pqb 0.40.11 → 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.d.ts +5 -5
- package/dist/index.js +246 -214
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -215
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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$
|
|
121
|
-
var __defProps$
|
|
122
|
-
var __getOwnPropDescs$
|
|
123
|
-
var __getOwnPropSymbols$
|
|
124
|
-
var __hasOwnProp$
|
|
125
|
-
var __propIsEnum$
|
|
126
|
-
var __defNormalProp$
|
|
127
|
-
var __spreadValues$
|
|
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$
|
|
130
|
-
__defNormalProp$
|
|
131
|
-
if (__getOwnPropSymbols$
|
|
132
|
-
for (var prop of __getOwnPropSymbols$
|
|
133
|
-
if (__propIsEnum$
|
|
134
|
-
__defNormalProp$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
387
|
-
var __defProps$
|
|
388
|
-
var __getOwnPropDescs$
|
|
389
|
-
var __getOwnPropSymbols$
|
|
390
|
-
var __hasOwnProp$
|
|
391
|
-
var __propIsEnum$
|
|
392
|
-
var __defNormalProp$
|
|
393
|
-
var __spreadValues$
|
|
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$
|
|
396
|
-
__defNormalProp$
|
|
397
|
-
if (__getOwnPropSymbols$
|
|
398
|
-
for (var prop of __getOwnPropSymbols$
|
|
399
|
-
if (__propIsEnum$
|
|
400
|
-
__defNormalProp$
|
|
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$
|
|
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$
|
|
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$
|
|
860
|
-
var __defProps$
|
|
861
|
-
var __getOwnPropDescs$
|
|
862
|
-
var __getOwnPropSymbols$
|
|
863
|
-
var __hasOwnProp$
|
|
864
|
-
var __propIsEnum$
|
|
865
|
-
var __defNormalProp$
|
|
866
|
-
var __spreadValues$
|
|
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$
|
|
869
|
-
__defNormalProp$
|
|
870
|
-
if (__getOwnPropSymbols$
|
|
871
|
-
for (var prop of __getOwnPropSymbols$
|
|
872
|
-
if (__propIsEnum$
|
|
873
|
-
__defNormalProp$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
1081
|
-
var __defProps$
|
|
1082
|
-
var __getOwnPropDescs$
|
|
1083
|
-
var __getOwnPropSymbols$
|
|
1084
|
-
var __hasOwnProp$
|
|
1085
|
-
var __propIsEnum$
|
|
1086
|
-
var __defNormalProp$
|
|
1087
|
-
var __spreadValues$
|
|
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$
|
|
1090
|
-
__defNormalProp$
|
|
1091
|
-
if (__getOwnPropSymbols$
|
|
1092
|
-
for (var prop of __getOwnPropSymbols$
|
|
1093
|
-
if (__propIsEnum$
|
|
1094
|
-
__defNormalProp$
|
|
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$
|
|
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$
|
|
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$
|
|
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.
|
|
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) {
|
|
@@ -1796,7 +1796,7 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
1796
1796
|
}
|
|
1797
1797
|
return column;
|
|
1798
1798
|
}
|
|
1799
|
-
const tableName = ((_b = data.
|
|
1799
|
+
const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
|
|
1800
1800
|
const quoted = `"${table}"`;
|
|
1801
1801
|
const col = quoted === quotedAs ? data.shape[key] : (_c = data.joinedShapes) == null ? void 0 : _c[tableName][key];
|
|
1802
1802
|
if (col) {
|
|
@@ -2137,9 +2137,9 @@ const processWhere = (ands, ctx, table, query, data, quotedAs) => {
|
|
|
2137
2137
|
const item = value;
|
|
2138
2138
|
const joinAs = `"${getJoinItemSource(item.joinFrom)}"`;
|
|
2139
2139
|
const { on } = item;
|
|
2140
|
-
const q = item.
|
|
2140
|
+
const q = item.useOuterAliases ? {
|
|
2141
2141
|
joinedShapes: query.joinedShapes,
|
|
2142
|
-
|
|
2142
|
+
aliases: query.outerAliases,
|
|
2143
2143
|
shape: query.shape
|
|
2144
2144
|
} : query;
|
|
2145
2145
|
ands.push(
|
|
@@ -2267,25 +2267,25 @@ const pushIn = (ctx, query, ands, quotedAs, arg) => {
|
|
|
2267
2267
|
ands.push(`${multiple ? `(${columnsSql})` : columnsSql} IN ${value}`);
|
|
2268
2268
|
};
|
|
2269
2269
|
|
|
2270
|
-
var __defProp$
|
|
2271
|
-
var __defProps$
|
|
2272
|
-
var __getOwnPropDescs$
|
|
2273
|
-
var __getOwnPropSymbols$
|
|
2274
|
-
var __hasOwnProp$
|
|
2275
|
-
var __propIsEnum$
|
|
2276
|
-
var __defNormalProp$
|
|
2277
|
-
var __spreadValues$
|
|
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) => {
|
|
2278
2278
|
for (var prop in b || (b = {}))
|
|
2279
|
-
if (__hasOwnProp$
|
|
2280
|
-
__defNormalProp$
|
|
2281
|
-
if (__getOwnPropSymbols$
|
|
2282
|
-
for (var prop of __getOwnPropSymbols$
|
|
2283
|
-
if (__propIsEnum$
|
|
2284
|
-
__defNormalProp$
|
|
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]);
|
|
2285
2285
|
}
|
|
2286
2286
|
return a;
|
|
2287
2287
|
};
|
|
2288
|
-
var __spreadProps$
|
|
2288
|
+
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
2289
2289
|
const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
2290
2290
|
let target;
|
|
2291
2291
|
let on;
|
|
@@ -2347,8 +2347,8 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
|
2347
2347
|
const whereSql = whereToSql(
|
|
2348
2348
|
ctx,
|
|
2349
2349
|
q,
|
|
2350
|
-
__spreadProps$
|
|
2351
|
-
joinedShapes: __spreadProps$
|
|
2350
|
+
__spreadProps$a(__spreadValues$j({}, q.q), {
|
|
2351
|
+
joinedShapes: __spreadProps$a(__spreadValues$j(__spreadValues$j({}, query.joinedShapes), q.q.joinedShapes), {
|
|
2352
2352
|
[table.q.as || table.table]: table.q.shape
|
|
2353
2353
|
})
|
|
2354
2354
|
}),
|
|
@@ -2451,7 +2451,7 @@ const pushJoinSql = (ctx, table, query, quotedAs) => {
|
|
|
2451
2451
|
const { aliasValue } = ctx;
|
|
2452
2452
|
ctx.aliasValue = true;
|
|
2453
2453
|
const as = item[2];
|
|
2454
|
-
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.
|
|
2454
|
+
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.aliases) == null ? void 0 : _a[as]) || as}" ON true`;
|
|
2455
2455
|
ctx.aliasValue = aliasValue;
|
|
2456
2456
|
} else {
|
|
2457
2457
|
const { target, on = "true" } = processJoinItem(
|
|
@@ -2480,7 +2480,8 @@ const skipQueryKeysForSubQuery = {
|
|
|
2480
2480
|
or: true,
|
|
2481
2481
|
returnType: true,
|
|
2482
2482
|
joinedShapes: true,
|
|
2483
|
-
returnsOne: true
|
|
2483
|
+
returnsOne: true,
|
|
2484
|
+
aliases: true
|
|
2484
2485
|
};
|
|
2485
2486
|
const getIsJoinSubQuery = (query) => {
|
|
2486
2487
|
const {
|
|
@@ -2495,25 +2496,25 @@ const getIsJoinSubQuery = (query) => {
|
|
|
2495
2496
|
return false;
|
|
2496
2497
|
};
|
|
2497
2498
|
|
|
2498
|
-
var __defProp$
|
|
2499
|
-
var __defProps$
|
|
2500
|
-
var __getOwnPropDescs$
|
|
2501
|
-
var __getOwnPropSymbols$
|
|
2502
|
-
var __hasOwnProp$
|
|
2503
|
-
var __propIsEnum$
|
|
2504
|
-
var __defNormalProp$
|
|
2505
|
-
var __spreadValues$
|
|
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) => {
|
|
2506
2507
|
for (var prop in b || (b = {}))
|
|
2507
|
-
if (__hasOwnProp$
|
|
2508
|
-
__defNormalProp$
|
|
2509
|
-
if (__getOwnPropSymbols$
|
|
2510
|
-
for (var prop of __getOwnPropSymbols$
|
|
2511
|
-
if (__propIsEnum$
|
|
2512
|
-
__defNormalProp$
|
|
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]);
|
|
2513
2514
|
}
|
|
2514
2515
|
return a;
|
|
2515
2516
|
};
|
|
2516
|
-
var __spreadProps$
|
|
2517
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
2517
2518
|
const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
2518
2519
|
var _a;
|
|
2519
2520
|
if (typeof first === "string") {
|
|
@@ -2550,13 +2551,13 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2550
2551
|
logger: joinToQ.logger
|
|
2551
2552
|
};
|
|
2552
2553
|
j.baseQuery = j;
|
|
2553
|
-
const joinedShapes = __spreadProps$
|
|
2554
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinToQ.joinedShapes), {
|
|
2554
2555
|
[joinToQ.as || joinTo.table]: joinTo.shape
|
|
2555
2556
|
});
|
|
2556
2557
|
const r = args[0](
|
|
2557
2558
|
makeJoinQueryBuilder(
|
|
2558
2559
|
j,
|
|
2559
|
-
j.q.joinedShapes ? __spreadValues$
|
|
2560
|
+
j.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2560
2561
|
joinTo
|
|
2561
2562
|
)
|
|
2562
2563
|
);
|
|
@@ -2583,16 +2584,16 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2583
2584
|
pushQueryArray(q, "or", query.or);
|
|
2584
2585
|
}
|
|
2585
2586
|
if (query.scopes) {
|
|
2586
|
-
q.q.scopes = __spreadValues$
|
|
2587
|
+
q.q.scopes = __spreadValues$i(__spreadValues$i({}, q.q.scopes), query.scopes);
|
|
2587
2588
|
}
|
|
2588
2589
|
}
|
|
2589
|
-
const joinedShapes = __spreadProps$
|
|
2590
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinTo.q.joinedShapes), {
|
|
2590
2591
|
[joinTo.q.as || joinTo.table]: joinTo.shape
|
|
2591
2592
|
});
|
|
2592
2593
|
const r = args0(
|
|
2593
2594
|
makeJoinQueryBuilder(
|
|
2594
2595
|
q,
|
|
2595
|
-
q.q.joinedShapes ? __spreadValues$
|
|
2596
|
+
q.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2596
2597
|
joinTo
|
|
2597
2598
|
)
|
|
2598
2599
|
);
|
|
@@ -2647,25 +2648,25 @@ const _queryNone = (q) => {
|
|
|
2647
2648
|
};
|
|
2648
2649
|
const isQueryNone = (q) => q.then === noneMethods.then;
|
|
2649
2650
|
|
|
2650
|
-
var __defProp$
|
|
2651
|
-
var __defProps$
|
|
2652
|
-
var __getOwnPropDescs$
|
|
2653
|
-
var __getOwnPropSymbols$
|
|
2654
|
-
var __hasOwnProp$
|
|
2655
|
-
var __propIsEnum$
|
|
2656
|
-
var __defNormalProp$
|
|
2657
|
-
var __spreadValues$
|
|
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) => {
|
|
2658
2659
|
for (var prop in b || (b = {}))
|
|
2659
|
-
if (__hasOwnProp$
|
|
2660
|
-
__defNormalProp$
|
|
2661
|
-
if (__getOwnPropSymbols$
|
|
2662
|
-
for (var prop of __getOwnPropSymbols$
|
|
2663
|
-
if (__propIsEnum$
|
|
2664
|
-
__defNormalProp$
|
|
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]);
|
|
2665
2666
|
}
|
|
2666
2667
|
return a;
|
|
2667
2668
|
};
|
|
2668
|
-
var __spreadProps$
|
|
2669
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
2669
2670
|
const _join = (query, require2, type, first, args) => {
|
|
2670
2671
|
var _a, _b, _c, _d;
|
|
2671
2672
|
let joinKey;
|
|
@@ -2707,7 +2708,7 @@ const _join = (query, require2, type, first, args) => {
|
|
|
2707
2708
|
computeds = w == null ? void 0 : w.computeds;
|
|
2708
2709
|
if (shape) {
|
|
2709
2710
|
if (!require2)
|
|
2710
|
-
shape = __spreadValues$
|
|
2711
|
+
shape = __spreadValues$h({}, shape);
|
|
2711
2712
|
parsers = {};
|
|
2712
2713
|
for (const key in shape) {
|
|
2713
2714
|
const parser = shape[key].parseFn;
|
|
@@ -2811,7 +2812,7 @@ const _joinLateral = (self, type, arg, cb, as) => {
|
|
|
2811
2812
|
t.table = arg;
|
|
2812
2813
|
t.shape = w.shape;
|
|
2813
2814
|
t.computeds = w.computeds;
|
|
2814
|
-
t.q = __spreadProps$
|
|
2815
|
+
t.q = __spreadProps$8(__spreadValues$h({}, t.q), {
|
|
2815
2816
|
shape: w.shape
|
|
2816
2817
|
});
|
|
2817
2818
|
t.baseQuery = t;
|
|
@@ -3300,25 +3301,25 @@ class QueryLog {
|
|
|
3300
3301
|
}
|
|
3301
3302
|
}
|
|
3302
3303
|
|
|
3303
|
-
var __defProp$
|
|
3304
|
-
var __defProps$
|
|
3305
|
-
var __getOwnPropDescs$
|
|
3306
|
-
var __getOwnPropSymbols$
|
|
3307
|
-
var __hasOwnProp$
|
|
3308
|
-
var __propIsEnum$
|
|
3309
|
-
var __defNormalProp$
|
|
3310
|
-
var __spreadValues$
|
|
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) => {
|
|
3311
3312
|
for (var prop in b || (b = {}))
|
|
3312
|
-
if (__hasOwnProp$
|
|
3313
|
-
__defNormalProp$
|
|
3314
|
-
if (__getOwnPropSymbols$
|
|
3315
|
-
for (var prop of __getOwnPropSymbols$
|
|
3316
|
-
if (__propIsEnum$
|
|
3317
|
-
__defNormalProp$
|
|
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]);
|
|
3318
3319
|
}
|
|
3319
3320
|
return a;
|
|
3320
3321
|
};
|
|
3321
|
-
var __spreadProps$
|
|
3322
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
3322
3323
|
const commitSql$1 = {
|
|
3323
3324
|
text: "COMMIT"
|
|
3324
3325
|
};
|
|
@@ -3483,7 +3484,7 @@ const runAfterCommit = async (afterCommit, result) => {
|
|
|
3483
3484
|
let r = 0;
|
|
3484
3485
|
for (let i = 0, len = afterCommit.length; i < len; i += 3) {
|
|
3485
3486
|
for (const fn of afterCommit[i + 2]) {
|
|
3486
|
-
resultsWithNames.push(__spreadProps$
|
|
3487
|
+
resultsWithNames.push(__spreadProps$7(__spreadValues$g({}, hookResults[r++]), {
|
|
3487
3488
|
name: fn.name
|
|
3488
3489
|
}));
|
|
3489
3490
|
}
|
|
@@ -3545,25 +3546,25 @@ const finalizeNestedHookSelect = (batches, returnType, tempColumns, renames, key
|
|
|
3545
3546
|
}
|
|
3546
3547
|
};
|
|
3547
3548
|
|
|
3548
|
-
var __defProp$
|
|
3549
|
-
var __defProps$
|
|
3550
|
-
var __getOwnPropDescs$
|
|
3551
|
-
var __getOwnPropSymbols$
|
|
3552
|
-
var __hasOwnProp$
|
|
3553
|
-
var __propIsEnum$
|
|
3554
|
-
var __defNormalProp$
|
|
3555
|
-
var __spreadValues$
|
|
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) => {
|
|
3556
3557
|
for (var prop in b || (b = {}))
|
|
3557
|
-
if (__hasOwnProp$
|
|
3558
|
-
__defNormalProp$
|
|
3559
|
-
if (__getOwnPropSymbols$
|
|
3560
|
-
for (var prop of __getOwnPropSymbols$
|
|
3561
|
-
if (__propIsEnum$
|
|
3562
|
-
__defNormalProp$
|
|
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]);
|
|
3563
3564
|
}
|
|
3564
3565
|
return a;
|
|
3565
3566
|
};
|
|
3566
|
-
var __spreadProps$
|
|
3567
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
3567
3568
|
class ComputedColumn {
|
|
3568
3569
|
constructor(kind, deps, fn) {
|
|
3569
3570
|
this.kind = kind;
|
|
@@ -3580,7 +3581,7 @@ const applyComputedColumns = (q, fn) => {
|
|
|
3580
3581
|
for (const key in computed) {
|
|
3581
3582
|
const item = computed[key];
|
|
3582
3583
|
if (item instanceof ComputedColumn) {
|
|
3583
|
-
q.q.computeds = __spreadProps$
|
|
3584
|
+
q.q.computeds = __spreadProps$6(__spreadValues$f({}, q.q.computeds), { [key]: item });
|
|
3584
3585
|
} else {
|
|
3585
3586
|
const data = (q.shape[key] = item.result.value || UnknownColumn.instance).data;
|
|
3586
3587
|
data.computed = item;
|
|
@@ -3690,25 +3691,25 @@ const saveBatchComputed = (key, result, res, blanks) => {
|
|
|
3690
3691
|
}
|
|
3691
3692
|
};
|
|
3692
3693
|
|
|
3693
|
-
var __defProp$
|
|
3694
|
-
var __defProps$
|
|
3695
|
-
var __getOwnPropDescs$
|
|
3696
|
-
var __getOwnPropSymbols$
|
|
3697
|
-
var __hasOwnProp$
|
|
3698
|
-
var __propIsEnum$
|
|
3699
|
-
var __defNormalProp$
|
|
3700
|
-
var __spreadValues$
|
|
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) => {
|
|
3701
3702
|
for (var prop in b || (b = {}))
|
|
3702
|
-
if (__hasOwnProp$
|
|
3703
|
-
__defNormalProp$
|
|
3704
|
-
if (__getOwnPropSymbols$
|
|
3705
|
-
for (var prop of __getOwnPropSymbols$
|
|
3706
|
-
if (__propIsEnum$
|
|
3707
|
-
__defNormalProp$
|
|
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]);
|
|
3708
3709
|
}
|
|
3709
3710
|
return a;
|
|
3710
3711
|
};
|
|
3711
|
-
var __spreadProps$
|
|
3712
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
3712
3713
|
const queryMethodByReturnType = {
|
|
3713
3714
|
undefined: "query",
|
|
3714
3715
|
all: "query",
|
|
@@ -3952,7 +3953,7 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
|
|
|
3952
3953
|
if (hookResults.some((result2) => result2.status === "rejected")) {
|
|
3953
3954
|
_afterCommitError(
|
|
3954
3955
|
result,
|
|
3955
|
-
hookResults.map((result2, i) => __spreadProps$
|
|
3956
|
+
hookResults.map((result2, i) => __spreadProps$5(__spreadValues$e({}, result2), {
|
|
3956
3957
|
name: afterCommitHooks[i].name
|
|
3957
3958
|
})),
|
|
3958
3959
|
q.q.catchAfterCommitError
|
|
@@ -4194,7 +4195,7 @@ const filterResult = (q, returnType, queryResult, result, tempColumns, hasAfterH
|
|
|
4194
4195
|
return row;
|
|
4195
4196
|
} else {
|
|
4196
4197
|
if (hasAfterHook)
|
|
4197
|
-
row = __spreadValues$
|
|
4198
|
+
row = __spreadValues$e({}, row);
|
|
4198
4199
|
for (const column of tempColumns) {
|
|
4199
4200
|
delete row[column];
|
|
4200
4201
|
}
|
|
@@ -4237,7 +4238,7 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4237
4238
|
if (tempColumns == null ? void 0 : tempColumns.size) {
|
|
4238
4239
|
if (hasAfterHook) {
|
|
4239
4240
|
return result.map((data) => {
|
|
4240
|
-
const record = __spreadValues$
|
|
4241
|
+
const record = __spreadValues$e({}, data);
|
|
4241
4242
|
for (const key of tempColumns) {
|
|
4242
4243
|
delete record[key];
|
|
4243
4244
|
}
|
|
@@ -4254,25 +4255,25 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4254
4255
|
return result;
|
|
4255
4256
|
};
|
|
4256
4257
|
|
|
4257
|
-
var __defProp$
|
|
4258
|
-
var __defProps$
|
|
4259
|
-
var __getOwnPropDescs$
|
|
4260
|
-
var __getOwnPropSymbols$
|
|
4261
|
-
var __hasOwnProp$
|
|
4262
|
-
var __propIsEnum$
|
|
4263
|
-
var __defNormalProp$
|
|
4264
|
-
var __spreadValues$
|
|
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) => {
|
|
4265
4266
|
for (var prop in b || (b = {}))
|
|
4266
|
-
if (__hasOwnProp$
|
|
4267
|
-
__defNormalProp$
|
|
4268
|
-
if (__getOwnPropSymbols$
|
|
4269
|
-
for (var prop of __getOwnPropSymbols$
|
|
4270
|
-
if (__propIsEnum$
|
|
4271
|
-
__defNormalProp$
|
|
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]);
|
|
4272
4273
|
}
|
|
4273
4274
|
return a;
|
|
4274
4275
|
};
|
|
4275
|
-
var __spreadProps$
|
|
4276
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
4276
4277
|
const addParserForRawExpression = (q, key, raw) => {
|
|
4277
4278
|
const type = raw.result.value;
|
|
4278
4279
|
if (type == null ? void 0 : type.parseFn)
|
|
@@ -4494,11 +4495,12 @@ const collectNestedSelectBatches = (batches, rows, path, last) => {
|
|
|
4494
4495
|
};
|
|
4495
4496
|
const emptyArrSQL = new RawSQL("'[]'");
|
|
4496
4497
|
const processSelectArg = (q, as, arg, columnAs) => {
|
|
4497
|
-
var _a, _b
|
|
4498
|
+
var _a, _b;
|
|
4498
4499
|
if (typeof arg === "string") {
|
|
4499
4500
|
return setParserForSelectedString(q, arg, as, columnAs);
|
|
4500
4501
|
}
|
|
4501
4502
|
const selectAs = {};
|
|
4503
|
+
let aliases;
|
|
4502
4504
|
for (const key in arg) {
|
|
4503
4505
|
let value = arg[key];
|
|
4504
4506
|
if (typeof value === "function") {
|
|
@@ -4533,17 +4535,11 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4533
4535
|
query = value;
|
|
4534
4536
|
}
|
|
4535
4537
|
}
|
|
4536
|
-
|
|
4537
|
-
if ((_a = value.q.joinedShapes) == null ? void 0 : _a[key]) {
|
|
4538
|
-
let suffix = 2;
|
|
4539
|
-
const joinOverrides = (_c = (_b = q.q).joinOverrides) != null ? _c : _b.joinOverrides = {};
|
|
4540
|
-
while (joinOverrides[asOverride = `${key}${suffix}`]) {
|
|
4541
|
-
suffix++;
|
|
4542
|
-
}
|
|
4543
|
-
joinOverrides[asOverride] = asOverride;
|
|
4544
|
-
joinOverrides[key] = asOverride;
|
|
4545
|
-
}
|
|
4538
|
+
const asOverride = (_a = value.q.aliases[key]) != null ? _a : key;
|
|
4546
4539
|
value.q.joinedForSelect = asOverride;
|
|
4540
|
+
if (asOverride !== key) {
|
|
4541
|
+
aliases = __spreadProps$4(__spreadValues$d({}, q.q.aliases), { [key]: asOverride });
|
|
4542
|
+
}
|
|
4547
4543
|
_joinLateral(
|
|
4548
4544
|
q,
|
|
4549
4545
|
value.q.innerJoinLateral ? "JOIN" : "LEFT JOIN",
|
|
@@ -4551,10 +4547,12 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4551
4547
|
(q2) => q2,
|
|
4552
4548
|
key
|
|
4553
4549
|
);
|
|
4554
|
-
} else if (((
|
|
4550
|
+
} else if (((_b = value.q) == null ? void 0 : _b.subQuery) && value.q.expr) {
|
|
4555
4551
|
value = value.q.expr;
|
|
4556
4552
|
}
|
|
4557
4553
|
}
|
|
4554
|
+
if (aliases)
|
|
4555
|
+
q.q.aliases = aliases;
|
|
4558
4556
|
selectAs[key] = addParserForSelectItem(
|
|
4559
4557
|
q,
|
|
4560
4558
|
as,
|
|
@@ -4599,7 +4597,7 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
|
|
|
4599
4597
|
for (const column2 of computed.deps) {
|
|
4600
4598
|
map.set(column2, { select: `${table}.${column2}` });
|
|
4601
4599
|
}
|
|
4602
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4600
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), {
|
|
4603
4601
|
[column]: computed
|
|
4604
4602
|
});
|
|
4605
4603
|
return;
|
|
@@ -4623,7 +4621,7 @@ const handleComputed = (q, computeds, column) => {
|
|
|
4623
4621
|
for (const column2 of computed.deps) {
|
|
4624
4622
|
map.set(column2, { select: column2 });
|
|
4625
4623
|
}
|
|
4626
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4624
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), { [column]: computed });
|
|
4627
4625
|
return;
|
|
4628
4626
|
}
|
|
4629
4627
|
return column;
|
|
@@ -4821,10 +4819,43 @@ function _queryGetOptional(self, arg) {
|
|
|
4821
4819
|
return _get(self, "value", arg);
|
|
4822
4820
|
}
|
|
4823
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));
|
|
4824
4841
|
const _queryAs = (self, as) => {
|
|
4825
|
-
|
|
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
|
+
});
|
|
4826
4847
|
return self;
|
|
4827
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
|
+
};
|
|
4828
4859
|
class AsMethods {
|
|
4829
4860
|
/**
|
|
4830
4861
|
* Sets table alias:
|
|
@@ -6190,14 +6221,14 @@ const makeRegexToFindInSql = (value) => {
|
|
|
6190
6221
|
return new RegExp(`${value}(?=(?:[^']*'[^']*')*[^']*$)`, "g");
|
|
6191
6222
|
};
|
|
6192
6223
|
const resolveSubQueryCallback = (q, cb) => {
|
|
6193
|
-
const { subQuery, relChain,
|
|
6224
|
+
const { subQuery, relChain, outerAliases } = q.q;
|
|
6194
6225
|
q.q.subQuery = 1;
|
|
6195
6226
|
q.q.relChain = void 0;
|
|
6196
|
-
q.q.
|
|
6227
|
+
q.q.outerAliases = q.q.aliases;
|
|
6197
6228
|
const result = cb(q);
|
|
6198
6229
|
q.q.subQuery = subQuery;
|
|
6199
6230
|
q.q.relChain = relChain;
|
|
6200
|
-
q.q.
|
|
6231
|
+
q.q.outerAliases = outerAliases;
|
|
6201
6232
|
return result;
|
|
6202
6233
|
};
|
|
6203
6234
|
const joinSubQuery = (q, sub) => {
|
|
@@ -9351,7 +9382,7 @@ const pushQueryOnForOuter = (q, joinFrom, joinTo, ...on) => {
|
|
|
9351
9382
|
ON: {
|
|
9352
9383
|
joinTo: joinFrom,
|
|
9353
9384
|
joinFrom: joinTo,
|
|
9354
|
-
|
|
9385
|
+
useOuterAliases: true,
|
|
9355
9386
|
on
|
|
9356
9387
|
}
|
|
9357
9388
|
});
|
|
@@ -9760,7 +9791,7 @@ const resolveCallbacksInArgs = (q, args) => {
|
|
|
9760
9791
|
qb.q = getClonedQueryData(q.q);
|
|
9761
9792
|
qb.q.and = qb.q.or = qb.q.scopes = void 0;
|
|
9762
9793
|
qb.q.subQuery = 1;
|
|
9763
|
-
qb.q.
|
|
9794
|
+
qb.q.outerAliases = qb.q.aliases;
|
|
9764
9795
|
args[i] = resolveSubQueryCallback(qb, arg);
|
|
9765
9796
|
}
|
|
9766
9797
|
}
|
|
@@ -13199,5 +13230,5 @@ function copyTableData(query, arg) {
|
|
|
13199
13230
|
return q;
|
|
13200
13231
|
}
|
|
13201
13232
|
|
|
13202
|
-
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, throwIfJoinLateral, 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 };
|
|
13203
13234
|
//# sourceMappingURL=index.mjs.map
|