@minnowdb/core 0.6.9 → 0.7.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 (103) hide show
  1. package/dist/block-format/block.js +254 -325
  2. package/dist/block-format/checksum.js +30 -52
  3. package/dist/block-format/codecs.js +112 -125
  4. package/dist/block-format/column.js +187 -205
  5. package/dist/block-format/index.js +5 -1
  6. package/dist/block-format/physical.js +371 -387
  7. package/dist/block-format/types.js +4 -1
  8. package/dist/block-format/unicode.js +30 -39
  9. package/dist/date-value.d.ts +5 -0
  10. package/dist/date-value.js +71 -41
  11. package/dist/engine/artifact-cache.js +106 -116
  12. package/dist/engine/batch.js +36 -44
  13. package/dist/engine/buffered-writer.js +156 -158
  14. package/dist/engine/byte-estimates.js +20 -22
  15. package/dist/engine/cache-limits.js +24 -25
  16. package/dist/engine/cancellation.js +5 -3
  17. package/dist/engine/catalog.js +64 -73
  18. package/dist/engine/client.js +715 -780
  19. package/dist/engine/database.js +15952 -18465
  20. package/dist/engine/defaults.js +104 -111
  21. package/dist/engine/errors.js +113 -128
  22. package/dist/engine/fts.js +233 -280
  23. package/dist/engine/group-index.js +287 -321
  24. package/dist/engine/index.js +23 -12
  25. package/dist/engine/join-index.js +177 -186
  26. package/dist/engine/keyed-live.js +168 -173
  27. package/dist/engine/live-api.js +0 -1
  28. package/dist/engine/live-equal.js +32 -37
  29. package/dist/engine/live.js +603 -647
  30. package/dist/engine/memory.js +109 -111
  31. package/dist/engine/optimizer.d.ts +19 -1
  32. package/dist/engine/optimizer.js +2642 -2515
  33. package/dist/engine/point-read.d.ts +4 -2
  34. package/dist/engine/point-read.js +121 -171
  35. package/dist/engine/query-api.js +12 -3
  36. package/dist/engine/query-cache.js +61 -69
  37. package/dist/engine/query.d.ts +45 -0
  38. package/dist/engine/query.js +8506 -9375
  39. package/dist/engine/result-wire.js +221 -252
  40. package/dist/engine/schema-wire.js +97 -112
  41. package/dist/engine/schema.js +1099 -1254
  42. package/dist/engine/sort-keys.js +315 -389
  43. package/dist/engine/sql-domains.d.ts +7 -1
  44. package/dist/engine/sql-domains.js +648 -734
  45. package/dist/engine/sql-driver.js +0 -1
  46. package/dist/engine/sql-functions.d.ts +11 -0
  47. package/dist/engine/sql-functions.js +1092 -0
  48. package/dist/engine/sql-json.js +199 -218
  49. package/dist/engine/sql-semantics.d.ts +25 -4
  50. package/dist/engine/sql-semantics.js +579 -513
  51. package/dist/engine/typed-live.js +271 -293
  52. package/dist/engine/vector.d.ts +7 -1
  53. package/dist/engine/vector.js +4513 -4580
  54. package/dist/engine/worker-host.d.ts +8 -63
  55. package/dist/engine/worker-host.js +28 -1130
  56. package/dist/engine/worker-indexeddb.d.ts +1 -0
  57. package/dist/engine/worker-indexeddb.js +3 -0
  58. package/dist/engine/worker-memory.d.ts +1 -0
  59. package/dist/engine/worker-memory.js +3 -0
  60. package/dist/engine/worker-opfs.d.ts +1 -0
  61. package/dist/engine/worker-opfs.js +3 -0
  62. package/dist/engine/worker-server.d.ts +93 -0
  63. package/dist/engine/worker-server.js +999 -0
  64. package/dist/engine/worker-store-indexeddb.d.ts +2 -0
  65. package/dist/engine/worker-store-indexeddb.js +11 -0
  66. package/dist/engine/worker-store-memory.d.ts +2 -0
  67. package/dist/engine/worker-store-memory.js +6 -0
  68. package/dist/engine/worker-store-opfs.d.ts +2 -0
  69. package/dist/engine/worker-store-opfs.js +9 -0
  70. package/dist/engine/worker.js +0 -12
  71. package/dist/engine/write-block-planner.js +93 -100
  72. package/dist/plan/index.js +15 -16
  73. package/dist/plan/model.d.ts +9 -1
  74. package/dist/plan/model.js +20 -27
  75. package/dist/storage/index.js +0 -12
  76. package/dist/storage/indexeddb.js +11776 -13171
  77. package/dist/storage/memory.js +1198 -1241
  78. package/dist/storage/opfs/files.js +238 -295
  79. package/dist/storage/opfs/index.js +9 -3
  80. package/dist/storage/opfs/leader.js +4386 -4856
  81. package/dist/storage/opfs/rpc.js +223 -259
  82. package/dist/storage/opfs/snapshot-ledger.js +219 -260
  83. package/dist/storage/opfs/store.js +884 -1003
  84. package/dist/storage/persistence.js +59 -74
  85. package/dist/storage/snapshot-stream.js +788 -826
  86. package/dist/storage/snapshot.js +36 -37
  87. package/dist/storage/toolkit/extents.js +444 -520
  88. package/dist/storage/toolkit/index.js +28 -29
  89. package/dist/storage/toolkit/record-core.js +5792 -6377
  90. package/dist/storage/toolkit/sync-file.js +34 -42
  91. package/dist/storage/toolkit/wal.js +92 -127
  92. package/dist/storage/toolkit/wire.js +232 -256
  93. package/dist/storage/types.js +2952 -3228
  94. package/dist/testing/block-store-conformance.js +1556 -1629
  95. package/dist/testing/index.js +310 -291
  96. package/dist/testing/opfs-shim.js +280 -312
  97. package/dist/testing/simulator.js +496 -534
  98. package/dist/testing/sqllogictest.js +425 -365
  99. package/dist/transactions/index.js +1464 -1712
  100. package/dist/worker-protocol/index.js +70 -69
  101. package/package.json +20 -2
  102. package/postgres-feature-profile.json +15 -5
  103. package/sql-feature-matrix.json +252 -2
@@ -1,122 +1,115 @@
1
- /**
2
- * Write-time default filling. Only an omitted property or SQL `DEFAULT` means "generate";
3
- * explicit NULL passes through untouched. Literal and SQL-expression defaults are filled before
4
- * validation. Auto-increment slots stay null until the write path atomically reserves a range.
5
- */
6
1
  import { copyDate } from "../date-value.js";
7
- export async function fillColumnDefaults(table, input, evaluateExpression, knownRowCount) {
8
- const rowCount = knownRowCount ?? Object.values(input.columns).find((values) => values.length > 0)?.length ?? 0;
9
- if (!Number.isSafeInteger(rowCount) || rowCount < 0) {
10
- throw new TypeError(`Batch row count must be a non-negative safe integer: ${String(rowCount)}`);
2
+ async function fillColumnDefaults(table, input, evaluateExpression, knownRowCount) {
3
+ const rowCount = knownRowCount ?? Object.values(input.columns).find((values) => values.length > 0)?.length ?? 0;
4
+ if (!Number.isSafeInteger(rowCount) || rowCount < 0) {
5
+ throw new TypeError(`Batch row count must be a non-negative safe integer: ${String(rowCount)}`);
6
+ }
7
+ for (const [name, values] of Object.entries(input.columns)) {
8
+ if (values.length !== rowCount) {
9
+ throw new TypeError(`Column ${name} has ${String(values.length)} rows; expected ${String(rowCount)}`);
11
10
  }
12
- for (const [name, values] of Object.entries(input.columns)) {
13
- if (values.length !== rowCount) {
14
- throw new TypeError(`Column ${name} has ${String(values.length)} rows; expected ${String(rowCount)}`);
15
- }
11
+ }
12
+ if (rowCount === 0)
13
+ return { batch: input, generated: /* @__PURE__ */ new Map() };
14
+ const columns = { ...input.columns };
15
+ const generated = /* @__PURE__ */ new Map();
16
+ let autoIncrement;
17
+ for (const [name, mask] of Object.entries(input.omitted ?? {})) {
18
+ if (!table.columns.some((column) => column.name === name)) {
19
+ throw new TypeError(`Unknown column in omission mask: ${name}`);
16
20
  }
17
- if (rowCount === 0)
18
- return { batch: input, generated: new Map() };
19
- const columns = { ...input.columns };
20
- const generated = new Map();
21
- let autoIncrement;
22
- for (const [name, mask] of Object.entries(input.omitted ?? {})) {
23
- if (!table.columns.some((column) => column.name === name)) {
24
- throw new TypeError(`Unknown column in omission mask: ${name}`);
25
- }
26
- if (mask.length !== rowCount) {
27
- throw new TypeError(`Omission mask ${name} has ${String(mask.length)} rows; expected ${String(rowCount)}`);
28
- }
29
- if (mask.some((value) => typeof value !== "boolean")) {
30
- throw new TypeError(`Omission mask ${name} must contain booleans`);
31
- }
21
+ if (mask.length !== rowCount) {
22
+ throw new TypeError(`Omission mask ${name} has ${String(mask.length)} rows; expected ${String(rowCount)}`);
32
23
  }
33
- for (const column of table.columns) {
34
- const defaultValue = column.defaultValue;
35
- const provided = input.columns[column.name];
36
- const omitted = input.omitted?.[column.name];
37
- const isOmitted = (index) => provided === undefined || omitted?.[index] === true;
38
- if (column.generatedValue !== undefined) {
39
- if (provided !== undefined) {
40
- for (let index = 0; index < rowCount; index += 1) {
41
- if (!isOmitted(index)) {
42
- throw new TypeError(`Generated column cannot be assigned: ${column.name}`);
43
- }
44
- }
45
- }
46
- columns[column.name] = new Array(rowCount).fill(null);
47
- continue;
48
- }
49
- if (defaultValue === undefined) {
50
- if (provided === undefined || omitted?.some(Boolean) === true) {
51
- const values = provided === undefined ? new Array(rowCount).fill(null) : [...provided];
52
- for (let index = 0; index < rowCount; index += 1) {
53
- if (isOmitted(index))
54
- values[index] = null;
55
- }
56
- columns[column.name] = values;
57
- }
58
- continue;
59
- }
60
- if (defaultValue.kind === "autoincrement") {
61
- const missingIndexes = [];
62
- let maxExplicit = 0n;
63
- for (let index = 0; index < rowCount; index += 1) {
64
- const value = provided?.[index] ?? null;
65
- if (isOmitted(index)) {
66
- missingIndexes.push(index);
67
- continue;
68
- }
69
- if (typeof value !== "number" || !Number.isSafeInteger(value)) {
70
- throw new TypeError(`${column.name}[${String(index)}] must be a whole number in the safe integer range`);
71
- }
72
- if (BigInt(value) > maxExplicit)
73
- maxExplicit = BigInt(value);
74
- }
75
- if (missingIndexes.length > 0) {
76
- columns[column.name] =
77
- provided === undefined ? new Array(rowCount).fill(null) : [...provided];
78
- }
79
- autoIncrement = { column, missingIndexes, atLeast: maxExplicit + 1n };
80
- continue;
24
+ if (mask.some((value) => typeof value !== "boolean")) {
25
+ throw new TypeError(`Omission mask ${name} must contain booleans`);
26
+ }
27
+ }
28
+ for (const column of table.columns) {
29
+ const defaultValue = column.defaultValue;
30
+ const provided = input.columns[column.name];
31
+ const omitted = input.omitted?.[column.name];
32
+ const isOmitted = (index) => provided === void 0 || omitted?.[index] === true;
33
+ if (column.generatedValue !== void 0) {
34
+ if (provided !== void 0) {
35
+ for (let index = 0; index < rowCount; index += 1) {
36
+ if (!isOmitted(index)) {
37
+ throw new TypeError(`Generated column cannot be assigned: ${column.name}`);
38
+ }
81
39
  }
82
- const values = provided === undefined ? new Array(rowCount).fill(null) : [...provided];
83
- let filled = false;
40
+ }
41
+ columns[column.name] = new Array(rowCount).fill(null);
42
+ continue;
43
+ }
44
+ if (defaultValue === void 0) {
45
+ if (provided === void 0 || omitted?.some(Boolean) === true) {
46
+ const values2 = provided === void 0 ? new Array(rowCount).fill(null) : [...provided];
84
47
  for (let index = 0; index < rowCount; index += 1) {
85
- if (!isOmitted(index))
86
- continue;
87
- filled = true;
88
- switch (defaultValue.kind) {
89
- case "literal":
90
- values[index] =
91
- defaultValue.value instanceof Date ? copyDate(defaultValue.value) : defaultValue.value;
92
- break;
93
- case "expression":
94
- values[index] = await evaluateExpression(defaultValue.sql, index);
95
- break;
96
- }
48
+ if (isOmitted(index))
49
+ values2[index] = null;
50
+ }
51
+ columns[column.name] = values2;
52
+ }
53
+ continue;
54
+ }
55
+ if (defaultValue.kind === "autoincrement") {
56
+ const missingIndexes = [];
57
+ let maxExplicit = 0n;
58
+ for (let index = 0; index < rowCount; index += 1) {
59
+ const value = provided?.[index] ?? null;
60
+ if (isOmitted(index)) {
61
+ missingIndexes.push(index);
62
+ continue;
97
63
  }
98
- if (filled) {
99
- columns[column.name] = values;
100
- generated.set(column.name, values);
64
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) {
65
+ throw new TypeError(`${column.name}[${String(index)}] must be a whole number in the safe integer range`);
101
66
  }
67
+ if (BigInt(value) > maxExplicit)
68
+ maxExplicit = BigInt(value);
69
+ }
70
+ if (missingIndexes.length > 0) {
71
+ columns[column.name] = provided === void 0 ? new Array(rowCount).fill(null) : [...provided];
72
+ }
73
+ autoIncrement = { column, missingIndexes, atLeast: maxExplicit + 1n };
74
+ continue;
75
+ }
76
+ const values = provided === void 0 ? new Array(rowCount).fill(null) : [...provided];
77
+ let filled = false;
78
+ for (let index = 0; index < rowCount; index += 1) {
79
+ if (!isOmitted(index))
80
+ continue;
81
+ filled = true;
82
+ switch (defaultValue.kind) {
83
+ case "literal":
84
+ values[index] = defaultValue.value instanceof Date ? copyDate(defaultValue.value) : defaultValue.value;
85
+ break;
86
+ case "expression":
87
+ values[index] = await evaluateExpression(defaultValue.sql, index);
88
+ break;
89
+ }
102
90
  }
103
- return {
104
- batch: { columns, rowCount },
105
- generated,
106
- ...(autoIncrement === undefined ? {} : { autoIncrement }),
107
- };
91
+ if (filled) {
92
+ columns[column.name] = values;
93
+ generated.set(column.name, values);
94
+ }
95
+ }
96
+ return {
97
+ batch: { columns, rowCount },
98
+ generated,
99
+ ...autoIncrement === void 0 ? {} : { autoIncrement }
100
+ };
108
101
  }
109
- /**
110
- * Writes the reserved range into the batch's null slots. The vector is the fresh array
111
- * `fillColumnDefaults` created for this fill, never a caller-owned one.
112
- */
113
- export function patchAutoIncrementValues(input, fill, range) {
114
- const vector = input.columns[fill.column.name];
115
- fill.missingIndexes.forEach((rowIndex, offset) => {
116
- const value = range.start + BigInt(offset);
117
- if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
118
- throw new RangeError(`Auto-increment exhausted the safe integer range: ${fill.column.name}`);
119
- }
120
- vector[rowIndex] = Number(value);
121
- });
102
+ function patchAutoIncrementValues(input, fill, range) {
103
+ const vector = input.columns[fill.column.name];
104
+ fill.missingIndexes.forEach((rowIndex, offset) => {
105
+ const value = range.start + BigInt(offset);
106
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
107
+ throw new RangeError(`Auto-increment exhausted the safe integer range: ${fill.column.name}`);
108
+ }
109
+ vector[rowIndex] = Number(value);
110
+ });
122
111
  }
112
+ export {
113
+ fillColumnDefaults,
114
+ patchAutoIncrementValues
115
+ };
@@ -1,142 +1,127 @@
1
- /**
2
- * Typed engine errors, kept free of engine imports so the main-thread worker client can rehydrate
3
- * them (name, fields, instanceof) without bundling the executor.
4
- */
5
1
  function formatValue(value) {
6
- return value instanceof Date ? dateIsoString(value) : String(value);
2
+ return value instanceof Date ? dateIsoString(value) : String(value);
7
3
  }
8
- /** A database operation named a table that is not present in the current catalog. */
9
- export class UnknownTableError extends TypeError {
10
- tableName;
11
- name = "UnknownTableError";
12
- constructor(tableName) {
13
- super(`Unknown table: ${tableName}`);
14
- this.tableName = tableName;
15
- }
4
+ class UnknownTableError extends TypeError {
5
+ tableName;
6
+ name = "UnknownTableError";
7
+ constructor(tableName) {
8
+ super(`Unknown table: ${tableName}`);
9
+ this.tableName = tableName;
10
+ }
16
11
  }
17
- /** Refuses another read before one database instance retains an unbounded request backlog. */
18
- export class DatabaseReadBacklogError extends Error {
19
- limit;
20
- name = "DatabaseReadBacklogError";
21
- constructor(limit = 256) {
22
- super(`A database cannot retain more than ${String(limit)} active reads; await a read`);
23
- this.limit = limit;
24
- }
12
+ class DatabaseReadBacklogError extends Error {
13
+ limit;
14
+ name = "DatabaseReadBacklogError";
15
+ constructor(limit = 256) {
16
+ super(`A database cannot retain more than ${String(limit)} active reads; await a read`);
17
+ this.limit = limit;
18
+ }
25
19
  }
26
- /** A live-query owner reached one of its documented resident-resource ceilings. */
27
- export class LiveQueryLimitError extends Error {
28
- resource;
29
- limit;
30
- name = "LiveQueryLimitError";
31
- constructor(resource, limit) {
32
- super(resource === "set"
33
- ? `A database cannot retain more than ${String(limit)} live-query sets`
34
- : `A live-query set cannot retain more than ${String(limit)} ${resource} records`);
35
- this.resource = resource;
36
- this.limit = limit;
37
- }
20
+ class LiveQueryLimitError extends Error {
21
+ resource;
22
+ limit;
23
+ name = "LiveQueryLimitError";
24
+ constructor(resource, limit) {
25
+ super(resource === "set" ? `A database cannot retain more than ${String(limit)} live-query sets` : `A live-query set cannot retain more than ${String(limit)} ${resource} records`);
26
+ this.resource = resource;
27
+ this.limit = limit;
28
+ }
38
29
  }
39
- export class UniqueConstraintError extends Error {
40
- tableName;
41
- columnName;
42
- value;
43
- name = "UniqueConstraintError";
44
- constructor(tableName, columnName, value) {
45
- super(`Duplicate value for ${tableName}.${columnName}: ${formatValue(value)}`);
46
- this.tableName = tableName;
47
- this.columnName = columnName;
48
- this.value = value;
49
- }
30
+ class UniqueConstraintError extends Error {
31
+ tableName;
32
+ columnName;
33
+ value;
34
+ name = "UniqueConstraintError";
35
+ constructor(tableName, columnName, value) {
36
+ super(`Duplicate value for ${tableName}.${columnName}: ${formatValue(value)}`);
37
+ this.tableName = tableName;
38
+ this.columnName = columnName;
39
+ this.value = value;
40
+ }
50
41
  }
51
- export class MissingKeyError extends Error {
52
- tableName;
53
- columnName;
54
- value;
55
- name = "MissingKeyError";
56
- constructor(tableName, columnName, value) {
57
- super(`Missing value for ${tableName}.${columnName}: ${formatValue(value)}`);
58
- this.tableName = tableName;
59
- this.columnName = columnName;
60
- this.value = value;
61
- }
42
+ class MissingKeyError extends Error {
43
+ tableName;
44
+ columnName;
45
+ value;
46
+ name = "MissingKeyError";
47
+ constructor(tableName, columnName, value) {
48
+ super(`Missing value for ${tableName}.${columnName}: ${formatValue(value)}`);
49
+ this.tableName = tableName;
50
+ this.columnName = columnName;
51
+ this.value = value;
52
+ }
62
53
  }
63
- export class CompactionMemoryBudgetError extends Error {
64
- budgetBytes;
65
- minimumBytes;
66
- name = "CompactionMemoryBudgetError";
67
- constructor(budgetBytes, minimumBytes) {
68
- super(`Compaction needs at least ${String(minimumBytes)} bytes of working memory; budget is ${String(budgetBytes)} bytes`);
69
- this.budgetBytes = budgetBytes;
70
- this.minimumBytes = minimumBytes;
71
- }
54
+ class CompactionMemoryBudgetError extends Error {
55
+ budgetBytes;
56
+ minimumBytes;
57
+ name = "CompactionMemoryBudgetError";
58
+ constructor(budgetBytes, minimumBytes) {
59
+ super(`Compaction needs at least ${String(minimumBytes)} bytes of working memory; budget is ${String(budgetBytes)} bytes`);
60
+ this.budgetBytes = budgetBytes;
61
+ this.minimumBytes = minimumBytes;
62
+ }
72
63
  }
73
- export class CompactionWriteAmplificationError extends Error {
74
- outputBytes;
75
- maximumOutputBytes;
76
- name = "CompactionWriteAmplificationError";
77
- constructor(outputBytes, maximumOutputBytes) {
78
- super(`Compaction output would use ${String(outputBytes)} stored bytes; limit is ${String(maximumOutputBytes)} bytes`);
79
- this.outputBytes = outputBytes;
80
- this.maximumOutputBytes = maximumOutputBytes;
81
- }
64
+ class CompactionWriteAmplificationError extends Error {
65
+ outputBytes;
66
+ maximumOutputBytes;
67
+ name = "CompactionWriteAmplificationError";
68
+ constructor(outputBytes, maximumOutputBytes) {
69
+ super(`Compaction output would use ${String(outputBytes)} stored bytes; limit is ${String(maximumOutputBytes)} bytes`);
70
+ this.outputBytes = outputBytes;
71
+ this.maximumOutputBytes = maximumOutputBytes;
72
+ }
82
73
  }
83
- export class CompactionJobCancelledError extends Error {
84
- jobId;
85
- name = "CompactionJobCancelledError";
86
- constructor(jobId) {
87
- super(`Compaction job cancelled: ${jobId}`);
88
- this.jobId = jobId;
89
- }
74
+ class CompactionJobCancelledError extends Error {
75
+ jobId;
76
+ name = "CompactionJobCancelledError";
77
+ constructor(jobId) {
78
+ super(`Compaction job cancelled: ${jobId}`);
79
+ this.jobId = jobId;
80
+ }
90
81
  }
91
- /** Refuses more growth after automatic collection repeatedly fails at a generous debt limit. */
92
- export class MaintenanceBacklogError extends Error {
93
- pendingCommits;
94
- causeMessage;
95
- name = "MaintenanceBacklogError";
96
- constructor(pendingCommits, causeMessage) {
97
- super(`Automatic storage collection could not keep up after ${String(pendingCommits)} commits${causeMessage === null ? "" : `: ${causeMessage}`}`);
98
- this.pendingCommits = pendingCommits;
99
- this.causeMessage = causeMessage;
100
- }
82
+ class MaintenanceBacklogError extends Error {
83
+ pendingCommits;
84
+ causeMessage;
85
+ name = "MaintenanceBacklogError";
86
+ constructor(pendingCommits, causeMessage) {
87
+ super(`Automatic storage collection could not keep up after ${String(pendingCommits)} commits${causeMessage === null ? "" : `: ${causeMessage}`}`);
88
+ this.pendingCommits = pendingCommits;
89
+ this.causeMessage = causeMessage;
90
+ }
101
91
  }
102
- /**
103
- * A paged visible-segment scan cannot continue after its table is dropped or replaced. Segment
104
- * metadata for a dropped table is removed immediately, so returning an empty or partial page
105
- * would silently misrepresent the captured scan.
106
- */
107
- export class VisibleSegmentCursorStaleError extends Error {
108
- tableName;
109
- capturedTableId;
110
- currentTableId;
111
- name = "VisibleSegmentCursorStaleError";
112
- constructor(tableName, capturedTableId, currentTableId) {
113
- super(`Visible segment cursor for ${tableName} is stale: captured table ${capturedTableId}; ${currentTableId === null
114
- ? "the table no longer exists"
115
- : `current table is ${currentTableId}`}`);
116
- this.tableName = tableName;
117
- this.capturedTableId = capturedTableId;
118
- this.currentTableId = currentTableId;
119
- }
92
+ class VisibleSegmentCursorStaleError extends Error {
93
+ tableName;
94
+ capturedTableId;
95
+ currentTableId;
96
+ name = "VisibleSegmentCursorStaleError";
97
+ constructor(tableName, capturedTableId, currentTableId) {
98
+ super(`Visible segment cursor for ${tableName} is stale: captured table ${capturedTableId}; ${currentTableId === null ? "the table no longer exists" : `current table is ${currentTableId}`}`);
99
+ this.tableName = tableName;
100
+ this.capturedTableId = capturedTableId;
101
+ this.currentTableId = currentTableId;
102
+ }
120
103
  }
121
- /**
122
- * SQL that failed to compile, located in the text the caller passed. `offset` and `length` are
123
- * character positions into that exact string — leading whitespace included — so an editor can
124
- * underline the token that failed without re-deriving the position from the message.
125
- *
126
- * `length` is 0 where the failure has no width: an empty statement, or a query that ended before
127
- * the parser expected it to. Errors raised after parsing succeeds (plan optimization, execution)
128
- * carry no position and stay plain `TypeError`s.
129
- *
130
- * It extends `TypeError` because that is what compilation failures threw before positions existed.
131
- */
132
- export class SqlCompileError extends TypeError {
133
- offset;
134
- length;
135
- name = "SqlCompileError";
136
- constructor(message, offset, length) {
137
- super(message);
138
- this.offset = offset;
139
- this.length = length;
140
- }
104
+ class SqlCompileError extends TypeError {
105
+ offset;
106
+ length;
107
+ name = "SqlCompileError";
108
+ constructor(message, offset, length) {
109
+ super(message);
110
+ this.offset = offset;
111
+ this.length = length;
112
+ }
141
113
  }
142
114
  import { dateIsoString } from "../date-value.js";
115
+ export {
116
+ CompactionJobCancelledError,
117
+ CompactionMemoryBudgetError,
118
+ CompactionWriteAmplificationError,
119
+ DatabaseReadBacklogError,
120
+ LiveQueryLimitError,
121
+ MaintenanceBacklogError,
122
+ MissingKeyError,
123
+ SqlCompileError,
124
+ UniqueConstraintError,
125
+ UnknownTableError,
126
+ VisibleSegmentCursorStaleError
127
+ };