@routier/core 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assertions/index.cjs +19 -8
- package/dist/assertions/index.cjs.map +1 -1
- package/dist/assertions/index.d.ts +5 -1
- package/dist/assertions/index.js +21 -9
- package/dist/assertions/index.js.map +1 -1
- package/dist/collections/MemoryDataCollection.d.ts +10 -0
- package/dist/collections/index.cjs +29 -4
- package/dist/collections/index.cjs.map +1 -1
- package/dist/collections/index.js +29 -4
- package/dist/collections/index.js.map +1 -1
- package/dist/expressions/callSource.d.ts +41 -0
- package/dist/expressions/evaluate.d.ts +3 -0
- package/dist/expressions/fold.d.ts +7 -0
- package/dist/expressions/index.cjs +1754 -233
- package/dist/expressions/index.cjs.map +1 -1
- package/dist/expressions/index.d.ts +2 -0
- package/dist/expressions/index.js +1765 -234
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/types.d.ts +45 -26
- package/dist/expressions/utils.d.ts +19 -1
- package/dist/index.cjs +2429 -363
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2769 -682
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +6 -4
- package/dist/performance/index.cjs.map +1 -1
- package/dist/performance/index.js +6 -4
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +6 -4
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.js +6 -4
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/index.cjs +2323 -316
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2328 -311
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +38 -10
- package/dist/plugins/query/describeFilter.d.ts +83 -0
- package/dist/plugins/query/explain.d.ts +71 -9
- package/dist/plugins/query/index.d.ts +1 -0
- package/dist/plugins/query/join.d.ts +4 -1
- package/dist/plugins/query/types.d.ts +36 -4
- package/dist/plugins/resultShape.d.ts +35 -0
- package/dist/schema/PropertyInfo.d.ts +0 -1
- package/dist/schema/index.cjs +7 -14
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.js +7 -14
- package/dist/schema/index.js.map +1 -1
- package/dist/transfer/ChunkEncoder.d.ts +60 -0
- package/dist/transfer/decoder.d.ts +29 -0
- package/dist/transfer/fillers.d.ts +36 -0
- package/dist/transfer/index.cjs +873 -0
- package/dist/transfer/index.cjs.map +1 -0
- package/dist/transfer/index.d.ts +47 -0
- package/dist/transfer/index.js +872 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/transfer/plan.d.ts +94 -0
- package/dist/transfer/types.d.ts +138 -0
- package/dist/utilities/index.cjs +242 -49
- package/dist/utilities/index.cjs.map +1 -1
- package/dist/utilities/index.js +242 -49
- package/dist/utilities/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
8
8
|
Ye: () => (assertIsNumber),
|
|
9
9
|
dp: () => (assertDate),
|
|
10
10
|
e3: () => (isPropertyExpression),
|
|
11
|
+
fm: () => (isCallExpression),
|
|
11
12
|
jf: () => (assertIsNotNull),
|
|
12
13
|
nn: () => (assertInstanceOf),
|
|
13
14
|
vg: () => (isOperatorExpression),
|
|
@@ -87,6 +88,11 @@ function isObjectWithType(value) {
|
|
|
87
88
|
*/ function isValueExpression(value) {
|
|
88
89
|
return isObjectWithType(value) && value.type === "value";
|
|
89
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Type guard: narrows `value` to `CallExpression` when it is an object with `type === "call"`.
|
|
93
|
+
*/ function isCallExpression(value) {
|
|
94
|
+
return isObjectWithType(value) && value.type === "call";
|
|
95
|
+
}
|
|
90
96
|
/**
|
|
91
97
|
* Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === "empty"`.
|
|
92
98
|
*/ function isEmptyExpression(value) {
|
|
@@ -971,10 +977,35 @@ class MemoryDataCollection {
|
|
|
971
977
|
}
|
|
972
978
|
throw new Error(`Id Property '${property.name}' must be string or number, found '${property.type}'`);
|
|
973
979
|
}
|
|
980
|
+
_dateColumns;
|
|
981
|
+
/** Date columns, by the name a stored record uses. Nested dates live inside a JSON column. */ get dateColumns() {
|
|
982
|
+
if (this._dateColumns == null) {
|
|
983
|
+
this._dateColumns = this.schema.properties.filter((property)=>property.type === types/* .SchemaTypes.Date */.L.Date && property.getAssignmentPath().includes(".") === false).map((property)=>property.getResolvedName());
|
|
984
|
+
}
|
|
985
|
+
return this._dateColumns;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* The record this collection keeps.
|
|
989
|
+
*
|
|
990
|
+
* A copy, so a caller holding the entity cannot write into the store afterwards. Dates are held
|
|
991
|
+
* as Dates: a predicate compares a Date, and a stored ISO string never matches one.
|
|
992
|
+
*/ toStored(item) {
|
|
993
|
+
const columns = this.dateColumns;
|
|
994
|
+
const stored = {
|
|
995
|
+
...item
|
|
996
|
+
};
|
|
997
|
+
for(let i = 0, length = columns.length; i < length; i++){
|
|
998
|
+
const value = stored[columns[i]];
|
|
999
|
+
if (typeof value === "string") {
|
|
1000
|
+
stored[columns[i]] = new Date(value);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return stored;
|
|
1004
|
+
}
|
|
974
1005
|
seed(items) {
|
|
975
1006
|
for(let i = 0, length = items.length; i < length; i++){
|
|
976
1007
|
const id = this.resolveIdSet(items[i]);
|
|
977
|
-
this.data.set(id.toString(), items[i]);
|
|
1008
|
+
this.data.set(id.toString(), this.toStored(items[i]));
|
|
978
1009
|
}
|
|
979
1010
|
}
|
|
980
1011
|
resolveCurrentIdSet(item) {
|
|
@@ -1016,7 +1047,7 @@ class MemoryDataCollection {
|
|
|
1016
1047
|
}
|
|
1017
1048
|
add(item) {
|
|
1018
1049
|
const id = this.resolveIdSet(item);
|
|
1019
|
-
this.data.set(id.toString(), item);
|
|
1050
|
+
this.data.set(id.toString(), this.toStored(item));
|
|
1020
1051
|
}
|
|
1021
1052
|
/**
|
|
1022
1053
|
* Adds a record only when no record with the same key is present. Durable
|
|
@@ -1026,7 +1057,7 @@ class MemoryDataCollection {
|
|
|
1026
1057
|
const id = this.resolveIdSet(item);
|
|
1027
1058
|
const key = id.toString();
|
|
1028
1059
|
if (this.data.has(key) === false) {
|
|
1029
|
-
this.data.set(key, item);
|
|
1060
|
+
this.data.set(key, this.toStored(item));
|
|
1030
1061
|
}
|
|
1031
1062
|
}
|
|
1032
1063
|
/**
|
|
@@ -1042,7 +1073,7 @@ class MemoryDataCollection {
|
|
|
1042
1073
|
}
|
|
1043
1074
|
update(item) {
|
|
1044
1075
|
const id = this.resolveCurrentIdSet(item);
|
|
1045
|
-
this.data.set(id.toString(), item);
|
|
1076
|
+
this.data.set(id.toString(), this.toStored(item));
|
|
1046
1077
|
}
|
|
1047
1078
|
destroy(done) {
|
|
1048
1079
|
this.nextNumericalIds.clear();
|
|
@@ -1143,62 +1174,396 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1143
1174
|
|
|
1144
1175
|
|
|
1145
1176
|
|
|
1177
|
+
},
|
|
1178
|
+
429(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1179
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1180
|
+
N: () => (CALL_SOURCE),
|
|
1181
|
+
a: () => (renderCallAsJs)
|
|
1182
|
+
});
|
|
1183
|
+
const CALL_SOURCE = {
|
|
1184
|
+
"to-lower-case": {
|
|
1185
|
+
form: "method",
|
|
1186
|
+
name: "toLowerCase"
|
|
1187
|
+
},
|
|
1188
|
+
"to-upper-case": {
|
|
1189
|
+
form: "method",
|
|
1190
|
+
name: "toUpperCase"
|
|
1191
|
+
},
|
|
1192
|
+
"length": {
|
|
1193
|
+
form: "property",
|
|
1194
|
+
name: "length"
|
|
1195
|
+
},
|
|
1196
|
+
"trim": {
|
|
1197
|
+
form: "method",
|
|
1198
|
+
name: "trim"
|
|
1199
|
+
},
|
|
1200
|
+
"trim-start": {
|
|
1201
|
+
form: "method",
|
|
1202
|
+
name: "trimStart"
|
|
1203
|
+
},
|
|
1204
|
+
"trim-end": {
|
|
1205
|
+
form: "method",
|
|
1206
|
+
name: "trimEnd"
|
|
1207
|
+
},
|
|
1208
|
+
"index-of": {
|
|
1209
|
+
form: "method",
|
|
1210
|
+
name: "indexOf"
|
|
1211
|
+
},
|
|
1212
|
+
"substring": {
|
|
1213
|
+
form: "method",
|
|
1214
|
+
name: "substring"
|
|
1215
|
+
},
|
|
1216
|
+
"concat": {
|
|
1217
|
+
form: "method",
|
|
1218
|
+
name: "concat"
|
|
1219
|
+
},
|
|
1220
|
+
"replace": {
|
|
1221
|
+
form: "method",
|
|
1222
|
+
name: "replace"
|
|
1223
|
+
},
|
|
1224
|
+
"replace-all": {
|
|
1225
|
+
form: "method",
|
|
1226
|
+
name: "replaceAll"
|
|
1227
|
+
},
|
|
1228
|
+
"absolute": {
|
|
1229
|
+
form: "function",
|
|
1230
|
+
name: "Math.abs"
|
|
1231
|
+
},
|
|
1232
|
+
"floor": {
|
|
1233
|
+
form: "function",
|
|
1234
|
+
name: "Math.floor"
|
|
1235
|
+
},
|
|
1236
|
+
"ceiling": {
|
|
1237
|
+
form: "function",
|
|
1238
|
+
name: "Math.ceil"
|
|
1239
|
+
},
|
|
1240
|
+
"round": {
|
|
1241
|
+
form: "function",
|
|
1242
|
+
name: "Math.round"
|
|
1243
|
+
},
|
|
1244
|
+
"sign": {
|
|
1245
|
+
form: "function",
|
|
1246
|
+
name: "Math.sign"
|
|
1247
|
+
},
|
|
1248
|
+
"square-root": {
|
|
1249
|
+
form: "function",
|
|
1250
|
+
name: "Math.sqrt"
|
|
1251
|
+
},
|
|
1252
|
+
"add": {
|
|
1253
|
+
form: "operator",
|
|
1254
|
+
symbol: "+"
|
|
1255
|
+
},
|
|
1256
|
+
"subtract": {
|
|
1257
|
+
form: "operator",
|
|
1258
|
+
symbol: "-"
|
|
1259
|
+
},
|
|
1260
|
+
"multiply": {
|
|
1261
|
+
form: "operator",
|
|
1262
|
+
symbol: "*"
|
|
1263
|
+
},
|
|
1264
|
+
"divide": {
|
|
1265
|
+
form: "operator",
|
|
1266
|
+
symbol: "/"
|
|
1267
|
+
},
|
|
1268
|
+
"modulo": {
|
|
1269
|
+
form: "operator",
|
|
1270
|
+
symbol: "%"
|
|
1271
|
+
},
|
|
1272
|
+
"utc-year": {
|
|
1273
|
+
form: "method",
|
|
1274
|
+
name: "getUTCFullYear"
|
|
1275
|
+
},
|
|
1276
|
+
"utc-month": {
|
|
1277
|
+
form: "method",
|
|
1278
|
+
name: "getUTCMonth"
|
|
1279
|
+
},
|
|
1280
|
+
"utc-day-of-month": {
|
|
1281
|
+
form: "method",
|
|
1282
|
+
name: "getUTCDate"
|
|
1283
|
+
},
|
|
1284
|
+
"utc-day-of-week": {
|
|
1285
|
+
form: "method",
|
|
1286
|
+
name: "getUTCDay"
|
|
1287
|
+
},
|
|
1288
|
+
"utc-hour": {
|
|
1289
|
+
form: "method",
|
|
1290
|
+
name: "getUTCHours"
|
|
1291
|
+
},
|
|
1292
|
+
"utc-minute": {
|
|
1293
|
+
form: "method",
|
|
1294
|
+
name: "getUTCMinutes"
|
|
1295
|
+
},
|
|
1296
|
+
"utc-second": {
|
|
1297
|
+
form: "method",
|
|
1298
|
+
name: "getUTCSeconds"
|
|
1299
|
+
},
|
|
1300
|
+
"utc-millisecond": {
|
|
1301
|
+
form: "method",
|
|
1302
|
+
name: "getUTCMilliseconds"
|
|
1303
|
+
},
|
|
1304
|
+
"epoch-ms": {
|
|
1305
|
+
form: "method",
|
|
1306
|
+
name: "getTime"
|
|
1307
|
+
},
|
|
1308
|
+
"to-string": {
|
|
1309
|
+
form: "function",
|
|
1310
|
+
name: "String"
|
|
1311
|
+
},
|
|
1312
|
+
"to-number": {
|
|
1313
|
+
form: "function",
|
|
1314
|
+
name: "Number"
|
|
1315
|
+
},
|
|
1316
|
+
"to-boolean": {
|
|
1317
|
+
form: "function",
|
|
1318
|
+
name: "Boolean"
|
|
1319
|
+
},
|
|
1320
|
+
"type-of": {
|
|
1321
|
+
form: "prefix",
|
|
1322
|
+
keyword: "typeof"
|
|
1323
|
+
},
|
|
1324
|
+
"some": {
|
|
1325
|
+
form: "method",
|
|
1326
|
+
name: "some"
|
|
1327
|
+
},
|
|
1328
|
+
"every": {
|
|
1329
|
+
form: "method",
|
|
1330
|
+
name: "every"
|
|
1331
|
+
},
|
|
1332
|
+
// `Math.pow(a, b)` parses to the same call; `**` is the shorter of the two spellings
|
|
1333
|
+
"power": {
|
|
1334
|
+
form: "operator",
|
|
1335
|
+
symbol: "**"
|
|
1336
|
+
},
|
|
1337
|
+
"bit-and": {
|
|
1338
|
+
form: "operator",
|
|
1339
|
+
symbol: "&"
|
|
1340
|
+
},
|
|
1341
|
+
"bit-or": {
|
|
1342
|
+
form: "operator",
|
|
1343
|
+
symbol: "|"
|
|
1344
|
+
},
|
|
1345
|
+
"bit-xor": {
|
|
1346
|
+
form: "operator",
|
|
1347
|
+
symbol: "^"
|
|
1348
|
+
},
|
|
1349
|
+
"shift-left": {
|
|
1350
|
+
form: "operator",
|
|
1351
|
+
symbol: "<<"
|
|
1352
|
+
},
|
|
1353
|
+
"shift-right": {
|
|
1354
|
+
form: "operator",
|
|
1355
|
+
symbol: ">>"
|
|
1356
|
+
},
|
|
1357
|
+
"shift-right-unsigned": {
|
|
1358
|
+
form: "operator",
|
|
1359
|
+
symbol: ">>>"
|
|
1360
|
+
},
|
|
1361
|
+
"bit-not": {
|
|
1362
|
+
form: "prefix",
|
|
1363
|
+
keyword: "~"
|
|
1364
|
+
},
|
|
1365
|
+
"coalesce": {
|
|
1366
|
+
form: "operator",
|
|
1367
|
+
symbol: "??"
|
|
1368
|
+
},
|
|
1369
|
+
"conditional": {
|
|
1370
|
+
form: "conditional"
|
|
1371
|
+
},
|
|
1372
|
+
"matches": {
|
|
1373
|
+
form: "regex-test"
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
/**
|
|
1377
|
+
* A call rendered as the JavaScript that produced it, from operand and argument text already
|
|
1378
|
+
* rendered by the caller.
|
|
1379
|
+
*
|
|
1380
|
+
* Takes strings so one implementation serves a live tree and a serialized one.
|
|
1381
|
+
*/ /**
|
|
1382
|
+
* Thunked because rendering a side can record a parameter, and `regex-test` emits its argument
|
|
1383
|
+
* before its operand — so the two orders have to agree.
|
|
1384
|
+
*/ const renderCallAsJs = (call, renderOperand, renderArgs)=>{
|
|
1385
|
+
const source = CALL_SOURCE[call];
|
|
1386
|
+
if (source == null) {
|
|
1387
|
+
const operand = renderOperand();
|
|
1388
|
+
return `${operand}.${call}(${renderArgs().join(", ")})`;
|
|
1389
|
+
}
|
|
1390
|
+
if (source.form === "property") {
|
|
1391
|
+
return `${renderOperand()}.${source.name}`;
|
|
1392
|
+
}
|
|
1393
|
+
if (source.form === "regex-test") {
|
|
1394
|
+
const pattern = renderArgs()[0] ?? "?";
|
|
1395
|
+
return `${pattern}.test(${renderOperand()})`;
|
|
1396
|
+
}
|
|
1397
|
+
if (source.form === "method") {
|
|
1398
|
+
const operand = renderOperand();
|
|
1399
|
+
return `${operand}.${source.name}(${renderArgs().join(", ")})`;
|
|
1400
|
+
}
|
|
1401
|
+
if (source.form === "function") {
|
|
1402
|
+
const operand = renderOperand();
|
|
1403
|
+
return `${source.name}(${[
|
|
1404
|
+
operand,
|
|
1405
|
+
...renderArgs()
|
|
1406
|
+
].join(", ")})`;
|
|
1407
|
+
}
|
|
1408
|
+
if (source.form === "prefix") {
|
|
1409
|
+
// `~x`, not `~ x` — a bitwise complement is written tight, unlike `typeof`
|
|
1410
|
+
const operand = renderOperand();
|
|
1411
|
+
return source.keyword === "~" ? `${source.keyword}${operand}` : `${source.keyword} ${operand}`;
|
|
1412
|
+
}
|
|
1413
|
+
if (source.form === "conditional") {
|
|
1414
|
+
const operand = renderOperand();
|
|
1415
|
+
const args = renderArgs();
|
|
1416
|
+
return `${operand} ? ${args[0] ?? "?"} : ${args[1] ?? "?"}`;
|
|
1417
|
+
}
|
|
1418
|
+
const operand = renderOperand();
|
|
1419
|
+
return `${[
|
|
1420
|
+
operand,
|
|
1421
|
+
...renderArgs()
|
|
1422
|
+
].join(` ${source.symbol} `)}`;
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
|
|
1146
1426
|
},
|
|
1147
1427
|
835(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1148
1428
|
__webpack_require__.d(__webpack_exports__, {
|
|
1149
1429
|
t: () => (EXPRESSION_TYPES)
|
|
1150
1430
|
});
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
"
|
|
1156
|
-
"
|
|
1157
|
-
"
|
|
1158
|
-
|
|
1431
|
+
/**
|
|
1432
|
+
* A `Record` rather than a list, so adding to `ExpressionType` without adding it here is a compile
|
|
1433
|
+
* error. As a list it was not exhaustive, and `call` was silently missing from `isExpression`.
|
|
1434
|
+
*/ const EXPRESSION_TYPE_SET = {
|
|
1435
|
+
"operator": true,
|
|
1436
|
+
"comparator": true,
|
|
1437
|
+
"property": true,
|
|
1438
|
+
"value": true,
|
|
1439
|
+
"call": true,
|
|
1440
|
+
"empty": true,
|
|
1441
|
+
"not-parsable": true
|
|
1442
|
+
};
|
|
1443
|
+
const EXPRESSION_TYPES = Object.keys(EXPRESSION_TYPE_SET);
|
|
1159
1444
|
|
|
1160
1445
|
|
|
1161
1446
|
},
|
|
1162
1447
|
379(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1163
1448
|
__webpack_require__.d(__webpack_exports__, {
|
|
1164
1449
|
Vu: () => (toPredicate),
|
|
1450
|
+
Vv: () => (operandValue),
|
|
1165
1451
|
_3: () => (evaluate),
|
|
1452
|
+
gm: () => (UNRESOLVED),
|
|
1166
1453
|
wS: () => (toStrictPredicate)
|
|
1167
1454
|
});
|
|
1168
1455
|
/* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
|
|
1169
1456
|
|
|
1170
1457
|
/** Reads a property or literal operand, or `UNRESOLVED` when the node is not one. */ const UNRESOLVED = Symbol("unresolved");
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1458
|
+
const ARITHMETIC = {
|
|
1459
|
+
"add": (left, right)=>left + right,
|
|
1460
|
+
"subtract": (left, right)=>left - right,
|
|
1461
|
+
"multiply": (left, right)=>left * right,
|
|
1462
|
+
"divide": (left, right)=>left / right,
|
|
1463
|
+
"modulo": (left, right)=>left % right,
|
|
1464
|
+
"power": (left, right)=>left ** right,
|
|
1465
|
+
"bit-and": (left, right)=>left & right,
|
|
1466
|
+
"bit-or": (left, right)=>left | right,
|
|
1467
|
+
"bit-xor": (left, right)=>left ^ right,
|
|
1468
|
+
"shift-left": (left, right)=>left << right,
|
|
1469
|
+
"shift-right": (left, right)=>left >> right,
|
|
1470
|
+
"shift-right-unsigned": (left, right)=>left >>> right
|
|
1471
|
+
};
|
|
1472
|
+
const applyCall = (call, value, args)=>{
|
|
1473
|
+
// Above the guard: a template renders null as "null" in JavaScript, so these two are total.
|
|
1474
|
+
if (call === "to-string") {
|
|
1475
|
+
return String(value);
|
|
1476
|
+
}
|
|
1477
|
+
if (call === "concat") {
|
|
1478
|
+
return [
|
|
1479
|
+
value,
|
|
1480
|
+
...args
|
|
1481
|
+
].map(String).join("");
|
|
1174
1482
|
}
|
|
1175
|
-
// A
|
|
1176
|
-
//
|
|
1483
|
+
// A call applied to an absent value has no answer, and inventing one ("" for a missing string)
|
|
1484
|
+
// is how a filter starts matching rows it should not.
|
|
1177
1485
|
if (value == null) {
|
|
1178
1486
|
return UNRESOLVED;
|
|
1179
1487
|
}
|
|
1180
|
-
if (
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1488
|
+
if (call === "to-lower-case" || call === "to-upper-case") {
|
|
1489
|
+
if (typeof value !== "string") {
|
|
1490
|
+
return UNRESOLVED;
|
|
1491
|
+
}
|
|
1492
|
+
const lower = call === "to-lower-case";
|
|
1493
|
+
if (args.length === 0 || args[0] == null) {
|
|
1494
|
+
return lower ? value.toLowerCase() : value.toUpperCase();
|
|
1495
|
+
}
|
|
1496
|
+
if (typeof args[0] !== "string") {
|
|
1497
|
+
return UNRESOLVED;
|
|
1498
|
+
}
|
|
1499
|
+
try {
|
|
1500
|
+
// An explicit locale is deterministic; dropping it answers a different question in Turkish.
|
|
1501
|
+
return lower ? value.toLocaleLowerCase(args[0]) : value.toLocaleUpperCase(args[0]);
|
|
1502
|
+
} catch {
|
|
1503
|
+
// An invalid language tag throws RangeError; no answer beats the host's default.
|
|
1504
|
+
return UNRESOLVED;
|
|
1505
|
+
}
|
|
1185
1506
|
}
|
|
1186
|
-
if (
|
|
1507
|
+
if (call === "length") {
|
|
1187
1508
|
return typeof value === "string" || Array.isArray(value) ? value.length : UNRESOLVED;
|
|
1188
1509
|
}
|
|
1510
|
+
if (call === "bit-not") {
|
|
1511
|
+
return typeof value === "number" ? ~value : UNRESOLVED;
|
|
1512
|
+
}
|
|
1513
|
+
if (call === "matches") {
|
|
1514
|
+
if (typeof value !== "string" || !(args[0] instanceof RegExp)) {
|
|
1515
|
+
return UNRESOLVED;
|
|
1516
|
+
}
|
|
1517
|
+
// `test` advances `lastIndex` on a global or sticky pattern, and the pattern is shared with
|
|
1518
|
+
// the cached template, where a source evaluates fresh in JavaScript.
|
|
1519
|
+
return args[0].global || args[0].sticky ? new RegExp(args[0].source, args[0].flags).test(value) : args[0].test(value);
|
|
1520
|
+
}
|
|
1521
|
+
const arithmetic = ARITHMETIC[call];
|
|
1522
|
+
if (arithmetic != null) {
|
|
1523
|
+
return typeof value === "number" && typeof args[0] === "number" ? arithmetic(value, args[0]) : UNRESOLVED;
|
|
1524
|
+
}
|
|
1189
1525
|
return UNRESOLVED;
|
|
1190
1526
|
};
|
|
1191
|
-
const
|
|
1527
|
+
const operandValue = (expression, row)=>{
|
|
1192
1528
|
if (expression == null) {
|
|
1193
1529
|
return UNRESOLVED;
|
|
1194
1530
|
}
|
|
1195
1531
|
if ((0,_assertions__rspack_import_0/* .isValueExpression */.S6)(expression)) {
|
|
1196
|
-
return
|
|
1532
|
+
return expression.value;
|
|
1197
1533
|
}
|
|
1198
1534
|
if ((0,_assertions__rspack_import_0/* .isPropertyExpression */.e3)(expression)) {
|
|
1199
1535
|
// Through the PropertyInfo, so a nested path and a `from`-renamed segment resolve the same
|
|
1200
1536
|
// way every other consumer of the tree resolves them.
|
|
1201
|
-
return
|
|
1537
|
+
return expression.property.getValue(row);
|
|
1538
|
+
}
|
|
1539
|
+
if ((0,_assertions__rspack_import_0/* .isCallExpression */.fm)(expression)) {
|
|
1540
|
+
/**
|
|
1541
|
+
* `??` and `? :` are the two calls whose whole job is to answer when something is absent, so
|
|
1542
|
+
* they run before the guard that refuses an absent operand.
|
|
1543
|
+
*/ if (expression.call === "coalesce") {
|
|
1544
|
+
const left = operandValue(expression.expression, row);
|
|
1545
|
+
return left === UNRESOLVED || left == null ? operandValue(expression.arguments[0], row) : left;
|
|
1546
|
+
}
|
|
1547
|
+
if (expression.call === "conditional") {
|
|
1548
|
+
const condition = evaluate(expression.expression, row);
|
|
1549
|
+
if (condition === undefined) {
|
|
1550
|
+
return UNRESOLVED;
|
|
1551
|
+
}
|
|
1552
|
+
return operandValue(expression.arguments[condition === true ? 0 : 1], row);
|
|
1553
|
+
}
|
|
1554
|
+
const inner = operandValue(expression.expression, row);
|
|
1555
|
+
if (inner === UNRESOLVED) {
|
|
1556
|
+
return UNRESOLVED;
|
|
1557
|
+
}
|
|
1558
|
+
const args = [];
|
|
1559
|
+
for (const argument of expression.arguments){
|
|
1560
|
+
const resolved = operandValue(argument, row);
|
|
1561
|
+
if (resolved === UNRESOLVED) {
|
|
1562
|
+
return UNRESOLVED;
|
|
1563
|
+
}
|
|
1564
|
+
args.push(resolved);
|
|
1565
|
+
}
|
|
1566
|
+
return applyCall(expression.call, inner, args);
|
|
1202
1567
|
}
|
|
1203
1568
|
return UNRESOLVED;
|
|
1204
1569
|
};
|
|
@@ -1283,8 +1648,8 @@ const evaluateComparator = (comparator, left, right, strict)=>{
|
|
|
1283
1648
|
return left === false && right === false ? false : undefined;
|
|
1284
1649
|
}
|
|
1285
1650
|
if ((0,_assertions__rspack_import_0/* .isComparatorExpression */.xH)(expression)) {
|
|
1286
|
-
const left =
|
|
1287
|
-
const right =
|
|
1651
|
+
const left = operandValue(expression.left, row);
|
|
1652
|
+
const right = operandValue(expression.right, row);
|
|
1288
1653
|
if (left === UNRESOLVED || right === UNRESOLVED) {
|
|
1289
1654
|
return undefined;
|
|
1290
1655
|
}
|
|
@@ -1323,30 +1688,152 @@ const evaluateComparator = (comparator, left, right, strict)=>{
|
|
|
1323
1688
|
|
|
1324
1689
|
|
|
1325
1690
|
},
|
|
1326
|
-
|
|
1691
|
+
43(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1327
1692
|
__webpack_require__.d(__webpack_exports__, {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
Sm: () => (/* reexport safe */ _types__rspack_import_2.Sm),
|
|
1332
|
-
Vu: () => (/* reexport safe */ _evaluate__rspack_import_0.Vu),
|
|
1333
|
-
_3: () => (/* reexport safe */ _evaluate__rspack_import_0._3),
|
|
1334
|
-
bQ: () => (/* reexport safe */ _types__rspack_import_2.bQ),
|
|
1335
|
-
ep: () => (/* reexport safe */ _types__rspack_import_2.ep),
|
|
1336
|
-
fw: () => (/* reexport safe */ _types__rspack_import_2.fw),
|
|
1337
|
-
jJ: () => (/* reexport safe */ _utils__rspack_import_3.j),
|
|
1338
|
-
oH: () => (/* reexport safe */ _parser__rspack_import_1.oH),
|
|
1339
|
-
oY: () => (/* reexport safe */ _utils__rspack_import_3.o),
|
|
1340
|
-
pg: () => (/* reexport safe */ _parser__rspack_import_1.pg),
|
|
1341
|
-
r4: () => (/* reexport safe */ _types__rspack_import_2.r4),
|
|
1342
|
-
tA: () => (/* reexport safe */ _constants__rspack_import_4.t),
|
|
1343
|
-
wS: () => (/* reexport safe */ _evaluate__rspack_import_0.wS)
|
|
1693
|
+
F5: () => (foldConstantCalls),
|
|
1694
|
+
Sv: () => (FOLDABLE),
|
|
1695
|
+
br: () => (foldedOperandValue)
|
|
1344
1696
|
});
|
|
1345
|
-
/* import */ var
|
|
1346
|
-
/* import */ var
|
|
1697
|
+
/* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
|
|
1698
|
+
/* import */ var _evaluate__rspack_import_3 = __webpack_require__(379);
|
|
1347
1699
|
/* import */ var _types__rspack_import_2 = __webpack_require__(27);
|
|
1348
|
-
/* import */ var
|
|
1349
|
-
|
|
1700
|
+
/* import */ var _utils__rspack_import_1 = __webpack_require__(63);
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
/** Calls fold may compute. Absent means a plugin declines it, so a new call is opt-in. */ const FOLDABLE = new Set([
|
|
1706
|
+
"to-lower-case",
|
|
1707
|
+
"to-upper-case",
|
|
1708
|
+
"length",
|
|
1709
|
+
"bit-not",
|
|
1710
|
+
"matches",
|
|
1711
|
+
"to-string",
|
|
1712
|
+
"concat",
|
|
1713
|
+
"add",
|
|
1714
|
+
"subtract",
|
|
1715
|
+
"multiply",
|
|
1716
|
+
"divide",
|
|
1717
|
+
"modulo",
|
|
1718
|
+
"power",
|
|
1719
|
+
"bit-and",
|
|
1720
|
+
"bit-or",
|
|
1721
|
+
"bit-xor",
|
|
1722
|
+
"shift-left",
|
|
1723
|
+
"shift-right",
|
|
1724
|
+
"shift-right-unsigned",
|
|
1725
|
+
"coalesce",
|
|
1726
|
+
"conditional"
|
|
1727
|
+
]);
|
|
1728
|
+
/** `String(value)` on an object is the host's rendering — a Date carries its timezone. */ const COERCES_TO_TEXT = new Set([
|
|
1729
|
+
"to-string",
|
|
1730
|
+
"concat"
|
|
1731
|
+
]);
|
|
1732
|
+
const isFrozenPrimitive = (value)=>value == null || typeof value !== "object";
|
|
1733
|
+
const readsAProperty = (expression)=>{
|
|
1734
|
+
if ((0,_assertions__rspack_import_0/* .isPropertyExpression */.e3)(expression)) {
|
|
1735
|
+
return true;
|
|
1736
|
+
}
|
|
1737
|
+
return (0,_utils__rspack_import_1/* .childrenOf */.LU)(expression).some(readsAProperty);
|
|
1738
|
+
};
|
|
1739
|
+
/** A `conditional` holds a condition where every other call holds a value. */ const isConstant = (call)=>{
|
|
1740
|
+
if (!FOLDABLE.has(call.call) || !call.arguments.every(_assertions__rspack_import_0/* .isValueExpression */.S6)) {
|
|
1741
|
+
return false;
|
|
1742
|
+
}
|
|
1743
|
+
if (COERCES_TO_TEXT.has(call.call) && [
|
|
1744
|
+
call.expression,
|
|
1745
|
+
...call.arguments
|
|
1746
|
+
].some((operand)=>(0,_assertions__rspack_import_0/* .isValueExpression */.S6)(operand) && !isFrozenPrimitive(operand.value))) {
|
|
1747
|
+
return false;
|
|
1748
|
+
}
|
|
1749
|
+
return call.call === "conditional" ? !readsAProperty(call.expression) : (0,_assertions__rspack_import_0/* .isValueExpression */.S6)(call.expression);
|
|
1750
|
+
};
|
|
1751
|
+
/** Computes every call whose operand and arguments are all literals. Runs after `bindExpression`. */ const foldConstantCalls = (expression)=>{
|
|
1752
|
+
if ((0,_assertions__rspack_import_0/* .isCallExpression */.fm)(expression)) {
|
|
1753
|
+
const folded = new _types__rspack_import_2/* .CallExpression */.DG({
|
|
1754
|
+
call: expression.call,
|
|
1755
|
+
expression: foldConstantCalls(expression.expression),
|
|
1756
|
+
arguments: expression.arguments.map(foldConstantCalls)
|
|
1757
|
+
});
|
|
1758
|
+
if (!isConstant(folded)) {
|
|
1759
|
+
return folded;
|
|
1760
|
+
}
|
|
1761
|
+
const value = (0,_evaluate__rspack_import_3/* .operandValue */.Vv)(folded, {});
|
|
1762
|
+
return value === _evaluate__rspack_import_3/* .UNRESOLVED */.gm ? folded : new _types__rspack_import_2/* .ValueExpression */.Ko({
|
|
1763
|
+
value
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
if ((0,_assertions__rspack_import_0/* .isComparatorExpression */.xH)(expression)) {
|
|
1767
|
+
return new _types__rspack_import_2/* .ComparatorExpression */.bQ({
|
|
1768
|
+
comparator: expression.comparator,
|
|
1769
|
+
negated: expression.negated,
|
|
1770
|
+
strict: expression.strict,
|
|
1771
|
+
left: expression.left == null ? undefined : foldConstantCalls(expression.left),
|
|
1772
|
+
right: expression.right == null ? undefined : foldConstantCalls(expression.right)
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
if ((0,_assertions__rspack_import_0/* .isOperatorExpression */.vg)(expression)) {
|
|
1776
|
+
return new _types__rspack_import_2/* .OperatorExpression */.fw({
|
|
1777
|
+
operator: expression.operator,
|
|
1778
|
+
left: expression.left == null ? undefined : foldConstantCalls(expression.left),
|
|
1779
|
+
right: expression.right == null ? undefined : foldConstantCalls(expression.right)
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
return expression;
|
|
1783
|
+
};
|
|
1784
|
+
/** The value a literal operand binds as once the calls on it are computed. Throws if it cannot. */ const foldedOperandValue = (operand, calls)=>{
|
|
1785
|
+
if (calls.length === 0) {
|
|
1786
|
+
return operand.value;
|
|
1787
|
+
}
|
|
1788
|
+
// `peelCalls` returns calls innermost first, so the last one evaluates the whole chain.
|
|
1789
|
+
const outermost = calls[calls.length - 1];
|
|
1790
|
+
const value = readsAProperty(outermost) ? _evaluate__rspack_import_3/* .UNRESOLVED */.gm : (0,_evaluate__rspack_import_3/* .operandValue */.Vv)(outermost, {});
|
|
1791
|
+
if (value === _evaluate__rspack_import_3/* .UNRESOLVED */.gm) {
|
|
1792
|
+
throw new Error(`'${calls.map((call)=>call.call).join("', '")}' cannot be computed on the literal ` + `'${String(operand.value)}'.`);
|
|
1793
|
+
}
|
|
1794
|
+
return value;
|
|
1795
|
+
};
|
|
1796
|
+
|
|
1797
|
+
|
|
1798
|
+
},
|
|
1799
|
+
138(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
1800
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1801
|
+
CC: () => (/* reexport safe */ _utils__rspack_import_5.CC),
|
|
1802
|
+
DG: () => (/* reexport safe */ _types__rspack_import_4.DG),
|
|
1803
|
+
F5: () => (/* reexport safe */ _fold__rspack_import_2.F5),
|
|
1804
|
+
Ko: () => (/* reexport safe */ _types__rspack_import_4.Ko),
|
|
1805
|
+
LU: () => (/* reexport safe */ _utils__rspack_import_5.LU),
|
|
1806
|
+
MY: () => (/* reexport safe */ _parser__rspack_import_3.MY),
|
|
1807
|
+
Nb: () => (/* reexport safe */ _callSource__rspack_import_0.N),
|
|
1808
|
+
SC: () => (/* reexport safe */ _types__rspack_import_4.SC),
|
|
1809
|
+
Sm: () => (/* reexport safe */ _types__rspack_import_4.Sm),
|
|
1810
|
+
Sv: () => (/* reexport safe */ _fold__rspack_import_2.Sv),
|
|
1811
|
+
Vu: () => (/* reexport safe */ _evaluate__rspack_import_1.Vu),
|
|
1812
|
+
Vv: () => (/* reexport safe */ _evaluate__rspack_import_1.Vv),
|
|
1813
|
+
_3: () => (/* reexport safe */ _evaluate__rspack_import_1._3),
|
|
1814
|
+
ax: () => (/* reexport safe */ _callSource__rspack_import_0.a),
|
|
1815
|
+
bQ: () => (/* reexport safe */ _types__rspack_import_4.bQ),
|
|
1816
|
+
br: () => (/* reexport safe */ _fold__rspack_import_2.br),
|
|
1817
|
+
ep: () => (/* reexport safe */ _types__rspack_import_4.ep),
|
|
1818
|
+
fw: () => (/* reexport safe */ _types__rspack_import_4.fw),
|
|
1819
|
+
gm: () => (/* reexport safe */ _evaluate__rspack_import_1.gm),
|
|
1820
|
+
jJ: () => (/* reexport safe */ _utils__rspack_import_5.jJ),
|
|
1821
|
+
oH: () => (/* reexport safe */ _parser__rspack_import_3.oH),
|
|
1822
|
+
oY: () => (/* reexport safe */ _utils__rspack_import_5.oY),
|
|
1823
|
+
pg: () => (/* reexport safe */ _parser__rspack_import_3.pg),
|
|
1824
|
+
r4: () => (/* reexport safe */ _types__rspack_import_4.r4),
|
|
1825
|
+
tA: () => (/* reexport safe */ _constants__rspack_import_6.t),
|
|
1826
|
+
wS: () => (/* reexport safe */ _evaluate__rspack_import_1.wS)
|
|
1827
|
+
});
|
|
1828
|
+
/* import */ var _callSource__rspack_import_0 = __webpack_require__(429);
|
|
1829
|
+
/* import */ var _evaluate__rspack_import_1 = __webpack_require__(379);
|
|
1830
|
+
/* import */ var _fold__rspack_import_2 = __webpack_require__(43);
|
|
1831
|
+
/* import */ var _parser__rspack_import_3 = __webpack_require__(91);
|
|
1832
|
+
/* import */ var _types__rspack_import_4 = __webpack_require__(27);
|
|
1833
|
+
/* import */ var _utils__rspack_import_5 = __webpack_require__(63);
|
|
1834
|
+
/* import */ var _constants__rspack_import_6 = __webpack_require__(835);
|
|
1835
|
+
|
|
1836
|
+
|
|
1350
1837
|
|
|
1351
1838
|
|
|
1352
1839
|
|
|
@@ -1361,14 +1848,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1361
1848
|
oH: () => (parseFragment),
|
|
1362
1849
|
pg: () => (combineExpressions)
|
|
1363
1850
|
});
|
|
1364
|
-
/* import */ var
|
|
1851
|
+
/* import */ var _utilities__rspack_import_5 = __webpack_require__(581);
|
|
1365
1852
|
/* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
|
|
1366
1853
|
/* import */ var _schema__rspack_import_2 = __webpack_require__(537);
|
|
1854
|
+
/* import */ var _evaluate__rspack_import_3 = __webpack_require__(379);
|
|
1855
|
+
/* import */ var _fold__rspack_import_4 = __webpack_require__(43);
|
|
1367
1856
|
/* import */ var _types__rspack_import_1 = __webpack_require__(27);
|
|
1368
1857
|
|
|
1369
1858
|
|
|
1370
1859
|
|
|
1371
1860
|
|
|
1861
|
+
|
|
1862
|
+
|
|
1372
1863
|
// Error message constants
|
|
1373
1864
|
const ERROR_MESSAGES = {
|
|
1374
1865
|
PROPERTY_NOT_FOUND: (path)=>`Error parsing query, could not find PropertyInfo for path: ${path}`,
|
|
@@ -1414,8 +1905,13 @@ const converters = {
|
|
|
1414
1905
|
};
|
|
1415
1906
|
// Longest first so multi-character punctuation wins over its prefixes
|
|
1416
1907
|
const MULTI_CHARACTER_PUNCTUATION = [
|
|
1908
|
+
">>>",
|
|
1417
1909
|
"===",
|
|
1418
1910
|
"!==",
|
|
1911
|
+
"**",
|
|
1912
|
+
"<<",
|
|
1913
|
+
">>",
|
|
1914
|
+
"??",
|
|
1419
1915
|
"?.",
|
|
1420
1916
|
"&&",
|
|
1421
1917
|
"||",
|
|
@@ -1452,9 +1948,17 @@ const SINGLE_CHARACTER_PUNCTUATION = new Set([
|
|
|
1452
1948
|
"?",
|
|
1453
1949
|
":",
|
|
1454
1950
|
"&",
|
|
1455
|
-
"|"
|
|
1951
|
+
"|",
|
|
1952
|
+
"^",
|
|
1953
|
+
"~"
|
|
1456
1954
|
]);
|
|
1457
|
-
|
|
1955
|
+
/**
|
|
1956
|
+
* A lookup table keyed by source text.
|
|
1957
|
+
*
|
|
1958
|
+
* Null-prototype: `TRANSFORM_METHODS["toString"]` otherwise returns `Object.prototype.toString`,
|
|
1959
|
+
* which is truthy, and the parser reads a method it does not support as one it does.
|
|
1960
|
+
*/ const sourceKeyed = (entries)=>Object.assign(Object.create(null), entries);
|
|
1961
|
+
const STRING_ESCAPES = sourceKeyed({
|
|
1458
1962
|
"n": "\n",
|
|
1459
1963
|
"r": "\r",
|
|
1460
1964
|
"t": "\t",
|
|
@@ -1462,6 +1966,24 @@ const STRING_ESCAPES = {
|
|
|
1462
1966
|
"f": "\f",
|
|
1463
1967
|
"v": "\v",
|
|
1464
1968
|
"0": "\0"
|
|
1969
|
+
});
|
|
1970
|
+
/**
|
|
1971
|
+
* Whether a `/` here opens a regex rather than dividing.
|
|
1972
|
+
*
|
|
1973
|
+
* A regex cannot follow a value. Everything else — the start of the source, an operator, an opening
|
|
1974
|
+
* bracket, a comma — is a position where only a regex makes sense.
|
|
1975
|
+
*/ const regexCanStartHere = (tokens)=>{
|
|
1976
|
+
const previous = tokens[tokens.length - 1];
|
|
1977
|
+
if (previous == null) {
|
|
1978
|
+
return true;
|
|
1979
|
+
}
|
|
1980
|
+
if (previous.kind === "number" || previous.kind === "string" || previous.kind === "bigint" || previous.kind === "regex") {
|
|
1981
|
+
return false;
|
|
1982
|
+
}
|
|
1983
|
+
if (previous.kind === "identifier") {
|
|
1984
|
+
return false;
|
|
1985
|
+
}
|
|
1986
|
+
return previous.value !== ")" && previous.value !== "]";
|
|
1465
1987
|
};
|
|
1466
1988
|
const isIdentifierStart = (char)=>/[a-zA-Z_$]/.test(char);
|
|
1467
1989
|
const isIdentifierPart = (char)=>/[a-zA-Z0-9_$]/.test(char);
|
|
@@ -1511,6 +2033,51 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1511
2033
|
i++;
|
|
1512
2034
|
continue;
|
|
1513
2035
|
}
|
|
2036
|
+
/**
|
|
2037
|
+
* A regex literal, told from division by what came before it.
|
|
2038
|
+
*
|
|
2039
|
+
* `/` after a value — a number, string, identifier, `)` or `]` — is division. Anywhere else
|
|
2040
|
+
* it opens a regex. That is the same rule a JavaScript lexer uses, and it is why `x.a / 2`
|
|
2041
|
+
* and `/^a/.test(x.a)` can share a character.
|
|
2042
|
+
*/ if (char === "/" && source[i + 1] !== "/" && source[i + 1] !== "*" && regexCanStartHere(tokens)) {
|
|
2043
|
+
let value = "";
|
|
2044
|
+
let inClass = false;
|
|
2045
|
+
let j = i + 1;
|
|
2046
|
+
while(j < source.length){
|
|
2047
|
+
const current = source[j];
|
|
2048
|
+
if (current === "\\") {
|
|
2049
|
+
value += current + (source[j + 1] ?? "");
|
|
2050
|
+
j += 2;
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2053
|
+
if (current === "[") {
|
|
2054
|
+
inClass = true;
|
|
2055
|
+
} else if (current === "]") {
|
|
2056
|
+
inClass = false;
|
|
2057
|
+
} else if (current === "/" && inClass === false) {
|
|
2058
|
+
break;
|
|
2059
|
+
} else if (current === "\n") {
|
|
2060
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated regular expression"));
|
|
2061
|
+
}
|
|
2062
|
+
value += current;
|
|
2063
|
+
j++;
|
|
2064
|
+
}
|
|
2065
|
+
if (j >= source.length) {
|
|
2066
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated regular expression"));
|
|
2067
|
+
}
|
|
2068
|
+
j++;
|
|
2069
|
+
let flags = "";
|
|
2070
|
+
while(j < source.length && isIdentifierPart(source[j])){
|
|
2071
|
+
flags += source[j];
|
|
2072
|
+
j++;
|
|
2073
|
+
}
|
|
2074
|
+
i = j;
|
|
2075
|
+
tokens.push({
|
|
2076
|
+
kind: "regex",
|
|
2077
|
+
value: `${value}\u0000${flags}`
|
|
2078
|
+
});
|
|
2079
|
+
continue;
|
|
2080
|
+
}
|
|
1514
2081
|
// Comments
|
|
1515
2082
|
if (char === "/" && source[i + 1] === "/") {
|
|
1516
2083
|
while(i < source.length && source[i] !== "\n"){
|
|
@@ -1530,6 +2097,8 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1530
2097
|
if (char === "'" || char === "\"" || char === "`") {
|
|
1531
2098
|
const quote = char;
|
|
1532
2099
|
let value = "";
|
|
2100
|
+
const chunks = [];
|
|
2101
|
+
const expressions = [];
|
|
1533
2102
|
i++;
|
|
1534
2103
|
while(i < source.length && source[i] !== quote){
|
|
1535
2104
|
if (source[i] === "\\") {
|
|
@@ -1544,8 +2113,43 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1544
2113
|
i += 2;
|
|
1545
2114
|
continue;
|
|
1546
2115
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
2116
|
+
/**
|
|
2117
|
+
* An interpolation. The literal so far becomes a chunk and the expression source is
|
|
2118
|
+
* kept whole, to be parsed by its own stream — nesting means the inner source can
|
|
2119
|
+
* hold anything, including another template.
|
|
2120
|
+
*/ if (quote === "`" && source[i] === "$" && source[i + 1] === "{") {
|
|
2121
|
+
let depth = 1;
|
|
2122
|
+
let expression = "";
|
|
2123
|
+
let at = i + 2;
|
|
2124
|
+
while(at < source.length && depth > 0){
|
|
2125
|
+
const current = source[at];
|
|
2126
|
+
if (current === "{") {
|
|
2127
|
+
depth++;
|
|
2128
|
+
} else if (current === "}") {
|
|
2129
|
+
depth--;
|
|
2130
|
+
if (depth === 0) {
|
|
2131
|
+
break;
|
|
2132
|
+
}
|
|
2133
|
+
} else if (current === "'" || current === '"' || current === "`") {
|
|
2134
|
+
const closing = current;
|
|
2135
|
+
expression += current;
|
|
2136
|
+
at++;
|
|
2137
|
+
while(at < source.length && source[at] !== closing){
|
|
2138
|
+
expression += source[at] === "\\" ? source[at] + (source[at + 1] ?? "") : source[at];
|
|
2139
|
+
at += source[at] === "\\" ? 2 : 1;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
expression += source[at];
|
|
2143
|
+
at++;
|
|
2144
|
+
}
|
|
2145
|
+
if (depth > 0) {
|
|
2146
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated template interpolation"));
|
|
2147
|
+
}
|
|
2148
|
+
chunks.push(value);
|
|
2149
|
+
expressions.push(expression);
|
|
2150
|
+
value = "";
|
|
2151
|
+
i = at + 1;
|
|
2152
|
+
continue;
|
|
1549
2153
|
}
|
|
1550
2154
|
value += source[i];
|
|
1551
2155
|
i++;
|
|
@@ -1554,6 +2158,17 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1554
2158
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED("unterminated string literal"));
|
|
1555
2159
|
}
|
|
1556
2160
|
i++; // consume closing quote
|
|
2161
|
+
if (expressions.length > 0) {
|
|
2162
|
+
chunks.push(value);
|
|
2163
|
+
tokens.push({
|
|
2164
|
+
kind: "template",
|
|
2165
|
+
value: JSON.stringify({
|
|
2166
|
+
chunks,
|
|
2167
|
+
expressions
|
|
2168
|
+
})
|
|
2169
|
+
});
|
|
2170
|
+
continue;
|
|
2171
|
+
}
|
|
1557
2172
|
tokens.push({
|
|
1558
2173
|
kind: "string",
|
|
1559
2174
|
value
|
|
@@ -1597,6 +2212,14 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1597
2212
|
}
|
|
1598
2213
|
}
|
|
1599
2214
|
}
|
|
2215
|
+
if (source[i] === "n") {
|
|
2216
|
+
i++;
|
|
2217
|
+
tokens.push({
|
|
2218
|
+
kind: "bigint",
|
|
2219
|
+
value: value.replace(/_/g, "")
|
|
2220
|
+
});
|
|
2221
|
+
continue;
|
|
2222
|
+
}
|
|
1600
2223
|
tokens.push({
|
|
1601
2224
|
kind: "number",
|
|
1602
2225
|
value: value.replace(/_/g, "")
|
|
@@ -1647,6 +2270,24 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1647
2270
|
constructor(tokens){
|
|
1648
2271
|
this.tokens = tokens;
|
|
1649
2272
|
}
|
|
2273
|
+
/** Inserts tokens at the cursor, bracketed so they keep their own precedence. */ splice(tokens) {
|
|
2274
|
+
const bracketed = [
|
|
2275
|
+
{
|
|
2276
|
+
kind: "punctuation",
|
|
2277
|
+
value: "("
|
|
2278
|
+
},
|
|
2279
|
+
...tokens,
|
|
2280
|
+
{
|
|
2281
|
+
kind: "punctuation",
|
|
2282
|
+
value: ")"
|
|
2283
|
+
}
|
|
2284
|
+
];
|
|
2285
|
+
this.tokens = [
|
|
2286
|
+
...this.tokens.slice(0, this.index),
|
|
2287
|
+
...bracketed,
|
|
2288
|
+
...this.tokens.slice(this.index)
|
|
2289
|
+
];
|
|
2290
|
+
}
|
|
1650
2291
|
get isAtEnd() {
|
|
1651
2292
|
return this.index >= this.tokens.length;
|
|
1652
2293
|
}
|
|
@@ -1661,10 +2302,108 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1661
2302
|
this.index++;
|
|
1662
2303
|
return token;
|
|
1663
2304
|
}
|
|
2305
|
+
/** The tokens of one statement's value, through the `;` or block end that closes it. */ takeStatementTokens() {
|
|
2306
|
+
const tokens = [];
|
|
2307
|
+
let depth = 0;
|
|
2308
|
+
while(!this.isAtEnd){
|
|
2309
|
+
const token = this.peek();
|
|
2310
|
+
if (token.kind === "punctuation") {
|
|
2311
|
+
if (token.value === "(" || token.value === "[" || token.value === "{") {
|
|
2312
|
+
depth++;
|
|
2313
|
+
} else if (token.value === ")" || token.value === "]" || token.value === "}") {
|
|
2314
|
+
if (depth === 0) {
|
|
2315
|
+
break;
|
|
2316
|
+
}
|
|
2317
|
+
depth--;
|
|
2318
|
+
} else if (token.value === ";" && depth === 0) {
|
|
2319
|
+
this.next();
|
|
2320
|
+
break;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
tokens.push(this.next());
|
|
2324
|
+
}
|
|
2325
|
+
if (tokens.length === 0) {
|
|
2326
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a declaration with no value"));
|
|
2327
|
+
}
|
|
2328
|
+
return tokens;
|
|
2329
|
+
}
|
|
1664
2330
|
isPunctuation(value, offset = 0) {
|
|
1665
2331
|
const token = this.peek(offset);
|
|
1666
2332
|
return token != null && token.kind === "punctuation" && token.value === value;
|
|
1667
2333
|
}
|
|
2334
|
+
/**
|
|
2335
|
+
* Whether the group starting here holds a value rather than a condition.
|
|
2336
|
+
*
|
|
2337
|
+
* `(a && b)` is a boolean sub-expression; `(x.name ?? '') === 'ada'` and `(x.name).length` are
|
|
2338
|
+
* values. Only the token after the matching bracket tells them apart, so the decision is made by
|
|
2339
|
+
* looking ahead rather than by parsing one way and catching the failure — a rewind on exception
|
|
2340
|
+
* would swallow a genuine syntax error inside the group and report it as something else.
|
|
2341
|
+
*/ groupIsValue() {
|
|
2342
|
+
let depth = 0;
|
|
2343
|
+
let at = this.index;
|
|
2344
|
+
for(; at < this.tokens.length; at++){
|
|
2345
|
+
const token = this.tokens[at];
|
|
2346
|
+
if (token.kind !== "punctuation") {
|
|
2347
|
+
continue;
|
|
2348
|
+
}
|
|
2349
|
+
if (token.value === "(") {
|
|
2350
|
+
depth++;
|
|
2351
|
+
continue;
|
|
2352
|
+
}
|
|
2353
|
+
if (token.value === ")") {
|
|
2354
|
+
depth--;
|
|
2355
|
+
if (depth === 0) {
|
|
2356
|
+
break;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
const after = this.tokens[at + 1];
|
|
2361
|
+
if (after == null || after.kind !== "punctuation") {
|
|
2362
|
+
return false;
|
|
2363
|
+
}
|
|
2364
|
+
return COMPARISON_OPERATORS[after.value] != null || after.value === "." || after.value === "?.";
|
|
2365
|
+
}
|
|
2366
|
+
/** Whether a `?` sits at the top level of what is left, so this is a conditional. */ holdsConditional() {
|
|
2367
|
+
let depth = 0;
|
|
2368
|
+
for(let at = this.index; at < this.tokens.length; at++){
|
|
2369
|
+
const token = this.tokens[at];
|
|
2370
|
+
if (token.kind !== "punctuation") {
|
|
2371
|
+
continue;
|
|
2372
|
+
}
|
|
2373
|
+
if (token.value === "(" || token.value === "[") {
|
|
2374
|
+
depth++;
|
|
2375
|
+
} else if (token.value === ")" || token.value === "]") {
|
|
2376
|
+
depth--;
|
|
2377
|
+
} else if (token.value === "?" && depth === 0) {
|
|
2378
|
+
return true;
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
return false;
|
|
2382
|
+
}
|
|
2383
|
+
/** Whether the group starting here is `( … ? … : … )` rather than a plain value. */ groupHoldsConditional() {
|
|
2384
|
+
let depth = 0;
|
|
2385
|
+
for(let at = this.index; at < this.tokens.length; at++){
|
|
2386
|
+
const token = this.tokens[at];
|
|
2387
|
+
if (token.kind !== "punctuation") {
|
|
2388
|
+
continue;
|
|
2389
|
+
}
|
|
2390
|
+
if (token.value === "(") {
|
|
2391
|
+
depth++;
|
|
2392
|
+
continue;
|
|
2393
|
+
}
|
|
2394
|
+
if (token.value === ")") {
|
|
2395
|
+
depth--;
|
|
2396
|
+
if (depth === 0) {
|
|
2397
|
+
return false;
|
|
2398
|
+
}
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
if (token.value === "?" && depth === 1) {
|
|
2402
|
+
return true;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
return false;
|
|
2406
|
+
}
|
|
1668
2407
|
matchPunctuation(value) {
|
|
1669
2408
|
if (this.isPunctuation(value)) {
|
|
1670
2409
|
this.index++;
|
|
@@ -1678,12 +2417,101 @@ const isHexDigit = (char)=>isDigit(char) || char >= "a" && char <= "f" || char >
|
|
|
1678
2417
|
}
|
|
1679
2418
|
}
|
|
1680
2419
|
}
|
|
1681
|
-
|
|
2420
|
+
/**
|
|
2421
|
+
* Calls JavaScript binds LOOSER than a comparison.
|
|
2422
|
+
*
|
|
2423
|
+
* This grammar reads a comparison's operands as values, which puts these tighter than they belong:
|
|
2424
|
+
* `x.flags & 6 === 2` is `x.flags & (6 === 2)` in JavaScript and would be read here as
|
|
2425
|
+
* `(x.flags & 6) === 2`. The two answer differently, so an ungrouped one is refused rather than
|
|
2426
|
+
* reinterpreted — the filter then runs in memory against the caller's own function, which is right by
|
|
2427
|
+
* construction. Brackets say which was meant, and JavaScript itself makes an unbracketed `??` mix a
|
|
2428
|
+
* syntax error for the same reason.
|
|
2429
|
+
*/ const LOOSER_THAN_COMPARISON = [
|
|
2430
|
+
"bit-and",
|
|
2431
|
+
"bit-or",
|
|
2432
|
+
"bit-xor",
|
|
2433
|
+
"coalesce"
|
|
2434
|
+
];
|
|
2435
|
+
const needsBrackets = (operand)=>operand.kind === "arithmetic" && operand.grouped !== true && LOOSER_THAN_COMPARISON.includes(operand.call);
|
|
2436
|
+
/** JavaScript precedence: `*`, `/`, `%` bind tighter than `+` and `-`. */ const MULTIPLICATIVE_OPERATORS = sourceKeyed({
|
|
2437
|
+
"*": "multiply",
|
|
2438
|
+
"/": "divide",
|
|
2439
|
+
"%": "modulo"
|
|
2440
|
+
});
|
|
2441
|
+
const ADDITIVE_OPERATORS = sourceKeyed({
|
|
2442
|
+
"+": "add",
|
|
2443
|
+
"-": "subtract"
|
|
2444
|
+
});
|
|
2445
|
+
const SHIFT_OPERATORS = sourceKeyed({
|
|
2446
|
+
"<<": "shift-left",
|
|
2447
|
+
">>": "shift-right",
|
|
2448
|
+
">>>": "shift-right-unsigned"
|
|
2449
|
+
});
|
|
2450
|
+
const BITWISE_AND_OPERATORS = sourceKeyed({
|
|
2451
|
+
"&": "bit-and"
|
|
2452
|
+
});
|
|
2453
|
+
const BITWISE_XOR_OPERATORS = sourceKeyed({
|
|
2454
|
+
"^": "bit-xor"
|
|
2455
|
+
});
|
|
2456
|
+
const BITWISE_OR_OPERATORS = sourceKeyed({
|
|
2457
|
+
"|": "bit-or"
|
|
2458
|
+
});
|
|
2459
|
+
const COALESCE_OPERATORS = sourceKeyed({
|
|
2460
|
+
"??": "coalesce"
|
|
2461
|
+
});
|
|
2462
|
+
/** Whether a schema property is reachable in here, which decides which side of a comparison it is. */ const containsProperty = (operand)=>{
|
|
2463
|
+
if (operand.kind === "property") {
|
|
2464
|
+
return true;
|
|
2465
|
+
}
|
|
2466
|
+
if (operand.kind === "conditional") {
|
|
2467
|
+
// A comparison always names a schema property, so the condition alone settles it
|
|
2468
|
+
return true;
|
|
2469
|
+
}
|
|
2470
|
+
return operand.kind === "arithmetic" && (containsProperty(operand.left) || containsProperty(operand.right) || operand.extra != null && containsProperty(operand.extra));
|
|
2471
|
+
};
|
|
2472
|
+
const DECLARATION_KEYWORDS = new Set([
|
|
2473
|
+
"const",
|
|
2474
|
+
"let",
|
|
2475
|
+
"var"
|
|
2476
|
+
]);
|
|
2477
|
+
/** An operand whose value only a row can supply. */ const UNKNOWN_UNTIL_ROW = Symbol("unknown until row");
|
|
2478
|
+
/** The empty argument slot of a unary call. Compared by identity, so a real `undefined` still counts. */ const NO_ARGUMENT = Object.freeze({
|
|
2479
|
+
kind: "value",
|
|
2480
|
+
value: undefined,
|
|
2481
|
+
transformer: null,
|
|
2482
|
+
locale: null
|
|
2483
|
+
});
|
|
2484
|
+
const noArgument = ()=>NO_ARGUMENT;
|
|
2485
|
+
/** A predicate no row satisfies. Never reaches a tree: no expression node means "match nothing". */ const NEVER = "never";
|
|
2486
|
+
const and = (left, right)=>{
|
|
2487
|
+
if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(left)) {
|
|
2488
|
+
return right;
|
|
2489
|
+
}
|
|
2490
|
+
if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(right)) {
|
|
2491
|
+
return left;
|
|
2492
|
+
}
|
|
2493
|
+
return new _types__rspack_import_1/* .OperatorExpression */.fw({
|
|
2494
|
+
operator: "&&",
|
|
2495
|
+
left,
|
|
2496
|
+
right
|
|
2497
|
+
});
|
|
2498
|
+
};
|
|
2499
|
+
const or = (left, right)=>{
|
|
2500
|
+
if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(left) || _types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(right)) {
|
|
2501
|
+
return _types__rspack_import_1/* .Expression.EMPTY */.r4.EMPTY;
|
|
2502
|
+
}
|
|
2503
|
+
return new _types__rspack_import_1/* .OperatorExpression */.fw({
|
|
2504
|
+
operator: "||",
|
|
2505
|
+
left,
|
|
2506
|
+
right
|
|
2507
|
+
});
|
|
2508
|
+
};
|
|
2509
|
+
const COMPARATOR_METHODS = sourceKeyed({
|
|
1682
2510
|
startsWith: "starts-with",
|
|
1683
2511
|
endsWith: "ends-with",
|
|
1684
2512
|
includes: "includes"
|
|
1685
|
-
};
|
|
1686
|
-
const TRANSFORM_METHODS = {
|
|
2513
|
+
});
|
|
2514
|
+
const TRANSFORM_METHODS = sourceKeyed({
|
|
1687
2515
|
toLowerCase: {
|
|
1688
2516
|
transformer: "to-lower-case",
|
|
1689
2517
|
locale: null
|
|
@@ -1700,8 +2528,8 @@ const TRANSFORM_METHODS = {
|
|
|
1700
2528
|
transformer: "to-upper-case",
|
|
1701
2529
|
locale: "en-US"
|
|
1702
2530
|
}
|
|
1703
|
-
};
|
|
1704
|
-
const COMPARISON_OPERATORS = {
|
|
2531
|
+
});
|
|
2532
|
+
const COMPARISON_OPERATORS = sourceKeyed({
|
|
1705
2533
|
"==": {
|
|
1706
2534
|
comparator: "equals",
|
|
1707
2535
|
negated: false,
|
|
@@ -1742,7 +2570,7 @@ const COMPARISON_OPERATORS = {
|
|
|
1742
2570
|
negated: false,
|
|
1743
2571
|
strict: false
|
|
1744
2572
|
}
|
|
1745
|
-
};
|
|
2573
|
+
});
|
|
1746
2574
|
const SWAPPED_COMPARATORS = {
|
|
1747
2575
|
"equals": "equals",
|
|
1748
2576
|
"greater-than": "less-than",
|
|
@@ -1813,14 +2641,14 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1813
2641
|
*/ class ExpressionParser {
|
|
1814
2642
|
schema;
|
|
1815
2643
|
stream;
|
|
1816
|
-
|
|
2644
|
+
scope;
|
|
1817
2645
|
paramsName;
|
|
1818
2646
|
params;
|
|
1819
2647
|
/** Set when a param value shaped the tree itself (e.g. x[p.name]) — such templates cannot be cached. */ structurallyDependsOnParams = false;
|
|
1820
|
-
constructor(schema, stream,
|
|
2648
|
+
constructor(schema, stream, scope, paramsName, params){
|
|
1821
2649
|
this.schema = schema;
|
|
1822
2650
|
this.stream = stream;
|
|
1823
|
-
this.
|
|
2651
|
+
this.scope = scope;
|
|
1824
2652
|
this.paramsName = paramsName;
|
|
1825
2653
|
this.params = params;
|
|
1826
2654
|
}
|
|
@@ -1831,6 +2659,180 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1831
2659
|
}
|
|
1832
2660
|
return expression;
|
|
1833
2661
|
}
|
|
2662
|
+
parseBody() {
|
|
2663
|
+
if (!this.stream.isPunctuation("{")) {
|
|
2664
|
+
return this.parse();
|
|
2665
|
+
}
|
|
2666
|
+
const answer = this.parseBlock();
|
|
2667
|
+
if (!this.stream.isAtEnd) {
|
|
2668
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`unexpected token '${this.stream.peek()?.value}'`));
|
|
2669
|
+
}
|
|
2670
|
+
if (answer === NEVER) {
|
|
2671
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a predicate no row can satisfy"));
|
|
2672
|
+
}
|
|
2673
|
+
return answer;
|
|
2674
|
+
}
|
|
2675
|
+
/** The expression a `{ … }` block answers with. */ parseBlock() {
|
|
2676
|
+
this.stream.expectPunctuation("{");
|
|
2677
|
+
const answer = this.parseStatements();
|
|
2678
|
+
this.stream.expectPunctuation("}");
|
|
2679
|
+
return answer;
|
|
2680
|
+
}
|
|
2681
|
+
/** Statements up to the one that returns. What follows a `return` is never read, as in JavaScript. */ parseStatements() {
|
|
2682
|
+
if (this.stream.isPunctuation("}") || this.stream.isAtEnd) {
|
|
2683
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a block body that returns nothing"));
|
|
2684
|
+
}
|
|
2685
|
+
const keyword = this.stream.peek();
|
|
2686
|
+
if (keyword == null || keyword.kind !== "identifier") {
|
|
2687
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`a statement starting '${keyword?.value}'`));
|
|
2688
|
+
}
|
|
2689
|
+
if (DECLARATION_KEYWORDS.has(keyword.value)) {
|
|
2690
|
+
this.declare();
|
|
2691
|
+
return this.parseStatements();
|
|
2692
|
+
}
|
|
2693
|
+
if (keyword.value === "return") {
|
|
2694
|
+
this.stream.next();
|
|
2695
|
+
const answer = this.parseReturnedCondition();
|
|
2696
|
+
this.stream.matchPunctuation(";");
|
|
2697
|
+
return answer;
|
|
2698
|
+
}
|
|
2699
|
+
if (keyword.value === "if") {
|
|
2700
|
+
return this.parseIfStatement();
|
|
2701
|
+
}
|
|
2702
|
+
if (keyword.value === "switch") {
|
|
2703
|
+
return this.parseSwitchStatement();
|
|
2704
|
+
}
|
|
2705
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`the statement '${keyword.value}'`));
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Binds a `const`/`let`/`var` name to the tokens of its initializer — tokens rather than a parsed
|
|
2709
|
+
* expression, so the name works as an operand, an argument, or a call receiver alike.
|
|
2710
|
+
*/ declare() {
|
|
2711
|
+
this.stream.next();
|
|
2712
|
+
const name = this.stream.next();
|
|
2713
|
+
if (name.kind !== "identifier") {
|
|
2714
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`the declaration '${name.value}'`));
|
|
2715
|
+
}
|
|
2716
|
+
this.stream.expectPunctuation("=");
|
|
2717
|
+
this.scope.set(name.value, {
|
|
2718
|
+
kind: "inlined",
|
|
2719
|
+
tokens: this.stream.takeStatementTokens()
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
/** `return false` on its own, which no row satisfies, and every other returned condition. */ parseReturnedCondition() {
|
|
2723
|
+
const next = this.stream.peek();
|
|
2724
|
+
const after = this.stream.peek(1);
|
|
2725
|
+
const endsHere = after == null || after.kind === "punctuation" && (after.value === ";" || after.value === "}");
|
|
2726
|
+
if (next != null && next.kind === "identifier" && next.value === "false" && endsHere) {
|
|
2727
|
+
this.stream.next();
|
|
2728
|
+
return NEVER;
|
|
2729
|
+
}
|
|
2730
|
+
return this.parseOr();
|
|
2731
|
+
}
|
|
2732
|
+
parseIfStatement() {
|
|
2733
|
+
this.stream.next();
|
|
2734
|
+
this.stream.expectPunctuation("(");
|
|
2735
|
+
const condition = this.parseOr();
|
|
2736
|
+
this.stream.expectPunctuation(")");
|
|
2737
|
+
const whenTrue = this.parseBranch();
|
|
2738
|
+
if (this.stream.peek()?.value === "else") {
|
|
2739
|
+
this.stream.next();
|
|
2740
|
+
return this.either(condition, whenTrue, this.parseBranch());
|
|
2741
|
+
}
|
|
2742
|
+
// Without an `else`, the statements after the `if` are the other branch
|
|
2743
|
+
return this.either(condition, whenTrue, this.parseStatements());
|
|
2744
|
+
}
|
|
2745
|
+
/** One arm of an `if`: a block, or a single statement. */ parseBranch() {
|
|
2746
|
+
return this.stream.isPunctuation("{") ? this.parseBlock() : this.parseStatements();
|
|
2747
|
+
}
|
|
2748
|
+
/** A `switch` over one subject, as the disjunction of its cases. */ parseSwitchStatement() {
|
|
2749
|
+
this.stream.next();
|
|
2750
|
+
this.stream.expectPunctuation("(");
|
|
2751
|
+
const subject = this.parseValue();
|
|
2752
|
+
this.stream.expectPunctuation(")");
|
|
2753
|
+
this.stream.expectPunctuation("{");
|
|
2754
|
+
let matching = null;
|
|
2755
|
+
let pending = [];
|
|
2756
|
+
let everyLabel = [];
|
|
2757
|
+
let byDefault = null;
|
|
2758
|
+
let anyCaseBroke = false;
|
|
2759
|
+
while(!this.stream.matchPunctuation("}")){
|
|
2760
|
+
const label = this.stream.next();
|
|
2761
|
+
if (label.kind !== "identifier" || label.value !== "case" && label.value !== "default") {
|
|
2762
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'${label.value}' inside a switch`));
|
|
2763
|
+
}
|
|
2764
|
+
if (label.value === "case") {
|
|
2765
|
+
const test = this.buildComparison(subject, COMPARISON_OPERATORS["==="], this.parseValue());
|
|
2766
|
+
pending.push(test);
|
|
2767
|
+
everyLabel.push(test);
|
|
2768
|
+
}
|
|
2769
|
+
this.stream.expectPunctuation(":");
|
|
2770
|
+
// `case 'a':` with no body of its own runs the next case's body
|
|
2771
|
+
if (this.stream.peek()?.value === "case" || this.stream.peek()?.value === "default") {
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
if (this.stream.peek()?.value === "break") {
|
|
2775
|
+
this.stream.next();
|
|
2776
|
+
this.stream.matchPunctuation(";");
|
|
2777
|
+
anyCaseBroke = true;
|
|
2778
|
+
pending = [];
|
|
2779
|
+
continue;
|
|
2780
|
+
}
|
|
2781
|
+
const body = this.parseCaseBody();
|
|
2782
|
+
if (label.value === "default") {
|
|
2783
|
+
byDefault = body === NEVER ? null : body;
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
if (body !== NEVER && pending.length > 0) {
|
|
2787
|
+
const reached = pending.reduce((left, right)=>or(left, right));
|
|
2788
|
+
const term = _types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(body) ? reached : and(reached, body);
|
|
2789
|
+
matching = matching == null ? term : or(matching, term);
|
|
2790
|
+
}
|
|
2791
|
+
pending = [];
|
|
2792
|
+
}
|
|
2793
|
+
// Falling out of the switch continues after it, so the statements there are the default too
|
|
2794
|
+
const afterSwitch = byDefault == null && !this.stream.isPunctuation("}") && !this.stream.isAtEnd ? this.parseStatements() : NEVER;
|
|
2795
|
+
if (afterSwitch !== NEVER) {
|
|
2796
|
+
// A `break` also continues after the switch, so its case would take that answer rather
|
|
2797
|
+
// than none — a distinction this rewrite cannot carry
|
|
2798
|
+
if (anyCaseBroke) {
|
|
2799
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a switch that breaks and then falls into more statements"));
|
|
2800
|
+
}
|
|
2801
|
+
byDefault = afterSwitch;
|
|
2802
|
+
}
|
|
2803
|
+
// A `default` runs only when every case failed, wherever it was written
|
|
2804
|
+
if (byDefault != null) {
|
|
2805
|
+
const noCaseMatched = everyLabel.length === 0 ? byDefault : and(this.negateExpression(everyLabel.reduce((left, right)=>or(left, right))), byDefault);
|
|
2806
|
+
matching = matching == null ? noCaseMatched : or(matching, noCaseMatched);
|
|
2807
|
+
}
|
|
2808
|
+
return matching ?? NEVER;
|
|
2809
|
+
}
|
|
2810
|
+
/** One case body, and the `break` that may follow its `return`. */ parseCaseBody() {
|
|
2811
|
+
const answer = this.parseStatements();
|
|
2812
|
+
if (this.stream.peek()?.value === "break") {
|
|
2813
|
+
this.stream.next();
|
|
2814
|
+
this.stream.matchPunctuation(";");
|
|
2815
|
+
}
|
|
2816
|
+
return answer;
|
|
2817
|
+
}
|
|
2818
|
+
/**
|
|
2819
|
+
* The predicate an `if`/`else` answers: `(condition && whenTrue) || (!condition && whenFalse)`,
|
|
2820
|
+
* with each case below that form after a constant branch cancels out.
|
|
2821
|
+
*/ either(condition, whenTrue, whenFalse) {
|
|
2822
|
+
if (whenTrue === NEVER) {
|
|
2823
|
+
return whenFalse === NEVER ? NEVER : and(this.negateExpression(condition), whenFalse);
|
|
2824
|
+
}
|
|
2825
|
+
if (whenFalse === NEVER) {
|
|
2826
|
+
return and(condition, whenTrue);
|
|
2827
|
+
}
|
|
2828
|
+
if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(whenTrue)) {
|
|
2829
|
+
return or(condition, whenFalse);
|
|
2830
|
+
}
|
|
2831
|
+
if (_types__rspack_import_1/* .Expression.isEmpty */.r4.isEmpty(whenFalse)) {
|
|
2832
|
+
return or(this.negateExpression(condition), whenTrue);
|
|
2833
|
+
}
|
|
2834
|
+
return or(and(condition, whenTrue), and(this.negateExpression(condition), whenFalse));
|
|
2835
|
+
}
|
|
1834
2836
|
// || binds loosest, so it sits at the root of the parse
|
|
1835
2837
|
parseOr() {
|
|
1836
2838
|
let left = this.parseAnd();
|
|
@@ -1878,10 +2880,18 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1878
2880
|
/**
|
|
1879
2881
|
* Applies `!` to an already-parsed expression: comparators flip their
|
|
1880
2882
|
* negated flag, compound expressions distribute via De Morgan's laws.
|
|
2883
|
+
*
|
|
2884
|
+
* Builds a new tree rather than flipping the flag in place, because an `if` uses its condition
|
|
2885
|
+
* twice — once negated — and a shared node would carry the flip into both branches.
|
|
1881
2886
|
*/ negateExpression(expression) {
|
|
1882
2887
|
if (expression instanceof _types__rspack_import_1/* .ComparatorExpression */.bQ) {
|
|
1883
|
-
|
|
1884
|
-
|
|
2888
|
+
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
2889
|
+
comparator: expression.comparator,
|
|
2890
|
+
negated: !expression.negated,
|
|
2891
|
+
strict: expression.strict,
|
|
2892
|
+
left: expression.left,
|
|
2893
|
+
right: expression.right
|
|
2894
|
+
});
|
|
1885
2895
|
}
|
|
1886
2896
|
if (expression instanceof _types__rspack_import_1/* .OperatorExpression */.fw && expression.left != null && expression.right != null) {
|
|
1887
2897
|
return new _types__rspack_import_1/* .OperatorExpression */.fw({
|
|
@@ -1893,25 +2903,125 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1893
2903
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED("'!' on this expression"));
|
|
1894
2904
|
}
|
|
1895
2905
|
parseComparison() {
|
|
1896
|
-
|
|
1897
|
-
|
|
2906
|
+
/**
|
|
2907
|
+
* A parenthesised group is either a boolean sub-expression or a VALUE — `(a && b)` against
|
|
2908
|
+
* `(x.name ?? '') === 'ada'` — and which one it is is only known at the closing bracket, by
|
|
2909
|
+
* what follows. So the boolean reading is tried first and rewound if a comparator turns up.
|
|
2910
|
+
*/ if (this.stream.isPunctuation("(") && this.stream.groupIsValue() === false) {
|
|
2911
|
+
this.stream.next();
|
|
1898
2912
|
const expression = this.parseOr();
|
|
1899
2913
|
this.stream.expectPunctuation(")");
|
|
1900
|
-
const trailing = this.stream.peek();
|
|
1901
|
-
if (trailing != null && trailing.kind === "punctuation" && COMPARISON_OPERATORS[trailing.value] != null) {
|
|
1902
|
-
throw new Error(ERROR_MESSAGES.UNSUPPORTED("comparison against a parenthesized expression"));
|
|
1903
|
-
}
|
|
1904
2914
|
return expression;
|
|
1905
2915
|
}
|
|
1906
|
-
const left = this.
|
|
2916
|
+
const left = this.parseValue();
|
|
1907
2917
|
const operatorToken = this.stream.peek();
|
|
1908
2918
|
if (operatorToken != null && operatorToken.kind === "punctuation" && COMPARISON_OPERATORS[operatorToken.value] != null) {
|
|
1909
2919
|
this.stream.next();
|
|
1910
|
-
const right = this.
|
|
2920
|
+
const right = this.parseValue();
|
|
1911
2921
|
return this.buildComparison(left, COMPARISON_OPERATORS[operatorToken.value], right);
|
|
1912
2922
|
}
|
|
1913
2923
|
return this.buildStandalone(left);
|
|
1914
2924
|
}
|
|
2925
|
+
/**
|
|
2926
|
+
* A value, at JavaScript's precedence.
|
|
2927
|
+
*
|
|
2928
|
+
* Lowest first: the conditional operator, then nullish coalescing, then the bitwise levels, then
|
|
2929
|
+
* the shifts, then the arithmetic. Comparison sits between the shifts and the bitwise levels in
|
|
2930
|
+
* JavaScript, but a comparison is a boolean and is handled by `parseComparison` above, so this
|
|
2931
|
+
* chain skips it — a bitwise operand here is always a value.
|
|
2932
|
+
*/ /**
|
|
2933
|
+
* An operand from its own source, sharing this parser's schema and parameter names.
|
|
2934
|
+
*
|
|
2935
|
+
* A structural dependence found inside propagates outward: the template it belongs to cannot be
|
|
2936
|
+
* cached either.
|
|
2937
|
+
*/ parseNested(source) {
|
|
2938
|
+
const nested = new ExpressionParser(this.schema, new TokenStream(tokenize(source)), this.scope, this.paramsName, this.params);
|
|
2939
|
+
const operand = nested.parseInterpolation();
|
|
2940
|
+
// Leftover tokens mean the interpolation held something this reads only part of. Silently
|
|
2941
|
+
// keeping the part it understood is the worst outcome available: `${x.age > 5 ? "a" : "b"}`
|
|
2942
|
+
// would become `x.age`, and the filter would answer a question nobody asked.
|
|
2943
|
+
if (nested.stream.isAtEnd === false) {
|
|
2944
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("an interpolation this parser reads only part of"));
|
|
2945
|
+
}
|
|
2946
|
+
if (nested.structurallyDependsOnParams === true) {
|
|
2947
|
+
this.structurallyDependsOnParams = true;
|
|
2948
|
+
}
|
|
2949
|
+
return operand;
|
|
2950
|
+
}
|
|
2951
|
+
/**
|
|
2952
|
+
* The whole of one `${…}`.
|
|
2953
|
+
*
|
|
2954
|
+
* A conditional is read here rather than in `parseValue`, because an interpolation is the one
|
|
2955
|
+
* place a conditional appears without brackets around it.
|
|
2956
|
+
*/ parseInterpolation() {
|
|
2957
|
+
if (this.stream.holdsConditional()) {
|
|
2958
|
+
const condition = this.parseOr();
|
|
2959
|
+
this.stream.expectPunctuation("?");
|
|
2960
|
+
const whenTrue = this.parseValue();
|
|
2961
|
+
this.stream.expectPunctuation(":");
|
|
2962
|
+
const whenFalse = this.parseValue();
|
|
2963
|
+
return {
|
|
2964
|
+
kind: "conditional",
|
|
2965
|
+
condition,
|
|
2966
|
+
whenTrue,
|
|
2967
|
+
whenFalse
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
return this.parseValue();
|
|
2971
|
+
}
|
|
2972
|
+
parseValue() {
|
|
2973
|
+
return this.parseCoalesce();
|
|
2974
|
+
}
|
|
2975
|
+
parseCoalesce() {
|
|
2976
|
+
return this.parseBinary(COALESCE_OPERATORS, ()=>this.parseBitwiseOr());
|
|
2977
|
+
}
|
|
2978
|
+
parseBitwiseOr() {
|
|
2979
|
+
return this.parseBinary(BITWISE_OR_OPERATORS, ()=>this.parseBitwiseXor());
|
|
2980
|
+
}
|
|
2981
|
+
parseBitwiseXor() {
|
|
2982
|
+
return this.parseBinary(BITWISE_XOR_OPERATORS, ()=>this.parseBitwiseAnd());
|
|
2983
|
+
}
|
|
2984
|
+
parseBitwiseAnd() {
|
|
2985
|
+
return this.parseBinary(BITWISE_AND_OPERATORS, ()=>this.parseShift());
|
|
2986
|
+
}
|
|
2987
|
+
parseShift() {
|
|
2988
|
+
return this.parseBinary(SHIFT_OPERATORS, ()=>this.parseAdditive());
|
|
2989
|
+
}
|
|
2990
|
+
parseAdditive() {
|
|
2991
|
+
return this.parseBinary(ADDITIVE_OPERATORS, ()=>this.parseMultiplicative());
|
|
2992
|
+
}
|
|
2993
|
+
parseMultiplicative() {
|
|
2994
|
+
return this.parseBinary(MULTIPLICATIVE_OPERATORS, ()=>this.parseExponent());
|
|
2995
|
+
}
|
|
2996
|
+
/** `**` is RIGHT-associative: `2 ** 3 ** 2` is 2 ** 9, not 8 ** 2. */ parseExponent() {
|
|
2997
|
+
const left = this.parseOperand();
|
|
2998
|
+
if (this.stream.isPunctuation("**") === false) {
|
|
2999
|
+
return left;
|
|
3000
|
+
}
|
|
3001
|
+
this.stream.next();
|
|
3002
|
+
return {
|
|
3003
|
+
kind: "arithmetic",
|
|
3004
|
+
call: "power",
|
|
3005
|
+
left,
|
|
3006
|
+
right: this.parseExponent()
|
|
3007
|
+
};
|
|
3008
|
+
}
|
|
3009
|
+
/** Left-associative, so `a - b - c` is `(a - b) - c` rather than `a - (b - c)`. */ parseBinary(operators, next) {
|
|
3010
|
+
let left = next();
|
|
3011
|
+
for(;;){
|
|
3012
|
+
const token = this.stream.peek();
|
|
3013
|
+
if (token == null || token.kind !== "punctuation" || operators[token.value] == null) {
|
|
3014
|
+
return left;
|
|
3015
|
+
}
|
|
3016
|
+
this.stream.next();
|
|
3017
|
+
left = {
|
|
3018
|
+
kind: "arithmetic",
|
|
3019
|
+
call: operators[token.value],
|
|
3020
|
+
left,
|
|
3021
|
+
right: next()
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
1915
3025
|
parseOperand() {
|
|
1916
3026
|
const token = this.stream.peek();
|
|
1917
3027
|
if (token == null) {
|
|
@@ -1935,6 +3045,131 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1935
3045
|
locale: null
|
|
1936
3046
|
};
|
|
1937
3047
|
}
|
|
3048
|
+
// A parenthesised VALUE — `(x.price & 1)`, `(x.name ?? '')`. The boolean reading of a group
|
|
3049
|
+
// is handled in parseComparison; by the time an operand sees one it is arithmetic.
|
|
3050
|
+
if (token.kind === "punctuation" && token.value === "(") {
|
|
3051
|
+
const conditional = this.stream.groupHoldsConditional();
|
|
3052
|
+
this.stream.next();
|
|
3053
|
+
if (conditional === true) {
|
|
3054
|
+
const condition = this.parseOr();
|
|
3055
|
+
this.stream.expectPunctuation("?");
|
|
3056
|
+
const whenTrue = this.parseValue();
|
|
3057
|
+
this.stream.expectPunctuation(":");
|
|
3058
|
+
const whenFalse = this.parseValue();
|
|
3059
|
+
this.stream.expectPunctuation(")");
|
|
3060
|
+
return {
|
|
3061
|
+
kind: "conditional",
|
|
3062
|
+
condition,
|
|
3063
|
+
whenTrue,
|
|
3064
|
+
whenFalse
|
|
3065
|
+
};
|
|
3066
|
+
}
|
|
3067
|
+
const inner = this.parseValue();
|
|
3068
|
+
this.stream.expectPunctuation(")");
|
|
3069
|
+
const grouped = inner.kind === "arithmetic" ? {
|
|
3070
|
+
...inner,
|
|
3071
|
+
grouped: true
|
|
3072
|
+
} : inner;
|
|
3073
|
+
return this.withGroupCall(grouped);
|
|
3074
|
+
}
|
|
3075
|
+
/**
|
|
3076
|
+
* A template with interpolation, folded into `concat`.
|
|
3077
|
+
*
|
|
3078
|
+
* Each `${…}` was kept as source by the tokenizer and is parsed by its own stream, so it can
|
|
3079
|
+
* hold anything an operand can — a property, a param, arithmetic, another template. Empty
|
|
3080
|
+
* chunks are dropped: `${a}${b}` is two operands, not two operands and three empty strings.
|
|
3081
|
+
*/ if (token.kind === "template") {
|
|
3082
|
+
this.stream.next();
|
|
3083
|
+
const { chunks, expressions } = JSON.parse(token.value);
|
|
3084
|
+
const pieces = [];
|
|
3085
|
+
for(let at = 0; at < chunks.length; at++){
|
|
3086
|
+
if (chunks[at].length > 0) {
|
|
3087
|
+
pieces.push({
|
|
3088
|
+
kind: "value",
|
|
3089
|
+
value: chunks[at],
|
|
3090
|
+
transformer: null,
|
|
3091
|
+
locale: null
|
|
3092
|
+
});
|
|
3093
|
+
}
|
|
3094
|
+
if (at < expressions.length) {
|
|
3095
|
+
pieces.push(this.parseNested(expressions[at]));
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
if (pieces.length === 0) {
|
|
3099
|
+
return {
|
|
3100
|
+
kind: "value",
|
|
3101
|
+
value: "",
|
|
3102
|
+
transformer: null,
|
|
3103
|
+
locale: null
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
// One piece and no chunk means no concat to do the coercion, so the conversion has to be
|
|
3107
|
+
// explicit: `` `${x.age}` `` is the STRING "9", not the number 9.
|
|
3108
|
+
if (pieces.length === 1) {
|
|
3109
|
+
const only = pieces[0];
|
|
3110
|
+
const alreadyText = only.kind === "value" && typeof only.value === "string";
|
|
3111
|
+
return alreadyText ? only : {
|
|
3112
|
+
kind: "arithmetic",
|
|
3113
|
+
call: "to-string",
|
|
3114
|
+
left: only,
|
|
3115
|
+
right: noArgument()
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
return pieces.reduce((left, right)=>({
|
|
3119
|
+
kind: "arithmetic",
|
|
3120
|
+
call: "concat",
|
|
3121
|
+
left,
|
|
3122
|
+
right
|
|
3123
|
+
}));
|
|
3124
|
+
}
|
|
3125
|
+
if (token.kind === "bigint") {
|
|
3126
|
+
this.stream.next();
|
|
3127
|
+
return {
|
|
3128
|
+
kind: "value",
|
|
3129
|
+
value: BigInt(token.value),
|
|
3130
|
+
transformer: null,
|
|
3131
|
+
locale: null
|
|
3132
|
+
};
|
|
3133
|
+
}
|
|
3134
|
+
if (token.kind === "regex") {
|
|
3135
|
+
this.stream.next();
|
|
3136
|
+
const [source, flags] = token.value.split("\u0000");
|
|
3137
|
+
const pattern = {
|
|
3138
|
+
kind: "value",
|
|
3139
|
+
value: new RegExp(source, flags),
|
|
3140
|
+
transformer: null,
|
|
3141
|
+
locale: null
|
|
3142
|
+
};
|
|
3143
|
+
// `/^a/.test(x.name)` — the pattern is the literal, the subject is the argument, and the
|
|
3144
|
+
// tree puts them the other way round: the property is what the call applies to.
|
|
3145
|
+
if (this.stream.isPunctuation(".")) {
|
|
3146
|
+
const method = this.stream.peek(1);
|
|
3147
|
+
if (method != null && method.kind === "identifier" && method.value === "test") {
|
|
3148
|
+
this.stream.next();
|
|
3149
|
+
this.stream.next();
|
|
3150
|
+
this.stream.expectPunctuation("(");
|
|
3151
|
+
const subject = this.parseValue();
|
|
3152
|
+
this.stream.expectPunctuation(")");
|
|
3153
|
+
return {
|
|
3154
|
+
kind: "arithmetic",
|
|
3155
|
+
call: "matches",
|
|
3156
|
+
left: subject,
|
|
3157
|
+
right: pattern
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
return pattern;
|
|
3162
|
+
}
|
|
3163
|
+
if (token.kind === "punctuation" && token.value === "~") {
|
|
3164
|
+
this.stream.next();
|
|
3165
|
+
// Unary, so the tree carries the operand and no argument
|
|
3166
|
+
return {
|
|
3167
|
+
kind: "arithmetic",
|
|
3168
|
+
call: "bit-not",
|
|
3169
|
+
left: this.parseOperand(),
|
|
3170
|
+
right: noArgument()
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
1938
3173
|
if (token.kind === "punctuation" && token.value === "-") {
|
|
1939
3174
|
this.stream.next();
|
|
1940
3175
|
const numberToken = this.stream.next();
|
|
@@ -1992,6 +3227,9 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
1992
3227
|
if (argument.kind === "method-call") {
|
|
1993
3228
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED("nested method call inside .includes()"));
|
|
1994
3229
|
}
|
|
3230
|
+
if (argument.kind === "arithmetic" || argument.kind === "conditional") {
|
|
3231
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("arithmetic inside .includes()"));
|
|
3232
|
+
}
|
|
1995
3233
|
return {
|
|
1996
3234
|
kind: "method-call",
|
|
1997
3235
|
target: array,
|
|
@@ -2037,16 +3275,17 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2037
3275
|
locale: null
|
|
2038
3276
|
};
|
|
2039
3277
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
if (this.paramsName != null && root === this.paramsName) {
|
|
3278
|
+
const binding = this.scope.get(root);
|
|
3279
|
+
if (binding != null) {
|
|
3280
|
+
if (binding.kind === "inlined") {
|
|
3281
|
+
this.stream.splice(binding.tokens);
|
|
3282
|
+
return this.parseOperand();
|
|
3283
|
+
}
|
|
2047
3284
|
return this.parseChain({
|
|
2048
|
-
kind:
|
|
2049
|
-
|
|
3285
|
+
kind: binding.kind,
|
|
3286
|
+
path: [
|
|
3287
|
+
...binding.path
|
|
3288
|
+
]
|
|
2050
3289
|
});
|
|
2051
3290
|
}
|
|
2052
3291
|
// A bare variable from the outer scope — its value cannot be derived from source text
|
|
@@ -2056,7 +3295,7 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2056
3295
|
* Parses the segments after an entity/params root: dot access, bracket
|
|
2057
3296
|
* access, transform methods and comparator methods.
|
|
2058
3297
|
*/ parseChain(options) {
|
|
2059
|
-
const path =
|
|
3298
|
+
const path = options.path;
|
|
2060
3299
|
let transformer = null;
|
|
2061
3300
|
let locale = null;
|
|
2062
3301
|
while(true){
|
|
@@ -2082,6 +3321,9 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2082
3321
|
if (argument.kind === "method-call") {
|
|
2083
3322
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`nested method call inside .${method}()`));
|
|
2084
3323
|
}
|
|
3324
|
+
if (argument.kind === "arithmetic" || argument.kind === "conditional") {
|
|
3325
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`arithmetic inside .${method}()`));
|
|
3326
|
+
}
|
|
2085
3327
|
return {
|
|
2086
3328
|
kind: "method-call",
|
|
2087
3329
|
target: this.resolveChain(options.kind, path, transformer, locale),
|
|
@@ -2118,12 +3360,15 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2118
3360
|
// docs/mutation-backlog.md) — every mutation of this four-conjunct guard reroutes
|
|
2119
3361
|
// bracket access between two paths that both collapse to NOT_PARSABLE; the
|
|
2120
3362
|
// experiment recorded there aimed 30 tests at this line and killed none.
|
|
2121
|
-
|
|
2122
|
-
|
|
3363
|
+
const binding = token.kind === "identifier" ? this.scope.get(token.value) : undefined;
|
|
3364
|
+
if (kind === "property" && binding != null && binding.kind === "param") {
|
|
3365
|
+
const paramPath = [
|
|
3366
|
+
...binding.path
|
|
3367
|
+
];
|
|
2123
3368
|
while(this.stream.matchPunctuation(".") || this.stream.matchPunctuation("?.")){
|
|
2124
3369
|
paramPath.push(this.stream.next().value);
|
|
2125
3370
|
}
|
|
2126
|
-
const resolved = resolveParamPath(this.paramsName, paramPath, this.params);
|
|
3371
|
+
const resolved = resolveParamPath(this.paramsName ?? token.value, paramPath, this.params);
|
|
2127
3372
|
if (typeof resolved !== "string") {
|
|
2128
3373
|
throw new ParamDependentParseError(ERROR_MESSAGES.PROPERTY_NOT_FOUND(paramPath.join(".")));
|
|
2129
3374
|
}
|
|
@@ -2176,6 +3421,67 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2176
3421
|
locale
|
|
2177
3422
|
};
|
|
2178
3423
|
}
|
|
3424
|
+
/**
|
|
3425
|
+
* A call on a parenthesised value: `(x.name).toLowerCase()`, `(x.age + 1).length`. Any operand can
|
|
3426
|
+
* receive one here, unlike a property chain, which carries at most one transform.
|
|
3427
|
+
*/ withGroupCall(operand) {
|
|
3428
|
+
let receiver = operand;
|
|
3429
|
+
while(this.stream.isPunctuation(".") || this.stream.isPunctuation("?.")){
|
|
3430
|
+
const segment = this.stream.peek(1);
|
|
3431
|
+
if (segment == null || segment.kind !== "identifier") {
|
|
3432
|
+
break;
|
|
3433
|
+
}
|
|
3434
|
+
if (segment.value === "length" && !this.stream.isPunctuation("(", 2)) {
|
|
3435
|
+
this.stream.next();
|
|
3436
|
+
this.stream.next();
|
|
3437
|
+
receiver = {
|
|
3438
|
+
kind: "arithmetic",
|
|
3439
|
+
call: "length",
|
|
3440
|
+
left: receiver,
|
|
3441
|
+
right: noArgument()
|
|
3442
|
+
};
|
|
3443
|
+
continue;
|
|
3444
|
+
}
|
|
3445
|
+
const transform = TRANSFORM_METHODS[segment.value];
|
|
3446
|
+
if (transform != null) {
|
|
3447
|
+
this.stream.next();
|
|
3448
|
+
this.stream.next();
|
|
3449
|
+
this.stream.expectPunctuation("(");
|
|
3450
|
+
this.stream.expectPunctuation(")");
|
|
3451
|
+
receiver = {
|
|
3452
|
+
kind: "arithmetic",
|
|
3453
|
+
call: transform.transformer,
|
|
3454
|
+
left: receiver,
|
|
3455
|
+
right: transform.locale == null ? noArgument() : {
|
|
3456
|
+
kind: "value",
|
|
3457
|
+
value: transform.locale,
|
|
3458
|
+
transformer: null,
|
|
3459
|
+
locale: null
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
continue;
|
|
3463
|
+
}
|
|
3464
|
+
// A comparator method needs a property target, which only an ungrouped chain produces
|
|
3465
|
+
if (COMPARATOR_METHODS[segment.value] != null && receiver.kind === "property") {
|
|
3466
|
+
this.stream.next();
|
|
3467
|
+
this.stream.next();
|
|
3468
|
+
this.stream.expectPunctuation("(");
|
|
3469
|
+
const argument = this.parseOperand();
|
|
3470
|
+
this.stream.expectPunctuation(")");
|
|
3471
|
+
if (argument.kind !== "property" && argument.kind !== "value" && argument.kind !== "param") {
|
|
3472
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'.${segment.value}()' on that argument`));
|
|
3473
|
+
}
|
|
3474
|
+
return {
|
|
3475
|
+
kind: "method-call",
|
|
3476
|
+
target: receiver,
|
|
3477
|
+
method: segment.value,
|
|
3478
|
+
argument
|
|
3479
|
+
};
|
|
3480
|
+
}
|
|
3481
|
+
break;
|
|
3482
|
+
}
|
|
3483
|
+
return receiver;
|
|
3484
|
+
}
|
|
2179
3485
|
withValueTransformer(operand) {
|
|
2180
3486
|
if (this.stream.isPunctuation(".")) {
|
|
2181
3487
|
const method = this.stream.peek(1);
|
|
@@ -2209,12 +3515,22 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2209
3515
|
if (right.kind === "method-call") {
|
|
2210
3516
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED("method call on the right side of a comparison"));
|
|
2211
3517
|
}
|
|
2212
|
-
if (left
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
3518
|
+
if (needsBrackets(left) || needsBrackets(right)) {
|
|
3519
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a bitwise or nullish operator compared without brackets, which JavaScript reads the other way round"));
|
|
3520
|
+
}
|
|
3521
|
+
if (left.kind === "arithmetic" || right.kind === "arithmetic" || left.kind === "conditional" || right.kind === "conditional") {
|
|
3522
|
+
if (containsProperty(left) === false && containsProperty(right) === false) {
|
|
3523
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("arithmetic that references no schema property"));
|
|
2217
3524
|
}
|
|
3525
|
+
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
3526
|
+
comparator: operator.comparator,
|
|
3527
|
+
negated: operator.negated,
|
|
3528
|
+
strict: operator.strict,
|
|
3529
|
+
left: this.createOperandExpression(left),
|
|
3530
|
+
right: this.createOperandExpression(right)
|
|
3531
|
+
});
|
|
3532
|
+
}
|
|
3533
|
+
if (left.kind === "property" && right.kind === "property") {
|
|
2218
3534
|
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
2219
3535
|
comparator: operator.comparator,
|
|
2220
3536
|
negated: operator.negated,
|
|
@@ -2223,18 +3539,63 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2223
3539
|
right: this.createPropertyExpression(right)
|
|
2224
3540
|
});
|
|
2225
3541
|
}
|
|
3542
|
+
// Only a loose comparison coerces. `===` records `strict` and honouring it is the point.
|
|
2226
3543
|
if (left.kind === "property" && right.kind !== "property") {
|
|
2227
|
-
return this.buildPropertyComparator(left, operator, right, /* applyConverter */
|
|
3544
|
+
return this.buildPropertyComparator(left, operator, right, /* applyConverter */ !operator.strict);
|
|
2228
3545
|
}
|
|
2229
3546
|
if (right.kind === "property" && left.kind !== "property") {
|
|
2230
3547
|
const swapped = {
|
|
2231
3548
|
...operator,
|
|
2232
3549
|
comparator: SWAPPED_COMPARATORS[operator.comparator]
|
|
2233
3550
|
};
|
|
2234
|
-
return this.buildPropertyComparator(right, swapped, left, /* applyConverter */
|
|
3551
|
+
return this.buildPropertyComparator(right, swapped, left, /* applyConverter */ !operator.strict);
|
|
3552
|
+
}
|
|
3553
|
+
const settled = this.settleConstantComparison(left, operator, right);
|
|
3554
|
+
if (settled != null) {
|
|
3555
|
+
return settled;
|
|
2235
3556
|
}
|
|
2236
3557
|
throw new Error(ERROR_MESSAGES.UNSUPPORTED("comparison requires a schema property on at least one side"));
|
|
2237
3558
|
}
|
|
3559
|
+
/**
|
|
3560
|
+
* The answer a comparison of two constants gives, when that answer is `true`. The other answer
|
|
3561
|
+
* excludes every row, which has no expression node.
|
|
3562
|
+
*/ settleConstantComparison(left, operator, right) {
|
|
3563
|
+
const leftValue = this.constantOf(left);
|
|
3564
|
+
const rightValue = this.constantOf(right);
|
|
3565
|
+
if (leftValue === UNKNOWN_UNTIL_ROW || rightValue === UNKNOWN_UNTIL_ROW) {
|
|
3566
|
+
return null;
|
|
3567
|
+
}
|
|
3568
|
+
const answer = (0,_evaluate__rspack_import_3/* .evaluate */._3)(new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
3569
|
+
comparator: operator.comparator,
|
|
3570
|
+
negated: operator.negated,
|
|
3571
|
+
strict: operator.strict,
|
|
3572
|
+
left: new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
3573
|
+
value: leftValue
|
|
3574
|
+
}),
|
|
3575
|
+
right: new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
3576
|
+
value: rightValue
|
|
3577
|
+
})
|
|
3578
|
+
}), {});
|
|
3579
|
+
if (answer === true) {
|
|
3580
|
+
return _types__rspack_import_1/* .Expression.EMPTY */.r4.EMPTY;
|
|
3581
|
+
}
|
|
3582
|
+
// Params decided this, so the refusal must not be cached against the source: the same filter
|
|
3583
|
+
// with other params can be a tautology.
|
|
3584
|
+
if (left.kind === "param" || right.kind === "param") {
|
|
3585
|
+
throw new ParamDependentParseError(ERROR_MESSAGES.UNSUPPORTED("a params comparison no row satisfies"));
|
|
3586
|
+
}
|
|
3587
|
+
return null;
|
|
3588
|
+
}
|
|
3589
|
+
/** The value an operand holds already, for the operands that do not depend on a row. */ constantOf(operand) {
|
|
3590
|
+
if (operand.kind === "value" && operand.transformer == null) {
|
|
3591
|
+
return operand.value;
|
|
3592
|
+
}
|
|
3593
|
+
if (operand.kind === "param" && operand.transformer == null) {
|
|
3594
|
+
this.structurallyDependsOnParams = true;
|
|
3595
|
+
return resolveParamPath(this.paramsName ?? "params", operand.path, this.params);
|
|
3596
|
+
}
|
|
3597
|
+
return UNKNOWN_UNTIL_ROW;
|
|
3598
|
+
}
|
|
2238
3599
|
buildStandalone(operand) {
|
|
2239
3600
|
if (operand.kind === "method-call") {
|
|
2240
3601
|
return this.buildMethodComparator(operand);
|
|
@@ -2257,6 +3618,21 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2257
3618
|
locale: null
|
|
2258
3619
|
}, /* applyConverter */ true);
|
|
2259
3620
|
}
|
|
3621
|
+
// A boolean-valued call standing alone IS the predicate
|
|
3622
|
+
if (operand.kind === "arithmetic" && operand.call === "matches") {
|
|
3623
|
+
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
3624
|
+
comparator: "equals",
|
|
3625
|
+
negated: false,
|
|
3626
|
+
strict: false,
|
|
3627
|
+
left: this.createOperandExpression(operand),
|
|
3628
|
+
right: new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
3629
|
+
value: true
|
|
3630
|
+
})
|
|
3631
|
+
});
|
|
3632
|
+
}
|
|
3633
|
+
if (operand.kind === "arithmetic" || operand.kind === "conditional") {
|
|
3634
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("arithmetic used as a condition rather than compared"));
|
|
3635
|
+
}
|
|
2260
3636
|
// Constant `true` — a tautology, which parseAnd/parseOr simplify away
|
|
2261
3637
|
if (operand.kind === "value" && operand.value === true && operand.transformer == null) {
|
|
2262
3638
|
return _types__rspack_import_1/* .Expression.EMPTY */.r4.EMPTY;
|
|
@@ -2309,12 +3685,6 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2309
3685
|
right: this.createValueExpression(value, null, /* applyConverter */ false)
|
|
2310
3686
|
});
|
|
2311
3687
|
}
|
|
2312
|
-
// Casing transformers on a property are only meaningful with string-matching
|
|
2313
|
-
// comparators; on relational comparators the plugins would silently
|
|
2314
|
-
// ignore them and return wrong data
|
|
2315
|
-
if (property.transformer != null && !isStringMatch) {
|
|
2316
|
-
throw new Error(ERROR_MESSAGES.UNSUPPORTED("transform method outside of startsWith/endsWith/includes"));
|
|
2317
|
-
}
|
|
2318
3688
|
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
2319
3689
|
comparator: operator.comparator,
|
|
2320
3690
|
negated: operator.negated,
|
|
@@ -2323,31 +3693,60 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2323
3693
|
right: this.createValueExpression(value, property.property, applyConverter)
|
|
2324
3694
|
});
|
|
2325
3695
|
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Any operand as an expression.
|
|
3698
|
+
*
|
|
3699
|
+
* Values inside arithmetic take no paired property: the result is a computed number, so the
|
|
3700
|
+
* property's serializer and type converter do not describe it — the same reason `.length` skips
|
|
3701
|
+
* them.
|
|
3702
|
+
*/ createOperandExpression(operand) {
|
|
3703
|
+
if (operand.kind === "conditional") {
|
|
3704
|
+
return new _types__rspack_import_1/* .CallExpression */.DG({
|
|
3705
|
+
call: "conditional",
|
|
3706
|
+
expression: operand.condition,
|
|
3707
|
+
arguments: [
|
|
3708
|
+
this.createOperandExpression(operand.whenTrue),
|
|
3709
|
+
this.createOperandExpression(operand.whenFalse)
|
|
3710
|
+
]
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
if (operand.kind === "arithmetic") {
|
|
3714
|
+
return new _types__rspack_import_1/* .CallExpression */.DG({
|
|
3715
|
+
call: operand.call,
|
|
3716
|
+
expression: this.createOperandExpression(operand.left),
|
|
3717
|
+
arguments: operand.right === NO_ARGUMENT ? [] : operand.extra == null ? [
|
|
3718
|
+
this.createOperandExpression(operand.right)
|
|
3719
|
+
] : [
|
|
3720
|
+
this.createOperandExpression(operand.right),
|
|
3721
|
+
this.createOperandExpression(operand.extra)
|
|
3722
|
+
]
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3725
|
+
if (operand.kind === "property") {
|
|
3726
|
+
return this.createPropertyExpression(operand);
|
|
3727
|
+
}
|
|
3728
|
+
if (operand.kind === "method-call") {
|
|
3729
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED("a method call inside arithmetic"));
|
|
3730
|
+
}
|
|
3731
|
+
return this.createValueExpression(operand, null, /* applyConverter */ false);
|
|
3732
|
+
}
|
|
2326
3733
|
createPropertyExpression(operand) {
|
|
2327
|
-
|
|
3734
|
+
return asCall(new _types__rspack_import_1/* .PropertyExpression */.ep({
|
|
2328
3735
|
property: operand.property
|
|
2329
|
-
});
|
|
2330
|
-
expression.transformer = operand.transformer;
|
|
2331
|
-
expression.locale = operand.locale;
|
|
2332
|
-
return expression;
|
|
3736
|
+
}), operand.transformer, operand.locale);
|
|
2333
3737
|
}
|
|
2334
3738
|
createValueExpression(operand, pairedProperty, applyConverter) {
|
|
2335
3739
|
if (operand.kind === "param") {
|
|
2336
|
-
|
|
3740
|
+
return asCall(new ParamReferenceExpression({
|
|
2337
3741
|
paramPath: operand.path,
|
|
2338
3742
|
pairedProperty,
|
|
2339
3743
|
applyConverter
|
|
2340
|
-
});
|
|
2341
|
-
expression.transformer = operand.transformer;
|
|
2342
|
-
expression.locale = operand.locale;
|
|
2343
|
-
return expression;
|
|
3744
|
+
}), operand.transformer, operand.locale);
|
|
2344
3745
|
}
|
|
2345
3746
|
const expression = new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
2346
3747
|
value: resolvePairedValue(operand.value, pairedProperty, applyConverter)
|
|
2347
3748
|
});
|
|
2348
|
-
expression.transformer
|
|
2349
|
-
expression.locale = operand.locale;
|
|
2350
|
-
return expression;
|
|
3749
|
+
return asCall(expression, operand.transformer, operand.locale);
|
|
2351
3750
|
}
|
|
2352
3751
|
}
|
|
2353
3752
|
// #endregion
|
|
@@ -2359,28 +3758,19 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2359
3758
|
*/ const bindExpression = (expression, paramsName, params)=>{
|
|
2360
3759
|
if (expression instanceof ParamReferenceExpression) {
|
|
2361
3760
|
const raw = resolveParamPath(paramsName ?? "params", expression.paramPath, params);
|
|
2362
|
-
|
|
3761
|
+
return new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
2363
3762
|
value: resolvePairedValue(raw, expression.pairedProperty, expression.applyConverter)
|
|
2364
3763
|
});
|
|
2365
|
-
bound.transformer = expression.transformer;
|
|
2366
|
-
bound.locale = expression.locale;
|
|
2367
|
-
return bound;
|
|
2368
3764
|
}
|
|
2369
3765
|
if (expression instanceof _types__rspack_import_1/* .ValueExpression */.Ko) {
|
|
2370
|
-
|
|
3766
|
+
return new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
2371
3767
|
value: expression.value
|
|
2372
3768
|
});
|
|
2373
|
-
clone.transformer = expression.transformer;
|
|
2374
|
-
clone.locale = expression.locale;
|
|
2375
|
-
return clone;
|
|
2376
3769
|
}
|
|
2377
3770
|
if (expression instanceof _types__rspack_import_1/* .PropertyExpression */.ep) {
|
|
2378
|
-
|
|
3771
|
+
return new _types__rspack_import_1/* .PropertyExpression */.ep({
|
|
2379
3772
|
property: expression.property
|
|
2380
3773
|
});
|
|
2381
|
-
clone.transformer = expression.transformer;
|
|
2382
|
-
clone.locale = expression.locale;
|
|
2383
|
-
return clone;
|
|
2384
3774
|
}
|
|
2385
3775
|
if (expression instanceof _types__rspack_import_1/* .ComparatorExpression */.bQ) {
|
|
2386
3776
|
return new _types__rspack_import_1/* .ComparatorExpression */.bQ({
|
|
@@ -2398,8 +3788,99 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2398
3788
|
right: expression.right ? bindExpression(expression.right, paramsName, params) : undefined
|
|
2399
3789
|
});
|
|
2400
3790
|
}
|
|
3791
|
+
if (expression instanceof _types__rspack_import_1/* .CallExpression */.DG) {
|
|
3792
|
+
return new _types__rspack_import_1/* .CallExpression */.DG({
|
|
3793
|
+
call: expression.call,
|
|
3794
|
+
expression: bindExpression(expression.expression, paramsName, params),
|
|
3795
|
+
arguments: expression.arguments.map((argument)=>bindExpression(argument, paramsName, params))
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
2401
3798
|
return expression;
|
|
2402
3799
|
};
|
|
3800
|
+
/**
|
|
3801
|
+
* Wraps an operand in the call a transform method named, if there was one.
|
|
3802
|
+
*
|
|
3803
|
+
* `Transformer` and `Call` share these three names, so the transform IS the call name. A locale
|
|
3804
|
+
* becomes the call's first argument, which is where it belongs — it qualifies the casing, not the
|
|
3805
|
+
* property.
|
|
3806
|
+
*/ const asCall = (inner, transformer, locale)=>{
|
|
3807
|
+
if (transformer == null) {
|
|
3808
|
+
return inner;
|
|
3809
|
+
}
|
|
3810
|
+
return new _types__rspack_import_1/* .CallExpression */.DG({
|
|
3811
|
+
call: transformer,
|
|
3812
|
+
expression: inner,
|
|
3813
|
+
arguments: locale == null ? [] : [
|
|
3814
|
+
new _types__rspack_import_1/* .ValueExpression */.Ko({
|
|
3815
|
+
value: locale
|
|
3816
|
+
})
|
|
3817
|
+
]
|
|
3818
|
+
});
|
|
3819
|
+
};
|
|
3820
|
+
/** Binds every name a destructuring pattern introduces to the path it reads. */ const bindPattern = (stream, kind, path, scope)=>{
|
|
3821
|
+
if (!stream.matchPunctuation("{")) {
|
|
3822
|
+
const name = stream.next();
|
|
3823
|
+
if (name.kind !== "identifier") {
|
|
3824
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`parameter '${name.value}'`));
|
|
3825
|
+
}
|
|
3826
|
+
scope.set(name.value, {
|
|
3827
|
+
kind,
|
|
3828
|
+
path
|
|
3829
|
+
});
|
|
3830
|
+
return;
|
|
3831
|
+
}
|
|
3832
|
+
while(!stream.matchPunctuation("}")){
|
|
3833
|
+
const key = stream.next();
|
|
3834
|
+
if (key.kind !== "identifier") {
|
|
3835
|
+
throw new Error(ERROR_MESSAGES.UNSUPPORTED(`destructured key '${key.value}'`));
|
|
3836
|
+
}
|
|
3837
|
+
if (stream.matchPunctuation(":")) {
|
|
3838
|
+
bindPattern(stream, kind, [
|
|
3839
|
+
...path,
|
|
3840
|
+
key.value
|
|
3841
|
+
], scope);
|
|
3842
|
+
} else {
|
|
3843
|
+
scope.set(key.value, {
|
|
3844
|
+
kind,
|
|
3845
|
+
path: [
|
|
3846
|
+
...path,
|
|
3847
|
+
key.value
|
|
3848
|
+
]
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3851
|
+
if (!stream.matchPunctuation(",")) {
|
|
3852
|
+
stream.expectPunctuation("}");
|
|
3853
|
+
return;
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
/** Reads a filter's parameter list — the entity alone, or the `[entity, params]` pair — into a scope. */ const buildScope = (parameterNames, hasParams)=>{
|
|
3858
|
+
const stream = new TokenStream(tokenize(parameterNames));
|
|
3859
|
+
const scope = new Map();
|
|
3860
|
+
if (!stream.matchPunctuation("[")) {
|
|
3861
|
+
bindPattern(stream, "property", [], scope);
|
|
3862
|
+
return {
|
|
3863
|
+
scope,
|
|
3864
|
+
paramsName: null
|
|
3865
|
+
};
|
|
3866
|
+
}
|
|
3867
|
+
bindPattern(stream, "property", [], scope);
|
|
3868
|
+
if (hasParams && stream.matchPunctuation(",") && !stream.isPunctuation("]")) {
|
|
3869
|
+
bindPattern(stream, "param", [], scope);
|
|
3870
|
+
}
|
|
3871
|
+
return {
|
|
3872
|
+
scope,
|
|
3873
|
+
paramsName: wholeParamsName(scope)
|
|
3874
|
+
};
|
|
3875
|
+
};
|
|
3876
|
+
/** The name the whole params object was given, when it was not destructured. Error messages only. */ const wholeParamsName = (scope)=>{
|
|
3877
|
+
for (const [name, binding] of scope){
|
|
3878
|
+
if (binding.kind === "param" && binding.path.length === 0) {
|
|
3879
|
+
return name;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
return null;
|
|
3883
|
+
};
|
|
2403
3884
|
/**
|
|
2404
3885
|
* Splits stringified filter source into parameter names and the expression
|
|
2405
3886
|
* body, unwrapping single-return block bodies.
|
|
@@ -2429,33 +3910,12 @@ const resolveParamPath = (paramsName, path, data)=>{
|
|
|
2429
3910
|
parameterNames = parameterNames.slice(1, -1).trim();
|
|
2430
3911
|
}
|
|
2431
3912
|
}
|
|
2432
|
-
|
|
2433
|
-
let paramsName = null;
|
|
2434
|
-
if (parameterNames.startsWith("[") && parameterNames.endsWith("]")) {
|
|
2435
|
-
const destructured = parameterNames.slice(1, -1).split(",").map((w)=>w.trim());
|
|
2436
|
-
entityName = destructured[0];
|
|
2437
|
-
if (hasParams) {
|
|
2438
|
-
paramsName = destructured[1] ?? null;
|
|
2439
|
-
}
|
|
2440
|
-
} else {
|
|
2441
|
-
entityName = parameterNames;
|
|
2442
|
-
}
|
|
2443
|
-
if (entityName == null || entityName.length === 0) {
|
|
3913
|
+
if (parameterNames.length === 0) {
|
|
2444
3914
|
throw new Error("Invalid Function");
|
|
2445
3915
|
}
|
|
2446
|
-
|
|
2447
|
-
if (body.startsWith("{")) {
|
|
2448
|
-
const inner = body.slice(1, body.lastIndexOf("}")).trim();
|
|
2449
|
-
if (!inner.startsWith("return")) {
|
|
2450
|
-
throw new Error(ERROR_MESSAGES.UNSUPPORTED("block body without a single return statement"));
|
|
2451
|
-
}
|
|
2452
|
-
body = inner.slice("return".length).trim();
|
|
2453
|
-
if (body.endsWith(";")) {
|
|
2454
|
-
body = body.slice(0, -1).trim();
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
3916
|
+
const { scope, paramsName } = buildScope(parameterNames, hasParams);
|
|
2457
3917
|
return {
|
|
2458
|
-
|
|
3918
|
+
scope,
|
|
2459
3919
|
paramsName,
|
|
2460
3920
|
body
|
|
2461
3921
|
};
|
|
@@ -2523,17 +3983,27 @@ const combineExpressions = (...expressions)=>{
|
|
|
2523
3983
|
*/ const parseFragment = (schema, body, rootName)=>{
|
|
2524
3984
|
try {
|
|
2525
3985
|
const stream = new TokenStream(tokenize(body));
|
|
2526
|
-
const
|
|
2527
|
-
|
|
3986
|
+
const scope = new Map([
|
|
3987
|
+
[
|
|
3988
|
+
rootName,
|
|
3989
|
+
{
|
|
3990
|
+
kind: "property",
|
|
3991
|
+
path: []
|
|
3992
|
+
}
|
|
3993
|
+
]
|
|
3994
|
+
]);
|
|
3995
|
+
const parser = new ExpressionParser(schema, stream, scope, null, undefined);
|
|
3996
|
+
return (0,_fold__rspack_import_4/* .foldConstantCalls */.F5)(parser.parse());
|
|
2528
3997
|
} catch {
|
|
2529
3998
|
// The failure is expected and informative — see above — so it is not logged. A caller that
|
|
2530
3999
|
// parses one conjunct against two schemas would otherwise warn on every successful split.
|
|
2531
4000
|
return _types__rspack_import_1/* .Expression.NOT_PARSABLE */.r4.NOT_PARSABLE;
|
|
2532
4001
|
}
|
|
2533
4002
|
};
|
|
4003
|
+
/** What the parser refused, from a throw that may not be an `Error`. */ const refusalOf = (error)=>error instanceof Error ? error.message : String(error);
|
|
2534
4004
|
const toExpression = (schema, fn, params)=>{
|
|
2535
4005
|
const stringifiedFunction = fn.toString();
|
|
2536
|
-
const warn = (error)=>
|
|
4006
|
+
const warn = (error)=>_utilities__rspack_import_5/* .logger.warn */.vF.warn("Error parsing expression", {
|
|
2537
4007
|
error,
|
|
2538
4008
|
collectionName: schema.collectionName,
|
|
2539
4009
|
params,
|
|
@@ -2541,16 +4011,17 @@ const toExpression = (schema, fn, params)=>{
|
|
|
2541
4011
|
});
|
|
2542
4012
|
const cached = getCachedTemplate(schema, stringifiedFunction);
|
|
2543
4013
|
if (cached != null) {
|
|
2544
|
-
// A cached failure — the warning was already logged when it was discovered
|
|
4014
|
+
// A cached failure — the warning was already logged when it was discovered. The template
|
|
4015
|
+
// carries what was refused, and `.explain()` is usually called once the cache is warm.
|
|
2545
4016
|
if (_types__rspack_import_1/* .Expression.isNotParsable */.r4.isNotParsable(cached.template)) {
|
|
2546
|
-
return
|
|
4017
|
+
return cached.template;
|
|
2547
4018
|
}
|
|
2548
4019
|
try {
|
|
2549
|
-
return bindExpression(cached.template, cached.paramsName, params);
|
|
4020
|
+
return (0,_fold__rspack_import_4/* .foldConstantCalls */.F5)(bindExpression(cached.template, cached.paramsName, params));
|
|
2550
4021
|
} catch (error) {
|
|
2551
4022
|
// Binding failures are param-dependent by nature — never cached
|
|
2552
4023
|
warn(error);
|
|
2553
|
-
return _types__rspack_import_1/* .Expression.
|
|
4024
|
+
return _types__rspack_import_1/* .Expression.notParsable */.r4.notParsable(refusalOf(error));
|
|
2554
4025
|
}
|
|
2555
4026
|
}
|
|
2556
4027
|
let paramsName = null;
|
|
@@ -2559,22 +4030,23 @@ const toExpression = (schema, fn, params)=>{
|
|
|
2559
4030
|
try {
|
|
2560
4031
|
const shape = resolveFunctionShape(stringifiedFunction, params != null);
|
|
2561
4032
|
const stream = new TokenStream(tokenize(shape.body));
|
|
2562
|
-
const parser = new ExpressionParser(schema, stream, shape.
|
|
4033
|
+
const parser = new ExpressionParser(schema, stream, shape.scope, shape.paramsName, params);
|
|
2563
4034
|
paramsName = shape.paramsName;
|
|
2564
|
-
template = parser.
|
|
4035
|
+
template = parser.parseBody();
|
|
2565
4036
|
structurallyDependsOnParams = parser.structurallyDependsOnParams;
|
|
2566
4037
|
} catch (error) {
|
|
2567
4038
|
// Cache the failure so a hot query on an unsupported filter doesn't
|
|
2568
4039
|
// re-parse and re-warn on every execution. Param-dependent failures are
|
|
2569
4040
|
// exempt: the same source can succeed with different params.
|
|
4041
|
+
const refused = _types__rspack_import_1/* .Expression.notParsable */.r4.notParsable(refusalOf(error));
|
|
2570
4042
|
if (!(error instanceof ParamDependentParseError)) {
|
|
2571
4043
|
setCachedTemplate(schema, stringifiedFunction, {
|
|
2572
|
-
template:
|
|
4044
|
+
template: refused,
|
|
2573
4045
|
paramsName: null
|
|
2574
4046
|
});
|
|
2575
4047
|
}
|
|
2576
4048
|
warn(error);
|
|
2577
|
-
return
|
|
4049
|
+
return refused;
|
|
2578
4050
|
}
|
|
2579
4051
|
// Templates whose structure was resolved from param values are only
|
|
2580
4052
|
// valid for this exact params object — parse those fresh every time
|
|
@@ -2585,10 +4057,10 @@ const toExpression = (schema, fn, params)=>{
|
|
|
2585
4057
|
});
|
|
2586
4058
|
}
|
|
2587
4059
|
try {
|
|
2588
|
-
return bindExpression(template, paramsName, params);
|
|
4060
|
+
return (0,_fold__rspack_import_4/* .foldConstantCalls */.F5)(bindExpression(template, paramsName, params));
|
|
2589
4061
|
} catch (error) {
|
|
2590
4062
|
warn(error);
|
|
2591
|
-
return _types__rspack_import_1/* .Expression.
|
|
4063
|
+
return _types__rspack_import_1/* .Expression.notParsable */.r4.notParsable(refusalOf(error));
|
|
2592
4064
|
}
|
|
2593
4065
|
};
|
|
2594
4066
|
|
|
@@ -2596,6 +4068,7 @@ const toExpression = (schema, fn, params)=>{
|
|
|
2596
4068
|
},
|
|
2597
4069
|
27(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2598
4070
|
__webpack_require__.d(__webpack_exports__, {
|
|
4071
|
+
DG: () => (CallExpression),
|
|
2599
4072
|
Ko: () => (ValueExpression),
|
|
2600
4073
|
SC: () => (NotParsableExpression),
|
|
2601
4074
|
Sm: () => (EmptyExpression),
|
|
@@ -2607,59 +4080,69 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
2607
4080
|
const valueToJson = (value)=>{
|
|
2608
4081
|
if (value === undefined) {
|
|
2609
4082
|
return {
|
|
2610
|
-
|
|
4083
|
+
undefined: true
|
|
2611
4084
|
};
|
|
2612
4085
|
}
|
|
2613
4086
|
if (value === null) {
|
|
2614
|
-
return
|
|
2615
|
-
k: "raw",
|
|
2616
|
-
v: null
|
|
2617
|
-
};
|
|
4087
|
+
return null;
|
|
2618
4088
|
}
|
|
2619
4089
|
if (value instanceof Date) {
|
|
2620
4090
|
// ISO rather than epoch millis: it survives a human reading the payload, and an invalid
|
|
2621
4091
|
// Date has no ISO form — so it is caught here rather than becoming a silent `null`.
|
|
2622
4092
|
return {
|
|
2623
|
-
|
|
2624
|
-
v: value.toISOString()
|
|
4093
|
+
date: value.toISOString()
|
|
2625
4094
|
};
|
|
2626
4095
|
}
|
|
2627
4096
|
if (Array.isArray(value)) {
|
|
2628
|
-
return
|
|
2629
|
-
k: "array",
|
|
2630
|
-
v: value.map(valueToJson)
|
|
2631
|
-
};
|
|
4097
|
+
return value.map(valueToJson);
|
|
2632
4098
|
}
|
|
2633
4099
|
if (typeof value === "number" && Number.isFinite(value) === false) {
|
|
2634
4100
|
// `JSON.stringify` turns all three of these into `null`, which would compare as a different
|
|
2635
4101
|
// value entirely rather than failing.
|
|
2636
4102
|
return {
|
|
2637
|
-
|
|
2638
|
-
v: Number.isNaN(value) ? "NaN" : value > 0 ? "Infinity" : "-Infinity"
|
|
4103
|
+
number: Number.isNaN(value) ? "NaN" : value > 0 ? "Infinity" : "-Infinity"
|
|
2639
4104
|
};
|
|
2640
4105
|
}
|
|
2641
4106
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
4107
|
+
return value;
|
|
4108
|
+
}
|
|
4109
|
+
if (value instanceof RegExp) {
|
|
4110
|
+
return {
|
|
4111
|
+
regex: {
|
|
4112
|
+
source: value.source,
|
|
4113
|
+
flags: value.flags
|
|
4114
|
+
}
|
|
4115
|
+
};
|
|
4116
|
+
}
|
|
4117
|
+
// `JSON.stringify` throws outright on a bigint rather than losing it quietly, so this is the one
|
|
4118
|
+
// tag that turns a crash into a value
|
|
4119
|
+
if (typeof value === "bigint") {
|
|
2642
4120
|
return {
|
|
2643
|
-
|
|
2644
|
-
v: value
|
|
4121
|
+
bigint: value.toString()
|
|
2645
4122
|
};
|
|
2646
4123
|
}
|
|
2647
4124
|
throw new Error(`Cannot serialize this filter value: only strings, numbers, booleans, null, undefined, Dates and arrays of those can cross a wire. ` + `Received: ${Object.prototype.toString.call(value)}`);
|
|
2648
4125
|
};
|
|
2649
4126
|
const valueFromJson = (value)=>{
|
|
2650
|
-
if (value
|
|
2651
|
-
return
|
|
4127
|
+
if (value === null || typeof value !== "object") {
|
|
4128
|
+
return value;
|
|
4129
|
+
}
|
|
4130
|
+
if (Array.isArray(value)) {
|
|
4131
|
+
return value.map(valueFromJson);
|
|
4132
|
+
}
|
|
4133
|
+
if ("date" in value) {
|
|
4134
|
+
return new Date(value.date);
|
|
2652
4135
|
}
|
|
2653
|
-
if (
|
|
2654
|
-
return
|
|
4136
|
+
if ("undefined" in value) {
|
|
4137
|
+
return undefined;
|
|
2655
4138
|
}
|
|
2656
|
-
if (
|
|
2657
|
-
return value.
|
|
4139
|
+
if ("regex" in value) {
|
|
4140
|
+
return new RegExp(value.regex.source, value.regex.flags);
|
|
2658
4141
|
}
|
|
2659
|
-
if (
|
|
2660
|
-
return value.
|
|
4142
|
+
if ("bigint" in value) {
|
|
4143
|
+
return BigInt(value.bigint);
|
|
2661
4144
|
}
|
|
2662
|
-
return value.
|
|
4145
|
+
return value.number === "NaN" ? Number.NaN : value.number === "Infinity" ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
2663
4146
|
};
|
|
2664
4147
|
/**
|
|
2665
4148
|
* The base class for all expression types.
|
|
@@ -2676,6 +4159,9 @@ const valueFromJson = (value)=>{
|
|
|
2676
4159
|
static get NOT_PARSABLE() {
|
|
2677
4160
|
return new NotParsableExpression();
|
|
2678
4161
|
}
|
|
4162
|
+
/** `NOT_PARSABLE`, carrying what the parser refused. */ static notParsable(reason) {
|
|
4163
|
+
return new NotParsableExpression(reason);
|
|
4164
|
+
}
|
|
2679
4165
|
static isEmpty(expression) {
|
|
2680
4166
|
return expression.type === "empty" || expression instanceof EmptyExpression;
|
|
2681
4167
|
}
|
|
@@ -2692,7 +4178,7 @@ const valueFromJson = (value)=>{
|
|
|
2692
4178
|
*
|
|
2693
4179
|
* ## Why it is this small
|
|
2694
4180
|
*
|
|
2695
|
-
* Of the
|
|
4181
|
+
* Of the seven node types a bound tree can contain, exactly one holds anything JSON cannot carry:
|
|
2696
4182
|
* `PropertyExpression`, whose live `PropertyInfo` has functions, a parent chain and caches. It
|
|
2697
4183
|
* reduces to a property PATH — `PropertyInfo.id` IS the dotted path, and `getProperty` is keyed by
|
|
2698
4184
|
* exactly that — so rebinding is one lookup.
|
|
@@ -2707,7 +4193,7 @@ const valueFromJson = (value)=>{
|
|
|
2707
4193
|
if (expression.type === "operator") {
|
|
2708
4194
|
const operator = expression;
|
|
2709
4195
|
return {
|
|
2710
|
-
|
|
4196
|
+
type: "operator",
|
|
2711
4197
|
operator: operator.operator,
|
|
2712
4198
|
...operator.left != null && {
|
|
2713
4199
|
left: Expression.toJson(operator.left)
|
|
@@ -2720,7 +4206,7 @@ const valueFromJson = (value)=>{
|
|
|
2720
4206
|
if (expression.type === "comparator") {
|
|
2721
4207
|
const comparator = expression;
|
|
2722
4208
|
return {
|
|
2723
|
-
|
|
4209
|
+
type: "comparator",
|
|
2724
4210
|
comparator: comparator.comparator,
|
|
2725
4211
|
negated: comparator.negated,
|
|
2726
4212
|
strict: comparator.strict,
|
|
@@ -2732,29 +4218,41 @@ const valueFromJson = (value)=>{
|
|
|
2732
4218
|
}
|
|
2733
4219
|
};
|
|
2734
4220
|
}
|
|
4221
|
+
if (expression.type === "call") {
|
|
4222
|
+
const call = expression;
|
|
4223
|
+
return {
|
|
4224
|
+
type: "call",
|
|
4225
|
+
call: call.call,
|
|
4226
|
+
expression: Expression.toJson(call.expression),
|
|
4227
|
+
arguments: call.arguments.map(Expression.toJson)
|
|
4228
|
+
};
|
|
4229
|
+
}
|
|
2735
4230
|
if (expression.type === "property") {
|
|
2736
4231
|
const property = expression;
|
|
2737
4232
|
return {
|
|
2738
|
-
|
|
4233
|
+
type: "property",
|
|
2739
4234
|
// The dotted path, which is exactly the key `getProperty` is looking up
|
|
2740
|
-
path: property.property.id
|
|
2741
|
-
transformer: property.transformer,
|
|
2742
|
-
locale: property.locale
|
|
4235
|
+
path: property.property.id
|
|
2743
4236
|
};
|
|
2744
4237
|
}
|
|
2745
4238
|
if (expression.type === "value") {
|
|
2746
4239
|
const value = expression;
|
|
2747
4240
|
return {
|
|
2748
|
-
|
|
2749
|
-
value: valueToJson(value.value)
|
|
2750
|
-
|
|
2751
|
-
|
|
4241
|
+
type: "value",
|
|
4242
|
+
value: valueToJson(value.value)
|
|
4243
|
+
};
|
|
4244
|
+
}
|
|
4245
|
+
if (expression.type === "empty") {
|
|
4246
|
+
return {
|
|
4247
|
+
type: "empty"
|
|
2752
4248
|
};
|
|
2753
4249
|
}
|
|
2754
|
-
|
|
2755
|
-
|
|
4250
|
+
const reason = expression.reason;
|
|
4251
|
+
return reason == null ? {
|
|
4252
|
+
type: "not-parsable"
|
|
2756
4253
|
} : {
|
|
2757
|
-
|
|
4254
|
+
type: "not-parsable",
|
|
4255
|
+
reason
|
|
2758
4256
|
};
|
|
2759
4257
|
}
|
|
2760
4258
|
/**
|
|
@@ -2770,14 +4268,14 @@ const valueFromJson = (value)=>{
|
|
|
2770
4268
|
* failure here worse than an error.
|
|
2771
4269
|
*/ static fromJson(json, schema) {
|
|
2772
4270
|
const child = (node)=>node == null ? undefined : Expression.fromJson(node, schema);
|
|
2773
|
-
if (json.
|
|
4271
|
+
if (json.type === "operator") {
|
|
2774
4272
|
return new OperatorExpression({
|
|
2775
4273
|
operator: json.operator,
|
|
2776
4274
|
left: child(json.left),
|
|
2777
4275
|
right: child(json.right)
|
|
2778
4276
|
});
|
|
2779
4277
|
}
|
|
2780
|
-
if (json.
|
|
4278
|
+
if (json.type === "comparator") {
|
|
2781
4279
|
return new ComparatorExpression({
|
|
2782
4280
|
comparator: json.comparator,
|
|
2783
4281
|
negated: json.negated,
|
|
@@ -2786,27 +4284,34 @@ const valueFromJson = (value)=>{
|
|
|
2786
4284
|
right: child(json.right)
|
|
2787
4285
|
});
|
|
2788
4286
|
}
|
|
2789
|
-
if (json.
|
|
4287
|
+
if (json.type === "call") {
|
|
4288
|
+
if (json.expression == null) {
|
|
4289
|
+
throw new Error(`Cannot deserialize a filter: a '${json.call}' call carries no operand. ` + `Collection: ${schema.collectionName}.`);
|
|
4290
|
+
}
|
|
4291
|
+
return new CallExpression({
|
|
4292
|
+
call: json.call,
|
|
4293
|
+
expression: Expression.fromJson(json.expression, schema),
|
|
4294
|
+
arguments: (json.arguments ?? []).map((argument)=>Expression.fromJson(argument, schema))
|
|
4295
|
+
});
|
|
4296
|
+
}
|
|
4297
|
+
if (json.type === "property") {
|
|
2790
4298
|
const property = schema.getProperty(json.path);
|
|
2791
4299
|
if (property == null) {
|
|
2792
4300
|
throw new Error(`Cannot deserialize a filter: this schema does not declare the property it names. ` + `Property: ${json.path}, Collection: ${schema.collectionName}. ` + `The two sides disagree about the shape of the data, so the filter cannot be applied.`);
|
|
2793
4301
|
}
|
|
2794
|
-
|
|
4302
|
+
return new PropertyExpression({
|
|
2795
4303
|
property
|
|
2796
4304
|
});
|
|
2797
|
-
rebuilt.transformer = json.transformer;
|
|
2798
|
-
rebuilt.locale = json.locale;
|
|
2799
|
-
return rebuilt;
|
|
2800
4305
|
}
|
|
2801
|
-
if (json.
|
|
2802
|
-
|
|
4306
|
+
if (json.type === "value") {
|
|
4307
|
+
return new ValueExpression({
|
|
2803
4308
|
value: valueFromJson(json.value)
|
|
2804
4309
|
});
|
|
2805
|
-
rebuilt.transformer = json.transformer;
|
|
2806
|
-
rebuilt.locale = json.locale;
|
|
2807
|
-
return rebuilt;
|
|
2808
4310
|
}
|
|
2809
|
-
|
|
4311
|
+
if (json.type === "empty") {
|
|
4312
|
+
return Expression.EMPTY;
|
|
4313
|
+
}
|
|
4314
|
+
return json.reason == null ? Expression.NOT_PARSABLE : Expression.notParsable(json.reason);
|
|
2810
4315
|
}
|
|
2811
4316
|
}
|
|
2812
4317
|
class EmptyExpression extends Expression {
|
|
@@ -2814,6 +4319,11 @@ class EmptyExpression extends Expression {
|
|
|
2814
4319
|
}
|
|
2815
4320
|
class NotParsableExpression extends Expression {
|
|
2816
4321
|
type = "not-parsable";
|
|
4322
|
+
/** What the parser refused, when it knows. `.explain()` prints it beside the source. */ reason;
|
|
4323
|
+
constructor(reason){
|
|
4324
|
+
super();
|
|
4325
|
+
this.reason = reason;
|
|
4326
|
+
}
|
|
2817
4327
|
}
|
|
2818
4328
|
/**
|
|
2819
4329
|
* A class representing a comparison operation (e.g., equals, greater-than).
|
|
@@ -2844,20 +4354,28 @@ class NotParsableExpression extends Expression {
|
|
|
2844
4354
|
*/ class PropertyExpression extends Expression {
|
|
2845
4355
|
/** The type of the expression (always 'property'). */ type = "property";
|
|
2846
4356
|
/** The property info for the path. */ property;
|
|
2847
|
-
transformer = null;
|
|
2848
|
-
locale = null;
|
|
2849
4357
|
constructor(options){
|
|
2850
4358
|
super();
|
|
2851
4359
|
this.property = options.property;
|
|
2852
4360
|
}
|
|
2853
4361
|
}
|
|
4362
|
+
class CallExpression extends Expression {
|
|
4363
|
+
type = "call";
|
|
4364
|
+
call;
|
|
4365
|
+
expression;
|
|
4366
|
+
/** Empty for a unary call. */ arguments;
|
|
4367
|
+
constructor(options){
|
|
4368
|
+
super();
|
|
4369
|
+
this.call = options.call;
|
|
4370
|
+
this.expression = options.expression;
|
|
4371
|
+
this.arguments = options.arguments ?? [];
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
2854
4374
|
/**
|
|
2855
4375
|
* A class representing a literal value.
|
|
2856
4376
|
*/ class ValueExpression extends Expression {
|
|
2857
4377
|
/** The type of the expression (always 'value'). */ type = "value";
|
|
2858
4378
|
/** The literal value. */ value;
|
|
2859
|
-
transformer = null;
|
|
2860
|
-
locale = null;
|
|
2861
4379
|
constructor(options){
|
|
2862
4380
|
super();
|
|
2863
4381
|
this.value = options.value;
|
|
@@ -2868,9 +4386,45 @@ class NotParsableExpression extends Expression {
|
|
|
2868
4386
|
},
|
|
2869
4387
|
63(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
2870
4388
|
__webpack_require__.d(__webpack_exports__, {
|
|
2871
|
-
|
|
2872
|
-
|
|
4389
|
+
CC: () => (peelCalls),
|
|
4390
|
+
LU: () => (childrenOf),
|
|
4391
|
+
jJ: () => (forEach),
|
|
4392
|
+
oY: () => (getProperties)
|
|
2873
4393
|
});
|
|
4394
|
+
/**
|
|
4395
|
+
* Separates an operand from the calls applied to it.
|
|
4396
|
+
*
|
|
4397
|
+
* `null` when there is no operand beneath the calls. Every consumer needs this to decide whether a
|
|
4398
|
+
* comparator side is a property or a value, so it lives here rather than in each translator.
|
|
4399
|
+
*/ function peelCalls(expression) {
|
|
4400
|
+
const calls = [];
|
|
4401
|
+
let current = expression;
|
|
4402
|
+
while(current != null && current.type === "call"){
|
|
4403
|
+
calls.unshift(current);
|
|
4404
|
+
current = current.expression;
|
|
4405
|
+
}
|
|
4406
|
+
return current == null ? null : {
|
|
4407
|
+
operand: current,
|
|
4408
|
+
calls
|
|
4409
|
+
};
|
|
4410
|
+
}
|
|
4411
|
+
function childrenOf(expression) {
|
|
4412
|
+
if (expression.type === "call") {
|
|
4413
|
+
const call = expression;
|
|
4414
|
+
return [
|
|
4415
|
+
call.expression,
|
|
4416
|
+
...call.arguments ?? []
|
|
4417
|
+
].filter((child)=>child != null);
|
|
4418
|
+
}
|
|
4419
|
+
const children = [];
|
|
4420
|
+
if (expression.left != null) {
|
|
4421
|
+
children.push(expression.left);
|
|
4422
|
+
}
|
|
4423
|
+
if (expression.right != null) {
|
|
4424
|
+
children.push(expression.right);
|
|
4425
|
+
}
|
|
4426
|
+
return children;
|
|
4427
|
+
}
|
|
2874
4428
|
/**
|
|
2875
4429
|
* Extracts all properties referenced in an expression
|
|
2876
4430
|
* @param expression The expression to analyze
|
|
@@ -2882,12 +4436,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
2882
4436
|
if (expr.type === "property") {
|
|
2883
4437
|
properties.push(expr.property);
|
|
2884
4438
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
traverse(expr.left);
|
|
2888
|
-
}
|
|
2889
|
-
if (expr.right) {
|
|
2890
|
-
traverse(expr.right);
|
|
4439
|
+
for (const child of childrenOf(expr)){
|
|
4440
|
+
traverse(child);
|
|
2891
4441
|
}
|
|
2892
4442
|
}
|
|
2893
4443
|
traverse(expression);
|
|
@@ -2900,14 +4450,8 @@ function forEach(expression, callback) {
|
|
|
2900
4450
|
if (!callback(expr)) {
|
|
2901
4451
|
return false;
|
|
2902
4452
|
}
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
if (!traverse(expr.left)) {
|
|
2906
|
-
return false;
|
|
2907
|
-
}
|
|
2908
|
-
}
|
|
2909
|
-
if (expr.right) {
|
|
2910
|
-
if (!traverse(expr.right)) {
|
|
4453
|
+
for (const child of childrenOf(expr)){
|
|
4454
|
+
if (!traverse(child)) {
|
|
2911
4455
|
return false;
|
|
2912
4456
|
}
|
|
2913
4457
|
}
|
|
@@ -3255,7 +4799,7 @@ var TrampolinePipeline = __webpack_require__(416);
|
|
|
3255
4799
|
|
|
3256
4800
|
|
|
3257
4801
|
},
|
|
3258
|
-
|
|
4802
|
+
640(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
3259
4803
|
|
|
3260
4804
|
// EXPORTS
|
|
3261
4805
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -3266,34 +4810,44 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3266
4810
|
_b: () => (/* reexport */ DEFAULT_SEMI_JOIN_KEY_THRESHOLD),
|
|
3267
4811
|
pt: () => (/* reexport */ types_QueryOrdering),
|
|
3268
4812
|
Ib: () => (/* reexport */ TranslatedSingleValue),
|
|
4813
|
+
fp: () => (/* reexport */ describeFilterAsJs),
|
|
3269
4814
|
RK: () => (/* reexport */ distinctJoinKeys),
|
|
3270
4815
|
Bg: () => (/* reexport */ hashJoin),
|
|
4816
|
+
_1: () => (/* reexport */ mappedResultColumns),
|
|
3271
4817
|
iG: () => (/* reexport */ nearestBy),
|
|
3272
4818
|
qy: () => (/* reexport */ readJoinKey),
|
|
3273
4819
|
yR: () => (/* reexport */ serializePersistResult),
|
|
3274
4820
|
y4: () => (/* reexport */ CacheDbPlugin),
|
|
3275
4821
|
lO: () => (/* reexport */ cosineDistance),
|
|
4822
|
+
QC: () => (/* reexport */ DATABASE_EXECUTION_EXPLANATIONS),
|
|
3276
4823
|
d0: () => (/* reexport */ JsonTranslator),
|
|
4824
|
+
Wi: () => (/* reexport */ parameter),
|
|
3277
4825
|
PP: () => (/* reexport */ splitSendableOptions),
|
|
3278
4826
|
f2: () => (/* reexport */ TranslatedGroupValue),
|
|
3279
4827
|
wN: () => (/* reexport */ collectingSink),
|
|
3280
4828
|
QB: () => (/* reexport */ RetryDbPlugin),
|
|
3281
4829
|
m6: () => (/* reexport */ executeJoin),
|
|
4830
|
+
i1: () => (/* reexport */ parameteriseDocument),
|
|
3282
4831
|
__: () => (/* reexport */ toEntityShape),
|
|
3283
4832
|
VW: () => (/* reexport */ applyInnerOptions),
|
|
4833
|
+
B2: () => (/* reexport */ describeUnparsableFilter),
|
|
3284
4834
|
Jd: () => (/* reexport */ EphemeralDataPlugin),
|
|
3285
4835
|
Pl: () => (/* reexport */ deserializePersistResult),
|
|
3286
4836
|
JF: () => (/* reexport */ DataTranslator),
|
|
3287
4837
|
HM: () => (/* reexport */ QueryOptionsCollection/* .QueryOptionsCollection */.H),
|
|
3288
4838
|
KB: () => (/* reexport */ createRequestHandler),
|
|
3289
|
-
|
|
4839
|
+
fN: () => (/* reexport */ executedQueriesOf),
|
|
3290
4840
|
II: () => (/* reexport */ deserializeQueryOptions),
|
|
3291
|
-
|
|
4841
|
+
vZ: () => (/* reexport */ formatExplanation),
|
|
4842
|
+
yX: () => (/* reexport */ isDatabaseStep),
|
|
3292
4843
|
as: () => (/* reexport */ loadJoinInnerSide),
|
|
4844
|
+
n: () => (/* reexport */ serializeBulkPersist),
|
|
3293
4845
|
lA: () => (/* reexport */ semiJoinFilter),
|
|
4846
|
+
oJ: () => (/* reexport */ withInnerSide),
|
|
3294
4847
|
kX: () => (/* reexport */ BatchingDbPlugin),
|
|
3295
4848
|
DF: () => (/* reexport */ SqlTranslator),
|
|
3296
4849
|
qj: () => (/* reexport */ loggerSink),
|
|
4850
|
+
To: () => (/* reexport */ describeFilters),
|
|
3297
4851
|
gH: () => (/* reexport */ MEMORY_EXECUTION_EXPLANATIONS),
|
|
3298
4852
|
BL: () => (/* reexport */ serializeQueryOptions),
|
|
3299
4853
|
Kg: () => (/* reexport */ withExecutedQueries),
|
|
@@ -3304,6 +4858,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3304
4858
|
jE: () => (/* reexport */ EXECUTED_QUERIES_UNSUPPORTED)
|
|
3305
4859
|
});
|
|
3306
4860
|
|
|
4861
|
+
;// CONCATENATED MODULE: ./src/plugins/resultShape.ts
|
|
4862
|
+
/**
|
|
4863
|
+
* The columns a `map` projection selects.
|
|
4864
|
+
*
|
|
4865
|
+
* Named by `sourceName`, which is what the statement actually emits; the rename to
|
|
4866
|
+
* `destinationName` happens in the translator, after the rows come back. A field with no
|
|
4867
|
+
* `property` is an expression.
|
|
4868
|
+
*/ const mappedResultColumns = (fields)=>fields.map((field)=>({
|
|
4869
|
+
name: field.sourceName,
|
|
4870
|
+
property: field.property ?? null
|
|
4871
|
+
}));
|
|
4872
|
+
|
|
3307
4873
|
;// CONCATENATED MODULE: ./src/plugins/translators/TranslatedArrayValue.ts
|
|
3308
4874
|
class TranslatedArrayValue {
|
|
3309
4875
|
value;
|
|
@@ -3398,6 +4964,10 @@ class DataTranslator {
|
|
|
3398
4964
|
translate(data) {
|
|
3399
4965
|
const isTransformed = this.query.options.hasTransformations();
|
|
3400
4966
|
this.query.options.forEach((item)=>{
|
|
4967
|
+
// The plugin reported it could not run this one, so the memory pass owns it now.
|
|
4968
|
+
if (item.target === "database" && item.reason !== "executed") {
|
|
4969
|
+
return;
|
|
4970
|
+
}
|
|
3401
4971
|
data = this.functionMap[item.name](data, item);
|
|
3402
4972
|
});
|
|
3403
4973
|
if (Array.isArray(data)) {
|
|
@@ -3810,7 +5380,7 @@ class Query {
|
|
|
3810
5380
|
* Only a plugin that runs its outer query FIRST can supply these, and most run this loader
|
|
3811
5381
|
* before anything else — so it is optional, and its absence costs a wider inner read rather
|
|
3812
5382
|
* than a wrong one.
|
|
3813
|
-
*/ outerKeys)=>{
|
|
5383
|
+
*/ outerKeys, /** Where the inner read reports what it executed. Defaults to the outer read's own list. */ innerExecutedQueries)=>{
|
|
3814
5384
|
const joinOption = event.operation.options.getLast("join");
|
|
3815
5385
|
if (joinOption == null) {
|
|
3816
5386
|
done({
|
|
@@ -3838,9 +5408,10 @@ class Query {
|
|
|
3838
5408
|
action: "query",
|
|
3839
5409
|
reason: "join inner side",
|
|
3840
5410
|
explain: event.explain,
|
|
3841
|
-
// The
|
|
3842
|
-
//
|
|
3843
|
-
|
|
5411
|
+
// The caller decides where the inner read reports, because only it knows whether the inner
|
|
5412
|
+
// side is the SAME plugin — where both reads belong in one explanation — or a different one,
|
|
5413
|
+
// where a PouchDB scan filed under SqliteDbPlugin is a lie.
|
|
5414
|
+
executedQueries: innerExecutedQueries ?? event.executedQueries
|
|
3844
5415
|
};
|
|
3845
5416
|
query(innerEvent, (result)=>{
|
|
3846
5417
|
if (result.ok === Result/* .PluginEventResult.ERROR */.D.ERROR) {
|
|
@@ -3917,6 +5488,12 @@ class Query {
|
|
|
3917
5488
|
return;
|
|
3918
5489
|
}
|
|
3919
5490
|
const outerRows = outerResult.data.value ?? [];
|
|
5491
|
+
if (at.reason !== "executed") {
|
|
5492
|
+
// The outer read reported something, so the database phase stopped before the join.
|
|
5493
|
+
// The datastore's own join branch pairs these rows.
|
|
5494
|
+
done(Result/* .PluginEventResult.success */.D.success(event.id, new TranslatedArrayValue(outerRows, false)));
|
|
5495
|
+
return;
|
|
5496
|
+
}
|
|
3920
5497
|
// Storage shape: the plugin returns rows as it holds them, and deserialization is what
|
|
3921
5498
|
// `executeJoin` does per side below.
|
|
3922
5499
|
const outerKeys = distinctJoinKeys(outerRows, at.value.outerKey, at.value.semiJoinKeyThreshold, {
|
|
@@ -4032,9 +5609,7 @@ class JsonTranslator extends DataTranslator {
|
|
|
4032
5609
|
if (field.property != null) {
|
|
4033
5610
|
const value = field.property.getValue(data[i]);
|
|
4034
5611
|
if (value != null) {
|
|
4035
|
-
|
|
4036
|
-
const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
|
|
4037
|
-
field.property.setValue(data[i], resolvedValue);
|
|
5612
|
+
field.property.setValue(data[i], field.property.deserialize(value));
|
|
4038
5613
|
}
|
|
4039
5614
|
}
|
|
4040
5615
|
}
|
|
@@ -4058,9 +5633,7 @@ class JsonTranslator extends DataTranslator {
|
|
|
4058
5633
|
if (field.property != null) {
|
|
4059
5634
|
const value = field.property.getValue(data[i]);
|
|
4060
5635
|
if (value != null) {
|
|
4061
|
-
|
|
4062
|
-
const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;
|
|
4063
|
-
field.property.setValue(item, resolvedValue);
|
|
5636
|
+
field.property.setValue(item, field.property.deserialize(value));
|
|
4064
5637
|
continue;
|
|
4065
5638
|
}
|
|
4066
5639
|
// The property exists, lets set it to the value (null/undefined)
|
|
@@ -4401,9 +5974,12 @@ class SqlTranslator extends DataTranslator {
|
|
|
4401
5974
|
for(let j = 0, l = option.value.fields.length; j < l; j++){
|
|
4402
5975
|
const field = option.value.fields[j];
|
|
4403
5976
|
if (field.property != null) {
|
|
4404
|
-
const
|
|
5977
|
+
const row = data[i];
|
|
5978
|
+
// A nested field arrives FLAT, under the alias the statement emitted, because
|
|
5979
|
+
// the value was read out of a JSON column. `setValue` puts it back on its path.
|
|
5980
|
+
const value = Object.prototype.hasOwnProperty.call(row, field.sourceName) ? row[field.sourceName] : field.property.getValue(row);
|
|
4405
5981
|
if (value != null) {
|
|
4406
|
-
field.property.setValue(
|
|
5982
|
+
field.property.setValue(row, field.property.deserialize(value));
|
|
4407
5983
|
}
|
|
4408
5984
|
}
|
|
4409
5985
|
}
|
|
@@ -4540,6 +6116,183 @@ class SqlTranslator extends DataTranslator {
|
|
|
4540
6116
|
|
|
4541
6117
|
|
|
4542
6118
|
|
|
6119
|
+
// EXTERNAL MODULE: ./src/expressions/callSource.ts
|
|
6120
|
+
var callSource = __webpack_require__(429);
|
|
6121
|
+
;// CONCATENATED MODULE: ./src/plugins/query/describeFilter.ts
|
|
6122
|
+
|
|
6123
|
+
|
|
6124
|
+
const COMPARATOR_OPERATORS = {
|
|
6125
|
+
"equals": "===",
|
|
6126
|
+
"greater-than": ">",
|
|
6127
|
+
"greater-than-equals": ">=",
|
|
6128
|
+
"less-than": "<",
|
|
6129
|
+
"less-than-equals": "<="
|
|
6130
|
+
};
|
|
6131
|
+
/** The three comparators that read as a method call rather than an operator. */ const COMPARATOR_METHODS = {
|
|
6132
|
+
"starts-with": "startsWith",
|
|
6133
|
+
"includes": "includes",
|
|
6134
|
+
"ends-with": "endsWith"
|
|
6135
|
+
};
|
|
6136
|
+
const renderProperty = (property)=>property.property.getPathArray().join(".");
|
|
6137
|
+
/**
|
|
6138
|
+
* The predicate as JavaScript, with every value replaced by `?`.
|
|
6139
|
+
*
|
|
6140
|
+
* Rendered from the parsed tree rather than from the function's source. The tree is what the
|
|
6141
|
+
* backend was actually given, so this cannot drift from what ran; and a value reaching the tree
|
|
6142
|
+
* as a literal is indistinguishable from one arriving through a params object, which is what
|
|
6143
|
+
* makes both come out as `?` the way SQL treats them.
|
|
6144
|
+
*/ const describeFilterAsJs = (expression)=>{
|
|
6145
|
+
const parameters = [];
|
|
6146
|
+
const hold = (value)=>{
|
|
6147
|
+
parameters.push(value);
|
|
6148
|
+
return "?";
|
|
6149
|
+
};
|
|
6150
|
+
const side = (part)=>{
|
|
6151
|
+
if (part == null) {
|
|
6152
|
+
return "?";
|
|
6153
|
+
}
|
|
6154
|
+
if ((0,assertions/* .isPropertyExpression */.e3)(part)) {
|
|
6155
|
+
return renderProperty(part);
|
|
6156
|
+
}
|
|
6157
|
+
if ((0,assertions/* .isValueExpression */.S6)(part)) {
|
|
6158
|
+
return hold(part.value);
|
|
6159
|
+
}
|
|
6160
|
+
if ((0,assertions/* .isCallExpression */.fm)(part)) {
|
|
6161
|
+
return (0,callSource/* .renderCallAsJs */.a)(part.call, ()=>side(part.expression), ()=>part.arguments.map(side));
|
|
6162
|
+
}
|
|
6163
|
+
return walk(part);
|
|
6164
|
+
};
|
|
6165
|
+
const walk = (current)=>{
|
|
6166
|
+
if ((0,assertions/* .isOperatorExpression */.vg)(current)) {
|
|
6167
|
+
const operator = current.operator === "&&" ? "&&" : "||";
|
|
6168
|
+
return `(${side(current.left)} ${operator} ${side(current.right)})`;
|
|
6169
|
+
}
|
|
6170
|
+
if ((0,assertions/* .isComparatorExpression */.xH)(current)) {
|
|
6171
|
+
const method = COMPARATOR_METHODS[current.comparator];
|
|
6172
|
+
// Evaluated LEFT then RIGHT, always: the parameter order has to match the reading
|
|
6173
|
+
// order of the text, or the values line up against the wrong placeholders.
|
|
6174
|
+
const left = side(current.left);
|
|
6175
|
+
const right = side(current.right);
|
|
6176
|
+
if (method != null) {
|
|
6177
|
+
const call = `${left}.${method}(${right})`;
|
|
6178
|
+
return current.negated ? `${call} === false` : call;
|
|
6179
|
+
}
|
|
6180
|
+
const symbol = COMPARATOR_OPERATORS[current.comparator];
|
|
6181
|
+
if (symbol == null) {
|
|
6182
|
+
return `${left} ${current.comparator} ${right}`;
|
|
6183
|
+
}
|
|
6184
|
+
return `${left} ${current.negated ? negate(symbol) : symbol} ${right}`;
|
|
6185
|
+
}
|
|
6186
|
+
if ((0,assertions/* .isCallExpression */.fm)(current)) {
|
|
6187
|
+
return (0,callSource/* .renderCallAsJs */.a)(current.call, ()=>side(current.expression), ()=>current.arguments.map(side));
|
|
6188
|
+
}
|
|
6189
|
+
if (current.type === "empty") {
|
|
6190
|
+
return "(no filter)";
|
|
6191
|
+
}
|
|
6192
|
+
return current.type === "not-parsable" ? "(not parsable)" : `(unsupported: ${current.type})`;
|
|
6193
|
+
};
|
|
6194
|
+
return {
|
|
6195
|
+
text: walk(expression),
|
|
6196
|
+
parameters
|
|
6197
|
+
};
|
|
6198
|
+
};
|
|
6199
|
+
const negate = (symbol)=>{
|
|
6200
|
+
switch(symbol){
|
|
6201
|
+
case "===":
|
|
6202
|
+
return "!==";
|
|
6203
|
+
case ">":
|
|
6204
|
+
return "<=";
|
|
6205
|
+
case ">=":
|
|
6206
|
+
return "<";
|
|
6207
|
+
case "<":
|
|
6208
|
+
return ">=";
|
|
6209
|
+
case "<=":
|
|
6210
|
+
return ">";
|
|
6211
|
+
default:
|
|
6212
|
+
return `!${symbol}`;
|
|
6213
|
+
}
|
|
6214
|
+
};
|
|
6215
|
+
/**
|
|
6216
|
+
* Marks a value inside a query document so it is replaced by `?` rather than printed.
|
|
6217
|
+
*
|
|
6218
|
+
* A document language carries its values inline, so there is nothing in the shape itself to say
|
|
6219
|
+
* which parts are operators and which are data. A dialect wraps the data as it builds the
|
|
6220
|
+
* document, and `parameteriseDocument` reads the wrapper.
|
|
6221
|
+
*/ const PARAMETER = Symbol("routier.parameter");
|
|
6222
|
+
const parameter = (value)=>({
|
|
6223
|
+
[PARAMETER]: value
|
|
6224
|
+
});
|
|
6225
|
+
const isParameter = (value)=>typeof value === "object" && value !== null && PARAMETER in value;
|
|
6226
|
+
/**
|
|
6227
|
+
* Renders a query DOCUMENT with its values replaced by `?`.
|
|
6228
|
+
*
|
|
6229
|
+
* Language-agnostic on purpose: an MQL filter and a Mango selector are both plain objects, and so
|
|
6230
|
+
* is whatever a future document store wants reported. The dialect decides the shape; this only
|
|
6231
|
+
* decides how it is written down.
|
|
6232
|
+
*
|
|
6233
|
+
* A value not wrapped by `parameter` is structural — an operator name, a field path, a nesting
|
|
6234
|
+
* level — and is printed as it is. That is the whole distinction, and it has to be made where the
|
|
6235
|
+
* document is built, because by the time it is an object the two are the same kind of thing.
|
|
6236
|
+
*/ const parameteriseDocument = (document)=>{
|
|
6237
|
+
const parameters = [];
|
|
6238
|
+
const render = (value)=>{
|
|
6239
|
+
if (isParameter(value)) {
|
|
6240
|
+
parameters.push(value[PARAMETER]);
|
|
6241
|
+
return "?";
|
|
6242
|
+
}
|
|
6243
|
+
if (Array.isArray(value)) {
|
|
6244
|
+
return `[${value.map(render).join(", ")}]`;
|
|
6245
|
+
}
|
|
6246
|
+
if (typeof value === "object" && value !== null) {
|
|
6247
|
+
const entries = Object.entries(value).map(([key, nested])=>`${JSON.stringify(key)}: ${render(nested)}`);
|
|
6248
|
+
return `{ ${entries.join(", ")} }`;
|
|
6249
|
+
}
|
|
6250
|
+
return JSON.stringify(value) ?? String(value);
|
|
6251
|
+
};
|
|
6252
|
+
return {
|
|
6253
|
+
text: render(document),
|
|
6254
|
+
parameters
|
|
6255
|
+
};
|
|
6256
|
+
};
|
|
6257
|
+
/**
|
|
6258
|
+
* Every filter on a query, as one description.
|
|
6259
|
+
*
|
|
6260
|
+
* Filters accumulate — `.where(a).where(b)` is `a && b` — so they are reported as one predicate
|
|
6261
|
+
* rather than several, which is how the caller thinks of them and how a SQL plugin renders them
|
|
6262
|
+
* into one `WHERE`. Parameters run left to right across the whole thing, matching the text.
|
|
6263
|
+
*
|
|
6264
|
+
* A filter that could not be parsed falls back to its source. Mixing the two is deliberate: one
|
|
6265
|
+
* unparsable filter does not make the others unreadable, and seeing which one it was is the
|
|
6266
|
+
* point.
|
|
6267
|
+
*/ const describeFilters = (filters)=>{
|
|
6268
|
+
const parameters = [];
|
|
6269
|
+
const parts = filters.map((entry)=>{
|
|
6270
|
+
const described = entry.expression?.type === "not-parsable" ? describeUnparsableFilter(entry.filter, entry.expression.reason) : describeFilterAsJs(entry.expression);
|
|
6271
|
+
parameters.push(...described.parameters);
|
|
6272
|
+
return described.text;
|
|
6273
|
+
});
|
|
6274
|
+
if (parts.length === 0) {
|
|
6275
|
+
return {
|
|
6276
|
+
text: "(no filter)",
|
|
6277
|
+
parameters: []
|
|
6278
|
+
};
|
|
6279
|
+
}
|
|
6280
|
+
return {
|
|
6281
|
+
text: parts.length === 1 ? parts[0] : parts.join(" && "),
|
|
6282
|
+
parameters
|
|
6283
|
+
};
|
|
6284
|
+
};
|
|
6285
|
+
/**
|
|
6286
|
+
* A predicate core could not parse, shown as the caller wrote it.
|
|
6287
|
+
*
|
|
6288
|
+
* This is the case where the source matters most: an unparsable filter is why the query did not
|
|
6289
|
+
* push down, and the reason codes say that it happened without showing what it was. There are no
|
|
6290
|
+
* parameters — nothing was extracted, because nothing was understood.
|
|
6291
|
+
*/ const describeUnparsableFilter = (filter, reason)=>({
|
|
6292
|
+
text: typeof filter === "function" ? `${String(filter)} — ${reason ?? "could not be parsed"}, evaluated in memory` : "(not parsable)",
|
|
6293
|
+
parameters: []
|
|
6294
|
+
});
|
|
6295
|
+
|
|
4543
6296
|
;// CONCATENATED MODULE: ./src/plugins/query/explain.ts
|
|
4544
6297
|
|
|
4545
6298
|
/**
|
|
@@ -4554,12 +6307,23 @@ class SqlTranslator extends DataTranslator {
|
|
|
4554
6307
|
"map-rename": "A map renames or drops properties, so every option after it refers to names the database does not have.",
|
|
4555
6308
|
"after-nearest": "A similarity search orders and limits rows, and the plugin cannot report whether it performed the search, so every option after it runs in memory.",
|
|
4556
6309
|
"after-join": "A join produces [outer, inner] tuples rather than entities, and the plugin cannot report how it joined, so every option after it runs in memory.",
|
|
4557
|
-
"cross-plugin-join": "The two sides of this join live on different plugins, so neither can read the other's rows and the join runs in the datastore."
|
|
6310
|
+
"cross-plugin-join": "The two sides of this join live on different plugins, so neither can read the other's rows and the join runs in the datastore.",
|
|
6311
|
+
"after-window": "A skip or take runs before this option, and SQL applies WHERE before LIMIT, so pushing it down would window rows this option had not seen yet. It runs in memory over the windowed rows instead.",
|
|
6312
|
+
"predicate-error": "A strict comparison compares a column against a value of a type it can never equal, so the answer is the same for every row and the filter runs in memory. Check the types in the filter."
|
|
4558
6313
|
};
|
|
4559
6314
|
const EXECUTED_QUERIES_UNSUPPORTED = "This plugin did not report what it executed. It may not support explain.";
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
6315
|
+
/**
|
|
6316
|
+
* Why an option planned for the database did not run there. `executed` has no sentence: it needs no
|
|
6317
|
+
* explaining, and a step made of executed options is a database step like any other.
|
|
6318
|
+
*/ const DATABASE_EXECUTION_EXPLANATIONS = {
|
|
6319
|
+
"missing-capability": "The plugin's engine cannot express this option, so it runs in memory over the rows the plugin did return. Only the plugin can know this — an engine's capabilities are not visible from here.",
|
|
6320
|
+
"engine-divergence": "The plugin's engine would answer this option differently from JavaScript, so it runs in memory instead and the rows match what the predicate means. Nothing in the query needs changing.",
|
|
6321
|
+
"not-reached": "The database stopped at an option it could not express, so this one runs in memory too. Carrying on would apply it to rows the earlier option had not filtered."
|
|
6322
|
+
};
|
|
6323
|
+
/**
|
|
6324
|
+
* TypeScript does not narrow a union from a discriminant nested inside a property, so the two kinds
|
|
6325
|
+
* of step need a guard rather than an inline check.
|
|
6326
|
+
*/ const isDatabaseStep = (step)=>step.executedIn.kind === "database";
|
|
4563
6327
|
/**
|
|
4564
6328
|
* The reportable shape of one option's value.
|
|
4565
6329
|
*
|
|
@@ -4640,12 +6404,16 @@ const explainedOptionsOf = (options)=>{
|
|
|
4640
6404
|
options.forEach((option)=>explained.push(explainedOptionOf(option, index++)));
|
|
4641
6405
|
return explained;
|
|
4642
6406
|
};
|
|
6407
|
+
/** Every sentence, whoever decided — the summary reads the same either way. */ const EXPLANATIONS = {
|
|
6408
|
+
...MEMORY_EXECUTION_EXPLANATIONS,
|
|
6409
|
+
...DATABASE_EXECUTION_EXPLANATIONS
|
|
6410
|
+
};
|
|
4643
6411
|
const summarize = (steps)=>{
|
|
4644
6412
|
const reasons = [];
|
|
4645
6413
|
let database = 0;
|
|
4646
6414
|
let memory = 0;
|
|
4647
6415
|
for (const step of steps){
|
|
4648
|
-
if (step
|
|
6416
|
+
if (isDatabaseStep(step)) {
|
|
4649
6417
|
database += step.options.length;
|
|
4650
6418
|
continue;
|
|
4651
6419
|
}
|
|
@@ -4655,7 +6423,7 @@ const summarize = (steps)=>{
|
|
|
4655
6423
|
}
|
|
4656
6424
|
}
|
|
4657
6425
|
const counts = `${database} ${database === 1 ? "option ran" : "options ran"} in the database, ${memory} ran in memory.`;
|
|
4658
|
-
const causes = reasons.map((reason)=>
|
|
6426
|
+
const causes = reasons.map((reason)=>EXPLANATIONS[reason]).join(" ");
|
|
4659
6427
|
return {
|
|
4660
6428
|
database,
|
|
4661
6429
|
memory,
|
|
@@ -4663,50 +6431,87 @@ const summarize = (steps)=>{
|
|
|
4663
6431
|
explanation: causes.length === 0 ? counts : `${counts} ${causes}`
|
|
4664
6432
|
};
|
|
4665
6433
|
};
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
6434
|
+
const outcomeOf = (option)=>{
|
|
6435
|
+
if (option.target === "memory") {
|
|
6436
|
+
return {
|
|
6437
|
+
executedIn: "memory",
|
|
6438
|
+
reason: option.reason,
|
|
6439
|
+
explanation: MEMORY_EXECUTION_EXPLANATIONS[option.reason]
|
|
6440
|
+
};
|
|
6441
|
+
}
|
|
6442
|
+
if (option.reason === "executed") {
|
|
6443
|
+
return {
|
|
6444
|
+
executedIn: "database",
|
|
6445
|
+
reason: null,
|
|
6446
|
+
explanation: null
|
|
6447
|
+
};
|
|
6448
|
+
}
|
|
6449
|
+
return {
|
|
6450
|
+
executedIn: "memory",
|
|
6451
|
+
reason: option.reason,
|
|
6452
|
+
explanation: DATABASE_EXECUTION_EXPLANATIONS[option.reason]
|
|
6453
|
+
};
|
|
6454
|
+
};
|
|
6455
|
+
/** Whether an option belongs to the step already open, or starts a new one. */ const continuesStep = (current, outcome)=>{
|
|
6456
|
+
if (current == null) {
|
|
6457
|
+
return false;
|
|
6458
|
+
}
|
|
6459
|
+
if (current.executedIn.kind === "database") {
|
|
6460
|
+
return outcome.reason == null;
|
|
6461
|
+
}
|
|
6462
|
+
// `?? null` because a step with no reason omits the key, and `undefined === null` is false —
|
|
6463
|
+
// without it every option started a step of its own
|
|
6464
|
+
return outcome.reason != null && (current.reason ?? null) === outcome.reason;
|
|
6465
|
+
};
|
|
6466
|
+
const toExecutionSteps = (options, ranIn)=>{
|
|
4678
6467
|
const steps = [];
|
|
4679
6468
|
let index = 0;
|
|
4680
6469
|
options.forEach((option)=>{
|
|
4681
6470
|
const explained = explainedOptionOf(option, index++);
|
|
4682
6471
|
const current = steps[steps.length - 1];
|
|
4683
|
-
|
|
6472
|
+
const outcome = outcomeOf(option);
|
|
6473
|
+
// Grouped by outcome, not by target: an option the database could not express and one core
|
|
6474
|
+
// sent to memory both run in memory, for different reasons a reader needs told apart.
|
|
6475
|
+
if (continuesStep(current, outcome) === true) {
|
|
4684
6476
|
current.options.push(explained);
|
|
4685
6477
|
return;
|
|
4686
6478
|
}
|
|
4687
|
-
steps.push({
|
|
4688
|
-
step:
|
|
6479
|
+
steps.push(outcome.reason == null ? {
|
|
6480
|
+
step: 0,
|
|
4689
6481
|
of: 0,
|
|
4690
|
-
executedIn:
|
|
4691
|
-
description: option.target === "database" ? DATABASE_STEP_DESCRIPTION : MEMORY_STEP_DESCRIPTION,
|
|
6482
|
+
executedIn: ranIn,
|
|
4692
6483
|
options: [
|
|
4693
6484
|
explained
|
|
4694
6485
|
],
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
6486
|
+
executedQueries: []
|
|
6487
|
+
} : {
|
|
6488
|
+
step: 0,
|
|
6489
|
+
of: 0,
|
|
6490
|
+
executedIn: {
|
|
6491
|
+
kind: "memory"
|
|
6492
|
+
},
|
|
6493
|
+
options: [
|
|
6494
|
+
explained
|
|
6495
|
+
],
|
|
6496
|
+
reason: outcome.reason,
|
|
6497
|
+
explanation: outcome.explanation ?? undefined
|
|
4699
6498
|
});
|
|
4700
6499
|
});
|
|
4701
|
-
|
|
6500
|
+
// A database step even when nothing pushed down: the plugin is dispatched either way, so
|
|
6501
|
+
// reporting "0 in the database" while the backend reads the whole table is the opposite of
|
|
6502
|
+
// the truth.
|
|
6503
|
+
if (steps[0]?.executedIn.kind !== "database") {
|
|
4702
6504
|
steps.unshift({
|
|
4703
6505
|
step: 0,
|
|
4704
6506
|
of: 0,
|
|
4705
|
-
executedIn:
|
|
4706
|
-
|
|
4707
|
-
|
|
6507
|
+
executedIn: ranIn,
|
|
6508
|
+
options: [],
|
|
6509
|
+
executedQueries: []
|
|
4708
6510
|
});
|
|
4709
6511
|
}
|
|
6512
|
+
return steps;
|
|
6513
|
+
};
|
|
6514
|
+
/** Numbers a finished list, so `step 1 of 3` reads as the shape of the whole query. */ const numbered = (steps)=>{
|
|
4710
6515
|
for(let i = 0; i < steps.length; i++){
|
|
4711
6516
|
steps[i].step = i + 1;
|
|
4712
6517
|
steps[i].of = steps.length;
|
|
@@ -4721,10 +6526,11 @@ const summarize = (steps)=>{
|
|
|
4721
6526
|
* post-join filter alone in the memory half derives back to `"database"`, and the document
|
|
4722
6527
|
* would report memory work as having run in the database.
|
|
4723
6528
|
*/ const explainQuery = (options, context)=>{
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
6529
|
+
const executionSteps = numbered(toExecutionSteps(options, {
|
|
6530
|
+
kind: "database",
|
|
6531
|
+
database: context.database,
|
|
6532
|
+
plugin: context.pluginKind
|
|
6533
|
+
}));
|
|
4728
6534
|
return {
|
|
4729
6535
|
collection: context.collection,
|
|
4730
6536
|
database: context.database,
|
|
@@ -4751,7 +6557,7 @@ const summarize = (steps)=>{
|
|
|
4751
6557
|
// Only the first database step: a plugin reports what IT ran, and everything it ran
|
|
4752
6558
|
// was sent as one dispatch. Stamping the same statements onto a second database step
|
|
4753
6559
|
// would claim they ran twice.
|
|
4754
|
-
if (step
|
|
6560
|
+
if (isDatabaseStep(step) === false || attached === true) {
|
|
4755
6561
|
return {
|
|
4756
6562
|
...step,
|
|
4757
6563
|
options: [
|
|
@@ -4784,8 +6590,47 @@ const summarize = (steps)=>{
|
|
|
4784
6590
|
executionSteps
|
|
4785
6591
|
};
|
|
4786
6592
|
};
|
|
6593
|
+
/**
|
|
6594
|
+
* Adds the step for a cross-plugin join's inner side.
|
|
6595
|
+
*
|
|
6596
|
+
* Appended by the executor rather than derived from the options, because the inner side's options
|
|
6597
|
+
* live on the join, in its own collection, and were never part of this query's chain. It goes before
|
|
6598
|
+
* the memory steps that consume it — the join cannot run until both sides are read.
|
|
6599
|
+
*/ /**
|
|
6600
|
+
* Every statement the query ran, across every database it touched, in execution order.
|
|
6601
|
+
*
|
|
6602
|
+
* A step is a place, so the statements live on the steps — this is for a caller that wants them all
|
|
6603
|
+
* without caring which plugin ran which.
|
|
6604
|
+
*/ const executedQueriesOf = (explanation)=>explanation.executionSteps.flatMap((step)=>isDatabaseStep(step) ? step.executedQueries : []);
|
|
6605
|
+
const withInnerSide = (explanation, innerSide)=>{
|
|
6606
|
+
const step = {
|
|
6607
|
+
step: 0,
|
|
6608
|
+
of: 0,
|
|
6609
|
+
executedIn: {
|
|
6610
|
+
kind: "database",
|
|
6611
|
+
database: innerSide.database,
|
|
6612
|
+
plugin: innerSide.plugin
|
|
6613
|
+
},
|
|
6614
|
+
options: [],
|
|
6615
|
+
executedQueries: innerSide.executedQueries
|
|
6616
|
+
};
|
|
6617
|
+
const firstMemory = explanation.executionSteps.findIndex((current)=>isDatabaseStep(current) === false);
|
|
6618
|
+
const at = firstMemory === -1 ? explanation.executionSteps.length : firstMemory;
|
|
6619
|
+
const executionSteps = numbered([
|
|
6620
|
+
...explanation.executionSteps.slice(0, at),
|
|
6621
|
+
step,
|
|
6622
|
+
...explanation.executionSteps.slice(at)
|
|
6623
|
+
]);
|
|
6624
|
+
return {
|
|
6625
|
+
...explanation,
|
|
6626
|
+
executionSteps,
|
|
6627
|
+
summary: summarize(executionSteps)
|
|
6628
|
+
};
|
|
6629
|
+
};
|
|
4787
6630
|
|
|
4788
6631
|
;// CONCATENATED MODULE: ./src/plugins/query/formatExplanation.ts
|
|
6632
|
+
|
|
6633
|
+
|
|
4789
6634
|
const OPTION_LABEL_WIDTH = 8;
|
|
4790
6635
|
const WRAP_WIDTH = 68;
|
|
4791
6636
|
/** Wraps `text` to `WRAP_WIDTH`, prefixing every line with `indent`. */ const wrap = (text, indent)=>{
|
|
@@ -4811,29 +6656,41 @@ const COMPARATOR_SYMBOLS = {
|
|
|
4811
6656
|
"less-than": "<",
|
|
4812
6657
|
"less-than-equals": "<="
|
|
4813
6658
|
};
|
|
4814
|
-
const describeValue = (value)=>{
|
|
4815
|
-
if (value
|
|
6659
|
+
/** Typed against the union so a new OBJECT tag is a compile error here, not an "undefined" in output. */ const describeValue = (value)=>{
|
|
6660
|
+
if (value === null) {
|
|
6661
|
+
return "null";
|
|
6662
|
+
}
|
|
6663
|
+
if (value === undefined) {
|
|
4816
6664
|
return "?";
|
|
4817
6665
|
}
|
|
4818
|
-
if (value
|
|
4819
|
-
return
|
|
6666
|
+
if (Array.isArray(value)) {
|
|
6667
|
+
return `[${value.map(describeValue).join(", ")}]`;
|
|
6668
|
+
}
|
|
6669
|
+
if (typeof value !== "object") {
|
|
6670
|
+
return typeof value === "string" ? `"${value}"` : String(value);
|
|
6671
|
+
}
|
|
6672
|
+
if ("date" in value) {
|
|
6673
|
+
return value.date;
|
|
4820
6674
|
}
|
|
4821
|
-
if (
|
|
4822
|
-
return
|
|
6675
|
+
if ("undefined" in value) {
|
|
6676
|
+
return "undefined";
|
|
4823
6677
|
}
|
|
4824
|
-
if (
|
|
4825
|
-
return
|
|
6678
|
+
if ("regex" in value) {
|
|
6679
|
+
return `/${value.regex.source}/${value.regex.flags}`;
|
|
4826
6680
|
}
|
|
4827
|
-
|
|
6681
|
+
if ("bigint" in value) {
|
|
6682
|
+
return `${value.bigint}n`;
|
|
6683
|
+
}
|
|
6684
|
+
return value.number;
|
|
4828
6685
|
};
|
|
4829
6686
|
/** Renders a serialized expression back to something close to the source predicate. */ const describeExpression = (expression)=>{
|
|
4830
6687
|
if (expression == null) {
|
|
4831
6688
|
return "?";
|
|
4832
6689
|
}
|
|
4833
|
-
if (expression.
|
|
6690
|
+
if (expression.type === "operator") {
|
|
4834
6691
|
return `${describeExpression(expression.left)} ${expression.operator} ${describeExpression(expression.right)}`;
|
|
4835
6692
|
}
|
|
4836
|
-
if (expression.
|
|
6693
|
+
if (expression.type === "comparator") {
|
|
4837
6694
|
const left = describeExpression(expression.left);
|
|
4838
6695
|
const right = describeExpression(expression.right);
|
|
4839
6696
|
const symbol = COMPARATOR_SYMBOLS[expression.comparator];
|
|
@@ -4842,13 +6699,24 @@ const describeValue = (value)=>{
|
|
|
4842
6699
|
}
|
|
4843
6700
|
return `${left} ${expression.negated === true ? "!==" : symbol} ${right}`;
|
|
4844
6701
|
}
|
|
4845
|
-
if (expression.
|
|
6702
|
+
if (expression.type === "property") {
|
|
4846
6703
|
return expression.path;
|
|
4847
6704
|
}
|
|
4848
|
-
if (expression.
|
|
6705
|
+
if (expression.type === "value") {
|
|
4849
6706
|
return describeValue(expression.value);
|
|
4850
6707
|
}
|
|
4851
|
-
|
|
6708
|
+
if (expression.type === "call") {
|
|
6709
|
+
return (0,callSource/* .renderCallAsJs */.a)(expression.call, ()=>describeExpression(expression.expression), ()=>(expression.arguments ?? []).map(describeExpression));
|
|
6710
|
+
}
|
|
6711
|
+
if (expression.type === "empty") {
|
|
6712
|
+
return "(no filter)";
|
|
6713
|
+
}
|
|
6714
|
+
// Distinguishable from "(not parsable)", which means the parser gave up and this runs in memory
|
|
6715
|
+
if (expression.type === "not-parsable") {
|
|
6716
|
+
return expression.reason == null ? "(not parsable)" : `(not parsable: ${expression.reason})`;
|
|
6717
|
+
}
|
|
6718
|
+
// Unreachable while the union is exhausted above; a payload from a newer sender is not.
|
|
6719
|
+
return `(unsupported: ${expression.type})`;
|
|
4852
6720
|
};
|
|
4853
6721
|
const describeOption = (option)=>{
|
|
4854
6722
|
const detail = option.detail;
|
|
@@ -4876,18 +6744,35 @@ const describeOption = (option)=>{
|
|
|
4876
6744
|
}
|
|
4877
6745
|
return "";
|
|
4878
6746
|
};
|
|
6747
|
+
/**
|
|
6748
|
+
* The sentence for a kind of step.
|
|
6749
|
+
*
|
|
6750
|
+
* Here rather than on the step: it is one of two constants keyed off `executedIn`, so carrying it in
|
|
6751
|
+
* the payload put prose beside the field it was derived from.
|
|
6752
|
+
*/ const DATABASE_STEP_DESCRIPTION = "These options are sent to the plugin.";
|
|
6753
|
+
const MEMORY_STEP_DESCRIPTION = "Routier runs these over the rows the database returned, after deserializing them.";
|
|
6754
|
+
const UNNARROWED_READ_DESCRIPTION = "No option could be pushed down, so the plugin reads the whole collection.";
|
|
6755
|
+
/** `database · orders.db · SqliteDbPlugin`, so a cross-plugin join says who ran what. */ const whereItRan = (step)=>isDatabaseStep(step) ? `database · ${step.executedIn.database} · ${step.executedIn.plugin}` : "memory";
|
|
4879
6756
|
const formatStep = (step, lines)=>{
|
|
4880
|
-
const reason = step.reason == null ? "" : ` [${step.reason}]`;
|
|
4881
|
-
lines.push(` STEP ${step.step} of ${step.of} — ${step
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
6757
|
+
const reason = isDatabaseStep(step) || step.reason == null ? "" : ` [${step.reason}]`;
|
|
6758
|
+
lines.push(` STEP ${step.step} of ${step.of} — ${whereItRan(step)}${reason}`);
|
|
6759
|
+
if (isDatabaseStep(step)) {
|
|
6760
|
+
lines.push(...wrap(step.options.length === 0 ? UNNARROWED_READ_DESCRIPTION : DATABASE_STEP_DESCRIPTION, " "));
|
|
6761
|
+
} else {
|
|
6762
|
+
lines.push(...wrap(MEMORY_STEP_DESCRIPTION, " "));
|
|
6763
|
+
if (step.explanation != null) {
|
|
6764
|
+
lines.push(...wrap(step.explanation, " "));
|
|
6765
|
+
}
|
|
4885
6766
|
}
|
|
4886
6767
|
lines.push("");
|
|
4887
6768
|
for (const option of step.options){
|
|
4888
6769
|
lines.push(` ${option.name.padEnd(OPTION_LABEL_WIDTH)} ${describeOption(option)}`.trimEnd());
|
|
4889
6770
|
}
|
|
4890
|
-
|
|
6771
|
+
if (isDatabaseStep(step) === false) {
|
|
6772
|
+
lines.push("");
|
|
6773
|
+
return;
|
|
6774
|
+
}
|
|
6775
|
+
for (const executed of step.executedQueries){
|
|
4891
6776
|
lines.push("");
|
|
4892
6777
|
lines.push(...executed.text.split("\n").map((line)=>` ${line}`));
|
|
4893
6778
|
if (executed.parameters != null && executed.parameters.length > 0) {
|
|
@@ -4936,8 +6821,11 @@ var types_QueryOrdering = /*#__PURE__*/ function(QueryOrdering) {
|
|
|
4936
6821
|
|
|
4937
6822
|
|
|
4938
6823
|
|
|
6824
|
+
|
|
4939
6825
|
// EXTERNAL MODULE: ./src/expressions/evaluate.ts
|
|
4940
6826
|
var evaluate = __webpack_require__(379);
|
|
6827
|
+
// EXTERNAL MODULE: ./src/expressions/fold.ts
|
|
6828
|
+
var fold = __webpack_require__(43);
|
|
4941
6829
|
;// CONCATENATED MODULE: ./src/plugins/wire/query.ts
|
|
4942
6830
|
|
|
4943
6831
|
|
|
@@ -5138,7 +7026,7 @@ const serializeQueryOptions = (options)=>{
|
|
|
5138
7026
|
}
|
|
5139
7027
|
case "filter":
|
|
5140
7028
|
{
|
|
5141
|
-
const expression = types/* .Expression.fromJson */.r4.fromJson(option.value.expression, schema);
|
|
7029
|
+
const expression = (0,fold/* .foldConstantCalls */.F5)(types/* .Expression.fromJson */.r4.fromJson(option.value.expression, schema));
|
|
5142
7030
|
options.add("filter", {
|
|
5143
7031
|
filter: (0,evaluate/* .toStrictPredicate */.wS)(expression),
|
|
5144
7032
|
expression,
|
|
@@ -5822,7 +7710,8 @@ var TrampolinePipeline = __webpack_require__(416);
|
|
|
5822
7710
|
if (!(0,assertions/* .isPropertyExpression */.e3)(left) || !(0,assertions/* .isValueExpression */.S6)(right)) {
|
|
5823
7711
|
return null;
|
|
5824
7712
|
}
|
|
5825
|
-
|
|
7713
|
+
// A called property is a CallExpression, so it fails the isPropertyExpression check above
|
|
7714
|
+
if (left.property.isKey !== true || right.value == null) {
|
|
5826
7715
|
return null;
|
|
5827
7716
|
}
|
|
5828
7717
|
return {
|
|
@@ -6195,11 +8084,17 @@ class EphemeralDataPlugin {
|
|
|
6195
8084
|
* collection to pair it with three rows.
|
|
6196
8085
|
*
|
|
6197
8086
|
* `cloned` is in storage shape, so the keys are read by resolved column name.
|
|
6198
|
-
*/
|
|
6199
|
-
|
|
6200
|
-
|
|
8087
|
+
*/ /**
|
|
8088
|
+
* No statement to quote — an ephemeral store walks its own records — so the scan
|
|
8089
|
+
* is said plainly, and the PREDICATE is reported as JavaScript beside it. A count
|
|
8090
|
+
* alone leaves a reader unable to tell a filter that matched nothing from one
|
|
8091
|
+
* that was never applied.
|
|
8092
|
+
*
|
|
8093
|
+
* Before the inner side, to match execution order.
|
|
8094
|
+
*/ const described = describeFilters(operation.options.get("filter").map((entry)=>entry.option.value));
|
|
6201
8095
|
event.executedQueries.push({
|
|
6202
|
-
text: `${operation.schema.collectionName}: scanned ${cloned.length} in-memory
|
|
8096
|
+
text: `${operation.schema.collectionName}: scanned ${cloned.length} in-memory ` + `${cloned.length === 1 ? "record" : "records"}, filter ${described.text}`,
|
|
8097
|
+
parameters: described.parameters.length > 0 ? described.parameters : undefined
|
|
6203
8098
|
});
|
|
6204
8099
|
const joinOption = operation.options.getLast("join");
|
|
6205
8100
|
const outerKeys = joinOption == null ? null : distinctJoinKeys(cloned, joinOption.value.outerKey, joinOption.value.semiJoinKeyThreshold, {
|
|
@@ -6374,6 +8269,29 @@ class TelemetryDbPlugin {
|
|
|
6374
8269
|
return JSON.stringify(option.value ?? null);
|
|
6375
8270
|
}
|
|
6376
8271
|
};
|
|
8272
|
+
/**
|
|
8273
|
+
* Restores a `Date` that `structuredClone` produced outside this realm.
|
|
8274
|
+
*
|
|
8275
|
+
* The clone is a real date and fails `instanceof Date`, which is what a caller checks. Mutated in
|
|
8276
|
+
* place because the clone is already private to this call.
|
|
8277
|
+
*/ const reviveDates = (value)=>{
|
|
8278
|
+
if (value == null || typeof value !== "object") {
|
|
8279
|
+
return value;
|
|
8280
|
+
}
|
|
8281
|
+
if (Object.prototype.toString.call(value) === "[object Date]") {
|
|
8282
|
+
return value instanceof Date ? value : new Date(value);
|
|
8283
|
+
}
|
|
8284
|
+
if (Array.isArray(value)) {
|
|
8285
|
+
for(let i = 0, length = value.length; i < length; i++){
|
|
8286
|
+
value[i] = reviveDates(value[i]);
|
|
8287
|
+
}
|
|
8288
|
+
return value;
|
|
8289
|
+
}
|
|
8290
|
+
for (const key of Object.keys(value)){
|
|
8291
|
+
value[key] = reviveDates(value[key]);
|
|
8292
|
+
}
|
|
8293
|
+
return value;
|
|
8294
|
+
};
|
|
6377
8295
|
class CacheDbPlugin {
|
|
6378
8296
|
plugin;
|
|
6379
8297
|
max;
|
|
@@ -6412,7 +8330,7 @@ class CacheDbPlugin {
|
|
|
6412
8330
|
* the next update would be written UNCHECKED with no error anywhere.
|
|
6413
8331
|
* Pinned by `datastore/src/collections/wrapperStacking.test.ts`.
|
|
6414
8332
|
*/ rebuild(entry) {
|
|
6415
|
-
return new entry.construct(structuredClone(entry.value), entry.isTransformed);
|
|
8333
|
+
return new entry.construct(reviveDates(structuredClone(entry.value)), entry.isTransformed);
|
|
6416
8334
|
}
|
|
6417
8335
|
query(event, done) {
|
|
6418
8336
|
const key = this.keyFor(event);
|
|
@@ -6435,6 +8353,14 @@ class CacheDbPlugin {
|
|
|
6435
8353
|
done(result);
|
|
6436
8354
|
return;
|
|
6437
8355
|
}
|
|
8356
|
+
// A partial answer must never be cached. When the plugin reports an option it cannot
|
|
8357
|
+
// express, these rows are what came back BEFORE the datastore finished the query — and a
|
|
8358
|
+
// later hit skips the plugin entirely, so nothing would report and the rows would be
|
|
8359
|
+
// returned as if they were the whole answer. Unfiltered, silently.
|
|
8360
|
+
if (event.operation.options.notExecuted().length > 0) {
|
|
8361
|
+
done(Result/* .PluginEventResult.success */.D.success(event.id, result.data));
|
|
8362
|
+
return;
|
|
8363
|
+
}
|
|
6438
8364
|
this.store(key, result.data);
|
|
6439
8365
|
// The caller gets a rebuilt value too, not the one just stored, so that mutating
|
|
6440
8366
|
// the result of a MISS cannot corrupt what the next hit returns.
|
|
@@ -6813,38 +8739,69 @@ const DEFAULT_MAX_BATCH_SIZE = 100;
|
|
|
6813
8739
|
|
|
6814
8740
|
|
|
6815
8741
|
|
|
8742
|
+
|
|
6816
8743
|
},
|
|
6817
8744
|
198(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
6818
8745
|
__webpack_require__.d(__webpack_exports__, {
|
|
6819
8746
|
H: () => (QueryOptionsCollection)
|
|
6820
8747
|
});
|
|
6821
8748
|
/* import */ var _assertions__rspack_import_1 = __webpack_require__(126);
|
|
6822
|
-
/* import */ var
|
|
8749
|
+
/* import */ var _expressions_utils__rspack_import_2 = __webpack_require__(63);
|
|
8750
|
+
/* import */ var _schema_types__rspack_import_0 = __webpack_require__(537);
|
|
8751
|
+
/* import */ var _utilities__rspack_import_3 = __webpack_require__(581);
|
|
8752
|
+
|
|
6823
8753
|
|
|
6824
8754
|
|
|
8755
|
+
|
|
8756
|
+
/** What a schema type is called in JavaScript, where one exists. A value of any other type cannot equal it. */ const JAVASCRIPT_TYPE_OF = {
|
|
8757
|
+
[_schema_types__rspack_import_0/* .SchemaTypes.Number */.L.Number]: "number",
|
|
8758
|
+
[_schema_types__rspack_import_0/* .SchemaTypes.String */.L.String]: "string",
|
|
8759
|
+
[_schema_types__rspack_import_0/* .SchemaTypes.Boolean */.L.Boolean]: "boolean",
|
|
8760
|
+
[_schema_types__rspack_import_0/* .SchemaTypes.Date */.L.Date]: "object"
|
|
8761
|
+
};
|
|
8762
|
+
const mismatchedSide = (property, value)=>{
|
|
8763
|
+
if (property == null || value == null || !(0,_assertions__rspack_import_1/* .isPropertyExpression */.e3)(property) || !(0,_assertions__rspack_import_1/* .isValueExpression */.S6)(value)) {
|
|
8764
|
+
return null;
|
|
8765
|
+
}
|
|
8766
|
+
const expected = JAVASCRIPT_TYPE_OF[property.property.type];
|
|
8767
|
+
if (expected == null || value.value == null || typeof value.value === expected) {
|
|
8768
|
+
return null;
|
|
8769
|
+
}
|
|
8770
|
+
return {
|
|
8771
|
+
property,
|
|
8772
|
+
value,
|
|
8773
|
+
expected
|
|
8774
|
+
};
|
|
8775
|
+
};
|
|
8776
|
+
/** A strict comparison whose answer is the same for every row, because the types cannot be equal. */ const comparesTypesThatCannotMatch = (expression)=>{
|
|
8777
|
+
if (!(0,_assertions__rspack_import_1/* .isComparatorExpression */.xH)(expression) || expression.strict !== true) {
|
|
8778
|
+
return false;
|
|
8779
|
+
}
|
|
8780
|
+
if (expression.comparator !== "equals") {
|
|
8781
|
+
return false;
|
|
8782
|
+
}
|
|
8783
|
+
return mismatchedSide(expression.left, expression.right) != null || mismatchedSide(expression.right, expression.left) != null;
|
|
8784
|
+
};
|
|
8785
|
+
/** `JSON.stringify` throws on a BigInt, and this runs inside the guard that exists to catch one. */ const describeLiteral = (value)=>typeof value === "string" ? `"${value}"` : String(value);
|
|
8786
|
+
const mismatchWarning = (expression)=>{
|
|
8787
|
+
const side = mismatchedSide(expression.left, expression.right) ?? mismatchedSide(expression.right, expression.left);
|
|
8788
|
+
const outcome = expression.negated ? "every row matches" : "no row matches";
|
|
8789
|
+
return `Routier: '${side.property.property.getAssignmentPath()}' is a ${side.expected}, and this filter ` + `compares it against ${describeLiteral(side.value.value)}, which is a ${typeof side.value.value}. ` + `A strict comparison between them is the same answer for every row, so ${outcome} and the filter ` + `runs in memory. https://routier.dev/guides/strict-comparison-types`;
|
|
8790
|
+
};
|
|
6825
8791
|
class QueryOptionsCollection {
|
|
6826
8792
|
options = new Map();
|
|
6827
8793
|
nextExecutionTarget = "database";
|
|
6828
8794
|
nextExecutionReason = null;
|
|
6829
8795
|
nextIndex = 0;
|
|
6830
8796
|
enumeratedItems = [];
|
|
8797
|
+
dirty = true;
|
|
8798
|
+
/** The collection a `splitAt`/`split` half came from. A capability report belongs to it. */ origin = null;
|
|
6831
8799
|
/** Cuts over to memory execution, keeping the first cause. See `MemoryExecutionReason`. */ cutOverToMemory(reason) {
|
|
6832
8800
|
this.nextExecutionTarget = "memory";
|
|
6833
8801
|
if (this.nextExecutionReason == null) {
|
|
6834
8802
|
this.nextExecutionReason = reason;
|
|
6835
8803
|
}
|
|
6836
8804
|
}
|
|
6837
|
-
/**
|
|
6838
|
-
* True when `split()` or `splitAt()` produced this collection.
|
|
6839
|
-
*
|
|
6840
|
-
* Those rebuild each half by re-adding its options, which re-derives execution targets
|
|
6841
|
-
* without the options that caused them — a post-join filter alone in the memory half
|
|
6842
|
-
* derives back to `"database"`. Anything reading `target` as a report of where work runs
|
|
6843
|
-
* has to reject a derived collection; see `explainQuery`.
|
|
6844
|
-
*/ derived = false;
|
|
6845
|
-
get isDerived() {
|
|
6846
|
-
return this.derived;
|
|
6847
|
-
}
|
|
6848
8805
|
get items() {
|
|
6849
8806
|
return this.options;
|
|
6850
8807
|
}
|
|
@@ -6879,7 +8836,7 @@ class QueryOptionsCollection {
|
|
|
6879
8836
|
if (filterValue.expression.type === "not-parsable") {
|
|
6880
8837
|
this.cutOverToMemory("not-parsable");
|
|
6881
8838
|
} else {
|
|
6882
|
-
(0,
|
|
8839
|
+
(0,_expressions_utils__rspack_import_2/* .forEach */.jJ)(filterValue.expression, (expression)=>{
|
|
6883
8840
|
if ((0,_assertions__rspack_import_1/* .isPropertyExpression */.e3)(expression) && expression.property.isUnmapped) {
|
|
6884
8841
|
// Cut over to memory execution, unmapped properties are not in the database and
|
|
6885
8842
|
// cannot be queried
|
|
@@ -6894,6 +8851,11 @@ class QueryOptionsCollection {
|
|
|
6894
8851
|
this.cutOverToMemory("renamed-property");
|
|
6895
8852
|
return false;
|
|
6896
8853
|
}
|
|
8854
|
+
if (comparesTypesThatCannotMatch(expression)) {
|
|
8855
|
+
_utilities__rspack_import_3/* .logger.warn */.vF.warn(mismatchWarning(expression));
|
|
8856
|
+
this.cutOverToMemory("predicate-error");
|
|
8857
|
+
return false;
|
|
8858
|
+
}
|
|
6897
8859
|
return true;
|
|
6898
8860
|
});
|
|
6899
8861
|
}
|
|
@@ -6922,6 +8884,11 @@ class QueryOptionsCollection {
|
|
|
6922
8884
|
this.cutOverToMemory("renamed-property");
|
|
6923
8885
|
}
|
|
6924
8886
|
}
|
|
8887
|
+
if ((name === "filter" || name === "sort") && (this.options.has("skip") || this.options.has("take"))) {
|
|
8888
|
+
// SQL emits WHERE before LIMIT and Mongo's find() filters before skipping, so an option
|
|
8889
|
+
// written after a window can only see the windowed rows if it runs after it.
|
|
8890
|
+
this.cutOverToMemory("after-window");
|
|
8891
|
+
}
|
|
6925
8892
|
if (name === "join") {
|
|
6926
8893
|
const joinValue = value;
|
|
6927
8894
|
// A join whose two sides live on different plugins cannot be sent to EITHER of
|
|
@@ -6934,18 +8901,24 @@ class QueryOptionsCollection {
|
|
|
6934
8901
|
this.cutOverToMemory("cross-plugin-join");
|
|
6935
8902
|
}
|
|
6936
8903
|
}
|
|
8904
|
+
// `executed` is the plan, not a record: nothing has run when an option is added. Every
|
|
8905
|
+
// consumer reads it after the plugin returned, so the optimistic window is never observed.
|
|
6937
8906
|
const item = {
|
|
6938
8907
|
index: this.nextIndex,
|
|
6939
|
-
option: {
|
|
8908
|
+
option: this.nextExecutionTarget === "database" ? {
|
|
6940
8909
|
name,
|
|
6941
|
-
target: this.nextExecutionTarget,
|
|
6942
8910
|
value,
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
8911
|
+
target: "database",
|
|
8912
|
+
reason: "executed"
|
|
8913
|
+
} : {
|
|
8914
|
+
name,
|
|
8915
|
+
value,
|
|
8916
|
+
target: "memory",
|
|
8917
|
+
reason: this.nextExecutionReason ?? "not-parsable"
|
|
6946
8918
|
}
|
|
6947
8919
|
};
|
|
6948
8920
|
this.nextIndex++;
|
|
8921
|
+
this.dirty = true;
|
|
6949
8922
|
const found = this.options.get(name);
|
|
6950
8923
|
this.options.set(name, [
|
|
6951
8924
|
...found ?? [],
|
|
@@ -6990,8 +8963,6 @@ class QueryOptionsCollection {
|
|
|
6990
8963
|
const sortedItems = this.enumeratedItems.toSorted((a, b)=>a.index - b.index);
|
|
6991
8964
|
const before = new QueryOptionsCollection();
|
|
6992
8965
|
const after = new QueryOptionsCollection();
|
|
6993
|
-
before.derived = true;
|
|
6994
|
-
after.derived = true;
|
|
6995
8966
|
let at = null;
|
|
6996
8967
|
for(let i = 0, length = sortedItems.length; i < length; i++){
|
|
6997
8968
|
const { option } = sortedItems[i];
|
|
@@ -7000,8 +8971,10 @@ class QueryOptionsCollection {
|
|
|
7000
8971
|
continue;
|
|
7001
8972
|
}
|
|
7002
8973
|
const destination = at == null ? before : after;
|
|
7003
|
-
destination.
|
|
8974
|
+
destination.adopt(sortedItems[i]);
|
|
7004
8975
|
}
|
|
8976
|
+
before.origin = this.origin ?? this;
|
|
8977
|
+
after.origin = this.origin ?? this;
|
|
7005
8978
|
return {
|
|
7006
8979
|
before,
|
|
7007
8980
|
at,
|
|
@@ -7033,23 +9006,99 @@ class QueryOptionsCollection {
|
|
|
7033
9006
|
this.nextExecutionReason = nextExecutionReason;
|
|
7034
9007
|
this.nextIndex = nextIndex;
|
|
7035
9008
|
this.enumeratedItems = [];
|
|
9009
|
+
// Clearing the list is not enough now that staleness is a flag rather than a count:
|
|
9010
|
+
// without this, `resolveEnumeration` believes the empty list is current and every read
|
|
9011
|
+
// of the collection sees no options at all.
|
|
9012
|
+
this.dirty = true;
|
|
7036
9013
|
};
|
|
7037
9014
|
}
|
|
9015
|
+
/** Takes an item as it stands — same object, same index, same target and reason. */ adopt(item) {
|
|
9016
|
+
const found = this.options.get(item.option.name);
|
|
9017
|
+
this.options.set(item.option.name, [
|
|
9018
|
+
...found ?? [],
|
|
9019
|
+
item
|
|
9020
|
+
]);
|
|
9021
|
+
this.nextIndex = Math.max(this.nextIndex, item.index + 1);
|
|
9022
|
+
this.dirty = true;
|
|
9023
|
+
}
|
|
9024
|
+
/**
|
|
9025
|
+
* A plugin reporting that its engine cannot express one option.
|
|
9026
|
+
*
|
|
9027
|
+
* Core marks the rest of the database phase `not-reached`, because the database has to stop
|
|
9028
|
+
* there — a window applied in front of a filter that was not applied returns the wrong rows.
|
|
9029
|
+
* Passing the cascade through core is what makes it impossible for a plugin to mark a
|
|
9030
|
+
* non-contiguous cut.
|
|
9031
|
+
*
|
|
9032
|
+
* A report names a culprit and never un-names one, so reports commute.
|
|
9033
|
+
*
|
|
9034
|
+
* The option is not moved to the memory arm. It stays where it was planned, which is what keeps
|
|
9035
|
+
* a redirect distinguishable from something core sent to memory in the first place.
|
|
9036
|
+
*/ reportMissingCapability(item) {
|
|
9037
|
+
this.report(item, "missing-capability");
|
|
9038
|
+
}
|
|
9039
|
+
/**
|
|
9040
|
+
* A plugin reporting that its engine would answer one option differently from JavaScript.
|
|
9041
|
+
*
|
|
9042
|
+
* Same cascade as `reportMissingCapability`, and a separate reason because the caller can act on
|
|
9043
|
+
* one and not the other. See `DatabaseExecutionReason`.
|
|
9044
|
+
*/ reportEngineDivergence(item) {
|
|
9045
|
+
this.report(item, "engine-divergence");
|
|
9046
|
+
}
|
|
9047
|
+
report(item, reason) {
|
|
9048
|
+
// A half can only see its own slice, and the database has to stop for the whole dispatch.
|
|
9049
|
+
if (this.origin != null) {
|
|
9050
|
+
this.origin.report(item, reason);
|
|
9051
|
+
return;
|
|
9052
|
+
}
|
|
9053
|
+
this.resolveEnumeration();
|
|
9054
|
+
for (const candidate of this.enumeratedItems){
|
|
9055
|
+
if (candidate.option.target !== "database" || candidate.index < item.index) {
|
|
9056
|
+
continue;
|
|
9057
|
+
}
|
|
9058
|
+
if (candidate.index === item.index) {
|
|
9059
|
+
candidate.option.reason = reason;
|
|
9060
|
+
continue;
|
|
9061
|
+
}
|
|
9062
|
+
if (candidate.option.reason === "executed") {
|
|
9063
|
+
candidate.option.reason = "not-reached";
|
|
9064
|
+
}
|
|
9065
|
+
}
|
|
9066
|
+
}
|
|
9067
|
+
/**
|
|
9068
|
+
* Forgets what any previous dispatch reported.
|
|
9069
|
+
*
|
|
9070
|
+
* Capability is answered per dispatch, so a report is only an answer for the execution that
|
|
9071
|
+
* produced it. The items are shared with any snapshot, so a report mutated in place otherwise
|
|
9072
|
+
* survives a restore and a second terminal on the same queryable replays options the plugin
|
|
9073
|
+
* did run — a `skip` applied twice, over rows already windowed.
|
|
9074
|
+
*/ forgetReports() {
|
|
9075
|
+
this.resolveEnumeration();
|
|
9076
|
+
for (const item of this.enumeratedItems){
|
|
9077
|
+
if (item.option.target === "database") {
|
|
9078
|
+
item.option.reason = "executed";
|
|
9079
|
+
}
|
|
9080
|
+
}
|
|
9081
|
+
}
|
|
9082
|
+
/** The options the database did not run, in the order they were written. */ notExecuted() {
|
|
9083
|
+
this.resolveEnumeration();
|
|
9084
|
+
return this.enumeratedItems.filter((item)=>item.option.target === "database" && item.option.reason !== "executed").toSorted((a, b)=>a.index - b.index);
|
|
9085
|
+
}
|
|
7038
9086
|
split() {
|
|
7039
9087
|
this.resolveEnumeration();
|
|
7040
9088
|
const sortedItems = this.enumeratedItems.toSorted((a, b)=>a.index - b.index);
|
|
7041
9089
|
const memoryQueryOptionsCollection = new QueryOptionsCollection();
|
|
7042
9090
|
const databaseQueryOptionsCollection = new QueryOptionsCollection();
|
|
7043
|
-
memoryQueryOptionsCollection.derived = true;
|
|
7044
|
-
databaseQueryOptionsCollection.derived = true;
|
|
7045
9091
|
for(let i = 0, length = sortedItems.length; i < length; i++){
|
|
7046
9092
|
const sortedItem = sortedItems[i];
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
9093
|
+
const half = sortedItem.option.target === "database" ? databaseQueryOptionsCollection : memoryQueryOptionsCollection;
|
|
9094
|
+
// The ITEM, not its name and value. Re-adding would re-derive target and reason from a
|
|
9095
|
+
// fresh cascade, and a memory option re-added alone comes back out as `database` with no
|
|
9096
|
+
// reason at all. Sharing it also means a plugin's report on the database half is the
|
|
9097
|
+
// same object the explanation reads.
|
|
9098
|
+
half.adopt(sortedItem);
|
|
9099
|
+
}
|
|
9100
|
+
memoryQueryOptionsCollection.origin = this.origin ?? this;
|
|
9101
|
+
databaseQueryOptionsCollection.origin = this.origin ?? this;
|
|
7053
9102
|
return {
|
|
7054
9103
|
memory: memoryQueryOptionsCollection,
|
|
7055
9104
|
database: databaseQueryOptionsCollection
|
|
@@ -7095,8 +9144,11 @@ class QueryOptionsCollection {
|
|
|
7095
9144
|
].flat().toSorted((a, b)=>a.index - b.index);
|
|
7096
9145
|
}
|
|
7097
9146
|
resolveEnumeration() {
|
|
7098
|
-
|
|
9147
|
+
// A flag, not a count: adopting leaves gaps in the indexes, so `length !== nextIndex` is
|
|
9148
|
+
// true forever on a half and the enumeration rebuilds on every read.
|
|
9149
|
+
if (this.dirty === true) {
|
|
7099
9150
|
this.enumeratedItems = this.getEnumeration();
|
|
9151
|
+
this.dirty = false;
|
|
7100
9152
|
}
|
|
7101
9153
|
}
|
|
7102
9154
|
forEach(iterator) {
|
|
@@ -8074,12 +10126,6 @@ class SchemaComputed extends SchemaBase {
|
|
|
8074
10126
|
;// CONCATENATED MODULE: ./src/schema/PropertyInfo.ts
|
|
8075
10127
|
|
|
8076
10128
|
|
|
8077
|
-
const SUPPORTED_DESERIALIZATION_TYPES = new Set([
|
|
8078
|
-
types/* .SchemaTypes.Boolean */.L.Boolean,
|
|
8079
|
-
types/* .SchemaTypes.Date */.L.Date,
|
|
8080
|
-
types/* .SchemaTypes.Number */.L.Number,
|
|
8081
|
-
types/* .SchemaTypes.String */.L.String
|
|
8082
|
-
]);
|
|
8083
10129
|
/**
|
|
8084
10130
|
* Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
|
|
8085
10131
|
*/ class PropertyInfo {
|
|
@@ -8199,9 +10245,6 @@ const SUPPORTED_DESERIALIZATION_TYPES = new Set([
|
|
|
8199
10245
|
get isRenamed() {
|
|
8200
10246
|
return !!this.from;
|
|
8201
10247
|
}
|
|
8202
|
-
get supportsDeserialization() {
|
|
8203
|
-
return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);
|
|
8204
|
-
}
|
|
8205
10248
|
_getPropertyChain() {
|
|
8206
10249
|
if (this._propertyChainCache) {
|
|
8207
10250
|
return this._propertyChainCache;
|
|
@@ -8454,7 +10497,7 @@ const SUPPORTED_DESERIALIZATION_TYPES = new Set([
|
|
|
8454
10497
|
if (this.type === types/* .SchemaTypes.Boolean */.L.Boolean) {
|
|
8455
10498
|
return Boolean(value);
|
|
8456
10499
|
}
|
|
8457
|
-
|
|
10500
|
+
return value;
|
|
8458
10501
|
}
|
|
8459
10502
|
}
|
|
8460
10503
|
|
|
@@ -13497,12 +15540,14 @@ const isLogLevel = (value)=>typeof value === 'string' && LOG_LEVELS.includes(val
|
|
|
13497
15540
|
const debug = process.env.DEBUG;
|
|
13498
15541
|
if (debug === 'routier' || debug === '*') return 'debug';
|
|
13499
15542
|
const env = "production"?.toLowerCase();
|
|
13500
|
-
// `test` is deliberately absent. It used to be here, which meant no test suite anywhere
|
|
13501
|
-
// could run Routier quietly. Opt in with DEBUG=routier or ROUTIER_LOG_LEVEL when a test
|
|
13502
|
-
// needs the output.
|
|
13503
15543
|
if (env === 'dev' || env === 'development') return 'debug';
|
|
13504
15544
|
}
|
|
13505
|
-
|
|
15545
|
+
// Warnings are on unless something turns them off.
|
|
15546
|
+
//
|
|
15547
|
+
// Routier warns when a query returns correct rows a slower way than it could, or when a filter
|
|
15548
|
+
// compares types that can never match. Both are the caller's to act on, and a default of
|
|
15549
|
+
// `silent` meant the only people who ever saw them were the ones who already knew to look.
|
|
15550
|
+
return 'warn';
|
|
13506
15551
|
};
|
|
13507
15552
|
let level = resolveLevel();
|
|
13508
15553
|
let rank = RANK[level];
|
|
@@ -13799,173 +15844,194 @@ var __webpack_exports__ = {};
|
|
|
13799
15844
|
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
13800
15845
|
(() => {
|
|
13801
15846
|
__webpack_require__.d(__webpack_exports__, {
|
|
13802
|
-
$
|
|
13803
|
-
$
|
|
13804
|
-
$
|
|
13805
|
-
$
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
15847
|
+
$EW: () => (/* reexport safe */ _collections__rspack_import_2.$E),
|
|
15848
|
+
$HD: () => (/* reexport safe */ _schema__rspack_import_9.$H),
|
|
15849
|
+
$PY: () => (/* reexport safe */ _utilities__rspack_import_10.$P),
|
|
15850
|
+
$jz: () => (/* reexport safe */ _codegen__rspack_import_1.$j),
|
|
15851
|
+
AFm: () => (/* reexport safe */ _assertions__rspack_import_0.AF),
|
|
15852
|
+
AYs: () => (/* reexport safe */ _schema__rspack_import_9.AY),
|
|
15853
|
+
ArK: () => (/* reexport safe */ _errors__rspack_import_3.Ar),
|
|
15854
|
+
B2$: () => (/* reexport safe */ _plugins__rspack_import_7.B2),
|
|
15855
|
+
BHS: () => (/* reexport safe */ _assertions__rspack_import_0.BH),
|
|
15856
|
+
BLm: () => (/* reexport safe */ _plugins__rspack_import_7.BL),
|
|
15857
|
+
Bg1: () => (/* reexport safe */ _plugins__rspack_import_7.Bg),
|
|
15858
|
+
CCQ: () => (/* reexport safe */ _expressions__rspack_import_4.CC),
|
|
15859
|
+
CWQ: () => (/* reexport safe */ _schema__rspack_import_9.CW),
|
|
15860
|
+
CgF: () => (/* reexport safe */ _schema__rspack_import_9.Cg),
|
|
15861
|
+
Cgm: () => (/* reexport safe */ _utilities__rspack_import_10.Cg),
|
|
15862
|
+
Cv0: () => (/* reexport safe */ _assertions__rspack_import_0.Cv),
|
|
15863
|
+
DFQ: () => (/* reexport safe */ _plugins__rspack_import_7.DF),
|
|
15864
|
+
DGz: () => (/* reexport safe */ _expressions__rspack_import_4.DG),
|
|
15865
|
+
Dkq: () => (/* reexport safe */ _schema__rspack_import_9.Dk),
|
|
15866
|
+
DqV: () => (/* reexport safe */ _results__rspack_import_8.Dq),
|
|
15867
|
+
E2X: () => (/* reexport safe */ _codegen__rspack_import_1.E2),
|
|
15868
|
+
F5D: () => (/* reexport safe */ _expressions__rspack_import_4.F5),
|
|
15869
|
+
FRo: () => (/* reexport safe */ _schema__rspack_import_9.FR),
|
|
15870
|
+
Fn9: () => (/* reexport safe */ _schema__rspack_import_9.Fn),
|
|
15871
|
+
HMh: () => (/* reexport safe */ _plugins__rspack_import_7.HM),
|
|
15872
|
+
He0: () => (/* reexport safe */ _utilities__rspack_import_10.He),
|
|
15873
|
+
IBA: () => (/* reexport safe */ _schema__rspack_import_9.IB),
|
|
15874
|
+
IIj: () => (/* reexport safe */ _plugins__rspack_import_7.II),
|
|
15875
|
+
IbH: () => (/* reexport safe */ _plugins__rspack_import_7.Ib),
|
|
15876
|
+
JFg: () => (/* reexport safe */ _plugins__rspack_import_7.JF),
|
|
15877
|
+
Jdk: () => (/* reexport safe */ _plugins__rspack_import_7.Jd),
|
|
15878
|
+
KB4: () => (/* reexport safe */ _plugins__rspack_import_7.KB),
|
|
15879
|
+
KC5: () => (/* reexport safe */ _schema__rspack_import_9.KC),
|
|
15880
|
+
KgE: () => (/* reexport safe */ _plugins__rspack_import_7.Kg),
|
|
15881
|
+
Ko2: () => (/* reexport safe */ _expressions__rspack_import_4.Ko),
|
|
15882
|
+
L$j: () => (/* reexport safe */ _schema__rspack_import_9.L$),
|
|
15883
|
+
L8V: () => (/* reexport safe */ _schema__rspack_import_9.L8),
|
|
15884
|
+
LLS: () => (/* reexport safe */ _schema__rspack_import_9.LL),
|
|
15885
|
+
LUe: () => (/* reexport safe */ _expressions__rspack_import_4.LU),
|
|
15886
|
+
MYx: () => (/* reexport safe */ _expressions__rspack_import_4.MY),
|
|
15887
|
+
MiC: () => (/* reexport safe */ _utilities__rspack_import_10.Mi),
|
|
15888
|
+
Mrv: () => (/* reexport safe */ _plugins__rspack_import_7.Mr),
|
|
15889
|
+
N82: () => (/* reexport safe */ _utilities__rspack_import_10.N8),
|
|
15890
|
+
NbB: () => (/* reexport safe */ _expressions__rspack_import_4.Nb),
|
|
15891
|
+
NlX: () => (/* reexport safe */ _codegen__rspack_import_1.Nl),
|
|
15892
|
+
Nog: () => (/* reexport safe */ _codegen__rspack_import_1.No),
|
|
15893
|
+
Nrn: () => (/* reexport safe */ _utilities__rspack_import_10.Nr),
|
|
15894
|
+
O_H: () => (/* reexport safe */ _codegen__rspack_import_1.O_),
|
|
15895
|
+
OdT: () => (/* reexport safe */ _schema__rspack_import_9.Od),
|
|
15896
|
+
PGb: () => (/* reexport safe */ _schema__rspack_import_9.PG),
|
|
15897
|
+
PPB: () => (/* reexport safe */ _plugins__rspack_import_7.PP),
|
|
15898
|
+
PlD: () => (/* reexport safe */ _plugins__rspack_import_7.Pl),
|
|
15899
|
+
Pr0: () => (/* reexport safe */ _plugins__rspack_import_7.Pr),
|
|
15900
|
+
Q7C: () => (/* reexport safe */ _results__rspack_import_8.Q7),
|
|
15901
|
+
QBn: () => (/* reexport safe */ _plugins__rspack_import_7.QB),
|
|
15902
|
+
QCV: () => (/* reexport safe */ _plugins__rspack_import_7.QC),
|
|
15903
|
+
Qc7: () => (/* reexport safe */ _schema__rspack_import_9.Qc),
|
|
15904
|
+
R7L: () => (/* reexport safe */ _collections__rspack_import_2.R7),
|
|
15905
|
+
RKi: () => (/* reexport safe */ _plugins__rspack_import_7.RK),
|
|
15906
|
+
S6v: () => (/* reexport safe */ _assertions__rspack_import_0.S6),
|
|
15907
|
+
SCB: () => (/* reexport safe */ _expressions__rspack_import_4.SC),
|
|
15908
|
+
Smt: () => (/* reexport safe */ _expressions__rspack_import_4.Sm),
|
|
15909
|
+
Sv9: () => (/* reexport safe */ _expressions__rspack_import_4.Sv),
|
|
15910
|
+
TFx: () => (/* reexport safe */ _schema__rspack_import_9.TF),
|
|
15911
|
+
Tlv: () => (/* reexport safe */ _codegen__rspack_import_1.Tl),
|
|
15912
|
+
To4: () => (/* reexport safe */ _plugins__rspack_import_7.To),
|
|
15913
|
+
UQ$: () => (/* reexport safe */ _pipeline__rspack_import_6.UQ),
|
|
15914
|
+
UXe: () => (/* reexport safe */ _schema__rspack_import_9.UX),
|
|
15915
|
+
VGm: () => (/* reexport safe */ _schema__rspack_import_9.VG),
|
|
15916
|
+
VTd: () => (/* reexport safe */ _errors__rspack_import_3.VT),
|
|
15917
|
+
VWF: () => (/* reexport safe */ _plugins__rspack_import_7.VW),
|
|
15918
|
+
VgV: () => (/* reexport safe */ _utilities__rspack_import_10.Vg),
|
|
15919
|
+
Vup: () => (/* reexport safe */ _expressions__rspack_import_4.Vu),
|
|
15920
|
+
Vv5: () => (/* reexport safe */ _expressions__rspack_import_4.Vv),
|
|
15921
|
+
Wif: () => (/* reexport safe */ _plugins__rspack_import_7.Wi),
|
|
15922
|
+
XKQ: () => (/* reexport safe */ _plugins__rspack_import_7.XK),
|
|
15923
|
+
XML: () => (/* reexport safe */ _utilities__rspack_import_10.XM),
|
|
15924
|
+
XMU: () => (/* reexport safe */ _schema__rspack_import_9.XM),
|
|
15925
|
+
Ye2: () => (/* reexport safe */ _assertions__rspack_import_0.Ye),
|
|
15926
|
+
Zm6: () => (/* reexport safe */ _utilities__rspack_import_10.Zm),
|
|
15927
|
+
Zmv: () => (/* reexport safe */ _codegen__rspack_import_1.Zm),
|
|
15928
|
+
_1B: () => (/* reexport safe */ _plugins__rspack_import_7._1),
|
|
15929
|
+
_3z: () => (/* reexport safe */ _expressions__rspack_import_4._3),
|
|
15930
|
+
__t: () => (/* reexport safe */ _plugins__rspack_import_7.__),
|
|
15931
|
+
_bM: () => (/* reexport safe */ _plugins__rspack_import_7._b),
|
|
15932
|
+
_h8: () => (/* reexport safe */ _schema__rspack_import_9._h),
|
|
15933
|
+
_tD: () => (/* reexport safe */ _schema__rspack_import_9._t),
|
|
15934
|
+
_v8: () => (/* reexport safe */ _collections__rspack_import_2._v),
|
|
15935
|
+
aeS: () => (/* reexport safe */ _plugins__rspack_import_7.ae),
|
|
15936
|
+
apy: () => (/* reexport safe */ _utilities__rspack_import_10.ap),
|
|
15937
|
+
asd: () => (/* reexport safe */ _plugins__rspack_import_7.as),
|
|
15938
|
+
avB: () => (/* reexport safe */ _utilities__rspack_import_10.av),
|
|
15939
|
+
axV: () => (/* reexport safe */ _expressions__rspack_import_4.ax),
|
|
15940
|
+
bQK: () => (/* reexport safe */ _expressions__rspack_import_4.bQ),
|
|
15941
|
+
bXL: () => (/* reexport safe */ _plugins__rspack_import_7.bX),
|
|
15942
|
+
brM: () => (/* reexport safe */ _expressions__rspack_import_4.br),
|
|
15943
|
+
d0y: () => (/* reexport safe */ _plugins__rspack_import_7.d0),
|
|
15944
|
+
dFF: () => (/* reexport safe */ _schema__rspack_import_9.dF),
|
|
15945
|
+
dpe: () => (/* reexport safe */ _assertions__rspack_import_0.dp),
|
|
15946
|
+
e3n: () => (/* reexport safe */ _assertions__rspack_import_0.e3),
|
|
15947
|
+
eBw: () => (/* reexport safe */ _codegen__rspack_import_1.eB),
|
|
15948
|
+
epV: () => (/* reexport safe */ _expressions__rspack_import_4.ep),
|
|
15949
|
+
f27: () => (/* reexport safe */ _plugins__rspack_import_7.f2),
|
|
15950
|
+
fLe: () => (/* reexport safe */ _errors__rspack_import_3.fL),
|
|
15951
|
+
fNp: () => (/* reexport safe */ _plugins__rspack_import_7.fN),
|
|
15952
|
+
feB: () => (/* reexport safe */ _codegen__rspack_import_1.fe),
|
|
15953
|
+
fmL: () => (/* reexport safe */ _assertions__rspack_import_0.fm),
|
|
15954
|
+
fpB: () => (/* reexport safe */ _plugins__rspack_import_7.fp),
|
|
15955
|
+
fw9: () => (/* reexport safe */ _expressions__rspack_import_4.fw),
|
|
15956
|
+
g5v: () => (/* reexport safe */ _collections__rspack_import_2.g5),
|
|
15957
|
+
gHt: () => (/* reexport safe */ _plugins__rspack_import_7.gH),
|
|
15958
|
+
gZm: () => (/* reexport safe */ _utilities__rspack_import_10.gZ),
|
|
15959
|
+
g_q: () => (/* reexport safe */ _schema__rspack_import_9.g_),
|
|
15960
|
+
geP: () => (/* reexport safe */ _schema__rspack_import_9.ge),
|
|
15961
|
+
gm4: () => (/* reexport safe */ _expressions__rspack_import_4.gm),
|
|
15962
|
+
hLl: () => (/* reexport safe */ _codegen__rspack_import_1.hL),
|
|
15963
|
+
hMR: () => (/* reexport safe */ _schema__rspack_import_9.hM),
|
|
15964
|
+
hdC: () => (/* reexport safe */ _schema__rspack_import_9.hd),
|
|
15965
|
+
heW: () => (/* reexport safe */ _schema__rspack_import_9.he),
|
|
13903
15966
|
hq: () => (/* reexport safe */ _pipeline__rspack_import_6.hq),
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
15967
|
+
hqX: () => (/* reexport safe */ _results__rspack_import_8.hq),
|
|
15968
|
+
i1p: () => (/* reexport safe */ _plugins__rspack_import_7.i1),
|
|
15969
|
+
iGi: () => (/* reexport safe */ _plugins__rspack_import_7.iG),
|
|
15970
|
+
ixs: () => (/* reexport safe */ _schema__rspack_import_9.ix),
|
|
15971
|
+
j7i: () => (/* reexport safe */ _codegen__rspack_import_1.j7),
|
|
15972
|
+
jER: () => (/* reexport safe */ _plugins__rspack_import_7.jE),
|
|
15973
|
+
jJl: () => (/* reexport safe */ _expressions__rspack_import_4.jJ),
|
|
15974
|
+
jOn: () => (/* reexport safe */ _plugins__rspack_import_7.jO),
|
|
15975
|
+
jf6: () => (/* reexport safe */ _assertions__rspack_import_0.jf),
|
|
15976
|
+
kEY: () => (/* reexport safe */ _schema__rspack_import_9.kE),
|
|
15977
|
+
kFv: () => (/* reexport safe */ _codegen__rspack_import_1.kF),
|
|
15978
|
+
kXt: () => (/* reexport safe */ _plugins__rspack_import_7.kX),
|
|
15979
|
+
kXy: () => (/* reexport safe */ _pipeline__rspack_import_6.kX),
|
|
15980
|
+
l5B: () => (/* reexport safe */ _schema__rspack_import_9.l5),
|
|
15981
|
+
lAq: () => (/* reexport safe */ _plugins__rspack_import_7.lA),
|
|
15982
|
+
lOZ: () => (/* reexport safe */ _plugins__rspack_import_7.lO),
|
|
15983
|
+
lQ1: () => (/* reexport safe */ _utilities__rspack_import_10.lQ),
|
|
15984
|
+
ly4: () => (/* reexport safe */ _schema__rspack_import_9.ly),
|
|
15985
|
+
m6g: () => (/* reexport safe */ _plugins__rspack_import_7.m6),
|
|
15986
|
+
naN: () => (/* reexport safe */ _plugins__rspack_import_7.n),
|
|
15987
|
+
nni: () => (/* reexport safe */ _assertions__rspack_import_0.nn),
|
|
15988
|
+
o8B: () => (/* reexport safe */ _utilities__rspack_import_10.o8),
|
|
15989
|
+
oHM: () => (/* reexport safe */ _expressions__rspack_import_4.oH),
|
|
15990
|
+
oJY: () => (/* reexport safe */ _plugins__rspack_import_7.oJ),
|
|
15991
|
+
oYS: () => (/* reexport safe */ _expressions__rspack_import_4.oY),
|
|
15992
|
+
omr: () => (/* reexport safe */ _collections__rspack_import_2.om),
|
|
15993
|
+
otk: () => (/* reexport safe */ _codegen__rspack_import_1.ot),
|
|
15994
|
+
p_D: () => (/* reexport safe */ _utilities__rspack_import_10.p_),
|
|
15995
|
+
pgI: () => (/* reexport safe */ _expressions__rspack_import_4.pg),
|
|
15996
|
+
ptB: () => (/* reexport safe */ _plugins__rspack_import_7.pt),
|
|
15997
|
+
pyz: () => (/* reexport safe */ _schema__rspack_import_9.py),
|
|
13934
15998
|
qQ: () => (/* reexport safe */ _schema__rspack_import_9.qQ),
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
15999
|
+
qYY: () => (/* reexport safe */ _codegen__rspack_import_1.qY),
|
|
16000
|
+
qjC: () => (/* reexport safe */ _plugins__rspack_import_7.qj),
|
|
16001
|
+
qkU: () => (/* reexport safe */ _collections__rspack_import_2.qk),
|
|
16002
|
+
qyv: () => (/* reexport safe */ _plugins__rspack_import_7.qy),
|
|
16003
|
+
r4q: () => (/* reexport safe */ _expressions__rspack_import_4.r4),
|
|
16004
|
+
r4y: () => (/* reexport safe */ _collections__rspack_import_2.r4),
|
|
16005
|
+
r5d: () => (/* reexport safe */ _schema__rspack_import_9.r5),
|
|
13941
16006
|
s: () => (/* reexport safe */ _schema__rspack_import_9.s),
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
wL
|
|
16007
|
+
szu: () => (/* reexport safe */ _utilities__rspack_import_10.sz),
|
|
16008
|
+
tAN: () => (/* reexport safe */ _expressions__rspack_import_4.tA),
|
|
16009
|
+
tB5: () => (/* reexport safe */ _performance__rspack_import_5.t),
|
|
16010
|
+
tWU: () => (/* reexport safe */ _utilities__rspack_import_10.tW),
|
|
16011
|
+
tXs: () => (/* reexport safe */ _utilities__rspack_import_10.tX),
|
|
16012
|
+
uRe: () => (/* reexport safe */ _utilities__rspack_import_10.uR),
|
|
16013
|
+
vF5: () => (/* reexport safe */ _utilities__rspack_import_10.vF),
|
|
16014
|
+
vZg: () => (/* reexport safe */ _plugins__rspack_import_7.vZ),
|
|
16015
|
+
vgl: () => (/* reexport safe */ _assertions__rspack_import_0.vg),
|
|
16016
|
+
wL$: () => (/* reexport safe */ _assertions__rspack_import_0.wL),
|
|
13952
16017
|
wM: () => (/* reexport safe */ _collections__rspack_import_2.wM),
|
|
13953
|
-
wN
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
16018
|
+
wN$: () => (/* reexport safe */ _plugins__rspack_import_7.wN),
|
|
16019
|
+
wSV: () => (/* reexport safe */ _expressions__rspack_import_4.wS),
|
|
16020
|
+
w_n: () => (/* reexport safe */ _schema__rspack_import_9.w_),
|
|
16021
|
+
wgE: () => (/* reexport safe */ _utilities__rspack_import_10.wg),
|
|
16022
|
+
wpC: () => (/* reexport safe */ _collections__rspack_import_2.wp),
|
|
16023
|
+
wtA: () => (/* reexport safe */ _schema__rspack_import_9.wt),
|
|
16024
|
+
xHv: () => (/* reexport safe */ _assertions__rspack_import_0.xH),
|
|
16025
|
+
xP1: () => (/* reexport safe */ _performance__rspack_import_5.x),
|
|
16026
|
+
xwG: () => (/* reexport safe */ _plugins__rspack_import_7.xw),
|
|
16027
|
+
y48: () => (/* reexport safe */ _plugins__rspack_import_7.y4),
|
|
16028
|
+
yRE: () => (/* reexport safe */ _plugins__rspack_import_7.yR),
|
|
16029
|
+
yVU: () => (/* reexport safe */ _schema__rspack_import_9.yV),
|
|
16030
|
+
yXq: () => (/* reexport safe */ _plugins__rspack_import_7.yX),
|
|
16031
|
+
ysd: () => (/* reexport safe */ _assertions__rspack_import_0.ys),
|
|
16032
|
+
z1W: () => (/* reexport safe */ _schema__rspack_import_9.z1),
|
|
16033
|
+
z9H: () => (/* reexport safe */ _schema__rspack_import_9.z9),
|
|
16034
|
+
zHw: () => (/* reexport safe */ _plugins__rspack_import_7.zH)
|
|
13969
16035
|
});
|
|
13970
16036
|
/* import */ var _assertions__rspack_import_0 = __webpack_require__(126);
|
|
13971
16037
|
/* import */ var _codegen__rspack_import_1 = __webpack_require__(80);
|
|
@@ -13974,7 +16040,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13974
16040
|
/* import */ var _expressions__rspack_import_4 = __webpack_require__(138);
|
|
13975
16041
|
/* import */ var _performance__rspack_import_5 = __webpack_require__(971);
|
|
13976
16042
|
/* import */ var _pipeline__rspack_import_6 = __webpack_require__(314);
|
|
13977
|
-
/* import */ var _plugins__rspack_import_7 = __webpack_require__(
|
|
16043
|
+
/* import */ var _plugins__rspack_import_7 = __webpack_require__(640);
|
|
13978
16044
|
/* import */ var _results__rspack_import_8 = __webpack_require__(264);
|
|
13979
16045
|
/* import */ var _schema__rspack_import_9 = __webpack_require__(755);
|
|
13980
16046
|
/* import */ var _utilities__rspack_import_10 = __webpack_require__(222);
|
|
@@ -13993,173 +16059,194 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13993
16059
|
|
|
13994
16060
|
})();
|
|
13995
16061
|
|
|
13996
|
-
var __webpack_exports__AndBuilder = __webpack_exports__.
|
|
13997
|
-
var __webpack_exports__ArrayBuilder = __webpack_exports__.$
|
|
13998
|
-
var __webpack_exports__AssignmentBuilder = __webpack_exports__.
|
|
13999
|
-
var __webpack_exports__BatchingDbPlugin = __webpack_exports__.
|
|
14000
|
-
var __webpack_exports__Block = __webpack_exports__.
|
|
14001
|
-
var __webpack_exports__BulkPersistChanges = __webpack_exports__.
|
|
14002
|
-
var __webpack_exports__BulkPersistResult = __webpack_exports__.
|
|
14003
|
-
var
|
|
14004
|
-
var
|
|
14005
|
-
var
|
|
14006
|
-
var
|
|
14007
|
-
var
|
|
14008
|
-
var
|
|
14009
|
-
var
|
|
14010
|
-
var
|
|
14011
|
-
var
|
|
14012
|
-
var
|
|
14013
|
-
var
|
|
14014
|
-
var
|
|
14015
|
-
var
|
|
14016
|
-
var
|
|
14017
|
-
var
|
|
14018
|
-
var
|
|
14019
|
-
var
|
|
14020
|
-
var
|
|
14021
|
-
var
|
|
14022
|
-
var
|
|
14023
|
-
var
|
|
14024
|
-
var
|
|
14025
|
-
var
|
|
14026
|
-
var
|
|
14027
|
-
var
|
|
14028
|
-
var
|
|
14029
|
-
var
|
|
14030
|
-
var
|
|
14031
|
-
var
|
|
14032
|
-
var
|
|
14033
|
-
var
|
|
14034
|
-
var
|
|
14035
|
-
var
|
|
14036
|
-
var
|
|
14037
|
-
var
|
|
14038
|
-
var
|
|
14039
|
-
var
|
|
14040
|
-
var
|
|
14041
|
-
var
|
|
16062
|
+
var __webpack_exports__AndBuilder = __webpack_exports__.Nog;
|
|
16063
|
+
var __webpack_exports__ArrayBuilder = __webpack_exports__.$jz;
|
|
16064
|
+
var __webpack_exports__AssignmentBuilder = __webpack_exports__.hLl;
|
|
16065
|
+
var __webpack_exports__BatchingDbPlugin = __webpack_exports__.kXt;
|
|
16066
|
+
var __webpack_exports__Block = __webpack_exports__.eBw;
|
|
16067
|
+
var __webpack_exports__BulkPersistChanges = __webpack_exports__.qkU;
|
|
16068
|
+
var __webpack_exports__BulkPersistResult = __webpack_exports__.omr;
|
|
16069
|
+
var __webpack_exports__CALL_SOURCE = __webpack_exports__.NbB;
|
|
16070
|
+
var __webpack_exports__CacheDbPlugin = __webpack_exports__.y48;
|
|
16071
|
+
var __webpack_exports__CallExpression = __webpack_exports__.DGz;
|
|
16072
|
+
var __webpack_exports__CodeBuilder = __webpack_exports__.NlX;
|
|
16073
|
+
var __webpack_exports__ComparatorExpression = __webpack_exports__.bQK;
|
|
16074
|
+
var __webpack_exports__ConcurrencyDbPlugin = __webpack_exports__.bXL;
|
|
16075
|
+
var __webpack_exports__ContainerBlock = __webpack_exports__.j7i;
|
|
16076
|
+
var __webpack_exports__DATABASE_EXECUTION_EXPLANATIONS = __webpack_exports__.QCV;
|
|
16077
|
+
var __webpack_exports__DEFAULT_SEMI_JOIN_KEY_THRESHOLD = __webpack_exports__._bM;
|
|
16078
|
+
var __webpack_exports__DataTranslator = __webpack_exports__.JFg;
|
|
16079
|
+
var __webpack_exports__EXECUTED_QUERIES_UNSUPPORTED = __webpack_exports__.jER;
|
|
16080
|
+
var __webpack_exports__EXPRESSION_TYPES = __webpack_exports__.tAN;
|
|
16081
|
+
var __webpack_exports__EmptyExpression = __webpack_exports__.Smt;
|
|
16082
|
+
var __webpack_exports__EphemeralDataPlugin = __webpack_exports__.Jdk;
|
|
16083
|
+
var __webpack_exports__Expression = __webpack_exports__.r4q;
|
|
16084
|
+
var __webpack_exports__FOLDABLE = __webpack_exports__.Sv9;
|
|
16085
|
+
var __webpack_exports__FunctionBuilder = __webpack_exports__.kFv;
|
|
16086
|
+
var __webpack_exports__FunctionFactoryBuilder = __webpack_exports__.O_H;
|
|
16087
|
+
var __webpack_exports__HashType = __webpack_exports__.$HD;
|
|
16088
|
+
var __webpack_exports__IdSet = __webpack_exports__.wpC;
|
|
16089
|
+
var __webpack_exports__IfBuilder = __webpack_exports__.Zmv;
|
|
16090
|
+
var __webpack_exports__JsonTranslator = __webpack_exports__.d0y;
|
|
16091
|
+
var __webpack_exports__LOG_LEVELS = __webpack_exports__.p_D;
|
|
16092
|
+
var __webpack_exports__MEMORY_EXECUTION_EXPLANATIONS = __webpack_exports__.gHt;
|
|
16093
|
+
var __webpack_exports__MemoryDataCollection = __webpack_exports__._v8;
|
|
16094
|
+
var __webpack_exports__NotParsableExpression = __webpack_exports__.SCB;
|
|
16095
|
+
var __webpack_exports__ObjectBuilder = __webpack_exports__.Tlv;
|
|
16096
|
+
var __webpack_exports__OperatorExpression = __webpack_exports__.fw9;
|
|
16097
|
+
var __webpack_exports__OptimisticConcurrencyError = __webpack_exports__.VTd;
|
|
16098
|
+
var __webpack_exports__PluginDestroyedError = __webpack_exports__.fLe;
|
|
16099
|
+
var __webpack_exports__PluginEventResult = __webpack_exports__.DqV;
|
|
16100
|
+
var __webpack_exports__PropertyExpression = __webpack_exports__.epV;
|
|
16101
|
+
var __webpack_exports__PropertyInfo = __webpack_exports__.KC5;
|
|
16102
|
+
var __webpack_exports__Query = __webpack_exports__.XKQ;
|
|
16103
|
+
var __webpack_exports__QueryOptionsCollection = __webpack_exports__.HMh;
|
|
16104
|
+
var __webpack_exports__QueryOrdering = __webpack_exports__.ptB;
|
|
16105
|
+
var __webpack_exports__RawBuilder = __webpack_exports__.qYY;
|
|
16106
|
+
var __webpack_exports__ReadonlySchemaCollection = __webpack_exports__.g5v;
|
|
16107
|
+
var __webpack_exports__Result = __webpack_exports__.Q7C;
|
|
16108
|
+
var __webpack_exports__RetryDbPlugin = __webpack_exports__.QBn;
|
|
16109
|
+
var __webpack_exports__SchemaArray = __webpack_exports__.Fn9;
|
|
16110
|
+
var __webpack_exports__SchemaBase = __webpack_exports__.FRo;
|
|
16111
|
+
var __webpack_exports__SchemaBoolean = __webpack_exports__.w_n;
|
|
14042
16112
|
var __webpack_exports__SchemaCollection = __webpack_exports__.wM;
|
|
14043
|
-
var __webpack_exports__SchemaComputed = __webpack_exports__.
|
|
14044
|
-
var __webpack_exports__SchemaDate = __webpack_exports__.
|
|
14045
|
-
var __webpack_exports__SchemaDefault = __webpack_exports__.
|
|
14046
|
-
var __webpack_exports__SchemaDefinition = __webpack_exports__.
|
|
14047
|
-
var __webpack_exports__SchemaDeserialize = __webpack_exports__.
|
|
14048
|
-
var __webpack_exports__SchemaDistinct = __webpack_exports__.
|
|
14049
|
-
var __webpack_exports__SchemaError = __webpack_exports__.
|
|
14050
|
-
var __webpack_exports__SchemaFile = __webpack_exports__.
|
|
14051
|
-
var __webpack_exports__SchemaForeignKey = __webpack_exports__.
|
|
14052
|
-
var __webpack_exports__SchemaFrom = __webpack_exports__.
|
|
14053
|
-
var __webpack_exports__SchemaFunction = __webpack_exports__.
|
|
16113
|
+
var __webpack_exports__SchemaComputed = __webpack_exports__.r5d;
|
|
16114
|
+
var __webpack_exports__SchemaDate = __webpack_exports__.Qc7;
|
|
16115
|
+
var __webpack_exports__SchemaDefault = __webpack_exports__.l5B;
|
|
16116
|
+
var __webpack_exports__SchemaDefinition = __webpack_exports__.dFF;
|
|
16117
|
+
var __webpack_exports__SchemaDeserialize = __webpack_exports__.pyz;
|
|
16118
|
+
var __webpack_exports__SchemaDistinct = __webpack_exports__._tD;
|
|
16119
|
+
var __webpack_exports__SchemaError = __webpack_exports__.ArK;
|
|
16120
|
+
var __webpack_exports__SchemaFile = __webpack_exports__.CgF;
|
|
16121
|
+
var __webpack_exports__SchemaForeignKey = __webpack_exports__.z9H;
|
|
16122
|
+
var __webpack_exports__SchemaFrom = __webpack_exports__.AYs;
|
|
16123
|
+
var __webpack_exports__SchemaFunction = __webpack_exports__._h8;
|
|
14054
16124
|
var __webpack_exports__SchemaIdentity = __webpack_exports__.qQ;
|
|
14055
|
-
var __webpack_exports__SchemaIndex = __webpack_exports__.
|
|
14056
|
-
var __webpack_exports__SchemaKey = __webpack_exports__.
|
|
14057
|
-
var __webpack_exports__SchemaNullable = __webpack_exports__.
|
|
14058
|
-
var __webpack_exports__SchemaNumber = __webpack_exports__.
|
|
14059
|
-
var __webpack_exports__SchemaObject = __webpack_exports__.
|
|
14060
|
-
var __webpack_exports__SchemaOptional = __webpack_exports__.
|
|
14061
|
-
var __webpack_exports__SchemaPersistChanges = __webpack_exports__.$
|
|
14062
|
-
var __webpack_exports__SchemaPersistResult = __webpack_exports__.
|
|
14063
|
-
var __webpack_exports__SchemaReadonly = __webpack_exports__.
|
|
14064
|
-
var __webpack_exports__SchemaSearchable = __webpack_exports__.
|
|
14065
|
-
var __webpack_exports__SchemaSerialize = __webpack_exports__.
|
|
14066
|
-
var __webpack_exports__SchemaString = __webpack_exports__.
|
|
14067
|
-
var __webpack_exports__SchemaTag = __webpack_exports__.
|
|
14068
|
-
var __webpack_exports__SchemaTracked = __webpack_exports__.
|
|
14069
|
-
var __webpack_exports__SchemaTransform = __webpack_exports__.
|
|
14070
|
-
var __webpack_exports__SchemaTypes = __webpack_exports__.
|
|
14071
|
-
var __webpack_exports__SchemaVector = __webpack_exports__.
|
|
14072
|
-
var __webpack_exports__SlotBlock = __webpack_exports__.
|
|
14073
|
-
var __webpack_exports__SqlTranslator = __webpack_exports__.
|
|
14074
|
-
var __webpack_exports__StringBuilder = __webpack_exports__.
|
|
16125
|
+
var __webpack_exports__SchemaIndex = __webpack_exports__.kEY;
|
|
16126
|
+
var __webpack_exports__SchemaKey = __webpack_exports__.z1W;
|
|
16127
|
+
var __webpack_exports__SchemaNullable = __webpack_exports__.hdC;
|
|
16128
|
+
var __webpack_exports__SchemaNumber = __webpack_exports__.PGb;
|
|
16129
|
+
var __webpack_exports__SchemaObject = __webpack_exports__.heW;
|
|
16130
|
+
var __webpack_exports__SchemaOptional = __webpack_exports__.ixs;
|
|
16131
|
+
var __webpack_exports__SchemaPersistChanges = __webpack_exports__.$EW;
|
|
16132
|
+
var __webpack_exports__SchemaPersistResult = __webpack_exports__.R7L;
|
|
16133
|
+
var __webpack_exports__SchemaReadonly = __webpack_exports__.wtA;
|
|
16134
|
+
var __webpack_exports__SchemaSearchable = __webpack_exports__.geP;
|
|
16135
|
+
var __webpack_exports__SchemaSerialize = __webpack_exports__.CWQ;
|
|
16136
|
+
var __webpack_exports__SchemaString = __webpack_exports__.XMU;
|
|
16137
|
+
var __webpack_exports__SchemaTag = __webpack_exports__.yVU;
|
|
16138
|
+
var __webpack_exports__SchemaTracked = __webpack_exports__.IBA;
|
|
16139
|
+
var __webpack_exports__SchemaTransform = __webpack_exports__.g_q;
|
|
16140
|
+
var __webpack_exports__SchemaTypes = __webpack_exports__.L8V;
|
|
16141
|
+
var __webpack_exports__SchemaVector = __webpack_exports__.TFx;
|
|
16142
|
+
var __webpack_exports__SlotBlock = __webpack_exports__.E2X;
|
|
16143
|
+
var __webpack_exports__SqlTranslator = __webpack_exports__.DFQ;
|
|
16144
|
+
var __webpack_exports__StringBuilder = __webpack_exports__.feB;
|
|
14075
16145
|
var __webpack_exports__SyncronousQueue = __webpack_exports__.hq;
|
|
14076
|
-
var __webpack_exports__TagCollection = __webpack_exports__.
|
|
14077
|
-
var __webpack_exports__TelemetryDbPlugin = __webpack_exports__.
|
|
14078
|
-
var __webpack_exports__TrampolinePipeline = __webpack_exports__.
|
|
14079
|
-
var __webpack_exports__TranslatedArrayValue = __webpack_exports__.
|
|
14080
|
-
var __webpack_exports__TranslatedGroupValue = __webpack_exports__.
|
|
14081
|
-
var __webpack_exports__TranslatedSingleValue = __webpack_exports__.
|
|
14082
|
-
var __webpack_exports__TupleTranslator = __webpack_exports__.
|
|
14083
|
-
var
|
|
14084
|
-
var
|
|
14085
|
-
var
|
|
14086
|
-
var
|
|
14087
|
-
var
|
|
14088
|
-
var
|
|
14089
|
-
var
|
|
14090
|
-
var
|
|
14091
|
-
var
|
|
14092
|
-
var
|
|
14093
|
-
var
|
|
14094
|
-
var
|
|
14095
|
-
var
|
|
14096
|
-
var
|
|
14097
|
-
var
|
|
14098
|
-
var
|
|
14099
|
-
var
|
|
14100
|
-
var
|
|
14101
|
-
var
|
|
14102
|
-
var
|
|
14103
|
-
var
|
|
14104
|
-
var
|
|
14105
|
-
var
|
|
14106
|
-
var
|
|
14107
|
-
var
|
|
14108
|
-
var
|
|
14109
|
-
var
|
|
14110
|
-
var
|
|
14111
|
-
var
|
|
14112
|
-
var
|
|
14113
|
-
var
|
|
14114
|
-
var
|
|
14115
|
-
var
|
|
14116
|
-
var
|
|
14117
|
-
var
|
|
14118
|
-
var
|
|
14119
|
-
var
|
|
14120
|
-
var
|
|
14121
|
-
var
|
|
14122
|
-
var
|
|
14123
|
-
var
|
|
14124
|
-
var
|
|
14125
|
-
var
|
|
14126
|
-
var
|
|
14127
|
-
var
|
|
14128
|
-
var
|
|
14129
|
-
var
|
|
14130
|
-
var
|
|
14131
|
-
var
|
|
14132
|
-
var
|
|
14133
|
-
var
|
|
14134
|
-
var
|
|
14135
|
-
var
|
|
14136
|
-
var
|
|
14137
|
-
var
|
|
14138
|
-
var
|
|
14139
|
-
var
|
|
14140
|
-
var
|
|
14141
|
-
var
|
|
14142
|
-
var
|
|
14143
|
-
var
|
|
16146
|
+
var __webpack_exports__TagCollection = __webpack_exports__.r4y;
|
|
16147
|
+
var __webpack_exports__TelemetryDbPlugin = __webpack_exports__.Pr0;
|
|
16148
|
+
var __webpack_exports__TrampolinePipeline = __webpack_exports__.kXy;
|
|
16149
|
+
var __webpack_exports__TranslatedArrayValue = __webpack_exports__.xwG;
|
|
16150
|
+
var __webpack_exports__TranslatedGroupValue = __webpack_exports__.f27;
|
|
16151
|
+
var __webpack_exports__TranslatedSingleValue = __webpack_exports__.IbH;
|
|
16152
|
+
var __webpack_exports__TupleTranslator = __webpack_exports__.jOn;
|
|
16153
|
+
var __webpack_exports__UNRESOLVED = __webpack_exports__.gm4;
|
|
16154
|
+
var __webpack_exports__ValueExpression = __webpack_exports__.Ko2;
|
|
16155
|
+
var __webpack_exports__VariableBuilder = __webpack_exports__.otk;
|
|
16156
|
+
var __webpack_exports__WorkPipeline = __webpack_exports__.UQ$;
|
|
16157
|
+
var __webpack_exports__applyInnerOptions = __webpack_exports__.VWF;
|
|
16158
|
+
var __webpack_exports__assertDate = __webpack_exports__.dpe;
|
|
16159
|
+
var __webpack_exports__assertInstanceOf = __webpack_exports__.nni;
|
|
16160
|
+
var __webpack_exports__assertIsArray = __webpack_exports__.ysd;
|
|
16161
|
+
var __webpack_exports__assertIsNotNull = __webpack_exports__.jf6;
|
|
16162
|
+
var __webpack_exports__assertIsNumber = __webpack_exports__.Ye2;
|
|
16163
|
+
var __webpack_exports__assertString = __webpack_exports__.Cv0;
|
|
16164
|
+
var __webpack_exports__cast = __webpack_exports__.wgE;
|
|
16165
|
+
var __webpack_exports__childrenOf = __webpack_exports__.LUe;
|
|
16166
|
+
var __webpack_exports__clone = __webpack_exports__.o8B;
|
|
16167
|
+
var __webpack_exports__collectingSink = __webpack_exports__.wN$;
|
|
16168
|
+
var __webpack_exports__combineExpressions = __webpack_exports__.pgI;
|
|
16169
|
+
var __webpack_exports__combineQueryOptionsCollections = __webpack_exports__.N82;
|
|
16170
|
+
var __webpack_exports__compiledSchemaToJsonSchema = __webpack_exports__.VGm;
|
|
16171
|
+
var __webpack_exports__cosineDistance = __webpack_exports__.lOZ;
|
|
16172
|
+
var __webpack_exports__createRequestHandler = __webpack_exports__.KB4;
|
|
16173
|
+
var __webpack_exports__createStandardJsonSchemaProps = __webpack_exports__.hMR;
|
|
16174
|
+
var __webpack_exports__describeFilterAsJs = __webpack_exports__.fpB;
|
|
16175
|
+
var __webpack_exports__describeFilters = __webpack_exports__.To4;
|
|
16176
|
+
var __webpack_exports__describeUnparsableFilter = __webpack_exports__.B2$;
|
|
16177
|
+
var __webpack_exports__deserializeBulkPersist = __webpack_exports__.Mrv;
|
|
16178
|
+
var __webpack_exports__deserializePersistResult = __webpack_exports__.PlD;
|
|
16179
|
+
var __webpack_exports__deserializeQueryOptions = __webpack_exports__.IIj;
|
|
16180
|
+
var __webpack_exports__distinctJoinKeys = __webpack_exports__.RKi;
|
|
16181
|
+
var __webpack_exports__evaluate = __webpack_exports__._3z;
|
|
16182
|
+
var __webpack_exports__executeJoin = __webpack_exports__.m6g;
|
|
16183
|
+
var __webpack_exports__executedQueriesOf = __webpack_exports__.fNp;
|
|
16184
|
+
var __webpack_exports__explainQuery = __webpack_exports__.aeS;
|
|
16185
|
+
var __webpack_exports__extractTypeInfo = __webpack_exports__.OdT;
|
|
16186
|
+
var __webpack_exports__fastHash = __webpack_exports__.Nrn;
|
|
16187
|
+
var __webpack_exports__foldConstantCalls = __webpack_exports__.F5D;
|
|
16188
|
+
var __webpack_exports__foldedOperandValue = __webpack_exports__.brM;
|
|
16189
|
+
var __webpack_exports__forEach = __webpack_exports__.jJl;
|
|
16190
|
+
var __webpack_exports__formatExplanation = __webpack_exports__.vZg;
|
|
16191
|
+
var __webpack_exports__getLogLevel = __webpack_exports__.XML;
|
|
16192
|
+
var __webpack_exports__getProperties = __webpack_exports__.oYS;
|
|
16193
|
+
var __webpack_exports__hasPrimitiveElements = __webpack_exports__.LLS;
|
|
16194
|
+
var __webpack_exports__hash = __webpack_exports__.tWU;
|
|
16195
|
+
var __webpack_exports__hashJoin = __webpack_exports__.Bg1;
|
|
16196
|
+
var __webpack_exports__isArrayValued = __webpack_exports__.ly4;
|
|
16197
|
+
var __webpack_exports__isCallExpression = __webpack_exports__.fmL;
|
|
16198
|
+
var __webpack_exports__isComparatorExpression = __webpack_exports__.xHv;
|
|
16199
|
+
var __webpack_exports__isDatabaseStep = __webpack_exports__.yXq;
|
|
16200
|
+
var __webpack_exports__isDate = __webpack_exports__.$PY;
|
|
16201
|
+
var __webpack_exports__isEmptyExpression = __webpack_exports__.wL$;
|
|
16202
|
+
var __webpack_exports__isExpression = __webpack_exports__.BHS;
|
|
16203
|
+
var __webpack_exports__isLogLevelEnabled = __webpack_exports__.MiC;
|
|
16204
|
+
var __webpack_exports__isNodeRuntime = __webpack_exports__.tXs;
|
|
16205
|
+
var __webpack_exports__isNotParsableExpression = __webpack_exports__.AFm;
|
|
16206
|
+
var __webpack_exports__isOperatorExpression = __webpack_exports__.vgl;
|
|
16207
|
+
var __webpack_exports__isPropertyExpression = __webpack_exports__.e3n;
|
|
16208
|
+
var __webpack_exports__isValueExpression = __webpack_exports__.S6v;
|
|
16209
|
+
var __webpack_exports__joinInPlugin = __webpack_exports__.zHw;
|
|
16210
|
+
var __webpack_exports__loadJoinInnerSide = __webpack_exports__.asd;
|
|
16211
|
+
var __webpack_exports__logger = __webpack_exports__.vF5;
|
|
16212
|
+
var __webpack_exports__loggerSink = __webpack_exports__.qjC;
|
|
16213
|
+
var __webpack_exports__mappedResultColumns = __webpack_exports__._1B;
|
|
16214
|
+
var __webpack_exports__measure = __webpack_exports__.xP1;
|
|
16215
|
+
var __webpack_exports__nearestBy = __webpack_exports__.iGi;
|
|
16216
|
+
var __webpack_exports__noop = __webpack_exports__.lQ1;
|
|
16217
|
+
var __webpack_exports__now = __webpack_exports__.tB5;
|
|
16218
|
+
var __webpack_exports__operandValue = __webpack_exports__.Vv5;
|
|
16219
|
+
var __webpack_exports__parameter = __webpack_exports__.Wif;
|
|
16220
|
+
var __webpack_exports__parameteriseDocument = __webpack_exports__.i1p;
|
|
16221
|
+
var __webpack_exports__parseFragment = __webpack_exports__.oHM;
|
|
16222
|
+
var __webpack_exports__peelCalls = __webpack_exports__.CCQ;
|
|
16223
|
+
var __webpack_exports__propertyInfoToJsonSchema = __webpack_exports__.UXe;
|
|
16224
|
+
var __webpack_exports__readJoinKey = __webpack_exports__.qyv;
|
|
16225
|
+
var __webpack_exports__rehydrateSchemaFromJsonSchema = __webpack_exports__.L$j;
|
|
16226
|
+
var __webpack_exports__rehydrateSchemaFromJsonString = __webpack_exports__.Dkq;
|
|
16227
|
+
var __webpack_exports__renderCallAsJs = __webpack_exports__.axV;
|
|
16228
|
+
var __webpack_exports__resetLogLevel = __webpack_exports__.Cgm;
|
|
16229
|
+
var __webpack_exports__resolveBulkPersistChanges = __webpack_exports__.apy;
|
|
14144
16230
|
var __webpack_exports__s = __webpack_exports__.s;
|
|
14145
|
-
var __webpack_exports__semiJoinFilter = __webpack_exports__.
|
|
14146
|
-
var __webpack_exports__serializeBulkPersist = __webpack_exports__.
|
|
14147
|
-
var __webpack_exports__serializePersistResult = __webpack_exports__.
|
|
14148
|
-
var __webpack_exports__serializeQueryOptions = __webpack_exports__.
|
|
14149
|
-
var __webpack_exports__setLogLevel = __webpack_exports__.
|
|
14150
|
-
var __webpack_exports__splitSendableOptions = __webpack_exports__.
|
|
14151
|
-
var __webpack_exports__stringifyObject = __webpack_exports__.
|
|
14152
|
-
var __webpack_exports__toEntityShape = __webpack_exports__.
|
|
14153
|
-
var __webpack_exports__toEventArray = __webpack_exports__.
|
|
14154
|
-
var __webpack_exports__toExpression = __webpack_exports__.
|
|
14155
|
-
var __webpack_exports__toMap = __webpack_exports__.
|
|
14156
|
-
var __webpack_exports__toPredicate = __webpack_exports__.
|
|
14157
|
-
var __webpack_exports__toPromise = __webpack_exports__.
|
|
14158
|
-
var __webpack_exports__toStrictPredicate = __webpack_exports__.
|
|
14159
|
-
var __webpack_exports__unsafeCast = __webpack_exports__.
|
|
14160
|
-
var __webpack_exports__uuid = __webpack_exports__.
|
|
14161
|
-
var __webpack_exports__uuidv4 = __webpack_exports__.
|
|
14162
|
-
var __webpack_exports__withExecutedQueries = __webpack_exports__.
|
|
14163
|
-
|
|
16231
|
+
var __webpack_exports__semiJoinFilter = __webpack_exports__.lAq;
|
|
16232
|
+
var __webpack_exports__serializeBulkPersist = __webpack_exports__.naN;
|
|
16233
|
+
var __webpack_exports__serializePersistResult = __webpack_exports__.yRE;
|
|
16234
|
+
var __webpack_exports__serializeQueryOptions = __webpack_exports__.BLm;
|
|
16235
|
+
var __webpack_exports__setLogLevel = __webpack_exports__.He0;
|
|
16236
|
+
var __webpack_exports__splitSendableOptions = __webpack_exports__.PPB;
|
|
16237
|
+
var __webpack_exports__stringifyObject = __webpack_exports__.Zm6;
|
|
16238
|
+
var __webpack_exports__toEntityShape = __webpack_exports__.__t;
|
|
16239
|
+
var __webpack_exports__toEventArray = __webpack_exports__.VgV;
|
|
16240
|
+
var __webpack_exports__toExpression = __webpack_exports__.MYx;
|
|
16241
|
+
var __webpack_exports__toMap = __webpack_exports__.avB;
|
|
16242
|
+
var __webpack_exports__toPredicate = __webpack_exports__.Vup;
|
|
16243
|
+
var __webpack_exports__toPromise = __webpack_exports__.hqX;
|
|
16244
|
+
var __webpack_exports__toStrictPredicate = __webpack_exports__.wSV;
|
|
16245
|
+
var __webpack_exports__unsafeCast = __webpack_exports__.szu;
|
|
16246
|
+
var __webpack_exports__uuid = __webpack_exports__.uRe;
|
|
16247
|
+
var __webpack_exports__uuidv4 = __webpack_exports__.gZm;
|
|
16248
|
+
var __webpack_exports__withExecutedQueries = __webpack_exports__.KgE;
|
|
16249
|
+
var __webpack_exports__withInnerSide = __webpack_exports__.oJY;
|
|
16250
|
+
export { __webpack_exports__AndBuilder as AndBuilder, __webpack_exports__ArrayBuilder as ArrayBuilder, __webpack_exports__AssignmentBuilder as AssignmentBuilder, __webpack_exports__BatchingDbPlugin as BatchingDbPlugin, __webpack_exports__Block as Block, __webpack_exports__BulkPersistChanges as BulkPersistChanges, __webpack_exports__BulkPersistResult as BulkPersistResult, __webpack_exports__CALL_SOURCE as CALL_SOURCE, __webpack_exports__CacheDbPlugin as CacheDbPlugin, __webpack_exports__CallExpression as CallExpression, __webpack_exports__CodeBuilder as CodeBuilder, __webpack_exports__ComparatorExpression as ComparatorExpression, __webpack_exports__ConcurrencyDbPlugin as ConcurrencyDbPlugin, __webpack_exports__ContainerBlock as ContainerBlock, __webpack_exports__DATABASE_EXECUTION_EXPLANATIONS as DATABASE_EXECUTION_EXPLANATIONS, __webpack_exports__DEFAULT_SEMI_JOIN_KEY_THRESHOLD as DEFAULT_SEMI_JOIN_KEY_THRESHOLD, __webpack_exports__DataTranslator as DataTranslator, __webpack_exports__EXECUTED_QUERIES_UNSUPPORTED as EXECUTED_QUERIES_UNSUPPORTED, __webpack_exports__EXPRESSION_TYPES as EXPRESSION_TYPES, __webpack_exports__EmptyExpression as EmptyExpression, __webpack_exports__EphemeralDataPlugin as EphemeralDataPlugin, __webpack_exports__Expression as Expression, __webpack_exports__FOLDABLE as FOLDABLE, __webpack_exports__FunctionBuilder as FunctionBuilder, __webpack_exports__FunctionFactoryBuilder as FunctionFactoryBuilder, __webpack_exports__HashType as HashType, __webpack_exports__IdSet as IdSet, __webpack_exports__IfBuilder as IfBuilder, __webpack_exports__JsonTranslator as JsonTranslator, __webpack_exports__LOG_LEVELS as LOG_LEVELS, __webpack_exports__MEMORY_EXECUTION_EXPLANATIONS as MEMORY_EXECUTION_EXPLANATIONS, __webpack_exports__MemoryDataCollection as MemoryDataCollection, __webpack_exports__NotParsableExpression as NotParsableExpression, __webpack_exports__ObjectBuilder as ObjectBuilder, __webpack_exports__OperatorExpression as OperatorExpression, __webpack_exports__OptimisticConcurrencyError as OptimisticConcurrencyError, __webpack_exports__PluginDestroyedError as PluginDestroyedError, __webpack_exports__PluginEventResult as PluginEventResult, __webpack_exports__PropertyExpression as PropertyExpression, __webpack_exports__PropertyInfo as PropertyInfo, __webpack_exports__Query as Query, __webpack_exports__QueryOptionsCollection as QueryOptionsCollection, __webpack_exports__QueryOrdering as QueryOrdering, __webpack_exports__RawBuilder as RawBuilder, __webpack_exports__ReadonlySchemaCollection as ReadonlySchemaCollection, __webpack_exports__Result as Result, __webpack_exports__RetryDbPlugin as RetryDbPlugin, __webpack_exports__SchemaArray as SchemaArray, __webpack_exports__SchemaBase as SchemaBase, __webpack_exports__SchemaBoolean as SchemaBoolean, __webpack_exports__SchemaCollection as SchemaCollection, __webpack_exports__SchemaComputed as SchemaComputed, __webpack_exports__SchemaDate as SchemaDate, __webpack_exports__SchemaDefault as SchemaDefault, __webpack_exports__SchemaDefinition as SchemaDefinition, __webpack_exports__SchemaDeserialize as SchemaDeserialize, __webpack_exports__SchemaDistinct as SchemaDistinct, __webpack_exports__SchemaError as SchemaError, __webpack_exports__SchemaFile as SchemaFile, __webpack_exports__SchemaForeignKey as SchemaForeignKey, __webpack_exports__SchemaFrom as SchemaFrom, __webpack_exports__SchemaFunction as SchemaFunction, __webpack_exports__SchemaIdentity as SchemaIdentity, __webpack_exports__SchemaIndex as SchemaIndex, __webpack_exports__SchemaKey as SchemaKey, __webpack_exports__SchemaNullable as SchemaNullable, __webpack_exports__SchemaNumber as SchemaNumber, __webpack_exports__SchemaObject as SchemaObject, __webpack_exports__SchemaOptional as SchemaOptional, __webpack_exports__SchemaPersistChanges as SchemaPersistChanges, __webpack_exports__SchemaPersistResult as SchemaPersistResult, __webpack_exports__SchemaReadonly as SchemaReadonly, __webpack_exports__SchemaSearchable as SchemaSearchable, __webpack_exports__SchemaSerialize as SchemaSerialize, __webpack_exports__SchemaString as SchemaString, __webpack_exports__SchemaTag as SchemaTag, __webpack_exports__SchemaTracked as SchemaTracked, __webpack_exports__SchemaTransform as SchemaTransform, __webpack_exports__SchemaTypes as SchemaTypes, __webpack_exports__SchemaVector as SchemaVector, __webpack_exports__SlotBlock as SlotBlock, __webpack_exports__SqlTranslator as SqlTranslator, __webpack_exports__StringBuilder as StringBuilder, __webpack_exports__SyncronousQueue as SyncronousQueue, __webpack_exports__TagCollection as TagCollection, __webpack_exports__TelemetryDbPlugin as TelemetryDbPlugin, __webpack_exports__TrampolinePipeline as TrampolinePipeline, __webpack_exports__TranslatedArrayValue as TranslatedArrayValue, __webpack_exports__TranslatedGroupValue as TranslatedGroupValue, __webpack_exports__TranslatedSingleValue as TranslatedSingleValue, __webpack_exports__TupleTranslator as TupleTranslator, __webpack_exports__UNRESOLVED as UNRESOLVED, __webpack_exports__ValueExpression as ValueExpression, __webpack_exports__VariableBuilder as VariableBuilder, __webpack_exports__WorkPipeline as WorkPipeline, __webpack_exports__applyInnerOptions as applyInnerOptions, __webpack_exports__assertDate as assertDate, __webpack_exports__assertInstanceOf as assertInstanceOf, __webpack_exports__assertIsArray as assertIsArray, __webpack_exports__assertIsNotNull as assertIsNotNull, __webpack_exports__assertIsNumber as assertIsNumber, __webpack_exports__assertString as assertString, __webpack_exports__cast as cast, __webpack_exports__childrenOf as childrenOf, __webpack_exports__clone as clone, __webpack_exports__collectingSink as collectingSink, __webpack_exports__combineExpressions as combineExpressions, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__compiledSchemaToJsonSchema as compiledSchemaToJsonSchema, __webpack_exports__cosineDistance as cosineDistance, __webpack_exports__createRequestHandler as createRequestHandler, __webpack_exports__createStandardJsonSchemaProps as createStandardJsonSchemaProps, __webpack_exports__describeFilterAsJs as describeFilterAsJs, __webpack_exports__describeFilters as describeFilters, __webpack_exports__describeUnparsableFilter as describeUnparsableFilter, __webpack_exports__deserializeBulkPersist as deserializeBulkPersist, __webpack_exports__deserializePersistResult as deserializePersistResult, __webpack_exports__deserializeQueryOptions as deserializeQueryOptions, __webpack_exports__distinctJoinKeys as distinctJoinKeys, __webpack_exports__evaluate as evaluate, __webpack_exports__executeJoin as executeJoin, __webpack_exports__executedQueriesOf as executedQueriesOf, __webpack_exports__explainQuery as explainQuery, __webpack_exports__extractTypeInfo as extractTypeInfo, __webpack_exports__fastHash as fastHash, __webpack_exports__foldConstantCalls as foldConstantCalls, __webpack_exports__foldedOperandValue as foldedOperandValue, __webpack_exports__forEach as forEach, __webpack_exports__formatExplanation as formatExplanation, __webpack_exports__getLogLevel as getLogLevel, __webpack_exports__getProperties as getProperties, __webpack_exports__hasPrimitiveElements as hasPrimitiveElements, __webpack_exports__hash as hash, __webpack_exports__hashJoin as hashJoin, __webpack_exports__isArrayValued as isArrayValued, __webpack_exports__isCallExpression as isCallExpression, __webpack_exports__isComparatorExpression as isComparatorExpression, __webpack_exports__isDatabaseStep as isDatabaseStep, __webpack_exports__isDate as isDate, __webpack_exports__isEmptyExpression as isEmptyExpression, __webpack_exports__isExpression as isExpression, __webpack_exports__isLogLevelEnabled as isLogLevelEnabled, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__isNotParsableExpression as isNotParsableExpression, __webpack_exports__isOperatorExpression as isOperatorExpression, __webpack_exports__isPropertyExpression as isPropertyExpression, __webpack_exports__isValueExpression as isValueExpression, __webpack_exports__joinInPlugin as joinInPlugin, __webpack_exports__loadJoinInnerSide as loadJoinInnerSide, __webpack_exports__logger as logger, __webpack_exports__loggerSink as loggerSink, __webpack_exports__mappedResultColumns as mappedResultColumns, __webpack_exports__measure as measure, __webpack_exports__nearestBy as nearestBy, __webpack_exports__noop as noop, __webpack_exports__now as now, __webpack_exports__operandValue as operandValue, __webpack_exports__parameter as parameter, __webpack_exports__parameteriseDocument as parameteriseDocument, __webpack_exports__parseFragment as parseFragment, __webpack_exports__peelCalls as peelCalls, __webpack_exports__propertyInfoToJsonSchema as propertyInfoToJsonSchema, __webpack_exports__readJoinKey as readJoinKey, __webpack_exports__rehydrateSchemaFromJsonSchema as rehydrateSchemaFromJsonSchema, __webpack_exports__rehydrateSchemaFromJsonString as rehydrateSchemaFromJsonString, __webpack_exports__renderCallAsJs as renderCallAsJs, __webpack_exports__resetLogLevel as resetLogLevel, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__s as s, __webpack_exports__semiJoinFilter as semiJoinFilter, __webpack_exports__serializeBulkPersist as serializeBulkPersist, __webpack_exports__serializePersistResult as serializePersistResult, __webpack_exports__serializeQueryOptions as serializeQueryOptions, __webpack_exports__setLogLevel as setLogLevel, __webpack_exports__splitSendableOptions as splitSendableOptions, __webpack_exports__stringifyObject as stringifyObject, __webpack_exports__toEntityShape as toEntityShape, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toExpression as toExpression, __webpack_exports__toMap as toMap, __webpack_exports__toPredicate as toPredicate, __webpack_exports__toPromise as toPromise, __webpack_exports__toStrictPredicate as toStrictPredicate, __webpack_exports__unsafeCast as unsafeCast, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4, __webpack_exports__withExecutedQueries as withExecutedQueries, __webpack_exports__withInnerSide as withInnerSide };
|
|
14164
16251
|
|
|
14165
16252
|
//# sourceMappingURL=index.js.map
|