/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { EnvMap } from '../../src/env.js'; import type { MysqlPool } from '../../src/engines/mysql.js'; import type { PgPool } from '../../src/engines/postgres.js'; import type { Clock, Digest, Store } from '../../src/ports.js'; /** One matrix adapter: a test-title name and a factory returning a fresh, isolated store. */ export type AdapterCase = { name: string; makeStore: () => Promise; }; /** * The suite URL policy over src/env.ts: Postgres falls back to the compose-local default (each * suite's reachability probe turns absence into a skip); MySQL runs only when something names it. */ export declare function testPostgresUrl(env: EnvMap): string; /** As {@link testPostgresUrl}; null (nothing names MySQL) means the suite skips or registers nothing. */ export declare function testMysqlUrl(env: EnvMap): string | null; export declare function freshName(prefix: string): string; export declare function safeDatabaseName(name: string): string; export declare function withDatabase(url: string, database: string | null): string; export declare function isStaleThrowaway(name: string, all?: boolean): boolean; /** * Drops every stale throwaway namespace reachable through a Postgres URL: el_* schemas in the * connected database, plus the pid-named integration databases. Returns the names it dropped. */ export declare function sweepStalePostgres(url: string, all?: boolean): Promise; /** As {@link sweepStalePostgres}, for the el_* throwaway databases on a MySQL server. */ export declare function sweepStaleMysql(url: string, all?: boolean): Promise; export declare function maybeSweep(engine: 'postgres' | 'mysql', url: string): Promise; /** * A Postgres store on its own throwaway schema, dropped on close (postgresStore's `schema` * option does all of that). Shared by the conformance matrix and the bench harness, which * differ only in digest/clock and pool sizing. `driver: 'postgresjs'` mounts the wire-trial * postgres.js pool behind the store's driver seam instead of pg. */ export declare function makeIsolatedPostgresStore(opts: { url: string; digest: Digest; clock: Clock; poolMax?: number; connectionTimeoutMillis?: number; driver?: 'pg' | 'postgresjs'; /** Applied to the pool behind the store's driver seam — the profiler's statement tap. */ wrapPool?: (pool: PgPool) => PgPool; }): Promise; /** * A MySQL store on its own freshly created database, dropped on close — the isolated-MySQL * provisioning shared by the conformance matrix and the bench harness. Each store gets a whole * database of its own because concurrent stores re-running the schema against one shared * database could leave it half-applied. If setup throws partway, the same teardown runs, so no * pool or database leaks. */ export declare function makeIsolatedMysqlStore(opts: { url: string; digest: Digest; clock: Clock; connectionLimit?: number; driver?: 'mysql2' | 'mariadb'; /** Applied to the built pool at the driver seam — the profiler's statement tap. */ wrapPool?: (pool: MysqlPool) => MysqlPool; }): Promise; /** * The conformance matrix: a fresh-store factory per adapter, each wired with the same seeded * digest and fixed clock so identical inputs hash identically on every backend. Reachability is * not probed here; prove.ts and fuzz.ts probe each backend themselves. */ export declare function adapterMatrix(env: EnvMap): AdapterCase[];