LogoRobo.js
Framework

FlashcoreSystem

Variable: FlashcoreSystem

const FlashcoreSystem: {
  get config: Readonly<FlashcoreConfig>;
  get isInitialized: boolean;
  get schemasValidated: boolean;
  capabilities: AdapterCapabilities;
  checkIntegrity: Promise<{
     durationMs: number;
     isValid: boolean;
     models: IntegrityReport[];
    }>;
  createMigrationRunner: Promise<MigrationRunner>;
  extend: Promise<void>;
  flushIndexes: Promise<void>;
  getClientExtensions: Record<string, Record<string, unknown>>;
  getModel: FlashcoreModel<T>;
  getPluginContext: PluginContext;
  getRegisteredModels: Map<string, FlashcoreModel<{
     id: string;
    }>>;
  init: Promise<void>;
  introspect: FlashcoreIntrospection;
  metrics: FlashcoreMetrics;
  preload: Promise<void>;
  rebuildIndexes: Promise<void>;
  rebuildIndexesBackground: Promise<void>;
  registerModel: FlashcoreModel<T>;
  repair: Promise<FullRepairResult>;
  resetMetrics: void;
  runAutoRepair: Promise<{
     errors: string[];
     repaired: number;
    }>;
  schema: FlashcoreSchema;
  transaction: Promise<TransactionResult<T>>;
  validateSchemas: Promise<{
     changedModels: {
        name: string;
        safeChanges: SchemaChange[];
       }[];
     modelsValidated: number;
     newModels: string[];
    }>;
  verify: Promise<IntegrityReport>;
};

Flashcore.$ system API with Proxy wrapper.

The Proxy enables direct plugin client extension access:

  • Flashcore.$.realtime.getSubscriptionCount() instead of
  • Flashcore.$.getClientExtensions()['realtime'].getSubscriptionCount()

Type declaration

NameTypeDescription
get configReadonly<FlashcoreConfig>Get the current configuration (read-only). Throws FlashcoreError if not initialized
get isInitializedbooleanCheck if Flashcore is initialized.
get schemasValidatedbooleanCheck if schemas have been validated.
capabilities()AdapterCapabilitiesGet the current adapter capabilities. Throws FlashcoreError if not initialized
checkIntegrity()Promise<{ durationMs: number; isValid: boolean; models: IntegrityReport[]; }>Check integrity of all registered models. Validates derived index structures (filter, sorted indexes, unique indexes) against authoritative data (catalog, chunks).
createMigrationRunner()Promise<MigrationRunner>Create a migration runner for CLI operations.
extend()Promise<void>Register a plugin at runtime. This enables runtime plugin composition after initialization. The plugin's setup() hook will be called immediately.
flushIndexes()Promise<void>Flush all pending index changes to storage. Forces immediate persistence of all dirty indexes.
getClientExtensions()Record<string, Record<string, unknown>>Get client extensions for all plugins. Returns an object where each key is a plugin name and the value is that plugin's client extensions.
getModel()FlashcoreModel<T>Get a registered model by name.
getPluginContext()PluginContextGet plugin context by name.
getRegisteredModels()Map<string, FlashcoreModel<{ id: string; }>>Get all registered models. Returns a Map of model key to model instance.
init()Promise<void>Initialize Flashcore with the provided options. Must be called before using any Flashcore features. Idempotent: calling multiple times with the same options is safe.
introspect()FlashcoreIntrospectionGet introspection data about the current Flashcore state. Returns information about models, storage, plugins, and WAL status.
metrics()FlashcoreMetricsGet current metrics.
preload()Promise<void>Preload specified models into memory. Loads catalog, filter, and sorted indexes for the specified models. Useful when lazyLoading is enabled but you want to warm up specific models.
rebuildIndexes()Promise<void>Rebuild all indexes for a model (or all models). This completely rebuilds filter and sorted indexes from authoritative data.
rebuildIndexesBackground()Promise<void>Rebuild indexes for a model in the background. Builds new indexes without blocking queries, then atomically swaps the new indexes in place of the old ones.
registerModel()FlashcoreModel<T>Register a model with the given schema.
repair()Promise<FullRepairResult>Repair a specific model based on integrity check.
resetMetrics()voidReset all metrics counters.
runAutoRepair()Promise<{ errors: string[]; repaired: number; }>Run auto-repair based on configuration. Called after schema validation if autoRepair is enabled.
schema()FlashcoreSchemaGet a namespaced schema helper. Used by plugins to register models in isolated namespaces.
transaction()Promise<TransactionResult<T>>Execute a function within a transaction. Example const result = await Flashcore.$.transaction(async (ctx) => { const user = await ctx.read('user:123') ctx.set('user:123', { ...user, name: 'Updated' }) return user })
validateSchemas()Promise<{ changedModels: { name: string; safeChanges: SchemaChange[]; }[]; modelsValidated: number; newModels: string[]; }>Validate schemas of all registered models. Compares stored schema metadata checksums against current code checksums. - Safe changes are auto-applied - Breaking changes throw FlashcoreSchemaError Should be called after all models are registered (typically during app startup).
verify()Promise<IntegrityReport>Verify integrity of a specific model.

On this page