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