@dbsp/adapter-pgsql 3.3.0 → 3.5.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/README.md +3 -1
- package/dist/index.d.ts +324 -85
- package/dist/index.js +3466 -1623
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _dbsp_core from '@dbsp/core';
|
|
2
|
-
import { IndexInfo, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, ExpressionRef, ModelIR as ModelIR$1, ExecutionCoordinator, CapabilityDescriptor } from '@dbsp/core';
|
|
2
|
+
import { IndexInfo, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, ExpressionRef, ModelIR as ModelIR$1, TransitionRunPersister, ExecutionCoordinator, CapabilityDescriptor } from '@dbsp/core';
|
|
3
3
|
export { normalizeSQL } from '@dbsp/core';
|
|
4
4
|
import * as _dbsp_types from '@dbsp/types';
|
|
5
|
-
import { DialectCapabilities, ModelIR, ColumnListInput, ParamIntent, JsonAggOrderByEntry, IndexIR, HierarchyIR, Adapter, DbCasing, AdapterLogger, AdapterCapabilities, PlanReport, CompiledNqlQuery, CompileOptions, CompiledQuery, CompileResultWithIncludes, SubqueryIncludeInfo, ExpressionIntent, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, RecursivePlanReport, CteQueryIntent, SetOperationIntent, DumpMeta, Dump, AdapterStreamOptions, PinnedConnectionOptions, TransactionOptions,
|
|
5
|
+
import { DialectCapabilities, ModelIR, ColumnListInput, ParamIntent, JsonAggOrderByEntry, IndexIR, HierarchyIR, Adapter, DbCasing, AdapterLogger, AdapterCapabilities, ConnectionAvailability, PlanReport, CompiledNqlQuery, CompileOptions, CompiledQuery, CompileResultWithIncludes, SubqueryIncludeInfo, ExpressionIntent, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, RecursivePlanReport, CteQueryIntent, SetOperationIntent, DumpMeta, Dump, AdapterStreamOptions, PinnedConnectionOptions, TransactionOptions, ColumnIR, MutationReturningItem, WhereIntent, OutputDescriptor, QueryIntent, OperationKindRef, SemanticArtifactRef, ProvenPlanShape, PostgreSqlObservationTargetIdentity, ExecutionContract, TransitionSessionClient, TransitionRunJournal, TransitionLessor, 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 } from '@dbsp/types';
|
|
6
6
|
import * as _pgsql_types from '@pgsql/types';
|
|
7
7
|
import { Node, OnConflictClause, ParamRef } from '@pgsql/types';
|
|
8
8
|
import { Pool, PoolClient } from 'pg';
|
|
@@ -888,6 +888,11 @@ type PgsqlTransactionTimeoutParameter = 'lock_timeout' | 'statement_timeout';
|
|
|
888
888
|
* @module pgsql-adapter
|
|
889
889
|
*/
|
|
890
890
|
|
|
891
|
+
declare const rollbackOnlyPgsqlScopeBrand: unique symbol;
|
|
892
|
+
/** A scope minted by withScratchScope and guaranteed to roll back on success. */
|
|
893
|
+
type RollbackOnlyPgsqlScope<DB = unknown> = PgsqlAdapter<DB> & {
|
|
894
|
+
readonly [rollbackOnlyPgsqlScopeBrand]: typeof rollbackOnlyPgsqlScopeBrand;
|
|
895
|
+
};
|
|
891
896
|
type PgAdvisoryLockKey = bigint | {
|
|
892
897
|
readonly classId: number;
|
|
893
898
|
readonly objId: number;
|
|
@@ -955,6 +960,10 @@ declare class PgsqlTransactionTimeoutError extends Error {
|
|
|
955
960
|
/**
|
|
956
961
|
* Options for PgsqlAdapter.
|
|
957
962
|
*/
|
|
963
|
+
interface PgsqlPreparedStatementsOptions {
|
|
964
|
+
/** Maximum distinct compiled statements admitted per executor (default: 500). */
|
|
965
|
+
readonly maxStatements?: number;
|
|
966
|
+
}
|
|
958
967
|
interface PgsqlAdapterOptions {
|
|
959
968
|
/** Schema name for multi-tenant queries */
|
|
960
969
|
readonly schemaName?: string;
|
|
@@ -973,6 +982,11 @@ interface PgsqlAdapterOptions {
|
|
|
973
982
|
readonly defaultPkColumnName?: string;
|
|
974
983
|
/** Convention for deriving FK column names: (tableName, pkName) => fkColumnName */
|
|
975
984
|
readonly deriveFkColumnName?: FkColumnDerivation;
|
|
985
|
+
/**
|
|
986
|
+
* Opt in to node-postgres named prepared statements for compiled queries with
|
|
987
|
+
* parameters. `true` uses the default statement cap; an object overrides it.
|
|
988
|
+
*/
|
|
989
|
+
readonly preparedStatements?: boolean | PgsqlPreparedStatementsOptions;
|
|
976
990
|
}
|
|
977
991
|
interface PgsqlPoolAdapterOptions extends PgsqlAdapterOptions {
|
|
978
992
|
readonly borrowedClient?: false;
|
|
@@ -1029,6 +1043,7 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
|
|
|
1029
1043
|
private readonly managedTransactions;
|
|
1030
1044
|
private readonly adapterManagedTransaction;
|
|
1031
1045
|
private readonly adapterManagedPinnedConnection;
|
|
1046
|
+
private readonly rollbackOnlyScope;
|
|
1032
1047
|
private readonly scopeToken;
|
|
1033
1048
|
private readonly scopeState;
|
|
1034
1049
|
private readonly schemaName;
|
|
@@ -1036,6 +1051,8 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
|
|
|
1036
1051
|
private readonly naming;
|
|
1037
1052
|
private readonly model;
|
|
1038
1053
|
private readonly logger;
|
|
1054
|
+
private readonly preparedStatements;
|
|
1055
|
+
private readonly preparedStatementRegistry;
|
|
1039
1056
|
private readonly _capabilities;
|
|
1040
1057
|
private readonly defaultPk;
|
|
1041
1058
|
private readonly deriveFk;
|
|
@@ -1072,11 +1089,13 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
|
|
|
1072
1089
|
private compileNqlBundleLeafEnvelope;
|
|
1073
1090
|
private compileNqlBundle;
|
|
1074
1091
|
/**
|
|
1075
|
-
* Returns the pool/client executor, or
|
|
1092
|
+
* Returns the pool/client executor, or refuses a connectionless adapter.
|
|
1076
1093
|
*/
|
|
1077
1094
|
private requireConnection;
|
|
1078
1095
|
/** Adapter capabilities for feature detection */
|
|
1079
1096
|
get capabilities(): AdapterCapabilities;
|
|
1097
|
+
/** Per-instance connection state, distinct from PostgreSQL capabilities. */
|
|
1098
|
+
get connectionAvailability(): ConnectionAvailability;
|
|
1080
1099
|
/** PostgreSQL dialect capabilities for planner strategy selection */
|
|
1081
1100
|
get dialectCapabilities(): DialectCapabilities;
|
|
1082
1101
|
/**
|
|
@@ -1304,12 +1323,16 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
|
|
|
1304
1323
|
* Execute scratch PostgreSQL work in a scope that always rolls back on success.
|
|
1305
1324
|
*
|
|
1306
1325
|
* This is intentionally PostgreSQL-adapter-specific. It is used for catalog
|
|
1307
|
-
* shaped scratch DDL such as
|
|
1308
|
-
*
|
|
1326
|
+
* shaped scratch DDL such as expression canonicalisation, where the caller
|
|
1327
|
+
* needs PostgreSQL's rendering but must not keep the scratch objects. This
|
|
1328
|
+
* scope has exactly one successful exit: rollback. In a caller transaction,
|
|
1329
|
+
* only this outer savepoint is retained after rollback; nested work releases
|
|
1330
|
+
* normally, so a large canonicalisation run cannot retain one subtransaction
|
|
1331
|
+
* per expression.
|
|
1309
1332
|
* Rollback here is cleanup of dbsp-created work, not a sandbox for arbitrary
|
|
1310
1333
|
* session effects.
|
|
1311
1334
|
*/
|
|
1312
|
-
withScratchScope<T>(fn: (adapter:
|
|
1335
|
+
withScratchScope<T>(fn: (adapter: RollbackOnlyPgsqlScope<DB>) => Promise<T>): Promise<T>;
|
|
1313
1336
|
private createManagedClientAdapter;
|
|
1314
1337
|
private createPinnedConnectionAdapter;
|
|
1315
1338
|
private createChildTransactionObserver;
|
|
@@ -1499,10 +1522,11 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
|
|
|
1499
1522
|
declare function createPgsqlAdapter<DB = unknown>(pool: Pool, options?: PgsqlPoolAdapterOptions): PgsqlAdapter<DB>;
|
|
1500
1523
|
declare function createPgsqlAdapter<DB = unknown>(client: PoolClient, options: PgsqlBorrowedClientAdapterOptions): PgsqlAdapter<DB>;
|
|
1501
1524
|
/**
|
|
1502
|
-
* Creates a
|
|
1525
|
+
* Creates a connectionless PgsqlAdapter for SQL generation without a database connection.
|
|
1503
1526
|
*
|
|
1504
1527
|
* All compilation methods (compile, compileInsert, etc.), createDump(), and generateDDL()
|
|
1505
|
-
* work normally.
|
|
1528
|
+
* work normally. The adapter has the full PgsqlAdapter surface; database operations refuse
|
|
1529
|
+
* at runtime until it is constructed with a connection via createPgsqlAdapter(pool).
|
|
1506
1530
|
*
|
|
1507
1531
|
* @example
|
|
1508
1532
|
* ```typescript
|
|
@@ -1515,7 +1539,57 @@ declare function createPgsqlAdapter<DB = unknown>(client: PoolClient, options: P
|
|
|
1515
1539
|
* console.log(dump.sql);
|
|
1516
1540
|
* ```
|
|
1517
1541
|
*/
|
|
1518
|
-
declare function createPgsqlCompileOnlyAdapter<DB = unknown>(options?: PgsqlAdapterOptions):
|
|
1542
|
+
declare function createPgsqlCompileOnlyAdapter<DB = unknown>(options?: PgsqlAdapterOptions): PgsqlAdapter<DB>;
|
|
1543
|
+
|
|
1544
|
+
interface CheckConstraintCanonicalizationWarning {
|
|
1545
|
+
readonly table: string;
|
|
1546
|
+
readonly kind: 'check_constraint';
|
|
1547
|
+
readonly name: string;
|
|
1548
|
+
readonly constraint: string;
|
|
1549
|
+
readonly message: string;
|
|
1550
|
+
readonly cause: unknown;
|
|
1551
|
+
}
|
|
1552
|
+
interface ColumnDefaultCanonicalizationWarning {
|
|
1553
|
+
readonly table: string;
|
|
1554
|
+
readonly kind: 'column_default';
|
|
1555
|
+
readonly name: string;
|
|
1556
|
+
readonly message: string;
|
|
1557
|
+
readonly cause: unknown;
|
|
1558
|
+
readonly outcome?: 'unavailable' | 'rejected' | 'refused';
|
|
1559
|
+
/** Whether this warning represents a raw fallback or absent counterpart. */
|
|
1560
|
+
readonly comparison: 'raw' | 'unpaired';
|
|
1561
|
+
/** Present when the default could not be paired with the opposite model side. */
|
|
1562
|
+
readonly side?: 'desired' | 'database';
|
|
1563
|
+
}
|
|
1564
|
+
type ExpressionCanonicalizationWarning = CheckConstraintCanonicalizationWarning | ColumnDefaultCanonicalizationWarning;
|
|
1565
|
+
interface CanonicalizeCheckConstraintsOptions {
|
|
1566
|
+
/** Database schema that owns the target tables and target-scoped enum types. */
|
|
1567
|
+
readonly schemaName?: string;
|
|
1568
|
+
/** Naming convention used when matching desired table names to DB table names. */
|
|
1569
|
+
readonly dbCasing?: DbCasing;
|
|
1570
|
+
/** Called when PostgreSQL CHECK canonicalisation fails and raw comparison is used. */
|
|
1571
|
+
readonly onWarning?: (warning: CheckConstraintCanonicalizationWarning) => void;
|
|
1572
|
+
/** Throw instead of falling back to raw comparison when canonicalisation fails. */
|
|
1573
|
+
readonly requireCanonicalization?: boolean;
|
|
1574
|
+
/** Skip CHECK scratch work when the caller's dialect does not support CHECK DDL. */
|
|
1575
|
+
readonly canonicalizeCheckConstraints?: boolean;
|
|
1576
|
+
}
|
|
1577
|
+
declare class CheckConstraintCanonicalizationError extends Error {
|
|
1578
|
+
readonly table: string;
|
|
1579
|
+
readonly constraints: readonly string[];
|
|
1580
|
+
readonly cause: unknown;
|
|
1581
|
+
constructor(table: string, constraints: readonly string[], cause: unknown);
|
|
1582
|
+
}
|
|
1583
|
+
declare class ColumnDefaultCanonicalizationError extends Error {
|
|
1584
|
+
readonly table: string;
|
|
1585
|
+
readonly column: string;
|
|
1586
|
+
readonly cause: unknown;
|
|
1587
|
+
constructor(table: string, column: string, cause: unknown);
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Canonicalise PostgreSQL CHECK constraint expressions in a desired model.
|
|
1591
|
+
*/
|
|
1592
|
+
declare function canonicalizeCheckConstraints(adapter: RollbackOnlyPgsqlScope, desired: ModelIR, dbModel: ModelIR, options?: CanonicalizeCheckConstraintsOptions): Promise<ModelIR>;
|
|
1519
1593
|
|
|
1520
1594
|
/**
|
|
1521
1595
|
* Schema Comparison Engine (DDL-PROV Block 1)
|
|
@@ -1586,13 +1660,16 @@ interface CompareSchemataOptions {
|
|
|
1586
1660
|
*
|
|
1587
1661
|
* `compareSchemata()` is intentionally pure and cannot ask PostgreSQL to
|
|
1588
1662
|
* canonicalise raw-SQL expression surfaces. By default it keeps the historic
|
|
1589
|
-
* best-effort
|
|
1590
|
-
* predicates, and index expressions. Set this flag to throw when either model
|
|
1663
|
+
* best-effort verbatim comparison for column defaults, CHECK expressions,
|
|
1664
|
+
* partial-index predicates, and index expressions. Set this flag to throw when either model
|
|
1591
1665
|
* contains one of those surfaces so a caller cannot accidentally rely on a
|
|
1592
1666
|
* compile-only diff for a convergence-sensitive check.
|
|
1593
1667
|
*
|
|
1594
1668
|
* Live PostgreSQL callers should use `comparePgsqlDatabaseSchema()`, which
|
|
1595
|
-
* canonicalises CHECK constraint expressions before calling this function.
|
|
1669
|
+
* canonicalises CHECK constraint expressions and column defaults before calling this function.
|
|
1670
|
+
* Under that live mode, every default surface considered under this option is
|
|
1671
|
+
* either canonicalised as a pair or explicitly refused. This does not prove
|
|
1672
|
+
* that the resulting migration is executable.
|
|
1596
1673
|
* Partial-index predicates and index expressions are not canonicalised by the
|
|
1597
1674
|
* live helper and are rejected there when this strict flag is set.
|
|
1598
1675
|
*/
|
|
@@ -1614,36 +1691,44 @@ declare function compareSchemata(schema: ModelIR, db: ModelIR, options?: Compare
|
|
|
1614
1691
|
|
|
1615
1692
|
interface ComparePgsqlDatabaseSchemaOptions extends CompareSchemataOptions, SchemaScopeOptions {
|
|
1616
1693
|
/**
|
|
1617
|
-
* Whether to canonicalise PostgreSQL CHECK constraint expressions before
|
|
1694
|
+
* Whether to canonicalise PostgreSQL CHECK constraint expressions and column defaults before
|
|
1618
1695
|
* comparing. Defaults to `true`. Set to `false` only for compatibility with
|
|
1619
1696
|
* legacy raw-string live diffs.
|
|
1620
1697
|
*
|
|
1621
|
-
* Live canonicalisation creates temporary scratch tables
|
|
1622
|
-
*
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
*
|
|
1626
|
-
* falls back to best-effort raw string comparison for the affected CHECK
|
|
1627
|
-
* constraints.
|
|
1698
|
+
* Live canonicalisation creates temporary scratch tables inside an adapter
|
|
1699
|
+
* scratch scope whose successful cleanup is rollback. The database role needs
|
|
1700
|
+
* permission to create temporary tables and use the scratch column types. If
|
|
1701
|
+
* PostgreSQL refuses that scratch DDL, non-strict mode warns and falls back to
|
|
1702
|
+
* best-effort raw string comparison for the affected expression surfaces.
|
|
1628
1703
|
*/
|
|
1629
1704
|
readonly canonicalizeExpressions?: boolean;
|
|
1630
1705
|
/**
|
|
1631
|
-
* Receives live
|
|
1706
|
+
* Receives live expression canonicalisation warnings. Defaults to console.warn.
|
|
1632
1707
|
*/
|
|
1633
1708
|
readonly onWarning?: (message: string) => void;
|
|
1709
|
+
/** Receives the identity-bearing canonicalisation warning before its string form. */
|
|
1710
|
+
readonly onExpressionCanonicalizationWarning?: (warning: ExpressionCanonicalizationWarning) => void;
|
|
1634
1711
|
/**
|
|
1635
1712
|
* Diff that the caller just applied before this live re-diff. Used only when
|
|
1636
|
-
* CHECK expressions are compared by raw text to fail loudly if the exact same
|
|
1713
|
+
* CHECK expressions or column defaults are compared by raw text to fail loudly if the exact same
|
|
1637
1714
|
* expression-surface drift appears again after re-introspection.
|
|
1638
1715
|
*/
|
|
1639
1716
|
readonly previouslyAppliedDiff?: SchemaDiff;
|
|
1640
1717
|
}
|
|
1641
|
-
|
|
1718
|
+
type NonConvergentSchemaDiffSurface = {
|
|
1719
|
+
readonly kind: 'check_constraint';
|
|
1642
1720
|
readonly table: string;
|
|
1643
1721
|
readonly constraint: string;
|
|
1644
|
-
|
|
1645
|
-
readonly
|
|
1646
|
-
|
|
1722
|
+
} | {
|
|
1723
|
+
readonly kind: 'column_default';
|
|
1724
|
+
readonly table: string;
|
|
1725
|
+
readonly column: string;
|
|
1726
|
+
};
|
|
1727
|
+
declare class NonConvergentSchemaDiffError extends Error {
|
|
1728
|
+
readonly surface: NonConvergentSchemaDiffSurface;
|
|
1729
|
+
readonly desiredExpressionHash: string;
|
|
1730
|
+
readonly databaseExpressionHash: string;
|
|
1731
|
+
constructor(surface: NonConvergentSchemaDiffSurface, desiredExpressionHash: string, databaseExpressionHash: string);
|
|
1647
1732
|
}
|
|
1648
1733
|
/** An enum value this diff adds, reported as a candidate cause — never asserted. */
|
|
1649
1734
|
interface AddedEnumValue {
|
|
@@ -1654,11 +1739,12 @@ declare class CheckConstraintNewEnumValueError extends Error {
|
|
|
1654
1739
|
readonly table: string;
|
|
1655
1740
|
readonly constraint: string;
|
|
1656
1741
|
readonly addedEnumValues: readonly AddedEnumValue[];
|
|
1657
|
-
|
|
1742
|
+
readonly surfaceKind: 'CHECK constraint' | 'column default';
|
|
1743
|
+
constructor(table: string, constraint: string, addedEnumValues: readonly AddedEnumValue[], surfaceKind?: 'CHECK constraint' | 'column default');
|
|
1658
1744
|
}
|
|
1659
1745
|
/**
|
|
1660
1746
|
* Live PostgreSQL schema diff: introspect, canonicalise desired CHECK
|
|
1661
|
-
* constraint expressions through PostgreSQL, then call the pure synchronous
|
|
1747
|
+
* constraint expressions and column defaults through PostgreSQL, then call the pure synchronous
|
|
1662
1748
|
* schema comparator.
|
|
1663
1749
|
*
|
|
1664
1750
|
* If CHECK canonicalisation falls back while the same diff adds a plausibly
|
|
@@ -1673,7 +1759,7 @@ declare class CheckConstraintNewEnumValueError extends Error {
|
|
|
1673
1759
|
* diffs reject them.
|
|
1674
1760
|
*/
|
|
1675
1761
|
declare function comparePgsqlDatabaseSchema(adapter: PgsqlAdapter, desired: ModelIR, options?: ComparePgsqlDatabaseSchemaOptions): Promise<SchemaDiff>;
|
|
1676
|
-
declare function assertNoRepeatedExpressionSurfaceDrift(previouslyAppliedDiff: SchemaDiff, currentDiff: SchemaDiff,
|
|
1762
|
+
declare function assertNoRepeatedExpressionSurfaceDrift(previouslyAppliedDiff: SchemaDiff, currentDiff: SchemaDiff, rawExpressionSurfaces?: ReadonlySet<string>): void;
|
|
1677
1763
|
|
|
1678
1764
|
/**
|
|
1679
1765
|
* Migration SQL Generator (DDL-PROV Block 1)
|
|
@@ -1965,59 +2051,6 @@ declare function getRowEstimates(plans: ExplainPlan[]): {
|
|
|
1965
2051
|
actual: number;
|
|
1966
2052
|
};
|
|
1967
2053
|
|
|
1968
|
-
interface CheckConstraintCanonicalizationWarning {
|
|
1969
|
-
readonly table: string;
|
|
1970
|
-
readonly constraint: string;
|
|
1971
|
-
readonly message: string;
|
|
1972
|
-
readonly cause: unknown;
|
|
1973
|
-
}
|
|
1974
|
-
interface CanonicalizeCheckConstraintsOptions {
|
|
1975
|
-
/** Database schema that owns the target tables and target-scoped enum types. */
|
|
1976
|
-
readonly schemaName?: string;
|
|
1977
|
-
/** Naming convention used when matching desired table names to DB table names. */
|
|
1978
|
-
readonly dbCasing?: DbCasing;
|
|
1979
|
-
/** Called when PostgreSQL CHECK canonicalisation fails and raw comparison is used. */
|
|
1980
|
-
readonly onWarning?: (warning: CheckConstraintCanonicalizationWarning) => void;
|
|
1981
|
-
/** Throw instead of falling back to raw comparison when canonicalisation fails. */
|
|
1982
|
-
readonly requireCanonicalization?: boolean;
|
|
1983
|
-
}
|
|
1984
|
-
type PgsqlCanonicalizationScope = Pick<Adapter, 'executeRaw' | 'transaction'>;
|
|
1985
|
-
declare class CheckConstraintCanonicalizationError extends Error {
|
|
1986
|
-
readonly table: string;
|
|
1987
|
-
readonly constraints: readonly string[];
|
|
1988
|
-
readonly cause: unknown;
|
|
1989
|
-
constructor(table: string, constraints: readonly string[], cause: unknown);
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Canonicalise PostgreSQL CHECK constraint expressions in a desired model.
|
|
1993
|
-
*
|
|
1994
|
-
* CHECK constraints are canonicalised by creating a transaction-local temp table
|
|
1995
|
-
* with the desired table's column definitions (borrowing live database type
|
|
1996
|
-
* detail for existing columns when the desired model omits it), adding the
|
|
1997
|
-
* authored CHECK constraints to that temp table, and reading PostgreSQL's
|
|
1998
|
-
* `pg_get_constraintdef()` rendering. The caller must provide a rollback-only
|
|
1999
|
-
* scratch scope; that rollback is cleanup for dbsp-created scratch objects, not
|
|
2000
|
-
* a sandbox for arbitrary session effects.
|
|
2001
|
-
* Missing desired enum types are also created inside that scratch scope before
|
|
2002
|
-
* scratch tables.
|
|
2003
|
-
* Scratch columns include only names and types; defaults, identity, uniqueness,
|
|
2004
|
-
* nullability, and other table-shape clauses are deliberately omitted.
|
|
2005
|
-
*
|
|
2006
|
-
* The returned expression is the full `CHECK (...)` clause. Bare authored
|
|
2007
|
-
* predicates are accepted and become full CHECK clauses.
|
|
2008
|
-
*
|
|
2009
|
-
* PostgreSQL does not allow an enum value added by `ALTER TYPE ... ADD VALUE`
|
|
2010
|
-
* to be used in the same transaction that added it. Because dbsp currently
|
|
2011
|
-
* emits and applies each migration in one transaction, the live diff layer
|
|
2012
|
-
* deliberately refuses CHECK constraints that fall back while the same diff adds
|
|
2013
|
-
* a plausibly referenced enum value. Splitting that into multiple transaction
|
|
2014
|
-
* phases is a separate migration-runner feature.
|
|
2015
|
-
*
|
|
2016
|
-
* This does not canonicalise partial-index predicates or index expressions, so
|
|
2017
|
-
* those surfaces may still compare by raw text in non-strict diffs.
|
|
2018
|
-
*/
|
|
2019
|
-
declare function canonicalizeCheckConstraints(adapter: PgsqlCanonicalizationScope, desired: ModelIR, dbModel: ModelIR, options?: CanonicalizeCheckConstraintsOptions): Promise<ModelIR>;
|
|
2020
|
-
|
|
2021
2054
|
/**
|
|
2022
2055
|
* ParadeDB Extension Wrappers
|
|
2023
2056
|
*
|
|
@@ -2759,6 +2792,7 @@ declare const ENUM_ADD_VALUE_RULE_ID = "postgresql.enum.add-value";
|
|
|
2759
2792
|
declare const LOGICAL_IDENTITY_ADOPTION_RULE_ID = "postgresql.logical-identity.adopt";
|
|
2760
2793
|
declare const DBSP_META_SCHEMA = "dbsp_meta";
|
|
2761
2794
|
declare const DBSP_TRANSITION_RUN_TABLE = "dbsp_transition_run";
|
|
2795
|
+
declare const DBSP_TRANSITION_RUN_PLAN_TABLE = "dbsp_transition_run_plan";
|
|
2762
2796
|
declare const DBSP_TRANSITION_JOURNAL_TABLE = "dbsp_transition_journal";
|
|
2763
2797
|
declare const DBSP_LOGICAL_IDENTITY_TABLE = "dbsp_logical_identity";
|
|
2764
2798
|
declare const COLUMN_EXISTS_OBSERVATION = "postgresql.column.exists";
|
|
@@ -2769,6 +2803,40 @@ declare const ENGINE_VERSION_OBSERVATION = "postgresql.engine.version-supported"
|
|
|
2769
2803
|
declare const LOGICAL_IDENTITY_CARRIER_OBSERVATION = "postgresql.logical-identity.carrier-state";
|
|
2770
2804
|
declare const NO_NULLS_GUARD = "NO_NULLS";
|
|
2771
2805
|
|
|
2806
|
+
/**
|
|
2807
|
+
* A proven operation may still be ineligible for a durable execution contract
|
|
2808
|
+
* when its reviewed requirements cannot be derived. The CLI renders this as a
|
|
2809
|
+
* blocked assessment rather than treating it as an operational failure.
|
|
2810
|
+
*/
|
|
2811
|
+
declare class PgExecutionContractDerivationError extends Error {
|
|
2812
|
+
readonly operationRef: string;
|
|
2813
|
+
readonly operationName: string;
|
|
2814
|
+
constructor(operationRef: string, operationName: string, detail: string);
|
|
2815
|
+
}
|
|
2816
|
+
/**
|
|
2817
|
+
* Compare namespace identities by name, rather than the incidental order in
|
|
2818
|
+
* which PostgreSQL or a persisted JSON document happened to return them.
|
|
2819
|
+
*/
|
|
2820
|
+
declare function pgTargetIdentityMismatch(expected: PostgreSqlObservationTargetIdentity, observed: PostgreSqlObservationTargetIdentity): string | undefined;
|
|
2821
|
+
/**
|
|
2822
|
+
* Name resolution is only used to locate the namespace OID. The resulting
|
|
2823
|
+
* contract never treats the name itself as identity.
|
|
2824
|
+
*/
|
|
2825
|
+
declare function readPgExecutionTargetFromClient(target: TransitionSessionClient, namespaceNames: readonly string[]): Promise<{
|
|
2826
|
+
readonly identity: PostgreSqlObservationTargetIdentity;
|
|
2827
|
+
readonly sessionProvenance: Readonly<Record<'search_path' | 'client_encoding' | 'TimeZone', string>>;
|
|
2828
|
+
}>;
|
|
2829
|
+
/** Build the versioned canonical document once, while the plan is minted. */
|
|
2830
|
+
declare function createPgExecutionContract(plan: ProvenPlanShape, identity: PostgreSqlObservationTargetIdentity, _sessionProvenance: Readonly<Record<'search_path' | 'client_encoding' | 'TimeZone', string>>): ExecutionContract;
|
|
2831
|
+
/** Evaluate the stored document on the leased executor, before it renders SQL. */
|
|
2832
|
+
declare function evaluatePgExecutionContract(target: TransitionSessionClient, contract: ExecutionContract): Promise<{
|
|
2833
|
+
readonly ok: true;
|
|
2834
|
+
} | {
|
|
2835
|
+
readonly ok: false;
|
|
2836
|
+
readonly clause: string;
|
|
2837
|
+
readonly detail: string;
|
|
2838
|
+
}>;
|
|
2839
|
+
|
|
2772
2840
|
type QueryResultLike = {
|
|
2773
2841
|
readonly rows: readonly Record<string, unknown>[];
|
|
2774
2842
|
};
|
|
@@ -2778,9 +2846,20 @@ type TransitionJournalQueryable = {
|
|
|
2778
2846
|
declare function renderCreateDbspMetaSchemaSql(): string;
|
|
2779
2847
|
declare function renderCreateTransitionRunTableSql(): string;
|
|
2780
2848
|
declare function renderCreateTransitionJournalTableSql(): string;
|
|
2849
|
+
declare function renderCreateTransitionRunPlanTableSql(): string;
|
|
2781
2850
|
declare function ensureTransitionJournal(executor: TransitionJournalQueryable): Promise<void>;
|
|
2782
|
-
declare function
|
|
2851
|
+
declare function createPgTransitionRunPersister(executor: TransitionJournalQueryable): TransitionRunPersister;
|
|
2852
|
+
declare function readTransitionJournal(executor: TransitionJournalQueryable, runId: string): Promise<TransitionRunJournal & {
|
|
2853
|
+
readonly plan: ProvenPlanShape;
|
|
2854
|
+
}>;
|
|
2783
2855
|
|
|
2856
|
+
type PgTransitionClientLease = {
|
|
2857
|
+
readonly client: PoolClient;
|
|
2858
|
+
query(sql: string, params?: unknown): Promise<{
|
|
2859
|
+
readonly rows: readonly Record<string, unknown>[];
|
|
2860
|
+
}>;
|
|
2861
|
+
release(error?: unknown): void;
|
|
2862
|
+
};
|
|
2784
2863
|
/**
|
|
2785
2864
|
* Declare a pg Pool as a source of transition leases.
|
|
2786
2865
|
*
|
|
@@ -2801,6 +2880,8 @@ declare function readTransitionJournal(executor: TransitionJournalQueryable, run
|
|
|
2801
2880
|
* worth spending that.
|
|
2802
2881
|
*/
|
|
2803
2882
|
declare function createPgTransitionLessor(pool: Pool): TransitionLessor;
|
|
2883
|
+
/** Acquire a UTF-8-configured PostgreSQL client for direct planning paths. */
|
|
2884
|
+
declare function acquirePgTransitionClient(pool: Pool): Promise<PgTransitionClientLease>;
|
|
2804
2885
|
|
|
2805
2886
|
type ObservationTarget = {
|
|
2806
2887
|
readonly table: string;
|
|
@@ -2817,7 +2898,7 @@ type EnumObservationTarget = {
|
|
|
2817
2898
|
/** Acquire one lease, issue the observation, then release that lease. */
|
|
2818
2899
|
declare function executePgObservationFromLessor(lessor: TransitionLessor, request: ObservationRequest, context: ObservationContext): Promise<EvidenceObservation>;
|
|
2819
2900
|
/** Acquire one lease, read context, then release that lease. */
|
|
2820
|
-
declare function readPgObservationContextFromLessor(lessor: TransitionLessor, schema?: string, observationTarget?: ObservationTarget | EnumObservationTarget): Promise<ObservationContext>;
|
|
2901
|
+
declare function readPgObservationContextFromLessor(lessor: TransitionLessor, schema?: string, observationTarget?: ObservationTarget | EnumObservationTarget, expectedTargetIdentity?: ObservationContext['postgresqlTargetIdentity']): Promise<ObservationContext>;
|
|
2821
2902
|
declare function createPgObservationIssuer(): ObservationIssuer;
|
|
2822
2903
|
|
|
2823
2904
|
interface SetNotNullColumnShapeExpectation {
|
|
@@ -2864,7 +2945,12 @@ declare function beforeAfterFingerprints$3(operation: PhysicalOperation, evidenc
|
|
|
2864
2945
|
};
|
|
2865
2946
|
declare function createAlterColumnSetNotNullOperationRuntime(): {
|
|
2866
2947
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
2948
|
+
operationKind: _dbsp_types.OperationKindRef;
|
|
2949
|
+
executionContractEligibility: {
|
|
2950
|
+
readonly eligible: true;
|
|
2951
|
+
};
|
|
2867
2952
|
supportsOperation(operation: PhysicalOperation): boolean;
|
|
2953
|
+
renderPlanSql(operation: PhysicalOperation, context: ObservationContext): string;
|
|
2868
2954
|
effectsOf(operation: PhysicalOperation, context: ObservationContext): OperationEffectAssessment;
|
|
2869
2955
|
buildFingerprints: typeof beforeAfterFingerprints$3;
|
|
2870
2956
|
writeIntentJournal(client: TransitionExecutionClient$3, record: DurableIntentRecord): Promise<void>;
|
|
@@ -2910,7 +2996,15 @@ declare function beforeAfterFingerprints$2(operation: PhysicalOperation, evidenc
|
|
|
2910
2996
|
declare function createAlterTypeAddValueOperationRuntime(): {
|
|
2911
2997
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
2912
2998
|
operationKind: _dbsp_types.OperationKindRef;
|
|
2999
|
+
executionContractEligibility: {
|
|
3000
|
+
readonly eligible: true;
|
|
3001
|
+
};
|
|
3002
|
+
rendererSessionRequirements: readonly [{
|
|
3003
|
+
readonly setting: "standard_conforming_strings";
|
|
3004
|
+
readonly value: "on";
|
|
3005
|
+
}];
|
|
2913
3006
|
supportsOperation(operation: PhysicalOperation): boolean;
|
|
3007
|
+
renderPlanSql(operation: PhysicalOperation, context: ObservationContext): string;
|
|
2914
3008
|
effectsOf(operation: PhysicalOperation, context: ObservationContext): OperationEffectAssessment;
|
|
2915
3009
|
buildFingerprints: typeof beforeAfterFingerprints$2;
|
|
2916
3010
|
writeIntentJournal(client: TransitionExecutionClient$2, record: DurableIntentRecord): Promise<void>;
|
|
@@ -2958,7 +3052,12 @@ declare function beforeAfterFingerprints$1(operation: PhysicalOperation, evidenc
|
|
|
2958
3052
|
};
|
|
2959
3053
|
declare function createAttachLogicalIdentityOperationRuntime(): {
|
|
2960
3054
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3055
|
+
executionContractEligibility: {
|
|
3056
|
+
readonly eligible: false;
|
|
3057
|
+
readonly detail: "PostgreSQL AttachLogicalIdentity has no derivable execution requirements yet";
|
|
3058
|
+
};
|
|
2961
3059
|
supportsOperation(operation: PhysicalOperation): boolean;
|
|
3060
|
+
renderPlanSql(operation: PhysicalOperation): string;
|
|
2962
3061
|
effectsOf(operation: PhysicalOperation, context: ObservationContext): OperationEffectAssessment;
|
|
2963
3062
|
buildFingerprints: typeof beforeAfterFingerprints$1;
|
|
2964
3063
|
writeIntentJournal(client: TransitionExecutionClient$1, record: DurableIntentRecord): Promise<void>;
|
|
@@ -3002,7 +3101,12 @@ declare function beforeAfterFingerprints(operation: PhysicalOperation, _evidence
|
|
|
3002
3101
|
declare function createManualSqlOperationRuntime(): {
|
|
3003
3102
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3004
3103
|
operationKind: _dbsp_types.OperationKindRef;
|
|
3104
|
+
executionContractEligibility: {
|
|
3105
|
+
readonly eligible: false;
|
|
3106
|
+
readonly detail: "PostgreSQL ManualSql has no derivable execution requirements because its statement has no declared schema target";
|
|
3107
|
+
};
|
|
3005
3108
|
supportsOperation(operation: PhysicalOperation): boolean;
|
|
3109
|
+
renderPlanSql(operation: PhysicalOperation, context: ObservationContext): string;
|
|
3006
3110
|
effectsOf(operation: PhysicalOperation, context: ObservationContext): OperationEffectAssessment;
|
|
3007
3111
|
buildFingerprints: typeof beforeAfterFingerprints;
|
|
3008
3112
|
writeIntentJournal(client: TransitionExecutionClient, record: DurableIntentRecord): Promise<void>;
|
|
@@ -3107,7 +3211,12 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
|
|
|
3107
3211
|
rules: (_dbsp_types.TransitionRule<AddCheckMatch> | _dbsp_types.TransitionRule<LogicalIdentityAdoptionMatch> | _dbsp_types.TransitionRule<CreateUniqueIndexConcurrentlyMatch> | _dbsp_types.TransitionRule<EnumAddValueMatch> | _dbsp_types.TransitionRule<SetNotNullMatch>)[];
|
|
3108
3212
|
operationSemantics: ({
|
|
3109
3213
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3214
|
+
operationKind: _dbsp_types.OperationKindRef;
|
|
3215
|
+
executionContractEligibility: {
|
|
3216
|
+
readonly eligible: true;
|
|
3217
|
+
};
|
|
3110
3218
|
supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
|
|
3219
|
+
renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
|
|
3111
3220
|
effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
|
|
3112
3221
|
buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
|
|
3113
3222
|
expectedBefore: _dbsp_types.FingerprintManifest;
|
|
@@ -3162,7 +3271,15 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
|
|
|
3162
3271
|
} | {
|
|
3163
3272
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3164
3273
|
operationKind: _dbsp_types.OperationKindRef;
|
|
3274
|
+
executionContractEligibility: {
|
|
3275
|
+
readonly eligible: true;
|
|
3276
|
+
};
|
|
3277
|
+
rendererSessionRequirements: readonly [{
|
|
3278
|
+
readonly setting: "standard_conforming_strings";
|
|
3279
|
+
readonly value: "on";
|
|
3280
|
+
}];
|
|
3165
3281
|
supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
|
|
3282
|
+
renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
|
|
3166
3283
|
effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
|
|
3167
3284
|
buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
|
|
3168
3285
|
expectedBefore: _dbsp_types.FingerprintManifest;
|
|
@@ -3214,10 +3331,71 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
|
|
|
3214
3331
|
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3215
3332
|
}, journal: _dbsp_types.StepJournal): Promise<void>;
|
|
3216
3333
|
isLockTimeout(error: unknown): boolean;
|
|
3334
|
+
} | {
|
|
3335
|
+
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3336
|
+
executionContractEligibility: {
|
|
3337
|
+
readonly eligible: false;
|
|
3338
|
+
readonly detail: "PostgreSQL AttachLogicalIdentity has no derivable execution requirements yet";
|
|
3339
|
+
};
|
|
3340
|
+
supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
|
|
3341
|
+
renderPlanSql(operation: _dbsp_types.PhysicalOperation): string;
|
|
3342
|
+
effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
|
|
3343
|
+
buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
|
|
3344
|
+
expectedBefore: _dbsp_types.FingerprintManifest;
|
|
3345
|
+
expectedAfter: _dbsp_types.FingerprintManifest;
|
|
3346
|
+
};
|
|
3347
|
+
writeIntentJournal(client: {
|
|
3348
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3349
|
+
}, record: _dbsp_types.DurableIntentRecord): Promise<void>;
|
|
3350
|
+
begin(client: {
|
|
3351
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3352
|
+
}): Promise<void>;
|
|
3353
|
+
setLockTimeout(client: {
|
|
3354
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3355
|
+
}, maxWaitMs: number): Promise<void>;
|
|
3356
|
+
acquireLocks(client: {
|
|
3357
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3358
|
+
}, operation: _dbsp_types.PhysicalOperation): Promise<void>;
|
|
3359
|
+
observeContext(client: {
|
|
3360
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3361
|
+
}, operation: _dbsp_types.PhysicalOperation, _proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
|
|
3362
|
+
observeOperation(client: {
|
|
3363
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3364
|
+
}, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, phase: "before" | "after", issuer: _dbsp_types.ObservationIssuer): Promise<{
|
|
3365
|
+
observations: _dbsp_types.IssuedObservation[];
|
|
3366
|
+
fingerprint: _dbsp_types.FingerprintManifest;
|
|
3367
|
+
}>;
|
|
3368
|
+
checkGuard(): Promise<{
|
|
3369
|
+
passed: boolean;
|
|
3370
|
+
observations: never[];
|
|
3371
|
+
recovery: never[];
|
|
3372
|
+
}>;
|
|
3373
|
+
executeOperation(client: {
|
|
3374
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3375
|
+
}, operation: _dbsp_types.PhysicalOperation): Promise<{
|
|
3376
|
+
kind: "completed";
|
|
3377
|
+
}>;
|
|
3378
|
+
writeCompletionJournal(client: {
|
|
3379
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3380
|
+
}, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
|
|
3381
|
+
commit(client: {
|
|
3382
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3383
|
+
}): Promise<void>;
|
|
3384
|
+
rollback(client: {
|
|
3385
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3386
|
+
}): Promise<void>;
|
|
3387
|
+
writeObservedJournal(client: {
|
|
3388
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3389
|
+
}, journal: _dbsp_types.StepJournal): Promise<void>;
|
|
3390
|
+
isLockTimeout(error: unknown): boolean;
|
|
3217
3391
|
} | {
|
|
3218
3392
|
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3219
3393
|
operationKind: _dbsp_types.OperationKindRef;
|
|
3394
|
+
executionContractEligibility: {
|
|
3395
|
+
readonly eligible: true;
|
|
3396
|
+
};
|
|
3220
3397
|
supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
|
|
3398
|
+
renderPlanSql(operation: _dbsp_types.PhysicalOperation): string;
|
|
3221
3399
|
effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
|
|
3222
3400
|
buildFingerprints: (operation: _dbsp_types.PhysicalOperation, evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
|
|
3223
3401
|
expectedBefore: _dbsp_types.FingerprintManifest;
|
|
@@ -3275,6 +3453,62 @@ declare function createPgTransitionPack(options?: PgTransitionPackOptions): {
|
|
|
3275
3453
|
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3276
3454
|
}, journal: _dbsp_types.StepJournal): Promise<void>;
|
|
3277
3455
|
isLockTimeout(error: unknown): boolean;
|
|
3456
|
+
} | {
|
|
3457
|
+
artifact: _dbsp_types.SemanticArtifactRef;
|
|
3458
|
+
operationKind: _dbsp_types.OperationKindRef;
|
|
3459
|
+
executionContractEligibility: {
|
|
3460
|
+
readonly eligible: false;
|
|
3461
|
+
readonly detail: "PostgreSQL ManualSql has no derivable execution requirements because its statement has no declared schema target";
|
|
3462
|
+
};
|
|
3463
|
+
supportsOperation(operation: _dbsp_types.PhysicalOperation): boolean;
|
|
3464
|
+
renderPlanSql(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): string;
|
|
3465
|
+
effectsOf(operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): _dbsp_types.OperationEffectAssessment;
|
|
3466
|
+
buildFingerprints: (operation: _dbsp_types.PhysicalOperation, _evidence: readonly _dbsp_types.EvidenceObservation[], context: _dbsp_types.ObservationContext) => {
|
|
3467
|
+
expectedBefore: _dbsp_types.FingerprintManifest;
|
|
3468
|
+
expectedAfter: _dbsp_types.FingerprintManifest;
|
|
3469
|
+
};
|
|
3470
|
+
writeIntentJournal(client: {
|
|
3471
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3472
|
+
}, record: _dbsp_types.DurableIntentRecord): Promise<void>;
|
|
3473
|
+
begin(client: {
|
|
3474
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3475
|
+
}): Promise<void>;
|
|
3476
|
+
setLockTimeout(_client: {
|
|
3477
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3478
|
+
}, _maxWaitMs: number): Promise<void>;
|
|
3479
|
+
acquireLocks(): Promise<void>;
|
|
3480
|
+
observeContext(client: {
|
|
3481
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3482
|
+
}, _operation: _dbsp_types.PhysicalOperation, proofContext: _dbsp_types.ObservationContext): Promise<_dbsp_types.ObservationContext>;
|
|
3483
|
+
observeOperation(_client: {
|
|
3484
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3485
|
+
}, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext, phase: "before" | "after"): Promise<{
|
|
3486
|
+
observations: never[];
|
|
3487
|
+
fingerprint: _dbsp_types.FingerprintManifest;
|
|
3488
|
+
}>;
|
|
3489
|
+
checkGuard(): Promise<{
|
|
3490
|
+
passed: boolean;
|
|
3491
|
+
observations: never[];
|
|
3492
|
+
recovery: never[];
|
|
3493
|
+
}>;
|
|
3494
|
+
executeOperation(client: {
|
|
3495
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3496
|
+
}, operation: _dbsp_types.PhysicalOperation, context: _dbsp_types.ObservationContext): Promise<{
|
|
3497
|
+
kind: "completed";
|
|
3498
|
+
}>;
|
|
3499
|
+
writeCompletionJournal(client: {
|
|
3500
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3501
|
+
}, operation: _dbsp_types.PhysicalOperation, record: _dbsp_types.TransactionalCompletionRecord): Promise<void>;
|
|
3502
|
+
commit(client: {
|
|
3503
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3504
|
+
}): Promise<void>;
|
|
3505
|
+
rollback(client: {
|
|
3506
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3507
|
+
}): Promise<void>;
|
|
3508
|
+
writeObservedJournal(client: {
|
|
3509
|
+
readonly opaqueClient: _dbsp_types.TransitionSessionClient;
|
|
3510
|
+
}, journal: _dbsp_types.StepJournal): Promise<void>;
|
|
3511
|
+
isLockTimeout(error: unknown): boolean;
|
|
3278
3512
|
})[];
|
|
3279
3513
|
issuer: _dbsp_types.ObservationIssuer;
|
|
3280
3514
|
executionCoordinator: ExecutionCoordinator;
|
|
@@ -3346,6 +3580,11 @@ declare function validateIdentifiers(identifiers: Record<string, 'table' | 'colu
|
|
|
3346
3580
|
* NOT for use in SQL - use validateIdentifier + AST helpers for that.
|
|
3347
3581
|
*/
|
|
3348
3582
|
declare function sanitizeForDisplay(value: string): string;
|
|
3583
|
+
/**
|
|
3584
|
+
* Preserve hostile diagnostic text as one printable line without losing which
|
|
3585
|
+
* control character was supplied. This is for diagnostics only, never SQL.
|
|
3586
|
+
*/
|
|
3587
|
+
declare function escapeDiagnosticText(value: string): string;
|
|
3349
3588
|
/**
|
|
3350
3589
|
* Validate a raw SQL expression used in DDL contexts (defaults, policy USING/CHECK).
|
|
3351
3590
|
* Rejects injection vectors: semicolons, line-comment markers, block-comment markers.
|
|
@@ -3357,4 +3596,4 @@ declare function sanitizeForDisplay(value: string): string;
|
|
|
3357
3596
|
*/
|
|
3358
3597
|
declare function validateSqlExpression(sql: string, context: string): void;
|
|
3359
3598
|
|
|
3360
|
-
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 AddedEnumValue, type AlterColumnSetNotNullPayload, type AlterTypeAddValuePayload, type AttachLogicalIdentityPayload, type BatchValuesJoinDecision, COLUMN_EXISTS_OBSERVATION, CamelCaseNamingPlugin, type CanonicalizeCheckConstraintsOptions, type ChangeKind, CheckConstraintCanonicalizationError, type CheckConstraintCanonicalizationWarning, CheckConstraintNewEnumValueError, type ComparePgsqlDatabaseSchemaOptions, type CompareSchemataOptions, type CompiledResult, type CompilerContext, type CompilerOptions, type CompilerState, type ConflictAction, type ConflictTarget, type CursorHoldOption, type CursorOptions, type CursorScrollOption, DBSP_LOGICAL_IDENTITY_TABLE, DBSP_META_SCHEMA, DBSP_TRANSITION_JOURNAL_TABLE, DBSP_TRANSITION_RUN_TABLE, DEFAULT_PK_COLUMN, DEFAULT_REDACTION_PATTERNS, type Decision, type DeleteConfig, type DetectedHierarchy, type DiffSummary, 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, ExpressionCanonicalizationUnavailableError, type ExpressionHandler, type FetchDirection, type FetchOptions, type FkColumnDerivation, type GenerateDDLOptions, type IdentityAdoptionAsserter, IdentityNamingPlugin, type IncludeHandler, type IncludeResult, type IndexCapabilityContext, IndexFeatureUnsupportedError, type IndexRenderSpec, type InsertConfig, type IntrospectedModelIR, type IntrospectionOptions, InvalidIdentifierError, type JoinDecision, LOGICAL_IDENTITY_ADOPTION_RULE_ID, LOGICAL_IDENTITY_CARRIER_OBSERVATION, type LeafCompileFn, type LogicalIdentityAdoptionMatch, type LogicalIdentityAdoptionRuleOptions, MANUAL_SQL_OPERATION_KIND, type ManualSqlPayload, type MigrationRecord, type MigrationSQLOptions, NO_NULLS_GUARD, type NamingPlugin, NonConvergentSchemaDiffError, PG_INTROSPECTION_ARTIFACT, PG_OPERATION_PACK_ARTIFACT, PG_RULE_PACK_ARTIFACT, type ParamRefValidationResult, type ParsedMigrationFile, type PgAdvisoryLockKey, type PgAdvisoryLockResult, type PgTransitionPackOptions, PgsqlAdapter, type PgsqlAdapterOptions, PgsqlAdvisoryLockOptionsError, type PgsqlBorrowedClientAdapterOptions, PgsqlPinnedConnectionAbortSignalError, type PgsqlPoolAdapterOptions, PgsqlRawSqlTransactionControlError, PgsqlTransactionAbortSignalError, PgsqlTransactionAbortedCommitError, PgsqlTransactionAbortedError, PgsqlTransactionOptionsError, PgsqlTransactionTimeoutError, PlanCompiler, type PlanDecision, type PrecompiledJoinDecision, type RedactionConfig, type RedactionPattern, SET_NOT_NULL_RULE_ID, type SchemaChange, type SchemaDiff, type SchemaScopeOptions, type SetNotNullMatch, type SetNotNullRuleOptions, type SetOperationResult, type SimplifiedPlanReport, type StreamConfig, type UpdateConfig, type UpsertConfig, type WhereDispatcher, type WhereHandler, assertCreateIndexSupported, assertCreateIndexesSupported, assertNoRepeatedExpressionSurfaceDrift, bm25Search, booleanSearch, boost, buildCloseCursor, buildDeclareCursor, buildExplain, buildExplainAnalyzeJson, buildExplainPlan, buildExplainVerbose, buildFetch, buildFetchAll, buildFetchFirst, buildFetchForward, buildFetchNext, buildOnConflictClause, buildStreamingStatements, camelCaseNaming, canGenerateCreateIndex, canonicalizeCheckConstraints, collectAndValidateParamRefs, comparePgsqlDatabaseSchema, compareSchemata, compileDelete, compileInsert, compileMutation, compilePlan, compileSetOperation, compileUpdate, compileUpsert, conditionalUpdate, cosineDistance, createAlterColumnSetNotNullOperationRuntime, createAlterTypeAddValueOperationRuntime, createAnyExpr, createAttachLogicalIdentityOperationRuntime, createEnumAddValueRule, createEqualityExpr, createLeafCompileFn, createLogicalIdentityAdoptionRule, createManualSqlOperationRuntime, createParamRef, createPgObservationIssuer, createPgTransitionLessor, createPgTransitionPack, createPgsqlAdapter, createPgsqlCompileOnlyAdapter, createSetNotNullRule, createTypeCastParamRef, defaultFkDerivation, derivePostgresqlCapabilitiesForVersion, ensureMigrationsTable, ensureTransitionJournal, excludedRef, executePgObservationFromLessor, generateCreateIndex, generateCursorName, generateDDL, generateDownSQL, generateMigrationFile, generateMigrationSQL, generateSeries, getAppliedMigrations, getNamingPluginForDbCasing, getNextSchemaVersion, getRowEstimates, getTotalExecutionTime, identityNaming, innerProduct, introspect, isBatchValuesJoinDecision, isDestructiveDown, isJoinDecision, isMigrationApplied, isPrecompiledJoinDecision, isReservedKeyword, l2Distance, mapColumnType, mapOnDeleteAction, nextval, normalizeManualSqlPayload, parse, parseExplainJson, parseMigrationFile, rawDistance, readPgObservationContextFromLessor, readTransitionJournal, recordMigration, redactParams, removeMigrationRecord, renderAlterColumnSetNotNullSql, renderAlterTypeAddValueSql, renderAttachLogicalIdentityLockSql, renderCreateDbspMetaSchemaSql, renderCreateIndex, renderCreateLogicalIdentityIndexesSql, renderCreateLogicalIdentitySideTableSql, renderCreateTransitionJournalTableSql, renderCreateTransitionRunTableSql, renderInsertLogicalIdentitySql, renderNoNullsCheckSql, renderSetNotNullLockSql, resolveLogicalName, sanitizeForDisplay, score, validateIdentifier, validateIdentifiers, validateParamRef, validateQualifiedIdentifier, validateSqlExpression, vectorDims, withMigrationLock };
|
|
3599
|
+
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 AddedEnumValue, type AlterColumnSetNotNullPayload, type AlterTypeAddValuePayload, type AttachLogicalIdentityPayload, type BatchValuesJoinDecision, COLUMN_EXISTS_OBSERVATION, CamelCaseNamingPlugin, type CanonicalizeCheckConstraintsOptions, type ChangeKind, CheckConstraintCanonicalizationError, type CheckConstraintCanonicalizationWarning, CheckConstraintNewEnumValueError, ColumnDefaultCanonicalizationError, type ColumnDefaultCanonicalizationWarning, type ComparePgsqlDatabaseSchemaOptions, type CompareSchemataOptions, type CompiledResult, type CompilerContext, type CompilerOptions, type CompilerState, type ConflictAction, type ConflictTarget, type CursorHoldOption, type CursorOptions, type CursorScrollOption, DBSP_LOGICAL_IDENTITY_TABLE, DBSP_META_SCHEMA, DBSP_TRANSITION_JOURNAL_TABLE, DBSP_TRANSITION_RUN_PLAN_TABLE, DBSP_TRANSITION_RUN_TABLE, DEFAULT_PK_COLUMN, DEFAULT_REDACTION_PATTERNS, type Decision, type DeleteConfig, type DetectedHierarchy, type DiffSummary, 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, ExpressionCanonicalizationUnavailableError, type ExpressionCanonicalizationWarning, type ExpressionHandler, type FetchDirection, type FetchOptions, type FkColumnDerivation, type GenerateDDLOptions, type IdentityAdoptionAsserter, IdentityNamingPlugin, type IncludeHandler, type IncludeResult, type IndexCapabilityContext, IndexFeatureUnsupportedError, type IndexRenderSpec, type InsertConfig, type IntrospectedModelIR, type IntrospectionOptions, InvalidIdentifierError, type JoinDecision, LOGICAL_IDENTITY_ADOPTION_RULE_ID, LOGICAL_IDENTITY_CARRIER_OBSERVATION, type LeafCompileFn, type LogicalIdentityAdoptionMatch, type LogicalIdentityAdoptionRuleOptions, MANUAL_SQL_OPERATION_KIND, type ManualSqlPayload, type MigrationRecord, type MigrationSQLOptions, NO_NULLS_GUARD, type NamingPlugin, NonConvergentSchemaDiffError, type NonConvergentSchemaDiffSurface, PG_INTROSPECTION_ARTIFACT, PG_OPERATION_PACK_ARTIFACT, PG_RULE_PACK_ARTIFACT, type ParamRefValidationResult, type ParsedMigrationFile, type PgAdvisoryLockKey, type PgAdvisoryLockResult, PgExecutionContractDerivationError, type PgTransitionClientLease, type PgTransitionPackOptions, PgsqlAdapter, type PgsqlAdapterOptions, PgsqlAdvisoryLockOptionsError, type PgsqlBorrowedClientAdapterOptions, PgsqlPinnedConnectionAbortSignalError, type PgsqlPoolAdapterOptions, type PgsqlPreparedStatementsOptions, PgsqlRawSqlTransactionControlError, PgsqlTransactionAbortSignalError, PgsqlTransactionAbortedCommitError, PgsqlTransactionAbortedError, PgsqlTransactionOptionsError, PgsqlTransactionTimeoutError, PlanCompiler, type PlanDecision, type PrecompiledJoinDecision, type RedactionConfig, type RedactionPattern, type RollbackOnlyPgsqlScope, SET_NOT_NULL_RULE_ID, type SchemaChange, type SchemaDiff, type SchemaScopeOptions, type SetNotNullMatch, type SetNotNullRuleOptions, type SetOperationResult, type SimplifiedPlanReport, type StreamConfig, type UpdateConfig, type UpsertConfig, type WhereDispatcher, type WhereHandler, acquirePgTransitionClient, assertCreateIndexSupported, assertCreateIndexesSupported, assertNoRepeatedExpressionSurfaceDrift, bm25Search, booleanSearch, boost, buildCloseCursor, buildDeclareCursor, buildExplain, buildExplainAnalyzeJson, buildExplainPlan, buildExplainVerbose, buildFetch, buildFetchAll, buildFetchFirst, buildFetchForward, buildFetchNext, buildOnConflictClause, buildStreamingStatements, camelCaseNaming, canGenerateCreateIndex, canonicalizeCheckConstraints, collectAndValidateParamRefs, comparePgsqlDatabaseSchema, compareSchemata, compileDelete, compileInsert, compileMutation, compilePlan, compileSetOperation, compileUpdate, compileUpsert, conditionalUpdate, cosineDistance, createAlterColumnSetNotNullOperationRuntime, createAlterTypeAddValueOperationRuntime, createAnyExpr, createAttachLogicalIdentityOperationRuntime, createEnumAddValueRule, createEqualityExpr, createLeafCompileFn, createLogicalIdentityAdoptionRule, createManualSqlOperationRuntime, createParamRef, createPgExecutionContract, createPgObservationIssuer, createPgTransitionLessor, createPgTransitionPack, createPgTransitionRunPersister, createPgsqlAdapter, createPgsqlCompileOnlyAdapter, createSetNotNullRule, createTypeCastParamRef, defaultFkDerivation, derivePostgresqlCapabilitiesForVersion, ensureMigrationsTable, ensureTransitionJournal, escapeDiagnosticText, evaluatePgExecutionContract, excludedRef, executePgObservationFromLessor, generateCreateIndex, generateCursorName, generateDDL, generateDownSQL, generateMigrationFile, generateMigrationSQL, generateSeries, getAppliedMigrations, getNamingPluginForDbCasing, getNextSchemaVersion, getRowEstimates, getTotalExecutionTime, identityNaming, innerProduct, introspect, isBatchValuesJoinDecision, isDestructiveDown, isJoinDecision, isMigrationApplied, isPrecompiledJoinDecision, isReservedKeyword, l2Distance, mapColumnType, mapOnDeleteAction, nextval, normalizeManualSqlPayload, parse, parseExplainJson, parseMigrationFile, pgTargetIdentityMismatch, rawDistance, readPgExecutionTargetFromClient, readPgObservationContextFromLessor, readTransitionJournal, recordMigration, redactParams, removeMigrationRecord, renderAlterColumnSetNotNullSql, renderAlterTypeAddValueSql, renderAttachLogicalIdentityLockSql, renderCreateDbspMetaSchemaSql, renderCreateIndex, renderCreateLogicalIdentityIndexesSql, renderCreateLogicalIdentitySideTableSql, renderCreateTransitionJournalTableSql, renderCreateTransitionRunPlanTableSql, renderCreateTransitionRunTableSql, renderInsertLogicalIdentitySql, renderNoNullsCheckSql, renderSetNotNullLockSql, resolveLogicalName, sanitizeForDisplay, score, validateIdentifier, validateIdentifiers, validateParamRef, validateQualifiedIdentifier, validateSqlExpression, vectorDims, withMigrationLock };
|