pqb 0.3.2 → 0.3.4
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 +1239 -1342
- package/dist/index.esm.js +482 -432
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +484 -434
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/columnSchema/columnType.test.ts +2 -1
- package/src/columnSchema/columnsSchema.ts +20 -60
- package/src/db.test.ts +1 -1
- package/src/db.ts +27 -20
- package/src/query.ts +36 -32
- package/src/queryDataUtils.ts +0 -7
- package/src/queryMethods/aggregate.ts +2 -3
- package/src/queryMethods/clear.ts +3 -4
- package/src/queryMethods/delete.ts +3 -3
- package/src/queryMethods/from.test.ts +2 -3
- package/src/queryMethods/get.ts +0 -1
- package/src/queryMethods/index.ts +1 -0
- package/src/queryMethods/insert.ts +14 -13
- package/src/queryMethods/json.ts +7 -3
- package/src/queryMethods/merge.test.ts +471 -0
- package/src/queryMethods/merge.ts +67 -0
- package/src/queryMethods/queryMethods.test.ts +14 -59
- package/src/queryMethods/queryMethods.ts +18 -33
- package/src/queryMethods/select.test.ts +4 -0
- package/src/queryMethods/select.ts +4 -2
- package/src/queryMethods/then.ts +3 -3
- package/src/queryMethods/update.ts +21 -14
- package/src/sql/fromAndAs.ts +2 -3
- package/src/sql/select.ts +1 -2
- package/src/sql/toSql.ts +4 -3
- package/src/sql/types.ts +7 -3
- package/src/sql/window.ts +1 -1
- package/src/sql/with.ts +25 -20
- package/src/utils.test.ts +0 -18
- package/src/utils.ts +0 -40
- package/src/columnSchema/columnsSchema.test.ts +0 -32
package/dist/index.js
CHANGED
|
@@ -4,28 +4,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var pg = require('pg');
|
|
6
6
|
|
|
7
|
-
var __defProp$
|
|
7
|
+
var __defProp$q = Object.defineProperty;
|
|
8
8
|
var __defProps$l = Object.defineProperties;
|
|
9
9
|
var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols$
|
|
11
|
-
var __hasOwnProp$
|
|
12
|
-
var __propIsEnum$
|
|
13
|
-
var __defNormalProp$
|
|
14
|
-
var __spreadValues$
|
|
10
|
+
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
11
|
+
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues$q = (a, b) => {
|
|
15
15
|
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp$
|
|
17
|
-
__defNormalProp$
|
|
18
|
-
if (__getOwnPropSymbols$
|
|
19
|
-
for (var prop of __getOwnPropSymbols$
|
|
20
|
-
if (__propIsEnum$
|
|
21
|
-
__defNormalProp$
|
|
16
|
+
if (__hasOwnProp$r.call(b, prop))
|
|
17
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols$r)
|
|
19
|
+
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
20
|
+
if (__propIsEnum$r.call(b, prop))
|
|
21
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
22
22
|
}
|
|
23
23
|
return a;
|
|
24
24
|
};
|
|
25
25
|
var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
|
|
26
26
|
const addColumnData = (q, key, value) => {
|
|
27
27
|
const cloned = Object.create(q);
|
|
28
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
28
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, q.data), { [key]: value });
|
|
29
29
|
return cloned;
|
|
30
30
|
};
|
|
31
31
|
class ColumnType {
|
|
@@ -43,12 +43,12 @@ class ColumnType {
|
|
|
43
43
|
foreignKey(fnOrTable, column, options = {}) {
|
|
44
44
|
const cloned = Object.create(this);
|
|
45
45
|
if (typeof fnOrTable === "string") {
|
|
46
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
47
|
-
foreignKey: __spreadValues$
|
|
46
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, this.data), {
|
|
47
|
+
foreignKey: __spreadValues$q({ table: fnOrTable, columns: [column] }, options)
|
|
48
48
|
});
|
|
49
49
|
} else {
|
|
50
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
51
|
-
foreignKey: __spreadValues$
|
|
50
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, this.data), {
|
|
51
|
+
foreignKey: __spreadValues$q({ fn: fnOrTable, columns: [column] }, options)
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return cloned;
|
|
@@ -80,7 +80,7 @@ class ColumnType {
|
|
|
80
80
|
return addColumnData(this, "index", options);
|
|
81
81
|
}
|
|
82
82
|
unique(options = {}) {
|
|
83
|
-
return addColumnData(this, "index", __spreadProps$l(__spreadValues$
|
|
83
|
+
return addColumnData(this, "index", __spreadProps$l(__spreadValues$q({}, options), { unique: true }));
|
|
84
84
|
}
|
|
85
85
|
comment(comment) {
|
|
86
86
|
return addColumnData(this, "comment", comment);
|
|
@@ -207,21 +207,21 @@ const addValue = (values, value) => {
|
|
|
207
207
|
return `$${values.length}`;
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
var __defProp$
|
|
210
|
+
var __defProp$p = Object.defineProperty;
|
|
211
211
|
var __defProps$k = Object.defineProperties;
|
|
212
212
|
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
213
|
-
var __getOwnPropSymbols$
|
|
214
|
-
var __hasOwnProp$
|
|
215
|
-
var __propIsEnum$
|
|
216
|
-
var __defNormalProp$
|
|
217
|
-
var __spreadValues$
|
|
213
|
+
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
214
|
+
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
215
|
+
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
216
|
+
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
217
|
+
var __spreadValues$p = (a, b) => {
|
|
218
218
|
for (var prop in b || (b = {}))
|
|
219
|
-
if (__hasOwnProp$
|
|
220
|
-
__defNormalProp$
|
|
221
|
-
if (__getOwnPropSymbols$
|
|
222
|
-
for (var prop of __getOwnPropSymbols$
|
|
223
|
-
if (__propIsEnum$
|
|
224
|
-
__defNormalProp$
|
|
219
|
+
if (__hasOwnProp$q.call(b, prop))
|
|
220
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
221
|
+
if (__getOwnPropSymbols$q)
|
|
222
|
+
for (var prop of __getOwnPropSymbols$q(b)) {
|
|
223
|
+
if (__propIsEnum$q.call(b, prop))
|
|
224
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
225
225
|
}
|
|
226
226
|
return a;
|
|
227
227
|
};
|
|
@@ -311,14 +311,14 @@ const base = () => ({
|
|
|
311
311
|
in: all.in(),
|
|
312
312
|
notIn: all.notIn()
|
|
313
313
|
});
|
|
314
|
-
const numeric = () => __spreadProps$k(__spreadValues$
|
|
314
|
+
const numeric = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
315
315
|
lt: all.lt(),
|
|
316
316
|
lte: all.lte(),
|
|
317
317
|
gt: all.gt(),
|
|
318
318
|
gte: all.gte(),
|
|
319
319
|
between: all.between()
|
|
320
320
|
});
|
|
321
|
-
const text = () => __spreadProps$k(__spreadValues$
|
|
321
|
+
const text = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
322
322
|
contains: all.contains(),
|
|
323
323
|
containsInsensitive: all.containsInsensitive(),
|
|
324
324
|
startsWith: all.startsWith(),
|
|
@@ -326,7 +326,7 @@ const text = () => __spreadProps$k(__spreadValues$o({}, base()), {
|
|
|
326
326
|
endsWith: all.endsWith(),
|
|
327
327
|
endsWithInsensitive: all.endsWithInsensitive()
|
|
328
328
|
});
|
|
329
|
-
const json = () => __spreadProps$k(__spreadValues$
|
|
329
|
+
const json = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
330
330
|
jsonPath: all.jsonPath(),
|
|
331
331
|
jsonSupersetOf: all.jsonSupersetOf(),
|
|
332
332
|
jsonSubsetOf: all.jsonSubsetOf()
|
|
@@ -342,6 +342,12 @@ const Operators = {
|
|
|
342
342
|
array: base()
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
const defaultsKey = Symbol("defaults");
|
|
346
|
+
const queryTypeWithLimitOne = {
|
|
347
|
+
one: true,
|
|
348
|
+
oneOrThrow: true
|
|
349
|
+
};
|
|
350
|
+
|
|
345
351
|
const pushDistinctSql = (ctx, distinct, quotedAs) => {
|
|
346
352
|
ctx.sql.push("DISTINCT");
|
|
347
353
|
if (distinct.length) {
|
|
@@ -694,21 +700,21 @@ const pushIn = (ands, prefix, quotedAs, values, arg) => {
|
|
|
694
700
|
);
|
|
695
701
|
};
|
|
696
702
|
|
|
697
|
-
var __defProp$
|
|
703
|
+
var __defProp$o = Object.defineProperty;
|
|
698
704
|
var __defProps$j = Object.defineProperties;
|
|
699
705
|
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
700
|
-
var __getOwnPropSymbols$
|
|
701
|
-
var __hasOwnProp$
|
|
702
|
-
var __propIsEnum$
|
|
703
|
-
var __defNormalProp$
|
|
704
|
-
var __spreadValues$
|
|
706
|
+
var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
|
|
707
|
+
var __hasOwnProp$p = Object.prototype.hasOwnProperty;
|
|
708
|
+
var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
|
|
709
|
+
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
710
|
+
var __spreadValues$o = (a, b) => {
|
|
705
711
|
for (var prop in b || (b = {}))
|
|
706
|
-
if (__hasOwnProp$
|
|
707
|
-
__defNormalProp$
|
|
708
|
-
if (__getOwnPropSymbols$
|
|
709
|
-
for (var prop of __getOwnPropSymbols$
|
|
710
|
-
if (__propIsEnum$
|
|
711
|
-
__defNormalProp$
|
|
712
|
+
if (__hasOwnProp$p.call(b, prop))
|
|
713
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
714
|
+
if (__getOwnPropSymbols$p)
|
|
715
|
+
for (var prop of __getOwnPropSymbols$p(b)) {
|
|
716
|
+
if (__propIsEnum$p.call(b, prop))
|
|
717
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
712
718
|
}
|
|
713
719
|
return a;
|
|
714
720
|
};
|
|
@@ -716,7 +722,7 @@ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
|
|
|
716
722
|
const aggregateToSql = (ctx, model, item, quotedAs) => {
|
|
717
723
|
var _a;
|
|
718
724
|
const sql = [`${item.function}(`];
|
|
719
|
-
ctx = __spreadProps$j(__spreadValues$
|
|
725
|
+
ctx = __spreadProps$j(__spreadValues$o({}, ctx), { sql });
|
|
720
726
|
const options = item.options || EMPTY_OBJECT;
|
|
721
727
|
if (options.distinct && !options.withinGroup)
|
|
722
728
|
sql.push("DISTINCT ");
|
|
@@ -884,7 +890,7 @@ const selectToSql = (ctx, model, query, quotedAs) => {
|
|
|
884
890
|
}
|
|
885
891
|
};
|
|
886
892
|
const pushSubQuerySql = (query, as, values, list) => {
|
|
887
|
-
const { returnType } = query.query;
|
|
893
|
+
const { returnType = "all" } = query.query;
|
|
888
894
|
switch (returnType) {
|
|
889
895
|
case "all":
|
|
890
896
|
case "one":
|
|
@@ -901,7 +907,6 @@ const pushSubQuerySql = (query, as, values, list) => {
|
|
|
901
907
|
select[0] = { selectAs: { c: first } };
|
|
902
908
|
query = query._wrap(query.__model.clone());
|
|
903
909
|
query._getOptional(raw(`COALESCE(json_agg("c"), '[]')`));
|
|
904
|
-
delete query.query.take;
|
|
905
910
|
break;
|
|
906
911
|
}
|
|
907
912
|
case "rows":
|
|
@@ -1019,22 +1024,30 @@ const havingToSql = (ctx, model, query, quotedAs) => {
|
|
|
1019
1024
|
};
|
|
1020
1025
|
|
|
1021
1026
|
const pushWithSql = (ctx, withData) => {
|
|
1022
|
-
withData.
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
inner
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1027
|
+
if (!withData.length)
|
|
1028
|
+
return;
|
|
1029
|
+
ctx.sql.push(
|
|
1030
|
+
"WITH",
|
|
1031
|
+
withData.map((withItem) => {
|
|
1032
|
+
const [name, options, query] = withItem;
|
|
1033
|
+
let inner;
|
|
1034
|
+
if (isRaw(query)) {
|
|
1035
|
+
inner = getRaw(query, ctx.values);
|
|
1036
|
+
} else {
|
|
1037
|
+
inner = query.toSql({ values: ctx.values }).text;
|
|
1038
|
+
}
|
|
1039
|
+
return `${options.recursive ? "RECURSIVE " : ""}${q(name)}${options.columns ? `(${options.columns.map(q).join(", ")})` : ""} AS ${options.materialized ? "MATERIALIZED " : options.notMaterialized ? "NOT MATERIALIZED " : ""}(${inner})`;
|
|
1040
|
+
}).join(", ")
|
|
1041
|
+
);
|
|
1034
1042
|
};
|
|
1035
1043
|
|
|
1044
|
+
const checkIfASimpleQuery = (q) => {
|
|
1045
|
+
if (q.returnType && q.returnType !== "all")
|
|
1046
|
+
return false;
|
|
1047
|
+
const keys = Object.keys(q);
|
|
1048
|
+
return !keys.some((key) => queryKeysOfNotSimpleQuery.includes(key));
|
|
1049
|
+
};
|
|
1036
1050
|
const queryKeysOfNotSimpleQuery = [
|
|
1037
|
-
"take",
|
|
1038
1051
|
"with",
|
|
1039
1052
|
"as",
|
|
1040
1053
|
"from",
|
|
@@ -1076,8 +1089,7 @@ const getFrom = (model, query, values) => {
|
|
|
1076
1089
|
return `(${sql.text})`;
|
|
1077
1090
|
}
|
|
1078
1091
|
const q = query.from.query;
|
|
1079
|
-
|
|
1080
|
-
if (keys.some((key) => queryKeysOfNotSimpleQuery.includes(key))) {
|
|
1092
|
+
if (!checkIfASimpleQuery(q)) {
|
|
1081
1093
|
const sql = query.from.toSql({ values });
|
|
1082
1094
|
return `(${sql.text})`;
|
|
1083
1095
|
}
|
|
@@ -1333,8 +1345,9 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1333
1345
|
if (query.order) {
|
|
1334
1346
|
pushOrderBySql(ctx, quotedAs, query.order);
|
|
1335
1347
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1348
|
+
const limit = queryTypeWithLimitOne[query.returnType] ? 1 : query.limit;
|
|
1349
|
+
if (limit) {
|
|
1350
|
+
sql.push(`LIMIT ${addValue(values, limit)}`);
|
|
1338
1351
|
}
|
|
1339
1352
|
if (query.offset) {
|
|
1340
1353
|
sql.push(`OFFSET ${addValue(values, query.offset)}`);
|
|
@@ -1355,21 +1368,21 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1355
1368
|
return { text: sql.join(" "), values };
|
|
1356
1369
|
};
|
|
1357
1370
|
|
|
1358
|
-
var __defProp$
|
|
1371
|
+
var __defProp$n = Object.defineProperty;
|
|
1359
1372
|
var __defProps$i = Object.defineProperties;
|
|
1360
1373
|
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
1361
|
-
var __getOwnPropSymbols$
|
|
1362
|
-
var __hasOwnProp$
|
|
1363
|
-
var __propIsEnum$
|
|
1364
|
-
var __defNormalProp$
|
|
1365
|
-
var __spreadValues$
|
|
1374
|
+
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
1375
|
+
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
1376
|
+
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
1377
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1378
|
+
var __spreadValues$n = (a, b) => {
|
|
1366
1379
|
for (var prop in b || (b = {}))
|
|
1367
|
-
if (__hasOwnProp$
|
|
1368
|
-
__defNormalProp$
|
|
1369
|
-
if (__getOwnPropSymbols$
|
|
1370
|
-
for (var prop of __getOwnPropSymbols$
|
|
1371
|
-
if (__propIsEnum$
|
|
1372
|
-
__defNormalProp$
|
|
1380
|
+
if (__hasOwnProp$o.call(b, prop))
|
|
1381
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
1382
|
+
if (__getOwnPropSymbols$o)
|
|
1383
|
+
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
1384
|
+
if (__propIsEnum$o.call(b, prop))
|
|
1385
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
1373
1386
|
}
|
|
1374
1387
|
return a;
|
|
1375
1388
|
};
|
|
@@ -1389,7 +1402,7 @@ const joinTruthy = (...strings) => {
|
|
|
1389
1402
|
return strings.filter((string) => string).join("");
|
|
1390
1403
|
};
|
|
1391
1404
|
const getClonedQueryData = (query) => {
|
|
1392
|
-
const cloned = __spreadProps$i(__spreadValues$
|
|
1405
|
+
const cloned = __spreadProps$i(__spreadValues$n({}, query), { [toSqlCacheKey]: void 0 });
|
|
1393
1406
|
for (const key in query) {
|
|
1394
1407
|
if (Array.isArray(query[key])) {
|
|
1395
1408
|
cloned[key] = [
|
|
@@ -1450,28 +1463,28 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
1450
1463
|
assignMethodsToClass: assignMethodsToClass
|
|
1451
1464
|
});
|
|
1452
1465
|
|
|
1453
|
-
var __defProp$
|
|
1466
|
+
var __defProp$m = Object.defineProperty;
|
|
1454
1467
|
var __defProps$h = Object.defineProperties;
|
|
1455
1468
|
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
1456
|
-
var __getOwnPropSymbols$
|
|
1457
|
-
var __hasOwnProp$
|
|
1458
|
-
var __propIsEnum$
|
|
1459
|
-
var __defNormalProp$
|
|
1460
|
-
var __spreadValues$
|
|
1469
|
+
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
1470
|
+
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
1471
|
+
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
1472
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1473
|
+
var __spreadValues$m = (a, b) => {
|
|
1461
1474
|
for (var prop in b || (b = {}))
|
|
1462
|
-
if (__hasOwnProp$
|
|
1463
|
-
__defNormalProp$
|
|
1464
|
-
if (__getOwnPropSymbols$
|
|
1465
|
-
for (var prop of __getOwnPropSymbols$
|
|
1466
|
-
if (__propIsEnum$
|
|
1467
|
-
__defNormalProp$
|
|
1475
|
+
if (__hasOwnProp$n.call(b, prop))
|
|
1476
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
1477
|
+
if (__getOwnPropSymbols$n)
|
|
1478
|
+
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
1479
|
+
if (__propIsEnum$n.call(b, prop))
|
|
1480
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
1468
1481
|
}
|
|
1469
1482
|
return a;
|
|
1470
1483
|
};
|
|
1471
1484
|
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
1472
1485
|
const setDataValue = (item, key, value) => {
|
|
1473
1486
|
const cloned = Object.create(item);
|
|
1474
|
-
cloned.data = __spreadProps$h(__spreadValues$
|
|
1487
|
+
cloned.data = __spreadProps$h(__spreadValues$m({}, item.data), { [key]: value });
|
|
1475
1488
|
return cloned;
|
|
1476
1489
|
};
|
|
1477
1490
|
function min(value) {
|
|
@@ -1501,7 +1514,7 @@ const setMethods = {
|
|
|
1501
1514
|
size,
|
|
1502
1515
|
nonempty
|
|
1503
1516
|
};
|
|
1504
|
-
const stringTypeMethods = () => __spreadProps$h(__spreadValues$
|
|
1517
|
+
const stringTypeMethods = () => __spreadProps$h(__spreadValues$m({}, arrayMethods), {
|
|
1505
1518
|
email() {
|
|
1506
1519
|
return setDataValue(this, "email", true);
|
|
1507
1520
|
},
|
|
@@ -1972,21 +1985,21 @@ class EnumColumn extends ColumnType {
|
|
|
1972
1985
|
}
|
|
1973
1986
|
}
|
|
1974
1987
|
|
|
1975
|
-
var __defProp$
|
|
1988
|
+
var __defProp$l = Object.defineProperty;
|
|
1976
1989
|
var __defProps$g = Object.defineProperties;
|
|
1977
1990
|
var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
|
|
1978
|
-
var __getOwnPropSymbols$
|
|
1979
|
-
var __hasOwnProp$
|
|
1980
|
-
var __propIsEnum$
|
|
1981
|
-
var __defNormalProp$
|
|
1982
|
-
var __spreadValues$
|
|
1991
|
+
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
1992
|
+
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
1993
|
+
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
1994
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1995
|
+
var __spreadValues$l = (a, b) => {
|
|
1983
1996
|
for (var prop in b || (b = {}))
|
|
1984
|
-
if (__hasOwnProp$
|
|
1985
|
-
__defNormalProp$
|
|
1986
|
-
if (__getOwnPropSymbols$
|
|
1987
|
-
for (var prop of __getOwnPropSymbols$
|
|
1988
|
-
if (__propIsEnum$
|
|
1989
|
-
__defNormalProp$
|
|
1997
|
+
if (__hasOwnProp$m.call(b, prop))
|
|
1998
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
1999
|
+
if (__getOwnPropSymbols$m)
|
|
2000
|
+
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
2001
|
+
if (__propIsEnum$m.call(b, prop))
|
|
2002
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
1990
2003
|
}
|
|
1991
2004
|
return a;
|
|
1992
2005
|
};
|
|
@@ -1994,42 +2007,42 @@ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
|
|
|
1994
2007
|
var __objRest$4 = (source, exclude) => {
|
|
1995
2008
|
var target = {};
|
|
1996
2009
|
for (var prop in source)
|
|
1997
|
-
if (__hasOwnProp$
|
|
2010
|
+
if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1998
2011
|
target[prop] = source[prop];
|
|
1999
|
-
if (source != null && __getOwnPropSymbols$
|
|
2000
|
-
for (var prop of __getOwnPropSymbols$
|
|
2001
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2012
|
+
if (source != null && __getOwnPropSymbols$m)
|
|
2013
|
+
for (var prop of __getOwnPropSymbols$m(source)) {
|
|
2014
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
|
|
2002
2015
|
target[prop] = source[prop];
|
|
2003
2016
|
}
|
|
2004
2017
|
return target;
|
|
2005
2018
|
};
|
|
2006
2019
|
const optional = (type) => {
|
|
2007
|
-
return __spreadProps$g(__spreadValues$
|
|
2008
|
-
data: __spreadProps$g(__spreadValues$
|
|
2020
|
+
return __spreadProps$g(__spreadValues$l({}, type), {
|
|
2021
|
+
data: __spreadProps$g(__spreadValues$l({}, type.data), { optional: true })
|
|
2009
2022
|
});
|
|
2010
2023
|
};
|
|
2011
2024
|
const required = (type) => {
|
|
2012
2025
|
const _a = type.data, data = __objRest$4(_a, ["optional"]);
|
|
2013
|
-
return __spreadProps$g(__spreadValues$
|
|
2026
|
+
return __spreadProps$g(__spreadValues$l({}, type), {
|
|
2014
2027
|
data
|
|
2015
2028
|
});
|
|
2016
2029
|
};
|
|
2017
2030
|
|
|
2018
|
-
var __defProp$
|
|
2031
|
+
var __defProp$k = Object.defineProperty;
|
|
2019
2032
|
var __defProps$f = Object.defineProperties;
|
|
2020
2033
|
var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
|
|
2021
|
-
var __getOwnPropSymbols$
|
|
2022
|
-
var __hasOwnProp$
|
|
2023
|
-
var __propIsEnum$
|
|
2024
|
-
var __defNormalProp$
|
|
2025
|
-
var __spreadValues$
|
|
2034
|
+
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
2035
|
+
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
2036
|
+
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
2037
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2038
|
+
var __spreadValues$k = (a, b) => {
|
|
2026
2039
|
for (var prop in b || (b = {}))
|
|
2027
|
-
if (__hasOwnProp$
|
|
2028
|
-
__defNormalProp$
|
|
2029
|
-
if (__getOwnPropSymbols$
|
|
2030
|
-
for (var prop of __getOwnPropSymbols$
|
|
2031
|
-
if (__propIsEnum$
|
|
2032
|
-
__defNormalProp$
|
|
2040
|
+
if (__hasOwnProp$l.call(b, prop))
|
|
2041
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
2042
|
+
if (__getOwnPropSymbols$l)
|
|
2043
|
+
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
2044
|
+
if (__propIsEnum$l.call(b, prop))
|
|
2045
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
2033
2046
|
}
|
|
2034
2047
|
return a;
|
|
2035
2048
|
};
|
|
@@ -2037,42 +2050,42 @@ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
|
|
|
2037
2050
|
var __objRest$3 = (source, exclude) => {
|
|
2038
2051
|
var target = {};
|
|
2039
2052
|
for (var prop in source)
|
|
2040
|
-
if (__hasOwnProp$
|
|
2053
|
+
if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2041
2054
|
target[prop] = source[prop];
|
|
2042
|
-
if (source != null && __getOwnPropSymbols$
|
|
2043
|
-
for (var prop of __getOwnPropSymbols$
|
|
2044
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2055
|
+
if (source != null && __getOwnPropSymbols$l)
|
|
2056
|
+
for (var prop of __getOwnPropSymbols$l(source)) {
|
|
2057
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
|
|
2045
2058
|
target[prop] = source[prop];
|
|
2046
2059
|
}
|
|
2047
2060
|
return target;
|
|
2048
2061
|
};
|
|
2049
2062
|
const nullable = (type) => {
|
|
2050
|
-
return __spreadProps$f(__spreadValues$
|
|
2051
|
-
data: __spreadProps$f(__spreadValues$
|
|
2063
|
+
return __spreadProps$f(__spreadValues$k({}, type), {
|
|
2064
|
+
data: __spreadProps$f(__spreadValues$k({}, type.data), { nullable: true })
|
|
2052
2065
|
});
|
|
2053
2066
|
};
|
|
2054
2067
|
const notNullable = (type) => {
|
|
2055
2068
|
const _a = type.data, data = __objRest$3(_a, ["nullable"]);
|
|
2056
|
-
return __spreadProps$f(__spreadValues$
|
|
2069
|
+
return __spreadProps$f(__spreadValues$k({}, type), {
|
|
2057
2070
|
data
|
|
2058
2071
|
});
|
|
2059
2072
|
};
|
|
2060
2073
|
|
|
2061
|
-
var __defProp$
|
|
2074
|
+
var __defProp$j = Object.defineProperty;
|
|
2062
2075
|
var __defProps$e = Object.defineProperties;
|
|
2063
2076
|
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
2064
|
-
var __getOwnPropSymbols$
|
|
2065
|
-
var __hasOwnProp$
|
|
2066
|
-
var __propIsEnum$
|
|
2067
|
-
var __defNormalProp$
|
|
2068
|
-
var __spreadValues$
|
|
2077
|
+
var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
|
|
2078
|
+
var __hasOwnProp$k = Object.prototype.hasOwnProperty;
|
|
2079
|
+
var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
|
|
2080
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2081
|
+
var __spreadValues$j = (a, b) => {
|
|
2069
2082
|
for (var prop in b || (b = {}))
|
|
2070
|
-
if (__hasOwnProp$
|
|
2071
|
-
__defNormalProp$
|
|
2072
|
-
if (__getOwnPropSymbols$
|
|
2073
|
-
for (var prop of __getOwnPropSymbols$
|
|
2074
|
-
if (__propIsEnum$
|
|
2075
|
-
__defNormalProp$
|
|
2083
|
+
if (__hasOwnProp$k.call(b, prop))
|
|
2084
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2085
|
+
if (__getOwnPropSymbols$k)
|
|
2086
|
+
for (var prop of __getOwnPropSymbols$k(b)) {
|
|
2087
|
+
if (__propIsEnum$k.call(b, prop))
|
|
2088
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2076
2089
|
}
|
|
2077
2090
|
return a;
|
|
2078
2091
|
};
|
|
@@ -2080,23 +2093,23 @@ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
|
2080
2093
|
var __objRest$2 = (source, exclude) => {
|
|
2081
2094
|
var target = {};
|
|
2082
2095
|
for (var prop in source)
|
|
2083
|
-
if (__hasOwnProp$
|
|
2096
|
+
if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2084
2097
|
target[prop] = source[prop];
|
|
2085
|
-
if (source != null && __getOwnPropSymbols$
|
|
2086
|
-
for (var prop of __getOwnPropSymbols$
|
|
2087
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2098
|
+
if (source != null && __getOwnPropSymbols$k)
|
|
2099
|
+
for (var prop of __getOwnPropSymbols$k(source)) {
|
|
2100
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
|
|
2088
2101
|
target[prop] = source[prop];
|
|
2089
2102
|
}
|
|
2090
2103
|
return target;
|
|
2091
2104
|
};
|
|
2092
2105
|
const nullish = (type) => {
|
|
2093
|
-
return __spreadProps$e(__spreadValues$
|
|
2094
|
-
data: __spreadProps$e(__spreadValues$
|
|
2106
|
+
return __spreadProps$e(__spreadValues$j({}, type), {
|
|
2107
|
+
data: __spreadProps$e(__spreadValues$j({}, type.data), { nullable: true, optional: true })
|
|
2095
2108
|
});
|
|
2096
2109
|
};
|
|
2097
2110
|
const notNullish = (type) => {
|
|
2098
2111
|
const _a = type.data, data = __objRest$2(_a, ["nullable", "optional"]);
|
|
2099
|
-
return __spreadProps$e(__spreadValues$
|
|
2112
|
+
return __spreadProps$e(__spreadValues$j({}, type), {
|
|
2100
2113
|
data
|
|
2101
2114
|
});
|
|
2102
2115
|
};
|
|
@@ -2116,21 +2129,21 @@ const union = (types) => {
|
|
|
2116
2129
|
});
|
|
2117
2130
|
};
|
|
2118
2131
|
|
|
2119
|
-
var __defProp$
|
|
2132
|
+
var __defProp$i = Object.defineProperty;
|
|
2120
2133
|
var __defProps$d = Object.defineProperties;
|
|
2121
2134
|
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
2122
|
-
var __getOwnPropSymbols$
|
|
2123
|
-
var __hasOwnProp$
|
|
2124
|
-
var __propIsEnum$
|
|
2125
|
-
var __defNormalProp$
|
|
2126
|
-
var __spreadValues$
|
|
2135
|
+
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
2136
|
+
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
2137
|
+
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
2138
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2139
|
+
var __spreadValues$i = (a, b) => {
|
|
2127
2140
|
for (var prop in b || (b = {}))
|
|
2128
|
-
if (__hasOwnProp$
|
|
2129
|
-
__defNormalProp$
|
|
2130
|
-
if (__getOwnPropSymbols$
|
|
2131
|
-
for (var prop of __getOwnPropSymbols$
|
|
2132
|
-
if (__propIsEnum$
|
|
2133
|
-
__defNormalProp$
|
|
2141
|
+
if (__hasOwnProp$j.call(b, prop))
|
|
2142
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2143
|
+
if (__getOwnPropSymbols$j)
|
|
2144
|
+
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
2145
|
+
if (__propIsEnum$j.call(b, prop))
|
|
2146
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2134
2147
|
}
|
|
2135
2148
|
return a;
|
|
2136
2149
|
};
|
|
@@ -2162,22 +2175,22 @@ const baseTypeMethods = {
|
|
|
2162
2175
|
return this;
|
|
2163
2176
|
},
|
|
2164
2177
|
transform(fn) {
|
|
2165
|
-
return __spreadProps$d(__spreadValues$
|
|
2178
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2166
2179
|
chain: [...this.chain, ["transform", fn]]
|
|
2167
2180
|
});
|
|
2168
2181
|
},
|
|
2169
2182
|
to(fn, type) {
|
|
2170
|
-
return __spreadProps$d(__spreadValues$
|
|
2183
|
+
return __spreadProps$d(__spreadValues$i({}, type), {
|
|
2171
2184
|
chain: [...this.chain, ["to", fn, type], ...type.chain]
|
|
2172
2185
|
});
|
|
2173
2186
|
},
|
|
2174
2187
|
refine(check) {
|
|
2175
|
-
return __spreadProps$d(__spreadValues$
|
|
2188
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2176
2189
|
chain: [...this.chain, ["refine", check]]
|
|
2177
2190
|
});
|
|
2178
2191
|
},
|
|
2179
2192
|
superRefine(check) {
|
|
2180
|
-
return __spreadProps$d(__spreadValues$
|
|
2193
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2181
2194
|
chain: [...this.chain, ["superRefine", check]]
|
|
2182
2195
|
});
|
|
2183
2196
|
},
|
|
@@ -2190,7 +2203,7 @@ const baseTypeMethods = {
|
|
|
2190
2203
|
},
|
|
2191
2204
|
default(value) {
|
|
2192
2205
|
const cloned = Object.create(this);
|
|
2193
|
-
cloned.data = __spreadProps$d(__spreadValues$
|
|
2206
|
+
cloned.data = __spreadProps$d(__spreadValues$i({}, cloned.data), { default: value });
|
|
2194
2207
|
return cloned;
|
|
2195
2208
|
},
|
|
2196
2209
|
array() {
|
|
@@ -2198,34 +2211,34 @@ const baseTypeMethods = {
|
|
|
2198
2211
|
}
|
|
2199
2212
|
};
|
|
2200
2213
|
const constructType = (type) => {
|
|
2201
|
-
return __spreadValues$
|
|
2214
|
+
return __spreadValues$i(__spreadValues$i({}, baseTypeMethods), type);
|
|
2202
2215
|
};
|
|
2203
2216
|
|
|
2204
|
-
var __defProp$
|
|
2217
|
+
var __defProp$h = Object.defineProperty;
|
|
2205
2218
|
var __defProps$c = Object.defineProperties;
|
|
2206
2219
|
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
2207
|
-
var __getOwnPropSymbols$
|
|
2208
|
-
var __hasOwnProp$
|
|
2209
|
-
var __propIsEnum$
|
|
2210
|
-
var __defNormalProp$
|
|
2211
|
-
var __spreadValues$
|
|
2220
|
+
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
2221
|
+
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
2222
|
+
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
2223
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2224
|
+
var __spreadValues$h = (a, b) => {
|
|
2212
2225
|
for (var prop in b || (b = {}))
|
|
2213
|
-
if (__hasOwnProp$
|
|
2214
|
-
__defNormalProp$
|
|
2215
|
-
if (__getOwnPropSymbols$
|
|
2216
|
-
for (var prop of __getOwnPropSymbols$
|
|
2217
|
-
if (__propIsEnum$
|
|
2218
|
-
__defNormalProp$
|
|
2226
|
+
if (__hasOwnProp$i.call(b, prop))
|
|
2227
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2228
|
+
if (__getOwnPropSymbols$i)
|
|
2229
|
+
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
2230
|
+
if (__propIsEnum$i.call(b, prop))
|
|
2231
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2219
2232
|
}
|
|
2220
2233
|
return a;
|
|
2221
2234
|
};
|
|
2222
2235
|
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
2223
2236
|
const array = (element) => {
|
|
2224
|
-
return constructType(__spreadValues$
|
|
2237
|
+
return constructType(__spreadValues$h({
|
|
2225
2238
|
dataType: "array",
|
|
2226
2239
|
element,
|
|
2227
2240
|
deepPartial() {
|
|
2228
|
-
return __spreadProps$c(__spreadValues$
|
|
2241
|
+
return __spreadProps$c(__spreadValues$h({}, this), {
|
|
2229
2242
|
element: this.element.deepPartial()
|
|
2230
2243
|
});
|
|
2231
2244
|
},
|
|
@@ -2235,21 +2248,21 @@ const array = (element) => {
|
|
|
2235
2248
|
}, arrayMethods));
|
|
2236
2249
|
};
|
|
2237
2250
|
|
|
2238
|
-
var __defProp$
|
|
2251
|
+
var __defProp$g = Object.defineProperty;
|
|
2239
2252
|
var __defProps$b = Object.defineProperties;
|
|
2240
2253
|
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
2241
|
-
var __getOwnPropSymbols$
|
|
2242
|
-
var __hasOwnProp$
|
|
2243
|
-
var __propIsEnum$
|
|
2244
|
-
var __defNormalProp$
|
|
2245
|
-
var __spreadValues$
|
|
2254
|
+
var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
|
|
2255
|
+
var __hasOwnProp$h = Object.prototype.hasOwnProperty;
|
|
2256
|
+
var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
|
|
2257
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2258
|
+
var __spreadValues$g = (a, b) => {
|
|
2246
2259
|
for (var prop in b || (b = {}))
|
|
2247
|
-
if (__hasOwnProp$
|
|
2248
|
-
__defNormalProp$
|
|
2249
|
-
if (__getOwnPropSymbols$
|
|
2250
|
-
for (var prop of __getOwnPropSymbols$
|
|
2251
|
-
if (__propIsEnum$
|
|
2252
|
-
__defNormalProp$
|
|
2260
|
+
if (__hasOwnProp$h.call(b, prop))
|
|
2261
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
2262
|
+
if (__getOwnPropSymbols$h)
|
|
2263
|
+
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
2264
|
+
if (__propIsEnum$h.call(b, prop))
|
|
2265
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
2253
2266
|
}
|
|
2254
2267
|
return a;
|
|
2255
2268
|
};
|
|
@@ -2273,7 +2286,7 @@ const discriminatedUnion = (discriminator, options) => {
|
|
|
2273
2286
|
partial.shape[discriminator] = option.shape[discriminator];
|
|
2274
2287
|
newOptionsMap.set(key, partial);
|
|
2275
2288
|
});
|
|
2276
|
-
return __spreadProps$b(__spreadValues$
|
|
2289
|
+
return __spreadProps$b(__spreadValues$g({}, this), {
|
|
2277
2290
|
options: newOptionsMap
|
|
2278
2291
|
});
|
|
2279
2292
|
}
|
|
@@ -2302,21 +2315,21 @@ const instanceOf = (cls) => {
|
|
|
2302
2315
|
});
|
|
2303
2316
|
};
|
|
2304
2317
|
|
|
2305
|
-
var __defProp$
|
|
2318
|
+
var __defProp$f = Object.defineProperty;
|
|
2306
2319
|
var __defProps$a = Object.defineProperties;
|
|
2307
2320
|
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
2308
|
-
var __getOwnPropSymbols$
|
|
2309
|
-
var __hasOwnProp$
|
|
2310
|
-
var __propIsEnum$
|
|
2311
|
-
var __defNormalProp$
|
|
2312
|
-
var __spreadValues$
|
|
2321
|
+
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
2322
|
+
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
2323
|
+
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
2324
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2325
|
+
var __spreadValues$f = (a, b) => {
|
|
2313
2326
|
for (var prop in b || (b = {}))
|
|
2314
|
-
if (__hasOwnProp$
|
|
2315
|
-
__defNormalProp$
|
|
2316
|
-
if (__getOwnPropSymbols$
|
|
2317
|
-
for (var prop of __getOwnPropSymbols$
|
|
2318
|
-
if (__propIsEnum$
|
|
2319
|
-
__defNormalProp$
|
|
2327
|
+
if (__hasOwnProp$g.call(b, prop))
|
|
2328
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
2329
|
+
if (__getOwnPropSymbols$g)
|
|
2330
|
+
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
2331
|
+
if (__propIsEnum$g.call(b, prop))
|
|
2332
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
2320
2333
|
}
|
|
2321
2334
|
return a;
|
|
2322
2335
|
};
|
|
@@ -2328,7 +2341,7 @@ const lazy = (fn) => {
|
|
|
2328
2341
|
return this.typeCache || (this.typeCache = fn());
|
|
2329
2342
|
},
|
|
2330
2343
|
deepPartial() {
|
|
2331
|
-
return __spreadProps$a(__spreadValues$
|
|
2344
|
+
return __spreadProps$a(__spreadValues$f({}, this), {
|
|
2332
2345
|
typeCache: void 0,
|
|
2333
2346
|
getter: () => this.getter().deepPartial()
|
|
2334
2347
|
});
|
|
@@ -2341,21 +2354,21 @@ const literal = (value) => constructType({
|
|
|
2341
2354
|
value
|
|
2342
2355
|
});
|
|
2343
2356
|
|
|
2344
|
-
var __defProp$
|
|
2357
|
+
var __defProp$e = Object.defineProperty;
|
|
2345
2358
|
var __defProps$9 = Object.defineProperties;
|
|
2346
2359
|
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
2347
|
-
var __getOwnPropSymbols$
|
|
2348
|
-
var __hasOwnProp$
|
|
2349
|
-
var __propIsEnum$
|
|
2350
|
-
var __defNormalProp$
|
|
2351
|
-
var __spreadValues$
|
|
2360
|
+
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
2361
|
+
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
2362
|
+
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
2363
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2364
|
+
var __spreadValues$e = (a, b) => {
|
|
2352
2365
|
for (var prop in b || (b = {}))
|
|
2353
|
-
if (__hasOwnProp$
|
|
2354
|
-
__defNormalProp$
|
|
2355
|
-
if (__getOwnPropSymbols$
|
|
2356
|
-
for (var prop of __getOwnPropSymbols$
|
|
2357
|
-
if (__propIsEnum$
|
|
2358
|
-
__defNormalProp$
|
|
2366
|
+
if (__hasOwnProp$f.call(b, prop))
|
|
2367
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
2368
|
+
if (__getOwnPropSymbols$f)
|
|
2369
|
+
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
2370
|
+
if (__propIsEnum$f.call(b, prop))
|
|
2371
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
2359
2372
|
}
|
|
2360
2373
|
return a;
|
|
2361
2374
|
};
|
|
@@ -2366,7 +2379,7 @@ const map = (keyType, valueType) => {
|
|
|
2366
2379
|
keyType,
|
|
2367
2380
|
valueType,
|
|
2368
2381
|
deepPartial() {
|
|
2369
|
-
return __spreadProps$9(__spreadValues$
|
|
2382
|
+
return __spreadProps$9(__spreadValues$e({}, this), {
|
|
2370
2383
|
keyType: this.keyType.deepPartial(),
|
|
2371
2384
|
valueType: this.valueType.deepPartial()
|
|
2372
2385
|
});
|
|
@@ -2392,21 +2405,21 @@ const nativeEnum = (givenEnum) => {
|
|
|
2392
2405
|
});
|
|
2393
2406
|
};
|
|
2394
2407
|
|
|
2395
|
-
var __defProp$
|
|
2408
|
+
var __defProp$d = Object.defineProperty;
|
|
2396
2409
|
var __defProps$8 = Object.defineProperties;
|
|
2397
2410
|
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
2398
|
-
var __getOwnPropSymbols$
|
|
2399
|
-
var __hasOwnProp$
|
|
2400
|
-
var __propIsEnum$
|
|
2401
|
-
var __defNormalProp$
|
|
2402
|
-
var __spreadValues$
|
|
2411
|
+
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
2412
|
+
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
2413
|
+
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
2414
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2415
|
+
var __spreadValues$d = (a, b) => {
|
|
2403
2416
|
for (var prop in b || (b = {}))
|
|
2404
|
-
if (__hasOwnProp$
|
|
2405
|
-
__defNormalProp$
|
|
2406
|
-
if (__getOwnPropSymbols$
|
|
2407
|
-
for (var prop of __getOwnPropSymbols$
|
|
2408
|
-
if (__propIsEnum$
|
|
2409
|
-
__defNormalProp$
|
|
2417
|
+
if (__hasOwnProp$e.call(b, prop))
|
|
2418
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
2419
|
+
if (__getOwnPropSymbols$e)
|
|
2420
|
+
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
2421
|
+
if (__propIsEnum$e.call(b, prop))
|
|
2422
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
2410
2423
|
}
|
|
2411
2424
|
return a;
|
|
2412
2425
|
};
|
|
@@ -2419,12 +2432,12 @@ const object = (shape) => {
|
|
|
2419
2432
|
catchAllType: void 0,
|
|
2420
2433
|
extend(add) {
|
|
2421
2434
|
return object(
|
|
2422
|
-
Object.assign(__spreadValues$
|
|
2435
|
+
Object.assign(__spreadValues$d({}, this.shape), add)
|
|
2423
2436
|
);
|
|
2424
2437
|
},
|
|
2425
2438
|
merge(obj) {
|
|
2426
2439
|
return object(
|
|
2427
|
-
Object.assign(__spreadValues$
|
|
2440
|
+
Object.assign(__spreadValues$d({}, this.shape), obj.shape)
|
|
2428
2441
|
);
|
|
2429
2442
|
},
|
|
2430
2443
|
pick(...arr) {
|
|
@@ -2442,7 +2455,7 @@ const object = (shape) => {
|
|
|
2442
2455
|
return object(picked);
|
|
2443
2456
|
},
|
|
2444
2457
|
partial(...arr) {
|
|
2445
|
-
const mapped = __spreadValues$
|
|
2458
|
+
const mapped = __spreadValues$d({}, this.shape);
|
|
2446
2459
|
if (arr.length) {
|
|
2447
2460
|
arr.forEach((key) => {
|
|
2448
2461
|
mapped[key] = mapped[key].optional();
|
|
@@ -2459,48 +2472,48 @@ const object = (shape) => {
|
|
|
2459
2472
|
for (const key in this.shape) {
|
|
2460
2473
|
newShape[key] = optional(this.shape[key].deepPartial());
|
|
2461
2474
|
}
|
|
2462
|
-
return __spreadProps$8(__spreadValues$
|
|
2475
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2463
2476
|
shape: newShape
|
|
2464
2477
|
});
|
|
2465
2478
|
},
|
|
2466
2479
|
passthrough() {
|
|
2467
|
-
return __spreadProps$8(__spreadValues$
|
|
2480
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2468
2481
|
unknownKeys: "passthrough"
|
|
2469
2482
|
});
|
|
2470
2483
|
},
|
|
2471
2484
|
strict() {
|
|
2472
|
-
return __spreadProps$8(__spreadValues$
|
|
2485
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2473
2486
|
unknownKeys: "strict"
|
|
2474
2487
|
});
|
|
2475
2488
|
},
|
|
2476
2489
|
strip() {
|
|
2477
|
-
return __spreadProps$8(__spreadValues$
|
|
2490
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2478
2491
|
unknownKeys: "strip"
|
|
2479
2492
|
});
|
|
2480
2493
|
},
|
|
2481
2494
|
catchAll(type) {
|
|
2482
|
-
return __spreadProps$8(__spreadValues$
|
|
2495
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2483
2496
|
catchAllType: type
|
|
2484
2497
|
});
|
|
2485
2498
|
}
|
|
2486
2499
|
});
|
|
2487
2500
|
};
|
|
2488
2501
|
|
|
2489
|
-
var __defProp$
|
|
2502
|
+
var __defProp$c = Object.defineProperty;
|
|
2490
2503
|
var __defProps$7 = Object.defineProperties;
|
|
2491
2504
|
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
2492
|
-
var __getOwnPropSymbols$
|
|
2493
|
-
var __hasOwnProp$
|
|
2494
|
-
var __propIsEnum$
|
|
2495
|
-
var __defNormalProp$
|
|
2496
|
-
var __spreadValues$
|
|
2505
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
2506
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
2507
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
2508
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2509
|
+
var __spreadValues$c = (a, b) => {
|
|
2497
2510
|
for (var prop in b || (b = {}))
|
|
2498
|
-
if (__hasOwnProp$
|
|
2499
|
-
__defNormalProp$
|
|
2500
|
-
if (__getOwnPropSymbols$
|
|
2501
|
-
for (var prop of __getOwnPropSymbols$
|
|
2502
|
-
if (__propIsEnum$
|
|
2503
|
-
__defNormalProp$
|
|
2511
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
2512
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
2513
|
+
if (__getOwnPropSymbols$d)
|
|
2514
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
2515
|
+
if (__propIsEnum$d.call(b, prop))
|
|
2516
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
2504
2517
|
}
|
|
2505
2518
|
return a;
|
|
2506
2519
|
};
|
|
@@ -2510,7 +2523,7 @@ const any = () => {
|
|
|
2510
2523
|
dataType: "any"
|
|
2511
2524
|
});
|
|
2512
2525
|
};
|
|
2513
|
-
const bigIntMethods = __spreadValues$
|
|
2526
|
+
const bigIntMethods = __spreadValues$c({
|
|
2514
2527
|
dataType: "bigint"
|
|
2515
2528
|
}, numberTypeMethods);
|
|
2516
2529
|
const bigint = () => {
|
|
@@ -2536,19 +2549,19 @@ const nullType = () => {
|
|
|
2536
2549
|
dataType: "null"
|
|
2537
2550
|
});
|
|
2538
2551
|
};
|
|
2539
|
-
const numberMethods = __spreadProps$7(__spreadValues$
|
|
2552
|
+
const numberMethods = __spreadProps$7(__spreadValues$c({}, numberTypeMethods), {
|
|
2540
2553
|
dataType: "number"
|
|
2541
2554
|
});
|
|
2542
2555
|
const number = () => {
|
|
2543
2556
|
return constructType(numberMethods);
|
|
2544
2557
|
};
|
|
2545
|
-
const dateMethods = __spreadProps$7(__spreadValues$
|
|
2558
|
+
const dateMethods = __spreadProps$7(__spreadValues$c({}, dateTypeMethods), {
|
|
2546
2559
|
dataType: "date"
|
|
2547
2560
|
});
|
|
2548
2561
|
const date = () => {
|
|
2549
2562
|
return constructType(dateMethods);
|
|
2550
2563
|
};
|
|
2551
|
-
const stringMethods = __spreadProps$7(__spreadValues$
|
|
2564
|
+
const stringMethods = __spreadProps$7(__spreadValues$c({}, stringTypeMethods()), {
|
|
2552
2565
|
dataType: "string"
|
|
2553
2566
|
});
|
|
2554
2567
|
const string = () => {
|
|
@@ -2584,21 +2597,21 @@ const scalarTypes = {
|
|
|
2584
2597
|
void: voidType
|
|
2585
2598
|
};
|
|
2586
2599
|
|
|
2587
|
-
var __defProp$
|
|
2600
|
+
var __defProp$b = Object.defineProperty;
|
|
2588
2601
|
var __defProps$6 = Object.defineProperties;
|
|
2589
2602
|
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
2590
|
-
var __getOwnPropSymbols$
|
|
2591
|
-
var __hasOwnProp$
|
|
2592
|
-
var __propIsEnum$
|
|
2593
|
-
var __defNormalProp$
|
|
2594
|
-
var __spreadValues$
|
|
2603
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
2604
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
2605
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
2606
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2607
|
+
var __spreadValues$b = (a, b) => {
|
|
2595
2608
|
for (var prop in b || (b = {}))
|
|
2596
|
-
if (__hasOwnProp$
|
|
2597
|
-
__defNormalProp$
|
|
2598
|
-
if (__getOwnPropSymbols$
|
|
2599
|
-
for (var prop of __getOwnPropSymbols$
|
|
2600
|
-
if (__propIsEnum$
|
|
2601
|
-
__defNormalProp$
|
|
2609
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
2610
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
2611
|
+
if (__getOwnPropSymbols$c)
|
|
2612
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
2613
|
+
if (__propIsEnum$c.call(b, prop))
|
|
2614
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
2602
2615
|
}
|
|
2603
2616
|
return a;
|
|
2604
2617
|
};
|
|
@@ -2610,38 +2623,38 @@ function record(...args) {
|
|
|
2610
2623
|
keyType,
|
|
2611
2624
|
valueType,
|
|
2612
2625
|
deepPartial() {
|
|
2613
|
-
return __spreadProps$6(__spreadValues$
|
|
2626
|
+
return __spreadProps$6(__spreadValues$b({}, this), {
|
|
2614
2627
|
valueType: this.valueType.deepPartial()
|
|
2615
2628
|
});
|
|
2616
2629
|
}
|
|
2617
2630
|
});
|
|
2618
2631
|
}
|
|
2619
2632
|
|
|
2620
|
-
var __defProp$
|
|
2633
|
+
var __defProp$a = Object.defineProperty;
|
|
2621
2634
|
var __defProps$5 = Object.defineProperties;
|
|
2622
2635
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
2623
|
-
var __getOwnPropSymbols$
|
|
2624
|
-
var __hasOwnProp$
|
|
2625
|
-
var __propIsEnum$
|
|
2626
|
-
var __defNormalProp$
|
|
2627
|
-
var __spreadValues$
|
|
2636
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
2637
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
2638
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
2639
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2640
|
+
var __spreadValues$a = (a, b) => {
|
|
2628
2641
|
for (var prop in b || (b = {}))
|
|
2629
|
-
if (__hasOwnProp$
|
|
2630
|
-
__defNormalProp$
|
|
2631
|
-
if (__getOwnPropSymbols$
|
|
2632
|
-
for (var prop of __getOwnPropSymbols$
|
|
2633
|
-
if (__propIsEnum$
|
|
2634
|
-
__defNormalProp$
|
|
2642
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
2643
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
2644
|
+
if (__getOwnPropSymbols$b)
|
|
2645
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
2646
|
+
if (__propIsEnum$b.call(b, prop))
|
|
2647
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
2635
2648
|
}
|
|
2636
2649
|
return a;
|
|
2637
2650
|
};
|
|
2638
2651
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
2639
2652
|
const set = (valueType) => {
|
|
2640
|
-
return constructType(__spreadValues$
|
|
2653
|
+
return constructType(__spreadValues$a({
|
|
2641
2654
|
dataType: "set",
|
|
2642
2655
|
valueType,
|
|
2643
2656
|
deepPartial() {
|
|
2644
|
-
return __spreadProps$5(__spreadValues$
|
|
2657
|
+
return __spreadProps$5(__spreadValues$a({}, this), {
|
|
2645
2658
|
valueType: this.valueType.deepPartial()
|
|
2646
2659
|
});
|
|
2647
2660
|
},
|
|
@@ -2651,21 +2664,21 @@ const set = (valueType) => {
|
|
|
2651
2664
|
}, setMethods));
|
|
2652
2665
|
};
|
|
2653
2666
|
|
|
2654
|
-
var __defProp$
|
|
2667
|
+
var __defProp$9 = Object.defineProperty;
|
|
2655
2668
|
var __defProps$4 = Object.defineProperties;
|
|
2656
2669
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
2657
|
-
var __getOwnPropSymbols$
|
|
2658
|
-
var __hasOwnProp$
|
|
2659
|
-
var __propIsEnum$
|
|
2660
|
-
var __defNormalProp$
|
|
2661
|
-
var __spreadValues$
|
|
2670
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
2671
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
2672
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
2673
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2674
|
+
var __spreadValues$9 = (a, b) => {
|
|
2662
2675
|
for (var prop in b || (b = {}))
|
|
2663
|
-
if (__hasOwnProp$
|
|
2664
|
-
__defNormalProp$
|
|
2665
|
-
if (__getOwnPropSymbols$
|
|
2666
|
-
for (var prop of __getOwnPropSymbols$
|
|
2667
|
-
if (__propIsEnum$
|
|
2668
|
-
__defNormalProp$
|
|
2676
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
2677
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
2678
|
+
if (__getOwnPropSymbols$a)
|
|
2679
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
2680
|
+
if (__propIsEnum$a.call(b, prop))
|
|
2681
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
2669
2682
|
}
|
|
2670
2683
|
return a;
|
|
2671
2684
|
};
|
|
@@ -2676,38 +2689,38 @@ const tuple = (items, rest = null) => {
|
|
|
2676
2689
|
items,
|
|
2677
2690
|
restType: rest,
|
|
2678
2691
|
rest(rest2) {
|
|
2679
|
-
return __spreadProps$4(__spreadValues$
|
|
2692
|
+
return __spreadProps$4(__spreadValues$9({}, this), {
|
|
2680
2693
|
restType: rest2
|
|
2681
2694
|
});
|
|
2682
2695
|
},
|
|
2683
2696
|
deepPartial() {
|
|
2684
|
-
return __spreadProps$4(__spreadValues$
|
|
2697
|
+
return __spreadProps$4(__spreadValues$9({}, this), {
|
|
2685
2698
|
items: this.items.map((item) => item.deepPartial())
|
|
2686
2699
|
});
|
|
2687
2700
|
}
|
|
2688
2701
|
});
|
|
2689
2702
|
};
|
|
2690
2703
|
|
|
2691
|
-
var __defProp$
|
|
2704
|
+
var __defProp$8 = Object.defineProperty;
|
|
2692
2705
|
var __defProps$3 = Object.defineProperties;
|
|
2693
2706
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
2694
|
-
var __getOwnPropSymbols$
|
|
2695
|
-
var __hasOwnProp$
|
|
2696
|
-
var __propIsEnum$
|
|
2697
|
-
var __defNormalProp$
|
|
2698
|
-
var __spreadValues$
|
|
2707
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
2708
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
2709
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
2710
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2711
|
+
var __spreadValues$8 = (a, b) => {
|
|
2699
2712
|
for (var prop in b || (b = {}))
|
|
2700
|
-
if (__hasOwnProp$
|
|
2701
|
-
__defNormalProp$
|
|
2702
|
-
if (__getOwnPropSymbols$
|
|
2703
|
-
for (var prop of __getOwnPropSymbols$
|
|
2704
|
-
if (__propIsEnum$
|
|
2705
|
-
__defNormalProp$
|
|
2713
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
2714
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
2715
|
+
if (__getOwnPropSymbols$9)
|
|
2716
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
2717
|
+
if (__propIsEnum$9.call(b, prop))
|
|
2718
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
2706
2719
|
}
|
|
2707
2720
|
return a;
|
|
2708
2721
|
};
|
|
2709
2722
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
2710
|
-
const jsonTypes = __spreadProps$3(__spreadValues$
|
|
2723
|
+
const jsonTypes = __spreadProps$3(__spreadValues$8({
|
|
2711
2724
|
array,
|
|
2712
2725
|
discriminatedUnion,
|
|
2713
2726
|
enum: enumType,
|
|
@@ -2862,21 +2875,21 @@ const checkIfDataHasUpdatedAt = (data) => {
|
|
|
2862
2875
|
});
|
|
2863
2876
|
};
|
|
2864
2877
|
|
|
2865
|
-
var __defProp$
|
|
2878
|
+
var __defProp$7 = Object.defineProperty;
|
|
2866
2879
|
var __defProps$2 = Object.defineProperties;
|
|
2867
2880
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2868
|
-
var __getOwnPropSymbols$
|
|
2869
|
-
var __hasOwnProp$
|
|
2870
|
-
var __propIsEnum$
|
|
2871
|
-
var __defNormalProp$
|
|
2872
|
-
var __spreadValues$
|
|
2881
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
2882
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
2883
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
2884
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2885
|
+
var __spreadValues$7 = (a, b) => {
|
|
2873
2886
|
for (var prop in b || (b = {}))
|
|
2874
|
-
if (__hasOwnProp$
|
|
2875
|
-
__defNormalProp$
|
|
2876
|
-
if (__getOwnPropSymbols$
|
|
2877
|
-
for (var prop of __getOwnPropSymbols$
|
|
2878
|
-
if (__propIsEnum$
|
|
2879
|
-
__defNormalProp$
|
|
2887
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
2888
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
2889
|
+
if (__getOwnPropSymbols$8)
|
|
2890
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
2891
|
+
if (__propIsEnum$8.call(b, prop))
|
|
2892
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
2880
2893
|
}
|
|
2881
2894
|
return a;
|
|
2882
2895
|
};
|
|
@@ -2959,7 +2972,7 @@ const columnTypes = {
|
|
|
2959
2972
|
columns: toArray(columns).map(
|
|
2960
2973
|
(column) => typeof column === "string" ? { column } : column
|
|
2961
2974
|
),
|
|
2962
|
-
options: __spreadProps$2(__spreadValues$
|
|
2975
|
+
options: __spreadProps$2(__spreadValues$7({}, options), { unique: true })
|
|
2963
2976
|
};
|
|
2964
2977
|
tableData.indexes.push(index);
|
|
2965
2978
|
return emptyObject;
|
|
@@ -2995,26 +3008,18 @@ class ArrayOfColumnsObjects extends ColumnType {
|
|
|
2995
3008
|
}
|
|
2996
3009
|
class PluckResultColumnType extends ColumnType {
|
|
2997
3010
|
}
|
|
2998
|
-
class TableSchema {
|
|
2999
|
-
constructor(shape) {
|
|
3000
|
-
this.shape = shape;
|
|
3001
|
-
this.primaryKeys = Object.entries(this.shape).filter(([, column]) => {
|
|
3002
|
-
return column.isPrimaryKey;
|
|
3003
|
-
}).map(([key]) => key);
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
3011
|
|
|
3007
|
-
var __getOwnPropSymbols$
|
|
3008
|
-
var __hasOwnProp$
|
|
3009
|
-
var __propIsEnum$
|
|
3012
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
3013
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
3014
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
3010
3015
|
var __objRest$1 = (source, exclude) => {
|
|
3011
3016
|
var target = {};
|
|
3012
3017
|
for (var prop in source)
|
|
3013
|
-
if (__hasOwnProp$
|
|
3018
|
+
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3014
3019
|
target[prop] = source[prop];
|
|
3015
|
-
if (source != null && __getOwnPropSymbols$
|
|
3016
|
-
for (var prop of __getOwnPropSymbols$
|
|
3017
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
3020
|
+
if (source != null && __getOwnPropSymbols$7)
|
|
3021
|
+
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
3022
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
3018
3023
|
target[prop] = source[prop];
|
|
3019
3024
|
}
|
|
3020
3025
|
return target;
|
|
@@ -3119,11 +3124,6 @@ class TransactionAdapter {
|
|
|
3119
3124
|
}
|
|
3120
3125
|
}
|
|
3121
3126
|
|
|
3122
|
-
const removeFromQuery = (q, key) => {
|
|
3123
|
-
if (q.query)
|
|
3124
|
-
delete q.query[key];
|
|
3125
|
-
return q;
|
|
3126
|
-
};
|
|
3127
3127
|
const pushQueryArray = (q, key, value) => {
|
|
3128
3128
|
if (!q.query[key])
|
|
3129
3129
|
q.query[key] = value;
|
|
@@ -3154,7 +3154,6 @@ const setQueryObjectValue = (q, object, key, value) => {
|
|
|
3154
3154
|
const getValueKey = Symbol("get");
|
|
3155
3155
|
const _get = (q, returnType, arg) => {
|
|
3156
3156
|
q.query.returnType = returnType;
|
|
3157
|
-
q.query.take = true;
|
|
3158
3157
|
if (typeof arg === "object" && isRaw(arg)) {
|
|
3159
3158
|
addParserForRawExpression(q, getValueKey, arg);
|
|
3160
3159
|
q.query.select = [arg];
|
|
@@ -3206,7 +3205,7 @@ class Then {
|
|
|
3206
3205
|
}
|
|
3207
3206
|
}
|
|
3208
3207
|
const handleResult = async (q, result) => {
|
|
3209
|
-
return parseResult(q, q.query.returnType, result);
|
|
3208
|
+
return parseResult(q, q.query.returnType || "all", result);
|
|
3210
3209
|
};
|
|
3211
3210
|
const then = async (q, resolve, reject) => {
|
|
3212
3211
|
let sql;
|
|
@@ -3233,7 +3232,7 @@ const then = async (q, resolve, reject) => {
|
|
|
3233
3232
|
if (q.query.log) {
|
|
3234
3233
|
logData = q.query.log.beforeQuery(sql);
|
|
3235
3234
|
}
|
|
3236
|
-
const queryResult = await q.query.adapter[queryMethodByReturnType[q.query.returnType]](sql);
|
|
3235
|
+
const queryResult = await q.query.adapter[queryMethodByReturnType[q.query.returnType || "all"]](sql);
|
|
3237
3236
|
if (q.query.log) {
|
|
3238
3237
|
q.query.log.afterQuery(sql, logData);
|
|
3239
3238
|
sql = void 0;
|
|
@@ -3254,7 +3253,7 @@ const then = async (q, resolve, reject) => {
|
|
|
3254
3253
|
reject == null ? void 0 : reject(error);
|
|
3255
3254
|
}
|
|
3256
3255
|
};
|
|
3257
|
-
const parseResult = (q, returnType, result) => {
|
|
3256
|
+
const parseResult = (q, returnType = "all", result) => {
|
|
3258
3257
|
var _a, _b;
|
|
3259
3258
|
switch (returnType) {
|
|
3260
3259
|
case "all": {
|
|
@@ -3361,7 +3360,7 @@ const addParserForSelectItem = (q, as, key, arg) => {
|
|
|
3361
3360
|
const rel = arg(q);
|
|
3362
3361
|
const parsers = getQueryParsers(rel);
|
|
3363
3362
|
if (parsers) {
|
|
3364
|
-
if (rel.query.
|
|
3363
|
+
if (queryTypeWithLimitOne[rel.query.returnType]) {
|
|
3365
3364
|
addParserToQuery(q.query, key, (item) => parseRecord(parsers, item));
|
|
3366
3365
|
} else {
|
|
3367
3366
|
addParserToQuery(
|
|
@@ -3467,21 +3466,21 @@ class Select {
|
|
|
3467
3466
|
}
|
|
3468
3467
|
}
|
|
3469
3468
|
|
|
3470
|
-
var __defProp$
|
|
3469
|
+
var __defProp$6 = Object.defineProperty;
|
|
3471
3470
|
var __defProps$1 = Object.defineProperties;
|
|
3472
3471
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
3473
|
-
var __getOwnPropSymbols$
|
|
3474
|
-
var __hasOwnProp$
|
|
3475
|
-
var __propIsEnum$
|
|
3476
|
-
var __defNormalProp$
|
|
3477
|
-
var __spreadValues$
|
|
3472
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
3473
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
3474
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
3475
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3476
|
+
var __spreadValues$6 = (a, b) => {
|
|
3478
3477
|
for (var prop in b || (b = {}))
|
|
3479
|
-
if (__hasOwnProp$
|
|
3480
|
-
__defNormalProp$
|
|
3481
|
-
if (__getOwnPropSymbols$
|
|
3482
|
-
for (var prop of __getOwnPropSymbols$
|
|
3483
|
-
if (__propIsEnum$
|
|
3484
|
-
__defNormalProp$
|
|
3478
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
3479
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
3480
|
+
if (__getOwnPropSymbols$6)
|
|
3481
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
3482
|
+
if (__propIsEnum$6.call(b, prop))
|
|
3483
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
3485
3484
|
}
|
|
3486
3485
|
return a;
|
|
3487
3486
|
};
|
|
@@ -3506,7 +3505,7 @@ const buildAggregateSelectItem = (functionName, arg, options) => {
|
|
|
3506
3505
|
return {
|
|
3507
3506
|
function: functionName,
|
|
3508
3507
|
arg,
|
|
3509
|
-
options: __spreadProps$1(__spreadValues$
|
|
3508
|
+
options: __spreadProps$1(__spreadValues$6({}, options), {
|
|
3510
3509
|
order: (options == null ? void 0 : options.order) ? Array.isArray(options.order) ? options.order : [options.order] : void 0,
|
|
3511
3510
|
filter: options == null ? void 0 : options.filter,
|
|
3512
3511
|
filterOr: options == null ? void 0 : options.filterOr
|
|
@@ -3521,7 +3520,6 @@ const parseIntOrNullColumn = new IntegerColumn().parse(
|
|
|
3521
3520
|
);
|
|
3522
3521
|
const get = (q) => {
|
|
3523
3522
|
q.query.returnType = "valueOrThrow";
|
|
3524
|
-
removeFromQuery(q, "take");
|
|
3525
3523
|
const select = q.query.select;
|
|
3526
3524
|
if (select.length > 1) {
|
|
3527
3525
|
select[0] = select[select.length - 1];
|
|
@@ -3844,8 +3842,8 @@ class Clear {
|
|
|
3844
3842
|
_clear(...clears) {
|
|
3845
3843
|
clears.forEach((clear) => {
|
|
3846
3844
|
if (clear === "where") {
|
|
3847
|
-
|
|
3848
|
-
|
|
3845
|
+
delete this.query.and;
|
|
3846
|
+
delete this.query.or;
|
|
3849
3847
|
} else if (clear === "counters") {
|
|
3850
3848
|
if ("type" in this.query && this.query.type === "update") {
|
|
3851
3849
|
this.query.updateData = this.query.updateData.filter((item) => {
|
|
@@ -3866,7 +3864,7 @@ class Clear {
|
|
|
3866
3864
|
});
|
|
3867
3865
|
}
|
|
3868
3866
|
} else {
|
|
3869
|
-
|
|
3867
|
+
delete this.query[clear];
|
|
3870
3868
|
}
|
|
3871
3869
|
});
|
|
3872
3870
|
return this;
|
|
@@ -4020,19 +4018,19 @@ class From {
|
|
|
4020
4018
|
}
|
|
4021
4019
|
}
|
|
4022
4020
|
|
|
4023
|
-
var __defProp$
|
|
4024
|
-
var __getOwnPropSymbols$
|
|
4025
|
-
var __hasOwnProp$
|
|
4026
|
-
var __propIsEnum$
|
|
4027
|
-
var __defNormalProp$
|
|
4028
|
-
var __spreadValues$
|
|
4021
|
+
var __defProp$5 = Object.defineProperty;
|
|
4022
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
4023
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
4024
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
4025
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4026
|
+
var __spreadValues$5 = (a, b) => {
|
|
4029
4027
|
for (var prop in b || (b = {}))
|
|
4030
|
-
if (__hasOwnProp$
|
|
4031
|
-
__defNormalProp$
|
|
4032
|
-
if (__getOwnPropSymbols$
|
|
4033
|
-
for (var prop of __getOwnPropSymbols$
|
|
4034
|
-
if (__propIsEnum$
|
|
4035
|
-
__defNormalProp$
|
|
4028
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
4029
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
4030
|
+
if (__getOwnPropSymbols$5)
|
|
4031
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
4032
|
+
if (__propIsEnum$5.call(b, prop))
|
|
4033
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
4036
4034
|
}
|
|
4037
4035
|
return a;
|
|
4038
4036
|
};
|
|
@@ -4040,15 +4038,15 @@ const processHavingArg = (arg) => {
|
|
|
4040
4038
|
if ("__model" in arg || isRaw(arg)) {
|
|
4041
4039
|
return arg;
|
|
4042
4040
|
} else {
|
|
4043
|
-
const processed = __spreadValues$
|
|
4041
|
+
const processed = __spreadValues$5({}, arg);
|
|
4044
4042
|
for (const fn in arg) {
|
|
4045
4043
|
const data = arg[fn];
|
|
4046
4044
|
if (typeof data === "object") {
|
|
4047
|
-
processed[fn] = __spreadValues$
|
|
4045
|
+
processed[fn] = __spreadValues$5({}, data);
|
|
4048
4046
|
for (const column in data) {
|
|
4049
4047
|
const value = data[column];
|
|
4050
4048
|
if (typeof value === "object") {
|
|
4051
|
-
processed[fn][column] = __spreadValues$
|
|
4049
|
+
processed[fn][column] = __spreadValues$5({}, value);
|
|
4052
4050
|
const options = value;
|
|
4053
4051
|
if ("order" in options && options.order && !Array.isArray(options.order)) {
|
|
4054
4052
|
processed[fn][column].order = [options.order];
|
|
@@ -4089,19 +4087,19 @@ class Having {
|
|
|
4089
4087
|
}
|
|
4090
4088
|
}
|
|
4091
4089
|
|
|
4092
|
-
var __defProp$
|
|
4093
|
-
var __getOwnPropSymbols$
|
|
4094
|
-
var __hasOwnProp$
|
|
4095
|
-
var __propIsEnum$
|
|
4096
|
-
var __defNormalProp$
|
|
4097
|
-
var __spreadValues$
|
|
4090
|
+
var __defProp$4 = Object.defineProperty;
|
|
4091
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
4092
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
4093
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
4094
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4095
|
+
var __spreadValues$4 = (a, b) => {
|
|
4098
4096
|
for (var prop in b || (b = {}))
|
|
4099
|
-
if (__hasOwnProp$
|
|
4100
|
-
__defNormalProp$
|
|
4101
|
-
if (__getOwnPropSymbols$
|
|
4102
|
-
for (var prop of __getOwnPropSymbols$
|
|
4103
|
-
if (__propIsEnum$
|
|
4104
|
-
__defNormalProp$
|
|
4097
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
4098
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
4099
|
+
if (__getOwnPropSymbols$4)
|
|
4100
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
4101
|
+
if (__propIsEnum$4.call(b, prop))
|
|
4102
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
4105
4103
|
}
|
|
4106
4104
|
return a;
|
|
4107
4105
|
};
|
|
@@ -4144,7 +4142,7 @@ const createInsertCtx = (q) => ({
|
|
|
4144
4142
|
relations: q.relations
|
|
4145
4143
|
});
|
|
4146
4144
|
const getInsertSingleReturnType = (q) => {
|
|
4147
|
-
const { select, returnType } = q.query;
|
|
4145
|
+
const { select, returnType = "all" } = q.query;
|
|
4148
4146
|
if (select) {
|
|
4149
4147
|
return returnType === "all" ? "one" : returnType;
|
|
4150
4148
|
} else {
|
|
@@ -4164,7 +4162,7 @@ const handleInsertOneData = (q, data, ctx) => {
|
|
|
4164
4162
|
const columnsMap = {};
|
|
4165
4163
|
const defaults = q.query.defaults;
|
|
4166
4164
|
if (defaults) {
|
|
4167
|
-
data = __spreadValues$
|
|
4165
|
+
data = __spreadValues$4(__spreadValues$4({}, defaults), data);
|
|
4168
4166
|
}
|
|
4169
4167
|
processInsertItem(data, 0, ctx, columns, columnsMap);
|
|
4170
4168
|
const values = [columns.map((key) => data[key])];
|
|
@@ -4175,7 +4173,7 @@ const handleInsertManyData = (q, data, ctx) => {
|
|
|
4175
4173
|
const columnsMap = {};
|
|
4176
4174
|
const defaults = q.query.defaults;
|
|
4177
4175
|
if (defaults) {
|
|
4178
|
-
data = data.map((item) => __spreadValues$
|
|
4176
|
+
data = data.map((item) => __spreadValues$4(__spreadValues$4({}, defaults), item));
|
|
4179
4177
|
}
|
|
4180
4178
|
data.forEach((item, i) => {
|
|
4181
4179
|
processInsertItem(item, i, ctx, columns, columnsMap);
|
|
@@ -4673,10 +4671,9 @@ class Json {
|
|
|
4673
4671
|
const q = this._wrap(this.__model.clone());
|
|
4674
4672
|
q._getOptional(
|
|
4675
4673
|
raw(
|
|
4676
|
-
this.query.
|
|
4674
|
+
queryTypeWithLimitOne[this.query.returnType] ? `row_to_json("t".*)` : `COALESCE(json_agg(row_to_json("t".*)), '[]')`
|
|
4677
4675
|
)
|
|
4678
4676
|
);
|
|
4679
|
-
delete q.query.take;
|
|
4680
4677
|
return q;
|
|
4681
4678
|
}
|
|
4682
4679
|
jsonSet(column, path, value, options) {
|
|
@@ -4827,6 +4824,60 @@ class QueryLog {
|
|
|
4827
4824
|
}
|
|
4828
4825
|
}
|
|
4829
4826
|
|
|
4827
|
+
var __defProp$3 = Object.defineProperty;
|
|
4828
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
4829
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
4830
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
4831
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4832
|
+
var __spreadValues$3 = (a, b) => {
|
|
4833
|
+
for (var prop in b || (b = {}))
|
|
4834
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
4835
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
4836
|
+
if (__getOwnPropSymbols$3)
|
|
4837
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
4838
|
+
if (__propIsEnum$3.call(b, prop))
|
|
4839
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
4840
|
+
}
|
|
4841
|
+
return a;
|
|
4842
|
+
};
|
|
4843
|
+
const mergableObjects = {
|
|
4844
|
+
withShapes: true,
|
|
4845
|
+
parsers: true,
|
|
4846
|
+
defaults: true,
|
|
4847
|
+
joinedParsers: true
|
|
4848
|
+
};
|
|
4849
|
+
class MergeQueryMethods {
|
|
4850
|
+
merge(q) {
|
|
4851
|
+
return this.clone()._merge(q);
|
|
4852
|
+
}
|
|
4853
|
+
_merge(q) {
|
|
4854
|
+
const a = this.query;
|
|
4855
|
+
const b = q.query;
|
|
4856
|
+
for (const key in b) {
|
|
4857
|
+
const value = b[key];
|
|
4858
|
+
switch (typeof value) {
|
|
4859
|
+
case "boolean":
|
|
4860
|
+
case "string":
|
|
4861
|
+
case "number":
|
|
4862
|
+
a[key] = value;
|
|
4863
|
+
break;
|
|
4864
|
+
case "object":
|
|
4865
|
+
if (Array.isArray(value)) {
|
|
4866
|
+
a[key] = a[key] ? [...a[key], ...value] : value;
|
|
4867
|
+
} else if (mergableObjects[key]) {
|
|
4868
|
+
a[key] = a[key] ? __spreadValues$3(__spreadValues$3({}, a[key]), value) : value;
|
|
4869
|
+
} else {
|
|
4870
|
+
a[key] = value;
|
|
4871
|
+
}
|
|
4872
|
+
break;
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
if (b.returnType)
|
|
4876
|
+
a.returnType = b.returnType;
|
|
4877
|
+
return this;
|
|
4878
|
+
}
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4830
4881
|
var __defProp$2 = Object.defineProperty;
|
|
4831
4882
|
var __defProps = Object.defineProperties;
|
|
4832
4883
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -4985,7 +5036,7 @@ class Update {
|
|
|
4985
5036
|
return q._update(...args);
|
|
4986
5037
|
}
|
|
4987
5038
|
_update(...args) {
|
|
4988
|
-
var _a, _b;
|
|
5039
|
+
var _a, _b, _c;
|
|
4989
5040
|
const { query } = this;
|
|
4990
5041
|
const data = args[0];
|
|
4991
5042
|
const set = __spreadValues$1({}, data);
|
|
@@ -4993,7 +5044,7 @@ class Update {
|
|
|
4993
5044
|
const relations = this.relations;
|
|
4994
5045
|
const prependRelations = {};
|
|
4995
5046
|
const appendRelations = {};
|
|
4996
|
-
const originalReturnType = query.returnType;
|
|
5047
|
+
const originalReturnType = query.returnType || "all";
|
|
4997
5048
|
for (const key in data) {
|
|
4998
5049
|
if (relations[key]) {
|
|
4999
5050
|
delete set[key];
|
|
@@ -5027,12 +5078,14 @@ class Update {
|
|
|
5027
5078
|
if ((state == null ? void 0 : state.updateLater) || appendRelationKeys.length && originalReturnType !== "all") {
|
|
5028
5079
|
query.returnType = "all";
|
|
5029
5080
|
if (state == null ? void 0 : state.updateLater) {
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5081
|
+
if (!((_c = query.select) == null ? void 0 : _c.includes("*"))) {
|
|
5082
|
+
this.primaryKeys.forEach((key) => {
|
|
5083
|
+
var _a2;
|
|
5084
|
+
if (!((_a2 = query.select) == null ? void 0 : _a2.includes(key))) {
|
|
5085
|
+
this._select(key);
|
|
5086
|
+
}
|
|
5087
|
+
});
|
|
5088
|
+
}
|
|
5036
5089
|
}
|
|
5037
5090
|
const { handleResult } = query;
|
|
5038
5091
|
query.handleResult = async (q, queryResult) => {
|
|
@@ -5040,7 +5093,7 @@ class Update {
|
|
|
5040
5093
|
if (state == null ? void 0 : state.updateLater) {
|
|
5041
5094
|
await Promise.all(state.updateLaterPromises);
|
|
5042
5095
|
const t = this.__model.clone().transacting(q);
|
|
5043
|
-
const keys = this.
|
|
5096
|
+
const keys = this.primaryKeys;
|
|
5044
5097
|
t._whereIn(
|
|
5045
5098
|
keys,
|
|
5046
5099
|
resultOfTypeAll.map((item) => keys.map((key) => item[key]))
|
|
@@ -5066,6 +5119,9 @@ class Update {
|
|
|
5066
5119
|
return (q, result) => {
|
|
5067
5120
|
var _a2, _b2;
|
|
5068
5121
|
const all = resultOfTypeAll || result;
|
|
5122
|
+
if (q.query.returnType !== originalReturnType) {
|
|
5123
|
+
q.query.returnType = originalReturnType;
|
|
5124
|
+
}
|
|
5069
5125
|
return (_b2 = (_a2 = relations[relationName]).nestedUpdate) == null ? void 0 : _b2.call(_a2, q, all, appendRelations[relationName]);
|
|
5070
5126
|
};
|
|
5071
5127
|
})
|
|
@@ -5235,7 +5291,6 @@ class QueryMethods {
|
|
|
5235
5291
|
}
|
|
5236
5292
|
_all() {
|
|
5237
5293
|
this.query.returnType = "all";
|
|
5238
|
-
removeFromQuery(this, "take");
|
|
5239
5294
|
return this;
|
|
5240
5295
|
}
|
|
5241
5296
|
take() {
|
|
@@ -5243,7 +5298,6 @@ class QueryMethods {
|
|
|
5243
5298
|
}
|
|
5244
5299
|
_take() {
|
|
5245
5300
|
this.query.returnType = "oneOrThrow";
|
|
5246
|
-
this.query.take = true;
|
|
5247
5301
|
return this;
|
|
5248
5302
|
}
|
|
5249
5303
|
takeOptional() {
|
|
@@ -5251,7 +5305,6 @@ class QueryMethods {
|
|
|
5251
5305
|
}
|
|
5252
5306
|
_takeOptional() {
|
|
5253
5307
|
this.query.returnType = "one";
|
|
5254
|
-
this.query.take = true;
|
|
5255
5308
|
return this;
|
|
5256
5309
|
}
|
|
5257
5310
|
rows() {
|
|
@@ -5259,7 +5312,6 @@ class QueryMethods {
|
|
|
5259
5312
|
}
|
|
5260
5313
|
_rows() {
|
|
5261
5314
|
this.query.returnType = "rows";
|
|
5262
|
-
removeFromQuery(this, "take");
|
|
5263
5315
|
return this;
|
|
5264
5316
|
}
|
|
5265
5317
|
pluck(select) {
|
|
@@ -5267,7 +5319,6 @@ class QueryMethods {
|
|
|
5267
5319
|
}
|
|
5268
5320
|
_pluck(select) {
|
|
5269
5321
|
this.query.returnType = "pluck";
|
|
5270
|
-
removeFromQuery(this, "take");
|
|
5271
5322
|
this.query.select = [select];
|
|
5272
5323
|
addParserForSelectItem(this, this.query.as || this.table, "pluck", select);
|
|
5273
5324
|
return this;
|
|
@@ -5277,7 +5328,6 @@ class QueryMethods {
|
|
|
5277
5328
|
}
|
|
5278
5329
|
_exec() {
|
|
5279
5330
|
this.query.returnType = "void";
|
|
5280
|
-
removeFromQuery(this, "take");
|
|
5281
5331
|
return this;
|
|
5282
5332
|
}
|
|
5283
5333
|
clone() {
|
|
@@ -5294,22 +5344,20 @@ class QueryMethods {
|
|
|
5294
5344
|
_distinct(...columns) {
|
|
5295
5345
|
return pushQueryArray(this, "distinct", columns);
|
|
5296
5346
|
}
|
|
5297
|
-
find(
|
|
5298
|
-
return this.clone()._find(
|
|
5347
|
+
find(value) {
|
|
5348
|
+
return this.clone()._find(value);
|
|
5299
5349
|
}
|
|
5300
|
-
_find(
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
});
|
|
5305
|
-
return this._where(conditions)._take();
|
|
5350
|
+
_find(value) {
|
|
5351
|
+
return this._where({
|
|
5352
|
+
[this.singlePrimaryKey]: value
|
|
5353
|
+
})._take();
|
|
5306
5354
|
}
|
|
5307
|
-
findOptional(
|
|
5308
|
-
return this.clone()._findOptional(
|
|
5355
|
+
findOptional(value) {
|
|
5356
|
+
return this.clone()._findOptional(value);
|
|
5309
5357
|
}
|
|
5310
|
-
_findOptional(
|
|
5358
|
+
_findOptional(value) {
|
|
5311
5359
|
return this._find(
|
|
5312
|
-
|
|
5360
|
+
value
|
|
5313
5361
|
).takeOptional();
|
|
5314
5362
|
}
|
|
5315
5363
|
findBy(...args) {
|
|
@@ -5386,7 +5434,6 @@ class QueryMethods {
|
|
|
5386
5434
|
const q = this._getOptional(raw("true"));
|
|
5387
5435
|
q.query.notFoundDefault = false;
|
|
5388
5436
|
q.query.coalesceValue = false;
|
|
5389
|
-
delete q.query.take;
|
|
5390
5437
|
return q;
|
|
5391
5438
|
}
|
|
5392
5439
|
truncate(options) {
|
|
@@ -5426,7 +5473,8 @@ applyMixins(QueryMethods, [
|
|
|
5426
5473
|
QueryLog,
|
|
5427
5474
|
QueryCallbacks,
|
|
5428
5475
|
QueryUpsert,
|
|
5429
|
-
QueryGet
|
|
5476
|
+
QueryGet,
|
|
5477
|
+
MergeQueryMethods
|
|
5430
5478
|
]);
|
|
5431
5479
|
|
|
5432
5480
|
var __defProp = Object.defineProperty;
|
|
@@ -5470,14 +5518,18 @@ class Db {
|
|
|
5470
5518
|
this.query = {
|
|
5471
5519
|
adapter,
|
|
5472
5520
|
handleResult,
|
|
5473
|
-
returnType: "all",
|
|
5474
5521
|
logger,
|
|
5475
5522
|
log: logParamToLogObject(logger, options.log)
|
|
5476
5523
|
};
|
|
5477
5524
|
if (options == null ? void 0 : options.schema) {
|
|
5478
5525
|
this.query.schema = options.schema;
|
|
5479
5526
|
}
|
|
5480
|
-
this.
|
|
5527
|
+
this.primaryKeys = Object.keys(shape).filter(
|
|
5528
|
+
(key) => shape[key].isPrimaryKey
|
|
5529
|
+
);
|
|
5530
|
+
if (this.primaryKeys.length === 1) {
|
|
5531
|
+
this.singlePrimaryKey = this.primaryKeys[0];
|
|
5532
|
+
}
|
|
5481
5533
|
const columns = Object.keys(
|
|
5482
5534
|
shape
|
|
5483
5535
|
);
|
|
@@ -5518,7 +5570,7 @@ const createDb = (_a) => {
|
|
|
5518
5570
|
var _b = _a, {
|
|
5519
5571
|
log,
|
|
5520
5572
|
logger,
|
|
5521
|
-
columnTypes: ct
|
|
5573
|
+
columnTypes: ct
|
|
5522
5574
|
} = _b, options = __objRest(_b, [
|
|
5523
5575
|
"log",
|
|
5524
5576
|
"logger",
|
|
@@ -5553,8 +5605,6 @@ const createDb = (_a) => {
|
|
|
5553
5605
|
return db;
|
|
5554
5606
|
};
|
|
5555
5607
|
|
|
5556
|
-
const defaultsKey = Symbol("defaults");
|
|
5557
|
-
|
|
5558
5608
|
const relationQueryKey = Symbol("relationQuery");
|
|
5559
5609
|
const isRequiredRelationKey = Symbol("isRequiredRelation");
|
|
5560
5610
|
|
|
@@ -5604,6 +5654,7 @@ exports.LineColumn = LineColumn;
|
|
|
5604
5654
|
exports.LsegColumn = LsegColumn;
|
|
5605
5655
|
exports.MacAddr8Column = MacAddr8Column;
|
|
5606
5656
|
exports.MacAddrColumn = MacAddrColumn;
|
|
5657
|
+
exports.MergeQueryMethods = MergeQueryMethods;
|
|
5607
5658
|
exports.MoneyColumn = MoneyColumn;
|
|
5608
5659
|
exports.MoreThanOneRowError = MoreThanOneRowError;
|
|
5609
5660
|
exports.NotFoundError = NotFoundError;
|
|
@@ -5628,7 +5679,6 @@ exports.Select = Select;
|
|
|
5628
5679
|
exports.SerialColumn = SerialColumn;
|
|
5629
5680
|
exports.SmallIntColumn = SmallIntColumn;
|
|
5630
5681
|
exports.SmallSerialColumn = SmallSerialColumn;
|
|
5631
|
-
exports.TableSchema = TableSchema;
|
|
5632
5682
|
exports.TextBaseColumn = TextBaseColumn;
|
|
5633
5683
|
exports.TextColumn = TextColumn;
|
|
5634
5684
|
exports.Then = Then;
|
|
@@ -5663,6 +5713,7 @@ exports.aggregate1FunctionNames = aggregate1FunctionNames;
|
|
|
5663
5713
|
exports.applyMixins = applyMixins;
|
|
5664
5714
|
exports.array = array;
|
|
5665
5715
|
exports.arrayToEnum = arrayToEnum;
|
|
5716
|
+
exports.checkIfASimpleQuery = checkIfASimpleQuery;
|
|
5666
5717
|
exports.columnTypes = columnTypes;
|
|
5667
5718
|
exports.columnUtils = utils;
|
|
5668
5719
|
exports.constructType = constructType;
|
|
@@ -5712,13 +5763,12 @@ exports.pushQueryArray = pushQueryArray;
|
|
|
5712
5763
|
exports.pushQueryOn = pushQueryOn;
|
|
5713
5764
|
exports.pushQueryOrOn = pushQueryOrOn;
|
|
5714
5765
|
exports.pushQueryValue = pushQueryValue;
|
|
5715
|
-
exports.queryKeysOfNotSimpleQuery = queryKeysOfNotSimpleQuery;
|
|
5716
5766
|
exports.queryMethodByReturnType = queryMethodByReturnType;
|
|
5767
|
+
exports.queryTypeWithLimitOne = queryTypeWithLimitOne;
|
|
5717
5768
|
exports.quote = quote;
|
|
5718
5769
|
exports.raw = raw;
|
|
5719
5770
|
exports.record = record;
|
|
5720
5771
|
exports.relationQueryKey = relationQueryKey;
|
|
5721
|
-
exports.removeFromQuery = removeFromQuery;
|
|
5722
5772
|
exports.required = required;
|
|
5723
5773
|
exports.resetTableData = resetTableData;
|
|
5724
5774
|
exports.scalarTypes = scalarTypes;
|