import { AsyncEventEmitter, type EventConfigByName } from '@prismamedia/async-event-emitter'; import * as core from '@prismamedia/graphql-platform'; import * as utils from '@prismamedia/graphql-platform-utils'; import * as mariadb from 'mariadb'; import * as semver from 'semver'; import type { Except } from 'type-fest'; import { MariaDBBroker, type MariaDBBrokerOptions } from './broker.js'; import { Schema, type ForeignKeyIndexConfig, type LeafColumnConfig, type ReferenceColumnTreeConfig, type SchemaConfig, type TableConfig, type UniqueIndexConfig } from './schema.js'; import { StatementKind, type Statement } from './statement.js'; export * as mariadb from 'mariadb'; export * from './broker.js'; export * from './escaping.js'; export * from './schema.js'; export * from './statement.js'; export type PoolConnection = mariadb.PoolConnection & { kind: TKind; } & AsyncDisposable; /** * @see https://mariadb.com/kb/en/ok_packet/ */ export type OkPacket = { affectedRows: number; insertId: bigint; warningStatus: number; }; export type MariaDBConnectorEventDataByName = { 'executed-statement': { statement: Statement; result: any; durationInSeconds: number; }; 'failed-statement': { statement: Statement; error: mariadb.SqlError; durationInSeconds: number; }; }; export interface MariaDBConnectorConfig { useCommonTableExpression?: boolean; charset?: string; collation?: string; version?: string; schema?: SchemaConfig; pool?: Except; on?: EventConfigByName; broker?: MariaDBBrokerOptions | MariaDBBrokerOptions['enabled']; } /** * @see https://mariadb.com/kb/en/nodejs-connector/ */ export declare class MariaDBConnector extends AsyncEventEmitter implements core.ConnectorInterface { #private; readonly gp: core.GraphQLPlatform; readonly config: MariaDBConnectorConfig; readonly configPath: utils.Path; readonly configOverrides?: { [core.ConnectorConfigOverrideKind.NODE]: { /** * Optional, customize the node's table */ table?: TableConfig; }; [core.ConnectorConfigOverrideKind.FEATURE]: { /** * Optional, customize the node's table */ table?: Pick; }; [core.ConnectorConfigOverrideKind.LEAF]: { /** * Optional, customize the leaf's column */ column?: LeafColumnConfig; }; [core.ConnectorConfigOverrideKind.EDGE]: { /** * Optional, customize the edge's columns' name */ columns?: ReferenceColumnTreeConfig; /** * Optional, customize the edge's foreign-key */ foreignKey?: ForeignKeyIndexConfig; }; [core.ConnectorConfigOverrideKind.UNIQUE_CONSTRAINT]: { /** * Optional, customize the unique-constraint's index */ index?: UniqueIndexConfig; }; }; readonly useCommonTableExpression: boolean; readonly poolConfig?: Except; readonly poolConfigPath: utils.Path; readonly charset: string; readonly collation: string; readonly version?: semver.SemVer; readonly schema: Schema; constructor(gp: core.GraphQLPlatform, config: MariaDBConnectorConfig, configPath?: utils.Path); get broker(): MariaDBBroker | undefined; getPool(kind?: StatementKind): mariadb.Pool & { kind: StatementKind; }; disconnect(): Promise; getConnection(kind?: TKind): Promise>; withConnection(task: (connection: PoolConnection) => Promise, kind?: TKind, maybeConnection?: PoolConnection): Promise; withConnectionInTransaction(task: (connection: PoolConnection) => Promise, kind?: TKind): Promise; executeQuery(query: string | mariadb.QueryOptions, values?: any, kind?: StatementKind): Promise; /** * Returns the first row, if any */ getRowIfExists(query: string | mariadb.QueryOptions, values?: any, kind?: StatementKind): Promise; /** * Returns the first row */ getRow(query: string | mariadb.QueryOptions, values?: any, kind?: StatementKind): Promise; /** * Returns the first column of the first row */ getColumn(query: string | mariadb.QueryOptions, values?: any, kind?: StatementKind): Promise; executeStatement(statement: Statement, connection?: PoolConnection, path?: utils.Path): Promise; ensureEventSchedulerIsEnabled(connection?: PoolConnection): Promise; /** * WARNING: For test-use only! * * It will DESTROY all the schema's structure & data */ setup(): Promise; /** * WARNING: For test-use only! * * It will DESTROY all the schema's structure & data */ teardown(): Promise; preMutation(context: core.MutationContext): Promise; /** * Gets the current mutation's transactional connection */ getConnectionForMutation(context: core.MutationContext): PoolConnection; postSuccessfulMutation(context: core.MutationContext): Promise; postFailedMutation(context: core.MutationContext, _cause: Error): Promise; postMutation(context: core.MutationContext): Promise; count(context: core.OperationContext, { node, ...statement }: core.ConnectorCountStatement, path?: utils.Path): Promise; find(context: core.OperationContext, { node, ...statement }: core.ConnectorFindStatement, path?: utils.Path): Promise; create(context: core.MutationContext, { node, ...statement }: core.ConnectorCreateStatement, path?: utils.Path): Promise; update(context: core.MutationContext, { node, ...statement }: core.ConnectorUpdateStatement, path?: utils.Path): Promise; delete(context: core.MutationContext, { node, ...statement }: core.ConnectorDeleteStatement, path?: utils.Path): Promise; } //# sourceMappingURL=index.d.ts.map