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.esm.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { types, Pool } from 'pg';
|
|
2
2
|
|
|
3
|
-
var __defProp$
|
|
3
|
+
var __defProp$q = Object.defineProperty;
|
|
4
4
|
var __defProps$l = Object.defineProperties;
|
|
5
5
|
var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols$
|
|
7
|
-
var __hasOwnProp$
|
|
8
|
-
var __propIsEnum$
|
|
9
|
-
var __defNormalProp$
|
|
10
|
-
var __spreadValues$
|
|
6
|
+
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues$q = (a, b) => {
|
|
11
11
|
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp$
|
|
13
|
-
__defNormalProp$
|
|
14
|
-
if (__getOwnPropSymbols$
|
|
15
|
-
for (var prop of __getOwnPropSymbols$
|
|
16
|
-
if (__propIsEnum$
|
|
17
|
-
__defNormalProp$
|
|
12
|
+
if (__hasOwnProp$r.call(b, prop))
|
|
13
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols$r)
|
|
15
|
+
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
16
|
+
if (__propIsEnum$r.call(b, prop))
|
|
17
|
+
__defNormalProp$q(a, prop, b[prop]);
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
21
|
var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
|
|
22
22
|
const addColumnData = (q, key, value) => {
|
|
23
23
|
const cloned = Object.create(q);
|
|
24
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
24
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, q.data), { [key]: value });
|
|
25
25
|
return cloned;
|
|
26
26
|
};
|
|
27
27
|
class ColumnType {
|
|
@@ -39,12 +39,12 @@ class ColumnType {
|
|
|
39
39
|
foreignKey(fnOrTable, column, options = {}) {
|
|
40
40
|
const cloned = Object.create(this);
|
|
41
41
|
if (typeof fnOrTable === "string") {
|
|
42
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
43
|
-
foreignKey: __spreadValues$
|
|
42
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, this.data), {
|
|
43
|
+
foreignKey: __spreadValues$q({ table: fnOrTable, columns: [column] }, options)
|
|
44
44
|
});
|
|
45
45
|
} else {
|
|
46
|
-
cloned.data = __spreadProps$l(__spreadValues$
|
|
47
|
-
foreignKey: __spreadValues$
|
|
46
|
+
cloned.data = __spreadProps$l(__spreadValues$q({}, this.data), {
|
|
47
|
+
foreignKey: __spreadValues$q({ fn: fnOrTable, columns: [column] }, options)
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
return cloned;
|
|
@@ -76,7 +76,7 @@ class ColumnType {
|
|
|
76
76
|
return addColumnData(this, "index", options);
|
|
77
77
|
}
|
|
78
78
|
unique(options = {}) {
|
|
79
|
-
return addColumnData(this, "index", __spreadProps$l(__spreadValues$
|
|
79
|
+
return addColumnData(this, "index", __spreadProps$l(__spreadValues$q({}, options), { unique: true }));
|
|
80
80
|
}
|
|
81
81
|
comment(comment) {
|
|
82
82
|
return addColumnData(this, "comment", comment);
|
|
@@ -203,21 +203,21 @@ const addValue = (values, value) => {
|
|
|
203
203
|
return `$${values.length}`;
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var __defProp$
|
|
206
|
+
var __defProp$p = Object.defineProperty;
|
|
207
207
|
var __defProps$k = Object.defineProperties;
|
|
208
208
|
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
209
|
-
var __getOwnPropSymbols$
|
|
210
|
-
var __hasOwnProp$
|
|
211
|
-
var __propIsEnum$
|
|
212
|
-
var __defNormalProp$
|
|
213
|
-
var __spreadValues$
|
|
209
|
+
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
210
|
+
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
211
|
+
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
212
|
+
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
213
|
+
var __spreadValues$p = (a, b) => {
|
|
214
214
|
for (var prop in b || (b = {}))
|
|
215
|
-
if (__hasOwnProp$
|
|
216
|
-
__defNormalProp$
|
|
217
|
-
if (__getOwnPropSymbols$
|
|
218
|
-
for (var prop of __getOwnPropSymbols$
|
|
219
|
-
if (__propIsEnum$
|
|
220
|
-
__defNormalProp$
|
|
215
|
+
if (__hasOwnProp$q.call(b, prop))
|
|
216
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
217
|
+
if (__getOwnPropSymbols$q)
|
|
218
|
+
for (var prop of __getOwnPropSymbols$q(b)) {
|
|
219
|
+
if (__propIsEnum$q.call(b, prop))
|
|
220
|
+
__defNormalProp$p(a, prop, b[prop]);
|
|
221
221
|
}
|
|
222
222
|
return a;
|
|
223
223
|
};
|
|
@@ -307,14 +307,14 @@ const base = () => ({
|
|
|
307
307
|
in: all.in(),
|
|
308
308
|
notIn: all.notIn()
|
|
309
309
|
});
|
|
310
|
-
const numeric = () => __spreadProps$k(__spreadValues$
|
|
310
|
+
const numeric = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
311
311
|
lt: all.lt(),
|
|
312
312
|
lte: all.lte(),
|
|
313
313
|
gt: all.gt(),
|
|
314
314
|
gte: all.gte(),
|
|
315
315
|
between: all.between()
|
|
316
316
|
});
|
|
317
|
-
const text = () => __spreadProps$k(__spreadValues$
|
|
317
|
+
const text = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
318
318
|
contains: all.contains(),
|
|
319
319
|
containsInsensitive: all.containsInsensitive(),
|
|
320
320
|
startsWith: all.startsWith(),
|
|
@@ -322,7 +322,7 @@ const text = () => __spreadProps$k(__spreadValues$o({}, base()), {
|
|
|
322
322
|
endsWith: all.endsWith(),
|
|
323
323
|
endsWithInsensitive: all.endsWithInsensitive()
|
|
324
324
|
});
|
|
325
|
-
const json = () => __spreadProps$k(__spreadValues$
|
|
325
|
+
const json = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
326
326
|
jsonPath: all.jsonPath(),
|
|
327
327
|
jsonSupersetOf: all.jsonSupersetOf(),
|
|
328
328
|
jsonSubsetOf: all.jsonSubsetOf()
|
|
@@ -338,6 +338,12 @@ const Operators = {
|
|
|
338
338
|
array: base()
|
|
339
339
|
};
|
|
340
340
|
|
|
341
|
+
const defaultsKey = Symbol("defaults");
|
|
342
|
+
const queryTypeWithLimitOne = {
|
|
343
|
+
one: true,
|
|
344
|
+
oneOrThrow: true
|
|
345
|
+
};
|
|
346
|
+
|
|
341
347
|
const pushDistinctSql = (ctx, distinct, quotedAs) => {
|
|
342
348
|
ctx.sql.push("DISTINCT");
|
|
343
349
|
if (distinct.length) {
|
|
@@ -690,21 +696,21 @@ const pushIn = (ands, prefix, quotedAs, values, arg) => {
|
|
|
690
696
|
);
|
|
691
697
|
};
|
|
692
698
|
|
|
693
|
-
var __defProp$
|
|
699
|
+
var __defProp$o = Object.defineProperty;
|
|
694
700
|
var __defProps$j = Object.defineProperties;
|
|
695
701
|
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
696
|
-
var __getOwnPropSymbols$
|
|
697
|
-
var __hasOwnProp$
|
|
698
|
-
var __propIsEnum$
|
|
699
|
-
var __defNormalProp$
|
|
700
|
-
var __spreadValues$
|
|
702
|
+
var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
|
|
703
|
+
var __hasOwnProp$p = Object.prototype.hasOwnProperty;
|
|
704
|
+
var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
|
|
705
|
+
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
706
|
+
var __spreadValues$o = (a, b) => {
|
|
701
707
|
for (var prop in b || (b = {}))
|
|
702
|
-
if (__hasOwnProp$
|
|
703
|
-
__defNormalProp$
|
|
704
|
-
if (__getOwnPropSymbols$
|
|
705
|
-
for (var prop of __getOwnPropSymbols$
|
|
706
|
-
if (__propIsEnum$
|
|
707
|
-
__defNormalProp$
|
|
708
|
+
if (__hasOwnProp$p.call(b, prop))
|
|
709
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
710
|
+
if (__getOwnPropSymbols$p)
|
|
711
|
+
for (var prop of __getOwnPropSymbols$p(b)) {
|
|
712
|
+
if (__propIsEnum$p.call(b, prop))
|
|
713
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
708
714
|
}
|
|
709
715
|
return a;
|
|
710
716
|
};
|
|
@@ -712,7 +718,7 @@ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
|
|
|
712
718
|
const aggregateToSql = (ctx, model, item, quotedAs) => {
|
|
713
719
|
var _a;
|
|
714
720
|
const sql = [`${item.function}(`];
|
|
715
|
-
ctx = __spreadProps$j(__spreadValues$
|
|
721
|
+
ctx = __spreadProps$j(__spreadValues$o({}, ctx), { sql });
|
|
716
722
|
const options = item.options || EMPTY_OBJECT;
|
|
717
723
|
if (options.distinct && !options.withinGroup)
|
|
718
724
|
sql.push("DISTINCT ");
|
|
@@ -880,7 +886,7 @@ const selectToSql = (ctx, model, query, quotedAs) => {
|
|
|
880
886
|
}
|
|
881
887
|
};
|
|
882
888
|
const pushSubQuerySql = (query, as, values, list) => {
|
|
883
|
-
const { returnType } = query.query;
|
|
889
|
+
const { returnType = "all" } = query.query;
|
|
884
890
|
switch (returnType) {
|
|
885
891
|
case "all":
|
|
886
892
|
case "one":
|
|
@@ -897,7 +903,6 @@ const pushSubQuerySql = (query, as, values, list) => {
|
|
|
897
903
|
select[0] = { selectAs: { c: first } };
|
|
898
904
|
query = query._wrap(query.__model.clone());
|
|
899
905
|
query._getOptional(raw(`COALESCE(json_agg("c"), '[]')`));
|
|
900
|
-
delete query.query.take;
|
|
901
906
|
break;
|
|
902
907
|
}
|
|
903
908
|
case "rows":
|
|
@@ -1015,22 +1020,30 @@ const havingToSql = (ctx, model, query, quotedAs) => {
|
|
|
1015
1020
|
};
|
|
1016
1021
|
|
|
1017
1022
|
const pushWithSql = (ctx, withData) => {
|
|
1018
|
-
withData.
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
inner
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1023
|
+
if (!withData.length)
|
|
1024
|
+
return;
|
|
1025
|
+
ctx.sql.push(
|
|
1026
|
+
"WITH",
|
|
1027
|
+
withData.map((withItem) => {
|
|
1028
|
+
const [name, options, query] = withItem;
|
|
1029
|
+
let inner;
|
|
1030
|
+
if (isRaw(query)) {
|
|
1031
|
+
inner = getRaw(query, ctx.values);
|
|
1032
|
+
} else {
|
|
1033
|
+
inner = query.toSql({ values: ctx.values }).text;
|
|
1034
|
+
}
|
|
1035
|
+
return `${options.recursive ? "RECURSIVE " : ""}${q(name)}${options.columns ? `(${options.columns.map(q).join(", ")})` : ""} AS ${options.materialized ? "MATERIALIZED " : options.notMaterialized ? "NOT MATERIALIZED " : ""}(${inner})`;
|
|
1036
|
+
}).join(", ")
|
|
1037
|
+
);
|
|
1030
1038
|
};
|
|
1031
1039
|
|
|
1040
|
+
const checkIfASimpleQuery = (q) => {
|
|
1041
|
+
if (q.returnType && q.returnType !== "all")
|
|
1042
|
+
return false;
|
|
1043
|
+
const keys = Object.keys(q);
|
|
1044
|
+
return !keys.some((key) => queryKeysOfNotSimpleQuery.includes(key));
|
|
1045
|
+
};
|
|
1032
1046
|
const queryKeysOfNotSimpleQuery = [
|
|
1033
|
-
"take",
|
|
1034
1047
|
"with",
|
|
1035
1048
|
"as",
|
|
1036
1049
|
"from",
|
|
@@ -1072,8 +1085,7 @@ const getFrom = (model, query, values) => {
|
|
|
1072
1085
|
return `(${sql.text})`;
|
|
1073
1086
|
}
|
|
1074
1087
|
const q = query.from.query;
|
|
1075
|
-
|
|
1076
|
-
if (keys.some((key) => queryKeysOfNotSimpleQuery.includes(key))) {
|
|
1088
|
+
if (!checkIfASimpleQuery(q)) {
|
|
1077
1089
|
const sql = query.from.toSql({ values });
|
|
1078
1090
|
return `(${sql.text})`;
|
|
1079
1091
|
}
|
|
@@ -1329,8 +1341,9 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1329
1341
|
if (query.order) {
|
|
1330
1342
|
pushOrderBySql(ctx, quotedAs, query.order);
|
|
1331
1343
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1344
|
+
const limit = queryTypeWithLimitOne[query.returnType] ? 1 : query.limit;
|
|
1345
|
+
if (limit) {
|
|
1346
|
+
sql.push(`LIMIT ${addValue(values, limit)}`);
|
|
1334
1347
|
}
|
|
1335
1348
|
if (query.offset) {
|
|
1336
1349
|
sql.push(`OFFSET ${addValue(values, query.offset)}`);
|
|
@@ -1351,21 +1364,21 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1351
1364
|
return { text: sql.join(" "), values };
|
|
1352
1365
|
};
|
|
1353
1366
|
|
|
1354
|
-
var __defProp$
|
|
1367
|
+
var __defProp$n = Object.defineProperty;
|
|
1355
1368
|
var __defProps$i = Object.defineProperties;
|
|
1356
1369
|
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
1357
|
-
var __getOwnPropSymbols$
|
|
1358
|
-
var __hasOwnProp$
|
|
1359
|
-
var __propIsEnum$
|
|
1360
|
-
var __defNormalProp$
|
|
1361
|
-
var __spreadValues$
|
|
1370
|
+
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
1371
|
+
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
1372
|
+
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
1373
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1374
|
+
var __spreadValues$n = (a, b) => {
|
|
1362
1375
|
for (var prop in b || (b = {}))
|
|
1363
|
-
if (__hasOwnProp$
|
|
1364
|
-
__defNormalProp$
|
|
1365
|
-
if (__getOwnPropSymbols$
|
|
1366
|
-
for (var prop of __getOwnPropSymbols$
|
|
1367
|
-
if (__propIsEnum$
|
|
1368
|
-
__defNormalProp$
|
|
1376
|
+
if (__hasOwnProp$o.call(b, prop))
|
|
1377
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
1378
|
+
if (__getOwnPropSymbols$o)
|
|
1379
|
+
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
1380
|
+
if (__propIsEnum$o.call(b, prop))
|
|
1381
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
1369
1382
|
}
|
|
1370
1383
|
return a;
|
|
1371
1384
|
};
|
|
@@ -1385,7 +1398,7 @@ const joinTruthy = (...strings) => {
|
|
|
1385
1398
|
return strings.filter((string) => string).join("");
|
|
1386
1399
|
};
|
|
1387
1400
|
const getClonedQueryData = (query) => {
|
|
1388
|
-
const cloned = __spreadProps$i(__spreadValues$
|
|
1401
|
+
const cloned = __spreadProps$i(__spreadValues$n({}, query), { [toSqlCacheKey]: void 0 });
|
|
1389
1402
|
for (const key in query) {
|
|
1390
1403
|
if (Array.isArray(query[key])) {
|
|
1391
1404
|
cloned[key] = [
|
|
@@ -1446,28 +1459,28 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
1446
1459
|
assignMethodsToClass: assignMethodsToClass
|
|
1447
1460
|
});
|
|
1448
1461
|
|
|
1449
|
-
var __defProp$
|
|
1462
|
+
var __defProp$m = Object.defineProperty;
|
|
1450
1463
|
var __defProps$h = Object.defineProperties;
|
|
1451
1464
|
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
1452
|
-
var __getOwnPropSymbols$
|
|
1453
|
-
var __hasOwnProp$
|
|
1454
|
-
var __propIsEnum$
|
|
1455
|
-
var __defNormalProp$
|
|
1456
|
-
var __spreadValues$
|
|
1465
|
+
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
1466
|
+
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
1467
|
+
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
1468
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1469
|
+
var __spreadValues$m = (a, b) => {
|
|
1457
1470
|
for (var prop in b || (b = {}))
|
|
1458
|
-
if (__hasOwnProp$
|
|
1459
|
-
__defNormalProp$
|
|
1460
|
-
if (__getOwnPropSymbols$
|
|
1461
|
-
for (var prop of __getOwnPropSymbols$
|
|
1462
|
-
if (__propIsEnum$
|
|
1463
|
-
__defNormalProp$
|
|
1471
|
+
if (__hasOwnProp$n.call(b, prop))
|
|
1472
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
1473
|
+
if (__getOwnPropSymbols$n)
|
|
1474
|
+
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
1475
|
+
if (__propIsEnum$n.call(b, prop))
|
|
1476
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
1464
1477
|
}
|
|
1465
1478
|
return a;
|
|
1466
1479
|
};
|
|
1467
1480
|
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
1468
1481
|
const setDataValue = (item, key, value) => {
|
|
1469
1482
|
const cloned = Object.create(item);
|
|
1470
|
-
cloned.data = __spreadProps$h(__spreadValues$
|
|
1483
|
+
cloned.data = __spreadProps$h(__spreadValues$m({}, item.data), { [key]: value });
|
|
1471
1484
|
return cloned;
|
|
1472
1485
|
};
|
|
1473
1486
|
function min(value) {
|
|
@@ -1497,7 +1510,7 @@ const setMethods = {
|
|
|
1497
1510
|
size,
|
|
1498
1511
|
nonempty
|
|
1499
1512
|
};
|
|
1500
|
-
const stringTypeMethods = () => __spreadProps$h(__spreadValues$
|
|
1513
|
+
const stringTypeMethods = () => __spreadProps$h(__spreadValues$m({}, arrayMethods), {
|
|
1501
1514
|
email() {
|
|
1502
1515
|
return setDataValue(this, "email", true);
|
|
1503
1516
|
},
|
|
@@ -1968,21 +1981,21 @@ class EnumColumn extends ColumnType {
|
|
|
1968
1981
|
}
|
|
1969
1982
|
}
|
|
1970
1983
|
|
|
1971
|
-
var __defProp$
|
|
1984
|
+
var __defProp$l = Object.defineProperty;
|
|
1972
1985
|
var __defProps$g = Object.defineProperties;
|
|
1973
1986
|
var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
|
|
1974
|
-
var __getOwnPropSymbols$
|
|
1975
|
-
var __hasOwnProp$
|
|
1976
|
-
var __propIsEnum$
|
|
1977
|
-
var __defNormalProp$
|
|
1978
|
-
var __spreadValues$
|
|
1987
|
+
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
1988
|
+
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
1989
|
+
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
1990
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1991
|
+
var __spreadValues$l = (a, b) => {
|
|
1979
1992
|
for (var prop in b || (b = {}))
|
|
1980
|
-
if (__hasOwnProp$
|
|
1981
|
-
__defNormalProp$
|
|
1982
|
-
if (__getOwnPropSymbols$
|
|
1983
|
-
for (var prop of __getOwnPropSymbols$
|
|
1984
|
-
if (__propIsEnum$
|
|
1985
|
-
__defNormalProp$
|
|
1993
|
+
if (__hasOwnProp$m.call(b, prop))
|
|
1994
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
1995
|
+
if (__getOwnPropSymbols$m)
|
|
1996
|
+
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
1997
|
+
if (__propIsEnum$m.call(b, prop))
|
|
1998
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
1986
1999
|
}
|
|
1987
2000
|
return a;
|
|
1988
2001
|
};
|
|
@@ -1990,42 +2003,42 @@ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
|
|
|
1990
2003
|
var __objRest$4 = (source, exclude) => {
|
|
1991
2004
|
var target = {};
|
|
1992
2005
|
for (var prop in source)
|
|
1993
|
-
if (__hasOwnProp$
|
|
2006
|
+
if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1994
2007
|
target[prop] = source[prop];
|
|
1995
|
-
if (source != null && __getOwnPropSymbols$
|
|
1996
|
-
for (var prop of __getOwnPropSymbols$
|
|
1997
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2008
|
+
if (source != null && __getOwnPropSymbols$m)
|
|
2009
|
+
for (var prop of __getOwnPropSymbols$m(source)) {
|
|
2010
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
|
|
1998
2011
|
target[prop] = source[prop];
|
|
1999
2012
|
}
|
|
2000
2013
|
return target;
|
|
2001
2014
|
};
|
|
2002
2015
|
const optional = (type) => {
|
|
2003
|
-
return __spreadProps$g(__spreadValues$
|
|
2004
|
-
data: __spreadProps$g(__spreadValues$
|
|
2016
|
+
return __spreadProps$g(__spreadValues$l({}, type), {
|
|
2017
|
+
data: __spreadProps$g(__spreadValues$l({}, type.data), { optional: true })
|
|
2005
2018
|
});
|
|
2006
2019
|
};
|
|
2007
2020
|
const required = (type) => {
|
|
2008
2021
|
const _a = type.data, data = __objRest$4(_a, ["optional"]);
|
|
2009
|
-
return __spreadProps$g(__spreadValues$
|
|
2022
|
+
return __spreadProps$g(__spreadValues$l({}, type), {
|
|
2010
2023
|
data
|
|
2011
2024
|
});
|
|
2012
2025
|
};
|
|
2013
2026
|
|
|
2014
|
-
var __defProp$
|
|
2027
|
+
var __defProp$k = Object.defineProperty;
|
|
2015
2028
|
var __defProps$f = Object.defineProperties;
|
|
2016
2029
|
var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
|
|
2017
|
-
var __getOwnPropSymbols$
|
|
2018
|
-
var __hasOwnProp$
|
|
2019
|
-
var __propIsEnum$
|
|
2020
|
-
var __defNormalProp$
|
|
2021
|
-
var __spreadValues$
|
|
2030
|
+
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
2031
|
+
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
2032
|
+
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
2033
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2034
|
+
var __spreadValues$k = (a, b) => {
|
|
2022
2035
|
for (var prop in b || (b = {}))
|
|
2023
|
-
if (__hasOwnProp$
|
|
2024
|
-
__defNormalProp$
|
|
2025
|
-
if (__getOwnPropSymbols$
|
|
2026
|
-
for (var prop of __getOwnPropSymbols$
|
|
2027
|
-
if (__propIsEnum$
|
|
2028
|
-
__defNormalProp$
|
|
2036
|
+
if (__hasOwnProp$l.call(b, prop))
|
|
2037
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
2038
|
+
if (__getOwnPropSymbols$l)
|
|
2039
|
+
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
2040
|
+
if (__propIsEnum$l.call(b, prop))
|
|
2041
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
2029
2042
|
}
|
|
2030
2043
|
return a;
|
|
2031
2044
|
};
|
|
@@ -2033,42 +2046,42 @@ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
|
|
|
2033
2046
|
var __objRest$3 = (source, exclude) => {
|
|
2034
2047
|
var target = {};
|
|
2035
2048
|
for (var prop in source)
|
|
2036
|
-
if (__hasOwnProp$
|
|
2049
|
+
if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2037
2050
|
target[prop] = source[prop];
|
|
2038
|
-
if (source != null && __getOwnPropSymbols$
|
|
2039
|
-
for (var prop of __getOwnPropSymbols$
|
|
2040
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2051
|
+
if (source != null && __getOwnPropSymbols$l)
|
|
2052
|
+
for (var prop of __getOwnPropSymbols$l(source)) {
|
|
2053
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
|
|
2041
2054
|
target[prop] = source[prop];
|
|
2042
2055
|
}
|
|
2043
2056
|
return target;
|
|
2044
2057
|
};
|
|
2045
2058
|
const nullable = (type) => {
|
|
2046
|
-
return __spreadProps$f(__spreadValues$
|
|
2047
|
-
data: __spreadProps$f(__spreadValues$
|
|
2059
|
+
return __spreadProps$f(__spreadValues$k({}, type), {
|
|
2060
|
+
data: __spreadProps$f(__spreadValues$k({}, type.data), { nullable: true })
|
|
2048
2061
|
});
|
|
2049
2062
|
};
|
|
2050
2063
|
const notNullable = (type) => {
|
|
2051
2064
|
const _a = type.data, data = __objRest$3(_a, ["nullable"]);
|
|
2052
|
-
return __spreadProps$f(__spreadValues$
|
|
2065
|
+
return __spreadProps$f(__spreadValues$k({}, type), {
|
|
2053
2066
|
data
|
|
2054
2067
|
});
|
|
2055
2068
|
};
|
|
2056
2069
|
|
|
2057
|
-
var __defProp$
|
|
2070
|
+
var __defProp$j = Object.defineProperty;
|
|
2058
2071
|
var __defProps$e = Object.defineProperties;
|
|
2059
2072
|
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
2060
|
-
var __getOwnPropSymbols$
|
|
2061
|
-
var __hasOwnProp$
|
|
2062
|
-
var __propIsEnum$
|
|
2063
|
-
var __defNormalProp$
|
|
2064
|
-
var __spreadValues$
|
|
2073
|
+
var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
|
|
2074
|
+
var __hasOwnProp$k = Object.prototype.hasOwnProperty;
|
|
2075
|
+
var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
|
|
2076
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2077
|
+
var __spreadValues$j = (a, b) => {
|
|
2065
2078
|
for (var prop in b || (b = {}))
|
|
2066
|
-
if (__hasOwnProp$
|
|
2067
|
-
__defNormalProp$
|
|
2068
|
-
if (__getOwnPropSymbols$
|
|
2069
|
-
for (var prop of __getOwnPropSymbols$
|
|
2070
|
-
if (__propIsEnum$
|
|
2071
|
-
__defNormalProp$
|
|
2079
|
+
if (__hasOwnProp$k.call(b, prop))
|
|
2080
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2081
|
+
if (__getOwnPropSymbols$k)
|
|
2082
|
+
for (var prop of __getOwnPropSymbols$k(b)) {
|
|
2083
|
+
if (__propIsEnum$k.call(b, prop))
|
|
2084
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2072
2085
|
}
|
|
2073
2086
|
return a;
|
|
2074
2087
|
};
|
|
@@ -2076,23 +2089,23 @@ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
|
2076
2089
|
var __objRest$2 = (source, exclude) => {
|
|
2077
2090
|
var target = {};
|
|
2078
2091
|
for (var prop in source)
|
|
2079
|
-
if (__hasOwnProp$
|
|
2092
|
+
if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2080
2093
|
target[prop] = source[prop];
|
|
2081
|
-
if (source != null && __getOwnPropSymbols$
|
|
2082
|
-
for (var prop of __getOwnPropSymbols$
|
|
2083
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
2094
|
+
if (source != null && __getOwnPropSymbols$k)
|
|
2095
|
+
for (var prop of __getOwnPropSymbols$k(source)) {
|
|
2096
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
|
|
2084
2097
|
target[prop] = source[prop];
|
|
2085
2098
|
}
|
|
2086
2099
|
return target;
|
|
2087
2100
|
};
|
|
2088
2101
|
const nullish = (type) => {
|
|
2089
|
-
return __spreadProps$e(__spreadValues$
|
|
2090
|
-
data: __spreadProps$e(__spreadValues$
|
|
2102
|
+
return __spreadProps$e(__spreadValues$j({}, type), {
|
|
2103
|
+
data: __spreadProps$e(__spreadValues$j({}, type.data), { nullable: true, optional: true })
|
|
2091
2104
|
});
|
|
2092
2105
|
};
|
|
2093
2106
|
const notNullish = (type) => {
|
|
2094
2107
|
const _a = type.data, data = __objRest$2(_a, ["nullable", "optional"]);
|
|
2095
|
-
return __spreadProps$e(__spreadValues$
|
|
2108
|
+
return __spreadProps$e(__spreadValues$j({}, type), {
|
|
2096
2109
|
data
|
|
2097
2110
|
});
|
|
2098
2111
|
};
|
|
@@ -2112,21 +2125,21 @@ const union = (types) => {
|
|
|
2112
2125
|
});
|
|
2113
2126
|
};
|
|
2114
2127
|
|
|
2115
|
-
var __defProp$
|
|
2128
|
+
var __defProp$i = Object.defineProperty;
|
|
2116
2129
|
var __defProps$d = Object.defineProperties;
|
|
2117
2130
|
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
2118
|
-
var __getOwnPropSymbols$
|
|
2119
|
-
var __hasOwnProp$
|
|
2120
|
-
var __propIsEnum$
|
|
2121
|
-
var __defNormalProp$
|
|
2122
|
-
var __spreadValues$
|
|
2131
|
+
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
2132
|
+
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
2133
|
+
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
2134
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2135
|
+
var __spreadValues$i = (a, b) => {
|
|
2123
2136
|
for (var prop in b || (b = {}))
|
|
2124
|
-
if (__hasOwnProp$
|
|
2125
|
-
__defNormalProp$
|
|
2126
|
-
if (__getOwnPropSymbols$
|
|
2127
|
-
for (var prop of __getOwnPropSymbols$
|
|
2128
|
-
if (__propIsEnum$
|
|
2129
|
-
__defNormalProp$
|
|
2137
|
+
if (__hasOwnProp$j.call(b, prop))
|
|
2138
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2139
|
+
if (__getOwnPropSymbols$j)
|
|
2140
|
+
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
2141
|
+
if (__propIsEnum$j.call(b, prop))
|
|
2142
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2130
2143
|
}
|
|
2131
2144
|
return a;
|
|
2132
2145
|
};
|
|
@@ -2158,22 +2171,22 @@ const baseTypeMethods = {
|
|
|
2158
2171
|
return this;
|
|
2159
2172
|
},
|
|
2160
2173
|
transform(fn) {
|
|
2161
|
-
return __spreadProps$d(__spreadValues$
|
|
2174
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2162
2175
|
chain: [...this.chain, ["transform", fn]]
|
|
2163
2176
|
});
|
|
2164
2177
|
},
|
|
2165
2178
|
to(fn, type) {
|
|
2166
|
-
return __spreadProps$d(__spreadValues$
|
|
2179
|
+
return __spreadProps$d(__spreadValues$i({}, type), {
|
|
2167
2180
|
chain: [...this.chain, ["to", fn, type], ...type.chain]
|
|
2168
2181
|
});
|
|
2169
2182
|
},
|
|
2170
2183
|
refine(check) {
|
|
2171
|
-
return __spreadProps$d(__spreadValues$
|
|
2184
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2172
2185
|
chain: [...this.chain, ["refine", check]]
|
|
2173
2186
|
});
|
|
2174
2187
|
},
|
|
2175
2188
|
superRefine(check) {
|
|
2176
|
-
return __spreadProps$d(__spreadValues$
|
|
2189
|
+
return __spreadProps$d(__spreadValues$i({}, this), {
|
|
2177
2190
|
chain: [...this.chain, ["superRefine", check]]
|
|
2178
2191
|
});
|
|
2179
2192
|
},
|
|
@@ -2186,7 +2199,7 @@ const baseTypeMethods = {
|
|
|
2186
2199
|
},
|
|
2187
2200
|
default(value) {
|
|
2188
2201
|
const cloned = Object.create(this);
|
|
2189
|
-
cloned.data = __spreadProps$d(__spreadValues$
|
|
2202
|
+
cloned.data = __spreadProps$d(__spreadValues$i({}, cloned.data), { default: value });
|
|
2190
2203
|
return cloned;
|
|
2191
2204
|
},
|
|
2192
2205
|
array() {
|
|
@@ -2194,34 +2207,34 @@ const baseTypeMethods = {
|
|
|
2194
2207
|
}
|
|
2195
2208
|
};
|
|
2196
2209
|
const constructType = (type) => {
|
|
2197
|
-
return __spreadValues$
|
|
2210
|
+
return __spreadValues$i(__spreadValues$i({}, baseTypeMethods), type);
|
|
2198
2211
|
};
|
|
2199
2212
|
|
|
2200
|
-
var __defProp$
|
|
2213
|
+
var __defProp$h = Object.defineProperty;
|
|
2201
2214
|
var __defProps$c = Object.defineProperties;
|
|
2202
2215
|
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
2203
|
-
var __getOwnPropSymbols$
|
|
2204
|
-
var __hasOwnProp$
|
|
2205
|
-
var __propIsEnum$
|
|
2206
|
-
var __defNormalProp$
|
|
2207
|
-
var __spreadValues$
|
|
2216
|
+
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
2217
|
+
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
2218
|
+
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
2219
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2220
|
+
var __spreadValues$h = (a, b) => {
|
|
2208
2221
|
for (var prop in b || (b = {}))
|
|
2209
|
-
if (__hasOwnProp$
|
|
2210
|
-
__defNormalProp$
|
|
2211
|
-
if (__getOwnPropSymbols$
|
|
2212
|
-
for (var prop of __getOwnPropSymbols$
|
|
2213
|
-
if (__propIsEnum$
|
|
2214
|
-
__defNormalProp$
|
|
2222
|
+
if (__hasOwnProp$i.call(b, prop))
|
|
2223
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2224
|
+
if (__getOwnPropSymbols$i)
|
|
2225
|
+
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
2226
|
+
if (__propIsEnum$i.call(b, prop))
|
|
2227
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2215
2228
|
}
|
|
2216
2229
|
return a;
|
|
2217
2230
|
};
|
|
2218
2231
|
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
2219
2232
|
const array = (element) => {
|
|
2220
|
-
return constructType(__spreadValues$
|
|
2233
|
+
return constructType(__spreadValues$h({
|
|
2221
2234
|
dataType: "array",
|
|
2222
2235
|
element,
|
|
2223
2236
|
deepPartial() {
|
|
2224
|
-
return __spreadProps$c(__spreadValues$
|
|
2237
|
+
return __spreadProps$c(__spreadValues$h({}, this), {
|
|
2225
2238
|
element: this.element.deepPartial()
|
|
2226
2239
|
});
|
|
2227
2240
|
},
|
|
@@ -2231,21 +2244,21 @@ const array = (element) => {
|
|
|
2231
2244
|
}, arrayMethods));
|
|
2232
2245
|
};
|
|
2233
2246
|
|
|
2234
|
-
var __defProp$
|
|
2247
|
+
var __defProp$g = Object.defineProperty;
|
|
2235
2248
|
var __defProps$b = Object.defineProperties;
|
|
2236
2249
|
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
2237
|
-
var __getOwnPropSymbols$
|
|
2238
|
-
var __hasOwnProp$
|
|
2239
|
-
var __propIsEnum$
|
|
2240
|
-
var __defNormalProp$
|
|
2241
|
-
var __spreadValues$
|
|
2250
|
+
var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
|
|
2251
|
+
var __hasOwnProp$h = Object.prototype.hasOwnProperty;
|
|
2252
|
+
var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
|
|
2253
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2254
|
+
var __spreadValues$g = (a, b) => {
|
|
2242
2255
|
for (var prop in b || (b = {}))
|
|
2243
|
-
if (__hasOwnProp$
|
|
2244
|
-
__defNormalProp$
|
|
2245
|
-
if (__getOwnPropSymbols$
|
|
2246
|
-
for (var prop of __getOwnPropSymbols$
|
|
2247
|
-
if (__propIsEnum$
|
|
2248
|
-
__defNormalProp$
|
|
2256
|
+
if (__hasOwnProp$h.call(b, prop))
|
|
2257
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
2258
|
+
if (__getOwnPropSymbols$h)
|
|
2259
|
+
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
2260
|
+
if (__propIsEnum$h.call(b, prop))
|
|
2261
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
2249
2262
|
}
|
|
2250
2263
|
return a;
|
|
2251
2264
|
};
|
|
@@ -2269,7 +2282,7 @@ const discriminatedUnion = (discriminator, options) => {
|
|
|
2269
2282
|
partial.shape[discriminator] = option.shape[discriminator];
|
|
2270
2283
|
newOptionsMap.set(key, partial);
|
|
2271
2284
|
});
|
|
2272
|
-
return __spreadProps$b(__spreadValues$
|
|
2285
|
+
return __spreadProps$b(__spreadValues$g({}, this), {
|
|
2273
2286
|
options: newOptionsMap
|
|
2274
2287
|
});
|
|
2275
2288
|
}
|
|
@@ -2298,21 +2311,21 @@ const instanceOf = (cls) => {
|
|
|
2298
2311
|
});
|
|
2299
2312
|
};
|
|
2300
2313
|
|
|
2301
|
-
var __defProp$
|
|
2314
|
+
var __defProp$f = Object.defineProperty;
|
|
2302
2315
|
var __defProps$a = Object.defineProperties;
|
|
2303
2316
|
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
2304
|
-
var __getOwnPropSymbols$
|
|
2305
|
-
var __hasOwnProp$
|
|
2306
|
-
var __propIsEnum$
|
|
2307
|
-
var __defNormalProp$
|
|
2308
|
-
var __spreadValues$
|
|
2317
|
+
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
2318
|
+
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
2319
|
+
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
2320
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2321
|
+
var __spreadValues$f = (a, b) => {
|
|
2309
2322
|
for (var prop in b || (b = {}))
|
|
2310
|
-
if (__hasOwnProp$
|
|
2311
|
-
__defNormalProp$
|
|
2312
|
-
if (__getOwnPropSymbols$
|
|
2313
|
-
for (var prop of __getOwnPropSymbols$
|
|
2314
|
-
if (__propIsEnum$
|
|
2315
|
-
__defNormalProp$
|
|
2323
|
+
if (__hasOwnProp$g.call(b, prop))
|
|
2324
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
2325
|
+
if (__getOwnPropSymbols$g)
|
|
2326
|
+
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
2327
|
+
if (__propIsEnum$g.call(b, prop))
|
|
2328
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
2316
2329
|
}
|
|
2317
2330
|
return a;
|
|
2318
2331
|
};
|
|
@@ -2324,7 +2337,7 @@ const lazy = (fn) => {
|
|
|
2324
2337
|
return this.typeCache || (this.typeCache = fn());
|
|
2325
2338
|
},
|
|
2326
2339
|
deepPartial() {
|
|
2327
|
-
return __spreadProps$a(__spreadValues$
|
|
2340
|
+
return __spreadProps$a(__spreadValues$f({}, this), {
|
|
2328
2341
|
typeCache: void 0,
|
|
2329
2342
|
getter: () => this.getter().deepPartial()
|
|
2330
2343
|
});
|
|
@@ -2337,21 +2350,21 @@ const literal = (value) => constructType({
|
|
|
2337
2350
|
value
|
|
2338
2351
|
});
|
|
2339
2352
|
|
|
2340
|
-
var __defProp$
|
|
2353
|
+
var __defProp$e = Object.defineProperty;
|
|
2341
2354
|
var __defProps$9 = Object.defineProperties;
|
|
2342
2355
|
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
2343
|
-
var __getOwnPropSymbols$
|
|
2344
|
-
var __hasOwnProp$
|
|
2345
|
-
var __propIsEnum$
|
|
2346
|
-
var __defNormalProp$
|
|
2347
|
-
var __spreadValues$
|
|
2356
|
+
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
2357
|
+
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
2358
|
+
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
2359
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2360
|
+
var __spreadValues$e = (a, b) => {
|
|
2348
2361
|
for (var prop in b || (b = {}))
|
|
2349
|
-
if (__hasOwnProp$
|
|
2350
|
-
__defNormalProp$
|
|
2351
|
-
if (__getOwnPropSymbols$
|
|
2352
|
-
for (var prop of __getOwnPropSymbols$
|
|
2353
|
-
if (__propIsEnum$
|
|
2354
|
-
__defNormalProp$
|
|
2362
|
+
if (__hasOwnProp$f.call(b, prop))
|
|
2363
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
2364
|
+
if (__getOwnPropSymbols$f)
|
|
2365
|
+
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
2366
|
+
if (__propIsEnum$f.call(b, prop))
|
|
2367
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
2355
2368
|
}
|
|
2356
2369
|
return a;
|
|
2357
2370
|
};
|
|
@@ -2362,7 +2375,7 @@ const map = (keyType, valueType) => {
|
|
|
2362
2375
|
keyType,
|
|
2363
2376
|
valueType,
|
|
2364
2377
|
deepPartial() {
|
|
2365
|
-
return __spreadProps$9(__spreadValues$
|
|
2378
|
+
return __spreadProps$9(__spreadValues$e({}, this), {
|
|
2366
2379
|
keyType: this.keyType.deepPartial(),
|
|
2367
2380
|
valueType: this.valueType.deepPartial()
|
|
2368
2381
|
});
|
|
@@ -2388,21 +2401,21 @@ const nativeEnum = (givenEnum) => {
|
|
|
2388
2401
|
});
|
|
2389
2402
|
};
|
|
2390
2403
|
|
|
2391
|
-
var __defProp$
|
|
2404
|
+
var __defProp$d = Object.defineProperty;
|
|
2392
2405
|
var __defProps$8 = Object.defineProperties;
|
|
2393
2406
|
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
2394
|
-
var __getOwnPropSymbols$
|
|
2395
|
-
var __hasOwnProp$
|
|
2396
|
-
var __propIsEnum$
|
|
2397
|
-
var __defNormalProp$
|
|
2398
|
-
var __spreadValues$
|
|
2407
|
+
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
2408
|
+
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
2409
|
+
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
2410
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2411
|
+
var __spreadValues$d = (a, b) => {
|
|
2399
2412
|
for (var prop in b || (b = {}))
|
|
2400
|
-
if (__hasOwnProp$
|
|
2401
|
-
__defNormalProp$
|
|
2402
|
-
if (__getOwnPropSymbols$
|
|
2403
|
-
for (var prop of __getOwnPropSymbols$
|
|
2404
|
-
if (__propIsEnum$
|
|
2405
|
-
__defNormalProp$
|
|
2413
|
+
if (__hasOwnProp$e.call(b, prop))
|
|
2414
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
2415
|
+
if (__getOwnPropSymbols$e)
|
|
2416
|
+
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
2417
|
+
if (__propIsEnum$e.call(b, prop))
|
|
2418
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
2406
2419
|
}
|
|
2407
2420
|
return a;
|
|
2408
2421
|
};
|
|
@@ -2415,12 +2428,12 @@ const object = (shape) => {
|
|
|
2415
2428
|
catchAllType: void 0,
|
|
2416
2429
|
extend(add) {
|
|
2417
2430
|
return object(
|
|
2418
|
-
Object.assign(__spreadValues$
|
|
2431
|
+
Object.assign(__spreadValues$d({}, this.shape), add)
|
|
2419
2432
|
);
|
|
2420
2433
|
},
|
|
2421
2434
|
merge(obj) {
|
|
2422
2435
|
return object(
|
|
2423
|
-
Object.assign(__spreadValues$
|
|
2436
|
+
Object.assign(__spreadValues$d({}, this.shape), obj.shape)
|
|
2424
2437
|
);
|
|
2425
2438
|
},
|
|
2426
2439
|
pick(...arr) {
|
|
@@ -2438,7 +2451,7 @@ const object = (shape) => {
|
|
|
2438
2451
|
return object(picked);
|
|
2439
2452
|
},
|
|
2440
2453
|
partial(...arr) {
|
|
2441
|
-
const mapped = __spreadValues$
|
|
2454
|
+
const mapped = __spreadValues$d({}, this.shape);
|
|
2442
2455
|
if (arr.length) {
|
|
2443
2456
|
arr.forEach((key) => {
|
|
2444
2457
|
mapped[key] = mapped[key].optional();
|
|
@@ -2455,48 +2468,48 @@ const object = (shape) => {
|
|
|
2455
2468
|
for (const key in this.shape) {
|
|
2456
2469
|
newShape[key] = optional(this.shape[key].deepPartial());
|
|
2457
2470
|
}
|
|
2458
|
-
return __spreadProps$8(__spreadValues$
|
|
2471
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2459
2472
|
shape: newShape
|
|
2460
2473
|
});
|
|
2461
2474
|
},
|
|
2462
2475
|
passthrough() {
|
|
2463
|
-
return __spreadProps$8(__spreadValues$
|
|
2476
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2464
2477
|
unknownKeys: "passthrough"
|
|
2465
2478
|
});
|
|
2466
2479
|
},
|
|
2467
2480
|
strict() {
|
|
2468
|
-
return __spreadProps$8(__spreadValues$
|
|
2481
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2469
2482
|
unknownKeys: "strict"
|
|
2470
2483
|
});
|
|
2471
2484
|
},
|
|
2472
2485
|
strip() {
|
|
2473
|
-
return __spreadProps$8(__spreadValues$
|
|
2486
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2474
2487
|
unknownKeys: "strip"
|
|
2475
2488
|
});
|
|
2476
2489
|
},
|
|
2477
2490
|
catchAll(type) {
|
|
2478
|
-
return __spreadProps$8(__spreadValues$
|
|
2491
|
+
return __spreadProps$8(__spreadValues$d({}, this), {
|
|
2479
2492
|
catchAllType: type
|
|
2480
2493
|
});
|
|
2481
2494
|
}
|
|
2482
2495
|
});
|
|
2483
2496
|
};
|
|
2484
2497
|
|
|
2485
|
-
var __defProp$
|
|
2498
|
+
var __defProp$c = Object.defineProperty;
|
|
2486
2499
|
var __defProps$7 = Object.defineProperties;
|
|
2487
2500
|
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
2488
|
-
var __getOwnPropSymbols$
|
|
2489
|
-
var __hasOwnProp$
|
|
2490
|
-
var __propIsEnum$
|
|
2491
|
-
var __defNormalProp$
|
|
2492
|
-
var __spreadValues$
|
|
2501
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
2502
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
2503
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
2504
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2505
|
+
var __spreadValues$c = (a, b) => {
|
|
2493
2506
|
for (var prop in b || (b = {}))
|
|
2494
|
-
if (__hasOwnProp$
|
|
2495
|
-
__defNormalProp$
|
|
2496
|
-
if (__getOwnPropSymbols$
|
|
2497
|
-
for (var prop of __getOwnPropSymbols$
|
|
2498
|
-
if (__propIsEnum$
|
|
2499
|
-
__defNormalProp$
|
|
2507
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
2508
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
2509
|
+
if (__getOwnPropSymbols$d)
|
|
2510
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
2511
|
+
if (__propIsEnum$d.call(b, prop))
|
|
2512
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
2500
2513
|
}
|
|
2501
2514
|
return a;
|
|
2502
2515
|
};
|
|
@@ -2506,7 +2519,7 @@ const any = () => {
|
|
|
2506
2519
|
dataType: "any"
|
|
2507
2520
|
});
|
|
2508
2521
|
};
|
|
2509
|
-
const bigIntMethods = __spreadValues$
|
|
2522
|
+
const bigIntMethods = __spreadValues$c({
|
|
2510
2523
|
dataType: "bigint"
|
|
2511
2524
|
}, numberTypeMethods);
|
|
2512
2525
|
const bigint = () => {
|
|
@@ -2532,19 +2545,19 @@ const nullType = () => {
|
|
|
2532
2545
|
dataType: "null"
|
|
2533
2546
|
});
|
|
2534
2547
|
};
|
|
2535
|
-
const numberMethods = __spreadProps$7(__spreadValues$
|
|
2548
|
+
const numberMethods = __spreadProps$7(__spreadValues$c({}, numberTypeMethods), {
|
|
2536
2549
|
dataType: "number"
|
|
2537
2550
|
});
|
|
2538
2551
|
const number = () => {
|
|
2539
2552
|
return constructType(numberMethods);
|
|
2540
2553
|
};
|
|
2541
|
-
const dateMethods = __spreadProps$7(__spreadValues$
|
|
2554
|
+
const dateMethods = __spreadProps$7(__spreadValues$c({}, dateTypeMethods), {
|
|
2542
2555
|
dataType: "date"
|
|
2543
2556
|
});
|
|
2544
2557
|
const date = () => {
|
|
2545
2558
|
return constructType(dateMethods);
|
|
2546
2559
|
};
|
|
2547
|
-
const stringMethods = __spreadProps$7(__spreadValues$
|
|
2560
|
+
const stringMethods = __spreadProps$7(__spreadValues$c({}, stringTypeMethods()), {
|
|
2548
2561
|
dataType: "string"
|
|
2549
2562
|
});
|
|
2550
2563
|
const string = () => {
|
|
@@ -2580,21 +2593,21 @@ const scalarTypes = {
|
|
|
2580
2593
|
void: voidType
|
|
2581
2594
|
};
|
|
2582
2595
|
|
|
2583
|
-
var __defProp$
|
|
2596
|
+
var __defProp$b = Object.defineProperty;
|
|
2584
2597
|
var __defProps$6 = Object.defineProperties;
|
|
2585
2598
|
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
2586
|
-
var __getOwnPropSymbols$
|
|
2587
|
-
var __hasOwnProp$
|
|
2588
|
-
var __propIsEnum$
|
|
2589
|
-
var __defNormalProp$
|
|
2590
|
-
var __spreadValues$
|
|
2599
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
2600
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
2601
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
2602
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2603
|
+
var __spreadValues$b = (a, b) => {
|
|
2591
2604
|
for (var prop in b || (b = {}))
|
|
2592
|
-
if (__hasOwnProp$
|
|
2593
|
-
__defNormalProp$
|
|
2594
|
-
if (__getOwnPropSymbols$
|
|
2595
|
-
for (var prop of __getOwnPropSymbols$
|
|
2596
|
-
if (__propIsEnum$
|
|
2597
|
-
__defNormalProp$
|
|
2605
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
2606
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
2607
|
+
if (__getOwnPropSymbols$c)
|
|
2608
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
2609
|
+
if (__propIsEnum$c.call(b, prop))
|
|
2610
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
2598
2611
|
}
|
|
2599
2612
|
return a;
|
|
2600
2613
|
};
|
|
@@ -2606,38 +2619,38 @@ function record(...args) {
|
|
|
2606
2619
|
keyType,
|
|
2607
2620
|
valueType,
|
|
2608
2621
|
deepPartial() {
|
|
2609
|
-
return __spreadProps$6(__spreadValues$
|
|
2622
|
+
return __spreadProps$6(__spreadValues$b({}, this), {
|
|
2610
2623
|
valueType: this.valueType.deepPartial()
|
|
2611
2624
|
});
|
|
2612
2625
|
}
|
|
2613
2626
|
});
|
|
2614
2627
|
}
|
|
2615
2628
|
|
|
2616
|
-
var __defProp$
|
|
2629
|
+
var __defProp$a = Object.defineProperty;
|
|
2617
2630
|
var __defProps$5 = Object.defineProperties;
|
|
2618
2631
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
2619
|
-
var __getOwnPropSymbols$
|
|
2620
|
-
var __hasOwnProp$
|
|
2621
|
-
var __propIsEnum$
|
|
2622
|
-
var __defNormalProp$
|
|
2623
|
-
var __spreadValues$
|
|
2632
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
2633
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
2634
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
2635
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2636
|
+
var __spreadValues$a = (a, b) => {
|
|
2624
2637
|
for (var prop in b || (b = {}))
|
|
2625
|
-
if (__hasOwnProp$
|
|
2626
|
-
__defNormalProp$
|
|
2627
|
-
if (__getOwnPropSymbols$
|
|
2628
|
-
for (var prop of __getOwnPropSymbols$
|
|
2629
|
-
if (__propIsEnum$
|
|
2630
|
-
__defNormalProp$
|
|
2638
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
2639
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
2640
|
+
if (__getOwnPropSymbols$b)
|
|
2641
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
2642
|
+
if (__propIsEnum$b.call(b, prop))
|
|
2643
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
2631
2644
|
}
|
|
2632
2645
|
return a;
|
|
2633
2646
|
};
|
|
2634
2647
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
2635
2648
|
const set = (valueType) => {
|
|
2636
|
-
return constructType(__spreadValues$
|
|
2649
|
+
return constructType(__spreadValues$a({
|
|
2637
2650
|
dataType: "set",
|
|
2638
2651
|
valueType,
|
|
2639
2652
|
deepPartial() {
|
|
2640
|
-
return __spreadProps$5(__spreadValues$
|
|
2653
|
+
return __spreadProps$5(__spreadValues$a({}, this), {
|
|
2641
2654
|
valueType: this.valueType.deepPartial()
|
|
2642
2655
|
});
|
|
2643
2656
|
},
|
|
@@ -2647,21 +2660,21 @@ const set = (valueType) => {
|
|
|
2647
2660
|
}, setMethods));
|
|
2648
2661
|
};
|
|
2649
2662
|
|
|
2650
|
-
var __defProp$
|
|
2663
|
+
var __defProp$9 = Object.defineProperty;
|
|
2651
2664
|
var __defProps$4 = Object.defineProperties;
|
|
2652
2665
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
2653
|
-
var __getOwnPropSymbols$
|
|
2654
|
-
var __hasOwnProp$
|
|
2655
|
-
var __propIsEnum$
|
|
2656
|
-
var __defNormalProp$
|
|
2657
|
-
var __spreadValues$
|
|
2666
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
2667
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
2668
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
2669
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2670
|
+
var __spreadValues$9 = (a, b) => {
|
|
2658
2671
|
for (var prop in b || (b = {}))
|
|
2659
|
-
if (__hasOwnProp$
|
|
2660
|
-
__defNormalProp$
|
|
2661
|
-
if (__getOwnPropSymbols$
|
|
2662
|
-
for (var prop of __getOwnPropSymbols$
|
|
2663
|
-
if (__propIsEnum$
|
|
2664
|
-
__defNormalProp$
|
|
2672
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
2673
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
2674
|
+
if (__getOwnPropSymbols$a)
|
|
2675
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
2676
|
+
if (__propIsEnum$a.call(b, prop))
|
|
2677
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
2665
2678
|
}
|
|
2666
2679
|
return a;
|
|
2667
2680
|
};
|
|
@@ -2672,38 +2685,38 @@ const tuple = (items, rest = null) => {
|
|
|
2672
2685
|
items,
|
|
2673
2686
|
restType: rest,
|
|
2674
2687
|
rest(rest2) {
|
|
2675
|
-
return __spreadProps$4(__spreadValues$
|
|
2688
|
+
return __spreadProps$4(__spreadValues$9({}, this), {
|
|
2676
2689
|
restType: rest2
|
|
2677
2690
|
});
|
|
2678
2691
|
},
|
|
2679
2692
|
deepPartial() {
|
|
2680
|
-
return __spreadProps$4(__spreadValues$
|
|
2693
|
+
return __spreadProps$4(__spreadValues$9({}, this), {
|
|
2681
2694
|
items: this.items.map((item) => item.deepPartial())
|
|
2682
2695
|
});
|
|
2683
2696
|
}
|
|
2684
2697
|
});
|
|
2685
2698
|
};
|
|
2686
2699
|
|
|
2687
|
-
var __defProp$
|
|
2700
|
+
var __defProp$8 = Object.defineProperty;
|
|
2688
2701
|
var __defProps$3 = Object.defineProperties;
|
|
2689
2702
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
2690
|
-
var __getOwnPropSymbols$
|
|
2691
|
-
var __hasOwnProp$
|
|
2692
|
-
var __propIsEnum$
|
|
2693
|
-
var __defNormalProp$
|
|
2694
|
-
var __spreadValues$
|
|
2703
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
2704
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
2705
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
2706
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2707
|
+
var __spreadValues$8 = (a, b) => {
|
|
2695
2708
|
for (var prop in b || (b = {}))
|
|
2696
|
-
if (__hasOwnProp$
|
|
2697
|
-
__defNormalProp$
|
|
2698
|
-
if (__getOwnPropSymbols$
|
|
2699
|
-
for (var prop of __getOwnPropSymbols$
|
|
2700
|
-
if (__propIsEnum$
|
|
2701
|
-
__defNormalProp$
|
|
2709
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
2710
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
2711
|
+
if (__getOwnPropSymbols$9)
|
|
2712
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
2713
|
+
if (__propIsEnum$9.call(b, prop))
|
|
2714
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
2702
2715
|
}
|
|
2703
2716
|
return a;
|
|
2704
2717
|
};
|
|
2705
2718
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
2706
|
-
const jsonTypes = __spreadProps$3(__spreadValues$
|
|
2719
|
+
const jsonTypes = __spreadProps$3(__spreadValues$8({
|
|
2707
2720
|
array,
|
|
2708
2721
|
discriminatedUnion,
|
|
2709
2722
|
enum: enumType,
|
|
@@ -2858,21 +2871,21 @@ const checkIfDataHasUpdatedAt = (data) => {
|
|
|
2858
2871
|
});
|
|
2859
2872
|
};
|
|
2860
2873
|
|
|
2861
|
-
var __defProp$
|
|
2874
|
+
var __defProp$7 = Object.defineProperty;
|
|
2862
2875
|
var __defProps$2 = Object.defineProperties;
|
|
2863
2876
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2864
|
-
var __getOwnPropSymbols$
|
|
2865
|
-
var __hasOwnProp$
|
|
2866
|
-
var __propIsEnum$
|
|
2867
|
-
var __defNormalProp$
|
|
2868
|
-
var __spreadValues$
|
|
2877
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
2878
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
2879
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
2880
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2881
|
+
var __spreadValues$7 = (a, b) => {
|
|
2869
2882
|
for (var prop in b || (b = {}))
|
|
2870
|
-
if (__hasOwnProp$
|
|
2871
|
-
__defNormalProp$
|
|
2872
|
-
if (__getOwnPropSymbols$
|
|
2873
|
-
for (var prop of __getOwnPropSymbols$
|
|
2874
|
-
if (__propIsEnum$
|
|
2875
|
-
__defNormalProp$
|
|
2883
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
2884
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
2885
|
+
if (__getOwnPropSymbols$8)
|
|
2886
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
2887
|
+
if (__propIsEnum$8.call(b, prop))
|
|
2888
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
2876
2889
|
}
|
|
2877
2890
|
return a;
|
|
2878
2891
|
};
|
|
@@ -2955,7 +2968,7 @@ const columnTypes = {
|
|
|
2955
2968
|
columns: toArray(columns).map(
|
|
2956
2969
|
(column) => typeof column === "string" ? { column } : column
|
|
2957
2970
|
),
|
|
2958
|
-
options: __spreadProps$2(__spreadValues$
|
|
2971
|
+
options: __spreadProps$2(__spreadValues$7({}, options), { unique: true })
|
|
2959
2972
|
};
|
|
2960
2973
|
tableData.indexes.push(index);
|
|
2961
2974
|
return emptyObject;
|
|
@@ -2991,26 +3004,18 @@ class ArrayOfColumnsObjects extends ColumnType {
|
|
|
2991
3004
|
}
|
|
2992
3005
|
class PluckResultColumnType extends ColumnType {
|
|
2993
3006
|
}
|
|
2994
|
-
class TableSchema {
|
|
2995
|
-
constructor(shape) {
|
|
2996
|
-
this.shape = shape;
|
|
2997
|
-
this.primaryKeys = Object.entries(this.shape).filter(([, column]) => {
|
|
2998
|
-
return column.isPrimaryKey;
|
|
2999
|
-
}).map(([key]) => key);
|
|
3000
|
-
}
|
|
3001
|
-
}
|
|
3002
3007
|
|
|
3003
|
-
var __getOwnPropSymbols$
|
|
3004
|
-
var __hasOwnProp$
|
|
3005
|
-
var __propIsEnum$
|
|
3008
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
3009
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
3010
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
3006
3011
|
var __objRest$1 = (source, exclude) => {
|
|
3007
3012
|
var target = {};
|
|
3008
3013
|
for (var prop in source)
|
|
3009
|
-
if (__hasOwnProp$
|
|
3014
|
+
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3010
3015
|
target[prop] = source[prop];
|
|
3011
|
-
if (source != null && __getOwnPropSymbols$
|
|
3012
|
-
for (var prop of __getOwnPropSymbols$
|
|
3013
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
3016
|
+
if (source != null && __getOwnPropSymbols$7)
|
|
3017
|
+
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
3018
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
3014
3019
|
target[prop] = source[prop];
|
|
3015
3020
|
}
|
|
3016
3021
|
return target;
|
|
@@ -3115,11 +3120,6 @@ class TransactionAdapter {
|
|
|
3115
3120
|
}
|
|
3116
3121
|
}
|
|
3117
3122
|
|
|
3118
|
-
const removeFromQuery = (q, key) => {
|
|
3119
|
-
if (q.query)
|
|
3120
|
-
delete q.query[key];
|
|
3121
|
-
return q;
|
|
3122
|
-
};
|
|
3123
3123
|
const pushQueryArray = (q, key, value) => {
|
|
3124
3124
|
if (!q.query[key])
|
|
3125
3125
|
q.query[key] = value;
|
|
@@ -3150,7 +3150,6 @@ const setQueryObjectValue = (q, object, key, value) => {
|
|
|
3150
3150
|
const getValueKey = Symbol("get");
|
|
3151
3151
|
const _get = (q, returnType, arg) => {
|
|
3152
3152
|
q.query.returnType = returnType;
|
|
3153
|
-
q.query.take = true;
|
|
3154
3153
|
if (typeof arg === "object" && isRaw(arg)) {
|
|
3155
3154
|
addParserForRawExpression(q, getValueKey, arg);
|
|
3156
3155
|
q.query.select = [arg];
|
|
@@ -3202,7 +3201,7 @@ class Then {
|
|
|
3202
3201
|
}
|
|
3203
3202
|
}
|
|
3204
3203
|
const handleResult = async (q, result) => {
|
|
3205
|
-
return parseResult(q, q.query.returnType, result);
|
|
3204
|
+
return parseResult(q, q.query.returnType || "all", result);
|
|
3206
3205
|
};
|
|
3207
3206
|
const then = async (q, resolve, reject) => {
|
|
3208
3207
|
let sql;
|
|
@@ -3229,7 +3228,7 @@ const then = async (q, resolve, reject) => {
|
|
|
3229
3228
|
if (q.query.log) {
|
|
3230
3229
|
logData = q.query.log.beforeQuery(sql);
|
|
3231
3230
|
}
|
|
3232
|
-
const queryResult = await q.query.adapter[queryMethodByReturnType[q.query.returnType]](sql);
|
|
3231
|
+
const queryResult = await q.query.adapter[queryMethodByReturnType[q.query.returnType || "all"]](sql);
|
|
3233
3232
|
if (q.query.log) {
|
|
3234
3233
|
q.query.log.afterQuery(sql, logData);
|
|
3235
3234
|
sql = void 0;
|
|
@@ -3250,7 +3249,7 @@ const then = async (q, resolve, reject) => {
|
|
|
3250
3249
|
reject == null ? void 0 : reject(error);
|
|
3251
3250
|
}
|
|
3252
3251
|
};
|
|
3253
|
-
const parseResult = (q, returnType, result) => {
|
|
3252
|
+
const parseResult = (q, returnType = "all", result) => {
|
|
3254
3253
|
var _a, _b;
|
|
3255
3254
|
switch (returnType) {
|
|
3256
3255
|
case "all": {
|
|
@@ -3357,7 +3356,7 @@ const addParserForSelectItem = (q, as, key, arg) => {
|
|
|
3357
3356
|
const rel = arg(q);
|
|
3358
3357
|
const parsers = getQueryParsers(rel);
|
|
3359
3358
|
if (parsers) {
|
|
3360
|
-
if (rel.query.
|
|
3359
|
+
if (queryTypeWithLimitOne[rel.query.returnType]) {
|
|
3361
3360
|
addParserToQuery(q.query, key, (item) => parseRecord(parsers, item));
|
|
3362
3361
|
} else {
|
|
3363
3362
|
addParserToQuery(
|
|
@@ -3463,21 +3462,21 @@ class Select {
|
|
|
3463
3462
|
}
|
|
3464
3463
|
}
|
|
3465
3464
|
|
|
3466
|
-
var __defProp$
|
|
3465
|
+
var __defProp$6 = Object.defineProperty;
|
|
3467
3466
|
var __defProps$1 = Object.defineProperties;
|
|
3468
3467
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
3469
|
-
var __getOwnPropSymbols$
|
|
3470
|
-
var __hasOwnProp$
|
|
3471
|
-
var __propIsEnum$
|
|
3472
|
-
var __defNormalProp$
|
|
3473
|
-
var __spreadValues$
|
|
3468
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
3469
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
3470
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
3471
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3472
|
+
var __spreadValues$6 = (a, b) => {
|
|
3474
3473
|
for (var prop in b || (b = {}))
|
|
3475
|
-
if (__hasOwnProp$
|
|
3476
|
-
__defNormalProp$
|
|
3477
|
-
if (__getOwnPropSymbols$
|
|
3478
|
-
for (var prop of __getOwnPropSymbols$
|
|
3479
|
-
if (__propIsEnum$
|
|
3480
|
-
__defNormalProp$
|
|
3474
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
3475
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
3476
|
+
if (__getOwnPropSymbols$6)
|
|
3477
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
3478
|
+
if (__propIsEnum$6.call(b, prop))
|
|
3479
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
3481
3480
|
}
|
|
3482
3481
|
return a;
|
|
3483
3482
|
};
|
|
@@ -3502,7 +3501,7 @@ const buildAggregateSelectItem = (functionName, arg, options) => {
|
|
|
3502
3501
|
return {
|
|
3503
3502
|
function: functionName,
|
|
3504
3503
|
arg,
|
|
3505
|
-
options: __spreadProps$1(__spreadValues$
|
|
3504
|
+
options: __spreadProps$1(__spreadValues$6({}, options), {
|
|
3506
3505
|
order: (options == null ? void 0 : options.order) ? Array.isArray(options.order) ? options.order : [options.order] : void 0,
|
|
3507
3506
|
filter: options == null ? void 0 : options.filter,
|
|
3508
3507
|
filterOr: options == null ? void 0 : options.filterOr
|
|
@@ -3517,7 +3516,6 @@ const parseIntOrNullColumn = new IntegerColumn().parse(
|
|
|
3517
3516
|
);
|
|
3518
3517
|
const get = (q) => {
|
|
3519
3518
|
q.query.returnType = "valueOrThrow";
|
|
3520
|
-
removeFromQuery(q, "take");
|
|
3521
3519
|
const select = q.query.select;
|
|
3522
3520
|
if (select.length > 1) {
|
|
3523
3521
|
select[0] = select[select.length - 1];
|
|
@@ -3840,8 +3838,8 @@ class Clear {
|
|
|
3840
3838
|
_clear(...clears) {
|
|
3841
3839
|
clears.forEach((clear) => {
|
|
3842
3840
|
if (clear === "where") {
|
|
3843
|
-
|
|
3844
|
-
|
|
3841
|
+
delete this.query.and;
|
|
3842
|
+
delete this.query.or;
|
|
3845
3843
|
} else if (clear === "counters") {
|
|
3846
3844
|
if ("type" in this.query && this.query.type === "update") {
|
|
3847
3845
|
this.query.updateData = this.query.updateData.filter((item) => {
|
|
@@ -3862,7 +3860,7 @@ class Clear {
|
|
|
3862
3860
|
});
|
|
3863
3861
|
}
|
|
3864
3862
|
} else {
|
|
3865
|
-
|
|
3863
|
+
delete this.query[clear];
|
|
3866
3864
|
}
|
|
3867
3865
|
});
|
|
3868
3866
|
return this;
|
|
@@ -4016,19 +4014,19 @@ class From {
|
|
|
4016
4014
|
}
|
|
4017
4015
|
}
|
|
4018
4016
|
|
|
4019
|
-
var __defProp$
|
|
4020
|
-
var __getOwnPropSymbols$
|
|
4021
|
-
var __hasOwnProp$
|
|
4022
|
-
var __propIsEnum$
|
|
4023
|
-
var __defNormalProp$
|
|
4024
|
-
var __spreadValues$
|
|
4017
|
+
var __defProp$5 = Object.defineProperty;
|
|
4018
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
4019
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
4020
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
4021
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4022
|
+
var __spreadValues$5 = (a, b) => {
|
|
4025
4023
|
for (var prop in b || (b = {}))
|
|
4026
|
-
if (__hasOwnProp$
|
|
4027
|
-
__defNormalProp$
|
|
4028
|
-
if (__getOwnPropSymbols$
|
|
4029
|
-
for (var prop of __getOwnPropSymbols$
|
|
4030
|
-
if (__propIsEnum$
|
|
4031
|
-
__defNormalProp$
|
|
4024
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
4025
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
4026
|
+
if (__getOwnPropSymbols$5)
|
|
4027
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
4028
|
+
if (__propIsEnum$5.call(b, prop))
|
|
4029
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
4032
4030
|
}
|
|
4033
4031
|
return a;
|
|
4034
4032
|
};
|
|
@@ -4036,15 +4034,15 @@ const processHavingArg = (arg) => {
|
|
|
4036
4034
|
if ("__model" in arg || isRaw(arg)) {
|
|
4037
4035
|
return arg;
|
|
4038
4036
|
} else {
|
|
4039
|
-
const processed = __spreadValues$
|
|
4037
|
+
const processed = __spreadValues$5({}, arg);
|
|
4040
4038
|
for (const fn in arg) {
|
|
4041
4039
|
const data = arg[fn];
|
|
4042
4040
|
if (typeof data === "object") {
|
|
4043
|
-
processed[fn] = __spreadValues$
|
|
4041
|
+
processed[fn] = __spreadValues$5({}, data);
|
|
4044
4042
|
for (const column in data) {
|
|
4045
4043
|
const value = data[column];
|
|
4046
4044
|
if (typeof value === "object") {
|
|
4047
|
-
processed[fn][column] = __spreadValues$
|
|
4045
|
+
processed[fn][column] = __spreadValues$5({}, value);
|
|
4048
4046
|
const options = value;
|
|
4049
4047
|
if ("order" in options && options.order && !Array.isArray(options.order)) {
|
|
4050
4048
|
processed[fn][column].order = [options.order];
|
|
@@ -4085,19 +4083,19 @@ class Having {
|
|
|
4085
4083
|
}
|
|
4086
4084
|
}
|
|
4087
4085
|
|
|
4088
|
-
var __defProp$
|
|
4089
|
-
var __getOwnPropSymbols$
|
|
4090
|
-
var __hasOwnProp$
|
|
4091
|
-
var __propIsEnum$
|
|
4092
|
-
var __defNormalProp$
|
|
4093
|
-
var __spreadValues$
|
|
4086
|
+
var __defProp$4 = Object.defineProperty;
|
|
4087
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
4088
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
4089
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
4090
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4091
|
+
var __spreadValues$4 = (a, b) => {
|
|
4094
4092
|
for (var prop in b || (b = {}))
|
|
4095
|
-
if (__hasOwnProp$
|
|
4096
|
-
__defNormalProp$
|
|
4097
|
-
if (__getOwnPropSymbols$
|
|
4098
|
-
for (var prop of __getOwnPropSymbols$
|
|
4099
|
-
if (__propIsEnum$
|
|
4100
|
-
__defNormalProp$
|
|
4093
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
4094
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
4095
|
+
if (__getOwnPropSymbols$4)
|
|
4096
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
4097
|
+
if (__propIsEnum$4.call(b, prop))
|
|
4098
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
4101
4099
|
}
|
|
4102
4100
|
return a;
|
|
4103
4101
|
};
|
|
@@ -4140,7 +4138,7 @@ const createInsertCtx = (q) => ({
|
|
|
4140
4138
|
relations: q.relations
|
|
4141
4139
|
});
|
|
4142
4140
|
const getInsertSingleReturnType = (q) => {
|
|
4143
|
-
const { select, returnType } = q.query;
|
|
4141
|
+
const { select, returnType = "all" } = q.query;
|
|
4144
4142
|
if (select) {
|
|
4145
4143
|
return returnType === "all" ? "one" : returnType;
|
|
4146
4144
|
} else {
|
|
@@ -4160,7 +4158,7 @@ const handleInsertOneData = (q, data, ctx) => {
|
|
|
4160
4158
|
const columnsMap = {};
|
|
4161
4159
|
const defaults = q.query.defaults;
|
|
4162
4160
|
if (defaults) {
|
|
4163
|
-
data = __spreadValues$
|
|
4161
|
+
data = __spreadValues$4(__spreadValues$4({}, defaults), data);
|
|
4164
4162
|
}
|
|
4165
4163
|
processInsertItem(data, 0, ctx, columns, columnsMap);
|
|
4166
4164
|
const values = [columns.map((key) => data[key])];
|
|
@@ -4171,7 +4169,7 @@ const handleInsertManyData = (q, data, ctx) => {
|
|
|
4171
4169
|
const columnsMap = {};
|
|
4172
4170
|
const defaults = q.query.defaults;
|
|
4173
4171
|
if (defaults) {
|
|
4174
|
-
data = data.map((item) => __spreadValues$
|
|
4172
|
+
data = data.map((item) => __spreadValues$4(__spreadValues$4({}, defaults), item));
|
|
4175
4173
|
}
|
|
4176
4174
|
data.forEach((item, i) => {
|
|
4177
4175
|
processInsertItem(item, i, ctx, columns, columnsMap);
|
|
@@ -4669,10 +4667,9 @@ class Json {
|
|
|
4669
4667
|
const q = this._wrap(this.__model.clone());
|
|
4670
4668
|
q._getOptional(
|
|
4671
4669
|
raw(
|
|
4672
|
-
this.query.
|
|
4670
|
+
queryTypeWithLimitOne[this.query.returnType] ? `row_to_json("t".*)` : `COALESCE(json_agg(row_to_json("t".*)), '[]')`
|
|
4673
4671
|
)
|
|
4674
4672
|
);
|
|
4675
|
-
delete q.query.take;
|
|
4676
4673
|
return q;
|
|
4677
4674
|
}
|
|
4678
4675
|
jsonSet(column, path, value, options) {
|
|
@@ -4823,6 +4820,60 @@ class QueryLog {
|
|
|
4823
4820
|
}
|
|
4824
4821
|
}
|
|
4825
4822
|
|
|
4823
|
+
var __defProp$3 = Object.defineProperty;
|
|
4824
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
4825
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
4826
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
4827
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4828
|
+
var __spreadValues$3 = (a, b) => {
|
|
4829
|
+
for (var prop in b || (b = {}))
|
|
4830
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
4831
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
4832
|
+
if (__getOwnPropSymbols$3)
|
|
4833
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
4834
|
+
if (__propIsEnum$3.call(b, prop))
|
|
4835
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
4836
|
+
}
|
|
4837
|
+
return a;
|
|
4838
|
+
};
|
|
4839
|
+
const mergableObjects = {
|
|
4840
|
+
withShapes: true,
|
|
4841
|
+
parsers: true,
|
|
4842
|
+
defaults: true,
|
|
4843
|
+
joinedParsers: true
|
|
4844
|
+
};
|
|
4845
|
+
class MergeQueryMethods {
|
|
4846
|
+
merge(q) {
|
|
4847
|
+
return this.clone()._merge(q);
|
|
4848
|
+
}
|
|
4849
|
+
_merge(q) {
|
|
4850
|
+
const a = this.query;
|
|
4851
|
+
const b = q.query;
|
|
4852
|
+
for (const key in b) {
|
|
4853
|
+
const value = b[key];
|
|
4854
|
+
switch (typeof value) {
|
|
4855
|
+
case "boolean":
|
|
4856
|
+
case "string":
|
|
4857
|
+
case "number":
|
|
4858
|
+
a[key] = value;
|
|
4859
|
+
break;
|
|
4860
|
+
case "object":
|
|
4861
|
+
if (Array.isArray(value)) {
|
|
4862
|
+
a[key] = a[key] ? [...a[key], ...value] : value;
|
|
4863
|
+
} else if (mergableObjects[key]) {
|
|
4864
|
+
a[key] = a[key] ? __spreadValues$3(__spreadValues$3({}, a[key]), value) : value;
|
|
4865
|
+
} else {
|
|
4866
|
+
a[key] = value;
|
|
4867
|
+
}
|
|
4868
|
+
break;
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
if (b.returnType)
|
|
4872
|
+
a.returnType = b.returnType;
|
|
4873
|
+
return this;
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4826
4877
|
var __defProp$2 = Object.defineProperty;
|
|
4827
4878
|
var __defProps = Object.defineProperties;
|
|
4828
4879
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -4981,7 +5032,7 @@ class Update {
|
|
|
4981
5032
|
return q._update(...args);
|
|
4982
5033
|
}
|
|
4983
5034
|
_update(...args) {
|
|
4984
|
-
var _a, _b;
|
|
5035
|
+
var _a, _b, _c;
|
|
4985
5036
|
const { query } = this;
|
|
4986
5037
|
const data = args[0];
|
|
4987
5038
|
const set = __spreadValues$1({}, data);
|
|
@@ -4989,7 +5040,7 @@ class Update {
|
|
|
4989
5040
|
const relations = this.relations;
|
|
4990
5041
|
const prependRelations = {};
|
|
4991
5042
|
const appendRelations = {};
|
|
4992
|
-
const originalReturnType = query.returnType;
|
|
5043
|
+
const originalReturnType = query.returnType || "all";
|
|
4993
5044
|
for (const key in data) {
|
|
4994
5045
|
if (relations[key]) {
|
|
4995
5046
|
delete set[key];
|
|
@@ -5023,12 +5074,14 @@ class Update {
|
|
|
5023
5074
|
if ((state == null ? void 0 : state.updateLater) || appendRelationKeys.length && originalReturnType !== "all") {
|
|
5024
5075
|
query.returnType = "all";
|
|
5025
5076
|
if (state == null ? void 0 : state.updateLater) {
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5077
|
+
if (!((_c = query.select) == null ? void 0 : _c.includes("*"))) {
|
|
5078
|
+
this.primaryKeys.forEach((key) => {
|
|
5079
|
+
var _a2;
|
|
5080
|
+
if (!((_a2 = query.select) == null ? void 0 : _a2.includes(key))) {
|
|
5081
|
+
this._select(key);
|
|
5082
|
+
}
|
|
5083
|
+
});
|
|
5084
|
+
}
|
|
5032
5085
|
}
|
|
5033
5086
|
const { handleResult } = query;
|
|
5034
5087
|
query.handleResult = async (q, queryResult) => {
|
|
@@ -5036,7 +5089,7 @@ class Update {
|
|
|
5036
5089
|
if (state == null ? void 0 : state.updateLater) {
|
|
5037
5090
|
await Promise.all(state.updateLaterPromises);
|
|
5038
5091
|
const t = this.__model.clone().transacting(q);
|
|
5039
|
-
const keys = this.
|
|
5092
|
+
const keys = this.primaryKeys;
|
|
5040
5093
|
t._whereIn(
|
|
5041
5094
|
keys,
|
|
5042
5095
|
resultOfTypeAll.map((item) => keys.map((key) => item[key]))
|
|
@@ -5062,6 +5115,9 @@ class Update {
|
|
|
5062
5115
|
return (q, result) => {
|
|
5063
5116
|
var _a2, _b2;
|
|
5064
5117
|
const all = resultOfTypeAll || result;
|
|
5118
|
+
if (q.query.returnType !== originalReturnType) {
|
|
5119
|
+
q.query.returnType = originalReturnType;
|
|
5120
|
+
}
|
|
5065
5121
|
return (_b2 = (_a2 = relations[relationName]).nestedUpdate) == null ? void 0 : _b2.call(_a2, q, all, appendRelations[relationName]);
|
|
5066
5122
|
};
|
|
5067
5123
|
})
|
|
@@ -5231,7 +5287,6 @@ class QueryMethods {
|
|
|
5231
5287
|
}
|
|
5232
5288
|
_all() {
|
|
5233
5289
|
this.query.returnType = "all";
|
|
5234
|
-
removeFromQuery(this, "take");
|
|
5235
5290
|
return this;
|
|
5236
5291
|
}
|
|
5237
5292
|
take() {
|
|
@@ -5239,7 +5294,6 @@ class QueryMethods {
|
|
|
5239
5294
|
}
|
|
5240
5295
|
_take() {
|
|
5241
5296
|
this.query.returnType = "oneOrThrow";
|
|
5242
|
-
this.query.take = true;
|
|
5243
5297
|
return this;
|
|
5244
5298
|
}
|
|
5245
5299
|
takeOptional() {
|
|
@@ -5247,7 +5301,6 @@ class QueryMethods {
|
|
|
5247
5301
|
}
|
|
5248
5302
|
_takeOptional() {
|
|
5249
5303
|
this.query.returnType = "one";
|
|
5250
|
-
this.query.take = true;
|
|
5251
5304
|
return this;
|
|
5252
5305
|
}
|
|
5253
5306
|
rows() {
|
|
@@ -5255,7 +5308,6 @@ class QueryMethods {
|
|
|
5255
5308
|
}
|
|
5256
5309
|
_rows() {
|
|
5257
5310
|
this.query.returnType = "rows";
|
|
5258
|
-
removeFromQuery(this, "take");
|
|
5259
5311
|
return this;
|
|
5260
5312
|
}
|
|
5261
5313
|
pluck(select) {
|
|
@@ -5263,7 +5315,6 @@ class QueryMethods {
|
|
|
5263
5315
|
}
|
|
5264
5316
|
_pluck(select) {
|
|
5265
5317
|
this.query.returnType = "pluck";
|
|
5266
|
-
removeFromQuery(this, "take");
|
|
5267
5318
|
this.query.select = [select];
|
|
5268
5319
|
addParserForSelectItem(this, this.query.as || this.table, "pluck", select);
|
|
5269
5320
|
return this;
|
|
@@ -5273,7 +5324,6 @@ class QueryMethods {
|
|
|
5273
5324
|
}
|
|
5274
5325
|
_exec() {
|
|
5275
5326
|
this.query.returnType = "void";
|
|
5276
|
-
removeFromQuery(this, "take");
|
|
5277
5327
|
return this;
|
|
5278
5328
|
}
|
|
5279
5329
|
clone() {
|
|
@@ -5290,22 +5340,20 @@ class QueryMethods {
|
|
|
5290
5340
|
_distinct(...columns) {
|
|
5291
5341
|
return pushQueryArray(this, "distinct", columns);
|
|
5292
5342
|
}
|
|
5293
|
-
find(
|
|
5294
|
-
return this.clone()._find(
|
|
5343
|
+
find(value) {
|
|
5344
|
+
return this.clone()._find(value);
|
|
5295
5345
|
}
|
|
5296
|
-
_find(
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
});
|
|
5301
|
-
return this._where(conditions)._take();
|
|
5346
|
+
_find(value) {
|
|
5347
|
+
return this._where({
|
|
5348
|
+
[this.singlePrimaryKey]: value
|
|
5349
|
+
})._take();
|
|
5302
5350
|
}
|
|
5303
|
-
findOptional(
|
|
5304
|
-
return this.clone()._findOptional(
|
|
5351
|
+
findOptional(value) {
|
|
5352
|
+
return this.clone()._findOptional(value);
|
|
5305
5353
|
}
|
|
5306
|
-
_findOptional(
|
|
5354
|
+
_findOptional(value) {
|
|
5307
5355
|
return this._find(
|
|
5308
|
-
|
|
5356
|
+
value
|
|
5309
5357
|
).takeOptional();
|
|
5310
5358
|
}
|
|
5311
5359
|
findBy(...args) {
|
|
@@ -5382,7 +5430,6 @@ class QueryMethods {
|
|
|
5382
5430
|
const q = this._getOptional(raw("true"));
|
|
5383
5431
|
q.query.notFoundDefault = false;
|
|
5384
5432
|
q.query.coalesceValue = false;
|
|
5385
|
-
delete q.query.take;
|
|
5386
5433
|
return q;
|
|
5387
5434
|
}
|
|
5388
5435
|
truncate(options) {
|
|
@@ -5422,7 +5469,8 @@ applyMixins(QueryMethods, [
|
|
|
5422
5469
|
QueryLog,
|
|
5423
5470
|
QueryCallbacks,
|
|
5424
5471
|
QueryUpsert,
|
|
5425
|
-
QueryGet
|
|
5472
|
+
QueryGet,
|
|
5473
|
+
MergeQueryMethods
|
|
5426
5474
|
]);
|
|
5427
5475
|
|
|
5428
5476
|
var __defProp = Object.defineProperty;
|
|
@@ -5466,14 +5514,18 @@ class Db {
|
|
|
5466
5514
|
this.query = {
|
|
5467
5515
|
adapter,
|
|
5468
5516
|
handleResult,
|
|
5469
|
-
returnType: "all",
|
|
5470
5517
|
logger,
|
|
5471
5518
|
log: logParamToLogObject(logger, options.log)
|
|
5472
5519
|
};
|
|
5473
5520
|
if (options == null ? void 0 : options.schema) {
|
|
5474
5521
|
this.query.schema = options.schema;
|
|
5475
5522
|
}
|
|
5476
|
-
this.
|
|
5523
|
+
this.primaryKeys = Object.keys(shape).filter(
|
|
5524
|
+
(key) => shape[key].isPrimaryKey
|
|
5525
|
+
);
|
|
5526
|
+
if (this.primaryKeys.length === 1) {
|
|
5527
|
+
this.singlePrimaryKey = this.primaryKeys[0];
|
|
5528
|
+
}
|
|
5477
5529
|
const columns = Object.keys(
|
|
5478
5530
|
shape
|
|
5479
5531
|
);
|
|
@@ -5514,7 +5566,7 @@ const createDb = (_a) => {
|
|
|
5514
5566
|
var _b = _a, {
|
|
5515
5567
|
log,
|
|
5516
5568
|
logger,
|
|
5517
|
-
columnTypes: ct
|
|
5569
|
+
columnTypes: ct
|
|
5518
5570
|
} = _b, options = __objRest(_b, [
|
|
5519
5571
|
"log",
|
|
5520
5572
|
"logger",
|
|
@@ -5549,10 +5601,8 @@ const createDb = (_a) => {
|
|
|
5549
5601
|
return db;
|
|
5550
5602
|
};
|
|
5551
5603
|
|
|
5552
|
-
const defaultsKey = Symbol("defaults");
|
|
5553
|
-
|
|
5554
5604
|
const relationQueryKey = Symbol("relationQuery");
|
|
5555
5605
|
const isRequiredRelationKey = Symbol("isRequiredRelation");
|
|
5556
5606
|
|
|
5557
|
-
export { Adapter, Aggregate, ArrayColumn, ArrayOfColumnsObjects, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ColumnInfoMethods, ColumnType, ColumnsObject, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DecimalBaseColumn, DecimalColumn, Delete, DoublePrecisionColumn, EMPTY_OBJECT, EnumColumn, For, From, Having, InetColumn, Insert, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, Json, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnQueryBuilder, Operators, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, QueryCallbacks, QueryGet, QueryLog, QueryMethods, QueryUpsert, RealColumn, Select, SerialColumn, SmallIntColumn, SmallSerialColumn,
|
|
5607
|
+
export { Adapter, Aggregate, ArrayColumn, ArrayOfColumnsObjects, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ColumnInfoMethods, ColumnType, ColumnsObject, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DecimalBaseColumn, DecimalColumn, Delete, DoublePrecisionColumn, EMPTY_OBJECT, EnumColumn, For, From, Having, InetColumn, Insert, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, Json, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnQueryBuilder, Operators, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, QueryCallbacks, QueryGet, QueryLog, QueryMethods, QueryUpsert, RealColumn, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, Transaction, TransactionAdapter, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, Update, VarCharColumn, Where, WhereQueryBuilder, With, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, applyMixins, array, arrayToEnum, checkIfASimpleQuery, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getRawSql, getTableData, getValidEnumValues, getValueKey, handleResult, instanceOf, intersection, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, makeRegexToFindInSql, map, nativeEnum, newTableData, noop, notNullable, notNullish, nullable, nullish, object, optional, parseRecord, parseResult, processSelectArg, pushOrNewArray, pushOrNewArrayToObject, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, raw, record, relationQueryKey, required, resetTableData, scalarTypes, set, setQueryObjectValue, toArray, toSql, toSqlCacheKey, tuple, union };
|
|
5558
5608
|
//# sourceMappingURL=index.esm.js.map
|