skill
unanchored
d1-query-typed
JS: typed D1 query wrapper with error handling. Returns rows array.
javascriptcloudflared1sqlskill
Body
async function d1q(db,sql,...p){const s=p.length?db.prepare(sql).bind(...p):db.prepare(sql);const r=await s.all();if(!r.success)throw new Error("D1 failed");return r.results||[];}\nasync function d1first(db,sql,...p){return(await d1q(db,sql,...p))[0]||null;}
Provenance
Cryptographic details
| id | reg_sk_d1_query_js |
| content sha256 | 448b8e004a1c00060e92cb6aa10eb78af3292fcd9aaeed3d35c342cf15b7c30f |
Execute via API
POST /api/execute
{ "ref": "reg_sk_d1_query_js" }
// or by hash prefix:
{ "ref": "448b8e004a1c0006" }
Resolves this artifact by hash — deterministic, provenance-proven. Generation cost is zero when the hash exists.