Db
Path:
codemode-gateway/src/providers/db.tsRelative: src/providers/db.tsSubproject: codemode-gatewayCategory: codemode-gatewayLines: 148Bytes: 5,353Imports: 1Exports: 2
Content Preview
- import type { Env } from "../types";
- /**
- * `db` namespace tools — generic SQL over the bound D1 database `env.DB`.
- *
- * Unlike the REST `cf.d1_*` path (which calls the Cloudflare API and needs a
- * D1-scoped `CF_API_TOKEN`), a D1 binding needs NO API token — the binding is
- * authorized at deploy time. This is the primary, always-available SQL path.
- *
- * Two tools, each with a parse-side SQL guard:
- * - `query({ sql, params? })` → SELECT rows only (rejects non-SELECT).
- * - `exec({ sql,