@dbsp/adapter-pgsql 7.2.0 → 8.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/{chunk-WGJ4IBEN.js → chunk-GTX6FAK2.js} +697 -309
- package/dist/chunk-GTX6FAK2.js.map +1 -0
- package/dist/index.d.ts +10 -55
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +15 -5
- package/dist/internal.js +1 -1
- package/dist/{outcome-protocol-D-nihcUJ.d.ts → outcome-protocol-SJC5Zk63.d.ts} +16 -1
- package/package.json +3 -3
- package/dist/chunk-WGJ4IBEN.js.map +0 -1
package/dist/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _dbsp_types from '@dbsp/types';
|
|
2
2
|
import { TransitionRunMetadata, ProvenPlanShape, TransitionRunJournal, TransitionSessionClient, ModelIR, CompareOutcome, PlanAssessment, ObservationContext, ApplyResult, ApplyPolicy, ColumnListInput, ParamIntent, DialectCapabilities, WhereIntent, ExpressionIntent, NormalizedManagedStep } from '@dbsp/types';
|
|
3
3
|
import { Node } from '@pgsql/types';
|
|
4
|
-
import {
|
|
5
|
-
export { c6 as ComparePgDatabaseSchemaOptions, c7 as ComparePgDeclaredAdoptionSchemaInput, c8 as CompareSchemataOptions, c9 as ConvergePgBaseOptions, ca as ConvergePgCheckOptions,
|
|
4
|
+
import { am as PgLedgerTarget, T as TransitionJournalQueryable, b_ as PgOrderedLedgerLocks, b$ as PgLedgerShapeAllowance, c0 as PgLedgerPhysicalShapeOutcome, bA as readPgLedgerScopeCurrency, e as PgPhysicalModel, c1 as DeclaredNameResolver, F as FkColumnDerivation, c2 as BindingNameRegistry, c3 as QueryScope, c4 as RelationTargetProjectionRegistry, c5 as NestedSelectCompiler, a as CompilerContext, P as PgLockedRun, c as PgOutcomeCheckpointObserver } from './outcome-protocol-SJC5Zk63.js';
|
|
5
|
+
export { c6 as ComparePgDatabaseSchemaOptions, c7 as ComparePgDeclaredAdoptionSchemaInput, c8 as CompareSchemataOptions, c9 as ConvergePgBaseOptions, ca as ConvergePgCheckOptions, d as ConvergePgOptions, cb as GenerateDDLOptions, cc as MigrationSQLOptions, cd as PgAdoptionComparisonExecutor, a8 as PgApplicationStepTx, ce as PgCommitAcknowledgementAmbiguousError, ac as PgConvergeApplicationStep, ad as PgConvergeAssertStep, g as PgConvergeCheckResult, ae as PgConvergeInitializationFailure, af as PgConvergeOnceStep, ag as PgConvergePlannedStep, ai as PgConvergeRefusalChange, aj as PgConvergeRefusalError, f as PgConvergeResult, cf as appendPgLedgerClaim, cg as appendPgLedgerClaimGroup, ch as appendPgLedgerProgress, ci as appendPgLedgerRelease, cj as appendPgLedgerResolution, ck as appendPgLedgerResolutionGroup, cl as appendPgOutcomeResolution, cm as classifyPgLedgerPhysicalShape, cn as collectReferencedKeyRemovalConflicts, co as comparePgDatabaseSchema, cp as comparePgDeclaredAdoptionSchema, cq as compareSchemata, cr as convergePg, cs as createPgDeclaredAdoptionStep, ct as createPgDeclaredSequenceAdoptionStep, cu as createPgLedgerShapeAllowance, cv as executePgDestructiveOutcome, cw as generateDDL, cx as generateDownSQL, cy as generateMigrationSQL, cz as lockPgJournalRun, cA as modelForDeclaredAdoption, cB as openPgOutcomeClaim, cC as openPgOutcomeClaimGroup, cD as pgDeclaredAdoptionDeclaration, cE as pgDeclaredSequenceAdoptionDeclaration, cF as readPgLedgerReservationsForPair, cG as recoverPgAdmittedReaddressPair, cH as recoverPgOutcomeClaim, cI as resolvePgDestructiveOutcome, cJ as resolvePgOutcomeClaimGroup } from './outcome-protocol-SJC5Zk63.js';
|
|
6
6
|
import { TransitionRunAuthorization, JsonAggOrderByEntry, ScopedApprovalSet } from '@dbsp/types/internal';
|
|
7
7
|
import { InProcessProvenPlan, ValidatedManagedStepManifest } from '@dbsp/core/internal';
|
|
8
8
|
import { Pool, PoolClient } from 'pg';
|
|
@@ -266,15 +266,15 @@ interface SimplifiedPlanReport {
|
|
|
266
266
|
}[];
|
|
267
267
|
readonly expressionSubqueries?: readonly {
|
|
268
268
|
readonly expression: ExpressionIntent;
|
|
269
|
-
readonly
|
|
270
|
-
use: 'scalar';
|
|
271
|
-
}>;
|
|
269
|
+
readonly select: _dbsp_types.ResolvedNestedSelect;
|
|
272
270
|
}[];
|
|
273
271
|
readonly rawHaving?: WhereIntent;
|
|
274
272
|
readonly directConditions?: boolean;
|
|
275
273
|
/** Set when the report carries core's execution: FILTER and NQL CASE conditions read the resolved nodes. */
|
|
276
274
|
readonly resolvedExecution?: boolean;
|
|
277
275
|
readonly enclosingRanges?: CompilerContext['enclosingRanges'];
|
|
276
|
+
/** A nested select: the emitted qualifier of each enclosing root range, by its core alias. */
|
|
277
|
+
readonly enclosingQualifiers?: ReadonlyMap<string, string>;
|
|
278
278
|
readonly rootAlias?: string;
|
|
279
279
|
readonly rootTable: string;
|
|
280
280
|
readonly decisions: readonly PlanDecision[];
|
|
@@ -316,6 +316,10 @@ interface CompilerOptions {
|
|
|
316
316
|
readonly bindingNames?: BindingNameRegistry;
|
|
317
317
|
readonly scope?: QueryScope;
|
|
318
318
|
readonly relationTargetProjections?: RelationTargetProjectionRegistry;
|
|
319
|
+
/** Compiles a scalar subquery body that core resolved as a nested select. */
|
|
320
|
+
readonly compileNestedSelect?: NestedSelectCompiler;
|
|
321
|
+
/** The compiler of a query-local-source body: bodies below it keep its route. */
|
|
322
|
+
readonly localSubtree?: boolean;
|
|
319
323
|
}
|
|
320
324
|
declare class PlanCompiler {
|
|
321
325
|
private readonly declaredNames;
|
|
@@ -328,10 +332,14 @@ declare class PlanCompiler {
|
|
|
328
332
|
private readonly bindingNames;
|
|
329
333
|
private readonly scope;
|
|
330
334
|
private readonly relationTargetProjections;
|
|
335
|
+
private readonly nestedSelectCompiler;
|
|
336
|
+
private readonly localSubtree;
|
|
331
337
|
/** Mutable state shared with extracted condition/value compilation functions */
|
|
332
338
|
private state;
|
|
333
339
|
/** Track root table for EXISTS FK correlation */
|
|
334
340
|
private currentRootTable;
|
|
341
|
+
/** The emitted alias of the root range when it differs from its table (a nested body). */
|
|
342
|
+
private currentRootAlias;
|
|
335
343
|
/** Pending JOINs registered by filter/include strategies (flushed in compileSelect) */
|
|
336
344
|
private pendingJoins;
|
|
337
345
|
/** Raw JOIN AST nodes from include handlers (e.g., LATERAL) */
|
|
@@ -418,6 +426,8 @@ declare class PlanCompiler {
|
|
|
418
426
|
/** Build a fresh HandlerCompilerState sharing the current parameter array. */
|
|
419
427
|
private createHandlerState;
|
|
420
428
|
private schemaForRangeVar;
|
|
429
|
+
/** A FROM name bound in this query to a local source (an NQL binding, a CTE or a BatchValues range). */
|
|
430
|
+
private isQueryLocalSource;
|
|
421
431
|
private isNqlBindingRoot;
|
|
422
432
|
/** Classify a FROM target before it reaches the typed AST façade. */
|
|
423
433
|
private tableIdentifier;
|
package/dist/internal.js
CHANGED
|
@@ -2019,6 +2019,16 @@ interface CompilerContext {
|
|
|
2019
2019
|
ast: Node;
|
|
2020
2020
|
parameters: readonly unknown[];
|
|
2021
2021
|
};
|
|
2022
|
+
/**
|
|
2023
|
+
* Compile a scalar subquery body that core resolved as a nested select, with
|
|
2024
|
+
* the root select compiler, inside `parent`. Its parameters are numbered from
|
|
2025
|
+
* $1; the caller renumbers them into its own sequence.
|
|
2026
|
+
*/
|
|
2027
|
+
readonly compileNestedSelect?: NestedSelectCompiler;
|
|
2028
|
+
/** In a nested select: the emitted qualifier of each enclosing root range, by its core alias. */
|
|
2029
|
+
readonly enclosingQualifiers?: ReadonlyMap<string, string>;
|
|
2030
|
+
/** In a nested select whose alias differs from its table: the core alias of its root range. */
|
|
2031
|
+
readonly rootRangeAlias?: string;
|
|
2022
2032
|
/**
|
|
2023
2033
|
* Optional recursive compiler for NQL-origin SELECT expression values nested
|
|
2024
2034
|
* inside handler arguments, such as coalesce(upper(name), :fallback) or
|
|
@@ -2242,6 +2252,11 @@ interface IncludeResult {
|
|
|
2242
2252
|
/** Subquery for LATERAL */
|
|
2243
2253
|
lateral?: Node;
|
|
2244
2254
|
}
|
|
2255
|
+
/** Compiles core's nested select of a scalar subquery body inside its enclosing context. */
|
|
2256
|
+
type NestedSelectCompiler = (select: _dbsp_types.ResolvedNestedSelect, parent: CompilerContext) => {
|
|
2257
|
+
ast: Node;
|
|
2258
|
+
parameters: readonly unknown[];
|
|
2259
|
+
};
|
|
2245
2260
|
|
|
2246
2261
|
/** Compilation position selects the migrated root WHERE, FILTER and recursive-anchor paths; other callers retain their lowering. */
|
|
2247
2262
|
type ConditionPosition = 'where' | 'having' | 'filter' | 'join-on' | 'recursive-anchor' | 'subquery' | 'case-when' | 'update-where' | 'delete-where' | 'upsert-guard';
|
|
@@ -3056,4 +3071,4 @@ declare function executePgAdmittedOperation(session: TransitionJournalQueryable,
|
|
|
3056
3071
|
*/
|
|
3057
3072
|
declare function recoverPgOutcomeClaim(executor: TransitionJournalQueryable, request: PgOutcomeRecoveryRequest): Promise<PgOutcomeRecoveryResult>;
|
|
3058
3073
|
|
|
3059
|
-
export {
|
|
3074
|
+
export { PartialIndexPredicateNewEnumValueError as $, type AddedEnumValue as A, type GeneratedPostconditionBindingAddress as B, type ChangeKind as C, type Decision as D, ExpressionCanonicalizationUnavailableError as E, type FkColumnDerivation as F, type GeneratedPostconditionSession as G, GeneratedPostconditionBindingResolutionError as H, GeneratedPostconditionProofInFlightError as I, GeneratedPostconditionReplanRequiredError as J, GeneratedPostconditionSessionDeactivatedError as K, GeneratedPostconditionWorkInFlightError as L, type IncludeHandler as M, type IncludeResult as N, type IndexCapabilityContext as O, type PgLockedRun as P, IndexFeatureUnsupportedError as Q, IndexPredicateCanonicalizationError as R, type SqlIdentifier as S, type TransitionJournalQueryable as T, type IndexRenderSpec as U, type IntrospectedModelIR as V, type IntrospectionOptions as W, type MigrationSQLOptions as X, NonConvergentSchemaDiffError as Y, type NonConvergentSchemaDiffSurface as Z, PG_LEDGER_SHAPE_VERSION as _, type CompilerContext as a, type WhereDispatcher as a$, PgAdapter as a0, type PgAdapterOptions as a1, type PgAdmittedOperation as a2, type PgAdmittedOperationResult as a3, type PgAdvisoryLockKey as a4, PgAdvisoryLockOptionsError as a5, type PgAdvisoryLockResult as a6, type PgApplicationStepOwnedState as a7, type PgApplicationStepTx as a8, type PgBorrowedClientAdapterOptions as a9, PgPhysicalModelInputError as aA, type PgPhysicalNameClaim as aB, type PgPhysicalNameCollision as aC, PgPhysicalNameCollisionError as aD, type PgPhysicalNamespace as aE, PgPinnedConnectionAbortSignalError as aF, type PgPoolAdapterOptions as aG, PgPreparedStatementReplayError as aH, type PgPreparedStatementsOptions as aI, PgRawSqlTransactionControlError as aJ, type PgReinitializePreflightOptions as aK, type PgReinitializePreflightPool as aL, type PgRollbackOnlyScope as aM, type PgSchemaDiff as aN, PgTransactionAbortSignalError as aO, PgTransactionAbortedCommitError as aP, PgTransactionAbortedError as aQ, PgTransactionOptionsError as aR, PgTransactionTimeoutError as aS, RawIndexPredicateFallbackError as aT, type ReferencedKeyKind as aU, type ReferencedKeyRemovalConflict as aV, ReferencedKeyRemovalError as aW, type SchemaChange as aX, type SchemaDiff as aY, type SchemaScopeOptions as aZ, TransitionRunIdentityMismatchError as a_, type PgCatalogueIdentityQueryable as aa, type PgCompileOnlyAdapterOptions as ab, type PgConvergeApplicationStep as ac, type PgConvergeAssertStep as ad, type PgConvergeInitializationFailure as ae, type PgConvergeOnceStep as af, type PgConvergePlannedStep as ag, type PgConvergeRefusal as ah, type PgConvergeRefusalChange as ai, PgConvergeRefusalError as aj, type PgLedgerLockResult as ak, PgLedgerStorageUnsupportedError as al, type PgLedgerTarget as am, type PgOutcomeCheckpoint as an, type PgOutcomeClaimRequest as ao, type PgOutcomeExecutionRequest as ap, type PgOutcomeNonTransactionalRequest as aq, type PgOutcomeReadBackFactory as ar, type PgOutcomeRecoveryRequest as as, type PgOutcomeRecoveryResult as at, type PgOutcomeResolution as au, type PgOutcomeResolutionAppendResult as av, type PgOutcomeResult as aw, type PgOutcomeTransactionalRequest as ax, type PgOwnedCheckState as ay, type PgPhysicalModelInput as az, type CompilerState as b, type PgLedgerShapeAllowance as b$, type WhereHandler as b0, acquirePgLedgerLocks as b1, appendIntentJournal as b2, appendTransitionAuthorization as b3, assertCreateIndexSupported as b4, assertCreateIndexesSupported as b5, assertDeclarableChangeKind as b6, assertGeneratedPostconditionSession as b7, assertNoRepeatedExpressionSurfaceDrift as b8, canGenerateCreateIndex as b9, readPgLedgerScopeCurrency as bA, readPgOutcomeRecoveryReadBack as bB, readVerifiedPgLedgerReservationsForPair as bC, recordPgLedgerIdentity as bD, renderCreateDbspMetaSchemaSql as bE, renderCreateIndex as bF, renderCreateLedgerEventTableSql as bG, renderCreateLedgerIdentityTableSql as bH, renderCreateLedgerImmutabilityFunctionSql as bI, renderCreateLedgerImmutabilityTriggerSql as bJ, renderCreateLedgerMarkerTableSql as bK, renderCreateLedgerReservationTableSql as bL, renderCreateLedgerTerminalMemberIndexSql as bM, renderCreateTransitionAuthorizationTableSql as bN, renderCreateTransitionJournalTableSql as bO, renderCreateTransitionRunPlanTableSql as bP, renderCreateTransitionRunTableSql as bQ, runPgReinitializePreflight as bR, toGeneratedPostconditionBindingAddress as bS, validatePgLedgerRuntimeIntegrity as bT, verifyGeneratedCheckPostcondition as bU, verifyGeneratedColumnPostcondition as bV, verifyGeneratedIdentityPostcondition as bW, verifyGeneratedIndexPostcondition as bX, verifyGeneratedTablePostcondition as bY, withGeneratedPostconditionSession as bZ, type PgOrderedLedgerLocks as b_, canonicalizeCheckConstraints as ba, comparePgDatabaseSchema as bb, compareSchemata as bc, createPgAdapter as bd, createPgCompileOnlyAdapter as be, createPgGeneratedManagedStep as bf, createPgPhysicalModel as bg, createPgTransitionRunPersister as bh, decodeGeneratedPostcondition as bi, decodeGeneratedPostconditionPayload as bj, defaultFkDerivation as bk, ensureDbspMetaLedger as bl, ensurePgLedger as bm, ensurePgLedgerStorageVersion as bn, ensureTransitionJournal as bo, executePgAdmittedOperation as bp, generateCreateIndex as bq, generateDDL as br, generateDownSQL as bs, generateMigrationSQL as bt, generatedPostconditionDigest as bu, generatedPostconditionForChange as bv, introspect as bw, readPgCatalogueIdentity as bx, readPgLedgerMarker as by, readPgLedgerReservationsForExecution as bz, type PgOutcomeCheckpointObserver as c, type PgLedgerPhysicalShapeOutcome as c0, type DeclaredNameResolver as c1, type BindingNameRegistry as c2, type QueryScope as c3, type RelationTargetProjectionRegistry as c4, type NestedSelectCompiler as c5, type ComparePgDatabaseSchemaOptions$1 as c6, type ComparePgDeclaredAdoptionSchemaInput as c7, type CompareSchemataOptions$1 as c8, type ConvergePgBaseOptions as c9, modelForDeclaredAdoption as cA, openPgOutcomeClaim as cB, openPgOutcomeClaimGroup as cC, pgDeclaredAdoptionDeclaration as cD, pgDeclaredSequenceAdoptionDeclaration as cE, readPgLedgerReservationsForPair as cF, recoverPgAdmittedReaddressPair as cG, recoverPgOutcomeClaim as cH, resolvePgDestructiveOutcome as cI, resolvePgOutcomeClaimGroup as cJ, type ConvergePgCheckOptions as ca, type GenerateDDLOptions$1 as cb, type MigrationSQLOptions$1 as cc, type PgAdoptionComparisonExecutor as cd, PgCommitAcknowledgementAmbiguousError as ce, appendPgLedgerClaim as cf, appendPgLedgerClaimGroup as cg, appendPgLedgerProgress as ch, appendPgLedgerRelease as ci, appendPgLedgerResolution as cj, appendPgLedgerResolutionGroup as ck, appendPgOutcomeResolution as cl, classifyPgLedgerPhysicalShape as cm, collectReferencedKeyRemovalConflicts as cn, comparePgDatabaseSchema$1 as co, comparePgDeclaredAdoptionSchema as cp, compareSchemata$1 as cq, convergePg as cr, createPgDeclaredAdoptionStep as cs, createPgDeclaredSequenceAdoptionStep as ct, createPgLedgerShapeAllowance as cu, executePgDestructiveOutcome as cv, generateDDL$1 as cw, generateDownSQL$1 as cx, generateMigrationSQL$1 as cy, lockPgJournalRun as cz, type ConvergePgOptions as d, type PgPhysicalModel as e, type PgConvergeResult as f, type PgConvergeCheckResult as g, type PgLedgerScopeCurrency as h, AutoIncrementTransitionUnsupportedError as i, type CanonicalizeCheckConstraintsOptions as j, CheckConstraintCanonicalizationError as k, type CheckConstraintCanonicalizationWarning as l, CheckConstraintNewEnumValueError as m, ColumnDefaultCanonicalizationError as n, type ColumnDefaultCanonicalizationWarning as o, type ComparePgDatabaseSchemaOptions as p, type CompareSchemataOptions as q, readTransitionJournal as r, DEFAULT_PK_COLUMN as s, type DetectedHierarchy as t, type DiffSummary as u, type ExpressionCanonicalizationWarning as v, type ExpressionHandler as w, ExpressionKeyedIndexPredicateCanonicalizationUnsupportedError as x, type GenerateDDLOptions as y, type GeneratedPostcondition as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbsp/adapter-pgsql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "PostgreSQL adapter for db-semantic-planner — compiles query intents to optimized parameterized SQL",
|
|
5
5
|
"author": "Olivier Orabona <oorabona@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dbsp/core": "
|
|
49
|
-
"@dbsp/types": "^6.
|
|
48
|
+
"@dbsp/core": "7.0.0",
|
|
49
|
+
"@dbsp/types": "^6.4.0",
|
|
50
50
|
"@pgsql/types": "18.0.0",
|
|
51
51
|
"pg": "^8.21.0"
|
|
52
52
|
},
|