@dbsp/core 6.3.0 → 7.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/{assertion-functions-dyf-Q__5.d.ts → assertion-functions-mGgbz4_k.d.ts} +53 -30
- package/dist/{chunk-5UI5IH5U.js → chunk-MVPSYATN.js} +177 -105
- package/dist/chunk-MVPSYATN.js.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5UI5IH5U.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _dbsp_types from '@dbsp/types';
|
|
2
|
-
import { REF_BRAND,
|
|
2
|
+
import { REF_BRAND, ColumnJsReadType as ColumnJsReadType$1, OnDeleteAction, ColumnType, WhereIntent, TableReaddressDeclaration, ModelIR, DbCasing, PlanOptions, PlanReport, RecursivePlanOptions, RecursivePlanReport, RangeAllocator, ResolvedRange, RelationIR, DialectCapabilities, ResolvedIncludeStrategy, ExclusiveTransitionTarget, TransitionSessionClient, TransitionLessor, TransitionQueryClient, ObservationContext, TransitionRunMetadata, TransitionRule, OperationSemantics, OperationKindRef, PhysicalOperation, EvidenceObservation, FingerprintManifest, ObservationIssuer, EquivalenceCapability, CapabilityDescriptor, TransitionCompositionFact, RuleRef, SemanticArtifactRef, DurableIntentRecord, OperationEffectAssessment, IssuedObservation, ApplyGuard, RecoveryArtefact, OperationExecutionOutcome, ManagedStepClaimMaterial, LedgerPayload, TransactionalCompletionRecord, StepJournal, TransitionRunJournal, ProvenPlanShape, ApplyPolicy, ResourceAddress, JsonValue as JsonValue$1, DeclarationSet, ApplicableAssessment, ApplyResult, ExecutionContract, DurableApplyOutcome, CompareOutcome, ProofClaim, PlanAssessment, InapplicableAssessment, TransactionBeginOptions, Dump, SortDirection, DumpMeta, Adapter, CompileOptions, CompiledQuery, DumpSequenceStep, EXPRESSION_BRAND, PREDICATE_BRAND } from '@dbsp/types';
|
|
3
3
|
import { QueryIntent, RecursiveIntent, IncludeIntent, WhereIntent as WhereIntent$1, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, SetOperationIntent, LockStrength, LockWaitPolicy, MutationIntent as MutationIntent$1, UpsertConflictTarget, UpsertConflictAction, CompileOnlyAdapter, ExpressionIntent, IncludeOrderByIntent, SelectIntent, ComparisonOperator, WhereSubqueryIntent, SubqueryRefIntent, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereRelationFilterIntent, RecursiveExistsOptions, WhereExistsIntent, WhereInIntent, WhereNullIntent, WhereLikeIntent, WhereNotIntent, WhereNotExistsIntent, WhereOrIntent, WhereRawExistsIntent, WhereRawNotExistsIntent, WhereExpressionIntent, StandaloneWhereExpressionIntent, AggOrderByArg, PredicateOperator } from '@dbsp/types/internal';
|
|
4
4
|
import { NqlCompilerOptions, CompiledNqlQuery } from '@dbsp/nql';
|
|
5
5
|
|
|
@@ -4445,25 +4445,15 @@ declare function sql(sqlFragment: string): SqlRawExpression;
|
|
|
4445
4445
|
declare function isSqlRaw(value: unknown): value is SqlRawExpression;
|
|
4446
4446
|
|
|
4447
4447
|
/**
|
|
4448
|
-
* Accepted input types for
|
|
4449
|
-
*
|
|
4450
|
-
* - `string` → implicitly converted to ref() (column reference)
|
|
4451
|
-
* - `number | boolean | readonly unknown[]` → implicitly converted to param() (bound value)
|
|
4448
|
+
* Accepted input types for fn() arguments: a {@link ReferenceLeaf}, or an
|
|
4449
|
+
* `aggOrderBy()` marker placing an ORDER BY entry inside an aggregate.
|
|
4452
4450
|
*
|
|
4453
|
-
*
|
|
4454
|
-
*
|
|
4451
|
+
* Every leaf follows the reference rule of `coerceReference`: a string is a
|
|
4452
|
+
* column, a finite number or boolean is inlined, an array or `Date` is bound,
|
|
4453
|
+
* an expression object is used as is. Use `literal()` for a string value and
|
|
4454
|
+
* `param()` to bind a value explicitly.
|
|
4455
4455
|
*/
|
|
4456
|
-
|
|
4457
|
-
* Accepted input types for op() and fn() arguments.
|
|
4458
|
-
* - `ExpressionRef` → used as-is
|
|
4459
|
-
* - `string` → implicitly converted to ref() (column reference)
|
|
4460
|
-
* - `number | boolean | readonly unknown[]` → implicitly converted to param() (bound value)
|
|
4461
|
-
* - `AggOrderByArg` → ORDER BY entry inside an aggregate (fn() only)
|
|
4462
|
-
*
|
|
4463
|
-
* Use `ref()` / `param()` explicitly for ambiguous cases (e.g., a string that is a value,
|
|
4464
|
-
* not a column name → use `literal()` instead).
|
|
4465
|
-
*/
|
|
4466
|
-
type ExprInput = ExpressionRef | ExpressionSpec | AggOrderByArg | string | number | boolean | readonly unknown[];
|
|
4456
|
+
type ExprInput = ReferenceLeaf | AggOrderByArg;
|
|
4467
4457
|
|
|
4468
4458
|
type BinaryPredicateOperator = Exclude<PredicateOperator, 'AND' | 'OR' | 'NOT'>;
|
|
4469
4459
|
type NonPredicateOperator<TOperator extends string> = TOperator extends PredicateOperator ? never : TOperator;
|
|
@@ -4570,17 +4560,20 @@ declare function ref(column: string): ExpressionRef;
|
|
|
4570
4560
|
declare function param(value: unknown): ExpressionRef;
|
|
4571
4561
|
/**
|
|
4572
4562
|
* Type cast — compiles to expr::typeName or CAST(expr AS typeName).
|
|
4563
|
+
* `expr` follows the reference-leaf rule: a string is a column.
|
|
4573
4564
|
*
|
|
4574
4565
|
* @example cast(param([0.1, 0.2]), 'vector') → $1::vector
|
|
4566
|
+
* @example cast('title', 'text') → CAST(title AS text)
|
|
4575
4567
|
* @throws Error if typeName fails validation (injection guard)
|
|
4576
4568
|
*/
|
|
4577
|
-
declare function cast(expr:
|
|
4569
|
+
declare function cast(expr: ReferenceLeaf, typeName: string): ExpressionRef;
|
|
4578
4570
|
/**
|
|
4579
4571
|
* Custom binary operator — left OP right.
|
|
4580
|
-
*
|
|
4572
|
+
* Leaves follow the reference rule: string → column, finite number/boolean → inlined constant,
|
|
4573
|
+
* non-finite number/array/Date → bound parameter, expression object → used as is.
|
|
4581
4574
|
*
|
|
4582
4575
|
* @example op('<=>', ref('embedding'), cast(param([0.1]), 'vector'))
|
|
4583
|
-
* @example op('<=>', 'embedding', [0.1, 0.2]) //
|
|
4576
|
+
* @example op('<=>', 'embedding', [0.1, 0.2]) // column <=> $1
|
|
4584
4577
|
* @throws Error if operator fails validation (injection guard)
|
|
4585
4578
|
*/
|
|
4586
4579
|
/** Logical AND / OR — both operands must be predicates. */
|
|
@@ -4588,9 +4581,9 @@ declare function op(operator: 'AND' | 'OR', left: PredicateRef, right: Predicate
|
|
|
4588
4581
|
/** Logical NOT — its sole operand must be a predicate. */
|
|
4589
4582
|
declare function op(operator: 'NOT', operand: PredicateRef): WhereOnlyPredicate;
|
|
4590
4583
|
/** Predicate binary operators accept expression operands. */
|
|
4591
|
-
declare function op(operator: BinaryPredicateOperator, left:
|
|
4584
|
+
declare function op(operator: BinaryPredicateOperator, left: ReferenceLeaf, right: ReferenceLeaf): ExpressionPredicateRef;
|
|
4592
4585
|
/** Any non-predicate operator remains an ordinary expression. */
|
|
4593
|
-
declare function op<TOperator extends string>(operator: NonPredicateOperator<TOperator>, left:
|
|
4586
|
+
declare function op<TOperator extends string>(operator: NonPredicateOperator<TOperator>, left: ReferenceLeaf, right: ReferenceLeaf): ExpressionRef;
|
|
4594
4587
|
/**
|
|
4595
4588
|
* Assert that an arbitrary expression is boolean for use in WHERE.
|
|
4596
4589
|
*
|
|
@@ -4601,7 +4594,8 @@ declare function unsafeAsPredicate(expr: ExpressionRef): PredicateExpressionRef;
|
|
|
4601
4594
|
/**
|
|
4602
4595
|
* Custom function call — name(args...).
|
|
4603
4596
|
* Supports schema-qualified names (e.g., 'paradedb.score', 'ST_Distance').
|
|
4604
|
-
*
|
|
4597
|
+
* Leaves follow the reference rule: string → column, finite number/boolean → inlined constant,
|
|
4598
|
+
* non-finite number/array/Date → bound parameter, expression object → used as is.
|
|
4605
4599
|
*
|
|
4606
4600
|
* @example fn('now') → now()
|
|
4607
4601
|
* @example fn('paradedb.score', ref('id')) → paradedb.score("id")
|
|
@@ -4610,7 +4604,8 @@ declare function unsafeAsPredicate(expr: ExpressionRef): PredicateExpressionRef;
|
|
|
4610
4604
|
/**
|
|
4611
4605
|
* Custom function call — name(args...).
|
|
4612
4606
|
* Supports schema-qualified names (e.g., 'paradedb.score', 'ST_Distance').
|
|
4613
|
-
*
|
|
4607
|
+
* Leaves follow the reference rule: string → column, finite number/boolean → inlined constant,
|
|
4608
|
+
* non-finite number/array/Date → bound parameter, expression object → used as is.
|
|
4614
4609
|
*
|
|
4615
4610
|
* Pass `aggOrderBy('col', 'asc')` args to add ORDER BY inside aggregates:
|
|
4616
4611
|
* `fn('array_agg', ref('name'), aggOrderBy('path'))` → array_agg("name" ORDER BY "path" ASC)
|
|
@@ -4655,7 +4650,7 @@ declare function literal(value: string | number | boolean | null): ExpressionRef
|
|
|
4655
4650
|
* @example unary('-', ref('score')) → -"score"
|
|
4656
4651
|
* @throws Error if operator fails validation (injection guard)
|
|
4657
4652
|
*/
|
|
4658
|
-
declare function unary(operator: string, expr:
|
|
4653
|
+
declare function unary(operator: string, expr: ReferenceLeaf): ExpressionRef;
|
|
4659
4654
|
/**
|
|
4660
4655
|
* Named argument for function calls: name => value.
|
|
4661
4656
|
* Use inside fn() args to produce PostgreSQL named-argument syntax.
|
|
@@ -4665,7 +4660,7 @@ declare function unary(operator: string, expr: ExprInput): ExpressionRef;
|
|
|
4665
4660
|
* @example namedArg('query_string', param('hello'))
|
|
4666
4661
|
* → query_string => $1
|
|
4667
4662
|
*/
|
|
4668
|
-
declare function namedArg(name: string, value:
|
|
4663
|
+
declare function namedArg(name: string, value: ReferenceLeaf): ExpressionRef;
|
|
4669
4664
|
/** SQL wildcard (*) — use in fn('count', star()) for COUNT(*) */
|
|
4670
4665
|
declare function star(): ExpressionRef;
|
|
4671
4666
|
/**
|
|
@@ -4674,7 +4669,7 @@ declare function star(): ExpressionRef;
|
|
|
4674
4669
|
* @example array(literal(1), literal(2), literal(3)) → ARRAY[1, 2, 3]
|
|
4675
4670
|
* @example array(ref('name'), ref('kind')) → ARRAY["name", "kind"]
|
|
4676
4671
|
*/
|
|
4677
|
-
declare function array(...items:
|
|
4672
|
+
declare function array(...items: ReferenceLeaf[]): ExpressionRef;
|
|
4678
4673
|
/**
|
|
4679
4674
|
* Creates an ORDER BY marker for use as an argument to `fn()`.
|
|
4680
4675
|
* When passed to `fn()`, the compiler places it in the aggregate's
|
|
@@ -4692,7 +4687,7 @@ declare function aggOrderBy(field: string, direction?: 'asc' | 'desc'): AggOrder
|
|
|
4692
4687
|
* @example arrayAgg('name', aggOrderBy('path', 'desc')) → array_agg("name" ORDER BY "path" DESC)
|
|
4693
4688
|
* @example arrayAgg(distinct('name')) → array_agg(DISTINCT name)
|
|
4694
4689
|
*/
|
|
4695
|
-
declare function arrayAgg(col:
|
|
4690
|
+
declare function arrayAgg(col: ReferenceLeaf | DistinctField, ...rest: AggOrderByArg[]): ExpressionRef;
|
|
4696
4691
|
/**
|
|
4697
4692
|
* Shorthand for `fn('string_agg', col, separator, ...orderByArgs)`.
|
|
4698
4693
|
*
|
|
@@ -4702,6 +4697,34 @@ declare function arrayAgg(col: ExpressionRef | string | DistinctField, ...rest:
|
|
|
4702
4697
|
*/
|
|
4703
4698
|
declare function stringAgg(col: ExpressionRef | string | DistinctField, separator: ExpressionRef, ...rest: AggOrderByArg[]): ExpressionRef;
|
|
4704
4699
|
|
|
4700
|
+
/**
|
|
4701
|
+
* @module coerce
|
|
4702
|
+
* The one leaf rule shared by the expression constructors (ADR 0011).
|
|
4703
|
+
*
|
|
4704
|
+
* A constructor first recognises its own grammar (names, operators, cast
|
|
4705
|
+
* types, `distinct()` and `aggOrderBy()` markers). Every scalar leaf left over
|
|
4706
|
+
* goes through {@link coerceReference}, which turns it into an expression
|
|
4707
|
+
* intent or refuses it by name. It never binds an expression object, a
|
|
4708
|
+
* builder, a `ColumnRef`, an `outerRef()`, a `sql()` marker or a plain object
|
|
4709
|
+
* as a parameter value.
|
|
4710
|
+
*/
|
|
4711
|
+
|
|
4712
|
+
/**
|
|
4713
|
+
* A scalar argument of an expression constructor (`fn`, `boolFn`, `op`,
|
|
4714
|
+
* `unary`, `namedArg`, `array`, `cast`, `arrayAgg`, CASE results).
|
|
4715
|
+
*
|
|
4716
|
+
* - a string is a column;
|
|
4717
|
+
* - a finite number, a boolean, or a `bigint` within the safe-integer range
|
|
4718
|
+
* is an inlined constant;
|
|
4719
|
+
* - a non-finite number, a `bigint` outside that range, an array or a `Date`
|
|
4720
|
+
* is a bound parameter;
|
|
4721
|
+
* - an expression object (`ExpressionRef`, `ExpressionSpec`, `ColumnRef`,
|
|
4722
|
+
* `SubqueryExpression`, schema `ref()`) is used as is.
|
|
4723
|
+
*
|
|
4724
|
+
* Use `literal()`, `param()` or `exprRef()` to force a position.
|
|
4725
|
+
*/
|
|
4726
|
+
type ReferenceLeaf = string | number | boolean | bigint | Date | readonly unknown[] | ExpressionRef | ExpressionSpec | ColumnRef<string, string, unknown> | SubqueryExpression | RefDefinition;
|
|
4727
|
+
|
|
4705
4728
|
/**
|
|
4706
4729
|
* Assertion Parser for .assert.dbsp files.
|
|
4707
4730
|
*
|
|
@@ -4976,4 +4999,4 @@ declare const assertIntentHasWhere: (result: AssertionQueryResult, expected: boo
|
|
|
4976
4999
|
declare const assertIntentHasGroupBy: (result: AssertionQueryResult, expected: boolean) => AssertionOutcome;
|
|
4977
5000
|
declare const assertIntentHasOrderBy: (result: AssertionQueryResult, expected: boolean) => AssertionOutcome;
|
|
4978
5001
|
|
|
4979
|
-
export { type
|
|
5002
|
+
export { type Assertion as $, type AliasedExprColumn as A, type BatchValuesRef as B, type ColumnSpec as C, type DefaultFilters as D, ExpressionRef as E, type PredicateExpressionRef as F, type AssertionBlock as G, type HookStore as H, type IncludeOptionsWithRecursive as I, type AssertionQueryResult as J, type AssertionSummary as K, type ListHierarchyOptions as L, type HookManager as M, type NullsPosition as N, type ObserverErrorHandler as O, PackRegistry as P, type QueryBuilder as Q, type RecursiveIncludeOptions as R, type StreamOptions as S, type TransitionRunPersister as T, UpdateBuilder as U, type AfterMutationHook as V, type WhereFilter as W, type AfterMutationObserver as X, type AfterQueryHook as Y, type AfterQueryObserver as Z, AmbiguousPlanError as _, type HookErrorHandler as a, isRef as a$, type AssertionOutcome as a0, type BeforeMutationHook as a1, type BeforeQueryHook as a2, type ColumnDef as a3, type IncludeOptions as a4, type IntentSummary as a5, type JsonValue as a6, type ManyToManyDefinition as a7, type ManyToManyOptions as a8, type MutationDump as a9, assertEquals as aA, assertParamsEquals as aB, assertParamsType as aC, assertSQLEquals as aD, batchValues as aE, boolFn as aF, cast as aG, coalesce as aH, col as aI, createHookManager as aJ, distinct as aK, eq as aL, every as aM, exists as aN, ref as aO, extractPseudoColumnKeywords as aP, fn as aQ, getSchemaFromDb as aR, gt as aS, gte as aT, inArray as aU, inSubquery as aV, isBatchValuesRef as aW, isDistinctFrom as aX, isNotNull as aY, isNull as aZ, isOperationRuntime as a_, type MutationHookContext as aa, type NqlBuilder as ab, type OnErrorHook as ac, POSTGRESQL_CAPABILITIES as ad, type ParseError as ae, type ParseResult as af, type QueryAssertionResult as ag, type QueryHookContext as ah, type RefOptions as ai, type RelationRef as aj, type SchemaColumnType as ak, type SchemaIndexOptions as al, type SchemaOptions as am, type SchemaTableOptions as an, type SelfRefRoles as ao, type SqlRawExpression as ap, SubqueryBuilder as aq, SubqueryExpression as ar, TABLE_META as as, type TableDef as at, admitRecordedIdentity as au, aggOrderBy as av, and as aw, any as ax, array as ay, arrayAgg as az, type RelationHints as b, assertIntentHasOrderBy as b$, isSqlRaw as b0, like as b1, literal as b2, lt as b3, lte as b4, manyToMany as b5, namedArg as b6, neq as b7, none as b8, not as b9, type DurablyLoadedRun as bA, type ExecutionCoordinator as bB, MSSQL_CAPABILITIES as bC, MYSQL_CAPABILITIES as bD, type ManagedOutcomeExecutionRequest as bE, type ManagedOutcomePreflightRequest as bF, type NonRollbackableExecutionTracker as bG, type PlanScope as bH, type RefDefinition as bI, type RegisteredOperationSemantics as bJ, SQLITE_CAPABILITIES as bK, TRANSITION_LESSOR_REJECTION as bL, type TransitionExecutionClient as bM, type TransitionLeaseFailure as bN, type TransitionPack as bO, acquireExclusiveTransitionLease as bP, acquireTransitionLease as bQ, acquireTransitionTargetLease as bR, assertCanonicalizableJson as bS, assertContains as bT, assertDbColumnExists as bU, assertDbOutput as bV, assertDbRowsEquals as bW, assertDbRowsMax as bX, assertDbRowsMin as bY, assertDbValueEquals as bZ, assertIntentHasGroupBy as b_, notExists as ba, nqlRaw as bb, op as bc, or as bd, outerRef as be, param as bf, parseAssertionFile as bg, plan as bh, planRecursive as bi, raw as bj, rawExists as bk, ref$1 as bl, relationColumn as bm, schema as bn, some as bo, sql as bp, star as bq, subquery as br, unary as bs, unsafeAsPredicate as bt, validateAssertionBlocks as bu, type Applier as bv, type InProcessProvenPlan as bw, type Prover as bx, ASSERTION_TYPES as by, DUCKDB_CAPABILITIES as bz, type AggregateOptions as c, assertIntentHasWhere as c0, assertIntentTable as c1, assertIntentType as c2, assertIntentWith as c3, assertMatches as c4, assertParamsLength as c5, assertParamsValue as c6, assertSQLColumn as c7, assertSQLJoin as c8, assertSQLTable as c9, transitionPhysicalSessionIsCompromised as cA, validateDeclarationModel as cB, validateIncludeInput as cC, validateIncludeOptions as cD, validateIncludeOrdering as cE, validateIncludeStrategy as cF, validateRecursiveIncludeStrategy as cG, validateRecursiveSetOperation as cH, validateResolvedIncludeStrategy as cI, validateSchemaIndexOptions as cJ, validateTypeName as cK, assertSuccess as ca, bindDeclarationSet as cb, compileNqlRead as cc, createBindingFinalPlan as cd, createExclusiveTransitionTarget as ce, createPackRegistry as cf, createTransitionLessor as cg, declarationSetFromModel as ch, isDurablyLoadedRun as ci, isExclusiveTransitionTarget as cj, isExpressionSpec as ck, isOverallSuccess as cl, isTransitionLessor as cm, isWhereIntent as cn, loadVerifiedRecoveryJournal as co, markTransitionClientCompromised as cp, mintDurablyLoadedRun as cq, normalizeRecursiveIncludeOptions as cr, objectToWhereIntent as cs, planInScope as ct, planOperationSession as cu, rawNotExists as cv, requiresDatabase as cw, resolveQueryIndex as cx, serverVersionNum as cy, stringAgg as cz, type DistinctField as d, type OrderByRecord as e, type OrderBySpec as f, type ExpressionSpec as g, type PredicateRef as h, type DumpMetaInput as i, type PaginateOptions as j, type PaginatedResult as k, type CursorPaginateOptions as l, type CursorPaginatedResult as m, type SetOperationBuilder as n, type TableRef as o, type ColumnRef as p, InsertBuilder as q, DeleteBuilder as r, UpsertBuilder as s, type InferTableRow as t, type NqlTag as u, type BatchValuesOptions as v, type Schema as w, type SchemaDefinition as x, type InferDB as y, type ReferenceLeaf as z };
|