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.js
CHANGED
|
@@ -119,25 +119,25 @@ const sqlFn = (...args) => {
|
|
|
119
119
|
return (...args2) => new RawSQL(args2, arg);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
var __defProp$
|
|
123
|
-
var __defProps$
|
|
124
|
-
var __getOwnPropDescs$
|
|
125
|
-
var __getOwnPropSymbols$
|
|
126
|
-
var __hasOwnProp$
|
|
127
|
-
var __propIsEnum$
|
|
128
|
-
var __defNormalProp$
|
|
129
|
-
var __spreadValues$
|
|
122
|
+
var __defProp$n = Object.defineProperty;
|
|
123
|
+
var __defProps$e = Object.defineProperties;
|
|
124
|
+
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
125
|
+
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
126
|
+
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
127
|
+
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
128
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
129
|
+
var __spreadValues$n = (a, b) => {
|
|
130
130
|
for (var prop in b || (b = {}))
|
|
131
|
-
if (__hasOwnProp$
|
|
132
|
-
__defNormalProp$
|
|
133
|
-
if (__getOwnPropSymbols$
|
|
134
|
-
for (var prop of __getOwnPropSymbols$
|
|
135
|
-
if (__propIsEnum$
|
|
136
|
-
__defNormalProp$
|
|
131
|
+
if (__hasOwnProp$o.call(b, prop))
|
|
132
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
133
|
+
if (__getOwnPropSymbols$o)
|
|
134
|
+
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
135
|
+
if (__propIsEnum$o.call(b, prop))
|
|
136
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
137
137
|
}
|
|
138
138
|
return a;
|
|
139
139
|
};
|
|
140
|
-
var __spreadProps$
|
|
140
|
+
var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
141
141
|
class ColumnType extends orchidCore.ColumnTypeBase {
|
|
142
142
|
/**
|
|
143
143
|
* Mark the column as a primary key.
|
|
@@ -336,13 +336,13 @@ class ColumnType extends orchidCore.ColumnTypeBase {
|
|
|
336
336
|
*/
|
|
337
337
|
searchIndex(...args) {
|
|
338
338
|
return orchidCore.pushColumnData(this, "indexes", {
|
|
339
|
-
options: __spreadValues$
|
|
339
|
+
options: __spreadValues$n(__spreadValues$n({}, typeof args[0] === "string" ? args[1] : args[0]), this.dataType === "tsvector" ? { using: "GIN" } : { tsVector: true }),
|
|
340
340
|
name: typeof args[0] === "string" ? args[0] : void 0
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
unique(...args) {
|
|
344
344
|
return orchidCore.pushColumnData(this, "indexes", {
|
|
345
|
-
options: __spreadProps$
|
|
345
|
+
options: __spreadProps$e(__spreadValues$n({}, typeof args[0] === "string" ? args[1] : args[0]), {
|
|
346
346
|
unique: true
|
|
347
347
|
}),
|
|
348
348
|
name: typeof args[0] === "string" ? args[0] : void 0
|
|
@@ -385,25 +385,25 @@ class ColumnType extends orchidCore.ColumnTypeBase {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
var __defProp$
|
|
389
|
-
var __defProps$
|
|
390
|
-
var __getOwnPropDescs$
|
|
391
|
-
var __getOwnPropSymbols$
|
|
392
|
-
var __hasOwnProp$
|
|
393
|
-
var __propIsEnum$
|
|
394
|
-
var __defNormalProp$
|
|
395
|
-
var __spreadValues$
|
|
388
|
+
var __defProp$m = Object.defineProperty;
|
|
389
|
+
var __defProps$d = Object.defineProperties;
|
|
390
|
+
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
391
|
+
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
392
|
+
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
393
|
+
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
394
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
395
|
+
var __spreadValues$m = (a, b) => {
|
|
396
396
|
for (var prop in b || (b = {}))
|
|
397
|
-
if (__hasOwnProp$
|
|
398
|
-
__defNormalProp$
|
|
399
|
-
if (__getOwnPropSymbols$
|
|
400
|
-
for (var prop of __getOwnPropSymbols$
|
|
401
|
-
if (__propIsEnum$
|
|
402
|
-
__defNormalProp$
|
|
397
|
+
if (__hasOwnProp$n.call(b, prop))
|
|
398
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
399
|
+
if (__getOwnPropSymbols$n)
|
|
400
|
+
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
401
|
+
if (__propIsEnum$n.call(b, prop))
|
|
402
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
403
403
|
}
|
|
404
404
|
return a;
|
|
405
405
|
};
|
|
406
|
-
var __spreadProps$
|
|
406
|
+
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
407
407
|
const knownDefaults = {
|
|
408
408
|
current_timestamp: "now()",
|
|
409
409
|
"transaction_timestamp()": "now()"
|
|
@@ -419,7 +419,7 @@ const simplifyColumnDefault = (value) => {
|
|
|
419
419
|
const instantiateColumn = (typeFn, params) => {
|
|
420
420
|
const column = typeFn();
|
|
421
421
|
const { dateTimePrecision } = params;
|
|
422
|
-
Object.assign(column.data, __spreadProps$
|
|
422
|
+
Object.assign(column.data, __spreadProps$d(__spreadValues$m({}, params), {
|
|
423
423
|
dateTimePrecision: (
|
|
424
424
|
// 0 is default for date, 6 is default for timestamp
|
|
425
425
|
dateTimePrecision && dateTimePrecision !== 6 ? dateTimePrecision : void 0
|
|
@@ -858,25 +858,25 @@ const getSqlText = (sql) => {
|
|
|
858
858
|
throw new Error(`Batch SQL is not supported in this query`);
|
|
859
859
|
};
|
|
860
860
|
|
|
861
|
-
var __defProp$
|
|
862
|
-
var __defProps$
|
|
863
|
-
var __getOwnPropDescs$
|
|
864
|
-
var __getOwnPropSymbols$
|
|
865
|
-
var __hasOwnProp$
|
|
866
|
-
var __propIsEnum$
|
|
867
|
-
var __defNormalProp$
|
|
868
|
-
var __spreadValues$
|
|
861
|
+
var __defProp$l = Object.defineProperty;
|
|
862
|
+
var __defProps$c = Object.defineProperties;
|
|
863
|
+
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
864
|
+
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
865
|
+
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
866
|
+
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
867
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
868
|
+
var __spreadValues$l = (a, b) => {
|
|
869
869
|
for (var prop in b || (b = {}))
|
|
870
|
-
if (__hasOwnProp$
|
|
871
|
-
__defNormalProp$
|
|
872
|
-
if (__getOwnPropSymbols$
|
|
873
|
-
for (var prop of __getOwnPropSymbols$
|
|
874
|
-
if (__propIsEnum$
|
|
875
|
-
__defNormalProp$
|
|
870
|
+
if (__hasOwnProp$m.call(b, prop))
|
|
871
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
872
|
+
if (__getOwnPropSymbols$m)
|
|
873
|
+
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
874
|
+
if (__propIsEnum$m.call(b, prop))
|
|
875
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
876
876
|
}
|
|
877
877
|
return a;
|
|
878
878
|
};
|
|
879
|
-
var __spreadProps$
|
|
879
|
+
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
880
880
|
function setQueryOperators(query, operators) {
|
|
881
881
|
const q = query.q;
|
|
882
882
|
if (q.operators !== operators) {
|
|
@@ -965,7 +965,7 @@ const base = {
|
|
|
965
965
|
(key, value, ctx, quotedAs) => `NOT ${key} IN ${quoteValue(value, ctx, quotedAs)}`
|
|
966
966
|
)
|
|
967
967
|
};
|
|
968
|
-
const boolean = __spreadProps$
|
|
968
|
+
const boolean = __spreadProps$c(__spreadValues$l({}, base), {
|
|
969
969
|
and: make(
|
|
970
970
|
(key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
|
|
971
971
|
),
|
|
@@ -973,7 +973,7 @@ const boolean = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
973
973
|
(key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
|
|
974
974
|
)
|
|
975
975
|
});
|
|
976
|
-
const numeric = __spreadProps$
|
|
976
|
+
const numeric = __spreadProps$c(__spreadValues$l({}, base), {
|
|
977
977
|
lt: make(
|
|
978
978
|
(key, value, ctx, quotedAs) => `${key} < ${quoteValue(value, ctx, quotedAs)}`
|
|
979
979
|
),
|
|
@@ -994,7 +994,7 @@ const numeric = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
994
994
|
)}`
|
|
995
995
|
)
|
|
996
996
|
});
|
|
997
|
-
const text = __spreadProps$
|
|
997
|
+
const text = __spreadProps$c(__spreadValues$l({}, base), {
|
|
998
998
|
contains: make(
|
|
999
999
|
(key, value, ctx, quotedAs) => `${key} ILIKE '%' || ${quoteLikeValue(value, ctx, quotedAs)} || '%'`
|
|
1000
1000
|
),
|
|
@@ -1016,7 +1016,7 @@ const text = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
1016
1016
|
});
|
|
1017
1017
|
const encodeJsonPath = (ctx, path) => orchidCore.addValue(ctx.values, `{${Array.isArray(path) ? path.join(", ") : path}}`);
|
|
1018
1018
|
const jsonPathQueryOp = (key, [path, options], ctx) => `jsonb_path_query_first(${key}, ${orchidCore.addValue(ctx.values, path)}${(options == null ? void 0 : options.vars) ? `, ${orchidCore.addValue(ctx.values, JSON.stringify(options.vars))}${options.silent ? ", true" : ""}` : (options == null ? void 0 : options.silent) ? ", NULL, true" : ""})`;
|
|
1019
|
-
const json = __spreadProps$
|
|
1019
|
+
const json = __spreadProps$c(__spreadValues$l({}, base), {
|
|
1020
1020
|
jsonPathQueryFirst: Object.assign(
|
|
1021
1021
|
function(path, options) {
|
|
1022
1022
|
var _a, _b, _c, _d, _e;
|
|
@@ -1079,25 +1079,25 @@ const Operators = {
|
|
|
1079
1079
|
array: base
|
|
1080
1080
|
};
|
|
1081
1081
|
|
|
1082
|
-
var __defProp$
|
|
1083
|
-
var __defProps$
|
|
1084
|
-
var __getOwnPropDescs$
|
|
1085
|
-
var __getOwnPropSymbols$
|
|
1086
|
-
var __hasOwnProp$
|
|
1087
|
-
var __propIsEnum$
|
|
1088
|
-
var __defNormalProp$
|
|
1089
|
-
var __spreadValues$
|
|
1082
|
+
var __defProp$k = Object.defineProperty;
|
|
1083
|
+
var __defProps$b = Object.defineProperties;
|
|
1084
|
+
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
1085
|
+
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
1086
|
+
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
1087
|
+
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
1088
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1089
|
+
var __spreadValues$k = (a, b) => {
|
|
1090
1090
|
for (var prop in b || (b = {}))
|
|
1091
|
-
if (__hasOwnProp$
|
|
1092
|
-
__defNormalProp$
|
|
1093
|
-
if (__getOwnPropSymbols$
|
|
1094
|
-
for (var prop of __getOwnPropSymbols$
|
|
1095
|
-
if (__propIsEnum$
|
|
1096
|
-
__defNormalProp$
|
|
1091
|
+
if (__hasOwnProp$l.call(b, prop))
|
|
1092
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
1093
|
+
if (__getOwnPropSymbols$l)
|
|
1094
|
+
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
1095
|
+
if (__propIsEnum$l.call(b, prop))
|
|
1096
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
1097
1097
|
}
|
|
1098
1098
|
return a;
|
|
1099
1099
|
};
|
|
1100
|
-
var __spreadProps$
|
|
1100
|
+
var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
|
|
1101
1101
|
class TextBaseColumn extends ColumnType {
|
|
1102
1102
|
constructor(schema, schemaType = schema.stringSchema()) {
|
|
1103
1103
|
super(schema, schemaType);
|
|
@@ -1151,7 +1151,7 @@ class StringColumn extends VarCharColumn {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
const textColumnToCode = (column, ctx, key) => {
|
|
1154
|
-
const data = __spreadValues$
|
|
1154
|
+
const data = __spreadValues$k({}, column.data);
|
|
1155
1155
|
let args = "";
|
|
1156
1156
|
const hasMax = data.maxArg !== void 0 && data.max === data.maxArg;
|
|
1157
1157
|
if (data.minArg !== void 0 && data.min === data.minArg || hasMax) {
|
|
@@ -1456,7 +1456,7 @@ class UUIDColumn extends ColumnType {
|
|
|
1456
1456
|
key,
|
|
1457
1457
|
`uuid()`,
|
|
1458
1458
|
// don't output the default default
|
|
1459
|
-
data.default instanceof orchidCore.RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$
|
|
1459
|
+
data.default instanceof orchidCore.RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$b(__spreadValues$k({}, data), { default: void 0 }) : data
|
|
1460
1460
|
);
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
@@ -1747,7 +1747,7 @@ const columnWithDotToSql = (ctx, data, shape, column, index, quotedAs, select) =
|
|
|
1747
1747
|
if (key === "*") {
|
|
1748
1748
|
return ((_a = data.joinedShapes) == null ? void 0 : _a[table]) ? select ? `row_to_json("${table}".*)` : `"${table}".*` : column;
|
|
1749
1749
|
}
|
|
1750
|
-
const tableName = ((_b = data.
|
|
1750
|
+
const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
|
|
1751
1751
|
const quoted = `"${table}"`;
|
|
1752
1752
|
const col = quoted === quotedAs ? shape[key] : (_d = (_c = data.joinedShapes) == null ? void 0 : _c[tableName]) == null ? void 0 : _d[key];
|
|
1753
1753
|
if (col) {
|
|
@@ -1798,7 +1798,7 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
1798
1798
|
}
|
|
1799
1799
|
return column;
|
|
1800
1800
|
}
|
|
1801
|
-
const tableName = ((_b = data.
|
|
1801
|
+
const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
|
|
1802
1802
|
const quoted = `"${table}"`;
|
|
1803
1803
|
const col = quoted === quotedAs ? data.shape[key] : (_c = data.joinedShapes) == null ? void 0 : _c[tableName][key];
|
|
1804
1804
|
if (col) {
|
|
@@ -2139,9 +2139,9 @@ const processWhere = (ands, ctx, table, query, data, quotedAs) => {
|
|
|
2139
2139
|
const item = value;
|
|
2140
2140
|
const joinAs = `"${getJoinItemSource(item.joinFrom)}"`;
|
|
2141
2141
|
const { on } = item;
|
|
2142
|
-
const q = item.
|
|
2142
|
+
const q = item.useOuterAliases ? {
|
|
2143
2143
|
joinedShapes: query.joinedShapes,
|
|
2144
|
-
|
|
2144
|
+
aliases: query.outerAliases,
|
|
2145
2145
|
shape: query.shape
|
|
2146
2146
|
} : query;
|
|
2147
2147
|
ands.push(
|
|
@@ -2269,25 +2269,25 @@ const pushIn = (ctx, query, ands, quotedAs, arg) => {
|
|
|
2269
2269
|
ands.push(`${multiple ? `(${columnsSql})` : columnsSql} IN ${value}`);
|
|
2270
2270
|
};
|
|
2271
2271
|
|
|
2272
|
-
var __defProp$
|
|
2273
|
-
var __defProps$
|
|
2274
|
-
var __getOwnPropDescs$
|
|
2275
|
-
var __getOwnPropSymbols$
|
|
2276
|
-
var __hasOwnProp$
|
|
2277
|
-
var __propIsEnum$
|
|
2278
|
-
var __defNormalProp$
|
|
2279
|
-
var __spreadValues$
|
|
2272
|
+
var __defProp$j = Object.defineProperty;
|
|
2273
|
+
var __defProps$a = Object.defineProperties;
|
|
2274
|
+
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
2275
|
+
var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
|
|
2276
|
+
var __hasOwnProp$k = Object.prototype.hasOwnProperty;
|
|
2277
|
+
var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
|
|
2278
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2279
|
+
var __spreadValues$j = (a, b) => {
|
|
2280
2280
|
for (var prop in b || (b = {}))
|
|
2281
|
-
if (__hasOwnProp$
|
|
2282
|
-
__defNormalProp$
|
|
2283
|
-
if (__getOwnPropSymbols$
|
|
2284
|
-
for (var prop of __getOwnPropSymbols$
|
|
2285
|
-
if (__propIsEnum$
|
|
2286
|
-
__defNormalProp$
|
|
2281
|
+
if (__hasOwnProp$k.call(b, prop))
|
|
2282
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2283
|
+
if (__getOwnPropSymbols$k)
|
|
2284
|
+
for (var prop of __getOwnPropSymbols$k(b)) {
|
|
2285
|
+
if (__propIsEnum$k.call(b, prop))
|
|
2286
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2287
2287
|
}
|
|
2288
2288
|
return a;
|
|
2289
2289
|
};
|
|
2290
|
-
var __spreadProps$
|
|
2290
|
+
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
2291
2291
|
const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
2292
2292
|
let target;
|
|
2293
2293
|
let on;
|
|
@@ -2349,8 +2349,8 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
|
2349
2349
|
const whereSql = whereToSql(
|
|
2350
2350
|
ctx,
|
|
2351
2351
|
q,
|
|
2352
|
-
__spreadProps$
|
|
2353
|
-
joinedShapes: __spreadProps$
|
|
2352
|
+
__spreadProps$a(__spreadValues$j({}, q.q), {
|
|
2353
|
+
joinedShapes: __spreadProps$a(__spreadValues$j(__spreadValues$j({}, query.joinedShapes), q.q.joinedShapes), {
|
|
2354
2354
|
[table.q.as || table.table]: table.q.shape
|
|
2355
2355
|
})
|
|
2356
2356
|
}),
|
|
@@ -2453,7 +2453,7 @@ const pushJoinSql = (ctx, table, query, quotedAs) => {
|
|
|
2453
2453
|
const { aliasValue } = ctx;
|
|
2454
2454
|
ctx.aliasValue = true;
|
|
2455
2455
|
const as = item[2];
|
|
2456
|
-
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.
|
|
2456
|
+
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.aliases) == null ? void 0 : _a[as]) || as}" ON true`;
|
|
2457
2457
|
ctx.aliasValue = aliasValue;
|
|
2458
2458
|
} else {
|
|
2459
2459
|
const { target, on = "true" } = processJoinItem(
|
|
@@ -2482,7 +2482,8 @@ const skipQueryKeysForSubQuery = {
|
|
|
2482
2482
|
or: true,
|
|
2483
2483
|
returnType: true,
|
|
2484
2484
|
joinedShapes: true,
|
|
2485
|
-
returnsOne: true
|
|
2485
|
+
returnsOne: true,
|
|
2486
|
+
aliases: true
|
|
2486
2487
|
};
|
|
2487
2488
|
const getIsJoinSubQuery = (query) => {
|
|
2488
2489
|
const {
|
|
@@ -2497,25 +2498,25 @@ const getIsJoinSubQuery = (query) => {
|
|
|
2497
2498
|
return false;
|
|
2498
2499
|
};
|
|
2499
2500
|
|
|
2500
|
-
var __defProp$
|
|
2501
|
-
var __defProps$
|
|
2502
|
-
var __getOwnPropDescs$
|
|
2503
|
-
var __getOwnPropSymbols$
|
|
2504
|
-
var __hasOwnProp$
|
|
2505
|
-
var __propIsEnum$
|
|
2506
|
-
var __defNormalProp$
|
|
2507
|
-
var __spreadValues$
|
|
2501
|
+
var __defProp$i = Object.defineProperty;
|
|
2502
|
+
var __defProps$9 = Object.defineProperties;
|
|
2503
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
2504
|
+
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
2505
|
+
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
2506
|
+
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
2507
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2508
|
+
var __spreadValues$i = (a, b) => {
|
|
2508
2509
|
for (var prop in b || (b = {}))
|
|
2509
|
-
if (__hasOwnProp$
|
|
2510
|
-
__defNormalProp$
|
|
2511
|
-
if (__getOwnPropSymbols$
|
|
2512
|
-
for (var prop of __getOwnPropSymbols$
|
|
2513
|
-
if (__propIsEnum$
|
|
2514
|
-
__defNormalProp$
|
|
2510
|
+
if (__hasOwnProp$j.call(b, prop))
|
|
2511
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2512
|
+
if (__getOwnPropSymbols$j)
|
|
2513
|
+
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
2514
|
+
if (__propIsEnum$j.call(b, prop))
|
|
2515
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2515
2516
|
}
|
|
2516
2517
|
return a;
|
|
2517
2518
|
};
|
|
2518
|
-
var __spreadProps$
|
|
2519
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
2519
2520
|
const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
2520
2521
|
var _a;
|
|
2521
2522
|
if (typeof first === "string") {
|
|
@@ -2552,13 +2553,13 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2552
2553
|
logger: joinToQ.logger
|
|
2553
2554
|
};
|
|
2554
2555
|
j.baseQuery = j;
|
|
2555
|
-
const joinedShapes = __spreadProps$
|
|
2556
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinToQ.joinedShapes), {
|
|
2556
2557
|
[joinToQ.as || joinTo.table]: joinTo.shape
|
|
2557
2558
|
});
|
|
2558
2559
|
const r = args[0](
|
|
2559
2560
|
makeJoinQueryBuilder(
|
|
2560
2561
|
j,
|
|
2561
|
-
j.q.joinedShapes ? __spreadValues$
|
|
2562
|
+
j.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2562
2563
|
joinTo
|
|
2563
2564
|
)
|
|
2564
2565
|
);
|
|
@@ -2585,16 +2586,16 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2585
2586
|
pushQueryArray(q, "or", query.or);
|
|
2586
2587
|
}
|
|
2587
2588
|
if (query.scopes) {
|
|
2588
|
-
q.q.scopes = __spreadValues$
|
|
2589
|
+
q.q.scopes = __spreadValues$i(__spreadValues$i({}, q.q.scopes), query.scopes);
|
|
2589
2590
|
}
|
|
2590
2591
|
}
|
|
2591
|
-
const joinedShapes = __spreadProps$
|
|
2592
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinTo.q.joinedShapes), {
|
|
2592
2593
|
[joinTo.q.as || joinTo.table]: joinTo.shape
|
|
2593
2594
|
});
|
|
2594
2595
|
const r = args0(
|
|
2595
2596
|
makeJoinQueryBuilder(
|
|
2596
2597
|
q,
|
|
2597
|
-
q.q.joinedShapes ? __spreadValues$
|
|
2598
|
+
q.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2598
2599
|
joinTo
|
|
2599
2600
|
)
|
|
2600
2601
|
);
|
|
@@ -2649,25 +2650,25 @@ const _queryNone = (q) => {
|
|
|
2649
2650
|
};
|
|
2650
2651
|
const isQueryNone = (q) => q.then === noneMethods.then;
|
|
2651
2652
|
|
|
2652
|
-
var __defProp$
|
|
2653
|
-
var __defProps$
|
|
2654
|
-
var __getOwnPropDescs$
|
|
2655
|
-
var __getOwnPropSymbols$
|
|
2656
|
-
var __hasOwnProp$
|
|
2657
|
-
var __propIsEnum$
|
|
2658
|
-
var __defNormalProp$
|
|
2659
|
-
var __spreadValues$
|
|
2653
|
+
var __defProp$h = Object.defineProperty;
|
|
2654
|
+
var __defProps$8 = Object.defineProperties;
|
|
2655
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
2656
|
+
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
2657
|
+
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
2658
|
+
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
2659
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2660
|
+
var __spreadValues$h = (a, b) => {
|
|
2660
2661
|
for (var prop in b || (b = {}))
|
|
2661
|
-
if (__hasOwnProp$
|
|
2662
|
-
__defNormalProp$
|
|
2663
|
-
if (__getOwnPropSymbols$
|
|
2664
|
-
for (var prop of __getOwnPropSymbols$
|
|
2665
|
-
if (__propIsEnum$
|
|
2666
|
-
__defNormalProp$
|
|
2662
|
+
if (__hasOwnProp$i.call(b, prop))
|
|
2663
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2664
|
+
if (__getOwnPropSymbols$i)
|
|
2665
|
+
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
2666
|
+
if (__propIsEnum$i.call(b, prop))
|
|
2667
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2667
2668
|
}
|
|
2668
2669
|
return a;
|
|
2669
2670
|
};
|
|
2670
|
-
var __spreadProps$
|
|
2671
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
2671
2672
|
const _join = (query, require2, type, first, args) => {
|
|
2672
2673
|
var _a, _b, _c, _d;
|
|
2673
2674
|
let joinKey;
|
|
@@ -2709,7 +2710,7 @@ const _join = (query, require2, type, first, args) => {
|
|
|
2709
2710
|
computeds = w == null ? void 0 : w.computeds;
|
|
2710
2711
|
if (shape) {
|
|
2711
2712
|
if (!require2)
|
|
2712
|
-
shape = __spreadValues$
|
|
2713
|
+
shape = __spreadValues$h({}, shape);
|
|
2713
2714
|
parsers = {};
|
|
2714
2715
|
for (const key in shape) {
|
|
2715
2716
|
const parser = shape[key].parseFn;
|
|
@@ -2813,7 +2814,7 @@ const _joinLateral = (self, type, arg, cb, as) => {
|
|
|
2813
2814
|
t.table = arg;
|
|
2814
2815
|
t.shape = w.shape;
|
|
2815
2816
|
t.computeds = w.computeds;
|
|
2816
|
-
t.q = __spreadProps$
|
|
2817
|
+
t.q = __spreadProps$8(__spreadValues$h({}, t.q), {
|
|
2817
2818
|
shape: w.shape
|
|
2818
2819
|
});
|
|
2819
2820
|
t.baseQuery = t;
|
|
@@ -3302,25 +3303,25 @@ class QueryLog {
|
|
|
3302
3303
|
}
|
|
3303
3304
|
}
|
|
3304
3305
|
|
|
3305
|
-
var __defProp$
|
|
3306
|
-
var __defProps$
|
|
3307
|
-
var __getOwnPropDescs$
|
|
3308
|
-
var __getOwnPropSymbols$
|
|
3309
|
-
var __hasOwnProp$
|
|
3310
|
-
var __propIsEnum$
|
|
3311
|
-
var __defNormalProp$
|
|
3312
|
-
var __spreadValues$
|
|
3306
|
+
var __defProp$g = Object.defineProperty;
|
|
3307
|
+
var __defProps$7 = Object.defineProperties;
|
|
3308
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
3309
|
+
var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
|
|
3310
|
+
var __hasOwnProp$h = Object.prototype.hasOwnProperty;
|
|
3311
|
+
var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
|
|
3312
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3313
|
+
var __spreadValues$g = (a, b) => {
|
|
3313
3314
|
for (var prop in b || (b = {}))
|
|
3314
|
-
if (__hasOwnProp$
|
|
3315
|
-
__defNormalProp$
|
|
3316
|
-
if (__getOwnPropSymbols$
|
|
3317
|
-
for (var prop of __getOwnPropSymbols$
|
|
3318
|
-
if (__propIsEnum$
|
|
3319
|
-
__defNormalProp$
|
|
3315
|
+
if (__hasOwnProp$h.call(b, prop))
|
|
3316
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
3317
|
+
if (__getOwnPropSymbols$h)
|
|
3318
|
+
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
3319
|
+
if (__propIsEnum$h.call(b, prop))
|
|
3320
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
3320
3321
|
}
|
|
3321
3322
|
return a;
|
|
3322
3323
|
};
|
|
3323
|
-
var __spreadProps$
|
|
3324
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
3324
3325
|
const commitSql$1 = {
|
|
3325
3326
|
text: "COMMIT"
|
|
3326
3327
|
};
|
|
@@ -3485,7 +3486,7 @@ const runAfterCommit = async (afterCommit, result) => {
|
|
|
3485
3486
|
let r = 0;
|
|
3486
3487
|
for (let i = 0, len = afterCommit.length; i < len; i += 3) {
|
|
3487
3488
|
for (const fn of afterCommit[i + 2]) {
|
|
3488
|
-
resultsWithNames.push(__spreadProps$
|
|
3489
|
+
resultsWithNames.push(__spreadProps$7(__spreadValues$g({}, hookResults[r++]), {
|
|
3489
3490
|
name: fn.name
|
|
3490
3491
|
}));
|
|
3491
3492
|
}
|
|
@@ -3547,25 +3548,25 @@ const finalizeNestedHookSelect = (batches, returnType, tempColumns, renames, key
|
|
|
3547
3548
|
}
|
|
3548
3549
|
};
|
|
3549
3550
|
|
|
3550
|
-
var __defProp$
|
|
3551
|
-
var __defProps$
|
|
3552
|
-
var __getOwnPropDescs$
|
|
3553
|
-
var __getOwnPropSymbols$
|
|
3554
|
-
var __hasOwnProp$
|
|
3555
|
-
var __propIsEnum$
|
|
3556
|
-
var __defNormalProp$
|
|
3557
|
-
var __spreadValues$
|
|
3551
|
+
var __defProp$f = Object.defineProperty;
|
|
3552
|
+
var __defProps$6 = Object.defineProperties;
|
|
3553
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
3554
|
+
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
3555
|
+
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
3556
|
+
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
3557
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3558
|
+
var __spreadValues$f = (a, b) => {
|
|
3558
3559
|
for (var prop in b || (b = {}))
|
|
3559
|
-
if (__hasOwnProp$
|
|
3560
|
-
__defNormalProp$
|
|
3561
|
-
if (__getOwnPropSymbols$
|
|
3562
|
-
for (var prop of __getOwnPropSymbols$
|
|
3563
|
-
if (__propIsEnum$
|
|
3564
|
-
__defNormalProp$
|
|
3560
|
+
if (__hasOwnProp$g.call(b, prop))
|
|
3561
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
3562
|
+
if (__getOwnPropSymbols$g)
|
|
3563
|
+
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
3564
|
+
if (__propIsEnum$g.call(b, prop))
|
|
3565
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
3565
3566
|
}
|
|
3566
3567
|
return a;
|
|
3567
3568
|
};
|
|
3568
|
-
var __spreadProps$
|
|
3569
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
3569
3570
|
class ComputedColumn {
|
|
3570
3571
|
constructor(kind, deps, fn) {
|
|
3571
3572
|
this.kind = kind;
|
|
@@ -3582,7 +3583,7 @@ const applyComputedColumns = (q, fn) => {
|
|
|
3582
3583
|
for (const key in computed) {
|
|
3583
3584
|
const item = computed[key];
|
|
3584
3585
|
if (item instanceof ComputedColumn) {
|
|
3585
|
-
q.q.computeds = __spreadProps$
|
|
3586
|
+
q.q.computeds = __spreadProps$6(__spreadValues$f({}, q.q.computeds), { [key]: item });
|
|
3586
3587
|
} else {
|
|
3587
3588
|
const data = (q.shape[key] = item.result.value || UnknownColumn.instance).data;
|
|
3588
3589
|
data.computed = item;
|
|
@@ -3692,25 +3693,25 @@ const saveBatchComputed = (key, result, res, blanks) => {
|
|
|
3692
3693
|
}
|
|
3693
3694
|
};
|
|
3694
3695
|
|
|
3695
|
-
var __defProp$
|
|
3696
|
-
var __defProps$
|
|
3697
|
-
var __getOwnPropDescs$
|
|
3698
|
-
var __getOwnPropSymbols$
|
|
3699
|
-
var __hasOwnProp$
|
|
3700
|
-
var __propIsEnum$
|
|
3701
|
-
var __defNormalProp$
|
|
3702
|
-
var __spreadValues$
|
|
3696
|
+
var __defProp$e = Object.defineProperty;
|
|
3697
|
+
var __defProps$5 = Object.defineProperties;
|
|
3698
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
3699
|
+
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
3700
|
+
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
3701
|
+
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
3702
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3703
|
+
var __spreadValues$e = (a, b) => {
|
|
3703
3704
|
for (var prop in b || (b = {}))
|
|
3704
|
-
if (__hasOwnProp$
|
|
3705
|
-
__defNormalProp$
|
|
3706
|
-
if (__getOwnPropSymbols$
|
|
3707
|
-
for (var prop of __getOwnPropSymbols$
|
|
3708
|
-
if (__propIsEnum$
|
|
3709
|
-
__defNormalProp$
|
|
3705
|
+
if (__hasOwnProp$f.call(b, prop))
|
|
3706
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
3707
|
+
if (__getOwnPropSymbols$f)
|
|
3708
|
+
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
3709
|
+
if (__propIsEnum$f.call(b, prop))
|
|
3710
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
3710
3711
|
}
|
|
3711
3712
|
return a;
|
|
3712
3713
|
};
|
|
3713
|
-
var __spreadProps$
|
|
3714
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
3714
3715
|
const queryMethodByReturnType = {
|
|
3715
3716
|
undefined: "query",
|
|
3716
3717
|
all: "query",
|
|
@@ -3954,7 +3955,7 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
|
|
|
3954
3955
|
if (hookResults.some((result2) => result2.status === "rejected")) {
|
|
3955
3956
|
_afterCommitError(
|
|
3956
3957
|
result,
|
|
3957
|
-
hookResults.map((result2, i) => __spreadProps$
|
|
3958
|
+
hookResults.map((result2, i) => __spreadProps$5(__spreadValues$e({}, result2), {
|
|
3958
3959
|
name: afterCommitHooks[i].name
|
|
3959
3960
|
})),
|
|
3960
3961
|
q.q.catchAfterCommitError
|
|
@@ -4196,7 +4197,7 @@ const filterResult = (q, returnType, queryResult, result, tempColumns, hasAfterH
|
|
|
4196
4197
|
return row;
|
|
4197
4198
|
} else {
|
|
4198
4199
|
if (hasAfterHook)
|
|
4199
|
-
row = __spreadValues$
|
|
4200
|
+
row = __spreadValues$e({}, row);
|
|
4200
4201
|
for (const column of tempColumns) {
|
|
4201
4202
|
delete row[column];
|
|
4202
4203
|
}
|
|
@@ -4239,7 +4240,7 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4239
4240
|
if (tempColumns == null ? void 0 : tempColumns.size) {
|
|
4240
4241
|
if (hasAfterHook) {
|
|
4241
4242
|
return result.map((data) => {
|
|
4242
|
-
const record = __spreadValues$
|
|
4243
|
+
const record = __spreadValues$e({}, data);
|
|
4243
4244
|
for (const key of tempColumns) {
|
|
4244
4245
|
delete record[key];
|
|
4245
4246
|
}
|
|
@@ -4256,25 +4257,25 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4256
4257
|
return result;
|
|
4257
4258
|
};
|
|
4258
4259
|
|
|
4259
|
-
var __defProp$
|
|
4260
|
-
var __defProps$
|
|
4261
|
-
var __getOwnPropDescs$
|
|
4262
|
-
var __getOwnPropSymbols$
|
|
4263
|
-
var __hasOwnProp$
|
|
4264
|
-
var __propIsEnum$
|
|
4265
|
-
var __defNormalProp$
|
|
4266
|
-
var __spreadValues$
|
|
4260
|
+
var __defProp$d = Object.defineProperty;
|
|
4261
|
+
var __defProps$4 = Object.defineProperties;
|
|
4262
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
4263
|
+
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
4264
|
+
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
4265
|
+
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
4266
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4267
|
+
var __spreadValues$d = (a, b) => {
|
|
4267
4268
|
for (var prop in b || (b = {}))
|
|
4268
|
-
if (__hasOwnProp$
|
|
4269
|
-
__defNormalProp$
|
|
4270
|
-
if (__getOwnPropSymbols$
|
|
4271
|
-
for (var prop of __getOwnPropSymbols$
|
|
4272
|
-
if (__propIsEnum$
|
|
4273
|
-
__defNormalProp$
|
|
4269
|
+
if (__hasOwnProp$e.call(b, prop))
|
|
4270
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
4271
|
+
if (__getOwnPropSymbols$e)
|
|
4272
|
+
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
4273
|
+
if (__propIsEnum$e.call(b, prop))
|
|
4274
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
4274
4275
|
}
|
|
4275
4276
|
return a;
|
|
4276
4277
|
};
|
|
4277
|
-
var __spreadProps$
|
|
4278
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
4278
4279
|
const addParserForRawExpression = (q, key, raw) => {
|
|
4279
4280
|
const type = raw.result.value;
|
|
4280
4281
|
if (type == null ? void 0 : type.parseFn)
|
|
@@ -4496,11 +4497,12 @@ const collectNestedSelectBatches = (batches, rows, path, last) => {
|
|
|
4496
4497
|
};
|
|
4497
4498
|
const emptyArrSQL = new RawSQL("'[]'");
|
|
4498
4499
|
const processSelectArg = (q, as, arg, columnAs) => {
|
|
4499
|
-
var _a, _b
|
|
4500
|
+
var _a, _b;
|
|
4500
4501
|
if (typeof arg === "string") {
|
|
4501
4502
|
return setParserForSelectedString(q, arg, as, columnAs);
|
|
4502
4503
|
}
|
|
4503
4504
|
const selectAs = {};
|
|
4505
|
+
let aliases;
|
|
4504
4506
|
for (const key in arg) {
|
|
4505
4507
|
let value = arg[key];
|
|
4506
4508
|
if (typeof value === "function") {
|
|
@@ -4535,17 +4537,11 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4535
4537
|
query = value;
|
|
4536
4538
|
}
|
|
4537
4539
|
}
|
|
4538
|
-
|
|
4539
|
-
if ((_a = value.q.joinedShapes) == null ? void 0 : _a[key]) {
|
|
4540
|
-
let suffix = 2;
|
|
4541
|
-
const joinOverrides = (_c = (_b = q.q).joinOverrides) != null ? _c : _b.joinOverrides = {};
|
|
4542
|
-
while (joinOverrides[asOverride = `${key}${suffix}`]) {
|
|
4543
|
-
suffix++;
|
|
4544
|
-
}
|
|
4545
|
-
joinOverrides[asOverride] = asOverride;
|
|
4546
|
-
joinOverrides[key] = asOverride;
|
|
4547
|
-
}
|
|
4540
|
+
const asOverride = (_a = value.q.aliases[key]) != null ? _a : key;
|
|
4548
4541
|
value.q.joinedForSelect = asOverride;
|
|
4542
|
+
if (asOverride !== key) {
|
|
4543
|
+
aliases = __spreadProps$4(__spreadValues$d({}, q.q.aliases), { [key]: asOverride });
|
|
4544
|
+
}
|
|
4549
4545
|
_joinLateral(
|
|
4550
4546
|
q,
|
|
4551
4547
|
value.q.innerJoinLateral ? "JOIN" : "LEFT JOIN",
|
|
@@ -4553,10 +4549,12 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4553
4549
|
(q2) => q2,
|
|
4554
4550
|
key
|
|
4555
4551
|
);
|
|
4556
|
-
} else if (((
|
|
4552
|
+
} else if (((_b = value.q) == null ? void 0 : _b.subQuery) && value.q.expr) {
|
|
4557
4553
|
value = value.q.expr;
|
|
4558
4554
|
}
|
|
4559
4555
|
}
|
|
4556
|
+
if (aliases)
|
|
4557
|
+
q.q.aliases = aliases;
|
|
4560
4558
|
selectAs[key] = addParserForSelectItem(
|
|
4561
4559
|
q,
|
|
4562
4560
|
as,
|
|
@@ -4601,7 +4599,7 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
|
|
|
4601
4599
|
for (const column2 of computed.deps) {
|
|
4602
4600
|
map.set(column2, { select: `${table}.${column2}` });
|
|
4603
4601
|
}
|
|
4604
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4602
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), {
|
|
4605
4603
|
[column]: computed
|
|
4606
4604
|
});
|
|
4607
4605
|
return;
|
|
@@ -4625,7 +4623,7 @@ const handleComputed = (q, computeds, column) => {
|
|
|
4625
4623
|
for (const column2 of computed.deps) {
|
|
4626
4624
|
map.set(column2, { select: column2 });
|
|
4627
4625
|
}
|
|
4628
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4626
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), { [column]: computed });
|
|
4629
4627
|
return;
|
|
4630
4628
|
}
|
|
4631
4629
|
return column;
|
|
@@ -4823,10 +4821,43 @@ function _queryGetOptional(self, arg) {
|
|
|
4823
4821
|
return _get(self, "value", arg);
|
|
4824
4822
|
}
|
|
4825
4823
|
|
|
4824
|
+
var __defProp$c = Object.defineProperty;
|
|
4825
|
+
var __defProps$3 = Object.defineProperties;
|
|
4826
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
4827
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
4828
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
4829
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
4830
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4831
|
+
var __spreadValues$c = (a, b) => {
|
|
4832
|
+
for (var prop in b || (b = {}))
|
|
4833
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
4834
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
4835
|
+
if (__getOwnPropSymbols$d)
|
|
4836
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
4837
|
+
if (__propIsEnum$d.call(b, prop))
|
|
4838
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
4839
|
+
}
|
|
4840
|
+
return a;
|
|
4841
|
+
};
|
|
4842
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
4826
4843
|
const _queryAs = (self, as) => {
|
|
4827
|
-
|
|
4844
|
+
const { q } = self;
|
|
4845
|
+
q.as = as;
|
|
4846
|
+
q.aliases = __spreadProps$3(__spreadValues$c({}, q.aliases), {
|
|
4847
|
+
[as]: q.aliases ? _queryResolveAlias(q.aliases, as) : as
|
|
4848
|
+
});
|
|
4828
4849
|
return self;
|
|
4829
4850
|
};
|
|
4851
|
+
const _queryResolveAlias = (aliases, as) => {
|
|
4852
|
+
if (!aliases[as])
|
|
4853
|
+
return as;
|
|
4854
|
+
let suffix = 2;
|
|
4855
|
+
let privateAs;
|
|
4856
|
+
while (aliases[privateAs = as + suffix]) {
|
|
4857
|
+
suffix++;
|
|
4858
|
+
}
|
|
4859
|
+
return privateAs;
|
|
4860
|
+
};
|
|
4830
4861
|
class AsMethods {
|
|
4831
4862
|
/**
|
|
4832
4863
|
* Sets table alias:
|
|
@@ -6192,14 +6223,14 @@ const makeRegexToFindInSql = (value) => {
|
|
|
6192
6223
|
return new RegExp(`${value}(?=(?:[^']*'[^']*')*[^']*$)`, "g");
|
|
6193
6224
|
};
|
|
6194
6225
|
const resolveSubQueryCallback = (q, cb) => {
|
|
6195
|
-
const { subQuery, relChain,
|
|
6226
|
+
const { subQuery, relChain, outerAliases } = q.q;
|
|
6196
6227
|
q.q.subQuery = 1;
|
|
6197
6228
|
q.q.relChain = void 0;
|
|
6198
|
-
q.q.
|
|
6229
|
+
q.q.outerAliases = q.q.aliases;
|
|
6199
6230
|
const result = cb(q);
|
|
6200
6231
|
q.q.subQuery = subQuery;
|
|
6201
6232
|
q.q.relChain = relChain;
|
|
6202
|
-
q.q.
|
|
6233
|
+
q.q.outerAliases = outerAliases;
|
|
6203
6234
|
return result;
|
|
6204
6235
|
};
|
|
6205
6236
|
const joinSubQuery = (q, sub) => {
|
|
@@ -9353,7 +9384,7 @@ const pushQueryOnForOuter = (q, joinFrom, joinTo, ...on) => {
|
|
|
9353
9384
|
ON: {
|
|
9354
9385
|
joinTo: joinFrom,
|
|
9355
9386
|
joinFrom: joinTo,
|
|
9356
|
-
|
|
9387
|
+
useOuterAliases: true,
|
|
9357
9388
|
on
|
|
9358
9389
|
}
|
|
9359
9390
|
});
|
|
@@ -9762,7 +9793,7 @@ const resolveCallbacksInArgs = (q, args) => {
|
|
|
9762
9793
|
qb.q = getClonedQueryData(q.q);
|
|
9763
9794
|
qb.q.and = qb.q.or = qb.q.scopes = void 0;
|
|
9764
9795
|
qb.q.subQuery = 1;
|
|
9765
|
-
qb.q.
|
|
9796
|
+
qb.q.outerAliases = qb.q.aliases;
|
|
9766
9797
|
args[i] = resolveSubQueryCallback(qb, arg);
|
|
9767
9798
|
}
|
|
9768
9799
|
}
|
|
@@ -13349,6 +13380,7 @@ exports._queryJoinOnJsonPathEquals = _queryJoinOnJsonPathEquals;
|
|
|
13349
13380
|
exports._queryJoinOrOn = _queryJoinOrOn;
|
|
13350
13381
|
exports._queryOr = _queryOr;
|
|
13351
13382
|
exports._queryOrNot = _queryOrNot;
|
|
13383
|
+
exports._queryResolveAlias = _queryResolveAlias;
|
|
13352
13384
|
exports._queryRows = _queryRows;
|
|
13353
13385
|
exports._querySelect = _querySelect;
|
|
13354
13386
|
exports._queryTake = _queryTake;
|