/** * ObjectQL Bridge Class * Copyright (c) 2026-present ObjectStack Inc. * * Extends the upstream @objectstack/objectql.ObjectQL engine with: * - Legacy constructor config (datasources map) * - MetadataRegistry integration (for ObjectLoader filesystem loading) * * This allows existing consumers to keep using: * const app = new ObjectQL({ datasources: { default: driver } }); * const loader = new ObjectLoader(app.metadata); * await loader.load(dir); * await app.init(); */ import { ObjectQL as UpstreamObjectQL } from '@objectstack/objectql'; import type { ServiceObject } from '@objectstack/spec/data'; import type { DriverInterface } from '@objectstack/core'; import { MetadataRegistry } from '@objectql/types'; import type { Driver } from '@objectql/types'; /** * Legacy config shape accepted by the ObjectQL bridge constructor. */ export interface ObjectQLConfig { datasources?: Record; [key: string]: unknown; } /** * ObjectQL — drop-in replacement that bridges the upstream engine * with the @objectql/types MetadataRegistry used by ObjectLoader. */ export declare class ObjectQL extends UpstreamObjectQL { /** * Filesystem metadata registry populated by ObjectLoader. * After calling loader.load(), call app.init() to sync these * entries into the upstream SchemaRegistry & driver layer. */ readonly metadata: MetadataRegistry; /** Typed self-reference for compat methods */ private get compat(); private pendingDrivers; registerObject: (schema: ServiceObject, packageId?: string, namespace?: string) => string; constructor(config?: ObjectQLConfig); /** * Initialize the engine. * * Before calling the upstream init (which connects drivers and syncs schemas), * bridge all objects loaded via ObjectLoader into the upstream SchemaRegistry. */ init(): Promise; /** * Sync all filesystem-loaded metadata into the upstream SchemaRegistry. * Called automatically by init(), but can also be called manually. */ private syncMetadataToRegistry; /** * Get an object definition by name. * * Checks the upstream SchemaRegistry first, then falls back to the * local MetadataRegistry for objects loaded via ObjectLoader but * not yet synced (i.e., init() hasn't been called yet). */ getObject(name: string): ServiceObject | undefined; /** * Get all registered object configs as a name→config map. * * Merges results from the upstream SchemaRegistry with the * local MetadataRegistry (for pre-init objects). */ getConfigs(): Record; /** * Remove all hooks, actions, and objects contributed by a package. * Also cleans up the local MetadataRegistry. */ removePackage(packageId: string): void; }