@resvary/sqlite
v1.3.0
Published
SQLite persistence for Resvary credits, usage receipts, and payment receipts
Downloads
1,394
Readme
@resvary/sqlite
SQLite persistence for Resvary credits, usage receipts, and stablecoin payment receipts.
import { CreditLedger } from '@resvary/sdk/credits';
import { createSqliteCreditStore } from '@resvary/sqlite';
const store = createSqliteCreditStore({ path: '.resvary/resvary.sqlite' });
const credits = new CreditLedger({ projectId: 'my_ai_product', store });On POSIX systems, newly created database directories use mode 0700, while the database,
WAL, and shared-memory files use mode 0600. On Windows, run the process under a dedicated
service account and restrict the database directory with NTFS ACLs.
The existing createSqliteReceiptStore remains available for payment invoices, receipts, webhook deliveries, and Arc watcher cursors. Both stores can use the same file.
Requires Node.js 24+ and local filesystem access. The credit store uses WAL, BEGIN IMMEDIATE, rollback-safe writes, and versioned schema metadata. Opening an older database applies migrations automatically. Schema v5 adds credit policies and verified legacy-lot backfill; schema v6 adds normalized admin query columns, timeline indexes, and the operator action journal; schema v7 adds durable metered operations. Version 1.3 schema v8 adds operation-list, transition-history, and targeted operator-action indexes.
