@nicia-ai/typegraph 0.16.1 → 0.16.2
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/backend/postgres/index.cjs +28 -28
- package/dist/backend/postgres/index.js +3 -3
- package/dist/backend/sqlite/index.cjs +13 -13
- package/dist/backend/sqlite/index.js +3 -3
- package/dist/backend/sqlite/local.cjs +10 -10
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.js +6 -6
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-CRMN2NOM.cjs → chunk-2UTJRP4F.cjs} +14 -14
- package/dist/{chunk-CRMN2NOM.cjs.map → chunk-2UTJRP4F.cjs.map} +1 -1
- package/dist/{chunk-NI2GV74U.cjs → chunk-5GZMPJOP.cjs} +6 -6
- package/dist/{chunk-NI2GV74U.cjs.map → chunk-5GZMPJOP.cjs.map} +1 -1
- package/dist/{chunk-56RQFK7U.cjs → chunk-5H74QKKF.cjs} +50 -26
- package/dist/chunk-5H74QKKF.cjs.map +1 -0
- package/dist/{chunk-HWWF3FOP.js → chunk-7ZVPFJLQ.js} +3 -3
- package/dist/{chunk-HWWF3FOP.js.map → chunk-7ZVPFJLQ.js.map} +1 -1
- package/dist/{chunk-IRFD3MEU.js → chunk-G5CYWKRF.js} +3 -3
- package/dist/{chunk-IRFD3MEU.js.map → chunk-G5CYWKRF.js.map} +1 -1
- package/dist/{chunk-XZBAGJJH.js → chunk-IRS2C6GN.js} +36 -12
- package/dist/chunk-IRS2C6GN.js.map +1 -0
- package/dist/{chunk-44SXEVF4.cjs → chunk-O5PST6TB.cjs} +17 -2
- package/dist/chunk-O5PST6TB.cjs.map +1 -0
- package/dist/{chunk-L4ON6RJF.js → chunk-W6M7XWKX.js} +4 -4
- package/dist/{chunk-L4ON6RJF.js.map → chunk-W6M7XWKX.js.map} +1 -1
- package/dist/{chunk-SJ2QMDXY.js → chunk-WFMTAEEN.js} +17 -3
- package/dist/chunk-WFMTAEEN.js.map +1 -0
- package/dist/{chunk-3HQLOKS5.cjs → chunk-X33WV2UF.cjs} +14 -14
- package/dist/{chunk-3HQLOKS5.cjs.map → chunk-X33WV2UF.cjs.map} +1 -1
- package/dist/{index-QTnQwakS.d.cts → index-DXkEXpNz.d.cts} +13 -1
- package/dist/{index-QTnQwakS.d.ts → index-DXkEXpNz.d.ts} +13 -1
- package/dist/index.cjs +220 -216
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/interchange/index.cjs +7 -7
- package/dist/interchange/index.js +2 -2
- package/dist/schema/index.cjs +22 -22
- package/dist/schema/index.d.cts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-44SXEVF4.cjs.map +0 -1
- package/dist/chunk-56RQFK7U.cjs.map +0 -1
- package/dist/chunk-SJ2QMDXY.js.map +0 -1
- package/dist/chunk-XZBAGJJH.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkX33WV2UF_cjs = require('./chunk-X33WV2UF.cjs');
|
|
4
|
+
var chunk5GZMPJOP_cjs = require('./chunk-5GZMPJOP.cjs');
|
|
5
|
+
var chunkO5PST6TB_cjs = require('./chunk-O5PST6TB.cjs');
|
|
6
6
|
var chunkMME3H4ZF_cjs = require('./chunk-MME3H4ZF.cjs');
|
|
7
7
|
var chunkP5CNM325_cjs = require('./chunk-P5CNM325.cjs');
|
|
8
8
|
var zod = require('zod');
|
|
@@ -32,7 +32,7 @@ var PROTOTYPE_POLLUTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
32
32
|
function validateProjectionField(field2, entityType, kind) {
|
|
33
33
|
const reserved = entityType === "node" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;
|
|
34
34
|
if (reserved.has(field2)) {
|
|
35
|
-
throw new
|
|
35
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
36
36
|
`Projection field "${field2}" on ${entityType} kind "${kind}" conflicts with a reserved structural key`,
|
|
37
37
|
{ field: field2, kind, entityType, reservedKeys: [...reserved] },
|
|
38
38
|
{
|
|
@@ -41,7 +41,7 @@ function validateProjectionField(field2, entityType, kind) {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
if (PROTOTYPE_POLLUTION_KEYS.has(field2)) {
|
|
44
|
-
throw new
|
|
44
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
45
45
|
`Projection field "${field2}" on ${entityType} kind "${kind}" is not allowed`,
|
|
46
46
|
{ field: field2, kind, entityType },
|
|
47
47
|
{
|
|
@@ -67,7 +67,7 @@ function validateSchemaKeys(schema, name) {
|
|
|
67
67
|
(key) => RESERVED_NODE_KEYS.has(key)
|
|
68
68
|
);
|
|
69
69
|
if (conflicts.length > 0) {
|
|
70
|
-
throw new
|
|
70
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
71
71
|
`Node "${name}" schema contains reserved property names: ${conflicts.join(", ")}`,
|
|
72
72
|
{ nodeType: name, conflicts, reservedKeys: [...RESERVED_NODE_KEYS] },
|
|
73
73
|
{
|
|
@@ -79,7 +79,7 @@ function validateSchemaKeys(schema, name) {
|
|
|
79
79
|
function defineNode(name, options) {
|
|
80
80
|
validateSchemaKeys(options.schema, name);
|
|
81
81
|
return Object.freeze({
|
|
82
|
-
[
|
|
82
|
+
[chunk5GZMPJOP_cjs.NODE_TYPE_BRAND]: true,
|
|
83
83
|
kind: name,
|
|
84
84
|
schema: options.schema,
|
|
85
85
|
description: options.description
|
|
@@ -92,7 +92,7 @@ function validateSchemaKeys2(schema, name) {
|
|
|
92
92
|
(key) => RESERVED_EDGE_KEYS.has(key)
|
|
93
93
|
);
|
|
94
94
|
if (conflicts.length > 0) {
|
|
95
|
-
throw new
|
|
95
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
96
96
|
`Edge "${name}" schema contains reserved property names: ${conflicts.join(", ")}`,
|
|
97
97
|
{ edgeType: name, conflicts, reservedKeys: [...RESERVED_EDGE_KEYS] },
|
|
98
98
|
{
|
|
@@ -105,7 +105,7 @@ function defineEdge(name, options) {
|
|
|
105
105
|
const schema = options?.schema ?? EMPTY_SCHEMA;
|
|
106
106
|
validateSchemaKeys2(schema, name);
|
|
107
107
|
return Object.freeze({
|
|
108
|
-
[
|
|
108
|
+
[chunk5GZMPJOP_cjs.EDGE_TYPE_BRAND]: true,
|
|
109
109
|
kind: name,
|
|
110
110
|
schema,
|
|
111
111
|
description: options?.description,
|
|
@@ -125,7 +125,7 @@ function metaEdge(name, options = {}) {
|
|
|
125
125
|
description: options.description
|
|
126
126
|
};
|
|
127
127
|
return Object.freeze({
|
|
128
|
-
[
|
|
128
|
+
[chunkX33WV2UF_cjs.META_EDGE_BRAND]: true,
|
|
129
129
|
name,
|
|
130
130
|
properties
|
|
131
131
|
});
|
|
@@ -161,7 +161,7 @@ function createExternalRef(table) {
|
|
|
161
161
|
// src/ontology/core-meta-edges.ts
|
|
162
162
|
function createMetaEdge(name, properties) {
|
|
163
163
|
return Object.freeze({
|
|
164
|
-
[
|
|
164
|
+
[chunkX33WV2UF_cjs.META_EDGE_BRAND]: true,
|
|
165
165
|
name,
|
|
166
166
|
properties: {
|
|
167
167
|
transitive: properties.transitive ?? false,
|
|
@@ -173,7 +173,7 @@ function createMetaEdge(name, properties) {
|
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
var subClassOfMetaEdge = createMetaEdge(
|
|
176
|
+
var subClassOfMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_SUB_CLASS_OF, {
|
|
177
177
|
transitive: true,
|
|
178
178
|
inference: "subsumption",
|
|
179
179
|
description: "Type inheritance (Podcast subClassOf Media)"
|
|
@@ -185,9 +185,9 @@ function subClassOf(child, parent) {
|
|
|
185
185
|
to: parent
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
-
var broaderMetaEdge = createMetaEdge(
|
|
188
|
+
var broaderMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_BROADER, {
|
|
189
189
|
transitive: true,
|
|
190
|
-
inverse:
|
|
190
|
+
inverse: chunkX33WV2UF_cjs.META_EDGE_NARROWER,
|
|
191
191
|
inference: "hierarchy",
|
|
192
192
|
description: "Broader concept (ML broader AI)"
|
|
193
193
|
});
|
|
@@ -198,9 +198,9 @@ function broader(narrowerConcept, broaderConcept) {
|
|
|
198
198
|
to: broaderConcept
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
var narrowerMetaEdge = createMetaEdge(
|
|
201
|
+
var narrowerMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_NARROWER, {
|
|
202
202
|
transitive: true,
|
|
203
|
-
inverse:
|
|
203
|
+
inverse: chunkX33WV2UF_cjs.META_EDGE_BROADER,
|
|
204
204
|
inference: "hierarchy",
|
|
205
205
|
description: "Narrower concept (AI narrower ML)"
|
|
206
206
|
});
|
|
@@ -211,7 +211,7 @@ function narrower(broaderConcept, narrowerConcept) {
|
|
|
211
211
|
to: narrowerConcept
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
var relatedToMetaEdge = createMetaEdge(
|
|
214
|
+
var relatedToMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_RELATED_TO, {
|
|
215
215
|
symmetric: true,
|
|
216
216
|
inference: "association",
|
|
217
217
|
description: "Non-hierarchical association"
|
|
@@ -223,7 +223,7 @@ function relatedTo(conceptA, conceptB) {
|
|
|
223
223
|
to: conceptB
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
var equivalentToMetaEdge = createMetaEdge(
|
|
226
|
+
var equivalentToMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_EQUIVALENT_TO, {
|
|
227
227
|
symmetric: true,
|
|
228
228
|
transitive: true,
|
|
229
229
|
inference: "substitution",
|
|
@@ -236,7 +236,7 @@ function equivalentTo(kindA, kindBOrIri) {
|
|
|
236
236
|
to: kindBOrIri
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
var sameAsMetaEdge = createMetaEdge(
|
|
239
|
+
var sameAsMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_SAME_AS, {
|
|
240
240
|
symmetric: true,
|
|
241
241
|
transitive: true,
|
|
242
242
|
inference: "substitution",
|
|
@@ -249,7 +249,7 @@ function sameAs(kindA, kindBOrIri) {
|
|
|
249
249
|
to: kindBOrIri
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
var differentFromMetaEdge = createMetaEdge(
|
|
252
|
+
var differentFromMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_DIFFERENT_FROM, {
|
|
253
253
|
symmetric: true,
|
|
254
254
|
inference: "constraint",
|
|
255
255
|
description: "Explicitly different individuals"
|
|
@@ -261,7 +261,7 @@ function differentFrom(kindA, kindB) {
|
|
|
261
261
|
to: kindB
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
-
var disjointWithMetaEdge = createMetaEdge(
|
|
264
|
+
var disjointWithMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_DISJOINT_WITH, {
|
|
265
265
|
symmetric: true,
|
|
266
266
|
inference: "constraint",
|
|
267
267
|
description: "Mutually exclusive types"
|
|
@@ -273,9 +273,9 @@ function disjointWith(kindA, kindB) {
|
|
|
273
273
|
to: kindB
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
var partOfMetaEdge = createMetaEdge(
|
|
276
|
+
var partOfMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_PART_OF, {
|
|
277
277
|
transitive: true,
|
|
278
|
-
inverse:
|
|
278
|
+
inverse: chunkX33WV2UF_cjs.META_EDGE_HAS_PART,
|
|
279
279
|
inference: "composition",
|
|
280
280
|
description: "X is part of Y"
|
|
281
281
|
});
|
|
@@ -286,9 +286,9 @@ function partOf(part, whole) {
|
|
|
286
286
|
to: whole
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
var hasPartMetaEdge = createMetaEdge(
|
|
289
|
+
var hasPartMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_HAS_PART, {
|
|
290
290
|
transitive: true,
|
|
291
|
-
inverse:
|
|
291
|
+
inverse: chunkX33WV2UF_cjs.META_EDGE_PART_OF,
|
|
292
292
|
inference: "composition",
|
|
293
293
|
description: "Y has part X"
|
|
294
294
|
});
|
|
@@ -299,12 +299,12 @@ function hasPart(whole, part) {
|
|
|
299
299
|
to: part
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
-
var inverseOfMetaEdge = createMetaEdge(
|
|
302
|
+
var inverseOfMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_INVERSE_OF, {
|
|
303
303
|
symmetric: true,
|
|
304
304
|
inference: "none",
|
|
305
305
|
description: "Edge A is inverse of edge B"
|
|
306
306
|
});
|
|
307
|
-
var impliesMetaEdge = createMetaEdge(
|
|
307
|
+
var impliesMetaEdge = createMetaEdge(chunkX33WV2UF_cjs.META_EDGE_IMPLIES, {
|
|
308
308
|
transitive: true,
|
|
309
309
|
inference: "none",
|
|
310
310
|
description: "Edge A implies edge B exists"
|
|
@@ -817,7 +817,7 @@ function notInSubquery(field2, subquery) {
|
|
|
817
817
|
function assertSingleColumnSubquery(subquery) {
|
|
818
818
|
const columnCount = getSubqueryColumnCount(subquery);
|
|
819
819
|
if (columnCount === 1) return;
|
|
820
|
-
throw new
|
|
820
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
821
821
|
`IN/NOT IN subquery must project exactly 1 column, but got ${columnCount}`,
|
|
822
822
|
{ subqueryColumnCount: columnCount },
|
|
823
823
|
{
|
|
@@ -830,7 +830,7 @@ function assertCompatibleSubqueryValueTypes(field2, subquery) {
|
|
|
830
830
|
const subqueryValueType = getSingleSubqueryColumnValueType(subquery);
|
|
831
831
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
832
832
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
833
|
-
throw new
|
|
833
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
834
834
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
835
835
|
{ valueType: resolvedValueType },
|
|
836
836
|
{
|
|
@@ -841,7 +841,7 @@ function assertCompatibleSubqueryValueTypes(field2, subquery) {
|
|
|
841
841
|
if (isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
842
842
|
return;
|
|
843
843
|
}
|
|
844
|
-
throw new
|
|
844
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
845
845
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
846
846
|
{
|
|
847
847
|
fieldValueType,
|
|
@@ -967,7 +967,7 @@ function resolveLiteralValueTypes(literals) {
|
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
969
|
if (resolved.size > 1) {
|
|
970
|
-
throw new
|
|
970
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
971
971
|
"Mixed literal value types are not supported in predicates",
|
|
972
972
|
{ valueTypes: [...resolved] }
|
|
973
973
|
);
|
|
@@ -1093,7 +1093,7 @@ function compilePredicateExpression(expr, ctx) {
|
|
|
1093
1093
|
if (!upperIsParam) boundsForType.push(expr.upper);
|
|
1094
1094
|
const valueType = boundsForType.length > 0 ? resolveComparisonValueType(expr.field, boundsForType) : normalizeValueType2(expr.field.valueType);
|
|
1095
1095
|
if (valueType === "array" || valueType === "object") {
|
|
1096
|
-
throw new
|
|
1096
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1097
1097
|
"Between comparisons are not supported for JSON arrays or objects"
|
|
1098
1098
|
);
|
|
1099
1099
|
}
|
|
@@ -1158,7 +1158,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1158
1158
|
);
|
|
1159
1159
|
const opSql2 = COMPARISON_OP_SQL[expr.op];
|
|
1160
1160
|
if (!opSql2) {
|
|
1161
|
-
throw new
|
|
1161
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1162
1162
|
`Comparison operation "${expr.op}" is not supported for parameterized predicates`
|
|
1163
1163
|
);
|
|
1164
1164
|
}
|
|
@@ -1166,7 +1166,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
const valueType = resolveComparisonValueType(expr.left, expr.right);
|
|
1168
1168
|
if (valueType === "array" || valueType === "object") {
|
|
1169
|
-
throw new
|
|
1169
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1170
1170
|
`Comparison operation "${expr.op}" is not supported for ${valueType} values`
|
|
1171
1171
|
);
|
|
1172
1172
|
}
|
|
@@ -1194,7 +1194,7 @@ function compileComparisonPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1194
1194
|
const convertedRight = convertValueForSql(rightValue.value, dialect);
|
|
1195
1195
|
const opSql = COMPARISON_OP_SQL[expr.op];
|
|
1196
1196
|
if (!opSql) {
|
|
1197
|
-
throw new
|
|
1197
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1198
1198
|
`Comparison operation "${expr.op}" is not supported`
|
|
1199
1199
|
);
|
|
1200
1200
|
}
|
|
@@ -1257,13 +1257,13 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
case "pathEquals": {
|
|
1259
1259
|
if (!expr.value) {
|
|
1260
|
-
throw new
|
|
1260
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1261
1261
|
"pathEquals requires a comparison value"
|
|
1262
1262
|
);
|
|
1263
1263
|
}
|
|
1264
1264
|
const valueType = resolvePredicateValueType(expr.valueType, expr.value);
|
|
1265
1265
|
if (valueType === "array" || valueType === "object") {
|
|
1266
|
-
throw new
|
|
1266
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1267
1267
|
"pathEquals is not supported for JSON arrays or objects"
|
|
1268
1268
|
);
|
|
1269
1269
|
}
|
|
@@ -1279,7 +1279,7 @@ function compileObjectPredicate(expr, dialect, cteColumnPrefix) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
case "pathContains": {
|
|
1281
1281
|
if (!expr.value) {
|
|
1282
|
-
throw new
|
|
1282
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1283
1283
|
"pathContains requires a comparison value"
|
|
1284
1284
|
);
|
|
1285
1285
|
}
|
|
@@ -1307,7 +1307,7 @@ function compileAggregatePredicate(expr, dialect) {
|
|
|
1307
1307
|
const aggregate = compileAggregateExpr(expr.aggregate, dialect);
|
|
1308
1308
|
const op = COMPARISON_OP_SQL[expr.op];
|
|
1309
1309
|
if (!op) {
|
|
1310
|
-
throw new
|
|
1310
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1311
1311
|
`Comparison operation "${expr.op}" is not supported for aggregate predicates`
|
|
1312
1312
|
);
|
|
1313
1313
|
}
|
|
@@ -1342,7 +1342,7 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1342
1342
|
return drizzleOrm.sql`MAX(${field2})`;
|
|
1343
1343
|
}
|
|
1344
1344
|
default: {
|
|
1345
|
-
throw new
|
|
1345
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1346
1346
|
`Unknown aggregate function: ${expr.function}`
|
|
1347
1347
|
);
|
|
1348
1348
|
}
|
|
@@ -1350,7 +1350,7 @@ function compileAggregateExpr(expr, dialect) {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
function compileExistsSubquery(expr, ctx) {
|
|
1352
1352
|
if (expr.subquery.graphId === void 0) {
|
|
1353
|
-
throw new
|
|
1353
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError("EXISTS subquery must have a graphId");
|
|
1354
1354
|
}
|
|
1355
1355
|
const subSql = ctx.compileQuery(expr.subquery, expr.subquery.graphId);
|
|
1356
1356
|
return expr.negated ? drizzleOrm.sql`NOT EXISTS (${subSql})` : drizzleOrm.sql`EXISTS (${subSql})`;
|
|
@@ -1358,7 +1358,7 @@ function compileExistsSubquery(expr, ctx) {
|
|
|
1358
1358
|
function compileInSubquery(expr, ctx) {
|
|
1359
1359
|
const subqueryColumnCount = getSubqueryColumnCount(expr.subquery);
|
|
1360
1360
|
if (subqueryColumnCount !== 1) {
|
|
1361
|
-
throw new
|
|
1361
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1362
1362
|
`IN/NOT IN subquery must project exactly 1 column, but got ${subqueryColumnCount}`,
|
|
1363
1363
|
{ subqueryColumnCount }
|
|
1364
1364
|
);
|
|
@@ -1367,13 +1367,13 @@ function compileInSubquery(expr, ctx) {
|
|
|
1367
1367
|
const subqueryValueType = getSingleSubqueryColumnValueType(expr.subquery);
|
|
1368
1368
|
const resolvedValueType = fieldValueType ?? subqueryValueType;
|
|
1369
1369
|
if (isUnsupportedInSubqueryValueType(resolvedValueType)) {
|
|
1370
|
-
throw new
|
|
1370
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1371
1371
|
`IN/NOT IN subquery does not support ${String(resolvedValueType)} values`,
|
|
1372
1372
|
{ valueType: resolvedValueType }
|
|
1373
1373
|
);
|
|
1374
1374
|
}
|
|
1375
1375
|
if (!isInSubqueryTypeCompatible(fieldValueType, subqueryValueType)) {
|
|
1376
|
-
throw new
|
|
1376
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1377
1377
|
`IN/NOT IN type mismatch: field type "${String(fieldValueType)}" does not match subquery column type "${String(subqueryValueType)}"`,
|
|
1378
1378
|
{
|
|
1379
1379
|
fieldValueType,
|
|
@@ -1383,7 +1383,7 @@ function compileInSubquery(expr, ctx) {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
const valueType = fieldValueType ?? subqueryValueType;
|
|
1385
1385
|
if (expr.subquery.graphId === void 0) {
|
|
1386
|
-
throw new
|
|
1386
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1387
1387
|
"IN/NOT IN subquery must have a graphId"
|
|
1388
1388
|
);
|
|
1389
1389
|
}
|
|
@@ -1407,7 +1407,7 @@ function extractVectorSimilarityPredicates(predicates) {
|
|
|
1407
1407
|
switch (expr.__type) {
|
|
1408
1408
|
case "vector_similarity": {
|
|
1409
1409
|
if (inDisallowedBranch) {
|
|
1410
|
-
throw new
|
|
1410
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
1411
1411
|
"Vector similarity predicates cannot be nested under OR or NOT. Use top-level AND combinations instead."
|
|
1412
1412
|
);
|
|
1413
1413
|
}
|
|
@@ -1493,7 +1493,7 @@ function getNodeKindsForAlias(ast, alias) {
|
|
|
1493
1493
|
return traversal.nodeKinds;
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
|
-
throw new
|
|
1496
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(`Unknown traversal source alias: ${alias}`);
|
|
1497
1497
|
}
|
|
1498
1498
|
|
|
1499
1499
|
// src/query/compiler/emitter/plan-inspector.ts
|
|
@@ -1548,7 +1548,7 @@ function findUnaryNodeInProjectChain(rootNode, op) {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
function inspectProjectPlan(logicalPlan) {
|
|
1550
1550
|
if (logicalPlan.root.op !== "project") {
|
|
1551
|
-
throw new
|
|
1551
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1552
1552
|
`SQL emitter expected logical plan root to be "project", got "${logicalPlan.root.op}"`,
|
|
1553
1553
|
{ component: "plan-inspector" }
|
|
1554
1554
|
);
|
|
@@ -1578,13 +1578,13 @@ function inspectProjectPlan(logicalPlan) {
|
|
|
1578
1578
|
function inspectStandardProjectPlan(logicalPlan) {
|
|
1579
1579
|
const shape = inspectProjectPlan(logicalPlan);
|
|
1580
1580
|
if (shape.hasSetOperation) {
|
|
1581
|
-
throw new
|
|
1581
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1582
1582
|
'Standard SQL emitter does not support plans containing "set_op" nodes',
|
|
1583
1583
|
{ component: "plan-inspector" }
|
|
1584
1584
|
);
|
|
1585
1585
|
}
|
|
1586
1586
|
if (shape.hasRecursiveExpand) {
|
|
1587
|
-
throw new
|
|
1587
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1588
1588
|
'Standard SQL emitter does not support plans containing "recursive_expand" nodes',
|
|
1589
1589
|
{ component: "plan-inspector" }
|
|
1590
1590
|
);
|
|
@@ -1594,13 +1594,13 @@ function inspectStandardProjectPlan(logicalPlan) {
|
|
|
1594
1594
|
function inspectRecursiveProjectPlan(logicalPlan) {
|
|
1595
1595
|
const shape = inspectProjectPlan(logicalPlan);
|
|
1596
1596
|
if (!shape.hasRecursiveExpand) {
|
|
1597
|
-
throw new
|
|
1597
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1598
1598
|
'Recursive SQL emitter expected logical plan to contain a "recursive_expand" node',
|
|
1599
1599
|
{ component: "plan-inspector" }
|
|
1600
1600
|
);
|
|
1601
1601
|
}
|
|
1602
1602
|
if (shape.hasSetOperation) {
|
|
1603
|
-
throw new
|
|
1603
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1604
1604
|
'Recursive SQL emitter does not support plans containing "set_op" nodes',
|
|
1605
1605
|
{ component: "plan-inspector" }
|
|
1606
1606
|
);
|
|
@@ -1659,7 +1659,7 @@ function inspectSetOperationPlan(logicalPlan) {
|
|
|
1659
1659
|
const operations = /* @__PURE__ */ new Set();
|
|
1660
1660
|
collectPlanOperations(logicalPlan.root, operations);
|
|
1661
1661
|
if (!operations.has("set_op")) {
|
|
1662
|
-
throw new
|
|
1662
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1663
1663
|
'Set-operation SQL emitter expected logical plan to contain a "set_op" node',
|
|
1664
1664
|
{ component: "plan-inspector" }
|
|
1665
1665
|
);
|
|
@@ -1677,25 +1677,25 @@ function inspectSetOperationPlan(logicalPlan) {
|
|
|
1677
1677
|
function assertRecursiveEmitterClauseAlignment(logicalPlan, input) {
|
|
1678
1678
|
const planShape = inspectRecursiveProjectPlan(logicalPlan);
|
|
1679
1679
|
if (planShape.hasSort && input.orderBy === void 0) {
|
|
1680
|
-
throw new
|
|
1680
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1681
1681
|
"Recursive SQL emitter expected ORDER BY clause for plan containing a sort node",
|
|
1682
1682
|
{ component: "recursive-emitter" }
|
|
1683
1683
|
);
|
|
1684
1684
|
}
|
|
1685
1685
|
if (!planShape.hasSort && input.orderBy !== void 0) {
|
|
1686
|
-
throw new
|
|
1686
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1687
1687
|
"Recursive SQL emitter received ORDER BY clause for a plan without sort nodes",
|
|
1688
1688
|
{ component: "recursive-emitter" }
|
|
1689
1689
|
);
|
|
1690
1690
|
}
|
|
1691
1691
|
if (planShape.hasLimitOffset && input.limitOffset === void 0) {
|
|
1692
|
-
throw new
|
|
1692
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1693
1693
|
"Recursive SQL emitter expected LIMIT/OFFSET clause for plan containing a limit_offset node",
|
|
1694
1694
|
{ component: "recursive-emitter" }
|
|
1695
1695
|
);
|
|
1696
1696
|
}
|
|
1697
1697
|
if (!planShape.hasLimitOffset && input.limitOffset !== void 0) {
|
|
1698
|
-
throw new
|
|
1698
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1699
1699
|
"Recursive SQL emitter received LIMIT/OFFSET clause for a plan without limit_offset nodes",
|
|
1700
1700
|
{ component: "recursive-emitter" }
|
|
1701
1701
|
);
|
|
@@ -1722,14 +1722,14 @@ function assertSetOperationEmitterClauseAlignment(logicalPlan, suffixClauses) {
|
|
|
1722
1722
|
const shape = inspectSetOperationPlan(logicalPlan);
|
|
1723
1723
|
const hasSuffixClauses = suffixClauses !== void 0 && suffixClauses.length > 0;
|
|
1724
1724
|
if (!shape.hasSort && !shape.hasLimitOffset && hasSuffixClauses) {
|
|
1725
|
-
throw new
|
|
1725
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1726
1726
|
"Set-operation SQL emitter received suffix clauses for a plan without top-level sort or limit_offset nodes",
|
|
1727
1727
|
{ component: "set-operation-emitter" }
|
|
1728
1728
|
);
|
|
1729
1729
|
}
|
|
1730
1730
|
if (!hasSuffixClauses) {
|
|
1731
1731
|
if (shape.hasSort || shape.hasLimitOffset) {
|
|
1732
|
-
throw new
|
|
1732
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1733
1733
|
"Set-operation SQL emitter expected suffix clauses for plan containing top-level sort or limit_offset nodes",
|
|
1734
1734
|
{ component: "set-operation-emitter" }
|
|
1735
1735
|
);
|
|
@@ -1739,7 +1739,7 @@ function assertSetOperationEmitterClauseAlignment(logicalPlan, suffixClauses) {
|
|
|
1739
1739
|
const limitOffsetClauseCount = shape.limitOffsetNode === void 0 ? 0 : (shape.limitOffsetNode.limit === void 0 ? 0 : 1) + (shape.limitOffsetNode.offset === void 0 ? 0 : 1);
|
|
1740
1740
|
const expectedClauseCount = (shape.sortNode === void 0 ? 0 : 1) + limitOffsetClauseCount;
|
|
1741
1741
|
if (suffixClauses.length !== expectedClauseCount) {
|
|
1742
|
-
throw new
|
|
1742
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1743
1743
|
`Set-operation SQL emitter expected ${String(expectedClauseCount)} top-level suffix clause(s) from logical plan, got ${String(suffixClauses.length)}`,
|
|
1744
1744
|
{ component: "set-operation-emitter" }
|
|
1745
1745
|
);
|
|
@@ -1763,38 +1763,38 @@ function emitSetOperationQuerySql(input) {
|
|
|
1763
1763
|
function assertStandardEmitterClauseAlignment(logicalPlan, input) {
|
|
1764
1764
|
const planShape = inspectStandardProjectPlan(logicalPlan);
|
|
1765
1765
|
if (input.groupBy !== void 0 && !planShape.hasAggregate) {
|
|
1766
|
-
throw new
|
|
1766
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1767
1767
|
"Standard SQL emitter received GROUP BY clause for a plan without aggregate nodes",
|
|
1768
1768
|
{ component: "standard-emitter" }
|
|
1769
1769
|
);
|
|
1770
1770
|
}
|
|
1771
1771
|
if (input.having !== void 0 && !planShape.hasAggregate) {
|
|
1772
|
-
throw new
|
|
1772
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1773
1773
|
"Standard SQL emitter received HAVING clause for a plan without aggregate nodes",
|
|
1774
1774
|
{ component: "standard-emitter" }
|
|
1775
1775
|
);
|
|
1776
1776
|
}
|
|
1777
1777
|
const expectsOrderBy = planShape.hasSort || planShape.hasVectorKnn;
|
|
1778
1778
|
if (expectsOrderBy && input.orderBy === void 0) {
|
|
1779
|
-
throw new
|
|
1779
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1780
1780
|
"Standard SQL emitter expected ORDER BY clause for plan containing a sort or vector_knn node",
|
|
1781
1781
|
{ component: "standard-emitter" }
|
|
1782
1782
|
);
|
|
1783
1783
|
}
|
|
1784
1784
|
if (!expectsOrderBy && input.orderBy !== void 0) {
|
|
1785
|
-
throw new
|
|
1785
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1786
1786
|
"Standard SQL emitter received ORDER BY clause for a plan without sort or vector_knn nodes",
|
|
1787
1787
|
{ component: "standard-emitter" }
|
|
1788
1788
|
);
|
|
1789
1789
|
}
|
|
1790
1790
|
if (planShape.hasLimitOffset && input.limitOffset === void 0) {
|
|
1791
|
-
throw new
|
|
1791
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1792
1792
|
"Standard SQL emitter expected LIMIT/OFFSET clause for plan containing a limit_offset node",
|
|
1793
1793
|
{ component: "standard-emitter" }
|
|
1794
1794
|
);
|
|
1795
1795
|
}
|
|
1796
1796
|
if (!planShape.hasLimitOffset && input.limitOffset !== void 0) {
|
|
1797
|
-
throw new
|
|
1797
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
1798
1798
|
"Standard SQL emitter received LIMIT/OFFSET clause for a plan without limit_offset nodes",
|
|
1799
1799
|
{ component: "standard-emitter" }
|
|
1800
1800
|
);
|
|
@@ -2147,7 +2147,7 @@ function compileAggregateExprFromSource(expr, dialect) {
|
|
|
2147
2147
|
return drizzleOrm.sql`${drizzleOrm.sql.raw(fn.toUpperCase())}(${column})`;
|
|
2148
2148
|
}
|
|
2149
2149
|
default: {
|
|
2150
|
-
throw new
|
|
2150
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2151
2151
|
`Unknown aggregate function: ${String(fn)}`
|
|
2152
2152
|
);
|
|
2153
2153
|
}
|
|
@@ -2245,7 +2245,7 @@ function buildStandardOrderBy(input) {
|
|
|
2245
2245
|
for (const orderSpec of ast.orderBy) {
|
|
2246
2246
|
const valueType = orderSpec.field.valueType;
|
|
2247
2247
|
if (valueType === "array" || valueType === "object") {
|
|
2248
|
-
throw new
|
|
2248
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2249
2249
|
"Ordering by JSON arrays or objects is not supported"
|
|
2250
2250
|
);
|
|
2251
2251
|
}
|
|
@@ -2375,7 +2375,7 @@ function buildStandardVectorOrderBy(input) {
|
|
|
2375
2375
|
for (const orderSpec of ast.orderBy) {
|
|
2376
2376
|
const valueType = orderSpec.field.valueType;
|
|
2377
2377
|
if (valueType === "array" || valueType === "object") {
|
|
2378
|
-
throw new
|
|
2378
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2379
2379
|
"Ordering by JSON arrays or objects is not supported"
|
|
2380
2380
|
);
|
|
2381
2381
|
}
|
|
@@ -2416,10 +2416,10 @@ function runRecursiveTraversalSelectionPass(ast) {
|
|
|
2416
2416
|
(traversal) => traversal.variableLength !== void 0
|
|
2417
2417
|
);
|
|
2418
2418
|
if (variableLengthTraversal === void 0) {
|
|
2419
|
-
throw new
|
|
2419
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError("No variable-length traversal found");
|
|
2420
2420
|
}
|
|
2421
2421
|
if (ast.traversals.length > 1) {
|
|
2422
|
-
throw new
|
|
2422
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2423
2423
|
"Variable-length traversals with multiple traversals are not yet supported. Please use a single variable-length traversal."
|
|
2424
2424
|
);
|
|
2425
2425
|
}
|
|
@@ -2483,7 +2483,7 @@ function createTemporalFilterPass(ast, currentTimestamp) {
|
|
|
2483
2483
|
function runVectorPredicatePass(ast, dialect) {
|
|
2484
2484
|
const vectorPredicates = extractVectorSimilarityPredicates(ast.predicates);
|
|
2485
2485
|
if (vectorPredicates.length > 1) {
|
|
2486
|
-
throw new
|
|
2486
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2487
2487
|
"Multiple vector similarity predicates in a single query are not supported"
|
|
2488
2488
|
);
|
|
2489
2489
|
}
|
|
@@ -2493,29 +2493,29 @@ function runVectorPredicatePass(ast, dialect) {
|
|
|
2493
2493
|
}
|
|
2494
2494
|
const vectorStrategy = dialect.capabilities.vectorPredicateStrategy;
|
|
2495
2495
|
if (vectorStrategy === "unsupported" || !dialect.supportsVectors) {
|
|
2496
|
-
throw new
|
|
2496
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2497
2497
|
`Vector similarity predicates are not supported for dialect "${dialect.name}"`
|
|
2498
2498
|
);
|
|
2499
2499
|
}
|
|
2500
2500
|
if (!dialect.capabilities.vectorMetrics.includes(vectorPredicate.metric)) {
|
|
2501
|
-
throw new
|
|
2501
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2502
2502
|
`Vector metric "${vectorPredicate.metric}" is not supported for dialect "${dialect.name}"`
|
|
2503
2503
|
);
|
|
2504
2504
|
}
|
|
2505
2505
|
if (!Number.isFinite(vectorPredicate.limit) || vectorPredicate.limit <= 0) {
|
|
2506
|
-
throw new
|
|
2506
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2507
2507
|
`Vector predicate limit must be a positive finite number, got ${String(vectorPredicate.limit)}`
|
|
2508
2508
|
);
|
|
2509
2509
|
}
|
|
2510
2510
|
const { minScore } = vectorPredicate;
|
|
2511
2511
|
if (minScore !== void 0) {
|
|
2512
2512
|
if (!Number.isFinite(minScore)) {
|
|
2513
|
-
throw new
|
|
2513
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2514
2514
|
`Vector minScore must be a finite number, got ${String(minScore)}`
|
|
2515
2515
|
);
|
|
2516
2516
|
}
|
|
2517
2517
|
if (vectorPredicate.metric === "cosine" && (minScore < -1 || minScore > 1)) {
|
|
2518
|
-
throw new
|
|
2518
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
2519
2519
|
`Cosine minScore must be between -1 and 1, got ${String(minScore)}`
|
|
2520
2520
|
);
|
|
2521
2521
|
}
|
|
@@ -2609,7 +2609,7 @@ function appendAggregateSortLimitAndProjectNodes(currentNode, ast, nextPlanNodeI
|
|
|
2609
2609
|
} else if (hasOffset) {
|
|
2610
2610
|
node = { ...limitOffsetNodeBase, offset: ast.offset };
|
|
2611
2611
|
} else {
|
|
2612
|
-
throw new
|
|
2612
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
2613
2613
|
"limit_offset node requires limit or offset to be present"
|
|
2614
2614
|
);
|
|
2615
2615
|
}
|
|
@@ -2902,7 +2902,7 @@ function runRecursiveQueryPassPipeline(ast, graphId, ctx) {
|
|
|
2902
2902
|
execute(currentState) {
|
|
2903
2903
|
const traversal = currentState.traversal;
|
|
2904
2904
|
if (traversal === void 0) {
|
|
2905
|
-
throw new
|
|
2905
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
2906
2906
|
"Recursive traversal pass did not select traversal"
|
|
2907
2907
|
);
|
|
2908
2908
|
}
|
|
@@ -2955,17 +2955,17 @@ function compileVariableLengthQueryWithRecursiveCteStrategy(ast, graphId, ctx) {
|
|
|
2955
2955
|
traversal: vlTraversal
|
|
2956
2956
|
} = passState;
|
|
2957
2957
|
if (temporalFilterPass === void 0) {
|
|
2958
|
-
throw new
|
|
2958
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
2959
2959
|
"Temporal filter pass did not initialize temporal state"
|
|
2960
2960
|
);
|
|
2961
2961
|
}
|
|
2962
2962
|
if (logicalPlan === void 0) {
|
|
2963
|
-
throw new
|
|
2963
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
2964
2964
|
"Logical plan pass did not initialize plan state"
|
|
2965
2965
|
);
|
|
2966
2966
|
}
|
|
2967
2967
|
if (vlTraversal === void 0) {
|
|
2968
|
-
throw new
|
|
2968
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
2969
2969
|
"Recursive traversal pass did not select traversal"
|
|
2970
2970
|
);
|
|
2971
2971
|
}
|
|
@@ -3057,7 +3057,7 @@ function compileRecursiveCte(ast, traversal, graphId, ctx, requiredColumnsByAlia
|
|
|
3057
3057
|
targetContext
|
|
3058
3058
|
);
|
|
3059
3059
|
if (vl.maxDepth > MAX_EXPLICIT_RECURSIVE_DEPTH) {
|
|
3060
|
-
throw new
|
|
3060
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
3061
3061
|
`Recursive traversal maxHops(${vl.maxDepth}) exceeds maximum explicit depth of ${MAX_EXPLICIT_RECURSIVE_DEPTH}`
|
|
3062
3062
|
);
|
|
3063
3063
|
}
|
|
@@ -3284,7 +3284,7 @@ function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
|
|
|
3284
3284
|
const allowedAliases = /* @__PURE__ */ new Set([ast.start.alias, traversal.nodeAlias]);
|
|
3285
3285
|
const columns = fields.map((field2) => {
|
|
3286
3286
|
if (!allowedAliases.has(field2.alias)) {
|
|
3287
|
-
throw new
|
|
3287
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
3288
3288
|
`Selective projection for recursive traversals does not support alias "${field2.alias}"`
|
|
3289
3289
|
);
|
|
3290
3290
|
}
|
|
@@ -3318,7 +3318,7 @@ function compileRecursiveOrderBy(ast, dialect) {
|
|
|
3318
3318
|
for (const orderSpec of ast.orderBy) {
|
|
3319
3319
|
const valueType = orderSpec.field.valueType;
|
|
3320
3320
|
if (valueType === "array" || valueType === "object") {
|
|
3321
|
-
throw new
|
|
3321
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
3322
3322
|
"Ordering by JSON arrays or objects is not supported"
|
|
3323
3323
|
);
|
|
3324
3324
|
}
|
|
@@ -3351,15 +3351,15 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
3351
3351
|
var VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;
|
|
3352
3352
|
function validateTableName(name, label) {
|
|
3353
3353
|
if (!name || name.length === 0) {
|
|
3354
|
-
throw new
|
|
3354
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(`${label} table name cannot be empty`);
|
|
3355
3355
|
}
|
|
3356
3356
|
if (name.length > chunkMME3H4ZF_cjs.MAX_PG_IDENTIFIER_LENGTH) {
|
|
3357
|
-
throw new
|
|
3357
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
3358
3358
|
`${label} table name exceeds maximum length of ${chunkMME3H4ZF_cjs.MAX_PG_IDENTIFIER_LENGTH} characters`
|
|
3359
3359
|
);
|
|
3360
3360
|
}
|
|
3361
3361
|
if (!VALID_IDENTIFIER_PATTERN.test(name)) {
|
|
3362
|
-
throw new
|
|
3362
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
3363
3363
|
`${label} table name "${name}" is not a valid SQL identifier. Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`
|
|
3364
3364
|
);
|
|
3365
3365
|
}
|
|
@@ -3907,7 +3907,7 @@ function compileSetOperation(op, graphId, dialect, schema, compileQuery2) {
|
|
|
3907
3907
|
const passState = runSetOperationPassPipeline(op, graphId, dialect);
|
|
3908
3908
|
const { logicalPlan } = passState;
|
|
3909
3909
|
if (logicalPlan === void 0) {
|
|
3910
|
-
throw new
|
|
3910
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
3911
3911
|
"Logical plan pass did not initialize plan state"
|
|
3912
3912
|
);
|
|
3913
3913
|
}
|
|
@@ -3971,7 +3971,7 @@ function compileSetOperationForSqlite(op, graphId, dialect, logicalPlan, schema)
|
|
|
3971
3971
|
dialect,
|
|
3972
3972
|
schema,
|
|
3973
3973
|
compileQuery: () => {
|
|
3974
|
-
throw new
|
|
3974
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
3975
3975
|
"compileQuery is not available in set-operation CTE compilation"
|
|
3976
3976
|
);
|
|
3977
3977
|
}
|
|
@@ -4023,7 +4023,7 @@ function validateSqliteSetOpLeaf(ast) {
|
|
|
4023
4023
|
unsupported.push("per-query OFFSET (use set operation's offset instead)");
|
|
4024
4024
|
}
|
|
4025
4025
|
if (unsupported.length > 0) {
|
|
4026
|
-
throw new
|
|
4026
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
4027
4027
|
`SQLite set operations (UNION/INTERSECT/EXCEPT) do not support: ${unsupported.join(", ")}. Use PostgreSQL for complex set operations, or refactor to separate queries.`
|
|
4028
4028
|
);
|
|
4029
4029
|
}
|
|
@@ -4179,7 +4179,7 @@ function compileFieldValueForSetOp(source, prefix, alias, dialect) {
|
|
|
4179
4179
|
return drizzleOrm.sql`${drizzleOrm.sql.raw(fn.toUpperCase())}(${column})`;
|
|
4180
4180
|
}
|
|
4181
4181
|
default: {
|
|
4182
|
-
throw new
|
|
4182
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
4183
4183
|
`Unknown aggregate function: ${String(fn)}`
|
|
4184
4184
|
);
|
|
4185
4185
|
}
|
|
@@ -4233,7 +4233,7 @@ function buildCompoundSelectRecursive(query, leaves, prefixToSelect) {
|
|
|
4233
4233
|
if (!("__type" in query)) {
|
|
4234
4234
|
const leaf = leaves.find((l) => l.ast === query);
|
|
4235
4235
|
if (!leaf) {
|
|
4236
|
-
throw new
|
|
4236
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError("Leaf query not found in leaves array");
|
|
4237
4237
|
}
|
|
4238
4238
|
return prefixToSelect.get(leaf.prefix);
|
|
4239
4239
|
}
|
|
@@ -4277,7 +4277,7 @@ function buildSetOperationSuffixClauses(op, dialect) {
|
|
|
4277
4277
|
if (op.orderBy && op.orderBy.length > 0) {
|
|
4278
4278
|
const projection = getLeftmostProjection(op);
|
|
4279
4279
|
if (projection.fields.length === 0) {
|
|
4280
|
-
throw new
|
|
4280
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
4281
4281
|
"Set operation ORDER BY requires explicit field projection. SELECT * does not provide stable output column names for ordering. Use .select() to specify which fields to project."
|
|
4282
4282
|
);
|
|
4283
4283
|
}
|
|
@@ -4287,7 +4287,7 @@ function buildSetOperationSuffixClauses(op, dialect) {
|
|
|
4287
4287
|
if (!projected) {
|
|
4288
4288
|
const fieldDesc = orderSpec.field.jsonPointer ? `${orderSpec.field.alias}.props${orderSpec.field.jsonPointer}` : `${orderSpec.field.alias}.${orderSpec.field.path.join(".")}`;
|
|
4289
4289
|
const availableFields = projection.fields.map((f) => f.outputName).join(", ");
|
|
4290
|
-
throw new
|
|
4290
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
4291
4291
|
`Set operation ORDER BY field "${fieldDesc}" is not in the projection. ORDER BY for UNION/INTERSECT/EXCEPT must reference projected columns. Available columns: ${availableFields}`
|
|
4292
4292
|
);
|
|
4293
4293
|
}
|
|
@@ -4894,13 +4894,13 @@ function compileStandardQueryWithCteStrategy(ast, graphId, ctx) {
|
|
|
4894
4894
|
vectorPredicate
|
|
4895
4895
|
} = runStandardQueryPassPipeline(ast, graphId, ctx);
|
|
4896
4896
|
if (temporalFilterPass === void 0) {
|
|
4897
|
-
throw new
|
|
4897
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
4898
4898
|
"Temporal filter pass did not initialize temporal state",
|
|
4899
4899
|
{ phase: "standard-pass-pipeline" }
|
|
4900
4900
|
);
|
|
4901
4901
|
}
|
|
4902
4902
|
if (logicalPlan === void 0) {
|
|
4903
|
-
throw new
|
|
4903
|
+
throw new chunkO5PST6TB_cjs.CompilerInvariantError(
|
|
4904
4904
|
"Logical plan pass did not initialize plan state",
|
|
4905
4905
|
{ phase: "standard-pass-pipeline" }
|
|
4906
4906
|
);
|
|
@@ -5001,7 +5001,7 @@ function decodeCursor(cursor) {
|
|
|
5001
5001
|
const json = atob(base64);
|
|
5002
5002
|
const raw = JSON.parse(json);
|
|
5003
5003
|
if (typeof raw.v !== "number" || raw.v > CURSOR_VERSION) {
|
|
5004
|
-
throw new
|
|
5004
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5005
5005
|
`Unsupported cursor version: ${String(raw.v)}. Maximum supported: ${CURSOR_VERSION}`,
|
|
5006
5006
|
{
|
|
5007
5007
|
issues: [
|
|
@@ -5017,7 +5017,7 @@ function decodeCursor(cursor) {
|
|
|
5017
5017
|
);
|
|
5018
5018
|
}
|
|
5019
5019
|
if (raw.d !== "f" && raw.d !== "b") {
|
|
5020
|
-
throw new
|
|
5020
|
+
throw new chunkO5PST6TB_cjs.ValidationError(`Invalid cursor direction: ${String(raw.d)}`, {
|
|
5021
5021
|
issues: [
|
|
5022
5022
|
{
|
|
5023
5023
|
path: "cursor",
|
|
@@ -5027,7 +5027,7 @@ function decodeCursor(cursor) {
|
|
|
5027
5027
|
});
|
|
5028
5028
|
}
|
|
5029
5029
|
if (!Array.isArray(raw.vals) || !Array.isArray(raw.cols)) {
|
|
5030
|
-
throw new
|
|
5030
|
+
throw new chunkO5PST6TB_cjs.ValidationError("Invalid cursor structure", {
|
|
5031
5031
|
issues: [
|
|
5032
5032
|
{
|
|
5033
5033
|
path: "cursor",
|
|
@@ -5037,7 +5037,7 @@ function decodeCursor(cursor) {
|
|
|
5037
5037
|
});
|
|
5038
5038
|
}
|
|
5039
5039
|
if (raw.vals.length !== raw.cols.length) {
|
|
5040
|
-
throw new
|
|
5040
|
+
throw new chunkO5PST6TB_cjs.ValidationError("Cursor column count mismatch", {
|
|
5041
5041
|
issues: [
|
|
5042
5042
|
{
|
|
5043
5043
|
path: "cursor",
|
|
@@ -5053,10 +5053,10 @@ function decodeCursor(cursor) {
|
|
|
5053
5053
|
cols: raw.cols
|
|
5054
5054
|
};
|
|
5055
5055
|
} catch (error) {
|
|
5056
|
-
if (error instanceof
|
|
5056
|
+
if (error instanceof chunkO5PST6TB_cjs.ValidationError) {
|
|
5057
5057
|
throw error;
|
|
5058
5058
|
}
|
|
5059
|
-
throw new
|
|
5059
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5060
5060
|
"Invalid cursor format",
|
|
5061
5061
|
{
|
|
5062
5062
|
issues: [{ path: "cursor", message: "Failed to decode cursor" }]
|
|
@@ -5120,7 +5120,7 @@ function buildCursorFromRow(row, orderSpecs, direction) {
|
|
|
5120
5120
|
function validateCursorColumns(cursorData, orderSpecs) {
|
|
5121
5121
|
const expectedCols = orderSpecs.map((spec) => buildColumnId(spec));
|
|
5122
5122
|
if (cursorData.cols.length !== expectedCols.length) {
|
|
5123
|
-
throw new
|
|
5123
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5124
5124
|
`Cursor has ${cursorData.cols.length} columns but query has ${expectedCols.length} ORDER BY columns`,
|
|
5125
5125
|
{
|
|
5126
5126
|
issues: [
|
|
@@ -5137,7 +5137,7 @@ function validateCursorColumns(cursorData, orderSpecs) {
|
|
|
5137
5137
|
}
|
|
5138
5138
|
for (const [index, expectedCol] of expectedCols.entries()) {
|
|
5139
5139
|
if (cursorData.cols[index] !== expectedCol) {
|
|
5140
|
-
throw new
|
|
5140
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5141
5141
|
`Cursor column mismatch at position ${index}: expected "${expectedCol}", got "${cursorData.cols[index]}"`,
|
|
5142
5142
|
{
|
|
5143
5143
|
issues: [
|
|
@@ -5951,7 +5951,7 @@ var SQL_RESERVED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
5951
5951
|
]);
|
|
5952
5952
|
function validateSqlIdentifier(alias) {
|
|
5953
5953
|
if (!SQL_IDENTIFIER_PATTERN.test(alias)) {
|
|
5954
|
-
throw new
|
|
5954
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5955
5955
|
`Invalid alias "${alias}": must start with a letter or underscore, contain only letters, digits, and underscores, and be at most 63 characters`,
|
|
5956
5956
|
{
|
|
5957
5957
|
issues: [
|
|
@@ -5967,7 +5967,7 @@ function validateSqlIdentifier(alias) {
|
|
|
5967
5967
|
);
|
|
5968
5968
|
}
|
|
5969
5969
|
if (alias.toLowerCase().startsWith("cte_")) {
|
|
5970
|
-
throw new
|
|
5970
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5971
5971
|
`Invalid alias "${alias}": aliases starting with "cte_" are reserved for internal use`,
|
|
5972
5972
|
{
|
|
5973
5973
|
issues: [
|
|
@@ -5983,7 +5983,7 @@ function validateSqlIdentifier(alias) {
|
|
|
5983
5983
|
);
|
|
5984
5984
|
}
|
|
5985
5985
|
if (SQL_RESERVED_KEYWORDS.has(alias.toLowerCase())) {
|
|
5986
|
-
throw new
|
|
5986
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
5987
5987
|
`Invalid alias "${alias}": "${alias}" is a reserved SQL keyword`,
|
|
5988
5988
|
{
|
|
5989
5989
|
issues: [
|
|
@@ -5997,7 +5997,7 @@ function validateSqlIdentifier(alias) {
|
|
|
5997
5997
|
}
|
|
5998
5998
|
}
|
|
5999
5999
|
function throwInvalidVectorPredicatePlacement(path) {
|
|
6000
|
-
throw new
|
|
6000
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
6001
6001
|
"Vector similarity predicates cannot be nested under OR or NOT. Use top-level AND combinations instead.",
|
|
6002
6002
|
{
|
|
6003
6003
|
issues: [
|
|
@@ -6108,7 +6108,7 @@ function buildQueryAst(config, state) {
|
|
|
6108
6108
|
}
|
|
6109
6109
|
function toLiteral(value) {
|
|
6110
6110
|
if (value === null) {
|
|
6111
|
-
throw new
|
|
6111
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6112
6112
|
"Parameter value must not be null (use undefined-based patterns instead)",
|
|
6113
6113
|
{ parameterName: "value", valueType: "null" }
|
|
6114
6114
|
);
|
|
@@ -6125,7 +6125,7 @@ function toLiteral(value) {
|
|
|
6125
6125
|
if (typeof value === "boolean") {
|
|
6126
6126
|
return { __type: "literal", value, valueType: "boolean" };
|
|
6127
6127
|
}
|
|
6128
|
-
throw new
|
|
6128
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6129
6129
|
`Unsupported parameter value type: ${typeof value}`,
|
|
6130
6130
|
{ parameterName: "value", actualType: typeof value }
|
|
6131
6131
|
);
|
|
@@ -6136,7 +6136,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6136
6136
|
if (isParameterRef(expr.right)) {
|
|
6137
6137
|
const value = bindings[expr.right.name];
|
|
6138
6138
|
if (value === void 0) {
|
|
6139
|
-
throw new
|
|
6139
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6140
6140
|
`Missing binding for parameter "${expr.right.name}"`,
|
|
6141
6141
|
{ parameterName: expr.right.name }
|
|
6142
6142
|
);
|
|
@@ -6152,13 +6152,13 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6152
6152
|
if (isParameterRef(expr.pattern)) {
|
|
6153
6153
|
const value = bindings[expr.pattern.name];
|
|
6154
6154
|
if (value === void 0) {
|
|
6155
|
-
throw new
|
|
6155
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6156
6156
|
`Missing binding for parameter "${expr.pattern.name}"`,
|
|
6157
6157
|
{ parameterName: expr.pattern.name }
|
|
6158
6158
|
);
|
|
6159
6159
|
}
|
|
6160
6160
|
if (typeof value !== "string") {
|
|
6161
|
-
throw new
|
|
6161
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6162
6162
|
`Parameter "${expr.pattern.name}" must be a string for string operations`,
|
|
6163
6163
|
{ parameterName: expr.pattern.name, actualType: typeof value }
|
|
6164
6164
|
);
|
|
@@ -6225,7 +6225,7 @@ function substitutePredicateExpression(expr, bindings) {
|
|
|
6225
6225
|
function resolveBinding(bindings, name) {
|
|
6226
6226
|
const value = bindings[name];
|
|
6227
6227
|
if (value === void 0) {
|
|
6228
|
-
throw new
|
|
6228
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(`Missing binding for parameter "${name}"`, {
|
|
6229
6229
|
parameterName: name
|
|
6230
6230
|
});
|
|
6231
6231
|
}
|
|
@@ -6250,7 +6250,7 @@ function fillPlaceholders(params, bindings, dialect) {
|
|
|
6250
6250
|
const name = parameter.name;
|
|
6251
6251
|
const value = bindings[name];
|
|
6252
6252
|
if (value === void 0) {
|
|
6253
|
-
throw new
|
|
6253
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6254
6254
|
`Missing binding for parameter "${name}"`,
|
|
6255
6255
|
{ parameterName: name }
|
|
6256
6256
|
);
|
|
@@ -6317,7 +6317,7 @@ var PreparedQuery = class {
|
|
|
6317
6317
|
this.#selectFn
|
|
6318
6318
|
);
|
|
6319
6319
|
} catch (error) {
|
|
6320
|
-
if (error instanceof MissingSelectiveFieldError || error instanceof
|
|
6320
|
+
if (error instanceof MissingSelectiveFieldError || error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
6321
6321
|
return this.#executeUnoptimized(bindings);
|
|
6322
6322
|
}
|
|
6323
6323
|
throw error;
|
|
@@ -6487,7 +6487,7 @@ function validateBindings(bindings, metadata) {
|
|
|
6487
6487
|
}
|
|
6488
6488
|
}
|
|
6489
6489
|
if (missing.length > 0) {
|
|
6490
|
-
throw new
|
|
6490
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6491
6491
|
`Missing bindings for parameter${missing.length === 1 ? "" : "s"}: ${missing.map((name) => `"${name}"`).join(", ")}`,
|
|
6492
6492
|
{ missingParameters: missing }
|
|
6493
6493
|
);
|
|
@@ -6496,7 +6496,7 @@ function validateBindings(bindings, metadata) {
|
|
|
6496
6496
|
(name) => !expectedNames.has(name)
|
|
6497
6497
|
);
|
|
6498
6498
|
if (unexpected.length > 0) {
|
|
6499
|
-
throw new
|
|
6499
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6500
6500
|
`Unexpected bindings provided: ${unexpected.map((name) => `"${name}"`).join(", ")}`,
|
|
6501
6501
|
{ unexpectedParameters: unexpected }
|
|
6502
6502
|
);
|
|
@@ -6508,14 +6508,14 @@ function validateBindings(bindings, metadata) {
|
|
|
6508
6508
|
}
|
|
6509
6509
|
function validateBindingValue(name, value, isStringOp) {
|
|
6510
6510
|
if (value === null) {
|
|
6511
|
-
throw new
|
|
6511
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6512
6512
|
"Parameter value must not be null (use undefined-based patterns instead)",
|
|
6513
6513
|
{ parameterName: name, valueType: "null" }
|
|
6514
6514
|
);
|
|
6515
6515
|
}
|
|
6516
6516
|
if (isStringOp) {
|
|
6517
6517
|
if (typeof value !== "string") {
|
|
6518
|
-
throw new
|
|
6518
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6519
6519
|
`Parameter "${name}" must be a string for string operations`,
|
|
6520
6520
|
{ parameterName: name, actualType: typeof value }
|
|
6521
6521
|
);
|
|
@@ -6525,7 +6525,7 @@ function validateBindingValue(name, value, isStringOp) {
|
|
|
6525
6525
|
if (value instanceof Date || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
6526
6526
|
return;
|
|
6527
6527
|
}
|
|
6528
|
-
throw new
|
|
6528
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
6529
6529
|
`Unsupported parameter value type: ${typeof value}`,
|
|
6530
6530
|
{ parameterName: name, actualType: typeof value }
|
|
6531
6531
|
);
|
|
@@ -6912,7 +6912,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
6912
6912
|
this.#cachedOptimizedCompiled = NOT_COMPUTED;
|
|
6913
6913
|
return void 0;
|
|
6914
6914
|
}
|
|
6915
|
-
if (error instanceof
|
|
6915
|
+
if (error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
6916
6916
|
this.#cachedSelectiveFieldsForExecute = void 0;
|
|
6917
6917
|
this.#cachedOptimizedCompiled = NOT_COMPUTED;
|
|
6918
6918
|
return void 0;
|
|
@@ -6962,7 +6962,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
6962
6962
|
this.#cachedOptimizedCompiled = NOT_COMPUTED;
|
|
6963
6963
|
return void 0;
|
|
6964
6964
|
}
|
|
6965
|
-
if (error instanceof
|
|
6965
|
+
if (error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
6966
6966
|
this.#cachedSelectiveFieldsForExecute = void 0;
|
|
6967
6967
|
this.#cachedOptimizedCompiled = NOT_COMPUTED;
|
|
6968
6968
|
return void 0;
|
|
@@ -7096,7 +7096,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7096
7096
|
selectiveFields
|
|
7097
7097
|
});
|
|
7098
7098
|
} catch (error) {
|
|
7099
|
-
if (error instanceof
|
|
7099
|
+
if (error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
7100
7100
|
this.#cachedSelectiveFieldsForPagination = void 0;
|
|
7101
7101
|
return void 0;
|
|
7102
7102
|
}
|
|
@@ -7122,7 +7122,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7122
7122
|
this.#cachedSelectiveFieldsForPagination = void 0;
|
|
7123
7123
|
return void 0;
|
|
7124
7124
|
}
|
|
7125
|
-
if (error instanceof
|
|
7125
|
+
if (error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
7126
7126
|
this.#cachedSelectiveFieldsForPagination = void 0;
|
|
7127
7127
|
return void 0;
|
|
7128
7128
|
}
|
|
@@ -7147,7 +7147,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7147
7147
|
this.#cachedSelectiveFieldsForPagination = void 0;
|
|
7148
7148
|
return void 0;
|
|
7149
7149
|
}
|
|
7150
|
-
if (error instanceof
|
|
7150
|
+
if (error instanceof chunkO5PST6TB_cjs.UnsupportedPredicateError) {
|
|
7151
7151
|
this.#cachedSelectiveFieldsForPagination = void 0;
|
|
7152
7152
|
return void 0;
|
|
7153
7153
|
}
|
|
@@ -7303,7 +7303,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7303
7303
|
);
|
|
7304
7304
|
}
|
|
7305
7305
|
if (this.#state.orderBy.length === 0) {
|
|
7306
|
-
throw new
|
|
7306
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
7307
7307
|
"Cursor pagination requires ORDER BY. Add .orderBy() before .paginate()",
|
|
7308
7308
|
{
|
|
7309
7309
|
issues: [
|
|
@@ -7379,7 +7379,7 @@ var ExecutableQuery = class _ExecutableQuery {
|
|
|
7379
7379
|
*/
|
|
7380
7380
|
stream(options) {
|
|
7381
7381
|
if (this.#state.orderBy.length === 0) {
|
|
7382
|
-
throw new
|
|
7382
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
7383
7383
|
"Streaming requires ORDER BY. Add .orderBy() before .stream()",
|
|
7384
7384
|
{
|
|
7385
7385
|
issues: [
|
|
@@ -8158,7 +8158,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
8158
8158
|
*/
|
|
8159
8159
|
temporal(mode, asOf) {
|
|
8160
8160
|
if (mode === "asOf" && asOf === void 0) {
|
|
8161
|
-
throw new
|
|
8161
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
8162
8162
|
'Temporal mode "asOf" requires a timestamp',
|
|
8163
8163
|
{
|
|
8164
8164
|
issues: [
|
|
@@ -8837,12 +8837,12 @@ function createQueryBuilder(graphId, registry, options) {
|
|
|
8837
8837
|
function buildKindRegistry(graph) {
|
|
8838
8838
|
const nodeTypes = extractNodeTypes(graph);
|
|
8839
8839
|
const edgeTypes = extractEdgeTypes(graph);
|
|
8840
|
-
const closures = graph.ontology.length > 0 ?
|
|
8841
|
-
return new
|
|
8840
|
+
const closures = graph.ontology.length > 0 ? chunkX33WV2UF_cjs.computeClosuresFromOntology(graph.ontology) : chunkX33WV2UF_cjs.createEmptyClosures();
|
|
8841
|
+
return new chunkX33WV2UF_cjs.KindRegistry(nodeTypes, edgeTypes, closures);
|
|
8842
8842
|
}
|
|
8843
8843
|
function extractNodeTypes(graph) {
|
|
8844
8844
|
const result = /* @__PURE__ */ new Map();
|
|
8845
|
-
for (const typeName of
|
|
8845
|
+
for (const typeName of chunk5GZMPJOP_cjs.getNodeKinds(graph)) {
|
|
8846
8846
|
const registration = graph.nodes[typeName];
|
|
8847
8847
|
result.set(typeName, registration.type);
|
|
8848
8848
|
}
|
|
@@ -8850,7 +8850,7 @@ function extractNodeTypes(graph) {
|
|
|
8850
8850
|
}
|
|
8851
8851
|
function extractEdgeTypes(graph) {
|
|
8852
8852
|
const result = /* @__PURE__ */ new Map();
|
|
8853
|
-
for (const typeName of
|
|
8853
|
+
for (const typeName of chunk5GZMPJOP_cjs.getEdgeKinds(graph)) {
|
|
8854
8854
|
const registration = graph.edges[typeName];
|
|
8855
8855
|
result.set(typeName, registration.type);
|
|
8856
8856
|
}
|
|
@@ -9024,7 +9024,7 @@ function createEdgeCollection(config) {
|
|
|
9024
9024
|
async find(options) {
|
|
9025
9025
|
const untypedOptions = options;
|
|
9026
9026
|
if (untypedOptions?.where !== void 0) {
|
|
9027
|
-
throw new
|
|
9027
|
+
throw new chunkO5PST6TB_cjs.UnsupportedPredicateError(
|
|
9028
9028
|
`store.edges.${kind}.find({ where }) is not supported. Use store.query().traverse(...).whereEdge(...) for edge property filters.`,
|
|
9029
9029
|
{ kind, operation: "find" }
|
|
9030
9030
|
);
|
|
@@ -9037,7 +9037,7 @@ function createEdgeCollection(config) {
|
|
|
9037
9037
|
temporalMode: mode
|
|
9038
9038
|
};
|
|
9039
9039
|
if (mode === "current" || mode === "asOf") {
|
|
9040
|
-
params.asOf = options?.asOf ??
|
|
9040
|
+
params.asOf = options?.asOf ?? chunk5GZMPJOP_cjs.nowIso();
|
|
9041
9041
|
}
|
|
9042
9042
|
if (options?.from?.kind !== void 0)
|
|
9043
9043
|
params.fromKind = options.from.kind;
|
|
@@ -9058,7 +9058,7 @@ function createEdgeCollection(config) {
|
|
|
9058
9058
|
temporalMode: mode
|
|
9059
9059
|
};
|
|
9060
9060
|
if (mode === "current" || mode === "asOf") {
|
|
9061
|
-
params.asOf = options?.asOf ??
|
|
9061
|
+
params.asOf = options?.asOf ?? chunk5GZMPJOP_cjs.nowIso();
|
|
9062
9062
|
}
|
|
9063
9063
|
if (options?.from?.kind !== void 0)
|
|
9064
9064
|
params.fromKind = options.from.kind;
|
|
@@ -9344,7 +9344,7 @@ function createNodeCollection(config) {
|
|
|
9344
9344
|
},
|
|
9345
9345
|
async find(options) {
|
|
9346
9346
|
if (options?.where !== void 0 && createQuery === void 0) {
|
|
9347
|
-
throw new
|
|
9347
|
+
throw new chunkO5PST6TB_cjs.ConfigurationError(
|
|
9348
9348
|
`store.nodes.${kind}.find({ where }) requires a query-capable store`,
|
|
9349
9349
|
{ kind, operation: "find" }
|
|
9350
9350
|
);
|
|
@@ -9353,7 +9353,7 @@ function createNodeCollection(config) {
|
|
|
9353
9353
|
const mode2 = options.temporalMode ?? defaultTemporalMode;
|
|
9354
9354
|
let query = createQuery().from(kind, "_n").temporal(
|
|
9355
9355
|
mode2,
|
|
9356
|
-
mode2 === "asOf" ? options.asOf ??
|
|
9356
|
+
mode2 === "asOf" ? options.asOf ?? chunk5GZMPJOP_cjs.nowIso() : void 0
|
|
9357
9357
|
).whereNode("_n", options.where).select((ctx) => ctx._n);
|
|
9358
9358
|
if (options.limit !== void 0) query = query.limit(options.limit);
|
|
9359
9359
|
if (options.offset !== void 0) query = query.offset(options.offset);
|
|
@@ -9368,7 +9368,7 @@ function createNodeCollection(config) {
|
|
|
9368
9368
|
temporalMode: mode
|
|
9369
9369
|
};
|
|
9370
9370
|
if (mode === "current" || mode === "asOf") {
|
|
9371
|
-
params.asOf = options?.asOf ??
|
|
9371
|
+
params.asOf = options?.asOf ?? chunk5GZMPJOP_cjs.nowIso();
|
|
9372
9372
|
}
|
|
9373
9373
|
if (options?.limit !== void 0) params.limit = options.limit;
|
|
9374
9374
|
if (options?.offset !== void 0) params.offset = options.offset;
|
|
@@ -9384,7 +9384,7 @@ function createNodeCollection(config) {
|
|
|
9384
9384
|
temporalMode: mode
|
|
9385
9385
|
};
|
|
9386
9386
|
if (mode === "current" || mode === "asOf") {
|
|
9387
|
-
params.asOf = options?.asOf ??
|
|
9387
|
+
params.asOf = options?.asOf ?? chunk5GZMPJOP_cjs.nowIso();
|
|
9388
9388
|
}
|
|
9389
9389
|
return backend.countNodesByKind(params);
|
|
9390
9390
|
},
|
|
@@ -9594,7 +9594,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
|
|
|
9594
9594
|
return new Proxy({}, {
|
|
9595
9595
|
get: (_, kind) => {
|
|
9596
9596
|
if (!Object.hasOwn(graph.nodes, kind)) {
|
|
9597
|
-
throw new
|
|
9597
|
+
throw new chunkO5PST6TB_cjs.KindNotFoundError(kind, "node");
|
|
9598
9598
|
}
|
|
9599
9599
|
const cached = collectionCache.get(kind);
|
|
9600
9600
|
if (cached !== void 0) {
|
|
@@ -9616,7 +9616,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
|
|
|
9616
9616
|
return new Proxy({}, {
|
|
9617
9617
|
get: (_, kind) => {
|
|
9618
9618
|
if (!Object.hasOwn(graph.edges, kind)) {
|
|
9619
|
-
throw new
|
|
9619
|
+
throw new chunkO5PST6TB_cjs.KindNotFoundError(kind, "edge");
|
|
9620
9620
|
}
|
|
9621
9621
|
const cached = collectionCache.get(kind);
|
|
9622
9622
|
if (cached !== void 0) {
|
|
@@ -9715,7 +9715,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
9715
9715
|
}
|
|
9716
9716
|
case "one": {
|
|
9717
9717
|
if (existingEdgeCount > 0) {
|
|
9718
|
-
return new
|
|
9718
|
+
return new chunkO5PST6TB_cjs.CardinalityError({
|
|
9719
9719
|
edgeKind,
|
|
9720
9720
|
fromKind,
|
|
9721
9721
|
fromId,
|
|
@@ -9730,7 +9730,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
9730
9730
|
}
|
|
9731
9731
|
case "oneActive": {
|
|
9732
9732
|
if (hasActiveEdge) {
|
|
9733
|
-
return new
|
|
9733
|
+
return new chunkO5PST6TB_cjs.CardinalityError({
|
|
9734
9734
|
edgeKind,
|
|
9735
9735
|
fromKind,
|
|
9736
9736
|
fromId,
|
|
@@ -9744,7 +9744,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
9744
9744
|
}
|
|
9745
9745
|
function checkUniqueEdge(edgeKind, fromKind, fromId, _toKind, _toId, existingCount) {
|
|
9746
9746
|
if (existingCount > 0) {
|
|
9747
|
-
return new
|
|
9747
|
+
return new chunkO5PST6TB_cjs.CardinalityError({
|
|
9748
9748
|
edgeKind,
|
|
9749
9749
|
fromKind,
|
|
9750
9750
|
fromId,
|
|
@@ -9760,7 +9760,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
9760
9760
|
(validKind) => registry.isAssignableTo(fromKind, validKind)
|
|
9761
9761
|
);
|
|
9762
9762
|
if (!fromValid) {
|
|
9763
|
-
return new
|
|
9763
|
+
return new chunkO5PST6TB_cjs.EndpointError({
|
|
9764
9764
|
edgeKind,
|
|
9765
9765
|
endpoint: "from",
|
|
9766
9766
|
actualKind: fromKind,
|
|
@@ -9772,7 +9772,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
9772
9772
|
(validKind) => registry.isAssignableTo(toKind, validKind)
|
|
9773
9773
|
);
|
|
9774
9774
|
if (!toValid) {
|
|
9775
|
-
return new
|
|
9775
|
+
return new chunkO5PST6TB_cjs.EndpointError({
|
|
9776
9776
|
edgeKind,
|
|
9777
9777
|
endpoint: "to",
|
|
9778
9778
|
actualKind: toKind,
|
|
@@ -9784,7 +9784,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
9784
9784
|
function checkDisjointness(nodeId, nodeKind, existingKinds, registry) {
|
|
9785
9785
|
for (const existingKind of existingKinds) {
|
|
9786
9786
|
if (registry.areDisjoint(nodeKind, existingKind)) {
|
|
9787
|
-
return new
|
|
9787
|
+
return new chunkO5PST6TB_cjs.DisjointError({
|
|
9788
9788
|
nodeId,
|
|
9789
9789
|
attemptedKind: nodeKind,
|
|
9790
9790
|
conflictingKind: existingKind
|
|
@@ -9876,7 +9876,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
9876
9876
|
// src/store/operations/edge-operations.ts
|
|
9877
9877
|
function getEdgeRegistration(graph, kind) {
|
|
9878
9878
|
const registration = graph.edges[kind];
|
|
9879
|
-
if (registration === void 0) throw new
|
|
9879
|
+
if (registration === void 0) throw new chunkO5PST6TB_cjs.KindNotFoundError(kind, "edge");
|
|
9880
9880
|
return registration;
|
|
9881
9881
|
}
|
|
9882
9882
|
function buildEdgeEndpointCacheKey(graphId, kind, id) {
|
|
@@ -10018,7 +10018,7 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
10018
10018
|
if (endpointError) throw endpointError;
|
|
10019
10019
|
const fromNode = await backend.getNode(ctx.graphId, fromKind, input.fromId);
|
|
10020
10020
|
if (!fromNode || fromNode.deleted_at) {
|
|
10021
|
-
throw new
|
|
10021
|
+
throw new chunkO5PST6TB_cjs.EndpointNotFoundError({
|
|
10022
10022
|
edgeKind: kind,
|
|
10023
10023
|
endpoint: "from",
|
|
10024
10024
|
nodeKind: fromKind,
|
|
@@ -10027,19 +10027,19 @@ async function validateAndPrepareEdgeCreate(ctx, input, id, backend) {
|
|
|
10027
10027
|
}
|
|
10028
10028
|
const toNode = await backend.getNode(ctx.graphId, toKind, input.toId);
|
|
10029
10029
|
if (!toNode || toNode.deleted_at) {
|
|
10030
|
-
throw new
|
|
10030
|
+
throw new chunkO5PST6TB_cjs.EndpointNotFoundError({
|
|
10031
10031
|
edgeKind: kind,
|
|
10032
10032
|
endpoint: "to",
|
|
10033
10033
|
nodeKind: toKind,
|
|
10034
10034
|
nodeId: input.toId
|
|
10035
10035
|
});
|
|
10036
10036
|
}
|
|
10037
|
-
const validatedProps =
|
|
10037
|
+
const validatedProps = chunkX33WV2UF_cjs.validateEdgeProps(edgeKind.schema, input.props, {
|
|
10038
10038
|
kind,
|
|
10039
10039
|
operation: "create"
|
|
10040
10040
|
});
|
|
10041
|
-
const validFrom =
|
|
10042
|
-
const validTo =
|
|
10041
|
+
const validFrom = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validFrom, "validFrom");
|
|
10042
|
+
const validTo = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validTo, "validTo");
|
|
10043
10043
|
const cardinality = registration.cardinality ?? "many";
|
|
10044
10044
|
const constraintContext = {
|
|
10045
10045
|
graphId: ctx.graphId,
|
|
@@ -10094,7 +10094,7 @@ async function executeEdgeCreateInternal(ctx, input, backend, options) {
|
|
|
10094
10094
|
async function executeEdgeCreate(ctx, input, backend) {
|
|
10095
10095
|
const result = await executeEdgeCreateInternal(ctx, input, backend);
|
|
10096
10096
|
if (!result) {
|
|
10097
|
-
throw new
|
|
10097
|
+
throw new chunkO5PST6TB_cjs.DatabaseOperationError(
|
|
10098
10098
|
"Edge create failed: expected created edge row",
|
|
10099
10099
|
{ operation: "insert", entity: "edge" }
|
|
10100
10100
|
);
|
|
@@ -10171,7 +10171,7 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
10171
10171
|
const id = input.id;
|
|
10172
10172
|
const existing = await backend.getEdge(ctx.graphId, id);
|
|
10173
10173
|
if (!existing || existing.deleted_at) {
|
|
10174
|
-
throw new
|
|
10174
|
+
throw new chunkO5PST6TB_cjs.EdgeNotFoundError("unknown", id);
|
|
10175
10175
|
}
|
|
10176
10176
|
const opContext = ctx.createOperationContext(
|
|
10177
10177
|
"update",
|
|
@@ -10184,12 +10184,12 @@ async function executeEdgeUpdate(ctx, input, backend) {
|
|
|
10184
10184
|
const edgeKind = registration.type;
|
|
10185
10185
|
const existingProps = JSON.parse(existing.props);
|
|
10186
10186
|
const mergedProps = { ...existingProps, ...input.props };
|
|
10187
|
-
const validatedProps =
|
|
10187
|
+
const validatedProps = chunkX33WV2UF_cjs.validateEdgeProps(edgeKind.schema, mergedProps, {
|
|
10188
10188
|
kind: existing.kind,
|
|
10189
10189
|
operation: "update",
|
|
10190
10190
|
id
|
|
10191
10191
|
});
|
|
10192
|
-
const validTo =
|
|
10192
|
+
const validTo = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validTo, "validTo");
|
|
10193
10193
|
const updateParams = {
|
|
10194
10194
|
graphId: ctx.graphId,
|
|
10195
10195
|
id,
|
|
@@ -10204,18 +10204,18 @@ async function executeEdgeUpsertUpdate(ctx, input, backend, options) {
|
|
|
10204
10204
|
const id = input.id;
|
|
10205
10205
|
const existing = await backend.getEdge(ctx.graphId, id);
|
|
10206
10206
|
if (!existing) {
|
|
10207
|
-
throw new
|
|
10207
|
+
throw new chunkO5PST6TB_cjs.EdgeNotFoundError("unknown", id);
|
|
10208
10208
|
}
|
|
10209
10209
|
const registration = getEdgeRegistration(ctx.graph, existing.kind);
|
|
10210
10210
|
const edgeKind = registration.type;
|
|
10211
10211
|
const existingProps = JSON.parse(existing.props);
|
|
10212
10212
|
const mergedProps = { ...existingProps, ...input.props };
|
|
10213
|
-
const validatedProps =
|
|
10213
|
+
const validatedProps = chunkX33WV2UF_cjs.validateEdgeProps(edgeKind.schema, mergedProps, {
|
|
10214
10214
|
kind: existing.kind,
|
|
10215
10215
|
operation: "update",
|
|
10216
10216
|
id
|
|
10217
10217
|
});
|
|
10218
|
-
const validTo =
|
|
10218
|
+
const validTo = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validTo, "validTo");
|
|
10219
10219
|
const updateParams = {
|
|
10220
10220
|
graphId: ctx.graphId,
|
|
10221
10221
|
id,
|
|
@@ -10269,7 +10269,7 @@ function validateMatchOnFields(schema, matchOn, edgeKind) {
|
|
|
10269
10269
|
if (matchOn.length === 0) return;
|
|
10270
10270
|
const shape = schema.shape;
|
|
10271
10271
|
if (shape === void 0) {
|
|
10272
|
-
throw new
|
|
10272
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
10273
10273
|
`Edge kind "${edgeKind}" has no schema shape to validate matchOn fields against`,
|
|
10274
10274
|
{
|
|
10275
10275
|
kind: edgeKind,
|
|
@@ -10283,7 +10283,7 @@ function validateMatchOnFields(schema, matchOn, edgeKind) {
|
|
|
10283
10283
|
}
|
|
10284
10284
|
const invalidFields = matchOn.filter((field2) => !(field2 in shape));
|
|
10285
10285
|
if (invalidFields.length > 0) {
|
|
10286
|
-
throw new
|
|
10286
|
+
throw new chunkO5PST6TB_cjs.ValidationError(
|
|
10287
10287
|
`Invalid matchOn fields for edge kind "${edgeKind}": ${invalidFields.join(", ")}`,
|
|
10288
10288
|
{
|
|
10289
10289
|
kind: edgeKind,
|
|
@@ -10367,7 +10367,7 @@ async function executeEdgeGetOrCreateByEndpoints(ctx, kind, fromKind, fromId, to
|
|
|
10367
10367
|
const matchOn = options?.matchOn ?? [];
|
|
10368
10368
|
const registration = getEdgeRegistration(ctx.graph, kind);
|
|
10369
10369
|
const edgeKind = registration.type;
|
|
10370
|
-
const validatedProps =
|
|
10370
|
+
const validatedProps = chunkX33WV2UF_cjs.validateEdgeProps(edgeKind.schema, props, {
|
|
10371
10371
|
kind,
|
|
10372
10372
|
operation: "create"
|
|
10373
10373
|
});
|
|
@@ -10449,7 +10449,7 @@ async function executeEdgeBulkGetOrCreateByEndpoints(ctx, kind, items, backend,
|
|
|
10449
10449
|
validateMatchOnFields(edgeKind.schema, matchOn, kind);
|
|
10450
10450
|
const validated = [];
|
|
10451
10451
|
for (const item of items) {
|
|
10452
|
-
const validatedProps =
|
|
10452
|
+
const validatedProps = chunkX33WV2UF_cjs.validateEdgeProps(edgeKind.schema, item.props, {
|
|
10453
10453
|
kind,
|
|
10454
10454
|
operation: "create"
|
|
10455
10455
|
});
|
|
@@ -10726,7 +10726,7 @@ async function checkUniquenessConstraints(ctx, kind, id, props, constraints) {
|
|
|
10726
10726
|
key
|
|
10727
10727
|
});
|
|
10728
10728
|
if (existing && existing.node_id !== id) {
|
|
10729
|
-
throw new
|
|
10729
|
+
throw new chunkO5PST6TB_cjs.UniquenessError({
|
|
10730
10730
|
constraintName: constraint.name,
|
|
10731
10731
|
kind: kindToCheck,
|
|
10732
10732
|
existingId: existing.node_id,
|
|
@@ -10809,7 +10809,7 @@ async function updateUniquenessEntries(ctx, kind, id, oldProps, newProps, constr
|
|
|
10809
10809
|
key: newKey
|
|
10810
10810
|
});
|
|
10811
10811
|
if (existing && existing.node_id !== id) {
|
|
10812
|
-
throw new
|
|
10812
|
+
throw new chunkO5PST6TB_cjs.UniquenessError({
|
|
10813
10813
|
constraintName: constraint.name,
|
|
10814
10814
|
kind: kindToCheck,
|
|
10815
10815
|
existingId: existing.node_id,
|
|
@@ -10833,7 +10833,7 @@ async function updateUniquenessEntries(ctx, kind, id, oldProps, newProps, constr
|
|
|
10833
10833
|
// src/store/operations/node-operations.ts
|
|
10834
10834
|
function getNodeRegistration(graph, kind) {
|
|
10835
10835
|
const registration = graph.nodes[kind];
|
|
10836
|
-
if (registration === void 0) throw new
|
|
10836
|
+
if (registration === void 0) throw new chunkO5PST6TB_cjs.KindNotFoundError(kind, "node");
|
|
10837
10837
|
return registration;
|
|
10838
10838
|
}
|
|
10839
10839
|
var CACHE_KEY_SEPARATOR = "\0";
|
|
@@ -10844,7 +10844,7 @@ function buildUniqueCacheKey(graphId, nodeKind, constraintName, key) {
|
|
|
10844
10844
|
return `${graphId}${CACHE_KEY_SEPARATOR}${nodeKind}${CACHE_KEY_SEPARATOR}${constraintName}${CACHE_KEY_SEPARATOR}${key}`;
|
|
10845
10845
|
}
|
|
10846
10846
|
function createNodeAlreadyExistsError(kind, id) {
|
|
10847
|
-
return new
|
|
10847
|
+
return new chunkO5PST6TB_cjs.ValidationError(
|
|
10848
10848
|
`Node already exists: ${kind}/${id}`,
|
|
10849
10849
|
{
|
|
10850
10850
|
entityType: "node",
|
|
@@ -10885,7 +10885,7 @@ function resolveConstraint(graph, kind, constraintName) {
|
|
|
10885
10885
|
(candidate) => candidate.name === constraintName
|
|
10886
10886
|
);
|
|
10887
10887
|
if (constraint === void 0) {
|
|
10888
|
-
throw new
|
|
10888
|
+
throw new chunkO5PST6TB_cjs.NodeConstraintNotFoundError(constraintName, kind);
|
|
10889
10889
|
}
|
|
10890
10890
|
return constraint;
|
|
10891
10891
|
}
|
|
@@ -10994,12 +10994,12 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend) {
|
|
|
10994
10994
|
const kind = input.kind;
|
|
10995
10995
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
10996
10996
|
const nodeKind = registration.type;
|
|
10997
|
-
const validatedProps =
|
|
10997
|
+
const validatedProps = chunkX33WV2UF_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
10998
10998
|
kind,
|
|
10999
10999
|
operation: "create"
|
|
11000
11000
|
});
|
|
11001
|
-
const validFrom =
|
|
11002
|
-
const validTo =
|
|
11001
|
+
const validFrom = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validFrom, "validFrom");
|
|
11002
|
+
const validTo = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validTo, "validTo");
|
|
11003
11003
|
const existingNode = await backend.getNode(ctx.graphId, kind, id);
|
|
11004
11004
|
if (existingNode && !existingNode.deleted_at) {
|
|
11005
11005
|
throw createNodeAlreadyExistsError(kind, id);
|
|
@@ -11058,17 +11058,17 @@ async function performNodeUpdate(ctx, input, backend, options) {
|
|
|
11058
11058
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
11059
11059
|
const existing = await backend.getNode(ctx.graphId, kind, id);
|
|
11060
11060
|
if (!existing || existing.deleted_at && !options?.clearDeleted) {
|
|
11061
|
-
throw new
|
|
11061
|
+
throw new chunkO5PST6TB_cjs.NodeNotFoundError(kind, id);
|
|
11062
11062
|
}
|
|
11063
11063
|
const existingProps = JSON.parse(existing.props);
|
|
11064
11064
|
const mergedProps = { ...existingProps, ...input.props };
|
|
11065
11065
|
const nodeKind = registration.type;
|
|
11066
|
-
const validatedProps =
|
|
11066
|
+
const validatedProps = chunkX33WV2UF_cjs.validateNodeProps(nodeKind.schema, mergedProps, {
|
|
11067
11067
|
kind,
|
|
11068
11068
|
operation: "update",
|
|
11069
11069
|
id
|
|
11070
11070
|
});
|
|
11071
|
-
const validTo =
|
|
11071
|
+
const validTo = chunk5GZMPJOP_cjs.validateOptionalIsoDate(input.validTo, "validTo");
|
|
11072
11072
|
await updateUniquenessEntries(
|
|
11073
11073
|
createUniquenessContext(ctx.graphId, ctx.registry, backend),
|
|
11074
11074
|
kind,
|
|
@@ -11105,7 +11105,7 @@ async function enforceDeleteBehavior(ctx, kind, id, mode, backend, registration)
|
|
|
11105
11105
|
switch (deleteBehavior) {
|
|
11106
11106
|
case "restrict": {
|
|
11107
11107
|
const edgeKinds = [...new Set(connectedEdges.map((edge) => edge.kind))];
|
|
11108
|
-
throw new
|
|
11108
|
+
throw new chunkO5PST6TB_cjs.RestrictedDeleteError({
|
|
11109
11109
|
nodeKind: kind,
|
|
11110
11110
|
nodeId: id,
|
|
11111
11111
|
edgeCount: connectedEdges.length,
|
|
@@ -11226,7 +11226,7 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
11226
11226
|
async function executeNodeCreate(ctx, input, backend) {
|
|
11227
11227
|
const result = await executeNodeCreateInternal(ctx, input, backend);
|
|
11228
11228
|
if (!result) {
|
|
11229
|
-
throw new
|
|
11229
|
+
throw new chunkO5PST6TB_cjs.DatabaseOperationError(
|
|
11230
11230
|
"Node create failed: expected created node row",
|
|
11231
11231
|
{ operation: "insert", entity: "node" }
|
|
11232
11232
|
);
|
|
@@ -11327,7 +11327,7 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
11327
11327
|
const ifExists = options?.ifExists ?? "return";
|
|
11328
11328
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
11329
11329
|
const nodeKind = registration.type;
|
|
11330
|
-
const validatedProps =
|
|
11330
|
+
const validatedProps = chunkX33WV2UF_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
11331
11331
|
kind,
|
|
11332
11332
|
operation: "create"
|
|
11333
11333
|
});
|
|
@@ -11399,7 +11399,7 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
11399
11399
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
11400
11400
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
11401
11401
|
const nodeKind = registration.type;
|
|
11402
|
-
const validatedProps =
|
|
11402
|
+
const validatedProps = chunkX33WV2UF_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
11403
11403
|
kind,
|
|
11404
11404
|
operation: "create"
|
|
11405
11405
|
});
|
|
@@ -11436,7 +11436,7 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
11436
11436
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
11437
11437
|
const validated = [];
|
|
11438
11438
|
for (const item of items) {
|
|
11439
|
-
const validatedProps =
|
|
11439
|
+
const validatedProps = chunkX33WV2UF_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
11440
11440
|
kind,
|
|
11441
11441
|
operation: "create"
|
|
11442
11442
|
});
|
|
@@ -12048,7 +12048,7 @@ var Store = class {
|
|
|
12048
12048
|
// === Internal: Temporal Filtering ===
|
|
12049
12049
|
#matchesTemporalMode(row, options) {
|
|
12050
12050
|
const mode = options?.temporalMode ?? this.#graph.defaults.temporalMode;
|
|
12051
|
-
const asOf = options?.asOf ??
|
|
12051
|
+
const asOf = options?.asOf ?? chunk5GZMPJOP_cjs.nowIso();
|
|
12052
12052
|
switch (mode) {
|
|
12053
12053
|
case "current":
|
|
12054
12054
|
case "asOf": {
|
|
@@ -12081,137 +12081,141 @@ function createStore(graph, backend, options) {
|
|
|
12081
12081
|
}
|
|
12082
12082
|
async function createStoreWithSchema(graph, backend, options) {
|
|
12083
12083
|
const store = createStore(graph, backend, options);
|
|
12084
|
-
const result = await
|
|
12084
|
+
const result = await chunkX33WV2UF_cjs.ensureSchema(backend, graph, options);
|
|
12085
12085
|
return [store, result];
|
|
12086
12086
|
}
|
|
12087
12087
|
|
|
12088
12088
|
Object.defineProperty(exports, "isMetaEdge", {
|
|
12089
12089
|
enumerable: true,
|
|
12090
|
-
get: function () { return
|
|
12090
|
+
get: function () { return chunkX33WV2UF_cjs.isMetaEdge; }
|
|
12091
12091
|
});
|
|
12092
12092
|
Object.defineProperty(exports, "defineGraph", {
|
|
12093
12093
|
enumerable: true,
|
|
12094
|
-
get: function () { return
|
|
12094
|
+
get: function () { return chunk5GZMPJOP_cjs.defineGraph; }
|
|
12095
12095
|
});
|
|
12096
12096
|
Object.defineProperty(exports, "getEdgeKinds", {
|
|
12097
12097
|
enumerable: true,
|
|
12098
|
-
get: function () { return
|
|
12098
|
+
get: function () { return chunk5GZMPJOP_cjs.getEdgeKinds; }
|
|
12099
12099
|
});
|
|
12100
12100
|
Object.defineProperty(exports, "getNodeKinds", {
|
|
12101
12101
|
enumerable: true,
|
|
12102
|
-
get: function () { return
|
|
12102
|
+
get: function () { return chunk5GZMPJOP_cjs.getNodeKinds; }
|
|
12103
12103
|
});
|
|
12104
12104
|
Object.defineProperty(exports, "isEdgeType", {
|
|
12105
12105
|
enumerable: true,
|
|
12106
|
-
get: function () { return
|
|
12106
|
+
get: function () { return chunk5GZMPJOP_cjs.isEdgeType; }
|
|
12107
12107
|
});
|
|
12108
12108
|
Object.defineProperty(exports, "isEdgeTypeWithEndpoints", {
|
|
12109
12109
|
enumerable: true,
|
|
12110
|
-
get: function () { return
|
|
12110
|
+
get: function () { return chunk5GZMPJOP_cjs.isEdgeTypeWithEndpoints; }
|
|
12111
12111
|
});
|
|
12112
12112
|
Object.defineProperty(exports, "isGraphDef", {
|
|
12113
12113
|
enumerable: true,
|
|
12114
|
-
get: function () { return
|
|
12114
|
+
get: function () { return chunk5GZMPJOP_cjs.isGraphDef; }
|
|
12115
12115
|
});
|
|
12116
12116
|
Object.defineProperty(exports, "isNodeType", {
|
|
12117
12117
|
enumerable: true,
|
|
12118
|
-
get: function () { return
|
|
12118
|
+
get: function () { return chunk5GZMPJOP_cjs.isNodeType; }
|
|
12119
|
+
});
|
|
12120
|
+
Object.defineProperty(exports, "BackendDisposedError", {
|
|
12121
|
+
enumerable: true,
|
|
12122
|
+
get: function () { return chunkO5PST6TB_cjs.BackendDisposedError; }
|
|
12119
12123
|
});
|
|
12120
12124
|
Object.defineProperty(exports, "CardinalityError", {
|
|
12121
12125
|
enumerable: true,
|
|
12122
|
-
get: function () { return
|
|
12126
|
+
get: function () { return chunkO5PST6TB_cjs.CardinalityError; }
|
|
12123
12127
|
});
|
|
12124
12128
|
Object.defineProperty(exports, "CompilerInvariantError", {
|
|
12125
12129
|
enumerable: true,
|
|
12126
|
-
get: function () { return
|
|
12130
|
+
get: function () { return chunkO5PST6TB_cjs.CompilerInvariantError; }
|
|
12127
12131
|
});
|
|
12128
12132
|
Object.defineProperty(exports, "ConfigurationError", {
|
|
12129
12133
|
enumerable: true,
|
|
12130
|
-
get: function () { return
|
|
12134
|
+
get: function () { return chunkO5PST6TB_cjs.ConfigurationError; }
|
|
12131
12135
|
});
|
|
12132
12136
|
Object.defineProperty(exports, "DatabaseOperationError", {
|
|
12133
12137
|
enumerable: true,
|
|
12134
|
-
get: function () { return
|
|
12138
|
+
get: function () { return chunkO5PST6TB_cjs.DatabaseOperationError; }
|
|
12135
12139
|
});
|
|
12136
12140
|
Object.defineProperty(exports, "DisjointError", {
|
|
12137
12141
|
enumerable: true,
|
|
12138
|
-
get: function () { return
|
|
12142
|
+
get: function () { return chunkO5PST6TB_cjs.DisjointError; }
|
|
12139
12143
|
});
|
|
12140
12144
|
Object.defineProperty(exports, "EdgeNotFoundError", {
|
|
12141
12145
|
enumerable: true,
|
|
12142
|
-
get: function () { return
|
|
12146
|
+
get: function () { return chunkO5PST6TB_cjs.EdgeNotFoundError; }
|
|
12143
12147
|
});
|
|
12144
12148
|
Object.defineProperty(exports, "EndpointError", {
|
|
12145
12149
|
enumerable: true,
|
|
12146
|
-
get: function () { return
|
|
12150
|
+
get: function () { return chunkO5PST6TB_cjs.EndpointError; }
|
|
12147
12151
|
});
|
|
12148
12152
|
Object.defineProperty(exports, "EndpointNotFoundError", {
|
|
12149
12153
|
enumerable: true,
|
|
12150
|
-
get: function () { return
|
|
12154
|
+
get: function () { return chunkO5PST6TB_cjs.EndpointNotFoundError; }
|
|
12151
12155
|
});
|
|
12152
12156
|
Object.defineProperty(exports, "KindNotFoundError", {
|
|
12153
12157
|
enumerable: true,
|
|
12154
|
-
get: function () { return
|
|
12158
|
+
get: function () { return chunkO5PST6TB_cjs.KindNotFoundError; }
|
|
12155
12159
|
});
|
|
12156
12160
|
Object.defineProperty(exports, "MigrationError", {
|
|
12157
12161
|
enumerable: true,
|
|
12158
|
-
get: function () { return
|
|
12162
|
+
get: function () { return chunkO5PST6TB_cjs.MigrationError; }
|
|
12159
12163
|
});
|
|
12160
12164
|
Object.defineProperty(exports, "NodeConstraintNotFoundError", {
|
|
12161
12165
|
enumerable: true,
|
|
12162
|
-
get: function () { return
|
|
12166
|
+
get: function () { return chunkO5PST6TB_cjs.NodeConstraintNotFoundError; }
|
|
12163
12167
|
});
|
|
12164
12168
|
Object.defineProperty(exports, "NodeNotFoundError", {
|
|
12165
12169
|
enumerable: true,
|
|
12166
|
-
get: function () { return
|
|
12170
|
+
get: function () { return chunkO5PST6TB_cjs.NodeNotFoundError; }
|
|
12167
12171
|
});
|
|
12168
12172
|
Object.defineProperty(exports, "RestrictedDeleteError", {
|
|
12169
12173
|
enumerable: true,
|
|
12170
|
-
get: function () { return
|
|
12174
|
+
get: function () { return chunkO5PST6TB_cjs.RestrictedDeleteError; }
|
|
12171
12175
|
});
|
|
12172
12176
|
Object.defineProperty(exports, "SchemaMismatchError", {
|
|
12173
12177
|
enumerable: true,
|
|
12174
|
-
get: function () { return
|
|
12178
|
+
get: function () { return chunkO5PST6TB_cjs.SchemaMismatchError; }
|
|
12175
12179
|
});
|
|
12176
12180
|
Object.defineProperty(exports, "TypeGraphError", {
|
|
12177
12181
|
enumerable: true,
|
|
12178
|
-
get: function () { return
|
|
12182
|
+
get: function () { return chunkO5PST6TB_cjs.TypeGraphError; }
|
|
12179
12183
|
});
|
|
12180
12184
|
Object.defineProperty(exports, "UniquenessError", {
|
|
12181
12185
|
enumerable: true,
|
|
12182
|
-
get: function () { return
|
|
12186
|
+
get: function () { return chunkO5PST6TB_cjs.UniquenessError; }
|
|
12183
12187
|
});
|
|
12184
12188
|
Object.defineProperty(exports, "UnsupportedPredicateError", {
|
|
12185
12189
|
enumerable: true,
|
|
12186
|
-
get: function () { return
|
|
12190
|
+
get: function () { return chunkO5PST6TB_cjs.UnsupportedPredicateError; }
|
|
12187
12191
|
});
|
|
12188
12192
|
Object.defineProperty(exports, "ValidationError", {
|
|
12189
12193
|
enumerable: true,
|
|
12190
|
-
get: function () { return
|
|
12194
|
+
get: function () { return chunkO5PST6TB_cjs.ValidationError; }
|
|
12191
12195
|
});
|
|
12192
12196
|
Object.defineProperty(exports, "VersionConflictError", {
|
|
12193
12197
|
enumerable: true,
|
|
12194
|
-
get: function () { return
|
|
12198
|
+
get: function () { return chunkO5PST6TB_cjs.VersionConflictError; }
|
|
12195
12199
|
});
|
|
12196
12200
|
Object.defineProperty(exports, "getErrorSuggestion", {
|
|
12197
12201
|
enumerable: true,
|
|
12198
|
-
get: function () { return
|
|
12202
|
+
get: function () { return chunkO5PST6TB_cjs.getErrorSuggestion; }
|
|
12199
12203
|
});
|
|
12200
12204
|
Object.defineProperty(exports, "isConstraintError", {
|
|
12201
12205
|
enumerable: true,
|
|
12202
|
-
get: function () { return
|
|
12206
|
+
get: function () { return chunkO5PST6TB_cjs.isConstraintError; }
|
|
12203
12207
|
});
|
|
12204
12208
|
Object.defineProperty(exports, "isSystemError", {
|
|
12205
12209
|
enumerable: true,
|
|
12206
|
-
get: function () { return
|
|
12210
|
+
get: function () { return chunkO5PST6TB_cjs.isSystemError; }
|
|
12207
12211
|
});
|
|
12208
12212
|
Object.defineProperty(exports, "isTypeGraphError", {
|
|
12209
12213
|
enumerable: true,
|
|
12210
|
-
get: function () { return
|
|
12214
|
+
get: function () { return chunkO5PST6TB_cjs.isTypeGraphError; }
|
|
12211
12215
|
});
|
|
12212
12216
|
Object.defineProperty(exports, "isUserRecoverable", {
|
|
12213
12217
|
enumerable: true,
|
|
12214
|
-
get: function () { return
|
|
12218
|
+
get: function () { return chunkO5PST6TB_cjs.isUserRecoverable; }
|
|
12215
12219
|
});
|
|
12216
12220
|
Object.defineProperty(exports, "MAX_JSON_POINTER_DEPTH", {
|
|
12217
12221
|
enumerable: true,
|