UNPKG

@mwcp/kmore

Version:

midway component for knex, supports declarative transaction and OpenTelemetry

27 lines 1.58 kB
import { IMidwayContainer } from '@midwayjs/core'; import { TraceScopeType, TraceService } from '@mwcp/otel'; import { Application, Context } from '@mwcp/share'; import type { BuilderHookOptions, BuilderTransactingHookOptions, Kmore, KmoreTransaction, ResponseHookOptions } from 'kmore'; import { TrxStatusService } from '../trx-status.service.js'; import { DbConfig } from '../types.js'; export declare class DbHookBuilder<SourceName extends string = string> { private readonly sourceConfig; readonly app: Application; readonly applicationContext: IMidwayContainer; readonly appDir: string; readonly baseDir: string; readonly trxStatusSvc: TrxStatusService; readonly traceService: TraceService; builderPreHooks(options: BuilderHookOptions): void; builderPostHook(options: BuilderHookOptions): Promise<void>; protected builderPrePropagating(options: BuilderHookOptions): void; protected builderPostPropagating(options: BuilderHookOptions): Promise<void>; builderResultPreHook(options: ResponseHookOptions): Promise<void>; builderTransactingPostHook(this: DbHookBuilder, options: BuilderTransactingHookOptions): void; protected getTrxTraceScopeByQueryId(db: Kmore, queryId: symbol): TraceScopeType | undefined; protected getDbConfigByDbId(dbId: SourceName): DbConfig | undefined; protected getWebContext(): Context | undefined; protected getWebContextThenApp(): Context | Application; protected getTraceScopeByTrx(transaction: KmoreTransaction): TraceScopeType; } //# sourceMappingURL=db-hook.builder.d.ts.map