@dbsp/core 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +95 -16
- package/dist/index.js +641 -209
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
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, TransactionalAdapter, TransactionalCompletionRecord, TransitionCandidate,
|
|
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, ResourceAddress, ResourceSelector, TransitionLessor, ApplyPolicy, ApplyResult, TransitionCandidate, TransitionFragmentComposition, PlanAssessment, CompareOutcome, TransitionQueryClient, TransitionFragment, ProofClaim, Assumption, ProvenPlanShape, ApplicableAssessment, TransitionRunJournal, 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, AggOrderByArg, RelationType as RelationType$1, Cardinality, FeatureWarning, UnsupportedFeatureBehavior, FeatureBehaviorConfig, RangeValue, WhereRangeIntent, 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, 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';
|
|
4
4
|
import { NqlCompilerOptions } from '@dbsp/nql';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1439,15 +1439,13 @@ interface GuardExecutionResult {
|
|
|
1439
1439
|
readonly recovery: readonly RecoveryArtefact[];
|
|
1440
1440
|
}
|
|
1441
1441
|
interface TransitionExecutionClient {
|
|
1442
|
-
readonly opaqueClient:
|
|
1442
|
+
readonly opaqueClient: TransitionSessionClient;
|
|
1443
1443
|
}
|
|
1444
1444
|
interface NonRollbackableExecutionTracker {
|
|
1445
1445
|
markNonRollbackableOperationExecuted(): void;
|
|
1446
1446
|
}
|
|
1447
1447
|
interface ExecutionCoordinator {
|
|
1448
1448
|
readonly transactionDomain: string;
|
|
1449
|
-
checkout(target: TransitionConnectionPool): Promise<TransitionExecutionClient>;
|
|
1450
|
-
release(client: TransitionExecutionClient, error?: unknown): Promise<void> | void;
|
|
1451
1449
|
begin(client: TransitionExecutionClient): Promise<void>;
|
|
1452
1450
|
setLockTimeout(client: TransitionExecutionClient, maxWaitMs: number): Promise<void>;
|
|
1453
1451
|
commit(client: TransitionExecutionClient): Promise<void>;
|
|
@@ -1459,8 +1457,6 @@ interface TransactionCoordinatorBinding {
|
|
|
1459
1457
|
readonly transactionDomain: string;
|
|
1460
1458
|
}
|
|
1461
1459
|
interface OperationRuntime extends RegisteredOperationSemantics {
|
|
1462
|
-
checkout(target: TransitionConnectionPool): Promise<TransitionExecutionClient>;
|
|
1463
|
-
release(client: TransitionExecutionClient, error?: unknown): Promise<void> | void;
|
|
1464
1460
|
writeIntentJournal(client: TransitionExecutionClient, record: DurableIntentRecord): Promise<void>;
|
|
1465
1461
|
begin(client: TransitionExecutionClient): Promise<void>;
|
|
1466
1462
|
setLockTimeout(client: TransitionExecutionClient, maxWaitMs: number): Promise<void>;
|
|
@@ -1623,7 +1619,7 @@ interface StagedTransitionInput {
|
|
|
1623
1619
|
readonly desired: ModelIR;
|
|
1624
1620
|
readonly loadCurrent: () => Promise<ModelIR>;
|
|
1625
1621
|
readonly readContext: () => Promise<ObservationContext>;
|
|
1626
|
-
readonly target:
|
|
1622
|
+
readonly target: TransitionLessor;
|
|
1627
1623
|
readonly policy: ApplyPolicy;
|
|
1628
1624
|
readonly maxIterations?: number;
|
|
1629
1625
|
}
|
|
@@ -1661,6 +1657,48 @@ declare function chooseReadyCandidate(preflight: Extract<StagedCompositionPrefli
|
|
|
1661
1657
|
}>): StagedCompositionCandidate;
|
|
1662
1658
|
declare function projectCompareToSingleCandidate(compare: TransitionCompare, entry: StagedCompositionCandidate): TransitionCompare;
|
|
1663
1659
|
|
|
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
|
+
|
|
1664
1702
|
type TransitionRelationalValidationInput = {
|
|
1665
1703
|
readonly kind: 'fragment';
|
|
1666
1704
|
readonly fragment: TransitionFragment;
|
|
@@ -1712,20 +1750,20 @@ type ProveOutcome = {
|
|
|
1712
1750
|
};
|
|
1713
1751
|
interface Prover {
|
|
1714
1752
|
readonly artifact: SemanticArtifactRef;
|
|
1715
|
-
prove(compare: CompareOutcome, target:
|
|
1753
|
+
prove(compare: CompareOutcome, target: TransitionLessor, context: ObservationContext): Promise<ProveOutcome>;
|
|
1716
1754
|
}
|
|
1717
1755
|
interface Applier {
|
|
1718
1756
|
readonly artifact: SemanticArtifactRef;
|
|
1719
1757
|
apply(proven: {
|
|
1720
1758
|
readonly plan: InProcessProvenPlan;
|
|
1721
1759
|
readonly assessment: ApplicableAssessment;
|
|
1722
|
-
}, policy: ApplyPolicy, target:
|
|
1723
|
-
resume(runId: string, loadCurrent: TransitionResumeJournalLoader, readContext: TransitionResumeContextReader, policy: ApplyPolicy, target:
|
|
1760
|
+
}, policy: ApplyPolicy, target: TransitionLessor): Promise<ApplyResult>;
|
|
1761
|
+
resume(runId: string, loadCurrent: TransitionResumeJournalLoader, readContext: TransitionResumeContextReader, policy: ApplyPolicy, target: TransitionLessor): Promise<ApplyResult>;
|
|
1724
1762
|
}
|
|
1725
1763
|
type TransitionResumeJournalLoader = (runId: string) => Promise<TransitionRunJournal & {
|
|
1726
1764
|
readonly plan: ProvenPlanShape;
|
|
1727
1765
|
}>;
|
|
1728
|
-
type TransitionResumeContextReader = (target:
|
|
1766
|
+
type TransitionResumeContextReader = (target: TransitionLessor, run: TransitionRunJournal['run']) => Promise<ObservationContext>;
|
|
1729
1767
|
|
|
1730
1768
|
/**
|
|
1731
1769
|
* @module model-impl
|
|
@@ -2426,7 +2464,7 @@ interface QueryBuilderContext {
|
|
|
2426
2464
|
* Options for streaming query execution.
|
|
2427
2465
|
* Options for configuring streaming behavior.
|
|
2428
2466
|
*/
|
|
2429
|
-
interface StreamOptions {
|
|
2467
|
+
interface StreamOptions extends TransactionBeginOptions {
|
|
2430
2468
|
/**
|
|
2431
2469
|
* Number of rows to fetch per batch from the database.
|
|
2432
2470
|
* Only affects PostgreSQL with pg-cursor configured.
|
|
@@ -2438,6 +2476,8 @@ interface StreamOptions {
|
|
|
2438
2476
|
* Receives the query dump for observability/logging.
|
|
2439
2477
|
*/
|
|
2440
2478
|
readonly onStart?: (dump: Dump) => void;
|
|
2479
|
+
/** AbortSignal is intentionally unsupported by stream-owned transactions. */
|
|
2480
|
+
readonly signal?: never;
|
|
2441
2481
|
}
|
|
2442
2482
|
/**
|
|
2443
2483
|
* Options for offset-based pagination.
|
|
@@ -3851,6 +3891,7 @@ declare abstract class MutationBuilderBase<T, TIntent extends InsertIntent | Upd
|
|
|
3851
3891
|
protected requireAdapter(operation: string): Adapter;
|
|
3852
3892
|
dump(extraOptions?: CompileOptions): MutationDump;
|
|
3853
3893
|
execute(): Promise<T>;
|
|
3894
|
+
affectedRows(): Promise<number>;
|
|
3854
3895
|
private prepareMutationExecution;
|
|
3855
3896
|
}
|
|
3856
3897
|
/**
|
|
@@ -4475,6 +4516,13 @@ interface SelectExpressionResult {
|
|
|
4475
4516
|
*/
|
|
4476
4517
|
execute<T = Record<string, unknown>>(): Promise<T[]>;
|
|
4477
4518
|
}
|
|
4519
|
+
interface RawReadOptions {
|
|
4520
|
+
/**
|
|
4521
|
+
* Map of output-key -> JS read type, applied to bigint columns read via raw SQL.
|
|
4522
|
+
* The caller declares provenance explicitly; dbsp does not infer it for arbitrary SQL.
|
|
4523
|
+
*/
|
|
4524
|
+
readonly bigintReads?: Readonly<Record<string, ColumnJsReadType$1>>;
|
|
4525
|
+
}
|
|
4478
4526
|
interface OrmInstance<DB = Record<string, unknown>> {
|
|
4479
4527
|
/**
|
|
4480
4528
|
* Type-safe table references for query building.
|
|
@@ -4624,6 +4672,26 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4624
4672
|
* The strict mode setting for this ORM instance.
|
|
4625
4673
|
*/
|
|
4626
4674
|
readonly strictMode: boolean;
|
|
4675
|
+
/**
|
|
4676
|
+
* Whether the connection backing this ORM instance is inside a transaction.
|
|
4677
|
+
*
|
|
4678
|
+
* Reflects the backing adapter's real transaction state: `true` inside a
|
|
4679
|
+
* {@link OrmInstance.transaction} callback, and also `true` for a top-level
|
|
4680
|
+
* instance built on an adapter that is ALREADY inside a caller-owned
|
|
4681
|
+
* transaction (e.g. a borrowed pg client mid-`BEGIN`); `false` otherwise.
|
|
4682
|
+
*
|
|
4683
|
+
* Callers use this to enforce a top-level precondition: an operation whose
|
|
4684
|
+
* effects a caller's outer rollback must not silently undo — DDL that cannot
|
|
4685
|
+
* be nested, or a process-level cache that would go stale if the surrounding
|
|
4686
|
+
* transaction rolls back — can fail closed when the connection is already in a
|
|
4687
|
+
* transaction instead of assuming it owns the top-level transaction.
|
|
4688
|
+
*
|
|
4689
|
+
* Optional for backward compatibility: instances produced by `createOrm`
|
|
4690
|
+
* always populate it, but a pre-existing hand-built `OrmInstance` double may
|
|
4691
|
+
* omit it (reads as `undefined`), so a fail-closed caller should treat a
|
|
4692
|
+
* non-`true` value it cannot confirm accordingly.
|
|
4693
|
+
*/
|
|
4694
|
+
readonly inTransaction?: boolean;
|
|
4627
4695
|
/**
|
|
4628
4696
|
* Create a schema-scoped ORM instance.
|
|
4629
4697
|
* All queries from the returned instance will include the schema prefix.
|
|
@@ -4731,7 +4799,17 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4731
4799
|
* });
|
|
4732
4800
|
* ```
|
|
4733
4801
|
*/
|
|
4734
|
-
transaction<T>(fn: (tx: OrmInstance<DB>) => Promise<T
|
|
4802
|
+
transaction<T>(fn: (tx: OrmInstance<DB>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
4803
|
+
/**
|
|
4804
|
+
* Execute a callback with all ORM work pinned to one physical database
|
|
4805
|
+
* connection for the callback lifetime, without opening a transaction.
|
|
4806
|
+
*
|
|
4807
|
+
* @typeParam T - The return type of the callback
|
|
4808
|
+
* @param fn - Async callback that receives a connection-pinned ORM instance
|
|
4809
|
+
* @param options - Optional pinned connection controls
|
|
4810
|
+
* @returns Promise resolving to the callback's return value
|
|
4811
|
+
*/
|
|
4812
|
+
withPinnedConnection<T>(fn: (pinned: OrmInstance<DB>) => Promise<T>, options?: PinnedConnectionOptions): Promise<T>;
|
|
4735
4813
|
/**
|
|
4736
4814
|
* NQL template tag for writing queries in Natural Query Language.
|
|
4737
4815
|
*
|
|
@@ -4755,9 +4833,10 @@ interface OrmInstance<DB = Record<string, unknown>> {
|
|
|
4755
4833
|
* @typeParam T - Expected result type (defaults to unknown)
|
|
4756
4834
|
* @param sql - Raw SQL string with parameter placeholders
|
|
4757
4835
|
* @param parameters - Parameter values for placeholders
|
|
4836
|
+
* @param options - Explicit raw read coercion options
|
|
4758
4837
|
* @returns Promise resolving to array of results
|
|
4759
4838
|
*/
|
|
4760
|
-
raw<T = unknown>(sql: string, parameters?: readonly unknown[]): Promise<T[]>;
|
|
4839
|
+
raw<T = unknown>(sql: string, parameters?: readonly unknown[], options?: RawReadOptions): Promise<T[]>;
|
|
4761
4840
|
/**
|
|
4762
4841
|
* Create a CTE (Common Table Expression) backed by unnest() arrays.
|
|
4763
4842
|
*
|
|
@@ -8016,4 +8095,4 @@ declare const assertIntentHasOrderBy: (result: AssertionQueryResult, expected: b
|
|
|
8016
8095
|
*/
|
|
8017
8096
|
declare function runAssertions(blocks: AssertionBlock[], results: AssertionQueryResult[], queries: string[], hasDb?: boolean): AssertionSummary;
|
|
8018
8097
|
|
|
8019
|
-
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, type TableAssertionData, type TableDDL, type TableDef, type TableIndexes, type TableMetaKey, TableNotFoundError, type TableRef, type TransactionCoordinatorBinding, type TransitionExecutionClient, type TransitionPack, type TransitionRelationalValidationInput, type TransitionRelationalValidationResult, type TraversalDirection, UnhandledTypeInDialect, UnknownDialectError, UnsafeOperationError, UnsupportedCapabilityError, UnsupportedFeatureError, UnsupportedStrategyError, UpdateBuilder, UpsertBuilder, type WarningCategory, type WhereFilter, WindowBuilder, advisoryObservationId, aggOrderBy, and, any, array, arrayAgg, assertCapability, 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, assumptionId, batchValues, capitalize, caseWhen, cast, checkDelta, chooseReadyCandidate, claimId, coalesce, col, composeAfterMutationHooks, composeAfterQueryHooks, composeBeforeMutationHooks, composeBeforeQueryHooks, composeOnErrorHooks, countDistinctRelationPathsByName, createApplier, createComparator, createDialectCapabilities, createEvidenceView, createHookManager, createNqlTag, createOrm, createPackRegistry, createProver, createPseudoColumnMetadata, createRawCteBuilder, createRecursiveMetadata, createStagedTransitionOrchestrator, decapitalize, 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, isAliasedColumn, isAllColumns, isBatchValuesRef, isCardinalityShorthand, isColumnRef, isDistinctField, isDistinctFrom, isExpressionSpec, isKnownDialect, isNotNull, isNull, isOperationRuntime, isOverallSuccess, isRecursiveIncludeOptions, isRecursiveRelation, isRef, isRelationObjectDef, isRelationRef, isRelationTupleDef, isSelfReferential, isSqlRaw, isSubqueryExpression, isTableRef, isWhereIntent, lag, lead, like, literal, lt, lte, namedArg, negotiateFeatures, neq, none, normalizeSQL, normalizedIndex, not, notExists, nqlRaw, objectToWhereIntent, op, or, outerRef, param, parseAssertionFile, parseRelationDef, parseRelationKey, pipeAfterMutationHooks, pipeAfterQueryHooks, pipeBeforeMutationHooks, pipeBeforeQueryHooks, pipeOnErrorHooks, plan, planRecursive, pluralize, preflightStagedComposition, projectCompareToSingleCandidate, 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, unary, validateAssertionBlocks, validateRecursiveInclude, validateRecursiveShape, validateSchemaIndexOptions, validateTransitionRelationalInvariants, validateTypeName, wAvg, wCount, wMax, wMin, wSum, withPriority };
|
|
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, TRANSITION_LESSOR_REJECTION, type TableAssertionData, type TableDDL, type TableDef, type TableIndexes, type TableMetaKey, TableNotFoundError, type TableRef, type TransactionCoordinatorBinding, type TransitionExecutionClient, type TransitionLeaseFailure, type TransitionPack, type TransitionRelationalValidationInput, type TransitionRelationalValidationResult, type TraversalDirection, UnhandledTypeInDialect, UnknownDialectError, UnsafeOperationError, UnsupportedCapabilityError, UnsupportedFeatureError, UnsupportedStrategyError, UpdateBuilder, UpsertBuilder, type WarningCategory, type WhereFilter, WindowBuilder, acquireTransitionLease, advisoryObservationId, aggOrderBy, and, any, array, arrayAgg, assertCapability, 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, assumptionId, batchValues, capitalize, caseWhen, cast, checkDelta, chooseReadyCandidate, claimId, coalesce, col, composeAfterMutationHooks, composeAfterQueryHooks, composeBeforeMutationHooks, composeBeforeQueryHooks, composeOnErrorHooks, countDistinctRelationPathsByName, createApplier, createComparator, createDialectCapabilities, createEvidenceView, createHookManager, createNqlTag, createOrm, createPackRegistry, createProver, createPseudoColumnMetadata, createRawCteBuilder, createRecursiveMetadata, createStagedTransitionOrchestrator, createTransitionLessor, decapitalize, 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, isAliasedColumn, isAllColumns, isBatchValuesRef, isCardinalityShorthand, isColumnRef, isDistinctField, isDistinctFrom, isExpressionSpec, isKnownDialect, isNotNull, isNull, isOperationRuntime, isOverallSuccess, isRecursiveIncludeOptions, isRecursiveRelation, isRef, isRelationObjectDef, isRelationRef, isRelationTupleDef, isSelfReferential, isSqlRaw, isSubqueryExpression, isTableRef, isTransitionLessor, isWhereIntent, lag, lead, like, literal, lt, lte, namedArg, negotiateFeatures, neq, none, normalizeSQL, normalizedIndex, not, notExists, nqlRaw, objectToWhereIntent, op, or, outerRef, param, parseAssertionFile, parseRelationDef, parseRelationKey, pipeAfterMutationHooks, pipeAfterQueryHooks, pipeBeforeMutationHooks, pipeBeforeQueryHooks, pipeOnErrorHooks, plan, planRecursive, pluralize, preflightStagedComposition, projectCompareToSingleCandidate, 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, unary, validateAssertionBlocks, validateRecursiveInclude, validateRecursiveShape, validateSchemaIndexOptions, validateTransitionRelationalInvariants, validateTypeName, wAvg, wCount, wMax, wMin, wSum, withPriority };
|