Skip to content

feat: adapter interface contract for ORM adapters#18

Merged
ssilvius merged 1 commit intomainfrom
feat/16-adapter-interface
Apr 13, 2026
Merged

feat: adapter interface contract for ORM adapters#18
ssilvius merged 1 commit intomainfrom
feat/16-adapter-interface

Conversation

@ssilvius
Copy link
Copy Markdown
Contributor

Summary

Defines LedgerAdapter<TDb, TAuditTable, TQueryFilter> interface in src/core/adapter.ts. Any ORM adapter (Drizzle, Kysely, future) must implement this contract.

Four capability groups, 7 methods:

  • Query filters: notDeleted, onlyDeleted
  • Audit operations: insertAuditEntry, getRecordHistory
  • GDPR: purgeUserData, isUserDataPurged
  • Soft-delete automation: createAuditedDb

Type-level test confirms the Drizzle adapter satisfies the interface.

Excluded from contract (adapter-specific): AuditLogger (Drizzle Logger), convenience wrappers (logInsert etc.), includingDeleted() (tautology).

Test plan

  • pnpm preflight passes
  • Drizzle adapter satisfies LedgerAdapter via type-level test

Introduces LedgerAdapter<TDb, TAuditTable, TQueryFilter> in src/core/adapter.ts
that codifies the methods any ORM adapter must implement: query filters
(notDeleted, onlyDeleted), audit operations (insertAuditEntry, getRecordHistory),
GDPR (purgeUserData, isUserDataPurged), and soft-delete automation (createAuditedDb).
Includes a type-level compatibility test verifying the Drizzle adapter satisfies
the interface via satisfies and assignment checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ssilvius ssilvius merged commit 7448d9c into main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: adapter interface contract

1 participant