pqb 0.40.10 → 0.40.12

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$m = Object.defineProperty;
121
- var __defProps$d = Object.defineProperties;
122
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
123
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
124
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
125
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
126
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
127
- var __spreadValues$m = (a, b) => {
120
+ var __defProp$n = Object.defineProperty;
121
+ var __defProps$e = Object.defineProperties;
122
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
123
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
124
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
125
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
126
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
127
+ var __spreadValues$n = (a, b) => {
128
128
  for (var prop in b || (b = {}))
129
- if (__hasOwnProp$n.call(b, prop))
130
- __defNormalProp$m(a, prop, b[prop]);
131
- if (__getOwnPropSymbols$n)
132
- for (var prop of __getOwnPropSymbols$n(b)) {
133
- if (__propIsEnum$n.call(b, prop))
134
- __defNormalProp$m(a, prop, b[prop]);
129
+ if (__hasOwnProp$o.call(b, prop))
130
+ __defNormalProp$n(a, prop, b[prop]);
131
+ if (__getOwnPropSymbols$o)
132
+ for (var prop of __getOwnPropSymbols$o(b)) {
133
+ if (__propIsEnum$o.call(b, prop))
134
+ __defNormalProp$n(a, prop, b[prop]);
135
135
  }
136
136
  return a;
137
137
  };
138
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
138
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(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$m(__spreadValues$m({}, typeof args[0] === "string" ? args[1] : args[0]), this.dataType === "tsvector" ? { using: "GIN" } : { tsVector: true }),
337
+ options: __spreadValues$n(__spreadValues$n({}, 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$d(__spreadValues$m({}, typeof args[0] === "string" ? args[1] : args[0]), {
343
+ options: __spreadProps$e(__spreadValues$n({}, 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
@@ -383,25 +383,25 @@ class ColumnType extends ColumnTypeBase {
383
383
  }
384
384
  }
385
385
 
386
- var __defProp$l = Object.defineProperty;
387
- var __defProps$c = Object.defineProperties;
388
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
389
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
390
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
391
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
392
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
393
- var __spreadValues$l = (a, b) => {
386
+ var __defProp$m = Object.defineProperty;
387
+ var __defProps$d = Object.defineProperties;
388
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
389
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
390
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
391
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
392
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
393
+ var __spreadValues$m = (a, b) => {
394
394
  for (var prop in b || (b = {}))
395
- if (__hasOwnProp$m.call(b, prop))
396
- __defNormalProp$l(a, prop, b[prop]);
397
- if (__getOwnPropSymbols$m)
398
- for (var prop of __getOwnPropSymbols$m(b)) {
399
- if (__propIsEnum$m.call(b, prop))
400
- __defNormalProp$l(a, prop, b[prop]);
395
+ if (__hasOwnProp$n.call(b, prop))
396
+ __defNormalProp$m(a, prop, b[prop]);
397
+ if (__getOwnPropSymbols$n)
398
+ for (var prop of __getOwnPropSymbols$n(b)) {
399
+ if (__propIsEnum$n.call(b, prop))
400
+ __defNormalProp$m(a, prop, b[prop]);
401
401
  }
402
402
  return a;
403
403
  };
404
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
404
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
405
405
  const knownDefaults = {
406
406
  current_timestamp: "now()",
407
407
  "transaction_timestamp()": "now()"
@@ -417,7 +417,7 @@ const simplifyColumnDefault = (value) => {
417
417
  const instantiateColumn = (typeFn, params) => {
418
418
  const column = typeFn();
419
419
  const { dateTimePrecision } = params;
420
- Object.assign(column.data, __spreadProps$c(__spreadValues$l({}, params), {
420
+ Object.assign(column.data, __spreadProps$d(__spreadValues$m({}, params), {
421
421
  dateTimePrecision: (
422
422
  // 0 is default for date, 6 is default for timestamp
423
423
  dateTimePrecision && dateTimePrecision !== 6 ? dateTimePrecision : void 0
@@ -856,25 +856,25 @@ const getSqlText = (sql) => {
856
856
  throw new Error(`Batch SQL is not supported in this query`);
857
857
  };
858
858
 
859
- var __defProp$k = Object.defineProperty;
860
- var __defProps$b = Object.defineProperties;
861
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
862
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
863
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
864
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
865
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
866
- var __spreadValues$k = (a, b) => {
859
+ var __defProp$l = Object.defineProperty;
860
+ var __defProps$c = Object.defineProperties;
861
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
862
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
863
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
864
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
865
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
866
+ var __spreadValues$l = (a, b) => {
867
867
  for (var prop in b || (b = {}))
868
- if (__hasOwnProp$l.call(b, prop))
869
- __defNormalProp$k(a, prop, b[prop]);
870
- if (__getOwnPropSymbols$l)
871
- for (var prop of __getOwnPropSymbols$l(b)) {
872
- if (__propIsEnum$l.call(b, prop))
873
- __defNormalProp$k(a, prop, b[prop]);
868
+ if (__hasOwnProp$m.call(b, prop))
869
+ __defNormalProp$l(a, prop, b[prop]);
870
+ if (__getOwnPropSymbols$m)
871
+ for (var prop of __getOwnPropSymbols$m(b)) {
872
+ if (__propIsEnum$m.call(b, prop))
873
+ __defNormalProp$l(a, prop, b[prop]);
874
874
  }
875
875
  return a;
876
876
  };
877
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
877
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
878
878
  function setQueryOperators(query, operators) {
879
879
  const q = query.q;
880
880
  if (q.operators !== operators) {
@@ -963,7 +963,7 @@ const base = {
963
963
  (key, value, ctx, quotedAs) => `NOT ${key} IN ${quoteValue(value, ctx, quotedAs)}`
964
964
  )
965
965
  };
966
- const boolean = __spreadProps$b(__spreadValues$k({}, base), {
966
+ const boolean = __spreadProps$c(__spreadValues$l({}, base), {
967
967
  and: make(
968
968
  (key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
969
969
  ),
@@ -971,7 +971,7 @@ const boolean = __spreadProps$b(__spreadValues$k({}, base), {
971
971
  (key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
972
972
  )
973
973
  });
974
- const numeric = __spreadProps$b(__spreadValues$k({}, base), {
974
+ const numeric = __spreadProps$c(__spreadValues$l({}, base), {
975
975
  lt: make(
976
976
  (key, value, ctx, quotedAs) => `${key} < ${quoteValue(value, ctx, quotedAs)}`
977
977
  ),
@@ -992,7 +992,7 @@ const numeric = __spreadProps$b(__spreadValues$k({}, base), {
992
992
  )}`
993
993
  )
994
994
  });
995
- const text = __spreadProps$b(__spreadValues$k({}, base), {
995
+ const text = __spreadProps$c(__spreadValues$l({}, base), {
996
996
  contains: make(
997
997
  (key, value, ctx, quotedAs) => `${key} ILIKE '%' || ${quoteLikeValue(value, ctx, quotedAs)} || '%'`
998
998
  ),
@@ -1014,7 +1014,7 @@ const text = __spreadProps$b(__spreadValues$k({}, base), {
1014
1014
  });
1015
1015
  const encodeJsonPath = (ctx, path) => addValue(ctx.values, `{${Array.isArray(path) ? path.join(", ") : path}}`);
1016
1016
  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" : ""})`;
1017
- const json = __spreadProps$b(__spreadValues$k({}, base), {
1017
+ const json = __spreadProps$c(__spreadValues$l({}, base), {
1018
1018
  jsonPathQueryFirst: Object.assign(
1019
1019
  function(path, options) {
1020
1020
  var _a, _b, _c, _d, _e;
@@ -1077,25 +1077,25 @@ const Operators = {
1077
1077
  array: base
1078
1078
  };
1079
1079
 
1080
- var __defProp$j = Object.defineProperty;
1081
- var __defProps$a = Object.defineProperties;
1082
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
1083
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
1084
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
1085
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
1086
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1087
- var __spreadValues$j = (a, b) => {
1080
+ var __defProp$k = Object.defineProperty;
1081
+ var __defProps$b = Object.defineProperties;
1082
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
1083
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
1084
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
1085
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
1086
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1087
+ var __spreadValues$k = (a, b) => {
1088
1088
  for (var prop in b || (b = {}))
1089
- if (__hasOwnProp$k.call(b, prop))
1090
- __defNormalProp$j(a, prop, b[prop]);
1091
- if (__getOwnPropSymbols$k)
1092
- for (var prop of __getOwnPropSymbols$k(b)) {
1093
- if (__propIsEnum$k.call(b, prop))
1094
- __defNormalProp$j(a, prop, b[prop]);
1089
+ if (__hasOwnProp$l.call(b, prop))
1090
+ __defNormalProp$k(a, prop, b[prop]);
1091
+ if (__getOwnPropSymbols$l)
1092
+ for (var prop of __getOwnPropSymbols$l(b)) {
1093
+ if (__propIsEnum$l.call(b, prop))
1094
+ __defNormalProp$k(a, prop, b[prop]);
1095
1095
  }
1096
1096
  return a;
1097
1097
  };
1098
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
1098
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
1099
1099
  class TextBaseColumn extends ColumnType {
1100
1100
  constructor(schema, schemaType = schema.stringSchema()) {
1101
1101
  super(schema, schemaType);
@@ -1149,7 +1149,7 @@ class StringColumn extends VarCharColumn {
1149
1149
  }
1150
1150
  }
1151
1151
  const textColumnToCode = (column, ctx, key) => {
1152
- const data = __spreadValues$j({}, column.data);
1152
+ const data = __spreadValues$k({}, column.data);
1153
1153
  let args = "";
1154
1154
  const hasMax = data.maxArg !== void 0 && data.max === data.maxArg;
1155
1155
  if (data.minArg !== void 0 && data.min === data.minArg || hasMax) {
@@ -1454,7 +1454,7 @@ class UUIDColumn extends ColumnType {
1454
1454
  key,
1455
1455
  `uuid()`,
1456
1456
  // don't output the default default
1457
- data.default instanceof RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$a(__spreadValues$j({}, data), { default: void 0 }) : data
1457
+ data.default instanceof RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$b(__spreadValues$k({}, data), { default: void 0 }) : data
1458
1458
  );
1459
1459
  }
1460
1460
  }
@@ -1745,7 +1745,7 @@ const columnWithDotToSql = (ctx, data, shape, column, index, quotedAs, select) =
1745
1745
  if (key === "*") {
1746
1746
  return ((_a = data.joinedShapes) == null ? void 0 : _a[table]) ? select ? `row_to_json("${table}".*)` : `"${table}".*` : column;
1747
1747
  }
1748
- const tableName = ((_b = data.joinOverrides) == null ? void 0 : _b[table]) || table;
1748
+ const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
1749
1749
  const quoted = `"${table}"`;
1750
1750
  const col = quoted === quotedAs ? shape[key] : (_d = (_c = data.joinedShapes) == null ? void 0 : _c[tableName]) == null ? void 0 : _d[key];
1751
1751
  if (col) {
@@ -1775,12 +1775,28 @@ const columnToSqlWithAs = (ctx, data, column, as, quotedAs, select) => {
1775
1775
  const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, select) => {
1776
1776
  var _a, _b, _c;
1777
1777
  if (key === "*") {
1778
- if ((_a = data.joinedShapes) == null ? void 0 : _a[table]) {
1779
- return select ? `row_to_json("${table}".*) "${as}"` : `"${table}".r "${as}"`;
1778
+ const shape = (_a = data.joinedShapes) == null ? void 0 : _a[table];
1779
+ if (shape) {
1780
+ if (select) {
1781
+ let isSimple = true;
1782
+ const list = [];
1783
+ for (const key2 in shape) {
1784
+ const column2 = shape[key2];
1785
+ if (column2.data.explicitSelect || column2 instanceof VirtualColumn) {
1786
+ continue;
1787
+ }
1788
+ if (column2.data.name) {
1789
+ isSimple = false;
1790
+ }
1791
+ list.push(`'${key2}'`, `"${table}"."${column2.data.name || key2}"`);
1792
+ }
1793
+ return (isSimple ? `row_to_json("${table}".*)` : "json_build_object(" + list.join(", ") + ")") + ` "${as}"`;
1794
+ }
1795
+ return `"${table}".r "${as}"`;
1780
1796
  }
1781
1797
  return column;
1782
1798
  }
1783
- const tableName = ((_b = data.joinOverrides) == null ? void 0 : _b[table]) || table;
1799
+ const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
1784
1800
  const quoted = `"${table}"`;
1785
1801
  const col = quoted === quotedAs ? data.shape[key] : (_c = data.joinedShapes) == null ? void 0 : _c[tableName][key];
1786
1802
  if (col) {
@@ -1896,8 +1912,10 @@ class QueryError extends OrchidOrmInternalError {
1896
1912
  const list = (_a = this.detail.match(/\((.*)\)=/)) == null ? void 0 : _a[1];
1897
1913
  if (list) {
1898
1914
  list.split(", ").forEach((item) => {
1915
+ var _a2;
1899
1916
  const column = item.startsWith('"') ? item.slice(1, -1) : item;
1900
- columns[column] = true;
1917
+ const key = (_a2 = this.query.columnNameToKey(column)) != null ? _a2 : column;
1918
+ columns[key] = true;
1901
1919
  });
1902
1920
  }
1903
1921
  }
@@ -1947,6 +1965,17 @@ const throwIfNoWhere = (q, method) => {
1947
1965
  );
1948
1966
  }
1949
1967
  };
1968
+ const throwIfJoinLateral = (q, method) => {
1969
+ var _a;
1970
+ if ((_a = q.q.join) == null ? void 0 : _a.some(
1971
+ (x) => Array.isArray(x) || "s" in x.args && x.args.s
1972
+ )) {
1973
+ throw new OrchidOrmInternalError(
1974
+ q,
1975
+ `Cannot join a complex query in ${method}`
1976
+ );
1977
+ }
1978
+ };
1950
1979
  const saveSearchAlias = (q, as, key) => {
1951
1980
  const shapes = q.q[key];
1952
1981
  if (shapes == null ? void 0 : shapes[as]) {
@@ -2108,9 +2137,9 @@ const processWhere = (ands, ctx, table, query, data, quotedAs) => {
2108
2137
  const item = value;
2109
2138
  const joinAs = `"${getJoinItemSource(item.joinFrom)}"`;
2110
2139
  const { on } = item;
2111
- const q = item.useOuterJoinOverrides ? {
2140
+ const q = item.useOuterAliases ? {
2112
2141
  joinedShapes: query.joinedShapes,
2113
- joinOverrides: query.outerJoinOverrides,
2142
+ aliases: query.outerAliases,
2114
2143
  shape: query.shape
2115
2144
  } : query;
2116
2145
  ands.push(
@@ -2238,25 +2267,25 @@ const pushIn = (ctx, query, ands, quotedAs, arg) => {
2238
2267
  ands.push(`${multiple ? `(${columnsSql})` : columnsSql} IN ${value}`);
2239
2268
  };
2240
2269
 
2241
- var __defProp$i = Object.defineProperty;
2242
- var __defProps$9 = Object.defineProperties;
2243
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
2244
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
2245
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
2246
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
2247
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2248
- var __spreadValues$i = (a, b) => {
2270
+ var __defProp$j = Object.defineProperty;
2271
+ var __defProps$a = Object.defineProperties;
2272
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
2273
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
2274
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
2275
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
2276
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2277
+ var __spreadValues$j = (a, b) => {
2249
2278
  for (var prop in b || (b = {}))
2250
- if (__hasOwnProp$j.call(b, prop))
2251
- __defNormalProp$i(a, prop, b[prop]);
2252
- if (__getOwnPropSymbols$j)
2253
- for (var prop of __getOwnPropSymbols$j(b)) {
2254
- if (__propIsEnum$j.call(b, prop))
2255
- __defNormalProp$i(a, prop, b[prop]);
2279
+ if (__hasOwnProp$k.call(b, prop))
2280
+ __defNormalProp$j(a, prop, b[prop]);
2281
+ if (__getOwnPropSymbols$k)
2282
+ for (var prop of __getOwnPropSymbols$k(b)) {
2283
+ if (__propIsEnum$k.call(b, prop))
2284
+ __defNormalProp$j(a, prop, b[prop]);
2256
2285
  }
2257
2286
  return a;
2258
2287
  };
2259
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
2288
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
2260
2289
  const processJoinItem = (ctx, table, query, args, quotedAs) => {
2261
2290
  let target;
2262
2291
  let on;
@@ -2318,8 +2347,8 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
2318
2347
  const whereSql = whereToSql(
2319
2348
  ctx,
2320
2349
  q,
2321
- __spreadProps$9(__spreadValues$i({}, q.q), {
2322
- joinedShapes: __spreadProps$9(__spreadValues$i(__spreadValues$i({}, query.joinedShapes), q.q.joinedShapes), {
2350
+ __spreadProps$a(__spreadValues$j({}, q.q), {
2351
+ joinedShapes: __spreadProps$a(__spreadValues$j(__spreadValues$j({}, query.joinedShapes), q.q.joinedShapes), {
2323
2352
  [table.q.as || table.table]: table.q.shape
2324
2353
  })
2325
2354
  }),
@@ -2422,7 +2451,7 @@ const pushJoinSql = (ctx, table, query, quotedAs) => {
2422
2451
  const { aliasValue } = ctx;
2423
2452
  ctx.aliasValue = true;
2424
2453
  const as = item[2];
2425
- sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.joinOverrides) == null ? void 0 : _a[as]) || as}" ON true`;
2454
+ sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.aliases) == null ? void 0 : _a[as]) || as}" ON true`;
2426
2455
  ctx.aliasValue = aliasValue;
2427
2456
  } else {
2428
2457
  const { target, on = "true" } = processJoinItem(
@@ -2451,7 +2480,8 @@ const skipQueryKeysForSubQuery = {
2451
2480
  or: true,
2452
2481
  returnType: true,
2453
2482
  joinedShapes: true,
2454
- returnsOne: true
2483
+ returnsOne: true,
2484
+ aliases: true
2455
2485
  };
2456
2486
  const getIsJoinSubQuery = (query) => {
2457
2487
  const {
@@ -2466,25 +2496,25 @@ const getIsJoinSubQuery = (query) => {
2466
2496
  return false;
2467
2497
  };
2468
2498
 
2469
- var __defProp$h = Object.defineProperty;
2470
- var __defProps$8 = Object.defineProperties;
2471
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
2472
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2473
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2474
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2475
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2476
- var __spreadValues$h = (a, b) => {
2499
+ var __defProp$i = Object.defineProperty;
2500
+ var __defProps$9 = Object.defineProperties;
2501
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
2502
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
2503
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
2504
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
2505
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2506
+ var __spreadValues$i = (a, b) => {
2477
2507
  for (var prop in b || (b = {}))
2478
- if (__hasOwnProp$i.call(b, prop))
2479
- __defNormalProp$h(a, prop, b[prop]);
2480
- if (__getOwnPropSymbols$i)
2481
- for (var prop of __getOwnPropSymbols$i(b)) {
2482
- if (__propIsEnum$i.call(b, prop))
2483
- __defNormalProp$h(a, prop, b[prop]);
2508
+ if (__hasOwnProp$j.call(b, prop))
2509
+ __defNormalProp$i(a, prop, b[prop]);
2510
+ if (__getOwnPropSymbols$j)
2511
+ for (var prop of __getOwnPropSymbols$j(b)) {
2512
+ if (__propIsEnum$j.call(b, prop))
2513
+ __defNormalProp$i(a, prop, b[prop]);
2484
2514
  }
2485
2515
  return a;
2486
2516
  };
2487
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
2517
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
2488
2518
  const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
2489
2519
  var _a;
2490
2520
  if (typeof first === "string") {
@@ -2521,13 +2551,13 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
2521
2551
  logger: joinToQ.logger
2522
2552
  };
2523
2553
  j.baseQuery = j;
2524
- const joinedShapes = __spreadProps$8(__spreadValues$h({}, joinToQ.joinedShapes), {
2554
+ const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinToQ.joinedShapes), {
2525
2555
  [joinToQ.as || joinTo.table]: joinTo.shape
2526
2556
  });
2527
2557
  const r = args[0](
2528
2558
  makeJoinQueryBuilder(
2529
2559
  j,
2530
- j.q.joinedShapes ? __spreadValues$h(__spreadValues$h({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
2560
+ j.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
2531
2561
  joinTo
2532
2562
  )
2533
2563
  );
@@ -2554,16 +2584,16 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
2554
2584
  pushQueryArray(q, "or", query.or);
2555
2585
  }
2556
2586
  if (query.scopes) {
2557
- q.q.scopes = __spreadValues$h(__spreadValues$h({}, q.q.scopes), query.scopes);
2587
+ q.q.scopes = __spreadValues$i(__spreadValues$i({}, q.q.scopes), query.scopes);
2558
2588
  }
2559
2589
  }
2560
- const joinedShapes = __spreadProps$8(__spreadValues$h({}, joinTo.q.joinedShapes), {
2590
+ const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinTo.q.joinedShapes), {
2561
2591
  [joinTo.q.as || joinTo.table]: joinTo.shape
2562
2592
  });
2563
2593
  const r = args0(
2564
2594
  makeJoinQueryBuilder(
2565
2595
  q,
2566
- q.q.joinedShapes ? __spreadValues$h(__spreadValues$h({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
2596
+ q.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
2567
2597
  joinTo
2568
2598
  )
2569
2599
  );
@@ -2618,25 +2648,25 @@ const _queryNone = (q) => {
2618
2648
  };
2619
2649
  const isQueryNone = (q) => q.then === noneMethods.then;
2620
2650
 
2621
- var __defProp$g = Object.defineProperty;
2622
- var __defProps$7 = Object.defineProperties;
2623
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
2624
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
2625
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
2626
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
2627
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2628
- var __spreadValues$g = (a, b) => {
2651
+ var __defProp$h = Object.defineProperty;
2652
+ var __defProps$8 = Object.defineProperties;
2653
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
2654
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2655
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2656
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2657
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2658
+ var __spreadValues$h = (a, b) => {
2629
2659
  for (var prop in b || (b = {}))
2630
- if (__hasOwnProp$h.call(b, prop))
2631
- __defNormalProp$g(a, prop, b[prop]);
2632
- if (__getOwnPropSymbols$h)
2633
- for (var prop of __getOwnPropSymbols$h(b)) {
2634
- if (__propIsEnum$h.call(b, prop))
2635
- __defNormalProp$g(a, prop, b[prop]);
2660
+ if (__hasOwnProp$i.call(b, prop))
2661
+ __defNormalProp$h(a, prop, b[prop]);
2662
+ if (__getOwnPropSymbols$i)
2663
+ for (var prop of __getOwnPropSymbols$i(b)) {
2664
+ if (__propIsEnum$i.call(b, prop))
2665
+ __defNormalProp$h(a, prop, b[prop]);
2636
2666
  }
2637
2667
  return a;
2638
2668
  };
2639
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
2669
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
2640
2670
  const _join = (query, require2, type, first, args) => {
2641
2671
  var _a, _b, _c, _d;
2642
2672
  let joinKey;
@@ -2650,16 +2680,16 @@ const _join = (query, require2, type, first, args) => {
2650
2680
  if (require2 && isQueryNone(first)) {
2651
2681
  return _queryNone(query);
2652
2682
  }
2653
- const q = first;
2654
- joinSubQuery = getIsJoinSubQuery(q);
2655
- joinKey = q.q.as || q.table;
2683
+ const q2 = first;
2684
+ joinSubQuery = getIsJoinSubQuery(q2);
2685
+ joinKey = q2.q.as || q2.table;
2656
2686
  if (joinKey) {
2657
- shape = getShapeFromSelect(q, joinSubQuery);
2658
- parsers = q.q.parsers;
2659
- batchParsers = q.q.batchParsers;
2660
- computeds = q.q.computeds;
2687
+ shape = getShapeFromSelect(q2, joinSubQuery && !!q2.q.select);
2688
+ parsers = q2.q.parsers;
2689
+ batchParsers = q2.q.batchParsers;
2690
+ computeds = q2.q.computeds;
2661
2691
  if (joinSubQuery) {
2662
- first = q.clone();
2692
+ first = q2.clone();
2663
2693
  first.shape = shape;
2664
2694
  }
2665
2695
  }
@@ -2678,7 +2708,7 @@ const _join = (query, require2, type, first, args) => {
2678
2708
  computeds = w == null ? void 0 : w.computeds;
2679
2709
  if (shape) {
2680
2710
  if (!require2)
2681
- shape = __spreadValues$g({}, shape);
2711
+ shape = __spreadValues$h({}, shape);
2682
2712
  parsers = {};
2683
2713
  for (const key in shape) {
2684
2714
  const parser = shape[key].parseFn;
@@ -2742,10 +2772,14 @@ const _join = (query, require2, type, first, args) => {
2742
2772
  computeds
2743
2773
  );
2744
2774
  }
2745
- return pushQueryValue(query, "join", {
2775
+ const q = pushQueryValue(query, "join", {
2746
2776
  type,
2747
2777
  args: joinArgs
2748
2778
  });
2779
+ if (query.q.type === "delete") {
2780
+ throwIfJoinLateral(q, query.q.type);
2781
+ }
2782
+ return q;
2749
2783
  };
2750
2784
  const addAllShapesAndParsers = (query, joinKey, shape, parsers, batchParsers, computeds) => {
2751
2785
  var _a, _b;
@@ -2778,7 +2812,7 @@ const _joinLateral = (self, type, arg, cb, as) => {
2778
2812
  t.table = arg;
2779
2813
  t.shape = w.shape;
2780
2814
  t.computeds = w.computeds;
2781
- t.q = __spreadProps$7(__spreadValues$g({}, t.q), {
2815
+ t.q = __spreadProps$8(__spreadValues$h({}, t.q), {
2782
2816
  shape: w.shape
2783
2817
  });
2784
2818
  t.baseQuery = t;
@@ -3267,25 +3301,25 @@ class QueryLog {
3267
3301
  }
3268
3302
  }
3269
3303
 
3270
- var __defProp$f = Object.defineProperty;
3271
- var __defProps$6 = Object.defineProperties;
3272
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
3273
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
3274
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
3275
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
3276
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3277
- var __spreadValues$f = (a, b) => {
3304
+ var __defProp$g = Object.defineProperty;
3305
+ var __defProps$7 = Object.defineProperties;
3306
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
3307
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
3308
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
3309
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
3310
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3311
+ var __spreadValues$g = (a, b) => {
3278
3312
  for (var prop in b || (b = {}))
3279
- if (__hasOwnProp$g.call(b, prop))
3280
- __defNormalProp$f(a, prop, b[prop]);
3281
- if (__getOwnPropSymbols$g)
3282
- for (var prop of __getOwnPropSymbols$g(b)) {
3283
- if (__propIsEnum$g.call(b, prop))
3284
- __defNormalProp$f(a, prop, b[prop]);
3313
+ if (__hasOwnProp$h.call(b, prop))
3314
+ __defNormalProp$g(a, prop, b[prop]);
3315
+ if (__getOwnPropSymbols$h)
3316
+ for (var prop of __getOwnPropSymbols$h(b)) {
3317
+ if (__propIsEnum$h.call(b, prop))
3318
+ __defNormalProp$g(a, prop, b[prop]);
3285
3319
  }
3286
3320
  return a;
3287
3321
  };
3288
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
3322
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
3289
3323
  const commitSql$1 = {
3290
3324
  text: "COMMIT"
3291
3325
  };
@@ -3450,7 +3484,7 @@ const runAfterCommit = async (afterCommit, result) => {
3450
3484
  let r = 0;
3451
3485
  for (let i = 0, len = afterCommit.length; i < len; i += 3) {
3452
3486
  for (const fn of afterCommit[i + 2]) {
3453
- resultsWithNames.push(__spreadProps$6(__spreadValues$f({}, hookResults[r++]), {
3487
+ resultsWithNames.push(__spreadProps$7(__spreadValues$g({}, hookResults[r++]), {
3454
3488
  name: fn.name
3455
3489
  }));
3456
3490
  }
@@ -3512,25 +3546,25 @@ const finalizeNestedHookSelect = (batches, returnType, tempColumns, renames, key
3512
3546
  }
3513
3547
  };
3514
3548
 
3515
- var __defProp$e = Object.defineProperty;
3516
- var __defProps$5 = Object.defineProperties;
3517
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
3518
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3519
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3520
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3521
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3522
- var __spreadValues$e = (a, b) => {
3549
+ var __defProp$f = Object.defineProperty;
3550
+ var __defProps$6 = Object.defineProperties;
3551
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
3552
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
3553
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
3554
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
3555
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3556
+ var __spreadValues$f = (a, b) => {
3523
3557
  for (var prop in b || (b = {}))
3524
- if (__hasOwnProp$f.call(b, prop))
3525
- __defNormalProp$e(a, prop, b[prop]);
3526
- if (__getOwnPropSymbols$f)
3527
- for (var prop of __getOwnPropSymbols$f(b)) {
3528
- if (__propIsEnum$f.call(b, prop))
3529
- __defNormalProp$e(a, prop, b[prop]);
3558
+ if (__hasOwnProp$g.call(b, prop))
3559
+ __defNormalProp$f(a, prop, b[prop]);
3560
+ if (__getOwnPropSymbols$g)
3561
+ for (var prop of __getOwnPropSymbols$g(b)) {
3562
+ if (__propIsEnum$g.call(b, prop))
3563
+ __defNormalProp$f(a, prop, b[prop]);
3530
3564
  }
3531
3565
  return a;
3532
3566
  };
3533
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
3567
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
3534
3568
  class ComputedColumn {
3535
3569
  constructor(kind, deps, fn) {
3536
3570
  this.kind = kind;
@@ -3547,9 +3581,11 @@ const applyComputedColumns = (q, fn) => {
3547
3581
  for (const key in computed) {
3548
3582
  const item = computed[key];
3549
3583
  if (item instanceof ComputedColumn) {
3550
- q.q.computeds = __spreadProps$5(__spreadValues$e({}, q.q.computeds), { [key]: item });
3584
+ q.q.computeds = __spreadProps$6(__spreadValues$f({}, q.q.computeds), { [key]: item });
3551
3585
  } else {
3552
- (q.shape[key] = item.result.value || UnknownColumn.instance).data.computed = item;
3586
+ const data = (q.shape[key] = item.result.value || UnknownColumn.instance).data;
3587
+ data.computed = item;
3588
+ data.explicitSelect = true;
3553
3589
  }
3554
3590
  }
3555
3591
  q.computeAtRuntime = q.computeBatchAtRuntime = void 0;
@@ -3655,25 +3691,25 @@ const saveBatchComputed = (key, result, res, blanks) => {
3655
3691
  }
3656
3692
  };
3657
3693
 
3658
- var __defProp$d = Object.defineProperty;
3659
- var __defProps$4 = Object.defineProperties;
3660
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
3661
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
3662
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
3663
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
3664
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3665
- var __spreadValues$d = (a, b) => {
3694
+ var __defProp$e = Object.defineProperty;
3695
+ var __defProps$5 = Object.defineProperties;
3696
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
3697
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3698
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3699
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3700
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3701
+ var __spreadValues$e = (a, b) => {
3666
3702
  for (var prop in b || (b = {}))
3667
- if (__hasOwnProp$e.call(b, prop))
3668
- __defNormalProp$d(a, prop, b[prop]);
3669
- if (__getOwnPropSymbols$e)
3670
- for (var prop of __getOwnPropSymbols$e(b)) {
3671
- if (__propIsEnum$e.call(b, prop))
3672
- __defNormalProp$d(a, prop, b[prop]);
3703
+ if (__hasOwnProp$f.call(b, prop))
3704
+ __defNormalProp$e(a, prop, b[prop]);
3705
+ if (__getOwnPropSymbols$f)
3706
+ for (var prop of __getOwnPropSymbols$f(b)) {
3707
+ if (__propIsEnum$f.call(b, prop))
3708
+ __defNormalProp$e(a, prop, b[prop]);
3673
3709
  }
3674
3710
  return a;
3675
3711
  };
3676
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
3712
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
3677
3713
  const queryMethodByReturnType = {
3678
3714
  undefined: "query",
3679
3715
  all: "query",
@@ -3917,7 +3953,7 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
3917
3953
  if (hookResults.some((result2) => result2.status === "rejected")) {
3918
3954
  _afterCommitError(
3919
3955
  result,
3920
- hookResults.map((result2, i) => __spreadProps$4(__spreadValues$d({}, result2), {
3956
+ hookResults.map((result2, i) => __spreadProps$5(__spreadValues$e({}, result2), {
3921
3957
  name: afterCommitHooks[i].name
3922
3958
  })),
3923
3959
  q.q.catchAfterCommitError
@@ -3964,6 +4000,16 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
3964
4000
  error.cause = localError;
3965
4001
  }
3966
4002
  }
4003
+ const stack = localError.stack;
4004
+ if (stack) {
4005
+ const from = stack.indexOf("\n");
4006
+ if (from !== -1) {
4007
+ const to = stack.indexOf("\n", from + 1);
4008
+ if (to !== -1) {
4009
+ localError.stack = stack.slice(0, from) + stack.slice(to);
4010
+ }
4011
+ }
4012
+ }
3967
4013
  if (log && sql) {
3968
4014
  log.onError(error, sql, logData);
3969
4015
  }
@@ -4149,7 +4195,7 @@ const filterResult = (q, returnType, queryResult, result, tempColumns, hasAfterH
4149
4195
  return row;
4150
4196
  } else {
4151
4197
  if (hasAfterHook)
4152
- row = __spreadValues$d({}, row);
4198
+ row = __spreadValues$e({}, row);
4153
4199
  for (const column of tempColumns) {
4154
4200
  delete row[column];
4155
4201
  }
@@ -4192,7 +4238,7 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
4192
4238
  if (tempColumns == null ? void 0 : tempColumns.size) {
4193
4239
  if (hasAfterHook) {
4194
4240
  return result.map((data) => {
4195
- const record = __spreadValues$d({}, data);
4241
+ const record = __spreadValues$e({}, data);
4196
4242
  for (const key of tempColumns) {
4197
4243
  delete record[key];
4198
4244
  }
@@ -4209,25 +4255,25 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
4209
4255
  return result;
4210
4256
  };
4211
4257
 
4212
- var __defProp$c = Object.defineProperty;
4213
- var __defProps$3 = Object.defineProperties;
4214
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
4215
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
4216
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
4217
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
4218
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4219
- var __spreadValues$c = (a, b) => {
4258
+ var __defProp$d = Object.defineProperty;
4259
+ var __defProps$4 = Object.defineProperties;
4260
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
4261
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
4262
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
4263
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
4264
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4265
+ var __spreadValues$d = (a, b) => {
4220
4266
  for (var prop in b || (b = {}))
4221
- if (__hasOwnProp$d.call(b, prop))
4222
- __defNormalProp$c(a, prop, b[prop]);
4223
- if (__getOwnPropSymbols$d)
4224
- for (var prop of __getOwnPropSymbols$d(b)) {
4225
- if (__propIsEnum$d.call(b, prop))
4226
- __defNormalProp$c(a, prop, b[prop]);
4267
+ if (__hasOwnProp$e.call(b, prop))
4268
+ __defNormalProp$d(a, prop, b[prop]);
4269
+ if (__getOwnPropSymbols$e)
4270
+ for (var prop of __getOwnPropSymbols$e(b)) {
4271
+ if (__propIsEnum$e.call(b, prop))
4272
+ __defNormalProp$d(a, prop, b[prop]);
4227
4273
  }
4228
4274
  return a;
4229
4275
  };
4230
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
4276
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
4231
4277
  const addParserForRawExpression = (q, key, raw) => {
4232
4278
  const type = raw.result.value;
4233
4279
  if (type == null ? void 0 : type.parseFn)
@@ -4449,11 +4495,12 @@ const collectNestedSelectBatches = (batches, rows, path, last) => {
4449
4495
  };
4450
4496
  const emptyArrSQL = new RawSQL("'[]'");
4451
4497
  const processSelectArg = (q, as, arg, columnAs) => {
4452
- var _a, _b, _c, _d;
4498
+ var _a, _b;
4453
4499
  if (typeof arg === "string") {
4454
4500
  return setParserForSelectedString(q, arg, as, columnAs);
4455
4501
  }
4456
4502
  const selectAs = {};
4503
+ let aliases;
4457
4504
  for (const key in arg) {
4458
4505
  let value = arg[key];
4459
4506
  if (typeof value === "function") {
@@ -4488,17 +4535,11 @@ const processSelectArg = (q, as, arg, columnAs) => {
4488
4535
  query = value;
4489
4536
  }
4490
4537
  }
4491
- let asOverride = key;
4492
- if ((_a = value.q.joinedShapes) == null ? void 0 : _a[key]) {
4493
- let suffix = 2;
4494
- const joinOverrides = (_c = (_b = q.q).joinOverrides) != null ? _c : _b.joinOverrides = {};
4495
- while (joinOverrides[asOverride = `${key}${suffix}`]) {
4496
- suffix++;
4497
- }
4498
- joinOverrides[asOverride] = asOverride;
4499
- joinOverrides[key] = asOverride;
4500
- }
4538
+ const asOverride = (_a = value.q.aliases[key]) != null ? _a : key;
4501
4539
  value.q.joinedForSelect = asOverride;
4540
+ if (asOverride !== key) {
4541
+ aliases = __spreadProps$4(__spreadValues$d({}, q.q.aliases), { [key]: asOverride });
4542
+ }
4502
4543
  _joinLateral(
4503
4544
  q,
4504
4545
  value.q.innerJoinLateral ? "JOIN" : "LEFT JOIN",
@@ -4506,10 +4547,12 @@ const processSelectArg = (q, as, arg, columnAs) => {
4506
4547
  (q2) => q2,
4507
4548
  key
4508
4549
  );
4509
- } else if (((_d = value.q) == null ? void 0 : _d.subQuery) && value.q.expr) {
4550
+ } else if (((_b = value.q) == null ? void 0 : _b.subQuery) && value.q.expr) {
4510
4551
  value = value.q.expr;
4511
4552
  }
4512
4553
  }
4554
+ if (aliases)
4555
+ q.q.aliases = aliases;
4513
4556
  selectAs[key] = addParserForSelectItem(
4514
4557
  q,
4515
4558
  as,
@@ -4554,7 +4597,7 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
4554
4597
  for (const column2 of computed.deps) {
4555
4598
  map.set(column2, { select: `${table}.${column2}` });
4556
4599
  }
4557
- q.q.selectedComputeds = __spreadProps$3(__spreadValues$c({}, q.q.selectedComputeds), {
4600
+ q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), {
4558
4601
  [column]: computed
4559
4602
  });
4560
4603
  return;
@@ -4578,7 +4621,7 @@ const handleComputed = (q, computeds, column) => {
4578
4621
  for (const column2 of computed.deps) {
4579
4622
  map.set(column2, { select: column2 });
4580
4623
  }
4581
- q.q.selectedComputeds = __spreadProps$3(__spreadValues$c({}, q.q.selectedComputeds), { [column]: computed });
4624
+ q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), { [column]: computed });
4582
4625
  return;
4583
4626
  }
4584
4627
  return column;
@@ -4776,10 +4819,43 @@ function _queryGetOptional(self, arg) {
4776
4819
  return _get(self, "value", arg);
4777
4820
  }
4778
4821
 
4822
+ var __defProp$c = Object.defineProperty;
4823
+ var __defProps$3 = Object.defineProperties;
4824
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
4825
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
4826
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
4827
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
4828
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4829
+ var __spreadValues$c = (a, b) => {
4830
+ for (var prop in b || (b = {}))
4831
+ if (__hasOwnProp$d.call(b, prop))
4832
+ __defNormalProp$c(a, prop, b[prop]);
4833
+ if (__getOwnPropSymbols$d)
4834
+ for (var prop of __getOwnPropSymbols$d(b)) {
4835
+ if (__propIsEnum$d.call(b, prop))
4836
+ __defNormalProp$c(a, prop, b[prop]);
4837
+ }
4838
+ return a;
4839
+ };
4840
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
4779
4841
  const _queryAs = (self, as) => {
4780
- self.q.as = as;
4842
+ const { q } = self;
4843
+ q.as = as;
4844
+ q.aliases = __spreadProps$3(__spreadValues$c({}, q.aliases), {
4845
+ [as]: q.aliases ? _queryResolveAlias(q.aliases, as) : as
4846
+ });
4781
4847
  return self;
4782
4848
  };
4849
+ const _queryResolveAlias = (aliases, as) => {
4850
+ if (!aliases[as])
4851
+ return as;
4852
+ let suffix = 2;
4853
+ let privateAs;
4854
+ while (aliases[privateAs = as + suffix]) {
4855
+ suffix++;
4856
+ }
4857
+ return privateAs;
4858
+ };
4783
4859
  class AsMethods {
4784
4860
  /**
4785
4861
  * Sets table alias:
@@ -5775,7 +5851,7 @@ const processValue = (ctx, table, QueryClass, key, value, quotedAs) => {
5775
5851
  };
5776
5852
 
5777
5853
  const pushDeleteSql = (ctx, table, query, quotedAs) => {
5778
- var _a, _b, _c, _d;
5854
+ var _a, _b, _c;
5779
5855
  const from = `"${table.table}"`;
5780
5856
  ctx.sql.push(`DELETE FROM ${from}`);
5781
5857
  if (from !== quotedAs) {
@@ -5787,27 +5863,16 @@ const pushDeleteSql = (ctx, table, query, quotedAs) => {
5787
5863
  const ons = [];
5788
5864
  const joinSet = query.join.length > 1 ? /* @__PURE__ */ new Set() : null;
5789
5865
  for (const item of query.join) {
5790
- if (Array.isArray(item)) {
5791
- const q = item[1];
5792
- const { aliasValue } = ctx;
5793
- ctx.aliasValue = true;
5794
- const as = item[2];
5795
- targets.push(
5796
- `LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_b = query.joinOverrides) == null ? void 0 : _b[as]) || as}"`
5797
- );
5798
- ctx.aliasValue = aliasValue;
5799
- } else {
5800
- const join = processJoinItem(ctx, table, query, item.args, quotedAs);
5801
- const key = `${join.target}${join.on}`;
5802
- if (joinSet) {
5803
- if (joinSet.has(key))
5804
- continue;
5805
- joinSet.add(key);
5806
- }
5807
- targets.push(join.target);
5808
- if (join.on)
5809
- ons.push(join.on);
5866
+ const join = processJoinItem(ctx, table, query, item.args, quotedAs);
5867
+ const key = `${join.target}${join.on}`;
5868
+ if (joinSet) {
5869
+ if (joinSet.has(key))
5870
+ continue;
5871
+ joinSet.add(key);
5810
5872
  }
5873
+ targets.push(join.target);
5874
+ if (join.on)
5875
+ ons.push(join.on);
5811
5876
  }
5812
5877
  if (targets.length) {
5813
5878
  ctx.sql.push(`USING ${targets.join(", ")}`);
@@ -5816,7 +5881,7 @@ const pushDeleteSql = (ctx, table, query, quotedAs) => {
5816
5881
  }
5817
5882
  pushWhereStatementSql(ctx, table, query, quotedAs);
5818
5883
  if (conditions) {
5819
- if (((_c = query.and) == null ? void 0 : _c.length) || ((_d = query.or) == null ? void 0 : _d.length) || query.scopes) {
5884
+ if (((_b = query.and) == null ? void 0 : _b.length) || ((_c = query.or) == null ? void 0 : _c.length) || query.scopes) {
5820
5885
  ctx.sql.push("AND", conditions);
5821
5886
  } else {
5822
5887
  ctx.sql.push("WHERE", conditions);
@@ -6156,14 +6221,14 @@ const makeRegexToFindInSql = (value) => {
6156
6221
  return new RegExp(`${value}(?=(?:[^']*'[^']*')*[^']*$)`, "g");
6157
6222
  };
6158
6223
  const resolveSubQueryCallback = (q, cb) => {
6159
- const { subQuery, relChain, outerJoinOverrides } = q.q;
6224
+ const { subQuery, relChain, outerAliases } = q.q;
6160
6225
  q.q.subQuery = 1;
6161
6226
  q.q.relChain = void 0;
6162
- q.q.outerJoinOverrides = q.q.joinOverrides;
6227
+ q.q.outerAliases = q.q.aliases;
6163
6228
  const result = cb(q);
6164
6229
  q.q.subQuery = subQuery;
6165
6230
  q.q.relChain = relChain;
6166
- q.q.outerJoinOverrides = outerJoinOverrides;
6231
+ q.q.outerAliases = outerAliases;
6167
6232
  return result;
6168
6233
  };
6169
6234
  const joinSubQuery = (q, sub) => {
@@ -8196,6 +8261,7 @@ const _queryDelete = (query) => {
8196
8261
  q.returnType = "rowCount";
8197
8262
  }
8198
8263
  throwIfNoWhere(query, "delete");
8264
+ throwIfJoinLateral(query, "delete");
8199
8265
  q.type = "delete";
8200
8266
  return query;
8201
8267
  };
@@ -9316,7 +9382,7 @@ const pushQueryOnForOuter = (q, joinFrom, joinTo, ...on) => {
9316
9382
  ON: {
9317
9383
  joinTo: joinFrom,
9318
9384
  joinFrom: joinTo,
9319
- useOuterJoinOverrides: true,
9385
+ useOuterAliases: true,
9320
9386
  on
9321
9387
  }
9322
9388
  });
@@ -9725,7 +9791,7 @@ const resolveCallbacksInArgs = (q, args) => {
9725
9791
  qb.q = getClonedQueryData(q.q);
9726
9792
  qb.q.and = qb.q.or = qb.q.scopes = void 0;
9727
9793
  qb.q.subQuery = 1;
9728
- qb.q.outerJoinOverrides = qb.q.joinOverrides;
9794
+ qb.q.outerAliases = qb.q.aliases;
9729
9795
  args[i] = resolveSubQueryCallback(qb, arg);
9730
9796
  }
9731
9797
  }
@@ -12784,16 +12850,18 @@ class Db {
12784
12850
  applyComputedColumns(this, options.computed);
12785
12851
  if (prepareSelectAll) {
12786
12852
  const list = [];
12853
+ const keys = {};
12787
12854
  for (const key in shape) {
12788
12855
  const column = shape[key];
12789
12856
  if (!column.data.explicitSelect) {
12790
12857
  list.push(
12791
12858
  column.data.name ? `"${column.data.name}" AS "${key}"` : `"${key}"`
12792
12859
  );
12860
+ keys[key] = column;
12793
12861
  }
12794
12862
  }
12795
12863
  this.q.selectAllColumns = list;
12796
- this.q.selectAllKeys = __spreadValues({}, shape);
12864
+ this.q.selectAllKeys = keys;
12797
12865
  }
12798
12866
  if (modifyQuery) {
12799
12867
  for (const cb of modifyQuery) {
@@ -12886,6 +12954,23 @@ class Db {
12886
12954
  queryArrays(...args) {
12887
12955
  return performQuery(this, args, "arrays");
12888
12956
  }
12957
+ /**
12958
+ * In snake case mode, or when columns have custom names,
12959
+ * use this method to exchange a db column name to its runtime key.
12960
+ */
12961
+ columnNameToKey(name) {
12962
+ var _a;
12963
+ let map = this.internal.columnNameToKeyMap;
12964
+ if (!map) {
12965
+ this.internal.columnNameToKeyMap = map = /* @__PURE__ */ new Map();
12966
+ const { shape } = this;
12967
+ for (const key in this.shape) {
12968
+ const column = shape[key];
12969
+ map.set((_a = column.data.name) != null ? _a : key, key);
12970
+ }
12971
+ }
12972
+ return map.get(name);
12973
+ }
12889
12974
  }
12890
12975
  const performQuery = async (q, args, method) => {
12891
12976
  var _a;
@@ -13145,5 +13230,5 @@ function copyTableData(query, arg) {
13145
13230
  return q;
13146
13231
  }
13147
13232
 
13148
- export { Adapter, AfterCommitError, AggregateMethods, ArrayColumn, AsMethods, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ColumnRefExpression, ColumnType, ComputedColumn, Create, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DecimalColumn, Delete, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, FnExpression, For, FromMethods, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnMethods, Operators, OrExpression, OrchidOrmError, OrchidOrmInternalError, PathColumn, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryBase, QueryError, QueryGet, QueryHooks, QueryLog, QueryMethods, QueryUpsertOrCreate, RawSQL, RealColumn, RefExpression, SearchMethods, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, SqlMethod, StringColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimestampColumn, TimestampTZColumn, Transaction, TransactionAdapter, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, UnknownColumn, Update, VarCharColumn, VirtualColumn, Where, WithMethods, XMLColumn, _afterCommitError, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, checkIfASimpleQuery, cloneQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql$1 as commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnInfo, getColumnTypes, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, instantiateColumn, isDefaultTimeStamp, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, makeSQL, parseRecord, parseTableData, parseTableDataInput, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArray, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValue, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallback, rollbackSql$1 as rollbackSql, saveSearchAlias, setParserForSelectedString, setQueryObjectValue, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfNoWhere, toSQL, toSQLCacheKey };
13233
+ export { Adapter, AfterCommitError, AggregateMethods, ArrayColumn, AsMethods, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ColumnRefExpression, ColumnType, ComputedColumn, Create, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DecimalColumn, Delete, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, FnExpression, For, FromMethods, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnMethods, Operators, OrExpression, OrchidOrmError, OrchidOrmInternalError, PathColumn, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryBase, QueryError, QueryGet, QueryHooks, QueryLog, QueryMethods, QueryUpsertOrCreate, RawSQL, RealColumn, RefExpression, SearchMethods, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, SqlMethod, StringColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimestampColumn, TimestampTZColumn, Transaction, TransactionAdapter, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, UnknownColumn, Update, VarCharColumn, VirtualColumn, Where, WithMethods, XMLColumn, _afterCommitError, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryResolveAlias, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, checkIfASimpleQuery, cloneQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql$1 as commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnInfo, getColumnTypes, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, instantiateColumn, isDefaultTimeStamp, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, makeSQL, parseRecord, parseTableData, parseTableDataInput, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArray, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValue, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallback, rollbackSql$1 as rollbackSql, saveSearchAlias, setParserForSelectedString, setQueryObjectValue, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL, toSQLCacheKey };
13149
13234
  //# sourceMappingURL=index.mjs.map