@voltro/database 0.22.1 → 0.24.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.
@@ -177,7 +177,7 @@ var r = (e) => {
177
177
  enumValues: t
178
178
  })
179
179
  };
180
- }, ae = () => a("boolean"), oe = () => a("timestamp"), l = () => a("date"), se = () => a("json"), ce = () => a("bytes"), le = (e, t) => new i({
180
+ }, ae = () => a("boolean"), oe = () => a("timestamp"), se = () => a("date"), ce = () => a("json"), le = () => a("bytes"), l = (e, t) => new i({
181
181
  type: "reference",
182
182
  nullable: !1,
183
183
  unique: !1,
@@ -187,13 +187,13 @@ var r = (e) => {
187
187
  refOnUpdate: t?.onUpdate ?? "noAction",
188
188
  fkAutoIndex: t?.index ?? !0,
189
189
  ...t?.orphanPolicy ? { orphanPolicy: t.orphanPolicy } : {}
190
- }), ue = () => new i({
190
+ }), u = () => new i({
191
191
  type: "text",
192
192
  nullable: !0,
193
193
  unique: !1,
194
194
  hasDefault: !1,
195
195
  dropped: !0
196
- }), de = (e, t) => {
196
+ }), d = (e, t) => {
197
197
  if (!Number.isInteger(e) || e <= 0) throw Error(`vector(${String(e)}): dimension must be a positive integer (the embedding length, e.g. vector(1536)).`);
198
198
  return new i({
199
199
  type: "vector",
@@ -203,13 +203,13 @@ var r = (e) => {
203
203
  vectorDim: e,
204
204
  vectorPrecision: t?.precision ?? "float32"
205
205
  });
206
- }, fe = (e) => new i({
206
+ }, ue = (e) => new i({
207
207
  type: "array",
208
208
  nullable: !1,
209
209
  unique: !1,
210
210
  hasDefault: !1,
211
211
  arrayElement: e.__definition().type
212
- }), pe = () => a("interval"), me = (e, t = 4326) => new i({
212
+ }), de = () => a("interval"), fe = (e, t = 4326) => new i({
213
213
  type: "text",
214
214
  nullable: !1,
215
215
  unique: !1,
@@ -219,7 +219,7 @@ var r = (e) => {
219
219
  geomKind: e,
220
220
  srid: t
221
221
  }
222
- }), he = (e, t = 4326) => new i({
222
+ }), pe = (e, t = 4326) => new i({
223
223
  type: "text",
224
224
  nullable: !1,
225
225
  unique: !1,
@@ -229,44 +229,44 @@ var r = (e) => {
229
229
  geomKind: e,
230
230
  srid: t
231
231
  }
232
- }), ge = (e) => new i({
232
+ }), me = (e) => new i({
233
233
  type: "raw",
234
234
  nullable: !1,
235
235
  unique: !1,
236
236
  hasDefault: !1,
237
237
  rawDdl: e
238
- }), u = (e) => {
238
+ }), f = (e) => {
239
239
  let t = {};
240
240
  for (let [n, r] of Object.entries(e)) t[n] = r.__definition();
241
241
  return t;
242
- }, d = /* @__PURE__ */ new Map(), _e = (e, t) => {
242
+ }, p = /* @__PURE__ */ new Map(), he = (e, t) => {
243
243
  if (t.from === t.to) throw Error(`declareEnumRename('${e}'): \`from\` and \`to\` are both '${t.from}' — a rename must change the value.`);
244
- let n = d.get(e) ?? [];
244
+ let n = p.get(e) ?? [];
245
245
  for (let r of n) {
246
246
  if (r.from === t.from && r.to === t.to) return;
247
247
  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}'.`);
248
248
  }
249
- n.push(t), d.set(e, n);
250
- }, ve = (e) => d.get(e) ?? [], ye = () => d, f = () => {
251
- d.clear();
252
- }, p = 63, m = 60, h = [], g = (e) => {
253
- h.includes(e) || h.push(e);
254
- }, be = () => {
255
- let e = h.slice();
256
- return h.length = 0, e;
257
- }, xe = /^[a-zA-Z_][a-zA-Z0-9_]*$/, _ = (e, t) => {
249
+ n.push(t), p.set(e, n);
250
+ }, ge = (e) => p.get(e) ?? [], _e = () => p, ve = () => {
251
+ p.clear();
252
+ }, ye = 63, be = 60, m = [], h = (e) => {
253
+ m.includes(e) || m.push(e);
254
+ }, xe = () => {
255
+ let e = m.slice();
256
+ return m.length = 0, e;
257
+ }, Se = /^[a-zA-Z_][a-zA-Z0-9_]*$/, g = (e, t) => {
258
258
  if (t.length === 0) throw Error(`${e} cannot be empty.`);
259
- if (!xe.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_]*$/.`);
260
- }, v = (e) => {
261
- if (_("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.`);
262
- e.length > 60 && g(`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.`);
263
- }, y = (e, t) => {
264
- if (_("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.`);
265
- t.length > 60 && g(`column '${t}' on table '${e}' is ${t.length} chars — close to the 63-byte limit.`);
266
- }, b = (e, t, n, r) => {
267
- if (_("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.`);
268
- t.length > 60 && g(`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.` : ""}`);
269
- }, x = (e, t) => {
259
+ if (!Se.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_]*$/.`);
260
+ }, _ = (e) => {
261
+ if (g("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.`);
262
+ e.length > 60 && h(`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.`);
263
+ }, v = (e, t) => {
264
+ if (g("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.`);
265
+ t.length > 60 && h(`column '${t}' on table '${e}' is ${t.length} chars — close to the 63-byte limit.`);
266
+ }, y = (e, t, n, r) => {
267
+ if (g("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.`);
268
+ t.length > 60 && h(`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.` : ""}`);
269
+ }, b = (e, t) => {
270
270
  if (e.length === 0) throw Error(`typeid prefix on table '${t.tableName}' cannot be empty.`);
271
271
  if (!/^[a-z][a-z0-9_]*$/.test(e)) {
272
272
  let n = t.kind === "derived" ? "the derived prefix doesn't match typeid's required shape — supply an explicit one via id({ prefix: '...' })." : "the prefix must match typeid's required shape /^[a-z][a-z0-9_]*$/.";
@@ -276,44 +276,44 @@ var r = (e) => {
276
276
  let n = t.kind === "derived" ? "shorten the table name, or supply an explicit short prefix via id({ prefix: '...' })." : "pick a shorter prefix.";
277
277
  throw Error(`typeid prefix '${e}' on table '${t.tableName}' is ${e.length} chars — exceeds the 63-byte limit; ${n}`);
278
278
  }
279
- e.length > 60 && g(`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).`);
280
- }, Se = 1704067200000n, Ce = 10n, S = 12n, C = (1n << Ce) - 1n, w = (1n << S) - 1n, T = S, E = 22n, D = () => {
279
+ e.length > 60 && h(`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).`);
280
+ }, Ce = 1704067200000n, we = 10n, x = 12n, S = (1n << we) - 1n, C = (1n << x) - 1n, w = x, T = 22n, E = () => {
281
281
  let e = process.env.SNOWFLAKE_MACHINE_ID;
282
282
  if (e === void 0 || e === "") return 0n;
283
283
  let t = BigInt(e);
284
- if (t < 0n || t > C) throw Error(`SNOWFLAKE_MACHINE_ID out of range: ${e}. Must be 0..${C}.`);
284
+ if (t < 0n || t > S) throw Error(`SNOWFLAKE_MACHINE_ID out of range: ${e}. Must be 0..${S}.`);
285
285
  return t;
286
- }, O = () => ({
286
+ }, D = () => ({
287
287
  lastMs: 0n,
288
288
  sequence: 0n,
289
- machineId: D()
290
- }), k, A = () => (k === void 0 && (k = O()), k), we = () => {
291
- k = O();
292
- }, j = () => BigInt(Date.now()), Te = (e) => {
293
- let t = j();
294
- for (; t <= e;) t = j();
289
+ machineId: E()
290
+ }), O, k = () => (O === void 0 && (O = D()), O), Te = () => {
291
+ O = D();
292
+ }, A = () => BigInt(Date.now()), Ee = (e) => {
293
+ let t = A();
294
+ for (; t <= e;) t = A();
295
295
  return t;
296
- }, M = () => {
297
- let e = A(), t = j();
298
- t === e.lastMs ? (e.sequence = e.sequence + 1n & w, e.sequence === 0n && (t = Te(e.lastMs), e.lastMs = t)) : (e.sequence = 0n, e.lastMs = t);
299
- let n = t - Se;
296
+ }, j = () => {
297
+ let e = k(), t = A();
298
+ t === e.lastMs ? (e.sequence = e.sequence + 1n & C, e.sequence === 0n && (t = Ee(e.lastMs), e.lastMs = t)) : (e.sequence = 0n, e.lastMs = t);
299
+ let n = t - Ce;
300
300
  if (n < 0n) throw Error("Snowflake timestamp before configured epoch (2024-01-01). System clock is wrong.");
301
- return (n << E | e.machineId << T | e.sequence).toString();
302
- }, N = (e) => {
301
+ return (n << T | e.machineId << w | e.sequence).toString();
302
+ }, M = (e) => {
303
303
  let t = e.toLowerCase();
304
304
  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.`);
305
305
  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: '...' }).`);
306
306
  let n = t.endsWith("ies") && t.length > 3 ? t.slice(0, -3) + "y" : t.endsWith("ses") || t.endsWith("xes") || t.endsWith("zes") || t.endsWith("shes") || t.endsWith("ches") ? t.slice(0, -2) : t.endsWith("s") && t.length > 1 ? t.slice(0, -1) : t;
307
- return x(n, {
307
+ return b(n, {
308
308
  kind: "derived",
309
309
  tableName: e
310
310
  }), n;
311
- }, P = (e, t) => {
311
+ }, N = (e, t) => {
312
312
  if (e === void 0) return {
313
313
  kind: "typeid",
314
- prefix: N(t)
314
+ prefix: M(t)
315
315
  };
316
- if ("prefix" in e && !("scheme" in e)) return x(e.prefix, {
316
+ if ("prefix" in e && !("scheme" in e)) return b(e.prefix, {
317
317
  kind: "explicit",
318
318
  tableName: t
319
319
  }), {
@@ -323,8 +323,8 @@ var r = (e) => {
323
323
  if (!("scheme" in e)) throw Error("invalid id() options: no scheme or prefix");
324
324
  switch (e.scheme) {
325
325
  case "typeid": {
326
- let n = e.prefix ?? N(t);
327
- return e.prefix !== void 0 && x(e.prefix, {
326
+ let n = e.prefix ?? M(t);
327
+ return e.prefix !== void 0 && b(e.prefix, {
328
328
  kind: "explicit",
329
329
  tableName: t
330
330
  }), {
@@ -340,22 +340,22 @@ var r = (e) => {
340
340
  generate: e.generate
341
341
  };
342
342
  }
343
- }, Ee = (n, r) => {
343
+ }, De = (n, r) => {
344
344
  switch (n.kind) {
345
345
  case "typeid": return e(n.prefix).toString();
346
346
  case "ulid": return t();
347
347
  case "numeric": return null;
348
- case "snowflake": return M();
348
+ case "snowflake": return j();
349
349
  case "custom": return n.generate(r);
350
350
  }
351
- }, F = (e) => ({
352
- fields: u(e.fields),
351
+ }, P = (e) => ({
352
+ fields: f(e.fields),
353
353
  ...e.id === void 0 ? {} : { id: e.id },
354
354
  ...e.requires === void 0 ? {} : { requires: e.requires },
355
355
  ...e.indexes === void 0 ? {} : { indexes: e.indexes },
356
356
  ...e.behaviors === void 0 ? {} : { behaviors: e.behaviors },
357
357
  ...e.policies === void 0 ? {} : { policies: e.policies }
358
- }), De = F, I = (e) => {
358
+ }), Oe = P, F = (e) => {
359
359
  let t = /* @__PURE__ */ new Set(), n = [], r = (e) => {
360
360
  let i = e.id ?? e;
361
361
  if (!t.has(i)) {
@@ -365,7 +365,7 @@ var r = (e) => {
365
365
  };
366
366
  for (let t of e) r(t);
367
367
  return n;
368
- }, Oe = (e, ...t) => {
368
+ }, ke = (e, ...t) => {
369
369
  if (t.length === 0) throw Error(`jsonIndex("${e}"): at least one path segment is required`);
370
370
  let n = (r) => ({
371
371
  jsonPath: {
@@ -376,14 +376,14 @@ var r = (e) => {
376
376
  numeric: () => n(!0)
377
377
  });
378
378
  return n(!1);
379
- }, ke = (e = "cosine", t = "float32") => {
379
+ }, Ae = (e = "cosine", t = "float32") => {
380
380
  let n = t === "half" ? "halfvec" : "vector";
381
381
  switch (e) {
382
382
  case "cosine": return `${n}_cosine_ops`;
383
383
  case "l2": return `${n}_l2_ops`;
384
384
  case "inner": return `${n}_ip_ops`;
385
385
  }
386
- }, Ae = [
386
+ }, je = [
387
387
  "id",
388
388
  "tenantId",
389
389
  "createdAt",
@@ -392,7 +392,7 @@ var r = (e) => {
392
392
  "updatedBy",
393
393
  "deletedAt",
394
394
  "deletedBy"
395
- ], L = (e) => e.id ?? `<anonymous mixin: ${Object.keys(e.fields).join(", ")}>`, R = (e, t) => `${e}_${t.join("_")}_idx`, je = (e, t) => `${e}_${t.join("_")}_uq`, z = (e, t, n, r, i) => {
395
+ ], I = (e) => e.id ?? `<anonymous mixin: ${Object.keys(e.fields).join(", ")}>`, L = (e, t) => `${e}_${t.join("_")}_idx`, Me = (e, t) => `${e}_${t.join("_")}_uq`, R = (e, t, n, r, i) => {
396
396
  if (n !== "hnsw") return;
397
397
  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.`);
398
398
  let a = r[0];
@@ -400,14 +400,14 @@ var r = (e) => {
400
400
  let o = i[a];
401
401
  if (o === void 0) throw Error(`hnsw index '${t}' on table '${e}' references unknown column '${a}'.`);
402
402
  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.`);
403
- }, Me = (e, t) => {
403
+ }, Ne = (e, t) => {
404
404
  let n;
405
405
  for (let [r, i] of Object.entries(e)) i.type === "id" && i.idScheme === void 0 && (n === void 0 && (n = { ...e }), n[r] = {
406
406
  ...i,
407
- idScheme: P(i.idSchemeInput, t)
407
+ idScheme: N(i.idSchemeInput, t)
408
408
  });
409
409
  return n ?? e;
410
- }, B = (e) => {
410
+ }, z = (e) => {
411
411
  let t = e.appliedPrimaryKey ?? [];
412
412
  return {
413
413
  tableName: e.tableName,
@@ -424,8 +424,8 @@ var r = (e) => {
424
424
  ...e.validatePatchSchema === void 0 ? {} : { validatePatchSchema: e.validatePatchSchema },
425
425
  fullTextIndex: ((t, n, r) => {
426
426
  if (n.length === 0) throw Error(`fullTextIndex '${t}' on '${e.tableName}' has no columns.`);
427
- if (b(e.tableName, t, !1, n), e.appliedFullText.some((e) => e.name === t)) throw Error(`duplicate full-text index '${t}' on table '${e.tableName}'.`);
428
- return B({
427
+ if (y(e.tableName, t, !1, n), e.appliedFullText.some((e) => e.name === t)) throw Error(`duplicate full-text index '${t}' on table '${e.tableName}'.`);
428
+ return z({
429
429
  ...e,
430
430
  tableName: e.tableName,
431
431
  fields: e.fields,
@@ -446,27 +446,27 @@ var r = (e) => {
446
446
  });
447
447
  }),
448
448
  with: ((...t) => {
449
- let n = I(t), r = { ...e.fields }, i = /* @__PURE__ */ new Map();
449
+ let n = F(t), r = { ...e.fields }, i = /* @__PURE__ */ new Map();
450
450
  for (let e of Object.keys(r)) i.set(e, {
451
451
  id: "<table>",
452
452
  fields: {}
453
453
  });
454
454
  for (let t of n) for (let [n, a] of Object.entries(t.fields)) {
455
455
  let o = i.get(n);
456
- if (o !== void 0) throw Error(`mixin collision on column '${n}' in table '${e.tableName}': '${L(o)}' and '${L(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.`);
457
- y(e.tableName, n), r[n] = a, i.set(n, t);
456
+ if (o !== void 0) throw Error(`mixin collision on column '${n}' in table '${e.tableName}': '${I(o)}' and '${I(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.`);
457
+ v(e.tableName, n), r[n] = a, i.set(n, t);
458
458
  }
459
459
  let a = [...e.appliedIndexes];
460
460
  for (let t of n) for (let n of t.indexes ?? []) {
461
- let t = n.name ?? R(e.tableName, n.fields);
462
- a.some((e) => e.name === t) || (b(e.tableName, t, n.name === void 0, n.fields), z(e.tableName, t, n.kind, n.fields, r), a.push({
461
+ let t = n.name ?? L(e.tableName, n.fields);
462
+ a.some((e) => e.name === t) || (y(e.tableName, t, n.name === void 0, n.fields), R(e.tableName, t, n.kind, n.fields, r), a.push({
463
463
  name: t,
464
464
  fields: n.fields,
465
465
  ...n.kind === void 0 ? {} : { kind: n.kind },
466
466
  ...n.kindOptions === void 0 ? {} : { kindOptions: n.kindOptions }
467
467
  }));
468
468
  }
469
- return B({
469
+ return z({
470
470
  ...e,
471
471
  tableName: e.tableName,
472
472
  fields: r,
@@ -483,10 +483,10 @@ var r = (e) => {
483
483
  }),
484
484
  index: ((...t) => {
485
485
  let n, r, i, a = Array.isArray(t[0]);
486
- if (a ? (r = t[0], i = t[1], n = R(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.`);
486
+ if (a ? (r = t[0], i = t[1], n = L(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.`);
487
487
  let o = r.filter((e) => typeof e == "string");
488
- if (b(e.tableName, n, a, o), z(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.`);
489
- return B({
488
+ if (y(e.tableName, n, a, o), R(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.`);
489
+ return z({
490
490
  ...e,
491
491
  tableName: e.tableName,
492
492
  fields: e.fields,
@@ -510,8 +510,8 @@ var r = (e) => {
510
510
  expressionIndex: ((t, n, r) => {
511
511
  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.`);
512
512
  let i = n.filter((e) => typeof e == "string");
513
- if (b(e.tableName, t, !1, i), z(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.`);
514
- return B({
513
+ if (y(e.tableName, t, !1, i), R(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.`);
514
+ return z({
515
515
  ...e,
516
516
  tableName: e.tableName,
517
517
  fields: e.fields,
@@ -534,9 +534,9 @@ var r = (e) => {
534
534
  }),
535
535
  unique: ((...t) => {
536
536
  let n, r, i, a = Array.isArray(t[0]);
537
- if (a ? (r = t[0], i = t[1], n = je(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.`);
538
- if (b(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.`);
539
- return B({
537
+ if (a ? (r = t[0], i = t[1], n = Me(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.`);
538
+ if (y(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.`);
539
+ return z({
540
540
  ...e,
541
541
  tableName: e.tableName,
542
542
  fields: e.fields,
@@ -557,10 +557,10 @@ var r = (e) => {
557
557
  }),
558
558
  uniqueActive: ((...t) => {
559
559
  let n, r, i, a = Array.isArray(t[0]);
560
- if (a ? (r = t[0], i = t[1], n = R(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.`);
561
- if (b(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).`);
560
+ if (a ? (r = t[0], i = t[1], n = L(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.`);
561
+ if (y(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).`);
562
562
  let o = i?.where ?? "\"deletedAt\" IS NULL";
563
- return B({
563
+ return z({
564
564
  ...e,
565
565
  tableName: e.tableName,
566
566
  fields: e.fields,
@@ -582,8 +582,8 @@ var r = (e) => {
582
582
  }),
583
583
  check: ((t, n) => {
584
584
  if (n.trim().length === 0) throw Error(`CHECK '${t}' on table '${e.tableName}' has an empty expression.`);
585
- if (b(e.tableName, t, !1, []), e.appliedChecks.some((e) => e.name === t)) throw Error(`duplicate CHECK '${t}' on table '${e.tableName}': each constraint name must be unique within a table.`);
586
- return B({
585
+ if (y(e.tableName, t, !1, []), e.appliedChecks.some((e) => e.name === t)) throw Error(`duplicate CHECK '${t}' on table '${e.tableName}': each constraint name must be unique within a table.`);
586
+ return z({
587
587
  ...e,
588
588
  tableName: e.tableName,
589
589
  fields: e.fields,
@@ -603,7 +603,7 @@ var r = (e) => {
603
603
  }),
604
604
  renamedFrom: ((t) => {
605
605
  if (t === e.tableName) throw Error(`renamedFrom('${t}') on table '${e.tableName}' names the table itself — drop the marker, there is nothing to rename.`);
606
- return v(t), B({
606
+ return _(t), z({
607
607
  ...e,
608
608
  previousTableName: t
609
609
  });
@@ -618,7 +618,7 @@ var r = (e) => {
618
618
  }
619
619
  if (t.length > 0) throw Error(`primaryKey([...]) declared twice on table '${e.tableName}'.`);
620
620
  for (let [t, r] of Object.entries(e.fields)) if (r.type === "id" && !n.includes(t)) throw Error(`primaryKey([...]) on table '${e.tableName}' conflicts with the id() column '${t}'. A composite primary key IS the key — drop the id() column, or include '${t}' in the composite key.`);
621
- return B({
621
+ return z({
622
622
  ...e,
623
623
  tableName: e.tableName,
624
624
  fields: e.fields,
@@ -633,7 +633,7 @@ var r = (e) => {
633
633
  ...e.validatePatchSchema === void 0 ? {} : { validatePatchSchema: e.validatePatchSchema }
634
634
  });
635
635
  }),
636
- nonReactive: (() => B({
636
+ nonReactive: (() => z({
637
637
  ...e,
638
638
  tableName: e.tableName,
639
639
  fields: e.fields,
@@ -647,7 +647,7 @@ var r = (e) => {
647
647
  ...e.insertSchema === void 0 ? {} : { insertSchema: e.insertSchema },
648
648
  ...e.validatePatchSchema === void 0 ? {} : { validatePatchSchema: e.validatePatchSchema }
649
649
  })),
650
- validate: ((t) => B({
650
+ validate: ((t) => z({
651
651
  ...e,
652
652
  tableName: e.tableName,
653
653
  fields: e.fields,
@@ -661,7 +661,7 @@ var r = (e) => {
661
661
  insertSchema: t,
662
662
  ...e.validatePatchSchema === void 0 ? {} : { validatePatchSchema: e.validatePatchSchema }
663
663
  })),
664
- validatePatch: ((t) => B({
664
+ validatePatch: ((t) => z({
665
665
  ...e,
666
666
  tableName: e.tableName,
667
667
  fields: e.fields,
@@ -676,11 +676,11 @@ var r = (e) => {
676
676
  validatePatchSchema: n.partial(t)
677
677
  }))
678
678
  };
679
- }, Ne = (e, t) => {
680
- v(e);
681
- let n = Me(u(t), e);
682
- for (let t of Object.keys(n)) y(e, t);
683
- return B({
679
+ }, Pe = (e, t) => {
680
+ _(e);
681
+ let n = Ne(f(t), e);
682
+ for (let t of Object.keys(n)) v(e, t);
683
+ return z({
684
684
  tableName: e,
685
685
  fields: n,
686
686
  isReactive: !0,
@@ -690,7 +690,7 @@ var r = (e) => {
690
690
  appliedFullText: [],
691
691
  appliedChecks: []
692
692
  });
693
- }, Pe = (e) => e === "sqlite" || e === "turso", V = (e, t) => {
693
+ }, Fe = (e) => e === "sqlite" || e === "turso", B = (e, t) => {
694
694
  switch (t) {
695
695
  case "mysql":
696
696
  case "mariadb": return `\`${e}\``;
@@ -699,51 +699,51 @@ var r = (e) => {
699
699
  case "sqlite":
700
700
  case "turso": return `"${e}"`;
701
701
  }
702
- }, H = Symbol.for("@voltro/database/tableRegistry"), U = globalThis, W = U[H] ?? (U[H] = /* @__PURE__ */ new Map()), G = (e) => {
703
- let t = W.get(e.tableName);
702
+ }, V = Symbol.for("@voltro/database/tableRegistry"), H = globalThis, U = H[V] ?? (H[V] = /* @__PURE__ */ new Map()), W = (e) => {
703
+ let t = U.get(e.tableName);
704
704
  if (t === void 0) {
705
- W.set(e.tableName, e);
705
+ U.set(e.tableName, e);
706
706
  return;
707
707
  }
708
708
  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.`);
709
- }, Fe = (e) => {
710
- W.get(e.tableName) === void 0 && W.set(e.tableName, e);
711
- }, K = (e) => W.get(e), Ie = (e) => {
712
- let t = W.get(e);
709
+ }, Ie = (e) => {
710
+ U.get(e.tableName) === void 0 && U.set(e.tableName, e);
711
+ }, G = (e) => U.get(e), Le = (e) => {
712
+ let t = U.get(e);
713
713
  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.`);
714
714
  return t;
715
- }, Le = () => [...W.values()], Re = () => {
716
- W.clear();
717
- }, ze = (e) => W.get(e)?.isReactive !== !1, Be = (e) => ({
715
+ }, Re = () => [...U.values()], ze = () => {
716
+ U.clear();
717
+ }, Be = (e) => U.get(e)?.isReactive !== !1, Ve = (e) => ({
718
718
  op: "count",
719
719
  alias: e ?? "count"
720
- }), Ve = (e, t) => ({
720
+ }), He = (e, t) => ({
721
721
  op: "count-distinct",
722
722
  column: e,
723
723
  alias: t ?? `count_distinct_${e}`
724
- }), He = (e, t) => ({
724
+ }), Ue = (e, t) => ({
725
725
  op: "sum",
726
726
  column: e,
727
727
  alias: t ?? `sum_${e}`
728
- }), Ue = (e, t) => ({
728
+ }), We = (e, t) => ({
729
729
  op: "avg",
730
730
  column: e,
731
731
  alias: t ?? `avg_${e}`
732
- }), We = (e, t) => ({
732
+ }), Ge = (e, t) => ({
733
733
  op: "min",
734
734
  column: e,
735
735
  alias: t ?? `min_${e}`
736
- }), Ge = (e, t) => ({
736
+ }), Ke = (e, t) => ({
737
737
  op: "max",
738
738
  column: e,
739
739
  alias: t ?? `max_${e}`
740
- }), Ke = (e, t) => ({
740
+ }), qe = (e, t) => ({
741
741
  op: "column",
742
742
  column: e,
743
743
  alias: t ?? e
744
- }), q = (e) => (...t) => {
744
+ }), K = (e) => (...t) => {
745
745
  if (t.length < 2) throw Error(`${e}: requires at least two queries`);
746
- return X({
746
+ return Y({
747
747
  table: t[0].descriptor.table,
748
748
  predicate: void 0,
749
749
  order: [],
@@ -755,55 +755,55 @@ var r = (e) => {
755
755
  queries: t.map((e) => e.descriptor)
756
756
  }
757
757
  });
758
- }, qe = q("union"), Je = q("union-all"), Ye = q("intersect"), Xe = q("except"), J = (e) => ({ over: (t) => ({
758
+ }, Je = K("union"), Ye = K("union-all"), Xe = K("intersect"), Ze = K("except"), q = (e) => ({ over: (t) => ({
759
759
  ...e,
760
760
  window: t
761
- }) }), Ze = (e = "rowNumber") => J({
761
+ }) }), Qe = (e = "rowNumber") => q({
762
762
  op: "window-row-number",
763
763
  alias: e
764
- }), Qe = (e = "rank") => J({
764
+ }), $e = (e = "rank") => q({
765
765
  op: "window-rank",
766
766
  alias: e
767
- }), $e = (e = "denseRank") => J({
767
+ }), et = (e = "denseRank") => q({
768
768
  op: "window-dense-rank",
769
769
  alias: e
770
- }), et = (e, t = 1, n) => J({
770
+ }), tt = (e, t = 1, n) => q({
771
771
  op: "window-lag",
772
772
  column: e,
773
773
  alias: n ?? `lag_${e}`,
774
774
  offset: t
775
- }), tt = (e, t = 1, n) => J({
775
+ }), nt = (e, t = 1, n) => q({
776
776
  op: "window-lead",
777
777
  column: e,
778
778
  alias: n ?? `lead_${e}`,
779
779
  offset: t
780
- }), nt = (e, t) => J({
780
+ }), rt = (e, t) => q({
781
781
  op: "window-sum-over",
782
782
  column: e,
783
783
  alias: t ?? `sum_${e}_over`
784
- }), rt = (e, t) => J({
784
+ }), it = (e, t) => q({
785
785
  op: "window-avg-over",
786
786
  column: e,
787
787
  alias: t ?? `avg_${e}_over`
788
- }), Y = (e, t, n) => {
789
- let r = n?.find((e) => e.name === t) ?? K(e)?.appliedFullText?.find((e) => e.name === t);
788
+ }), J = (e, t, n) => {
789
+ let r = n?.find((e) => e.name === t) ?? G(e)?.appliedFullText?.find((e) => e.name === t);
790
790
  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.`);
791
791
  return {
792
792
  columns: r.columns,
793
793
  ...r.config === void 0 ? {} : { config: r.config },
794
794
  ...r.weights === void 0 ? {} : { weights: r.weights }
795
795
  };
796
- }, X = (e) => ({
796
+ }, Y = (e) => ({
797
797
  descriptor: e,
798
798
  where(t) {
799
799
  let n = e.predicate ? { and: [e.predicate, t] } : t;
800
- return X({
800
+ return Y({
801
801
  ...e,
802
802
  predicate: n
803
803
  });
804
804
  },
805
805
  orderBy(t, n = "asc") {
806
- return X({
806
+ return Y({
807
807
  ...e,
808
808
  order: [...e.order, {
809
809
  column: t,
@@ -812,37 +812,37 @@ var r = (e) => {
812
812
  });
813
813
  },
814
814
  limit(t) {
815
- return X({
815
+ return Y({
816
816
  ...e,
817
817
  take: t
818
818
  });
819
819
  },
820
820
  offset(t) {
821
- return X({
821
+ return Y({
822
822
  ...e,
823
823
  skip: t
824
824
  });
825
825
  },
826
826
  select(...t) {
827
- return X({
827
+ return Y({
828
828
  ...e,
829
829
  projection: t
830
830
  });
831
831
  },
832
832
  using(t) {
833
- return X({
833
+ return Y({
834
834
  ...e,
835
835
  usingIndex: t
836
836
  });
837
837
  },
838
838
  withDeleted() {
839
- return X({
839
+ return Y({
840
840
  ...e,
841
841
  includeDeleted: !0
842
842
  });
843
843
  },
844
844
  unscoped() {
845
- return X({
845
+ return Y({
846
846
  ...e,
847
847
  crossTenant: !0
848
848
  });
@@ -852,13 +852,13 @@ var r = (e) => {
852
852
  ...e.eager ?? {},
853
853
  ...t
854
854
  };
855
- return X({
855
+ return Y({
856
856
  ...e,
857
857
  eager: n
858
858
  });
859
859
  },
860
860
  count() {
861
- return X({
861
+ return Y({
862
862
  ...e,
863
863
  projection: void 0,
864
864
  aggregations: [{
@@ -872,15 +872,15 @@ var r = (e) => {
872
872
  ...t,
873
873
  alias: e
874
874
  }));
875
- return X({
875
+ return Y({
876
876
  ...e,
877
877
  projection: void 0,
878
878
  aggregations: n
879
879
  });
880
880
  },
881
881
  matching(t, n) {
882
- let r = Y(e.table, t, e.fullTextIndexes);
883
- return X({
882
+ let r = J(e.table, t, e.fullTextIndexes);
883
+ return Y({
884
884
  ...e,
885
885
  fullTextSearch: {
886
886
  indexName: t,
@@ -894,7 +894,7 @@ var r = (e) => {
894
894
  rankBy(t) {
895
895
  let n = e.fullTextSearch;
896
896
  if (n === void 0) throw Error(".rankBy() requires a preceding .matching(...) clause — there is no full-text search to rank on this query.");
897
- return X({
897
+ return Y({
898
898
  ...e,
899
899
  fullTextSearch: {
900
900
  ...n,
@@ -913,7 +913,7 @@ var r = (e) => {
913
913
  distance: r?.distance ?? "cosine",
914
914
  ...e.annClause?.ef === void 0 ? {} : { ef: e.annClause.ef }
915
915
  };
916
- return X({
916
+ return Y({
917
917
  ...e,
918
918
  annClause: i
919
919
  });
@@ -925,7 +925,7 @@ var r = (e) => {
925
925
  distance: "cosine",
926
926
  ...e.annClause?.ef === void 0 ? {} : { ef: e.annClause.ef }
927
927
  };
928
- return X({
928
+ return Y({
929
929
  ...e,
930
930
  annClause: r,
931
931
  take: n
@@ -938,7 +938,7 @@ var r = (e) => {
938
938
  column: "",
939
939
  distance: "cosine"
940
940
  };
941
- return X({
941
+ return Y({
942
942
  ...e,
943
943
  annClause: {
944
944
  ...n,
@@ -947,22 +947,22 @@ var r = (e) => {
947
947
  });
948
948
  },
949
949
  use(t) {
950
- return X({ ...t(e) });
950
+ return Y({ ...t(e) });
951
951
  },
952
952
  distinct() {
953
- return X({
953
+ return Y({
954
954
  ...e,
955
955
  distinct: !0
956
956
  });
957
957
  },
958
958
  distinctOn(t) {
959
- return X({
959
+ return Y({
960
960
  ...e,
961
961
  distinctOn: [...t]
962
962
  });
963
963
  },
964
964
  as(t) {
965
- return X({
965
+ return Y({
966
966
  ...e,
967
967
  alias: t
968
968
  });
@@ -974,7 +974,7 @@ var r = (e) => {
974
974
  alias: n,
975
975
  on: r
976
976
  }];
977
- return X({
977
+ return Y({
978
978
  ...e,
979
979
  joins: a
980
980
  });
@@ -986,7 +986,7 @@ var r = (e) => {
986
986
  alias: n,
987
987
  on: r
988
988
  }];
989
- return X({
989
+ return Y({
990
990
  ...e,
991
991
  joins: a
992
992
  });
@@ -996,7 +996,7 @@ var r = (e) => {
996
996
  outputKey: e,
997
997
  source: t
998
998
  }));
999
- return X({
999
+ return Y({
1000
1000
  ...e,
1001
1001
  projection: void 0,
1002
1002
  joinedProjection: n
@@ -1005,7 +1005,7 @@ var r = (e) => {
1005
1005
  withCte(t, n) {
1006
1006
  let r = e.ctes ?? [];
1007
1007
  if (r.some((e) => e.name === t)) throw Error(`Query.withCte: duplicate CTE name '${t}'`);
1008
- return X({
1008
+ return Y({
1009
1009
  ...e,
1010
1010
  ctes: [...r, {
1011
1011
  name: t,
@@ -1016,7 +1016,7 @@ var r = (e) => {
1016
1016
  recursiveCte(t, n) {
1017
1017
  let r = e.ctes ?? [];
1018
1018
  if (r.some((e) => e.name === t)) throw Error(`Query.recursiveCte: duplicate CTE name '${t}'`);
1019
- return X({
1019
+ return Y({
1020
1020
  ...e,
1021
1021
  ctes: [...r, {
1022
1022
  name: t,
@@ -1027,20 +1027,20 @@ var r = (e) => {
1027
1027
  },
1028
1028
  groupBy(t) {
1029
1029
  let n = e.groupBy ? [...e.groupBy, ...t] : [...t];
1030
- return X({
1030
+ return Y({
1031
1031
  ...e,
1032
1032
  groupBy: n
1033
1033
  });
1034
1034
  },
1035
1035
  having(t) {
1036
1036
  let n = e.having ? { and: [e.having, t] } : t;
1037
- return X({
1037
+ return Y({
1038
1038
  ...e,
1039
1039
  having: n
1040
1040
  });
1041
1041
  },
1042
1042
  exists() {
1043
- return X({
1043
+ return Y({
1044
1044
  ...e,
1045
1045
  projection: void 0,
1046
1046
  aggregations: [{
@@ -1051,8 +1051,8 @@ var r = (e) => {
1051
1051
  });
1052
1052
  }
1053
1053
  });
1054
- function Z(e) {
1055
- return X({
1054
+ function X(e) {
1055
+ return Y({
1056
1056
  table: e.tableName,
1057
1057
  predicate: void 0,
1058
1058
  order: [],
@@ -1063,7 +1063,7 @@ function Z(e) {
1063
1063
  sourceTable: e
1064
1064
  });
1065
1065
  }
1066
- var Q = (e, t, n) => $(e, "id", t, n), $ = (e, t, n, r, i = "asc") => {
1066
+ var at = (e, t, n) => Z(e, "id", t, n), Z = (e, t, n, r, i = "asc") => {
1067
1067
  let a = [...e.order.filter((e) => e.column !== t), {
1068
1068
  column: t,
1069
1069
  direction: i
@@ -1078,21 +1078,21 @@ var Q = (e, t, n) => $(e, "id", t, n), $ = (e, t, n, r, i = "asc") => {
1078
1078
  order: a,
1079
1079
  take: r
1080
1080
  };
1081
- }, it = (e) => {
1081
+ }, ot = (e) => {
1082
1082
  let t = {};
1083
- for (let [n, r] of Object.entries(e)) G(r), t[n] = Z(r);
1083
+ for (let [n, r] of Object.entries(e)) W(r), t[n] = X(r);
1084
1084
  return t;
1085
- }, at = (e) => e.isView === !0, ot = (e, t, n) => {
1086
- if (v(e), n.trim().length === 0) throw Error(`view('${e}', …): the SELECT body is empty — a view must define a query.`);
1087
- let r = u(t);
1088
- for (let t of Object.keys(r)) y(e, t);
1085
+ }, st = (e) => e.isView === !0, ct = (e, t, n) => {
1086
+ if (_(e), n.trim().length === 0) throw Error(`view('${e}', …): the SELECT body is empty — a view must define a query.`);
1087
+ let r = f(t);
1088
+ for (let t of Object.keys(r)) v(e, t);
1089
1089
  return {
1090
1090
  tableName: e,
1091
1091
  fields: r,
1092
1092
  isView: !0,
1093
1093
  viewSelect: n
1094
1094
  };
1095
- }, st = (e) => Z({
1095
+ }, lt = (e) => X({
1096
1096
  ...e,
1097
1097
  isReactive: !1,
1098
1098
  appliedMixins: [],
@@ -1100,8 +1100,8 @@ var Q = (e, t, n) => $(e, "id", t, n), $ = (e, t, n, r, i = "asc") => {
1100
1100
  appliedUniques: [],
1101
1101
  appliedFullText: [],
1102
1102
  appliedChecks: []
1103
- }), ct = (e, t, n = null) => {
1104
- let r = n === null ? V(e.tableName, t) : `${V(n, t)}.${V(e.tableName, t)}`, i = e.viewSelect.trim();
1103
+ }), ut = (e, t, n = null) => {
1104
+ let r = n === null ? B(e.tableName, t) : `${B(n, t)}.${B(e.tableName, t)}`, i = e.viewSelect.trim();
1105
1105
  switch (t) {
1106
1106
  case "postgres":
1107
1107
  case "mysql":
@@ -1110,16 +1110,16 @@ var Q = (e, t, n) => $(e, "id", t, n), $ = (e, t, n, r, i = "asc") => {
1110
1110
  case "sqlite":
1111
1111
  case "turso": return `DROP VIEW IF EXISTS ${r};\nCREATE VIEW ${r} AS ${i};`;
1112
1112
  }
1113
- }, lt = /^[A-Za-z_][A-Za-z0-9_]*$/, ut = (e) => "$" + e.map((e) => typeof e == "number" ? `[${e}]` : lt.test(e) ? `.${e}` : `."${e.replace(/"/g, "\\\"")}"`).join(""), dt = (e) => "{" + e.map((e) => {
1113
+ }, dt = /^[A-Za-z_][A-Za-z0-9_]*$/, ft = (e) => "$" + e.map((e) => typeof e == "number" ? `[${e}]` : dt.test(e) ? `.${e}` : `."${e.replace(/"/g, "\\\"")}"`).join(""), pt = (e) => "{" + e.map((e) => {
1114
1114
  let t = String(e);
1115
1115
  return /^[A-Za-z0-9_]+$/.test(t) ? t : `"${t.replace(/(["\\])/g, "\\$1")}"`;
1116
- }).join(",") + "}", ft = (e, t, n, r = {}) => {
1117
- let i = V(e, n), a = r.numeric ?? !1;
1116
+ }).join(",") + "}", Q = (e, t, n, r = {}) => {
1117
+ let i = B(e, n), a = r.numeric ?? !1;
1118
1118
  if (n === "postgres") {
1119
- let e = `(${i} #>> '${dt(t)}'::text[])`;
1119
+ let e = `(${i} #>> '${pt(t)}'::text[])`;
1120
1120
  return a ? `${e}::numeric` : e;
1121
1121
  }
1122
- let o = ut(t);
1122
+ let o = ft(t);
1123
1123
  switch (n) {
1124
1124
  case "mysql":
1125
1125
  case "mariadb": {
@@ -1136,10 +1136,10 @@ var Q = (e, t, n) => $(e, "id", t, n), $ = (e, t, n, r, i = "asc") => {
1136
1136
  return a ? `CAST(${e} AS REAL)` : e;
1137
1137
  }
1138
1138
  }
1139
- }, pt = (e) => {
1139
+ }, mt = (e) => {
1140
1140
  if (!e.id || e.id.length === 0) throw Error("migration: `id` is required + must be non-empty");
1141
1141
  if (!e.up || !e.down) throw Error(`migration ${e.id}: both \`up\` and \`down\` must be functions`);
1142
1142
  return e;
1143
- }, mt = /^\d{8}_\d{6}_[a-z0-9_]+\.ts$/, ht = (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";
1143
+ }, ht = /^\d{8}_\d{6}_[a-z0-9_]+\.ts$/, gt = (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", $ = /* @__PURE__ */ new Set(["voltro_isr_cache"]), _t = (e) => $.has(e) || e.startsWith("_voltro_") || e.startsWith("_cloud_") || e.startsWith("cluster_"), vt = /__dropped_\d{14}$/, yt = (e) => vt.test(e);
1144
1144
  //#endregion
1145
- export { p as $, qe as A, r as At, V as B, Q as C, pe as Ct, Ze as D, ge as Dt, Y as E, ne as Et, K as F, De as G, Oe as H, ze as I, N as J, F as K, G as L, Le as M, oe as Mt, Re as N, de as Nt, He as O, te as Ot, Fe as P, we as Q, Ie as R, $ as S, ee as St, Qe as T, u as Tt, Ne as U, Ae as V, ke as W, P as X, Ee as Y, M as Z, Ye as _, c as _t, at as a, x as at, Ge as b, he as bt, ct as c, _e as ct, Ke as d, fe as dt, m as et, Be as f, re as ft, Xe as g, ie as gt, $e as h, l as ht, ft as i, v as it, Je as j, s as jt, nt as k, le as kt, Ue as l, ve as lt, it as m, ce as mt, ht as n, y as nt, st as o, ye as ot, Ve as p, ae as pt, I as q, pt as r, b as rt, ot as s, f as st, mt as t, be as tt, rt as u, i as ut, et as v, ue as vt, Z as w, se as wt, We as x, o as xt, tt as y, me as yt, Pe as z };
1145
+ export { N as $, Qe as A, me as At, W as B, Ke as C, pe as Ct, X as D, ce as Dt, at as E, de as Et, Re as F, oe as Ft, ke as G, Fe as H, ze as I, d as It, Oe as J, Pe as K, Ie as L, rt as M, l as Mt, Je as N, r as Nt, $e as O, f as Ot, Ye as P, s as Pt, De as Q, G as R, nt as S, fe as St, Z as T, ee as Tt, B as U, Le as V, je as W, F as X, P as Y, M as Z, ot as _, le as _t, gt as a, v as at, Xe as b, c as bt, st as c, b as ct, ut as d, he as dt, j as et, We as f, ge as ft, He as g, ae as gt, Ve as h, re as ht, ht as i, xe as it, Ue as j, te as jt, J as k, ne as kt, lt as l, _e as lt, qe as m, ue as mt, _t as n, ye as nt, mt as o, y as ot, it as p, i as pt, Ae as q, yt as r, be as rt, Q as s, _ as st, $ as t, Te as tt, ct as u, ve as ut, et as v, se as vt, Ge as w, o as wt, tt as x, u as xt, Ze as y, ie as yt, Be as z };