pqb 0.35.0 → 0.35.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/dist/index.js CHANGED
@@ -119,25 +119,25 @@ const sqlFn = (...args) => {
119
119
  return (...args2) => new RawSQL(args2, arg);
120
120
  };
121
121
 
122
- var __defProp$i = Object.defineProperty;
123
- var __defProps$9 = Object.defineProperties;
124
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
125
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
126
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
127
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
128
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
129
- var __spreadValues$i = (a, b) => {
122
+ var __defProp$l = Object.defineProperty;
123
+ var __defProps$b = Object.defineProperties;
124
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
125
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
126
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
127
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
128
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
129
+ var __spreadValues$l = (a, b) => {
130
130
  for (var prop in b || (b = {}))
131
- if (__hasOwnProp$j.call(b, prop))
132
- __defNormalProp$i(a, prop, b[prop]);
133
- if (__getOwnPropSymbols$j)
134
- for (var prop of __getOwnPropSymbols$j(b)) {
135
- if (__propIsEnum$j.call(b, prop))
136
- __defNormalProp$i(a, prop, b[prop]);
131
+ if (__hasOwnProp$m.call(b, prop))
132
+ __defNormalProp$l(a, prop, b[prop]);
133
+ if (__getOwnPropSymbols$m)
134
+ for (var prop of __getOwnPropSymbols$m(b)) {
135
+ if (__propIsEnum$m.call(b, prop))
136
+ __defNormalProp$l(a, prop, b[prop]);
137
137
  }
138
138
  return a;
139
139
  };
140
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
140
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
141
141
  class ColumnType extends orchidCore.ColumnTypeBase {
142
142
  /**
143
143
  * Mark the column as a primary key.
@@ -336,13 +336,13 @@ class ColumnType extends orchidCore.ColumnTypeBase {
336
336
  */
337
337
  searchIndex(...args) {
338
338
  return orchidCore.pushColumnData(this, "indexes", {
339
- options: __spreadValues$i(__spreadValues$i({}, typeof args[0] === "string" ? args[1] : args[0]), this.dataType === "tsvector" ? { using: "GIN" } : { tsVector: true }),
339
+ options: __spreadValues$l(__spreadValues$l({}, typeof args[0] === "string" ? args[1] : args[0]), this.dataType === "tsvector" ? { using: "GIN" } : { tsVector: true }),
340
340
  name: typeof args[0] === "string" ? args[0] : void 0
341
341
  });
342
342
  }
343
343
  unique(...args) {
344
344
  return orchidCore.pushColumnData(this, "indexes", {
345
- options: __spreadProps$9(__spreadValues$i({}, typeof args[0] === "string" ? args[1] : args[0]), {
345
+ options: __spreadProps$b(__spreadValues$l({}, typeof args[0] === "string" ? args[1] : args[0]), {
346
346
  unique: true
347
347
  }),
348
348
  name: typeof args[0] === "string" ? args[0] : void 0
@@ -384,25 +384,25 @@ class ColumnType extends orchidCore.ColumnTypeBase {
384
384
  }
385
385
  }
386
386
 
387
- var __defProp$h = Object.defineProperty;
388
- var __defProps$8 = Object.defineProperties;
389
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
390
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
391
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
392
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
393
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
394
- var __spreadValues$h = (a, b) => {
387
+ var __defProp$k = Object.defineProperty;
388
+ var __defProps$a = Object.defineProperties;
389
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
390
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
391
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
392
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
393
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
394
+ var __spreadValues$k = (a, b) => {
395
395
  for (var prop in b || (b = {}))
396
- if (__hasOwnProp$i.call(b, prop))
397
- __defNormalProp$h(a, prop, b[prop]);
398
- if (__getOwnPropSymbols$i)
399
- for (var prop of __getOwnPropSymbols$i(b)) {
400
- if (__propIsEnum$i.call(b, prop))
401
- __defNormalProp$h(a, prop, b[prop]);
396
+ if (__hasOwnProp$l.call(b, prop))
397
+ __defNormalProp$k(a, prop, b[prop]);
398
+ if (__getOwnPropSymbols$l)
399
+ for (var prop of __getOwnPropSymbols$l(b)) {
400
+ if (__propIsEnum$l.call(b, prop))
401
+ __defNormalProp$k(a, prop, b[prop]);
402
402
  }
403
403
  return a;
404
404
  };
405
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
405
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
406
406
  const knownDefaults = {
407
407
  current_timestamp: "now()",
408
408
  "transaction_timestamp()": "now()"
@@ -418,7 +418,7 @@ const simplifyColumnDefault = (value) => {
418
418
  const instantiateColumn = (typeFn, params) => {
419
419
  const column = typeFn();
420
420
  const { dateTimePrecision } = params;
421
- Object.assign(column.data, __spreadProps$8(__spreadValues$h({}, params), {
421
+ Object.assign(column.data, __spreadProps$a(__spreadValues$k({}, params), {
422
422
  dateTimePrecision: (
423
423
  // 0 is default for date, 6 is default for timestamp
424
424
  dateTimePrecision && dateTimePrecision !== 6 ? dateTimePrecision : void 0
@@ -842,25 +842,25 @@ const getSqlText = (sql) => {
842
842
  throw new Error(`Batch SQL is not supported in this query`);
843
843
  };
844
844
 
845
- var __defProp$g = Object.defineProperty;
846
- var __defProps$7 = Object.defineProperties;
847
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
848
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
849
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
850
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
851
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
852
- var __spreadValues$g = (a, b) => {
845
+ var __defProp$j = Object.defineProperty;
846
+ var __defProps$9 = Object.defineProperties;
847
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
848
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
849
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
850
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
851
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
852
+ var __spreadValues$j = (a, b) => {
853
853
  for (var prop in b || (b = {}))
854
- if (__hasOwnProp$h.call(b, prop))
855
- __defNormalProp$g(a, prop, b[prop]);
856
- if (__getOwnPropSymbols$h)
857
- for (var prop of __getOwnPropSymbols$h(b)) {
858
- if (__propIsEnum$h.call(b, prop))
859
- __defNormalProp$g(a, prop, b[prop]);
854
+ if (__hasOwnProp$k.call(b, prop))
855
+ __defNormalProp$j(a, prop, b[prop]);
856
+ if (__getOwnPropSymbols$k)
857
+ for (var prop of __getOwnPropSymbols$k(b)) {
858
+ if (__propIsEnum$k.call(b, prop))
859
+ __defNormalProp$j(a, prop, b[prop]);
860
860
  }
861
861
  return a;
862
862
  };
863
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
863
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
864
864
  function setQueryOperators(query, operators) {
865
865
  const q = query.q;
866
866
  if (q.operators !== operators) {
@@ -933,7 +933,7 @@ const base = {
933
933
  (key, value, ctx, quotedAs) => `NOT ${key} IN ${quoteValue$1(value, ctx, quotedAs)}`
934
934
  )
935
935
  };
936
- const boolean = __spreadProps$7(__spreadValues$g({}, base), {
936
+ const boolean = __spreadProps$9(__spreadValues$j({}, base), {
937
937
  and: make(
938
938
  (key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
939
939
  ),
@@ -941,7 +941,7 @@ const boolean = __spreadProps$7(__spreadValues$g({}, base), {
941
941
  (key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
942
942
  )
943
943
  });
944
- const numeric = __spreadProps$7(__spreadValues$g({}, base), {
944
+ const numeric = __spreadProps$9(__spreadValues$j({}, base), {
945
945
  lt: make(
946
946
  (key, value, ctx, quotedAs) => `${key} < ${quoteValue$1(value, ctx, quotedAs)}`
947
947
  ),
@@ -962,7 +962,7 @@ const numeric = __spreadProps$7(__spreadValues$g({}, base), {
962
962
  )}`
963
963
  )
964
964
  });
965
- const text = __spreadProps$7(__spreadValues$g({}, base), {
965
+ const text = __spreadProps$9(__spreadValues$j({}, base), {
966
966
  contains: make(
967
967
  (key, value, ctx, quotedAs) => `${key} ILIKE '%' || ${quoteValue$1(value, ctx, quotedAs)} || '%'`
968
968
  ),
@@ -984,7 +984,7 @@ const text = __spreadProps$7(__spreadValues$g({}, base), {
984
984
  });
985
985
  const encodeJsonPath = (ctx, path) => orchidCore.addValue(ctx.values, `{${Array.isArray(path) ? path.join(", ") : path}}`);
986
986
  const jsonPathQueryOp = (key, [path, options], ctx) => `jsonb_path_query_first(${key}, ${orchidCore.addValue(ctx.values, path)}${(options == null ? void 0 : options.vars) ? `, ${orchidCore.addValue(ctx.values, JSON.stringify(options.vars))}${options.silent ? ", true" : ""}` : (options == null ? void 0 : options.silent) ? ", NULL, true" : ""})`;
987
- const json = __spreadProps$7(__spreadValues$g({}, base), {
987
+ const json = __spreadProps$9(__spreadValues$j({}, base), {
988
988
  jsonPathQueryFirst: Object.assign(
989
989
  function(path, options) {
990
990
  var _a, _b, _c, _d, _e;
@@ -1211,25 +1211,25 @@ class BigSerialColumn extends NumberAsStringBaseColumn {
1211
1211
  }
1212
1212
  }
1213
1213
 
1214
- var __defProp$f = Object.defineProperty;
1215
- var __defProps$6 = Object.defineProperties;
1216
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
1217
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
1218
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
1219
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
1220
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1221
- var __spreadValues$f = (a, b) => {
1214
+ var __defProp$i = Object.defineProperty;
1215
+ var __defProps$8 = Object.defineProperties;
1216
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
1217
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
1218
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
1219
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
1220
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1221
+ var __spreadValues$i = (a, b) => {
1222
1222
  for (var prop in b || (b = {}))
1223
- if (__hasOwnProp$g.call(b, prop))
1224
- __defNormalProp$f(a, prop, b[prop]);
1225
- if (__getOwnPropSymbols$g)
1226
- for (var prop of __getOwnPropSymbols$g(b)) {
1227
- if (__propIsEnum$g.call(b, prop))
1228
- __defNormalProp$f(a, prop, b[prop]);
1223
+ if (__hasOwnProp$j.call(b, prop))
1224
+ __defNormalProp$i(a, prop, b[prop]);
1225
+ if (__getOwnPropSymbols$j)
1226
+ for (var prop of __getOwnPropSymbols$j(b)) {
1227
+ if (__propIsEnum$j.call(b, prop))
1228
+ __defNormalProp$i(a, prop, b[prop]);
1229
1229
  }
1230
1230
  return a;
1231
1231
  };
1232
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
1232
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
1233
1233
  class TextBaseColumn extends ColumnType {
1234
1234
  constructor(schema, schemaType = schema.stringSchema()) {
1235
1235
  super(schema, schemaType);
@@ -1277,7 +1277,7 @@ class StringColumn extends VarCharColumn {
1277
1277
  }
1278
1278
  }
1279
1279
  const textColumnToCode = (column, t, m) => {
1280
- const data = __spreadValues$f({}, column.data);
1280
+ const data = __spreadValues$i({}, column.data);
1281
1281
  let args = "";
1282
1282
  const hasMax = data.maxArg !== void 0 && data.max === data.maxArg;
1283
1283
  if (data.minArg !== void 0 && data.min === data.minArg || hasMax) {
@@ -1574,7 +1574,7 @@ class UUIDColumn extends ColumnType {
1574
1574
  `uuid()`,
1575
1575
  m,
1576
1576
  // don't output the default default
1577
- data.default instanceof orchidCore.RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$6(__spreadValues$f({}, data), { default: void 0 }) : data
1577
+ data.default instanceof orchidCore.RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$8(__spreadValues$i({}, data), { default: void 0 }) : data
1578
1578
  );
1579
1579
  }
1580
1580
  }
@@ -2319,25 +2319,25 @@ const pushIn = (ctx, query, ands, quotedAs, arg) => {
2319
2319
  ands.push(`${multiple ? `(${columnsSql})` : columnsSql} IN ${value}`);
2320
2320
  };
2321
2321
 
2322
- var __defProp$e = Object.defineProperty;
2323
- var __defProps$5 = Object.defineProperties;
2324
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
2325
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
2326
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
2327
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
2328
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2329
- var __spreadValues$e = (a, b) => {
2322
+ var __defProp$h = Object.defineProperty;
2323
+ var __defProps$7 = Object.defineProperties;
2324
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
2325
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2326
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2327
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2328
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2329
+ var __spreadValues$h = (a, b) => {
2330
2330
  for (var prop in b || (b = {}))
2331
- if (__hasOwnProp$f.call(b, prop))
2332
- __defNormalProp$e(a, prop, b[prop]);
2333
- if (__getOwnPropSymbols$f)
2334
- for (var prop of __getOwnPropSymbols$f(b)) {
2335
- if (__propIsEnum$f.call(b, prop))
2336
- __defNormalProp$e(a, prop, b[prop]);
2331
+ if (__hasOwnProp$i.call(b, prop))
2332
+ __defNormalProp$h(a, prop, b[prop]);
2333
+ if (__getOwnPropSymbols$i)
2334
+ for (var prop of __getOwnPropSymbols$i(b)) {
2335
+ if (__propIsEnum$i.call(b, prop))
2336
+ __defNormalProp$h(a, prop, b[prop]);
2337
2337
  }
2338
2338
  return a;
2339
2339
  };
2340
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
2340
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
2341
2341
  const processJoinItem = (ctx, table, query, args, quotedAs) => {
2342
2342
  let target;
2343
2343
  let on;
@@ -2399,8 +2399,8 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
2399
2399
  const whereSql = whereToSql(
2400
2400
  ctx,
2401
2401
  q,
2402
- __spreadProps$5(__spreadValues$e({}, q.q), {
2403
- joinedShapes: __spreadProps$5(__spreadValues$e(__spreadValues$e({}, query.joinedShapes), q.q.joinedShapes), {
2402
+ __spreadProps$7(__spreadValues$h({}, q.q), {
2403
+ joinedShapes: __spreadProps$7(__spreadValues$h(__spreadValues$h({}, query.joinedShapes), q.q.joinedShapes), {
2404
2404
  [table.q.as || table.table]: table.q.shape
2405
2405
  })
2406
2406
  }),
@@ -2547,25 +2547,25 @@ const getIsJoinSubQuery = (query) => {
2547
2547
  return false;
2548
2548
  };
2549
2549
 
2550
- var __defProp$d = Object.defineProperty;
2551
- var __defProps$4 = Object.defineProperties;
2552
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
2553
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
2554
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
2555
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
2556
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2557
- var __spreadValues$d = (a, b) => {
2550
+ var __defProp$g = Object.defineProperty;
2551
+ var __defProps$6 = Object.defineProperties;
2552
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
2553
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
2554
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
2555
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
2556
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2557
+ var __spreadValues$g = (a, b) => {
2558
2558
  for (var prop in b || (b = {}))
2559
- if (__hasOwnProp$e.call(b, prop))
2560
- __defNormalProp$d(a, prop, b[prop]);
2561
- if (__getOwnPropSymbols$e)
2562
- for (var prop of __getOwnPropSymbols$e(b)) {
2563
- if (__propIsEnum$e.call(b, prop))
2564
- __defNormalProp$d(a, prop, b[prop]);
2559
+ if (__hasOwnProp$h.call(b, prop))
2560
+ __defNormalProp$g(a, prop, b[prop]);
2561
+ if (__getOwnPropSymbols$h)
2562
+ for (var prop of __getOwnPropSymbols$h(b)) {
2563
+ if (__propIsEnum$h.call(b, prop))
2564
+ __defNormalProp$g(a, prop, b[prop]);
2565
2565
  }
2566
2566
  return a;
2567
2567
  };
2568
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
2568
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
2569
2569
  const processJoinArgs = (joinTo, first, args, joinSubQuery) => {
2570
2570
  var _a;
2571
2571
  if (typeof first === "string") {
@@ -2598,13 +2598,13 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery) => {
2598
2598
  logger: joinToQ.logger
2599
2599
  };
2600
2600
  j.baseQuery = j;
2601
- const joinedShapes = __spreadProps$4(__spreadValues$d({}, joinToQ.joinedShapes), {
2601
+ const joinedShapes = __spreadProps$6(__spreadValues$g({}, joinToQ.joinedShapes), {
2602
2602
  [joinToQ.as || joinTo.table]: joinTo.shape
2603
2603
  });
2604
2604
  const r = args[0](
2605
2605
  makeJoinQueryBuilder(
2606
2606
  j,
2607
- j.q.joinedShapes ? __spreadValues$d(__spreadValues$d({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
2607
+ j.q.joinedShapes ? __spreadValues$g(__spreadValues$g({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
2608
2608
  joinTo
2609
2609
  )
2610
2610
  );
@@ -2627,16 +2627,16 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery) => {
2627
2627
  pushQueryArray(q, "or", query.or);
2628
2628
  }
2629
2629
  if (query.scopes) {
2630
- q.q.scopes = __spreadValues$d(__spreadValues$d({}, q.q.scopes), query.scopes);
2630
+ q.q.scopes = __spreadValues$g(__spreadValues$g({}, q.q.scopes), query.scopes);
2631
2631
  }
2632
2632
  }
2633
- const joinedShapes = __spreadProps$4(__spreadValues$d({}, joinTo.q.joinedShapes), {
2633
+ const joinedShapes = __spreadProps$6(__spreadValues$g({}, joinTo.q.joinedShapes), {
2634
2634
  [joinTo.q.as || joinTo.table]: joinTo.shape
2635
2635
  });
2636
2636
  const r = args0(
2637
2637
  makeJoinQueryBuilder(
2638
2638
  q,
2639
- q.q.joinedShapes ? __spreadValues$d(__spreadValues$d({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
2639
+ q.q.joinedShapes ? __spreadValues$g(__spreadValues$g({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
2640
2640
  joinTo
2641
2641
  )
2642
2642
  );
@@ -2684,25 +2684,25 @@ const _queryNone = (q) => {
2684
2684
  };
2685
2685
  const isQueryNone = (q) => q.then === noneMethods.then;
2686
2686
 
2687
- var __defProp$c = Object.defineProperty;
2688
- var __defProps$3 = Object.defineProperties;
2689
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
2690
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
2691
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
2692
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
2693
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2694
- var __spreadValues$c = (a, b) => {
2687
+ var __defProp$f = Object.defineProperty;
2688
+ var __defProps$5 = Object.defineProperties;
2689
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
2690
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
2691
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
2692
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
2693
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2694
+ var __spreadValues$f = (a, b) => {
2695
2695
  for (var prop in b || (b = {}))
2696
- if (__hasOwnProp$d.call(b, prop))
2697
- __defNormalProp$c(a, prop, b[prop]);
2698
- if (__getOwnPropSymbols$d)
2699
- for (var prop of __getOwnPropSymbols$d(b)) {
2700
- if (__propIsEnum$d.call(b, prop))
2701
- __defNormalProp$c(a, prop, b[prop]);
2696
+ if (__hasOwnProp$g.call(b, prop))
2697
+ __defNormalProp$f(a, prop, b[prop]);
2698
+ if (__getOwnPropSymbols$g)
2699
+ for (var prop of __getOwnPropSymbols$g(b)) {
2700
+ if (__propIsEnum$g.call(b, prop))
2701
+ __defNormalProp$f(a, prop, b[prop]);
2702
2702
  }
2703
2703
  return a;
2704
2704
  };
2705
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
2705
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
2706
2706
  const _join = (query, require2, type, first, args) => {
2707
2707
  var _a, _b, _c, _d;
2708
2708
  let joinKey;
@@ -2747,7 +2747,7 @@ const _join = (query, require2, type, first, args) => {
2747
2747
  computeds = w == null ? void 0 : w.computeds;
2748
2748
  if (shape) {
2749
2749
  if (!require2)
2750
- shape = __spreadValues$c({}, shape);
2750
+ shape = __spreadValues$f({}, shape);
2751
2751
  parsers = {};
2752
2752
  for (const key in shape) {
2753
2753
  const parser = shape[key].parseFn;
@@ -2847,7 +2847,7 @@ const _joinLateral = (self, type, arg, cb, as) => {
2847
2847
  t.table = arg;
2848
2848
  t.shape = w.shape;
2849
2849
  t.computeds = w.computeds;
2850
- t.q = __spreadProps$3(__spreadValues$c({}, t.q), {
2850
+ t.q = __spreadProps$5(__spreadValues$f({}, t.q), {
2851
2851
  shape: w.shape
2852
2852
  });
2853
2853
  t.baseQuery = t;
@@ -3220,6 +3220,25 @@ const finalizeNestedHookSelect = (batches, returnType, tempColumns, renames, key
3220
3220
  }
3221
3221
  };
3222
3222
 
3223
+ var __defProp$e = Object.defineProperty;
3224
+ var __defProps$4 = Object.defineProperties;
3225
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
3226
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3227
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3228
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3229
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3230
+ var __spreadValues$e = (a, b) => {
3231
+ for (var prop in b || (b = {}))
3232
+ if (__hasOwnProp$f.call(b, prop))
3233
+ __defNormalProp$e(a, prop, b[prop]);
3234
+ if (__getOwnPropSymbols$f)
3235
+ for (var prop of __getOwnPropSymbols$f(b)) {
3236
+ if (__propIsEnum$f.call(b, prop))
3237
+ __defNormalProp$e(a, prop, b[prop]);
3238
+ }
3239
+ return a;
3240
+ };
3241
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
3223
3242
  class ComputedColumn {
3224
3243
  constructor(kind, deps, fn) {
3225
3244
  this.kind = kind;
@@ -3230,14 +3249,13 @@ class ComputedColumn {
3230
3249
  const computeAtRuntime = (deps, fn) => new ComputedColumn("one", deps, fn);
3231
3250
  const computeBatchAtRuntime = (deps, fn) => new ComputedColumn("many", deps, fn);
3232
3251
  const applyComputedColumns = (q, fn) => {
3233
- var _a, _b;
3234
3252
  q.computeAtRuntime = computeAtRuntime;
3235
3253
  q.computeBatchAtRuntime = computeBatchAtRuntime;
3236
3254
  const computed = fn(q);
3237
3255
  for (const key in computed) {
3238
3256
  const item = computed[key];
3239
3257
  if (item instanceof ComputedColumn) {
3240
- ((_b = (_a = q.q).computeds) != null ? _b : _a.computeds = {})[key] = item;
3258
+ q.q.computeds = __spreadProps$4(__spreadValues$e({}, q.q.computeds), { [key]: item });
3241
3259
  } else {
3242
3260
  (q.shape[key] = item.result.value || UnknownColumn.instance).data.computed = item;
3243
3261
  }
@@ -3345,19 +3363,19 @@ const saveBatchComputed = (key, result, res, blanks) => {
3345
3363
  }
3346
3364
  };
3347
3365
 
3348
- var __defProp$b = Object.defineProperty;
3349
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
3350
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
3351
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
3352
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3353
- var __spreadValues$b = (a, b) => {
3366
+ var __defProp$d = Object.defineProperty;
3367
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
3368
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
3369
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
3370
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3371
+ var __spreadValues$d = (a, b) => {
3354
3372
  for (var prop in b || (b = {}))
3355
- if (__hasOwnProp$c.call(b, prop))
3356
- __defNormalProp$b(a, prop, b[prop]);
3357
- if (__getOwnPropSymbols$c)
3358
- for (var prop of __getOwnPropSymbols$c(b)) {
3359
- if (__propIsEnum$c.call(b, prop))
3360
- __defNormalProp$b(a, prop, b[prop]);
3373
+ if (__hasOwnProp$e.call(b, prop))
3374
+ __defNormalProp$d(a, prop, b[prop]);
3375
+ if (__getOwnPropSymbols$e)
3376
+ for (var prop of __getOwnPropSymbols$e(b)) {
3377
+ if (__propIsEnum$e.call(b, prop))
3378
+ __defNormalProp$d(a, prop, b[prop]);
3361
3379
  }
3362
3380
  return a;
3363
3381
  };
@@ -3814,7 +3832,7 @@ const filterResult = (q, returnType, queryResult, result, tempColumns, hasAfterH
3814
3832
  return row;
3815
3833
  } else {
3816
3834
  if (hasAfterHook)
3817
- row = __spreadValues$b({}, row);
3835
+ row = __spreadValues$d({}, row);
3818
3836
  for (const column of tempColumns) {
3819
3837
  delete row[column];
3820
3838
  }
@@ -3847,7 +3865,7 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
3847
3865
  if (tempColumns == null ? void 0 : tempColumns.size) {
3848
3866
  if (hasAfterHook) {
3849
3867
  return result.map((data) => {
3850
- const record = __spreadValues$b({}, data);
3868
+ const record = __spreadValues$d({}, data);
3851
3869
  for (const key of tempColumns) {
3852
3870
  delete record[key];
3853
3871
  }
@@ -3864,6 +3882,25 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
3864
3882
  return result;
3865
3883
  };
3866
3884
 
3885
+ var __defProp$c = Object.defineProperty;
3886
+ var __defProps$3 = Object.defineProperties;
3887
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
3888
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
3889
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
3890
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
3891
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3892
+ var __spreadValues$c = (a, b) => {
3893
+ for (var prop in b || (b = {}))
3894
+ if (__hasOwnProp$d.call(b, prop))
3895
+ __defNormalProp$c(a, prop, b[prop]);
3896
+ if (__getOwnPropSymbols$d)
3897
+ for (var prop of __getOwnPropSymbols$d(b)) {
3898
+ if (__propIsEnum$d.call(b, prop))
3899
+ __defNormalProp$c(a, prop, b[prop]);
3900
+ }
3901
+ return a;
3902
+ };
3903
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
3867
3904
  const addParserForRawExpression = (q, key, raw) => {
3868
3905
  const type = raw.result.value;
3869
3906
  if (type == null ? void 0 : type.parseFn)
@@ -4156,7 +4193,7 @@ const processSelectArg = (q, as, arg, columnAs) => {
4156
4193
  return { selectAs };
4157
4194
  };
4158
4195
  const setParserForSelectedString = (q, arg, as, columnAs) => {
4159
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4160
4197
  const index = arg.indexOf(".");
4161
4198
  if (index !== -1) {
4162
4199
  const table = arg.slice(0, index);
@@ -4190,14 +4227,16 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
4190
4227
  for (const column2 of computed.deps) {
4191
4228
  map.set(column2, { select: `${table}.${column2}` });
4192
4229
  }
4193
- ((_k = (_j = q.q).selectedComputeds) != null ? _k : _j.selectedComputeds = {})[column] = computed;
4230
+ q.q.selectedComputeds = __spreadProps$3(__spreadValues$c({}, q.q.selectedComputeds), {
4231
+ [column]: computed
4232
+ });
4194
4233
  return;
4195
4234
  }
4196
4235
  return arg;
4197
4236
  }
4198
4237
  } else {
4199
4238
  if (columnAs) {
4200
- const parser = (_l = q.q.parsers) == null ? void 0 : _l[arg];
4239
+ const parser = (_j = q.q.parsers) == null ? void 0 : _j[arg];
4201
4240
  if (parser)
4202
4241
  q.q.parsers[columnAs] = parser;
4203
4242
  }
@@ -4205,14 +4244,14 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
4205
4244
  }
4206
4245
  };
4207
4246
  const handleComputed = (q, computeds, column) => {
4208
- var _a, _b, _c, _d;
4247
+ var _a, _b;
4209
4248
  if (computeds == null ? void 0 : computeds[column]) {
4210
4249
  const computed = computeds[column];
4211
4250
  const map = (_b = (_a = q.q).hookSelect) != null ? _b : _a.hookSelect = /* @__PURE__ */ new Map();
4212
4251
  for (const column2 of computed.deps) {
4213
4252
  map.set(column2, { select: column2 });
4214
4253
  }
4215
- ((_d = (_c = q.q).selectedComputeds) != null ? _d : _c.selectedComputeds = {})[column] = computed;
4254
+ q.q.selectedComputeds = __spreadProps$3(__spreadValues$c({}, q.q.selectedComputeds), { [column]: computed });
4216
4255
  return;
4217
4256
  }
4218
4257
  return column;
@@ -4428,8 +4467,24 @@ class AsMethods {
4428
4467
  }
4429
4468
  }
4430
4469
 
4470
+ var __defProp$b = Object.defineProperty;
4471
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
4472
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
4473
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
4474
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4475
+ var __spreadValues$b = (a, b) => {
4476
+ for (var prop in b || (b = {}))
4477
+ if (__hasOwnProp$c.call(b, prop))
4478
+ __defNormalProp$b(a, prop, b[prop]);
4479
+ if (__getOwnPropSymbols$c)
4480
+ for (var prop of __getOwnPropSymbols$c(b)) {
4481
+ if (__propIsEnum$c.call(b, prop))
4482
+ __defNormalProp$b(a, prop, b[prop]);
4483
+ }
4484
+ return a;
4485
+ };
4431
4486
  function queryFrom(self, arg) {
4432
- var _a, _b, _c, _d;
4487
+ var _a, _b, _c;
4433
4488
  const data = self.q;
4434
4489
  if (typeof arg === "string") {
4435
4490
  data.as || (data.as = arg);
@@ -4441,12 +4496,12 @@ function queryFrom(self, arg) {
4441
4496
  } else if (Array.isArray(arg)) {
4442
4497
  const { shape } = data;
4443
4498
  const parsers = (_c = data.parsers) != null ? _c : data.parsers = {};
4444
- const computeds = (_d = data.computeds) != null ? _d : data.computeds = {};
4445
4499
  for (const item of arg) {
4446
4500
  if (typeof item === "string") {
4447
4501
  const w = data.withShapes[item];
4448
4502
  Object.assign(shape, w.shape);
4449
- Object.assign(computeds, w.computeds);
4503
+ if (w.computeds)
4504
+ data.computeds = __spreadValues$b(__spreadValues$b({}, data.computeds), w.computeds);
4450
4505
  for (const key in w.shape) {
4451
4506
  if (w.shape[key].parseFn) {
4452
4507
  parsers[key] = w.shape[key].parseFn;
@@ -5704,6 +5759,12 @@ const cloneQuery = (q) => {
5704
5759
  q.after = q.after.slice(0);
5705
5760
  if (q.joinedShapes)
5706
5761
  q.joinedShapes = __spreadValues$a({}, q.joinedShapes);
5762
+ if (q.joinedComputeds)
5763
+ q.joinedComputeds = __spreadValues$a({}, q.joinedComputeds);
5764
+ if (q.batchParsers)
5765
+ q.batchParsers = [...q.batchParsers];
5766
+ if (q.joinedBatchParsers)
5767
+ q.joinedBatchParsers = __spreadValues$a({}, q.joinedBatchParsers);
5707
5768
  if (q.scopes)
5708
5769
  q.scopes = __spreadValues$a({}, q.scopes);
5709
5770
  if (q.parsers)