@splithub/adapter-d1
v0.5.1
Published
Cloudflare D1 store for self-hosted SplitHub experiments and analytics from websites and apps on Workers, with an in-memory D1 for tests.
Maintainers
Readme
@splithub/adapter-d1
Store implementation on Cloudflare D1. Used by SplitHub Cloud and by
self-hosters running the ingest handler on Workers.
import { d1Store, d1Schema } from '@splithub/adapter-d1';
const store = d1Store(env.DB, { project: projectId });
// apply d1Schema() once as a migrationEvents from apps keep their platform (ios, android ...; web for websites) and
app_version. A table made by an older d1Schema() gets the two columns on the first insert;
d1Migrations() returns the same ALTER statements if you prefer a migration.
@splithub/adapter-d1/testing exports sqliteD1(), a D1-shaped shim over
Node's built-in SQLite for unit tests.
