Driver Memory schema — Data Protocol reference
Defines the configuration options for the in-memory driver. Reference: objectql/packages/drivers/memory (Mingo-powered production-ready driver).
Memory Driver Configuration Schema
Defines the configuration options for the in-memory driver. Reference: objectql/packages/drivers/memory (Mingo-powered production-ready driver)
The memory driver is ideal for:
- Unit testing (no database setup required)
- Development & prototyping
- Edge/Worker environments (Cloudflare Workers, Deno Deploy)
- Client-side state management
- Temporary data caching
- CI/CD pipelines
Source: packages/spec/src/data/driver/memory.zod.ts
TypeScript Usage
import { AutoPersistenceConfigSchema, FilePersistenceConfigSchema, LocalStoragePersistenceConfigSchema, PersistenceTypeSchema } from '@objectstack/spec/data';
import type { AutoPersistenceConfig, FilePersistenceConfig, LocalStoragePersistenceConfig, PersistenceType } from '@objectstack/spec/data';
// Validate data
const result = AutoPersistenceConfigSchema.parse(data);AutoPersistenceConfig
Auto-detect persistence configuration
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | 'auto' | ✅ | |
| path | string | optional | File path override for Node.js environments |
| autoSaveIntervalMs | number | optional | Auto-save interval override for Node.js environments, in milliseconds |
| autoSaveInterval | never | optional | [REMOVED] AutoPersistenceConfig.autoSaveInterval was renamed to autoSaveIntervalMs in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to autoSaveIntervalMs; the value (milliseconds) is unchanged. Run os migrate meta --from 17 to list the mechanical edits for existing sources; --write applies the ones it can prove, and you apply the rest by hand. |
| key | string | optional | localStorage key override for browser environments |
FilePersistenceConfig
File-system persistence configuration
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | 'file' | ✅ | |
| path | string | optional | File path to persist data |
| autoSaveIntervalMs | number | optional (default: 2000) | Auto-save interval in ms |
| autoSaveInterval | never | optional | [REMOVED] FilePersistenceConfig.autoSaveInterval was renamed to autoSaveIntervalMs in @objectstack/spec 17 — the unit of a duration-shaped number lives in the key name, not only in the describe prose. Rename the key to autoSaveIntervalMs; the value (milliseconds) and the 2000 default are unchanged. Run os migrate meta --from 17 to list the mechanical edits for existing sources; --write applies the ones it can prove, and you apply the rest by hand. |
LocalStoragePersistenceConfig
localStorage persistence configuration
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | 'local' | ✅ | |
| key | string | optional | localStorage key for persisted data |
PersistenceType
Persistence backend type
Allowed Values
filelocalauto