pqb 0.40.11 → 0.41.0
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 +20 -31
- package/dist/index.js +418 -366
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -367
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -117,25 +117,25 @@ const sqlFn = (...args) => {
|
|
|
117
117
|
return (...args2) => new RawSQL(args2, arg);
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
var __defProp$
|
|
121
|
-
var __defProps$
|
|
122
|
-
var __getOwnPropDescs$
|
|
123
|
-
var __getOwnPropSymbols$
|
|
124
|
-
var __hasOwnProp$
|
|
125
|
-
var __propIsEnum$
|
|
126
|
-
var __defNormalProp$
|
|
127
|
-
var __spreadValues$
|
|
120
|
+
var __defProp$o = Object.defineProperty;
|
|
121
|
+
var __defProps$e = Object.defineProperties;
|
|
122
|
+
var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
|
|
123
|
+
var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
|
|
124
|
+
var __hasOwnProp$p = Object.prototype.hasOwnProperty;
|
|
125
|
+
var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
|
|
126
|
+
var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
127
|
+
var __spreadValues$o = (a, b) => {
|
|
128
128
|
for (var prop in b || (b = {}))
|
|
129
|
-
if (__hasOwnProp$
|
|
130
|
-
__defNormalProp$
|
|
131
|
-
if (__getOwnPropSymbols$
|
|
132
|
-
for (var prop of __getOwnPropSymbols$
|
|
133
|
-
if (__propIsEnum$
|
|
134
|
-
__defNormalProp$
|
|
129
|
+
if (__hasOwnProp$p.call(b, prop))
|
|
130
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
131
|
+
if (__getOwnPropSymbols$p)
|
|
132
|
+
for (var prop of __getOwnPropSymbols$p(b)) {
|
|
133
|
+
if (__propIsEnum$p.call(b, prop))
|
|
134
|
+
__defNormalProp$o(a, prop, b[prop]);
|
|
135
135
|
}
|
|
136
136
|
return a;
|
|
137
137
|
};
|
|
138
|
-
var __spreadProps$
|
|
138
|
+
var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
|
|
139
139
|
class ColumnType extends ColumnTypeBase {
|
|
140
140
|
/**
|
|
141
141
|
* Mark the column as a primary key.
|
|
@@ -334,13 +334,13 @@ class ColumnType extends ColumnTypeBase {
|
|
|
334
334
|
*/
|
|
335
335
|
searchIndex(...args) {
|
|
336
336
|
return pushColumnData(this, "indexes", {
|
|
337
|
-
options: __spreadValues$
|
|
337
|
+
options: __spreadValues$o(__spreadValues$o({}, typeof args[0] === "string" ? args[1] : args[0]), this.dataType === "tsvector" ? { using: "GIN" } : { tsVector: true }),
|
|
338
338
|
name: typeof args[0] === "string" ? args[0] : void 0
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
unique(...args) {
|
|
342
342
|
return pushColumnData(this, "indexes", {
|
|
343
|
-
options: __spreadProps$
|
|
343
|
+
options: __spreadProps$e(__spreadValues$o({}, typeof args[0] === "string" ? args[1] : args[0]), {
|
|
344
344
|
unique: true
|
|
345
345
|
}),
|
|
346
346
|
name: typeof args[0] === "string" ? args[0] : void 0
|
|
@@ -383,25 +383,25 @@ class ColumnType extends ColumnTypeBase {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
var __defProp$
|
|
387
|
-
var __defProps$
|
|
388
|
-
var __getOwnPropDescs$
|
|
389
|
-
var __getOwnPropSymbols$
|
|
390
|
-
var __hasOwnProp$
|
|
391
|
-
var __propIsEnum$
|
|
392
|
-
var __defNormalProp$
|
|
393
|
-
var __spreadValues$
|
|
386
|
+
var __defProp$n = Object.defineProperty;
|
|
387
|
+
var __defProps$d = Object.defineProperties;
|
|
388
|
+
var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
389
|
+
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
390
|
+
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
391
|
+
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
392
|
+
var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
393
|
+
var __spreadValues$n = (a, b) => {
|
|
394
394
|
for (var prop in b || (b = {}))
|
|
395
|
-
if (__hasOwnProp$
|
|
396
|
-
__defNormalProp$
|
|
397
|
-
if (__getOwnPropSymbols$
|
|
398
|
-
for (var prop of __getOwnPropSymbols$
|
|
399
|
-
if (__propIsEnum$
|
|
400
|
-
__defNormalProp$
|
|
395
|
+
if (__hasOwnProp$o.call(b, prop))
|
|
396
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
397
|
+
if (__getOwnPropSymbols$o)
|
|
398
|
+
for (var prop of __getOwnPropSymbols$o(b)) {
|
|
399
|
+
if (__propIsEnum$o.call(b, prop))
|
|
400
|
+
__defNormalProp$n(a, prop, b[prop]);
|
|
401
401
|
}
|
|
402
402
|
return a;
|
|
403
403
|
};
|
|
404
|
-
var __spreadProps$
|
|
404
|
+
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
405
405
|
const knownDefaults = {
|
|
406
406
|
current_timestamp: "now()",
|
|
407
407
|
"transaction_timestamp()": "now()"
|
|
@@ -417,7 +417,7 @@ const simplifyColumnDefault = (value) => {
|
|
|
417
417
|
const instantiateColumn = (typeFn, params) => {
|
|
418
418
|
const column = typeFn();
|
|
419
419
|
const { dateTimePrecision } = params;
|
|
420
|
-
Object.assign(column.data, __spreadProps$
|
|
420
|
+
Object.assign(column.data, __spreadProps$d(__spreadValues$n({}, params), {
|
|
421
421
|
dateTimePrecision: (
|
|
422
422
|
// 0 is default for date, 6 is default for timestamp
|
|
423
423
|
dateTimePrecision && dateTimePrecision !== 6 ? dateTimePrecision : void 0
|
|
@@ -775,8 +775,9 @@ const identityToCode = (identity, dataType) => {
|
|
|
775
775
|
addCode(code, ")");
|
|
776
776
|
return code;
|
|
777
777
|
};
|
|
778
|
-
const columnCode = (type, ctx, key, code
|
|
778
|
+
const columnCode = (type, ctx, key, code) => {
|
|
779
779
|
var _a;
|
|
780
|
+
const { data } = type;
|
|
780
781
|
code = toArray(code);
|
|
781
782
|
let prepend = `${ctx.t}.`;
|
|
782
783
|
const keyName = ctx.snakeCase ? toSnakeCase(key) : key;
|
|
@@ -807,13 +808,15 @@ const columnCode = (type, ctx, key, code, data = type.data, skip) => {
|
|
|
807
808
|
addCode(code, ".select(false)");
|
|
808
809
|
if (data.isNullable)
|
|
809
810
|
addCode(code, ".nullable()");
|
|
810
|
-
if (
|
|
811
|
-
addCode(code, `.encode(${
|
|
812
|
-
if (
|
|
813
|
-
addCode(code, `.parse(${
|
|
811
|
+
if (data.encode && data.encode !== data.defaultEncode)
|
|
812
|
+
addCode(code, `.encode(${data.encode.toString()})`);
|
|
813
|
+
if (data.parse && data.parse !== data.defaultParse)
|
|
814
|
+
addCode(code, `.parse(${data.parse.toString()})`);
|
|
815
|
+
if (type.data.parseNull)
|
|
816
|
+
addCode(code, `.parseNull(${type.data.parseNull.toString()})`);
|
|
814
817
|
if (data.as)
|
|
815
818
|
addCode(code, `.as(${data.as.toCode(ctx, key)})`);
|
|
816
|
-
if (data.default !== void 0 && (!ctx.migration || typeof data.default !== "function")) {
|
|
819
|
+
if (data.default !== void 0 && data.default !== data.defaultDefault && (!ctx.migration || typeof data.default !== "function")) {
|
|
817
820
|
addCode(
|
|
818
821
|
code,
|
|
819
822
|
`.default(${columnDefaultArgumentToCode(ctx.t, data.default)})`
|
|
@@ -856,21 +859,73 @@ const getSqlText = (sql) => {
|
|
|
856
859
|
throw new Error(`Batch SQL is not supported in this query`);
|
|
857
860
|
};
|
|
858
861
|
|
|
859
|
-
var __defProp$
|
|
862
|
+
var __defProp$m = Object.defineProperty;
|
|
863
|
+
var __defProps$c = Object.defineProperties;
|
|
864
|
+
var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
|
|
865
|
+
var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
|
|
866
|
+
var __hasOwnProp$n = Object.prototype.hasOwnProperty;
|
|
867
|
+
var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
|
|
868
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
869
|
+
var __spreadValues$m = (a, b) => {
|
|
870
|
+
for (var prop in b || (b = {}))
|
|
871
|
+
if (__hasOwnProp$n.call(b, prop))
|
|
872
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
873
|
+
if (__getOwnPropSymbols$n)
|
|
874
|
+
for (var prop of __getOwnPropSymbols$n(b)) {
|
|
875
|
+
if (__propIsEnum$n.call(b, prop))
|
|
876
|
+
__defNormalProp$m(a, prop, b[prop]);
|
|
877
|
+
}
|
|
878
|
+
return a;
|
|
879
|
+
};
|
|
880
|
+
var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
|
|
881
|
+
const addColumnParserToQuery = (q, key, column) => {
|
|
882
|
+
var _a;
|
|
883
|
+
if (column._parse) {
|
|
884
|
+
((_a = q.parsers) != null ? _a : q.parsers = {})[key] = column._parse;
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
const setColumnDefaultParse = (column, parse) => {
|
|
888
|
+
column.data.parse = column.data.defaultParse = parse;
|
|
889
|
+
column._parse = (input) => input === null ? null : parse(input);
|
|
890
|
+
};
|
|
891
|
+
const setColumnParse = (column, fn, outputSchema) => {
|
|
892
|
+
const c = Object.create(column);
|
|
893
|
+
c.outputSchema = outputSchema;
|
|
894
|
+
c.data = __spreadProps$c(__spreadValues$m({}, column.data), { parse: fn });
|
|
895
|
+
const { parseNull } = column.data;
|
|
896
|
+
c._parse = parseNull ? (input) => input === null ? parseNull() : fn(input) : (input) => input === null ? null : fn(input);
|
|
897
|
+
return c;
|
|
898
|
+
};
|
|
899
|
+
const setColumnParseNull = (column, fn, nullSchema) => {
|
|
900
|
+
const c = Object.create(column);
|
|
901
|
+
c.nullSchema = nullSchema;
|
|
902
|
+
c.data = __spreadProps$c(__spreadValues$m({}, column.data), { parseNull: fn });
|
|
903
|
+
const { parse } = column.data;
|
|
904
|
+
c._parse = parse ? (input) => input === null ? fn() : parse(input) : (input) => input === null ? fn() : input;
|
|
905
|
+
return c;
|
|
906
|
+
};
|
|
907
|
+
const setColumnEncode = (column, fn, inputSchema) => {
|
|
908
|
+
const c = Object.create(column);
|
|
909
|
+
c.inputSchema = inputSchema;
|
|
910
|
+
c.data = __spreadProps$c(__spreadValues$m({}, column.data), { encode: fn });
|
|
911
|
+
return c;
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
var __defProp$l = Object.defineProperty;
|
|
860
915
|
var __defProps$b = Object.defineProperties;
|
|
861
916
|
var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
|
|
862
|
-
var __getOwnPropSymbols$
|
|
863
|
-
var __hasOwnProp$
|
|
864
|
-
var __propIsEnum$
|
|
865
|
-
var __defNormalProp$
|
|
866
|
-
var __spreadValues$
|
|
917
|
+
var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
|
|
918
|
+
var __hasOwnProp$m = Object.prototype.hasOwnProperty;
|
|
919
|
+
var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
|
|
920
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
921
|
+
var __spreadValues$l = (a, b) => {
|
|
867
922
|
for (var prop in b || (b = {}))
|
|
868
|
-
if (__hasOwnProp$
|
|
869
|
-
__defNormalProp$
|
|
870
|
-
if (__getOwnPropSymbols$
|
|
871
|
-
for (var prop of __getOwnPropSymbols$
|
|
872
|
-
if (__propIsEnum$
|
|
873
|
-
__defNormalProp$
|
|
923
|
+
if (__hasOwnProp$m.call(b, prop))
|
|
924
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
925
|
+
if (__getOwnPropSymbols$m)
|
|
926
|
+
for (var prop of __getOwnPropSymbols$m(b)) {
|
|
927
|
+
if (__propIsEnum$m.call(b, prop))
|
|
928
|
+
__defNormalProp$l(a, prop, b[prop]);
|
|
874
929
|
}
|
|
875
930
|
return a;
|
|
876
931
|
};
|
|
@@ -963,7 +1018,7 @@ const base = {
|
|
|
963
1018
|
(key, value, ctx, quotedAs) => `NOT ${key} IN ${quoteValue(value, ctx, quotedAs)}`
|
|
964
1019
|
)
|
|
965
1020
|
};
|
|
966
|
-
const boolean = __spreadProps$b(__spreadValues$
|
|
1021
|
+
const boolean = __spreadProps$b(__spreadValues$l({}, base), {
|
|
967
1022
|
and: make(
|
|
968
1023
|
(key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
|
|
969
1024
|
),
|
|
@@ -971,7 +1026,7 @@ const boolean = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
971
1026
|
(key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
|
|
972
1027
|
)
|
|
973
1028
|
});
|
|
974
|
-
const numeric = __spreadProps$b(__spreadValues$
|
|
1029
|
+
const numeric = __spreadProps$b(__spreadValues$l({}, base), {
|
|
975
1030
|
lt: make(
|
|
976
1031
|
(key, value, ctx, quotedAs) => `${key} < ${quoteValue(value, ctx, quotedAs)}`
|
|
977
1032
|
),
|
|
@@ -992,7 +1047,7 @@ const numeric = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
992
1047
|
)}`
|
|
993
1048
|
)
|
|
994
1049
|
});
|
|
995
|
-
const text = __spreadProps$b(__spreadValues$
|
|
1050
|
+
const text = __spreadProps$b(__spreadValues$l({}, base), {
|
|
996
1051
|
contains: make(
|
|
997
1052
|
(key, value, ctx, quotedAs) => `${key} ILIKE '%' || ${quoteLikeValue(value, ctx, quotedAs)} || '%'`
|
|
998
1053
|
),
|
|
@@ -1014,10 +1069,10 @@ const text = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
1014
1069
|
});
|
|
1015
1070
|
const encodeJsonPath = (ctx, path) => addValue(ctx.values, `{${Array.isArray(path) ? path.join(", ") : path}}`);
|
|
1016
1071
|
const jsonPathQueryOp = (key, [path, options], ctx) => `jsonb_path_query_first(${key}, ${addValue(ctx.values, path)}${(options == null ? void 0 : options.vars) ? `, ${addValue(ctx.values, JSON.stringify(options.vars))}${options.silent ? ", true" : ""}` : (options == null ? void 0 : options.silent) ? ", NULL, true" : ""})`;
|
|
1017
|
-
const json = __spreadProps$b(__spreadValues$
|
|
1072
|
+
const json = __spreadProps$b(__spreadValues$l({}, base), {
|
|
1018
1073
|
jsonPathQueryFirst: Object.assign(
|
|
1019
1074
|
function(path, options) {
|
|
1020
|
-
var _a, _b, _c
|
|
1075
|
+
var _a, _b, _c;
|
|
1021
1076
|
const chain = (_b = (_a = this.q).chain) != null ? _b : _a.chain = [];
|
|
1022
1077
|
chain.push(jsonPathQueryOp, [path, options]);
|
|
1023
1078
|
if ((_c = this.q.parsers) == null ? void 0 : _c[getValueKey]) {
|
|
@@ -1025,8 +1080,7 @@ const json = __spreadProps$b(__spreadValues$k({}, base), {
|
|
|
1025
1080
|
}
|
|
1026
1081
|
if (options == null ? void 0 : options.type) {
|
|
1027
1082
|
const type = options.type(this.columnTypes);
|
|
1028
|
-
|
|
1029
|
-
((_e = (_d = this.q).parsers) != null ? _e : _d.parsers = {})[getValueKey] = type.parseFn;
|
|
1083
|
+
addColumnParserToQuery(this.q, getValueKey, type);
|
|
1030
1084
|
chain.push = (...args) => {
|
|
1031
1085
|
chain.push = Array.prototype.push;
|
|
1032
1086
|
chain.push((s) => `${s}::${type.dataType}`, emptyArray);
|
|
@@ -1077,25 +1131,22 @@ const Operators = {
|
|
|
1077
1131
|
array: base
|
|
1078
1132
|
};
|
|
1079
1133
|
|
|
1080
|
-
var __defProp$
|
|
1081
|
-
var
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1085
|
-
var
|
|
1086
|
-
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1087
|
-
var __spreadValues$j = (a, b) => {
|
|
1134
|
+
var __defProp$k = Object.defineProperty;
|
|
1135
|
+
var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
|
|
1136
|
+
var __hasOwnProp$l = Object.prototype.hasOwnProperty;
|
|
1137
|
+
var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
|
|
1138
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1139
|
+
var __spreadValues$k = (a, b) => {
|
|
1088
1140
|
for (var prop in b || (b = {}))
|
|
1089
|
-
if (__hasOwnProp$
|
|
1090
|
-
__defNormalProp$
|
|
1091
|
-
if (__getOwnPropSymbols$
|
|
1092
|
-
for (var prop of __getOwnPropSymbols$
|
|
1093
|
-
if (__propIsEnum$
|
|
1094
|
-
__defNormalProp$
|
|
1141
|
+
if (__hasOwnProp$l.call(b, prop))
|
|
1142
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
1143
|
+
if (__getOwnPropSymbols$l)
|
|
1144
|
+
for (var prop of __getOwnPropSymbols$l(b)) {
|
|
1145
|
+
if (__propIsEnum$l.call(b, prop))
|
|
1146
|
+
__defNormalProp$k(a, prop, b[prop]);
|
|
1095
1147
|
}
|
|
1096
1148
|
return a;
|
|
1097
1149
|
};
|
|
1098
|
-
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
1099
1150
|
class TextBaseColumn extends ColumnType {
|
|
1100
1151
|
constructor(schema, schemaType = schema.stringSchema()) {
|
|
1101
1152
|
super(schema, schemaType);
|
|
@@ -1149,7 +1200,7 @@ class StringColumn extends VarCharColumn {
|
|
|
1149
1200
|
}
|
|
1150
1201
|
}
|
|
1151
1202
|
const textColumnToCode = (column, ctx, key) => {
|
|
1152
|
-
const data = __spreadValues$
|
|
1203
|
+
const data = __spreadValues$k({}, column.data);
|
|
1153
1204
|
let args = "";
|
|
1154
1205
|
const hasMax = data.maxArg !== void 0 && data.max === data.maxArg;
|
|
1155
1206
|
if (data.minArg !== void 0 && data.min === data.minArg || hasMax) {
|
|
@@ -1265,19 +1316,20 @@ class MoneyColumn extends ColumnType {
|
|
|
1265
1316
|
super(schema, schema.number());
|
|
1266
1317
|
this.dataType = "money";
|
|
1267
1318
|
this.operators = Operators.number;
|
|
1268
|
-
this
|
|
1269
|
-
function(input) {
|
|
1270
|
-
return input === null ? input : parseFloat(input.replace(/,/g, "").replace(/\$/g, ""));
|
|
1271
|
-
},
|
|
1272
|
-
{
|
|
1273
|
-
hideFromCode: true
|
|
1274
|
-
}
|
|
1275
|
-
);
|
|
1319
|
+
setColumnDefaultParse(this, moneyParse);
|
|
1276
1320
|
}
|
|
1277
1321
|
toCode(ctx, key) {
|
|
1278
1322
|
return columnCode(this, ctx, key, `money()`);
|
|
1279
1323
|
}
|
|
1280
1324
|
}
|
|
1325
|
+
const moneyParse = Object.assign(
|
|
1326
|
+
function(input) {
|
|
1327
|
+
return input === null ? input : parseFloat(input.replace(/,/g, "").replace(/\$/g, ""));
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
hideFromCode: true
|
|
1331
|
+
}
|
|
1332
|
+
);
|
|
1281
1333
|
class CidrColumn extends ColumnType {
|
|
1282
1334
|
constructor(schema) {
|
|
1283
1335
|
super(schema, schema.stringSchema());
|
|
@@ -1436,6 +1488,7 @@ class UUIDColumn extends ColumnType {
|
|
|
1436
1488
|
super(schema, schema.uuid());
|
|
1437
1489
|
this.dataType = "uuid";
|
|
1438
1490
|
this.operators = Operators.text;
|
|
1491
|
+
this.data.defaultDefault = uuidDefault;
|
|
1439
1492
|
}
|
|
1440
1493
|
/**
|
|
1441
1494
|
* see {@link ColumnType.primaryKey}
|
|
@@ -1447,15 +1500,7 @@ class UUIDColumn extends ColumnType {
|
|
|
1447
1500
|
return column;
|
|
1448
1501
|
}
|
|
1449
1502
|
toCode(ctx, key) {
|
|
1450
|
-
|
|
1451
|
-
return columnCode(
|
|
1452
|
-
this,
|
|
1453
|
-
ctx,
|
|
1454
|
-
key,
|
|
1455
|
-
`uuid()`,
|
|
1456
|
-
// don't output the default default
|
|
1457
|
-
data.default instanceof RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$a(__spreadValues$j({}, data), { default: void 0 }) : data
|
|
1458
|
-
);
|
|
1503
|
+
return columnCode(this, ctx, key, `uuid()`);
|
|
1459
1504
|
}
|
|
1460
1505
|
}
|
|
1461
1506
|
class XMLColumn extends ColumnType {
|
|
@@ -1482,7 +1527,6 @@ class CitextColumn extends TextBaseColumn {
|
|
|
1482
1527
|
const dateTimeEncode = (input) => {
|
|
1483
1528
|
return typeof input === "number" ? new Date(input) : input;
|
|
1484
1529
|
};
|
|
1485
|
-
const skipDateMethodsFromToCode = { encodeFn: dateTimeEncode };
|
|
1486
1530
|
class DateBaseColumn extends ColumnType {
|
|
1487
1531
|
constructor(schema) {
|
|
1488
1532
|
super(
|
|
@@ -1492,9 +1536,9 @@ class DateBaseColumn extends ColumnType {
|
|
|
1492
1536
|
schema.stringNumberDate()
|
|
1493
1537
|
);
|
|
1494
1538
|
this.operators = Operators.date;
|
|
1495
|
-
this.encodeFn = dateTimeEncode;
|
|
1496
1539
|
this.asNumber = schema.dateAsNumber;
|
|
1497
1540
|
this.asDate = schema.dateAsDate;
|
|
1541
|
+
this.data.encode = this.data.defaultEncode = dateTimeEncode;
|
|
1498
1542
|
}
|
|
1499
1543
|
}
|
|
1500
1544
|
class DateColumn extends DateBaseColumn {
|
|
@@ -1507,9 +1551,7 @@ class DateColumn extends DateBaseColumn {
|
|
|
1507
1551
|
this,
|
|
1508
1552
|
ctx,
|
|
1509
1553
|
key,
|
|
1510
|
-
`date()${dateDataToCode(this.data, ctx.migration)}
|
|
1511
|
-
this.data,
|
|
1512
|
-
skipDateMethodsFromToCode
|
|
1554
|
+
`date()${dateDataToCode(this.data, ctx.migration)}`
|
|
1513
1555
|
);
|
|
1514
1556
|
}
|
|
1515
1557
|
}
|
|
@@ -1547,9 +1589,7 @@ const timestampToCode = (self, ctx, key) => {
|
|
|
1547
1589
|
self,
|
|
1548
1590
|
ctx,
|
|
1549
1591
|
key,
|
|
1550
|
-
`timestamps${noTz}(${p && p !== 6 ? p : ""}).${defaultTimestamp}${dateDataToCode(self.data, ctx.migration)}
|
|
1551
|
-
self.data,
|
|
1552
|
-
skipDateMethodsFromToCode
|
|
1592
|
+
`timestamps${noTz}(${p && p !== 6 ? p : ""}).${defaultTimestamp}${dateDataToCode(self.data, ctx.migration)}`
|
|
1553
1593
|
);
|
|
1554
1594
|
self.data.default = def;
|
|
1555
1595
|
self.data.modifyQuery = modifyQuery;
|
|
@@ -1559,9 +1599,7 @@ const timestampToCode = (self, ctx, key) => {
|
|
|
1559
1599
|
self,
|
|
1560
1600
|
ctx,
|
|
1561
1601
|
key,
|
|
1562
|
-
`${self instanceof TimestampColumn ? "timestampNoTZ" : "timestamp"}(${p && p !== 6 ? p : ""})${dateDataToCode(self.data, ctx.migration)}
|
|
1563
|
-
self.data,
|
|
1564
|
-
skipDateMethodsFromToCode
|
|
1602
|
+
`${self instanceof TimestampColumn ? "timestampNoTZ" : "timestamp"}(${p && p !== 6 ? p : ""})${dateDataToCode(self.data, ctx.migration)}`
|
|
1565
1603
|
);
|
|
1566
1604
|
}
|
|
1567
1605
|
};
|
|
@@ -1600,9 +1638,7 @@ class TimeColumn extends ColumnType {
|
|
|
1600
1638
|
`time(${dateTimePrecision || ""})${dateDataToCode(
|
|
1601
1639
|
this.data,
|
|
1602
1640
|
ctx.migration
|
|
1603
|
-
)}
|
|
1604
|
-
this.data,
|
|
1605
|
-
skipDateMethodsFromToCode
|
|
1641
|
+
)}`
|
|
1606
1642
|
);
|
|
1607
1643
|
}
|
|
1608
1644
|
}
|
|
@@ -1620,9 +1656,7 @@ class IntervalColumn extends ColumnType {
|
|
|
1620
1656
|
this,
|
|
1621
1657
|
ctx,
|
|
1622
1658
|
key,
|
|
1623
|
-
`interval(${[fields && `'${fields}'`, precision && String(precision)].filter((part) => part).join(", ")})
|
|
1624
|
-
this.data,
|
|
1625
|
-
skipDateMethodsFromToCode
|
|
1659
|
+
`interval(${[fields && `'${fields}'`, precision && String(precision)].filter((part) => part).join(", ")})`
|
|
1626
1660
|
);
|
|
1627
1661
|
}
|
|
1628
1662
|
toSQL() {
|
|
@@ -1640,28 +1674,26 @@ class BooleanColumn extends ColumnType {
|
|
|
1640
1674
|
this.dataType = "bool";
|
|
1641
1675
|
this.operators = Operators.boolean;
|
|
1642
1676
|
this.data.alias = "boolean";
|
|
1677
|
+
this.data.parseItem = parseItem;
|
|
1643
1678
|
}
|
|
1644
1679
|
toCode(ctx, key) {
|
|
1645
1680
|
return columnCode(this, ctx, key, "boolean()");
|
|
1646
1681
|
}
|
|
1647
|
-
parseItem(input) {
|
|
1648
|
-
return input[0] === "t";
|
|
1649
|
-
}
|
|
1650
1682
|
}
|
|
1683
|
+
const parseItem = (input) => input[0] === "t";
|
|
1651
1684
|
|
|
1652
|
-
const
|
|
1653
|
-
const toCodeSkip = { encodeFn };
|
|
1685
|
+
const encode = (x) => x === null ? x : JSON.stringify(x);
|
|
1654
1686
|
class JSONColumn extends ColumnType {
|
|
1655
|
-
constructor() {
|
|
1656
|
-
super(
|
|
1687
|
+
constructor(schema, inputType) {
|
|
1688
|
+
super(schema, inputType);
|
|
1657
1689
|
this.dataType = "jsonb";
|
|
1658
1690
|
this.operators = Operators.json;
|
|
1691
|
+
this.data.encode = this.data.defaultEncode = encode;
|
|
1659
1692
|
}
|
|
1660
1693
|
toCode(ctx, key) {
|
|
1661
|
-
return columnCode(this, ctx, key, `json()
|
|
1694
|
+
return columnCode(this, ctx, key, `json()`);
|
|
1662
1695
|
}
|
|
1663
1696
|
}
|
|
1664
|
-
JSONColumn.prototype.encodeFn = encodeFn;
|
|
1665
1697
|
class JSONTextColumn extends ColumnType {
|
|
1666
1698
|
constructor(schema) {
|
|
1667
1699
|
super(schema, schema.stringSchema());
|
|
@@ -1669,7 +1701,7 @@ class JSONTextColumn extends ColumnType {
|
|
|
1669
1701
|
this.operators = Operators.text;
|
|
1670
1702
|
}
|
|
1671
1703
|
toCode(ctx, key) {
|
|
1672
|
-
return columnCode(this, ctx, key, `jsonText()
|
|
1704
|
+
return columnCode(this, ctx, key, `jsonText()`);
|
|
1673
1705
|
}
|
|
1674
1706
|
}
|
|
1675
1707
|
|
|
@@ -1682,10 +1714,7 @@ const queryTypeWithLimitOne = {
|
|
|
1682
1714
|
const isQueryReturnsAll = (q) => !q.q.returnType || q.q.returnType === "all";
|
|
1683
1715
|
|
|
1684
1716
|
const applySqlComputed = (ctx, q, computed, as, quotedAs) => {
|
|
1685
|
-
|
|
1686
|
-
const parser = computed.result.value.parseFn;
|
|
1687
|
-
if (parser)
|
|
1688
|
-
((_a = q.parsers) != null ? _a : q.parsers = {})[as] = parser;
|
|
1717
|
+
addColumnParserToQuery(q, as, computed.result.value);
|
|
1689
1718
|
return computed.toSQL(ctx, quotedAs);
|
|
1690
1719
|
};
|
|
1691
1720
|
function simpleColumnToSQL(ctx, q, key, column, quotedAs) {
|
|
@@ -1745,7 +1774,7 @@ const columnWithDotToSql = (ctx, data, shape, column, index, quotedAs, select) =
|
|
|
1745
1774
|
if (key === "*") {
|
|
1746
1775
|
return ((_a = data.joinedShapes) == null ? void 0 : _a[table]) ? select ? `row_to_json("${table}".*)` : `"${table}".*` : column;
|
|
1747
1776
|
}
|
|
1748
|
-
const tableName = ((_b = data.
|
|
1777
|
+
const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
|
|
1749
1778
|
const quoted = `"${table}"`;
|
|
1750
1779
|
const col = quoted === quotedAs ? shape[key] : (_d = (_c = data.joinedShapes) == null ? void 0 : _c[tableName]) == null ? void 0 : _d[key];
|
|
1751
1780
|
if (col) {
|
|
@@ -1796,7 +1825,7 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
1796
1825
|
}
|
|
1797
1826
|
return column;
|
|
1798
1827
|
}
|
|
1799
|
-
const tableName = ((_b = data.
|
|
1828
|
+
const tableName = ((_b = data.aliases) == null ? void 0 : _b[table]) || table;
|
|
1800
1829
|
const quoted = `"${table}"`;
|
|
1801
1830
|
const col = quoted === quotedAs ? data.shape[key] : (_c = data.joinedShapes) == null ? void 0 : _c[tableName][key];
|
|
1802
1831
|
if (col) {
|
|
@@ -2137,9 +2166,9 @@ const processWhere = (ands, ctx, table, query, data, quotedAs) => {
|
|
|
2137
2166
|
const item = value;
|
|
2138
2167
|
const joinAs = `"${getJoinItemSource(item.joinFrom)}"`;
|
|
2139
2168
|
const { on } = item;
|
|
2140
|
-
const q = item.
|
|
2169
|
+
const q = item.useOuterAliases ? {
|
|
2141
2170
|
joinedShapes: query.joinedShapes,
|
|
2142
|
-
|
|
2171
|
+
aliases: query.outerAliases,
|
|
2143
2172
|
shape: query.shape
|
|
2144
2173
|
} : query;
|
|
2145
2174
|
ands.push(
|
|
@@ -2267,25 +2296,25 @@ const pushIn = (ctx, query, ands, quotedAs, arg) => {
|
|
|
2267
2296
|
ands.push(`${multiple ? `(${columnsSql})` : columnsSql} IN ${value}`);
|
|
2268
2297
|
};
|
|
2269
2298
|
|
|
2270
|
-
var __defProp$
|
|
2271
|
-
var __defProps$
|
|
2272
|
-
var __getOwnPropDescs$
|
|
2273
|
-
var __getOwnPropSymbols$
|
|
2274
|
-
var __hasOwnProp$
|
|
2275
|
-
var __propIsEnum$
|
|
2276
|
-
var __defNormalProp$
|
|
2277
|
-
var __spreadValues$
|
|
2299
|
+
var __defProp$j = Object.defineProperty;
|
|
2300
|
+
var __defProps$a = Object.defineProperties;
|
|
2301
|
+
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
2302
|
+
var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
|
|
2303
|
+
var __hasOwnProp$k = Object.prototype.hasOwnProperty;
|
|
2304
|
+
var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
|
|
2305
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2306
|
+
var __spreadValues$j = (a, b) => {
|
|
2278
2307
|
for (var prop in b || (b = {}))
|
|
2279
|
-
if (__hasOwnProp$
|
|
2280
|
-
__defNormalProp$
|
|
2281
|
-
if (__getOwnPropSymbols$
|
|
2282
|
-
for (var prop of __getOwnPropSymbols$
|
|
2283
|
-
if (__propIsEnum$
|
|
2284
|
-
__defNormalProp$
|
|
2308
|
+
if (__hasOwnProp$k.call(b, prop))
|
|
2309
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2310
|
+
if (__getOwnPropSymbols$k)
|
|
2311
|
+
for (var prop of __getOwnPropSymbols$k(b)) {
|
|
2312
|
+
if (__propIsEnum$k.call(b, prop))
|
|
2313
|
+
__defNormalProp$j(a, prop, b[prop]);
|
|
2285
2314
|
}
|
|
2286
2315
|
return a;
|
|
2287
2316
|
};
|
|
2288
|
-
var __spreadProps$
|
|
2317
|
+
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
2289
2318
|
const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
2290
2319
|
let target;
|
|
2291
2320
|
let on;
|
|
@@ -2347,8 +2376,8 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
|
2347
2376
|
const whereSql = whereToSql(
|
|
2348
2377
|
ctx,
|
|
2349
2378
|
q,
|
|
2350
|
-
__spreadProps$
|
|
2351
|
-
joinedShapes: __spreadProps$
|
|
2379
|
+
__spreadProps$a(__spreadValues$j({}, q.q), {
|
|
2380
|
+
joinedShapes: __spreadProps$a(__spreadValues$j(__spreadValues$j({}, query.joinedShapes), q.q.joinedShapes), {
|
|
2352
2381
|
[table.q.as || table.table]: table.q.shape
|
|
2353
2382
|
})
|
|
2354
2383
|
}),
|
|
@@ -2451,7 +2480,7 @@ const pushJoinSql = (ctx, table, query, quotedAs) => {
|
|
|
2451
2480
|
const { aliasValue } = ctx;
|
|
2452
2481
|
ctx.aliasValue = true;
|
|
2453
2482
|
const as = item[2];
|
|
2454
|
-
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.
|
|
2483
|
+
sql = `${item[0]} LATERAL (${getSqlText(q.toSQL(ctx))}) "${((_a = query.aliases) == null ? void 0 : _a[as]) || as}" ON true`;
|
|
2455
2484
|
ctx.aliasValue = aliasValue;
|
|
2456
2485
|
} else {
|
|
2457
2486
|
const { target, on = "true" } = processJoinItem(
|
|
@@ -2480,7 +2509,8 @@ const skipQueryKeysForSubQuery = {
|
|
|
2480
2509
|
or: true,
|
|
2481
2510
|
returnType: true,
|
|
2482
2511
|
joinedShapes: true,
|
|
2483
|
-
returnsOne: true
|
|
2512
|
+
returnsOne: true,
|
|
2513
|
+
aliases: true
|
|
2484
2514
|
};
|
|
2485
2515
|
const getIsJoinSubQuery = (query) => {
|
|
2486
2516
|
const {
|
|
@@ -2495,25 +2525,25 @@ const getIsJoinSubQuery = (query) => {
|
|
|
2495
2525
|
return false;
|
|
2496
2526
|
};
|
|
2497
2527
|
|
|
2498
|
-
var __defProp$
|
|
2499
|
-
var __defProps$
|
|
2500
|
-
var __getOwnPropDescs$
|
|
2501
|
-
var __getOwnPropSymbols$
|
|
2502
|
-
var __hasOwnProp$
|
|
2503
|
-
var __propIsEnum$
|
|
2504
|
-
var __defNormalProp$
|
|
2505
|
-
var __spreadValues$
|
|
2528
|
+
var __defProp$i = Object.defineProperty;
|
|
2529
|
+
var __defProps$9 = Object.defineProperties;
|
|
2530
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
2531
|
+
var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
|
|
2532
|
+
var __hasOwnProp$j = Object.prototype.hasOwnProperty;
|
|
2533
|
+
var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
|
|
2534
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2535
|
+
var __spreadValues$i = (a, b) => {
|
|
2506
2536
|
for (var prop in b || (b = {}))
|
|
2507
|
-
if (__hasOwnProp$
|
|
2508
|
-
__defNormalProp$
|
|
2509
|
-
if (__getOwnPropSymbols$
|
|
2510
|
-
for (var prop of __getOwnPropSymbols$
|
|
2511
|
-
if (__propIsEnum$
|
|
2512
|
-
__defNormalProp$
|
|
2537
|
+
if (__hasOwnProp$j.call(b, prop))
|
|
2538
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2539
|
+
if (__getOwnPropSymbols$j)
|
|
2540
|
+
for (var prop of __getOwnPropSymbols$j(b)) {
|
|
2541
|
+
if (__propIsEnum$j.call(b, prop))
|
|
2542
|
+
__defNormalProp$i(a, prop, b[prop]);
|
|
2513
2543
|
}
|
|
2514
2544
|
return a;
|
|
2515
2545
|
};
|
|
2516
|
-
var __spreadProps$
|
|
2546
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
2517
2547
|
const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
2518
2548
|
var _a;
|
|
2519
2549
|
if (typeof first === "string") {
|
|
@@ -2550,13 +2580,13 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2550
2580
|
logger: joinToQ.logger
|
|
2551
2581
|
};
|
|
2552
2582
|
j.baseQuery = j;
|
|
2553
|
-
const joinedShapes = __spreadProps$
|
|
2583
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinToQ.joinedShapes), {
|
|
2554
2584
|
[joinToQ.as || joinTo.table]: joinTo.shape
|
|
2555
2585
|
});
|
|
2556
2586
|
const r = args[0](
|
|
2557
2587
|
makeJoinQueryBuilder(
|
|
2558
2588
|
j,
|
|
2559
|
-
j.q.joinedShapes ? __spreadValues$
|
|
2589
|
+
j.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, j.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2560
2590
|
joinTo
|
|
2561
2591
|
)
|
|
2562
2592
|
);
|
|
@@ -2583,16 +2613,16 @@ const processJoinArgs = (joinTo, first, args, joinSubQuery, whereExists) => {
|
|
|
2583
2613
|
pushQueryArray(q, "or", query.or);
|
|
2584
2614
|
}
|
|
2585
2615
|
if (query.scopes) {
|
|
2586
|
-
q.q.scopes = __spreadValues$
|
|
2616
|
+
q.q.scopes = __spreadValues$i(__spreadValues$i({}, q.q.scopes), query.scopes);
|
|
2587
2617
|
}
|
|
2588
2618
|
}
|
|
2589
|
-
const joinedShapes = __spreadProps$
|
|
2619
|
+
const joinedShapes = __spreadProps$9(__spreadValues$i({}, joinTo.q.joinedShapes), {
|
|
2590
2620
|
[joinTo.q.as || joinTo.table]: joinTo.shape
|
|
2591
2621
|
});
|
|
2592
2622
|
const r = args0(
|
|
2593
2623
|
makeJoinQueryBuilder(
|
|
2594
2624
|
q,
|
|
2595
|
-
q.q.joinedShapes ? __spreadValues$
|
|
2625
|
+
q.q.joinedShapes ? __spreadValues$i(__spreadValues$i({}, q.q.joinedShapes), joinedShapes) : joinedShapes,
|
|
2596
2626
|
joinTo
|
|
2597
2627
|
)
|
|
2598
2628
|
);
|
|
@@ -2647,25 +2677,25 @@ const _queryNone = (q) => {
|
|
|
2647
2677
|
};
|
|
2648
2678
|
const isQueryNone = (q) => q.then === noneMethods.then;
|
|
2649
2679
|
|
|
2650
|
-
var __defProp$
|
|
2651
|
-
var __defProps$
|
|
2652
|
-
var __getOwnPropDescs$
|
|
2653
|
-
var __getOwnPropSymbols$
|
|
2654
|
-
var __hasOwnProp$
|
|
2655
|
-
var __propIsEnum$
|
|
2656
|
-
var __defNormalProp$
|
|
2657
|
-
var __spreadValues$
|
|
2680
|
+
var __defProp$h = Object.defineProperty;
|
|
2681
|
+
var __defProps$8 = Object.defineProperties;
|
|
2682
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
2683
|
+
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
2684
|
+
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
2685
|
+
var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
|
|
2686
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2687
|
+
var __spreadValues$h = (a, b) => {
|
|
2658
2688
|
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$
|
|
2689
|
+
if (__hasOwnProp$i.call(b, prop))
|
|
2690
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2691
|
+
if (__getOwnPropSymbols$i)
|
|
2692
|
+
for (var prop of __getOwnPropSymbols$i(b)) {
|
|
2693
|
+
if (__propIsEnum$i.call(b, prop))
|
|
2694
|
+
__defNormalProp$h(a, prop, b[prop]);
|
|
2665
2695
|
}
|
|
2666
2696
|
return a;
|
|
2667
2697
|
};
|
|
2668
|
-
var __spreadProps$
|
|
2698
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
2669
2699
|
const _join = (query, require2, type, first, args) => {
|
|
2670
2700
|
var _a, _b, _c, _d;
|
|
2671
2701
|
let joinKey;
|
|
@@ -2707,13 +2737,10 @@ const _join = (query, require2, type, first, args) => {
|
|
|
2707
2737
|
computeds = w == null ? void 0 : w.computeds;
|
|
2708
2738
|
if (shape) {
|
|
2709
2739
|
if (!require2)
|
|
2710
|
-
shape = __spreadValues$
|
|
2711
|
-
|
|
2740
|
+
shape = __spreadValues$h({}, shape);
|
|
2741
|
+
const arg = { parsers: {} };
|
|
2712
2742
|
for (const key in shape) {
|
|
2713
|
-
|
|
2714
|
-
if (parser) {
|
|
2715
|
-
parsers[key] = parser;
|
|
2716
|
-
}
|
|
2743
|
+
addColumnParserToQuery(arg, key, shape[key]);
|
|
2717
2744
|
}
|
|
2718
2745
|
}
|
|
2719
2746
|
}
|
|
@@ -2811,7 +2838,7 @@ const _joinLateral = (self, type, arg, cb, as) => {
|
|
|
2811
2838
|
t.table = arg;
|
|
2812
2839
|
t.shape = w.shape;
|
|
2813
2840
|
t.computeds = w.computeds;
|
|
2814
|
-
t.q = __spreadProps$
|
|
2841
|
+
t.q = __spreadProps$8(__spreadValues$h({}, t.q), {
|
|
2815
2842
|
shape: w.shape
|
|
2816
2843
|
});
|
|
2817
2844
|
t.baseQuery = t;
|
|
@@ -2869,19 +2896,8 @@ class ArrayColumn extends ColumnType {
|
|
|
2869
2896
|
super(schema, inputType, outputType, queryType);
|
|
2870
2897
|
this.dataType = "array";
|
|
2871
2898
|
this.operators = Operators.array;
|
|
2872
|
-
this.parseFn = Object.assign(
|
|
2873
|
-
(source) => {
|
|
2874
|
-
if (!source)
|
|
2875
|
-
return source;
|
|
2876
|
-
const entries = [];
|
|
2877
|
-
parsePostgresArray(source, entries, this.data.item.parseItem);
|
|
2878
|
-
return entries;
|
|
2879
|
-
},
|
|
2880
|
-
{
|
|
2881
|
-
hideFromCode: true
|
|
2882
|
-
}
|
|
2883
|
-
);
|
|
2884
2899
|
item.data.isNullable = true;
|
|
2900
|
+
setColumnDefaultParse(this, (input) => parse.call(this, input));
|
|
2885
2901
|
this.data.item = item instanceof ArrayColumn ? item.data.item : item;
|
|
2886
2902
|
this.data.name = item.data.name;
|
|
2887
2903
|
this.data.arrayDims = item instanceof ArrayColumn ? item.data.arrayDims + 1 : 1;
|
|
@@ -2906,6 +2922,11 @@ class ArrayColumn extends ColumnType {
|
|
|
2906
2922
|
return columnCode(this, ctx, key, code);
|
|
2907
2923
|
}
|
|
2908
2924
|
}
|
|
2925
|
+
const parse = function(source) {
|
|
2926
|
+
const entries = [];
|
|
2927
|
+
parsePostgresArray(source, entries, this.data.item.data.parseItem);
|
|
2928
|
+
return entries;
|
|
2929
|
+
};
|
|
2909
2930
|
const parsePostgresArray = (source, entries, transform) => {
|
|
2910
2931
|
let pos = 0;
|
|
2911
2932
|
if (source[0] === "[") {
|
|
@@ -3023,8 +3044,8 @@ class SmallIntColumn extends IntegerBaseColumn {
|
|
|
3023
3044
|
constructor(schema) {
|
|
3024
3045
|
super(schema);
|
|
3025
3046
|
this.dataType = "int2";
|
|
3026
|
-
this.parseItem = parseInt;
|
|
3027
3047
|
this.data.alias = "smallint";
|
|
3048
|
+
this.data.parseItem = parseInt;
|
|
3028
3049
|
}
|
|
3029
3050
|
toCode(ctx, key) {
|
|
3030
3051
|
return intToCode(this, ctx, key, "smallint");
|
|
@@ -3037,8 +3058,8 @@ class IntegerColumn extends IntegerBaseColumn {
|
|
|
3037
3058
|
constructor(schema) {
|
|
3038
3059
|
super(schema);
|
|
3039
3060
|
this.dataType = "int4";
|
|
3040
|
-
this.parseItem = parseInt;
|
|
3041
3061
|
this.data.alias = "integer";
|
|
3062
|
+
this.data.parseItem = parseInt;
|
|
3042
3063
|
}
|
|
3043
3064
|
toCode(ctx, key) {
|
|
3044
3065
|
return intToCode(this, ctx, key, "integer");
|
|
@@ -3064,8 +3085,8 @@ class RealColumn extends NumberBaseColumn {
|
|
|
3064
3085
|
constructor(schema) {
|
|
3065
3086
|
super(schema, schema.number());
|
|
3066
3087
|
this.dataType = "float4";
|
|
3067
|
-
this.parseItem = parseFloat;
|
|
3068
3088
|
this.data.alias = "real";
|
|
3089
|
+
this.data.parseItem = parseFloat;
|
|
3069
3090
|
}
|
|
3070
3091
|
toCode(ctx, key) {
|
|
3071
3092
|
return columnCode(
|
|
@@ -3090,9 +3111,9 @@ class SmallSerialColumn extends IntegerBaseColumn {
|
|
|
3090
3111
|
constructor(schema) {
|
|
3091
3112
|
super(schema);
|
|
3092
3113
|
this.dataType = "int2";
|
|
3093
|
-
this.parseItem = parseInt;
|
|
3094
3114
|
this.data.int = true;
|
|
3095
3115
|
this.data.alias = "smallSerial";
|
|
3116
|
+
this.data.parseItem = parseInt;
|
|
3096
3117
|
}
|
|
3097
3118
|
toSQL() {
|
|
3098
3119
|
return "smallserial";
|
|
@@ -3114,9 +3135,9 @@ class SerialColumn extends IntegerBaseColumn {
|
|
|
3114
3135
|
constructor(schema) {
|
|
3115
3136
|
super(schema);
|
|
3116
3137
|
this.dataType = "int4";
|
|
3117
|
-
this.parseItem = parseInt;
|
|
3118
3138
|
this.data.int = true;
|
|
3119
3139
|
this.data.alias = "serial";
|
|
3140
|
+
this.data.parseItem = parseInt;
|
|
3120
3141
|
}
|
|
3121
3142
|
toSQL() {
|
|
3122
3143
|
return "serial";
|
|
@@ -3148,29 +3169,31 @@ class BigSerialColumn extends NumberAsStringBaseColumn {
|
|
|
3148
3169
|
}
|
|
3149
3170
|
}
|
|
3150
3171
|
|
|
3151
|
-
const
|
|
3152
|
-
const parseDateToDate = (value) => value ? new Date(value) : value;
|
|
3153
|
-
parseDateToNumber.hideFromCode = parseDateToDate.hideFromCode = true;
|
|
3172
|
+
const parseDateToDate = (value) => new Date(value);
|
|
3154
3173
|
const defaultSchemaConfig = {
|
|
3174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3155
3175
|
parse(fn) {
|
|
3156
|
-
return
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3176
|
+
return setColumnParse(this, fn);
|
|
3177
|
+
},
|
|
3178
|
+
parseNull(fn) {
|
|
3179
|
+
return setColumnParseNull(this, fn);
|
|
3160
3180
|
},
|
|
3181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3161
3182
|
encode(fn) {
|
|
3162
|
-
return
|
|
3163
|
-
encodeFn: fn
|
|
3164
|
-
});
|
|
3183
|
+
return setColumnData(this, "encode", fn);
|
|
3165
3184
|
},
|
|
3166
3185
|
asType() {
|
|
3167
3186
|
return this;
|
|
3168
3187
|
},
|
|
3169
3188
|
dateAsNumber() {
|
|
3170
|
-
|
|
3189
|
+
const c = this.parse(Date.parse);
|
|
3190
|
+
c.data.defaultParse = Date.parse;
|
|
3191
|
+
return c;
|
|
3171
3192
|
},
|
|
3172
3193
|
dateAsDate() {
|
|
3173
|
-
|
|
3194
|
+
const c = this.parse(parseDateToDate);
|
|
3195
|
+
c.data.defaultParse = parseDateToDate;
|
|
3196
|
+
return c;
|
|
3174
3197
|
},
|
|
3175
3198
|
enum(dataType, type) {
|
|
3176
3199
|
return new EnumColumn(defaultSchemaConfig, dataType, type, void 0);
|
|
@@ -3300,25 +3323,25 @@ class QueryLog {
|
|
|
3300
3323
|
}
|
|
3301
3324
|
}
|
|
3302
3325
|
|
|
3303
|
-
var __defProp$
|
|
3304
|
-
var __defProps$
|
|
3305
|
-
var __getOwnPropDescs$
|
|
3306
|
-
var __getOwnPropSymbols$
|
|
3307
|
-
var __hasOwnProp$
|
|
3308
|
-
var __propIsEnum$
|
|
3309
|
-
var __defNormalProp$
|
|
3310
|
-
var __spreadValues$
|
|
3326
|
+
var __defProp$g = Object.defineProperty;
|
|
3327
|
+
var __defProps$7 = Object.defineProperties;
|
|
3328
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
3329
|
+
var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
|
|
3330
|
+
var __hasOwnProp$h = Object.prototype.hasOwnProperty;
|
|
3331
|
+
var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
|
|
3332
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3333
|
+
var __spreadValues$g = (a, b) => {
|
|
3311
3334
|
for (var prop in b || (b = {}))
|
|
3312
|
-
if (__hasOwnProp$
|
|
3313
|
-
__defNormalProp$
|
|
3314
|
-
if (__getOwnPropSymbols$
|
|
3315
|
-
for (var prop of __getOwnPropSymbols$
|
|
3316
|
-
if (__propIsEnum$
|
|
3317
|
-
__defNormalProp$
|
|
3335
|
+
if (__hasOwnProp$h.call(b, prop))
|
|
3336
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
3337
|
+
if (__getOwnPropSymbols$h)
|
|
3338
|
+
for (var prop of __getOwnPropSymbols$h(b)) {
|
|
3339
|
+
if (__propIsEnum$h.call(b, prop))
|
|
3340
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
3318
3341
|
}
|
|
3319
3342
|
return a;
|
|
3320
3343
|
};
|
|
3321
|
-
var __spreadProps$
|
|
3344
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
3322
3345
|
const commitSql$1 = {
|
|
3323
3346
|
text: "COMMIT"
|
|
3324
3347
|
};
|
|
@@ -3483,7 +3506,7 @@ const runAfterCommit = async (afterCommit, result) => {
|
|
|
3483
3506
|
let r = 0;
|
|
3484
3507
|
for (let i = 0, len = afterCommit.length; i < len; i += 3) {
|
|
3485
3508
|
for (const fn of afterCommit[i + 2]) {
|
|
3486
|
-
resultsWithNames.push(__spreadProps$
|
|
3509
|
+
resultsWithNames.push(__spreadProps$7(__spreadValues$g({}, hookResults[r++]), {
|
|
3487
3510
|
name: fn.name
|
|
3488
3511
|
}));
|
|
3489
3512
|
}
|
|
@@ -3545,25 +3568,25 @@ const finalizeNestedHookSelect = (batches, returnType, tempColumns, renames, key
|
|
|
3545
3568
|
}
|
|
3546
3569
|
};
|
|
3547
3570
|
|
|
3548
|
-
var __defProp$
|
|
3549
|
-
var __defProps$
|
|
3550
|
-
var __getOwnPropDescs$
|
|
3551
|
-
var __getOwnPropSymbols$
|
|
3552
|
-
var __hasOwnProp$
|
|
3553
|
-
var __propIsEnum$
|
|
3554
|
-
var __defNormalProp$
|
|
3555
|
-
var __spreadValues$
|
|
3571
|
+
var __defProp$f = Object.defineProperty;
|
|
3572
|
+
var __defProps$6 = Object.defineProperties;
|
|
3573
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
3574
|
+
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
3575
|
+
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
3576
|
+
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
3577
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3578
|
+
var __spreadValues$f = (a, b) => {
|
|
3556
3579
|
for (var prop in b || (b = {}))
|
|
3557
|
-
if (__hasOwnProp$
|
|
3558
|
-
__defNormalProp$
|
|
3559
|
-
if (__getOwnPropSymbols$
|
|
3560
|
-
for (var prop of __getOwnPropSymbols$
|
|
3561
|
-
if (__propIsEnum$
|
|
3562
|
-
__defNormalProp$
|
|
3580
|
+
if (__hasOwnProp$g.call(b, prop))
|
|
3581
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
3582
|
+
if (__getOwnPropSymbols$g)
|
|
3583
|
+
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
3584
|
+
if (__propIsEnum$g.call(b, prop))
|
|
3585
|
+
__defNormalProp$f(a, prop, b[prop]);
|
|
3563
3586
|
}
|
|
3564
3587
|
return a;
|
|
3565
3588
|
};
|
|
3566
|
-
var __spreadProps$
|
|
3589
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
3567
3590
|
class ComputedColumn {
|
|
3568
3591
|
constructor(kind, deps, fn) {
|
|
3569
3592
|
this.kind = kind;
|
|
@@ -3580,7 +3603,7 @@ const applyComputedColumns = (q, fn) => {
|
|
|
3580
3603
|
for (const key in computed) {
|
|
3581
3604
|
const item = computed[key];
|
|
3582
3605
|
if (item instanceof ComputedColumn) {
|
|
3583
|
-
q.q.computeds = __spreadProps$
|
|
3606
|
+
q.q.computeds = __spreadProps$6(__spreadValues$f({}, q.q.computeds), { [key]: item });
|
|
3584
3607
|
} else {
|
|
3585
3608
|
const data = (q.shape[key] = item.result.value || UnknownColumn.instance).data;
|
|
3586
3609
|
data.computed = item;
|
|
@@ -3690,25 +3713,25 @@ const saveBatchComputed = (key, result, res, blanks) => {
|
|
|
3690
3713
|
}
|
|
3691
3714
|
};
|
|
3692
3715
|
|
|
3693
|
-
var __defProp$
|
|
3694
|
-
var __defProps$
|
|
3695
|
-
var __getOwnPropDescs$
|
|
3696
|
-
var __getOwnPropSymbols$
|
|
3697
|
-
var __hasOwnProp$
|
|
3698
|
-
var __propIsEnum$
|
|
3699
|
-
var __defNormalProp$
|
|
3700
|
-
var __spreadValues$
|
|
3716
|
+
var __defProp$e = Object.defineProperty;
|
|
3717
|
+
var __defProps$5 = Object.defineProperties;
|
|
3718
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
3719
|
+
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
3720
|
+
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
3721
|
+
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
3722
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3723
|
+
var __spreadValues$e = (a, b) => {
|
|
3701
3724
|
for (var prop in b || (b = {}))
|
|
3702
|
-
if (__hasOwnProp$
|
|
3703
|
-
__defNormalProp$
|
|
3704
|
-
if (__getOwnPropSymbols$
|
|
3705
|
-
for (var prop of __getOwnPropSymbols$
|
|
3706
|
-
if (__propIsEnum$
|
|
3707
|
-
__defNormalProp$
|
|
3725
|
+
if (__hasOwnProp$f.call(b, prop))
|
|
3726
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
3727
|
+
if (__getOwnPropSymbols$f)
|
|
3728
|
+
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
3729
|
+
if (__propIsEnum$f.call(b, prop))
|
|
3730
|
+
__defNormalProp$e(a, prop, b[prop]);
|
|
3708
3731
|
}
|
|
3709
3732
|
return a;
|
|
3710
3733
|
};
|
|
3711
|
-
var __spreadProps$
|
|
3734
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
3712
3735
|
const queryMethodByReturnType = {
|
|
3713
3736
|
undefined: "query",
|
|
3714
3737
|
all: "query",
|
|
@@ -3952,7 +3975,7 @@ const then = async (q, adapter, trx, beforeHooks, afterHooks, afterCommitHooks,
|
|
|
3952
3975
|
if (hookResults.some((result2) => result2.status === "rejected")) {
|
|
3953
3976
|
_afterCommitError(
|
|
3954
3977
|
result,
|
|
3955
|
-
hookResults.map((result2, i) => __spreadProps$
|
|
3978
|
+
hookResults.map((result2, i) => __spreadProps$5(__spreadValues$e({}, result2), {
|
|
3956
3979
|
name: afterCommitHooks[i].name
|
|
3957
3980
|
})),
|
|
3958
3981
|
q.q.catchAfterCommitError
|
|
@@ -4194,7 +4217,7 @@ const filterResult = (q, returnType, queryResult, result, tempColumns, hasAfterH
|
|
|
4194
4217
|
return row;
|
|
4195
4218
|
} else {
|
|
4196
4219
|
if (hasAfterHook)
|
|
4197
|
-
row = __spreadValues$
|
|
4220
|
+
row = __spreadValues$e({}, row);
|
|
4198
4221
|
for (const column of tempColumns) {
|
|
4199
4222
|
delete row[column];
|
|
4200
4223
|
}
|
|
@@ -4237,7 +4260,7 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4237
4260
|
if (tempColumns == null ? void 0 : tempColumns.size) {
|
|
4238
4261
|
if (hasAfterHook) {
|
|
4239
4262
|
return result.map((data) => {
|
|
4240
|
-
const record = __spreadValues$
|
|
4263
|
+
const record = __spreadValues$e({}, data);
|
|
4241
4264
|
for (const key of tempColumns) {
|
|
4242
4265
|
delete record[key];
|
|
4243
4266
|
}
|
|
@@ -4254,29 +4277,28 @@ const filterAllResult = (result, tempColumns, hasAfterHook) => {
|
|
|
4254
4277
|
return result;
|
|
4255
4278
|
};
|
|
4256
4279
|
|
|
4257
|
-
var __defProp$
|
|
4258
|
-
var __defProps$
|
|
4259
|
-
var __getOwnPropDescs$
|
|
4260
|
-
var __getOwnPropSymbols$
|
|
4261
|
-
var __hasOwnProp$
|
|
4262
|
-
var __propIsEnum$
|
|
4263
|
-
var __defNormalProp$
|
|
4264
|
-
var __spreadValues$
|
|
4280
|
+
var __defProp$d = Object.defineProperty;
|
|
4281
|
+
var __defProps$4 = Object.defineProperties;
|
|
4282
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
4283
|
+
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
4284
|
+
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
4285
|
+
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
4286
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4287
|
+
var __spreadValues$d = (a, b) => {
|
|
4265
4288
|
for (var prop in b || (b = {}))
|
|
4266
|
-
if (__hasOwnProp$
|
|
4267
|
-
__defNormalProp$
|
|
4268
|
-
if (__getOwnPropSymbols$
|
|
4269
|
-
for (var prop of __getOwnPropSymbols$
|
|
4270
|
-
if (__propIsEnum$
|
|
4271
|
-
__defNormalProp$
|
|
4289
|
+
if (__hasOwnProp$e.call(b, prop))
|
|
4290
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
4291
|
+
if (__getOwnPropSymbols$e)
|
|
4292
|
+
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
4293
|
+
if (__propIsEnum$e.call(b, prop))
|
|
4294
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
4272
4295
|
}
|
|
4273
4296
|
return a;
|
|
4274
4297
|
};
|
|
4275
|
-
var __spreadProps$
|
|
4298
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
4276
4299
|
const addParserForRawExpression = (q, key, raw) => {
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
setParserToQuery(q.q, key, type.parseFn);
|
|
4300
|
+
if (raw.result.value)
|
|
4301
|
+
addColumnParserToQuery(q.q, key, raw.result.value);
|
|
4280
4302
|
};
|
|
4281
4303
|
const addParsersForSelectJoined = (q, arg, as = arg) => {
|
|
4282
4304
|
var _a, _b, _c, _d;
|
|
@@ -4494,11 +4516,12 @@ const collectNestedSelectBatches = (batches, rows, path, last) => {
|
|
|
4494
4516
|
};
|
|
4495
4517
|
const emptyArrSQL = new RawSQL("'[]'");
|
|
4496
4518
|
const processSelectArg = (q, as, arg, columnAs) => {
|
|
4497
|
-
var _a, _b
|
|
4519
|
+
var _a, _b;
|
|
4498
4520
|
if (typeof arg === "string") {
|
|
4499
4521
|
return setParserForSelectedString(q, arg, as, columnAs);
|
|
4500
4522
|
}
|
|
4501
4523
|
const selectAs = {};
|
|
4524
|
+
let aliases;
|
|
4502
4525
|
for (const key in arg) {
|
|
4503
4526
|
let value = arg[key];
|
|
4504
4527
|
if (typeof value === "function") {
|
|
@@ -4533,17 +4556,11 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4533
4556
|
query = value;
|
|
4534
4557
|
}
|
|
4535
4558
|
}
|
|
4536
|
-
|
|
4537
|
-
if ((_a = value.q.joinedShapes) == null ? void 0 : _a[key]) {
|
|
4538
|
-
let suffix = 2;
|
|
4539
|
-
const joinOverrides = (_c = (_b = q.q).joinOverrides) != null ? _c : _b.joinOverrides = {};
|
|
4540
|
-
while (joinOverrides[asOverride = `${key}${suffix}`]) {
|
|
4541
|
-
suffix++;
|
|
4542
|
-
}
|
|
4543
|
-
joinOverrides[asOverride] = asOverride;
|
|
4544
|
-
joinOverrides[key] = asOverride;
|
|
4545
|
-
}
|
|
4559
|
+
const asOverride = (_a = value.q.aliases[key]) != null ? _a : key;
|
|
4546
4560
|
value.q.joinedForSelect = asOverride;
|
|
4561
|
+
if (asOverride !== key) {
|
|
4562
|
+
aliases = __spreadProps$4(__spreadValues$d({}, q.q.aliases), { [key]: asOverride });
|
|
4563
|
+
}
|
|
4547
4564
|
_joinLateral(
|
|
4548
4565
|
q,
|
|
4549
4566
|
value.q.innerJoinLateral ? "JOIN" : "LEFT JOIN",
|
|
@@ -4551,10 +4568,12 @@ const processSelectArg = (q, as, arg, columnAs) => {
|
|
|
4551
4568
|
(q2) => q2,
|
|
4552
4569
|
key
|
|
4553
4570
|
);
|
|
4554
|
-
} else if (((
|
|
4571
|
+
} else if (((_b = value.q) == null ? void 0 : _b.subQuery) && value.q.expr) {
|
|
4555
4572
|
value = value.q.expr;
|
|
4556
4573
|
}
|
|
4557
4574
|
}
|
|
4575
|
+
if (aliases)
|
|
4576
|
+
q.q.aliases = aliases;
|
|
4558
4577
|
selectAs[key] = addParserForSelectItem(
|
|
4559
4578
|
q,
|
|
4560
4579
|
as,
|
|
@@ -4599,7 +4618,7 @@ const setParserForSelectedString = (q, arg, as, columnAs) => {
|
|
|
4599
4618
|
for (const column2 of computed.deps) {
|
|
4600
4619
|
map.set(column2, { select: `${table}.${column2}` });
|
|
4601
4620
|
}
|
|
4602
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4621
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), {
|
|
4603
4622
|
[column]: computed
|
|
4604
4623
|
});
|
|
4605
4624
|
return;
|
|
@@ -4623,7 +4642,7 @@ const handleComputed = (q, computeds, column) => {
|
|
|
4623
4642
|
for (const column2 of computed.deps) {
|
|
4624
4643
|
map.set(column2, { select: column2 });
|
|
4625
4644
|
}
|
|
4626
|
-
q.q.selectedComputeds = __spreadProps$
|
|
4645
|
+
q.q.selectedComputeds = __spreadProps$4(__spreadValues$d({}, q.q.selectedComputeds), { [column]: computed });
|
|
4627
4646
|
return;
|
|
4628
4647
|
}
|
|
4629
4648
|
return column;
|
|
@@ -4821,10 +4840,43 @@ function _queryGetOptional(self, arg) {
|
|
|
4821
4840
|
return _get(self, "value", arg);
|
|
4822
4841
|
}
|
|
4823
4842
|
|
|
4843
|
+
var __defProp$c = Object.defineProperty;
|
|
4844
|
+
var __defProps$3 = Object.defineProperties;
|
|
4845
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
4846
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
4847
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
4848
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
4849
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4850
|
+
var __spreadValues$c = (a, b) => {
|
|
4851
|
+
for (var prop in b || (b = {}))
|
|
4852
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
4853
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
4854
|
+
if (__getOwnPropSymbols$d)
|
|
4855
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
4856
|
+
if (__propIsEnum$d.call(b, prop))
|
|
4857
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
4858
|
+
}
|
|
4859
|
+
return a;
|
|
4860
|
+
};
|
|
4861
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
4824
4862
|
const _queryAs = (self, as) => {
|
|
4825
|
-
|
|
4863
|
+
const { q } = self;
|
|
4864
|
+
q.as = as;
|
|
4865
|
+
q.aliases = __spreadProps$3(__spreadValues$c({}, q.aliases), {
|
|
4866
|
+
[as]: q.aliases ? _queryResolveAlias(q.aliases, as) : as
|
|
4867
|
+
});
|
|
4826
4868
|
return self;
|
|
4827
4869
|
};
|
|
4870
|
+
const _queryResolveAlias = (aliases, as) => {
|
|
4871
|
+
if (!aliases[as])
|
|
4872
|
+
return as;
|
|
4873
|
+
let suffix = 2;
|
|
4874
|
+
let privateAs;
|
|
4875
|
+
while (aliases[privateAs = as + suffix]) {
|
|
4876
|
+
suffix++;
|
|
4877
|
+
}
|
|
4878
|
+
return privateAs;
|
|
4879
|
+
};
|
|
4828
4880
|
class AsMethods {
|
|
4829
4881
|
/**
|
|
4830
4882
|
* Sets table alias:
|
|
@@ -4871,7 +4923,6 @@ function queryFrom(self, arg) {
|
|
|
4871
4923
|
data.as || (data.as = "t");
|
|
4872
4924
|
} else if (Array.isArray(arg)) {
|
|
4873
4925
|
const { shape } = data;
|
|
4874
|
-
const parsers = (_c = data.parsers) != null ? _c : data.parsers = {};
|
|
4875
4926
|
for (const item of arg) {
|
|
4876
4927
|
if (typeof item === "string") {
|
|
4877
4928
|
const w = data.withShapes[item];
|
|
@@ -4879,13 +4930,15 @@ function queryFrom(self, arg) {
|
|
|
4879
4930
|
if (w.computeds)
|
|
4880
4931
|
data.computeds = __spreadValues$b(__spreadValues$b({}, data.computeds), w.computeds);
|
|
4881
4932
|
for (const key in w.shape) {
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4933
|
+
addColumnParserToQuery(
|
|
4934
|
+
self,
|
|
4935
|
+
key,
|
|
4936
|
+
w.shape[key]
|
|
4937
|
+
);
|
|
4885
4938
|
}
|
|
4886
4939
|
} else if (!isExpression(item)) {
|
|
4887
4940
|
Object.assign(shape, getShapeFromSelect(item, true));
|
|
4888
|
-
Object.assign(parsers, item.q.parsers);
|
|
4941
|
+
Object.assign((_c = data.parsers) != null ? _c : data.parsers = {}, item.q.parsers);
|
|
4889
4942
|
}
|
|
4890
4943
|
}
|
|
4891
4944
|
} else {
|
|
@@ -6190,14 +6243,14 @@ const makeRegexToFindInSql = (value) => {
|
|
|
6190
6243
|
return new RegExp(`${value}(?=(?:[^']*'[^']*')*[^']*$)`, "g");
|
|
6191
6244
|
};
|
|
6192
6245
|
const resolveSubQueryCallback = (q, cb) => {
|
|
6193
|
-
const { subQuery, relChain,
|
|
6246
|
+
const { subQuery, relChain, outerAliases } = q.q;
|
|
6194
6247
|
q.q.subQuery = 1;
|
|
6195
6248
|
q.q.relChain = void 0;
|
|
6196
|
-
q.q.
|
|
6249
|
+
q.q.outerAliases = q.q.aliases;
|
|
6197
6250
|
const result = cb(q);
|
|
6198
6251
|
q.q.subQuery = subQuery;
|
|
6199
6252
|
q.q.relChain = relChain;
|
|
6200
|
-
q.q.
|
|
6253
|
+
q.q.outerAliases = outerAliases;
|
|
6201
6254
|
return result;
|
|
6202
6255
|
};
|
|
6203
6256
|
const joinSubQuery = (q, sub) => {
|
|
@@ -6249,45 +6302,46 @@ class PostgisGeographyPointColumn extends ColumnType {
|
|
|
6249
6302
|
super(schema, schema.geographyPointSchema());
|
|
6250
6303
|
this.dataType = "geography(Point)";
|
|
6251
6304
|
this.operators = Operators.any;
|
|
6305
|
+
setColumnDefaultParse(this, defaultParse);
|
|
6306
|
+
this.data.encode = this.data.defaultEncode = defaultEncode;
|
|
6252
6307
|
}
|
|
6253
6308
|
static isDefaultPoint(typmod) {
|
|
6254
6309
|
return typmodType(typmod) === "Point" && typmodSrid(typmod) === defaultSrid;
|
|
6255
6310
|
}
|
|
6256
|
-
parseFn(input) {
|
|
6257
|
-
if (!input)
|
|
6258
|
-
return null;
|
|
6259
|
-
const bytes = new Uint8Array(20);
|
|
6260
|
-
for (let i = 0; i < 40; i += 2) {
|
|
6261
|
-
bytes[i / 2] = parseInt(input.slice(10 + i, 12 + i), 16);
|
|
6262
|
-
}
|
|
6263
|
-
const view = new DataView(bytes.buffer);
|
|
6264
|
-
const srid = view.getUint32(0, true);
|
|
6265
|
-
const lon = view.getFloat64(4, true);
|
|
6266
|
-
const lat = view.getFloat64(12, true);
|
|
6267
|
-
return srid === defaultSrid ? { lon, lat } : {
|
|
6268
|
-
lon,
|
|
6269
|
-
lat,
|
|
6270
|
-
srid
|
|
6271
|
-
};
|
|
6272
|
-
}
|
|
6273
|
-
encodeFn({ srid = defaultSrid, lon, lat }) {
|
|
6274
|
-
const arr = new Uint8Array(25);
|
|
6275
|
-
const view = new DataView(arr.buffer);
|
|
6276
|
-
view.setInt8(0, 1);
|
|
6277
|
-
view.setInt8(1, 1);
|
|
6278
|
-
view.setInt8(4, 32);
|
|
6279
|
-
view.setUint32(5, srid, true);
|
|
6280
|
-
view.setFloat64(9, lon, true);
|
|
6281
|
-
view.setFloat64(17, lat, true);
|
|
6282
|
-
return uint8ArrToHex(arr);
|
|
6283
|
-
}
|
|
6284
6311
|
toCode(ctx, key) {
|
|
6285
|
-
return columnCode(this, ctx, key, `geography.point()
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6312
|
+
return columnCode(this, ctx, key, `geography.point()`);
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
const defaultParse = (input) => {
|
|
6316
|
+
const bytes = new Uint8Array(20);
|
|
6317
|
+
for (let i = 0; i < 40; i += 2) {
|
|
6318
|
+
bytes[i / 2] = parseInt(input.slice(10 + i, 12 + i), 16);
|
|
6319
|
+
}
|
|
6320
|
+
const view = new DataView(bytes.buffer);
|
|
6321
|
+
const srid = view.getUint32(0, true);
|
|
6322
|
+
const lon = view.getFloat64(4, true);
|
|
6323
|
+
const lat = view.getFloat64(12, true);
|
|
6324
|
+
return srid === defaultSrid ? { lon, lat } : {
|
|
6325
|
+
lon,
|
|
6326
|
+
lat,
|
|
6327
|
+
srid
|
|
6328
|
+
};
|
|
6329
|
+
};
|
|
6330
|
+
const defaultEncode = ({
|
|
6331
|
+
srid = defaultSrid,
|
|
6332
|
+
lon,
|
|
6333
|
+
lat
|
|
6334
|
+
}) => {
|
|
6335
|
+
const arr = new Uint8Array(25);
|
|
6336
|
+
const view = new DataView(arr.buffer);
|
|
6337
|
+
view.setInt8(0, 1);
|
|
6338
|
+
view.setInt8(1, 1);
|
|
6339
|
+
view.setInt8(4, 32);
|
|
6340
|
+
view.setUint32(5, srid, true);
|
|
6341
|
+
view.setFloat64(9, lon, true);
|
|
6342
|
+
view.setFloat64(17, lat, true);
|
|
6343
|
+
return uint8ArrToHex(arr);
|
|
6344
|
+
};
|
|
6291
6345
|
const typmodGetType = (typmod) => (typmod & 252) >> 2;
|
|
6292
6346
|
const lwtypeName = (type) => [
|
|
6293
6347
|
"Unknown",
|
|
@@ -6764,10 +6818,7 @@ class FnExpression extends Expression {
|
|
|
6764
6818
|
query.q.returnsOne = true;
|
|
6765
6819
|
query.q.getColumn = value;
|
|
6766
6820
|
query.q.select = [this];
|
|
6767
|
-
|
|
6768
|
-
if (parseFn) {
|
|
6769
|
-
setParserToQuery(query.q, getValueKey, parseFn);
|
|
6770
|
-
}
|
|
6821
|
+
addColumnParserToQuery(query.q, getValueKey, value);
|
|
6771
6822
|
}
|
|
6772
6823
|
// Builds function SQL.
|
|
6773
6824
|
makeSQL(ctx, quotedAs) {
|
|
@@ -6857,18 +6908,14 @@ const isSelectingCount = (q) => {
|
|
|
6857
6908
|
const { expr } = q.q;
|
|
6858
6909
|
return expr instanceof FnExpression && expr.fn === "count" && expr.args[0] === "*";
|
|
6859
6910
|
};
|
|
6860
|
-
const int = new IntegerColumn(defaultSchemaConfig);
|
|
6861
|
-
|
|
6862
|
-
const nullableInt = new IntegerColumn(defaultSchemaConfig);
|
|
6863
|
-
nullableInt.parseItem = nullableInt.parseFn = (input) => input === null ? null : parseInt(input);
|
|
6864
|
-
const nullableFloat = new RealColumn(defaultSchemaConfig);
|
|
6865
|
-
nullableFloat.parseItem = nullableFloat.parseFn = (input) => input === null ? null : parseFloat(input);
|
|
6911
|
+
const int = new IntegerColumn(defaultSchemaConfig).parse(parseInt);
|
|
6912
|
+
const float = new RealColumn(defaultSchemaConfig).parse(parseFloat);
|
|
6866
6913
|
const stringAsNumber = new NumberAsStringBaseColumn(
|
|
6867
6914
|
defaultSchemaConfig
|
|
6868
6915
|
);
|
|
6869
6916
|
const numericResultColumn = (q, arg) => {
|
|
6870
6917
|
const type = typeof arg === "string" ? _getSelectableColumn(q, arg) : arg.result.value;
|
|
6871
|
-
return type instanceof NumberBaseColumn ?
|
|
6918
|
+
return type instanceof NumberBaseColumn ? float : stringAsNumber;
|
|
6872
6919
|
};
|
|
6873
6920
|
class AggregateMethods {
|
|
6874
6921
|
/**
|
|
@@ -7330,7 +7377,7 @@ class AggregateMethods {
|
|
|
7330
7377
|
* @param over - OVER clause config
|
|
7331
7378
|
*/
|
|
7332
7379
|
rowNumber(over) {
|
|
7333
|
-
return makeFnExpression(this,
|
|
7380
|
+
return makeFnExpression(this, int, "row_number", emptyArray, {
|
|
7334
7381
|
over
|
|
7335
7382
|
});
|
|
7336
7383
|
}
|
|
@@ -7353,7 +7400,7 @@ class AggregateMethods {
|
|
|
7353
7400
|
* @param over - OVER clause config
|
|
7354
7401
|
*/
|
|
7355
7402
|
rank(over) {
|
|
7356
|
-
return makeFnExpression(this,
|
|
7403
|
+
return makeFnExpression(this, int, "rank", emptyArray, {
|
|
7357
7404
|
over
|
|
7358
7405
|
});
|
|
7359
7406
|
}
|
|
@@ -7376,7 +7423,7 @@ class AggregateMethods {
|
|
|
7376
7423
|
* @param over - OVER clause config
|
|
7377
7424
|
*/
|
|
7378
7425
|
denseRank(over) {
|
|
7379
|
-
return makeFnExpression(this,
|
|
7426
|
+
return makeFnExpression(this, int, "dense_rank", emptyArray, {
|
|
7380
7427
|
over
|
|
7381
7428
|
});
|
|
7382
7429
|
}
|
|
@@ -7399,7 +7446,7 @@ class AggregateMethods {
|
|
|
7399
7446
|
* @param over - OVER clause config
|
|
7400
7447
|
*/
|
|
7401
7448
|
percentRank(over) {
|
|
7402
|
-
return makeFnExpression(this,
|
|
7449
|
+
return makeFnExpression(this, int, "percent_rank", emptyArray, {
|
|
7403
7450
|
over
|
|
7404
7451
|
});
|
|
7405
7452
|
}
|
|
@@ -7422,7 +7469,7 @@ class AggregateMethods {
|
|
|
7422
7469
|
* @param over - OVER clause config
|
|
7423
7470
|
*/
|
|
7424
7471
|
cumeDist(over) {
|
|
7425
|
-
return makeFnExpression(this,
|
|
7472
|
+
return makeFnExpression(this, float, "cume_dist", emptyArray, {
|
|
7426
7473
|
over
|
|
7427
7474
|
});
|
|
7428
7475
|
}
|
|
@@ -7506,7 +7553,7 @@ const processCreateItem = (q, item, rowIndex, ctx, encoders) => {
|
|
|
7506
7553
|
}
|
|
7507
7554
|
if (!ctx.columns.has(key) && (shape[key] && !shape[key].data.computed || shape === anyShape) && item[key] !== void 0) {
|
|
7508
7555
|
ctx.columns.set(key, ctx.columns.size);
|
|
7509
|
-
encoders[key] = (_c = shape[key]) == null ? void 0 : _c.
|
|
7556
|
+
encoders[key] = (_c = shape[key]) == null ? void 0 : _c.data.encode;
|
|
7510
7557
|
}
|
|
7511
7558
|
}
|
|
7512
7559
|
}
|
|
@@ -9351,7 +9398,7 @@ const pushQueryOnForOuter = (q, joinFrom, joinTo, ...on) => {
|
|
|
9351
9398
|
ON: {
|
|
9352
9399
|
joinTo: joinFrom,
|
|
9353
9400
|
joinFrom: joinTo,
|
|
9354
|
-
|
|
9401
|
+
useOuterAliases: true,
|
|
9355
9402
|
on
|
|
9356
9403
|
}
|
|
9357
9404
|
});
|
|
@@ -9760,7 +9807,7 @@ const resolveCallbacksInArgs = (q, args) => {
|
|
|
9760
9807
|
qb.q = getClonedQueryData(q.q);
|
|
9761
9808
|
qb.q.and = qb.q.or = qb.q.scopes = void 0;
|
|
9762
9809
|
qb.q.subQuery = 1;
|
|
9763
|
-
qb.q.
|
|
9810
|
+
qb.q.outerAliases = qb.q.aliases;
|
|
9764
9811
|
args[i] = resolveSubQueryCallback(qb, arg);
|
|
9765
9812
|
}
|
|
9766
9813
|
}
|
|
@@ -10654,7 +10701,7 @@ const _queryUpdate = (query, arg) => {
|
|
|
10654
10701
|
set[key] = new RawSQL(`(SELECT * FROM "${as}")`);
|
|
10655
10702
|
}
|
|
10656
10703
|
} else {
|
|
10657
|
-
const encode = shape[key].
|
|
10704
|
+
const encode = shape[key].data.encode;
|
|
10658
10705
|
if (encode)
|
|
10659
10706
|
set[key] = encode(value);
|
|
10660
10707
|
}
|
|
@@ -12747,9 +12794,9 @@ class Db {
|
|
|
12747
12794
|
for (const key in shape) {
|
|
12748
12795
|
const column = shape[key];
|
|
12749
12796
|
column.data.key = key;
|
|
12750
|
-
if (column.
|
|
12797
|
+
if (column._parse) {
|
|
12751
12798
|
hasParsers = true;
|
|
12752
|
-
parsers[key] = column.
|
|
12799
|
+
parsers[key] = column._parse;
|
|
12753
12800
|
}
|
|
12754
12801
|
if (column.data.name) {
|
|
12755
12802
|
prepareSelectAll = true;
|
|
@@ -12775,10 +12822,9 @@ class Db {
|
|
|
12775
12822
|
arr.push(key);
|
|
12776
12823
|
if (!column.data.runtimeDefault) {
|
|
12777
12824
|
const {
|
|
12778
|
-
data: { default: def }
|
|
12779
|
-
encodeFn
|
|
12825
|
+
data: { default: def, encode }
|
|
12780
12826
|
} = column;
|
|
12781
|
-
column.data.runtimeDefault =
|
|
12827
|
+
column.data.runtimeDefault = encode ? () => encode(def()) : def;
|
|
12782
12828
|
}
|
|
12783
12829
|
}
|
|
12784
12830
|
}
|
|
@@ -13199,5 +13245,5 @@ function copyTableData(query, arg) {
|
|
|
13199
13245
|
return q;
|
|
13200
13246
|
}
|
|
13201
13247
|
|
|
13202
|
-
export { Adapter, AfterCommitError, AggregateMethods, ArrayColumn, AsMethods, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ColumnRefExpression, ColumnType, ComputedColumn, Create, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DecimalColumn, Delete, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, FnExpression, For, FromMethods, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnMethods, Operators, OrExpression, OrchidOrmError, OrchidOrmInternalError, PathColumn, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryBase, QueryError, QueryGet, QueryHooks, QueryLog, QueryMethods, QueryUpsertOrCreate, RawSQL, RealColumn, RefExpression, SearchMethods, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, SqlMethod, StringColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimestampColumn, TimestampTZColumn, Transaction, TransactionAdapter, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, UnknownColumn, Update, VarCharColumn, VirtualColumn, Where, WithMethods, XMLColumn, _afterCommitError, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, checkIfASimpleQuery, cloneQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql$1 as commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnInfo, getColumnTypes, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, instantiateColumn, isDefaultTimeStamp, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, makeSQL, parseRecord, parseTableData, parseTableDataInput, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArray, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValue, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallback, rollbackSql$1 as rollbackSql, saveSearchAlias, setParserForSelectedString, setQueryObjectValue, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL, toSQLCacheKey };
|
|
13248
|
+
export { Adapter, AfterCommitError, AggregateMethods, ArrayColumn, AsMethods, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ColumnRefExpression, ColumnType, ComputedColumn, Create, CustomTypeColumn, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeTzBaseClass, Db, DecimalColumn, Delete, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, FnExpression, For, FromMethods, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnMethods, Operators, OrExpression, OrchidOrmError, OrchidOrmInternalError, PathColumn, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryBase, QueryError, QueryGet, QueryHooks, QueryLog, QueryMethods, QueryUpsertOrCreate, RawSQL, RealColumn, RefExpression, SearchMethods, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, SqlMethod, StringColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimestampColumn, TimestampTZColumn, Transaction, TransactionAdapter, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, UnknownColumn, Update, VarCharColumn, VirtualColumn, Where, WithMethods, XMLColumn, _afterCommitError, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryResolveAlias, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, checkIfASimpleQuery, cloneQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql$1 as commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnInfo, getColumnTypes, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, instantiateColumn, isDefaultTimeStamp, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, makeSQL, parseRecord, parseTableData, parseTableDataInput, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArray, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValue, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallback, rollbackSql$1 as rollbackSql, saveSearchAlias, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setParserForSelectedString, setQueryObjectValue, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL, toSQLCacheKey };
|
|
13203
13249
|
//# sourceMappingURL=index.mjs.map
|