dockbay
v0.0.0
Published
Backend driver substrate for primitive store adapters.
Downloads
138
Maintainers
Readme
DockBay TS
DockBay is the TypeScript backend driver substrate for agent-fabric store adapters. It defines a small transactional key-value row contract and ships memory, Convex-operation, and Postgres implementations.
This repo publishes the unscoped npm package dockbay.
Install
pnpm add dockbayAPI
The TypeScript and Python packages expose the same concepts:
RowScanOptionsTransactionStoreDriverMigrationSetcanonicalizekeyOfmatchesPrefixcompareRows- in-memory driver
- Convex operation host and operation driver
- Postgres driver
TypeScript exposes core types from dockbay and adapters from subpaths:
dockbaydockbay/memorydockbay/convexdockbay/postgres
Python exposes the same concepts from the dockbay package root with snake_case
function names.
Usage
import { createInMemoryDriver } from "dockbay/memory";
const driver = createInMemoryDriver();
await driver.transaction(async (txn) => {
await txn.upsert(
"runs",
{ tenantId: "tenant_demo", runId: "run_001" },
{ tenantId: "tenant_demo", runId: "run_001", status: "ok" },
);
const row = await txn.get("runs", {
tenantId: "tenant_demo",
runId: "run_001",
});
console.log(row);
});
await driver.close();Postgres
import { Pool } from "pg";
import { createPostgresDriver } from "dockbay/postgres";
const pool = new Pool({ connectionString: process.env.DOCKBAY_TEST_POSTGRES_URL });
const driver = createPostgresDriver(pool, { table: "store_driver_rows" });Mirror Contract
dockbay-ts and dockbay-py must preserve the same behavior:
upsertwrites a row by table and canonical key.getreads a row by table and canonical key.scanreturns rows whose keys match a prefix in canonical key order.scansupportsafterandlimit.compareAndApply/compare_and_applyupdates only when the stored value matches the expected value.canonicalizesorts object keys and omitsundefinedin TypeScript.
Development
pnpm install --frozen-lockfile
pnpm verify
pnpm build
npm pack --dry-runPostgres tests run when DOCKBAY_TEST_POSTGRES_URL is set.
