@enc-protocol/plugin-dataview-base
v0.9.0
Published
Default reference impls for the protocol-level DataView slots (SqlExecutor, DataViewIngest, WireDecrypt, DataViewProjection). The generated per-app DataView Worker imports these helpers — apps can swap any of them by passing alternative impls into the reg
Downloads
90
Readme
@enc-protocol/plugin-dataview-base
An infrastructure plugin that fills 6 server-side DataView protocol
slots with the canonical CF-Worker + D1 implementation. Used by
every dataview Worker emitted by impl-cli's codegen.
Slots filled
| Slot | Default behavior |
|-------------------------|--------------------------------------------------------|
| SqlExecutorFn | D1 query execution via the bound D1 database |
| DataViewIngestFn | Append events to D1 + invoke projections |
| WireDecryptFn | Decrypt incoming envelopes (uses bound crypto plugins) |
| DataViewProjectionFn | Per-table projection rebuild from the event log |
| RequestAuthFn | Ed25519 signature verification of inbound requests |
| PluginMatcherFn | Match incoming events to bindable plugin slots |
Usage
import { ServerDataview } from '@enc-protocol/plugin-runtime';
import * as defaults from '@enc-protocol/plugin-dataview-base';
const dataview = new ServerDataview({
bindings: defaults.bindings,
// ...
});Most apps don't bind this manually — the dataview codegen emitter in
impl-cli/lib/codegen/dataview-codegen.mjs wires it in
automatically.
When to swap
These slots are tightly coupled to the CF Workers + D1 deployment model. For alternate backends (Postgres, SQLite via Drizzle, etc.) write a parallel plugin.
CF compatibility
- Worker + D1 primitives
cf_compatible: true
