@voltro/database 0.82.0 → 0.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +361 -0
- package/dist/index.d.ts +47 -14
- package/dist/index.js +571 -570
- package/dist/{replaceInProgress-BbN7p1Q-.js → replaceInProgress-Z1aAw3GD.js} +368 -319
- package/dist/sql.d.ts +11 -0
- package/dist/sql.js +1576 -1502
- package/package.json +2 -2
|
@@ -265,7 +265,7 @@ var se = () => new u({
|
|
|
265
265
|
unique: !1,
|
|
266
266
|
hasDefault: !1,
|
|
267
267
|
dropped: !0
|
|
268
|
-
}), ce = (e, t) => {
|
|
268
|
+
}), ce = (e) => Object.keys(e.fields).filter((t) => e.fields[t]?.dropped !== !0), le = (e, t) => {
|
|
269
269
|
if (!Number.isInteger(e) || e <= 0) throw Error(`vector(${String(e)}): dimension must be a positive integer (the embedding length, e.g. vector(1536)).`);
|
|
270
270
|
return new u({
|
|
271
271
|
type: "vector",
|
|
@@ -275,13 +275,13 @@ var se = () => new u({
|
|
|
275
275
|
vectorDim: e,
|
|
276
276
|
vectorPrecision: t?.precision ?? "float32"
|
|
277
277
|
});
|
|
278
|
-
},
|
|
278
|
+
}, ue = (e) => new u({
|
|
279
279
|
type: "array",
|
|
280
280
|
nullable: !1,
|
|
281
281
|
unique: !1,
|
|
282
282
|
hasDefault: !1,
|
|
283
283
|
arrayElement: e.__definition().type
|
|
284
|
-
}),
|
|
284
|
+
}), de = () => d("interval"), fe = (e, t = 4326) => new u({
|
|
285
285
|
type: "text",
|
|
286
286
|
nullable: !1,
|
|
287
287
|
unique: !1,
|
|
@@ -291,7 +291,7 @@ var se = () => new u({
|
|
|
291
291
|
geomKind: e,
|
|
292
292
|
srid: t
|
|
293
293
|
}
|
|
294
|
-
}),
|
|
294
|
+
}), pe = (e, t = 4326) => new u({
|
|
295
295
|
type: "text",
|
|
296
296
|
nullable: !1,
|
|
297
297
|
unique: !1,
|
|
@@ -301,7 +301,7 @@ var se = () => new u({
|
|
|
301
301
|
geomKind: e,
|
|
302
302
|
srid: t
|
|
303
303
|
}
|
|
304
|
-
}),
|
|
304
|
+
}), me = (e) => new u({
|
|
305
305
|
type: "raw",
|
|
306
306
|
nullable: !1,
|
|
307
307
|
unique: !1,
|
|
@@ -311,14 +311,14 @@ var se = () => new u({
|
|
|
311
311
|
let t = {};
|
|
312
312
|
for (let [n, r] of Object.entries(e)) t[n] = r.__definition();
|
|
313
313
|
return t;
|
|
314
|
-
},
|
|
314
|
+
}, he = /* @__PURE__ */ new WeakMap(), ge = (e) => typeof e == "object" && e ? he.get(e) : void 0, _e = (e, t = {}) => {
|
|
315
315
|
let n = p();
|
|
316
|
-
return
|
|
316
|
+
return he.set(n, {
|
|
317
317
|
target: e,
|
|
318
318
|
orphanPolicy: t.orphanPolicy ?? "keep",
|
|
319
319
|
onSoftDelete: t.onSoftDelete ?? !1
|
|
320
320
|
}), n;
|
|
321
|
-
}, w = /* @__PURE__ */ new Map(),
|
|
321
|
+
}, w = /* @__PURE__ */ new Map(), ve = (e, t) => {
|
|
322
322
|
if (t.from === t.to) throw Error(`declareEnumRename('${e}'): \`from\` and \`to\` are both '${t.from}' — a rename must change the value.`);
|
|
323
323
|
let n = w.get(e) ?? [];
|
|
324
324
|
for (let r of n) {
|
|
@@ -326,9 +326,9 @@ var se = () => new u({
|
|
|
326
326
|
if (r.from === t.from && r.to !== t.to) throw Error(`declareEnumRename('${e}'): value '${t.from}' is already declared as renamed to '${r.to}', cannot also rename it to '${t.to}'.`);
|
|
327
327
|
}
|
|
328
328
|
n.push(t), w.set(e, n);
|
|
329
|
-
},
|
|
329
|
+
}, ye = (e) => w.get(e) ?? [], be = () => w, xe = () => {
|
|
330
330
|
w.clear();
|
|
331
|
-
},
|
|
331
|
+
}, Se = (t) => {
|
|
332
332
|
let r = t;
|
|
333
333
|
for (let t = 0; t < 4 && n.isFiberFailure(r); t++) r = e.squash(r[n.FiberFailureCauseId]);
|
|
334
334
|
return r;
|
|
@@ -339,63 +339,63 @@ var se = () => new u({
|
|
|
339
339
|
let o = [];
|
|
340
340
|
for (let e of a.slice(0, 8)) o.push(...T(e, r + 1));
|
|
341
341
|
return o;
|
|
342
|
-
},
|
|
343
|
-
let t = {}, n = [], r =
|
|
342
|
+
}, Ce = (e) => e.dbCode !== void 0 || e.dbErrno !== void 0 || e.dbNumber !== void 0 || e.dbSqlState !== void 0 || e.dbConstraint !== void 0, we = (e) => {
|
|
343
|
+
let t = {}, n = [], r = Se(e);
|
|
344
344
|
for (let e = 0; e < 8 && typeof r == "object" && r; e++) {
|
|
345
345
|
let e = r;
|
|
346
346
|
t.dbCode === void 0 && (typeof e.code == "string" || typeof e.code == "number") && (t.dbCode = e.code), t.dbErrno === void 0 && typeof e.errno == "number" && (t.dbErrno = e.errno), t.dbNumber === void 0 && typeof e.number == "number" && (t.dbNumber = e.number), t.dbSqlState === void 0 && typeof e.sqlState == "string" && (t.dbSqlState = e.sqlState), t.dbBindings === void 0 && typeof e.voltroBindings == "string" && (t.dbBindings = e.voltroBindings), t.dbStatement === void 0 && typeof e.sql == "string" && e.sql.includes("?") && (t.dbStatement = e.sql, t.dbPlaceholders = (e.sql.match(/\?/g) ?? []).length), t.dbFatal === void 0 && typeof e.fatal == "boolean" && (t.dbFatal = e.fatal), t.dbConstraint === void 0 && typeof e.constraint == "string" && (t.dbConstraint = e.constraint), t.dbTable === void 0 && typeof e.table == "string" && (t.dbTable = e.table), t.dbColumn === void 0 && typeof e.column == "string" && (t.dbColumn = e.column), t.dbSchema === void 0 && typeof e.schema == "string" && (t.dbSchema = e.schema);
|
|
347
347
|
let i = e.sqlMessage ?? e.detail;
|
|
348
348
|
t.dbMessage === void 0 && typeof i == "string" && (t.dbMessage = i);
|
|
349
349
|
let a = typeof e.constructor == "function" ? e.constructor.name : void 0, o = typeof e._tag == "string" && e._tag || typeof e.name == "string" && e.name || (typeof a == "string" && a !== "Object" ? a : void 0), s = typeof e.message == "string" ? e.message : void 0;
|
|
350
|
-
(o || s) && n.push(`${o || "Error"}${s ? `: ${s.slice(0, 200)}` : ""}`), r =
|
|
350
|
+
(o || s) && n.push(`${o || "Error"}${s ? `: ${s.slice(0, 200)}` : ""}`), r = Se(e.cause);
|
|
351
351
|
}
|
|
352
352
|
return n.length > 0 && (t.dbCauseChain = n.join(" ← "), t.dbMessage === void 0 && (t.dbMessage = n[n.length - 1])), t;
|
|
353
|
-
},
|
|
354
|
-
let t = T(e).map(
|
|
353
|
+
}, Te = (e) => {
|
|
354
|
+
let t = T(e).map(we);
|
|
355
355
|
if (t.length <= 1) return t[0] ?? {};
|
|
356
|
-
let n = t.find(
|
|
356
|
+
let n = t.find(Ce) ?? t[0], r = t.filter((e) => e !== n).map((e) => e.dbCauseChain).filter((e) => typeof e == "string");
|
|
357
357
|
if (r.length === 0) return n;
|
|
358
358
|
let i = typeof n.dbCauseChain == "string" ? n.dbCauseChain : void 0;
|
|
359
359
|
return {
|
|
360
360
|
...n,
|
|
361
361
|
dbCauseChain: [i, ...r].filter(Boolean).join(" ‖ ")
|
|
362
362
|
};
|
|
363
|
-
},
|
|
364
|
-
let n =
|
|
363
|
+
}, Ee = (e, t) => {
|
|
364
|
+
let n = Oe(e);
|
|
365
365
|
if (n !== void 0) return n;
|
|
366
|
-
let r =
|
|
366
|
+
let r = Te(e), i = Pe(r, t);
|
|
367
367
|
if (i !== void 0) {
|
|
368
368
|
let e = i.constraint ?? i.column;
|
|
369
369
|
return e === void 0 ? i.kind : `${i.kind}: ${e}`;
|
|
370
370
|
}
|
|
371
|
-
let a = r.dbCode ?? r.dbSqlState ?? r.dbErrno ?? r.dbNumber, o =
|
|
372
|
-
return a !== void 0 &&
|
|
373
|
-
},
|
|
371
|
+
let a = r.dbCode ?? r.dbSqlState ?? r.dbErrno ?? r.dbNumber, o = je(e);
|
|
372
|
+
return a !== void 0 && ke.test(String(a)) ? `${o} (${String(a)})` : o;
|
|
373
|
+
}, De = Symbol.for("@voltro/database/authoredMessage"), E = (e, t) => {
|
|
374
374
|
let n = t === void 0 ? Error(e) : Error(e, t);
|
|
375
|
-
return Object.defineProperty(n,
|
|
375
|
+
return Object.defineProperty(n, De, {
|
|
376
376
|
value: !0,
|
|
377
377
|
enumerable: !1
|
|
378
378
|
}), n;
|
|
379
|
-
},
|
|
379
|
+
}, Oe = (e) => {
|
|
380
380
|
for (let t of T(e)) {
|
|
381
381
|
let e = t;
|
|
382
382
|
for (let t = 0; typeof e == "object" && e && t < 8; t += 1) {
|
|
383
|
-
if (e[
|
|
383
|
+
if (e[De] === !0) {
|
|
384
384
|
let t = e.message;
|
|
385
385
|
if (typeof t == "string" && t.length > 0) return t;
|
|
386
386
|
}
|
|
387
387
|
e = e.cause;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
},
|
|
390
|
+
}, ke = /^[A-Za-z0-9_]{1,32}$/, Ae = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/, je = (e) => {
|
|
391
391
|
let t = e?._tag, n = e?.name, r = (typeof t == "string" ? t : typeof n == "string" ? n : "").split(/[^A-Za-z0-9_]+/).filter(Boolean).pop();
|
|
392
|
-
return r !== void 0 &&
|
|
393
|
-
},
|
|
392
|
+
return r !== void 0 && Ae.test(r) ? r : "unknown";
|
|
393
|
+
}, Me = /^[A-Za-z_][A-Za-z0-9_$]*$/, D = (e) => e !== void 0 && e.length <= 128 && Me.test(e) ? e : void 0, Ne = (e) => e === void 0 ? void 0 : e.split(".").pop() ?? e, O = (e, ...t) => {
|
|
394
394
|
for (let n of t) {
|
|
395
395
|
let t = n.exec(e);
|
|
396
396
|
if (t?.[1] !== void 0) return t[1];
|
|
397
397
|
}
|
|
398
|
-
},
|
|
398
|
+
}, Pe = (e, t) => {
|
|
399
399
|
let n = e.dbCode, r = e.dbErrno, i = e.dbNumber, a = typeof e.dbMessage == "string" ? e.dbMessage : "", o = `${typeof e.dbCauseChain == "string" ? e.dbCauseChain : ""} ${a}`;
|
|
400
400
|
if (n === "23503") {
|
|
401
401
|
let t = D(e.dbConstraint);
|
|
@@ -433,7 +433,7 @@ var se = () => new u({
|
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
if (r === 1062) {
|
|
436
|
-
let e = D(
|
|
436
|
+
let e = D(Ne(O(o, /for key '([^']+)'/)));
|
|
437
437
|
return {
|
|
438
438
|
kind: "unique",
|
|
439
439
|
...e === void 0 ? {} : { constraint: e }
|
|
@@ -484,14 +484,14 @@ var se = () => new u({
|
|
|
484
484
|
}
|
|
485
485
|
if (n === "SQLITE_CONSTRAINT_FOREIGNKEY") return { kind: t === "delete" || t === "deleteMany" || t === "hardDelete" ? "foreignKeyInUse" : "foreignKey" };
|
|
486
486
|
if (n === "SQLITE_CONSTRAINT_UNIQUE" || n === "SQLITE_CONSTRAINT_PRIMARYKEY") {
|
|
487
|
-
let e = D(
|
|
487
|
+
let e = D(Ne(O(o, /UNIQUE constraint failed: ([^,\s]+)/)));
|
|
488
488
|
return {
|
|
489
489
|
kind: "unique",
|
|
490
490
|
...e === void 0 ? {} : { column: e }
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
if (n === "SQLITE_CONSTRAINT_NOTNULL") {
|
|
494
|
-
let e = D(
|
|
494
|
+
let e = D(Ne(O(o, /NOT NULL constraint failed: ([^,\s]+)/)));
|
|
495
495
|
return {
|
|
496
496
|
kind: "notNull",
|
|
497
497
|
...e === void 0 ? {} : { column: e }
|
|
@@ -504,20 +504,20 @@ var se = () => new u({
|
|
|
504
504
|
...e === void 0 ? {} : { constraint: e }
|
|
505
505
|
};
|
|
506
506
|
}
|
|
507
|
-
}, Pe = (e) => {
|
|
508
|
-
let t = Ne(e)?.kind;
|
|
509
|
-
return t === "foreignKey" || t === "foreignKeyInUse";
|
|
510
507
|
}, Fe = (e) => {
|
|
508
|
+
let t = Pe(e)?.kind;
|
|
509
|
+
return t === "foreignKey" || t === "foreignKeyInUse";
|
|
510
|
+
}, Ie = (e) => {
|
|
511
511
|
let t = e.dbCode, n = e.dbErrno;
|
|
512
512
|
return t === "57014" || n === 3024 || n === 1969 || t === "ETIMEOUT" || t === "SQLITE_INTERRUPT";
|
|
513
|
-
},
|
|
513
|
+
}, Le = (e) => {
|
|
514
514
|
if (e.dbErrno !== 1366) return;
|
|
515
515
|
let t = `${typeof e.dbCauseChain == "string" ? e.dbCauseChain : ""} ${typeof e.dbMessage == "string" ? e.dbMessage : ""}`;
|
|
516
516
|
if (/Incorrect string value: '\\x(F[0-4])/i.exec(t) === null) return;
|
|
517
517
|
let n = O(t, /for column [`']?(?:[^`'.]+[`']?\.[`']?)*([^`'.]+)[`']? at row/);
|
|
518
518
|
return `${n === void 0 ? "the column" : `column '${n}'`} is stored in a character set that cannot hold a 4-byte character (utf8mb3). Declare the store's character set in app.config.ts — store: { dialect: 'mariadb' | 'mysql', charset: 'utf8mb4' } — and run \`voltro db plan\`: every declared table is created with it and converted to it.`;
|
|
519
|
-
},
|
|
520
|
-
let t =
|
|
519
|
+
}, Re = (e) => {
|
|
520
|
+
let t = Te(e), n = [
|
|
521
521
|
t.dbCode === void 0 ? void 0 : `code=${String(t.dbCode)}`,
|
|
522
522
|
t.dbErrno === void 0 ? void 0 : `errno=${String(t.dbErrno)}`,
|
|
523
523
|
t.dbNumber === void 0 ? void 0 : `number=${String(t.dbNumber)}`,
|
|
@@ -526,9 +526,9 @@ var se = () => new u({
|
|
|
526
526
|
t.dbPlaceholders === void 0 ? void 0 : `placeholders=${String(t.dbPlaceholders)}`
|
|
527
527
|
].filter((e) => e !== void 0), r = typeof e?.message == "string" ? e.message : void 0, i = typeof t.dbMessage == "string" ? t.dbMessage : void 0, a = i === void 0 ? void 0 : n.length > 0 || i !== r && i !== `Error: ${String(r)}` ? i : void 0, o = typeof t.dbBindings == "string" ? `\n bindings: ${t.dbBindings}` : "", s = typeof t.dbStatement == "string" ? `\n statement: ${t.dbStatement.length <= 400 ? t.dbStatement : `${t.dbStatement.slice(0, 400)}…`}` : "";
|
|
528
528
|
if (a === void 0 && n.length === 0) return;
|
|
529
|
-
let c =
|
|
529
|
+
let c = Le(t), l = c === void 0 ? "" : `\n hint: ${c}`;
|
|
530
530
|
return [a, n.length > 0 ? `[${n.join(" ")}]` : void 0].filter((e) => e !== void 0 && e !== "").join(" ") + l + s + o;
|
|
531
|
-
},
|
|
531
|
+
}, ze = (e) => Object.entries(e).map(([e, t]) => `${e}:${Be(t)}`).join(" "), Be = (e) => {
|
|
532
532
|
if (e === null) return "null";
|
|
533
533
|
if (e === void 0) return "undefined";
|
|
534
534
|
if (typeof e == "bigint") return "bigint";
|
|
@@ -538,22 +538,22 @@ var se = () => new u({
|
|
|
538
538
|
if (globalThis.Buffer !== void 0 && globalThis.Buffer.isBuffer(e)) return "Buffer";
|
|
539
539
|
let t = e.constructor?.name;
|
|
540
540
|
return typeof t == "string" && t !== "" ? t : "Object";
|
|
541
|
-
},
|
|
541
|
+
}, Ve = 63, He = 60, k = [], A = (e) => {
|
|
542
542
|
k.includes(e) || k.push(e);
|
|
543
|
-
},
|
|
543
|
+
}, Ue = () => {
|
|
544
544
|
let e = k.slice();
|
|
545
545
|
return k.length = 0, e;
|
|
546
|
-
},
|
|
546
|
+
}, We = /^[a-zA-Z_][a-zA-Z0-9_]*$/, Ge = (e, t) => {
|
|
547
547
|
if (t.length === 0) throw Error(`${e} cannot be empty.`);
|
|
548
|
-
if (!
|
|
548
|
+
if (!We.test(t)) throw Error(`${e} '${t}' contains characters outside [A-Za-z0-9_] or starts with a digit. Dialect-portable identifiers must match /^[a-zA-Z_][a-zA-Z0-9_]*$/.`);
|
|
549
549
|
}, j = (e) => {
|
|
550
|
-
if (
|
|
550
|
+
if (Ge("table name", e), e.length > 63) throw Error(`table name '${e}' is ${e.length} chars — exceeds the 63-byte cross-dialect limit (Postgres floor). Shorten the name; long table names also cascade into auto-named indexes and FK constraints that would themselves exceed the limit.`);
|
|
551
551
|
e.length > 60 && A(`table name '${e}' is ${e.length} chars — ${63 - e.length} from the Postgres 63-byte limit. Auto-named indexes on this table will run out of room fast.`);
|
|
552
552
|
}, M = (e, t) => {
|
|
553
|
-
if (
|
|
553
|
+
if (Ge("column name", t), t.length > 63) throw Error(`column '${t}' on table '${e}' is ${t.length} chars — exceeds the 63-byte cross-dialect limit (Postgres floor). Rename it.`);
|
|
554
554
|
t.length > 60 && A(`column '${t}' on table '${e}' is ${t.length} chars — close to the 63-byte limit.`);
|
|
555
555
|
}, N = (e, t, n, r) => {
|
|
556
|
-
if (
|
|
556
|
+
if (Ge("index name", t), t.length > 63) throw Error(n ? `auto-named index '${t}' on table '${e}' is ${t.length} chars — exceeds the 63-byte cross-dialect limit (Postgres floor). Supply an explicit short name: .index('<shortName>', ${JSON.stringify([...r])}).` : `index name '${t}' on table '${e}' is ${t.length} chars — exceeds the 63-byte cross-dialect limit (Postgres floor). Shorten it.`);
|
|
557
557
|
t.length > 60 && A(`index '${t}' on table '${e}' is ${t.length} chars — ${63 - t.length} from the 63-byte limit. ${n ? `Consider .index('<shortName>', ${JSON.stringify([...r])}) before it grows.` : ""}`);
|
|
558
558
|
}, P = (e, t) => {
|
|
559
559
|
if (e.length === 0) throw Error(`typeid prefix on table '${t.tableName}' cannot be empty.`);
|
|
@@ -566,29 +566,29 @@ var se = () => new u({
|
|
|
566
566
|
throw Error(`typeid prefix '${e}' on table '${t.tableName}' is ${e.length} chars — exceeds the 63-byte limit; ${n}`);
|
|
567
567
|
}
|
|
568
568
|
e.length > 60 && A(`typeid prefix '${e}' on table '${t.tableName}' is ${e.length} chars — close to the 63-byte limit. Generated ids will be even longer (prefix + '_' + 26).`);
|
|
569
|
-
},
|
|
569
|
+
}, Ke = 1704067200000n, qe = 10n, Je = 12n, Ye = (1n << qe) - 1n, Xe = (1n << Je) - 1n, Ze = Je, Qe = 22n, $e = () => {
|
|
570
570
|
let e = process.env.SNOWFLAKE_MACHINE_ID;
|
|
571
571
|
if (e === void 0 || e === "") return 0n;
|
|
572
572
|
let t = BigInt(e);
|
|
573
|
-
if (t < 0n || t >
|
|
573
|
+
if (t < 0n || t > Ye) throw Error(`SNOWFLAKE_MACHINE_ID out of range: ${e}. Must be 0..${Ye}.`);
|
|
574
574
|
return t;
|
|
575
|
-
},
|
|
575
|
+
}, et = () => ({
|
|
576
576
|
lastMs: 0n,
|
|
577
577
|
sequence: 0n,
|
|
578
|
-
machineId:
|
|
579
|
-
}), F,
|
|
580
|
-
F =
|
|
581
|
-
},
|
|
582
|
-
let t =
|
|
583
|
-
for (; t <= e;) t =
|
|
578
|
+
machineId: $e()
|
|
579
|
+
}), F, tt = () => (F === void 0 && (F = et()), F), nt = () => {
|
|
580
|
+
F = et();
|
|
581
|
+
}, rt = () => BigInt(Date.now()), it = (e) => {
|
|
582
|
+
let t = rt();
|
|
583
|
+
for (; t <= e;) t = rt();
|
|
584
584
|
return t;
|
|
585
|
-
},
|
|
586
|
-
let e =
|
|
587
|
-
t === e.lastMs ? (e.sequence = e.sequence + 1n &
|
|
588
|
-
let n = t -
|
|
585
|
+
}, at = () => {
|
|
586
|
+
let e = tt(), t = rt();
|
|
587
|
+
t === e.lastMs ? (e.sequence = e.sequence + 1n & Xe, e.sequence === 0n && (t = it(e.lastMs), e.lastMs = t)) : (e.sequence = 0n, e.lastMs = t);
|
|
588
|
+
let n = t - Ke;
|
|
589
589
|
if (n < 0n) throw Error("Snowflake timestamp before configured epoch (2024-01-01). System clock is wrong.");
|
|
590
|
-
return (n <<
|
|
591
|
-
},
|
|
590
|
+
return (n << Qe | e.machineId << Ze | e.sequence).toString();
|
|
591
|
+
}, ot = (e) => {
|
|
592
592
|
let t = e.toLowerCase();
|
|
593
593
|
if (t.startsWith("_")) throw Error(`cannot derive a typeid prefix for table '${e}' (table names starting with '_' are not valid typeid prefixes). Pick an explicit prefix via id({ prefix: '...' }) or use a different scheme like id({ scheme: 'numeric' }) for internal tables.`);
|
|
594
594
|
if (!/^[a-z][a-z0-9_]*$/.test(t)) throw Error(`cannot derive a typeid prefix from table name '${e}' (must match [a-z][a-z0-9_]*). Pick an explicit prefix via id({ prefix: '...' }).`);
|
|
@@ -597,10 +597,10 @@ var se = () => new u({
|
|
|
597
597
|
kind: "derived",
|
|
598
598
|
tableName: e
|
|
599
599
|
}), n;
|
|
600
|
-
},
|
|
600
|
+
}, st = (e, t) => {
|
|
601
601
|
if (e === void 0) return {
|
|
602
602
|
kind: "typeid",
|
|
603
|
-
prefix:
|
|
603
|
+
prefix: ot(t)
|
|
604
604
|
};
|
|
605
605
|
if ("prefix" in e && !("scheme" in e)) return P(e.prefix, {
|
|
606
606
|
kind: "explicit",
|
|
@@ -612,7 +612,7 @@ var se = () => new u({
|
|
|
612
612
|
if (!("scheme" in e)) throw Error("invalid id() options: no scheme or prefix");
|
|
613
613
|
switch (e.scheme) {
|
|
614
614
|
case "typeid": {
|
|
615
|
-
let n = e.prefix ??
|
|
615
|
+
let n = e.prefix ?? ot(t);
|
|
616
616
|
return e.prefix !== void 0 && P(e.prefix, {
|
|
617
617
|
kind: "explicit",
|
|
618
618
|
tableName: t
|
|
@@ -629,22 +629,22 @@ var se = () => new u({
|
|
|
629
629
|
generate: e.generate
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
|
-
},
|
|
632
|
+
}, ct = (e, t) => {
|
|
633
633
|
switch (e.kind) {
|
|
634
634
|
case "typeid": return i(e.prefix).toString();
|
|
635
635
|
case "ulid": return a();
|
|
636
636
|
case "numeric": return null;
|
|
637
|
-
case "snowflake": return
|
|
637
|
+
case "snowflake": return at();
|
|
638
638
|
case "custom": return e.generate(t);
|
|
639
639
|
}
|
|
640
|
-
},
|
|
640
|
+
}, lt = (e) => ({
|
|
641
641
|
fields: C(e.fields),
|
|
642
642
|
...e.id === void 0 ? {} : { id: e.id },
|
|
643
643
|
...e.requires === void 0 ? {} : { requires: e.requires },
|
|
644
644
|
...e.indexes === void 0 ? {} : { indexes: e.indexes },
|
|
645
645
|
...e.behaviors === void 0 ? {} : { behaviors: e.behaviors },
|
|
646
646
|
...e.policies === void 0 ? {} : { policies: e.policies }
|
|
647
|
-
}),
|
|
647
|
+
}), ut = lt, dt = (e) => {
|
|
648
648
|
let t = /* @__PURE__ */ new Set(), n = [], r = (e) => {
|
|
649
649
|
let i = e.id ?? e;
|
|
650
650
|
if (!t.has(i)) {
|
|
@@ -654,7 +654,7 @@ var se = () => new u({
|
|
|
654
654
|
};
|
|
655
655
|
for (let t of e) r(t);
|
|
656
656
|
return n;
|
|
657
|
-
},
|
|
657
|
+
}, ft = (e, ...t) => {
|
|
658
658
|
if (t.length === 0) throw Error(`jsonIndex("${e}"): at least one path segment is required`);
|
|
659
659
|
let n = (r) => ({
|
|
660
660
|
jsonPath: {
|
|
@@ -665,14 +665,14 @@ var se = () => new u({
|
|
|
665
665
|
numeric: () => n(!0)
|
|
666
666
|
});
|
|
667
667
|
return n(!1);
|
|
668
|
-
},
|
|
668
|
+
}, pt = (e = "cosine", t = "float32") => {
|
|
669
669
|
let n = t === "half" ? "halfvec" : "vector";
|
|
670
670
|
switch (e) {
|
|
671
671
|
case "cosine": return `${n}_cosine_ops`;
|
|
672
672
|
case "l2": return `${n}_l2_ops`;
|
|
673
673
|
case "inner": return `${n}_ip_ops`;
|
|
674
674
|
}
|
|
675
|
-
},
|
|
675
|
+
}, mt = [
|
|
676
676
|
"id",
|
|
677
677
|
"tenantId",
|
|
678
678
|
"createdAt",
|
|
@@ -681,7 +681,7 @@ var se = () => new u({
|
|
|
681
681
|
"updatedBy",
|
|
682
682
|
"deletedAt",
|
|
683
683
|
"deletedBy"
|
|
684
|
-
],
|
|
684
|
+
], ht = (e) => e.id ?? `<anonymous mixin: ${Object.keys(e.fields).join(", ")}>`, gt = (e, t) => `${e}_${t.join("_")}_idx`, _t = (e, t) => `${e}_${t.join("_")}_uq`, vt = (e, t, n, r, i) => {
|
|
685
685
|
if (n !== "hnsw") return;
|
|
686
686
|
if (r.length !== 1) throw Error(`hnsw index '${t}' on table '${e}' must cover exactly one vector column — got ${r.length} fields. pgvector's HNSW access method indexes a single vector column.`);
|
|
687
687
|
let a = r[0];
|
|
@@ -689,11 +689,11 @@ var se = () => new u({
|
|
|
689
689
|
let o = i[a];
|
|
690
690
|
if (o === void 0) throw Error(`hnsw index '${t}' on table '${e}' references unknown column '${a}'.`);
|
|
691
691
|
if (o.type !== "vector") throw Error(`hnsw index '${t}' on table '${e}' requires a vector() column — column '${a}' is '${o.type}'. HNSW is the pgvector approximate-nearest-neighbour method and only applies to vectors.`);
|
|
692
|
-
},
|
|
692
|
+
}, yt = (e, t) => {
|
|
693
693
|
let n;
|
|
694
694
|
for (let [r, i] of Object.entries(e)) i.type === "id" && i.idScheme === void 0 && (n === void 0 && (n = { ...e }), n[r] = {
|
|
695
695
|
...i,
|
|
696
|
-
idScheme:
|
|
696
|
+
idScheme: st(i.idSchemeInput, t)
|
|
697
697
|
});
|
|
698
698
|
return n ?? e;
|
|
699
699
|
}, I = (e) => {
|
|
@@ -737,20 +737,20 @@ var se = () => new u({
|
|
|
737
737
|
});
|
|
738
738
|
}),
|
|
739
739
|
with: ((...t) => {
|
|
740
|
-
let n =
|
|
740
|
+
let n = dt(t), r = { ...e.fields }, i = /* @__PURE__ */ new Map();
|
|
741
741
|
for (let e of Object.keys(r)) i.set(e, {
|
|
742
742
|
id: "<table>",
|
|
743
743
|
fields: {}
|
|
744
744
|
});
|
|
745
745
|
for (let t of n) for (let [n, a] of Object.entries(t.fields)) {
|
|
746
746
|
let o = i.get(n);
|
|
747
|
-
if (o !== void 0) throw Error(`mixin collision on column '${n}' in table '${e.tableName}': '${
|
|
747
|
+
if (o !== void 0) throw Error(`mixin collision on column '${n}' in table '${e.tableName}': '${ht(o)}' and '${ht(t)}' both define it. If they're the same mixin reached via different paths, set a shared 'id' on both. If they're genuinely different concerns, rename one of the columns.`);
|
|
748
748
|
M(e.tableName, n), r[n] = a, i.set(n, t);
|
|
749
749
|
}
|
|
750
750
|
let a = [...e.appliedIndexes];
|
|
751
751
|
for (let t of n) for (let n of t.indexes ?? []) {
|
|
752
|
-
let t = n.name ??
|
|
753
|
-
a.some((e) => e.name === t) || (N(e.tableName, t, n.name === void 0, n.fields),
|
|
752
|
+
let t = n.name ?? gt(e.tableName, n.fields);
|
|
753
|
+
a.some((e) => e.name === t) || (N(e.tableName, t, n.name === void 0, n.fields), vt(e.tableName, t, n.kind, n.fields, r), a.push({
|
|
754
754
|
name: t,
|
|
755
755
|
fields: n.fields,
|
|
756
756
|
...n.kind === void 0 ? {} : { kind: n.kind },
|
|
@@ -774,9 +774,9 @@ var se = () => new u({
|
|
|
774
774
|
}),
|
|
775
775
|
index: ((...t) => {
|
|
776
776
|
let n, r, i, a = Array.isArray(t[0]);
|
|
777
|
-
if (a ? (r = t[0], i = t[1], n =
|
|
777
|
+
if (a ? (r = t[0], i = t[1], n = gt(e.tableName, r)) : (n = t[0], r = t[1], i = t[2]), r.length === 0) throw Error(`index '${n}' on table '${e.tableName}' has no fields — an index must cover at least one column.`);
|
|
778
778
|
let o = r.filter((e) => typeof e == "string");
|
|
779
|
-
if (N(e.tableName, n, a, o),
|
|
779
|
+
if (N(e.tableName, n, a, o), vt(e.tableName, n, i?.kind, r, e.fields), e.appliedIndexes.some((e) => e.name === n)) throw t.length === 1 ? Error(`duplicate auto-named index '${n}' on table '${e.tableName}' — you've called .index(${JSON.stringify(r)}) twice. Pass an explicit name to the second one if both are intended (rare).`) : Error(`duplicate index '${n}' on table '${e.tableName}': each index name must be unique within a table.`);
|
|
780
780
|
return I({
|
|
781
781
|
...e,
|
|
782
782
|
tableName: e.tableName,
|
|
@@ -801,7 +801,7 @@ var se = () => new u({
|
|
|
801
801
|
expressionIndex: ((t, n, r) => {
|
|
802
802
|
if (n.length === 0) throw Error(`expressionIndex '${t}' on table '${e.tableName}' has no fields — an index must cover at least one column or expression.`);
|
|
803
803
|
let i = n.filter((e) => typeof e == "string");
|
|
804
|
-
if (N(e.tableName, t, !1, i),
|
|
804
|
+
if (N(e.tableName, t, !1, i), vt(e.tableName, t, r?.kind, n, e.fields), e.appliedIndexes.some((e) => e.name === t)) throw Error(`duplicate index '${t}' on table '${e.tableName}': each index name must be unique within a table.`);
|
|
805
805
|
return I({
|
|
806
806
|
...e,
|
|
807
807
|
tableName: e.tableName,
|
|
@@ -825,7 +825,7 @@ var se = () => new u({
|
|
|
825
825
|
}),
|
|
826
826
|
unique: ((...t) => {
|
|
827
827
|
let n, r, i, a = Array.isArray(t[0]);
|
|
828
|
-
if (a ? (r = t[0], i = t[1], n =
|
|
828
|
+
if (a ? (r = t[0], i = t[1], n = _t(e.tableName, r)) : (n = t[0], r = t[1], i = t[2]), r.length === 0) throw Error(`unique '${n}' on table '${e.tableName}' has no fields — a UNIQUE constraint must cover at least one column.`);
|
|
829
829
|
if (N(e.tableName, n, a, r), e.appliedUniques.some((e) => e.name === n)) throw Error(a ? `duplicate auto-named UNIQUE '${n}' on table '${e.tableName}' — you've called .unique(${JSON.stringify(r)}) twice. Pass an explicit name to the second one if both are intended (very rare).` : `duplicate UNIQUE '${n}' on table '${e.tableName}': each constraint name must be unique within a table.`);
|
|
830
830
|
return I({
|
|
831
831
|
...e,
|
|
@@ -848,7 +848,7 @@ var se = () => new u({
|
|
|
848
848
|
}),
|
|
849
849
|
uniqueActive: ((...t) => {
|
|
850
850
|
let n, r, i, a = Array.isArray(t[0]);
|
|
851
|
-
if (a ? (r = t[0], i = t[1], n =
|
|
851
|
+
if (a ? (r = t[0], i = t[1], n = gt(e.tableName, r)) : (n = t[0], r = t[1], i = t[2]), r.length === 0) throw Error(`uniqueActive '${n}' on table '${e.tableName}' has no fields — a partial UNIQUE must cover at least one column.`);
|
|
852
852
|
if (N(e.tableName, n, a, r), e.appliedIndexes.some((e) => e.name === n)) throw Error(`duplicate index '${n}' on table '${e.tableName}': each index name must be unique within a table (uniqueActive shares the index namespace).`);
|
|
853
853
|
let o = i?.where ?? "\"deletedAt\" IS NULL";
|
|
854
854
|
return I({
|
|
@@ -983,12 +983,12 @@ var se = () => new u({
|
|
|
983
983
|
}, L = (e, t) => {
|
|
984
984
|
j(e);
|
|
985
985
|
let n = Object.entries(t).flatMap(([e, t]) => {
|
|
986
|
-
let n =
|
|
986
|
+
let n = ge(t);
|
|
987
987
|
return n === void 0 ? [] : [{
|
|
988
988
|
column: e,
|
|
989
989
|
...n
|
|
990
990
|
}];
|
|
991
|
-
}), r =
|
|
991
|
+
}), r = yt(C(t), e);
|
|
992
992
|
for (let t of Object.keys(r)) M(e, t);
|
|
993
993
|
let i;
|
|
994
994
|
for (let [t, n] of Object.entries(r)) n.references === S && (n.references = () => {
|
|
@@ -1007,7 +1007,7 @@ var se = () => new u({
|
|
|
1007
1007
|
appliedChecks: [],
|
|
1008
1008
|
appliedRules: []
|
|
1009
1009
|
}), i;
|
|
1010
|
-
},
|
|
1010
|
+
}, bt = (e) => e === "sqlite" || e === "turso", xt = (e) => e === "mysql" || e === "mariadb", R = (e, t) => {
|
|
1011
1011
|
switch (t) {
|
|
1012
1012
|
case "mysql":
|
|
1013
1013
|
case "mariadb": return `\`${e.replace(/`/g, "``")}\``;
|
|
@@ -1016,45 +1016,45 @@ var se = () => new u({
|
|
|
1016
1016
|
case "sqlite":
|
|
1017
1017
|
case "turso": return `"${e.replace(/"/g, "\"\"")}"`;
|
|
1018
1018
|
}
|
|
1019
|
-
},
|
|
1019
|
+
}, St = 1e4, Ct = Symbol.for("@voltro/database/tableRegistry"), wt = globalThis, z = wt[Ct] ?? (wt[Ct] = /* @__PURE__ */ new Map()), Tt = (e) => {
|
|
1020
1020
|
let t = z.get(e.tableName);
|
|
1021
1021
|
if (t === void 0) {
|
|
1022
1022
|
z.set(e.tableName, e);
|
|
1023
1023
|
return;
|
|
1024
1024
|
}
|
|
1025
1025
|
if (t !== e) throw Error(`duplicate table '${e.tableName}' registration: two different table descriptors claim the same name. Rename one or import the shared module that defines it.`);
|
|
1026
|
-
},
|
|
1026
|
+
}, Et = (e) => {
|
|
1027
1027
|
z.get(e.tableName) === void 0 && z.set(e.tableName, e);
|
|
1028
|
-
}, B = (e) => z.get(e),
|
|
1028
|
+
}, B = (e) => z.get(e), Dt = (e) => {
|
|
1029
1029
|
let t = z.get(e);
|
|
1030
1030
|
if (t === void 0) throw Error(`table '${e}' is not registered. Register it by wrapping it in \`databaseHandle({ ... })\` (the usual path) or call \`registerTable(t)\` explicitly before this runs. Note a \`queryFor(t)\` query carries its own source table, so eager-loads don't hit this — this error means a reconstructed descriptor or by-name tooling reached an unregistered table.`);
|
|
1031
1031
|
return t;
|
|
1032
|
-
},
|
|
1032
|
+
}, Ot = () => [...z.values()], kt = (e) => z.delete(e), At = () => {
|
|
1033
1033
|
z.clear();
|
|
1034
|
-
},
|
|
1034
|
+
}, jt = (e) => z.get(e)?.isReactive !== !1, V = (e) => e.order ?? [], Mt = (e) => ({
|
|
1035
1035
|
op: "count",
|
|
1036
1036
|
alias: e ?? "count"
|
|
1037
|
-
}),
|
|
1037
|
+
}), Nt = (e, t) => ({
|
|
1038
1038
|
op: "count-distinct",
|
|
1039
1039
|
column: e,
|
|
1040
1040
|
alias: t ?? `count_distinct_${e}`
|
|
1041
|
-
}),
|
|
1041
|
+
}), Pt = (e, t) => ({
|
|
1042
1042
|
op: "sum",
|
|
1043
1043
|
column: e,
|
|
1044
1044
|
alias: t ?? `sum_${e}`
|
|
1045
|
-
}),
|
|
1045
|
+
}), Ft = (e, t) => ({
|
|
1046
1046
|
op: "avg",
|
|
1047
1047
|
column: e,
|
|
1048
1048
|
alias: t ?? `avg_${e}`
|
|
1049
|
-
}),
|
|
1049
|
+
}), It = (e, t) => ({
|
|
1050
1050
|
op: "min",
|
|
1051
1051
|
column: e,
|
|
1052
1052
|
alias: t ?? `min_${e}`
|
|
1053
|
-
}),
|
|
1053
|
+
}), Lt = (e, t) => ({
|
|
1054
1054
|
op: "max",
|
|
1055
1055
|
column: e,
|
|
1056
1056
|
alias: t ?? `max_${e}`
|
|
1057
|
-
}),
|
|
1057
|
+
}), Rt = (e, t) => ({
|
|
1058
1058
|
op: "column",
|
|
1059
1059
|
column: e,
|
|
1060
1060
|
alias: t ?? e
|
|
@@ -1072,37 +1072,37 @@ var se = () => new u({
|
|
|
1072
1072
|
queries: t.map((e) => e.descriptor)
|
|
1073
1073
|
}
|
|
1074
1074
|
});
|
|
1075
|
-
},
|
|
1075
|
+
}, zt = H("union"), Bt = H("union-all"), Vt = H("intersect"), Ht = H("except"), U = (e) => ({ over: (t) => ({
|
|
1076
1076
|
...e,
|
|
1077
1077
|
window: t
|
|
1078
|
-
}) }),
|
|
1078
|
+
}) }), Ut = (e = "rowNumber") => U({
|
|
1079
1079
|
op: "window-row-number",
|
|
1080
1080
|
alias: e
|
|
1081
|
-
}),
|
|
1081
|
+
}), Wt = (e = "rank") => U({
|
|
1082
1082
|
op: "window-rank",
|
|
1083
1083
|
alias: e
|
|
1084
|
-
}),
|
|
1084
|
+
}), Gt = (e = "denseRank") => U({
|
|
1085
1085
|
op: "window-dense-rank",
|
|
1086
1086
|
alias: e
|
|
1087
|
-
}),
|
|
1087
|
+
}), Kt = (e, t = 1, n) => U({
|
|
1088
1088
|
op: "window-lag",
|
|
1089
1089
|
column: e,
|
|
1090
1090
|
alias: n ?? `lag_${e}`,
|
|
1091
1091
|
offset: t
|
|
1092
|
-
}),
|
|
1092
|
+
}), qt = (e, t = 1, n) => U({
|
|
1093
1093
|
op: "window-lead",
|
|
1094
1094
|
column: e,
|
|
1095
1095
|
alias: n ?? `lead_${e}`,
|
|
1096
1096
|
offset: t
|
|
1097
|
-
}),
|
|
1097
|
+
}), Jt = (e, t) => U({
|
|
1098
1098
|
op: "window-sum-over",
|
|
1099
1099
|
column: e,
|
|
1100
1100
|
alias: t ?? `sum_${e}_over`
|
|
1101
|
-
}),
|
|
1101
|
+
}), Yt = (e, t) => U({
|
|
1102
1102
|
op: "window-avg-over",
|
|
1103
1103
|
column: e,
|
|
1104
1104
|
alias: t ?? `avg_${e}_over`
|
|
1105
|
-
}),
|
|
1105
|
+
}), Xt = (e, t, n) => {
|
|
1106
1106
|
let r = n?.find((e) => e.name === t) ?? B(e)?.appliedFullText?.find((e) => e.name === t);
|
|
1107
1107
|
if (r === void 0) throw Error(`.matching('${t}', ...): no full-text index named '${t}' is declared on table '${e}'. Declare it with \`table(...).fullTextIndex('${t}', [columns])\` first.`);
|
|
1108
1108
|
return {
|
|
@@ -1202,7 +1202,7 @@ var se = () => new u({
|
|
|
1202
1202
|
});
|
|
1203
1203
|
},
|
|
1204
1204
|
matching(t, n, r) {
|
|
1205
|
-
let i =
|
|
1205
|
+
let i = Xt(e.table, t, e.fullTextIndexes);
|
|
1206
1206
|
return W({
|
|
1207
1207
|
...e,
|
|
1208
1208
|
fullTextSearch: {
|
|
@@ -1296,7 +1296,8 @@ var se = () => new u({
|
|
|
1296
1296
|
kind: "inner",
|
|
1297
1297
|
table: i,
|
|
1298
1298
|
alias: n,
|
|
1299
|
-
on: r
|
|
1299
|
+
on: r,
|
|
1300
|
+
...typeof t == "string" ? {} : { sourceTable: t }
|
|
1300
1301
|
}];
|
|
1301
1302
|
return W({
|
|
1302
1303
|
...e,
|
|
@@ -1308,7 +1309,8 @@ var se = () => new u({
|
|
|
1308
1309
|
kind: "left",
|
|
1309
1310
|
table: i,
|
|
1310
1311
|
alias: n,
|
|
1311
|
-
on: r
|
|
1312
|
+
on: r,
|
|
1313
|
+
...typeof t == "string" ? {} : { sourceTable: t }
|
|
1312
1314
|
}];
|
|
1313
1315
|
return W({
|
|
1314
1316
|
...e,
|
|
@@ -1375,7 +1377,7 @@ var se = () => new u({
|
|
|
1375
1377
|
});
|
|
1376
1378
|
}
|
|
1377
1379
|
});
|
|
1378
|
-
function
|
|
1380
|
+
function Zt(e) {
|
|
1379
1381
|
return W({
|
|
1380
1382
|
table: e.tableName,
|
|
1381
1383
|
predicate: void 0,
|
|
@@ -1387,7 +1389,7 @@ function Xt(e) {
|
|
|
1387
1389
|
sourceTable: e
|
|
1388
1390
|
});
|
|
1389
1391
|
}
|
|
1390
|
-
var
|
|
1392
|
+
var Qt = (e, t, n) => $t(e, "id", t, n), $t = (e, t, n, r, i = "asc") => {
|
|
1391
1393
|
let a = [...e.order.filter((e) => e.column !== t), {
|
|
1392
1394
|
column: t,
|
|
1393
1395
|
direction: i
|
|
@@ -1402,11 +1404,11 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1402
1404
|
order: a,
|
|
1403
1405
|
take: r
|
|
1404
1406
|
};
|
|
1405
|
-
},
|
|
1407
|
+
}, en = (e) => {
|
|
1406
1408
|
let t = {};
|
|
1407
|
-
for (let [n, r] of Object.entries(e))
|
|
1409
|
+
for (let [n, r] of Object.entries(e)) Tt(r), t[n] = Zt(r);
|
|
1408
1410
|
return t;
|
|
1409
|
-
},
|
|
1411
|
+
}, tn = (e) => e.isView === !0, nn = (e, t, n) => {
|
|
1410
1412
|
if (j(e), n.trim().length === 0) throw Error(`view('${e}', …): the SELECT body is empty — a view must define a query.`);
|
|
1411
1413
|
let r = C(t);
|
|
1412
1414
|
for (let t of Object.keys(r)) M(e, t);
|
|
@@ -1416,7 +1418,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1416
1418
|
isView: !0,
|
|
1417
1419
|
viewSelect: n
|
|
1418
1420
|
};
|
|
1419
|
-
},
|
|
1421
|
+
}, rn = (e) => Zt({
|
|
1420
1422
|
...e,
|
|
1421
1423
|
isReactive: !1,
|
|
1422
1424
|
appliedMixins: [],
|
|
@@ -1424,7 +1426,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1424
1426
|
appliedUniques: [],
|
|
1425
1427
|
appliedFullText: [],
|
|
1426
1428
|
appliedChecks: []
|
|
1427
|
-
}),
|
|
1429
|
+
}), an = (e, t, n = null) => {
|
|
1428
1430
|
let r = n === null ? R(e.tableName, t) : `${R(n, t)}.${R(e.tableName, t)}`, i = e.viewSelect.trim();
|
|
1429
1431
|
switch (t) {
|
|
1430
1432
|
case "postgres":
|
|
@@ -1434,7 +1436,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1434
1436
|
case "sqlite":
|
|
1435
1437
|
case "turso": return `DROP VIEW IF EXISTS ${r};\nCREATE VIEW ${r} AS ${i};`;
|
|
1436
1438
|
}
|
|
1437
|
-
},
|
|
1439
|
+
}, on = (e) => e == null || typeof e == "boolean" ? e : typeof e == "number" ? e !== 0 : typeof e == "bigint" ? e !== 0n : typeof e == "string" ? e === "1" || e.toLowerCase() === "true" : e, sn = (e) => {
|
|
1438
1440
|
if (e == null || typeof e != "string") return e;
|
|
1439
1441
|
let t = e.trim();
|
|
1440
1442
|
if (t.length === 0) return e;
|
|
@@ -1445,7 +1447,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1445
1447
|
} catch {
|
|
1446
1448
|
return e;
|
|
1447
1449
|
}
|
|
1448
|
-
},
|
|
1450
|
+
}, cn = (e) => e == null || typeof e == "string" ? e : typeof e == "number" || typeof e == "bigint" ? String(e) : e, ln = (e) => {
|
|
1449
1451
|
if (e == null || e instanceof Date) return e;
|
|
1450
1452
|
if (typeof e == "string") {
|
|
1451
1453
|
let t = new Date(e);
|
|
@@ -1456,24 +1458,24 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1456
1458
|
return isNaN(t.getTime()) ? e : t;
|
|
1457
1459
|
}
|
|
1458
1460
|
return e;
|
|
1459
|
-
},
|
|
1461
|
+
}, un = (e, t, n) => {
|
|
1460
1462
|
if (e == null) return e;
|
|
1461
1463
|
switch (t) {
|
|
1462
|
-
case "boolean": return n === "postgres" ? e :
|
|
1463
|
-
case "vector": return n === "postgres" ?
|
|
1464
|
-
case "json": return n === "postgres" || n === "mysql" || n === "mariadb" ? e :
|
|
1465
|
-
case "array": return n === "postgres" ? e :
|
|
1464
|
+
case "boolean": return n === "postgres" ? e : on(e);
|
|
1465
|
+
case "vector": return n === "postgres" ? sn(e) : e;
|
|
1466
|
+
case "json": return n === "postgres" || n === "mysql" || n === "mariadb" ? e : sn(e);
|
|
1467
|
+
case "array": return n === "postgres" ? e : sn(e);
|
|
1466
1468
|
case "timestamp":
|
|
1467
|
-
case "date": return n === "sqlite" || n === "turso" ?
|
|
1469
|
+
case "date": return n === "sqlite" || n === "turso" ? ln(e) : e;
|
|
1468
1470
|
case "decimal":
|
|
1469
|
-
case "bigint": return
|
|
1471
|
+
case "bigint": return cn(e);
|
|
1470
1472
|
default: return e;
|
|
1471
1473
|
}
|
|
1472
|
-
},
|
|
1474
|
+
}, dn = (e, t, n) => {
|
|
1473
1475
|
if (e.length === 0) return e;
|
|
1474
1476
|
let r = B(t);
|
|
1475
|
-
return r === void 0 ? e :
|
|
1476
|
-
},
|
|
1477
|
+
return r === void 0 ? e : fn(e, r, n);
|
|
1478
|
+
}, fn = (e, t, n) => {
|
|
1477
1479
|
if (e.length === 0) return e;
|
|
1478
1480
|
let r = t.fields, i = [];
|
|
1479
1481
|
for (let [e, t] of Object.entries(r)) i.push({
|
|
@@ -1482,10 +1484,10 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1482
1484
|
});
|
|
1483
1485
|
return e.map((e) => {
|
|
1484
1486
|
let t = { ...e };
|
|
1485
|
-
for (let { key: e, type: r } of i) e in t && (t[e] =
|
|
1487
|
+
for (let { key: e, type: r } of i) e in t && (t[e] = un(t[e], r, n));
|
|
1486
1488
|
return t;
|
|
1487
1489
|
});
|
|
1488
|
-
},
|
|
1490
|
+
}, pn = (e, t) => {
|
|
1489
1491
|
if (e == null) return e;
|
|
1490
1492
|
switch (t) {
|
|
1491
1493
|
case "json": return JSON.stringify(e);
|
|
@@ -1493,25 +1495,38 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1493
1495
|
case "vector": return typeof e == "string" ? e : JSON.stringify(e);
|
|
1494
1496
|
default: return e;
|
|
1495
1497
|
}
|
|
1496
|
-
},
|
|
1498
|
+
}, mn = (e, t, n = ["json", "array"]) => {
|
|
1497
1499
|
let r = B(t);
|
|
1498
1500
|
if (r === void 0) return e;
|
|
1499
1501
|
let i = r.fields, a = null;
|
|
1500
1502
|
for (let [t, r] of Object.entries(i)) if (n.includes(r.type) && t in e) {
|
|
1501
|
-
let n =
|
|
1503
|
+
let n = pn(e[t], r.type);
|
|
1502
1504
|
n !== e[t] && (a === null && (a = { ...e }), a[t] = n);
|
|
1503
1505
|
}
|
|
1504
1506
|
return a ?? e;
|
|
1505
|
-
},
|
|
1507
|
+
}, hn = (e) => {
|
|
1508
|
+
if (e.length === 0) throw RangeError("Column reference must not be empty");
|
|
1509
|
+
return {
|
|
1510
|
+
_tag: "ColumnReference",
|
|
1511
|
+
column: e
|
|
1512
|
+
};
|
|
1513
|
+
}, G = (e) => typeof e == "object" && !!e && "_tag" in e && e._tag === "ColumnReference" && "column" in e && typeof e.column == "string", gn = [
|
|
1514
|
+
"eq",
|
|
1515
|
+
"neq",
|
|
1516
|
+
"gt",
|
|
1517
|
+
"gte",
|
|
1518
|
+
"lt",
|
|
1519
|
+
"lte"
|
|
1520
|
+
], _n = (e) => e == null ? e : e instanceof Date ? e.toISOString() : typeof e == "boolean" ? +!!e : Array.isArray(e) ? e.map((e) => _n(e)) : e, vn = /^[A-Za-z_][A-Za-z0-9_]*$/, yn = (e) => "$" + e.map((e) => typeof e == "number" ? `[${e}]` : vn.test(e) ? `.${e}` : `."${e.replace(/"/g, "\\\"")}"`).join(""), bn = (e) => "{" + e.map((e) => {
|
|
1506
1521
|
let t = String(e);
|
|
1507
1522
|
return /^[A-Za-z0-9_]+$/.test(t) ? t : `"${t.replace(/(["\\])/g, "\\$1")}"`;
|
|
1508
|
-
}).join(",") + "}",
|
|
1523
|
+
}).join(",") + "}", K = (e, t, n, r = {}) => {
|
|
1509
1524
|
let i = R(e, n), a = r.numeric ?? !1;
|
|
1510
1525
|
if (n === "postgres") {
|
|
1511
|
-
let e = `(${i} #>> '${
|
|
1526
|
+
let e = `(${i} #>> '${bn(t)}'::text[])`;
|
|
1512
1527
|
return a ? `${e}::numeric` : e;
|
|
1513
1528
|
}
|
|
1514
|
-
let o =
|
|
1529
|
+
let o = yn(t);
|
|
1515
1530
|
switch (n) {
|
|
1516
1531
|
case "mysql":
|
|
1517
1532
|
case "mariadb": {
|
|
@@ -1528,61 +1543,77 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1528
1543
|
return a ? `CAST(${e} AS REAL)` : e;
|
|
1529
1544
|
}
|
|
1530
1545
|
}
|
|
1531
|
-
},
|
|
1546
|
+
}, xn = class extends Error {
|
|
1532
1547
|
_tag = "TenantNamespaceUnresolved";
|
|
1533
1548
|
constructor(e) {
|
|
1534
1549
|
super(e), this.name = "TenantNamespaceUnresolved";
|
|
1535
1550
|
}
|
|
1536
|
-
},
|
|
1551
|
+
}, Sn = class extends Error {
|
|
1537
1552
|
_tag = "TenantNamespaceInvalid";
|
|
1538
1553
|
constructor(e) {
|
|
1539
1554
|
super(e), this.name = "TenantNamespaceInvalid";
|
|
1540
1555
|
}
|
|
1541
|
-
},
|
|
1542
|
-
if (e == null || e === "") throw new
|
|
1543
|
-
let t =
|
|
1544
|
-
if (t.replace(/_/g, "") === "") throw new
|
|
1545
|
-
let n = `${
|
|
1546
|
-
if (n.length >
|
|
1556
|
+
}, Cn = 63, wn = "tenant_", Tn = (e) => e.toLowerCase().replace(/[^a-z0-9_]/g, "_"), En = (e) => {
|
|
1557
|
+
if (e == null || e === "") throw new xn("namespace isolation is on but the request has no resolvable tenant (subject.tenantId is null/empty). Refusing to run against a shared/default namespace — this would be a cross-tenant read. Authenticate with a tenant-scoped subject, or disable namespace isolation for this surface.");
|
|
1558
|
+
let t = Tn(e);
|
|
1559
|
+
if (t.replace(/_/g, "") === "") throw new Sn(`tenant id '${e}' has no usable identifier characters after sanitisation — cannot derive a distinct namespace.`);
|
|
1560
|
+
let n = `${wn}${t}`;
|
|
1561
|
+
if (n.length > Cn) throw new Sn(`namespace '${n}' for tenant '${e}' exceeds the ${Cn}-byte identifier limit. Use a shorter tenant id.`);
|
|
1547
1562
|
return n;
|
|
1548
|
-
},
|
|
1549
|
-
if (e === void 0 || t == null || !
|
|
1563
|
+
}, q = (e, t) => e === null ? t : `${e}.${t}`, Dn = /* @__PURE__ */ new Set(["timestamp", "date"]), On = /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2})?/, kn = (e, t) => {
|
|
1564
|
+
if (e === void 0 || t == null || !Dn.has(e) || t instanceof Date) return t;
|
|
1550
1565
|
if (typeof t == "number" && Number.isFinite(t)) return new Date(t);
|
|
1551
|
-
if (typeof t == "string" &&
|
|
1566
|
+
if (typeof t == "string" && On.test(t)) {
|
|
1552
1567
|
let e = new Date(t);
|
|
1553
1568
|
return Number.isNaN(e.getTime()) ? t : e;
|
|
1554
1569
|
}
|
|
1555
1570
|
return t;
|
|
1556
|
-
},
|
|
1571
|
+
}, An = (e, t) => e === void 0 || !Dn.has(e) ? t : t.map((t) => kn(e, t)), jn = (e, t) => {
|
|
1572
|
+
let n = e.lastIndexOf("."), r = n < 0 ? e : e.slice(n + 1), i = n < 0 ? void 0 : e.slice(0, n), a = i === void 0 || i === t.alias || i === t.table, o = a ? void 0 : t.joins?.find((e) => e.alias === i), s = a ? t.table : o?.table, c = a ? t.sourceTable : o?.sourceTable;
|
|
1573
|
+
return (c?.tableName === s ? c : s === void 0 ? void 0 : B(s))?.fields[r];
|
|
1574
|
+
}, Mn = (e, t) => {
|
|
1557
1575
|
let { strings: n, values: r } = e, i = t.unsafe(n[0] ?? "");
|
|
1558
1576
|
for (let e = 0; e < r.length; e++) i = t`${i}${r[e]}${t.unsafe(n[e + 1] ?? "")}`;
|
|
1559
1577
|
return t`${i}`;
|
|
1560
|
-
},
|
|
1561
|
-
if ("not" in e) return t`NOT (${
|
|
1562
|
-
if ("and" in e) return e.and.length === 0 ? t`TRUE` : t.and(e.and.map((e) =>
|
|
1563
|
-
if ("or" in e) return e.or.length === 0 ? t`FALSE` : t.or(e.or.map((e) =>
|
|
1578
|
+
}, J = (e) => e.replace(/[\\%_]/g, (e) => `\\${e}`), Y = (e, t, n = null, r) => {
|
|
1579
|
+
if ("not" in e) return t`NOT (${Y(e.not, t, n, r)})`;
|
|
1580
|
+
if ("and" in e) return e.and.length === 0 ? t`TRUE` : t.and(e.and.map((e) => Y(e, t, n, r)));
|
|
1581
|
+
if ("or" in e) return e.or.length === 0 ? t`FALSE` : t.or(e.or.map((e) => Y(e, t, n, r)));
|
|
1564
1582
|
if (e.op === "subquery-in" || e.op === "subquery-not-in") {
|
|
1565
|
-
let r = e, i =
|
|
1583
|
+
let r = e, i = Z(r.subquery, t, n);
|
|
1566
1584
|
return r.op === "subquery-in" ? t`${t(r.column)} IN (${i})` : t`${t(r.column)} NOT IN (${i})`;
|
|
1567
1585
|
}
|
|
1568
1586
|
if (e.op === "exists" || e.op === "not-exists") {
|
|
1569
|
-
let r = e, i =
|
|
1587
|
+
let r = e, i = Z(r.subquery, t, n);
|
|
1570
1588
|
return r.op === "exists" ? t`EXISTS (${i})` : t`NOT EXISTS (${i})`;
|
|
1571
1589
|
}
|
|
1572
|
-
let i = e
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1590
|
+
let i = e;
|
|
1591
|
+
if (G(i.value)) {
|
|
1592
|
+
if (!gn.some((e) => e === i.op) || i.path !== void 0) throw E("Column references require a scalar comparison without a JSON path");
|
|
1593
|
+
let e = t(i.value.column), n = t(i.column);
|
|
1594
|
+
switch (i.op) {
|
|
1595
|
+
case "eq": return t`${n} = ${e}`;
|
|
1596
|
+
case "neq": return t`${n} <> ${e}`;
|
|
1597
|
+
case "gt": return t`${n} > ${e}`;
|
|
1598
|
+
case "gte": return t`${n} >= ${e}`;
|
|
1599
|
+
case "lt": return t`${n} < ${e}`;
|
|
1600
|
+
case "lte": return t`${n} <= ${e}`;
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
let a = t(i.column), o = i.path, s = o !== void 0 && o.length > 0, c = () => t.onDialectOrElse({
|
|
1604
|
+
mysql: () => t.unsafe(K(i.column, o, "mysql")),
|
|
1605
|
+
mssql: () => t.unsafe(K(i.column, o, "mssql")),
|
|
1606
|
+
sqlite: () => t.unsafe(K(i.column, o, "sqlite")),
|
|
1607
|
+
orElse: () => t.unsafe(K(i.column, o, "postgres"))
|
|
1577
1608
|
}), l = () => t.onDialectOrElse({
|
|
1578
|
-
mysql: () => t.unsafe(
|
|
1579
|
-
mssql: () => t.unsafe(
|
|
1580
|
-
sqlite: () => t.unsafe(
|
|
1581
|
-
orElse: () => t.unsafe(
|
|
1609
|
+
mysql: () => t.unsafe(K(i.column, o, "mysql", { numeric: !0 })),
|
|
1610
|
+
mssql: () => t.unsafe(K(i.column, o, "mssql", { numeric: !0 })),
|
|
1611
|
+
sqlite: () => t.unsafe(K(i.column, o, "sqlite", { numeric: !0 })),
|
|
1612
|
+
orElse: () => t.unsafe(K(i.column, o, "postgres", { numeric: !0 }))
|
|
1582
1613
|
}), u = s ? c() : a, d = s ? l() : a, f = (e) => s && e != null ? String(e) : e, p = (e) => s ? Number(e) : e, m = s || r === void 0 ? void 0 : B(r)?.fields?.[i.column]?.type, h = (e) => {
|
|
1583
|
-
let n =
|
|
1614
|
+
let n = kn(m, e);
|
|
1584
1615
|
return n instanceof Date ? t.onDialectOrElse({
|
|
1585
|
-
sqlite: () =>
|
|
1616
|
+
sqlite: () => _n(n),
|
|
1586
1617
|
orElse: () => n
|
|
1587
1618
|
}) : n;
|
|
1588
1619
|
};
|
|
@@ -1602,7 +1633,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1602
1633
|
return e.length === 0 ? t`TRUE` : t`${u} NOT IN ${t.in(s ? e.map((e) => f(e)) : e.map(h))}`;
|
|
1603
1634
|
}
|
|
1604
1635
|
case "contains": {
|
|
1605
|
-
let e = `%${
|
|
1636
|
+
let e = `%${J(typeof i.value == "string" ? i.value : String(i.value ?? ""))}%`;
|
|
1606
1637
|
return t.onDialectOrElse({
|
|
1607
1638
|
mysql: () => t`LOWER(${u}) LIKE LOWER(${e})`,
|
|
1608
1639
|
mssql: () => t`LOWER(${u}) LIKE LOWER(${e})`,
|
|
@@ -1611,7 +1642,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1611
1642
|
});
|
|
1612
1643
|
}
|
|
1613
1644
|
case "startsWith": {
|
|
1614
|
-
let e = `${
|
|
1645
|
+
let e = `${J(typeof i.value == "string" ? i.value : String(i.value ?? ""))}%`;
|
|
1615
1646
|
return t.onDialectOrElse({
|
|
1616
1647
|
mysql: () => t`${u} LIKE ${e}`,
|
|
1617
1648
|
orElse: () => t`${u} LIKE ${e} ESCAPE '\\'`
|
|
@@ -1659,13 +1690,13 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1659
1690
|
});
|
|
1660
1691
|
}
|
|
1661
1692
|
}
|
|
1662
|
-
},
|
|
1693
|
+
}, Nn = (e, t) => {
|
|
1663
1694
|
let n = [];
|
|
1664
1695
|
return e.partitionBy && e.partitionBy.length > 0 && n.push(t`PARTITION BY ${t.csv(e.partitionBy.map((e) => t`${t(e)}`))}`), e.orderBy && e.orderBy.length > 0 && n.push(t`ORDER BY ${t.csv(e.orderBy.map((e) => e.direction === "desc" ? t`${t(e.column)} DESC` : t`${t(e.column)} ASC`))}`), n.length === 0 ? t`` : n.length === 1 ? n[0] : n.reduce((e, n, r) => r === 0 ? n : t`${e} ${n}`);
|
|
1665
|
-
},
|
|
1696
|
+
}, Pn = (e, t) => t.csv(e.map((e) => {
|
|
1666
1697
|
let n = e.column === void 0 ? t.unsafe("*") : t`${t(e.column)}`;
|
|
1667
1698
|
if (e.op.startsWith("window-")) {
|
|
1668
|
-
let r =
|
|
1699
|
+
let r = Nn(e.window ?? {}, t);
|
|
1669
1700
|
switch (e.op) {
|
|
1670
1701
|
case "window-row-number": return t`ROW_NUMBER() OVER (${r}) AS ${t(e.alias)}`;
|
|
1671
1702
|
case "window-rank": return t`RANK() OVER (${r}) AS ${t(e.alias)}`;
|
|
@@ -1689,60 +1720,57 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1689
1720
|
return t`${t(e.column)} AS ${t(e.alias)}`;
|
|
1690
1721
|
default: throw E(`compileAggregateProjection: unknown op '${e.op}'`);
|
|
1691
1722
|
}
|
|
1692
|
-
})),
|
|
1723
|
+
})), Fn = (e) => `[${e.join(",")}]`, In = (e, t) => {
|
|
1693
1724
|
if (e.queryVector === void 0) return null;
|
|
1694
|
-
let n = t(e.column), r =
|
|
1725
|
+
let n = t(e.column), r = Fn(e.queryVector), i = e.distance === "cosine" ? "<=>" : e.distance === "l2" ? "<->" : "<#>", a = e.distance === "cosine" ? "VEC_DISTANCE_COSINE" : "VEC_DISTANCE_EUCLIDEAN";
|
|
1695
1726
|
return t.onDialectOrElse({
|
|
1696
1727
|
mysql: () => t`${t.unsafe(a)}(${n}, ${r})`,
|
|
1697
1728
|
mssql: () => t`NULL`,
|
|
1698
1729
|
sqlite: () => t`NULL`,
|
|
1699
1730
|
orElse: () => t`${n} ${t.unsafe(i)} ${r}::vector`
|
|
1700
1731
|
});
|
|
1701
|
-
},
|
|
1732
|
+
}, Ln = (e, t) => {
|
|
1702
1733
|
let n = t.unsafe(e.useGeography ? "::geography" : "::geometry");
|
|
1703
1734
|
return t`ST_Distance(${t(e.column)}${n}, ${e.geom}${n})`;
|
|
1704
|
-
},
|
|
1735
|
+
}, Rn = (e, t) => t`${t(e.column)} <-> ${e.geom}::geometry`, X = (e, t) => t`${t(`${e.indexName}_tsv`)}`, zn = (e, t) => `${t}_${e.indexName}_fts`, Bn = (e) => e.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter((e) => e !== ""), Vn = (e) => {
|
|
1705
1736
|
if (e.prefix !== !0) return;
|
|
1706
|
-
let t =
|
|
1737
|
+
let t = Bn(e.query);
|
|
1707
1738
|
if (t.length !== 0) return {
|
|
1708
1739
|
pg: t.map((e) => `${e}:*`).join(" & "),
|
|
1709
1740
|
mysql: t.map((e) => `+${e}*`).join(" "),
|
|
1710
1741
|
sqlite: t.map((e) => `"${e}"*`).join(" ")
|
|
1711
1742
|
};
|
|
1712
|
-
},
|
|
1713
|
-
let r = n.csv(e.columns.map((e) => n`${n(e)}`)), i = `%${
|
|
1743
|
+
}, Hn = (e, t, n) => {
|
|
1744
|
+
let r = n.csv(e.columns.map((e) => n`${n(e)}`)), i = `%${J(e.query)}%`, a = Vn(e), o = () => n.or(e.columns.map((e) => n`LOWER(${n(e)}) LIKE LOWER(${i}) ESCAPE '\\'`));
|
|
1714
1745
|
return e.fallback === "like" ? o() : n.onDialectOrElse({
|
|
1715
1746
|
mysql: () => a === void 0 ? n`MATCH(${r}) AGAINST(${e.query} IN NATURAL LANGUAGE MODE)` : n`MATCH(${r}) AGAINST(${a.mysql} IN BOOLEAN MODE)`,
|
|
1716
1747
|
sqlite: () => {
|
|
1717
|
-
let r = n(
|
|
1748
|
+
let r = n(zn(e, t));
|
|
1718
1749
|
return n`${n("id")} IN (SELECT ${n("row_id")} FROM ${r} WHERE ${r} MATCH ${a?.sqlite ?? e.query})`;
|
|
1719
1750
|
},
|
|
1720
1751
|
mssql: o,
|
|
1721
|
-
orElse: () => a === void 0 ? n`${
|
|
1752
|
+
orElse: () => a === void 0 ? n`${X(e, n)} @@ plainto_tsquery(${e.config ?? "english"}, ${e.query})` : n`${X(e, n)} @@ to_tsquery(${e.config ?? "english"}, ${a.pg})`
|
|
1722
1753
|
});
|
|
1723
|
-
},
|
|
1724
|
-
let r = `%${
|
|
1754
|
+
}, Un = (e, t, n) => {
|
|
1755
|
+
let r = `%${J(e.query)}%`, i = Vn(e), a = () => e.columns.map((e) => n`(CASE WHEN LOWER(${n(e)}) LIKE LOWER(${r}) ESCAPE '\\' THEN 1 ELSE 0 END)`).reduce((e, t, r) => r === 0 ? t : n`${e} + ${t}`);
|
|
1725
1756
|
return e.fallback === "like" ? a() : n.onDialectOrElse({
|
|
1726
1757
|
mysql: () => i === void 0 ? n`MATCH(${n.csv(e.columns.map((e) => n`${n(e)}`))}) AGAINST(${e.query} IN NATURAL LANGUAGE MODE)` : n`MATCH(${n.csv(e.columns.map((e) => n`${n(e)}`))}) AGAINST(${i.mysql} IN BOOLEAN MODE)`,
|
|
1727
1758
|
sqlite: () => {
|
|
1728
|
-
let r = n(
|
|
1759
|
+
let r = n(zn(e, t));
|
|
1729
1760
|
return n`COALESCE((SELECT -bm25(${r}) FROM ${r} WHERE ${r} MATCH ${i?.sqlite ?? e.query} AND ${r}.${n("row_id")} = ${n("id")}), 0)`;
|
|
1730
1761
|
},
|
|
1731
1762
|
mssql: a,
|
|
1732
|
-
orElse: () => i === void 0 ? n`ts_rank(${
|
|
1763
|
+
orElse: () => i === void 0 ? n`ts_rank(${X(e, n)}, plainto_tsquery(${e.config ?? "english"}, ${e.query}))` : n`ts_rank(${X(e, n)}, to_tsquery(${e.config ?? "english"}, ${i.pg}))`
|
|
1733
1764
|
});
|
|
1734
|
-
},
|
|
1735
|
-
let r = () => n?.length ? t.csv(n.map((e) => t`${
|
|
1736
|
-
return !
|
|
1737
|
-
sqlite: () => t.csv((n?.length ? n : Object.keys(
|
|
1738
|
-
orElse:
|
|
1765
|
+
}, Wn = (e, t, n, r) => {
|
|
1766
|
+
let i = (e) => t(r && !e.includes(".") ? `${r}.${e}` : e), a = () => n?.length ? t.csv(n.map((e) => t`${i(e)}`)) : r ? t`${t(r)}.*` : t`*`;
|
|
1767
|
+
return !e || !Object.values(e).some((e) => e.type === "bigint") ? a() : t.onDialectOrElse({
|
|
1768
|
+
sqlite: () => t.csv((n?.length ? n : Object.keys(e)).map((n) => e[n]?.type === "bigint" ? t`CAST(${i(n)} AS TEXT) AS ${t(n)}` : t`${i(n)}`)),
|
|
1769
|
+
orElse: a
|
|
1739
1770
|
});
|
|
1740
|
-
},
|
|
1741
|
-
let n = e.lastIndexOf("."), r = n < 0 ? e : e.slice(n + 1), i = n < 0 ? void 0 : e.slice(0, n), a = i === void 0 || i === t.alias || i === t.table ? t.table : t.joins?.find((e) => e.alias === i)?.table;
|
|
1742
|
-
return a === void 0 ? void 0 : B(a)?.fields?.[r]?.type;
|
|
1743
|
-
}, X = (e, t, n = null) => {
|
|
1771
|
+
}, Gn = (e, t, n) => Wn(B(e)?.fields, t, n), Z = (e, t, n = null) => {
|
|
1744
1772
|
if (e.setOp && e.setOp.queries.length >= 2) {
|
|
1745
|
-
let r = e.setOp.kind === "union" ? "UNION" : e.setOp.kind === "union-all" ? "UNION ALL" : e.setOp.kind === "intersect" ? "INTERSECT" : "EXCEPT", i = e.setOp.queries.map((e) => t`(${
|
|
1773
|
+
let r = e.setOp.kind === "union" ? "UNION" : e.setOp.kind === "union-all" ? "UNION ALL" : e.setOp.kind === "intersect" ? "INTERSECT" : "EXCEPT", i = e.setOp.queries.map((e) => t`(${Z(e, t, n)})`).reduce((e, n, i) => i === 0 ? n : t`${e} ${t.unsafe(r)} ${n}`), a = [];
|
|
1746
1774
|
if (V(e).length > 0 && a.push(t` ORDER BY ${t.csv(V(e).map((e) => e.direction === "desc" ? t`${t(e.column)} DESC` : t`${t(e.column)} ASC`))}`), e.take !== void 0) {
|
|
1747
1775
|
if (!Number.isInteger(e.take) || e.take < 0) throw E(`compileSelect: invalid take ${e.take}`);
|
|
1748
1776
|
a.push(t` LIMIT ${t.unsafe(String(e.take))}`);
|
|
@@ -1753,7 +1781,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1753
1781
|
}
|
|
1754
1782
|
return t`${i}${a.reduce((e, n) => t`${e}${n}`, t``)}`;
|
|
1755
1783
|
}
|
|
1756
|
-
let r = e.annClause === void 0 ? null :
|
|
1784
|
+
let r = e.annClause === void 0 ? null : In(e.annClause, t);
|
|
1757
1785
|
e.spatialClause !== void 0 && t.onDialectOrElse({
|
|
1758
1786
|
mysql: () => {
|
|
1759
1787
|
throw E("@voltro/plugin-postgis: spatial distance / KNN ordering is postgres-only");
|
|
@@ -1766,13 +1794,13 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1766
1794
|
},
|
|
1767
1795
|
orElse: () => t``
|
|
1768
1796
|
});
|
|
1769
|
-
let i = e.spatialClause?.projectAs === void 0 ? null :
|
|
1797
|
+
let i = e.spatialClause?.projectAs === void 0 ? null : Ln(e.spatialClause, t), a = e.aggregations && e.aggregations.length > 0 ? Pn(e.aggregations, t) : e.joinedProjection && e.joinedProjection.length > 0 ? t.csv(e.joinedProjection.map((n) => {
|
|
1770
1798
|
let r = t`${t(n.source)}`;
|
|
1771
|
-
return t`${
|
|
1799
|
+
return t`${jn(n.source, e)?.type === "bigint" ? t.onDialectOrElse({
|
|
1772
1800
|
sqlite: () => t`CAST(${r} AS TEXT)`,
|
|
1773
1801
|
orElse: () => r
|
|
1774
1802
|
}) : r} AS ${t(n.outputKey)}`;
|
|
1775
|
-
})) :
|
|
1803
|
+
})) : Wn((e.sourceTable?.tableName === e.table ? e.sourceTable : B(e.table))?.fields, t, e.projection, (e.joins?.length ?? 0) > 0 ? e.alias ?? e.table : void 0), o = (e.aggregations && e.aggregations.length > 0) === !0, s = r !== null && !o ? t`${a}, ${r} AS ${t("distance")}` : a, c = e.fullTextSearch, l = c?.rank !== void 0 && !o ? Un(c, e.table, t) : null, u = l !== null && c?.rank !== void 0 ? t`${s}, ${l} AS ${t(c.rank.alias)}` : s, d = i !== null && !o && e.spatialClause?.projectAs !== void 0 ? t`${u}, ${i} AS ${t(e.spatialClause.projectAs)}` : u, f = e.distinctOn && e.distinctOn.length > 0 ? t.onDialectOrElse({
|
|
1776
1804
|
orElse: () => t`DISTINCT ON (${t.csv(e.distinctOn.map((e) => t`${t(e)}`))}) `,
|
|
1777
1805
|
mysql: () => t`DISTINCT `,
|
|
1778
1806
|
mssql: () => t`DISTINCT `,
|
|
@@ -1784,13 +1812,13 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1784
1812
|
mssql: () => t``,
|
|
1785
1813
|
sqlite: () => t``,
|
|
1786
1814
|
orElse: () => t` FOR UPDATE`
|
|
1787
|
-
}) : t``, g = e.alias === void 0 ? t`${t(
|
|
1815
|
+
}) : t``, g = e.alias === void 0 ? t`${t(q(n, e.table))}${m}` : t`${t(q(n, e.table))} AS ${t(e.alias)}${m}`, ee = (e.joins ?? []).map((e) => {
|
|
1788
1816
|
let r = e.kind === "inner" ? "INNER" : "LEFT";
|
|
1789
|
-
return t` ${t.unsafe(r)} JOIN ${t(
|
|
1790
|
-
}), te = ee.length > 0 ? ee.reduce((e, n) => t`${e}${n}`, g) : g, ne = c === void 0 ? null :
|
|
1791
|
-
r !== null && x.push(t`${r} ASC`), e.spatialClause?.order !== void 0 && x.push(e.spatialClause.order === "desc" ? t`${
|
|
1817
|
+
return t` ${t.unsafe(r)} JOIN ${t(q(n, e.table))} AS ${t(e.alias)} ON ${Y(e.on, t, n)}`;
|
|
1818
|
+
}), te = ee.length > 0 ? ee.reduce((e, n) => t`${e}${n}`, g) : g, ne = c === void 0 ? null : Hn(c, e.table, t), _ = [e.predicate ? Y(e.predicate, t, n, e.table) : null, ne].filter((e) => e !== null), v = _.length > 0 ? t` WHERE ${t.and(_)}` : t``, re = e.groupBy && e.groupBy.length > 0 ? t` GROUP BY ${t.csv(e.groupBy.map((e) => t`${t(e)}`))}` : t``, y = e.having ? t` HAVING ${Y(e.having, t, n, e.table)}` : t``, b = e.skip !== void 0, x = [];
|
|
1819
|
+
r !== null && x.push(t`${r} ASC`), e.spatialClause?.order !== void 0 && x.push(e.spatialClause.order === "desc" ? t`${Rn(e.spatialClause, t)} DESC` : t`${Rn(e.spatialClause, t)} ASC`), l !== null && c?.rank?.order === !0 && x.push(t`${l} DESC`);
|
|
1792
1820
|
for (let n of V(e)) {
|
|
1793
|
-
let r = e.joinedProjection?.find((e) => e.outputKey === n.column)?.source ?? n.column, i = !o &&
|
|
1821
|
+
let r = e.joinedProjection?.find((e) => e.outputKey === n.column)?.source ?? n.column, i = !o && jn(r, e)?.type === "bigint" ? t.onDialectOrElse({
|
|
1794
1822
|
sqlite: () => t`${t(r.includes(".") ? r : `${e.alias ?? e.table}.${r}`)}`,
|
|
1795
1823
|
orElse: () => t`${t(n.column)}`
|
|
1796
1824
|
}) : t`${t(n.column)}`;
|
|
@@ -1802,18 +1830,22 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1802
1830
|
}) : t``, S = (e) => {
|
|
1803
1831
|
if (!Number.isFinite(e) || !Number.isInteger(e) || e < 0) throw E(`compileSelect: expected non-negative integer take/skip, got ${e}`);
|
|
1804
1832
|
return t.unsafe(String(e));
|
|
1805
|
-
}, ae = (e.ctes ?? []).map((e) => t`${t(e.name)} AS (${
|
|
1833
|
+
}, ae = (e.ctes ?? []).map((e) => t`${t(e.name)} AS (${Z(e.descriptor, t, n)})`), oe = (e.ctes ?? []).some((e) => e.recursive === !0), se = ae.length > 0 ? t`WITH ${t.unsafe(oe ? "RECURSIVE " : "")}${t.csv(ae)} ` : t``;
|
|
1806
1834
|
return t.onDialectOrElse({
|
|
1807
1835
|
mssql: () => {
|
|
1808
1836
|
let n = e.take !== void 0 && !b ? t`TOP ${S(e.take)} ` : t``, r = b ? t` OFFSET ${S(e.skip)} ROWS FETCH NEXT ${S(e.take ?? 2 ** 53 - 1)} ROWS ONLY` : t``;
|
|
1809
1837
|
return t`${se}SELECT ${n}${f}${d} FROM ${te}${v}${re}${y}${ie}${r}`;
|
|
1810
1838
|
},
|
|
1811
1839
|
orElse: () => {
|
|
1812
|
-
let n = e.take === void 0 ?
|
|
1840
|
+
let n = e.take === void 0 ? b ? t.onDialectOrElse({
|
|
1841
|
+
sqlite: () => t` LIMIT -1`,
|
|
1842
|
+
mysql: () => t` LIMIT 18446744073709551615`,
|
|
1843
|
+
orElse: () => t``
|
|
1844
|
+
}) : t`` : t` LIMIT ${S(e.take)}`, r = b ? t` OFFSET ${S(e.skip)}` : t``;
|
|
1813
1845
|
return t`${se}SELECT ${f}${d} FROM ${te}${v}${re}${y}${ie}${n}${r}${h}`;
|
|
1814
1846
|
}
|
|
1815
1847
|
});
|
|
1816
|
-
},
|
|
1848
|
+
}, Q = (e, t) => {
|
|
1817
1849
|
let n = (e) => {
|
|
1818
1850
|
if (typeof e != "string" || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(e)) return null;
|
|
1819
1851
|
let [t = "", n = ""] = e.replace(/^[+-]/, "").split("."), r = t.replace(/^0+/, "") || "0";
|
|
@@ -1831,73 +1863,73 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1831
1863
|
a = t === n ? 0 : t > n ? 1 : -1;
|
|
1832
1864
|
}
|
|
1833
1865
|
return a === 0 ? 0 : (a > 0 ? 1 : -1) * (r.negative ? -1 : 1);
|
|
1834
|
-
},
|
|
1866
|
+
}, Kn = (e, t) => ({
|
|
1835
1867
|
column: e,
|
|
1836
1868
|
op: "eq",
|
|
1837
1869
|
value: t
|
|
1838
|
-
}),
|
|
1870
|
+
}), qn = (e, t) => ({
|
|
1839
1871
|
column: e,
|
|
1840
1872
|
op: "neq",
|
|
1841
1873
|
value: t
|
|
1842
|
-
}),
|
|
1874
|
+
}), Jn = (e, t) => ({
|
|
1843
1875
|
column: e,
|
|
1844
1876
|
op: "gt",
|
|
1845
1877
|
value: t
|
|
1846
|
-
}),
|
|
1878
|
+
}), Yn = (e, t) => ({
|
|
1847
1879
|
column: e,
|
|
1848
1880
|
op: "gte",
|
|
1849
1881
|
value: t
|
|
1850
|
-
}),
|
|
1882
|
+
}), Xn = (e, t) => ({
|
|
1851
1883
|
column: e,
|
|
1852
1884
|
op: "lt",
|
|
1853
1885
|
value: t
|
|
1854
|
-
}),
|
|
1886
|
+
}), Zn = (e, t) => ({
|
|
1855
1887
|
column: e,
|
|
1856
1888
|
op: "lte",
|
|
1857
1889
|
value: t
|
|
1858
|
-
}),
|
|
1890
|
+
}), Qn = (e, t) => ({
|
|
1859
1891
|
column: e,
|
|
1860
1892
|
op: "in",
|
|
1861
1893
|
value: t
|
|
1862
|
-
}),
|
|
1894
|
+
}), $n = (e, t) => ({
|
|
1863
1895
|
column: e,
|
|
1864
1896
|
op: "notIn",
|
|
1865
1897
|
value: t
|
|
1866
|
-
}),
|
|
1898
|
+
}), er = (e, t) => ({
|
|
1867
1899
|
column: e,
|
|
1868
1900
|
op: "contains",
|
|
1869
1901
|
value: t
|
|
1870
|
-
}),
|
|
1902
|
+
}), tr = (e, t) => ({
|
|
1871
1903
|
column: e,
|
|
1872
1904
|
op: "startsWith",
|
|
1873
1905
|
value: t
|
|
1874
|
-
}),
|
|
1906
|
+
}), nr = (e, t) => ({
|
|
1875
1907
|
column: e,
|
|
1876
1908
|
op: "arrayContains",
|
|
1877
1909
|
value: t
|
|
1878
|
-
}),
|
|
1910
|
+
}), rr = (e, t) => ({
|
|
1879
1911
|
column: e,
|
|
1880
1912
|
op: "arrayOverlaps",
|
|
1881
1913
|
value: t
|
|
1882
|
-
}),
|
|
1914
|
+
}), ir = (e, t) => ({
|
|
1883
1915
|
column: e,
|
|
1884
1916
|
op: "arrayHas",
|
|
1885
1917
|
value: t
|
|
1886
|
-
}),
|
|
1918
|
+
}), ar = {
|
|
1887
1919
|
column: "id",
|
|
1888
1920
|
op: "in",
|
|
1889
1921
|
value: []
|
|
1890
|
-
},
|
|
1922
|
+
}, or = (e) => ({
|
|
1891
1923
|
column: e,
|
|
1892
1924
|
op: "isNull"
|
|
1893
|
-
}),
|
|
1925
|
+
}), sr = (e) => ({
|
|
1894
1926
|
column: e,
|
|
1895
1927
|
op: "isNotNull"
|
|
1896
|
-
}),
|
|
1928
|
+
}), cr = (e, t) => ({
|
|
1897
1929
|
column: e,
|
|
1898
1930
|
op: "spatial",
|
|
1899
1931
|
value: t
|
|
1900
|
-
}),
|
|
1932
|
+
}), lr = (...e) => ({ and: e }), ur = (...e) => ({ or: e }), dr = (e) => ({ not: e }), fr = (e, ...t) => {
|
|
1901
1933
|
if (t.length === 0) throw E(`jsonField("${e}"): at least one path segment is required`);
|
|
1902
1934
|
let n = (n, r) => ({
|
|
1903
1935
|
column: e,
|
|
@@ -1919,56 +1951,69 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1919
1951
|
isNull: () => n("isNull"),
|
|
1920
1952
|
isNotNull: () => n("isNotNull")
|
|
1921
1953
|
};
|
|
1922
|
-
},
|
|
1954
|
+
}, $ = (e) => "descriptor" in e ? e.descriptor : e, pr = (e, t) => ({
|
|
1923
1955
|
column: e,
|
|
1924
1956
|
op: "subquery-in",
|
|
1925
|
-
subquery:
|
|
1926
|
-
}),
|
|
1957
|
+
subquery: $(t)
|
|
1958
|
+
}), mr = (e, t) => ({
|
|
1927
1959
|
column: e,
|
|
1928
1960
|
op: "subquery-not-in",
|
|
1929
|
-
subquery:
|
|
1930
|
-
}),
|
|
1961
|
+
subquery: $(t)
|
|
1962
|
+
}), hr = (e) => ({
|
|
1931
1963
|
op: "exists",
|
|
1932
|
-
subquery:
|
|
1933
|
-
}),
|
|
1964
|
+
subquery: $(e)
|
|
1965
|
+
}), gr = (e) => ({
|
|
1934
1966
|
op: "not-exists",
|
|
1935
|
-
subquery:
|
|
1936
|
-
}),
|
|
1967
|
+
subquery: $(e)
|
|
1968
|
+
}), _r = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/, vr = (e) => {
|
|
1937
1969
|
if (e instanceof Date) return e.getTime();
|
|
1938
|
-
if (typeof e == "string" &&
|
|
1970
|
+
if (typeof e == "string" && _r.test(e)) {
|
|
1939
1971
|
let t = Date.parse(e);
|
|
1940
1972
|
return Number.isNaN(t) ? void 0 : t;
|
|
1941
1973
|
}
|
|
1942
|
-
},
|
|
1974
|
+
}, yr = (e, t) => {
|
|
1943
1975
|
if (!(e instanceof Date) && !(t instanceof Date)) return;
|
|
1944
|
-
let n =
|
|
1976
|
+
let n = vr(e), r = vr(t);
|
|
1945
1977
|
return n === void 0 || r === void 0 ? void 0 : [n, r];
|
|
1946
|
-
},
|
|
1978
|
+
}, br = (e, t) => {
|
|
1947
1979
|
if (e === t) return !0;
|
|
1948
|
-
let n =
|
|
1980
|
+
let n = yr(e, t);
|
|
1949
1981
|
return n !== void 0 && n[0] === n[1];
|
|
1950
|
-
},
|
|
1982
|
+
}, xr = (e, t) => {
|
|
1951
1983
|
if (e == null || t == null) return null;
|
|
1952
|
-
let n =
|
|
1984
|
+
let n = yr(e, t);
|
|
1953
1985
|
if (n !== void 0) return n[0] === n[1] ? 0 : n[0] > n[1] ? 1 : -1;
|
|
1954
1986
|
let r = e instanceof Date ? e.getTime() : e, i = t instanceof Date ? t.getTime() : t;
|
|
1955
1987
|
return typeof r == typeof i ? r === i ? 0 : r > i ? 1 : -1 : null;
|
|
1956
|
-
},
|
|
1988
|
+
}, Sr = (e, t, n = null, r = {}) => Cr(e, t, n, r) === !0, Cr = (e, t, n = null, r = {}) => {
|
|
1957
1989
|
if (!t) return !1;
|
|
1958
|
-
if ("not" in e)
|
|
1990
|
+
if ("not" in e) {
|
|
1991
|
+
let i = Cr(e.not, t, n, r);
|
|
1992
|
+
return i === null ? null : !i;
|
|
1993
|
+
}
|
|
1959
1994
|
if ("and" in e) {
|
|
1960
|
-
|
|
1961
|
-
|
|
1995
|
+
let i = !1;
|
|
1996
|
+
for (let a of e.and) {
|
|
1997
|
+
let e = Cr(a, t, n, r);
|
|
1998
|
+
if (e === !1) return !1;
|
|
1999
|
+
e === null && (i = !0);
|
|
2000
|
+
}
|
|
2001
|
+
return !i || null;
|
|
1962
2002
|
}
|
|
1963
2003
|
if ("or" in e) {
|
|
1964
|
-
|
|
1965
|
-
|
|
2004
|
+
let i = !1;
|
|
2005
|
+
for (let a of e.or) {
|
|
2006
|
+
let e = Cr(a, t, n, r);
|
|
2007
|
+
if (e === !0) return !0;
|
|
2008
|
+
e === null && (i = !0);
|
|
2009
|
+
}
|
|
2010
|
+
return i ? null : !1;
|
|
1966
2011
|
}
|
|
1967
2012
|
if (e.op === "subquery-in" || e.op === "subquery-not-in") {
|
|
1968
2013
|
if (!n) return !1;
|
|
1969
2014
|
let i = n.get(e.subquery);
|
|
1970
2015
|
if (!(i instanceof Set)) return !1;
|
|
1971
|
-
let a = t[e.column], o = r[e.column]?.type === "decimal" ? [...i].some((e) =>
|
|
2016
|
+
let a = t[e.column], o = r[e.column]?.type === "decimal" ? [...i].some((e) => Q(a, e) === 0) : i.has(a);
|
|
1972
2017
|
return e.op === "subquery-in" ? o : !o;
|
|
1973
2018
|
}
|
|
1974
2019
|
if (e.op === "exists" || e.op === "not-exists") {
|
|
@@ -1976,42 +2021,46 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
1976
2021
|
let t = n.get(e.subquery), r = typeof t == "number" ? t > 0 : t instanceof Set && t.size > 0;
|
|
1977
2022
|
return e.op === "exists" ? r : !r;
|
|
1978
2023
|
}
|
|
1979
|
-
let i = e, a = t[i.column], o =
|
|
2024
|
+
let i = e, a = t[i.column], o = G(i.value) ? i.value : void 0;
|
|
2025
|
+
if (o !== void 0 && (!gn.some((e) => e === i.op) || i.path !== void 0)) throw E("Column references require a scalar comparison without a JSON path");
|
|
2026
|
+
let s = o === void 0 ? i.value : t[o.column];
|
|
2027
|
+
if (o !== void 0 && (a == null || s == null)) return null;
|
|
2028
|
+
let c = r[i.column]?.type === "decimal", l = (e, t) => c && e != null && t != null ? Q(e, t) === 0 : br(e, t), u = c ? Q : xr;
|
|
1980
2029
|
switch (i.op) {
|
|
1981
|
-
case "eq": return
|
|
1982
|
-
case "neq": return !
|
|
1983
|
-
case "gt": return (
|
|
1984
|
-
case "gte": return (
|
|
1985
|
-
case "lt": return (
|
|
1986
|
-
case "lte": return (
|
|
1987
|
-
case "in": return Array.isArray(
|
|
1988
|
-
case "notIn": return Array.isArray(
|
|
1989
|
-
case "contains": return typeof a == "string" && typeof
|
|
1990
|
-
case "startsWith": return typeof a == "string" && typeof
|
|
2030
|
+
case "eq": return l(a, s);
|
|
2031
|
+
case "neq": return !l(a, s);
|
|
2032
|
+
case "gt": return (u(a, s) ?? -1) > 0;
|
|
2033
|
+
case "gte": return (u(a, s) ?? -1) >= 0;
|
|
2034
|
+
case "lt": return (u(a, s) ?? 1) < 0;
|
|
2035
|
+
case "lte": return (u(a, s) ?? 1) <= 0;
|
|
2036
|
+
case "in": return Array.isArray(s) && s.some((e) => l(a, e));
|
|
2037
|
+
case "notIn": return Array.isArray(s) && !s.some((e) => l(a, e));
|
|
2038
|
+
case "contains": return typeof a == "string" && typeof s == "string" && a.toLowerCase().includes(s.toLowerCase());
|
|
2039
|
+
case "startsWith": return typeof a == "string" && typeof s == "string" && a.startsWith(s);
|
|
1991
2040
|
case "arrayContains": {
|
|
1992
2041
|
let e = Array.isArray(a) ? a : [];
|
|
1993
|
-
return (Array.isArray(
|
|
2042
|
+
return (Array.isArray(s) ? s : []).every((t) => e.includes(t));
|
|
1994
2043
|
}
|
|
1995
2044
|
case "arrayOverlaps": {
|
|
1996
2045
|
let e = Array.isArray(a) ? a : [];
|
|
1997
|
-
return (Array.isArray(
|
|
2046
|
+
return (Array.isArray(s) ? s : []).some((t) => e.includes(t));
|
|
1998
2047
|
}
|
|
1999
|
-
case "arrayHas": return Array.isArray(a) && a.includes(
|
|
2048
|
+
case "arrayHas": return Array.isArray(a) && a.includes(s);
|
|
2000
2049
|
case "isNull": return a == null;
|
|
2001
2050
|
case "isNotNull": return a != null;
|
|
2002
2051
|
case "spatial": throw E("@voltro/plugin-postgis: spatial predicates (ST_DWithin / ST_Contains / ST_Within / ST_Intersects / bbox &&) are not evaluable in-memory — use them in one-shot ctx.store.query reads, not reactive subscriptions.");
|
|
2003
2052
|
}
|
|
2004
|
-
},
|
|
2053
|
+
}, wr = function* (e) {
|
|
2005
2054
|
if ("not" in e) {
|
|
2006
|
-
yield*
|
|
2055
|
+
yield* wr(e.not);
|
|
2007
2056
|
return;
|
|
2008
2057
|
}
|
|
2009
2058
|
if ("and" in e) {
|
|
2010
|
-
for (let t of e.and) yield*
|
|
2059
|
+
for (let t of e.and) yield* wr(t);
|
|
2011
2060
|
return;
|
|
2012
2061
|
}
|
|
2013
2062
|
if ("or" in e) {
|
|
2014
|
-
for (let t of e.or) yield*
|
|
2063
|
+
for (let t of e.or) yield* wr(t);
|
|
2015
2064
|
return;
|
|
2016
2065
|
}
|
|
2017
2066
|
e.op === "subquery-in" || e.op === "subquery-not-in" ? yield {
|
|
@@ -2021,30 +2070,30 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2021
2070
|
kind: "exists",
|
|
2022
2071
|
descriptor: e.subquery
|
|
2023
2072
|
});
|
|
2024
|
-
},
|
|
2073
|
+
}, Tr = function* (e, t = !0) {
|
|
2025
2074
|
if ("not" in e) {
|
|
2026
|
-
yield*
|
|
2075
|
+
yield* Tr(e.not, !1);
|
|
2027
2076
|
return;
|
|
2028
2077
|
}
|
|
2029
2078
|
if ("and" in e) {
|
|
2030
|
-
for (let n of e.and) yield*
|
|
2079
|
+
for (let n of e.and) yield* Tr(n, t);
|
|
2031
2080
|
return;
|
|
2032
2081
|
}
|
|
2033
2082
|
if ("or" in e) {
|
|
2034
|
-
for (let t of e.or) yield*
|
|
2083
|
+
for (let t of e.or) yield* Tr(t, !1);
|
|
2035
2084
|
return;
|
|
2036
2085
|
}
|
|
2037
2086
|
e.op !== "subquery-in" && e.op !== "subquery-not-in" && e.op !== "exists" && e.op !== "not-exists" && (yield {
|
|
2038
2087
|
...e,
|
|
2039
|
-
conjunctive: t
|
|
2088
|
+
conjunctive: t && !G(e.value)
|
|
2040
2089
|
});
|
|
2041
|
-
},
|
|
2090
|
+
}, Er = (e, t) => ({
|
|
2042
2091
|
name: e,
|
|
2043
2092
|
body: t
|
|
2044
|
-
}),
|
|
2093
|
+
}), Dr = (e) => {
|
|
2045
2094
|
if (e.lifecycle === "cron" && !e.cron) throw Error(`seed "${e.id}": lifecycle 'cron' requires a 'cron' field`);
|
|
2046
2095
|
if (e.lifecycle === "onSchemaChange" && (!e.watchedTables || e.watchedTables.length === 0)) throw Error(`seed "${e.id}": lifecycle 'onSchemaChange' requires at least one entry in 'watchedTables'`);
|
|
2047
|
-
let t = e.steps({ step:
|
|
2096
|
+
let t = e.steps({ step: Er });
|
|
2048
2097
|
if (t.length === 0) throw Error(`seed "${e.id}": at least one step is required`);
|
|
2049
2098
|
return {
|
|
2050
2099
|
__seed: !0,
|
|
@@ -2057,76 +2106,76 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2057
2106
|
...e.fingerprint === void 0 ? {} : { fingerprint: e.fingerprint },
|
|
2058
2107
|
steps: t
|
|
2059
2108
|
};
|
|
2060
|
-
},
|
|
2061
|
-
|
|
2062
|
-
},
|
|
2063
|
-
|
|
2064
|
-
},
|
|
2065
|
-
let t =
|
|
2109
|
+
}, Or = (e) => typeof e == "object" && !!e && "__seed" in e && e.__seed === !0, kr = null, Ar = null, jr = (e) => {
|
|
2110
|
+
kr = e;
|
|
2111
|
+
}, Mr = (e) => {
|
|
2112
|
+
Ar = e;
|
|
2113
|
+
}, Nr = async (e) => {
|
|
2114
|
+
let t = kr;
|
|
2066
2115
|
t !== null && await t(e);
|
|
2067
|
-
},
|
|
2068
|
-
let t =
|
|
2116
|
+
}, Pr = async (e) => {
|
|
2117
|
+
let t = Ar;
|
|
2069
2118
|
t !== null && e.changedTables.length !== 0 && await t(e);
|
|
2070
|
-
},
|
|
2119
|
+
}, Fr = ["before-schema", "after-schema"], Ir = (e) => {
|
|
2071
2120
|
if (!e.id || e.id.length === 0) throw Error("migration: `id` is required + must be non-empty");
|
|
2072
2121
|
if (!e.up || !e.down) throw Error(`migration ${e.id}: both \`up\` and \`down\` must be functions`);
|
|
2073
|
-
if (!
|
|
2122
|
+
if (!Fr.includes(e.phase)) throw Error(`migration ${e.id}: \`phase\` is required and must be one of ${Fr.map((e) => `'${e}'`).join(" | ")} — 'before-schema' runs before the declarative apply (a shape change the planner must not compute against), 'after-schema' runs after it (a body that needs the new shape, such as a back-fill into a table this deploy creates)`);
|
|
2074
2123
|
return e;
|
|
2075
|
-
},
|
|
2124
|
+
}, Lr = Symbol.for("voltro.migration.irreversible"), Rr = class extends Error {
|
|
2076
2125
|
migrationId;
|
|
2077
2126
|
reason;
|
|
2078
2127
|
_tag = "IrreversibleMigrationError";
|
|
2079
2128
|
constructor(e, t) {
|
|
2080
2129
|
super(`migration ${e} cannot be rolled back: ${t}`), this.migrationId = e, this.reason = t, this.name = "IrreversibleMigrationError";
|
|
2081
2130
|
}
|
|
2082
|
-
},
|
|
2131
|
+
}, zr = (e) => {
|
|
2083
2132
|
if (!e || e.trim().length === 0) throw Error("irreversible(): a reason is required");
|
|
2084
|
-
return Object.assign(() => t.fail(new
|
|
2085
|
-
},
|
|
2086
|
-
let t = e[
|
|
2133
|
+
return Object.assign(() => t.fail(new Rr("<unknown>", e)), { [Lr]: e });
|
|
2134
|
+
}, Br = (e) => {
|
|
2135
|
+
let t = e[Lr];
|
|
2087
2136
|
return typeof t == "string" ? t : void 0;
|
|
2088
|
-
},
|
|
2137
|
+
}, Vr = class {
|
|
2089
2138
|
reason;
|
|
2090
2139
|
_tag = "MigrationSkipped";
|
|
2091
2140
|
constructor(e) {
|
|
2092
2141
|
this.reason = e;
|
|
2093
2142
|
}
|
|
2094
|
-
},
|
|
2143
|
+
}, Hr = class extends Error {
|
|
2095
2144
|
migrationId;
|
|
2096
2145
|
failed;
|
|
2097
2146
|
_tag = "MigrationExpectationFailed";
|
|
2098
2147
|
constructor(e, t) {
|
|
2099
2148
|
super(`migration ${e}: ${t.length} post-condition(s) did not hold after up():\n` + t.map((e) => ` - ${e}`).join("\n") + "\n The migration is NOT recorded; the next run applies it again."), this.migrationId = e, this.failed = t, this.name = "MigrationExpectationFailed";
|
|
2100
2149
|
}
|
|
2101
|
-
},
|
|
2150
|
+
}, Ur = class extends Error {
|
|
2102
2151
|
migrationId;
|
|
2103
2152
|
dialect;
|
|
2104
2153
|
_tag = "TransactionBrokenByBodyError";
|
|
2105
2154
|
constructor(e, t) {
|
|
2106
2155
|
super(`migration ${e} is transactional, and its body COMMITTED the transaction from inside — on ${t} a DDL statement commits everything before it. The work is in the database and the migration is recorded; it will not run again. What did not hold is the all-or-nothing guarantee. Either mark it \`transactional: false\` (per-statement, resumable through your own idempotency) or move the schema change into \`ctx.schema\` in a migration of its own and keep this one to data.`), this.migrationId = e, this.dialect = t, this.name = "TransactionBrokenByBodyError";
|
|
2107
2156
|
}
|
|
2108
|
-
},
|
|
2157
|
+
}, Wr = class extends Error {
|
|
2109
2158
|
migrationId;
|
|
2110
2159
|
operation;
|
|
2111
2160
|
_tag = "MigrationNeedsSqlClient";
|
|
2112
2161
|
constructor(e, t, n) {
|
|
2113
2162
|
super(`migration ${e}: ${t} — ${n}`), this.migrationId = e, this.operation = t, this.name = "MigrationNeedsSqlClient";
|
|
2114
2163
|
}
|
|
2115
|
-
},
|
|
2164
|
+
}, Gr = class extends Error {
|
|
2116
2165
|
table;
|
|
2117
2166
|
report;
|
|
2118
2167
|
_tag = "RewriteUnstableError";
|
|
2119
2168
|
constructor(e, t) {
|
|
2120
2169
|
super(`rewrite of ${e} did not stabilise after ${t.passes} pass(es): ${t.rewritten} rewritten, ${t.contended} contended on the last pass. Check for concurrent writes and guard values that cannot round-trip exactly before raising maxPasses.`), this.table = e, this.report = t, this.name = "RewriteUnstableError";
|
|
2121
2170
|
}
|
|
2122
|
-
},
|
|
2171
|
+
}, Kr = /^\d{8}_\d{6}_[a-z0-9_]+\.ts$/, qr = (e) => typeof e == "object" && !!e && "id" in e && "up" in e && "down" in e && typeof e.id == "string" && typeof e.up == "function" && typeof e.down == "function", Jr = /* @__PURE__ */ new Set(["voltro_isr_cache"]), Yr = (e) => Jr.has(e) || e.startsWith("_voltro_") || e.startsWith("_cloud_") || e.startsWith("cluster_") || e.startsWith("__turso_internal_"), Xr = "_voltro_staging_", Zr = (e) => e.startsWith(Xr), Qr = /__dropped_\d{14}$/, $r = (e) => Qr.test(e), ei = 7, ti = (e) => {
|
|
2123
2172
|
let t = /__dropped_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/.exec(e);
|
|
2124
2173
|
if (t === null) return;
|
|
2125
2174
|
let [, n, r, i, a, o, s] = t;
|
|
2126
2175
|
return new Date(Date.UTC(Number(n), Number(r) - 1, Number(i), Number(a), Number(o), Number(s)));
|
|
2127
|
-
},
|
|
2176
|
+
}, ni = (e, t = {}) => {
|
|
2128
2177
|
let n = t.now ?? /* @__PURE__ */ new Date(), r = t.retentionDays ?? 7, i = [], a = (e, t) => {
|
|
2129
|
-
let a =
|
|
2178
|
+
let a = ti(e);
|
|
2130
2179
|
if (a === void 0) return;
|
|
2131
2180
|
let o = Math.floor((n.getTime() - a.getTime()) / 864e5);
|
|
2132
2181
|
o >= r && i.push({
|
|
@@ -2135,12 +2184,12 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2135
2184
|
ageDays: o
|
|
2136
2185
|
});
|
|
2137
2186
|
};
|
|
2138
|
-
for (let t of e.tables) if (a(t.name, t.name),
|
|
2187
|
+
for (let t of e.tables) if (a(t.name, t.name), !$r(t.name)) for (let e of t.columns ?? []) a(e.name, `${t.name}.${e.name}`);
|
|
2139
2188
|
return i;
|
|
2140
|
-
},
|
|
2189
|
+
}, ri = (e, t) => {
|
|
2141
2190
|
let n = e.reduce((e, t) => e.ageDays >= t.ageDays ? e : t), r = (/* @__PURE__ */ new Date(Date.now() - t * 864e5)).toISOString().slice(0, 10);
|
|
2142
2191
|
return `${e.length} soft-drop snapshot(s) older than ${t} day(s) still hold the dropped data (oldest: ${n.name}, ${n.ageDays}d) — ${e.map((e) => e.name).join(", ")}. Restore with \`voltro db restore-snapshot\` or reclaim with \`voltro db gc-snapshots --before ${r}\`; the window is \`database.softDropRetentionDays\` in app.config.`;
|
|
2143
|
-
},
|
|
2192
|
+
}, ii = (e, t) => e.filter((e) => !Yr(e.name) || t.has(e.name)), ai = L("_voltro_migrations", {
|
|
2144
2193
|
id: f({ prefix: "mig" }),
|
|
2145
2194
|
name: p(),
|
|
2146
2195
|
hash: p(),
|
|
@@ -2152,7 +2201,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2152
2201
|
workflowRunId: p().nullable(),
|
|
2153
2202
|
createdAt: v().default("now"),
|
|
2154
2203
|
updatedAt: v().default("now").onUpdate("now")
|
|
2155
|
-
}).index(["status"]),
|
|
2204
|
+
}).index(["status"]), oi = L("_voltro_seeds", {
|
|
2156
2205
|
id: f({ prefix: "seed" }),
|
|
2157
2206
|
name: p(),
|
|
2158
2207
|
lifecycle: p(),
|
|
@@ -2168,19 +2217,19 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2168
2217
|
workflowRunId: p().nullable(),
|
|
2169
2218
|
createdAt: v().default("now"),
|
|
2170
2219
|
updatedAt: v().default("now").onUpdate("now")
|
|
2171
|
-
}).index(["lifecycle"]).index(["nextRunAt"]),
|
|
2220
|
+
}).index(["lifecycle"]).index(["nextRunAt"]), si = L("_voltro_schema_owner", {
|
|
2172
2221
|
id: f({ prefix: "own" }),
|
|
2173
2222
|
appName: p(),
|
|
2174
2223
|
projectName: p().nullable(),
|
|
2175
2224
|
frameworkVersion: p().nullable(),
|
|
2176
2225
|
claimedAt: v().default("now")
|
|
2177
|
-
}),
|
|
2226
|
+
}), ci = L("_voltro_plugin_migrations", {
|
|
2178
2227
|
id: f({ prefix: "plm" }),
|
|
2179
2228
|
plugin_name: p(),
|
|
2180
2229
|
migration_id: p(),
|
|
2181
2230
|
description: p().nullable(),
|
|
2182
2231
|
applied_at: p()
|
|
2183
|
-
}),
|
|
2232
|
+
}), li = L("_voltro_migration_plans", {
|
|
2184
2233
|
id: f({ prefix: "plan" }),
|
|
2185
2234
|
fingerprint: p(),
|
|
2186
2235
|
liveFingerprint: p().nullable(),
|
|
@@ -2196,14 +2245,14 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2196
2245
|
appliedAt: v().default("now"),
|
|
2197
2246
|
createdAt: v().default("now"),
|
|
2198
2247
|
updatedAt: v().default("now").onUpdate("now")
|
|
2199
|
-
}).index(["fingerprint"]).index(["environment"]),
|
|
2248
|
+
}).index(["fingerprint"]).index(["environment"]), ui = L("_voltro_idempotency", {
|
|
2200
2249
|
id: f({ prefix: "idem" }),
|
|
2201
2250
|
scope: p(),
|
|
2202
2251
|
key: p(),
|
|
2203
2252
|
status: p(),
|
|
2204
2253
|
response: y().nullable(),
|
|
2205
2254
|
createdAt: v().default("now")
|
|
2206
|
-
}).unique(["scope", "key"]).index(["createdAt"]),
|
|
2255
|
+
}).unique(["scope", "key"]).index(["createdAt"]), di = L("_voltro_devices", {
|
|
2207
2256
|
id: f({ prefix: "device" }),
|
|
2208
2257
|
tenantId: p(),
|
|
2209
2258
|
name: p(),
|
|
@@ -2223,20 +2272,20 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2223
2272
|
createdBy: p().nullable(),
|
|
2224
2273
|
metadata: y().nullable(),
|
|
2225
2274
|
createdAt: v()
|
|
2226
|
-
}).index(["tenantId"]).index(["pairingHash"]).index(["accessHash"]).index(["refreshHash"]).index(["previousRefreshHash"]),
|
|
2275
|
+
}).index(["tenantId"]).index(["pairingHash"]).index(["accessHash"]).index(["refreshHash"]).index(["previousRefreshHash"]), fi = L("_voltro_tenant_selections", {
|
|
2227
2276
|
id: f({ prefix: "tsel" }),
|
|
2228
2277
|
subjectType: p().maxLength(32),
|
|
2229
2278
|
subjectId: p(),
|
|
2230
2279
|
tenantId: p(),
|
|
2231
2280
|
selectedAt: v()
|
|
2232
|
-
}).primaryKey(["id"]).nonReactive(),
|
|
2281
|
+
}).primaryKey(["id"]).nonReactive(), pi = L("_voltro_kv", {
|
|
2233
2282
|
id: f({ prefix: "kv" }),
|
|
2234
2283
|
key: p().unique(),
|
|
2235
2284
|
value: p().nullable(),
|
|
2236
2285
|
expiresAt: v().nullable(),
|
|
2237
2286
|
createdAt: v().default("now"),
|
|
2238
2287
|
updatedAt: v().default("now").onUpdate("now")
|
|
2239
|
-
}).index(["expiresAt"]),
|
|
2288
|
+
}).index(["expiresAt"]), mi = L("_voltro_api_keys", {
|
|
2240
2289
|
id: f({ prefix: "apikey" }),
|
|
2241
2290
|
tenantId: p().nullable(),
|
|
2242
2291
|
name: p(),
|
|
@@ -2251,7 +2300,7 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2251
2300
|
onBehalfOf: p().nullable(),
|
|
2252
2301
|
metadata: y().nullable(),
|
|
2253
2302
|
createdAt: v().default("now")
|
|
2254
|
-
}).index("byApiKeyTenant", ["tenantId"]),
|
|
2303
|
+
}).index("byApiKeyTenant", ["tenantId"]), hi = L("_voltro_replica_observations", {
|
|
2255
2304
|
id: f({ prefix: "robs" }),
|
|
2256
2305
|
replicaId: p().maxLength(191),
|
|
2257
2306
|
startedAt: v(),
|
|
@@ -2260,11 +2309,11 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2260
2309
|
payload: p().nullable(),
|
|
2261
2310
|
reachableAt: p().maxLength(255).nullable(),
|
|
2262
2311
|
writtenAt: v().default("now").onUpdate("now")
|
|
2263
|
-
}).unique(["replicaId", "kind"]).index(["kind"]),
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
],
|
|
2312
|
+
}).unique(["replicaId", "kind"]).index(["kind"]), gi = [
|
|
2313
|
+
ai,
|
|
2314
|
+
oi,
|
|
2315
|
+
li
|
|
2316
|
+
], _i = "_voltro_replace_in_progress", vi = L(_i, {
|
|
2268
2317
|
id: f({ prefix: "repl" }),
|
|
2269
2318
|
startedAt: v().default("now"),
|
|
2270
2319
|
kind: p().default("replace"),
|
|
@@ -2274,10 +2323,10 @@ var Zt = (e, t, n) => Qt(e, "id", t, n), Qt = (e, t, n, r, i = "asc") => {
|
|
|
2274
2323
|
staging: p().nullable(),
|
|
2275
2324
|
heartbeatAt: v().nullable(),
|
|
2276
2325
|
resumable: _().nullable()
|
|
2277
|
-
}).nonReactive(),
|
|
2326
|
+
}).nonReactive(), yi = 30, bi = (e, t) => {
|
|
2278
2327
|
let n = typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 30, r = Number(e.VOLTRO_STAGING_STALE_MINUTES);
|
|
2279
2328
|
return (Number.isFinite(r) && r > 0 ? r : n) * 6e4;
|
|
2280
|
-
},
|
|
2329
|
+
}, xi = (e) => e == null || String(e).length === 0 ? [] : String(e).split(",").map((e) => e.trim()).filter((e) => e.length > 0), Si = (e) => {
|
|
2281
2330
|
let t = e.filter((e) => e.kind !== "staging");
|
|
2282
2331
|
if (t.length !== 0) return `refusing to start: a destructive data operation did not finish.
|
|
2283
2332
|
${t.map((e) => {
|
|
@@ -2292,7 +2341,7 @@ ${t.map((e) => {
|
|
|
2292
2341
|
|
|
2293
2342
|
When the data is back, or you have decided the current state is correct, clear the marker:
|
|
2294
2343
|
voltro data clear-replace-marker --yes`;
|
|
2295
|
-
},
|
|
2344
|
+
}, Ci = (e, t, n) => {
|
|
2296
2345
|
let r = e.filter((e) => e.kind === "staging");
|
|
2297
2346
|
return {
|
|
2298
2347
|
all: r,
|
|
@@ -2302,7 +2351,7 @@ ${t.map((e) => {
|
|
|
2302
2351
|
return Number.isFinite(r) ? t - r >= n : !1;
|
|
2303
2352
|
})
|
|
2304
2353
|
};
|
|
2305
|
-
},
|
|
2354
|
+
}, wi = (e, t) => {
|
|
2306
2355
|
if (e.all.length === 0) return;
|
|
2307
2356
|
let n = new Set(e.droppable.map((e) => e.id));
|
|
2308
2357
|
return `staged data-import leftovers:
|
|
@@ -2313,4 +2362,4 @@ ${e.all.map((e) => {
|
|
|
2313
2362
|
a reason to refuse the boot — it is a reason to know the disk is holding a copy of a bundle.`;
|
|
2314
2363
|
};
|
|
2315
2364
|
//#endregion
|
|
2316
|
-
export {
|
|
2365
|
+
export { rr as $, Le as $n, en as $t, ti as A, mt as An, de as Ar, An as At, Br as B, at as Bn, o as Br, un as Bt, Xr as C, Tt as Cn, ne as Cr, Q as Ct, $r as D, xt as Dn, pe as Dr, Z as Dt, Yr as E, St as En, fe as Er, Gn as Et, Wr as F, lt as Fn, me as Fr, Tn as Ft, Nr as G, M as Gn, rn as Gt, Ir as H, Ve as Hn, v as Hr, dn as Ht, Vr as I, dt as In, c as Ir, K as It, jr as J, P as Jn, Ft as Jt, Or as K, N as Kn, nn as Kt, Gr as L, ot as Ln, h as Lr, _n as Lt, Rr as M, L as Mn, C as Mr, xn as Mt, Fr as N, pt as Nn, ee as Nr, q as Nt, Zr as O, bt as On, f as Or, J as Ot, Hr as P, ut as Pn, ce as Pr, En as Pt, ir as Q, Pe as Qn, Nt as Qt, Ur as R, ct as Rn, oe as Rr, hn as Rt, Jr as S, jt as Sn, re as Sr, Tr as St, ri as T, kt as Tn, se as Tr, Mn as Tt, Dr as U, He as Un, le as Ur, mn as Ut, qr as V, nt as Vn, p as Vr, fn as Vt, Pr as W, Ue as Wn, tn as Wt, lr as X, Oe as Xn, Rt as Xt, ar as Y, E as Yn, Yt, nr as Z, T as Zn, Mt as Zt, si as _, Bt as _n, b as _r, $n as _t, wi as a, Lt as an, Ee as ar, Jn as at, gi as b, Et as bn, s as br, cr as bt, bi as c, $t as cn, ve as cr, pr as ct, ui as d, Wt as dn, ge as dr, fr as dt, Gt as en, Re as er, wr as et, pi as f, Xt as fn, u as fr, Xn as ft, hi as g, zt as gn, _ as gr, gr as gt, ci as h, Jt as hn, te as hr, dr as ht, Si as i, qt as in, Ie as ir, hr as it, Kr as j, ft as jn, y as jr, Sn as jt, ii as k, R as kn, m as kr, kn as kt, mi as l, Qt as ln, ye as lr, sr as lt, ai as m, Pt as mn, ue as mr, qn as mt, yi as n, Vt as nn, Te as nr, Kn as nt, Ci as o, It as on, be as or, Yn as ot, li as p, Ut as pn, S as pr, Zn as pt, Mr as q, j as qn, an as qt, vi as r, Kt as rn, Fe as rr, Sr as rt, xi as s, V as sn, xe as sr, Qn as st, _i as t, Ht as tn, ze as tr, er as tt, di as u, Zt as un, _e as ur, or as ut, oi as v, Ot as vn, ie as vr, mr as vt, ni as w, Dt as wn, g as wr, Y as wt, ei as x, B as xn, x as xr, tr as xt, fi as y, At as yn, l as yr, ur as yt, zr as z, st as zn, ae as zr, G as zt };
|