import "./telemetry"; import "reflect-metadata"; import type { DataSource, DataSourceOptions, EntityManager } from "typeorm"; import type { EnvironmentConfig } from "./config"; import { AnyEntityManager } from "./lib/NestableTransaction"; export * from "./lib/NestableTransaction"; export declare const defaultDatabaseName: (config: EnvironmentConfig) => string; /** The name of one of the database connections configured in the app's starscream.config.ts */ export type ConnectionName = "main" | string; /** * Merge all the different spots where connection options can come from to produce a final option set for a given connection name **/ export declare const starscreamConnectionOptions: (connectionName: ConnectionName, config?: EnvironmentConfig, optionSets?: Partial[]) => DataSourceOptions; /** * Run a callback with a new entity manager that executes queries against a replica. */ export declare const withQueriesOnReplicas: (db: Manager, run: (db: Manager) => Promise) => Promise; /** * Get the list of database connections (as options objects) that should have database created and dropped. The app config specifies this using the `createDatabase` option in the config */ export declare const connectionsForDatabaseManagement: (config?: EnvironmentConfig) => string[]; /** * Create a new connection using the base options for the given connection name * @private */ export declare const createNewConnection: (connectionName: ConnectionName, overrideOptions?: Partial, config?: EnvironmentConfig) => Promise; /** * Create a new superuser connection for use in development/test. Throws in production -- we don't use superuser connections in production. * @private */ export declare const createNewSuperuserConnection: (connectionName: ConnectionName, overrideOptions?: Partial, config?: EnvironmentConfig) => Promise; /** * Create a new connection that can run longer queries and do DDL. * @private */ export declare const createNewUtilityConnection: (connectionName: ConnectionName, overrideOptions?: Partial, config?: EnvironmentConfig) => Promise; /** * Get or create the global connection for a given connection name * @public */ export declare const defaultConnection: (connectionName: ConnectionName, overrideOptions?: Partial, config?: EnvironmentConfig) => Promise; /** * Get or create the global superuser connection for this process * @public */ export declare const superuserConnection: (connectionName: ConnectionName) => Promise; /** * Get or create the global utility connection for a given connection name * @public */ export declare const utilityConnection: (connectionName: ConnectionName) => Promise; /** * Test helper for resetting the connection memos */ export declare const resetConnectionMemos: () => void; export declare const createDatabaseIfNotExists: (connectionName: ConnectionName) => Promise; /** Drop all of the given tables */ export declare const dropAll: (connection: DataSource, tableNames: string[]) => Promise; /** Delete all persisted data for known entities */ export declare const truncateAll: (connection: DataSource) => Promise; /** Resets all sequence values back to 1 for stable identifiers after a fixture reset or similar */ export declare const resetAllSequences: (connection: DataSource) => Promise; /** * Restores a given DB from a template database. * * The backup DB will first be dropped, if it exists. */ export declare const restoreDatabaseFromBackup: (dbName: string, backupName: string) => Promise; /** * Restore all sharded and core databases from their backups. */ export declare const restoreAllDatabasesFromBackups: () => Promise; /** * Restores a given DB from a template database, if the template DB exists. * * @see {@linkcode restoreDatabaseFromBackup} */ export declare const restoreDatabaseFromBackupIfExists: (dbName: string, backupName: string) => Promise; /** Drop any Postgres logical replication subscriptions that exist on the given connection */ export declare const dropAllSubscriptions: (connection: DataSource) => Promise; /** Drop any Postgres logical replication slots that exist on the given connection */ export declare const dropAllReplicationSlots: (connection: DataSource) => Promise; /** Drop any Postgres logical replication publications that exist on the given connection */ export declare const dropAllPublications: (connection: DataSource) => Promise; export declare const resetLogicalReplication: () => Promise;