@absolutejs/auth 0.56.8 → 0.56.10
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/agents/index.js +1459 -737
- package/dist/agents/index.js.map +31 -31
- package/dist/agents/postgresStores.d.ts +30 -10
- package/dist/cli/migrate.js +48 -43
- package/dist/cli/migrate.js.map +4 -4
- package/dist/index.js +1729 -947
- package/dist/index.js.map +33 -33
- package/dist/oidc/index.d.ts +1 -0
- package/dist/oidc/index.js +1464 -708
- package/dist/oidc/index.js.map +32 -31
- package/dist/oidc/operator.d.ts +14 -0
- package/dist/oidc/types.d.ts +4 -0
- package/dist/server.js +1729 -947
- package/dist/server.js.map +33 -33
- package/dist/vault/index.js +1449 -732
- package/dist/vault/index.js.map +30 -30
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -12763,6 +12763,9 @@ var SQL = class SQL2 {
|
|
|
12763
12763
|
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
12764
12764
|
return this;
|
|
12765
12765
|
}
|
|
12766
|
+
nullable() {
|
|
12767
|
+
return this;
|
|
12768
|
+
}
|
|
12766
12769
|
inlineParams() {
|
|
12767
12770
|
this.shouldInlineParams = true;
|
|
12768
12771
|
return this;
|
|
@@ -12948,9 +12951,10 @@ function fillPlaceholders(params, values) {
|
|
|
12948
12951
|
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
12949
12952
|
if (!(p.value.name in values))
|
|
12950
12953
|
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
+
const value = values[p.value.name];
|
|
12955
|
+
if (value === null)
|
|
12956
|
+
return value;
|
|
12957
|
+
const mapped = p.encoder.mapToDriverValue.isNoop ? value : p.encoder.mapToDriverValue(value);
|
|
12954
12958
|
return p.codec ? p.codec(mapped) : mapped;
|
|
12955
12959
|
}
|
|
12956
12960
|
return p;
|
|
@@ -13320,6 +13324,9 @@ var PgColumn = class extends Column {
|
|
|
13320
13324
|
}
|
|
13321
13325
|
return this;
|
|
13322
13326
|
}
|
|
13327
|
+
shouldDisableInsert() {
|
|
13328
|
+
return this.config.generatedIdentity !== undefined && this.config.generatedIdentity.type !== "byDefault" || this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
13329
|
+
}
|
|
13323
13330
|
mapArrayElements(value, mapper, depth) {
|
|
13324
13331
|
if (depth > 0 && Array.isArray(value))
|
|
13325
13332
|
return value.map((v) => v === null ? null : this.mapArrayElements(v, mapper, depth - 1));
|
|
@@ -13585,20 +13592,59 @@ function orderSelectedFields2(fields, pathPrefix, codecs) {
|
|
|
13585
13592
|
path: newPath,
|
|
13586
13593
|
field,
|
|
13587
13594
|
codec: codecs?.get(field, "normalize"),
|
|
13588
|
-
arrayDimensions: field.dimensions
|
|
13595
|
+
arrayDimensions: field.dimensions,
|
|
13596
|
+
column: field
|
|
13589
13597
|
});
|
|
13590
|
-
else if (is(field,
|
|
13591
|
-
|
|
13598
|
+
else if (is(field, SQL) || is(field, SQL.Aliased)) {
|
|
13599
|
+
const col = getColumnFromDecoder2(field);
|
|
13600
|
+
result.push(col ? {
|
|
13601
|
+
path: newPath,
|
|
13602
|
+
field,
|
|
13603
|
+
codec: codecs?.get(col, "normalize"),
|
|
13604
|
+
arrayDimensions: col.dimensions,
|
|
13605
|
+
column: col
|
|
13606
|
+
} : {
|
|
13607
|
+
path: newPath,
|
|
13608
|
+
field
|
|
13609
|
+
});
|
|
13610
|
+
} else if (is(field, Subquery)) {
|
|
13611
|
+
let column;
|
|
13612
|
+
const entry = Object.values(field._.selectedFields)[0];
|
|
13613
|
+
let fieldDecoder;
|
|
13614
|
+
if (is(entry, Column)) {
|
|
13615
|
+
column = entry;
|
|
13616
|
+
fieldDecoder = entry;
|
|
13617
|
+
} else if (is(entry, SQL)) {
|
|
13618
|
+
column = getColumnFromDecoder2(entry);
|
|
13619
|
+
fieldDecoder = entry.decoder;
|
|
13620
|
+
} else {
|
|
13621
|
+
column = getColumnFromDecoder2(entry);
|
|
13622
|
+
fieldDecoder = entry.sql.decoder;
|
|
13623
|
+
}
|
|
13624
|
+
if (fieldDecoder)
|
|
13625
|
+
field._.sql.decoder = fieldDecoder;
|
|
13626
|
+
result.push(column ? {
|
|
13627
|
+
path: newPath,
|
|
13628
|
+
field,
|
|
13629
|
+
codec: codecs?.get(column, "normalize"),
|
|
13630
|
+
arrayDimensions: column.dimensions,
|
|
13631
|
+
column
|
|
13632
|
+
} : {
|
|
13592
13633
|
path: newPath,
|
|
13593
13634
|
field
|
|
13594
13635
|
});
|
|
13595
|
-
else if (is(field, Table))
|
|
13636
|
+
} else if (is(field, Table))
|
|
13596
13637
|
result.push(...orderSelectedFields2(field[Table.Symbol.Columns], newPath, codecs));
|
|
13597
13638
|
else
|
|
13598
13639
|
result.push(...orderSelectedFields2(field, newPath, codecs));
|
|
13599
13640
|
return result;
|
|
13600
13641
|
}, []);
|
|
13601
13642
|
}
|
|
13643
|
+
function getColumnFromDecoder2(source) {
|
|
13644
|
+
const query = source.getSQL();
|
|
13645
|
+
if (is(query.decoder, Column))
|
|
13646
|
+
return query.decoder;
|
|
13647
|
+
}
|
|
13602
13648
|
function haveSameKeys2(left, right) {
|
|
13603
13649
|
const leftKeys = Object.keys(left);
|
|
13604
13650
|
const rightKeys = Object.keys(right);
|
|
@@ -13742,832 +13788,1458 @@ var PgBoolean = class extends PgColumn {
|
|
|
13742
13788
|
function boolean(name2) {
|
|
13743
13789
|
return new PgBooleanBuilder(name2 ?? "");
|
|
13744
13790
|
}
|
|
13745
|
-
// node_modules/drizzle-orm/pg-core/
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
return "double precision";
|
|
13791
|
+
// node_modules/drizzle-orm/pg-core/array.js
|
|
13792
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
13793
|
+
for (let i = startFrom;i < arrayString.length; i++) {
|
|
13794
|
+
const char = arrayString[i];
|
|
13795
|
+
if (char === "\\") {
|
|
13796
|
+
i++;
|
|
13797
|
+
continue;
|
|
13798
|
+
}
|
|
13799
|
+
if (char === '"')
|
|
13800
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
13801
|
+
if (inQuotes)
|
|
13802
|
+
continue;
|
|
13803
|
+
if (char === "," || char === "}")
|
|
13804
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
13760
13805
|
}
|
|
13761
|
-
|
|
13762
|
-
function doublePrecision(name2) {
|
|
13763
|
-
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
13806
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
13764
13807
|
}
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13808
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
13809
|
+
const result = [];
|
|
13810
|
+
let i = startFrom;
|
|
13811
|
+
let lastCharIsComma = false;
|
|
13812
|
+
while (i < arrayString.length) {
|
|
13813
|
+
const char = arrayString[i];
|
|
13814
|
+
if (char === ",") {
|
|
13815
|
+
if (lastCharIsComma || i === startFrom)
|
|
13816
|
+
result.push("");
|
|
13817
|
+
lastCharIsComma = true;
|
|
13818
|
+
i++;
|
|
13819
|
+
continue;
|
|
13820
|
+
}
|
|
13821
|
+
lastCharIsComma = false;
|
|
13822
|
+
if (char === "\\") {
|
|
13823
|
+
i += 2;
|
|
13824
|
+
continue;
|
|
13825
|
+
}
|
|
13826
|
+
if (char === '"') {
|
|
13827
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
13828
|
+
result.push(value2);
|
|
13829
|
+
i = startFrom2;
|
|
13830
|
+
continue;
|
|
13831
|
+
}
|
|
13832
|
+
if (char === "}")
|
|
13833
|
+
return [result, i + 1];
|
|
13834
|
+
if (char === "{") {
|
|
13835
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
13836
|
+
result.push(value2);
|
|
13837
|
+
i = startFrom2;
|
|
13838
|
+
continue;
|
|
13839
|
+
}
|
|
13840
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
13841
|
+
result.push(value);
|
|
13842
|
+
i = newStartFrom;
|
|
13780
13843
|
}
|
|
13781
|
-
|
|
13782
|
-
function integer(name2) {
|
|
13783
|
-
return new PgIntegerBuilder(name2 ?? "");
|
|
13844
|
+
return [result, i];
|
|
13784
13845
|
}
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
constructor(name2) {
|
|
13789
|
-
super(name2, "object json", "PgJsonb");
|
|
13790
|
-
}
|
|
13791
|
-
build(table) {
|
|
13792
|
-
return new PgJsonb(table, this.config);
|
|
13793
|
-
}
|
|
13794
|
-
};
|
|
13795
|
-
var PgJsonb = class extends PgColumn {
|
|
13796
|
-
static [entityKind] = "PgJsonb";
|
|
13797
|
-
codec = "jsonb";
|
|
13798
|
-
constructor(table, config) {
|
|
13799
|
-
super(table, config);
|
|
13800
|
-
}
|
|
13801
|
-
getSQLType() {
|
|
13802
|
-
return "jsonb";
|
|
13803
|
-
}
|
|
13804
|
-
};
|
|
13805
|
-
function jsonb(name2) {
|
|
13806
|
-
return new PgJsonbBuilder(name2 ?? "");
|
|
13846
|
+
function parsePgArray(arrayString) {
|
|
13847
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
13848
|
+
return result;
|
|
13807
13849
|
}
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13850
|
+
function makePgArray(array) {
|
|
13851
|
+
return `{${array.map((item) => {
|
|
13852
|
+
if (Array.isArray(item))
|
|
13853
|
+
return makePgArray(item);
|
|
13854
|
+
if (typeof item === "string")
|
|
13855
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
13856
|
+
return `${item}`;
|
|
13857
|
+
}).join(",")}}`;
|
|
13858
|
+
}
|
|
13859
|
+
|
|
13860
|
+
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
13861
|
+
function hexToBytes(hex) {
|
|
13862
|
+
const bytes = [];
|
|
13863
|
+
for (let c = 0;c < hex.length; c += 2)
|
|
13864
|
+
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
13865
|
+
return new Uint8Array(bytes);
|
|
13866
|
+
}
|
|
13867
|
+
function bytesToFloat64(bytes, offset) {
|
|
13868
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
13869
|
+
const view = new DataView(buffer);
|
|
13870
|
+
for (let i = 0;i < 8; i++)
|
|
13871
|
+
view.setUint8(i, bytes[offset + i]);
|
|
13872
|
+
return view.getFloat64(0, true);
|
|
13873
|
+
}
|
|
13874
|
+
function parseEWKB(hex) {
|
|
13875
|
+
const bytes = hexToBytes(hex);
|
|
13876
|
+
let offset = 0;
|
|
13877
|
+
const byteOrder = bytes[offset];
|
|
13878
|
+
offset += 1;
|
|
13879
|
+
const view = new DataView(bytes.buffer);
|
|
13880
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
13881
|
+
offset += 4;
|
|
13882
|
+
let srid;
|
|
13883
|
+
if (geomType & 536870912) {
|
|
13884
|
+
srid = view.getUint32(offset, byteOrder === 1);
|
|
13885
|
+
offset += 4;
|
|
13813
13886
|
}
|
|
13814
|
-
|
|
13815
|
-
|
|
13887
|
+
if ((geomType & 65535) === 1) {
|
|
13888
|
+
const x = bytesToFloat64(bytes, offset);
|
|
13889
|
+
offset += 8;
|
|
13890
|
+
const y = bytesToFloat64(bytes, offset);
|
|
13891
|
+
offset += 8;
|
|
13892
|
+
return {
|
|
13893
|
+
srid,
|
|
13894
|
+
point: [x, y]
|
|
13895
|
+
};
|
|
13816
13896
|
}
|
|
13897
|
+
throw new Error("Unsupported geometry type");
|
|
13898
|
+
}
|
|
13899
|
+
|
|
13900
|
+
// node_modules/drizzle-orm/codecs.js
|
|
13901
|
+
var noopCodecs = {};
|
|
13902
|
+
var arrayToItemTypeCodecNameMap = {
|
|
13903
|
+
cast: "cast",
|
|
13904
|
+
castArray: "cast",
|
|
13905
|
+
castInJson: "castInJson",
|
|
13906
|
+
castArrayInJson: "castInJson",
|
|
13907
|
+
castParam: "castParam",
|
|
13908
|
+
castArrayParam: "castParam",
|
|
13909
|
+
normalize: "normalize",
|
|
13910
|
+
normalizeArray: "normalize",
|
|
13911
|
+
normalizeInJson: "normalizeInJson",
|
|
13912
|
+
normalizeArrayInJson: "normalizeInJson",
|
|
13913
|
+
normalizeParam: "normalizeParam",
|
|
13914
|
+
normalizeParamArray: "normalizeParam"
|
|
13817
13915
|
};
|
|
13818
|
-
var
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13916
|
+
var itemToArrayTypeCodecNameMap = {
|
|
13917
|
+
cast: "castArray",
|
|
13918
|
+
castArray: "castArray",
|
|
13919
|
+
castInJson: "castArrayInJson",
|
|
13920
|
+
castArrayInJson: "castArrayInJson",
|
|
13921
|
+
castParam: "castArrayParam",
|
|
13922
|
+
castArrayParam: "castArrayParam",
|
|
13923
|
+
normalize: "normalizeArray",
|
|
13924
|
+
normalizeArray: "normalizeArray",
|
|
13925
|
+
normalizeInJson: "normalizeArrayInJson",
|
|
13926
|
+
normalizeArrayInJson: "normalizeArrayInJson",
|
|
13927
|
+
normalizeParam: "normalizeParamArray",
|
|
13928
|
+
normalizeParamArray: "normalizeParamArray"
|
|
13824
13929
|
};
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
static [entityKind] = "PgTextBuilder";
|
|
13831
|
-
constructor(name2, config) {
|
|
13832
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
13833
|
-
this.config.enumValues = config.enum;
|
|
13834
|
-
}
|
|
13835
|
-
build(table) {
|
|
13836
|
-
return new PgText(table, this.config, this.config.enumValues);
|
|
13930
|
+
var CodecsCollection = class {
|
|
13931
|
+
static [entityKind] = "CodecsCollection";
|
|
13932
|
+
constructor(resolveTypes, codecs = noopCodecs) {
|
|
13933
|
+
this.resolveTypes = resolveTypes;
|
|
13934
|
+
this.codecs = codecs;
|
|
13837
13935
|
}
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
super(table, config);
|
|
13845
|
-
this.enumValues = enumValues;
|
|
13936
|
+
get(column, type, override) {
|
|
13937
|
+
const sqlType = override ?? column.codec;
|
|
13938
|
+
if (!sqlType)
|
|
13939
|
+
return;
|
|
13940
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
13941
|
+
return this.codecs[sqlType]?.[codecType];
|
|
13846
13942
|
}
|
|
13847
|
-
|
|
13848
|
-
|
|
13943
|
+
apply(column, type, value, override) {
|
|
13944
|
+
const sqlType = override ?? column.codec;
|
|
13945
|
+
if (!sqlType)
|
|
13946
|
+
return value;
|
|
13947
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
13948
|
+
const codec = this.codecs[sqlType]?.[codecType];
|
|
13949
|
+
if (!codec)
|
|
13950
|
+
return value;
|
|
13951
|
+
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
13952
|
+
return codec(value, column, column.dimensions);
|
|
13953
|
+
return codec(value, column.dimensions);
|
|
13849
13954
|
}
|
|
13850
13955
|
};
|
|
13851
|
-
function
|
|
13852
|
-
const
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13956
|
+
function refineCodecs(source, extension = {}) {
|
|
13957
|
+
const keys = new Set([...Object.keys(source), ...Object.keys(extension)]).values();
|
|
13958
|
+
const result = {};
|
|
13959
|
+
for (const k of keys) {
|
|
13960
|
+
if (!(k in extension)) {
|
|
13961
|
+
result[k] = source[k] ? { ...source[k] } : undefined;
|
|
13962
|
+
continue;
|
|
13963
|
+
}
|
|
13964
|
+
if (!(k in source) || extension[k] === undefined) {
|
|
13965
|
+
result[k] = extension[k] ? { ...extension[k] } : undefined;
|
|
13966
|
+
continue;
|
|
13967
|
+
}
|
|
13968
|
+
const innerKeys = new Set([...Object.keys(extension[k]), ...Object.keys(source[k] ?? {})]).values();
|
|
13969
|
+
result[k] = {};
|
|
13970
|
+
for (const ik of innerKeys)
|
|
13971
|
+
result[k][ik] = ik in extension[k] ? extension[k][ik] : source[k]?.[ik];
|
|
13860
13972
|
}
|
|
13861
|
-
|
|
13973
|
+
return result;
|
|
13974
|
+
}
|
|
13862
13975
|
|
|
13863
|
-
// node_modules/drizzle-orm/pg-core/
|
|
13864
|
-
var
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13976
|
+
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
13977
|
+
var PG_ALIAS_TO_TYPE_MAP = {
|
|
13978
|
+
int2: "smallint",
|
|
13979
|
+
integer: "int",
|
|
13980
|
+
int4: "int",
|
|
13981
|
+
int8: "bigint",
|
|
13982
|
+
decimal: "numeric",
|
|
13983
|
+
real: "float4",
|
|
13984
|
+
double: "float8",
|
|
13985
|
+
"double precision": "float8",
|
|
13986
|
+
serial2: "smallserial",
|
|
13987
|
+
serial4: "serial",
|
|
13988
|
+
serial8: "bigserial",
|
|
13989
|
+
character: "char",
|
|
13990
|
+
"character varying": "varchar",
|
|
13991
|
+
"time with time zone": "timetz",
|
|
13992
|
+
"time without time zone": "time",
|
|
13993
|
+
"timestamp with time zone": "timestamptz",
|
|
13994
|
+
"timestamp without time zone": "timestamp",
|
|
13995
|
+
boolean: "bool",
|
|
13996
|
+
"bit varying": "varbit"
|
|
13874
13997
|
};
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13998
|
+
function resolvePgTypeAlias(type) {
|
|
13999
|
+
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
14000
|
+
}
|
|
14001
|
+
var unionsTypeTable = {
|
|
14002
|
+
smallint: {
|
|
14003
|
+
smallint: "smallint",
|
|
14004
|
+
int: "int",
|
|
14005
|
+
bigint: "bigint:number",
|
|
14006
|
+
"bigint:number": "bigint:number",
|
|
14007
|
+
"bigint:string": "bigint:number",
|
|
14008
|
+
numeric: "numeric:number",
|
|
14009
|
+
"numeric:number": "numeric:number",
|
|
14010
|
+
"numeric:bigint": "numeric:number",
|
|
14011
|
+
float4: "float4",
|
|
14012
|
+
float8: "float8",
|
|
14013
|
+
smallserial: "smallint",
|
|
14014
|
+
serial: "int",
|
|
14015
|
+
bigserial: "bigint:number",
|
|
14016
|
+
"bigserial:number": "bigint:number",
|
|
14017
|
+
oid: "oid",
|
|
14018
|
+
regproc: "regproc",
|
|
14019
|
+
regprocedure: "regprocedure",
|
|
14020
|
+
regoper: "regoper",
|
|
14021
|
+
regoperator: "regoperator",
|
|
14022
|
+
regclass: "regclass",
|
|
14023
|
+
regtype: "regtype",
|
|
14024
|
+
regrole: "regrole",
|
|
14025
|
+
regnamespace: "regnamespace",
|
|
14026
|
+
regconfig: "regconfig",
|
|
14027
|
+
regdictionary: "regdictionary"
|
|
14028
|
+
},
|
|
14029
|
+
int: {
|
|
14030
|
+
smallint: "int",
|
|
14031
|
+
int: "int",
|
|
14032
|
+
bigint: "bigint:number",
|
|
14033
|
+
"bigint:number": "bigint:number",
|
|
14034
|
+
"bigint:string": "bigint:number",
|
|
14035
|
+
numeric: "numeric:number",
|
|
14036
|
+
"numeric:number": "numeric:number",
|
|
14037
|
+
"numeric:bigint": "numeric:number",
|
|
14038
|
+
float4: "float4",
|
|
14039
|
+
float8: "float8",
|
|
14040
|
+
smallserial: "int",
|
|
14041
|
+
serial: "int",
|
|
14042
|
+
bigserial: "bigint:number",
|
|
14043
|
+
"bigserial:number": "bigint:number",
|
|
14044
|
+
oid: "oid",
|
|
14045
|
+
regproc: "regproc",
|
|
14046
|
+
regprocedure: "regprocedure",
|
|
14047
|
+
regoper: "regoper",
|
|
14048
|
+
regoperator: "regoperator",
|
|
14049
|
+
regclass: "regclass",
|
|
14050
|
+
regtype: "regtype",
|
|
14051
|
+
regrole: "regrole",
|
|
14052
|
+
regnamespace: "regnamespace",
|
|
14053
|
+
regconfig: "regconfig",
|
|
14054
|
+
regdictionary: "regdictionary"
|
|
14055
|
+
},
|
|
14056
|
+
bigint: {
|
|
14057
|
+
smallint: "bigint",
|
|
14058
|
+
int: "bigint",
|
|
14059
|
+
bigint: "bigint",
|
|
14060
|
+
"bigint:number": "bigint",
|
|
14061
|
+
"bigint:string": "bigint",
|
|
14062
|
+
numeric: "numeric:bigint",
|
|
14063
|
+
"numeric:number": "numeric:bigint",
|
|
14064
|
+
"numeric:bigint": "numeric:bigint",
|
|
14065
|
+
float4: "float4",
|
|
14066
|
+
float8: "float8",
|
|
14067
|
+
smallserial: "bigint",
|
|
14068
|
+
serial: "bigint",
|
|
14069
|
+
bigserial: "bigint",
|
|
14070
|
+
"bigserial:number": "bigint",
|
|
14071
|
+
oid: "oid",
|
|
14072
|
+
regproc: "regproc",
|
|
14073
|
+
regprocedure: "regprocedure",
|
|
14074
|
+
regoper: "regoper",
|
|
14075
|
+
regoperator: "regoperator",
|
|
14076
|
+
regclass: "regclass",
|
|
14077
|
+
regtype: "regtype",
|
|
14078
|
+
regrole: "regrole",
|
|
14079
|
+
regnamespace: "regnamespace",
|
|
14080
|
+
regconfig: "regconfig",
|
|
14081
|
+
regdictionary: "regdictionary"
|
|
14082
|
+
},
|
|
14083
|
+
"bigint:number": {
|
|
14084
|
+
smallint: "bigint:number",
|
|
14085
|
+
int: "bigint:number",
|
|
14086
|
+
bigint: "bigint:number",
|
|
14087
|
+
"bigint:number": "bigint:number",
|
|
14088
|
+
"bigint:string": "bigint:number",
|
|
14089
|
+
numeric: "numeric:number",
|
|
14090
|
+
"numeric:number": "numeric:number",
|
|
14091
|
+
"numeric:bigint": "numeric:number",
|
|
14092
|
+
float4: "float4",
|
|
14093
|
+
float8: "float8",
|
|
14094
|
+
smallserial: "bigint:number",
|
|
14095
|
+
serial: "bigint:number",
|
|
14096
|
+
bigserial: "bigint:number",
|
|
14097
|
+
"bigserial:number": "bigint:number",
|
|
14098
|
+
oid: "oid",
|
|
14099
|
+
regproc: "regproc",
|
|
14100
|
+
regprocedure: "regprocedure",
|
|
14101
|
+
regoper: "regoper",
|
|
14102
|
+
regoperator: "regoperator",
|
|
14103
|
+
regclass: "regclass",
|
|
14104
|
+
regtype: "regtype",
|
|
14105
|
+
regrole: "regrole",
|
|
14106
|
+
regnamespace: "regnamespace",
|
|
14107
|
+
regconfig: "regconfig",
|
|
14108
|
+
regdictionary: "regdictionary"
|
|
14109
|
+
},
|
|
14110
|
+
"bigint:string": {
|
|
14111
|
+
smallint: "bigint:string",
|
|
14112
|
+
int: "bigint:string",
|
|
14113
|
+
bigint: "bigint:string",
|
|
14114
|
+
"bigint:number": "bigint:string",
|
|
14115
|
+
"bigint:string": "bigint:string",
|
|
14116
|
+
numeric: "numeric",
|
|
14117
|
+
"numeric:number": "numeric",
|
|
14118
|
+
"numeric:bigint": "numeric",
|
|
14119
|
+
float4: "float4",
|
|
14120
|
+
float8: "float8",
|
|
14121
|
+
smallserial: "bigint:string",
|
|
14122
|
+
serial: "bigint:string",
|
|
14123
|
+
bigserial: "bigint:string",
|
|
14124
|
+
"bigserial:number": "bigint:string",
|
|
14125
|
+
oid: "oid",
|
|
14126
|
+
regproc: "regproc",
|
|
14127
|
+
regprocedure: "regprocedure",
|
|
14128
|
+
regoper: "regoper",
|
|
14129
|
+
regoperator: "regoperator",
|
|
14130
|
+
regclass: "regclass",
|
|
14131
|
+
regtype: "regtype",
|
|
14132
|
+
regrole: "regrole",
|
|
14133
|
+
regnamespace: "regnamespace",
|
|
14134
|
+
regconfig: "regconfig",
|
|
14135
|
+
regdictionary: "regdictionary"
|
|
14136
|
+
},
|
|
14137
|
+
numeric: {
|
|
14138
|
+
smallint: "numeric",
|
|
14139
|
+
int: "numeric",
|
|
14140
|
+
bigint: "numeric",
|
|
14141
|
+
"bigint:number": "numeric",
|
|
14142
|
+
"bigint:string": "numeric",
|
|
14143
|
+
numeric: "numeric",
|
|
14144
|
+
"numeric:number": "numeric",
|
|
14145
|
+
"numeric:bigint": "numeric",
|
|
14146
|
+
float4: "float4",
|
|
14147
|
+
float8: "float8",
|
|
14148
|
+
smallserial: "numeric",
|
|
14149
|
+
serial: "numeric",
|
|
14150
|
+
bigserial: "numeric",
|
|
14151
|
+
"bigserial:number": "numeric"
|
|
14152
|
+
},
|
|
14153
|
+
"numeric:number": {
|
|
14154
|
+
smallint: "numeric:number",
|
|
14155
|
+
int: "numeric:number",
|
|
14156
|
+
bigint: "numeric:number",
|
|
14157
|
+
"bigint:number": "numeric:number",
|
|
14158
|
+
"bigint:string": "numeric:number",
|
|
14159
|
+
numeric: "numeric:number",
|
|
14160
|
+
"numeric:number": "numeric:number",
|
|
14161
|
+
"numeric:bigint": "numeric:number",
|
|
14162
|
+
float4: "float4",
|
|
14163
|
+
float8: "float8",
|
|
14164
|
+
smallserial: "numeric:number",
|
|
14165
|
+
serial: "numeric:number",
|
|
14166
|
+
bigserial: "numeric:number",
|
|
14167
|
+
"bigserial:number": "numeric:number"
|
|
14168
|
+
},
|
|
14169
|
+
"numeric:bigint": {
|
|
14170
|
+
smallint: "numeric:bigint",
|
|
14171
|
+
int: "numeric:bigint",
|
|
14172
|
+
bigint: "numeric:bigint",
|
|
14173
|
+
"bigint:number": "numeric:bigint",
|
|
14174
|
+
"bigint:string": "numeric:bigint",
|
|
14175
|
+
numeric: "numeric:bigint",
|
|
14176
|
+
"numeric:number": "numeric:bigint",
|
|
14177
|
+
"numeric:bigint": "numeric:bigint",
|
|
14178
|
+
float4: "float4",
|
|
14179
|
+
float8: "float8",
|
|
14180
|
+
smallserial: "numeric:bigint",
|
|
14181
|
+
serial: "numeric:bigint",
|
|
14182
|
+
bigserial: "numeric:bigint",
|
|
14183
|
+
"bigserial:number": "numeric:bigint"
|
|
14184
|
+
},
|
|
14185
|
+
float4: {
|
|
14186
|
+
smallint: "float4",
|
|
14187
|
+
int: "float4",
|
|
14188
|
+
bigint: "float4",
|
|
14189
|
+
"bigint:number": "float4",
|
|
14190
|
+
"bigint:string": "float4",
|
|
14191
|
+
numeric: "float4",
|
|
14192
|
+
"numeric:number": "float4",
|
|
14193
|
+
"numeric:bigint": "float4",
|
|
14194
|
+
float4: "float4",
|
|
14195
|
+
float8: "float8",
|
|
14196
|
+
smallserial: "float4",
|
|
14197
|
+
serial: "float4",
|
|
14198
|
+
bigserial: "float4",
|
|
14199
|
+
"bigserial:number": "float4"
|
|
14200
|
+
},
|
|
14201
|
+
float8: {
|
|
14202
|
+
smallint: "float8",
|
|
14203
|
+
int: "float8",
|
|
14204
|
+
bigint: "float8",
|
|
14205
|
+
"bigint:number": "float8",
|
|
14206
|
+
"bigint:string": "float8",
|
|
14207
|
+
numeric: "float8",
|
|
14208
|
+
"numeric:number": "float8",
|
|
14209
|
+
"numeric:bigint": "float8",
|
|
14210
|
+
float4: "float8",
|
|
14211
|
+
float8: "float8",
|
|
14212
|
+
smallserial: "float8",
|
|
14213
|
+
serial: "float8",
|
|
14214
|
+
bigserial: "float8",
|
|
14215
|
+
"bigserial:number": "float8"
|
|
14216
|
+
},
|
|
14217
|
+
money: { money: "money" },
|
|
14218
|
+
smallserial: {
|
|
14219
|
+
smallint: "smallint",
|
|
14220
|
+
int: "int",
|
|
14221
|
+
bigint: "bigint:number",
|
|
14222
|
+
"bigint:number": "bigint:number",
|
|
14223
|
+
"bigint:string": "bigint:number",
|
|
14224
|
+
numeric: "numeric:number",
|
|
14225
|
+
"numeric:number": "numeric:number",
|
|
14226
|
+
"numeric:bigint": "numeric:number",
|
|
14227
|
+
float4: "float4",
|
|
14228
|
+
float8: "float8",
|
|
14229
|
+
smallserial: "smallint",
|
|
14230
|
+
serial: "int",
|
|
14231
|
+
bigserial: "bigint:number",
|
|
14232
|
+
"bigserial:number": "bigint:number",
|
|
14233
|
+
oid: "oid",
|
|
14234
|
+
regproc: "regproc",
|
|
14235
|
+
regprocedure: "regprocedure",
|
|
14236
|
+
regoper: "regoper",
|
|
14237
|
+
regoperator: "regoperator",
|
|
14238
|
+
regclass: "regclass",
|
|
14239
|
+
regtype: "regtype",
|
|
14240
|
+
regrole: "regrole",
|
|
14241
|
+
regnamespace: "regnamespace",
|
|
14242
|
+
regconfig: "regconfig",
|
|
14243
|
+
regdictionary: "regdictionary"
|
|
14244
|
+
},
|
|
14245
|
+
serial: {
|
|
14246
|
+
smallint: "int",
|
|
14247
|
+
int: "int",
|
|
14248
|
+
bigint: "bigint:number",
|
|
14249
|
+
"bigint:number": "bigint:number",
|
|
14250
|
+
"bigint:string": "bigint:number",
|
|
14251
|
+
numeric: "numeric:number",
|
|
14252
|
+
"numeric:number": "numeric:number",
|
|
14253
|
+
"numeric:bigint": "numeric:number",
|
|
14254
|
+
float4: "float4",
|
|
14255
|
+
float8: "float8",
|
|
14256
|
+
smallserial: "int",
|
|
14257
|
+
serial: "int",
|
|
14258
|
+
bigserial: "bigint:number",
|
|
14259
|
+
"bigserial:number": "bigint:number",
|
|
14260
|
+
oid: "oid",
|
|
14261
|
+
regproc: "regproc",
|
|
14262
|
+
regprocedure: "regprocedure",
|
|
14263
|
+
regoper: "regoper",
|
|
14264
|
+
regoperator: "regoperator",
|
|
14265
|
+
regclass: "regclass",
|
|
14266
|
+
regtype: "regtype",
|
|
14267
|
+
regrole: "regrole",
|
|
14268
|
+
regnamespace: "regnamespace",
|
|
14269
|
+
regconfig: "regconfig",
|
|
14270
|
+
regdictionary: "regdictionary"
|
|
14271
|
+
},
|
|
14272
|
+
bigserial: {
|
|
14273
|
+
smallint: "bigint",
|
|
14274
|
+
int: "bigint",
|
|
14275
|
+
bigint: "bigint",
|
|
14276
|
+
"bigint:number": "bigint",
|
|
14277
|
+
"bigint:string": "bigint",
|
|
14278
|
+
numeric: "numeric:bigint",
|
|
14279
|
+
"numeric:number": "numeric:bigint",
|
|
14280
|
+
"numeric:bigint": "numeric:bigint",
|
|
14281
|
+
float4: "float4",
|
|
14282
|
+
float8: "float8",
|
|
14283
|
+
smallserial: "bigint",
|
|
14284
|
+
serial: "bigint",
|
|
14285
|
+
bigserial: "bigint",
|
|
14286
|
+
"bigserial:number": "bigint",
|
|
14287
|
+
oid: "oid",
|
|
14288
|
+
regproc: "regproc",
|
|
14289
|
+
regprocedure: "regprocedure",
|
|
14290
|
+
regoper: "regoper",
|
|
14291
|
+
regoperator: "regoperator",
|
|
14292
|
+
regclass: "regclass",
|
|
14293
|
+
regtype: "regtype",
|
|
14294
|
+
regrole: "regrole",
|
|
14295
|
+
regnamespace: "regnamespace",
|
|
14296
|
+
regconfig: "regconfig",
|
|
14297
|
+
regdictionary: "regdictionary"
|
|
14298
|
+
},
|
|
14299
|
+
"bigserial:number": {
|
|
14300
|
+
smallint: "bigint:number",
|
|
14301
|
+
int: "bigint:number",
|
|
14302
|
+
bigint: "bigint:number",
|
|
14303
|
+
"bigint:number": "bigint:number",
|
|
14304
|
+
"bigint:string": "bigint:number",
|
|
14305
|
+
numeric: "numeric:number",
|
|
14306
|
+
"numeric:number": "numeric:number",
|
|
14307
|
+
"numeric:bigint": "numeric:number",
|
|
14308
|
+
float4: "float4",
|
|
14309
|
+
float8: "float8",
|
|
14310
|
+
smallserial: "bigint:number",
|
|
14311
|
+
serial: "bigint:number",
|
|
14312
|
+
bigserial: "bigint:number",
|
|
14313
|
+
"bigserial:number": "bigint:number",
|
|
14314
|
+
oid: "oid",
|
|
14315
|
+
regproc: "regproc",
|
|
14316
|
+
regprocedure: "regprocedure",
|
|
14317
|
+
regoper: "regoper",
|
|
14318
|
+
regoperator: "regoperator",
|
|
14319
|
+
regclass: "regclass",
|
|
14320
|
+
regtype: "regtype",
|
|
14321
|
+
regrole: "regrole",
|
|
14322
|
+
regnamespace: "regnamespace",
|
|
14323
|
+
regconfig: "regconfig",
|
|
14324
|
+
regdictionary: "regdictionary"
|
|
14325
|
+
},
|
|
14326
|
+
char: {
|
|
14327
|
+
char: "char",
|
|
14328
|
+
varchar: "char",
|
|
14329
|
+
text: "char"
|
|
14330
|
+
},
|
|
14331
|
+
varchar: {
|
|
14332
|
+
char: "varchar",
|
|
14333
|
+
varchar: "varchar",
|
|
14334
|
+
text: "varchar"
|
|
14335
|
+
},
|
|
14336
|
+
text: {
|
|
14337
|
+
char: "text",
|
|
14338
|
+
varchar: "text",
|
|
14339
|
+
text: "text"
|
|
14340
|
+
},
|
|
14341
|
+
bytea: { bytea: "bytea" },
|
|
14342
|
+
date: {
|
|
14343
|
+
date: "date",
|
|
14344
|
+
"date:string": "date",
|
|
14345
|
+
timestamp: "timestamp",
|
|
14346
|
+
"timestamp:string": "timestamp",
|
|
14347
|
+
timestamptz: "timestamptz",
|
|
14348
|
+
"timestamptz:string": "timestamptz"
|
|
14349
|
+
},
|
|
14350
|
+
"date:string": {
|
|
14351
|
+
date: "date:string",
|
|
14352
|
+
"date:string": "date:string",
|
|
14353
|
+
timestamp: "timestamp:string",
|
|
14354
|
+
"timestamp:string": "timestamp:string",
|
|
14355
|
+
timestamptz: "timestamptz:string",
|
|
14356
|
+
"timestamptz:string": "timestamptz:string"
|
|
14357
|
+
},
|
|
14358
|
+
time: {
|
|
14359
|
+
time: "time",
|
|
14360
|
+
timetz: "timetz"
|
|
14361
|
+
},
|
|
14362
|
+
timetz: {
|
|
14363
|
+
time: "timetz",
|
|
14364
|
+
timetz: "timetz"
|
|
14365
|
+
},
|
|
14366
|
+
timestamp: {
|
|
14367
|
+
date: "timestamp",
|
|
14368
|
+
"date:string": "timestamp",
|
|
14369
|
+
timestamp: "timestamp",
|
|
14370
|
+
"timestamp:string": "timestamp",
|
|
14371
|
+
timestamptz: "timestamptz",
|
|
14372
|
+
"timestamptz:string": "timestamptz"
|
|
14373
|
+
},
|
|
14374
|
+
"timestamp:string": {
|
|
14375
|
+
date: "timestamp:string",
|
|
14376
|
+
"date:string": "timestamp:string",
|
|
14377
|
+
timestamp: "timestamp:string",
|
|
14378
|
+
"timestamp:string": "timestamp:string",
|
|
14379
|
+
timestamptz: "timestamptz:string",
|
|
14380
|
+
"timestamptz:string": "timestamptz:string"
|
|
14381
|
+
},
|
|
14382
|
+
timestamptz: {
|
|
14383
|
+
date: "timestamptz",
|
|
14384
|
+
"date:string": "timestamptz",
|
|
14385
|
+
timestamp: "timestamptz",
|
|
14386
|
+
"timestamp:string": "timestamptz",
|
|
14387
|
+
timestamptz: "timestamptz",
|
|
14388
|
+
"timestamptz:string": "timestamptz"
|
|
14389
|
+
},
|
|
14390
|
+
"timestamptz:string": {
|
|
14391
|
+
date: "timestamptz:string",
|
|
14392
|
+
"date:string": "timestamptz:string",
|
|
14393
|
+
timestamp: "timestamptz:string",
|
|
14394
|
+
"timestamp:string": "timestamptz:string",
|
|
14395
|
+
timestamptz: "timestamptz:string",
|
|
14396
|
+
"timestamptz:string": "timestamptz:string"
|
|
14397
|
+
},
|
|
14398
|
+
interval: {
|
|
14399
|
+
interval: "interval",
|
|
14400
|
+
"interval:tuple": "interval"
|
|
14401
|
+
},
|
|
14402
|
+
"interval:tuple": {
|
|
14403
|
+
interval: "interval:tuple",
|
|
14404
|
+
"interval:tuple": "interval:tuple"
|
|
14405
|
+
},
|
|
14406
|
+
bool: { bool: "bool" },
|
|
14407
|
+
enum: { enum: "enum" },
|
|
14408
|
+
point: {
|
|
14409
|
+
point: "point",
|
|
14410
|
+
"point:tuple": "point"
|
|
14411
|
+
},
|
|
14412
|
+
"point:tuple": {
|
|
14413
|
+
point: "point:tuple",
|
|
14414
|
+
"point:tuple": "point:tuple"
|
|
14415
|
+
},
|
|
14416
|
+
line: {
|
|
14417
|
+
line: "line",
|
|
14418
|
+
"line:tuple": "line"
|
|
14419
|
+
},
|
|
14420
|
+
"line:tuple": {
|
|
14421
|
+
line: "line:tuple",
|
|
14422
|
+
"line:tuple": "line:tuple"
|
|
14423
|
+
},
|
|
14424
|
+
lseg: { lseg: "lseg" },
|
|
14425
|
+
box: { box: "box" },
|
|
14426
|
+
path: { path: "path" },
|
|
14427
|
+
polygon: { polygon: "polygon" },
|
|
14428
|
+
circle: { circle: "circle" },
|
|
14429
|
+
cidr: {
|
|
14430
|
+
cidr: "cidr",
|
|
14431
|
+
inet: "inet"
|
|
14432
|
+
},
|
|
14433
|
+
inet: {
|
|
14434
|
+
cidr: "inet",
|
|
14435
|
+
inet: "inet"
|
|
14436
|
+
},
|
|
14437
|
+
macaddr: {
|
|
14438
|
+
macaddr: "macaddr",
|
|
14439
|
+
macaddr8: "macaddr"
|
|
14440
|
+
},
|
|
14441
|
+
macaddr8: {
|
|
14442
|
+
macaddr: "macaddr8",
|
|
14443
|
+
macaddr8: "macaddr8"
|
|
14444
|
+
},
|
|
14445
|
+
bit: {
|
|
14446
|
+
bit: "bit",
|
|
14447
|
+
varbit: "bit"
|
|
14448
|
+
},
|
|
14449
|
+
varbit: {
|
|
14450
|
+
bit: "varbit",
|
|
14451
|
+
varbit: "varbit"
|
|
14452
|
+
},
|
|
14453
|
+
tsvector: { tsvector: "tsvector" },
|
|
14454
|
+
tsquery: { tsquery: "tsquery" },
|
|
14455
|
+
uuid: { uuid: "uuid" },
|
|
14456
|
+
xml: { xml: "xml" },
|
|
14457
|
+
json: { json: "json" },
|
|
14458
|
+
jsonb: { jsonb: "jsonb" },
|
|
14459
|
+
int4range: { int4range: "int4range" },
|
|
14460
|
+
int8range: { int8range: "int8range" },
|
|
14461
|
+
numrange: { numrange: "numrange" },
|
|
14462
|
+
tsrange: { tsrange: "tsrange" },
|
|
14463
|
+
tstzrange: { tstzrange: "tstzrange" },
|
|
14464
|
+
daterange: { daterange: "daterange" },
|
|
14465
|
+
int4multirange: { int4multirange: "int4multirange" },
|
|
14466
|
+
int8multirange: { int8multirange: "int8multirange" },
|
|
14467
|
+
nummultirange: { nummultirange: "nummultirange" },
|
|
14468
|
+
tsmultirange: { tsmultirange: "tsmultirange" },
|
|
14469
|
+
tstzmultirange: { tstzmultirange: "tstzmultirange" },
|
|
14470
|
+
datemultirange: { datemultirange: "datemultirange" },
|
|
14471
|
+
oid: {
|
|
14472
|
+
smallint: "oid",
|
|
14473
|
+
int: "oid",
|
|
14474
|
+
bigint: "oid",
|
|
14475
|
+
"bigint:number": "oid",
|
|
14476
|
+
"bigint:string": "oid",
|
|
14477
|
+
smallserial: "oid",
|
|
14478
|
+
serial: "oid",
|
|
14479
|
+
bigserial: "oid",
|
|
14480
|
+
"bigserial:number": "oid",
|
|
14481
|
+
oid: "oid",
|
|
14482
|
+
regproc: "oid",
|
|
14483
|
+
regprocedure: "oid",
|
|
14484
|
+
regoper: "oid",
|
|
14485
|
+
regoperator: "oid",
|
|
14486
|
+
regclass: "oid",
|
|
14487
|
+
regtype: "oid",
|
|
14488
|
+
regrole: "oid",
|
|
14489
|
+
regnamespace: "oid",
|
|
14490
|
+
regconfig: "oid",
|
|
14491
|
+
regdictionary: "oid"
|
|
14492
|
+
},
|
|
14493
|
+
regproc: {
|
|
14494
|
+
smallint: "regproc",
|
|
14495
|
+
int: "regproc",
|
|
14496
|
+
bigint: "regproc",
|
|
14497
|
+
"bigint:number": "regproc",
|
|
14498
|
+
"bigint:string": "regproc",
|
|
14499
|
+
smallserial: "regproc",
|
|
14500
|
+
serial: "regproc",
|
|
14501
|
+
bigserial: "regproc",
|
|
14502
|
+
"bigserial:number": "regproc",
|
|
14503
|
+
oid: "regproc",
|
|
14504
|
+
regproc: "regproc",
|
|
14505
|
+
regprocedure: "regproc"
|
|
14506
|
+
},
|
|
14507
|
+
regprocedure: {
|
|
14508
|
+
smallint: "regprocedure",
|
|
14509
|
+
int: "regprocedure",
|
|
14510
|
+
bigint: "regprocedure",
|
|
14511
|
+
"bigint:number": "regprocedure",
|
|
14512
|
+
"bigint:string": "regprocedure",
|
|
14513
|
+
smallserial: "regprocedure",
|
|
14514
|
+
serial: "regprocedure",
|
|
14515
|
+
bigserial: "regprocedure",
|
|
14516
|
+
"bigserial:number": "regprocedure",
|
|
14517
|
+
oid: "regprocedure",
|
|
14518
|
+
regproc: "regprocedure",
|
|
14519
|
+
regprocedure: "regprocedure"
|
|
14520
|
+
},
|
|
14521
|
+
regoper: {
|
|
14522
|
+
smallint: "regoper",
|
|
14523
|
+
int: "regoper",
|
|
14524
|
+
bigint: "regoper",
|
|
14525
|
+
"bigint:number": "regoper",
|
|
14526
|
+
"bigint:string": "regoper",
|
|
14527
|
+
smallserial: "regoper",
|
|
14528
|
+
serial: "regoper",
|
|
14529
|
+
bigserial: "regoper",
|
|
14530
|
+
"bigserial:number": "regoper",
|
|
14531
|
+
oid: "regoper",
|
|
14532
|
+
regoper: "regoper",
|
|
14533
|
+
regoperator: "regoper"
|
|
14534
|
+
},
|
|
14535
|
+
regoperator: {
|
|
14536
|
+
smallint: "regoperator",
|
|
14537
|
+
int: "regoperator",
|
|
14538
|
+
bigint: "regoperator",
|
|
14539
|
+
"bigint:number": "regoperator",
|
|
14540
|
+
"bigint:string": "regoperator",
|
|
14541
|
+
smallserial: "regoperator",
|
|
14542
|
+
serial: "regoperator",
|
|
14543
|
+
bigserial: "regoperator",
|
|
14544
|
+
"bigserial:number": "regoperator",
|
|
14545
|
+
oid: "regoperator",
|
|
14546
|
+
regoper: "regoperator",
|
|
14547
|
+
regoperator: "regoperator"
|
|
14548
|
+
},
|
|
14549
|
+
regclass: {
|
|
14550
|
+
smallint: "regclass",
|
|
14551
|
+
int: "regclass",
|
|
14552
|
+
bigint: "regclass",
|
|
14553
|
+
"bigint:number": "regclass",
|
|
14554
|
+
"bigint:string": "regclass",
|
|
14555
|
+
smallserial: "regclass",
|
|
14556
|
+
serial: "regclass",
|
|
14557
|
+
bigserial: "regclass",
|
|
14558
|
+
"bigserial:number": "regclass",
|
|
14559
|
+
oid: "regclass",
|
|
14560
|
+
regclass: "regclass"
|
|
14561
|
+
},
|
|
14562
|
+
regtype: {
|
|
14563
|
+
smallint: "regtype",
|
|
14564
|
+
int: "regtype",
|
|
14565
|
+
bigint: "regtype",
|
|
14566
|
+
"bigint:number": "regtype",
|
|
14567
|
+
"bigint:string": "regtype",
|
|
14568
|
+
smallserial: "regtype",
|
|
14569
|
+
serial: "regtype",
|
|
14570
|
+
bigserial: "regtype",
|
|
14571
|
+
"bigserial:number": "regtype",
|
|
14572
|
+
oid: "regtype",
|
|
14573
|
+
regtype: "regtype"
|
|
14574
|
+
},
|
|
14575
|
+
regrole: {
|
|
14576
|
+
smallint: "regrole",
|
|
14577
|
+
int: "regrole",
|
|
14578
|
+
bigint: "regrole",
|
|
14579
|
+
"bigint:number": "regrole",
|
|
14580
|
+
"bigint:string": "regrole",
|
|
14581
|
+
smallserial: "regrole",
|
|
14582
|
+
serial: "regrole",
|
|
14583
|
+
bigserial: "regrole",
|
|
14584
|
+
"bigserial:number": "regrole",
|
|
14585
|
+
oid: "regrole",
|
|
14586
|
+
regrole: "regrole"
|
|
14587
|
+
},
|
|
14588
|
+
regnamespace: {
|
|
14589
|
+
smallint: "regnamespace",
|
|
14590
|
+
int: "regnamespace",
|
|
14591
|
+
bigint: "regnamespace",
|
|
14592
|
+
"bigint:number": "regnamespace",
|
|
14593
|
+
"bigint:string": "regnamespace",
|
|
14594
|
+
smallserial: "regnamespace",
|
|
14595
|
+
serial: "regnamespace",
|
|
14596
|
+
bigserial: "regnamespace",
|
|
14597
|
+
"bigserial:number": "regnamespace",
|
|
14598
|
+
oid: "regnamespace",
|
|
14599
|
+
regnamespace: "regnamespace"
|
|
14600
|
+
},
|
|
14601
|
+
regconfig: {
|
|
14602
|
+
smallint: "regconfig",
|
|
14603
|
+
int: "regconfig",
|
|
14604
|
+
bigint: "regconfig",
|
|
14605
|
+
"bigint:number": "regconfig",
|
|
14606
|
+
"bigint:string": "regconfig",
|
|
14607
|
+
smallserial: "regconfig",
|
|
14608
|
+
serial: "regconfig",
|
|
14609
|
+
bigserial: "regconfig",
|
|
14610
|
+
"bigserial:number": "regconfig",
|
|
14611
|
+
oid: "regconfig",
|
|
14612
|
+
regconfig: "regconfig"
|
|
14613
|
+
},
|
|
14614
|
+
regdictionary: {
|
|
14615
|
+
smallint: "regdictionary",
|
|
14616
|
+
int: "regdictionary",
|
|
14617
|
+
bigint: "regdictionary",
|
|
14618
|
+
"bigint:number": "regdictionary",
|
|
14619
|
+
"bigint:string": "regdictionary",
|
|
14620
|
+
smallserial: "regdictionary",
|
|
14621
|
+
serial: "regdictionary",
|
|
14622
|
+
bigserial: "regdictionary",
|
|
14623
|
+
"bigserial:number": "regdictionary",
|
|
14624
|
+
oid: "regdictionary",
|
|
14625
|
+
regdictionary: "regdictionary"
|
|
13888
14626
|
}
|
|
13889
|
-
mapToDriverValue = (value) => {
|
|
13890
|
-
if (typeof value === "string")
|
|
13891
|
-
return value;
|
|
13892
|
-
return value.toISOString();
|
|
13893
|
-
};
|
|
13894
14627
|
};
|
|
13895
|
-
var
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
14628
|
+
var castToText = (name2) => sql`${name2}::text`;
|
|
14629
|
+
var castToTextArr = (name2, arrayDimensions) => sql`${name2}::text${sql.raw("[]".repeat(arrayDimensions))}`;
|
|
14630
|
+
var arrayCompatCast = (cast) => (name2, arrayDimensions) => {
|
|
14631
|
+
if (!arrayDimensions)
|
|
14632
|
+
return cast(name2);
|
|
14633
|
+
const aliases = [];
|
|
14634
|
+
for (let i = 0;i < arrayDimensions; i++)
|
|
14635
|
+
aliases.push(sql.identifier(`s${i}`));
|
|
14636
|
+
let indexed = name2;
|
|
14637
|
+
for (const alias of aliases)
|
|
14638
|
+
indexed = sql`${indexed}[${alias}]`;
|
|
14639
|
+
let expression = sql`array(\
|
|
14640
|
+
select ${cast(indexed)} \
|
|
14641
|
+
from generate_subscripts(${name2}, ${sql.raw(arrayDimensions.toString())}) ${aliases[arrayDimensions - 1]} \
|
|
14642
|
+
order by ${aliases[arrayDimensions - 1]})`;
|
|
14643
|
+
for (let dim = arrayDimensions - 1;dim > 0; dim--)
|
|
14644
|
+
expression = sql`array(\
|
|
14645
|
+
select ${expression} \
|
|
14646
|
+
from generate_subscripts(${name2}, ${sql.raw(dim.toString())}) ${aliases[dim - 1]} \
|
|
14647
|
+
order by ${aliases[dim - 1]})`;
|
|
14648
|
+
return sql`case when ${name2} is null then null else ${expression} end`;
|
|
13905
14649
|
};
|
|
13906
|
-
var
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
}
|
|
13917
|
-
getSQLType() {
|
|
13918
|
-
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
13919
|
-
}
|
|
13920
|
-
mapToDriverValue = (value) => {
|
|
13921
|
-
if (typeof value === "string")
|
|
13922
|
-
return value;
|
|
13923
|
-
return value.toISOString();
|
|
14650
|
+
var arrayCompatNormalize = (normalize) => {
|
|
14651
|
+
const loop = (value, arrayDimensions) => {
|
|
14652
|
+
const innerDimensions = arrayDimensions - 1;
|
|
14653
|
+
if (arrayDimensions > 1)
|
|
14654
|
+
for (let i = 0;i < value.length; ++i)
|
|
14655
|
+
loop(value[i], innerDimensions);
|
|
14656
|
+
else
|
|
14657
|
+
for (let i = 0;i < value.length; ++i)
|
|
14658
|
+
value[i] = normalize(value[i]);
|
|
14659
|
+
return value;
|
|
13924
14660
|
};
|
|
14661
|
+
return loop;
|
|
13925
14662
|
};
|
|
13926
|
-
|
|
13927
|
-
const
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
}
|
|
13940
|
-
build(table) {
|
|
13941
|
-
return new PgVarchar(table, this.config);
|
|
13942
|
-
}
|
|
14663
|
+
var arrayCompatNormalizeInput = (normalize, transformToPgArray = false) => {
|
|
14664
|
+
const loop = (value, arrayDimensions) => {
|
|
14665
|
+
const innerDimensions = arrayDimensions - 1;
|
|
14666
|
+
const out = Array.from({ length: value.length });
|
|
14667
|
+
if (arrayDimensions > 1)
|
|
14668
|
+
for (let i = 0;i < value.length; ++i)
|
|
14669
|
+
out[i] = loop(value[i], innerDimensions);
|
|
14670
|
+
else
|
|
14671
|
+
for (let i = 0;i < value.length; ++i)
|
|
14672
|
+
out[i] = normalize(value[i]);
|
|
14673
|
+
return out;
|
|
14674
|
+
};
|
|
14675
|
+
return transformToPgArray ? (v, d) => makePgArray(loop(v, d)) : loop;
|
|
13943
14676
|
};
|
|
13944
|
-
var
|
|
13945
|
-
|
|
13946
|
-
codec
|
|
13947
|
-
enumValues;
|
|
13948
|
-
constructor(table, config) {
|
|
13949
|
-
super(table, config);
|
|
13950
|
-
this.enumValues = config.enumValues;
|
|
13951
|
-
}
|
|
13952
|
-
getSQLType() {
|
|
13953
|
-
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
13954
|
-
}
|
|
14677
|
+
var parsePgArrayAndNormalize = (normalize) => {
|
|
14678
|
+
const codec = arrayCompatNormalize(normalize);
|
|
14679
|
+
return (value, arrayDimensions) => codec(parsePgArray(value), arrayDimensions);
|
|
13955
14680
|
};
|
|
13956
|
-
|
|
13957
|
-
const
|
|
13958
|
-
return
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
constructor(name2) {
|
|
13964
|
-
super(name2, "number int53", "PgBigSerial53");
|
|
13965
|
-
this.config.hasDefault = true;
|
|
13966
|
-
this.config.notNull = true;
|
|
13967
|
-
}
|
|
13968
|
-
build(table) {
|
|
13969
|
-
return new PgBigSerial53(table, this.config);
|
|
13970
|
-
}
|
|
14681
|
+
var parseLineTuple = (v) => {
|
|
14682
|
+
const [a, b, c] = v.slice(1, -1).split(",");
|
|
14683
|
+
return [
|
|
14684
|
+
Number.parseFloat(a),
|
|
14685
|
+
Number.parseFloat(b),
|
|
14686
|
+
Number.parseFloat(c)
|
|
14687
|
+
];
|
|
13971
14688
|
};
|
|
13972
|
-
var
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
14689
|
+
var parseLineABC = (v) => {
|
|
14690
|
+
const [a, b, c] = v.slice(1, -1).split(",");
|
|
14691
|
+
return {
|
|
14692
|
+
a: Number.parseFloat(a),
|
|
14693
|
+
b: Number.parseFloat(b),
|
|
14694
|
+
c: Number.parseFloat(c)
|
|
14695
|
+
};
|
|
13978
14696
|
};
|
|
13979
|
-
var
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
super(name2, "bigint int64", "PgBigSerial64");
|
|
13983
|
-
this.config.hasDefault = true;
|
|
13984
|
-
this.config.notNull = true;
|
|
13985
|
-
}
|
|
13986
|
-
build(table) {
|
|
13987
|
-
return new PgBigSerial64(table, this.config);
|
|
13988
|
-
}
|
|
14697
|
+
var parsePointTuple = (v) => {
|
|
14698
|
+
const [x, y] = v.slice(1, -1).split(",");
|
|
14699
|
+
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
13989
14700
|
};
|
|
13990
|
-
var
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
14701
|
+
var parsePointXY = (v) => {
|
|
14702
|
+
const [x, y] = v.slice(1, -1).split(",");
|
|
14703
|
+
return {
|
|
14704
|
+
x: Number.parseFloat(x),
|
|
14705
|
+
y: Number.parseFloat(y)
|
|
14706
|
+
};
|
|
14707
|
+
};
|
|
14708
|
+
var parseGeometryTuple = (v) => parseEWKB(v).point;
|
|
14709
|
+
var parseGeometryXY = (v) => {
|
|
14710
|
+
const parsed = parseEWKB(v);
|
|
14711
|
+
return {
|
|
14712
|
+
x: parsed.point[0],
|
|
14713
|
+
y: parsed.point[1]
|
|
14714
|
+
};
|
|
14715
|
+
};
|
|
14716
|
+
var textToDate = (v) => new Date(v);
|
|
14717
|
+
var textToDateWithTz = (v) => /* @__PURE__ */ new Date(v + "+0000");
|
|
14718
|
+
var parsePgVector = (v) => {
|
|
14719
|
+
const body = v.slice(1, -1);
|
|
14720
|
+
if (body.length === 0)
|
|
14721
|
+
return [];
|
|
14722
|
+
return body.split(",").map(Number.parseFloat);
|
|
14723
|
+
};
|
|
14724
|
+
var genericPgCodecs = {
|
|
14725
|
+
bytea: {
|
|
14726
|
+
castInJson: (name2) => sql`encode(${name2}, 'base64')`,
|
|
14727
|
+
castArrayInJson: arrayCompatCast((name2) => sql`encode(${name2}, 'base64')`),
|
|
14728
|
+
normalizeInJson: (v) => Buffer.from(v, "base64"),
|
|
14729
|
+
normalizeArrayInJson: arrayCompatNormalize((v) => Buffer.from(v, "base64"))
|
|
14730
|
+
},
|
|
14731
|
+
bigint: {
|
|
14732
|
+
castInJson: castToText,
|
|
14733
|
+
castArrayInJson: castToTextArr,
|
|
14734
|
+
normalizeInJson: BigInt,
|
|
14735
|
+
normalizeArrayInJson: arrayCompatNormalize(BigInt)
|
|
14736
|
+
},
|
|
14737
|
+
"bigint:number": {
|
|
14738
|
+
castInJson: castToText,
|
|
14739
|
+
castArrayInJson: castToTextArr,
|
|
14740
|
+
normalize: Number,
|
|
14741
|
+
normalizeArray: arrayCompatNormalize(Number),
|
|
14742
|
+
normalizeInJson: Number,
|
|
14743
|
+
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14744
|
+
},
|
|
14745
|
+
"bigint:string": {
|
|
14746
|
+
castInJson: castToText,
|
|
14747
|
+
castArrayInJson: castToTextArr
|
|
14748
|
+
},
|
|
14749
|
+
bigserial: {
|
|
14750
|
+
castInJson: castToText,
|
|
14751
|
+
castArrayInJson: castToTextArr,
|
|
14752
|
+
normalizeInJson: BigInt,
|
|
14753
|
+
normalizeArrayInJson: arrayCompatNormalize(BigInt),
|
|
14754
|
+
normalize: BigInt,
|
|
14755
|
+
normalizeArray: arrayCompatNormalize(BigInt)
|
|
14756
|
+
},
|
|
14757
|
+
"bigserial:number": {
|
|
14758
|
+
castInJson: castToText,
|
|
14759
|
+
castArrayInJson: castToTextArr,
|
|
14760
|
+
normalize: Number,
|
|
14761
|
+
normalizeArray: arrayCompatNormalize(Number),
|
|
14762
|
+
normalizeInJson: Number,
|
|
14763
|
+
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14764
|
+
},
|
|
14765
|
+
date: {
|
|
14766
|
+
normalizeInJson: textToDate,
|
|
14767
|
+
normalizeArrayInJson: arrayCompatNormalize(textToDate)
|
|
14768
|
+
},
|
|
14769
|
+
"date:string": {},
|
|
14770
|
+
enum: {
|
|
14771
|
+
castArray: castToTextArr,
|
|
14772
|
+
normalizeParamArray: makePgArray
|
|
14773
|
+
},
|
|
14774
|
+
"geometry(point)": {
|
|
14775
|
+
castInJson: castToText,
|
|
14776
|
+
castArrayInJson: castToTextArr,
|
|
14777
|
+
normalize: parseGeometryXY,
|
|
14778
|
+
normalizeArray: arrayCompatNormalize(parseGeometryXY),
|
|
14779
|
+
normalizeInJson: parseGeometryXY,
|
|
14780
|
+
normalizeArrayInJson: arrayCompatNormalize(parseGeometryXY)
|
|
14781
|
+
},
|
|
14782
|
+
"geometry(point):tuple": {
|
|
14783
|
+
castInJson: castToText,
|
|
14784
|
+
castArrayInJson: castToTextArr,
|
|
14785
|
+
normalize: parseGeometryTuple,
|
|
14786
|
+
normalizeArray: arrayCompatNormalize(parseGeometryTuple),
|
|
14787
|
+
normalizeInJson: parseGeometryTuple,
|
|
14788
|
+
normalizeArrayInJson: arrayCompatNormalize(parseGeometryTuple)
|
|
14789
|
+
},
|
|
14790
|
+
interval: { castArrayInJson: castToTextArr },
|
|
14791
|
+
json: { normalizeParamArray: arrayCompatNormalizeInput((v) => JSON.stringify(v), true) },
|
|
14792
|
+
jsonb: { normalizeParamArray: arrayCompatNormalizeInput((v) => JSON.stringify(v), true) },
|
|
14793
|
+
line: {
|
|
14794
|
+
castInJson: castToText,
|
|
14795
|
+
castArrayInJson: castToTextArr,
|
|
14796
|
+
normalize: parseLineABC,
|
|
14797
|
+
normalizeArray: arrayCompatNormalize(parseLineABC),
|
|
14798
|
+
normalizeInJson: parseLineABC,
|
|
14799
|
+
normalizeArrayInJson: arrayCompatNormalize(parseLineABC)
|
|
14800
|
+
},
|
|
14801
|
+
"line:tuple": {
|
|
14802
|
+
castInJson: castToText,
|
|
14803
|
+
castArrayInJson: castToTextArr,
|
|
14804
|
+
normalize: parseLineTuple,
|
|
14805
|
+
normalizeArray: arrayCompatNormalize(parseLineTuple),
|
|
14806
|
+
normalizeInJson: parseLineTuple,
|
|
14807
|
+
normalizeArrayInJson: arrayCompatNormalize(parseLineTuple)
|
|
14808
|
+
},
|
|
14809
|
+
numeric: {
|
|
14810
|
+
castInJson: castToText,
|
|
14811
|
+
castArrayInJson: castToTextArr,
|
|
14812
|
+
castArray: castToTextArr
|
|
14813
|
+
},
|
|
14814
|
+
"numeric:number": {
|
|
14815
|
+
castInJson: castToText,
|
|
14816
|
+
castArrayInJson: castToTextArr,
|
|
14817
|
+
castArray: castToTextArr,
|
|
14818
|
+
normalize: Number,
|
|
14819
|
+
normalizeArray: arrayCompatNormalize(Number),
|
|
14820
|
+
normalizeInJson: Number,
|
|
14821
|
+
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14822
|
+
},
|
|
14823
|
+
"numeric:bigint": {
|
|
14824
|
+
castInJson: castToText,
|
|
14825
|
+
castArrayInJson: castToTextArr,
|
|
14826
|
+
castArray: castToTextArr,
|
|
14827
|
+
normalize: BigInt,
|
|
14828
|
+
normalizeArray: arrayCompatNormalize(BigInt),
|
|
14829
|
+
normalizeInJson: BigInt,
|
|
14830
|
+
normalizeArrayInJson: arrayCompatNormalize(BigInt)
|
|
14831
|
+
},
|
|
14832
|
+
point: {
|
|
14833
|
+
castInJson: castToText,
|
|
14834
|
+
castArrayInJson: castToTextArr,
|
|
14835
|
+
normalize: parsePointXY,
|
|
14836
|
+
normalizeArray: arrayCompatNormalize(parsePointXY),
|
|
14837
|
+
normalizeInJson: parsePointXY,
|
|
14838
|
+
normalizeArrayInJson: arrayCompatNormalize(parsePointXY)
|
|
14839
|
+
},
|
|
14840
|
+
"point:tuple": {
|
|
14841
|
+
castInJson: castToText,
|
|
14842
|
+
castArrayInJson: castToTextArr,
|
|
14843
|
+
normalize: parsePointTuple,
|
|
14844
|
+
normalizeArray: arrayCompatNormalize(parsePointTuple),
|
|
14845
|
+
normalizeInJson: parsePointTuple,
|
|
14846
|
+
normalizeArrayInJson: arrayCompatNormalize(parsePointTuple)
|
|
14847
|
+
},
|
|
14848
|
+
timestamp: {
|
|
14849
|
+
castInJson: castToText,
|
|
14850
|
+
castArrayInJson: castToTextArr,
|
|
14851
|
+
normalizeInJson: textToDateWithTz,
|
|
14852
|
+
normalizeArrayInJson: arrayCompatNormalize(textToDateWithTz)
|
|
14853
|
+
},
|
|
14854
|
+
timestamptz: {
|
|
14855
|
+
castInJson: castToText,
|
|
14856
|
+
castArrayInJson: castToTextArr,
|
|
14857
|
+
normalizeInJson: textToDate,
|
|
14858
|
+
normalizeArrayInJson: arrayCompatNormalize(textToDate)
|
|
14859
|
+
},
|
|
14860
|
+
"timestamp:string": {
|
|
14861
|
+
castInJson: castToText,
|
|
14862
|
+
castArrayInJson: castToTextArr
|
|
14863
|
+
},
|
|
14864
|
+
"timestamptz:string": {
|
|
14865
|
+
castInJson: castToText,
|
|
14866
|
+
castArrayInJson: castToTextArr
|
|
14867
|
+
},
|
|
14868
|
+
halfvec: {
|
|
14869
|
+
normalize: parsePgVector,
|
|
14870
|
+
normalizeArray: parsePgArrayAndNormalize(parsePgVector),
|
|
14871
|
+
normalizeInJson: parsePgVector,
|
|
14872
|
+
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
14873
|
+
},
|
|
14874
|
+
vector: {
|
|
14875
|
+
normalize: parsePgVector,
|
|
14876
|
+
normalizeArray: parsePgArrayAndNormalize(parsePgVector),
|
|
14877
|
+
normalizeInJson: parsePgVector,
|
|
14878
|
+
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
13995
14879
|
}
|
|
13996
14880
|
};
|
|
13997
|
-
|
|
13998
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
13999
|
-
if (config.mode === "number")
|
|
14000
|
-
return new PgBigSerial53Builder(name2);
|
|
14001
|
-
return new PgBigSerial64Builder(name2);
|
|
14002
|
-
}
|
|
14881
|
+
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
14003
14882
|
|
|
14004
|
-
// node_modules/drizzle-orm/pg-core/columns/
|
|
14005
|
-
var
|
|
14006
|
-
static [entityKind] = "
|
|
14007
|
-
constructor(name2,
|
|
14008
|
-
super(name2,
|
|
14009
|
-
this.config.
|
|
14010
|
-
this.config.
|
|
14011
|
-
this.config.enumValues = config.enum;
|
|
14883
|
+
// node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
14884
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
14885
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
14886
|
+
constructor(name2, fieldConfig, customTypeParams) {
|
|
14887
|
+
super(name2, "custom", "PgCustomColumn");
|
|
14888
|
+
this.config.fieldConfig = fieldConfig;
|
|
14889
|
+
this.config.customTypeParams = customTypeParams;
|
|
14012
14890
|
}
|
|
14013
14891
|
build(table) {
|
|
14014
|
-
return new
|
|
14892
|
+
return new PgCustomColumn(table, this.config);
|
|
14015
14893
|
}
|
|
14016
14894
|
};
|
|
14017
|
-
var
|
|
14018
|
-
static [entityKind] = "
|
|
14019
|
-
codec
|
|
14020
|
-
|
|
14021
|
-
|
|
14895
|
+
var PgCustomColumn = class extends PgColumn {
|
|
14896
|
+
static [entityKind] = "PgCustomColumn";
|
|
14897
|
+
codec;
|
|
14898
|
+
sqlName;
|
|
14899
|
+
mapFromJsonValue;
|
|
14900
|
+
jsonSelectIdentifier;
|
|
14022
14901
|
constructor(table, config) {
|
|
14023
14902
|
super(table, config);
|
|
14024
|
-
this.
|
|
14025
|
-
this.
|
|
14903
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
14904
|
+
this.mapToDriverValue = config.customTypeParams.toDriver ?? this.mapToDriverValue;
|
|
14905
|
+
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
14906
|
+
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
14907
|
+
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
14908
|
+
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
14909
|
+
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
14910
|
+
if (this.dimensions && config.customTypeParams.fromJson)
|
|
14911
|
+
this.mapFromJsonValue = (value) => {
|
|
14912
|
+
if (value === null)
|
|
14913
|
+
return value;
|
|
14914
|
+
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
14915
|
+
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
14916
|
+
};
|
|
14917
|
+
}
|
|
14918
|
+
mapJsonArrayElements(value, mapper, depth) {
|
|
14919
|
+
if (depth > 0 && Array.isArray(value))
|
|
14920
|
+
return value.map((v) => v === null ? null : this.mapJsonArrayElements(v, mapper, depth - 1));
|
|
14921
|
+
return mapper(value);
|
|
14026
14922
|
}
|
|
14027
14923
|
getSQLType() {
|
|
14028
|
-
return this.
|
|
14924
|
+
return this.sqlName;
|
|
14029
14925
|
}
|
|
14030
14926
|
};
|
|
14031
|
-
function
|
|
14032
|
-
|
|
14033
|
-
|
|
14927
|
+
function customType(customTypeParams) {
|
|
14928
|
+
return (a, b) => {
|
|
14929
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
14930
|
+
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
14931
|
+
};
|
|
14034
14932
|
}
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
static [entityKind] = "PgCidrBuilder";
|
|
14933
|
+
// node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
14934
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
14935
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
14039
14936
|
constructor(name2) {
|
|
14040
|
-
super(name2, "
|
|
14937
|
+
super(name2, "number double", "PgDoublePrecision");
|
|
14041
14938
|
}
|
|
14042
14939
|
build(table) {
|
|
14043
|
-
return new
|
|
14940
|
+
return new PgDoublePrecision(table, this.config);
|
|
14044
14941
|
}
|
|
14045
14942
|
};
|
|
14046
|
-
var
|
|
14047
|
-
static [entityKind] = "
|
|
14048
|
-
codec = "
|
|
14943
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
14944
|
+
static [entityKind] = "PgDoublePrecision";
|
|
14945
|
+
codec = "float8";
|
|
14049
14946
|
getSQLType() {
|
|
14050
|
-
return "
|
|
14947
|
+
return "double precision";
|
|
14051
14948
|
}
|
|
14052
14949
|
};
|
|
14053
|
-
function
|
|
14054
|
-
return new
|
|
14950
|
+
function doublePrecision(name2) {
|
|
14951
|
+
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
14055
14952
|
}
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
if (char2 === "\\") {
|
|
14062
|
-
i++;
|
|
14063
|
-
continue;
|
|
14064
|
-
}
|
|
14065
|
-
if (char2 === '"')
|
|
14066
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
14067
|
-
if (inQuotes)
|
|
14068
|
-
continue;
|
|
14069
|
-
if (char2 === "," || char2 === "}")
|
|
14070
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
14953
|
+
// node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
14954
|
+
var PgIntegerBuilder = class extends PgIntColumnBuilder {
|
|
14955
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
14956
|
+
constructor(name2) {
|
|
14957
|
+
super(name2, "number int32", "PgInteger");
|
|
14071
14958
|
}
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
14075
|
-
const result = [];
|
|
14076
|
-
let i = startFrom;
|
|
14077
|
-
let lastCharIsComma = false;
|
|
14078
|
-
while (i < arrayString.length) {
|
|
14079
|
-
const char2 = arrayString[i];
|
|
14080
|
-
if (char2 === ",") {
|
|
14081
|
-
if (lastCharIsComma || i === startFrom)
|
|
14082
|
-
result.push("");
|
|
14083
|
-
lastCharIsComma = true;
|
|
14084
|
-
i++;
|
|
14085
|
-
continue;
|
|
14086
|
-
}
|
|
14087
|
-
lastCharIsComma = false;
|
|
14088
|
-
if (char2 === "\\") {
|
|
14089
|
-
i += 2;
|
|
14090
|
-
continue;
|
|
14091
|
-
}
|
|
14092
|
-
if (char2 === '"') {
|
|
14093
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
14094
|
-
result.push(value2);
|
|
14095
|
-
i = startFrom2;
|
|
14096
|
-
continue;
|
|
14097
|
-
}
|
|
14098
|
-
if (char2 === "}")
|
|
14099
|
-
return [result, i + 1];
|
|
14100
|
-
if (char2 === "{") {
|
|
14101
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
14102
|
-
result.push(value2);
|
|
14103
|
-
i = startFrom2;
|
|
14104
|
-
continue;
|
|
14105
|
-
}
|
|
14106
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
14107
|
-
result.push(value);
|
|
14108
|
-
i = newStartFrom;
|
|
14959
|
+
build(table) {
|
|
14960
|
+
return new PgInteger(table, this.config);
|
|
14109
14961
|
}
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
if (typeof item === "string")
|
|
14121
|
-
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
14122
|
-
return `${item}`;
|
|
14123
|
-
}).join(",")}}`;
|
|
14124
|
-
}
|
|
14125
|
-
|
|
14126
|
-
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
14127
|
-
function hexToBytes(hex) {
|
|
14128
|
-
const bytes = [];
|
|
14129
|
-
for (let c = 0;c < hex.length; c += 2)
|
|
14130
|
-
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
14131
|
-
return new Uint8Array(bytes);
|
|
14132
|
-
}
|
|
14133
|
-
function bytesToFloat64(bytes, offset) {
|
|
14134
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
14135
|
-
const view = new DataView(buffer);
|
|
14136
|
-
for (let i = 0;i < 8; i++)
|
|
14137
|
-
view.setUint8(i, bytes[offset + i]);
|
|
14138
|
-
return view.getFloat64(0, true);
|
|
14962
|
+
};
|
|
14963
|
+
var PgInteger = class extends PgColumn {
|
|
14964
|
+
static [entityKind] = "PgInteger";
|
|
14965
|
+
codec = "int";
|
|
14966
|
+
getSQLType() {
|
|
14967
|
+
return "integer";
|
|
14968
|
+
}
|
|
14969
|
+
};
|
|
14970
|
+
function integer(name2) {
|
|
14971
|
+
return new PgIntegerBuilder(name2 ?? "");
|
|
14139
14972
|
}
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
const view = new DataView(bytes.buffer);
|
|
14146
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
14147
|
-
offset += 4;
|
|
14148
|
-
let srid;
|
|
14149
|
-
if (geomType & 536870912) {
|
|
14150
|
-
srid = view.getUint32(offset, byteOrder === 1);
|
|
14151
|
-
offset += 4;
|
|
14973
|
+
// node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
14974
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
14975
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
14976
|
+
constructor(name2) {
|
|
14977
|
+
super(name2, "object json", "PgJsonb");
|
|
14152
14978
|
}
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
offset += 8;
|
|
14156
|
-
const y = bytesToFloat64(bytes, offset);
|
|
14157
|
-
offset += 8;
|
|
14158
|
-
return {
|
|
14159
|
-
srid,
|
|
14160
|
-
point: [x, y]
|
|
14161
|
-
};
|
|
14979
|
+
build(table) {
|
|
14980
|
+
return new PgJsonb(table, this.config);
|
|
14162
14981
|
}
|
|
14163
|
-
throw new Error("Unsupported geometry type");
|
|
14164
|
-
}
|
|
14165
|
-
|
|
14166
|
-
// node_modules/drizzle-orm/codecs.js
|
|
14167
|
-
var noopCodecs = {};
|
|
14168
|
-
var arrayToItemTypeCodecNameMap = {
|
|
14169
|
-
cast: "cast",
|
|
14170
|
-
castArray: "cast",
|
|
14171
|
-
castInJson: "castInJson",
|
|
14172
|
-
castArrayInJson: "castInJson",
|
|
14173
|
-
castParam: "castParam",
|
|
14174
|
-
castArrayParam: "castParam",
|
|
14175
|
-
normalize: "normalize",
|
|
14176
|
-
normalizeArray: "normalize",
|
|
14177
|
-
normalizeInJson: "normalizeInJson",
|
|
14178
|
-
normalizeArrayInJson: "normalizeInJson",
|
|
14179
|
-
normalizeParam: "normalizeParam",
|
|
14180
|
-
normalizeParamArray: "normalizeParam"
|
|
14181
14982
|
};
|
|
14182
|
-
var
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
normalizeInJson: "normalizeArrayInJson",
|
|
14192
|
-
normalizeArrayInJson: "normalizeArrayInJson",
|
|
14193
|
-
normalizeParam: "normalizeParamArray",
|
|
14194
|
-
normalizeParamArray: "normalizeParamArray"
|
|
14983
|
+
var PgJsonb = class extends PgColumn {
|
|
14984
|
+
static [entityKind] = "PgJsonb";
|
|
14985
|
+
codec = "jsonb";
|
|
14986
|
+
constructor(table, config) {
|
|
14987
|
+
super(table, config);
|
|
14988
|
+
}
|
|
14989
|
+
getSQLType() {
|
|
14990
|
+
return "jsonb";
|
|
14991
|
+
}
|
|
14195
14992
|
};
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14993
|
+
function jsonb(name2) {
|
|
14994
|
+
return new PgJsonbBuilder(name2 ?? "");
|
|
14995
|
+
}
|
|
14996
|
+
// node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
14997
|
+
var PgSmallIntBuilder = class extends PgIntColumnBuilder {
|
|
14998
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
14999
|
+
constructor(name2) {
|
|
15000
|
+
super(name2, "number int16", "PgSmallInt");
|
|
14201
15001
|
}
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
if (!sqlType)
|
|
14205
|
-
return;
|
|
14206
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
14207
|
-
return this.codecs[sqlType]?.[codecType];
|
|
15002
|
+
build(table) {
|
|
15003
|
+
return new PgSmallInt(table, this.config);
|
|
14208
15004
|
}
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
if (!codec)
|
|
14216
|
-
return value;
|
|
14217
|
-
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
14218
|
-
return codec(value, column, column.dimensions);
|
|
14219
|
-
return codec(value, column.dimensions);
|
|
15005
|
+
};
|
|
15006
|
+
var PgSmallInt = class extends PgColumn {
|
|
15007
|
+
static [entityKind] = "PgSmallInt";
|
|
15008
|
+
codec = "smallint";
|
|
15009
|
+
getSQLType() {
|
|
15010
|
+
return "smallint";
|
|
14220
15011
|
}
|
|
14221
15012
|
};
|
|
14222
|
-
function
|
|
14223
|
-
|
|
14224
|
-
const result = {};
|
|
14225
|
-
for (const k of keys) {
|
|
14226
|
-
if (!(k in extension)) {
|
|
14227
|
-
result[k] = source[k] ? { ...source[k] } : undefined;
|
|
14228
|
-
continue;
|
|
14229
|
-
}
|
|
14230
|
-
if (!(k in source) || extension[k] === undefined) {
|
|
14231
|
-
result[k] = extension[k] ? { ...extension[k] } : undefined;
|
|
14232
|
-
continue;
|
|
14233
|
-
}
|
|
14234
|
-
const innerKeys = new Set([...Object.keys(extension[k]), ...Object.keys(source[k] ?? {})]).values();
|
|
14235
|
-
result[k] = {};
|
|
14236
|
-
for (const ik of innerKeys)
|
|
14237
|
-
result[k][ik] = ik in extension[k] ? extension[k][ik] : source[k]?.[ik];
|
|
14238
|
-
}
|
|
14239
|
-
return result;
|
|
14240
|
-
}
|
|
14241
|
-
|
|
14242
|
-
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
14243
|
-
var PG_ALIAS_TO_TYPE_MAP = {
|
|
14244
|
-
int2: "smallint",
|
|
14245
|
-
integer: "int",
|
|
14246
|
-
int4: "int",
|
|
14247
|
-
int8: "bigint",
|
|
14248
|
-
decimal: "numeric",
|
|
14249
|
-
real: "float4",
|
|
14250
|
-
double: "float8",
|
|
14251
|
-
"double precision": "float8",
|
|
14252
|
-
serial2: "smallserial",
|
|
14253
|
-
serial4: "serial",
|
|
14254
|
-
serial8: "bigserial",
|
|
14255
|
-
character: "char",
|
|
14256
|
-
"character varying": "varchar",
|
|
14257
|
-
"time with time zone": "timetz",
|
|
14258
|
-
"time without time zone": "time",
|
|
14259
|
-
"timestamp with time zone": "timestamptz",
|
|
14260
|
-
"timestamp without time zone": "timestamp",
|
|
14261
|
-
boolean: "bool",
|
|
14262
|
-
"bit varying": "varbit"
|
|
14263
|
-
};
|
|
14264
|
-
function resolvePgTypeAlias(type) {
|
|
14265
|
-
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
15013
|
+
function smallint(name2) {
|
|
15014
|
+
return new PgSmallIntBuilder(name2 ?? "");
|
|
14266
15015
|
}
|
|
14267
|
-
|
|
14268
|
-
var
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14277
|
-
indexed = sql`${indexed}[${alias}]`;
|
|
14278
|
-
let expression = sql`array(\
|
|
14279
|
-
select ${cast(indexed)} \
|
|
14280
|
-
from generate_subscripts(${name2}, ${sql.raw(arrayDimensions.toString())}) ${aliases[arrayDimensions - 1]} \
|
|
14281
|
-
order by ${aliases[arrayDimensions - 1]})`;
|
|
14282
|
-
for (let dim = arrayDimensions - 1;dim > 0; dim--)
|
|
14283
|
-
expression = sql`array(\
|
|
14284
|
-
select ${expression} \
|
|
14285
|
-
from generate_subscripts(${name2}, ${sql.raw(dim.toString())}) ${aliases[dim - 1]} \
|
|
14286
|
-
order by ${aliases[dim - 1]})`;
|
|
14287
|
-
return sql`case when ${name2} is null then null else ${expression} end`;
|
|
14288
|
-
};
|
|
14289
|
-
var arrayCompatNormalize = (normalize) => {
|
|
14290
|
-
const loop = (value, arrayDimensions) => {
|
|
14291
|
-
const innerDimensions = arrayDimensions - 1;
|
|
14292
|
-
if (arrayDimensions > 1)
|
|
14293
|
-
for (let i = 0;i < value.length; ++i)
|
|
14294
|
-
loop(value[i], innerDimensions);
|
|
14295
|
-
else
|
|
14296
|
-
for (let i = 0;i < value.length; ++i)
|
|
14297
|
-
value[i] = normalize(value[i]);
|
|
14298
|
-
return value;
|
|
14299
|
-
};
|
|
14300
|
-
return loop;
|
|
15016
|
+
// node_modules/drizzle-orm/pg-core/columns/text.js
|
|
15017
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
15018
|
+
static [entityKind] = "PgTextBuilder";
|
|
15019
|
+
constructor(name2, config) {
|
|
15020
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
15021
|
+
this.config.enumValues = config.enum;
|
|
15022
|
+
}
|
|
15023
|
+
build(table) {
|
|
15024
|
+
return new PgText(table, this.config, this.config.enumValues);
|
|
15025
|
+
}
|
|
14301
15026
|
};
|
|
14302
|
-
var
|
|
14303
|
-
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
};
|
|
14314
|
-
return transformToPgArray ? (v, d) => makePgArray(loop(v, d)) : loop;
|
|
15027
|
+
var PgText = class extends PgColumn {
|
|
15028
|
+
static [entityKind] = "PgText";
|
|
15029
|
+
enumValues;
|
|
15030
|
+
codec = "text";
|
|
15031
|
+
constructor(table, config, enumValues) {
|
|
15032
|
+
super(table, config);
|
|
15033
|
+
this.enumValues = enumValues;
|
|
15034
|
+
}
|
|
15035
|
+
getSQLType() {
|
|
15036
|
+
return "text";
|
|
15037
|
+
}
|
|
14315
15038
|
};
|
|
14316
|
-
|
|
14317
|
-
const
|
|
14318
|
-
return
|
|
15039
|
+
function text(a, b = {}) {
|
|
15040
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
15041
|
+
return new PgTextBuilder(name2, config);
|
|
15042
|
+
}
|
|
15043
|
+
// node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
15044
|
+
var PgDateColumnBuilder = class extends PgColumnBuilder {
|
|
15045
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
15046
|
+
defaultNow() {
|
|
15047
|
+
return this.default(sql`now()`);
|
|
15048
|
+
}
|
|
14319
15049
|
};
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
15050
|
+
|
|
15051
|
+
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
15052
|
+
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
15053
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
15054
|
+
constructor(name2, withTimezone, precision) {
|
|
15055
|
+
super(name2, "object date", "PgTimestamp");
|
|
15056
|
+
this.config.withTimezone = withTimezone;
|
|
15057
|
+
this.config.precision = precision;
|
|
15058
|
+
}
|
|
15059
|
+
build(table) {
|
|
15060
|
+
return new PgTimestamp(table, this.config);
|
|
15061
|
+
}
|
|
14327
15062
|
};
|
|
14328
|
-
var
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
15063
|
+
var PgTimestamp = class extends PgColumn {
|
|
15064
|
+
static [entityKind] = "PgTimestamp";
|
|
15065
|
+
codec;
|
|
15066
|
+
withTimezone;
|
|
15067
|
+
precision;
|
|
15068
|
+
constructor(table, config) {
|
|
15069
|
+
super(table, config);
|
|
15070
|
+
this.withTimezone = config.withTimezone;
|
|
15071
|
+
this.precision = config.precision;
|
|
15072
|
+
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
15073
|
+
}
|
|
15074
|
+
getSQLType() {
|
|
15075
|
+
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
15076
|
+
}
|
|
15077
|
+
mapToDriverValue = (value) => {
|
|
15078
|
+
if (typeof value === "string")
|
|
15079
|
+
return value;
|
|
15080
|
+
return value.toISOString();
|
|
14334
15081
|
};
|
|
14335
15082
|
};
|
|
14336
|
-
var
|
|
14337
|
-
|
|
14338
|
-
|
|
15083
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
15084
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
15085
|
+
constructor(name2, withTimezone, precision) {
|
|
15086
|
+
super(name2, "string timestamp", "PgTimestampString");
|
|
15087
|
+
this.config.withTimezone = withTimezone;
|
|
15088
|
+
this.config.precision = precision;
|
|
15089
|
+
}
|
|
15090
|
+
build(table) {
|
|
15091
|
+
return new PgTimestampString(table, this.config);
|
|
15092
|
+
}
|
|
14339
15093
|
};
|
|
14340
|
-
var
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
15094
|
+
var PgTimestampString = class extends PgColumn {
|
|
15095
|
+
static [entityKind] = "PgTimestampString";
|
|
15096
|
+
codec;
|
|
15097
|
+
withTimezone;
|
|
15098
|
+
precision;
|
|
15099
|
+
constructor(table, config) {
|
|
15100
|
+
super(table, config);
|
|
15101
|
+
this.withTimezone = config.withTimezone;
|
|
15102
|
+
this.precision = config.precision;
|
|
15103
|
+
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
15104
|
+
}
|
|
15105
|
+
getSQLType() {
|
|
15106
|
+
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
15107
|
+
}
|
|
15108
|
+
mapToDriverValue = (value) => {
|
|
15109
|
+
if (typeof value === "string")
|
|
15110
|
+
return value;
|
|
15111
|
+
return value.toISOString();
|
|
14345
15112
|
};
|
|
14346
15113
|
};
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
15114
|
+
function timestamp(a, b = {}) {
|
|
15115
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
15116
|
+
if (config?.mode === "string")
|
|
15117
|
+
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
15118
|
+
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
15119
|
+
}
|
|
15120
|
+
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
15121
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
15122
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
15123
|
+
constructor(name2, config) {
|
|
15124
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
15125
|
+
this.config.length = config.length;
|
|
15126
|
+
this.config.enumValues = config.enum;
|
|
15127
|
+
}
|
|
15128
|
+
build(table) {
|
|
15129
|
+
return new PgVarchar(table, this.config);
|
|
15130
|
+
}
|
|
14354
15131
|
};
|
|
14355
|
-
var
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
15132
|
+
var PgVarchar = class extends PgColumn {
|
|
15133
|
+
static [entityKind] = "PgVarchar";
|
|
15134
|
+
codec = "varchar";
|
|
15135
|
+
enumValues;
|
|
15136
|
+
constructor(table, config) {
|
|
15137
|
+
super(table, config);
|
|
15138
|
+
this.enumValues = config.enumValues;
|
|
15139
|
+
}
|
|
15140
|
+
getSQLType() {
|
|
15141
|
+
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
15142
|
+
}
|
|
14362
15143
|
};
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
castInJson: castToText,
|
|
14378
|
-
castArrayInJson: castToTextArr,
|
|
14379
|
-
normalize: Number,
|
|
14380
|
-
normalizeArray: arrayCompatNormalize(Number),
|
|
14381
|
-
normalizeInJson: Number,
|
|
14382
|
-
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14383
|
-
},
|
|
14384
|
-
"bigint:string": {
|
|
14385
|
-
castInJson: castToText,
|
|
14386
|
-
castArrayInJson: castToTextArr
|
|
14387
|
-
},
|
|
14388
|
-
bigserial: {
|
|
14389
|
-
castInJson: castToText,
|
|
14390
|
-
castArrayInJson: castToTextArr,
|
|
14391
|
-
normalizeInJson: BigInt,
|
|
14392
|
-
normalizeArrayInJson: arrayCompatNormalize(BigInt),
|
|
14393
|
-
normalize: BigInt,
|
|
14394
|
-
normalizeArray: arrayCompatNormalize(BigInt)
|
|
14395
|
-
},
|
|
14396
|
-
"bigserial:number": {
|
|
14397
|
-
castInJson: castToText,
|
|
14398
|
-
castArrayInJson: castToTextArr,
|
|
14399
|
-
normalize: Number,
|
|
14400
|
-
normalizeArray: arrayCompatNormalize(Number),
|
|
14401
|
-
normalizeInJson: Number,
|
|
14402
|
-
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14403
|
-
},
|
|
14404
|
-
date: {
|
|
14405
|
-
normalizeInJson: textToDate,
|
|
14406
|
-
normalizeArrayInJson: arrayCompatNormalize(textToDate)
|
|
14407
|
-
},
|
|
14408
|
-
"date:string": {},
|
|
14409
|
-
enum: {
|
|
14410
|
-
castArray: castToTextArr,
|
|
14411
|
-
normalizeParamArray: makePgArray
|
|
14412
|
-
},
|
|
14413
|
-
"geometry(point)": {
|
|
14414
|
-
castInJson: castToText,
|
|
14415
|
-
castArrayInJson: castToTextArr,
|
|
14416
|
-
normalize: parseGeometryXY,
|
|
14417
|
-
normalizeArray: arrayCompatNormalize(parseGeometryXY),
|
|
14418
|
-
normalizeInJson: parseGeometryXY,
|
|
14419
|
-
normalizeArrayInJson: arrayCompatNormalize(parseGeometryXY)
|
|
14420
|
-
},
|
|
14421
|
-
"geometry(point):tuple": {
|
|
14422
|
-
castInJson: castToText,
|
|
14423
|
-
castArrayInJson: castToTextArr,
|
|
14424
|
-
normalize: parseGeometryTuple,
|
|
14425
|
-
normalizeArray: arrayCompatNormalize(parseGeometryTuple),
|
|
14426
|
-
normalizeInJson: parseGeometryTuple,
|
|
14427
|
-
normalizeArrayInJson: arrayCompatNormalize(parseGeometryTuple)
|
|
14428
|
-
},
|
|
14429
|
-
interval: { castArrayInJson: castToTextArr },
|
|
14430
|
-
json: { normalizeParamArray: arrayCompatNormalizeInput((v) => JSON.stringify(v), true) },
|
|
14431
|
-
jsonb: { normalizeParamArray: arrayCompatNormalizeInput((v) => JSON.stringify(v), true) },
|
|
14432
|
-
line: {
|
|
14433
|
-
castInJson: castToText,
|
|
14434
|
-
castArrayInJson: castToTextArr,
|
|
14435
|
-
normalize: parseLineABC,
|
|
14436
|
-
normalizeArray: arrayCompatNormalize(parseLineABC),
|
|
14437
|
-
normalizeInJson: parseLineABC,
|
|
14438
|
-
normalizeArrayInJson: arrayCompatNormalize(parseLineABC)
|
|
14439
|
-
},
|
|
14440
|
-
"line:tuple": {
|
|
14441
|
-
castInJson: castToText,
|
|
14442
|
-
castArrayInJson: castToTextArr,
|
|
14443
|
-
normalize: parseLineTuple,
|
|
14444
|
-
normalizeArray: arrayCompatNormalize(parseLineTuple),
|
|
14445
|
-
normalizeInJson: parseLineTuple,
|
|
14446
|
-
normalizeArrayInJson: arrayCompatNormalize(parseLineTuple)
|
|
14447
|
-
},
|
|
14448
|
-
numeric: {
|
|
14449
|
-
castInJson: castToText,
|
|
14450
|
-
castArrayInJson: castToTextArr,
|
|
14451
|
-
castArray: castToTextArr
|
|
14452
|
-
},
|
|
14453
|
-
"numeric:number": {
|
|
14454
|
-
castInJson: castToText,
|
|
14455
|
-
castArrayInJson: castToTextArr,
|
|
14456
|
-
castArray: castToTextArr,
|
|
14457
|
-
normalize: Number,
|
|
14458
|
-
normalizeArray: arrayCompatNormalize(Number),
|
|
14459
|
-
normalizeInJson: Number,
|
|
14460
|
-
normalizeArrayInJson: arrayCompatNormalize(Number)
|
|
14461
|
-
},
|
|
14462
|
-
"numeric:bigint": {
|
|
14463
|
-
castInJson: castToText,
|
|
14464
|
-
castArrayInJson: castToTextArr,
|
|
14465
|
-
castArray: castToTextArr,
|
|
14466
|
-
normalize: BigInt,
|
|
14467
|
-
normalizeArray: arrayCompatNormalize(BigInt),
|
|
14468
|
-
normalizeInJson: BigInt,
|
|
14469
|
-
normalizeArrayInJson: arrayCompatNormalize(BigInt)
|
|
14470
|
-
},
|
|
14471
|
-
point: {
|
|
14472
|
-
castInJson: castToText,
|
|
14473
|
-
castArrayInJson: castToTextArr,
|
|
14474
|
-
normalize: parsePointXY,
|
|
14475
|
-
normalizeArray: arrayCompatNormalize(parsePointXY),
|
|
14476
|
-
normalizeInJson: parsePointXY,
|
|
14477
|
-
normalizeArrayInJson: arrayCompatNormalize(parsePointXY)
|
|
14478
|
-
},
|
|
14479
|
-
"point:tuple": {
|
|
14480
|
-
castInJson: castToText,
|
|
14481
|
-
castArrayInJson: castToTextArr,
|
|
14482
|
-
normalize: parsePointTuple,
|
|
14483
|
-
normalizeArray: arrayCompatNormalize(parsePointTuple),
|
|
14484
|
-
normalizeInJson: parsePointTuple,
|
|
14485
|
-
normalizeArrayInJson: arrayCompatNormalize(parsePointTuple)
|
|
14486
|
-
},
|
|
14487
|
-
timestamp: {
|
|
14488
|
-
castInJson: castToText,
|
|
14489
|
-
castArrayInJson: castToTextArr,
|
|
14490
|
-
normalizeInJson: textToDateWithTz,
|
|
14491
|
-
normalizeArrayInJson: arrayCompatNormalize(textToDateWithTz)
|
|
14492
|
-
},
|
|
14493
|
-
timestamptz: {
|
|
14494
|
-
castInJson: castToText,
|
|
14495
|
-
castArrayInJson: castToTextArr,
|
|
14496
|
-
normalizeInJson: textToDate,
|
|
14497
|
-
normalizeArrayInJson: arrayCompatNormalize(textToDate)
|
|
14498
|
-
},
|
|
14499
|
-
"timestamp:string": {
|
|
14500
|
-
castInJson: castToText,
|
|
14501
|
-
castArrayInJson: castToTextArr
|
|
14502
|
-
},
|
|
14503
|
-
"timestamptz:string": {
|
|
14504
|
-
castInJson: castToText,
|
|
14505
|
-
castArrayInJson: castToTextArr
|
|
14506
|
-
},
|
|
14507
|
-
halfvec: {
|
|
14508
|
-
normalize: parsePgVector,
|
|
14509
|
-
normalizeArray: parsePgArrayAndNormalize(parsePgVector),
|
|
14510
|
-
normalizeInJson: parsePgVector,
|
|
14511
|
-
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
14512
|
-
},
|
|
14513
|
-
vector: {
|
|
14514
|
-
normalize: parsePgVector,
|
|
14515
|
-
normalizeArray: parsePgArrayAndNormalize(parsePgVector),
|
|
14516
|
-
normalizeInJson: parsePgVector,
|
|
14517
|
-
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
15144
|
+
function varchar(a, b = {}) {
|
|
15145
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
15146
|
+
return new PgVarcharBuilder(name2, config);
|
|
15147
|
+
}
|
|
15148
|
+
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
15149
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
15150
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
15151
|
+
constructor(name2) {
|
|
15152
|
+
super(name2, "number int53", "PgBigSerial53");
|
|
15153
|
+
this.config.hasDefault = true;
|
|
15154
|
+
this.config.notNull = true;
|
|
15155
|
+
}
|
|
15156
|
+
build(table) {
|
|
15157
|
+
return new PgBigSerial53(table, this.config);
|
|
14518
15158
|
}
|
|
14519
15159
|
};
|
|
14520
|
-
var
|
|
15160
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
15161
|
+
static [entityKind] = "PgBigSerial53";
|
|
15162
|
+
codec = "bigserial:number";
|
|
15163
|
+
getSQLType() {
|
|
15164
|
+
return "bigserial";
|
|
15165
|
+
}
|
|
15166
|
+
};
|
|
15167
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
15168
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
15169
|
+
constructor(name2) {
|
|
15170
|
+
super(name2, "bigint int64", "PgBigSerial64");
|
|
15171
|
+
this.config.hasDefault = true;
|
|
15172
|
+
this.config.notNull = true;
|
|
15173
|
+
}
|
|
15174
|
+
build(table) {
|
|
15175
|
+
return new PgBigSerial64(table, this.config);
|
|
15176
|
+
}
|
|
15177
|
+
};
|
|
15178
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
15179
|
+
static [entityKind] = "PgBigSerial64";
|
|
15180
|
+
codec = "bigserial";
|
|
15181
|
+
getSQLType() {
|
|
15182
|
+
return "bigserial";
|
|
15183
|
+
}
|
|
15184
|
+
};
|
|
15185
|
+
function bigserial(a, b) {
|
|
15186
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
15187
|
+
if (config.mode === "number")
|
|
15188
|
+
return new PgBigSerial53Builder(name2);
|
|
15189
|
+
return new PgBigSerial64Builder(name2);
|
|
15190
|
+
}
|
|
14521
15191
|
|
|
14522
|
-
// node_modules/drizzle-orm/pg-core/columns/
|
|
14523
|
-
var
|
|
14524
|
-
static [entityKind] = "
|
|
14525
|
-
constructor(name2,
|
|
14526
|
-
super(name2, "
|
|
14527
|
-
this.config.
|
|
14528
|
-
this.config.
|
|
15192
|
+
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
15193
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
15194
|
+
static [entityKind] = "PgCharBuilder";
|
|
15195
|
+
constructor(name2, config) {
|
|
15196
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
15197
|
+
this.config.length = config.length ?? 1;
|
|
15198
|
+
this.config.setLength = config.length !== undefined;
|
|
15199
|
+
this.config.enumValues = config.enum;
|
|
14529
15200
|
}
|
|
14530
15201
|
build(table) {
|
|
14531
|
-
return new
|
|
15202
|
+
return new PgChar(table, this.config);
|
|
14532
15203
|
}
|
|
14533
15204
|
};
|
|
14534
|
-
var
|
|
14535
|
-
static [entityKind] = "
|
|
14536
|
-
codec;
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
jsonSelectIdentifier;
|
|
15205
|
+
var PgChar = class extends PgColumn {
|
|
15206
|
+
static [entityKind] = "PgChar";
|
|
15207
|
+
codec = "char";
|
|
15208
|
+
enumValues;
|
|
15209
|
+
setLength;
|
|
14540
15210
|
constructor(table, config) {
|
|
14541
15211
|
super(table, config);
|
|
14542
|
-
this.
|
|
14543
|
-
this.
|
|
14544
|
-
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
14545
|
-
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
14546
|
-
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
14547
|
-
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
14548
|
-
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
14549
|
-
if (this.dimensions && config.customTypeParams.fromJson)
|
|
14550
|
-
this.mapFromJsonValue = (value) => {
|
|
14551
|
-
if (value === null)
|
|
14552
|
-
return value;
|
|
14553
|
-
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
14554
|
-
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
14555
|
-
};
|
|
15212
|
+
this.enumValues = config.enumValues;
|
|
15213
|
+
this.setLength = config.setLength;
|
|
14556
15214
|
}
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
15215
|
+
getSQLType() {
|
|
15216
|
+
return this.setLength ? `char(${this.length})` : `char`;
|
|
15217
|
+
}
|
|
15218
|
+
};
|
|
15219
|
+
function char(a, b = {}) {
|
|
15220
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
15221
|
+
return new PgCharBuilder(name2, config);
|
|
15222
|
+
}
|
|
15223
|
+
|
|
15224
|
+
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
15225
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
15226
|
+
static [entityKind] = "PgCidrBuilder";
|
|
15227
|
+
constructor(name2) {
|
|
15228
|
+
super(name2, "string cidr", "PgCidr");
|
|
15229
|
+
}
|
|
15230
|
+
build(table) {
|
|
15231
|
+
return new PgCidr(table, this.config);
|
|
14561
15232
|
}
|
|
15233
|
+
};
|
|
15234
|
+
var PgCidr = class extends PgColumn {
|
|
15235
|
+
static [entityKind] = "PgCidr";
|
|
15236
|
+
codec = "cidr";
|
|
14562
15237
|
getSQLType() {
|
|
14563
|
-
return
|
|
15238
|
+
return "cidr";
|
|
14564
15239
|
}
|
|
14565
15240
|
};
|
|
14566
|
-
function
|
|
14567
|
-
return (
|
|
14568
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
14569
|
-
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
14570
|
-
};
|
|
15241
|
+
function cidr(name2) {
|
|
15242
|
+
return new PgCidrBuilder(name2 ?? "");
|
|
14571
15243
|
}
|
|
14572
15244
|
|
|
14573
15245
|
// node_modules/drizzle-orm/pg-core/columns/date.js
|
|
@@ -20581,12 +21253,12 @@ async function hashQuery(sql2, params) {
|
|
|
20581
21253
|
var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
20582
21254
|
static [entityKind] = "PgCountBuilder";
|
|
20583
21255
|
dialect;
|
|
20584
|
-
static
|
|
21256
|
+
static buildCount(source, filters, parens) {
|
|
20585
21257
|
const query = sql`select count(*) from ${source}${sql` where ${filters}`.if(filters)}`;
|
|
20586
21258
|
return parens ? sql`(${query})` : query;
|
|
20587
21259
|
}
|
|
20588
21260
|
constructor(countConfig) {
|
|
20589
|
-
super(PgCountBuilder2.
|
|
21261
|
+
super(PgCountBuilder2.buildCount(countConfig.source, countConfig.filters, true).queryChunks);
|
|
20590
21262
|
this.countConfig = countConfig;
|
|
20591
21263
|
this.dialect = countConfig.dialect;
|
|
20592
21264
|
this.mapWith((e) => {
|
|
@@ -20595,10 +21267,13 @@ var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
|
20595
21267
|
return Number(e ?? 0);
|
|
20596
21268
|
});
|
|
20597
21269
|
}
|
|
21270
|
+
executableSql;
|
|
20598
21271
|
build() {
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
21272
|
+
if (!this.executableSql) {
|
|
21273
|
+
const { source, filters } = this.countConfig;
|
|
21274
|
+
this.executableSql = PgCountBuilder2.buildCount(source, filters);
|
|
21275
|
+
}
|
|
21276
|
+
return this.dialect.sqlToQuery(this.executableSql);
|
|
20602
21277
|
}
|
|
20603
21278
|
};
|
|
20604
21279
|
|
|
@@ -20850,7 +21525,6 @@ var SelectionProxyHandler = class SelectionProxyHandler2 {
|
|
|
20850
21525
|
var PgDeleteBase2 = class {
|
|
20851
21526
|
static [entityKind] = "PgDelete";
|
|
20852
21527
|
config;
|
|
20853
|
-
cacheConfig;
|
|
20854
21528
|
constructor(table, session, dialect, withList) {
|
|
20855
21529
|
this.session = session;
|
|
20856
21530
|
this.dialect = dialect;
|
|
@@ -20898,7 +21572,7 @@ var PgDeleteBase2 = class {
|
|
|
20898
21572
|
var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
20899
21573
|
static [entityKind] = "PgAsyncDelete";
|
|
20900
21574
|
_prepare(name2, generateName = false) {
|
|
20901
|
-
const { session, config, dialect
|
|
21575
|
+
const { session, config, dialect } = this;
|
|
20902
21576
|
const { returning: fields } = config;
|
|
20903
21577
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
20904
21578
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -20906,7 +21580,7 @@ var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
|
20906
21580
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
20907
21581
|
type: "delete",
|
|
20908
21582
|
tables: [...extractUsedTable(this.config.table)]
|
|
20909
|
-
}
|
|
21583
|
+
});
|
|
20910
21584
|
});
|
|
20911
21585
|
}
|
|
20912
21586
|
prepare(name2) {
|
|
@@ -20953,7 +21627,6 @@ var PgSelectBuilder2 = class {
|
|
|
20953
21627
|
if (config.withList)
|
|
20954
21628
|
this.withList = config.withList;
|
|
20955
21629
|
this.distinct = config.distinct;
|
|
20956
|
-
this.tagged = config.tagged;
|
|
20957
21630
|
}
|
|
20958
21631
|
from(source) {
|
|
20959
21632
|
const isPartialSelect = !!this.fields;
|
|
@@ -20976,8 +21649,7 @@ var PgSelectBuilder2 = class {
|
|
|
20976
21649
|
session: this.session,
|
|
20977
21650
|
dialect: this.dialect,
|
|
20978
21651
|
withList: this.withList,
|
|
20979
|
-
distinct: this.distinct
|
|
20980
|
-
tagged: this.tagged
|
|
21652
|
+
distinct: this.distinct
|
|
20981
21653
|
});
|
|
20982
21654
|
}
|
|
20983
21655
|
};
|
|
@@ -21001,8 +21673,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
21001
21673
|
table: config.table,
|
|
21002
21674
|
fields: { ...config.fields },
|
|
21003
21675
|
distinct: config.distinct,
|
|
21004
|
-
setOperators: []
|
|
21005
|
-
_tagged: config.tagged
|
|
21676
|
+
setOperators: []
|
|
21006
21677
|
};
|
|
21007
21678
|
this.isPartialSelect = config.isPartialSelect;
|
|
21008
21679
|
this._ = {
|
|
@@ -21179,6 +21850,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
21179
21850
|
return this;
|
|
21180
21851
|
}
|
|
21181
21852
|
getSQL() {
|
|
21853
|
+
this.config.fieldsFlat = orderSelectedFields2(this.config.fields, undefined, this.dialect.codecs);
|
|
21182
21854
|
return this.dialect.buildSelectQuery(this.config);
|
|
21183
21855
|
}
|
|
21184
21856
|
toSQL() {
|
|
@@ -21274,7 +21946,6 @@ params: ${params}`);
|
|
|
21274
21946
|
this.cause = cause;
|
|
21275
21947
|
}
|
|
21276
21948
|
};
|
|
21277
|
-
|
|
21278
21949
|
// node_modules/drizzle-orm/relations.js
|
|
21279
21950
|
var Relation2 = class {
|
|
21280
21951
|
static [entityKind] = "RelationV2";
|
|
@@ -21355,15 +22026,13 @@ var orderByOperators2 = {
|
|
|
21355
22026
|
asc,
|
|
21356
22027
|
desc
|
|
21357
22028
|
};
|
|
21358
|
-
function mapRelationalRow2(rows, isOne, buildQueryResultSelection,
|
|
22029
|
+
function mapRelationalRow2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false, useJsonMappers = true) {
|
|
21359
22030
|
const maxIdx = isOne ? 1 : rows.length;
|
|
21360
22031
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
21361
22032
|
let decoder;
|
|
21362
|
-
if (is(field, Column))
|
|
21363
|
-
if (useJsonMappers && field.mapFromJsonValue)
|
|
21364
|
-
return (v2) => field.mapFromJsonValue(v2);
|
|
22033
|
+
if (is(field, Column))
|
|
21365
22034
|
decoder = field;
|
|
21366
|
-
|
|
22035
|
+
else if (is(field, SQL))
|
|
21367
22036
|
decoder = field.decoder;
|
|
21368
22037
|
else if (is(field, SQL.Aliased))
|
|
21369
22038
|
decoder = field.sql.decoder;
|
|
@@ -21371,6 +22040,8 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
21371
22040
|
decoder = noopDecoder;
|
|
21372
22041
|
else
|
|
21373
22042
|
decoder = field.getSQL().decoder;
|
|
22043
|
+
if (useJsonMappers && field.mapFromJsonValue)
|
|
22044
|
+
return (v2) => field.mapFromJsonValue(v2);
|
|
21374
22045
|
return decoder.mapFromDriverValue.isNoop ? codec ? (value) => codec(value, arrayDimensions) : undefined : codec ? (value) => decoder.mapFromDriverValue(codec(value, arrayDimensions)) : (value) => decoder.mapFromDriverValue(value);
|
|
21375
22046
|
});
|
|
21376
22047
|
for (let i = 0;i < maxIdx; ++i) {
|
|
@@ -21387,14 +22058,12 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
21387
22058
|
} else if (parseJsonIfString && typeof row[selectionItem.key] === "string")
|
|
21388
22059
|
row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
21389
22060
|
if (selectionItem.isArray) {
|
|
21390
|
-
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection,
|
|
22061
|
+
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection, false, parseJsonIfString);
|
|
21391
22062
|
continue;
|
|
21392
22063
|
}
|
|
21393
|
-
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection,
|
|
22064
|
+
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection, false, parseJsonIfString);
|
|
21394
22065
|
continue;
|
|
21395
22066
|
}
|
|
21396
|
-
if (mapColumnValue)
|
|
21397
|
-
row[selectionItem.key] = mapColumnValue(row[selectionItem.key]);
|
|
21398
22067
|
if (row[selectionItem.key] === null)
|
|
21399
22068
|
continue;
|
|
21400
22069
|
const decoder = decoders[selectionItemIdx];
|
|
@@ -21405,7 +22074,7 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
21405
22074
|
}
|
|
21406
22075
|
return rows;
|
|
21407
22076
|
}
|
|
21408
|
-
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection,
|
|
22077
|
+
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false) {
|
|
21409
22078
|
const maxIdx = isOne ? 1 : rows.length;
|
|
21410
22079
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
21411
22080
|
let decoder;
|
|
@@ -21442,14 +22111,12 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
21442
22111
|
} else if (parseJsonIfString && typeof value === "string")
|
|
21443
22112
|
value = JSON.parse(value);
|
|
21444
22113
|
if (selectionItem.isArray)
|
|
21445
|
-
mapRelationalRow2(value, false, selectionItem.selection,
|
|
22114
|
+
mapRelationalRow2(value, false, selectionItem.selection, false, parseJsonIfString);
|
|
21446
22115
|
else
|
|
21447
|
-
mapRelationalRow2(value, true, selectionItem.selection,
|
|
22116
|
+
mapRelationalRow2(value, true, selectionItem.selection, false, parseJsonIfString);
|
|
21448
22117
|
result[selectionItem.key] = value;
|
|
21449
22118
|
continue;
|
|
21450
22119
|
}
|
|
21451
|
-
if (mapColumnValue)
|
|
21452
|
-
value = mapColumnValue(value);
|
|
21453
22120
|
if (value === null) {
|
|
21454
22121
|
result[selectionItem.key] = null;
|
|
21455
22122
|
continue;
|
|
@@ -21461,14 +22128,14 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
21461
22128
|
}
|
|
21462
22129
|
return isOne ? results[0] : results;
|
|
21463
22130
|
}
|
|
21464
|
-
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
22131
|
+
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
21465
22132
|
return (rows) => {
|
|
21466
22133
|
if (isFirst && !rows[0])
|
|
21467
22134
|
return rows[0];
|
|
21468
|
-
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection,
|
|
22135
|
+
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString) : mapRelationalRow2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString, rootJsonMappers);
|
|
21469
22136
|
};
|
|
21470
22137
|
}
|
|
21471
|
-
function makeJitRqbMapperInner(selection, rowExpr, selectionVar,
|
|
22138
|
+
function makeJitRqbMapperInner(selection, rowExpr, selectionVar, parseJson, parseJsonIfString, useJsonMappers, preFn, counter, accessByIdx) {
|
|
21472
22139
|
const bodyStmts = [];
|
|
21473
22140
|
const literalEntries = [];
|
|
21474
22141
|
let hasWork = false;
|
|
@@ -21492,7 +22159,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
21492
22159
|
preFn.push(`const { selection: ${nestedSelVar} } = ${sel};`);
|
|
21493
22160
|
if (isArray) {
|
|
21494
22161
|
const j = `j${counter.n++}`;
|
|
21495
|
-
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar,
|
|
22162
|
+
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
21496
22163
|
if (inner.hasWork) {
|
|
21497
22164
|
hasWork = true;
|
|
21498
22165
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -21505,7 +22172,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
21505
22172
|
} else
|
|
21506
22173
|
preFn.splice(savedPreFnLen, 1);
|
|
21507
22174
|
} else {
|
|
21508
|
-
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar,
|
|
22175
|
+
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
21509
22176
|
if (inner.hasWork) {
|
|
21510
22177
|
hasWork = true;
|
|
21511
22178
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -21534,21 +22201,39 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
21534
22201
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
21535
22202
|
}
|
|
21536
22203
|
} else if (is(field, SQL)) {
|
|
21537
|
-
if (
|
|
22204
|
+
if (useJsonMappers && field.decoder.mapFromJsonValue) {
|
|
22205
|
+
bypassCodecs = true;
|
|
22206
|
+
const id = counter.n++;
|
|
22207
|
+
destructure = `field: { decoder: dec${id} }`;
|
|
22208
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
22209
|
+
} else if (!field.decoder.mapFromDriverValue.isNoop) {
|
|
21538
22210
|
const id = counter.n++;
|
|
21539
22211
|
destructure = `field: { decoder: dec${id} }`;
|
|
21540
22212
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
21541
22213
|
}
|
|
21542
22214
|
} else if (is(field, SQL.Aliased)) {
|
|
21543
|
-
if (
|
|
22215
|
+
if (useJsonMappers && field.sql.decoder.mapFromJsonValue) {
|
|
22216
|
+
bypassCodecs = true;
|
|
22217
|
+
const id = counter.n++;
|
|
22218
|
+
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
22219
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
22220
|
+
} else if (!field.sql.decoder.mapFromDriverValue.isNoop) {
|
|
21544
22221
|
const id = counter.n++;
|
|
21545
22222
|
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
21546
22223
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
21547
22224
|
}
|
|
21548
|
-
} else if (is(field, Table) || is(field, View)) {} else
|
|
21549
|
-
const
|
|
21550
|
-
|
|
21551
|
-
|
|
22225
|
+
} else if (is(field, Table) || is(field, View)) {} else {
|
|
22226
|
+
const sqlExpr = field.getSQL();
|
|
22227
|
+
if (useJsonMappers && sqlExpr.decoder.mapFromJsonValue) {
|
|
22228
|
+
bypassCodecs = true;
|
|
22229
|
+
const id = counter.n++;
|
|
22230
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
22231
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
22232
|
+
} else if (!sqlExpr.decoder.mapFromDriverValue.isNoop) {
|
|
22233
|
+
const id = counter.n++;
|
|
22234
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
22235
|
+
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
22236
|
+
}
|
|
21552
22237
|
}
|
|
21553
22238
|
let codecVar = "";
|
|
21554
22239
|
if (!bypassCodecs && codec)
|
|
@@ -21561,19 +22246,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
21561
22246
|
parts.push(`codec: ${codecVar}`);
|
|
21562
22247
|
preFn.push(`const { ${parts.join(", ")} } = ${sel};`);
|
|
21563
22248
|
}
|
|
21564
|
-
if (
|
|
21565
|
-
hasWork = true;
|
|
21566
|
-
bodyStmts.push(`${slot} = mapColumnValue(${slot});`);
|
|
21567
|
-
if (decoderExpr || codecVar) {
|
|
21568
|
-
let decoded = slot;
|
|
21569
|
-
if (codecVar)
|
|
21570
|
-
decoded = `${codecVar}(${decoded}, ${arrayDimensions})`;
|
|
21571
|
-
if (decoderExpr)
|
|
21572
|
-
decoded = `${decoderExpr}(${decoded})`;
|
|
21573
|
-
bodyStmts.push(`if (${slot} !== null) ${slot} = ${decoded};`);
|
|
21574
|
-
}
|
|
21575
|
-
literalEntries.push(`${keyStr}: ${slot}`);
|
|
21576
|
-
} else if (decoderExpr || codecVar) {
|
|
22249
|
+
if (decoderExpr || codecVar) {
|
|
21577
22250
|
hasWork = true;
|
|
21578
22251
|
let decoded = slot;
|
|
21579
22252
|
if (codecVar)
|
|
@@ -21590,12 +22263,12 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
21590
22263
|
hasWork
|
|
21591
22264
|
};
|
|
21592
22265
|
}
|
|
21593
|
-
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
22266
|
+
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
21594
22267
|
const preFn = [];
|
|
21595
|
-
const inner = makeJitRqbMapperInner(selection, "row", "selection",
|
|
22268
|
+
const inner = makeJitRqbMapperInner(selection, "row", "selection", parseJson, parseJsonIfString, arrayModeRoot ? false : rootJsonMappers, preFn, { n: 0 }, !!arrayModeRoot);
|
|
21596
22269
|
const lines = [];
|
|
21597
22270
|
lines.push(` "use strict";
|
|
21598
|
-
const { selection
|
|
22271
|
+
const { selection } = this;`);
|
|
21599
22272
|
for (const p2 of preFn)
|
|
21600
22273
|
lines.push(` ${p2}`);
|
|
21601
22274
|
if (arrayModeRoot)
|
|
@@ -21637,10 +22310,7 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
|
|
|
21637
22310
|
lines.push("\t//# sourceURL=drizzle:jit-relational-query-mapper");
|
|
21638
22311
|
const compiled = lines.join(`
|
|
21639
22312
|
`);
|
|
21640
|
-
return Object.assign(new FnConstructor2("rows", compiled).bind({
|
|
21641
|
-
selection,
|
|
21642
|
-
mapColumnValue
|
|
21643
|
-
}), { body: `function jitRqbMapper (rows) {
|
|
22313
|
+
return Object.assign(new FnConstructor2("rows", compiled).bind({ selection }), { body: `function jitRqbMapper (rows) {
|
|
21644
22314
|
${compiled}
|
|
21645
22315
|
}` });
|
|
21646
22316
|
}
|
|
@@ -21763,17 +22433,23 @@ function relationsOrderToSQL2(table, orders) {
|
|
|
21763
22433
|
return;
|
|
21764
22434
|
return sql.join(entries.map(([target, value]) => (value === "asc" ? asc : desc)(fieldSelectionToSQL2(table, target))), sql`, `);
|
|
21765
22435
|
}
|
|
21766
|
-
function relationExtrasToSQL2(table, extras) {
|
|
22436
|
+
function relationExtrasToSQL2(table, extras, codecs, inJson) {
|
|
21767
22437
|
const subqueries = [];
|
|
21768
22438
|
const selection = [];
|
|
21769
22439
|
for (const [key, field] of Object.entries(extras)) {
|
|
21770
22440
|
if (!field)
|
|
21771
22441
|
continue;
|
|
21772
|
-
const
|
|
21773
|
-
const
|
|
21774
|
-
query
|
|
22442
|
+
const subq = (typeof field === "function" ? field(table, { sql: operators2.sql }) : field).getSQL();
|
|
22443
|
+
const column = codecs ? getColumnFromDecoder2(subq) : undefined;
|
|
22444
|
+
const query = column && (!inJson || !column.jsonSelectIdentifier) ? sql`${codecs.apply(column, inJson ? "castInJson" : "cast", sql`(${subq})`)} as ${sql.identifier(key)}` : sql`(${subq}) as ${sql.identifier(key)}`;
|
|
22445
|
+
query.decoder = subq.decoder;
|
|
21775
22446
|
subqueries.push(query);
|
|
21776
|
-
selection.push({
|
|
22447
|
+
selection.push(column && (!inJson || !column.mapFromJsonValue) ? {
|
|
22448
|
+
key,
|
|
22449
|
+
field: query,
|
|
22450
|
+
codec: codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
22451
|
+
arrayDimensions: column.dimensions
|
|
22452
|
+
} : {
|
|
21777
22453
|
key,
|
|
21778
22454
|
field: query
|
|
21779
22455
|
});
|
|
@@ -21882,43 +22558,58 @@ var PgDialect2 = class {
|
|
|
21882
22558
|
}
|
|
21883
22559
|
buildSelection(fields, { isSingleTable = false, ignoreCastCodecs = false } = {}) {
|
|
21884
22560
|
const columnsLen = fields.length;
|
|
21885
|
-
const chunks = fields.flatMap(({ field }, i) => {
|
|
22561
|
+
const chunks = fields.flatMap(({ field, codecOverride, column }, i) => {
|
|
21886
22562
|
const chunk = [];
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
22563
|
+
const override = codecOverride;
|
|
22564
|
+
if (is(field, SQL.Aliased))
|
|
22565
|
+
if (field.isSelectionField) {
|
|
22566
|
+
const query = !isSingleTable && field.origin !== undefined ? sql`${sql.identifier(field.origin)}.${sql.identifier(field.fieldAlias)}` : sql.identifier(field.fieldAlias);
|
|
22567
|
+
if (column && !ignoreCastCodecs)
|
|
22568
|
+
chunk.push(this.codecs.apply(column, "cast", query, override));
|
|
22569
|
+
else
|
|
22570
|
+
chunk.push(query);
|
|
22571
|
+
} else {
|
|
22572
|
+
const query = field.sql;
|
|
22573
|
+
if (isSingleTable) {
|
|
22574
|
+
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
22575
|
+
if (is(c, PgColumn))
|
|
22576
|
+
return sql.identifier(c.name);
|
|
22577
|
+
return c;
|
|
22578
|
+
}));
|
|
22579
|
+
if (query.shouldInlineParams)
|
|
22580
|
+
newSql.inlineParams();
|
|
22581
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
22582
|
+
} else
|
|
22583
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
22584
|
+
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
22585
|
+
}
|
|
22586
|
+
else if (is(field, SQL)) {
|
|
22587
|
+
const query = field;
|
|
21893
22588
|
if (isSingleTable) {
|
|
21894
22589
|
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
21895
22590
|
if (is(c, PgColumn))
|
|
21896
22591
|
return sql.identifier(c.name);
|
|
21897
22592
|
return c;
|
|
21898
22593
|
}));
|
|
21899
|
-
|
|
22594
|
+
if (query.shouldInlineParams)
|
|
22595
|
+
newSql.inlineParams();
|
|
22596
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
21900
22597
|
} else
|
|
21901
|
-
chunk.push(query);
|
|
21902
|
-
if (is(field, SQL.Aliased))
|
|
21903
|
-
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
22598
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
21904
22599
|
} else if (is(field, Column)) {
|
|
21905
22600
|
let name2;
|
|
21906
22601
|
if (isSingleTable)
|
|
21907
22602
|
name2 = field.isAlias ? sql.identifier(getOriginalColumnFromAlias2(field).name) : sql.identifier(field.name);
|
|
21908
22603
|
else
|
|
21909
22604
|
name2 = field.isAlias ? getOriginalColumnFromAlias2(field) : field;
|
|
21910
|
-
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2);
|
|
22605
|
+
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2, override);
|
|
21911
22606
|
chunk.push(field.isAlias ? sql`${casted} as ${field}` : casted);
|
|
21912
|
-
} else if (is(field, Subquery))
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
field._.sql.decoder = fieldDecoder;
|
|
21919
|
-
}
|
|
21920
|
-
chunk.push(field);
|
|
21921
|
-
}
|
|
22607
|
+
} else if (is(field, Subquery))
|
|
22608
|
+
if (column && !ignoreCastCodecs && !field._.isWith) {
|
|
22609
|
+
const innerCasted = this.codecs.apply(column, "cast", sql`(${field._.sql})`, override);
|
|
22610
|
+
chunk.push(sql`${innerCasted} ${sql.identifier(field._.alias)}`);
|
|
22611
|
+
} else
|
|
22612
|
+
chunk.push(column ? this.codecs.apply(column, "cast", field) : field, override);
|
|
21922
22613
|
if (i < columnsLen - 1)
|
|
21923
22614
|
chunk.push(sql`, `);
|
|
21924
22615
|
return chunk;
|
|
@@ -21969,8 +22660,10 @@ var PgDialect2 = class {
|
|
|
21969
22660
|
}
|
|
21970
22661
|
return table;
|
|
21971
22662
|
}
|
|
21972
|
-
buildSelectQuery({ withList,
|
|
21973
|
-
|
|
22663
|
+
buildSelectQuery({ withList, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, comment, ignoreSelectionCastCodecs }) {
|
|
22664
|
+
if (!fieldsFlat)
|
|
22665
|
+
throw new Error("Select query builder must be provided with `fieldsFlat` on `buildSelectQuery` invocation");
|
|
22666
|
+
const fieldsList = fieldsFlat;
|
|
21974
22667
|
for (const f of fieldsList)
|
|
21975
22668
|
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table, Subquery) ? table._.alias : is(table, PgViewBase) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : getTableName(table)) && !((table2) => joins?.some(({ alias: alias2 }) => alias2 === (table2[Table.Symbol.IsAlias] ? getTableName(table2) : table2[Table.Symbol.BaseName])))(f.field.table)) {
|
|
21976
22669
|
const tableName = getTableName(f.field.table);
|
|
@@ -21983,7 +22676,7 @@ var PgDialect2 = class {
|
|
|
21983
22676
|
distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
|
|
21984
22677
|
const selection = this.buildSelection(fieldsList, {
|
|
21985
22678
|
isSingleTable,
|
|
21986
|
-
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
22679
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs || setOperators.length > 0
|
|
21987
22680
|
});
|
|
21988
22681
|
const tableSql = this.buildFromTable(table);
|
|
21989
22682
|
const joinsSql = this.buildJoins(joins);
|
|
@@ -22010,26 +22703,67 @@ var PgDialect2 = class {
|
|
|
22010
22703
|
}
|
|
22011
22704
|
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClauseSql}${comment !== undefined ? sql` ${comment}` : undefined}`;
|
|
22012
22705
|
if (setOperators.length > 0)
|
|
22013
|
-
return this.buildSetOperations(finalQuery, setOperators);
|
|
22706
|
+
return this.buildSetOperations(finalQuery, fieldsList, ignoreSelectionCastCodecs, setOperators);
|
|
22014
22707
|
return finalQuery;
|
|
22015
22708
|
}
|
|
22016
|
-
buildSetOperations(leftSelect, setOperators) {
|
|
22017
|
-
const
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
|
|
22021
|
-
|
|
22709
|
+
buildSetOperations(leftSelect, leftSelection, ignoreSelectionCastCodecs, setOperators) {
|
|
22710
|
+
const outputSelection = leftSelection;
|
|
22711
|
+
for (let i = 0;i < setOperators.length; ++i) {
|
|
22712
|
+
const setOperator = setOperators[i];
|
|
22713
|
+
if (!setOperator)
|
|
22714
|
+
throw new Error("Cannot pass undefined values to any set operator");
|
|
22715
|
+
leftSelect = this.buildSetOperationQuery({
|
|
22022
22716
|
leftSelect,
|
|
22023
22717
|
setOperator
|
|
22024
22718
|
});
|
|
22025
|
-
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22719
|
+
const rightSelection = orderSelectedFields2(setOperator.rightSelect.getSelectedFields());
|
|
22720
|
+
for (let j = 0;j < outputSelection.length; ++j) {
|
|
22721
|
+
const l = outputSelection[j];
|
|
22722
|
+
const lPath = l.path.join(".");
|
|
22723
|
+
const r = rightSelection.find((e) => e.path.join(".") === lPath);
|
|
22724
|
+
const lc = l.codecOverride ?? l.column?.codec;
|
|
22725
|
+
const rc = r.codecOverride ?? r.column?.codec;
|
|
22726
|
+
outputSelection[j].codecOverride = lc && rc ? unionsTypeTable[lc]?.[rc] : lc;
|
|
22727
|
+
}
|
|
22728
|
+
}
|
|
22729
|
+
for (let i = 0;i < outputSelection.length; ++i) {
|
|
22730
|
+
const out = outputSelection[i];
|
|
22731
|
+
out.codec = out.codecOverride ? this.codecs.get(out.column, "normalize", out.codecOverride) : out.codec;
|
|
22732
|
+
}
|
|
22733
|
+
return ignoreSelectionCastCodecs ? leftSelect : sql`select ${this.buildSelection(outputSelection.map((field) => {
|
|
22734
|
+
if (is(field.field, SQL.Aliased)) {
|
|
22735
|
+
const ref = field.field.clone();
|
|
22736
|
+
ref.isSelectionField = true;
|
|
22737
|
+
return {
|
|
22738
|
+
...field,
|
|
22739
|
+
field: ref
|
|
22740
|
+
};
|
|
22741
|
+
}
|
|
22742
|
+
if (is(field.field, Column) && field.field.isAlias) {
|
|
22743
|
+
const ref = new SQL.Aliased(sql`${sql.identifier(field.field.name)}`, field.field.name);
|
|
22744
|
+
ref.isSelectionField = true;
|
|
22745
|
+
return {
|
|
22746
|
+
...field,
|
|
22747
|
+
field: ref
|
|
22748
|
+
};
|
|
22749
|
+
}
|
|
22750
|
+
if (is(field.field, Subquery)) {
|
|
22751
|
+
const ref = new SQL.Aliased(sql`${field.field.getSQL()}`, field.field._.alias);
|
|
22752
|
+
ref.isSelectionField = true;
|
|
22753
|
+
return {
|
|
22754
|
+
...field,
|
|
22755
|
+
field: ref
|
|
22756
|
+
};
|
|
22757
|
+
}
|
|
22758
|
+
return field;
|
|
22759
|
+
}), {
|
|
22760
|
+
isSingleTable: true,
|
|
22761
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
22762
|
+
})} from (${leftSelect}) ${sql.identifier("drizzle_union")}`;
|
|
22029
22763
|
}
|
|
22030
22764
|
buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset } }) {
|
|
22031
22765
|
const leftChunk = sql`(${leftSelect.getSQL()}) `;
|
|
22032
|
-
const rightChunk = sql`(${rightSelect.getSQL()})`;
|
|
22766
|
+
const rightChunk = sql`(${rightSelect.withoutSelectionCastCodecs().getSQL()})`;
|
|
22033
22767
|
let orderBySql;
|
|
22034
22768
|
if (orderBy && orderBy.length > 0) {
|
|
22035
22769
|
const orderByValues = [];
|
|
@@ -22055,8 +22789,9 @@ var PgDialect2 = class {
|
|
|
22055
22789
|
buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_, comment, ignoreSelectionCastCodecs }) {
|
|
22056
22790
|
const valuesSqlList = [];
|
|
22057
22791
|
const columns = table[Table.Symbol.Columns];
|
|
22058
|
-
const colEntries = Object.entries(columns)
|
|
22059
|
-
const
|
|
22792
|
+
const colEntries = Object.entries(columns);
|
|
22793
|
+
const colFilteredEntries = select && !is(valuesOrSelect, SQL) ? Object.keys(valuesOrSelect.getSelectedFields()).map((key) => [key, columns[key]]) : overridingSystemValue_ ? colEntries : colEntries.filter(([_, col]) => !col.shouldDisableInsert());
|
|
22794
|
+
const insertOrder = colFilteredEntries.map(([, column]) => sql.identifier(column.name));
|
|
22060
22795
|
if (select) {
|
|
22061
22796
|
const select2 = valuesOrSelect;
|
|
22062
22797
|
if (is(select2, SQL))
|
|
@@ -22068,7 +22803,7 @@ var PgDialect2 = class {
|
|
|
22068
22803
|
valuesSqlList.push(sql.raw("values "));
|
|
22069
22804
|
for (const [valueIndex, value] of values.entries()) {
|
|
22070
22805
|
const valueList = [];
|
|
22071
|
-
for (const [fieldName, col] of
|
|
22806
|
+
for (const [fieldName, col] of colFilteredEntries) {
|
|
22072
22807
|
const colValue = value[fieldName];
|
|
22073
22808
|
if (colValue === undefined || is(colValue, Param) && colValue.value === undefined)
|
|
22074
22809
|
if (col.defaultFn !== undefined) {
|
|
@@ -22119,31 +22854,48 @@ var PgDialect2 = class {
|
|
|
22119
22854
|
tagged: true
|
|
22120
22855
|
});
|
|
22121
22856
|
}
|
|
22122
|
-
|
|
22857
|
+
buildRqbColumn(table, field, key, inJson) {
|
|
22858
|
+
if (is(field, Column)) {
|
|
22859
|
+
const name2 = sql`${table}.${sql.identifier(field.name)}`;
|
|
22860
|
+
return sql`${inJson && field.jsonSelectIdentifier ? field.jsonSelectIdentifier(name2, sql, field.dimensions) : this.codecs.apply(field, inJson ? "castInJson" : "cast", name2)} as ${sql.identifier(key)}`;
|
|
22861
|
+
}
|
|
22862
|
+
if (is(field, SQL.Aliased)) {
|
|
22863
|
+
const column = getColumnFromDecoder2(field);
|
|
22864
|
+
const q = sql`${table}.${sql.identifier(field.fieldAlias)}`;
|
|
22865
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
22866
|
+
}
|
|
22867
|
+
if (isSQLWrapper(field)) {
|
|
22868
|
+
const column = getColumnFromDecoder2(field);
|
|
22869
|
+
const q = sql`${table}.${sql.identifier(key)}`;
|
|
22870
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
22871
|
+
}
|
|
22123
22872
|
throw new DrizzleError2({ message: `Views with nested selections are not supported by the relational query builder` });
|
|
22124
22873
|
}
|
|
22125
|
-
|
|
22126
|
-
if (is(
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22874
|
+
resolveSelection(field, key, inJson) {
|
|
22875
|
+
if (is(field, Column))
|
|
22876
|
+
return {
|
|
22877
|
+
key,
|
|
22878
|
+
field,
|
|
22879
|
+
codec: this.codecs.get(field, inJson ? "normalizeInJson" : "normalize"),
|
|
22880
|
+
arrayDimensions: field.dimensions
|
|
22881
|
+
};
|
|
22882
|
+
const decoderColumn = getColumnFromDecoder2(field);
|
|
22883
|
+
return decoderColumn ? {
|
|
22884
|
+
key,
|
|
22885
|
+
field,
|
|
22886
|
+
codec: decoderColumn && (!inJson || !decoderColumn.mapFromJsonValue) ? this.codecs.get(decoderColumn, inJson ? "normalizeInJson" : "normalize") : undefined,
|
|
22887
|
+
arrayDimensions: decoderColumn.dimensions
|
|
22888
|
+
} : {
|
|
22889
|
+
key,
|
|
22890
|
+
field
|
|
22891
|
+
};
|
|
22131
22892
|
}
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22137
|
-
|
|
22138
|
-
field: v2
|
|
22139
|
-
} : {
|
|
22140
|
-
key: k,
|
|
22141
|
-
field: v2
|
|
22142
|
-
});
|
|
22143
|
-
return this.buildRqbColumn(table, v2, k, inJson);
|
|
22144
|
-
}), sql`, `);
|
|
22145
|
-
};
|
|
22146
|
-
buildColumns = (table, selection, inJson, config) => config?.columns ? (() => {
|
|
22893
|
+
buildColumns = (table, selection, inJson, config) => {
|
|
22894
|
+
if (!config?.columns)
|
|
22895
|
+
return sql.join(Object.entries(table[TableColumns]).map(([k, v2]) => {
|
|
22896
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
22897
|
+
return this.buildRqbColumn(table, v2, k, inJson);
|
|
22898
|
+
}), sql`, `);
|
|
22147
22899
|
const entries = Object.entries(config.columns);
|
|
22148
22900
|
const columnContainer = table[TableColumns];
|
|
22149
22901
|
const columnIdentifiers = [];
|
|
@@ -22155,15 +22907,7 @@ var PgDialect2 = class {
|
|
|
22155
22907
|
if (v2) {
|
|
22156
22908
|
const column = columnContainer[k];
|
|
22157
22909
|
columnIdentifiers.push(this.buildRqbColumn(table, column, k, inJson));
|
|
22158
|
-
selection.push(
|
|
22159
|
-
key: k,
|
|
22160
|
-
codec: this.codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
22161
|
-
arrayDimensions: column.dimensions,
|
|
22162
|
-
field: column
|
|
22163
|
-
} : {
|
|
22164
|
-
key: k,
|
|
22165
|
-
field: column
|
|
22166
|
-
});
|
|
22910
|
+
selection.push(this.resolveSelection(column, k, inJson));
|
|
22167
22911
|
}
|
|
22168
22912
|
}
|
|
22169
22913
|
if (colSelectionMode === false)
|
|
@@ -22171,18 +22915,10 @@ var PgDialect2 = class {
|
|
|
22171
22915
|
if (config.columns[k] === false)
|
|
22172
22916
|
continue;
|
|
22173
22917
|
columnIdentifiers.push(this.buildRqbColumn(table, v2, k, inJson));
|
|
22174
|
-
selection.push(
|
|
22175
|
-
key: k,
|
|
22176
|
-
codec: this.codecs.get(v2, inJson ? "normalizeInJson" : "normalize"),
|
|
22177
|
-
arrayDimensions: v2.dimensions,
|
|
22178
|
-
field: v2
|
|
22179
|
-
} : {
|
|
22180
|
-
key: k,
|
|
22181
|
-
field: v2
|
|
22182
|
-
});
|
|
22918
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
22183
22919
|
}
|
|
22184
22920
|
return columnIdentifiers.length ? sql.join(columnIdentifiers, sql`, `) : undefined;
|
|
22185
|
-
}
|
|
22921
|
+
};
|
|
22186
22922
|
buildRelationalQuery({ schema, table, tableConfig, queryConfig: config, relationWhere, mode, errorPath, depth, throughJoin, nested }) {
|
|
22187
22923
|
const selection = [];
|
|
22188
22924
|
const isSingle = mode === "first";
|
|
@@ -22196,7 +22932,7 @@ var PgDialect2 = class {
|
|
|
22196
22932
|
const where = params?.where && relationWhere ? and(relationsFilterToSQL2(table, params.where, tableConfig.relations, schema), relationWhere) : params?.where ? relationsFilterToSQL2(table, params.where, tableConfig.relations, schema) : relationWhere;
|
|
22197
22933
|
const order = params?.orderBy ? relationsOrderToSQL2(table, params.orderBy) : undefined;
|
|
22198
22934
|
const columns = this.buildColumns(table, selection, !!nested, params);
|
|
22199
|
-
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras) : undefined;
|
|
22935
|
+
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras, this.codecs, nested) : undefined;
|
|
22200
22936
|
if (extras)
|
|
22201
22937
|
selection.push(...extras.selection);
|
|
22202
22938
|
const selectionArr = columns ? [columns] : [];
|
|
@@ -22346,11 +23082,6 @@ var PgInsertBuilder2 = class {
|
|
|
22346
23082
|
this.overridingSystemValue_ = overridingSystemValue_;
|
|
22347
23083
|
this.builder = builder;
|
|
22348
23084
|
}
|
|
22349
|
-
authToken;
|
|
22350
|
-
setToken(token) {
|
|
22351
|
-
this.authToken = token;
|
|
22352
|
-
return this;
|
|
22353
|
-
}
|
|
22354
23085
|
overridingSystemValue() {
|
|
22355
23086
|
this.overridingSystemValue_ = true;
|
|
22356
23087
|
return this;
|
|
@@ -22368,27 +23099,25 @@ var PgInsertBuilder2 = class {
|
|
|
22368
23099
|
}
|
|
22369
23100
|
return result;
|
|
22370
23101
|
});
|
|
22371
|
-
|
|
22372
|
-
if ("setToken" in builder)
|
|
22373
|
-
builder.setToken(this.authToken);
|
|
22374
|
-
return builder;
|
|
23102
|
+
return new this.builder(this.table, mappedValues, this.session, this.dialect, this.withList, false, this.overridingSystemValue_);
|
|
22375
23103
|
}
|
|
22376
23104
|
select(selectQuery) {
|
|
22377
23105
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder2) : selectQuery;
|
|
22378
23106
|
if ("withoutSelectionCastCodecs" in select)
|
|
22379
23107
|
select.withoutSelectionCastCodecs();
|
|
22380
|
-
if (!is(select, SQL)
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
23108
|
+
if (!is(select, SQL)) {
|
|
23109
|
+
const insertCols = Object.keys(this.table[Table.Symbol.Columns]);
|
|
23110
|
+
const selected = Object.keys(select._.selectedFields);
|
|
23111
|
+
for (const col of selected)
|
|
23112
|
+
if (!insertCols.includes(col))
|
|
23113
|
+
throw new Error(`Insert select error: column "${col}" does not exist in table "${this.table[Table.Symbol.Name]}"`);
|
|
23114
|
+
}
|
|
23115
|
+
return new this.builder(this.table, select, this.session, this.dialect, this.withList, true, this.overridingSystemValue_);
|
|
22386
23116
|
}
|
|
22387
23117
|
};
|
|
22388
23118
|
var PgInsertBase2 = class {
|
|
22389
23119
|
static [entityKind] = "PgInsert";
|
|
22390
23120
|
config;
|
|
22391
|
-
cacheConfig;
|
|
22392
23121
|
constructor(table, values, session, dialect, withList, select, overridingSystemValue_) {
|
|
22393
23122
|
this.session = session;
|
|
22394
23123
|
this.dialect = dialect;
|
|
@@ -22458,7 +23187,7 @@ var PgInsertBase2 = class {
|
|
|
22458
23187
|
var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
22459
23188
|
static [entityKind] = "PgAsyncInsert";
|
|
22460
23189
|
_prepare(name2, generateName = false) {
|
|
22461
|
-
const { session, config, dialect
|
|
23190
|
+
const { session, config, dialect } = this;
|
|
22462
23191
|
const { returning: fields } = config;
|
|
22463
23192
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
22464
23193
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -22466,7 +23195,7 @@ var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
|
22466
23195
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
22467
23196
|
type: "insert",
|
|
22468
23197
|
tables: [...extractUsedTable(this.config.table)]
|
|
22469
|
-
}
|
|
23198
|
+
});
|
|
22470
23199
|
});
|
|
22471
23200
|
}
|
|
22472
23201
|
prepare(name2) {
|
|
@@ -22511,10 +23240,10 @@ applyMixins2(PgAsyncRelationalQuery2, [QueryPromise2]);
|
|
|
22511
23240
|
// node_modules/drizzle-orm/pg-core/query-builders/raw.js
|
|
22512
23241
|
var PgRaw = class {
|
|
22513
23242
|
static [entityKind] = "PgRaw";
|
|
22514
|
-
constructor(sql2, query
|
|
23243
|
+
constructor(prepared, sql2, query) {
|
|
23244
|
+
this.prepared = prepared;
|
|
22515
23245
|
this.sql = sql2;
|
|
22516
23246
|
this.query = query;
|
|
22517
|
-
this.mapBatchResult = mapBatchResult;
|
|
22518
23247
|
}
|
|
22519
23248
|
getSQL() {
|
|
22520
23249
|
return this.sql;
|
|
@@ -22522,20 +23251,22 @@ var PgRaw = class {
|
|
|
22522
23251
|
getQuery() {
|
|
22523
23252
|
return this.query;
|
|
22524
23253
|
}
|
|
22525
|
-
|
|
22526
|
-
return
|
|
23254
|
+
_prepare() {
|
|
23255
|
+
return this.prepared;
|
|
22527
23256
|
}
|
|
22528
23257
|
};
|
|
22529
23258
|
|
|
22530
23259
|
// node_modules/drizzle-orm/pg-core/async/raw.js
|
|
22531
23260
|
var PgAsyncRaw2 = class extends PgRaw {
|
|
22532
23261
|
static [entityKind] = "PgAsyncRaw";
|
|
22533
|
-
constructor(
|
|
22534
|
-
super(sql2, query
|
|
22535
|
-
|
|
23262
|
+
constructor(prepared, sql2, query) {
|
|
23263
|
+
super(prepared, sql2, query);
|
|
23264
|
+
}
|
|
23265
|
+
execute(placeholderValues) {
|
|
23266
|
+
return this.prepared.execute(placeholderValues);
|
|
22536
23267
|
}
|
|
22537
23268
|
_prepare() {
|
|
22538
|
-
return this;
|
|
23269
|
+
return this.prepared;
|
|
22539
23270
|
}
|
|
22540
23271
|
};
|
|
22541
23272
|
applyMixins2(PgAsyncRaw2, [QueryPromise2]);
|
|
@@ -22593,12 +23324,11 @@ applyMixins2(PgAsyncRefreshMaterializedView2, [QueryPromise2]);
|
|
|
22593
23324
|
var PgAsyncSelectBase2 = class extends PgSelectBase2 {
|
|
22594
23325
|
static [entityKind] = "PgAsyncSelectQueryBuilder";
|
|
22595
23326
|
_prepare(name2, generateName = false) {
|
|
22596
|
-
const { session,
|
|
22597
|
-
const { fields } = config;
|
|
23327
|
+
const { session, dialect, cacheConfig, usedTables } = this;
|
|
22598
23328
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
22599
|
-
const query = this.config.
|
|
22600
|
-
const fieldsList =
|
|
22601
|
-
const mapper = this.dialect.mapperGenerators.rows(fieldsList, joinsNotNullableMap);
|
|
23329
|
+
const query = this.config.tagged ? dialect._sqlToQuery(this.getSQL()) : dialect.sqlToQuery(this.getSQL());
|
|
23330
|
+
const fieldsList = this.config.fieldsFlat;
|
|
23331
|
+
const mapper = this.dialect.mapperGenerators.rows(fieldsList, this.joinsNotNullableMap);
|
|
22602
23332
|
return session.prepareQuery(query, "arrays", name2 ?? generateName, mapper, {
|
|
22603
23333
|
type: "select",
|
|
22604
23334
|
tables: [...usedTables]
|
|
@@ -22626,16 +23356,8 @@ var PgUpdateBuilder2 = class {
|
|
|
22626
23356
|
this.withList = withList;
|
|
22627
23357
|
this.builder = builder;
|
|
22628
23358
|
}
|
|
22629
|
-
authToken;
|
|
22630
|
-
setToken(token) {
|
|
22631
|
-
this.authToken = token;
|
|
22632
|
-
return this;
|
|
22633
|
-
}
|
|
22634
23359
|
set(values) {
|
|
22635
|
-
|
|
22636
|
-
if ("setToken" in builder)
|
|
22637
|
-
builder.setToken(this.authToken);
|
|
22638
|
-
return builder;
|
|
23360
|
+
return new this.builder(this.table, mapUpdateSet2(this.table, values), this.session, this.dialect, this.withList);
|
|
22639
23361
|
}
|
|
22640
23362
|
};
|
|
22641
23363
|
var PgUpdateBase2 = class {
|
|
@@ -22643,7 +23365,6 @@ var PgUpdateBase2 = class {
|
|
|
22643
23365
|
config;
|
|
22644
23366
|
tableName;
|
|
22645
23367
|
joinsNotNullableMap;
|
|
22646
|
-
cacheConfig;
|
|
22647
23368
|
constructor(table, set, session, dialect, withList) {
|
|
22648
23369
|
this.session = session;
|
|
22649
23370
|
this.dialect = dialect;
|
|
@@ -22772,7 +23493,7 @@ var PgUpdateBase2 = class {
|
|
|
22772
23493
|
var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
22773
23494
|
static [entityKind] = "PgAsyncUpdate";
|
|
22774
23495
|
_prepare(name2, generateName = false) {
|
|
22775
|
-
const { session, config, dialect, joinsNotNullableMap
|
|
23496
|
+
const { session, config, dialect, joinsNotNullableMap } = this;
|
|
22776
23497
|
const { returning: fields } = config;
|
|
22777
23498
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
22778
23499
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -22780,7 +23501,7 @@ var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
|
22780
23501
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
22781
23502
|
type: "update",
|
|
22782
23503
|
tables: [...extractUsedTable(this.config.table)]
|
|
22783
|
-
}
|
|
23504
|
+
});
|
|
22784
23505
|
});
|
|
22785
23506
|
}
|
|
22786
23507
|
prepare(name2) {
|
|
@@ -22920,8 +23641,7 @@ var PgAsyncDatabase2 = class {
|
|
|
22920
23641
|
execute(query) {
|
|
22921
23642
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
22922
23643
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
22923
|
-
|
|
22924
|
-
return new PgAsyncRaw2(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
23644
|
+
return new PgAsyncRaw2(this.session.prepareQuery(builtQuery, "raw", false), sequel, builtQuery);
|
|
22925
23645
|
}
|
|
22926
23646
|
transaction(transaction, config) {
|
|
22927
23647
|
return this.session.transaction(transaction, config);
|
|
@@ -22934,9 +23654,6 @@ var PgBasePreparedQuery2 = class {
|
|
|
22934
23654
|
constructor(query) {
|
|
22935
23655
|
this.query = query;
|
|
22936
23656
|
}
|
|
22937
|
-
mapResult(_, __) {
|
|
22938
|
-
throw new Error("Method not implemented.");
|
|
22939
|
-
}
|
|
22940
23657
|
getQuery() {
|
|
22941
23658
|
return this.query;
|
|
22942
23659
|
}
|
|
@@ -26463,23 +27180,28 @@ var createInMemoryAgentRegistrationStore = () => {
|
|
|
26463
27180
|
var ID_LENGTH7 = 255;
|
|
26464
27181
|
var NAME_LENGTH = 255;
|
|
26465
27182
|
var STATUS_LENGTH2 = 16;
|
|
27183
|
+
var portableJsonb = customType({
|
|
27184
|
+
dataType: () => "jsonb",
|
|
27185
|
+
fromDriver: (value) => typeof value === "string" ? JSON.parse(value) : value,
|
|
27186
|
+
toDriver: (value) => JSON.stringify(value)
|
|
27187
|
+
});
|
|
26466
27188
|
var agentDelegationsTable = pgTable("auth_agent_delegations", {
|
|
26467
27189
|
agent_id: varchar("agent_id", { length: ID_LENGTH7 }).notNull(),
|
|
26468
|
-
authorization_details:
|
|
27190
|
+
authorization_details: portableJsonb("authorization_details").$type(),
|
|
26469
27191
|
created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
26470
27192
|
delegation_id: varchar("delegation_id", {
|
|
26471
27193
|
length: ID_LENGTH7
|
|
26472
27194
|
}).primaryKey(),
|
|
26473
27195
|
expires_at_ms: bigint("expires_at_ms", { mode: "number" }),
|
|
26474
27196
|
organization_id: varchar("organization_id", { length: ID_LENGTH7 }),
|
|
26475
|
-
scopes:
|
|
27197
|
+
scopes: portableJsonb("scopes").$type().notNull().default([]),
|
|
26476
27198
|
status: varchar("status", { length: STATUS_LENGTH2 }).$type().notNull(),
|
|
26477
27199
|
updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull(),
|
|
26478
27200
|
user_id: varchar("user_id", { length: ID_LENGTH7 }).notNull()
|
|
26479
27201
|
});
|
|
26480
27202
|
var agentIdentityRegistrationsTable = pgTable("auth_agent_identity_registrations", {
|
|
26481
27203
|
agent_id: varchar("agent_id", { length: ID_LENGTH7 }).notNull().unique(),
|
|
26482
|
-
claim_attempt:
|
|
27204
|
+
claim_attempt: portableJsonb("claim_attempt").$type(),
|
|
26483
27205
|
claim_attempt_token_hash: varchar("claim_attempt_token_hash", {
|
|
26484
27206
|
length: ID_LENGTH7
|
|
26485
27207
|
}).unique(),
|
|
@@ -26511,10 +27233,10 @@ var agentIdentityRegistrationsTable = pgTable("auth_agent_identity_registrations
|
|
|
26511
27233
|
]);
|
|
26512
27234
|
var agentRegistrationsTable = pgTable("auth_agent_registrations", {
|
|
26513
27235
|
agent_id: varchar("agent_id", { length: ID_LENGTH7 }).primaryKey(),
|
|
26514
|
-
allowed_scopes:
|
|
27236
|
+
allowed_scopes: portableJsonb("allowed_scopes").$type().notNull().default([]),
|
|
26515
27237
|
client_id: varchar("client_id", { length: ID_LENGTH7 }).unique(),
|
|
26516
27238
|
created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
26517
|
-
metadata:
|
|
27239
|
+
metadata: portableJsonb("metadata").$type(),
|
|
26518
27240
|
name: varchar("name", { length: NAME_LENGTH }).notNull(),
|
|
26519
27241
|
status: varchar("status", { length: STATUS_LENGTH2 }).$type().notNull(),
|
|
26520
27242
|
updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
|
|
@@ -26986,6 +27708,16 @@ var createInMemoryAuthorizationCodeStore = () => {
|
|
|
26986
27708
|
codes.delete(codeHash);
|
|
26987
27709
|
return record;
|
|
26988
27710
|
},
|
|
27711
|
+
deleteForClient: async (clientId) => {
|
|
27712
|
+
let deleted = 0;
|
|
27713
|
+
for (const [hash, code] of codes) {
|
|
27714
|
+
if (code.clientId !== clientId)
|
|
27715
|
+
continue;
|
|
27716
|
+
codes.delete(hash);
|
|
27717
|
+
deleted += 1;
|
|
27718
|
+
}
|
|
27719
|
+
return deleted;
|
|
27720
|
+
},
|
|
26989
27721
|
deleteForUserClient: async (userId, clientId) => {
|
|
26990
27722
|
let deleted = 0;
|
|
26991
27723
|
for (const [hash, code] of codes) {
|
|
@@ -27051,6 +27783,16 @@ var createInMemoryClientRegistrationTokenStore = () => {
|
|
|
27051
27783
|
byHash.delete(hash);
|
|
27052
27784
|
}
|
|
27053
27785
|
},
|
|
27786
|
+
deleteForClient: async (clientId) => {
|
|
27787
|
+
let deleted = 0;
|
|
27788
|
+
for (const [hash, token] of byHash) {
|
|
27789
|
+
if (token.clientId !== clientId)
|
|
27790
|
+
continue;
|
|
27791
|
+
byHash.delete(hash);
|
|
27792
|
+
deleted += 1;
|
|
27793
|
+
}
|
|
27794
|
+
return deleted;
|
|
27795
|
+
},
|
|
27054
27796
|
findByTokenHash: async (tokenHash) => byHash.get(tokenHash),
|
|
27055
27797
|
saveToken: async (token) => {
|
|
27056
27798
|
for (const [hash, existing] of byHash) {
|
|
@@ -27067,6 +27809,16 @@ var createInMemoryDeviceAuthorizationStore = () => {
|
|
|
27067
27809
|
deleteByDeviceCodeHash: async (deviceCodeHash) => {
|
|
27068
27810
|
byDeviceCode.delete(deviceCodeHash);
|
|
27069
27811
|
},
|
|
27812
|
+
deleteForClient: async (clientId) => {
|
|
27813
|
+
let deleted = 0;
|
|
27814
|
+
for (const [hash, authorization] of byDeviceCode) {
|
|
27815
|
+
if (authorization.clientId !== clientId)
|
|
27816
|
+
continue;
|
|
27817
|
+
byDeviceCode.delete(hash);
|
|
27818
|
+
deleted += 1;
|
|
27819
|
+
}
|
|
27820
|
+
return deleted;
|
|
27821
|
+
},
|
|
27070
27822
|
deleteForUserClient: async (userId, clientId) => {
|
|
27071
27823
|
let deleted = 0;
|
|
27072
27824
|
for (const [hash, authorization] of byDeviceCode) {
|
|
@@ -27148,6 +27900,16 @@ var createInMemoryOidcRefreshTokenStore = () => {
|
|
|
27148
27900
|
tokens.delete(tokenHash);
|
|
27149
27901
|
return record;
|
|
27150
27902
|
},
|
|
27903
|
+
deleteForClient: async (clientId) => {
|
|
27904
|
+
let deleted = 0;
|
|
27905
|
+
for (const [hash, token] of tokens) {
|
|
27906
|
+
if (token.clientId !== clientId)
|
|
27907
|
+
continue;
|
|
27908
|
+
tokens.delete(hash);
|
|
27909
|
+
deleted += 1;
|
|
27910
|
+
}
|
|
27911
|
+
return deleted;
|
|
27912
|
+
},
|
|
27151
27913
|
deleteForUser: async (userId) => {
|
|
27152
27914
|
for (const [hash, token] of tokens) {
|
|
27153
27915
|
if (token.userId === userId)
|
|
@@ -27442,6 +28204,10 @@ var createPostgresAuthorizationCodeStore = (db) => ({
|
|
|
27442
28204
|
const [row] = await db.delete(oauthCodesTable).where(eq(oauthCodesTable.code_hash, codeHash)).returning();
|
|
27443
28205
|
return row ? toCode(row) : undefined;
|
|
27444
28206
|
},
|
|
28207
|
+
deleteForClient: async (clientId) => {
|
|
28208
|
+
const deleted = await db.delete(oauthCodesTable).where(eq(oauthCodesTable.client_id, clientId)).returning({ codeHash: oauthCodesTable.code_hash });
|
|
28209
|
+
return deleted.length;
|
|
28210
|
+
},
|
|
27445
28211
|
deleteForUserClient: async (userId, clientId) => {
|
|
27446
28212
|
const deleted = await db.delete(oauthCodesTable).where(and(eq(oauthCodesTable.user_id, userId), eq(oauthCodesTable.client_id, clientId))).returning({ codeHash: oauthCodesTable.code_hash });
|
|
27447
28213
|
return deleted.length;
|
|
@@ -27471,6 +28237,12 @@ var createPostgresClientRegistrationTokenStore = (db) => ({
|
|
|
27471
28237
|
deleteByClientId: async (clientId) => {
|
|
27472
28238
|
await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, clientId));
|
|
27473
28239
|
},
|
|
28240
|
+
deleteForClient: async (clientId) => {
|
|
28241
|
+
const deleted = await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, clientId)).returning({
|
|
28242
|
+
tokenHash: oauthClientRegistrationTokensTable.token_hash
|
|
28243
|
+
});
|
|
28244
|
+
return deleted.length;
|
|
28245
|
+
},
|
|
27474
28246
|
findByTokenHash: async (tokenHash) => {
|
|
27475
28247
|
const [row] = await db.select().from(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.token_hash, tokenHash)).limit(1);
|
|
27476
28248
|
if (!row)
|
|
@@ -27495,6 +28267,12 @@ var createPostgresDeviceAuthorizationStore = (db) => ({
|
|
|
27495
28267
|
deleteByDeviceCodeHash: async (deviceCodeHash) => {
|
|
27496
28268
|
await db.delete(oauthDeviceAuthorizationsTable).where(eq(oauthDeviceAuthorizationsTable.device_code_hash, deviceCodeHash));
|
|
27497
28269
|
},
|
|
28270
|
+
deleteForClient: async (clientId) => {
|
|
28271
|
+
const deleted = await db.delete(oauthDeviceAuthorizationsTable).where(eq(oauthDeviceAuthorizationsTable.client_id, clientId)).returning({
|
|
28272
|
+
deviceCodeHash: oauthDeviceAuthorizationsTable.device_code_hash
|
|
28273
|
+
});
|
|
28274
|
+
return deleted.length;
|
|
28275
|
+
},
|
|
27498
28276
|
deleteForUserClient: async (userId, clientId) => {
|
|
27499
28277
|
const deleted = await db.delete(oauthDeviceAuthorizationsTable).where(and(eq(oauthDeviceAuthorizationsTable.user_sub, userId), eq(oauthDeviceAuthorizationsTable.client_id, clientId))).returning({
|
|
27500
28278
|
deviceCodeHash: oauthDeviceAuthorizationsTable.device_code_hash
|
|
@@ -27589,6 +28367,10 @@ var createPostgresOidcRefreshTokenStore = (db) => ({
|
|
|
27589
28367
|
const [row] = await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.token_hash, tokenHash)).returning();
|
|
27590
28368
|
return row ? toRefresh(row) : undefined;
|
|
27591
28369
|
},
|
|
28370
|
+
deleteForClient: async (clientId) => {
|
|
28371
|
+
const deleted = await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.client_id, clientId)).returning({ tokenHash: oauthRefreshTokensTable.token_hash });
|
|
28372
|
+
return deleted.length;
|
|
28373
|
+
},
|
|
27592
28374
|
deleteForUser: async (userId) => {
|
|
27593
28375
|
await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.user_id, userId));
|
|
27594
28376
|
},
|
|
@@ -29804,5 +30586,5 @@ export {
|
|
|
29804
30586
|
auth2 as auth
|
|
29805
30587
|
};
|
|
29806
30588
|
|
|
29807
|
-
//# debugId=
|
|
30589
|
+
//# debugId=286B6E54F8CE0D4D64756E2164756E21
|
|
29808
30590
|
//# sourceMappingURL=server.js.map
|