38 lines
3.5 KiB
Markdown
38 lines
3.5 KiB
Markdown
# Tasks — extend-better-auth-surrealdb-v1.6-adapter
|
|
|
|
## 1. Implementation
|
|
|
|
- [x] 1.1 Read installed `node_modules/better-auth/dist/index.d.mts` for `BetterAuthOptions.database` + `DBAdapterInstance` type
|
|
- [x] 1.2 Read `node_modules/@better-auth/core/dist/db/adapter/index.d.mts` for `createAdapterFactory` signature + every method the v1.6 `DBAdapter` requires
|
|
- [x] 1.3 Add `src/adapter/v1.6.{ts,test.ts,md}` exporting `betterAuthSurrealAdapter(options): DBAdapterInstance`; barrel updated in existing `src/adapter/index.ts`
|
|
- [x] 1.4 v1.6.ts internals:
|
|
- [x] 1.4.1 Zod-validate `options` via the existing `BetterAuthSurrealAdapterOptionsSchema`
|
|
- [x] 1.4.2 Build the underlying 10-method adapter via `createBetterAuthSurrealAdapter(options)`
|
|
- [x] 1.4.3 Return `(betterAuthOptions) => createAdapterFactory(...)` wired with CRUD forwarders, schema literal, and tx-aware transaction
|
|
- [x] 1.4.4 OTel: emit `better_auth.surrealdb.operations_total{model: "_transaction", operation: "transaction", outcome}` per `transaction()` invocation
|
|
- [x] 1.5 Add subpath export `./adapter/v1.6` to `package.json` `exports`
|
|
- [x] 1.6 Re-export `betterAuthSurrealAdapter` + `BetterAuthSurrealAdapterV16Options` type from `src/index.ts` (named exports only)
|
|
- [x] 1.7 Update `README.md` quick-start to lead with `betterAuthSurrealAdapter` v1.6; keep v1.4 surface in an "Advanced" section
|
|
|
|
## 2. Tests
|
|
|
|
- [x] 2.1 `src/adapter/v1.6.test.ts` — 11 unit scenarios covering the spec delta (factory shape; INVALID_INPUT for bad options; CRUD method existence; createSchema verbatim; errors propagate; createAsIsTransaction fallback; per-method round-trip; SurrealAdapter-branch transaction round-trip; transaction CRUD coverage)
|
|
- [x] 2.2 `src/adapter/v1.6.spec-conformance.test.ts` — `expectTypeOf` confirms the return type satisfies Better-Auth's `DBAdapterInstance`
|
|
- [x] 2.3 Extend `tests/integration/conformance.test.ts` with v1.6 smoke describe block (the full v1.4-shape harness is incompatible with the v1.6 wrapper because Better-Auth's `transformInput` whitelists fields against an in-memory schema that uses column names different from the bundled SurrealQL schema — see end-to-end test for the production signal)
|
|
- [x] 2.4 Add `tests/integration/better-auth-end-to-end.test.ts` — `betterAuth({ database: betterAuthSurrealAdapter({ client }), … })` → `auth.api.signUpEmail` round-trip against a real SurrealDB testcontainer; asserts `user` and `account` rows landed
|
|
- [x] 2.5 All new tests via `@suaveplan/testing/runner`, `{ timeout: 5000 }` (60000 for integration)
|
|
|
|
## 3. Gates
|
|
|
|
- [x] 3.1 `bunx turbo lint typecheck test --filter=@suaveplan/better-auth-surrealdb --force` → green
|
|
- [x] 3.2 Coverage 100/100/100/100 on the new v1.6 path (`bunx vitest run --coverage src/ tests/dep-graph.test.ts tests/property.test.ts`)
|
|
- [x] 3.3 `bun scripts/openspec-conformance.ts @suaveplan/better-auth-surrealdb` → PASS (0 error)
|
|
- [x] 3.4 `bunx turbo build --filter=@suaveplan/better-auth-surrealdb --force` → green; `dist/adapter/v1.6.{js,d.ts}` emitted and resolves via the new `./adapter/v1.6` subpath
|
|
- [x] 3.5 Banned-pattern + no `export *` + no direct runner imports (`bun scripts/lint/check-test-runner-imports.ts` → green)
|
|
|
|
## 4. Archive
|
|
|
|
- [x] 4.1 Fold spec → append the 5 new requirements to canonical `openspec/specs/better-auth-surrealdb/spec.md`
|
|
- [x] 4.2 mv change → `openspec/archive/2026-05-18-extend-better-auth-surrealdb-v1.6-adapter/`
|
|
- [x] 4.3 DO NOT refresh MANIFEST or STATUS — orchestrator consolidates after the chain
|