Memory
WIPEvery store in process memory, for tests and local runs
import { MemoryAdapter } from '@gentleduck/auth/adapters/memory'
const stores = new MemoryAdapter()
createAuth({ /* ... */ stores })
It holds identities, credentials, sessions and orgs in Maps and keeps the same contract as the SQL adapters, tenancy and uniqueness included, so a test against it exercises the engine as production runs it.
- Nothing survives a restart, and nothing is shared between processes.
strict({ env: 'production' })refuses it. - It has no
withClient, sowithTransactionrefuses it. seedOrg(row)plants an org, since the orgs store only reads.rawhands a test theMaps themselves, to plant a row no store call would write.- A fresh
new MemoryAdapter()per test is a clean database.
createTest() from @gentleduck/auth/test builds an engine over it for you; see Testing.