Skip to content

Documentation · IGNIS

@venizia/ignis-connectors ​

Generated from the built declarations by vulcan x atlas api gen - do not edit.

3 exports, 3 with TSDoc. 134 more are re-exported from other entries (listed at the end).

AbstractDriverDataSource ​

class

A datasource that holds one client and a connector built over it through a driver: the lifecycle every connector family that talks to an external engine shares - wiring the driver named by @datasource({ driver }), closing once, soft-evicting the client after a secret rotation, draining a client by whichever verb its engine spells it with. No SQL members: the relational family adds its dialect, executor and transactions in AbstractRelationalDataSource, a raw-SQL engine adds nothing (BaseRawSqlDataSource). Transactions stay NotSupported, as in AbstractDataSource.

mapSecretToSettings is a driver-config convention, not Postgres SQL, so it belongs on this neutral base - do not move it down into a family.

ts
export declare abstract class AbstractDriverDataSource<Settings extends object = {}, Schema extends TAnyDataSourceSchema = TAnyDataSourceSchema, ConfigurableOptions extends object = {}, Client = unknown, TConnector = unknown, TDriver extends IConnectorDriver<TConnector, unknown> = IConnectorDriver<TConnector, Client>> extends AbstractDataSource<Settings, Schema, ConfigurableOptions> {
    connector?: TConnector;
    protected client?: Client;
    protected driver?: TDriver;
    private closePromise?;
    /**
     * Lazy and idempotent: builds the driver named by `@datasource({ driver })` over the client
     * `configure()` assigned, then the connector from it. Returns the connector.
     */
    protected wireDriverFromMetadata(): TConnector;
    /**
     * Rejects a driver-name string from untyped JS
     * callers: a string carries no module into the bundle.
     */
    protected resolveDriverClass(): TClass<TDriver>;
    protected resolveDriver(): TDriver;
    /**
     * Assigns `this.driver` AND builds `this.connector` in one step - a
     * driver without its connector is silently bypassed on pooled queries. Returns the connector.
     */
    protected useDriver(opts: {
        driver: TDriver;
        schema?: Schema;
    }): TConnector;
    /** A datasource that opens on first use has no client, driver or connector until the first call that needs it has awaited `ensureOpen()`. */
    private assertOpenForSyncUse;
    /** The handles `configure()` is given: the connector and the client through the ungated internals, so its own database work (migrations, seeding) needs no gate. */
    protected createOpening(): IDataSourceOpening<TConnector, Client>;
    /** Wires the driver on first use, so a `configure()` that only builds `this.client` is enough. */
    getConnector(): TConnector;
    /**
     * Raw driver client (`pg.Pool` / `Sql`). Throws rather
     * than handing back an `undefined` typed as `Client`.
     */
    getClient(): Client;
    private readClient;
    /**
     * Ends the connection `configure()` opened. Runs once: every later call returns the first call's
     * promise. Goes through the driver, wired now if nothing queried yet, because its `end()` is the
     * engine's whole teardown - PGlite also clears the exit status it plants on the host process.
     */
    close(): Promise<void>;
    /** Ends a client that a failed open left half-built and forgets the driver and connector, so the next open starts from nothing. */
    protected discardPartialOpen(): Promise<void>;
    private endConnection;
    /**
     * Soft-evicts the pool after a secret rotation: rebuilds against the rotated credentials without
     * touching live fields, swaps atomically, then drains the old pool. On failure live state is
     * restored, any half-built pool drained, and the error rethrown.
     */
    onSecretRotated(opts: {
        key: string;
        secret: Record<string, string>;
    }): Promise<void>;
    /** Puts `settings` back to the snapshot: a key the failed rotation added (the rotated `password`) is removed, not left behind. */
    private restoreSettings;
    /**
     * Shuts a client down by whichever verb its engine spells it with -
     * `pg.Pool` and postgres.js have `end()`, PGlite and libsql only `close()`.
     * Probed rather than type-tested: this tier must not name an engine, and a
     * client left undrained keeps a WASM instance or file handle alive forever.
     */
    protected drainClient(opts: {
        client: unknown;
    }): Promise<boolean>;
    /** Vault's database engine returns `{ username, password }`; pg expects `{ user, password }`. */
    protected mapSecretToSettings(opts: {
        secret: Record<string, string>;
    }): Record<string, unknown>;
}

Source: packages/connectors/src/common/driver-data-source.ts

IConnectorDriver ​

interface

What every connector driver supplies, whatever the engine: a connector built over its client, the raw client, and its teardown. A relational driver adds connection acquisition for transactions (IRelationalDriver); a raw-SQL driver adds nothing. configure() stays app-written: the framework never builds the driver for you.

ts
export interface IConnectorDriver<TConnector, Client = unknown> {
    createConnector(opts: {
        schema: TAnyDataSourceSchema;
    }): TConnector;
    getClient(): Client;
    end(): Promise<void>;
}

Source: packages/connectors/src/common/driver.ts

ScopeFilterUtility ​

class

Boot-time checks for models that declare settings.access (scope filtering).

ts
export declare class ScopeFilterUtility {
    /**
     * Why a `through` chain cannot work, or undefined. Walks from `name` toward the model that holds a resolver: every
     * hop needs a `one` relation with a single-column key, the parent needs an `access`, and the chain is at most
     * `ScopeThroughLink.MAX_DEPTH` hops with no model twice. A key with no index is a warning: it still works, slowly.
     */
    private static throughProblem;
    /**
     * Refuses to boot when `settings.access` is declared where it cannot be honoured. Both cases
     * are silent at runtime and fail in OPPOSITE directions: a search-backed model returns more rows,
     * a context-less one returns none. The caller supplies `asyncContextEnabled` so no application
     * config type reaches into this tier.
     */
    static assertScopeFilterSupported(opts: {
        asyncContextEnabled: boolean;
        logger?: ILogger;
    }): void;
}

Source: packages/connectors/src/common/scope-filter.ts

Re-exported ​