@quereus/quereus 0.2.0 → 0.2.1

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.
Files changed (43) hide show
  1. package/dist/src/common/types.d.ts +1 -0
  2. package/dist/src/common/types.d.ts.map +1 -1
  3. package/dist/src/index.d.ts +1 -1
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/parser/ast.d.ts +1 -2
  6. package/dist/src/parser/ast.d.ts.map +1 -1
  7. package/dist/src/parser/parser.js.map +1 -1
  8. package/dist/src/planner/building/constraint-builder.d.ts +2 -2
  9. package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
  10. package/dist/src/planner/building/constraint-builder.js.map +1 -1
  11. package/dist/src/planner/building/delete.js +3 -3
  12. package/dist/src/planner/building/delete.js.map +1 -1
  13. package/dist/src/planner/building/insert.js +3 -3
  14. package/dist/src/planner/building/insert.js.map +1 -1
  15. package/dist/src/planner/building/update.js +4 -4
  16. package/dist/src/planner/building/update.js.map +1 -1
  17. package/dist/src/planner/nodes/constraint-check-node.d.ts +3 -3
  18. package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
  19. package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
  20. package/dist/src/planner/nodes/dml-executor-node.d.ts +1 -1
  21. package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
  22. package/dist/src/runtime/emit/constraint-check.js +2 -2
  23. package/dist/src/runtime/emit/constraint-check.js.map +1 -1
  24. package/dist/src/schema/table.d.ts +4 -4
  25. package/dist/src/schema/table.d.ts.map +1 -1
  26. package/dist/src/schema/table.js +10 -10
  27. package/dist/src/schema/table.js.map +1 -1
  28. package/dist/src/vtab/table.d.ts +1 -1
  29. package/dist/src/vtab/table.d.ts.map +1 -1
  30. package/package.json +2 -2
  31. package/src/common/types.ts +1 -0
  32. package/src/index.ts +1 -1
  33. package/src/parser/ast.ts +1 -4
  34. package/src/parser/parser.ts +5 -5
  35. package/src/planner/building/constraint-builder.ts +3 -3
  36. package/src/planner/building/delete.ts +3 -3
  37. package/src/planner/building/insert.ts +3 -3
  38. package/src/planner/building/update.ts +4 -4
  39. package/src/planner/nodes/constraint-check-node.ts +2 -2
  40. package/src/planner/nodes/dml-executor-node.ts +1 -1
  41. package/src/runtime/emit/constraint-check.ts +2 -2
  42. package/src/schema/table.ts +8 -8
  43. package/src/vtab/table.ts +1 -1
@@ -11,7 +11,7 @@ import { RegisteredScope } from '../scopes/registered.js';
11
11
  import { ColumnReferenceNode } from '../nodes/reference.js';
12
12
  import { SinkNode } from '../nodes/sink-node.js';
13
13
  import { ConstraintCheckNode } from '../nodes/constraint-check-node.js';
14
- import { RowOp } from '../../schema/table.js';
14
+ import { RowOpFlag } from '../../schema/table.js';
15
15
  import { ReturningNode } from '../nodes/returning-node.js';
16
16
  import { buildOldNewRowDescriptors } from '../../util/row-descriptor.js';
17
17
  import { DmlExecutorNode } from '../nodes/dml-executor-node.js';
@@ -74,7 +74,7 @@ export function buildDeleteStmt(
74
74
  const constraintChecks = buildConstraintChecks(
75
75
  deleteCtx,
76
76
  tableReference.tableSchema,
77
- RowOp.DELETE,
77
+ RowOpFlag.DELETE,
78
78
  oldAttributes,
79
79
  newAttributes,
80
80
  flatRowDescriptor
@@ -85,7 +85,7 @@ export function buildDeleteStmt(
85
85
  deleteCtx.scope,
86
86
  sourceNode,
87
87
  tableReference,
88
- RowOp.DELETE,
88
+ RowOpFlag.DELETE,
89
89
  oldRowDescriptor,
90
90
  newRowDescriptor,
91
91
  flatRowDescriptor,
@@ -16,7 +16,7 @@ import { RegisteredScope } from '../scopes/registered.js';
16
16
  import { ColumnReferenceNode } from '../nodes/reference.js';
17
17
  import { SinkNode } from '../nodes/sink-node.js';
18
18
  import { ConstraintCheckNode } from '../nodes/constraint-check-node.js';
19
- import { RowOp } from '../../schema/table.js';
19
+ import { RowOpFlag } from '../../schema/table.js';
20
20
  import { ReturningNode } from '../nodes/returning-node.js';
21
21
  import { ProjectNode, type Projection } from '../nodes/project-node.js';
22
22
  import { buildOldNewRowDescriptors } from '../../util/row-descriptor.js';
@@ -248,7 +248,7 @@ export function buildInsertStmt(
248
248
  const constraintChecks = buildConstraintChecks(
249
249
  ctx,
250
250
  tableReference.tableSchema,
251
- RowOp.INSERT,
251
+ RowOpFlag.INSERT,
252
252
  oldAttributes,
253
253
  newAttributes,
254
254
  flatRowDescriptor
@@ -266,7 +266,7 @@ export function buildInsertStmt(
266
266
  ctx.scope,
267
267
  insertNode,
268
268
  tableReference,
269
- RowOp.INSERT,
269
+ RowOpFlag.INSERT,
270
270
  oldRowDescriptor,
271
271
  newRowDescriptor,
272
272
  flatRowDescriptor,
@@ -12,7 +12,7 @@ import { RegisteredScope } from '../scopes/registered.js';
12
12
  import { ColumnReferenceNode } from '../nodes/reference.js';
13
13
  import { SinkNode } from '../nodes/sink-node.js';
14
14
  import { ConstraintCheckNode } from '../nodes/constraint-check-node.js';
15
- import { RowOp } from '../../schema/table.js';
15
+ import { RowOpFlag } from '../../schema/table.js';
16
16
  import { ReturningNode } from '../nodes/returning-node.js';
17
17
  import { buildOldNewRowDescriptors } from '../../util/row-descriptor.js';
18
18
  import { buildConstraintChecks } from './constraint-builder.js';
@@ -83,7 +83,7 @@ export function buildUpdateStmt(
83
83
  const constraintChecks = buildConstraintChecks(
84
84
  updateCtx,
85
85
  tableReference.tableSchema,
86
- RowOp.UPDATE,
86
+ RowOpFlag.UPDATE,
87
87
  oldAttributes,
88
88
  newAttributes,
89
89
  flatRowDescriptor
@@ -216,7 +216,7 @@ export function buildUpdateStmt(
216
216
  updateCtx.scope,
217
217
  updateNodeWithDescriptor,
218
218
  tableReference,
219
- RowOp.UPDATE,
219
+ RowOpFlag.UPDATE,
220
220
  oldRowDescriptor,
221
221
  newRowDescriptor,
222
222
  flatRowDescriptor,
@@ -252,7 +252,7 @@ export function buildUpdateStmt(
252
252
  updateCtx.scope,
253
253
  updateNode,
254
254
  tableReference,
255
- RowOp.UPDATE,
255
+ RowOpFlag.UPDATE,
256
256
  oldRowDescriptor,
257
257
  newRowDescriptor,
258
258
  flatRowDescriptor,
@@ -3,7 +3,7 @@ import { PlanNode, type RelationalPlanNode, type Attribute, type RowDescriptor,
3
3
  import { PlanNodeType } from './plan-node-type.js';
4
4
  import type { TableReferenceNode } from './reference.js';
5
5
  import type { RelationType } from '../../common/datatype.js';
6
- import type { RowOp } from '../../schema/table.js';
6
+ import type { RowOpFlag } from '../../schema/table.js';
7
7
  import type { RowConstraintSchema } from '../../schema/table.js';
8
8
 
9
9
  export interface ConstraintCheck {
@@ -22,7 +22,7 @@ export class ConstraintCheckNode extends PlanNode implements RelationalPlanNode
22
22
  scope: Scope,
23
23
  public readonly source: RelationalPlanNode,
24
24
  public readonly table: TableReferenceNode,
25
- public readonly operation: RowOp,
25
+ public readonly operation: RowOpFlag,
26
26
  public readonly oldRowDescriptor: RowDescriptor | undefined,
27
27
  public readonly newRowDescriptor: RowDescriptor | undefined,
28
28
  public readonly flatRowDescriptor: RowDescriptor,
@@ -4,7 +4,7 @@ import { PlanNodeType } from './plan-node-type.js';
4
4
  import type { TableReferenceNode } from './reference.js';
5
5
  import type { RelationType } from '../../common/datatype.js';
6
6
  import type { ConflictResolution } from '../../common/constants.js';
7
- import { RowOp } from '../../parser/ast.js';
7
+ import { RowOp } from '../../common/types.js';
8
8
 
9
9
  /**
10
10
  * Executes actual database insert/update/delete operations after constraint validation.
@@ -6,7 +6,7 @@ import { emitPlanNode, emitCallFromPlan } from '../emitters.js';
6
6
  import { QuereusError } from '../../common/errors.js';
7
7
  import { StatusCode, type SqlValue, type OutputValue } from '../../common/types.js';
8
8
  import type { RowConstraintSchema, TableSchema } from '../../schema/table.js';
9
- import { RowOp } from '../../schema/table.js';
9
+ import { RowOpFlag } from '../../schema/table.js';
10
10
  import { withAsyncRowContext } from '../context-helpers.js';
11
11
 
12
12
  export function emitConstraintCheck(plan: ConstraintCheckNode, ctx: EmissionContext): Instruction {
@@ -82,7 +82,7 @@ async function checkNotNullConstraints(
82
82
  // For INSERT operations, check NOT NULL on NEW values
83
83
  // For UPDATE operations, check NOT NULL on NEW values
84
84
  // DELETE operations don't need NOT NULL checks
85
- if (plan.operation === RowOp.DELETE) {
85
+ if (plan.operation === RowOpFlag.DELETE) {
86
86
  return;
87
87
  }
88
88
 
@@ -4,7 +4,7 @@ import { MemoryTableModule } from '../vtab/memory/module.js';
4
4
  import type { Expression } from '../parser/ast.js';
5
5
  import { type ColumnDef, type TableConstraint } from '../parser/ast.js';
6
6
  import { getAffinity } from '../common/type-inference.js';
7
- import { SqlDataType, StatusCode, type SqlValue } from '../common/types.js';
7
+ import { RowOp, SqlDataType, StatusCode, type SqlValue } from '../common/types.js';
8
8
  import type * as AST from '../parser/ast.js';
9
9
  import { quereusError, QuereusError } from '../common/errors.js';
10
10
  import { createLogger } from '../common/logger.js';
@@ -214,13 +214,13 @@ export function createBasicSchema(name: string, columns: { name: string, type: s
214
214
  }
215
215
 
216
216
  /** Bitmask for row operations */
217
- export const enum RowOp {
217
+ export const enum RowOpFlag {
218
218
  INSERT = 1,
219
219
  UPDATE = 2,
220
220
  DELETE = 4
221
221
  }
222
- export type RowOpMask = RowOp;
223
- export const DEFAULT_ROWOP_MASK = RowOp.INSERT | RowOp.UPDATE;
222
+ export type RowOpMask = RowOpFlag;
223
+ export const DEFAULT_ROWOP_MASK = RowOpFlag.INSERT | RowOpFlag.UPDATE;
224
224
 
225
225
  /**
226
226
  * Converts an array of row operations to a bitmask
@@ -228,16 +228,16 @@ export const DEFAULT_ROWOP_MASK = RowOp.INSERT | RowOp.UPDATE;
228
228
  * @param list Optional array of operation types
229
229
  * @returns A bitmask representing the operations
230
230
  */
231
- export function opsToMask(list?: AST.RowOp[]): RowOpMask {
231
+ export function opsToMask(list?: RowOp[]): RowOpMask {
232
232
  if (!list || list.length === 0) {
233
233
  return DEFAULT_ROWOP_MASK;
234
234
  }
235
235
  let mask: RowOpMask = 0 as RowOpMask;
236
236
  list.forEach(op => {
237
237
  switch (op) {
238
- case 'insert': mask |= RowOp.INSERT; break;
239
- case 'update': mask |= RowOp.UPDATE; break;
240
- case 'delete': mask |= RowOp.DELETE; break;
238
+ case 'insert': mask |= RowOpFlag.INSERT; break;
239
+ case 'update': mask |= RowOpFlag.UPDATE; break;
240
+ case 'delete': mask |= RowOpFlag.DELETE; break;
241
241
  }
242
242
  });
243
243
  return mask;
package/src/vtab/table.ts CHANGED
@@ -4,7 +4,7 @@ import type { TableSchema } from '../schema/table.js';
4
4
  import type { MaybePromise, Row } from '../common/types.js';
5
5
  import type { IndexSchema } from '../schema/table.js';
6
6
  import type { FilterInfo } from './filter-info.js';
7
- import type { RowOp } from '../parser/ast.js';
7
+ import type { RowOp } from '../common/types.js';
8
8
  import type { VirtualTableConnection } from './connection.js';
9
9
 
10
10
  /**