# Typed HTTP and D1 adapters The SDK 0.5.59 candidate supplies `createWebEffectAdapters` for explicit trusted host capabilities. It never falls back to ambient fetch or a database. The factory returns adapter definitions, their typed interfaces and versions, and a metadata-only snapshot. The finite private web-profile installation is independently accepted. Whole-SDK public distribution is still pending, and the public native and Wasm downloads are unchanged. The three adapters are `http.request` with `network.http`, `d1.query` with `storage.read`, and `d1.execute` with `storage.write`. Actual runtime capabilities are checked before dispatch. Source DATA cannot grant permission, supply a fetch function or choose a database handle. HTTP destinations use exact allowed origins and the shared strict URL policy. Requests omit cookies and refuse redirects. Trusted host headers can carry credentials; source headers cannot replace them. Returned data exposes only status, an allowlist of response headers and a fully admitted UTF-8 body. Response bytes are read incrementally and an excess result is refused without truncation. D1 statements are named and supplied by the host. Parameter and result-column schemas declare Int, Float or Text and optional nullability. Values are passed through `prepare(sql).bind(...values)` in the declared order; source values never become SQL syntax. A statement's read/write classification is a host assertion that must be audited with its SQL. Each factory tracks writes before their first host interaction. A completed request can return its saved admitted result without another native call. Reusing an operation ID for a different request refuses. A pending or unknown operation fences new writes across both HTTP and D1. Reads may continue. Cancellation after dispatch, a rejected callback or an invalid write response leaves the result unknown. A late successful callback does not clear that state. The adapter retains the original cause, uses safe fixed diagnostic text and never retries. A new factory is not a recovery procedure. This registry is memory-only and scoped to one factory. Durable applications must retain authority and outcomes through the existing durable service journal. Optional host quotas add admission controls; existing DATA ingress remains explicit. These counters are not heap or process limits. The official namespace passed 80 adapter scenarios and six additional compiler-to-runtime scenarios. The latter use the factory interfaces and adapters directly, including capability refusal before a host call and a completed write replay. Those controlled tests made no real outbound, D1 or model calls. A separate disposable local Miniflare/workerd run has eight independently accepted cases and 90 controller assertions. It used an actual local D1 binding: four selected `all()` calls and one selected `run()` call, with five prepares and binds. Fresh schema creation and the two-row seed batch are accounted separately. The checks preserved the complete rows after a bound SQL-looking Text value, returned a saved write result without a native replay, refused a conflicting operation ID and enforced the Source capability before a host call. Its original Document HTTP response was verified in full at 1 MiB. This is local synthetic integration, not a production Cloudflare deployment or crash-durable write registry. See [web applications](web-application.md) and [the cloud host](https://soloncode.solonsky.net/docs/cloud-service-host.md). ## Calling from source ```solon solonsky SourceCall { use d1; input request: Record; derive result: Record = d1.query(request); output result; } ``` Compile with the factory interfaces and execute with its original adapters and explicit `storage.read` capability. The SDK names follow the existing `module.function` syntax; applications do not need an alias layer. ```js import {compileModule, execute} from 'soloncode'; import {createWebEffectAdapters} from 'soloncode/web'; // env.DB is the trusted host's explicit D1 binding. const factory = createWebEffectAdapters({ hostVersion: 'application-d1-v1', d1: env.DB, statements: { find: { sql: 'SELECT id, label, score FROM entries WHERE score >= ?1 ORDER BY id', kind: 'read', params: [{name: 'minimumScore', type: 'Float'}], columns: {id: {type: 'Int'}, label: {type: 'Text'}, score: {type: 'Float'}}, }, }, }); const program = compileModule(source, {profile: 'web', interfaces: factory.interfaces}); const receipt = await execute(program, { request: {statement: 'find', params: {minimumScore: 0.5}}, }, {adapters: factory.adapters, capabilities: ['storage.read']}); console.log(receipt.outputs.result.rows); ``` The host supplies the source text shown above and owns the binding, SQL and permission. `http.request` and `d1.execute` follow the same direct interface pattern with their respective declared capabilities. A serialized receipt observation does not become a live receipt handle or host authority.