Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.5 KiB
@suaveplan/api-tenant-provider-memory - In-memory reference implementation of @suaveplan/api-tenant-provider TenantProvider. Backed by an insertion-ordered Map<TenantId, TenantRecord>, ships stable base64url-JSON cursor pagination, active/suspended/archived filtering matching the abstract contract, out-of-band add/remove/clear admin helpers, idempotent dispose, Zod-validated TenantRecord seeds, and the TENANT_PROVIDER_MEMORY.* error registry (DUPLICATE_TENANT, TENANT_NOT_FOUND, INVALID_RECORD). Passes runTenantProviderConformance verbatim. Used by @suaveplan/api test hosts and small static-tenant deployments.
In-memory reference implementation of the
@suaveplan/api-tenant-provider TenantProvider contract. Backed by
an insertion-ordered Map<TenantId, TenantRecord>. Production-grade
for small static-tenant deployments AND reference-grade for the
downstream DB-backed adapters (Stage 8) that ship the same contract.
The API testing kit (createTestHost) uses this provider by
default so unit tests never need a database.
Documentation tree
- error-codes — The in-memory
TenantProvideradapter has its own narrow error namespace, distinct from the abstract `TENANT_PROVIDER.…- error-codes — The in-memory
TenantProvideradapter has its own narrow error namespace, distinct from the abstract `TENANT_PROVIDER.…
- error-codes — The in-memory
- provider — In-memory reference implementation of the
@suaveplan/api-tenant-providerTenantProvidercontract. It is both the de…- provider — In-memory reference implementation of the
@suaveplan/api-tenant-providerTenantProvidercontract. It is both the de…
- provider — In-memory reference implementation of the
What ships
| Subpath | Module | Doc |
|---|---|---|
./provider |
createMemoryTenantProvider({ tenants? }) + admin helpers |
src/provider/provider.md |
./error-codes |
TENANT_PROVIDER_MEMORY_CODES + TenantProviderMemoryError |
src/error-codes/error-codes.md |
Surface
createMemoryTenantProvider(options?)— factory returning aMemoryTenantProvider(the abstractTenantProviderinterface plus out-of-bandadd/remove/clearadmin helpers).- Active-only filtering by default;
list({ includeSuspended: true })surfaces suspended tenants;archivedis reachable only throughlookup. - Cursor pagination via the canonical
@suaveplan/api-tenant-provider/paginationcodec — cursors produced by this provider round-trip with the abstract decoder.
Conformance
The package's own test file calls
runTenantProviderConformance({ label: "memory", factory: ... }) so
every invariant of the abstract contract is verified against this
adapter on every CI run.
Error namespace
TENANT_PROVIDER_MEMORY.* — three codes:
DUPLICATE_TENANT— seed oradd()collision.TENANT_NOT_FOUND—remove()of unknown id.INVALID_RECORD— schema failure at the boundary.
Errors that the abstract contract itself can raise
(TENANT_PROVIDER.INVALID_CURSOR) flow through unchanged from
@suaveplan/api-tenant-provider.
Out of scope
- DB-backed enumeration — Stage 8
api-tenant-provider-postgres/api-tenant-provider-surrealdb. - Persistence across process restarts — every
createMemoryTenantProvidercall starts from the supplied seed.
Stage
Stage 4 (Base adapters) of the API plugin system umbrella — see the design document.