@dbsp/types 3.3.0 → 4.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.
@@ -232,13 +232,13 @@ interface SequenceIR {
232
232
  /** Sequence name */
233
233
  readonly name: string;
234
234
  /** Start value */
235
- readonly startWith?: number;
235
+ readonly startWith?: number | string;
236
236
  /** Increment step */
237
- readonly incrementBy?: number;
237
+ readonly incrementBy?: number | string;
238
238
  /** Minimum value */
239
- readonly minValue?: number;
239
+ readonly minValue?: number | string;
240
240
  /** Maximum value */
241
- readonly maxValue?: number;
241
+ readonly maxValue?: number | string;
242
242
  /** Whether to cycle */
243
243
  readonly cycle?: boolean;
244
244
  /** Schema name (if not default) */
@@ -327,7 +327,12 @@ interface IndexIR {
327
327
  readonly nullsNotDistinct?: boolean;
328
328
  /** Index access method (default: btree) */
329
329
  readonly method?: string;
330
- /** Partial index predicate (WHERE clause) */
330
+ /**
331
+ * Partial index predicate (WHERE clause). The model representation has one
332
+ * absence value: `undefined`. Every present string, including an empty or
333
+ * whitespace-only string, is an authored `WHERE` clause and must reach
334
+ * PostgreSQL.
335
+ */
331
336
  readonly where?: string;
332
337
  /** Expression-based index entries (used instead of/alongside columns) */
333
338
  readonly expressions?: readonly string[];
@@ -344,6 +349,19 @@ interface IndexIR {
344
349
  interface TableIR {
345
350
  /** Table name in database */
346
351
  readonly name: string;
352
+ /**
353
+ * An explicit address change for this table. The desired table remains
354
+ * identified by `name`; `from` and `to` make the otherwise ambiguous
355
+ * rename/schema move an authored transition rather than inferred drift.
356
+ */
357
+ readonly readdress?: TableReaddressDeclaration;
358
+ /**
359
+ * Declare that this named, pre-existing table is to enter managed state.
360
+ * Existing objects are otherwise drift; adoption is never inferred.
361
+ */
362
+ readonly adopt?: true;
363
+ /** Request a reviewed retire-and-create replacement of this unchanged table. */
364
+ readonly replace?: true;
347
365
  /** Stable logical identity, when attached by an engine-neutral carrier. */
348
366
  readonly logicalIdentity?: LogicalIdentity;
349
367
  /** Column definitions */
@@ -371,6 +389,20 @@ interface TableIR {
371
389
  /** Row-Level Security policies */
372
390
  readonly policies?: readonly PolicyIR[];
373
391
  }
392
+ /** One endpoint of an authored table re-addressing declaration. */
393
+ interface TableReaddressAddress {
394
+ readonly name: string;
395
+ readonly schema?: string;
396
+ /** Deliberately carried through so the command can refuse the named kind. */
397
+ readonly kind?: string;
398
+ /** Deliberately carried through so the command can refuse cross-database moves. */
399
+ readonly database?: string;
400
+ }
401
+ /** A declared rename or schema move; execution currently supports tables only. */
402
+ interface TableReaddressDeclaration {
403
+ readonly from: TableReaddressAddress;
404
+ readonly to: TableReaddressAddress;
405
+ }
374
406
  /**
375
407
  * Relation definition with planning metadata
376
408
  */
@@ -1077,13 +1109,19 @@ interface WhereJsonExistsIntent {
1077
1109
  readonly field: string;
1078
1110
  readonly key: string | ParamIntent;
1079
1111
  }
1080
- /** WHERE clause using a custom expression with comparison */
1081
- interface WhereExpressionIntent {
1112
+ /** WHERE clause using a custom expression, optionally compared to a value. */
1113
+ type WhereExpressionIntent = {
1082
1114
  readonly kind: 'expression';
1083
1115
  readonly expr: ExpressionIntent;
1084
1116
  readonly operator: ComparisonOperator;
1085
1117
  readonly value: unknown;
1086
- }
1118
+ } | {
1119
+ readonly kind: 'expression';
1120
+ readonly expr: StandaloneWhereExpressionIntent;
1121
+ /** A standalone expression that is already a SQL predicate. */
1122
+ readonly operator?: never;
1123
+ readonly value?: never;
1124
+ };
1087
1125
  /**
1088
1126
  * Where intent - filter conditions union type
1089
1127
  * Discriminated union using 'kind' field
@@ -1427,6 +1465,14 @@ interface JsonPathExtractIntent {
1427
1465
  readonly mode: 'json' | 'text';
1428
1466
  readonly as?: string | undefined;
1429
1467
  }
1468
+ /**
1469
+ * Operators whose result is a SQL predicate.
1470
+ *
1471
+ * This is deliberately closed: `op()` only brands these literal operators as
1472
+ * predicates. Arbitrary operator strings remain ordinary expressions unless a
1473
+ * caller explicitly opts into `unsafeAsPredicate()`.
1474
+ */
1475
+ type PredicateOperator = '=' | '!=' | '<>' | '<' | '<=' | '>' | '>=' | 'AND' | 'OR' | 'NOT' | '@@' | '@@@' | '&&' | '<@' | '@>';
1430
1476
  /** Custom binary operator expression (e.g., <=> for pgvector) */
1431
1477
  interface CustomOpExpressionIntent {
1432
1478
  readonly kind: 'customOp';
@@ -1514,6 +1560,14 @@ interface UnaryExpressionIntent {
1514
1560
  * Extensible for future expression types
1515
1561
  */
1516
1562
  type ExpressionIntent = ColumnExpressionIntent | CoalesceExpressionIntent | RawExpressionIntent | ColumnAliasIntent | RelationColumnIntent | WindowIntent | AggregateExpressionIntent | PseudoColumnExpressionIntent | FunctionExpressionIntent | SubqueryExpressionIntent | ArithmeticExpressionIntent | LiteralExpressionIntent | ComparisonExpressionIntent | CaseExpressionIntent | JsonExtractIntent | JsonContainsIntent | JsonExistsIntent | JsonPathExtractIntent | CustomOpExpressionIntent | CustomFnExpressionIntent | RefExpressionIntent | ParamExpressionIntent | CastExpressionIntent | UnaryExpressionIntent | NamedArgExpressionIntent | StarExpressionIntent | ArrayExpressionIntent;
1563
+ /**
1564
+ * Expression intents that the standalone `WHERE` expression compiler accepts.
1565
+ *
1566
+ * This deliberately excludes SELECT-only and planner-only expression kinds.
1567
+ * A standalone expression is used only when a local predicate wrapper derives
1568
+ * `{ kind: 'expression', expr }` for `WHERE`.
1569
+ */
1570
+ type StandaloneWhereExpressionIntent = CustomOpExpressionIntent | CustomFnExpressionIntent | RefExpressionIntent | ParamExpressionIntent | CastExpressionIntent | LiteralExpressionIntent | UnaryExpressionIntent | NamedArgExpressionIntent | StarExpressionIntent | ArrayExpressionIntent | SubqueryExpressionIntent | RelationColumnIntent | CaseExpressionIntent;
1517
1571
  /**
1518
1572
  * Window function types for OVER clause analytics.
1519
1573
  * - Ranking: row_number, rank, dense_rank (no field required)
@@ -2793,6 +2847,21 @@ interface AdapterCapabilities {
2793
2847
  readonly supportsWindowFunctions: boolean;
2794
2848
  readonly supportsArrayType: boolean;
2795
2849
  }
2850
+ /**
2851
+ * Per-instance connection state for adapters whose compile surface can exist
2852
+ * without a live database connection.
2853
+ *
2854
+ * This is deliberately separate from AdapterCapabilities: a database can
2855
+ * support a feature such as transactions even when this adapter instance has
2856
+ * no connection with which to execute one.
2857
+ */
2858
+ type ConnectionAvailability = {
2859
+ readonly status: 'available';
2860
+ } | {
2861
+ readonly status: 'unavailable';
2862
+ readonly reason: string;
2863
+ readonly fix: string;
2864
+ };
2796
2865
  interface CompiledColumnMetadata {
2797
2866
  readonly table: string;
2798
2867
  readonly column: string;
@@ -3101,6 +3170,20 @@ interface Dump {
3101
3170
  interface BaseAdapter {
3102
3171
  /** Adapter capabilities for feature detection */
3103
3172
  readonly capabilities: AdapterCapabilities;
3173
+ /**
3174
+ * Optional per-instance connection state.
3175
+ *
3176
+ * Adapters that omit this retain the existing capability-only execution
3177
+ * checks. Adapters that declare an unavailable connection let core return
3178
+ * their actionable refusal before any capability preflight.
3179
+ */
3180
+ readonly connectionAvailability?: ConnectionAvailability;
3181
+ /**
3182
+ * Optional side-effect-free execution availability check.
3183
+ *
3184
+ * When present, core uses this instead of probing a raw connection handle.
3185
+ */
3186
+ executionAvailable?(): boolean;
3104
3187
  /**
3105
3188
  * Whether this adapter instance is scoped inside a transaction.
3106
3189
  * Compile-only adapters and adapters without an active transaction report false.
@@ -3160,8 +3243,8 @@ interface ExecutingAdapter extends BaseAdapter {
3160
3243
  /** Execute a query and return all results. */
3161
3244
  execute<T>(query: CompiledQuery<T>): Promise<T[]>;
3162
3245
  /** Execute a compiled query and return the rows plus result metadata, when the adapter supports it. */
3163
- executeWithMeta?<T = unknown>(query: CompiledQuery<T>): Promise<{
3164
- readonly rows: T[];
3246
+ executeWithMeta?(query: CompiledQuery): Promise<{
3247
+ readonly rows: readonly unknown[];
3165
3248
  readonly rowCount: number;
3166
3249
  readonly command?: string;
3167
3250
  }>;
@@ -3285,7 +3368,7 @@ interface RawSqlAdapter extends BaseAdapter {
3285
3368
  /**
3286
3369
  * PostgreSQL index access method.
3287
3370
  */
3288
- type IndexMethod = 'btree' | 'hash' | 'gist' | 'gin' | 'brin' | 'hnsw' | 'ivfflat' | 'bm25';
3371
+ type IndexMethod = 'btree' | 'hash' | 'gist' | 'gin' | 'brin' | 'spgist' | 'bloom' | 'hnsw' | 'ivfflat' | 'bm25';
3289
3372
  /** A column reference in an index: either a column name or an expression. */
3290
3373
  type IndexColumnDef = string | {
3291
3374
  expression: string;
@@ -3392,37 +3475,6 @@ interface DDLGeneratingAdapter extends BaseAdapter {
3392
3475
  */
3393
3476
  generateDDL(schema: ModelIR, options?: Record<string, unknown>): string[];
3394
3477
  }
3395
- /**
3396
- * Compile-only adapter - can compile SQL and generate DDL, but cannot execute
3397
- * queries or stream results. Useful for tooling, CLI, and testing without a
3398
- * live database connection.
3399
- *
3400
- * Includes DDLGeneratingAdapter because DDL generation is purely compile-time
3401
- * (no DB connection required — same rationale as SQL compilation).
3402
- *
3403
- * Explicitly excludes execution interfaces so that type-checking catches
3404
- * misuse (e.g. calling execute() on a compile-only instance) at compile time.
3405
- */
3406
- type CompileOnlyAdapter = CompilingAdapter & DDLGeneratingAdapter & TableDDLGeneratorAdapter & {
3407
- /** Naming convention used by this adapter. */
3408
- readonly dbCasing: DbCasing;
3409
- /**
3410
- * Create a schema-scoped compile-only adapter.
3411
- * Purely a schema-name prefix — no DB interaction required.
3412
- */
3413
- withSchema(schemaName: string): CompileOnlyAdapter;
3414
- readonly execute?: never;
3415
- readonly executeWithMeta?: never;
3416
- readonly executeOne?: never;
3417
- readonly executeOneOrThrow?: never;
3418
- readonly stream?: never;
3419
- readonly streamRaw?: never;
3420
- readonly introspect?: never;
3421
- readonly transaction?: never;
3422
- readonly withPinnedConnection?: never;
3423
- readonly executeRaw?: never;
3424
- readonly executeDDL?: never;
3425
- };
3426
3478
  /**
3427
3479
  * Database adapter interface - full adapter with all capabilities.
3428
3480
  *
@@ -3437,12 +3489,22 @@ interface Adapter<DB = unknown> extends CompilingAdapter, ExecutingAdapter, Stre
3437
3489
  readonly dbCasing: DbCasing;
3438
3490
  /**
3439
3491
  * Execute a DDL statement directly (e.g. TRUNCATE, VACUUM, ALTER TABLE, CREATE INDEX).
3440
- * Optional — compile-only adapters do not implement this.
3492
+ * Optional — adapters that do not provide DDL execution omit this method.
3441
3493
  *
3442
3494
  * @since DDL-TABLE-001
3443
3495
  */
3444
3496
  executeDDL?(sql: string): Promise<void>;
3445
3497
  }
3498
+ /**
3499
+ * @deprecated Existing `CompileOnlyAdapter` annotations remain valid. Use
3500
+ * `Adapter` when direct execution calls are needed.
3501
+ */
3502
+ type CompileOnlyAdapter<DB = unknown> = CompilingAdapter & DDLGeneratingAdapter & TableDDLGeneratorAdapter & {
3503
+ /** Naming convention used by this adapter. */
3504
+ readonly dbCasing: DbCasing;
3505
+ /** Create a schema-scoped compile-only adapter. */
3506
+ withSchema(schemaName: string): CompileOnlyAdapter<DB>;
3507
+ };
3446
3508
  /** Behavior when schema uses features the adapter doesn't support */
3447
3509
  type UnsupportedFeatureBehavior = 'error' | 'warning' | 'ignore';
3448
3510
  /** Aligned with DialectCapabilities supportsDDL* flags (1:1 mapping) */
@@ -3519,4 +3581,4 @@ interface TranslationContext {
3519
3581
  readonly dialectCapabilities: DialectCapabilities;
3520
3582
  }
3521
3583
 
3522
- export { type CustomTraversal as $, type Adapter as A, type BaseAdapter as B, type CompiledQuery as C, type CastExpressionIntent as D, type CheckConstraintIR as E, type CoalesceExpressionIntent as F, type ColumnAliasIntent as G, type ColumnExpressionIntent as H, type ColumnIR as I, type ColumnJsReadType as J, type ColumnListInput as K, type ColumnType as L, type CommonColumnType as M, type NqlBindingRelationType as N, type ComparisonExpressionIntent as O, type PlanReport as P, type ComparisonOperator as Q, type CompileOnlyAdapter as R, type CompileOptions as S, type CompileOptionsBase as T, type CompileResultWithIncludes as U, type CompiledNqlQuery as V, type CompilingAdapter as W, type CreateIndexOptions as X, type CteQueryIntent as Y, type CustomFnExpressionIntent as Z, type CustomOpExpressionIntent as _, type CompiledColumnMetadata as a, type NqlBindingColumnTypeInfo as a$, type DDLFeature as a0, type DDLFeatureElementMap as a1, type DDLFeatureVersionRange as a2, type DDLGeneratingAdapter as a3, type DbCasing as a4, type DecisionType as a5, type DeleteIntent as a6, type DialectCapabilities as a7, type DialectName as a8, type DiffSummary as a9, type InsertIntent as aA, type IntrospectingAdapter as aB, type IntrospectionOptions as aC, type IntrospectionResult as aD, type IsTypeSupported as aE, type JoinDefault as aF, type JoinIntent as aG, type JsonAggOrderByEntry as aH, type JsonContainsIntent as aI, type JsonExistsIntent as aJ, type JsonExtractIntent as aK, type JsonPathExtractIntent as aL, type LiteralExpressionIntent as aM, type LockIntent as aN, type LockStrength as aO, type LockWaitPolicy as aP, type LogicalIdentity as aQ, type LogicalIdentityCarrier as aR, type LogicalOperator as aS, type MSSQLColumnType as aT, type ModelIR as aU, type MutationIntent as aV, type MutationReturningItem as aW, type MySQLColumnType as aX, type NamedArgExpressionIntent as aY, type NestedOutputReadHandling as aZ, type NqlBindingColumnLineage as a_, type DropIndexOptions as aa, type DuckDBColumnType as ab, type Dump as ac, type DumpMeta as ad, type DumpSequenceStep as ae, type EdgeTableTraversal as af, type EmitJoinClause as ag, type EnumIR as ah, type ExecutingAdapter as ai, type ExpressionIntent as aj, type FeatureBehaviorConfig as ak, type FeatureTranslator as al, type FeatureWarning as am, type FieldRef as an, type FilterStrategy as ao, type ForeignKeyIR as ap, type FunctionExpressionIntent as aq, type HierarchyIR as ar, type IncludeIntent as as, type IncludeRecursiveOptions as at, type IncludeStrategy as au, type IndexColumnDef as av, type IndexIR as aw, type IndexInfo as ax, type IndexMethod as ay, type InsertFromIntent as az, type AdapterCapabilities as b, type RequiredEnumLabelIR as b$, type NqlBindingColumnUntypeableReason as b0, type NqlBindingOutputSchema as b1, type NqlBindingRelationFilterMetadata as b2, type NqlBindingVirtualRelation as b3, type NqlBindingVirtualRelationHop as b4, type NqlBindingVirtualRelationRecursive as b5, type NqlProgramSequenceStep as b6, type NqlRuntimeBinding as b7, type NullOperator as b8, type NullsPosition as b9, type QueryIntent as bA, type RangeOperand as bB, type RangeOperator as bC, type RangeValue as bD, type RankingWindowFunction as bE, type RankingWindowIntent as bF, type RawCteIntent as bG, type RawExpressionIntent as bH, type RawSqlAdapter as bI, type RecursiveAdvancedOptions as bJ, type RecursiveDedupe as bK, type RecursiveDirection as bL, type RecursiveEmitOptions as bM, type RecursiveExistsOptions as bN, type RecursiveIntent as bO, type RecursiveMetadata as bP, type RecursiveNodeIdExpr as bQ, type RecursivePlanOptions as bR, type RecursivePlanReport as bS, type RecursiveTrackOptions as bT, type RecursiveTraversal as bU, type RefExpressionIntent as bV, type RelationColumnIntent as bW, type RelationIR as bX, type RelationKind as bY, type RelationOperator as bZ, type RelationType as b_, type OffsetWindowFunction as ba, type OffsetWindowIntent as bb, type OnDeleteAction as bc, type OperationKindRef as bd, type Optionality as be, type OrderByExpressionIntent as bf, type OrderByFieldIntent as bg, type OrderByIntent as bh, type OutputDescriptor as bi, type OutputReadHandling as bj, type OutputSource as bk, type OutputValueShape as bl, type ParamExpressionIntent as bm, type ParamIntent as bn, type PartitionIR as bo, type PinnedConnectionOptions as bp, type PlanDecision as bq, type PlanOptions as br, type PlanWarning as bs, type PlanWarningCode as bt, type PolicyIR as bu, type PostgresColumnType as bv, type PostgresOnlyColumnType as bw, type PseudoColumnExpressionIntent as bx, type PseudoColumnMetadata as by, type PseudoColumnTraversal as bz, type AdapterLogger as c, type WindowOrderBy as c$, type ResolvedIncludeStrategy as c0, type SQLiteColumnType as c1, type SchemaChange as c2, type SchemaDiff as c3, type SelectAggregateIntent as c4, type SelectAllIntent as c5, type SelectFieldsIntent as c6, type SelectIntent as c7, type SelectWithExpressionsIntent as c8, type SemanticArtifactId as c9, type UpsertConflictTarget as cA, type UpsertFromIntent as cB, type UpsertIntent as cC, type VacuumOptions as cD, type WhereAndIntent as cE, type WhereAnyIntent as cF, type WhereComparisonIntent as cG, type WhereExistsIntent as cH, type WhereExpressionIntent as cI, type WhereInIntent as cJ, type WhereInSubqueryIntent as cK, type WhereInValueIntent as cL, type WhereIntent as cM, type WhereJsonContainsIntent as cN, type WhereJsonExistsIntent as cO, type WhereLikeIntent as cP, type WhereNotExistsIntent as cQ, type WhereNotIntent as cR, type WhereNullIntent as cS, type WhereOrIntent as cT, type WhereRangeIntent as cU, type WhereRawExistsIntent as cV, type WhereRawNotExistsIntent as cW, type WhereRelationFilterIntent as cX, type WhereSubqueryIntent as cY, type WindowFunction as cZ, type WindowIntent as c_, type SemanticArtifactRef as ca, type SequenceIR as cb, type SetOperationIntent as cc, type SetOperationType as cd, type SimpleCteIntent as ce, type SortDirection as cf, type StarExpressionIntent as cg, type StreamingAdapter as ch, type StringOperator as ci, type SubqueryExpressionIntent as cj, type SubqueryIncludeInfo as ck, type SubqueryRefIntent as cl, type SupportedColumnTypes as cm, type TableDDLGeneratorAdapter as cn, type TableIR as co, type TransactionBeginOptions as cp, type TransactionOptions as cq, type TransactionalAdapter as cr, type TranslationContext as cs, type TruncateOptions as ct, type TrustRoot as cu, type UnaryExpressionIntent as cv, type UnnestCteIntent as cw, type UnsupportedFeatureBehavior as cx, type UpdateIntent as cy, type UpsertConflictAction as cz, type AdapterStreamOptions as d, getNodeIdAlias as d0, isFieldRef as d1, isParamIntent as d2, resolveOutputReadHandling as d3, toColumnList as d4, type AdjacencyTraversal as e, type AggOrderByArg as f, type AggregateCountIntent as g, type AggregateExpressionIntent as h, type AggregateFieldIntent as i, type AggregateFunction as j, type AggregateIntent as k, type AggregateWindowFunction as l, type AggregateWindowIntent as m, type AliasIncludedColumnsMode as n, type AlterColumnOptions as o, type AmbiguityCheckResult as p, type ArithmeticExpressionIntent as q, type ArrayExpressionIntent as r, type ArrayOperator as s, type AuthorAttestedNativeDefault as t, type AuthorAttester as u, type BatchUpdateIntent as v, type BatchValuesJoinPayload as w, type CTEDefinition as x, type Cardinality as y, type CaseExpressionIntent as z };
3584
+ export { type CustomOpExpressionIntent as $, type Adapter as A, type BaseAdapter as B, type CompiledQuery as C, type CastExpressionIntent as D, type CheckConstraintIR as E, type CoalesceExpressionIntent as F, type ColumnAliasIntent as G, type ColumnExpressionIntent as H, type ColumnIR as I, type ColumnJsReadType as J, type ColumnListInput as K, type ColumnType as L, type CommonColumnType as M, type NqlBindingRelationType as N, type ComparisonExpressionIntent as O, type PlanReport as P, type ComparisonOperator as Q, type CompileOnlyAdapter as R, type CompileOptions as S, type CompileOptionsBase as T, type CompileResultWithIncludes as U, type CompiledNqlQuery as V, type CompilingAdapter as W, type ConnectionAvailability as X, type CreateIndexOptions as Y, type CteQueryIntent as Z, type CustomFnExpressionIntent as _, type CompiledColumnMetadata as a, type NqlBindingColumnLineage as a$, type CustomTraversal as a0, type DDLFeature as a1, type DDLFeatureElementMap as a2, type DDLFeatureVersionRange as a3, type DDLGeneratingAdapter as a4, type DbCasing as a5, type DecisionType as a6, type DeleteIntent as a7, type DialectCapabilities as a8, type DialectName as a9, type InsertFromIntent as aA, type InsertIntent as aB, type IntrospectingAdapter as aC, type IntrospectionOptions as aD, type IntrospectionResult as aE, type IsTypeSupported as aF, type JoinDefault as aG, type JoinIntent as aH, type JsonAggOrderByEntry as aI, type JsonContainsIntent as aJ, type JsonExistsIntent as aK, type JsonExtractIntent as aL, type JsonPathExtractIntent as aM, type LiteralExpressionIntent as aN, type LockIntent as aO, type LockStrength as aP, type LockWaitPolicy as aQ, type LogicalIdentity as aR, type LogicalIdentityCarrier as aS, type LogicalOperator as aT, type MSSQLColumnType as aU, type ModelIR as aV, type MutationIntent as aW, type MutationReturningItem as aX, type MySQLColumnType as aY, type NamedArgExpressionIntent as aZ, type NestedOutputReadHandling as a_, type DiffSummary as aa, type DropIndexOptions as ab, type DuckDBColumnType as ac, type Dump as ad, type DumpMeta as ae, type DumpSequenceStep as af, type EdgeTableTraversal as ag, type EmitJoinClause as ah, type EnumIR as ai, type ExecutingAdapter as aj, type ExpressionIntent as ak, type FeatureBehaviorConfig as al, type FeatureTranslator as am, type FeatureWarning as an, type FieldRef as ao, type FilterStrategy as ap, type ForeignKeyIR as aq, type FunctionExpressionIntent as ar, type HierarchyIR as as, type IncludeIntent as at, type IncludeRecursiveOptions as au, type IncludeStrategy as av, type IndexColumnDef as aw, type IndexIR as ax, type IndexInfo as ay, type IndexMethod as az, type AdapterCapabilities as b, type RelationOperator as b$, type NqlBindingColumnTypeInfo as b0, type NqlBindingColumnUntypeableReason as b1, type NqlBindingOutputSchema as b2, type NqlBindingRelationFilterMetadata as b3, type NqlBindingVirtualRelation as b4, type NqlBindingVirtualRelationHop as b5, type NqlBindingVirtualRelationRecursive as b6, type NqlProgramSequenceStep as b7, type NqlRuntimeBinding as b8, type NullOperator as b9, type PseudoColumnMetadata as bA, type PseudoColumnTraversal as bB, type QueryIntent as bC, type RangeOperand as bD, type RangeOperator as bE, type RangeValue as bF, type RankingWindowFunction as bG, type RankingWindowIntent as bH, type RawCteIntent as bI, type RawExpressionIntent as bJ, type RawSqlAdapter as bK, type RecursiveAdvancedOptions as bL, type RecursiveDedupe as bM, type RecursiveDirection as bN, type RecursiveEmitOptions as bO, type RecursiveExistsOptions as bP, type RecursiveIntent as bQ, type RecursiveMetadata as bR, type RecursiveNodeIdExpr as bS, type RecursivePlanOptions as bT, type RecursivePlanReport as bU, type RecursiveTrackOptions as bV, type RecursiveTraversal as bW, type RefExpressionIntent as bX, type RelationColumnIntent as bY, type RelationIR as bZ, type RelationKind as b_, type NullsPosition as ba, type OffsetWindowFunction as bb, type OffsetWindowIntent as bc, type OnDeleteAction as bd, type OperationKindRef as be, type Optionality as bf, type OrderByExpressionIntent as bg, type OrderByFieldIntent as bh, type OrderByIntent as bi, type OutputDescriptor as bj, type OutputReadHandling as bk, type OutputSource as bl, type OutputValueShape as bm, type ParamExpressionIntent as bn, type ParamIntent as bo, type PartitionIR as bp, type PinnedConnectionOptions as bq, type PlanDecision as br, type PlanOptions as bs, type PlanWarning as bt, type PlanWarningCode as bu, type PolicyIR as bv, type PostgresColumnType as bw, type PostgresOnlyColumnType as bx, type PredicateOperator as by, type PseudoColumnExpressionIntent as bz, type AdapterLogger as c, type WhereRawNotExistsIntent as c$, type RelationType as c0, type RequiredEnumLabelIR as c1, type ResolvedIncludeStrategy as c2, type SQLiteColumnType as c3, type SchemaChange as c4, type SchemaDiff as c5, type SelectAggregateIntent as c6, type SelectAllIntent as c7, type SelectFieldsIntent as c8, type SelectIntent as c9, type UnaryExpressionIntent as cA, type UnnestCteIntent as cB, type UnsupportedFeatureBehavior as cC, type UpdateIntent as cD, type UpsertConflictAction as cE, type UpsertConflictTarget as cF, type UpsertFromIntent as cG, type UpsertIntent as cH, type VacuumOptions as cI, type WhereAndIntent as cJ, type WhereAnyIntent as cK, type WhereComparisonIntent as cL, type WhereExistsIntent as cM, type WhereExpressionIntent as cN, type WhereInIntent as cO, type WhereInSubqueryIntent as cP, type WhereInValueIntent as cQ, type WhereIntent as cR, type WhereJsonContainsIntent as cS, type WhereJsonExistsIntent as cT, type WhereLikeIntent as cU, type WhereNotExistsIntent as cV, type WhereNotIntent as cW, type WhereNullIntent as cX, type WhereOrIntent as cY, type WhereRangeIntent as cZ, type WhereRawExistsIntent as c_, type SelectWithExpressionsIntent as ca, type SemanticArtifactId as cb, type SemanticArtifactRef as cc, type SequenceIR as cd, type SetOperationIntent as ce, type SetOperationType as cf, type SimpleCteIntent as cg, type SortDirection as ch, type StandaloneWhereExpressionIntent as ci, type StarExpressionIntent as cj, type StreamingAdapter as ck, type StringOperator as cl, type SubqueryExpressionIntent as cm, type SubqueryIncludeInfo as cn, type SubqueryRefIntent as co, type SupportedColumnTypes as cp, type TableDDLGeneratorAdapter as cq, type TableIR as cr, type TableReaddressAddress as cs, type TableReaddressDeclaration as ct, type TransactionBeginOptions as cu, type TransactionOptions as cv, type TransactionalAdapter as cw, type TranslationContext as cx, type TruncateOptions as cy, type TrustRoot as cz, type AdapterStreamOptions as d, type WhereRelationFilterIntent as d0, type WhereSubqueryIntent as d1, type WindowFunction as d2, type WindowIntent as d3, type WindowOrderBy as d4, getNodeIdAlias as d5, isFieldRef as d6, isParamIntent as d7, resolveOutputReadHandling as d8, toColumnList as d9, type AdjacencyTraversal as e, type AggOrderByArg as f, type AggregateCountIntent as g, type AggregateExpressionIntent as h, type AggregateFieldIntent as i, type AggregateFunction as j, type AggregateIntent as k, type AggregateWindowFunction as l, type AggregateWindowIntent as m, type AliasIncludedColumnsMode as n, type AlterColumnOptions as o, type AmbiguityCheckResult as p, type ArithmeticExpressionIntent as q, type ArrayExpressionIntent as r, type ArrayOperator as s, type AuthorAttestedNativeDefault as t, type AuthorAttester as u, type BatchUpdateIntent as v, type BatchValuesJoinPayload as w, type CTEDefinition as x, type Cardinality as y, type CaseExpressionIntent as z };
@@ -1,4 +1,4 @@
1
- import { C as CompiledQuery, a as CompiledColumnMetadata, P as PlanReport } from './adapter-CBhAwQzd.js';
1
+ import { C as CompiledQuery, a as CompiledColumnMetadata, P as PlanReport } from './adapter-B057_WKR.js';
2
2
 
3
3
  /**
4
4
  * Stable SPI for implementing the `Adapter` port. Only stable helpers required to construct/validate a
@@ -367,6 +367,154 @@ function buildRelationKeyFields(fk, direction, options = {}) {
367
367
  return { foreignKey };
368
368
  }
369
369
 
370
+ // src/transition/execution-contract.ts
371
+ var EXECUTION_CONTRACT_VERSION = 1;
372
+
373
+ // src/transition/ledger.ts
374
+ var LEDGER_EVENT_KINDS = [
375
+ "adopt-intent",
376
+ "adopt",
377
+ "intent",
378
+ "retire-intent",
379
+ "readdress-intent",
380
+ "refused",
381
+ "executing",
382
+ "observed",
383
+ "absent",
384
+ "indeterminate",
385
+ "resolved",
386
+ "readdressed-to",
387
+ "readdressed-from",
388
+ "released"
389
+ ];
390
+ function canonicalResourceParent(address) {
391
+ return {
392
+ engine: address.engine,
393
+ database: address.database,
394
+ ...address.schema === void 0 ? {} : { schema: address.schema },
395
+ ...address.parent === void 0 || address.parent === null ? {} : { parent: canonicalResourceParent(address.parent) },
396
+ kind: address.kind,
397
+ name: address.name
398
+ };
399
+ }
400
+ function canonicalJson(value) {
401
+ if (value === null) return "null";
402
+ if (value === void 0) return "null";
403
+ if (Array.isArray(value)) {
404
+ const entries = [];
405
+ for (let index = 0; index < value.length; index += 1)
406
+ entries.push(
407
+ Object.hasOwn(value, index) ? canonicalJson(value[index]) : "null"
408
+ );
409
+ return `[${entries.join(",")}]`;
410
+ }
411
+ if (typeof value === "object") {
412
+ const entries = Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, item]) => `${JSON.stringify(key)}:${canonicalJson(item)}`);
413
+ return `{${entries.join(",")}}`;
414
+ }
415
+ return JSON.stringify(value);
416
+ }
417
+ function normalizedParent(parent) {
418
+ if (parent === null || parent === void 0) return null;
419
+ const canonical = canonicalResourceParent(parent);
420
+ return {
421
+ engine: canonical.engine,
422
+ database: canonical.database,
423
+ ...canonical.schema === void 0 ? {} : { schema: canonical.schema },
424
+ parent: normalizedParent(canonical.parent),
425
+ kind: canonical.kind,
426
+ name: canonical.name
427
+ };
428
+ }
429
+ function canonicalLedgerAddress(address) {
430
+ return {
431
+ scope: address.scope,
432
+ engine: address.engine,
433
+ database: address.database,
434
+ ...address.schema === void 0 ? {} : { schema: address.schema },
435
+ parent: normalizedParent(address.parent),
436
+ kind: address.kind,
437
+ name: address.name
438
+ };
439
+ }
440
+ function sameLedgerAddress(left, right) {
441
+ return ledgerAddressKey(left) === ledgerAddressKey(right);
442
+ }
443
+ function ledgerAddressKey(address) {
444
+ return canonicalJson(canonicalLedgerAddress(address));
445
+ }
446
+ function ledgerAddressParentJson(address) {
447
+ return canonicalJson(normalizedParent(address.parent));
448
+ }
449
+
450
+ // src/transition/refusal.ts
451
+ var REFUSAL_VOCABULARY = {
452
+ "ERR-01": {
453
+ cause: "unaccepted non-transactional segment",
454
+ withheldAuthority: "non-transactional execution authority",
455
+ resolvingCommand: "dbsp apply"
456
+ },
457
+ "ERR-02": {
458
+ cause: "pre-existing object has no admitted adoption",
459
+ withheldAuthority: "creation authority over an occupied address",
460
+ resolvingCommand: "dbsp apply"
461
+ },
462
+ "ERR-03": {
463
+ cause: "managed-ledger preflight is not current",
464
+ withheldAuthority: "managed-ledger mutation authority",
465
+ resolvingCommand: "dbsp preflight --reinitialize"
466
+ },
467
+ "ERR-04": {
468
+ cause: "removal containment cannot be proven",
469
+ withheldAuthority: "destructive removal authority",
470
+ resolvingCommand: "dbsp apply"
471
+ },
472
+ "ERR-05": {
473
+ cause: "recorded identity differs from the live object",
474
+ withheldAuthority: "managed mutation authority",
475
+ resolvingCommand: "dbsp apply"
476
+ },
477
+ "ERR-06": {
478
+ cause: "managed-ledger lineage does not match this target",
479
+ withheldAuthority: "managed-ledger mutation authority",
480
+ resolvingCommand: "dbsp preflight --reinitialize"
481
+ },
482
+ "ERR-07": {
483
+ cause: "target database is read-only",
484
+ withheldAuthority: "database write authority",
485
+ resolvingCommand: "dbsp apply"
486
+ },
487
+ "ERR-08": {
488
+ cause: "ledger chain is malformed",
489
+ withheldAuthority: "managed mutation authority",
490
+ resolvingCommand: "dbsp inspect"
491
+ },
492
+ "ERR-09": {
493
+ cause: "catalogue read is unavailable",
494
+ withheldAuthority: "outcome classification authority",
495
+ resolvingCommand: "dbsp reconcile"
496
+ },
497
+ "ERR-10": {
498
+ cause: "recorded-plan path cannot execute a removal",
499
+ withheldAuthority: "recorded-plan removal execution",
500
+ resolvingCommand: "dbsp apply"
501
+ },
502
+ "ERR-11": {
503
+ cause: "recovery proved the interrupted operation had no effect",
504
+ withheldAuthority: "recovery execution authority",
505
+ resolvingCommand: "dbsp reconcile"
506
+ }
507
+ };
508
+ function refusalFor(code, input) {
509
+ void input.address;
510
+ return { code, ...REFUSAL_VOCABULARY[code], state: input.state };
511
+ }
512
+
513
+ // src/transition/resource.ts
514
+ function sameControllerIdentity(recorded, current) {
515
+ return recorded.name === current.name && recorded.oid === current.oid;
516
+ }
517
+
370
518
  export {
371
519
  convertBigintJsReadValue,
372
520
  toColumnList,
@@ -424,6 +572,15 @@ export {
424
572
  resolveJsonAggOrderKey,
425
573
  isValidSchema,
426
574
  resolveOutputReadHandling,
427
- buildRelationKeyFields
575
+ buildRelationKeyFields,
576
+ EXECUTION_CONTRACT_VERSION,
577
+ LEDGER_EVENT_KINDS,
578
+ canonicalResourceParent,
579
+ sameLedgerAddress,
580
+ ledgerAddressKey,
581
+ ledgerAddressParentJson,
582
+ REFUSAL_VOCABULARY,
583
+ refusalFor,
584
+ sameControllerIdentity
428
585
  };
429
- //# sourceMappingURL=chunk-4NBXLMCE.js.map
586
+ //# sourceMappingURL=chunk-CKQRFBMA.js.map