@dbsp/core 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.
- package/dist/chunk-AQN7HBYD.js +1740 -0
- package/dist/chunk-AQN7HBYD.js.map +1 -0
- package/dist/index.d.ts +532 -94
- package/dist/index.js +3374 -1708
- package/dist/index.js.map +1 -1
- package/dist/internal-CNjWzMNe.d.ts +177 -0
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +99 -0
- package/dist/internal.js.map +1 -0
- package/package.json +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _dbsp_types from '@dbsp/types';
|
|
2
|
-
import { PseudoColumnMetadata, RecursiveMetadata, RelationIR, RelationKind, AdapterCapabilities, Adapter, BaseAdapter, DDLGeneratingAdapter, ExecutingAdapter, IntrospectingAdapter, RawSqlAdapter, StreamingAdapter, TransactionalAdapter, ColumnType, ColumnJsReadType as ColumnJsReadType$1, WhereIntent, OnDeleteAction, ModelIR, DbCasing, QueryIntent, PlanOptions, PlanReport, RecursiveIntent, RecursivePlanOptions, RecursivePlanReport, ObservationContext, TransitionSessionClient, IssuedObservation, RecoveryArtefact, FingerprintManifest, OperationSemantics, OperationKindRef, PhysicalOperation, EvidenceObservation, DurableIntentRecord, OperationEffectAssessment, ObservationIssuer, ApplyGuard, OperationExecutionOutcome, TransactionalCompletionRecord, StepJournal, TransitionRule, EquivalenceCapability, CapabilityDescriptor, TransitionCompositionFact, RuleRef, SemanticArtifactRef, CheckConstraintIR, Comparator, EnumIR, ObservationRequest, EvidenceView, AdvisoryObservationId, AssumptionId, ClaimId, EvidenceId, SemanticArtifactId, IndexIR,
|
|
3
|
-
export { Adapter, AdapterCapabilities, AdapterLogger, AdapterStreamOptions, AdjacencyTraversal, AggregateExpressionIntent, AggregateFunction, AggregateIntent, AggregateWindowFunction, AliasIncludedColumnsMode, AlterColumnOptions, AmbiguityCheckResult, ApplicableAssessment, ApplicableEvaluation, ApplyPolicy, ArrayOperator, Assumption, BaseAdapter, CTEDefinition, CapabilityDescriptor, Cardinality, CaseExpressionIntent, CoalesceExpressionIntent, ColumnAliasIntent, ColumnExpressionIntent, ColumnIR, ColumnJsReadType, ColumnType, CommonColumnType, Comparator, CompareOutcome, ComparisonExpressionIntent, ComparisonOperator, CompileOnlyAdapter, CompileOptions, CompileResultWithIncludes, CompiledQuery, CompilingAdapter, CreateIndexOptions, CustomTraversal, DDLGeneratingAdapter, DbCasing, DecisionType, DeleteIntent, DialectCapabilities, DialectName, DropIndexOptions, DuckDBColumnType, Dump, DumpMeta, DurableIntentRecord, EdgeTableTraversal, EmitJoinClause, ExecutingAdapter, ExpressionIntent, FilterStrategy, FingerprintManifest, ForeignKeyIR, InapplicableAssessment, IncludeIntent, IncludeStrategy, IndexColumnDef, IndexIR, IndexInfo, IndexMethod, InsertFromIntent, InsertIntent, IntrospectingAdapter, IsTypeSupported, JoinDefault, JoinIntent, LiteralExpressionIntent, LogicalIdentity, LogicalIdentityCarrier, LogicalOperator, MSSQLColumnType, ModelIR, MutationIntent, MySQLColumnType, NullOperator, NullsPosition, ObservationContext, ObservationIssuer, ObservationRequest, OffsetWindowFunction, OnDeleteAction, OperationEffectAssessment, OperationSemantics, Optionality, OrderByIntent, PartitionIR, PhysicalOperation, PlanDecision, PlanOptions, PlanReport, PlanWarning, PlanWarningCode, PostgresColumnType, PostgresOnlyColumnType, ProvenApplyGuard, ProvenGuardProtocol, ProvenPlanShape, ProvenPlanStep, PseudoColumnExpressionIntent, PseudoColumnMetadata, PseudoColumnTraversal, QueryIntent, RangeOperator, RangeValue, RankingWindowFunction, RawExpressionIntent, RawSqlAdapter, RecognitionResult, RecursiveAdvancedOptions, RecursiveDedupe, RecursiveDirection, RecursiveEmitOptions, RecursiveExistsOptions, RecursiveIntent, RecursiveMetadata, RecursiveNodeIdExpr, RecursivePlanOptions, RecursivePlanReport, RecursiveTrackOptions, RecursiveTraversal, RelationColumnIntent, RelationIR, RelationKind, RelationOperator, RelationType, RequiredEnumLabelIR, ResolvedIncludeStrategy, ResourceAddress, RuleEvaluation, RuleSupport, SQLiteColumnType, SelectAggregateIntent, SelectAllIntent, SelectFieldsIntent, SelectIntent, SelectWithExpressionsIntent, SerializedProvenPlan, SortDirection, StepJournal, StreamingAdapter, StringOperator, SubqueryIncludeInfo, SubqueryRefIntent, SupportedColumnTypes, TableIR, TransactionOptions, TransactionalAdapter, TransactionalCompletionRecord, TransitionCandidate, TransitionLessor, TransitionQueryClient, TransitionRule, TransitionRunMetadata, TransitionSessionClient, TruncateOptions, UpdateIntent, UpsertConflictAction, UpsertConflictTarget, UpsertFromIntent, UpsertIntent, VacuumOptions, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereExistsIntent, WhereInIntent, WhereIntent, WhereLikeIntent, WhereNotExistsIntent, WhereNotIntent, WhereNullIntent, WhereOrIntent, WhereRangeIntent, WhereRelationFilterIntent, WhereSubqueryIntent, WindowFunction, WindowIntent, WindowOrderBy, getNodeIdAlias, isAdjacencyTraversal, isAggregateWindowFunction, isCoalesceExpression, isColumnAliasExpression, isCustomTraversal, isDeleteIntent, isEdgeTableTraversal, isInsertIntent, isMutationIntent, isRankingWindowFunction, isRawExpression, isRecursiveIntent, isRelationColumnExpression, isSelectAggregate, isSelectAll, isSelectFields, isSelectWithExpressions, isSubqueryRef, isUpdateIntent, isUpsertIntent, isWhereAnd, isWhereAny, isWhereComparison, isWhereExists, isWhereIn, isWhereLike, isWhereLogical, isWhereNot, isWhereNotExists, isWhereNull, isWhereOr, isWhereRange, isWhereRelationBased, isWhereRelationFilter, isWhereSubquery, isWindowIntent } from '@dbsp/types';
|
|
2
|
+
import { PseudoColumnMetadata, RecursiveMetadata, RelationIR, RelationKind, AdapterCapabilities, Adapter, BaseAdapter, DDLGeneratingAdapter, ExecutingAdapter, IntrospectingAdapter, RawSqlAdapter, StreamingAdapter, TransactionalAdapter, ColumnType, ColumnJsReadType as ColumnJsReadType$1, WhereIntent, OnDeleteAction, TableReaddressDeclaration, ModelIR, DbCasing, QueryIntent, PlanOptions, PlanReport, RecursiveIntent, RecursivePlanOptions, RecursivePlanReport, ObservationContext, TransitionSessionClient, TransitionRunMetadata, IssuedObservation, RecoveryArtefact, ManagedStepClaimMaterial, LedgerPayload, FingerprintManifest, OperationSemantics, OperationKindRef, PhysicalOperation, EvidenceObservation, DurableIntentRecord, OperationEffectAssessment, ObservationIssuer, ApplyGuard, OperationExecutionOutcome, TransactionalCompletionRecord, StepJournal, TransitionRule, EquivalenceCapability, CapabilityDescriptor, TransitionCompositionFact, RuleRef, SemanticArtifactRef, TransitionRunJournal, ProvenPlanShape, ApplyPolicy, CheckConstraintIR, Comparator, ResourceAddress, JsonValue as JsonValue$1, DeclarationSet, EnumIR, ObservationRequest, EvidenceView, ProofObligation, ExecutionContract, ExecutionRequirement, AdvisoryObservationId, AssumptionId, ClaimId, EvidenceId, SemanticArtifactId, IndexIR, LedgerClaimKind, LedgerLifecycleGrammarColumn, LedgerHome, LedgerAddress, LedgerChainMember, LedgerStableState, LedgerOpenClaim, LedgerChainProjection, Assumption, ResourceSelector, TransitionLessor, ApplyResult, TransitionCandidate, TransitionFragmentComposition, PlanAssessment, CompareOutcome, TransitionFragment, ProofClaim, NormalizedManagedStep, ApplicableAssessment, ExclusiveTransitionTarget, DurableApplyOutcome, InapplicableAssessment, TableIR, SequenceIR, AmbiguityCheckResult, DialectCapabilities, DDLFeature, DDLFeatureVersionRange, SelectIntent, IncludeIntent, AggregateIntent, OrderByIntent, SortDirection, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, TransactionBeginOptions, Dump, SetOperationIntent, LockStrength, LockWaitPolicy, DumpMeta, JoinIntent, UnnestCteIntent, CteQueryIntent, CompileOptions, CompiledQuery, MutationIntent as MutationIntent$1, DumpSequenceStep, UpsertConflictTarget, UpsertConflictAction, RawCteIntent, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, IndexInfo, TransactionOptions, PinnedConnectionOptions, ExpressionIntent, ComparisonOperator, WhereSubqueryIntent, SubqueryRefIntent, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereRelationFilterIntent, RecursiveExistsOptions, WhereExistsIntent, WhereInIntent, WhereNullIntent, WhereLikeIntent, WhereNotIntent, WhereNotExistsIntent, WhereOrIntent, WhereRawExistsIntent, WhereRawNotExistsIntent, WhereExpressionIntent, StandaloneWhereExpressionIntent, AggOrderByArg, PredicateOperator, RelationType as RelationType$1, Cardinality, FeatureWarning, UnsupportedFeatureBehavior, FeatureBehaviorConfig, RangeValue, WhereRangeIntent, RangeOperand, SubqueryIncludeInfo } from '@dbsp/types';
|
|
3
|
+
export { Adapter, AdapterCapabilities, AdapterLogger, AdapterStreamOptions, AdjacencyTraversal, AggregateExpressionIntent, AggregateFunction, AggregateIntent, AggregateWindowFunction, AliasIncludedColumnsMode, AlterColumnOptions, AmbiguityCheckResult, ApplicableAssessment, ApplicableEvaluation, ApplyPolicy, ArrayOperator, Assumption, BaseAdapter, CTEDefinition, CapabilityDescriptor, Cardinality, CaseExpressionIntent, CoalesceExpressionIntent, ColumnAliasIntent, ColumnExpressionIntent, ColumnIR, ColumnJsReadType, ColumnType, CommonColumnType, Comparator, CompareOutcome, ComparisonExpressionIntent, ComparisonOperator, CompileOnlyAdapter, CompileOptions, CompileResultWithIncludes, CompiledQuery, CompilingAdapter, ConnectionAvailability, CreateIndexOptions, CustomTraversal, DDLGeneratingAdapter, DbCasing, DecisionType, DeleteIntent, DialectCapabilities, DialectName, DropIndexOptions, DuckDBColumnType, Dump, DumpMeta, DurableIntentRecord, EdgeTableTraversal, EmitJoinClause, ExclusiveTransitionTarget, ExecutingAdapter, ExpressionIntent, FilterStrategy, FingerprintManifest, ForeignKeyIR, InapplicableAssessment, IncludeIntent, IncludeStrategy, IndexColumnDef, IndexIR, IndexInfo, IndexMethod, InsertFromIntent, InsertIntent, IntrospectingAdapter, IsTypeSupported, JoinDefault, JoinIntent, LiteralExpressionIntent, LogicalIdentity, LogicalIdentityCarrier, LogicalOperator, MSSQLColumnType, ModelIR, MutationIntent, MySQLColumnType, NullOperator, NullsPosition, ObservationContext, ObservationIssuer, ObservationRequest, OffsetWindowFunction, OnDeleteAction, OperationEffectAssessment, OperationSemantics, Optionality, OrderByIntent, PartitionIR, PhysicalOperation, PlanDecision, PlanOptions, PlanReport, PlanWarning, PlanWarningCode, PostgresColumnType, PostgresOnlyColumnType, PredicateOperator, ProvenApplyGuard, ProvenGuardProtocol, ProvenPlanShape, ProvenPlanStep, PseudoColumnExpressionIntent, PseudoColumnMetadata, PseudoColumnTraversal, QueryIntent, RangeOperator, RangeValue, RankingWindowFunction, RawExpressionIntent, RawSqlAdapter, RecognitionResult, RecursiveAdvancedOptions, RecursiveDedupe, RecursiveDirection, RecursiveEmitOptions, RecursiveExistsOptions, RecursiveIntent, RecursiveMetadata, RecursiveNodeIdExpr, RecursivePlanOptions, RecursivePlanReport, RecursiveTrackOptions, RecursiveTraversal, RelationColumnIntent, RelationIR, RelationKind, RelationOperator, RelationType, RequiredEnumLabelIR, ResolvedIncludeStrategy, ResourceAddress, RuleEvaluation, RuleSupport, SQLiteColumnType, SelectAggregateIntent, SelectAllIntent, SelectFieldsIntent, SelectIntent, SelectWithExpressionsIntent, SerializedProvenPlan, SortDirection, StepJournal, StreamingAdapter, StringOperator, SubqueryIncludeInfo, SubqueryRefIntent, SupportedColumnTypes, TableIR, TableReaddressAddress, TableReaddressDeclaration, TransactionOptions, TransactionalAdapter, TransactionalCompletionRecord, TransitionCandidate, TransitionLessor, TransitionQueryClient, TransitionRule, TransitionRunMetadata, TransitionSessionClient, TruncateOptions, UpdateIntent, UpsertConflictAction, UpsertConflictTarget, UpsertFromIntent, UpsertIntent, VacuumOptions, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereExistsIntent, WhereInIntent, WhereIntent, WhereLikeIntent, WhereNotExistsIntent, WhereNotIntent, WhereNullIntent, WhereOrIntent, WhereRangeIntent, WhereRelationFilterIntent, WhereSubqueryIntent, WindowFunction, WindowIntent, WindowOrderBy, getNodeIdAlias, isAdjacencyTraversal, isAggregateWindowFunction, isCoalesceExpression, isColumnAliasExpression, isCustomTraversal, isDeleteIntent, isEdgeTableTraversal, isInsertIntent, isMutationIntent, isRankingWindowFunction, isRawExpression, isRecursiveIntent, isRelationColumnExpression, isSelectAggregate, isSelectAll, isSelectFields, isSelectWithExpressions, isSubqueryRef, isUpdateIntent, isUpsertIntent, isWhereAnd, isWhereAny, isWhereComparison, isWhereExists, isWhereIn, isWhereLike, isWhereLogical, isWhereNot, isWhereNotExists, isWhereNull, isWhereOr, isWhereRange, isWhereRelationBased, isWhereRelationFilter, isWhereSubquery, isWindowIntent } from '@dbsp/types';
|
|
4
|
+
import { D as DurablyLoadedRun, T as TransitionReadTarget } from './internal-CNjWzMNe.js';
|
|
5
|
+
export { A as AdmittedDestructiveOutcomeClaim, a as TRANSITION_LESSOR_REJECTION, b as TransitionLeaseFailure, c as acquireExclusiveTransitionLease, d as acquireTransitionLease, e as acquireTransitionTargetLease, f as classifyOutcomeRecovery, g as createExclusiveTransitionTarget, h as createTransitionLessor, i as findUniqueLedgerTerminal, j as isExclusiveTransitionTarget, k as isTransitionLessor, o as outcomeClaimEventId, l as outcomeClaimId, p as planOperationSession } from './internal-CNjWzMNe.js';
|
|
4
6
|
import { NqlCompilerOptions } from '@dbsp/nql';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -51,6 +53,13 @@ declare function createRecursiveMetadata(direction: 'up' | 'down', throughRelati
|
|
|
51
53
|
* Check if adapter supports execution.
|
|
52
54
|
*/
|
|
53
55
|
declare function supportsExecution(adapter: BaseAdapter): adapter is ExecutingAdapter;
|
|
56
|
+
/**
|
|
57
|
+
* Refuse execution for adapters that explicitly report no connection.
|
|
58
|
+
*
|
|
59
|
+
* The availability declaration is optional so existing third-party adapters
|
|
60
|
+
* continue through the established capability checks unchanged.
|
|
61
|
+
*/
|
|
62
|
+
declare function assertConnectionAvailable(adapter: BaseAdapter, operation: string): void;
|
|
54
63
|
/**
|
|
55
64
|
* Check if adapter supports streaming.
|
|
56
65
|
*/
|
|
@@ -480,7 +489,7 @@ type InferColumnTypes<TColumns extends Record<string, ColumnRef<string, string,
|
|
|
480
489
|
* // { id: number; name: string; email: string }
|
|
481
490
|
* ```
|
|
482
491
|
*/
|
|
483
|
-
type InferTableRow<T> = T extends TableRef<
|
|
492
|
+
type InferTableRow<T> = T extends TableRef<infer _TName, infer TColumns> ? InferColumnTypes<TColumns> : never;
|
|
484
493
|
/**
|
|
485
494
|
* Type guard to check if a value is a TableRef.
|
|
486
495
|
*
|
|
@@ -920,6 +929,12 @@ interface SchemaTableOptions {
|
|
|
920
929
|
}>;
|
|
921
930
|
/** Composite foreign keys for this table (use ref() with columns/references) */
|
|
922
931
|
foreignKeys?: RefDefinition[];
|
|
932
|
+
/** Explicit rename or schema move for this desired table. */
|
|
933
|
+
readdress?: TableReaddressDeclaration;
|
|
934
|
+
/** Explicitly bring this existing table under managed state. */
|
|
935
|
+
adopt?: true;
|
|
936
|
+
/** Request a reviewed retire-and-create replacement of this table. */
|
|
937
|
+
replace?: true;
|
|
923
938
|
}
|
|
924
939
|
/**
|
|
925
940
|
* Per-table constraint options, keyed by table name.
|
|
@@ -933,10 +948,10 @@ interface SchemaExtras {
|
|
|
933
948
|
extensions?: string[];
|
|
934
949
|
/** Sequences to create (CREATE SEQUENCE). Key = sequence name */
|
|
935
950
|
sequences?: Record<string, {
|
|
936
|
-
startWith?: number;
|
|
937
|
-
incrementBy?: number;
|
|
938
|
-
minValue?: number;
|
|
939
|
-
maxValue?: number;
|
|
951
|
+
startWith?: number | string;
|
|
952
|
+
incrementBy?: number | string;
|
|
953
|
+
minValue?: number | string;
|
|
954
|
+
maxValue?: number | string;
|
|
940
955
|
cycle?: boolean;
|
|
941
956
|
}>;
|
|
942
957
|
}
|
|
@@ -1012,6 +1027,10 @@ interface Schema<T extends SchemaDefinition> {
|
|
|
1012
1027
|
readonly definition: T;
|
|
1013
1028
|
/** Table-level constraints supplied to schema() or reconstructed from introspection */
|
|
1014
1029
|
readonly constraints?: SchemaConstraints;
|
|
1030
|
+
/** Schema-wide objects supplied to schema(); retained for durable declarations. */
|
|
1031
|
+
readonly extras?: SchemaExtras;
|
|
1032
|
+
/** Planning inputs supplied to schema(); retained without changing model semantics. */
|
|
1033
|
+
readonly options?: SchemaOptions;
|
|
1015
1034
|
/** Converted ModelIR for use with ORM */
|
|
1016
1035
|
readonly model: ModelIR;
|
|
1017
1036
|
/** Table names */
|
|
@@ -1410,7 +1429,33 @@ interface OperationFingerprints {
|
|
|
1410
1429
|
}
|
|
1411
1430
|
interface RegisteredOperationSemantics extends OperationSemantics {
|
|
1412
1431
|
readonly operationKind?: OperationKindRef;
|
|
1432
|
+
/**
|
|
1433
|
+
* Execution-contract-aware packs declare whether reviewed requirements can be
|
|
1434
|
+
* derived for this operation. Contract-construction consumers may use the
|
|
1435
|
+
* declaration; proving remains available to callers that do not require a
|
|
1436
|
+
* contract.
|
|
1437
|
+
*/
|
|
1438
|
+
readonly executionContractEligibility?: {
|
|
1439
|
+
readonly eligible: true;
|
|
1440
|
+
} | {
|
|
1441
|
+
readonly eligible: false;
|
|
1442
|
+
readonly detail: string;
|
|
1443
|
+
};
|
|
1444
|
+
/**
|
|
1445
|
+
* Session settings that this operation's SQL renderer requires. Execution
|
|
1446
|
+
* contract construction reads these from the resolved operation runtime, so
|
|
1447
|
+
* the durable contract cannot drift from renderer prerequisites.
|
|
1448
|
+
*/
|
|
1449
|
+
readonly rendererSessionRequirements?: readonly {
|
|
1450
|
+
readonly setting: 'standard_conforming_strings';
|
|
1451
|
+
readonly value: 'on';
|
|
1452
|
+
}[];
|
|
1413
1453
|
supportsOperation?(operation: PhysicalOperation): boolean;
|
|
1454
|
+
/**
|
|
1455
|
+
* Optional non-executable SQL view for a proven operation. Packs opt in per
|
|
1456
|
+
* operation; consumers must refuse to render operations without this view.
|
|
1457
|
+
*/
|
|
1458
|
+
renderPlanSql?(operation: PhysicalOperation, context: ObservationContext): string;
|
|
1414
1459
|
buildFingerprints(operation: PhysicalOperation, evidence: readonly EvidenceObservation[], context: ObservationContext): OperationFingerprints;
|
|
1415
1460
|
}
|
|
1416
1461
|
interface OperationObservation {
|
|
@@ -1440,12 +1485,47 @@ interface GuardExecutionResult {
|
|
|
1440
1485
|
}
|
|
1441
1486
|
interface TransitionExecutionClient {
|
|
1442
1487
|
readonly opaqueClient: TransitionSessionClient;
|
|
1488
|
+
/** Mark the checked-out client unsafe to return to its pool. */
|
|
1489
|
+
markClientCompromised(): void;
|
|
1443
1490
|
}
|
|
1444
1491
|
interface NonRollbackableExecutionTracker {
|
|
1445
1492
|
markNonRollbackableOperationExecuted(): void;
|
|
1446
1493
|
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Adapter boundary for a plan-carried managed statement bundle. Core owns the
|
|
1496
|
+
* immutable material and the run link; the adapter owns claim admission,
|
|
1497
|
+
* token-gated SQL, and the INV-07 transaction composition.
|
|
1498
|
+
*/
|
|
1499
|
+
interface ManagedOutcomeExecutionRequest {
|
|
1500
|
+
readonly claim: ManagedStepClaimMaterial;
|
|
1501
|
+
readonly run: TransitionRunMetadata;
|
|
1502
|
+
/** Core-minted proof that this run crossed a verified execution boundary. */
|
|
1503
|
+
readonly durablyLoadedRun: DurablyLoadedRun;
|
|
1504
|
+
/** Minted once by apply(), never reused when a recorded run is applied again. */
|
|
1505
|
+
readonly executionId: string;
|
|
1506
|
+
readonly transactional: boolean;
|
|
1507
|
+
readonly lockTimeoutMs: number;
|
|
1508
|
+
/** The operation's own live postcondition observation, never a generic identity probe. */
|
|
1509
|
+
readBack(): Promise<LedgerPayload>;
|
|
1510
|
+
}
|
|
1511
|
+
/** The plan and session facts an adapter may inspect before the step intent. */
|
|
1512
|
+
type ManagedOutcomePreflightRequest = Pick<ManagedOutcomeExecutionRequest, 'claim' | 'run' | 'transactional' | 'lockTimeoutMs'>;
|
|
1447
1513
|
interface ExecutionCoordinator {
|
|
1448
1514
|
readonly transactionDomain: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* When supplied, core calls this after `begin` and before application locks
|
|
1517
|
+
* for transactional segments. It may reserve the durable run journal on the
|
|
1518
|
+
* same session so later intent writes keep journal-then-application lock
|
|
1519
|
+
* order. Generic runtimes without an operation/journal reservation protocol
|
|
1520
|
+
* leave this absent; in particular a non-transactional segment cannot retain
|
|
1521
|
+
* a transaction-scoped journal row lock across application locking.
|
|
1522
|
+
*
|
|
1523
|
+
* Before an intent exists, core can invoke `begin`, `setLockTimeout`, this
|
|
1524
|
+
* optional reservation, `rollback`, and `isLockTimeout`. They must
|
|
1525
|
+
* not perform operation DDL or any external effect. `executeOperation` is
|
|
1526
|
+
* the first callback allowed to do so.
|
|
1527
|
+
*/
|
|
1528
|
+
reserveJournalRun?(client: TransitionExecutionClient, run: TransitionRunMetadata): Promise<void>;
|
|
1449
1529
|
begin(client: TransitionExecutionClient): Promise<void>;
|
|
1450
1530
|
setLockTimeout(client: TransitionExecutionClient, maxWaitMs: number): Promise<void>;
|
|
1451
1531
|
commit(client: TransitionExecutionClient): Promise<void>;
|
|
@@ -1457,6 +1537,19 @@ interface TransactionCoordinatorBinding {
|
|
|
1457
1537
|
readonly transactionDomain: string;
|
|
1458
1538
|
}
|
|
1459
1539
|
interface OperationRuntime extends RegisteredOperationSemantics {
|
|
1540
|
+
/**
|
|
1541
|
+
* Before `writeIntentJournal`, core can invoke `effectsOf`, `begin`,
|
|
1542
|
+
* `setLockTimeout`, optional `reserveJournalRun`, `acquireLocks`,
|
|
1543
|
+
* `observeContext`,
|
|
1544
|
+
* `observeOperation`, `buildFingerprints`, `rollback`, and `isLockTimeout`.
|
|
1545
|
+
* All must perform no operation DDL or external effect. The only
|
|
1546
|
+
* pre-intent diagnostic exception is `writeObservedJournal` after a
|
|
1547
|
+
* fingerprint-construction failure: it may append that immutable failure
|
|
1548
|
+
* event, but may not perform operation DDL or an external effect. This lets a
|
|
1549
|
+
* refusal before the intent leave the run pristine; `executeOperation` is the
|
|
1550
|
+
* first callback allowed to perform the operation's DDL or external effect.
|
|
1551
|
+
*/
|
|
1552
|
+
reserveJournalRun?(client: TransitionExecutionClient, run: TransitionRunMetadata): Promise<void>;
|
|
1460
1553
|
writeIntentJournal(client: TransitionExecutionClient, record: DurableIntentRecord): Promise<void>;
|
|
1461
1554
|
begin(client: TransitionExecutionClient): Promise<void>;
|
|
1462
1555
|
setLockTimeout(client: TransitionExecutionClient, maxWaitMs: number): Promise<void>;
|
|
@@ -1465,6 +1558,17 @@ interface OperationRuntime extends RegisteredOperationSemantics {
|
|
|
1465
1558
|
observeOperation(client: TransitionExecutionClient, operation: PhysicalOperation, context: ObservationContext, phase: 'before' | 'after', issuer: ObservationIssuer): Promise<OperationObservation>;
|
|
1466
1559
|
checkGuard(client: TransitionExecutionClient, operation: PhysicalOperation, guard: ApplyGuard, context: ObservationContext): Promise<GuardExecutionResult>;
|
|
1467
1560
|
executeOperation(client: TransitionExecutionClient, operation: PhysicalOperation, context: ObservationContext, duringGuards?: readonly ApplyGuard[], executionTracker?: NonRollbackableExecutionTracker): Promise<OperationExecutionOutcome>;
|
|
1561
|
+
/**
|
|
1562
|
+
* Required when a plan step carries managed claim material. The applier
|
|
1563
|
+
* never falls back to `executeOperation` for such a step.
|
|
1564
|
+
*/
|
|
1565
|
+
executeManagedOutcome?(client: TransitionExecutionClient, request: ManagedOutcomeExecutionRequest): Promise<OperationExecutionOutcome>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Refuses a managed outcome before its durable step intent is recorded.
|
|
1568
|
+
* This boundary is for adapter-owned prerequisites such as an incompatible
|
|
1569
|
+
* ledger marker; it must not execute DDL or append ledger members.
|
|
1570
|
+
*/
|
|
1571
|
+
preflightManagedOutcome?(client: TransitionExecutionClient, request: ManagedOutcomePreflightRequest): Promise<string | undefined>;
|
|
1468
1572
|
writeCompletionJournal(client: TransitionExecutionClient, operation: PhysicalOperation, record: TransactionalCompletionRecord): Promise<void>;
|
|
1469
1573
|
commit(client: TransitionExecutionClient): Promise<void>;
|
|
1470
1574
|
rollback(client: TransitionExecutionClient): Promise<void>;
|
|
@@ -1530,7 +1634,47 @@ declare class PackRegistry {
|
|
|
1530
1634
|
}
|
|
1531
1635
|
declare function createPackRegistry(packs: readonly TransitionPack[]): PackRegistry;
|
|
1532
1636
|
|
|
1533
|
-
|
|
1637
|
+
interface ResumeTransitionInput {
|
|
1638
|
+
readonly journal: VerifiedRecoveryJournal;
|
|
1639
|
+
readonly readContext: (target: TransitionReadTarget, run: TransitionRunJournal['run']) => Promise<ObservationContext>;
|
|
1640
|
+
readonly policy?: ApplyPolicy;
|
|
1641
|
+
readonly target: TransitionReadTarget;
|
|
1642
|
+
readonly admitRecovery?: TransitionRecoveryAdmission;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* A frozen journal whose run identity, durable digest, external review digest,
|
|
1646
|
+
* and plan structure were verified together. The WeakSet is the runtime brand:
|
|
1647
|
+
* callers may cast a lookalike, but recovery will not accept it.
|
|
1648
|
+
*/
|
|
1649
|
+
type VerifiedRecoveryJournal = TransitionRunJournal & {
|
|
1650
|
+
readonly plan: ProvenPlanShape;
|
|
1651
|
+
};
|
|
1652
|
+
type RecoveryJournalLoadResult = {
|
|
1653
|
+
readonly ok: true;
|
|
1654
|
+
readonly journal: VerifiedRecoveryJournal;
|
|
1655
|
+
} | {
|
|
1656
|
+
readonly ok: false;
|
|
1657
|
+
readonly code: 'load-failed' | 'run-id-mismatch' | 'plan-digest-mismatch' | 'plan-invalid' | 'event-invalid';
|
|
1658
|
+
readonly detail: string;
|
|
1659
|
+
};
|
|
1660
|
+
/** Load exactly once, snapshot and freeze the complete durable evidence set. */
|
|
1661
|
+
declare function loadVerifiedRecoveryJournal(runId: string, expectedPlanDigest: string, loadCurrent: (runId: string) => Promise<TransitionRunJournal & {
|
|
1662
|
+
readonly plan: ProvenPlanShape;
|
|
1663
|
+
}>): Promise<RecoveryJournalLoadResult>;
|
|
1664
|
+
|
|
1665
|
+
declare function createApplier(registry: PackRegistry, persister: TransitionRunPersister): Applier;
|
|
1666
|
+
|
|
1667
|
+
/** Raised when a value cannot cross the durable JSON payload boundary. */
|
|
1668
|
+
declare class CanonicalJsonError extends TypeError {
|
|
1669
|
+
constructor(path: string, detail: string, options?: ErrorOptions);
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Encodes a JSON value with lexically sorted object keys and preserved array
|
|
1673
|
+
* order. Unlike JSON.stringify, this refuses values it would omit or coerce.
|
|
1674
|
+
*/
|
|
1675
|
+
declare function canonicalJson(value: unknown): string;
|
|
1676
|
+
/** Hashes the canonical durable representation of a JSON payload. */
|
|
1677
|
+
declare function canonicalJsonDigest(value: unknown): string;
|
|
1534
1678
|
|
|
1535
1679
|
type CheckSetEntry = Pick<CheckConstraintIR, 'name' | 'expression' | 'notValid'>;
|
|
1536
1680
|
type CheckDelta = {
|
|
@@ -1553,6 +1697,45 @@ declare function checkDelta(desiredChecks: readonly CheckConstraintIR[] | undefi
|
|
|
1553
1697
|
|
|
1554
1698
|
declare function createComparator(registry: PackRegistry): Comparator;
|
|
1555
1699
|
|
|
1700
|
+
declare function observationContextDigest(context: ObservationContext): string;
|
|
1701
|
+
|
|
1702
|
+
interface DeclarationAddressContext {
|
|
1703
|
+
readonly engine: string;
|
|
1704
|
+
readonly database: string;
|
|
1705
|
+
readonly schema: string;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* The declaration layer deliberately depends on this small structural naming
|
|
1709
|
+
* boundary rather than an adapter package. Callers pass the same strategy that
|
|
1710
|
+
* comparison and proof use for the target database.
|
|
1711
|
+
*/
|
|
1712
|
+
interface DeclarationNamingStrategy {
|
|
1713
|
+
toDatabase(identifier: string): string;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Reject every JavaScript value whose JSON representation is lossy or
|
|
1717
|
+
* host-dependent. JSON.stringify alone is unsuitable because it silently drops
|
|
1718
|
+
* functions and undefined object members, exactly the ColumnDef.default case.
|
|
1719
|
+
*/
|
|
1720
|
+
declare function assertCanonicalizableJson(value: unknown, path?: string, seen?: WeakSet<object>): asserts value is JsonValue$1;
|
|
1721
|
+
/**
|
|
1722
|
+
* Slice only the declarable part of ModelIR. Deliberately absent are
|
|
1723
|
+
* logicalIdentity, pseudoColumns, comment, partition, rlsEnabled and policies;
|
|
1724
|
+
* their omission is encoded here once, rather than re-checked at every caller.
|
|
1725
|
+
*/
|
|
1726
|
+
declare function declarationSetFromModel(model: ModelIR, context: DeclarationAddressContext, naming?: DeclarationNamingStrategy): DeclarationSet;
|
|
1727
|
+
/** Validate the complete declarable surface before comparison can short-circuit plan time. */
|
|
1728
|
+
declare function validateDeclarationModel(model: ModelIR): void;
|
|
1729
|
+
/** Compare only the recorded/live identity and retain the precise mismatch reason. */
|
|
1730
|
+
declare function admitRecordedIdentity(recorded: ResourceAddress, live: ResourceAddress): {
|
|
1731
|
+
readonly ok: true;
|
|
1732
|
+
} | {
|
|
1733
|
+
readonly ok: false;
|
|
1734
|
+
readonly detail: string;
|
|
1735
|
+
};
|
|
1736
|
+
/** Attach the canonical declaration artifact before metadata/digest minting. */
|
|
1737
|
+
declare function bindDeclarationSet(plan: InProcessProvenPlan, declarations: DeclarationSet): InProcessProvenPlan;
|
|
1738
|
+
|
|
1556
1739
|
type EnumAddDelta = {
|
|
1557
1740
|
readonly kind: 'none';
|
|
1558
1741
|
} | {
|
|
@@ -1574,6 +1757,31 @@ declare function createEvidenceView(params: {
|
|
|
1574
1757
|
readonly requests?: readonly ObservationRequest[];
|
|
1575
1758
|
}): EvidenceView;
|
|
1576
1759
|
|
|
1760
|
+
type EvidenceConclusion = 'established' | 'undischarged' | 'refuted' | 'conflicted';
|
|
1761
|
+
type EvidenceEntailmentResult = {
|
|
1762
|
+
readonly conclusion: EvidenceConclusion;
|
|
1763
|
+
readonly supportedBy: readonly EvidenceObservation[];
|
|
1764
|
+
};
|
|
1765
|
+
declare function concludeEvidenceForObligation(params: {
|
|
1766
|
+
readonly obligation: ProofObligation;
|
|
1767
|
+
readonly evidence: readonly EvidenceObservation[];
|
|
1768
|
+
readonly expectedContext?: ObservationContext;
|
|
1769
|
+
}): EvidenceEntailmentResult;
|
|
1770
|
+
|
|
1771
|
+
type ExecutionContractValidation = {
|
|
1772
|
+
readonly ok: true;
|
|
1773
|
+
readonly contract: ExecutionContract;
|
|
1774
|
+
} | {
|
|
1775
|
+
readonly ok: false;
|
|
1776
|
+
readonly detail: string;
|
|
1777
|
+
};
|
|
1778
|
+
/** Construct a fresh versioned contract whose requirements are canonical. */
|
|
1779
|
+
declare function createExecutionContract(requirements: readonly ExecutionRequirement[]): ExecutionContract;
|
|
1780
|
+
/** Fail closed for malformed, future, or non-canonical persisted contracts. */
|
|
1781
|
+
declare function validateExecutionContract(value: unknown): ExecutionContractValidation;
|
|
1782
|
+
/** Attach a planning-time-only contract to a fresh immutable durable plan. */
|
|
1783
|
+
declare function bindExecutionContract(plan: InProcessProvenPlan, contract: ExecutionContract): InProcessProvenPlan;
|
|
1784
|
+
|
|
1577
1785
|
declare function semanticArtifactId(value: string): SemanticArtifactId;
|
|
1578
1786
|
declare function assumptionId(value: string): AssumptionId;
|
|
1579
1787
|
declare function claimId(value: string): ClaimId;
|
|
@@ -1609,11 +1817,59 @@ type IndexPerspective = 'desired' | 'current';
|
|
|
1609
1817
|
declare function normalizedIndex(tableName: string, index: IndexIR, perspective?: IndexPerspective): IndexSetEntry;
|
|
1610
1818
|
declare function indexDelta(tableName: string, desiredIndexes: readonly IndexIR[], currentIndexes: readonly IndexIR[]): IndexDelta;
|
|
1611
1819
|
|
|
1820
|
+
/** Bump whenever the malformed-chain vocabulary or interpretation changes. */
|
|
1821
|
+
declare const LEDGER_PROJECTION_CODE_VERSION: 1;
|
|
1822
|
+
/**
|
|
1823
|
+
* The one closed grammar matrix. Later claim and token producers consume this
|
|
1824
|
+
* interpreter; they do not reconstruct lifecycle state from ledger spellings.
|
|
1825
|
+
*/
|
|
1826
|
+
declare const LEDGER_LIFECYCLE_GRAMMAR: Readonly<Record<LedgerClaimKind, LedgerLifecycleGrammarColumn>>;
|
|
1827
|
+
interface LifecycleFrame {
|
|
1828
|
+
readonly stableState: LedgerStableState;
|
|
1829
|
+
readonly openClaim?: LedgerOpenClaim;
|
|
1830
|
+
}
|
|
1831
|
+
type LifecycleStep = {
|
|
1832
|
+
readonly kind: 'ok';
|
|
1833
|
+
readonly frame: LifecycleFrame;
|
|
1834
|
+
} | {
|
|
1835
|
+
readonly kind: 'invalid';
|
|
1836
|
+
readonly detail: string;
|
|
1837
|
+
};
|
|
1838
|
+
interface LedgerChainProjectionInput {
|
|
1839
|
+
readonly ledger: LedgerHome;
|
|
1840
|
+
readonly address: LedgerAddress;
|
|
1841
|
+
readonly events: readonly LedgerChainMember[];
|
|
1842
|
+
}
|
|
1843
|
+
/** Interprets exactly one terminal-to-next lifecycle edge. */
|
|
1844
|
+
declare function interpretLedgerLifecycle(frame: LifecycleFrame, event: LedgerChainMember): LifecycleStep;
|
|
1845
|
+
/**
|
|
1846
|
+
* Projects a whole address chain without using insertion order. Malformed
|
|
1847
|
+
* chains deliberately return a structured value so mutation callers fail
|
|
1848
|
+
* closed while readers retain the evidence needed to diagnose it.
|
|
1849
|
+
*/
|
|
1850
|
+
declare function projectLedgerChain(input: LedgerChainProjectionInput): LedgerChainProjection;
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* Canonical digest used to bind a durable transition run to its proven plan.
|
|
1854
|
+
*/
|
|
1855
|
+
declare function transitionPlanDigest(plan: ProvenPlanShape): string;
|
|
1856
|
+
|
|
1612
1857
|
declare function createProver(registry: PackRegistry): Prover;
|
|
1613
1858
|
|
|
1614
1859
|
declare function resourceIsWithin(resource: ResourceAddress, parent: ResourceAddress): boolean;
|
|
1615
1860
|
declare function selectorMatchesResource(selector: ResourceSelector, resource: ResourceAddress): boolean;
|
|
1616
1861
|
declare function resourceScopeCovers(scope: readonly ResourceAddress[], required: readonly ResourceAddress[]): boolean;
|
|
1862
|
+
declare function assumptionAccepted(assumption: Assumption, policy: ApplyPolicy): boolean;
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Mint metadata for a proven transition before making it durable.
|
|
1866
|
+
*
|
|
1867
|
+
* The target digest is deliberately derived from the plan's evidence, not a
|
|
1868
|
+
* caller-supplied snapshot. That is the exact context resume verifies.
|
|
1869
|
+
*/
|
|
1870
|
+
declare function createTransitionRunMetadata(plan: InProcessProvenPlan): TransitionRunMetadata;
|
|
1871
|
+
/** Label a generator removal before persistence; it can never become replayable. */
|
|
1872
|
+
declare function markGeneratorRemovalNonReplayable(run: TransitionRunMetadata): TransitionRunMetadata;
|
|
1617
1873
|
|
|
1618
1874
|
interface StagedTransitionInput {
|
|
1619
1875
|
readonly desired: ModelIR;
|
|
@@ -1626,7 +1882,7 @@ interface StagedTransitionInput {
|
|
|
1626
1882
|
interface StagedTransitionOrchestrator {
|
|
1627
1883
|
applyStagedTransition(input: StagedTransitionInput): Promise<ApplyResult>;
|
|
1628
1884
|
}
|
|
1629
|
-
declare function createStagedTransitionOrchestrator(registry: PackRegistry): StagedTransitionOrchestrator;
|
|
1885
|
+
declare function createStagedTransitionOrchestrator(registry: PackRegistry, persister: TransitionRunPersister): StagedTransitionOrchestrator;
|
|
1630
1886
|
|
|
1631
1887
|
type TransitionCompare = Extract<CompareOutcome, {
|
|
1632
1888
|
readonly kind: 'transitions';
|
|
@@ -1657,48 +1913,6 @@ declare function chooseReadyCandidate(preflight: Extract<StagedCompositionPrefli
|
|
|
1657
1913
|
}>): StagedCompositionCandidate;
|
|
1658
1914
|
declare function projectCompareToSingleCandidate(compare: TransitionCompare, entry: StagedCompositionCandidate): TransitionCompare;
|
|
1659
1915
|
|
|
1660
|
-
declare const TRANSITION_LESSOR_REJECTION = "transition target must be a core-minted lessor";
|
|
1661
|
-
/** A core-owned lease: packs receive its session, while core retains release. */
|
|
1662
|
-
type TransitionLease = {
|
|
1663
|
-
readonly session: TransitionSessionClient;
|
|
1664
|
-
readonly release: (failure?: TransitionLeaseFailure) => Promise<void>;
|
|
1665
|
-
};
|
|
1666
|
-
/**
|
|
1667
|
-
* Cross the engine's acquisition boundary.
|
|
1668
|
-
*
|
|
1669
|
-
* A lessor brand is a declaration, not a security boundary, so every
|
|
1670
|
-
* acquisition is checked here even when a caller forged that declaration.
|
|
1671
|
-
*/
|
|
1672
|
-
declare function acquireTransitionLease(target: TransitionLessor): Promise<TransitionLease>;
|
|
1673
|
-
/**
|
|
1674
|
-
* Mint a declared source of transition leases.
|
|
1675
|
-
*
|
|
1676
|
-
* This declares a source of leases; it does not inspect individual
|
|
1677
|
-
* acquisitions. Every acquisition crosses `acquireTransitionLease`, the
|
|
1678
|
-
* runtime boundary that validates and captures it exactly once.
|
|
1679
|
-
*
|
|
1680
|
-
* The wrapper is allocated and frozen by core. Its non-writable,
|
|
1681
|
-
* non-configurable `Symbol.for('dbsp.transition.lessor')` brand carries this
|
|
1682
|
-
* protocol version, so independently installed incompatible core versions do
|
|
1683
|
-
* not accept one another's lessors. The global symbol is intentionally not a
|
|
1684
|
-
* security boundary: code already running in this realm can forge it. This
|
|
1685
|
-
* protects callers from passing the wrong connection object by accident.
|
|
1686
|
-
*/
|
|
1687
|
-
declare function createTransitionLessor(acquire: () => Promise<TransitionQueryClient>): TransitionLessor;
|
|
1688
|
-
/**
|
|
1689
|
-
* Recognize a core-minted transition lessor. The shape check only rejects a
|
|
1690
|
-
* contradictory declaration (a branded object without acquire()); the brand
|
|
1691
|
-
* and protocol version are the declaration.
|
|
1692
|
-
*/
|
|
1693
|
-
declare function isTransitionLessor(value: unknown): value is TransitionLessor;
|
|
1694
|
-
/**
|
|
1695
|
-
* Carries the error that ended a lease's use. Its presence — not the value it
|
|
1696
|
-
* holds — is what says the lease is being returned after a failure.
|
|
1697
|
-
*/
|
|
1698
|
-
type TransitionLeaseFailure = {
|
|
1699
|
-
readonly error: unknown;
|
|
1700
|
-
};
|
|
1701
|
-
|
|
1702
1916
|
type TransitionRelationalValidationInput = {
|
|
1703
1917
|
readonly kind: 'fragment';
|
|
1704
1918
|
readonly fragment: TransitionFragment;
|
|
@@ -1715,6 +1929,25 @@ type TransitionRelationalValidationResult = {
|
|
|
1715
1929
|
readonly ok: false;
|
|
1716
1930
|
readonly detail: string;
|
|
1717
1931
|
};
|
|
1932
|
+
declare const validatedManagedStepManifestBrand: unique symbol;
|
|
1933
|
+
/** A manifest normalized and accepted by the managed lifecycle boundary. */
|
|
1934
|
+
interface ValidatedManagedStepManifest {
|
|
1935
|
+
readonly steps: readonly NormalizedManagedStep[];
|
|
1936
|
+
readonly [validatedManagedStepManifestBrand]: 'dbsp-validated-managed-step-manifest';
|
|
1937
|
+
}
|
|
1938
|
+
type ValidatedManagedStepManifestResult = {
|
|
1939
|
+
readonly ok: true;
|
|
1940
|
+
readonly manifest: ValidatedManagedStepManifest;
|
|
1941
|
+
} | {
|
|
1942
|
+
readonly ok: false;
|
|
1943
|
+
readonly detail: string;
|
|
1944
|
+
};
|
|
1945
|
+
/**
|
|
1946
|
+
* Generic lifecycle invariants for adapter-produced normalized managed steps.
|
|
1947
|
+
* Mapping a concrete DDL kind remains adapter work; core only validates the
|
|
1948
|
+
* durable protocol shape before it becomes digest-covered plan material.
|
|
1949
|
+
*/
|
|
1950
|
+
declare function validateNormalizedManagedStepManifest(steps: readonly NormalizedManagedStep[]): ValidatedManagedStepManifestResult;
|
|
1718
1951
|
/**
|
|
1719
1952
|
* Diagnostic consistency check for transition fragments and already-trusted,
|
|
1720
1953
|
* in-process plans. For plan inputs this is not an untrusted serialized-plan
|
|
@@ -1726,6 +1959,14 @@ declare function validateTransitionRelationalInvariants(input: TransitionRelatio
|
|
|
1726
1959
|
type InProcessProvenPlan = ProvenPlanShape & {
|
|
1727
1960
|
readonly __inProcessProvenPlan: unique symbol;
|
|
1728
1961
|
};
|
|
1962
|
+
/**
|
|
1963
|
+
* Makes a transition run and its proven plan durable before execution begins.
|
|
1964
|
+
* Implementations must persist both rows atomically and accept retries only
|
|
1965
|
+
* when the metadata and plan are identical.
|
|
1966
|
+
*/
|
|
1967
|
+
type TransitionRunPersister = {
|
|
1968
|
+
persist(run: TransitionRunMetadata, plan: ProvenPlanShape): Promise<void>;
|
|
1969
|
+
};
|
|
1729
1970
|
type EstablishedProofClaim = ProofClaim & {
|
|
1730
1971
|
readonly assumes: readonly [];
|
|
1731
1972
|
readonly derivedBy: {
|
|
@@ -1758,12 +1999,65 @@ interface Applier {
|
|
|
1758
1999
|
readonly plan: InProcessProvenPlan;
|
|
1759
2000
|
readonly assessment: ApplicableAssessment;
|
|
1760
2001
|
}, policy: ApplyPolicy, target: TransitionLessor): Promise<ApplyResult>;
|
|
1761
|
-
|
|
2002
|
+
applyDurable(input: DurableApplyInput): Promise<DurableApplyResult>;
|
|
2003
|
+
resume(journal: VerifiedRecoveryJournal, readContext: ResumeTransitionInput['readContext'], policy: ApplyPolicy | undefined, target: TransitionReadTarget, admitRecovery?: TransitionRecoveryAdmission): Promise<ApplyResult>;
|
|
1762
2004
|
}
|
|
2005
|
+
/** Durable-run entry point; it snapshots and verifies serialized evidence. */
|
|
2006
|
+
interface DurableApplyInput {
|
|
2007
|
+
readonly runId: string;
|
|
2008
|
+
/**
|
|
2009
|
+
* Content hash the operator reviewed outside the target database. Durable
|
|
2010
|
+
* apply refuses unless it is the hash of the loaded plan itself.
|
|
2011
|
+
*/
|
|
2012
|
+
readonly expectedPlanDigest: string;
|
|
2013
|
+
readonly loadCurrent: TransitionResumeJournalLoader;
|
|
2014
|
+
readonly policy: ApplyPolicy;
|
|
2015
|
+
readonly target: ExclusiveTransitionTarget;
|
|
2016
|
+
/** Runs on the held execution lease before authorization, a transaction, intent, or DDL. */
|
|
2017
|
+
readonly prepareExecutionSession: (target: TransitionSessionClient, contract: ExecutionContract, plan: ProvenPlanShape) => Promise<{
|
|
2018
|
+
readonly ok: true;
|
|
2019
|
+
readonly context: ObservationContext;
|
|
2020
|
+
} | {
|
|
2021
|
+
readonly ok: false;
|
|
2022
|
+
/** Omitted by legacy adapters; treated as a contract refusal. */
|
|
2023
|
+
readonly kind?: 'refused' | 'failed' | 'read-only';
|
|
2024
|
+
readonly detail: string;
|
|
2025
|
+
}>;
|
|
2026
|
+
/** Called on that same preflight lease, after admission and before any step attempt. */
|
|
2027
|
+
readonly authorize: (run: TransitionRunJournal['run'], plan: ProvenPlanShape, target: TransitionSessionClient) => Promise<void>;
|
|
2028
|
+
}
|
|
2029
|
+
type DurableApplyResult = (ApplyResult & {
|
|
2030
|
+
readonly unresolvedOutcome: {
|
|
2031
|
+
readonly kind: 'recovery-required';
|
|
2032
|
+
readonly claimId: string;
|
|
2033
|
+
readonly detail: string;
|
|
2034
|
+
};
|
|
2035
|
+
readonly durableOutcome: 'recovery-required';
|
|
2036
|
+
}) | (ApplyResult & {
|
|
2037
|
+
readonly unresolvedOutcome: {
|
|
2038
|
+
readonly kind: 'transport-ambiguous';
|
|
2039
|
+
readonly detail: string;
|
|
2040
|
+
};
|
|
2041
|
+
readonly durableOutcome: 'transport-ambiguous';
|
|
2042
|
+
}) | (Omit<ApplyResult, 'unresolvedOutcome' | 'durableOutcome'> & {
|
|
2043
|
+
readonly unresolvedOutcome?: never;
|
|
2044
|
+
readonly durableOutcome: Exclude<DurableApplyOutcome, 'recovery-required' | 'transport-ambiguous'>;
|
|
2045
|
+
});
|
|
1763
2046
|
type TransitionResumeJournalLoader = (runId: string) => Promise<TransitionRunJournal & {
|
|
1764
2047
|
readonly plan: ProvenPlanShape;
|
|
1765
2048
|
}>;
|
|
1766
|
-
|
|
2049
|
+
/**
|
|
2050
|
+
* Recovery admission identifies the physical PostgreSQL target before any
|
|
2051
|
+
* classification journal can be written. It deliberately does not re-check
|
|
2052
|
+
* apply authority or the historic observation-context digest.
|
|
2053
|
+
*/
|
|
2054
|
+
type TransitionRecoveryAdmission = (target: TransitionReadTarget, contract: ExecutionContract) => Promise<{
|
|
2055
|
+
readonly ok: true;
|
|
2056
|
+
readonly context: ObservationContext;
|
|
2057
|
+
} | {
|
|
2058
|
+
readonly ok: false;
|
|
2059
|
+
readonly detail: string;
|
|
2060
|
+
}>;
|
|
1767
2061
|
|
|
1768
2062
|
/**
|
|
1769
2063
|
* @module model-impl
|
|
@@ -2330,7 +2624,7 @@ declare class IntentBuilder<TResult = unknown> {
|
|
|
2330
2624
|
*/
|
|
2331
2625
|
|
|
2332
2626
|
/** Query execution result types for afterQuery generics */
|
|
2333
|
-
type QueryResultType = 'all' | 'first' | '
|
|
2627
|
+
type QueryResultType = 'all' | 'first' | 'exists';
|
|
2334
2628
|
/**
|
|
2335
2629
|
* Context passed to query hooks (beforeQuery/afterQuery).
|
|
2336
2630
|
* Frozen via Object.freeze — hooks must return new objects to modify.
|
|
@@ -2389,11 +2683,16 @@ type ErrorHookContext = {
|
|
|
2389
2683
|
};
|
|
2390
2684
|
/** Hook invoked before query execution. Can modify intent via return. */
|
|
2391
2685
|
type BeforeQueryHook = (ctx: QueryHookContext) => QueryHookContext | Promise<QueryHookContext> | undefined;
|
|
2392
|
-
/**
|
|
2686
|
+
/** Observer invoked after query execution. Its return value is ignored. */
|
|
2687
|
+
type AfterQueryObserver = (ctx: QueryHookContext, result: unknown) => void | Promise<void>;
|
|
2688
|
+
/** Hook invoked after query execution. Can transform results without changing their shape. */
|
|
2393
2689
|
type AfterQueryHook = <R>(ctx: QueryHookContext, result: R) => R | Promise<R> | undefined;
|
|
2394
2690
|
/** Hook invoked before mutation execution. Can modify context via return. */
|
|
2395
2691
|
type BeforeMutationHook = <T>(ctx: MutationHookContext<T>) => MutationHookContext<T> | Promise<MutationHookContext<T>> | undefined;
|
|
2396
|
-
/**
|
|
2692
|
+
/** Observer invoked after mutation execution. Its return value is ignored. */
|
|
2693
|
+
type AfterMutationObserver = (ctx: MutationHookContext, result: unknown) => void | Promise<void>;
|
|
2694
|
+
type ObserverRegistration<T extends (...args: never[]) => unknown, TObserver extends (...args: never[]) => unknown> = ReturnType<T> extends ReturnType<TObserver> ? unknown : never;
|
|
2695
|
+
/** Hook invoked after mutation execution. Can transform RETURNING results without changing their shape. */
|
|
2397
2696
|
type AfterMutationHook = <T>(ctx: MutationHookContext<T>, result: T[]) => T[] | Promise<T[]> | undefined;
|
|
2398
2697
|
/** Hook invoked on query/mutation errors. Can transform the error. */
|
|
2399
2698
|
type OnErrorHook = (ctx: ErrorHookContext) => undefined | Error | Promise<undefined | Error>;
|
|
@@ -2402,11 +2701,21 @@ type OnErrorHook = (ctx: ErrorHookContext) => undefined | Error | Promise<undefi
|
|
|
2402
2701
|
* Returns 'continue' to skip failed hook, 'abort' to propagate error.
|
|
2403
2702
|
*/
|
|
2404
2703
|
type HookErrorHandler = (error: Error, hookName: string, ctx: QueryHookContext | MutationHookContext, phase: string) => 'continue' | 'abort';
|
|
2704
|
+
/**
|
|
2705
|
+
* Diagnostic sink for observer failures and snapshot skips.
|
|
2706
|
+
*
|
|
2707
|
+
* Unlike {@link HookErrorHandler}, this handler has no control-flow return:
|
|
2708
|
+
* observer diagnostics always go to a void sink and can never abort work that
|
|
2709
|
+
* has already executed.
|
|
2710
|
+
*/
|
|
2711
|
+
type ObserverErrorHandler = (error: Error, observerName: string, phase: 'afterQuery' | 'afterMutation') => void | Promise<void>;
|
|
2405
2712
|
/** Immutable builder interface for registering hooks */
|
|
2406
2713
|
interface HookManager {
|
|
2407
2714
|
beforeQuery(hook: BeforeQueryHook): HookManager;
|
|
2715
|
+
observeAfterQuery<T extends AfterQueryObserver>(observer: T & ObserverRegistration<T, AfterQueryObserver>): HookManager;
|
|
2408
2716
|
afterQuery(hook: AfterQueryHook): HookManager;
|
|
2409
2717
|
beforeMutation(hook: BeforeMutationHook): HookManager;
|
|
2718
|
+
observeAfterMutation<T extends AfterMutationObserver>(observer: T & ObserverRegistration<T, AfterMutationObserver>): HookManager;
|
|
2410
2719
|
afterMutation(hook: AfterMutationHook): HookManager;
|
|
2411
2720
|
onError(hook: OnErrorHook): HookManager;
|
|
2412
2721
|
freeze(): HookManager;
|
|
@@ -2414,8 +2723,10 @@ interface HookManager {
|
|
|
2414
2723
|
/** @internal Hook storage — exposed for runner access */
|
|
2415
2724
|
type HookStore = {
|
|
2416
2725
|
readonly beforeQuery: readonly BeforeQueryHook[];
|
|
2726
|
+
readonly afterQueryObservers: readonly AfterQueryObserver[];
|
|
2417
2727
|
readonly afterQuery: readonly AfterQueryHook[];
|
|
2418
2728
|
readonly beforeMutation: readonly BeforeMutationHook[];
|
|
2729
|
+
readonly afterMutationObservers: readonly AfterMutationObserver[];
|
|
2419
2730
|
readonly afterMutation: readonly AfterMutationHook[];
|
|
2420
2731
|
readonly onError: readonly OnErrorHook[];
|
|
2421
2732
|
readonly frozen: boolean;
|
|
@@ -2447,6 +2758,7 @@ interface QueryBuilderContext {
|
|
|
2447
2758
|
readonly defaultFilters?: DefaultFilters | undefined;
|
|
2448
2759
|
readonly hookStore?: HookStore | undefined;
|
|
2449
2760
|
readonly onHookError?: HookErrorHandler | undefined;
|
|
2761
|
+
readonly onObserverError?: ObserverErrorHandler | undefined;
|
|
2450
2762
|
readonly inTransaction?: boolean | undefined;
|
|
2451
2763
|
}
|
|
2452
2764
|
|
|
@@ -3052,7 +3364,7 @@ interface QueryBuilder<TResult = unknown> {
|
|
|
3052
3364
|
* orm.select('users').where({ active: true, role: 'admin' })
|
|
3053
3365
|
* ```
|
|
3054
3366
|
*/
|
|
3055
|
-
where(condition: WhereIntent | WhereFilter<TResult>): QueryBuilder<TResult>;
|
|
3367
|
+
where(condition: WhereIntent | PredicateRef | WhereFilter<TResult>): QueryBuilder<TResult>;
|
|
3056
3368
|
/**
|
|
3057
3369
|
* Add an explicit SQL JOIN clause to the query (non-hydrating, flat result).
|
|
3058
3370
|
*
|
|
@@ -3594,7 +3906,7 @@ declare class QueryBuilderImpl<TResult = unknown> implements QueryBuilder<TResul
|
|
|
3594
3906
|
}): QueryBuilder<TResult>;
|
|
3595
3907
|
limit(count: number): QueryBuilder<TResult>;
|
|
3596
3908
|
offset(count: number): QueryBuilder<TResult>;
|
|
3597
|
-
where(condition: WhereIntent | WhereFilter<TResult>): QueryBuilder<TResult>;
|
|
3909
|
+
where(condition: WhereIntent | PredicateRef | WhereFilter<TResult>): QueryBuilder<TResult>;
|
|
3598
3910
|
join(relationOrTableOrBatch: string | BatchValuesRef, opts?: {
|
|
3599
3911
|
type?: 'inner' | 'left';
|
|
3600
3912
|
on?: WhereIntent;
|
|
@@ -3833,6 +4145,39 @@ declare class CteQueryBuilder<TResult = unknown> {
|
|
|
3833
4145
|
* Part of DX-010: Mutations.
|
|
3834
4146
|
*/
|
|
3835
4147
|
|
|
4148
|
+
/**
|
|
4149
|
+
* A row shape accepted by INSERT and UPSERT values().
|
|
4150
|
+
*
|
|
4151
|
+
* The public ORM type carries row types, but not the per-column default or
|
|
4152
|
+
* serial metadata needed to make only generated columns optional. Until that
|
|
4153
|
+
* schema metadata is threaded through the mutation builders (#449), every row
|
|
4154
|
+
* column is optional here. Keys and value types remain constrained to the row
|
|
4155
|
+
* type; the database enforces required columns.
|
|
4156
|
+
*/
|
|
4157
|
+
type Insertable<T> = T extends object ? Partial<T> : Record<string, unknown>;
|
|
4158
|
+
/** A partial row shape accepted by UPDATE and UPSERT update operations. */
|
|
4159
|
+
type Updateable<T> = T extends object ? {
|
|
4160
|
+
[K in keyof T]?: T[K] | SqlRawExpression;
|
|
4161
|
+
} : Record<string, unknown>;
|
|
4162
|
+
/** A scalar-only partial row shape accepted by batchSet(). */
|
|
4163
|
+
type BatchUpdateable<T> = T extends object ? Partial<T> : Record<string, unknown>;
|
|
4164
|
+
/**
|
|
4165
|
+
* Reject keys outside a mutation payload's row shape, including when callers
|
|
4166
|
+
* pass an object through a variable rather than an object literal.
|
|
4167
|
+
*/
|
|
4168
|
+
type ExactMutationPayload<TInput, TShape> = TInput & Record<Exclude<keyof TInput, keyof TShape>, never>;
|
|
4169
|
+
type ExactMutationRows<TInput extends readonly unknown[], TShape> = TInput & {
|
|
4170
|
+
readonly [K in keyof TInput]: ExactMutationPayload<TInput[K], TShape>;
|
|
4171
|
+
};
|
|
4172
|
+
/**
|
|
4173
|
+
* Column names accepted by a mutation on a row shape.
|
|
4174
|
+
*
|
|
4175
|
+
* The tuple prevents conditional-type distribution: a mutation whose table is
|
|
4176
|
+
* a union may only name columns shared by every possible target table.
|
|
4177
|
+
*/
|
|
4178
|
+
type MutationKey<T> = [T] extends [object] ? Extract<keyof T, string> : string;
|
|
4179
|
+
type MutationReturningRow<T, K extends MutationKey<T>> = T extends object ? Pick<T, Extract<K, keyof T>> : Record<string, unknown>;
|
|
4180
|
+
type MutationWhereCondition = WhereIntent | PredicateRef;
|
|
3836
4181
|
/**
|
|
3837
4182
|
* Dump output for mutations.
|
|
3838
4183
|
* Similar to query Dump but without plan (mutations don't use the planner).
|
|
@@ -3857,6 +4202,7 @@ type MutationBaseOpts = {
|
|
|
3857
4202
|
schemaName?: string | undefined;
|
|
3858
4203
|
hookStore?: HookStore | undefined;
|
|
3859
4204
|
onHookError?: HookErrorHandler | undefined;
|
|
4205
|
+
onObserverError?: ObserverErrorHandler | undefined;
|
|
3860
4206
|
inTransaction?: boolean | undefined;
|
|
3861
4207
|
};
|
|
3862
4208
|
/**
|
|
@@ -3876,6 +4222,7 @@ declare abstract class MutationBuilderBase<T, TIntent extends InsertIntent | Upd
|
|
|
3876
4222
|
protected readonly returningColumns: readonly string[] | undefined;
|
|
3877
4223
|
protected readonly hookStore: HookStore | undefined;
|
|
3878
4224
|
protected readonly onHookError: HookErrorHandler | undefined;
|
|
4225
|
+
protected readonly onObserverError: ObserverErrorHandler | undefined;
|
|
3879
4226
|
protected readonly inTransaction: boolean | undefined;
|
|
3880
4227
|
protected constructor(opts: MutationBaseOpts & {
|
|
3881
4228
|
returning?: readonly string[] | undefined;
|
|
@@ -3898,7 +4245,7 @@ declare abstract class MutationBuilderBase<T, TIntent extends InsertIntent | Upd
|
|
|
3898
4245
|
* Builder for INSERT operations.
|
|
3899
4246
|
* Immutable - each method returns a new builder instance.
|
|
3900
4247
|
*/
|
|
3901
|
-
declare class InsertBuilder<
|
|
4248
|
+
declare class InsertBuilder<TRow = unknown, TResult = void> extends MutationBuilderBase<TResult, InsertIntent> {
|
|
3902
4249
|
private readonly valuesData;
|
|
3903
4250
|
protected readonly operationName = "insert";
|
|
3904
4251
|
constructor(opts: MutationBaseOpts & {
|
|
@@ -3909,7 +4256,7 @@ declare class InsertBuilder<T = void> extends MutationBuilderBase<T, InsertInten
|
|
|
3909
4256
|
* Set values to insert.
|
|
3910
4257
|
* Accepts a single object or an array for bulk insert.
|
|
3911
4258
|
*/
|
|
3912
|
-
values(data:
|
|
4259
|
+
values<TInput extends Insertable<TRow> | readonly Insertable<TRow>[]>(data: TInput & (TInput extends readonly Insertable<TRow>[] ? ExactMutationRows<TInput, Insertable<TRow>> : ExactMutationPayload<TInput, Insertable<TRow>>)): InsertBuilder<TRow, TResult>;
|
|
3913
4260
|
/**
|
|
3914
4261
|
* Specify columns to return after insert (DX-026).
|
|
3915
4262
|
* Requires adapter support for RETURNING clause.
|
|
@@ -3923,7 +4270,7 @@ declare class InsertBuilder<T = void> extends MutationBuilderBase<T, InsertInten
|
|
|
3923
4270
|
* // inserted = [{ id: 1, created_at: '2024-01-01T00:00:00Z' }]
|
|
3924
4271
|
* ```
|
|
3925
4272
|
*/
|
|
3926
|
-
returning<
|
|
4273
|
+
returning<K extends MutationKey<TRow>>(columns: readonly K[]): InsertBuilder<TRow, MutationReturningRow<TRow, K>[]>;
|
|
3927
4274
|
protected buildIntent(): InsertIntent;
|
|
3928
4275
|
protected compileIntent(adapter: Adapter, intent: InsertIntent, options?: CompileOptions): CompiledQuery;
|
|
3929
4276
|
}
|
|
@@ -3931,7 +4278,7 @@ declare class InsertBuilder<T = void> extends MutationBuilderBase<T, InsertInten
|
|
|
3931
4278
|
* Builder for UPDATE operations.
|
|
3932
4279
|
* Immutable - each method returns a new builder instance.
|
|
3933
4280
|
*/
|
|
3934
|
-
declare class UpdateBuilder<
|
|
4281
|
+
declare class UpdateBuilder<TRow = unknown, TResult = void> extends MutationBuilderBase<TResult, UpdateIntent | BatchUpdateIntent> {
|
|
3935
4282
|
private readonly setData;
|
|
3936
4283
|
private readonly whereIntent;
|
|
3937
4284
|
private readonly allowAllFlag;
|
|
@@ -3951,11 +4298,11 @@ declare class UpdateBuilder<T = void> extends MutationBuilderBase<T, UpdateInten
|
|
|
3951
4298
|
* Multiple calls merge fields (last value wins).
|
|
3952
4299
|
* When combined with batchSet(), these become scalar SET assignments applied to all rows.
|
|
3953
4300
|
*/
|
|
3954
|
-
set(data:
|
|
4301
|
+
set<TInput extends Updateable<TRow>>(data: ExactMutationPayload<TInput, Updateable<TRow>>): UpdateBuilder<TRow, TResult>;
|
|
3955
4302
|
/**
|
|
3956
4303
|
* Add WHERE condition.
|
|
3957
4304
|
*/
|
|
3958
|
-
where(condition:
|
|
4305
|
+
where(condition: MutationWhereCondition): UpdateBuilder<TRow, TResult>;
|
|
3959
4306
|
/**
|
|
3960
4307
|
* Specify columns to return after update (DX-026).
|
|
3961
4308
|
* Requires adapter support for RETURNING clause.
|
|
@@ -3969,7 +4316,7 @@ declare class UpdateBuilder<T = void> extends MutationBuilderBase<T, UpdateInten
|
|
|
3969
4316
|
* .execute();
|
|
3970
4317
|
* ```
|
|
3971
4318
|
*/
|
|
3972
|
-
returning<
|
|
4319
|
+
returning<K extends MutationKey<TRow>>(columns: readonly K[]): UpdateBuilder<TRow, MutationReturningRow<TRow, K>[]>;
|
|
3973
4320
|
/**
|
|
3974
4321
|
* Batch update multiple rows using unnest FROM strategy (BATCH-001).
|
|
3975
4322
|
*
|
|
@@ -3990,7 +4337,7 @@ declare class UpdateBuilder<T = void> extends MutationBuilderBase<T, UpdateInten
|
|
|
3990
4337
|
* .execute();
|
|
3991
4338
|
* ```
|
|
3992
4339
|
*/
|
|
3993
|
-
batchSet(matchColumn:
|
|
4340
|
+
batchSet<TInput extends BatchUpdateable<TRow>>(matchColumn: MutationKey<TRow> | MutationKey<TRow>[], data: readonly ExactMutationPayload<TInput, BatchUpdateable<TRow>>[]): UpdateBuilder<TRow, TResult>;
|
|
3994
4341
|
protected buildIntent(): UpdateIntent | BatchUpdateIntent;
|
|
3995
4342
|
protected compileIntent(adapter: Adapter, intent: UpdateIntent | BatchUpdateIntent, options?: CompileOptions): CompiledQuery;
|
|
3996
4343
|
}
|
|
@@ -3998,7 +4345,7 @@ declare class UpdateBuilder<T = void> extends MutationBuilderBase<T, UpdateInten
|
|
|
3998
4345
|
* Builder for DELETE operations.
|
|
3999
4346
|
* Immutable - each method returns a new builder instance.
|
|
4000
4347
|
*/
|
|
4001
|
-
declare class DeleteBuilder<
|
|
4348
|
+
declare class DeleteBuilder<TRow = unknown, TResult = void> extends MutationBuilderBase<TResult, DeleteIntent> {
|
|
4002
4349
|
private readonly whereIntent;
|
|
4003
4350
|
private readonly allowAllFlag;
|
|
4004
4351
|
private readonly cascadeRelations;
|
|
@@ -4012,13 +4359,13 @@ declare class DeleteBuilder<T = void> extends MutationBuilderBase<T, DeleteInten
|
|
|
4012
4359
|
/**
|
|
4013
4360
|
* Add WHERE condition.
|
|
4014
4361
|
*/
|
|
4015
|
-
where(condition:
|
|
4362
|
+
where(condition: MutationWhereCondition): DeleteBuilder<TRow, TResult>;
|
|
4016
4363
|
/**
|
|
4017
4364
|
* Enable cascade delete.
|
|
4018
4365
|
* Without arguments: deletes ALL related records.
|
|
4019
4366
|
* With array: deletes only specified relations.
|
|
4020
4367
|
*/
|
|
4021
|
-
cascade(relations?: readonly string[]): DeleteBuilder<
|
|
4368
|
+
cascade(relations?: readonly string[]): DeleteBuilder<TRow, TResult>;
|
|
4022
4369
|
/**
|
|
4023
4370
|
* Specify columns to return after delete (DX-026).
|
|
4024
4371
|
* Requires adapter support for RETURNING clause.
|
|
@@ -4031,7 +4378,7 @@ declare class DeleteBuilder<T = void> extends MutationBuilderBase<T, DeleteInten
|
|
|
4031
4378
|
* .execute();
|
|
4032
4379
|
* ```
|
|
4033
4380
|
*/
|
|
4034
|
-
returning<
|
|
4381
|
+
returning<K extends MutationKey<TRow>>(columns: readonly K[]): DeleteBuilder<TRow, MutationReturningRow<TRow, K>[]>;
|
|
4035
4382
|
protected buildIntent(): DeleteIntent;
|
|
4036
4383
|
protected compileIntent(adapter: Adapter, intent: DeleteIntent, options?: CompileOptions): CompiledQuery;
|
|
4037
4384
|
}
|
|
@@ -4064,7 +4411,7 @@ declare class DeleteBuilder<T = void> extends MutationBuilderBase<T, DeleteInten
|
|
|
4064
4411
|
* .execute();
|
|
4065
4412
|
* ```
|
|
4066
4413
|
*/
|
|
4067
|
-
declare class UpsertBuilder<
|
|
4414
|
+
declare class UpsertBuilder<TRow = unknown, TResult = void> extends MutationBuilderBase<TResult, UpsertIntent> {
|
|
4068
4415
|
private readonly valuesData;
|
|
4069
4416
|
private readonly conflictTarget;
|
|
4070
4417
|
private readonly conflictAction;
|
|
@@ -4079,17 +4426,17 @@ declare class UpsertBuilder<T = void> extends MutationBuilderBase<T, UpsertInten
|
|
|
4079
4426
|
* Set values to insert.
|
|
4080
4427
|
* Accepts a single object or an array for bulk upsert.
|
|
4081
4428
|
*/
|
|
4082
|
-
values(data:
|
|
4429
|
+
values<TInput extends Insertable<TRow> | readonly Insertable<TRow>[]>(data: TInput & (TInput extends readonly Insertable<TRow>[] ? ExactMutationRows<TInput, Insertable<TRow>> : ExactMutationPayload<TInput, Insertable<TRow>>)): UpsertBuilder<TRow, TResult>;
|
|
4083
4430
|
/**
|
|
4084
4431
|
* Specify conflict target by column names.
|
|
4085
4432
|
* These columns determine conflict detection.
|
|
4086
4433
|
*/
|
|
4087
|
-
onConflict(columns: readonly
|
|
4434
|
+
onConflict(columns: readonly MutationKey<TRow>[]): UpsertBuilder<TRow, TResult>;
|
|
4088
4435
|
/**
|
|
4089
4436
|
* Specify conflict target by constraint name.
|
|
4090
4437
|
* Alternative to onConflict() for named constraints.
|
|
4091
4438
|
*/
|
|
4092
|
-
onConflictConstraint(constraintName: string): UpsertBuilder<
|
|
4439
|
+
onConflictConstraint(constraintName: string): UpsertBuilder<TRow, TResult>;
|
|
4093
4440
|
/**
|
|
4094
4441
|
* On conflict, update the specified fields.
|
|
4095
4442
|
* If no fields specified, auto-updates all non-conflict columns.
|
|
@@ -4097,16 +4444,16 @@ declare class UpsertBuilder<T = void> extends MutationBuilderBase<T, UpsertInten
|
|
|
4097
4444
|
* @param set - Optional fields to update on conflict
|
|
4098
4445
|
* @param where - Optional condition for the update
|
|
4099
4446
|
*/
|
|
4100
|
-
doUpdate(set?:
|
|
4447
|
+
doUpdate<TInput extends Updateable<TRow>>(set?: ExactMutationPayload<TInput, Updateable<TRow>>, where?: MutationWhereCondition): UpsertBuilder<TRow, TResult>;
|
|
4101
4448
|
/**
|
|
4102
4449
|
* On conflict, do nothing (skip the insert).
|
|
4103
4450
|
*/
|
|
4104
|
-
doNothing(): UpsertBuilder<
|
|
4451
|
+
doNothing(): UpsertBuilder<TRow, TResult>;
|
|
4105
4452
|
/**
|
|
4106
4453
|
* Specify columns to return after upsert (DX-026).
|
|
4107
4454
|
* Requires adapter support for RETURNING clause.
|
|
4108
4455
|
*/
|
|
4109
|
-
returning<
|
|
4456
|
+
returning<K extends MutationKey<TRow>>(columns: readonly K[]): UpsertBuilder<TRow, MutationReturningRow<TRow, K>[]>;
|
|
4110
4457
|
protected buildIntent(): UpsertIntent;
|
|
4111
4458
|
protected compileIntent(adapter: Adapter, intent: UpsertIntent, options?: CompileOptions): CompiledQuery;
|
|
4112
4459
|
}
|
|
@@ -4188,9 +4535,13 @@ declare function nqlRaw(fragment: string): NqlRawFragment;
|
|
|
4188
4535
|
* @param model - ModelIR for plan execution
|
|
4189
4536
|
* @param adapter - Optional adapter for query execution
|
|
4190
4537
|
* @param schemaName - Optional schema name for multi-tenant queries
|
|
4538
|
+
* @param hookStore - Optional hook storage for query and mutation hooks
|
|
4539
|
+
* @param onHookError - Optional control-flow handler for hook failures
|
|
4540
|
+
* @param inTransaction - Whether execution is already within a transaction
|
|
4541
|
+
* @param onObserverError - Optional non-fatal diagnostic sink for observer failures
|
|
4191
4542
|
* @returns NQL template tag function
|
|
4192
4543
|
*/
|
|
4193
|
-
declare function createNqlTag(_schemaDefinition: unknown, model: ModelIR, adapter?: Adapter<unknown>, schemaName?: string, hookStore?: HookStore, onHookError?: HookErrorHandler, inTransaction?: boolean): NqlTag;
|
|
4544
|
+
declare function createNqlTag(_schemaDefinition: unknown, model: ModelIR, adapter?: Adapter<unknown>, schemaName?: string, hookStore?: HookStore, onHookError?: HookErrorHandler, inTransaction?: boolean, onObserverError?: ObserverErrorHandler): NqlTag;
|
|
4194
4545
|
/**
|
|
4195
4546
|
* Extract pseudo-column keywords from model configuration.
|
|
4196
4547
|
* Collects all configured roles and recursive keywords from all tables'
|
|
@@ -4454,11 +4805,12 @@ interface OrmOptionsWithAdapter<DB = unknown> extends OrmOptionsBase<DB> {
|
|
|
4454
4805
|
* - `orm.select(name)` - concise table-name form
|
|
4455
4806
|
* - `orm.from(table)` - TableRef form with column-level types
|
|
4456
4807
|
*
|
|
4457
|
-
* Mutations
|
|
4458
|
-
* - `orm.
|
|
4459
|
-
*
|
|
4460
|
-
* - `orm.
|
|
4461
|
-
*
|
|
4808
|
+
* Mutations have two schema-keyed surfaces:
|
|
4809
|
+
* - `orm.insert(name)`, `orm.update(name)`, `orm.delete(name)`, and
|
|
4810
|
+
* `orm.upsert(name)` are concise when the table name is already available.
|
|
4811
|
+
* - `orm.into(table)`, `orm.modify(table)`, `orm.removeFrom(table)`, and
|
|
4812
|
+
* `orm.upsertInto(table)` take a TableRef and fit flows that also use its
|
|
4813
|
+
* column references for typed filters and queries.
|
|
4462
4814
|
*
|
|
4463
4815
|
* @typeParam DB - Database row map type.
|
|
4464
4816
|
* Keys are table names, values are row types.
|
|
@@ -4561,6 +4913,14 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4561
4913
|
* @returns A QueryBuilder for constructing the select
|
|
4562
4914
|
*/
|
|
4563
4915
|
select<K extends keyof DB & string, TResult = DB[K]>(from: K): QueryBuilder<TResult>;
|
|
4916
|
+
/** Start a type-safe INSERT operation from a schema table name. */
|
|
4917
|
+
insert<K extends keyof DB & string>(table: K): InsertBuilder<DB[K]>;
|
|
4918
|
+
/** Start a type-safe UPDATE operation from a schema table name. */
|
|
4919
|
+
update<K extends keyof DB & string>(table: K): UpdateBuilder<DB[K]>;
|
|
4920
|
+
/** Start a type-safe DELETE operation from a schema table name. */
|
|
4921
|
+
delete<K extends keyof DB & string>(table: K): DeleteBuilder<DB[K]>;
|
|
4922
|
+
/** Start a type-safe UPSERT operation from a schema table name. */
|
|
4923
|
+
upsert<K extends keyof DB & string>(table: K): UpsertBuilder<DB[K]>;
|
|
4564
4924
|
/**
|
|
4565
4925
|
* Start building a SELECT query from a typed TableRef.
|
|
4566
4926
|
*
|
|
@@ -4767,7 +5127,7 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4767
5127
|
* .execute();
|
|
4768
5128
|
* ```
|
|
4769
5129
|
*/
|
|
4770
|
-
updateAll(table:
|
|
5130
|
+
updateAll<K extends keyof DB & string>(table: K): UpdateBuilder<DB[K]>;
|
|
4771
5131
|
/**
|
|
4772
5132
|
* Start building a DELETE operation that affects all rows.
|
|
4773
5133
|
* Use with caution - this explicitly allows deletes without WHERE.
|
|
@@ -4780,7 +5140,7 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4780
5140
|
* await orm.deleteAll('tempData').execute();
|
|
4781
5141
|
* ```
|
|
4782
5142
|
*/
|
|
4783
|
-
deleteAll(table:
|
|
5143
|
+
deleteAll<K extends keyof DB & string>(table: K): DeleteBuilder<DB[K]>;
|
|
4784
5144
|
/**
|
|
4785
5145
|
* Execute a callback within a database transaction.
|
|
4786
5146
|
* Auto-commits on success, auto-rolls back on exception.
|
|
@@ -6070,7 +6430,7 @@ interface SqlRawExpression {
|
|
|
6070
6430
|
* ```typescript
|
|
6071
6431
|
* orm.upsert('files')
|
|
6072
6432
|
* .values({ id: 1, name: 'test' })
|
|
6073
|
-
* .onConflict(
|
|
6433
|
+
* .onConflict(['id'])
|
|
6074
6434
|
* .doUpdate({ last_parsed: sql('now()'), count: sql('excluded.count + 1') })
|
|
6075
6435
|
* .execute();
|
|
6076
6436
|
*
|
|
@@ -6134,6 +6494,9 @@ declare function isSqlRaw(value: unknown): value is SqlRawExpression;
|
|
|
6134
6494
|
* not a column name → use `literal()` instead).
|
|
6135
6495
|
*/
|
|
6136
6496
|
type ExprInput = ExpressionRef | ExpressionSpec | AggOrderByArg | string | number | boolean | readonly unknown[];
|
|
6497
|
+
|
|
6498
|
+
type BinaryPredicateOperator = Exclude<PredicateOperator, 'AND' | 'OR' | 'NOT'>;
|
|
6499
|
+
type NonPredicateOperator<TOperator extends string> = TOperator extends PredicateOperator ? never : TOperator;
|
|
6137
6500
|
/**
|
|
6138
6501
|
* A chainable wrapper around an ExpressionIntent.
|
|
6139
6502
|
*
|
|
@@ -6187,6 +6550,47 @@ declare class ExpressionRef {
|
|
|
6187
6550
|
*/
|
|
6188
6551
|
filter(condition: WhereIntent): ExpressionRef;
|
|
6189
6552
|
}
|
|
6553
|
+
/** Marker used to identify an invalid predicate from a different core copy. */
|
|
6554
|
+
declare const PREDICATE_REF_DISCRIMINATOR: "dbsp.predicate.v1";
|
|
6555
|
+
/**
|
|
6556
|
+
* A predicate that is also a scalar expression.
|
|
6557
|
+
*
|
|
6558
|
+
* Its one canonical representation is the expression intent inherited from
|
|
6559
|
+
* `ExpressionRef`; the WHERE form is derived when a builder consumes it.
|
|
6560
|
+
*/
|
|
6561
|
+
declare class ExpressionPredicateRef extends ExpressionRef {
|
|
6562
|
+
readonly __predicateRef: "dbsp.predicate.v1";
|
|
6563
|
+
readonly intent: StandaloneWhereExpressionIntent;
|
|
6564
|
+
constructor(intent: StandaloneWhereExpressionIntent);
|
|
6565
|
+
as(alias: string): PredicateExpressionRef;
|
|
6566
|
+
}
|
|
6567
|
+
/** A scalar predicate created by `op()`, `boolFn()`, or `unsafeAsPredicate()`. */
|
|
6568
|
+
type PredicateExpressionRef = ExpressionPredicateRef;
|
|
6569
|
+
/**
|
|
6570
|
+
* A composed predicate has no scalar-expression representation in this API.
|
|
6571
|
+
* Its canonical representation is the complete WHERE intent.
|
|
6572
|
+
*/
|
|
6573
|
+
declare class WhereOnlyPredicateRef {
|
|
6574
|
+
readonly intent: WhereIntent;
|
|
6575
|
+
readonly __predicateRef: "dbsp.predicate.v1";
|
|
6576
|
+
constructor(intent: WhereIntent);
|
|
6577
|
+
}
|
|
6578
|
+
/** A composed predicate that is accepted only in `.where()`. */
|
|
6579
|
+
type WhereOnlyPredicate = WhereOnlyPredicateRef;
|
|
6580
|
+
/**
|
|
6581
|
+
* A value accepted by `.where()` as a predicate.
|
|
6582
|
+
*
|
|
6583
|
+
* The constructors are intentionally module-private. Use `op()`, predicate
|
|
6584
|
+
* helpers, or `unsafeAsPredicate()` instead.
|
|
6585
|
+
*/
|
|
6586
|
+
type PredicateRef = PredicateExpressionRef | WhereOnlyPredicate;
|
|
6587
|
+
/**
|
|
6588
|
+
* Recognize only predicate instances constructed by this installed core copy.
|
|
6589
|
+
*
|
|
6590
|
+
* A predicate from another installed copy is unsupported: reconstruct it with
|
|
6591
|
+
* this module's predicate factories before passing it to a builder.
|
|
6592
|
+
*/
|
|
6593
|
+
declare function isPredicateRef(value: unknown): value is PredicateRef;
|
|
6190
6594
|
/**
|
|
6191
6595
|
* Column reference — refers to a named column (or table.column).
|
|
6192
6596
|
*
|
|
@@ -6216,7 +6620,21 @@ declare function cast(expr: ExpressionRef, typeName: string): ExpressionRef;
|
|
|
6216
6620
|
* @example op('<=>', 'embedding', [0.1, 0.2]) // implicit conversions
|
|
6217
6621
|
* @throws Error if operator fails validation (injection guard)
|
|
6218
6622
|
*/
|
|
6219
|
-
|
|
6623
|
+
/** Logical AND / OR — both operands must be predicates. */
|
|
6624
|
+
declare function op(operator: 'AND' | 'OR', left: PredicateRef, right: PredicateRef): WhereOnlyPredicate;
|
|
6625
|
+
/** Logical NOT — its sole operand must be a predicate. */
|
|
6626
|
+
declare function op(operator: 'NOT', operand: PredicateRef): WhereOnlyPredicate;
|
|
6627
|
+
/** Predicate binary operators accept expression operands. */
|
|
6628
|
+
declare function op(operator: BinaryPredicateOperator, left: ExprInput, right: ExprInput): ExpressionPredicateRef;
|
|
6629
|
+
/** Any non-predicate operator remains an ordinary expression. */
|
|
6630
|
+
declare function op<TOperator extends string>(operator: NonPredicateOperator<TOperator>, left: ExprInput, right: ExprInput): ExpressionRef;
|
|
6631
|
+
/**
|
|
6632
|
+
* Assert that an arbitrary expression is boolean for use in WHERE.
|
|
6633
|
+
*
|
|
6634
|
+
* Use this only for a user-defined operator whose boolean result cannot be
|
|
6635
|
+
* represented by the closed PredicateOperator union.
|
|
6636
|
+
*/
|
|
6637
|
+
declare function unsafeAsPredicate(expr: ExpressionRef): PredicateExpressionRef;
|
|
6220
6638
|
/**
|
|
6221
6639
|
* Custom function call — name(args...).
|
|
6222
6640
|
* Supports schema-qualified names (e.g., 'paradedb.score', 'ST_Distance').
|
|
@@ -6242,6 +6660,18 @@ declare function op(operator: string, left: ExprInput, right: ExprInput): Expres
|
|
|
6242
6660
|
* @throws Error if name fails validation (injection guard)
|
|
6243
6661
|
*/
|
|
6244
6662
|
declare function fn(name: string, ...args: (ExprInput | DistinctField)[]): ExpressionRef;
|
|
6663
|
+
/**
|
|
6664
|
+
* Declare that a custom function call is boolean-valued for use in WHERE.
|
|
6665
|
+
*
|
|
6666
|
+
* This has the same trust boundary as the SQL function name and arguments the
|
|
6667
|
+
* caller writes: use it only when the declared function returns boolean.
|
|
6668
|
+
* Unlike `fn()`, which builds a scalar expression, `boolFn()` builds a
|
|
6669
|
+
* predicate that can be passed directly to `.where()`.
|
|
6670
|
+
*
|
|
6671
|
+
* @example boolFn('jsonb_exists', ref('data'), literal('phone'))
|
|
6672
|
+
* @throws Error if name fails validation (injection guard)
|
|
6673
|
+
*/
|
|
6674
|
+
declare function boolFn(name: string, ...args: (ExprInput | DistinctField)[]): PredicateExpressionRef;
|
|
6245
6675
|
/**
|
|
6246
6676
|
* Literal value — inlined directly in SQL (not bound as parameter).
|
|
6247
6677
|
* Use to distinguish SQL string literals from column references.
|
|
@@ -6907,7 +7337,7 @@ type FullTextSearchOptions = {
|
|
|
6907
7337
|
* }))
|
|
6908
7338
|
* ```
|
|
6909
7339
|
*/
|
|
6910
|
-
declare function fullTextSearch({ query, fields, tableAlias, }: FullTextSearchOptions):
|
|
7340
|
+
declare function fullTextSearch({ query, fields, tableAlias, }: FullTextSearchOptions): PredicateExpressionRef;
|
|
6911
7341
|
/**
|
|
6912
7342
|
* BM25 relevance score expression for ParadeDB.
|
|
6913
7343
|
*
|
|
@@ -7443,6 +7873,11 @@ interface SimplifiedOrmOptions<T extends SchemaDefinition = SchemaDefinition> {
|
|
|
7443
7873
|
* or 'abort' to propagate the error.
|
|
7444
7874
|
*/
|
|
7445
7875
|
readonly onHookError?: HookErrorHandler;
|
|
7876
|
+
/**
|
|
7877
|
+
* Non-fatal diagnostic sink for observer failures and snapshot skips.
|
|
7878
|
+
* Its return value is ignored and it can never abort query or mutation work.
|
|
7879
|
+
*/
|
|
7880
|
+
readonly onObserverError?: ObserverErrorHandler;
|
|
7446
7881
|
/**
|
|
7447
7882
|
* Behavior when schema uses features the adapter doesn't support.
|
|
7448
7883
|
* Default: 'warning' (emit warning + skip).
|
|
@@ -7569,7 +8004,7 @@ type RangeType = 'int4range' | 'int8range' | 'numrange' | 'tsrange' | 'tstzrange
|
|
|
7569
8004
|
* @example rangeOverlaps('span', [1, 100], 'int4range')
|
|
7570
8005
|
* → "span" && int4range($1, $2)
|
|
7571
8006
|
*/
|
|
7572
|
-
declare function rangeOverlaps(column: string, range: readonly [unknown, unknown], rangeType?: RangeType):
|
|
8007
|
+
declare function rangeOverlaps(column: string, range: readonly [unknown, unknown], rangeType?: RangeType): PredicateExpressionRef;
|
|
7573
8008
|
/**
|
|
7574
8009
|
* Range OVERLAPS — object API: delegates to WhereRangeIntent (planner path)
|
|
7575
8010
|
*
|
|
@@ -7582,20 +8017,20 @@ declare function rangeOverlaps(field: string, value: RangeValue): WhereRangeInte
|
|
|
7582
8017
|
* @example rangeContains('dateRange', ['2024-06-15', '2024-06-15'])
|
|
7583
8018
|
* → "dateRange" @> daterange($1, $2)
|
|
7584
8019
|
*/
|
|
7585
|
-
declare function rangeContains(column: string, range: readonly [unknown, unknown], rangeType?: RangeType):
|
|
8020
|
+
declare function rangeContains(column: string, range: readonly [unknown, unknown], rangeType?: RangeType): PredicateExpressionRef;
|
|
7586
8021
|
/**
|
|
7587
8022
|
* Range CONTAINS — object API: delegates to WhereRangeIntent (planner path)
|
|
7588
8023
|
*
|
|
7589
8024
|
* @example rangeContains('date_range', { lower: '2025-01-01', upper: '2025-01-05' })
|
|
7590
8025
|
*/
|
|
7591
|
-
declare function rangeContains(field: string, value:
|
|
8026
|
+
declare function rangeContains(field: string, value: RangeOperand): WhereRangeIntent;
|
|
7592
8027
|
/**
|
|
7593
8028
|
* Range CONTAINED BY — tuple API: `"column" <@ rangeType($1, $2)` (ExpressionRef)
|
|
7594
8029
|
*
|
|
7595
8030
|
* @example rangeContainedBy('dateRange', ['2024-01-01', '2024-12-31'])
|
|
7596
8031
|
* → "dateRange" <@ daterange($1, $2)
|
|
7597
8032
|
*/
|
|
7598
|
-
declare function rangeContainedBy(column: string, range: readonly [unknown, unknown], rangeType?: RangeType):
|
|
8033
|
+
declare function rangeContainedBy(column: string, range: readonly [unknown, unknown], rangeType?: RangeType): PredicateExpressionRef;
|
|
7599
8034
|
/**
|
|
7600
8035
|
* Range CONTAINED BY — object API: delegates to WhereRangeIntent (planner path)
|
|
7601
8036
|
*
|
|
@@ -7814,6 +8249,7 @@ declare function normalizeSQL(sql: string): string;
|
|
|
7814
8249
|
*
|
|
7815
8250
|
* Pure string parser — zero external dependencies.
|
|
7816
8251
|
*/
|
|
8252
|
+
|
|
7817
8253
|
declare const ASSERTION_TYPES: readonly ["output.contains", "output.equals", "output.matches", "sql.equals", "sql.matches", "params.equals", "params.length", "plan.contains", "success", "error.contains", "sql.table", "sql.column", "sql.join", "params.type", "params.value", "db.success", "db.output.contains", "db.rows.equals", "db.rows.min", "db.rows.max", "db.output", "db.column.exists", "db.value.equals", "intent.type", "intent.table", "intent.with", "intent.hasWhere", "intent.hasGroupBy", "intent.hasOrderBy"];
|
|
7818
8254
|
type AssertionType = (typeof ASSERTION_TYPES)[number];
|
|
7819
8255
|
/**
|
|
@@ -7829,12 +8265,14 @@ interface TableAssertionData {
|
|
|
7829
8265
|
columns: string[];
|
|
7830
8266
|
rows: string[][];
|
|
7831
8267
|
}
|
|
8268
|
+
/** Values representable in an assertion file, plus the parsed db.output table. */
|
|
8269
|
+
type AssertionValue = JsonValue$1 | TableAssertionData;
|
|
7832
8270
|
/**
|
|
7833
8271
|
* A single assertion within a block
|
|
7834
8272
|
*/
|
|
7835
8273
|
interface Assertion {
|
|
7836
8274
|
type: AssertionType;
|
|
7837
|
-
value:
|
|
8275
|
+
value: AssertionValue;
|
|
7838
8276
|
line: number;
|
|
7839
8277
|
}
|
|
7840
8278
|
/**
|
|
@@ -8095,4 +8533,4 @@ declare const assertIntentHasOrderBy: (result: AssertionQueryResult, expected: b
|
|
|
8095
8533
|
*/
|
|
8096
8534
|
declare function runAssertions(blocks: AssertionBlock[], results: AssertionQueryResult[], queries: string[], hasDb?: boolean): AssertionSummary;
|
|
8097
8535
|
|
|
8098
|
-
export { ASSERTION_TYPES, AdapterRequiredError, type AdjacencyOptions, type AfterMutationHook, type AfterQueryHook, type AggregateOptions, type AliasedColumn, type AliasedExprColumn, type AllColumns, AmbiguousPlanError, AmbiguousRelationError, type Applier, type Assertion, type AssertionBlock, type AssertionOutcome, type AssertionQueryResult, type AssertionSummary, type AssertionType, BRAND, type BatchValuesOptions, type BatchValuesRef, type BeforeMutationHook, type BeforeQueryHook, type BrandKey, COLUMN_META, type CardinalityShorthand, CaseBuilder, type CaseValue, type CheckDelta, type ColumnDef, type ColumnMetaKey, ColumnNotFoundError, type ColumnRef, type ColumnSpec, CteBuilder, type CteDump, CteQueryBuilder, type CursorPaginateOptions, type CursorPaginatedResult, DEFAULT_FEATURE_CHECKERS, DUCKDB_CAPABILITIES, type DefaultFilters, type DefineModelOptions, DeleteBuilder, type DistinctField, type DumpMetaInput, type EdgeTableOptions, type EmitWarningOptions, type EnumAddDelta, ErrorCode, type ErrorHookContext, Errors, type EstablishedProofClaim, type ExecutionCoordinator, ExecutionError, type ExprInput, ExpressionRef, type ExpressionSpec, type FeatureChecker, type FeatureUsage, type FilterOperators, type FilterValue, type FullTextSearchField, type FullTextSearchOptions, type GetSchemaFromDbOptions, type GuardExecutionResult, type HierarchyOptions, type HookErrorHandler, type HookManager, type HookPriority, type HydrateOptions, IRREGULAR_PLURALS, type InProcessProvenPlan, type IncludeOptions, type IncludeOptionsWithRecursive, type IndexDelta, type IndexSetEntry, type InferColumn, type InferColumnNonNull, type InferColumnType, type InferColumnTypes, type InferDB, type InferRefColumn, type InferRow, type InferSchemaDB, type InferTableRow, type InferTables, type InferredRangeValue, InsertBuilder, IntentBuilder, type IntentBuilderState, type IntentSummary, InvalidOperationError, InvalidRelationDefinitionError, type JoinOptions, type JsonValue, type LightweightRelationsDef, type ListHierarchyOptions, type ListIndexOptions, type Logger, MSSQL_CAPABILITIES, MYSQL_CAPABILITIES, ModelIRImpl, type MutationDump, type MutationHookContext, type MutationOperation, NamingConventionMismatchError, type NegotiationResult, type NestedInclude, type SchemaColumnType as NewSchemaColumnType, type NonRollbackableExecutionTracker, NotFoundError, type NqlBuilder, type NqlRawFragment, type NqlTag, type OnErrorHook, type OperationFingerprints, type OperationObservation, type OperationRuntime, type OrderByInput, type OrderByRecord, type OrderBySpec, type OrmInstance, type OrmOf, type OrmOptions, type OrmOptionsWithAdapter, type OrmOptionsWithModel, POSTGRESQL_CAPABILITIES, PackRegistry, type PaginateOptions, type PaginatedResult, type ParseError, type ParseResult, type ParsedRelationDef, type ParsedRelationKey, type PathOptions, type PrioritizedHook, type ProveOutcome, type Prover, type QueryAssertionResult, type QueryBuilder, type QueryHookContext, type QueryResultType, RELATION_META, type RangeType, RawCteQueryBuilder, type RecursiveDump, type RecursiveIncludeConfig, type RecursiveOptions, RecursiveShapeMismatchError, type RefDefinition, type RefOptions, type RegisteredOperationSemantics, type RelationHints, type RelationKey, type RelationMetaKey, RelationNotFoundError, type RelationObjectDef, type RelationPathIncludeNode, type RelationPathUsage, type RelationRef, type RelationShorthand, type RelationTupleDef, ResultHydrator, type RulePrecedenceFact, SQLITE_CAPABILITIES, SQL_RAW_MARKER, type Schema, type SchemaColumnType, type SchemaConstraints, type SchemaDefinition, SchemaValidationError as SchemaError, type SchemaExtras, type SchemaIndexOptions, type SchemaIndexValidationInput, type SchemaOptions, type SchemaTableOptions, SchemaValidationError, type SelectField, type SelfRefRoles, type SetOperationBuilder, type SimplifiedOrmOptions, type SqlRawExpression, type StagedCompositionCandidate, type StagedCompositionPreflight, type StagedCompositionPreflightInput, type StagedTransitionInput, type StagedTransitionOrchestrator, type StreamOptions, SubqueryBuilder, SubqueryExpression, TABLE_META,
|
|
8536
|
+
export { ASSERTION_TYPES, AdapterRequiredError, type AdjacencyOptions, type AfterMutationHook, type AfterMutationObserver, type AfterQueryHook, type AfterQueryObserver, type AggregateOptions, type AliasedColumn, type AliasedExprColumn, type AllColumns, AmbiguousPlanError, AmbiguousRelationError, type Applier, type Assertion, type AssertionBlock, type AssertionOutcome, type AssertionQueryResult, type AssertionSummary, type AssertionType, BRAND, type BatchValuesOptions, type BatchValuesRef, type BeforeMutationHook, type BeforeQueryHook, type BrandKey, COLUMN_META, CanonicalJsonError, type CardinalityShorthand, CaseBuilder, type CaseValue, type CheckDelta, type ColumnDef, type ColumnMetaKey, ColumnNotFoundError, type ColumnRef, type ColumnSpec, CteBuilder, type CteDump, CteQueryBuilder, type CursorPaginateOptions, type CursorPaginatedResult, DEFAULT_FEATURE_CHECKERS, DUCKDB_CAPABILITIES, type DeclarationNamingStrategy, type DefaultFilters, type DefineModelOptions, DeleteBuilder, type DistinctField, type DumpMetaInput, type EdgeTableOptions, type EmitWarningOptions, type EnumAddDelta, ErrorCode, type ErrorHookContext, Errors, type EstablishedProofClaim, type ExecutionCoordinator, ExecutionError, type ExprInput, ExpressionRef, type ExpressionSpec, type FeatureChecker, type FeatureUsage, type FilterOperators, type FilterValue, type FullTextSearchField, type FullTextSearchOptions, type GetSchemaFromDbOptions, type GuardExecutionResult, type HierarchyOptions, type HookErrorHandler, type HookManager, type HookPriority, type HydrateOptions, IRREGULAR_PLURALS, type InProcessProvenPlan, type IncludeOptions, type IncludeOptionsWithRecursive, type IndexDelta, type IndexSetEntry, type InferColumn, type InferColumnNonNull, type InferColumnType, type InferColumnTypes, type InferDB, type InferRefColumn, type InferRow, type InferSchemaDB, type InferTableRow, type InferTables, type InferredRangeValue, InsertBuilder, type Insertable, IntentBuilder, type IntentBuilderState, type IntentSummary, InvalidOperationError, InvalidRelationDefinitionError, type JoinOptions, type JsonValue, LEDGER_LIFECYCLE_GRAMMAR, LEDGER_PROJECTION_CODE_VERSION, type LedgerChainProjectionInput, type LightweightRelationsDef, type ListHierarchyOptions, type ListIndexOptions, type Logger, MSSQL_CAPABILITIES, MYSQL_CAPABILITIES, type ManagedOutcomeExecutionRequest, type ManagedOutcomePreflightRequest, ModelIRImpl, type MutationDump, type MutationHookContext, type MutationOperation, NamingConventionMismatchError, type NegotiationResult, type NestedInclude, type SchemaColumnType as NewSchemaColumnType, type NonRollbackableExecutionTracker, NotFoundError, type NqlBuilder, type NqlRawFragment, type NqlTag, type ObserverErrorHandler, type OnErrorHook, type OperationFingerprints, type OperationObservation, type OperationRuntime, type OrderByInput, type OrderByRecord, type OrderBySpec, type OrmInstance, type OrmOf, type OrmOptions, type OrmOptionsWithAdapter, type OrmOptionsWithModel, POSTGRESQL_CAPABILITIES, PREDICATE_REF_DISCRIMINATOR, PackRegistry, type PaginateOptions, type PaginatedResult, type ParseError, type ParseResult, type ParsedRelationDef, type ParsedRelationKey, type PathOptions, type PredicateExpressionRef, type PredicateRef, type PrioritizedHook, type ProveOutcome, type Prover, type QueryAssertionResult, type QueryBuilder, type QueryHookContext, type QueryResultType, RELATION_META, type RangeType, RawCteQueryBuilder, type RecursiveDump, type RecursiveIncludeConfig, type RecursiveOptions, RecursiveShapeMismatchError, type RefDefinition, type RefOptions, type RegisteredOperationSemantics, type RelationHints, type RelationKey, type RelationMetaKey, RelationNotFoundError, type RelationObjectDef, type RelationPathIncludeNode, type RelationPathUsage, type RelationRef, type RelationShorthand, type RelationTupleDef, ResultHydrator, type RulePrecedenceFact, SQLITE_CAPABILITIES, SQL_RAW_MARKER, type Schema, type SchemaColumnType, type SchemaConstraints, type SchemaDefinition, SchemaValidationError as SchemaError, type SchemaExtras, type SchemaIndexOptions, type SchemaIndexValidationInput, type SchemaOptions, type SchemaTableOptions, SchemaValidationError, type SelectField, type SelfRefRoles, type SetOperationBuilder, type SimplifiedOrmOptions, type SqlRawExpression, type StagedCompositionCandidate, type StagedCompositionPreflight, type StagedCompositionPreflightInput, type StagedTransitionInput, type StagedTransitionOrchestrator, type StreamOptions, SubqueryBuilder, SubqueryExpression, TABLE_META, type TableAssertionData, type TableDDL, type TableDef, type TableIndexes, type TableMetaKey, TableNotFoundError, type TableRef, type TransactionCoordinatorBinding, type TransitionExecutionClient, type TransitionPack, TransitionReadTarget, type TransitionRelationalValidationInput, type TransitionRelationalValidationResult, type TransitionRunPersister, type TraversalDirection, UnhandledTypeInDialect, UnknownDialectError, UnsafeOperationError, UnsupportedCapabilityError, UnsupportedFeatureError, UnsupportedStrategyError, UpdateBuilder, type Updateable, UpsertBuilder, type ValidatedManagedStepManifest, type ValidatedManagedStepManifestResult, type WarningCategory, type WhereFilter, WindowBuilder, admitRecordedIdentity, advisoryObservationId, aggOrderBy, and, any, array, arrayAgg, assertCanonicalizableJson, assertCapability, assertConnectionAvailable, assertContains, assertDbColumnExists, assertDbOutput, assertDbRowsEquals, assertDbRowsMax, assertDbRowsMin, assertDbValueEquals, assertEquals, assertIntentHasGroupBy, assertIntentHasOrderBy, assertIntentHasWhere, assertIntentTable, assertIntentType, assertIntentWith, assertMatches, assertParamsEquals, assertParamsLength, assertParamsType, assertParamsValue, assertSQLColumn, assertSQLEquals, assertSQLJoin, assertSQLTable, assertSuccess, assertTypeSupported, assumptionAccepted, assumptionId, batchValues, bindDeclarationSet, bindExecutionContract, boolFn, canonicalJson, canonicalJsonDigest, capitalize, caseWhen, cast, checkDelta, chooseReadyCandidate, claimId, coalesce, col, composeAfterMutationHooks, composeAfterQueryHooks, composeBeforeMutationHooks, composeBeforeQueryHooks, composeOnErrorHooks, concludeEvidenceForObligation, countDistinctRelationPathsByName, createApplier, createComparator, createDialectCapabilities, createEvidenceView, createExecutionContract, createHookManager, createNqlTag, createOrm, createPackRegistry, createProver, createPseudoColumnMetadata, createRawCteBuilder, createRecursiveMetadata, createStagedTransitionOrchestrator, createTransitionRunMetadata, decapitalize, declarationSetFromModel, defaultIndexName, defaultLogger, defineModel, denseRank, deriveRelationPathFromIntentPath, distinct, emitWarning, enumAddDelta, eq, every, evidenceId, exists, ref as exprRef, extendDialect, extractPseudoColumnKeywords, findClosestMatch, fn, fullTextSearch, getAvailableDialects, getDialectCapabilities, getLogger, getRelationKind, getSchemaFromDb, gt, gte, inArray, inSubquery, indexDelta, inferForeignKey, interpretLedgerLifecycle, isAliasedColumn, isAllColumns, isBatchValuesRef, isCardinalityShorthand, isColumnRef, isDistinctField, isDistinctFrom, isExpressionSpec, isKnownDialect, isNotNull, isNull, isOperationRuntime, isOverallSuccess, isPredicateRef, isRecursiveIncludeOptions, isRecursiveRelation, isRef, isRelationObjectDef, isRelationRef, isRelationTupleDef, isSelfReferential, isSqlRaw, isSubqueryExpression, isTableRef, isWhereIntent, lag, lead, like, literal, loadVerifiedRecoveryJournal, lt, lte, markGeneratorRemovalNonReplayable, namedArg, negotiateFeatures, neq, none, normalizeSQL, normalizedIndex, not, notExists, nqlRaw, objectToWhereIntent, observationContextDigest, op, or, outerRef, param, parseAssertionFile, parseRelationDef, parseRelationKey, pipeAfterMutationHooks, pipeAfterQueryHooks, pipeBeforeMutationHooks, pipeBeforeQueryHooks, pipeOnErrorHooks, plan, planRecursive, pluralize, preflightStagedComposition, projectCompareToSingleCandidate, projectLedgerChain, rangeContainedBy, rangeContains, rangeOverlaps, rank, raw, rawExists, rawNotExists, ref$1 as ref, registerDialect, relationColumn, requiresDatabase, resetLogger, resolveEnumSchemaForComparison, resolveQueryIndex, resourceIsWithin, resourceScopeCovers, rowNumber, runAssertions, schema, schemaToModelIR, selectorMatchesResource, semanticArtifactId, serverVersionNum, setLogger, silentLogger, singularize, some, sortByPriority, sql, star, stringAgg, subquery, supportsDDLGeneration, supportsExecution, supportsIntrospection, supportsRawSql, supportsStreaming, supportsTransactions, textScore, transitionPlanDigest, unary, unsafeAsPredicate, validateAssertionBlocks, validateDeclarationModel, validateExecutionContract, validateNormalizedManagedStepManifest, validateRecursiveInclude, validateRecursiveShape, validateSchemaIndexOptions, validateTransitionRelationalInvariants, validateTypeName, wAvg, wCount, wMax, wMin, wSum, withPriority };
|