@dbsp/core 1.1.0 → 1.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 CHANGED
@@ -1,5 +1,5 @@
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, WhereIntent, OnDeleteAction, ModelIR, DbCasing, QueryIntent, PlanOptions, PlanReport, RecursiveIntent, RecursivePlanOptions, RecursivePlanReport, TableIR, EnumIR, SequenceIR, AmbiguityCheckResult, DialectCapabilities, DDLFeature, DDLFeatureVersionRange, ComparisonOperator, WhereSubqueryIntent, SubqueryRefIntent, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereRelationFilterIntent, RecursiveExistsOptions, WhereExistsIntent, WhereInIntent, WhereNullIntent, WhereLikeIntent, WhereNotIntent, WhereNotExistsIntent, WhereOrIntent, WhereRawExistsIntent, WhereRawNotExistsIntent, SelectIntent, IncludeIntent, AggregateIntent, OrderByIntent, SortDirection, InsertIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, Dump, SetOperationIntent, LockStrength, LockWaitPolicy, DumpMeta, JoinIntent, UnnestCteIntent, CteQueryIntent, CompileOptions, CompiledQuery, UpsertConflictTarget, UpsertConflictAction, RawCteIntent, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, IndexInfo, ExpressionIntent, WhereExpressionIntent, AggOrderByArg, RelationType as RelationType$1, Cardinality, FeatureWarning, UnsupportedFeatureBehavior, FeatureBehaviorConfig, RangeValue, WhereRangeIntent, SubqueryIncludeInfo } from '@dbsp/types';
2
+ import { PseudoColumnMetadata, RecursiveMetadata, RelationIR, RelationKind, AdapterCapabilities, Adapter, BaseAdapter, DDLGeneratingAdapter, ExecutingAdapter, IntrospectingAdapter, RawSqlAdapter, StreamingAdapter, TransactionalAdapter, ColumnType, WhereIntent, OnDeleteAction, ModelIR, DbCasing, QueryIntent, PlanOptions, PlanReport, RecursiveIntent, RecursivePlanOptions, RecursivePlanReport, TableIR, EnumIR, SequenceIR, AmbiguityCheckResult, DialectCapabilities, DDLFeature, DDLFeatureVersionRange, ComparisonOperator, WhereSubqueryIntent, SubqueryRefIntent, WhereAndIntent, WhereAnyIntent, WhereComparisonIntent, WhereRelationFilterIntent, RecursiveExistsOptions, WhereExistsIntent, WhereInIntent, WhereNullIntent, WhereLikeIntent, WhereNotIntent, WhereNotExistsIntent, WhereOrIntent, WhereRawExistsIntent, WhereRawNotExistsIntent, SelectIntent, IncludeIntent, AggregateIntent, OrderByIntent, SortDirection, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, Dump, SetOperationIntent, LockStrength, LockWaitPolicy, DumpMeta, JoinIntent, UnnestCteIntent, CteQueryIntent, CompileOptions, CompiledQuery, MutationIntent as MutationIntent$1, DumpSequenceStep, UpsertConflictTarget, UpsertConflictAction, RawCteIntent, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, IndexInfo, ExpressionIntent, WhereExpressionIntent, AggOrderByArg, RelationType as RelationType$1, Cardinality, FeatureWarning, UnsupportedFeatureBehavior, FeatureBehaviorConfig, RangeValue, WhereRangeIntent, SubqueryIncludeInfo } from '@dbsp/types';
3
3
  export { Adapter, AdapterCapabilities, AdapterLogger, AdapterStreamOptions, AdjacencyTraversal, AggregateExpressionIntent, AggregateFunction, AggregateIntent, AggregateWindowFunction, AliasIncludedColumnsMode, AlterColumnOptions, AmbiguityCheckResult, ArrayOperator, BaseAdapter, CTEDefinition, Cardinality, CaseExpressionIntent, CoalesceExpressionIntent, ColumnAliasIntent, ColumnExpressionIntent, ColumnIR, ColumnType, CommonColumnType, ComparisonExpressionIntent, ComparisonOperator, CompileOnlyAdapter, CompileOptions, CompileResultWithIncludes, CompiledQuery, CompilingAdapter, CreateIndexOptions, CustomTraversal, DDLGeneratingAdapter, DbCasing, DecisionType, DeleteIntent, DialectCapabilities, DialectName, DropIndexOptions, DuckDBColumnType, Dump, DumpMeta, EdgeTableTraversal, EmitJoinClause, ExecutingAdapter, ExpressionIntent, FilterStrategy, ForeignKeyIR, IncludeIntent, IncludeStrategy, IndexColumnDef, IndexIR, IndexInfo, IndexMethod, InsertFromIntent, InsertIntent, IntrospectingAdapter, IsTypeSupported, JoinDefault, JoinIntent, LiteralExpressionIntent, LogicalOperator, MSSQLColumnType, ModelIR, MutationIntent, MySQLColumnType, NullOperator, NullsPosition, OffsetWindowFunction, OnDeleteAction, Optionality, OrderByIntent, PartitionIR, PlanDecision, PlanOptions, PlanReport, PlanWarning, PlanWarningCode, PostgresColumnType, PostgresOnlyColumnType, PseudoColumnExpressionIntent, PseudoColumnMetadata, PseudoColumnTraversal, QueryIntent, RangeOperator, RangeValue, RankingWindowFunction, RawExpressionIntent, RawSqlAdapter, RecursiveAdvancedOptions, RecursiveDedupe, RecursiveDirection, RecursiveEmitOptions, RecursiveExistsOptions, RecursiveIntent, RecursiveMetadata, RecursiveNodeIdExpr, RecursivePlanOptions, RecursivePlanReport, RecursiveTrackOptions, RecursiveTraversal, RelationColumnIntent, RelationIR, RelationKind, RelationOperator, RelationType, ResolvedIncludeStrategy, SQLiteColumnType, ScalarSubqueryIntent, SelectAggregateIntent, SelectAllIntent, SelectFieldsIntent, SelectIntent, SelectWithExpressionsIntent, SortDirection, StreamingAdapter, StringOperator, SubqueryIncludeInfo, SubqueryRefIntent, SupportedColumnTypes, TableIR, TransactionalAdapter, 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
  import * as v from 'valibot';
@@ -3153,9 +3153,9 @@ type QueryHookContext = {
3153
3153
  };
3154
3154
  /** Union of all mutation intent types */
3155
3155
  /** Union of all mutation intent types */
3156
- type MutationIntent = InsertIntent | UpdateIntent | BatchUpdateIntent | DeleteIntent | UpsertIntent;
3156
+ type MutationIntent = InsertIntent | InsertFromIntent | UpdateIntent | BatchUpdateIntent | DeleteIntent | UpsertIntent | UpsertFromIntent;
3157
3157
  /** Mutation operation types */
3158
- type MutationOperation = 'insert' | 'update' | 'batchUpdate' | 'delete' | 'upsert';
3158
+ type MutationOperation = 'insert' | 'insert_from' | 'update' | 'batchUpdate' | 'delete' | 'upsert' | 'upsert_from';
3159
3159
  /**
3160
3160
  * Context passed to mutation hooks (beforeMutation/afterMutation).
3161
3161
  * Frozen via Object.freeze — hooks must return new objects to modify.
@@ -4635,12 +4635,11 @@ interface MutationDump {
4635
4635
  /** Bound parameter values */
4636
4636
  readonly parameters: readonly unknown[];
4637
4637
  /** The mutation intent */
4638
- readonly intent: InsertIntent | UpdateIntent | BatchUpdateIntent | DeleteIntent | UpsertIntent;
4638
+ readonly intent: MutationIntent$1;
4639
4639
  /** Optional metadata */
4640
- readonly meta?: {
4641
- readonly schema?: string;
4642
- readonly compiledAt?: Date;
4643
- };
4640
+ readonly meta?: DumpMeta;
4641
+ /** Compile-only statement sequence for multi-statement NQL programs. */
4642
+ readonly sequence?: readonly DumpSequenceStep[];
4644
4643
  }
4645
4644
  /** Shared base options for all mutation builders */
4646
4645
  type MutationBaseOpts = {
@@ -4684,11 +4683,7 @@ declare abstract class MutationBuilderBase<T, TIntent extends InsertIntent | Upd
4684
4683
  protected requireAdapter(operation: string): Adapter;
4685
4684
  dump(extraOptions?: CompileOptions): MutationDump;
4686
4685
  execute(): Promise<T>;
4687
- private executeWithoutHooks;
4688
- private executeWithHooks;
4689
- private executeWithHooksInner;
4690
- /** Extract cardinality and data from mutation intent */
4691
- private extractIntentData;
4686
+ private prepareMutationExecution;
4692
4687
  }
4693
4688
  /**
4694
4689
  * Builder for INSERT operations.
@@ -4933,14 +4928,16 @@ declare class UpsertBuilder<T = void> extends MutationBuilderBase<T, UpsertInten
4933
4928
  interface NqlBuilder<T> {
4934
4929
  /** Execute query and return all results */
4935
4930
  all(): Promise<T[]>;
4931
+ /** Execute query or mutation and discard any returned rows */
4932
+ run(): Promise<void>;
4936
4933
  /** Execute query and return first result or null */
4937
4934
  first(): Promise<T | null>;
4938
4935
  /** Get the IntentIR for debugging */
4939
- toIntentIR(): QueryIntent;
4936
+ toIntentIR(): QueryIntent | MutationIntent$1;
4940
4937
  /** Get the execution plan */
4941
4938
  plan(): PlanReport;
4942
- /** Get full dump (plan + SQL + params) */
4943
- dump(meta?: DumpMetaInput): Dump;
4939
+ /** Get full dump. Mutations return MutationDump without a plan. */
4940
+ dump(meta?: DumpMetaInput): Dump | MutationDump;
4944
4941
  }
4945
4942
  /**
4946
4943
  * NQL template tag function type.
@@ -4984,7 +4981,7 @@ declare function nqlRaw(fragment: string): NqlRawFragment;
4984
4981
  * @param schemaName - Optional schema name for multi-tenant queries
4985
4982
  * @returns NQL template tag function
4986
4983
  */
4987
- declare function createNqlTag(schemaDefinition: unknown, model: ModelIR, adapter?: Adapter<unknown>, schemaName?: string): NqlTag;
4984
+ declare function createNqlTag(_schemaDefinition: unknown, model: ModelIR, adapter?: Adapter<unknown>, schemaName?: string, hookStore?: HookStore, onHookError?: HookErrorHandler, inTransaction?: boolean): NqlTag;
4988
4985
  /**
4989
4986
  * Extract pseudo-column keywords from model configuration.
4990
4987
  * Collects all configured roles and recursive keywords from all tables'