ObjectStackObjectStack

Metadata Loader

Metadata Loader protocol schemas

Metadata Manager Configuration

How the runtime MetadataManager is wired: which datasource backs sys_metadata, what to fall back to when that datasource is unreachable, cache / watch / validation settings, and the persistence write gates.

The loader and watch envelope types (MetadataFormat, MetadataStats, MetadataLoadOptions, MetadataWatchEvent, MetadataLoaderContract, …) are NOT here — they live in @objectstack/spec/system (system/metadata-persistence.zod), which is their single source.

Source: packages/spec/src/kernel/metadata-loader.zod.ts

TypeScript Usage

import { MetadataFallbackStrategySchema, MetadataManagerConfigSchema } from '@objectstack/spec/kernel';
import type { MetadataFallbackStrategy, MetadataManagerConfig } from '@objectstack/spec/kernel';

// Validate data
const result = MetadataFallbackStrategySchema.parse(data);

MetadataFallbackStrategy

Allowed Values

  • filesystem
  • memory
  • none

MetadataManagerConfig

Properties

PropertyTypeRequiredDescription
datasourcestringoptionalDatasource name reference for database persistence
tableNamestringoptional (default: "sys_metadata")Database table name for metadata storage
fallbackEnum<'filesystem' | 'memory' | 'none'>optional (default: "none")Fallback strategy when datasource is unavailable
rootDirstringoptionalRoot directory path
formatsEnum<'yaml' | 'json' | 'typescript' | 'javascript'>[]optional (default: ["typescript","json","yaml"])Enabled formats
cache{ enabled: boolean; ttl: integer; maxSize?: integer; databaseLoader?: object }optionalCache settings
watchbooleanoptional (default: false)Enable file watching
watchOptions{ ignored?: string[]; persistent: boolean; ignoreInitial: boolean }optionalFile watcher options
validation{ strict: boolean; throwOnError: boolean }optionalValidation settings
loaderOptionsRecord<string, any>optionalLoader-specific configuration
persistence{ writable: boolean }optionalPersistence write gates

Nested Shape: MetadataManagerConfig.cache

PropertyTypeRequiredDescription
enabledbooleanoptional (default: true)Enable caching
ttlintegeroptional (default: 3600)Cache TTL in seconds
maxSizeintegeroptionalMax cache size in bytes
databaseLoader{ enabled: boolean; maxSize: integer; ttl: integer }optionalDatabaseLoader read-through cache

Nested Shape: MetadataManagerConfig.watchOptions

PropertyTypeRequiredDescription
ignoredstring[]optionalPatterns to ignore
persistentbooleanoptional (default: true)Keep process running
ignoreInitialbooleanoptional (default: true)Ignore initial add events

Nested Shape: MetadataManagerConfig.validation

PropertyTypeRequiredDescription
strictbooleanoptional (default: true)Strict validation
throwOnErrorbooleanoptional (default: true)Throw on validation error

Nested Shape: MetadataManagerConfig.persistence

PropertyTypeRequiredDescription
writablebooleanoptional (default: true)Allow base metadata writes via register()
overlayWritableneveroptional[REMOVED] persistence.overlayWritable was removed from MetadataManagerConfig in @objectstack/spec 17 (ADR-0049 enforce-or-remove) — the only thing it gated was MetadataManager.saveOverlay(), a paper-protocol method no route or UI ever called, removed with the metadata-customization protocol (ADR-0126 supersedes it on the record). Delete the key. The base write gate that remains is persistence.writable; the real org-overlay writes (ADR-0005) ride the REST meta write doors' manage_metadata permission gate, not this flag.

On this page