ObjectStackObjectStack

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

PropertyTypeRequiredDescription
type'auto'✅
pathstringoptionalFile path override for Node.js environments
autoSaveIntervalMsnumberoptionalAuto-save interval override for Node.js environments, in milliseconds
autoSaveIntervalneveroptional[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.
keystringoptionallocalStorage key override for browser environments

FilePersistenceConfig

File-system persistence configuration

Properties

PropertyTypeRequiredDescription
type'file'✅
pathstringoptionalFile path to persist data
autoSaveIntervalMsnumberoptional (default: 2000)Auto-save interval in ms
autoSaveIntervalneveroptional[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

PropertyTypeRequiredDescription
type'local'✅
keystringoptionallocalStorage key for persisted data

PersistenceType

Persistence backend type

Allowed Values

  • file
  • local
  • auto

On this page