@dbsp/adapter-pgsql 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,723 +1,16 @@
1
- import { N as NamingPlugin, F as FkColumnDerivation, C as ChangeKind, G as GeneratedPostconditionSession, T as TransitionJournalQueryable, P as PgLockedRun, a as PgOutcomeCheckpointObserver, b as ConvergePgOptions$1, c as PgPhysicalModel, d as PgConvergeResult, e as PgConvergeCheckResult, f as PgLedgerScopeCurrency, r as readTransitionJournal } from './outcome-protocol-Dw5DYhnA.js';
2
- export { A as AddedEnumValue, g as AutoIncrementTransitionUnsupportedError, h as CamelCaseNamingPlugin, i as CanonicalizeCheckConstraintsOptions, j as CheckConstraintCanonicalizationError, k as CheckConstraintCanonicalizationWarning, l as CheckConstraintNewEnumValueError, m as ColumnDefaultCanonicalizationError, n as ColumnDefaultCanonicalizationWarning, o as ComparePgsqlDatabaseSchemaOptions, p as CompareSchemataOptions, D as DEFAULT_PK_COLUMN, q as DetectedHierarchy, s as DiffSummary, E as ExpressionCanonicalizationUnavailableError, t as ExpressionCanonicalizationWarning, u as ExpressionKeyedIndexPredicateCanonicalizationUnsupportedError, v as GenerateDDLOptions, w as GeneratedPostcondition, x as GeneratedPostconditionBindingAddress, y as GeneratedPostconditionBindingResolutionError, z as GeneratedPostconditionProofInFlightError, B as GeneratedPostconditionReplanRequiredError, H as GeneratedPostconditionSessionDeactivatedError, I as GeneratedPostconditionWorkInFlightError, J as IdentityNamingPlugin, K as IndexCapabilityContext, L as IndexFeatureUnsupportedError, M as IndexPredicateCanonicalizationError, O as IndexRenderSpec, Q as IntrospectedModelIR, R as IntrospectionOptions, S as MigrationSQLOptions, U as NonConvergentSchemaDiffError, V as NonConvergentSchemaDiffSurface, W as PG_LEDGER_SHAPE_VERSION, X as PartialIndexPredicateNewEnumValueError, Y as PgAdmittedOperation, Z as PgAdmittedOperationResult, _ as PgAdvisoryLockKey, $ as PgAdvisoryLockResult, a0 as PgApplicationStepOwnedState, a1 as PgApplicationStepTx, a2 as PgCatalogueIdentityQueryable, a3 as PgConvergeApplicationStep, a4 as PgConvergeAssertStep, a5 as PgConvergeInitializationFailure, a6 as PgConvergeOnceStep, a7 as PgConvergePlannedStep, a8 as PgConvergeRefusal, a9 as PgConvergeRefusalChange, aa as PgConvergeRefusalError, ab as PgLedgerLockResult, ac as PgLedgerStorageUnsupportedError, ad as PgLedgerTarget, ae as PgOutcomeCheckpoint, af as PgOutcomeClaimRequest, ag as PgOutcomeExecutionRequest, ah as PgOutcomeNonTransactionalRequest, ai as PgOutcomeReadBackFactory, aj as PgOutcomeRecoveryRequest, ak as PgOutcomeRecoveryResult, al as PgOutcomeResolution, am as PgOutcomeResolutionAppendResult, an as PgOutcomeResult, ao as PgOutcomeTransactionalRequest, ap as PgOwnedCheckState, aq as PgPhysicalModelInput, ar as PgPhysicalModelInputError, as as PgPhysicalNameClaim, at as PgPhysicalNameCollision, au as PgPhysicalNameCollisionError, av as PgPhysicalNamespace, aw as PgReinitializePreflightOptions, ax as PgReinitializePreflightPool, ay as PgSchemaDiff, az as PgsqlAdapter, aA as PgsqlAdapterOptions, aB as PgsqlAdvisoryLockOptionsError, aC as PgsqlBorrowedClientAdapterOptions, aD as PgsqlCompileOnlyAdapterOptions, aE as PgsqlPinnedConnectionAbortSignalError, aF as PgsqlPoolAdapterOptions, aG as PgsqlPreparedStatementReplayError, aH as PgsqlPreparedStatementsOptions, aI as PgsqlRawSqlTransactionControlError, aJ as PgsqlTransactionAbortSignalError, aK as PgsqlTransactionAbortedCommitError, aL as PgsqlTransactionAbortedError, aM as PgsqlTransactionOptionsError, aN as PgsqlTransactionTimeoutError, aO as RawIndexPredicateFallbackError, aP as ReferencedKeyKind, aQ as ReferencedKeyRemovalConflict, aR as ReferencedKeyRemovalError, aS as RollbackOnlyPgsqlScope, aT as SchemaChange, aU as SchemaDiff, aV as SchemaScopeOptions, aW as TransitionRunIdentityMismatchError, aX as acquirePgLedgerLocks, aY as appendIntentJournal, aZ as appendTransitionAuthorization, a_ as assertCreateIndexSupported, a$ as assertCreateIndexesSupported, b0 as assertDeclarableChangeKind, b1 as assertGeneratedPostconditionSession, b2 as assertNoRepeatedExpressionSurfaceDrift, b3 as camelCaseNaming, b4 as canGenerateCreateIndex, b5 as canonicalizeCheckConstraints, b6 as comparePgsqlDatabaseSchema, b7 as compareSchemata, b8 as createPgPhysicalModel, b9 as createPgTransitionRunPersister, ba as createPgsqlAdapter, bb as createPgsqlCompileOnlyAdapter, bc as createPgsqlGeneratedManagedStep, bd as decodeGeneratedPostcondition, be as decodeGeneratedPostconditionPayload, bf as defaultFkDerivation, bg as ensureDbspMetaLedger, bh as ensurePgLedger, bi as ensurePgLedgerStorageVersion, bj as ensureTransitionJournal, bk as executePgAdmittedOperation, bl as generateCreateIndex, bm as generateDDL, bn as generateDownSQL, bo as generateMigrationSQL, bp as generatedPostconditionDigest, bq as generatedPostconditionForChange, br as getNamingPluginForDbCasing, bs as identityNaming, bt as introspect, bu as readPgCatalogueIdentity, bv as readPgLedgerMarker, bw as readPgLedgerReservationsForExecution, bx as readPgLedgerScopeCurrency, by as readPgOutcomeRecoveryReadBack, bz as readVerifiedPgLedgerReservationsForPair, bA as recordPgLedgerIdentity, bB as renderCreateDbspMetaSchemaSql, bC as renderCreateIndex, bD as renderCreateLedgerEventTableSql, bE as renderCreateLedgerIdentityTableSql, bF as renderCreateLedgerImmutabilityFunctionSql, bG as renderCreateLedgerImmutabilityTriggerSql, bH as renderCreateLedgerMarkerTableSql, bI as renderCreateLedgerReservationTableSql, bJ as renderCreateLedgerTerminalMemberIndexSql, bK as renderCreateTransitionAuthorizationTableSql, bL as renderCreateTransitionJournalTableSql, bM as renderCreateTransitionRunPlanTableSql, bN as renderCreateTransitionRunTableSql, bO as runPgReinitializePreflight, bP as toGeneratedPostconditionBindingAddress, bQ as validatePgLedgerRuntimeIntegrity, bR as verifyGeneratedCheckPostcondition, bS as verifyGeneratedColumnPostcondition, bT as verifyGeneratedIdentityPostcondition, bU as verifyGeneratedIndexPostcondition, bV as verifyGeneratedTablePostcondition, bW as withGeneratedPostconditionSession } from './outcome-protocol-Dw5DYhnA.js';
3
- import * as _dbsp_core from '@dbsp/core';
4
- import { ExpressionRef, ModelIR as ModelIR$1, ValidatedManagedStepManifest, ExecutionCoordinator, CapabilityDescriptor } from '@dbsp/core';
1
+ import { C as ChangeKind, G as GeneratedPostconditionSession, S as SqlIdentifier, D as Decision, a as CompilerContext, b as CompilerState, P as ProjectionEnvelope, T as TransitionJournalQueryable, c as PgLockedRun, d as PgOutcomeCheckpointObserver, e as ConvergePgOptions$1, f as PgPhysicalModel, g as PgConvergeResult, h as PgConvergeCheckResult, i as PgLedgerScopeCurrency, r as readTransitionJournal } from './outcome-protocol-B3vRIj2q.js';
2
+ export { A as AddedEnumValue, j as AutoIncrementTransitionUnsupportedError, k as CanonicalizeCheckConstraintsOptions, l as CheckConstraintCanonicalizationError, m as CheckConstraintCanonicalizationWarning, n as CheckConstraintNewEnumValueError, o as ColumnDefaultCanonicalizationError, p as ColumnDefaultCanonicalizationWarning, q as ComparePgDatabaseSchemaOptions, s as CompareSchemataOptions, t as DEFAULT_PK_COLUMN, u as DetectedHierarchy, v as DiffSummary, E as ExpressionCanonicalizationUnavailableError, w as ExpressionCanonicalizationWarning, x as ExpressionHandler, y as ExpressionKeyedIndexPredicateCanonicalizationUnsupportedError, F as FkColumnDerivation, z as GenerateDDLOptions, B as GeneratedPostcondition, H as GeneratedPostconditionBindingAddress, I as GeneratedPostconditionBindingResolutionError, J as GeneratedPostconditionProofInFlightError, K as GeneratedPostconditionReplanRequiredError, L as GeneratedPostconditionSessionDeactivatedError, M as GeneratedPostconditionWorkInFlightError, N as IncludeHandler, O as IncludeResult, Q as IndexCapabilityContext, R as IndexFeatureUnsupportedError, U as IndexPredicateCanonicalizationError, V as IndexRenderSpec, W as IntrospectedModelIR, X as IntrospectionOptions, Y as MigrationSQLOptions, Z as NonConvergentSchemaDiffError, _ as NonConvergentSchemaDiffSurface, $ as PG_LEDGER_SHAPE_VERSION, a0 as PartialIndexPredicateNewEnumValueError, a1 as PgAdapter, a2 as PgAdapterOptions, a3 as PgAdmittedOperation, a4 as PgAdmittedOperationResult, a5 as PgAdvisoryLockKey, a6 as PgAdvisoryLockOptionsError, a7 as PgAdvisoryLockResult, a8 as PgApplicationStepOwnedState, a9 as PgApplicationStepTx, aa as PgBorrowedClientAdapterOptions, ab as PgCatalogueIdentityQueryable, ac as PgCompileOnlyAdapterOptions, ad as PgConvergeApplicationStep, ae as PgConvergeAssertStep, af as PgConvergeInitializationFailure, ag as PgConvergeOnceStep, ah as PgConvergePlannedStep, ai as PgConvergeRefusal, aj as PgConvergeRefusalChange, ak as PgConvergeRefusalError, al as PgLedgerLockResult, am as PgLedgerStorageUnsupportedError, an as PgLedgerTarget, ao as PgOutcomeCheckpoint, ap as PgOutcomeClaimRequest, aq as PgOutcomeExecutionRequest, ar as PgOutcomeNonTransactionalRequest, as as PgOutcomeReadBackFactory, at as PgOutcomeRecoveryRequest, au as PgOutcomeRecoveryResult, av as PgOutcomeResolution, aw as PgOutcomeResolutionAppendResult, ax as PgOutcomeResult, ay as PgOutcomeTransactionalRequest, az as PgOwnedCheckState, aA as PgPhysicalModelInput, aB as PgPhysicalModelInputError, aC as PgPhysicalNameClaim, aD as PgPhysicalNameCollision, aE as PgPhysicalNameCollisionError, aF as PgPhysicalNamespace, aG as PgPinnedConnectionAbortSignalError, aH as PgPoolAdapterOptions, aI as PgPreparedStatementReplayError, aJ as PgPreparedStatementsOptions, aK as PgRawSqlTransactionControlError, aL as PgReinitializePreflightOptions, aM as PgReinitializePreflightPool, aN as PgRollbackOnlyScope, aO as PgSchemaDiff, aP as PgTransactionAbortSignalError, aQ as PgTransactionAbortedCommitError, aR as PgTransactionAbortedError, aS as PgTransactionOptionsError, aT as PgTransactionTimeoutError, aU as RawIndexPredicateFallbackError, aV as ReferencedKeyKind, aW as ReferencedKeyRemovalConflict, aX as ReferencedKeyRemovalError, aY as SchemaChange, aZ as SchemaDiff, a_ as SchemaScopeOptions, a$ as TransitionRunIdentityMismatchError, b0 as WhereDispatcher, b1 as WhereHandler, b2 as acquirePgLedgerLocks, b3 as appendIntentJournal, b4 as appendTransitionAuthorization, b5 as assertCreateIndexSupported, b6 as assertCreateIndexesSupported, b7 as assertDeclarableChangeKind, b8 as assertGeneratedPostconditionSession, b9 as assertNoRepeatedExpressionSurfaceDrift, ba as canGenerateCreateIndex, bb as canonicalizeCheckConstraints, bc as comparePgDatabaseSchema, bd as compareSchemata, be as createPgAdapter, bf as createPgCompileOnlyAdapter, bg as createPgGeneratedManagedStep, bh as createPgPhysicalModel, bi as createPgTransitionRunPersister, bj as decodeGeneratedPostcondition, bk as decodeGeneratedPostconditionPayload, bl as defaultFkDerivation, bm as ensureDbspMetaLedger, bn as ensurePgLedger, bo as ensurePgLedgerStorageVersion, bp as ensureTransitionJournal, bq as executePgAdmittedOperation, br as generateCreateIndex, bs as generateDDL, bt as generateDownSQL, bu as generateMigrationSQL, bv as generatedPostconditionDigest, bw as generatedPostconditionForChange, bx as introspect, by as readPgCatalogueIdentity, bz as readPgLedgerMarker, bA as readPgLedgerReservationsForExecution, bB as readPgLedgerScopeCurrency, bC as readPgOutcomeRecoveryReadBack, bD as readVerifiedPgLedgerReservationsForPair, bE as recordPgLedgerIdentity, bF as renderCreateDbspMetaSchemaSql, bG as renderCreateIndex, bH as renderCreateLedgerEventTableSql, bI as renderCreateLedgerIdentityTableSql, bJ as renderCreateLedgerImmutabilityFunctionSql, bK as renderCreateLedgerImmutabilityTriggerSql, bL as renderCreateLedgerMarkerTableSql, bM as renderCreateLedgerReservationTableSql, bN as renderCreateLedgerTerminalMemberIndexSql, bO as renderCreateTransitionAuthorizationTableSql, bP as renderCreateTransitionJournalTableSql, bQ as renderCreateTransitionRunPlanTableSql, bR as renderCreateTransitionRunTableSql, bS as runPgReinitializePreflight, bT as toGeneratedPostconditionBindingAddress, bU as validatePgLedgerRuntimeIntegrity, bV as verifyGeneratedCheckPostcondition, bW as verifyGeneratedColumnPostcondition, bX as verifyGeneratedIdentityPostcondition, bY as verifyGeneratedIndexPostcondition, bZ as verifyGeneratedTablePostcondition, b_ as withGeneratedPostconditionSession } from './outcome-protocol-B3vRIj2q.js';
3
+ import { ExpressionRef, ModelIR } from '@dbsp/core';
5
4
  export { normalizeSQL } from '@dbsp/core';
6
5
  import * as _dbsp_types from '@dbsp/types';
7
- import { OutputDescriptor, PlanReport, DialectCapabilities, ModelIR, ColumnListInput, ParamIntent, JsonAggOrderByEntry, LedgerPayload, LedgerAddress, NormalizedManagedStep, ColumnIR, MutationReturningItem, WhereIntent, DbCasing, QueryIntent, CompiledQuery, SetOperationIntent, CompileOptions, LedgerHome, ScopedApprovalSet, LedgerChainMember, OperationKindRef, SemanticArtifactRef, ProvenPlanShape, PostgreSqlObservationTargetIdentity, ExecutionContract, TransitionSessionClient, TransitionLessor, ExclusiveTransitionTarget, ObservationIssuer, ObservationRequest, ObservationContext, EvidenceObservation, TypeRef, ExpressionValue, CollationRef, LogicalIdentity, PhysicalOperation, OperationEffectAssessment, FingerprintManifest, DurableIntentRecord, IssuedObservation, ApplyGuard, AdvisoryObservation, TransactionalCompletionRecord, StepJournal, UnsafeNativeFragment, ResourceAddress, ExecutableAssertion, Assumption, TransitionRule, TransitionCompositionFact, TrustRoot, RequiredEnumLabelIR, TableReaddressDeclaration, LedgerReservationRow, LedgerRefusal, ContainmentClosureDestructiveOutcome, LedgerClaimKind } from '@dbsp/types';
8
- import * as _pgsql_types from '@pgsql/types';
6
+ import { LedgerPayload, LedgerAddress, NormalizedManagedStep, ColumnIR, MutationReturningItem, WhereIntent, DialectCapabilities, QueryIntent, CompiledQuery, SetOperationIntent, PlanReport, CompileOptions, LedgerHome, LedgerChainMember, OperationKindRef, SemanticArtifactRef, ProvenPlanShape, ExecutionContract, TransitionSessionClient, TransitionLessor, ExclusiveTransitionTarget, ObservationIssuer, ObservationRequest, ObservationContext, EvidenceObservation, ExpressionValue, LogicalIdentity, PhysicalOperation, OperationEffectAssessment, FingerprintManifest, DurableIntentRecord, IssuedObservation, ApplyGuard, AdvisoryObservation, TransactionalCompletionRecord, StepJournal, ResourceAddress, Assumption, TransitionRule, TransitionCompositionFact, ModelIR as ModelIR$1, TrustRoot, TableReaddressDeclaration, LedgerClaimKind } from '@dbsp/types';
9
7
  import { Node, OnConflictClause, ParamRef } from '@pgsql/types';
10
- import { PoolClient, Pool } from 'pg';
8
+ import { ScopedApprovalSet, PostgreSqlObservationTargetIdentity, TypeRef, CollationRef, UnsafeNativeFragment, ExecutableAssertion, NamingPlugin, RequiredEnumLabelIR, LedgerReservationRow, LedgerRefusal, ContainmentClosureDestructiveOutcome } from '@dbsp/types/internal';
9
+ export { CamelCaseNamingPlugin, IdentityNamingPlugin, NamingPlugin, camelCaseNaming, getNamingPluginForDbCasing, identityNaming } from '@dbsp/types/internal';
10
+ import * as _dbsp_core_internal from '@dbsp/core/internal';
11
+ import { ValidatedManagedStepManifest, ExecutionCoordinator, CapabilityDescriptor } from '@dbsp/core/internal';
11
12
  export { escapeDiagnosticText } from '@dbsp/core/internal';
12
-
13
- /**
14
- * Internal registry of NQL `| bind name` CTE names visible to a compile pass.
15
- *
16
- * Binding names are query-local identifiers, not physical tables. When an active
17
- * schema is present, real table FROM sources must be schema-qualified, while CTE
18
- * binding names must remain unqualified.
19
- */
20
-
21
- type BindingNameRegistry = ReadonlySet<string>;
22
-
23
- declare const projectionEnvelopeBrand: unique symbol;
24
- type ProjectionEnvelope<T = unknown> = {
25
- readonly [projectionEnvelopeBrand]: true;
26
- readonly sql: string;
27
- readonly parameters: readonly unknown[];
28
- readonly ast?: Node;
29
- readonly projection: ProjectionState;
30
- readonly hydrationPlan?: PlanReport;
31
- readonly __resultType?: T;
32
- };
33
- type ProjectionState = {
34
- readonly kind: 'known';
35
- readonly outputs: ReadonlyMap<string, OutputProjection>;
36
- } | {
37
- readonly kind: 'dropped';
38
- readonly reason: ProjectionDropReason;
39
- readonly hadConvertibleSource: boolean;
40
- };
41
- type OutputProjection = OutputDescriptor;
42
-
43
- type ProjectionDropReason = 'set-operation-positional-merge' | 'raw-recursive-cte-positional-merge' | 'unknown-raw-sql' | 'unsupported-source';
44
-
45
- /**
46
- * Resolves the columns available through a relation target. A query-local
47
- * binding shadows a physical relation, so its (when known) projection is the
48
- * authority for every column emitted against that target.
49
- */
50
-
51
- type RelationTargetProjectionRegistry = ReadonlyMap<string, ProjectionEnvelope>;
52
- /** A query-scope binding from an emitted SQL alias to the relation it exposes. */
53
- type AliasColumnAuthority = ReadonlyMap<string, ResolvedRelationTarget>;
54
- type ResolvedRelationTarget = {
55
- readonly target: string;
56
- readonly cteName?: string;
57
- readonly outputs?: ReadonlyMap<string, OutputDescriptor>;
58
- };
59
-
60
- /** Built-in include strategies, shared by the runtime registry and public types. */
61
- declare const INCLUDE_STRATEGIES: readonly ["join", "lateral", "json_agg", "cte"];
62
- /** The four strategies this adapter implements handlers for, distinct from @dbsp/types' six-member IncludeStrategy, which includes the planner's subquery and auto. */
63
- type IncludeHandlerStrategy = (typeof INCLUDE_STRATEGIES)[number];
64
- /**
65
- * Immutable context passed to all handlers during compilation.
66
- */
67
- interface CompilerContext {
68
- /** Naming convention transformer */
69
- readonly naming: NamingPlugin;
70
- /** Schema name for table qualification (optional) */
71
- readonly schema?: string;
72
- /** Dialect capabilities for adapter-layer SQL surface gates */
73
- readonly dialectCapabilities?: DialectCapabilities;
74
- /** Root table name for the query */
75
- readonly rootTable: string;
76
- /** Current table alias (for JOINs) */
77
- readonly currentAlias?: string;
78
- /** Final relation path/name → SQL join alias map for relation-aware expression contexts */
79
- readonly aliases?: ReadonlyMap<string, string>;
80
- /** Maximum recursive depth (default: 100) */
81
- readonly maxRecursiveDepth: number;
82
- /** Optional callback for raw SQL audit trail */
83
- readonly onRawSQL?: (sql: string) => void;
84
- /** Default primary key column name for convention fallbacks (default: 'id') */
85
- readonly defaultPkColumnName?: string;
86
- /** Convention for deriving FK column names: (tableName, pkName) => fkColumnName */
87
- readonly deriveFkColumnName?: FkColumnDerivation;
88
- /** Alias of the outer (parent) query — used for FieldRef scope:'outer' resolution in EXISTS subqueries */
89
- readonly outerAlias?: string;
90
- /** Query-local CTE/binding names that must not be schema-qualified. */
91
- readonly bindingNames?: BindingNameRegistry;
92
- /** Known projections for visible CTE/binding relation targets. */
93
- readonly relationTargetProjections?: RelationTargetProjectionRegistry;
94
- /** Lexically visible SQL aliases that expose a known CTE projection. */
95
- readonly aliasColumnAuthorities?: AliasColumnAuthority;
96
- /**
97
- * Optional callback to compile a QueryIntent into an AST Node (SubLink subselect).
98
- * Set by PlanCompiler when compiling selectCustomExpression — enables SubqueryExpressionIntent
99
- * to embed a fully compiled sub-SELECT into the parent SELECT column list.
100
- *
101
- * @param query - The inner QueryIntent to compile
102
- * @param paramOffset - Current outer paramIndex; inner $N are renumbered by this offset
103
- * @returns The compiled SelectStmt AST node and the inner parameters
104
- */
105
- readonly compileSubquery?: (query: _dbsp_types.QueryIntent, paramOffset: number) => {
106
- ast: Node;
107
- parameters: readonly unknown[];
108
- };
109
- /**
110
- * Optional recursive compiler for NQL-origin SELECT expression values nested
111
- * inside handler arguments, such as coalesce(upper(name), :fallback) or
112
- * (price + :a) * :b.
113
- */
114
- readonly compileNqlSelectExpression?: (value: unknown, ctx: CompilerContext, state: CompilerState) => Node;
115
- /**
116
- * Optional callback to compile a custom fn() FILTER (WHERE ...) condition.
117
- * Set by PlanCompiler to keep WHERE-dispatcher dependencies out of expression
118
- * handlers while still applying FILTER in every expression position.
119
- */
120
- readonly compileCustomFnFilter?: (filterIntent: _dbsp_types.WhereIntent, ctx: CompilerContext, state: CompilerState) => Node | undefined;
121
- /**
122
- * Optional ModelIR for type-aware parameter casting.
123
- * When provided, WHERE comparisons emit `$N::type` to eliminate
124
- * PostgreSQL type inference ambiguity for nullable columns.
125
- */
126
- readonly model?: ModelIR;
127
- }
128
- /**
129
- * Mutable state maintained during compilation.
130
- */
131
- interface CompilerState {
132
- /** Collected parameters in order */
133
- parameters: unknown[];
134
- /** Current parameter index (1-based for PostgreSQL) */
135
- paramIndex: number;
136
- /** Registered CTEs for the query */
137
- ctes: Map<string, Node>;
138
- /** Table aliases in use */
139
- aliases: Map<string, string>;
140
- /** JOIN clauses accumulated */
141
- joins: Node[];
142
- }
143
- /**
144
- * Base decision interface matching core's PlanDecision structure.
145
- */
146
- interface Decision {
147
- readonly type: string;
148
- readonly table?: string;
149
- readonly column?: string;
150
- readonly alias?: string;
151
- readonly operator?: string;
152
- readonly value?: unknown;
153
- readonly paramIndex?: number;
154
- readonly dataType?: string;
155
- readonly direction?: 'ASC' | 'DESC';
156
- readonly nulls?: 'FIRST' | 'LAST';
157
- readonly joinType?: 'inner' | 'left';
158
- readonly sourceColumn?: ColumnListInput;
159
- readonly targetColumn?: ColumnListInput;
160
- readonly targetTable?: string;
161
- readonly function?: string;
162
- /** Apply DISTINCT to a SELECT-list aggregate (e.g. COUNT(DISTINCT col)). */
163
- readonly distinct?: boolean;
164
- readonly args?: readonly unknown[];
165
- readonly conditions?: readonly Decision[];
166
- readonly columns?: readonly string[];
167
- readonly values?: readonly unknown[];
168
- readonly set?: readonly {
169
- column: string;
170
- value: unknown;
171
- }[];
172
- readonly limit?: number | ParamIntent | {
173
- paramIndex: number;
174
- };
175
- readonly offset?: number | ParamIntent | {
176
- paramIndex: number;
177
- };
178
- readonly strategy?: IncludeHandlerStrategy;
179
- readonly relation?: string;
180
- readonly relationName?: string;
181
- readonly relationPath?: string;
182
- readonly hydrationPrefix?: string;
183
- readonly include?: readonly Decision[];
184
- readonly relationType?: 'belongsTo' | 'hasMany' | 'hasOne';
185
- readonly foreignKey?: ColumnListInput;
186
- readonly parentKey?: ColumnListInput;
187
- readonly orderByFallback?: boolean;
188
- readonly children?: readonly Decision[];
189
- readonly partition?: readonly string[];
190
- readonly orderBy?: readonly {
191
- column: string;
192
- direction?: 'ASC' | 'DESC';
193
- }[] | readonly JsonAggOrderByEntry[];
194
- readonly frame?: string;
195
- readonly maxDepth?: number;
196
- readonly pathColumn?: string;
197
- readonly cycleDetection?: boolean;
198
- readonly selectColumn?: string;
199
- readonly aggregate?: string;
200
- /**
201
- * Apply DISTINCT to a scalar subquery's aggregate (e.g. AVG(DISTINCT price)).
202
- * Deliberately NOT named `distinct` — `assertNoDroppedDecisionModifiers`
203
- * (subquery-emission.ts) treats a top-level `distinct === true` on ANY
204
- * subquery decision as an unsupported query-level DISTINCT modifier and
205
- * throws. This field is scoped to the aggregate projection only, so it
206
- * must not collide with that generic guard.
207
- */
208
- readonly aggregateDistinct?: boolean;
209
- readonly subqueryOperator?: string;
210
- readonly traversal?: string;
211
- readonly traversals?: readonly {
212
- traversal: string;
213
- targetColumn?: string;
214
- }[];
215
- readonly isRecursive?: boolean;
216
- readonly fkColumn?: string;
217
- readonly pkColumn?: string;
218
- readonly expandRelation?: string;
219
- readonly relationColumns?: readonly string[];
220
- readonly columnAliases?: Readonly<Record<string, string>>;
221
- readonly jsonPath?: readonly unknown[];
222
- readonly jsonMode?: 'json' | 'text';
223
- readonly _compiledFilterWhere?: _pgsql_types.Node;
224
- readonly filterWhere?: _pgsql_types.Node;
225
- readonly expressionIntent?: unknown;
226
- readonly escape?: string;
227
- /**
228
- * Provenance: the ORIGINAL QueryIntent before lowering.
229
- * Set by every lowering site (convertIn, convertSubquery, normalizeToDecision,
230
- * dispatchWhere, mapInSubqueryCondition) so that `buildPredicateSubquerySelect`
231
- * (subquery-emission.ts) can validate the true caller intent rather than the
232
- * stripped-down lowered decision fields.
233
- *
234
- * Required for IN / scalar / inSubquery / notInSubquery decisions.
235
- * Optional on other decision types.
236
- */
237
- readonly subqueryIntent?: _dbsp_types.QueryIntent;
238
- }
239
- /**
240
- * Handler for WHERE clause conditions.
241
- * Transforms condition decisions into PostgreSQL AST expressions.
242
- */
243
- interface WhereHandler {
244
- /** Operator(s) this handler supports */
245
- readonly operators: readonly string[];
246
- /**
247
- * Compile a WHERE condition to AST.
248
- * @param decision The condition decision
249
- * @param ctx Immutable compiler context
250
- * @param state Mutable compiler state
251
- * @param dispatch Callback to compile nested conditions
252
- * @returns PostgreSQL AST node for the condition
253
- */
254
- compile(decision: Decision, ctx: CompilerContext, state: CompilerState, dispatch: WhereDispatcher): Node;
255
- }
256
- /**
257
- * Dispatcher for recursive WHERE compilation.
258
- * The same function object may be passed to every level of a recursive compilation, so it is an opaque callback.
259
- * Handlers must not use its identity to distinguish frames or carry frame-local state.
260
- */
261
- type WhereDispatcher = (decision: Decision, ctx: CompilerContext, state: CompilerState) => Node;
262
- /**
263
- * Handler for SELECT expressions.
264
- * Transforms expression decisions into PostgreSQL AST nodes.
265
- */
266
- interface ExpressionHandler {
267
- /** Expression type(s) this handler supports */
268
- readonly types: readonly string[];
269
- /**
270
- * Safe to use when a function name comes from NQL text.
271
- *
272
- * Raw/escape-hatch handlers must not set this. NQL-origin function names use
273
- * this opt-in surface only, then fall back to generic FuncCall emission.
274
- */
275
- readonly nqlSafe?: boolean;
276
- /**
277
- * Compile an expression to AST.
278
- * @param decision The expression decision
279
- * @param ctx Immutable compiler context
280
- * @param state Mutable compiler state
281
- * @returns PostgreSQL AST node for the expression
282
- */
283
- compile(decision: Decision, ctx: CompilerContext, state: CompilerState): Node;
284
- }
285
- /**
286
- * Handler for include/relation strategies.
287
- * Transforms include decisions into PostgreSQL constructs (JOIN, LATERAL, json_agg, CTE).
288
- */
289
- interface IncludeHandler {
290
- /** Strategy this handler implements */
291
- readonly strategy: IncludeHandlerStrategy;
292
- /**
293
- * Compile an include to AST.
294
- * @param decision The include decision
295
- * @param ctx Immutable compiler context
296
- * @param state Mutable compiler state
297
- * @returns Object with modifications to apply
298
- */
299
- compile(decision: Decision, ctx: CompilerContext, state: CompilerState): IncludeResult;
300
- }
301
- /**
302
- * Result of include compilation.
303
- */
304
- interface IncludeResult {
305
- /** Additional target list items (SELECT columns) */
306
- targets?: Node[];
307
- /** JOIN to add to FROM clause */
308
- join?: Node;
309
- /** Additional JOINs for cascaded includes (e.g., flat deep nesting) */
310
- additionalJoins?: Node[];
311
- /** CTE to add to WITH clause */
312
- cte?: Node;
313
- /** Subquery for LATERAL */
314
- lateral?: Node;
315
- }
316
-
317
- type PlanExpressionOrderBy = readonly {
318
- field: string;
319
- direction?: 'asc' | 'desc';
320
- }[];
321
- /**
322
- * Simplified PlanDecision for the spike
323
- * (In production, import from @dbsp/core)
324
- */
325
- interface PlanDecision {
326
- readonly type: string;
327
- readonly table?: string;
328
- readonly column?: string;
329
- readonly alias?: string;
330
- readonly field?: string;
331
- readonly operator?: string;
332
- readonly value?: unknown;
333
- readonly paramIndex?: number;
334
- readonly direction?: 'ASC' | 'DESC';
335
- readonly nulls?: 'FIRST' | 'LAST';
336
- readonly joinType?: 'inner' | 'left';
337
- readonly sourceColumn?: ColumnListInput;
338
- readonly targetColumn?: ColumnListInput;
339
- readonly targetTable?: string;
340
- readonly function?: string;
341
- readonly distinct?: boolean;
342
- readonly args?: readonly unknown[];
343
- readonly conditions?: readonly PlanDecision[];
344
- readonly columns?: readonly string[];
345
- readonly values?: readonly unknown[];
346
- readonly set?: readonly {
347
- column: string;
348
- value: unknown;
349
- }[];
350
- readonly limit?: number | ParamIntent | {
351
- paramIndex: number;
352
- };
353
- readonly offset?: number | ParamIntent | {
354
- paramIndex: number;
355
- };
356
- readonly partitionBy?: readonly string[];
357
- readonly orderBy?: PlanExpressionOrderBy | readonly JsonAggOrderByEntry[];
358
- readonly dataType?: string;
359
- readonly sourceTable?: string;
360
- readonly relationName?: string;
361
- readonly relationPath?: string;
362
- readonly hydrationPrefix?: string;
363
- readonly relationType?: 'belongsTo' | 'hasMany' | 'hasOne';
364
- readonly foreignKey?: ColumnListInput;
365
- readonly parentKey?: ColumnListInput;
366
- readonly orderByFallback?: boolean;
367
- readonly children?: readonly PlanDecision[];
368
- readonly intentPath?: string;
369
- readonly choice?: string;
370
- readonly subquery?: {
371
- readonly from: string;
372
- readonly select: string;
373
- readonly where?: PlanDecision;
374
- readonly limit?: number | ParamIntent;
375
- readonly orderBy?: readonly {
376
- field: string;
377
- direction?: string;
378
- }[];
379
- };
380
- readonly expressionType?: string;
381
- readonly relation?: string;
382
- readonly columnAliases?: Readonly<Record<string, string>>;
383
- readonly traversal?: string;
384
- readonly pkColumn?: string;
385
- readonly fkColumn?: string;
386
- readonly maxDepth?: number;
387
- readonly role?: string;
388
- readonly jsonPath?: readonly string[];
389
- readonly jsonMode?: 'json' | 'text';
390
- readonly selectColumn?: string;
391
- readonly aggregate?: string;
392
- /**
393
- * Apply DISTINCT to a scalar subquery's aggregate (e.g. AVG(DISTINCT price)).
394
- * Deliberately NOT named `distinct` — that field means "this decision's own
395
- * query-level DISTINCT modifier" and `assertNoDroppedDecisionModifiers`
396
- * (subquery-emission.ts) rejects it as unsupported on subquery decisions.
397
- */
398
- readonly aggregateDistinct?: boolean;
399
- readonly subqueryOperator?: string;
400
- readonly filterCondition?: PlanDecision;
401
- readonly expressionIntent?: unknown;
402
- readonly escape?: string;
403
- readonly include?: readonly PlanDecision[];
404
- readonly joinRarg?: Node;
405
- readonly joinOnNode?: Node;
406
- readonly batchValuesParams?: readonly unknown[];
407
- /**
408
- * Provenance: the ORIGINAL QueryIntent before lowering.
409
- * Carried through every lowering site (convertIn, convertSubquery,
410
- * normalizeToDecision, dispatchWhere, mapInSubqueryCondition) so that
411
- * `buildPredicateSubquerySelect` can validate the true caller intent.
412
- *
413
- * Required for IN / scalar / inSubquery / notInSubquery decisions.
414
- * Optional on other decision types.
415
- */
416
- readonly subqueryIntent?: _dbsp_types.QueryIntent;
417
- }
418
- /**
419
- * Any decision of type 'join'.
420
- * Narrows `type` to the literal 'join' for safe switch exhaustion.
421
- */
422
- interface JoinDecision extends PlanDecision {
423
- readonly type: 'join';
424
- }
425
- /**
426
- * A 'join' decision that carries pre-compiled PostgreSQL AST nodes.
427
- * Used by both table-mode and BatchValues-mode joins when the ON condition
428
- * has been compiled ahead of time in adapter-compiler-select.ts.
429
- *
430
- * The `joinRarg` is the right-hand RangeVar/RangeFunction; `joinOnNode` is
431
- * the A_Expr tree for the ON clause.
432
- */
433
- interface PrecompiledJoinDecision extends JoinDecision {
434
- readonly joinRarg: Node;
435
- readonly joinOnNode: Node;
436
- readonly joinOnParams?: readonly unknown[];
437
- }
438
- /**
439
- * A pre-compiled 'join' decision backed by a BatchValues unnest() source.
440
- * `batchValuesParams` must be spliced into compiler state BEFORE other query
441
- * parameters so that $1/$2/… ParamRefs in the RangeFunction align correctly.
442
- */
443
- interface BatchValuesJoinDecision extends PrecompiledJoinDecision {
444
- readonly batchValuesParams: readonly unknown[];
445
- }
446
- /** Narrows a PlanDecision to JoinDecision (type === 'join'). */
447
- declare function isJoinDecision(d: PlanDecision): d is JoinDecision;
448
- /**
449
- * Narrows a PlanDecision to PrecompiledJoinDecision.
450
- * True when the join carries pre-compiled `joinRarg` + `joinOnNode` AST nodes
451
- * (table mode or BatchValues mode).
452
- */
453
- declare function isPrecompiledJoinDecision(d: PlanDecision): d is PrecompiledJoinDecision;
454
- /**
455
- * Narrows a PlanDecision to BatchValuesJoinDecision.
456
- * True when the join is a BatchValues unnest() join and carries pre-spliced
457
- * parameter arrays in `batchValuesParams`.
458
- */
459
- declare function isBatchValuesJoinDecision(d: PlanDecision): d is BatchValuesJoinDecision;
460
- /**
461
- * Simplified PlanReport for the spike
462
- */
463
- interface SimplifiedPlanReport {
464
- readonly rootTable: string;
465
- readonly decisions: readonly PlanDecision[];
466
- readonly schema?: string;
467
- /** If true, wrap result in SELECT EXISTS(SELECT 1 ...) AS "exists" */
468
- readonly existsWrap?: boolean;
469
- /** Row-level lock (FOR UPDATE/SHARE/etc.) */
470
- readonly lock?: _dbsp_types.LockIntent;
471
- /**
472
- * When present, the FROM clause is replaced by a pre-compiled RangeFunction node
473
- * (e.g. unnest() AS alias) instead of the root table rangeVar.
474
- * `batchValuesFromParams` holds the parameter arrays to splice into state first.
475
- */
476
- readonly batchValuesFromNode?: unknown;
477
- readonly batchValuesFromParams?: readonly unknown[];
478
- }
479
- /**
480
- * Compiled query result
481
- */
482
- interface CompiledResult {
483
- readonly sql: string;
484
- readonly parameters: readonly unknown[];
485
- readonly ast: Node;
486
- }
487
- interface CompilerOptions {
488
- readonly naming?: NamingPlugin;
489
- readonly schema?: string;
490
- readonly dialectCapabilities?: DialectCapabilities;
491
- /** Default primary key column name convention (default: 'id') */
492
- readonly defaultPkColumnName?: string;
493
- /** Convention for deriving FK column names: (tableName, pkName) => fkColumnName */
494
- readonly deriveFkColumnName?: FkColumnDerivation;
495
- /** ModelIR for type-aware parameter casting in WHERE clauses */
496
- readonly model?: _dbsp_types.ModelIR;
497
- /** Query-local CTE/binding names that must not be schema-qualified. */
498
- readonly bindingNames?: BindingNameRegistry;
499
- readonly relationTargetProjections?: RelationTargetProjectionRegistry;
500
- }
501
- declare class PlanCompiler {
502
- private readonly naming;
503
- private readonly schema;
504
- private readonly defaultPk;
505
- private readonly deriveFk;
506
- private readonly model;
507
- private readonly dialectCapabilities;
508
- private readonly bindingNames;
509
- private readonly relationTargetProjections;
510
- /** Mutable state shared with extracted condition/value compilation functions */
511
- private state;
512
- /** Track root table for EXISTS FK correlation */
513
- private currentRootTable;
514
- /** Pending JOINs registered by filter/include strategies (flushed in compileSelect) */
515
- private pendingJoins;
516
- /** Raw JOIN AST nodes from include handlers (e.g., LATERAL) */
517
- private rawJoins;
518
- /** CTE nodes from include handlers (e.g., CTE strategy) */
519
- private pendingCtes;
520
- /** Local aliases for binding relation-column scalar subqueries. */
521
- private bindingRelationColumnSubqueryIndex;
522
- /**
523
- * Maps relation-dotted include path → JOIN alias for multi-hop FK resolution.
524
- * Populated as join decisions are compiled so later hops can find the
525
- * correct source alias (e.g., 'callee.file' reads parent path 'callee').
526
- */
527
- private joinAliasMap;
528
- /**
529
- * Immutable-before-emission mapping from a public relation qualifier to the
530
- * SQL alias that is actually emitted for that relation.
531
- */
532
- private visibleSqlQualifiers;
533
- /**
534
- * Tracks all join aliases in use for the current query.
535
- * Entries are stored in emitted database-alias space, after naming.toDatabase().
536
- * Ensures no two JOINs share the same alias (DOUBLE-ALIAS prevention).
537
- */
538
- private usedJoinAliases;
539
- /**
540
- * Query-local authority for every emitted non-root alias. Root bindings are
541
- * deliberately absent: an unqualified root reference retains its historical
542
- * SQL semantics, even when the root happens to be a reduced CTE.
543
- */
544
- private aliasColumnAuthorities;
545
- constructor(options?: CompilerOptions);
546
- private childCompilerOptions;
547
- /** Build immutable context for handler-based WHERE compilation */
548
- private handlerCtx;
549
- private relationTargetContext;
550
- /** Register an emitted alias before any column-reference path can use it. */
551
- private registerAliasAuthority;
552
- private findAliasForLegacySourceTable;
553
- private emittedJoinAlias;
554
- private resolvedJoinAliases;
555
- private resolveVisibleSqlQualifier;
556
- private filterJoinAlias;
557
- /**
558
- * Dispatch a PlanDecision through the unified WHERE handler system.
559
- * Bridges PlanCompiler's state to handler types, calls dispatcher, syncs back.
560
- */
561
- private dispatchWhere;
562
- /**
563
- * Recursively convert a PlanDecision (potentially with nested in+subquery
564
- * or a logical group whose children contain in+subquery nodes) into a
565
- * HandlerDecision suitable for the WHERE dispatcher.
566
- *
567
- * When a PlanDecision has operator='in'/'notIn' with a subquery object,
568
- * mapToHandlerDecision loses the subquery because HandlerDecision has no
569
- * `subquery` field. This method detects that pattern and converts it to the
570
- * inSubquery/notInSubquery form that buildScalarSubquery expects.
571
- *
572
- * When the node is a logical group (whereAnd / whereOr / whereNot), each
573
- * child in `conditions` / `condition` is mapped recursively so that nested
574
- * IN+subquery nodes at any depth are guarded and remapped correctly, rather
575
- * than falling through to mapToHandlerDecision which would silently drop the
576
- * subquery and produce a malformed plain-IN binding.
577
- *
578
- * Called recursively so 2+ levels of nesting all work.
579
- */
580
- private mapInSubqueryCondition;
581
- /**
582
- * Bridge PlanDecision to handler Decision and dispatch to include handler.
583
- * Returns targets and optional pending joins to apply.
584
- */
585
- private compileIncludeViaHandler;
586
- /**
587
- * Compile a simplified plan report to SQL
588
- */
589
- compile(plan: SimplifiedPlanReport): CompiledResult;
590
- private detectQueryType;
591
- /** Build a HandlerCompilerContext for the given plan and optional alias override. */
592
- private createHandlerContext;
593
- /** Build a fresh HandlerCompilerState sharing the current parameter array. */
594
- private createHandlerState;
595
- private schemaForRangeVar;
596
- private isNqlBindingRoot;
597
- private allocateBindingRelationAlias;
598
- private buildCorrelatedRelationRefs;
599
- private bindingRelationHasCompleteManyToManyProof;
600
- private bindingRelationName;
601
- private bindingRelationNameLooksRecursive;
602
- private compileBindingRecursiveRelationColumnSubquery;
603
- private compileBindingRelationColumnSubquery;
604
- private compileExpressionSubquery;
605
- private compileGenericNqlFunction;
606
- private compileNqlFunctionArg;
607
- private compileNqlCaseExpressionArg;
608
- /**
609
- * Compile a SELECT-list target via expression handler.
610
- * Wraps the node in a ResTarget and pushes it onto targetList.
611
- */
612
- private compileSelectTarget;
613
- /**
614
- * Compile an includeStrategy decision and register its results.
615
- * Pushes targets onto targetList, raw joins / CTEs onto instance collections.
616
- */
617
- private registerIncludeCompilationResult;
618
- private compileIncludeDecision;
619
- private compileJoinIncludeAllocationPass;
620
- /**
621
- * Allocate visible SQL qualifiers before compiling a target. Only emitted
622
- * joins register their public qualifier; strategies without an outer source
623
- * deliberately leave their relation unavailable to qualified references.
624
- */
625
- private allocateVisibleSqlQualifiers;
626
- /**
627
- * Fold a WHERE-family decision into an existing where expression.
628
- * Returns the updated (or new) where node.
629
- */
630
- private compileWhereDecision;
631
- /**
632
- * Flush pendingJoins and rawJoins into the FROM clause.
633
- * Mutates the from array in-place.
634
- */
635
- private flushPendingJoins;
636
- /**
637
- * Build the initial FROM clause array and register batch-values parameters.
638
- * For batch-values queries, the unnest RangeFunction replaces the root rangeVar.
639
- */
640
- private compileFromClause;
641
- /**
642
- * Fold WHERE conditions from a join-strategy include decision into the
643
- * accumulated WHERE expression. The join alias is used as currentAlias so
644
- * column refs like `project_id` resolve against the joined table, not root.
645
- */
646
- private compileIncludeWhereConditions;
647
- private reserveManualJoinAliases;
648
- /**
649
- * Apply a single join decision to the FROM clause in-place.
650
- * Chains multiple joins by wrapping from[0] as the left-arg each time.
651
- */
652
- private compileJoinDecision;
653
- /**
654
- * Compile a single orderBy decision into a SortBy AST node.
655
- * Supports both expression-intent and plain column references.
656
- */
657
- /**
658
- * Compile a single orderBy decision into a SortBy AST node.
659
- * Supports both expression-intent and plain column references.
660
- * Returns undefined when neither expressionIntent nor column is present.
661
- */
662
- private compileOrderByDecision;
663
- /**
664
- * Compile a column reference that may use dotted 'relation.column' notation.
665
- */
666
- private compileRelationAwareColumnRef;
667
- /**
668
- * Compile a single groupBy decision into a ColumnRef AST node.
669
- * Supports dotted 'relation.column' notation for joined tables.
670
- */
671
- private compileGroupByDecision;
672
- /**
673
- * Compile a DISTINCT ON column into a ColumnRef AST node.
674
- * Mirrors GROUP BY relation-alias resolution while preserving unqualified
675
- * DISTINCT ON columns as unqualified references.
676
- */
677
- private compileDistinctOnColumn;
678
- /**
679
- * Assemble the final SelectStmt from all accumulated clause nodes.
680
- * Also handles the default SELECT *, CTEs, and row-level locking.
681
- */
682
- private buildSelectStmt;
683
- private compileSelect;
684
- /**
685
- * Wrap a SELECT statement in SELECT EXISTS(SELECT 1 ...) AS "exists"
686
- *
687
- * This transforms the inner SELECT by:
688
- * 1. Replacing targetList with just `1` (constant)
689
- * 2. Wrapping in SubLink with EXISTS_SUBLINK
690
- * 3. Creating outer SELECT with EXISTS result aliased as "exists"
691
- */
692
- private wrapSelectInExists;
693
- private compileCaseExpression;
694
- /**
695
- * Compile a CASE THEN/ELSE value based on its ExpressionIntent kind.
696
- * Delegates to shared resolveCaseValue with nested CASE support.
697
- */
698
- private compileCaseValue;
699
- /**
700
- * Compile a custom ExpressionIntent (customFn, customOp, ref, cast, unary,
701
- * array, function, subquery, …) to an AST node through the shared expression
702
- * compiler. Shared by the `selectCustomExpression` target path and CASE
703
- * THEN/ELSE values so both render the full expression surface identically.
704
- */
705
- private compileCustomExpressionNode;
706
- private compileInsert;
707
- private compileUpdate;
708
- private compileDelete;
709
- /**
710
- * Register an INNER JOIN for a belongsTo filter-strategy decision.
711
- * The JOIN replaces the EXISTS subquery when the planner chooses 'join'.
712
- * The ON condition correlates FK → PK (belongsTo: source.FK = target.PK).
713
- */
714
- private registerJoinFilter;
715
- private compileJoin;
716
- }
717
- /**
718
- * Convenience function to compile a plan
719
- */
720
- declare function compilePlan(plan: SimplifiedPlanReport, options?: CompilerOptions): CompiledResult;
13
+ import { PoolClient, Pool } from 'pg';
721
14
 
722
15
  declare function dbTypesEqual(a: string, b: string): boolean;
723
16
 
@@ -1121,55 +414,76 @@ declare function vectorDims(column: string): ExpressionRef;
1121
414
  * - RETURNING clause for all mutations
1122
415
  */
1123
416
 
417
+ /** Resolver-addressed declared column carried beside its physical SQL name. */
418
+ interface MutationColumnAddress {
419
+ readonly logicalTable: string;
420
+ readonly logicalColumn: string;
421
+ readonly physicalName: SqlIdentifier;
422
+ }
423
+ interface MutationColumnMetadata extends MutationColumnAddress {
424
+ readonly databaseType: string;
425
+ }
426
+ interface MutationTableMetadata {
427
+ readonly logicalTable: string;
428
+ readonly physicalName: SqlIdentifier;
429
+ }
430
+ type MutationColumnTypes = Record<string, string | MutationColumnMetadata>;
1124
431
  /**
1125
432
  * Configuration for INSERT compilation
1126
433
  */
1127
434
  interface InsertConfig {
1128
435
  /** Table to insert into */
1129
- table: string;
436
+ table: SqlIdentifier;
437
+ tableMetadata?: MutationTableMetadata;
1130
438
  /** Columns to insert */
1131
- columns: string[];
439
+ columns: SqlIdentifier[];
1132
440
  /** Values for each column (array of rows) */
1133
441
  values: unknown[][];
1134
442
  /** Columns to return (RETURNING clause) */
1135
443
  returning?: string[];
444
+ /** Addressed declared sources for RETURNING labels. */
445
+ returningSources?: SqlIdentifier[];
1136
446
  /** Alias-aware RETURNING projection items */
1137
447
  returningItems?: readonly MutationReturningItem[];
1138
448
  /** Subquery for INSERT ... SELECT */
1139
449
  selectQuery?: Node;
1140
450
  /** Column database types for type-cast emission (e.g. range types) */
1141
- columnTypes?: Record<string, string>;
451
+ columnTypes?: MutationColumnTypes;
1142
452
  }
1143
453
  /**
1144
454
  * Configuration for UPDATE compilation
1145
455
  */
1146
456
  interface UpdateConfig {
1147
457
  /** Table to update */
1148
- table: string;
458
+ table: SqlIdentifier;
459
+ tableMetadata?: MutationTableMetadata;
1149
460
  /** Column-value pairs to set */
1150
461
  set: {
1151
- column: string;
462
+ column: SqlIdentifier;
1152
463
  value: unknown;
1153
464
  }[];
1154
465
  /** WHERE conditions */
1155
466
  where?: Decision[];
1156
467
  /** Columns to return (RETURNING clause) */
1157
468
  returning?: string[];
469
+ returningSources?: SqlIdentifier[];
1158
470
  /** Alias-aware RETURNING projection items */
1159
471
  returningItems?: readonly MutationReturningItem[];
1160
472
  /** Column database types for type-cast emission (e.g. range types) */
1161
- columnTypes?: Record<string, string>;
473
+ columnTypes?: MutationColumnTypes;
1162
474
  }
1163
475
  /**
1164
476
  * Configuration for DELETE compilation
1165
477
  */
1166
478
  interface DeleteConfig {
1167
479
  /** Table to delete from */
1168
- table: string;
480
+ table: SqlIdentifier;
481
+ tableMetadata?: MutationTableMetadata;
1169
482
  /** WHERE conditions */
1170
483
  where?: Decision[];
1171
484
  /** Columns to return (RETURNING clause) */
1172
485
  returning?: string[];
486
+ returningSources?: SqlIdentifier[];
1173
487
  /** Alias-aware RETURNING projection items */
1174
488
  returningItems?: readonly MutationReturningItem[];
1175
489
  }
@@ -1208,9 +522,15 @@ type ConflictAction = 'nothing' | 'update';
1208
522
  */
1209
523
  interface ConflictTarget {
1210
524
  /** Column names that form the unique constraint */
1211
- columns?: string[];
1212
- /** Named constraint */
1213
- constraint?: string;
525
+ columns?: SqlIdentifier[];
526
+ columnAddresses?: MutationColumnAddress[];
527
+ /** Addressed constraint declared by the target table. */
528
+ constraint?: SqlIdentifier;
529
+ constraintAddress?: {
530
+ readonly logicalTable: string;
531
+ readonly logicalConstraint: string;
532
+ readonly physicalName: SqlIdentifier;
533
+ };
1214
534
  /** WHERE clause for partial index */
1215
535
  where?: Decision[];
1216
536
  }
@@ -1219,9 +539,10 @@ interface ConflictTarget {
1219
539
  */
1220
540
  interface UpsertConfig {
1221
541
  /** Table to upsert into */
1222
- table: string;
542
+ table: SqlIdentifier;
543
+ tableMetadata?: MutationTableMetadata;
1223
544
  /** Columns to insert */
1224
- columns: string[];
545
+ columns: SqlIdentifier[];
1225
546
  /** Values for each column (array of rows) */
1226
547
  values: unknown[][];
1227
548
  /** Conflict target (unique columns or constraint) */
@@ -1229,7 +550,8 @@ interface UpsertConfig {
1229
550
  /** What to do on conflict */
1230
551
  conflictAction: ConflictAction;
1231
552
  /** Columns to update on conflict (for 'update' action) */
1232
- updateColumns?: string[];
553
+ updateColumns?: SqlIdentifier[];
554
+ updateColumnAddresses?: MutationColumnAddress[];
1233
555
  /** Optional WHERE clause for ON CONFLICT DO UPDATE */
1234
556
  actionWhere?: Decision[];
1235
557
  /** Optional direct WHERE intent for ON CONFLICT DO UPDATE */
@@ -1238,23 +560,26 @@ interface UpsertConfig {
1238
560
  compileActionWhere?: (where: WhereIntent, state: CompilerState) => Node;
1239
561
  /** Use EXCLUDED.column for update values (default: true) */
1240
562
  useExcluded?: boolean;
563
+ /** Explicit scalar SET values, independent of INSERT values. */
564
+ updateValues?: ReadonlyMap<SqlIdentifier, unknown>;
1241
565
  /** Columns to return (RETURNING clause) */
1242
566
  returning?: string[];
567
+ returningSources?: SqlIdentifier[];
1243
568
  /** Alias-aware RETURNING projection items */
1244
569
  returningItems?: readonly MutationReturningItem[];
1245
570
  /** Optional column type hints for unnest casting (schema-driven) */
1246
- columnTypes?: Record<string, string>;
571
+ columnTypes?: Record<string, string | MutationColumnMetadata>;
1247
572
  /**
1248
573
  * Raw SQL expressions for specific update columns.
1249
574
  * These are injected verbatim into the ON CONFLICT DO UPDATE SET clause.
1250
- * Keys are logical column names (before naming plugin), values are raw SQL fragments.
575
+ * Keys are addressed target columns, values are raw SQL fragments.
1251
576
  *
1252
577
  * @warning SECURITY: fragments are inserted without parameterization.
1253
578
  * Only use with hardcoded expressions. Never with user input.
1254
579
  *
1255
580
  * @example { last_parsed: 'now()', count: 'excluded.count + 1' }
1256
581
  */
1257
- updateExpressions?: Record<string, string>;
582
+ updateExpressions?: ReadonlyMap<SqlIdentifier, string>;
1258
583
  }
1259
584
  /**
1260
585
  * Build ON CONFLICT clause for INSERT statement.
@@ -1269,46 +594,14 @@ declare function compileUpsert(config: UpsertConfig, ctx: CompilerContext, state
1269
594
  * EXCLUDED is a special table alias in ON CONFLICT ... DO UPDATE
1270
595
  * that refers to the row that would have been inserted.
1271
596
  */
1272
- declare function excludedRef(column: string, naming: {
1273
- toDatabase: (s: string) => string;
1274
- }): Node;
597
+ declare function excludedRef(column: SqlIdentifier): Node;
1275
598
  /**
1276
599
  * Build conditional update using COALESCE.
1277
600
  *
1278
601
  * Produces: COALESCE(EXCLUDED.col, table.col)
1279
602
  * This keeps existing value if new value is NULL.
1280
603
  */
1281
- declare function conditionalUpdate(column: string, table: string, ctx: CompilerContext): Node;
1282
-
1283
- /**
1284
- * @module naming
1285
- * Utilities for resolving database names to logical model names.
1286
- *
1287
- * The ModelIR.getTable() method expects logical (camelCase) names,
1288
- * but the adapter often works with database (snake_case) names.
1289
- * This module bridges that gap.
1290
- */
1291
-
1292
- /**
1293
- * Resolve a database table name to the corresponding logical model name.
1294
- *
1295
- * Converts the DB name using the naming convention, then looks it up in the model.
1296
- * Falls back to exact match if conversion doesn't find a match.
1297
- *
1298
- * @param model - The model IR to search in
1299
- * @param dbName - Database table name (e.g. "post_comments")
1300
- * @param convention - Naming convention used by the adapter
1301
- * @returns The logical table name if found, undefined otherwise
1302
- *
1303
- * @example
1304
- * ```typescript
1305
- * // With camelCase convention:
1306
- * resolveLogicalName(model, "post_comments", "camelCase") // → "postComments"
1307
- * resolveLogicalName(model, "posts", "camelCase") // → "posts"
1308
- * resolveLogicalName(model, "unknown", "camelCase") // → undefined
1309
- * ```
1310
- */
1311
- declare function resolveLogicalName(model: ModelIR, dbName: string, casing: DbCasing): string | undefined;
604
+ declare function conditionalUpdate(column: SqlIdentifier, table: SqlIdentifier, ctx: CompilerContext): Node;
1312
605
 
1313
606
  /**
1314
607
  * ParamRef validation and helpers for PostgreSQL AST
@@ -1365,7 +658,7 @@ declare function collectAndValidateParamRefs(node: unknown): {
1365
658
  allValid: boolean;
1366
659
  };
1367
660
 
1368
- declare function derivePostgresqlCapabilitiesForVersion(version: string): DialectCapabilities;
661
+ declare function derivePgCapabilitiesForVersion(version: string): DialectCapabilities;
1369
662
 
1370
663
  /**
1371
664
  * Redact sensitive values in a query dump's `params` array before logging.
@@ -1440,7 +733,7 @@ declare function compileSetOperation(intent: SetOperationIntent, compileFn: Leaf
1440
733
  /**
1441
734
  * Create a leaf compile function from adapter + model + capabilities.
1442
735
  *
1443
- * Convenience factory for the common case where you have a PgsqlAdapter
736
+ * Convenience factory for the common case where you have a PgAdapter
1444
737
  * and need a compileFn for `compileSetOperation`.
1445
738
  *
1446
739
  * @param adapter - Adapter with compile() and dialectCapabilities
@@ -1449,10 +742,10 @@ declare function compileSetOperation(intent: SetOperationIntent, compileFn: Leaf
1449
742
  */
1450
743
  declare function createLeafCompileFn(adapter: {
1451
744
  compile(plan: PlanReport, options: CompileOptions & {
1452
- model: ModelIR$1;
745
+ model: ModelIR;
1453
746
  }): CompiledQuery;
1454
747
  dialectCapabilities: DialectCapabilities;
1455
- }, model: ModelIR$1, planFn: (intent: QueryIntent, model: ModelIR$1, options: {
748
+ }, model: ModelIR, planFn: (intent: QueryIntent, model: ModelIR, options: {
1456
749
  dialectCapabilities: DialectCapabilities;
1457
750
  }) => PlanReport, options?: CompileOptions): LeafCompileFn;
1458
751
 
@@ -2175,7 +1468,7 @@ interface EnumAddValueRuleOptions {
2175
1468
  */
2176
1469
  readonly naming?: NamingPlugin;
2177
1470
  }
2178
- declare function satisfiesPgEnumLabelVisibleCompositionFact(fact: TransitionCompositionFact, current: ModelIR, _context: ObservationContext): boolean;
1471
+ declare function satisfiesPgEnumLabelVisibleCompositionFact(fact: TransitionCompositionFact, current: ModelIR$1, _context: ObservationContext): boolean;
2179
1472
  declare function createEnumAddValueRule(options?: EnumAddValueRuleOptions): TransitionRule<EnumAddValueMatch>;
2180
1473
 
2181
1474
  interface CreateUniqueIndexConcurrentlyMatch {
@@ -2221,65 +1514,65 @@ interface PgTransitionPackOptions {
2221
1514
  readonly identityAdoptionSelectionBasis?: string;
2222
1515
  }
2223
1516
  declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2224
- rules: (_dbsp_types.TransitionRule<AddCheckMatch> | _dbsp_types.TransitionRule<LogicalIdentityAdoptionMatch> | _dbsp_types.TransitionRule<CreateUniqueIndexConcurrentlyMatch> | _dbsp_types.TransitionRule<EnumAddValueMatch> | _dbsp_types.TransitionRule<SetNotNullMatch>)[];
1517
+ rules: (_dbsp_core_internal.TransitionRule<AddCheckMatch> | _dbsp_core_internal.TransitionRule<LogicalIdentityAdoptionMatch> | _dbsp_core_internal.TransitionRule<CreateUniqueIndexConcurrentlyMatch> | _dbsp_core_internal.TransitionRule<EnumAddValueMatch> | _dbsp_core_internal.TransitionRule<SetNotNullMatch>)[];
2225
1518
  operationSemantics: ({
2226
1519
  artifact: _dbsp_types.SemanticArtifactRef;
2227
1520
  operationKind: _dbsp_types.OperationKindRef;
2228
1521
  executionContractEligibility: {
2229
1522
  readonly eligible: true;
2230
1523
  };
2231
- supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
2232
- renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
2233
- effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
2234
- buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
2235
- expectedBefore: _dbsp_types.FingerprintManifest;
2236
- expectedAfter: _dbsp_types.FingerprintManifest;
1524
+ supportsOperation(operation: _dbsp_core_internal.PhysicalOperation): boolean;
1525
+ renderPlanSql(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): string;
1526
+ effectsOf(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): _dbsp_core_internal.OperationEffectAssessment;
1527
+ buildFingerprints: (operation: _dbsp_core_internal.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_core_internal.ObservationContext) => {
1528
+ expectedBefore: _dbsp_core_internal.FingerprintManifest;
1529
+ expectedAfter: _dbsp_core_internal.FingerprintManifest;
2237
1530
  };
2238
1531
  writeIntentJournal(client: {
2239
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2240
- }, record: _dbsp_types.DurableIntentRecord): Promise<void>;
1532
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1533
+ }, record: _dbsp_core_internal.DurableIntentRecord): Promise<void>;
2241
1534
  begin(client: {
2242
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1535
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2243
1536
  }): Promise<void>;
2244
1537
  setLockTimeout(client: {
2245
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1538
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2246
1539
  }, maxWaitMs: number): Promise<void>;
2247
1540
  acquireLocks(client: {
2248
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2249
- }, operation: _dbsp_types.PhysicalOperation, _effects: _dbsp_types.OperationEffectAssessment, context: _dbsp_types.ObservationContext): Promise<void>;
1541
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1542
+ }, operation: _dbsp_core_internal.PhysicalOperation, _effects: _dbsp_core_internal.OperationEffectAssessment, context: _dbsp_core_internal.ObservationContext): Promise<void>;
2250
1543
  observeContext(client: {
2251
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2252
- }, operation: _dbsp_types.PhysicalOperation, _proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
1544
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1545
+ }, operation: _dbsp_core_internal.PhysicalOperation, _proofContext: _dbsp_core_internal.ObservationContext): Promise<_dbsp_core_internal.ObservationContext>;
2253
1546
  observeOperation(client: {
2254
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2255
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, _phase: "before" | "after", issuer: _dbsp_types.ObservationIssuer): Promise<{
1547
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1548
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, _phase: "before" | "after", issuer: _dbsp_core_internal.ObservationIssuer): Promise<{
2256
1549
  observations: _dbsp_types.IssuedObservation[];
2257
- fingerprint: _dbsp_types.FingerprintManifest;
1550
+ fingerprint: _dbsp_core_internal.FingerprintManifest;
2258
1551
  }>;
2259
1552
  checkGuard(client: {
2260
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2261
- }, operation: _dbsp_types.PhysicalOperation, guard: _dbsp_types.ApplyGuard, context: _dbsp_types.ObservationContext): Promise<{
1553
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1554
+ }, operation: _dbsp_core_internal.PhysicalOperation, guard: _dbsp_types.ApplyGuard, context: _dbsp_core_internal.ObservationContext): Promise<{
2262
1555
  passed: boolean;
2263
1556
  observations: _dbsp_types.AdvisoryObservation[];
2264
1557
  recovery: readonly _dbsp_types.RecoveryArtefact[];
2265
1558
  }>;
2266
1559
  executeOperation(client: {
2267
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2268
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[]): Promise<{
1560
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1561
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[]): Promise<{
2269
1562
  kind: string;
2270
1563
  }>;
2271
1564
  writeCompletionJournal(client: {
2272
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2273
- }, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
1565
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1566
+ }, operation: _dbsp_core_internal.PhysicalOperation, record: _dbsp_core_internal.TransactionalCompletionRecord): Promise<void>;
2274
1567
  commit(client: {
2275
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1568
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2276
1569
  }): Promise<void>;
2277
1570
  rollback(client: {
2278
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1571
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2279
1572
  }): Promise<void>;
2280
1573
  writeObservedJournal(client: {
2281
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2282
- }, journal: _dbsp_types.StepJournal): Promise<void>;
1574
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1575
+ }, journal: _dbsp_core_internal.StepJournal): Promise<void>;
2283
1576
  isLockTimeout(error: unknown): boolean;
2284
1577
  } | {
2285
1578
  artifact: _dbsp_types.SemanticArtifactRef;
@@ -2291,58 +1584,58 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2291
1584
  readonly setting: "standard_conforming_strings";
2292
1585
  readonly value: "on";
2293
1586
  }];
2294
- supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
2295
- renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
2296
- effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
2297
- buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
2298
- expectedBefore: _dbsp_types.FingerprintManifest;
2299
- expectedAfter: _dbsp_types.FingerprintManifest;
1587
+ supportsOperation(operation: _dbsp_core_internal.PhysicalOperation): boolean;
1588
+ renderPlanSql(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): string;
1589
+ effectsOf(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): _dbsp_core_internal.OperationEffectAssessment;
1590
+ buildFingerprints: (operation: _dbsp_core_internal.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_core_internal.ObservationContext) => {
1591
+ expectedBefore: _dbsp_core_internal.FingerprintManifest;
1592
+ expectedAfter: _dbsp_core_internal.FingerprintManifest;
2300
1593
  };
2301
1594
  writeIntentJournal(client: {
2302
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2303
- }, record: _dbsp_types.DurableIntentRecord): Promise<void>;
1595
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1596
+ }, record: _dbsp_core_internal.DurableIntentRecord): Promise<void>;
2304
1597
  begin(client: {
2305
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1598
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2306
1599
  }): Promise<void>;
2307
1600
  setLockTimeout(client: {
2308
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1601
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2309
1602
  }, maxWaitMs: number): Promise<void>;
2310
1603
  acquireLocks(client: {
2311
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2312
- }, operation: _dbsp_types.PhysicalOperation): Promise<void>;
1604
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1605
+ }, operation: _dbsp_core_internal.PhysicalOperation): Promise<void>;
2313
1606
  observeContext(client: {
2314
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2315
- }, operation: _dbsp_types.PhysicalOperation, _proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
1607
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1608
+ }, operation: _dbsp_core_internal.PhysicalOperation, _proofContext: _dbsp_core_internal.ObservationContext): Promise<_dbsp_core_internal.ObservationContext>;
2316
1609
  observeOperation(client: {
2317
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2318
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, _phase: "before" | "after", issuer: _dbsp_types.ObservationIssuer): Promise<{
1610
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1611
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, _phase: "before" | "after", issuer: _dbsp_core_internal.ObservationIssuer): Promise<{
2319
1612
  observations: _dbsp_types.IssuedObservation[];
2320
- fingerprint: _dbsp_types.FingerprintManifest;
1613
+ fingerprint: _dbsp_core_internal.FingerprintManifest;
2321
1614
  }>;
2322
1615
  checkGuard(client: {
2323
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2324
- }, operation: _dbsp_types.PhysicalOperation, guard: _dbsp_types.ApplyGuard, context: _dbsp_types.ObservationContext): Promise<{
1616
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1617
+ }, operation: _dbsp_core_internal.PhysicalOperation, guard: _dbsp_types.ApplyGuard, context: _dbsp_core_internal.ObservationContext): Promise<{
2325
1618
  passed: boolean;
2326
1619
  observations: _dbsp_types.EvidenceObservation[];
2327
1620
  recovery: readonly _dbsp_types.RecoveryArtefact[];
2328
1621
  }>;
2329
1622
  executeOperation(client: {
2330
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2331
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[]): Promise<{
1623
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1624
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[]): Promise<{
2332
1625
  kind: string;
2333
1626
  }>;
2334
1627
  writeCompletionJournal(client: {
2335
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2336
- }, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
1628
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1629
+ }, operation: _dbsp_core_internal.PhysicalOperation, record: _dbsp_core_internal.TransactionalCompletionRecord): Promise<void>;
2337
1630
  commit(client: {
2338
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1631
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2339
1632
  }): Promise<void>;
2340
1633
  rollback(client: {
2341
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1634
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2342
1635
  }): Promise<void>;
2343
1636
  writeObservedJournal(client: {
2344
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2345
- }, journal: _dbsp_types.StepJournal): Promise<void>;
1637
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1638
+ }, journal: _dbsp_core_internal.StepJournal): Promise<void>;
2346
1639
  isLockTimeout(error: unknown): boolean;
2347
1640
  } | {
2348
1641
  artifact: _dbsp_types.SemanticArtifactRef;
@@ -2350,33 +1643,33 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2350
1643
  readonly eligible: false;
2351
1644
  readonly detail: "PostgreSQL AttachLogicalIdentity has no derivable execution requirements yet";
2352
1645
  };
2353
- supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
2354
- renderPlanSql(operation: _dbsp_types.PhysicalOperation): string;
2355
- effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
2356
- buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
2357
- expectedBefore: _dbsp_types.FingerprintManifest;
2358
- expectedAfter: _dbsp_types.FingerprintManifest;
1646
+ supportsOperation(operation: _dbsp_core_internal.PhysicalOperation): boolean;
1647
+ renderPlanSql(operation: _dbsp_core_internal.PhysicalOperation): string;
1648
+ effectsOf(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): _dbsp_core_internal.OperationEffectAssessment;
1649
+ buildFingerprints: (operation: _dbsp_core_internal.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_core_internal.ObservationContext) => {
1650
+ expectedBefore: _dbsp_core_internal.FingerprintManifest;
1651
+ expectedAfter: _dbsp_core_internal.FingerprintManifest;
2359
1652
  };
2360
1653
  writeIntentJournal(client: {
2361
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2362
- }, record: _dbsp_types.DurableIntentRecord): Promise<void>;
1654
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1655
+ }, record: _dbsp_core_internal.DurableIntentRecord): Promise<void>;
2363
1656
  begin(client: {
2364
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1657
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2365
1658
  }): Promise<void>;
2366
1659
  setLockTimeout(client: {
2367
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1660
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2368
1661
  }, maxWaitMs: number): Promise<void>;
2369
1662
  acquireLocks(client: {
2370
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2371
- }, operation: _dbsp_types.PhysicalOperation): Promise<void>;
1663
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1664
+ }, operation: _dbsp_core_internal.PhysicalOperation): Promise<void>;
2372
1665
  observeContext(client: {
2373
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2374
- }, operation: _dbsp_types.PhysicalOperation, _proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
1666
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1667
+ }, operation: _dbsp_core_internal.PhysicalOperation, _proofContext: _dbsp_core_internal.ObservationContext): Promise<_dbsp_core_internal.ObservationContext>;
2375
1668
  observeOperation(client: {
2376
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2377
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, phase: "before" | "after", issuer: _dbsp_types.ObservationIssuer): Promise<{
1669
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1670
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, phase: "before" | "after", issuer: _dbsp_core_internal.ObservationIssuer): Promise<{
2378
1671
  observations: _dbsp_types.IssuedObservation[];
2379
- fingerprint: _dbsp_types.FingerprintManifest;
1672
+ fingerprint: _dbsp_core_internal.FingerprintManifest;
2380
1673
  }>;
2381
1674
  checkGuard(): Promise<{
2382
1675
  passed: boolean;
@@ -2384,22 +1677,22 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2384
1677
  recovery: never[];
2385
1678
  }>;
2386
1679
  executeOperation(client: {
2387
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2388
- }, operation: _dbsp_types.PhysicalOperation): Promise<{
1680
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1681
+ }, operation: _dbsp_core_internal.PhysicalOperation): Promise<{
2389
1682
  kind: "completed";
2390
1683
  }>;
2391
1684
  writeCompletionJournal(client: {
2392
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2393
- }, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
1685
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1686
+ }, operation: _dbsp_core_internal.PhysicalOperation, record: _dbsp_core_internal.TransactionalCompletionRecord): Promise<void>;
2394
1687
  commit(client: {
2395
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1688
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2396
1689
  }): Promise<void>;
2397
1690
  rollback(client: {
2398
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1691
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2399
1692
  }): Promise<void>;
2400
1693
  writeObservedJournal(client: {
2401
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2402
- }, journal: _dbsp_types.StepJournal): Promise<void>;
1694
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1695
+ }, journal: _dbsp_core_internal.StepJournal): Promise<void>;
2403
1696
  isLockTimeout(error: unknown): boolean;
2404
1697
  } | {
2405
1698
  artifact: _dbsp_types.SemanticArtifactRef;
@@ -2407,38 +1700,38 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2407
1700
  executionContractEligibility: {
2408
1701
  readonly eligible: true;
2409
1702
  };
2410
- supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
2411
- renderPlanSql(operation: _dbsp_types.PhysicalOperation): string;
2412
- effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
2413
- buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
2414
- expectedBefore: _dbsp_types.FingerprintManifest;
2415
- expectedAfter: _dbsp_types.FingerprintManifest;
1703
+ supportsOperation(operation: _dbsp_core_internal.PhysicalOperation): boolean;
1704
+ renderPlanSql(operation: _dbsp_core_internal.PhysicalOperation): string;
1705
+ effectsOf(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): _dbsp_core_internal.OperationEffectAssessment;
1706
+ buildFingerprints: (operation: _dbsp_core_internal.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_core_internal.ObservationContext) => {
1707
+ expectedBefore: _dbsp_core_internal.FingerprintManifest;
1708
+ expectedAfter: _dbsp_core_internal.FingerprintManifest;
2416
1709
  };
2417
1710
  writeIntentJournal(client: {
2418
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2419
- }, record: _dbsp_types.DurableIntentRecord): Promise<void>;
1711
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1712
+ }, record: _dbsp_core_internal.DurableIntentRecord): Promise<void>;
2420
1713
  begin(_client: {
2421
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1714
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2422
1715
  }): Promise<never>;
2423
1716
  setLockTimeout(_client: {
2424
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1717
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2425
1718
  }, _maxWaitMs: number): Promise<void>;
2426
1719
  acquireLocks(): Promise<void>;
2427
1720
  observeContext(client: {
2428
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2429
- }, operation: _dbsp_types.PhysicalOperation, _proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
1721
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1722
+ }, operation: _dbsp_core_internal.PhysicalOperation, _proofContext: _dbsp_core_internal.ObservationContext): Promise<_dbsp_core_internal.ObservationContext>;
2430
1723
  observeOperation(client: {
2431
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2432
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, phase: "before" | "after", issuer: _dbsp_types.ObservationIssuer): Promise<{
1724
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1725
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, phase: "before" | "after", issuer: _dbsp_core_internal.ObservationIssuer): Promise<{
2433
1726
  observations: _dbsp_types.IssuedObservation[];
2434
- fingerprint: _dbsp_types.FingerprintManifest;
1727
+ fingerprint: _dbsp_core_internal.FingerprintManifest;
2435
1728
  }>;
2436
1729
  checkGuard(_client: {
2437
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2438
- }, _operation: _dbsp_types.PhysicalOperation, guard: _dbsp_types.ApplyGuard): Promise<never>;
1730
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1731
+ }, _operation: _dbsp_core_internal.PhysicalOperation, guard: _dbsp_types.ApplyGuard): Promise<never>;
2439
1732
  executeOperation(client: {
2440
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2441
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[], executionTracker?: _dbsp_core.NonRollbackableExecutionTracker): Promise<{
1733
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1734
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, duringGuards?: readonly _dbsp_types.ApplyGuard[], executionTracker?: _dbsp_core_internal.NonRollbackableExecutionTracker): Promise<{
2442
1735
  kind: "partially-applied";
2443
1736
  recovery: _dbsp_types.RecoveryArtefact[];
2444
1737
  detail: string;
@@ -2454,17 +1747,17 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2454
1747
  nonRollbackableFootprint: string;
2455
1748
  }>;
2456
1749
  writeCompletionJournal(client: {
2457
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2458
- }, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
1750
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1751
+ }, operation: _dbsp_core_internal.PhysicalOperation, record: _dbsp_core_internal.TransactionalCompletionRecord): Promise<void>;
2459
1752
  commit(_client: {
2460
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1753
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2461
1754
  }): Promise<never>;
2462
1755
  rollback(_client: {
2463
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1756
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2464
1757
  }): Promise<never>;
2465
1758
  writeObservedJournal(client: {
2466
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2467
- }, journal: _dbsp_types.StepJournal): Promise<void>;
1759
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1760
+ }, journal: _dbsp_core_internal.StepJournal): Promise<void>;
2468
1761
  isLockTimeout(error: unknown): boolean;
2469
1762
  } | {
2470
1763
  artifact: _dbsp_types.SemanticArtifactRef;
@@ -2473,31 +1766,31 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2473
1766
  readonly eligible: false;
2474
1767
  readonly detail: "PostgreSQL ManualSql has no derivable execution requirements because its statement has no declared schema target";
2475
1768
  };
2476
- supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
2477
- renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
2478
- effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
2479
- buildFingerprints: (operation: _dbsp_types.PhysicalOperation, _evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
2480
- expectedBefore: _dbsp_types.FingerprintManifest;
2481
- expectedAfter: _dbsp_types.FingerprintManifest;
1769
+ supportsOperation(operation: _dbsp_core_internal.PhysicalOperation): boolean;
1770
+ renderPlanSql(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): string;
1771
+ effectsOf(operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): _dbsp_core_internal.OperationEffectAssessment;
1772
+ buildFingerprints: (operation: _dbsp_core_internal.PhysicalOperation, _evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_core_internal.ObservationContext) => {
1773
+ expectedBefore: _dbsp_core_internal.FingerprintManifest;
1774
+ expectedAfter: _dbsp_core_internal.FingerprintManifest;
2482
1775
  };
2483
1776
  writeIntentJournal(client: {
2484
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2485
- }, record: _dbsp_types.DurableIntentRecord): Promise<void>;
1777
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1778
+ }, record: _dbsp_core_internal.DurableIntentRecord): Promise<void>;
2486
1779
  begin(client: {
2487
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1780
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2488
1781
  }): Promise<void>;
2489
1782
  setLockTimeout(_client: {
2490
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1783
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2491
1784
  }, _maxWaitMs: number): Promise<void>;
2492
1785
  acquireLocks(): Promise<void>;
2493
1786
  observeContext(client: {
2494
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2495
- }, _operation: _dbsp_types.PhysicalOperation, proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
1787
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1788
+ }, _operation: _dbsp_core_internal.PhysicalOperation, proofContext: _dbsp_core_internal.ObservationContext): Promise<_dbsp_core_internal.ObservationContext>;
2496
1789
  observeOperation(_client: {
2497
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2498
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, phase: "before" | "after"): Promise<{
1790
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1791
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext, phase: "before" | "after"): Promise<{
2499
1792
  observations: never[];
2500
- fingerprint: _dbsp_types.FingerprintManifest;
1793
+ fingerprint: _dbsp_core_internal.FingerprintManifest;
2501
1794
  }>;
2502
1795
  checkGuard(): Promise<{
2503
1796
  passed: boolean;
@@ -2505,25 +1798,25 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
2505
1798
  recovery: never[];
2506
1799
  }>;
2507
1800
  executeOperation(client: {
2508
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2509
- }, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): Promise<{
1801
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1802
+ }, operation: _dbsp_core_internal.PhysicalOperation, context: _dbsp_core_internal.ObservationContext): Promise<{
2510
1803
  kind: "completed";
2511
1804
  }>;
2512
1805
  writeCompletionJournal(client: {
2513
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2514
- }, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
1806
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1807
+ }, operation: _dbsp_core_internal.PhysicalOperation, record: _dbsp_core_internal.TransactionalCompletionRecord): Promise<void>;
2515
1808
  commit(client: {
2516
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1809
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2517
1810
  }): Promise<void>;
2518
1811
  rollback(client: {
2519
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
1812
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
2520
1813
  }): Promise<void>;
2521
1814
  writeObservedJournal(client: {
2522
- readonly opaqueClient: _dbsp_types.TransitionSessionClient;
2523
- }, journal: _dbsp_types.StepJournal): Promise<void>;
1815
+ readonly opaqueClient: _dbsp_core_internal.TransitionSessionClient;
1816
+ }, journal: _dbsp_core_internal.StepJournal): Promise<void>;
2524
1817
  isLockTimeout(error: unknown): boolean;
2525
1818
  })[];
2526
- issuer: _dbsp_types.ObservationIssuer;
1819
+ issuer: _dbsp_core_internal.ObservationIssuer;
2527
1820
  executionCoordinator: ExecutionCoordinator;
2528
1821
  transactionDomain: string;
2529
1822
  equivalence: _dbsp_types.EquivalenceCapability;
@@ -2880,4 +2173,4 @@ declare function sanitizeForDisplay(value: string): string;
2880
2173
  */
2881
2174
  declare function validateSqlExpression(sql: string, context: string): void;
2882
2175
 
2883
- export { ADD_CHECK_RULE_ID, ALTER_AUTHORITY_OBSERVATION, ALTER_COLUMN_SET_NOT_NULL_OPERATION_KIND, ALTER_TYPE_ADD_VALUE_OPERATION_KIND, ATTACH_LOGICAL_IDENTITY_OPERATION_KIND, type AlterColumnSetNotNullPayload, type AlterTypeAddValuePayload, type AttachLogicalIdentityPayload, type BatchValuesJoinDecision, COLUMN_EXISTS_OBSERVATION, ChangeKind, type CompiledResult, type CompilerContext, type CompilerOptions, type CompilerState, type ConflictAction, type ConflictTarget, type ConvergePgBaseOptions, type ConvergePgCheckOptions, type ConvergePgOptions, type CursorHoldOption, type CursorOptions, type CursorScrollOption, DATABASE_READ_ONLY_OUTCOME, DBSP_LEDGER_EVENT_TABLE, DBSP_LEDGER_IDENTITY_TABLE, DBSP_LEDGER_MARKER_TABLE, DBSP_LEDGER_RESERVATION_TABLE, DBSP_LOGICAL_IDENTITY_TABLE, DBSP_META_SCHEMA, DBSP_TRANSITION_AUTHORIZATION_TABLE, DBSP_TRANSITION_JOURNAL_TABLE, DBSP_TRANSITION_RUN_PLAN_TABLE, DBSP_TRANSITION_RUN_TABLE, DEFAULT_REDACTION_PATTERNS, type Decision, type DeleteConfig, ENGINE_VERSION_OBSERVATION, ENUM_ADD_VALUE_RULE_ID, ENUM_LABEL_VISIBLE_OBSERVATION, ENUM_TYPE_EXISTS_OBSERVATION, type EnumAddValueMatch, type EnumAddValueRuleOptions, type ExplainFormat, type ExplainOptions, type ExplainPlan, type ExpressionHandler, type FetchDirection, type FetchOptions, FkColumnDerivation, type GeneratedIdentityObservation, type GeneratedMutationClassification, type GeneratedPostconditionObservation, type GeneratedPostconditionReadBack, GeneratedPostconditionSession, type GeneratedStructuralObservation, type IdentityAdoptionAsserter, type IncludeHandler, type IncludeResult, type InsertConfig, InvalidIdentifierError, type JoinDecision, LOGICAL_IDENTITY_ADOPTION_RULE_ID, LOGICAL_IDENTITY_CARRIER_OBSERVATION, type LeafCompileFn, type LogicalIdentityAdoptionMatch, type LogicalIdentityAdoptionRuleOptions, MANUAL_SQL_OPERATION_KIND, type ManualSqlPayload, NO_NULLS_GUARD, NamingPlugin, PG_INTROSPECTION_ARTIFACT, PG_OPERATION_PACK_ARTIFACT, PG_RULE_PACK_ARTIFACT, type ParamRefValidationResult, type PgAdoptionPreflightResult, type PgAdoptionResult, PgConvergeCheckResult, PgConvergeResult, PgDatabaseReadOnlyError, type PgDatabaseWritability, type PgDeclaredAdoptionInput, PgExecutionContractDerivationError, type PgLedgerAddressChain, PgLedgerScopeCurrency, PgLockedRun, PgOutcomeCheckpointObserver, type PgPersistedDeclaredAdoptionInput, type PgPersistedReaddressInput, PgPhysicalModel, type PgReaddressPairRecoveryResult, type PgReconcileFailureStage, type PgReconcileRecoveryFailureCause, type PgReconcileRecoveryOutcome, type PgReconcileRecoveryReport, type PgReconcileSelectedIssue, PgReconcileTransitionRunError, type PgReconcileTransitionRunResult, type PgReleaseResult, type PgRemovalEffectAddress, type PgRemovalEffectsClosure, type PgTransitionClientLease, type PgTransitionPackOptions, PlanCompiler, type PlanDecision, type PrecompiledJoinDecision, type RedactionConfig, type RedactionPattern, SET_NOT_NULL_RULE_ID, type SetNotNullMatch, type SetOperationResult, type SimplifiedPlanReport, type StreamConfig, type UpdateConfig, type UpsertConfig, type WhereDispatcher, type WhereHandler, acquirePgTransitionClient, assertCreateUniqueIndexConcurrentlyRecoveryNotInvalid, assertPgDatabaseWritable, bm25Search, booleanSearch, boost, buildCloseCursor, buildDeclareCursor, buildExplain, buildExplainAnalyzeJson, buildExplainPlan, buildExplainVerbose, buildFetch, buildFetchAll, buildFetchFirst, buildFetchForward, buildFetchNext, buildOnConflictClause, buildStreamingStatements, classifyGeneratedMutation, classifyPgDatabaseWritability, classifyPgReaddressRecovery, classifyPgReaddressSupport, classifyPgWrite, classifyRemovalEffectsClosure, collectAndValidateParamRefs, compileDelete, compileInsert, compileMutation, compilePlan, compileSetOperation, compileUpdate, compileUpsert, conditionalUpdate, containmentAuthorityOutcome, convergePg, cosineDistance, createAlterColumnSetNotNullOperationRuntime, createAlterTypeAddValueOperationRuntime, createAnyExpr, createAttachLogicalIdentityOperationRuntime, createEnumAddValueRule, createEqualityExpr, createLeafCompileFn, createLogicalIdentityAdoptionRule, createManualSqlOperationRuntime, createParamRef, createPgExecutionContract, createPgObservationIssuer, createPgTransitionLessor, createPgTransitionPack, createSetNotNullRule, createTypeCastParamRef, dbTypesEqual, derivePostgresqlCapabilitiesForVersion, evaluatePgExecutionContract, excludedRef, executePgDeclaredAdoption, executePgObservationFromLessor, executePgPersistedTableReaddress, executionIdsForRun, findPgLedgerTerminalMember, generateCursorName, generateSeries, getRowEstimates, getTotalExecutionTime, innerProduct, isBatchValuesJoinDecision, isGeneratedMutationDestructive, isJoinDecision, isPgDatabaseReadOnlyError, isPrecompiledJoinDecision, isReservedKeyword, l2Distance, mapColumnType, mapOnDeleteAction, nextval, normalizeManualSqlPayload, parse, parseExplainJson, pgTargetIdentityMismatch, preflightPgDeclaredAdoption, preparePgExecutionSession, preparePgRecoveryAdmission, rawDistance, readGeneratedPostcondition, readGeneratedPostconditionReadBack, readPgExecutionTargetFromClient, readPgLedgerAddressChain, readPgLedgerControllerOid, readPgObservationContextFromClient, readPgObservationContextFromLessor, readPgRemovalEffectsClosure, readTransitionJournal, reconcilePgTransitionRun, recoverPgReaddressPair, redactParams, refusesRecordedPlanRemoval, releasePgManagedAddress, renderAlterColumnSetNotNullSql, renderAlterTypeAddValueSql, renderAttachLogicalIdentityLockSql, renderCreateLogicalIdentityIndexesSql, renderCreateLogicalIdentitySideTableSql, renderInsertLogicalIdentitySql, renderNoNullsCheckSql, renderPgTableReaddressStatements, renderSetNotNullLockSql, reservationsForRemovalClosure, resolveLogicalName, sanitizeForDisplay, score, validateIdentifier, validateIdentifiers, validateParamRef, validatePgManagedLedgerCurrency, validateQualifiedIdentifier, validateSqlExpression, vectorDims, withPgTransitionRunLock };
2176
+ export { ADD_CHECK_RULE_ID, ALTER_AUTHORITY_OBSERVATION, ALTER_COLUMN_SET_NOT_NULL_OPERATION_KIND, ALTER_TYPE_ADD_VALUE_OPERATION_KIND, ATTACH_LOGICAL_IDENTITY_OPERATION_KIND, type AlterColumnSetNotNullPayload, type AlterTypeAddValuePayload, type AttachLogicalIdentityPayload, COLUMN_EXISTS_OBSERVATION, ChangeKind, CompilerContext, CompilerState, type ConflictAction, type ConflictTarget, type ConvergePgBaseOptions, type ConvergePgCheckOptions, type ConvergePgOptions, type CursorHoldOption, type CursorOptions, type CursorScrollOption, DATABASE_READ_ONLY_OUTCOME, DBSP_LEDGER_EVENT_TABLE, DBSP_LEDGER_IDENTITY_TABLE, DBSP_LEDGER_MARKER_TABLE, DBSP_LEDGER_RESERVATION_TABLE, DBSP_LOGICAL_IDENTITY_TABLE, DBSP_META_SCHEMA, DBSP_TRANSITION_AUTHORIZATION_TABLE, DBSP_TRANSITION_JOURNAL_TABLE, DBSP_TRANSITION_RUN_PLAN_TABLE, DBSP_TRANSITION_RUN_TABLE, DEFAULT_REDACTION_PATTERNS, Decision, type DeleteConfig, ENGINE_VERSION_OBSERVATION, ENUM_ADD_VALUE_RULE_ID, ENUM_LABEL_VISIBLE_OBSERVATION, ENUM_TYPE_EXISTS_OBSERVATION, type EnumAddValueMatch, type EnumAddValueRuleOptions, type ExplainFormat, type ExplainOptions, type ExplainPlan, type FetchDirection, type FetchOptions, type GeneratedIdentityObservation, type GeneratedMutationClassification, type GeneratedPostconditionObservation, type GeneratedPostconditionReadBack, GeneratedPostconditionSession, type GeneratedStructuralObservation, type IdentityAdoptionAsserter, type InsertConfig, InvalidIdentifierError, LOGICAL_IDENTITY_ADOPTION_RULE_ID, LOGICAL_IDENTITY_CARRIER_OBSERVATION, type LeafCompileFn, type LogicalIdentityAdoptionMatch, type LogicalIdentityAdoptionRuleOptions, MANUAL_SQL_OPERATION_KIND, type ManualSqlPayload, NO_NULLS_GUARD, PG_INTROSPECTION_ARTIFACT, PG_OPERATION_PACK_ARTIFACT, PG_RULE_PACK_ARTIFACT, type ParamRefValidationResult, type PgAdoptionPreflightResult, type PgAdoptionResult, PgConvergeCheckResult, PgConvergeResult, PgDatabaseReadOnlyError, type PgDatabaseWritability, type PgDeclaredAdoptionInput, PgExecutionContractDerivationError, type PgLedgerAddressChain, PgLedgerScopeCurrency, PgLockedRun, PgOutcomeCheckpointObserver, type PgPersistedDeclaredAdoptionInput, type PgPersistedReaddressInput, PgPhysicalModel, type PgReaddressPairRecoveryResult, type PgReconcileFailureStage, type PgReconcileRecoveryFailureCause, type PgReconcileRecoveryOutcome, type PgReconcileRecoveryReport, type PgReconcileSelectedIssue, PgReconcileTransitionRunError, type PgReconcileTransitionRunResult, type PgReleaseResult, type PgRemovalEffectAddress, type PgRemovalEffectsClosure, type PgTransitionClientLease, type PgTransitionPackOptions, type RedactionConfig, type RedactionPattern, SET_NOT_NULL_RULE_ID, type SetNotNullMatch, type SetOperationResult, type StreamConfig, type UpdateConfig, type UpsertConfig, acquirePgTransitionClient, assertCreateUniqueIndexConcurrentlyRecoveryNotInvalid, assertPgDatabaseWritable, bm25Search, booleanSearch, boost, buildCloseCursor, buildDeclareCursor, buildExplain, buildExplainAnalyzeJson, buildExplainPlan, buildExplainVerbose, buildFetch, buildFetchAll, buildFetchFirst, buildFetchForward, buildFetchNext, buildOnConflictClause, buildStreamingStatements, classifyGeneratedMutation, classifyPgDatabaseWritability, classifyPgReaddressRecovery, classifyPgReaddressSupport, classifyPgWrite, classifyRemovalEffectsClosure, collectAndValidateParamRefs, compileDelete, compileInsert, compileMutation, compileSetOperation, compileUpdate, compileUpsert, conditionalUpdate, containmentAuthorityOutcome, convergePg, cosineDistance, createAlterColumnSetNotNullOperationRuntime, createAlterTypeAddValueOperationRuntime, createAnyExpr, createAttachLogicalIdentityOperationRuntime, createEnumAddValueRule, createEqualityExpr, createLeafCompileFn, createLogicalIdentityAdoptionRule, createManualSqlOperationRuntime, createParamRef, createPgExecutionContract, createPgObservationIssuer, createPgTransitionLessor, createPgTransitionPack, createSetNotNullRule, createTypeCastParamRef, dbTypesEqual, derivePgCapabilitiesForVersion, evaluatePgExecutionContract, excludedRef, executePgDeclaredAdoption, executePgObservationFromLessor, executePgPersistedTableReaddress, executionIdsForRun, findPgLedgerTerminalMember, generateCursorName, generateSeries, getRowEstimates, getTotalExecutionTime, innerProduct, isGeneratedMutationDestructive, isPgDatabaseReadOnlyError, isReservedKeyword, l2Distance, mapColumnType, mapOnDeleteAction, nextval, normalizeManualSqlPayload, parse, parseExplainJson, pgTargetIdentityMismatch, preflightPgDeclaredAdoption, preparePgExecutionSession, preparePgRecoveryAdmission, rawDistance, readGeneratedPostcondition, readGeneratedPostconditionReadBack, readPgExecutionTargetFromClient, readPgLedgerAddressChain, readPgLedgerControllerOid, readPgObservationContextFromClient, readPgObservationContextFromLessor, readPgRemovalEffectsClosure, readTransitionJournal, reconcilePgTransitionRun, recoverPgReaddressPair, redactParams, refusesRecordedPlanRemoval, releasePgManagedAddress, renderAlterColumnSetNotNullSql, renderAlterTypeAddValueSql, renderAttachLogicalIdentityLockSql, renderCreateLogicalIdentityIndexesSql, renderCreateLogicalIdentitySideTableSql, renderInsertLogicalIdentitySql, renderNoNullsCheckSql, renderPgTableReaddressStatements, renderSetNotNullLockSql, reservationsForRemovalClosure, sanitizeForDisplay, score, validateIdentifier, validateIdentifiers, validateParamRef, validatePgManagedLedgerCurrency, validateQualifiedIdentifier, validateSqlExpression, vectorDims, withPgTransitionRunLock };