@absolutejs/auth 0.56.7 → 0.56.9
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 +3 -3
- package/dist/index.js +1459 -737
- package/dist/index.js.map +31 -31
- package/dist/manifest.js +19 -2
- package/dist/manifest.js.map +3 -3
- package/dist/manifest.json +25 -1
- package/dist/oidc/index.js +1449 -732
- package/dist/oidc/index.js.map +30 -30
- package/dist/server.js +1459 -737
- package/dist/server.js.map +31 -31
- package/dist/vault/index.js +1449 -732
- package/dist/vault/index.js.map +30 -30
- package/package.json +3 -3
package/dist/vault/index.js
CHANGED
|
@@ -705,6 +705,9 @@ var SQL = class SQL2 {
|
|
|
705
705
|
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
706
706
|
return this;
|
|
707
707
|
}
|
|
708
|
+
nullable() {
|
|
709
|
+
return this;
|
|
710
|
+
}
|
|
708
711
|
inlineParams() {
|
|
709
712
|
this.shouldInlineParams = true;
|
|
710
713
|
return this;
|
|
@@ -890,9 +893,10 @@ function fillPlaceholders(params, values) {
|
|
|
890
893
|
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
891
894
|
if (!(p.value.name in values))
|
|
892
895
|
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
+
const value = values[p.value.name];
|
|
897
|
+
if (value === null)
|
|
898
|
+
return value;
|
|
899
|
+
const mapped = p.encoder.mapToDriverValue.isNoop ? value : p.encoder.mapToDriverValue(value);
|
|
896
900
|
return p.codec ? p.codec(mapped) : mapped;
|
|
897
901
|
}
|
|
898
902
|
return p;
|
|
@@ -1262,6 +1266,9 @@ var PgColumn = class extends Column {
|
|
|
1262
1266
|
}
|
|
1263
1267
|
return this;
|
|
1264
1268
|
}
|
|
1269
|
+
shouldDisableInsert() {
|
|
1270
|
+
return this.config.generatedIdentity !== undefined && this.config.generatedIdentity.type !== "byDefault" || this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
1271
|
+
}
|
|
1265
1272
|
mapArrayElements(value, mapper, depth) {
|
|
1266
1273
|
if (depth > 0 && Array.isArray(value))
|
|
1267
1274
|
return value.map((v) => v === null ? null : this.mapArrayElements(v, mapper, depth - 1));
|
|
@@ -1527,20 +1534,59 @@ function orderSelectedFields2(fields, pathPrefix, codecs) {
|
|
|
1527
1534
|
path: newPath,
|
|
1528
1535
|
field,
|
|
1529
1536
|
codec: codecs?.get(field, "normalize"),
|
|
1530
|
-
arrayDimensions: field.dimensions
|
|
1537
|
+
arrayDimensions: field.dimensions,
|
|
1538
|
+
column: field
|
|
1531
1539
|
});
|
|
1532
|
-
else if (is(field,
|
|
1533
|
-
|
|
1540
|
+
else if (is(field, SQL) || is(field, SQL.Aliased)) {
|
|
1541
|
+
const col = getColumnFromDecoder2(field);
|
|
1542
|
+
result.push(col ? {
|
|
1543
|
+
path: newPath,
|
|
1544
|
+
field,
|
|
1545
|
+
codec: codecs?.get(col, "normalize"),
|
|
1546
|
+
arrayDimensions: col.dimensions,
|
|
1547
|
+
column: col
|
|
1548
|
+
} : {
|
|
1549
|
+
path: newPath,
|
|
1550
|
+
field
|
|
1551
|
+
});
|
|
1552
|
+
} else if (is(field, Subquery)) {
|
|
1553
|
+
let column;
|
|
1554
|
+
const entry = Object.values(field._.selectedFields)[0];
|
|
1555
|
+
let fieldDecoder;
|
|
1556
|
+
if (is(entry, Column)) {
|
|
1557
|
+
column = entry;
|
|
1558
|
+
fieldDecoder = entry;
|
|
1559
|
+
} else if (is(entry, SQL)) {
|
|
1560
|
+
column = getColumnFromDecoder2(entry);
|
|
1561
|
+
fieldDecoder = entry.decoder;
|
|
1562
|
+
} else {
|
|
1563
|
+
column = getColumnFromDecoder2(entry);
|
|
1564
|
+
fieldDecoder = entry.sql.decoder;
|
|
1565
|
+
}
|
|
1566
|
+
if (fieldDecoder)
|
|
1567
|
+
field._.sql.decoder = fieldDecoder;
|
|
1568
|
+
result.push(column ? {
|
|
1569
|
+
path: newPath,
|
|
1570
|
+
field,
|
|
1571
|
+
codec: codecs?.get(column, "normalize"),
|
|
1572
|
+
arrayDimensions: column.dimensions,
|
|
1573
|
+
column
|
|
1574
|
+
} : {
|
|
1534
1575
|
path: newPath,
|
|
1535
1576
|
field
|
|
1536
1577
|
});
|
|
1537
|
-
else if (is(field, Table))
|
|
1578
|
+
} else if (is(field, Table))
|
|
1538
1579
|
result.push(...orderSelectedFields2(field[Table.Symbol.Columns], newPath, codecs));
|
|
1539
1580
|
else
|
|
1540
1581
|
result.push(...orderSelectedFields2(field, newPath, codecs));
|
|
1541
1582
|
return result;
|
|
1542
1583
|
}, []);
|
|
1543
1584
|
}
|
|
1585
|
+
function getColumnFromDecoder2(source) {
|
|
1586
|
+
const query = source.getSQL();
|
|
1587
|
+
if (is(query.decoder, Column))
|
|
1588
|
+
return query.decoder;
|
|
1589
|
+
}
|
|
1544
1590
|
function haveSameKeys2(left, right) {
|
|
1545
1591
|
const leftKeys = Object.keys(left);
|
|
1546
1592
|
const rightKeys = Object.keys(right);
|
|
@@ -1684,481 +1730,169 @@ var PgBoolean = class extends PgColumn {
|
|
|
1684
1730
|
function boolean(name2) {
|
|
1685
1731
|
return new PgBooleanBuilder(name2 ?? "");
|
|
1686
1732
|
}
|
|
1687
|
-
// node_modules/drizzle-orm/pg-core/
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
return "double precision";
|
|
1733
|
+
// node_modules/drizzle-orm/pg-core/array.js
|
|
1734
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
1735
|
+
for (let i = startFrom;i < arrayString.length; i++) {
|
|
1736
|
+
const char = arrayString[i];
|
|
1737
|
+
if (char === "\\") {
|
|
1738
|
+
i++;
|
|
1739
|
+
continue;
|
|
1740
|
+
}
|
|
1741
|
+
if (char === '"')
|
|
1742
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
1743
|
+
if (inQuotes)
|
|
1744
|
+
continue;
|
|
1745
|
+
if (char === "," || char === "}")
|
|
1746
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
1702
1747
|
}
|
|
1703
|
-
|
|
1704
|
-
function doublePrecision(name2) {
|
|
1705
|
-
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
1748
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
1706
1749
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1750
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
1751
|
+
const result = [];
|
|
1752
|
+
let i = startFrom;
|
|
1753
|
+
let lastCharIsComma = false;
|
|
1754
|
+
while (i < arrayString.length) {
|
|
1755
|
+
const char = arrayString[i];
|
|
1756
|
+
if (char === ",") {
|
|
1757
|
+
if (lastCharIsComma || i === startFrom)
|
|
1758
|
+
result.push("");
|
|
1759
|
+
lastCharIsComma = true;
|
|
1760
|
+
i++;
|
|
1761
|
+
continue;
|
|
1762
|
+
}
|
|
1763
|
+
lastCharIsComma = false;
|
|
1764
|
+
if (char === "\\") {
|
|
1765
|
+
i += 2;
|
|
1766
|
+
continue;
|
|
1767
|
+
}
|
|
1768
|
+
if (char === '"') {
|
|
1769
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
1770
|
+
result.push(value2);
|
|
1771
|
+
i = startFrom2;
|
|
1772
|
+
continue;
|
|
1773
|
+
}
|
|
1774
|
+
if (char === "}")
|
|
1775
|
+
return [result, i + 1];
|
|
1776
|
+
if (char === "{") {
|
|
1777
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
1778
|
+
result.push(value2);
|
|
1779
|
+
i = startFrom2;
|
|
1780
|
+
continue;
|
|
1781
|
+
}
|
|
1782
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
1783
|
+
result.push(value);
|
|
1784
|
+
i = newStartFrom;
|
|
1722
1785
|
}
|
|
1723
|
-
|
|
1724
|
-
function integer(name2) {
|
|
1725
|
-
return new PgIntegerBuilder(name2 ?? "");
|
|
1786
|
+
return [result, i];
|
|
1726
1787
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
constructor(name2) {
|
|
1731
|
-
super(name2, "object json", "PgJsonb");
|
|
1732
|
-
}
|
|
1733
|
-
build(table) {
|
|
1734
|
-
return new PgJsonb(table, this.config);
|
|
1735
|
-
}
|
|
1736
|
-
};
|
|
1737
|
-
var PgJsonb = class extends PgColumn {
|
|
1738
|
-
static [entityKind] = "PgJsonb";
|
|
1739
|
-
codec = "jsonb";
|
|
1740
|
-
constructor(table, config) {
|
|
1741
|
-
super(table, config);
|
|
1742
|
-
}
|
|
1743
|
-
getSQLType() {
|
|
1744
|
-
return "jsonb";
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
function jsonb(name2) {
|
|
1748
|
-
return new PgJsonbBuilder(name2 ?? "");
|
|
1788
|
+
function parsePgArray(arrayString) {
|
|
1789
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
1790
|
+
return result;
|
|
1749
1791
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1792
|
+
function makePgArray(array) {
|
|
1793
|
+
return `{${array.map((item) => {
|
|
1794
|
+
if (Array.isArray(item))
|
|
1795
|
+
return makePgArray(item);
|
|
1796
|
+
if (typeof item === "string")
|
|
1797
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
1798
|
+
return `${item}`;
|
|
1799
|
+
}).join(",")}}`;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
1803
|
+
function hexToBytes(hex) {
|
|
1804
|
+
const bytes = [];
|
|
1805
|
+
for (let c = 0;c < hex.length; c += 2)
|
|
1806
|
+
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
1807
|
+
return new Uint8Array(bytes);
|
|
1808
|
+
}
|
|
1809
|
+
function bytesToFloat64(bytes, offset) {
|
|
1810
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
1811
|
+
const view = new DataView(buffer);
|
|
1812
|
+
for (let i = 0;i < 8; i++)
|
|
1813
|
+
view.setUint8(i, bytes[offset + i]);
|
|
1814
|
+
return view.getFloat64(0, true);
|
|
1815
|
+
}
|
|
1816
|
+
function parseEWKB(hex) {
|
|
1817
|
+
const bytes = hexToBytes(hex);
|
|
1818
|
+
let offset = 0;
|
|
1819
|
+
const byteOrder = bytes[offset];
|
|
1820
|
+
offset += 1;
|
|
1821
|
+
const view = new DataView(bytes.buffer);
|
|
1822
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
1823
|
+
offset += 4;
|
|
1824
|
+
let srid;
|
|
1825
|
+
if (geomType & 536870912) {
|
|
1826
|
+
srid = view.getUint32(offset, byteOrder === 1);
|
|
1827
|
+
offset += 4;
|
|
1755
1828
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1829
|
+
if ((geomType & 65535) === 1) {
|
|
1830
|
+
const x = bytesToFloat64(bytes, offset);
|
|
1831
|
+
offset += 8;
|
|
1832
|
+
const y = bytesToFloat64(bytes, offset);
|
|
1833
|
+
offset += 8;
|
|
1834
|
+
return {
|
|
1835
|
+
srid,
|
|
1836
|
+
point: [x, y]
|
|
1837
|
+
};
|
|
1758
1838
|
}
|
|
1839
|
+
throw new Error("Unsupported geometry type");
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// node_modules/drizzle-orm/codecs.js
|
|
1843
|
+
var noopCodecs = {};
|
|
1844
|
+
var arrayToItemTypeCodecNameMap = {
|
|
1845
|
+
cast: "cast",
|
|
1846
|
+
castArray: "cast",
|
|
1847
|
+
castInJson: "castInJson",
|
|
1848
|
+
castArrayInJson: "castInJson",
|
|
1849
|
+
castParam: "castParam",
|
|
1850
|
+
castArrayParam: "castParam",
|
|
1851
|
+
normalize: "normalize",
|
|
1852
|
+
normalizeArray: "normalize",
|
|
1853
|
+
normalizeInJson: "normalizeInJson",
|
|
1854
|
+
normalizeArrayInJson: "normalizeInJson",
|
|
1855
|
+
normalizeParam: "normalizeParam",
|
|
1856
|
+
normalizeParamArray: "normalizeParam"
|
|
1759
1857
|
};
|
|
1760
|
-
var
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1858
|
+
var itemToArrayTypeCodecNameMap = {
|
|
1859
|
+
cast: "castArray",
|
|
1860
|
+
castArray: "castArray",
|
|
1861
|
+
castInJson: "castArrayInJson",
|
|
1862
|
+
castArrayInJson: "castArrayInJson",
|
|
1863
|
+
castParam: "castArrayParam",
|
|
1864
|
+
castArrayParam: "castArrayParam",
|
|
1865
|
+
normalize: "normalizeArray",
|
|
1866
|
+
normalizeArray: "normalizeArray",
|
|
1867
|
+
normalizeInJson: "normalizeArrayInJson",
|
|
1868
|
+
normalizeArrayInJson: "normalizeArrayInJson",
|
|
1869
|
+
normalizeParam: "normalizeParamArray",
|
|
1870
|
+
normalizeParamArray: "normalizeParamArray"
|
|
1766
1871
|
};
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
static [entityKind] = "PgTextBuilder";
|
|
1773
|
-
constructor(name2, config) {
|
|
1774
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
1775
|
-
this.config.enumValues = config.enum;
|
|
1776
|
-
}
|
|
1777
|
-
build(table) {
|
|
1778
|
-
return new PgText(table, this.config, this.config.enumValues);
|
|
1872
|
+
var CodecsCollection = class {
|
|
1873
|
+
static [entityKind] = "CodecsCollection";
|
|
1874
|
+
constructor(resolveTypes, codecs = noopCodecs) {
|
|
1875
|
+
this.resolveTypes = resolveTypes;
|
|
1876
|
+
this.codecs = codecs;
|
|
1779
1877
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
super(table, config);
|
|
1787
|
-
this.enumValues = enumValues;
|
|
1878
|
+
get(column, type, override) {
|
|
1879
|
+
const sqlType = override ?? column.codec;
|
|
1880
|
+
if (!sqlType)
|
|
1881
|
+
return;
|
|
1882
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1883
|
+
return this.codecs[sqlType]?.[codecType];
|
|
1788
1884
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
defaultNow() {
|
|
1801
|
-
return this.default(sql`now()`);
|
|
1802
|
-
}
|
|
1803
|
-
};
|
|
1804
|
-
|
|
1805
|
-
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
1806
|
-
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
1807
|
-
static [entityKind] = "PgTimestampBuilder";
|
|
1808
|
-
constructor(name2, withTimezone, precision) {
|
|
1809
|
-
super(name2, "object date", "PgTimestamp");
|
|
1810
|
-
this.config.withTimezone = withTimezone;
|
|
1811
|
-
this.config.precision = precision;
|
|
1812
|
-
}
|
|
1813
|
-
build(table) {
|
|
1814
|
-
return new PgTimestamp(table, this.config);
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
var PgTimestamp = class extends PgColumn {
|
|
1818
|
-
static [entityKind] = "PgTimestamp";
|
|
1819
|
-
codec;
|
|
1820
|
-
withTimezone;
|
|
1821
|
-
precision;
|
|
1822
|
-
constructor(table, config) {
|
|
1823
|
-
super(table, config);
|
|
1824
|
-
this.withTimezone = config.withTimezone;
|
|
1825
|
-
this.precision = config.precision;
|
|
1826
|
-
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
1827
|
-
}
|
|
1828
|
-
getSQLType() {
|
|
1829
|
-
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
1830
|
-
}
|
|
1831
|
-
mapToDriverValue = (value) => {
|
|
1832
|
-
if (typeof value === "string")
|
|
1833
|
-
return value;
|
|
1834
|
-
return value.toISOString();
|
|
1835
|
-
};
|
|
1836
|
-
};
|
|
1837
|
-
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
1838
|
-
static [entityKind] = "PgTimestampStringBuilder";
|
|
1839
|
-
constructor(name2, withTimezone, precision) {
|
|
1840
|
-
super(name2, "string timestamp", "PgTimestampString");
|
|
1841
|
-
this.config.withTimezone = withTimezone;
|
|
1842
|
-
this.config.precision = precision;
|
|
1843
|
-
}
|
|
1844
|
-
build(table) {
|
|
1845
|
-
return new PgTimestampString(table, this.config);
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
var PgTimestampString = class extends PgColumn {
|
|
1849
|
-
static [entityKind] = "PgTimestampString";
|
|
1850
|
-
codec;
|
|
1851
|
-
withTimezone;
|
|
1852
|
-
precision;
|
|
1853
|
-
constructor(table, config) {
|
|
1854
|
-
super(table, config);
|
|
1855
|
-
this.withTimezone = config.withTimezone;
|
|
1856
|
-
this.precision = config.precision;
|
|
1857
|
-
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
1858
|
-
}
|
|
1859
|
-
getSQLType() {
|
|
1860
|
-
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
1861
|
-
}
|
|
1862
|
-
mapToDriverValue = (value) => {
|
|
1863
|
-
if (typeof value === "string")
|
|
1864
|
-
return value;
|
|
1865
|
-
return value.toISOString();
|
|
1866
|
-
};
|
|
1867
|
-
};
|
|
1868
|
-
function timestamp(a, b = {}) {
|
|
1869
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1870
|
-
if (config?.mode === "string")
|
|
1871
|
-
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
1872
|
-
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
1873
|
-
}
|
|
1874
|
-
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
1875
|
-
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
1876
|
-
static [entityKind] = "PgVarcharBuilder";
|
|
1877
|
-
constructor(name2, config) {
|
|
1878
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
1879
|
-
this.config.length = config.length;
|
|
1880
|
-
this.config.enumValues = config.enum;
|
|
1881
|
-
}
|
|
1882
|
-
build(table) {
|
|
1883
|
-
return new PgVarchar(table, this.config);
|
|
1884
|
-
}
|
|
1885
|
-
};
|
|
1886
|
-
var PgVarchar = class extends PgColumn {
|
|
1887
|
-
static [entityKind] = "PgVarchar";
|
|
1888
|
-
codec = "varchar";
|
|
1889
|
-
enumValues;
|
|
1890
|
-
constructor(table, config) {
|
|
1891
|
-
super(table, config);
|
|
1892
|
-
this.enumValues = config.enumValues;
|
|
1893
|
-
}
|
|
1894
|
-
getSQLType() {
|
|
1895
|
-
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1898
|
-
function varchar(a, b = {}) {
|
|
1899
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1900
|
-
return new PgVarcharBuilder(name2, config);
|
|
1901
|
-
}
|
|
1902
|
-
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
1903
|
-
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
1904
|
-
static [entityKind] = "PgBigSerial53Builder";
|
|
1905
|
-
constructor(name2) {
|
|
1906
|
-
super(name2, "number int53", "PgBigSerial53");
|
|
1907
|
-
this.config.hasDefault = true;
|
|
1908
|
-
this.config.notNull = true;
|
|
1909
|
-
}
|
|
1910
|
-
build(table) {
|
|
1911
|
-
return new PgBigSerial53(table, this.config);
|
|
1912
|
-
}
|
|
1913
|
-
};
|
|
1914
|
-
var PgBigSerial53 = class extends PgColumn {
|
|
1915
|
-
static [entityKind] = "PgBigSerial53";
|
|
1916
|
-
codec = "bigserial:number";
|
|
1917
|
-
getSQLType() {
|
|
1918
|
-
return "bigserial";
|
|
1919
|
-
}
|
|
1920
|
-
};
|
|
1921
|
-
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
1922
|
-
static [entityKind] = "PgBigSerial64Builder";
|
|
1923
|
-
constructor(name2) {
|
|
1924
|
-
super(name2, "bigint int64", "PgBigSerial64");
|
|
1925
|
-
this.config.hasDefault = true;
|
|
1926
|
-
this.config.notNull = true;
|
|
1927
|
-
}
|
|
1928
|
-
build(table) {
|
|
1929
|
-
return new PgBigSerial64(table, this.config);
|
|
1930
|
-
}
|
|
1931
|
-
};
|
|
1932
|
-
var PgBigSerial64 = class extends PgColumn {
|
|
1933
|
-
static [entityKind] = "PgBigSerial64";
|
|
1934
|
-
codec = "bigserial";
|
|
1935
|
-
getSQLType() {
|
|
1936
|
-
return "bigserial";
|
|
1937
|
-
}
|
|
1938
|
-
};
|
|
1939
|
-
function bigserial(a, b) {
|
|
1940
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1941
|
-
if (config.mode === "number")
|
|
1942
|
-
return new PgBigSerial53Builder(name2);
|
|
1943
|
-
return new PgBigSerial64Builder(name2);
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
1947
|
-
var PgCharBuilder = class extends PgColumnBuilder {
|
|
1948
|
-
static [entityKind] = "PgCharBuilder";
|
|
1949
|
-
constructor(name2, config) {
|
|
1950
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
1951
|
-
this.config.length = config.length ?? 1;
|
|
1952
|
-
this.config.setLength = config.length !== undefined;
|
|
1953
|
-
this.config.enumValues = config.enum;
|
|
1954
|
-
}
|
|
1955
|
-
build(table) {
|
|
1956
|
-
return new PgChar(table, this.config);
|
|
1957
|
-
}
|
|
1958
|
-
};
|
|
1959
|
-
var PgChar = class extends PgColumn {
|
|
1960
|
-
static [entityKind] = "PgChar";
|
|
1961
|
-
codec = "char";
|
|
1962
|
-
enumValues;
|
|
1963
|
-
setLength;
|
|
1964
|
-
constructor(table, config) {
|
|
1965
|
-
super(table, config);
|
|
1966
|
-
this.enumValues = config.enumValues;
|
|
1967
|
-
this.setLength = config.setLength;
|
|
1968
|
-
}
|
|
1969
|
-
getSQLType() {
|
|
1970
|
-
return this.setLength ? `char(${this.length})` : `char`;
|
|
1971
|
-
}
|
|
1972
|
-
};
|
|
1973
|
-
function char(a, b = {}) {
|
|
1974
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1975
|
-
return new PgCharBuilder(name2, config);
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
1979
|
-
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
1980
|
-
static [entityKind] = "PgCidrBuilder";
|
|
1981
|
-
constructor(name2) {
|
|
1982
|
-
super(name2, "string cidr", "PgCidr");
|
|
1983
|
-
}
|
|
1984
|
-
build(table) {
|
|
1985
|
-
return new PgCidr(table, this.config);
|
|
1986
|
-
}
|
|
1987
|
-
};
|
|
1988
|
-
var PgCidr = class extends PgColumn {
|
|
1989
|
-
static [entityKind] = "PgCidr";
|
|
1990
|
-
codec = "cidr";
|
|
1991
|
-
getSQLType() {
|
|
1992
|
-
return "cidr";
|
|
1993
|
-
}
|
|
1994
|
-
};
|
|
1995
|
-
function cidr(name2) {
|
|
1996
|
-
return new PgCidrBuilder(name2 ?? "");
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
// node_modules/drizzle-orm/pg-core/array.js
|
|
2000
|
-
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
2001
|
-
for (let i = startFrom;i < arrayString.length; i++) {
|
|
2002
|
-
const char2 = arrayString[i];
|
|
2003
|
-
if (char2 === "\\") {
|
|
2004
|
-
i++;
|
|
2005
|
-
continue;
|
|
2006
|
-
}
|
|
2007
|
-
if (char2 === '"')
|
|
2008
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
2009
|
-
if (inQuotes)
|
|
2010
|
-
continue;
|
|
2011
|
-
if (char2 === "," || char2 === "}")
|
|
2012
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
2013
|
-
}
|
|
2014
|
-
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
2015
|
-
}
|
|
2016
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
2017
|
-
const result = [];
|
|
2018
|
-
let i = startFrom;
|
|
2019
|
-
let lastCharIsComma = false;
|
|
2020
|
-
while (i < arrayString.length) {
|
|
2021
|
-
const char2 = arrayString[i];
|
|
2022
|
-
if (char2 === ",") {
|
|
2023
|
-
if (lastCharIsComma || i === startFrom)
|
|
2024
|
-
result.push("");
|
|
2025
|
-
lastCharIsComma = true;
|
|
2026
|
-
i++;
|
|
2027
|
-
continue;
|
|
2028
|
-
}
|
|
2029
|
-
lastCharIsComma = false;
|
|
2030
|
-
if (char2 === "\\") {
|
|
2031
|
-
i += 2;
|
|
2032
|
-
continue;
|
|
2033
|
-
}
|
|
2034
|
-
if (char2 === '"') {
|
|
2035
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
2036
|
-
result.push(value2);
|
|
2037
|
-
i = startFrom2;
|
|
2038
|
-
continue;
|
|
2039
|
-
}
|
|
2040
|
-
if (char2 === "}")
|
|
2041
|
-
return [result, i + 1];
|
|
2042
|
-
if (char2 === "{") {
|
|
2043
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
2044
|
-
result.push(value2);
|
|
2045
|
-
i = startFrom2;
|
|
2046
|
-
continue;
|
|
2047
|
-
}
|
|
2048
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
2049
|
-
result.push(value);
|
|
2050
|
-
i = newStartFrom;
|
|
2051
|
-
}
|
|
2052
|
-
return [result, i];
|
|
2053
|
-
}
|
|
2054
|
-
function parsePgArray(arrayString) {
|
|
2055
|
-
const [result] = parsePgNestedArray(arrayString, 1);
|
|
2056
|
-
return result;
|
|
2057
|
-
}
|
|
2058
|
-
function makePgArray(array) {
|
|
2059
|
-
return `{${array.map((item) => {
|
|
2060
|
-
if (Array.isArray(item))
|
|
2061
|
-
return makePgArray(item);
|
|
2062
|
-
if (typeof item === "string")
|
|
2063
|
-
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
2064
|
-
return `${item}`;
|
|
2065
|
-
}).join(",")}}`;
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
2069
|
-
function hexToBytes(hex) {
|
|
2070
|
-
const bytes = [];
|
|
2071
|
-
for (let c = 0;c < hex.length; c += 2)
|
|
2072
|
-
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
2073
|
-
return new Uint8Array(bytes);
|
|
2074
|
-
}
|
|
2075
|
-
function bytesToFloat64(bytes, offset) {
|
|
2076
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
2077
|
-
const view = new DataView(buffer);
|
|
2078
|
-
for (let i = 0;i < 8; i++)
|
|
2079
|
-
view.setUint8(i, bytes[offset + i]);
|
|
2080
|
-
return view.getFloat64(0, true);
|
|
2081
|
-
}
|
|
2082
|
-
function parseEWKB(hex) {
|
|
2083
|
-
const bytes = hexToBytes(hex);
|
|
2084
|
-
let offset = 0;
|
|
2085
|
-
const byteOrder = bytes[offset];
|
|
2086
|
-
offset += 1;
|
|
2087
|
-
const view = new DataView(bytes.buffer);
|
|
2088
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
2089
|
-
offset += 4;
|
|
2090
|
-
let srid;
|
|
2091
|
-
if (geomType & 536870912) {
|
|
2092
|
-
srid = view.getUint32(offset, byteOrder === 1);
|
|
2093
|
-
offset += 4;
|
|
2094
|
-
}
|
|
2095
|
-
if ((geomType & 65535) === 1) {
|
|
2096
|
-
const x = bytesToFloat64(bytes, offset);
|
|
2097
|
-
offset += 8;
|
|
2098
|
-
const y = bytesToFloat64(bytes, offset);
|
|
2099
|
-
offset += 8;
|
|
2100
|
-
return {
|
|
2101
|
-
srid,
|
|
2102
|
-
point: [x, y]
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
throw new Error("Unsupported geometry type");
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
// node_modules/drizzle-orm/codecs.js
|
|
2109
|
-
var noopCodecs = {};
|
|
2110
|
-
var arrayToItemTypeCodecNameMap = {
|
|
2111
|
-
cast: "cast",
|
|
2112
|
-
castArray: "cast",
|
|
2113
|
-
castInJson: "castInJson",
|
|
2114
|
-
castArrayInJson: "castInJson",
|
|
2115
|
-
castParam: "castParam",
|
|
2116
|
-
castArrayParam: "castParam",
|
|
2117
|
-
normalize: "normalize",
|
|
2118
|
-
normalizeArray: "normalize",
|
|
2119
|
-
normalizeInJson: "normalizeInJson",
|
|
2120
|
-
normalizeArrayInJson: "normalizeInJson",
|
|
2121
|
-
normalizeParam: "normalizeParam",
|
|
2122
|
-
normalizeParamArray: "normalizeParam"
|
|
2123
|
-
};
|
|
2124
|
-
var itemToArrayTypeCodecNameMap = {
|
|
2125
|
-
cast: "castArray",
|
|
2126
|
-
castArray: "castArray",
|
|
2127
|
-
castInJson: "castArrayInJson",
|
|
2128
|
-
castArrayInJson: "castArrayInJson",
|
|
2129
|
-
castParam: "castArrayParam",
|
|
2130
|
-
castArrayParam: "castArrayParam",
|
|
2131
|
-
normalize: "normalizeArray",
|
|
2132
|
-
normalizeArray: "normalizeArray",
|
|
2133
|
-
normalizeInJson: "normalizeArrayInJson",
|
|
2134
|
-
normalizeArrayInJson: "normalizeArrayInJson",
|
|
2135
|
-
normalizeParam: "normalizeParamArray",
|
|
2136
|
-
normalizeParamArray: "normalizeParamArray"
|
|
2137
|
-
};
|
|
2138
|
-
var CodecsCollection = class {
|
|
2139
|
-
static [entityKind] = "CodecsCollection";
|
|
2140
|
-
constructor(resolveTypes, codecs = noopCodecs) {
|
|
2141
|
-
this.resolveTypes = resolveTypes;
|
|
2142
|
-
this.codecs = codecs;
|
|
2143
|
-
}
|
|
2144
|
-
get(column, type) {
|
|
2145
|
-
const sqlType = column.codec;
|
|
2146
|
-
if (!sqlType)
|
|
2147
|
-
return;
|
|
2148
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
2149
|
-
return this.codecs[sqlType]?.[codecType];
|
|
2150
|
-
}
|
|
2151
|
-
apply(column, type, value) {
|
|
2152
|
-
const sqlType = column.codec;
|
|
2153
|
-
if (!sqlType)
|
|
2154
|
-
return value;
|
|
2155
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
2156
|
-
const codec = this.codecs[sqlType]?.[codecType];
|
|
2157
|
-
if (!codec)
|
|
2158
|
-
return value;
|
|
2159
|
-
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
2160
|
-
return codec(value, column, column.dimensions);
|
|
2161
|
-
return codec(value, column.dimensions);
|
|
1885
|
+
apply(column, type, value, override) {
|
|
1886
|
+
const sqlType = override ?? column.codec;
|
|
1887
|
+
if (!sqlType)
|
|
1888
|
+
return value;
|
|
1889
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1890
|
+
const codec = this.codecs[sqlType]?.[codecType];
|
|
1891
|
+
if (!codec)
|
|
1892
|
+
return value;
|
|
1893
|
+
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
1894
|
+
return codec(value, column, column.dimensions);
|
|
1895
|
+
return codec(value, column.dimensions);
|
|
2162
1896
|
}
|
|
2163
1897
|
};
|
|
2164
1898
|
function refineCodecs(source, extension = {}) {
|
|
@@ -2178,34 +1912,661 @@ function refineCodecs(source, extension = {}) {
|
|
|
2178
1912
|
for (const ik of innerKeys)
|
|
2179
1913
|
result[k][ik] = ik in extension[k] ? extension[k][ik] : source[k]?.[ik];
|
|
2180
1914
|
}
|
|
2181
|
-
return result;
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
2185
|
-
var PG_ALIAS_TO_TYPE_MAP = {
|
|
2186
|
-
int2: "smallint",
|
|
2187
|
-
integer: "int",
|
|
2188
|
-
int4: "int",
|
|
2189
|
-
int8: "bigint",
|
|
2190
|
-
decimal: "numeric",
|
|
2191
|
-
real: "float4",
|
|
2192
|
-
double: "float8",
|
|
2193
|
-
"double precision": "float8",
|
|
2194
|
-
serial2: "smallserial",
|
|
2195
|
-
serial4: "serial",
|
|
2196
|
-
serial8: "bigserial",
|
|
2197
|
-
character: "char",
|
|
2198
|
-
"character varying": "varchar",
|
|
2199
|
-
"time with time zone": "timetz",
|
|
2200
|
-
"time without time zone": "time",
|
|
2201
|
-
"timestamp with time zone": "timestamptz",
|
|
2202
|
-
"timestamp without time zone": "timestamp",
|
|
2203
|
-
boolean: "bool",
|
|
2204
|
-
"bit varying": "varbit"
|
|
1915
|
+
return result;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
1919
|
+
var PG_ALIAS_TO_TYPE_MAP = {
|
|
1920
|
+
int2: "smallint",
|
|
1921
|
+
integer: "int",
|
|
1922
|
+
int4: "int",
|
|
1923
|
+
int8: "bigint",
|
|
1924
|
+
decimal: "numeric",
|
|
1925
|
+
real: "float4",
|
|
1926
|
+
double: "float8",
|
|
1927
|
+
"double precision": "float8",
|
|
1928
|
+
serial2: "smallserial",
|
|
1929
|
+
serial4: "serial",
|
|
1930
|
+
serial8: "bigserial",
|
|
1931
|
+
character: "char",
|
|
1932
|
+
"character varying": "varchar",
|
|
1933
|
+
"time with time zone": "timetz",
|
|
1934
|
+
"time without time zone": "time",
|
|
1935
|
+
"timestamp with time zone": "timestamptz",
|
|
1936
|
+
"timestamp without time zone": "timestamp",
|
|
1937
|
+
boolean: "bool",
|
|
1938
|
+
"bit varying": "varbit"
|
|
1939
|
+
};
|
|
1940
|
+
function resolvePgTypeAlias(type) {
|
|
1941
|
+
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
1942
|
+
}
|
|
1943
|
+
var unionsTypeTable = {
|
|
1944
|
+
smallint: {
|
|
1945
|
+
smallint: "smallint",
|
|
1946
|
+
int: "int",
|
|
1947
|
+
bigint: "bigint:number",
|
|
1948
|
+
"bigint:number": "bigint:number",
|
|
1949
|
+
"bigint:string": "bigint:number",
|
|
1950
|
+
numeric: "numeric:number",
|
|
1951
|
+
"numeric:number": "numeric:number",
|
|
1952
|
+
"numeric:bigint": "numeric:number",
|
|
1953
|
+
float4: "float4",
|
|
1954
|
+
float8: "float8",
|
|
1955
|
+
smallserial: "smallint",
|
|
1956
|
+
serial: "int",
|
|
1957
|
+
bigserial: "bigint:number",
|
|
1958
|
+
"bigserial:number": "bigint:number",
|
|
1959
|
+
oid: "oid",
|
|
1960
|
+
regproc: "regproc",
|
|
1961
|
+
regprocedure: "regprocedure",
|
|
1962
|
+
regoper: "regoper",
|
|
1963
|
+
regoperator: "regoperator",
|
|
1964
|
+
regclass: "regclass",
|
|
1965
|
+
regtype: "regtype",
|
|
1966
|
+
regrole: "regrole",
|
|
1967
|
+
regnamespace: "regnamespace",
|
|
1968
|
+
regconfig: "regconfig",
|
|
1969
|
+
regdictionary: "regdictionary"
|
|
1970
|
+
},
|
|
1971
|
+
int: {
|
|
1972
|
+
smallint: "int",
|
|
1973
|
+
int: "int",
|
|
1974
|
+
bigint: "bigint:number",
|
|
1975
|
+
"bigint:number": "bigint:number",
|
|
1976
|
+
"bigint:string": "bigint:number",
|
|
1977
|
+
numeric: "numeric:number",
|
|
1978
|
+
"numeric:number": "numeric:number",
|
|
1979
|
+
"numeric:bigint": "numeric:number",
|
|
1980
|
+
float4: "float4",
|
|
1981
|
+
float8: "float8",
|
|
1982
|
+
smallserial: "int",
|
|
1983
|
+
serial: "int",
|
|
1984
|
+
bigserial: "bigint:number",
|
|
1985
|
+
"bigserial:number": "bigint:number",
|
|
1986
|
+
oid: "oid",
|
|
1987
|
+
regproc: "regproc",
|
|
1988
|
+
regprocedure: "regprocedure",
|
|
1989
|
+
regoper: "regoper",
|
|
1990
|
+
regoperator: "regoperator",
|
|
1991
|
+
regclass: "regclass",
|
|
1992
|
+
regtype: "regtype",
|
|
1993
|
+
regrole: "regrole",
|
|
1994
|
+
regnamespace: "regnamespace",
|
|
1995
|
+
regconfig: "regconfig",
|
|
1996
|
+
regdictionary: "regdictionary"
|
|
1997
|
+
},
|
|
1998
|
+
bigint: {
|
|
1999
|
+
smallint: "bigint",
|
|
2000
|
+
int: "bigint",
|
|
2001
|
+
bigint: "bigint",
|
|
2002
|
+
"bigint:number": "bigint",
|
|
2003
|
+
"bigint:string": "bigint",
|
|
2004
|
+
numeric: "numeric:bigint",
|
|
2005
|
+
"numeric:number": "numeric:bigint",
|
|
2006
|
+
"numeric:bigint": "numeric:bigint",
|
|
2007
|
+
float4: "float4",
|
|
2008
|
+
float8: "float8",
|
|
2009
|
+
smallserial: "bigint",
|
|
2010
|
+
serial: "bigint",
|
|
2011
|
+
bigserial: "bigint",
|
|
2012
|
+
"bigserial:number": "bigint",
|
|
2013
|
+
oid: "oid",
|
|
2014
|
+
regproc: "regproc",
|
|
2015
|
+
regprocedure: "regprocedure",
|
|
2016
|
+
regoper: "regoper",
|
|
2017
|
+
regoperator: "regoperator",
|
|
2018
|
+
regclass: "regclass",
|
|
2019
|
+
regtype: "regtype",
|
|
2020
|
+
regrole: "regrole",
|
|
2021
|
+
regnamespace: "regnamespace",
|
|
2022
|
+
regconfig: "regconfig",
|
|
2023
|
+
regdictionary: "regdictionary"
|
|
2024
|
+
},
|
|
2025
|
+
"bigint:number": {
|
|
2026
|
+
smallint: "bigint:number",
|
|
2027
|
+
int: "bigint:number",
|
|
2028
|
+
bigint: "bigint:number",
|
|
2029
|
+
"bigint:number": "bigint:number",
|
|
2030
|
+
"bigint:string": "bigint:number",
|
|
2031
|
+
numeric: "numeric:number",
|
|
2032
|
+
"numeric:number": "numeric:number",
|
|
2033
|
+
"numeric:bigint": "numeric:number",
|
|
2034
|
+
float4: "float4",
|
|
2035
|
+
float8: "float8",
|
|
2036
|
+
smallserial: "bigint:number",
|
|
2037
|
+
serial: "bigint:number",
|
|
2038
|
+
bigserial: "bigint:number",
|
|
2039
|
+
"bigserial:number": "bigint:number",
|
|
2040
|
+
oid: "oid",
|
|
2041
|
+
regproc: "regproc",
|
|
2042
|
+
regprocedure: "regprocedure",
|
|
2043
|
+
regoper: "regoper",
|
|
2044
|
+
regoperator: "regoperator",
|
|
2045
|
+
regclass: "regclass",
|
|
2046
|
+
regtype: "regtype",
|
|
2047
|
+
regrole: "regrole",
|
|
2048
|
+
regnamespace: "regnamespace",
|
|
2049
|
+
regconfig: "regconfig",
|
|
2050
|
+
regdictionary: "regdictionary"
|
|
2051
|
+
},
|
|
2052
|
+
"bigint:string": {
|
|
2053
|
+
smallint: "bigint:string",
|
|
2054
|
+
int: "bigint:string",
|
|
2055
|
+
bigint: "bigint:string",
|
|
2056
|
+
"bigint:number": "bigint:string",
|
|
2057
|
+
"bigint:string": "bigint:string",
|
|
2058
|
+
numeric: "numeric",
|
|
2059
|
+
"numeric:number": "numeric",
|
|
2060
|
+
"numeric:bigint": "numeric",
|
|
2061
|
+
float4: "float4",
|
|
2062
|
+
float8: "float8",
|
|
2063
|
+
smallserial: "bigint:string",
|
|
2064
|
+
serial: "bigint:string",
|
|
2065
|
+
bigserial: "bigint:string",
|
|
2066
|
+
"bigserial:number": "bigint:string",
|
|
2067
|
+
oid: "oid",
|
|
2068
|
+
regproc: "regproc",
|
|
2069
|
+
regprocedure: "regprocedure",
|
|
2070
|
+
regoper: "regoper",
|
|
2071
|
+
regoperator: "regoperator",
|
|
2072
|
+
regclass: "regclass",
|
|
2073
|
+
regtype: "regtype",
|
|
2074
|
+
regrole: "regrole",
|
|
2075
|
+
regnamespace: "regnamespace",
|
|
2076
|
+
regconfig: "regconfig",
|
|
2077
|
+
regdictionary: "regdictionary"
|
|
2078
|
+
},
|
|
2079
|
+
numeric: {
|
|
2080
|
+
smallint: "numeric",
|
|
2081
|
+
int: "numeric",
|
|
2082
|
+
bigint: "numeric",
|
|
2083
|
+
"bigint:number": "numeric",
|
|
2084
|
+
"bigint:string": "numeric",
|
|
2085
|
+
numeric: "numeric",
|
|
2086
|
+
"numeric:number": "numeric",
|
|
2087
|
+
"numeric:bigint": "numeric",
|
|
2088
|
+
float4: "float4",
|
|
2089
|
+
float8: "float8",
|
|
2090
|
+
smallserial: "numeric",
|
|
2091
|
+
serial: "numeric",
|
|
2092
|
+
bigserial: "numeric",
|
|
2093
|
+
"bigserial:number": "numeric"
|
|
2094
|
+
},
|
|
2095
|
+
"numeric:number": {
|
|
2096
|
+
smallint: "numeric:number",
|
|
2097
|
+
int: "numeric:number",
|
|
2098
|
+
bigint: "numeric:number",
|
|
2099
|
+
"bigint:number": "numeric:number",
|
|
2100
|
+
"bigint:string": "numeric:number",
|
|
2101
|
+
numeric: "numeric:number",
|
|
2102
|
+
"numeric:number": "numeric:number",
|
|
2103
|
+
"numeric:bigint": "numeric:number",
|
|
2104
|
+
float4: "float4",
|
|
2105
|
+
float8: "float8",
|
|
2106
|
+
smallserial: "numeric:number",
|
|
2107
|
+
serial: "numeric:number",
|
|
2108
|
+
bigserial: "numeric:number",
|
|
2109
|
+
"bigserial:number": "numeric:number"
|
|
2110
|
+
},
|
|
2111
|
+
"numeric:bigint": {
|
|
2112
|
+
smallint: "numeric:bigint",
|
|
2113
|
+
int: "numeric:bigint",
|
|
2114
|
+
bigint: "numeric:bigint",
|
|
2115
|
+
"bigint:number": "numeric:bigint",
|
|
2116
|
+
"bigint:string": "numeric:bigint",
|
|
2117
|
+
numeric: "numeric:bigint",
|
|
2118
|
+
"numeric:number": "numeric:bigint",
|
|
2119
|
+
"numeric:bigint": "numeric:bigint",
|
|
2120
|
+
float4: "float4",
|
|
2121
|
+
float8: "float8",
|
|
2122
|
+
smallserial: "numeric:bigint",
|
|
2123
|
+
serial: "numeric:bigint",
|
|
2124
|
+
bigserial: "numeric:bigint",
|
|
2125
|
+
"bigserial:number": "numeric:bigint"
|
|
2126
|
+
},
|
|
2127
|
+
float4: {
|
|
2128
|
+
smallint: "float4",
|
|
2129
|
+
int: "float4",
|
|
2130
|
+
bigint: "float4",
|
|
2131
|
+
"bigint:number": "float4",
|
|
2132
|
+
"bigint:string": "float4",
|
|
2133
|
+
numeric: "float4",
|
|
2134
|
+
"numeric:number": "float4",
|
|
2135
|
+
"numeric:bigint": "float4",
|
|
2136
|
+
float4: "float4",
|
|
2137
|
+
float8: "float8",
|
|
2138
|
+
smallserial: "float4",
|
|
2139
|
+
serial: "float4",
|
|
2140
|
+
bigserial: "float4",
|
|
2141
|
+
"bigserial:number": "float4"
|
|
2142
|
+
},
|
|
2143
|
+
float8: {
|
|
2144
|
+
smallint: "float8",
|
|
2145
|
+
int: "float8",
|
|
2146
|
+
bigint: "float8",
|
|
2147
|
+
"bigint:number": "float8",
|
|
2148
|
+
"bigint:string": "float8",
|
|
2149
|
+
numeric: "float8",
|
|
2150
|
+
"numeric:number": "float8",
|
|
2151
|
+
"numeric:bigint": "float8",
|
|
2152
|
+
float4: "float8",
|
|
2153
|
+
float8: "float8",
|
|
2154
|
+
smallserial: "float8",
|
|
2155
|
+
serial: "float8",
|
|
2156
|
+
bigserial: "float8",
|
|
2157
|
+
"bigserial:number": "float8"
|
|
2158
|
+
},
|
|
2159
|
+
money: { money: "money" },
|
|
2160
|
+
smallserial: {
|
|
2161
|
+
smallint: "smallint",
|
|
2162
|
+
int: "int",
|
|
2163
|
+
bigint: "bigint:number",
|
|
2164
|
+
"bigint:number": "bigint:number",
|
|
2165
|
+
"bigint:string": "bigint:number",
|
|
2166
|
+
numeric: "numeric:number",
|
|
2167
|
+
"numeric:number": "numeric:number",
|
|
2168
|
+
"numeric:bigint": "numeric:number",
|
|
2169
|
+
float4: "float4",
|
|
2170
|
+
float8: "float8",
|
|
2171
|
+
smallserial: "smallint",
|
|
2172
|
+
serial: "int",
|
|
2173
|
+
bigserial: "bigint:number",
|
|
2174
|
+
"bigserial:number": "bigint:number",
|
|
2175
|
+
oid: "oid",
|
|
2176
|
+
regproc: "regproc",
|
|
2177
|
+
regprocedure: "regprocedure",
|
|
2178
|
+
regoper: "regoper",
|
|
2179
|
+
regoperator: "regoperator",
|
|
2180
|
+
regclass: "regclass",
|
|
2181
|
+
regtype: "regtype",
|
|
2182
|
+
regrole: "regrole",
|
|
2183
|
+
regnamespace: "regnamespace",
|
|
2184
|
+
regconfig: "regconfig",
|
|
2185
|
+
regdictionary: "regdictionary"
|
|
2186
|
+
},
|
|
2187
|
+
serial: {
|
|
2188
|
+
smallint: "int",
|
|
2189
|
+
int: "int",
|
|
2190
|
+
bigint: "bigint:number",
|
|
2191
|
+
"bigint:number": "bigint:number",
|
|
2192
|
+
"bigint:string": "bigint:number",
|
|
2193
|
+
numeric: "numeric:number",
|
|
2194
|
+
"numeric:number": "numeric:number",
|
|
2195
|
+
"numeric:bigint": "numeric:number",
|
|
2196
|
+
float4: "float4",
|
|
2197
|
+
float8: "float8",
|
|
2198
|
+
smallserial: "int",
|
|
2199
|
+
serial: "int",
|
|
2200
|
+
bigserial: "bigint:number",
|
|
2201
|
+
"bigserial:number": "bigint:number",
|
|
2202
|
+
oid: "oid",
|
|
2203
|
+
regproc: "regproc",
|
|
2204
|
+
regprocedure: "regprocedure",
|
|
2205
|
+
regoper: "regoper",
|
|
2206
|
+
regoperator: "regoperator",
|
|
2207
|
+
regclass: "regclass",
|
|
2208
|
+
regtype: "regtype",
|
|
2209
|
+
regrole: "regrole",
|
|
2210
|
+
regnamespace: "regnamespace",
|
|
2211
|
+
regconfig: "regconfig",
|
|
2212
|
+
regdictionary: "regdictionary"
|
|
2213
|
+
},
|
|
2214
|
+
bigserial: {
|
|
2215
|
+
smallint: "bigint",
|
|
2216
|
+
int: "bigint",
|
|
2217
|
+
bigint: "bigint",
|
|
2218
|
+
"bigint:number": "bigint",
|
|
2219
|
+
"bigint:string": "bigint",
|
|
2220
|
+
numeric: "numeric:bigint",
|
|
2221
|
+
"numeric:number": "numeric:bigint",
|
|
2222
|
+
"numeric:bigint": "numeric:bigint",
|
|
2223
|
+
float4: "float4",
|
|
2224
|
+
float8: "float8",
|
|
2225
|
+
smallserial: "bigint",
|
|
2226
|
+
serial: "bigint",
|
|
2227
|
+
bigserial: "bigint",
|
|
2228
|
+
"bigserial:number": "bigint",
|
|
2229
|
+
oid: "oid",
|
|
2230
|
+
regproc: "regproc",
|
|
2231
|
+
regprocedure: "regprocedure",
|
|
2232
|
+
regoper: "regoper",
|
|
2233
|
+
regoperator: "regoperator",
|
|
2234
|
+
regclass: "regclass",
|
|
2235
|
+
regtype: "regtype",
|
|
2236
|
+
regrole: "regrole",
|
|
2237
|
+
regnamespace: "regnamespace",
|
|
2238
|
+
regconfig: "regconfig",
|
|
2239
|
+
regdictionary: "regdictionary"
|
|
2240
|
+
},
|
|
2241
|
+
"bigserial:number": {
|
|
2242
|
+
smallint: "bigint:number",
|
|
2243
|
+
int: "bigint:number",
|
|
2244
|
+
bigint: "bigint:number",
|
|
2245
|
+
"bigint:number": "bigint:number",
|
|
2246
|
+
"bigint:string": "bigint:number",
|
|
2247
|
+
numeric: "numeric:number",
|
|
2248
|
+
"numeric:number": "numeric:number",
|
|
2249
|
+
"numeric:bigint": "numeric:number",
|
|
2250
|
+
float4: "float4",
|
|
2251
|
+
float8: "float8",
|
|
2252
|
+
smallserial: "bigint:number",
|
|
2253
|
+
serial: "bigint:number",
|
|
2254
|
+
bigserial: "bigint:number",
|
|
2255
|
+
"bigserial:number": "bigint:number",
|
|
2256
|
+
oid: "oid",
|
|
2257
|
+
regproc: "regproc",
|
|
2258
|
+
regprocedure: "regprocedure",
|
|
2259
|
+
regoper: "regoper",
|
|
2260
|
+
regoperator: "regoperator",
|
|
2261
|
+
regclass: "regclass",
|
|
2262
|
+
regtype: "regtype",
|
|
2263
|
+
regrole: "regrole",
|
|
2264
|
+
regnamespace: "regnamespace",
|
|
2265
|
+
regconfig: "regconfig",
|
|
2266
|
+
regdictionary: "regdictionary"
|
|
2267
|
+
},
|
|
2268
|
+
char: {
|
|
2269
|
+
char: "char",
|
|
2270
|
+
varchar: "char",
|
|
2271
|
+
text: "char"
|
|
2272
|
+
},
|
|
2273
|
+
varchar: {
|
|
2274
|
+
char: "varchar",
|
|
2275
|
+
varchar: "varchar",
|
|
2276
|
+
text: "varchar"
|
|
2277
|
+
},
|
|
2278
|
+
text: {
|
|
2279
|
+
char: "text",
|
|
2280
|
+
varchar: "text",
|
|
2281
|
+
text: "text"
|
|
2282
|
+
},
|
|
2283
|
+
bytea: { bytea: "bytea" },
|
|
2284
|
+
date: {
|
|
2285
|
+
date: "date",
|
|
2286
|
+
"date:string": "date",
|
|
2287
|
+
timestamp: "timestamp",
|
|
2288
|
+
"timestamp:string": "timestamp",
|
|
2289
|
+
timestamptz: "timestamptz",
|
|
2290
|
+
"timestamptz:string": "timestamptz"
|
|
2291
|
+
},
|
|
2292
|
+
"date:string": {
|
|
2293
|
+
date: "date:string",
|
|
2294
|
+
"date:string": "date:string",
|
|
2295
|
+
timestamp: "timestamp:string",
|
|
2296
|
+
"timestamp:string": "timestamp:string",
|
|
2297
|
+
timestamptz: "timestamptz:string",
|
|
2298
|
+
"timestamptz:string": "timestamptz:string"
|
|
2299
|
+
},
|
|
2300
|
+
time: {
|
|
2301
|
+
time: "time",
|
|
2302
|
+
timetz: "timetz"
|
|
2303
|
+
},
|
|
2304
|
+
timetz: {
|
|
2305
|
+
time: "timetz",
|
|
2306
|
+
timetz: "timetz"
|
|
2307
|
+
},
|
|
2308
|
+
timestamp: {
|
|
2309
|
+
date: "timestamp",
|
|
2310
|
+
"date:string": "timestamp",
|
|
2311
|
+
timestamp: "timestamp",
|
|
2312
|
+
"timestamp:string": "timestamp",
|
|
2313
|
+
timestamptz: "timestamptz",
|
|
2314
|
+
"timestamptz:string": "timestamptz"
|
|
2315
|
+
},
|
|
2316
|
+
"timestamp:string": {
|
|
2317
|
+
date: "timestamp:string",
|
|
2318
|
+
"date:string": "timestamp:string",
|
|
2319
|
+
timestamp: "timestamp:string",
|
|
2320
|
+
"timestamp:string": "timestamp:string",
|
|
2321
|
+
timestamptz: "timestamptz:string",
|
|
2322
|
+
"timestamptz:string": "timestamptz:string"
|
|
2323
|
+
},
|
|
2324
|
+
timestamptz: {
|
|
2325
|
+
date: "timestamptz",
|
|
2326
|
+
"date:string": "timestamptz",
|
|
2327
|
+
timestamp: "timestamptz",
|
|
2328
|
+
"timestamp:string": "timestamptz",
|
|
2329
|
+
timestamptz: "timestamptz",
|
|
2330
|
+
"timestamptz:string": "timestamptz"
|
|
2331
|
+
},
|
|
2332
|
+
"timestamptz:string": {
|
|
2333
|
+
date: "timestamptz:string",
|
|
2334
|
+
"date:string": "timestamptz:string",
|
|
2335
|
+
timestamp: "timestamptz:string",
|
|
2336
|
+
"timestamp:string": "timestamptz:string",
|
|
2337
|
+
timestamptz: "timestamptz:string",
|
|
2338
|
+
"timestamptz:string": "timestamptz:string"
|
|
2339
|
+
},
|
|
2340
|
+
interval: {
|
|
2341
|
+
interval: "interval",
|
|
2342
|
+
"interval:tuple": "interval"
|
|
2343
|
+
},
|
|
2344
|
+
"interval:tuple": {
|
|
2345
|
+
interval: "interval:tuple",
|
|
2346
|
+
"interval:tuple": "interval:tuple"
|
|
2347
|
+
},
|
|
2348
|
+
bool: { bool: "bool" },
|
|
2349
|
+
enum: { enum: "enum" },
|
|
2350
|
+
point: {
|
|
2351
|
+
point: "point",
|
|
2352
|
+
"point:tuple": "point"
|
|
2353
|
+
},
|
|
2354
|
+
"point:tuple": {
|
|
2355
|
+
point: "point:tuple",
|
|
2356
|
+
"point:tuple": "point:tuple"
|
|
2357
|
+
},
|
|
2358
|
+
line: {
|
|
2359
|
+
line: "line",
|
|
2360
|
+
"line:tuple": "line"
|
|
2361
|
+
},
|
|
2362
|
+
"line:tuple": {
|
|
2363
|
+
line: "line:tuple",
|
|
2364
|
+
"line:tuple": "line:tuple"
|
|
2365
|
+
},
|
|
2366
|
+
lseg: { lseg: "lseg" },
|
|
2367
|
+
box: { box: "box" },
|
|
2368
|
+
path: { path: "path" },
|
|
2369
|
+
polygon: { polygon: "polygon" },
|
|
2370
|
+
circle: { circle: "circle" },
|
|
2371
|
+
cidr: {
|
|
2372
|
+
cidr: "cidr",
|
|
2373
|
+
inet: "inet"
|
|
2374
|
+
},
|
|
2375
|
+
inet: {
|
|
2376
|
+
cidr: "inet",
|
|
2377
|
+
inet: "inet"
|
|
2378
|
+
},
|
|
2379
|
+
macaddr: {
|
|
2380
|
+
macaddr: "macaddr",
|
|
2381
|
+
macaddr8: "macaddr"
|
|
2382
|
+
},
|
|
2383
|
+
macaddr8: {
|
|
2384
|
+
macaddr: "macaddr8",
|
|
2385
|
+
macaddr8: "macaddr8"
|
|
2386
|
+
},
|
|
2387
|
+
bit: {
|
|
2388
|
+
bit: "bit",
|
|
2389
|
+
varbit: "bit"
|
|
2390
|
+
},
|
|
2391
|
+
varbit: {
|
|
2392
|
+
bit: "varbit",
|
|
2393
|
+
varbit: "varbit"
|
|
2394
|
+
},
|
|
2395
|
+
tsvector: { tsvector: "tsvector" },
|
|
2396
|
+
tsquery: { tsquery: "tsquery" },
|
|
2397
|
+
uuid: { uuid: "uuid" },
|
|
2398
|
+
xml: { xml: "xml" },
|
|
2399
|
+
json: { json: "json" },
|
|
2400
|
+
jsonb: { jsonb: "jsonb" },
|
|
2401
|
+
int4range: { int4range: "int4range" },
|
|
2402
|
+
int8range: { int8range: "int8range" },
|
|
2403
|
+
numrange: { numrange: "numrange" },
|
|
2404
|
+
tsrange: { tsrange: "tsrange" },
|
|
2405
|
+
tstzrange: { tstzrange: "tstzrange" },
|
|
2406
|
+
daterange: { daterange: "daterange" },
|
|
2407
|
+
int4multirange: { int4multirange: "int4multirange" },
|
|
2408
|
+
int8multirange: { int8multirange: "int8multirange" },
|
|
2409
|
+
nummultirange: { nummultirange: "nummultirange" },
|
|
2410
|
+
tsmultirange: { tsmultirange: "tsmultirange" },
|
|
2411
|
+
tstzmultirange: { tstzmultirange: "tstzmultirange" },
|
|
2412
|
+
datemultirange: { datemultirange: "datemultirange" },
|
|
2413
|
+
oid: {
|
|
2414
|
+
smallint: "oid",
|
|
2415
|
+
int: "oid",
|
|
2416
|
+
bigint: "oid",
|
|
2417
|
+
"bigint:number": "oid",
|
|
2418
|
+
"bigint:string": "oid",
|
|
2419
|
+
smallserial: "oid",
|
|
2420
|
+
serial: "oid",
|
|
2421
|
+
bigserial: "oid",
|
|
2422
|
+
"bigserial:number": "oid",
|
|
2423
|
+
oid: "oid",
|
|
2424
|
+
regproc: "oid",
|
|
2425
|
+
regprocedure: "oid",
|
|
2426
|
+
regoper: "oid",
|
|
2427
|
+
regoperator: "oid",
|
|
2428
|
+
regclass: "oid",
|
|
2429
|
+
regtype: "oid",
|
|
2430
|
+
regrole: "oid",
|
|
2431
|
+
regnamespace: "oid",
|
|
2432
|
+
regconfig: "oid",
|
|
2433
|
+
regdictionary: "oid"
|
|
2434
|
+
},
|
|
2435
|
+
regproc: {
|
|
2436
|
+
smallint: "regproc",
|
|
2437
|
+
int: "regproc",
|
|
2438
|
+
bigint: "regproc",
|
|
2439
|
+
"bigint:number": "regproc",
|
|
2440
|
+
"bigint:string": "regproc",
|
|
2441
|
+
smallserial: "regproc",
|
|
2442
|
+
serial: "regproc",
|
|
2443
|
+
bigserial: "regproc",
|
|
2444
|
+
"bigserial:number": "regproc",
|
|
2445
|
+
oid: "regproc",
|
|
2446
|
+
regproc: "regproc",
|
|
2447
|
+
regprocedure: "regproc"
|
|
2448
|
+
},
|
|
2449
|
+
regprocedure: {
|
|
2450
|
+
smallint: "regprocedure",
|
|
2451
|
+
int: "regprocedure",
|
|
2452
|
+
bigint: "regprocedure",
|
|
2453
|
+
"bigint:number": "regprocedure",
|
|
2454
|
+
"bigint:string": "regprocedure",
|
|
2455
|
+
smallserial: "regprocedure",
|
|
2456
|
+
serial: "regprocedure",
|
|
2457
|
+
bigserial: "regprocedure",
|
|
2458
|
+
"bigserial:number": "regprocedure",
|
|
2459
|
+
oid: "regprocedure",
|
|
2460
|
+
regproc: "regprocedure",
|
|
2461
|
+
regprocedure: "regprocedure"
|
|
2462
|
+
},
|
|
2463
|
+
regoper: {
|
|
2464
|
+
smallint: "regoper",
|
|
2465
|
+
int: "regoper",
|
|
2466
|
+
bigint: "regoper",
|
|
2467
|
+
"bigint:number": "regoper",
|
|
2468
|
+
"bigint:string": "regoper",
|
|
2469
|
+
smallserial: "regoper",
|
|
2470
|
+
serial: "regoper",
|
|
2471
|
+
bigserial: "regoper",
|
|
2472
|
+
"bigserial:number": "regoper",
|
|
2473
|
+
oid: "regoper",
|
|
2474
|
+
regoper: "regoper",
|
|
2475
|
+
regoperator: "regoper"
|
|
2476
|
+
},
|
|
2477
|
+
regoperator: {
|
|
2478
|
+
smallint: "regoperator",
|
|
2479
|
+
int: "regoperator",
|
|
2480
|
+
bigint: "regoperator",
|
|
2481
|
+
"bigint:number": "regoperator",
|
|
2482
|
+
"bigint:string": "regoperator",
|
|
2483
|
+
smallserial: "regoperator",
|
|
2484
|
+
serial: "regoperator",
|
|
2485
|
+
bigserial: "regoperator",
|
|
2486
|
+
"bigserial:number": "regoperator",
|
|
2487
|
+
oid: "regoperator",
|
|
2488
|
+
regoper: "regoperator",
|
|
2489
|
+
regoperator: "regoperator"
|
|
2490
|
+
},
|
|
2491
|
+
regclass: {
|
|
2492
|
+
smallint: "regclass",
|
|
2493
|
+
int: "regclass",
|
|
2494
|
+
bigint: "regclass",
|
|
2495
|
+
"bigint:number": "regclass",
|
|
2496
|
+
"bigint:string": "regclass",
|
|
2497
|
+
smallserial: "regclass",
|
|
2498
|
+
serial: "regclass",
|
|
2499
|
+
bigserial: "regclass",
|
|
2500
|
+
"bigserial:number": "regclass",
|
|
2501
|
+
oid: "regclass",
|
|
2502
|
+
regclass: "regclass"
|
|
2503
|
+
},
|
|
2504
|
+
regtype: {
|
|
2505
|
+
smallint: "regtype",
|
|
2506
|
+
int: "regtype",
|
|
2507
|
+
bigint: "regtype",
|
|
2508
|
+
"bigint:number": "regtype",
|
|
2509
|
+
"bigint:string": "regtype",
|
|
2510
|
+
smallserial: "regtype",
|
|
2511
|
+
serial: "regtype",
|
|
2512
|
+
bigserial: "regtype",
|
|
2513
|
+
"bigserial:number": "regtype",
|
|
2514
|
+
oid: "regtype",
|
|
2515
|
+
regtype: "regtype"
|
|
2516
|
+
},
|
|
2517
|
+
regrole: {
|
|
2518
|
+
smallint: "regrole",
|
|
2519
|
+
int: "regrole",
|
|
2520
|
+
bigint: "regrole",
|
|
2521
|
+
"bigint:number": "regrole",
|
|
2522
|
+
"bigint:string": "regrole",
|
|
2523
|
+
smallserial: "regrole",
|
|
2524
|
+
serial: "regrole",
|
|
2525
|
+
bigserial: "regrole",
|
|
2526
|
+
"bigserial:number": "regrole",
|
|
2527
|
+
oid: "regrole",
|
|
2528
|
+
regrole: "regrole"
|
|
2529
|
+
},
|
|
2530
|
+
regnamespace: {
|
|
2531
|
+
smallint: "regnamespace",
|
|
2532
|
+
int: "regnamespace",
|
|
2533
|
+
bigint: "regnamespace",
|
|
2534
|
+
"bigint:number": "regnamespace",
|
|
2535
|
+
"bigint:string": "regnamespace",
|
|
2536
|
+
smallserial: "regnamespace",
|
|
2537
|
+
serial: "regnamespace",
|
|
2538
|
+
bigserial: "regnamespace",
|
|
2539
|
+
"bigserial:number": "regnamespace",
|
|
2540
|
+
oid: "regnamespace",
|
|
2541
|
+
regnamespace: "regnamespace"
|
|
2542
|
+
},
|
|
2543
|
+
regconfig: {
|
|
2544
|
+
smallint: "regconfig",
|
|
2545
|
+
int: "regconfig",
|
|
2546
|
+
bigint: "regconfig",
|
|
2547
|
+
"bigint:number": "regconfig",
|
|
2548
|
+
"bigint:string": "regconfig",
|
|
2549
|
+
smallserial: "regconfig",
|
|
2550
|
+
serial: "regconfig",
|
|
2551
|
+
bigserial: "regconfig",
|
|
2552
|
+
"bigserial:number": "regconfig",
|
|
2553
|
+
oid: "regconfig",
|
|
2554
|
+
regconfig: "regconfig"
|
|
2555
|
+
},
|
|
2556
|
+
regdictionary: {
|
|
2557
|
+
smallint: "regdictionary",
|
|
2558
|
+
int: "regdictionary",
|
|
2559
|
+
bigint: "regdictionary",
|
|
2560
|
+
"bigint:number": "regdictionary",
|
|
2561
|
+
"bigint:string": "regdictionary",
|
|
2562
|
+
smallserial: "regdictionary",
|
|
2563
|
+
serial: "regdictionary",
|
|
2564
|
+
bigserial: "regdictionary",
|
|
2565
|
+
"bigserial:number": "regdictionary",
|
|
2566
|
+
oid: "regdictionary",
|
|
2567
|
+
regdictionary: "regdictionary"
|
|
2568
|
+
}
|
|
2205
2569
|
};
|
|
2206
|
-
function resolvePgTypeAlias(type) {
|
|
2207
|
-
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
2208
|
-
}
|
|
2209
2570
|
var castToText = (name2) => sql`${name2}::text`;
|
|
2210
2571
|
var castToTextArr = (name2, arrayDimensions) => sql`${name2}::text${sql.raw("[]".repeat(arrayDimensions))}`;
|
|
2211
2572
|
var arrayCompatCast = (cast) => (name2, arrayDimensions) => {
|
|
@@ -2459,57 +2820,368 @@ var genericPgCodecs = {
|
|
|
2459
2820
|
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
2460
2821
|
}
|
|
2461
2822
|
};
|
|
2462
|
-
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
2823
|
+
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
2824
|
+
|
|
2825
|
+
// node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
2826
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
2827
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
2828
|
+
constructor(name2, fieldConfig, customTypeParams) {
|
|
2829
|
+
super(name2, "custom", "PgCustomColumn");
|
|
2830
|
+
this.config.fieldConfig = fieldConfig;
|
|
2831
|
+
this.config.customTypeParams = customTypeParams;
|
|
2832
|
+
}
|
|
2833
|
+
build(table) {
|
|
2834
|
+
return new PgCustomColumn(table, this.config);
|
|
2835
|
+
}
|
|
2836
|
+
};
|
|
2837
|
+
var PgCustomColumn = class extends PgColumn {
|
|
2838
|
+
static [entityKind] = "PgCustomColumn";
|
|
2839
|
+
codec;
|
|
2840
|
+
sqlName;
|
|
2841
|
+
mapFromJsonValue;
|
|
2842
|
+
jsonSelectIdentifier;
|
|
2843
|
+
constructor(table, config) {
|
|
2844
|
+
super(table, config);
|
|
2845
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
2846
|
+
this.mapToDriverValue = config.customTypeParams.toDriver ?? this.mapToDriverValue;
|
|
2847
|
+
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
2848
|
+
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
2849
|
+
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
2850
|
+
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
2851
|
+
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
2852
|
+
if (this.dimensions && config.customTypeParams.fromJson)
|
|
2853
|
+
this.mapFromJsonValue = (value) => {
|
|
2854
|
+
if (value === null)
|
|
2855
|
+
return value;
|
|
2856
|
+
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
2857
|
+
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
mapJsonArrayElements(value, mapper, depth) {
|
|
2861
|
+
if (depth > 0 && Array.isArray(value))
|
|
2862
|
+
return value.map((v) => v === null ? null : this.mapJsonArrayElements(v, mapper, depth - 1));
|
|
2863
|
+
return mapper(value);
|
|
2864
|
+
}
|
|
2865
|
+
getSQLType() {
|
|
2866
|
+
return this.sqlName;
|
|
2867
|
+
}
|
|
2868
|
+
};
|
|
2869
|
+
function customType(customTypeParams) {
|
|
2870
|
+
return (a, b) => {
|
|
2871
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2872
|
+
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
2873
|
+
};
|
|
2874
|
+
}
|
|
2875
|
+
// node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
2876
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
2877
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
2878
|
+
constructor(name2) {
|
|
2879
|
+
super(name2, "number double", "PgDoublePrecision");
|
|
2880
|
+
}
|
|
2881
|
+
build(table) {
|
|
2882
|
+
return new PgDoublePrecision(table, this.config);
|
|
2883
|
+
}
|
|
2884
|
+
};
|
|
2885
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
2886
|
+
static [entityKind] = "PgDoublePrecision";
|
|
2887
|
+
codec = "float8";
|
|
2888
|
+
getSQLType() {
|
|
2889
|
+
return "double precision";
|
|
2890
|
+
}
|
|
2891
|
+
};
|
|
2892
|
+
function doublePrecision(name2) {
|
|
2893
|
+
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
2894
|
+
}
|
|
2895
|
+
// node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
2896
|
+
var PgIntegerBuilder = class extends PgIntColumnBuilder {
|
|
2897
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
2898
|
+
constructor(name2) {
|
|
2899
|
+
super(name2, "number int32", "PgInteger");
|
|
2900
|
+
}
|
|
2901
|
+
build(table) {
|
|
2902
|
+
return new PgInteger(table, this.config);
|
|
2903
|
+
}
|
|
2904
|
+
};
|
|
2905
|
+
var PgInteger = class extends PgColumn {
|
|
2906
|
+
static [entityKind] = "PgInteger";
|
|
2907
|
+
codec = "int";
|
|
2908
|
+
getSQLType() {
|
|
2909
|
+
return "integer";
|
|
2910
|
+
}
|
|
2911
|
+
};
|
|
2912
|
+
function integer(name2) {
|
|
2913
|
+
return new PgIntegerBuilder(name2 ?? "");
|
|
2914
|
+
}
|
|
2915
|
+
// node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
2916
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
2917
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
2918
|
+
constructor(name2) {
|
|
2919
|
+
super(name2, "object json", "PgJsonb");
|
|
2920
|
+
}
|
|
2921
|
+
build(table) {
|
|
2922
|
+
return new PgJsonb(table, this.config);
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
var PgJsonb = class extends PgColumn {
|
|
2926
|
+
static [entityKind] = "PgJsonb";
|
|
2927
|
+
codec = "jsonb";
|
|
2928
|
+
constructor(table, config) {
|
|
2929
|
+
super(table, config);
|
|
2930
|
+
}
|
|
2931
|
+
getSQLType() {
|
|
2932
|
+
return "jsonb";
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
function jsonb(name2) {
|
|
2936
|
+
return new PgJsonbBuilder(name2 ?? "");
|
|
2937
|
+
}
|
|
2938
|
+
// node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
2939
|
+
var PgSmallIntBuilder = class extends PgIntColumnBuilder {
|
|
2940
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
2941
|
+
constructor(name2) {
|
|
2942
|
+
super(name2, "number int16", "PgSmallInt");
|
|
2943
|
+
}
|
|
2944
|
+
build(table) {
|
|
2945
|
+
return new PgSmallInt(table, this.config);
|
|
2946
|
+
}
|
|
2947
|
+
};
|
|
2948
|
+
var PgSmallInt = class extends PgColumn {
|
|
2949
|
+
static [entityKind] = "PgSmallInt";
|
|
2950
|
+
codec = "smallint";
|
|
2951
|
+
getSQLType() {
|
|
2952
|
+
return "smallint";
|
|
2953
|
+
}
|
|
2954
|
+
};
|
|
2955
|
+
function smallint(name2) {
|
|
2956
|
+
return new PgSmallIntBuilder(name2 ?? "");
|
|
2957
|
+
}
|
|
2958
|
+
// node_modules/drizzle-orm/pg-core/columns/text.js
|
|
2959
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
2960
|
+
static [entityKind] = "PgTextBuilder";
|
|
2961
|
+
constructor(name2, config) {
|
|
2962
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
2963
|
+
this.config.enumValues = config.enum;
|
|
2964
|
+
}
|
|
2965
|
+
build(table) {
|
|
2966
|
+
return new PgText(table, this.config, this.config.enumValues);
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
var PgText = class extends PgColumn {
|
|
2970
|
+
static [entityKind] = "PgText";
|
|
2971
|
+
enumValues;
|
|
2972
|
+
codec = "text";
|
|
2973
|
+
constructor(table, config, enumValues) {
|
|
2974
|
+
super(table, config);
|
|
2975
|
+
this.enumValues = enumValues;
|
|
2976
|
+
}
|
|
2977
|
+
getSQLType() {
|
|
2978
|
+
return "text";
|
|
2979
|
+
}
|
|
2980
|
+
};
|
|
2981
|
+
function text(a, b = {}) {
|
|
2982
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2983
|
+
return new PgTextBuilder(name2, config);
|
|
2984
|
+
}
|
|
2985
|
+
// node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
2986
|
+
var PgDateColumnBuilder = class extends PgColumnBuilder {
|
|
2987
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
2988
|
+
defaultNow() {
|
|
2989
|
+
return this.default(sql`now()`);
|
|
2990
|
+
}
|
|
2991
|
+
};
|
|
2992
|
+
|
|
2993
|
+
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
2994
|
+
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
2995
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
2996
|
+
constructor(name2, withTimezone, precision) {
|
|
2997
|
+
super(name2, "object date", "PgTimestamp");
|
|
2998
|
+
this.config.withTimezone = withTimezone;
|
|
2999
|
+
this.config.precision = precision;
|
|
3000
|
+
}
|
|
3001
|
+
build(table) {
|
|
3002
|
+
return new PgTimestamp(table, this.config);
|
|
3003
|
+
}
|
|
3004
|
+
};
|
|
3005
|
+
var PgTimestamp = class extends PgColumn {
|
|
3006
|
+
static [entityKind] = "PgTimestamp";
|
|
3007
|
+
codec;
|
|
3008
|
+
withTimezone;
|
|
3009
|
+
precision;
|
|
3010
|
+
constructor(table, config) {
|
|
3011
|
+
super(table, config);
|
|
3012
|
+
this.withTimezone = config.withTimezone;
|
|
3013
|
+
this.precision = config.precision;
|
|
3014
|
+
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
3015
|
+
}
|
|
3016
|
+
getSQLType() {
|
|
3017
|
+
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
3018
|
+
}
|
|
3019
|
+
mapToDriverValue = (value) => {
|
|
3020
|
+
if (typeof value === "string")
|
|
3021
|
+
return value;
|
|
3022
|
+
return value.toISOString();
|
|
3023
|
+
};
|
|
3024
|
+
};
|
|
3025
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
3026
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
3027
|
+
constructor(name2, withTimezone, precision) {
|
|
3028
|
+
super(name2, "string timestamp", "PgTimestampString");
|
|
3029
|
+
this.config.withTimezone = withTimezone;
|
|
3030
|
+
this.config.precision = precision;
|
|
3031
|
+
}
|
|
3032
|
+
build(table) {
|
|
3033
|
+
return new PgTimestampString(table, this.config);
|
|
3034
|
+
}
|
|
3035
|
+
};
|
|
3036
|
+
var PgTimestampString = class extends PgColumn {
|
|
3037
|
+
static [entityKind] = "PgTimestampString";
|
|
3038
|
+
codec;
|
|
3039
|
+
withTimezone;
|
|
3040
|
+
precision;
|
|
3041
|
+
constructor(table, config) {
|
|
3042
|
+
super(table, config);
|
|
3043
|
+
this.withTimezone = config.withTimezone;
|
|
3044
|
+
this.precision = config.precision;
|
|
3045
|
+
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
3046
|
+
}
|
|
3047
|
+
getSQLType() {
|
|
3048
|
+
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
3049
|
+
}
|
|
3050
|
+
mapToDriverValue = (value) => {
|
|
3051
|
+
if (typeof value === "string")
|
|
3052
|
+
return value;
|
|
3053
|
+
return value.toISOString();
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3056
|
+
function timestamp(a, b = {}) {
|
|
3057
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3058
|
+
if (config?.mode === "string")
|
|
3059
|
+
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
3060
|
+
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
3061
|
+
}
|
|
3062
|
+
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
3063
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
3064
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
3065
|
+
constructor(name2, config) {
|
|
3066
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
3067
|
+
this.config.length = config.length;
|
|
3068
|
+
this.config.enumValues = config.enum;
|
|
3069
|
+
}
|
|
3070
|
+
build(table) {
|
|
3071
|
+
return new PgVarchar(table, this.config);
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
var PgVarchar = class extends PgColumn {
|
|
3075
|
+
static [entityKind] = "PgVarchar";
|
|
3076
|
+
codec = "varchar";
|
|
3077
|
+
enumValues;
|
|
3078
|
+
constructor(table, config) {
|
|
3079
|
+
super(table, config);
|
|
3080
|
+
this.enumValues = config.enumValues;
|
|
3081
|
+
}
|
|
3082
|
+
getSQLType() {
|
|
3083
|
+
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
function varchar(a, b = {}) {
|
|
3087
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3088
|
+
return new PgVarcharBuilder(name2, config);
|
|
3089
|
+
}
|
|
3090
|
+
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
3091
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
3092
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
3093
|
+
constructor(name2) {
|
|
3094
|
+
super(name2, "number int53", "PgBigSerial53");
|
|
3095
|
+
this.config.hasDefault = true;
|
|
3096
|
+
this.config.notNull = true;
|
|
3097
|
+
}
|
|
3098
|
+
build(table) {
|
|
3099
|
+
return new PgBigSerial53(table, this.config);
|
|
3100
|
+
}
|
|
3101
|
+
};
|
|
3102
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
3103
|
+
static [entityKind] = "PgBigSerial53";
|
|
3104
|
+
codec = "bigserial:number";
|
|
3105
|
+
getSQLType() {
|
|
3106
|
+
return "bigserial";
|
|
3107
|
+
}
|
|
3108
|
+
};
|
|
3109
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
3110
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
3111
|
+
constructor(name2) {
|
|
3112
|
+
super(name2, "bigint int64", "PgBigSerial64");
|
|
3113
|
+
this.config.hasDefault = true;
|
|
3114
|
+
this.config.notNull = true;
|
|
3115
|
+
}
|
|
3116
|
+
build(table) {
|
|
3117
|
+
return new PgBigSerial64(table, this.config);
|
|
3118
|
+
}
|
|
3119
|
+
};
|
|
3120
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
3121
|
+
static [entityKind] = "PgBigSerial64";
|
|
3122
|
+
codec = "bigserial";
|
|
3123
|
+
getSQLType() {
|
|
3124
|
+
return "bigserial";
|
|
3125
|
+
}
|
|
3126
|
+
};
|
|
3127
|
+
function bigserial(a, b) {
|
|
3128
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3129
|
+
if (config.mode === "number")
|
|
3130
|
+
return new PgBigSerial53Builder(name2);
|
|
3131
|
+
return new PgBigSerial64Builder(name2);
|
|
3132
|
+
}
|
|
2463
3133
|
|
|
2464
|
-
// node_modules/drizzle-orm/pg-core/columns/
|
|
2465
|
-
var
|
|
2466
|
-
static [entityKind] = "
|
|
2467
|
-
constructor(name2,
|
|
2468
|
-
super(name2, "
|
|
2469
|
-
this.config.
|
|
2470
|
-
this.config.
|
|
3134
|
+
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
3135
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
3136
|
+
static [entityKind] = "PgCharBuilder";
|
|
3137
|
+
constructor(name2, config) {
|
|
3138
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
3139
|
+
this.config.length = config.length ?? 1;
|
|
3140
|
+
this.config.setLength = config.length !== undefined;
|
|
3141
|
+
this.config.enumValues = config.enum;
|
|
2471
3142
|
}
|
|
2472
3143
|
build(table) {
|
|
2473
|
-
return new
|
|
3144
|
+
return new PgChar(table, this.config);
|
|
2474
3145
|
}
|
|
2475
3146
|
};
|
|
2476
|
-
var
|
|
2477
|
-
static [entityKind] = "
|
|
2478
|
-
codec;
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
jsonSelectIdentifier;
|
|
3147
|
+
var PgChar = class extends PgColumn {
|
|
3148
|
+
static [entityKind] = "PgChar";
|
|
3149
|
+
codec = "char";
|
|
3150
|
+
enumValues;
|
|
3151
|
+
setLength;
|
|
2482
3152
|
constructor(table, config) {
|
|
2483
3153
|
super(table, config);
|
|
2484
|
-
this.
|
|
2485
|
-
this.
|
|
2486
|
-
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
2487
|
-
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
2488
|
-
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
2489
|
-
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
2490
|
-
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
2491
|
-
if (this.dimensions && config.customTypeParams.fromJson)
|
|
2492
|
-
this.mapFromJsonValue = (value) => {
|
|
2493
|
-
if (value === null)
|
|
2494
|
-
return value;
|
|
2495
|
-
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
2496
|
-
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
2497
|
-
};
|
|
3154
|
+
this.enumValues = config.enumValues;
|
|
3155
|
+
this.setLength = config.setLength;
|
|
2498
3156
|
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
3157
|
+
getSQLType() {
|
|
3158
|
+
return this.setLength ? `char(${this.length})` : `char`;
|
|
3159
|
+
}
|
|
3160
|
+
};
|
|
3161
|
+
function char(a, b = {}) {
|
|
3162
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3163
|
+
return new PgCharBuilder(name2, config);
|
|
3164
|
+
}
|
|
3165
|
+
|
|
3166
|
+
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
3167
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
3168
|
+
static [entityKind] = "PgCidrBuilder";
|
|
3169
|
+
constructor(name2) {
|
|
3170
|
+
super(name2, "string cidr", "PgCidr");
|
|
2503
3171
|
}
|
|
3172
|
+
build(table) {
|
|
3173
|
+
return new PgCidr(table, this.config);
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
var PgCidr = class extends PgColumn {
|
|
3177
|
+
static [entityKind] = "PgCidr";
|
|
3178
|
+
codec = "cidr";
|
|
2504
3179
|
getSQLType() {
|
|
2505
|
-
return
|
|
3180
|
+
return "cidr";
|
|
2506
3181
|
}
|
|
2507
3182
|
};
|
|
2508
|
-
function
|
|
2509
|
-
return (
|
|
2510
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2511
|
-
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
2512
|
-
};
|
|
3183
|
+
function cidr(name2) {
|
|
3184
|
+
return new PgCidrBuilder(name2 ?? "");
|
|
2513
3185
|
}
|
|
2514
3186
|
|
|
2515
3187
|
// node_modules/drizzle-orm/pg-core/columns/date.js
|
|
@@ -8523,12 +9195,12 @@ async function hashQuery(sql2, params) {
|
|
|
8523
9195
|
var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
8524
9196
|
static [entityKind] = "PgCountBuilder";
|
|
8525
9197
|
dialect;
|
|
8526
|
-
static
|
|
9198
|
+
static buildCount(source, filters, parens) {
|
|
8527
9199
|
const query = sql`select count(*) from ${source}${sql` where ${filters}`.if(filters)}`;
|
|
8528
9200
|
return parens ? sql`(${query})` : query;
|
|
8529
9201
|
}
|
|
8530
9202
|
constructor(countConfig) {
|
|
8531
|
-
super(PgCountBuilder2.
|
|
9203
|
+
super(PgCountBuilder2.buildCount(countConfig.source, countConfig.filters, true).queryChunks);
|
|
8532
9204
|
this.countConfig = countConfig;
|
|
8533
9205
|
this.dialect = countConfig.dialect;
|
|
8534
9206
|
this.mapWith((e) => {
|
|
@@ -8537,10 +9209,13 @@ var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
|
8537
9209
|
return Number(e ?? 0);
|
|
8538
9210
|
});
|
|
8539
9211
|
}
|
|
9212
|
+
executableSql;
|
|
8540
9213
|
build() {
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
9214
|
+
if (!this.executableSql) {
|
|
9215
|
+
const { source, filters } = this.countConfig;
|
|
9216
|
+
this.executableSql = PgCountBuilder2.buildCount(source, filters);
|
|
9217
|
+
}
|
|
9218
|
+
return this.dialect.sqlToQuery(this.executableSql);
|
|
8544
9219
|
}
|
|
8545
9220
|
};
|
|
8546
9221
|
|
|
@@ -8792,7 +9467,6 @@ var SelectionProxyHandler = class SelectionProxyHandler2 {
|
|
|
8792
9467
|
var PgDeleteBase2 = class {
|
|
8793
9468
|
static [entityKind] = "PgDelete";
|
|
8794
9469
|
config;
|
|
8795
|
-
cacheConfig;
|
|
8796
9470
|
constructor(table, session, dialect, withList) {
|
|
8797
9471
|
this.session = session;
|
|
8798
9472
|
this.dialect = dialect;
|
|
@@ -8840,7 +9514,7 @@ var PgDeleteBase2 = class {
|
|
|
8840
9514
|
var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
8841
9515
|
static [entityKind] = "PgAsyncDelete";
|
|
8842
9516
|
_prepare(name2, generateName = false) {
|
|
8843
|
-
const { session, config, dialect
|
|
9517
|
+
const { session, config, dialect } = this;
|
|
8844
9518
|
const { returning: fields } = config;
|
|
8845
9519
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
8846
9520
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -8848,7 +9522,7 @@ var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
|
8848
9522
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
8849
9523
|
type: "delete",
|
|
8850
9524
|
tables: [...extractUsedTable(this.config.table)]
|
|
8851
|
-
}
|
|
9525
|
+
});
|
|
8852
9526
|
});
|
|
8853
9527
|
}
|
|
8854
9528
|
prepare(name2) {
|
|
@@ -8895,7 +9569,6 @@ var PgSelectBuilder2 = class {
|
|
|
8895
9569
|
if (config.withList)
|
|
8896
9570
|
this.withList = config.withList;
|
|
8897
9571
|
this.distinct = config.distinct;
|
|
8898
|
-
this.tagged = config.tagged;
|
|
8899
9572
|
}
|
|
8900
9573
|
from(source) {
|
|
8901
9574
|
const isPartialSelect = !!this.fields;
|
|
@@ -8918,8 +9591,7 @@ var PgSelectBuilder2 = class {
|
|
|
8918
9591
|
session: this.session,
|
|
8919
9592
|
dialect: this.dialect,
|
|
8920
9593
|
withList: this.withList,
|
|
8921
|
-
distinct: this.distinct
|
|
8922
|
-
tagged: this.tagged
|
|
9594
|
+
distinct: this.distinct
|
|
8923
9595
|
});
|
|
8924
9596
|
}
|
|
8925
9597
|
};
|
|
@@ -8943,8 +9615,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
8943
9615
|
table: config.table,
|
|
8944
9616
|
fields: { ...config.fields },
|
|
8945
9617
|
distinct: config.distinct,
|
|
8946
|
-
setOperators: []
|
|
8947
|
-
_tagged: config.tagged
|
|
9618
|
+
setOperators: []
|
|
8948
9619
|
};
|
|
8949
9620
|
this.isPartialSelect = config.isPartialSelect;
|
|
8950
9621
|
this._ = {
|
|
@@ -9121,6 +9792,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
9121
9792
|
return this;
|
|
9122
9793
|
}
|
|
9123
9794
|
getSQL() {
|
|
9795
|
+
this.config.fieldsFlat = orderSelectedFields2(this.config.fields, undefined, this.dialect.codecs);
|
|
9124
9796
|
return this.dialect.buildSelectQuery(this.config);
|
|
9125
9797
|
}
|
|
9126
9798
|
toSQL() {
|
|
@@ -9216,7 +9888,6 @@ params: ${params}`);
|
|
|
9216
9888
|
this.cause = cause;
|
|
9217
9889
|
}
|
|
9218
9890
|
};
|
|
9219
|
-
|
|
9220
9891
|
// node_modules/drizzle-orm/relations.js
|
|
9221
9892
|
var Relation2 = class {
|
|
9222
9893
|
static [entityKind] = "RelationV2";
|
|
@@ -9297,15 +9968,13 @@ var orderByOperators2 = {
|
|
|
9297
9968
|
asc,
|
|
9298
9969
|
desc
|
|
9299
9970
|
};
|
|
9300
|
-
function mapRelationalRow2(rows, isOne, buildQueryResultSelection,
|
|
9971
|
+
function mapRelationalRow2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false, useJsonMappers = true) {
|
|
9301
9972
|
const maxIdx = isOne ? 1 : rows.length;
|
|
9302
9973
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
9303
9974
|
let decoder;
|
|
9304
|
-
if (is(field, Column))
|
|
9305
|
-
if (useJsonMappers && field.mapFromJsonValue)
|
|
9306
|
-
return (v2) => field.mapFromJsonValue(v2);
|
|
9975
|
+
if (is(field, Column))
|
|
9307
9976
|
decoder = field;
|
|
9308
|
-
|
|
9977
|
+
else if (is(field, SQL))
|
|
9309
9978
|
decoder = field.decoder;
|
|
9310
9979
|
else if (is(field, SQL.Aliased))
|
|
9311
9980
|
decoder = field.sql.decoder;
|
|
@@ -9313,6 +9982,8 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9313
9982
|
decoder = noopDecoder;
|
|
9314
9983
|
else
|
|
9315
9984
|
decoder = field.getSQL().decoder;
|
|
9985
|
+
if (useJsonMappers && field.mapFromJsonValue)
|
|
9986
|
+
return (v2) => field.mapFromJsonValue(v2);
|
|
9316
9987
|
return decoder.mapFromDriverValue.isNoop ? codec ? (value) => codec(value, arrayDimensions) : undefined : codec ? (value) => decoder.mapFromDriverValue(codec(value, arrayDimensions)) : (value) => decoder.mapFromDriverValue(value);
|
|
9317
9988
|
});
|
|
9318
9989
|
for (let i = 0;i < maxIdx; ++i) {
|
|
@@ -9329,14 +10000,12 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9329
10000
|
} else if (parseJsonIfString && typeof row[selectionItem.key] === "string")
|
|
9330
10001
|
row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
9331
10002
|
if (selectionItem.isArray) {
|
|
9332
|
-
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection,
|
|
10003
|
+
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection, false, parseJsonIfString);
|
|
9333
10004
|
continue;
|
|
9334
10005
|
}
|
|
9335
|
-
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection,
|
|
10006
|
+
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection, false, parseJsonIfString);
|
|
9336
10007
|
continue;
|
|
9337
10008
|
}
|
|
9338
|
-
if (mapColumnValue)
|
|
9339
|
-
row[selectionItem.key] = mapColumnValue(row[selectionItem.key]);
|
|
9340
10009
|
if (row[selectionItem.key] === null)
|
|
9341
10010
|
continue;
|
|
9342
10011
|
const decoder = decoders[selectionItemIdx];
|
|
@@ -9347,7 +10016,7 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9347
10016
|
}
|
|
9348
10017
|
return rows;
|
|
9349
10018
|
}
|
|
9350
|
-
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection,
|
|
10019
|
+
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false) {
|
|
9351
10020
|
const maxIdx = isOne ? 1 : rows.length;
|
|
9352
10021
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
9353
10022
|
let decoder;
|
|
@@ -9384,14 +10053,12 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
9384
10053
|
} else if (parseJsonIfString && typeof value === "string")
|
|
9385
10054
|
value = JSON.parse(value);
|
|
9386
10055
|
if (selectionItem.isArray)
|
|
9387
|
-
mapRelationalRow2(value, false, selectionItem.selection,
|
|
10056
|
+
mapRelationalRow2(value, false, selectionItem.selection, false, parseJsonIfString);
|
|
9388
10057
|
else
|
|
9389
|
-
mapRelationalRow2(value, true, selectionItem.selection,
|
|
10058
|
+
mapRelationalRow2(value, true, selectionItem.selection, false, parseJsonIfString);
|
|
9390
10059
|
result[selectionItem.key] = value;
|
|
9391
10060
|
continue;
|
|
9392
10061
|
}
|
|
9393
|
-
if (mapColumnValue)
|
|
9394
|
-
value = mapColumnValue(value);
|
|
9395
10062
|
if (value === null) {
|
|
9396
10063
|
result[selectionItem.key] = null;
|
|
9397
10064
|
continue;
|
|
@@ -9403,14 +10070,14 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
9403
10070
|
}
|
|
9404
10071
|
return isOne ? results[0] : results;
|
|
9405
10072
|
}
|
|
9406
|
-
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
10073
|
+
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
9407
10074
|
return (rows) => {
|
|
9408
10075
|
if (isFirst && !rows[0])
|
|
9409
10076
|
return rows[0];
|
|
9410
|
-
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection,
|
|
10077
|
+
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString) : mapRelationalRow2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString, rootJsonMappers);
|
|
9411
10078
|
};
|
|
9412
10079
|
}
|
|
9413
|
-
function makeJitRqbMapperInner(selection, rowExpr, selectionVar,
|
|
10080
|
+
function makeJitRqbMapperInner(selection, rowExpr, selectionVar, parseJson, parseJsonIfString, useJsonMappers, preFn, counter, accessByIdx) {
|
|
9414
10081
|
const bodyStmts = [];
|
|
9415
10082
|
const literalEntries = [];
|
|
9416
10083
|
let hasWork = false;
|
|
@@ -9434,7 +10101,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9434
10101
|
preFn.push(`const { selection: ${nestedSelVar} } = ${sel};`);
|
|
9435
10102
|
if (isArray) {
|
|
9436
10103
|
const j = `j${counter.n++}`;
|
|
9437
|
-
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar,
|
|
10104
|
+
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
9438
10105
|
if (inner.hasWork) {
|
|
9439
10106
|
hasWork = true;
|
|
9440
10107
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -9447,7 +10114,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9447
10114
|
} else
|
|
9448
10115
|
preFn.splice(savedPreFnLen, 1);
|
|
9449
10116
|
} else {
|
|
9450
|
-
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar,
|
|
10117
|
+
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
9451
10118
|
if (inner.hasWork) {
|
|
9452
10119
|
hasWork = true;
|
|
9453
10120
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -9476,21 +10143,39 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9476
10143
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9477
10144
|
}
|
|
9478
10145
|
} else if (is(field, SQL)) {
|
|
9479
|
-
if (
|
|
10146
|
+
if (useJsonMappers && field.decoder.mapFromJsonValue) {
|
|
10147
|
+
bypassCodecs = true;
|
|
10148
|
+
const id = counter.n++;
|
|
10149
|
+
destructure = `field: { decoder: dec${id} }`;
|
|
10150
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10151
|
+
} else if (!field.decoder.mapFromDriverValue.isNoop) {
|
|
9480
10152
|
const id = counter.n++;
|
|
9481
10153
|
destructure = `field: { decoder: dec${id} }`;
|
|
9482
10154
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9483
10155
|
}
|
|
9484
10156
|
} else if (is(field, SQL.Aliased)) {
|
|
9485
|
-
if (
|
|
10157
|
+
if (useJsonMappers && field.sql.decoder.mapFromJsonValue) {
|
|
10158
|
+
bypassCodecs = true;
|
|
10159
|
+
const id = counter.n++;
|
|
10160
|
+
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
10161
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10162
|
+
} else if (!field.sql.decoder.mapFromDriverValue.isNoop) {
|
|
9486
10163
|
const id = counter.n++;
|
|
9487
10164
|
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
9488
10165
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9489
10166
|
}
|
|
9490
|
-
} else if (is(field, Table) || is(field, View)) {} else
|
|
9491
|
-
const
|
|
9492
|
-
|
|
9493
|
-
|
|
10167
|
+
} else if (is(field, Table) || is(field, View)) {} else {
|
|
10168
|
+
const sqlExpr = field.getSQL();
|
|
10169
|
+
if (useJsonMappers && sqlExpr.decoder.mapFromJsonValue) {
|
|
10170
|
+
bypassCodecs = true;
|
|
10171
|
+
const id = counter.n++;
|
|
10172
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
10173
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10174
|
+
} else if (!sqlExpr.decoder.mapFromDriverValue.isNoop) {
|
|
10175
|
+
const id = counter.n++;
|
|
10176
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
10177
|
+
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
10178
|
+
}
|
|
9494
10179
|
}
|
|
9495
10180
|
let codecVar = "";
|
|
9496
10181
|
if (!bypassCodecs && codec)
|
|
@@ -9503,19 +10188,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9503
10188
|
parts.push(`codec: ${codecVar}`);
|
|
9504
10189
|
preFn.push(`const { ${parts.join(", ")} } = ${sel};`);
|
|
9505
10190
|
}
|
|
9506
|
-
if (
|
|
9507
|
-
hasWork = true;
|
|
9508
|
-
bodyStmts.push(`${slot} = mapColumnValue(${slot});`);
|
|
9509
|
-
if (decoderExpr || codecVar) {
|
|
9510
|
-
let decoded = slot;
|
|
9511
|
-
if (codecVar)
|
|
9512
|
-
decoded = `${codecVar}(${decoded}, ${arrayDimensions})`;
|
|
9513
|
-
if (decoderExpr)
|
|
9514
|
-
decoded = `${decoderExpr}(${decoded})`;
|
|
9515
|
-
bodyStmts.push(`if (${slot} !== null) ${slot} = ${decoded};`);
|
|
9516
|
-
}
|
|
9517
|
-
literalEntries.push(`${keyStr}: ${slot}`);
|
|
9518
|
-
} else if (decoderExpr || codecVar) {
|
|
10191
|
+
if (decoderExpr || codecVar) {
|
|
9519
10192
|
hasWork = true;
|
|
9520
10193
|
let decoded = slot;
|
|
9521
10194
|
if (codecVar)
|
|
@@ -9532,12 +10205,12 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9532
10205
|
hasWork
|
|
9533
10206
|
};
|
|
9534
10207
|
}
|
|
9535
|
-
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
10208
|
+
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
9536
10209
|
const preFn = [];
|
|
9537
|
-
const inner = makeJitRqbMapperInner(selection, "row", "selection",
|
|
10210
|
+
const inner = makeJitRqbMapperInner(selection, "row", "selection", parseJson, parseJsonIfString, arrayModeRoot ? false : rootJsonMappers, preFn, { n: 0 }, !!arrayModeRoot);
|
|
9538
10211
|
const lines = [];
|
|
9539
10212
|
lines.push(` "use strict";
|
|
9540
|
-
const { selection
|
|
10213
|
+
const { selection } = this;`);
|
|
9541
10214
|
for (const p2 of preFn)
|
|
9542
10215
|
lines.push(` ${p2}`);
|
|
9543
10216
|
if (arrayModeRoot)
|
|
@@ -9579,10 +10252,7 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
|
|
|
9579
10252
|
lines.push("\t//# sourceURL=drizzle:jit-relational-query-mapper");
|
|
9580
10253
|
const compiled = lines.join(`
|
|
9581
10254
|
`);
|
|
9582
|
-
return Object.assign(new FnConstructor2("rows", compiled).bind({
|
|
9583
|
-
selection,
|
|
9584
|
-
mapColumnValue
|
|
9585
|
-
}), { body: `function jitRqbMapper (rows) {
|
|
10255
|
+
return Object.assign(new FnConstructor2("rows", compiled).bind({ selection }), { body: `function jitRqbMapper (rows) {
|
|
9586
10256
|
${compiled}
|
|
9587
10257
|
}` });
|
|
9588
10258
|
}
|
|
@@ -9705,17 +10375,23 @@ function relationsOrderToSQL2(table, orders) {
|
|
|
9705
10375
|
return;
|
|
9706
10376
|
return sql.join(entries.map(([target, value]) => (value === "asc" ? asc : desc)(fieldSelectionToSQL2(table, target))), sql`, `);
|
|
9707
10377
|
}
|
|
9708
|
-
function relationExtrasToSQL2(table, extras) {
|
|
10378
|
+
function relationExtrasToSQL2(table, extras, codecs, inJson) {
|
|
9709
10379
|
const subqueries = [];
|
|
9710
10380
|
const selection = [];
|
|
9711
10381
|
for (const [key, field] of Object.entries(extras)) {
|
|
9712
10382
|
if (!field)
|
|
9713
10383
|
continue;
|
|
9714
|
-
const
|
|
9715
|
-
const
|
|
9716
|
-
query
|
|
10384
|
+
const subq = (typeof field === "function" ? field(table, { sql: operators2.sql }) : field).getSQL();
|
|
10385
|
+
const column = codecs ? getColumnFromDecoder2(subq) : undefined;
|
|
10386
|
+
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)}`;
|
|
10387
|
+
query.decoder = subq.decoder;
|
|
9717
10388
|
subqueries.push(query);
|
|
9718
|
-
selection.push({
|
|
10389
|
+
selection.push(column && (!inJson || !column.mapFromJsonValue) ? {
|
|
10390
|
+
key,
|
|
10391
|
+
field: query,
|
|
10392
|
+
codec: codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
10393
|
+
arrayDimensions: column.dimensions
|
|
10394
|
+
} : {
|
|
9719
10395
|
key,
|
|
9720
10396
|
field: query
|
|
9721
10397
|
});
|
|
@@ -9824,43 +10500,58 @@ var PgDialect2 = class {
|
|
|
9824
10500
|
}
|
|
9825
10501
|
buildSelection(fields, { isSingleTable = false, ignoreCastCodecs = false } = {}) {
|
|
9826
10502
|
const columnsLen = fields.length;
|
|
9827
|
-
const chunks = fields.flatMap(({ field }, i) => {
|
|
10503
|
+
const chunks = fields.flatMap(({ field, codecOverride, column }, i) => {
|
|
9828
10504
|
const chunk = [];
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
10505
|
+
const override = codecOverride;
|
|
10506
|
+
if (is(field, SQL.Aliased))
|
|
10507
|
+
if (field.isSelectionField) {
|
|
10508
|
+
const query = !isSingleTable && field.origin !== undefined ? sql`${sql.identifier(field.origin)}.${sql.identifier(field.fieldAlias)}` : sql.identifier(field.fieldAlias);
|
|
10509
|
+
if (column && !ignoreCastCodecs)
|
|
10510
|
+
chunk.push(this.codecs.apply(column, "cast", query, override));
|
|
10511
|
+
else
|
|
10512
|
+
chunk.push(query);
|
|
10513
|
+
} else {
|
|
10514
|
+
const query = field.sql;
|
|
10515
|
+
if (isSingleTable) {
|
|
10516
|
+
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
10517
|
+
if (is(c, PgColumn))
|
|
10518
|
+
return sql.identifier(c.name);
|
|
10519
|
+
return c;
|
|
10520
|
+
}));
|
|
10521
|
+
if (query.shouldInlineParams)
|
|
10522
|
+
newSql.inlineParams();
|
|
10523
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
10524
|
+
} else
|
|
10525
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
10526
|
+
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
10527
|
+
}
|
|
10528
|
+
else if (is(field, SQL)) {
|
|
10529
|
+
const query = field;
|
|
9835
10530
|
if (isSingleTable) {
|
|
9836
10531
|
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
9837
10532
|
if (is(c, PgColumn))
|
|
9838
10533
|
return sql.identifier(c.name);
|
|
9839
10534
|
return c;
|
|
9840
10535
|
}));
|
|
9841
|
-
|
|
10536
|
+
if (query.shouldInlineParams)
|
|
10537
|
+
newSql.inlineParams();
|
|
10538
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
9842
10539
|
} else
|
|
9843
|
-
chunk.push(query);
|
|
9844
|
-
if (is(field, SQL.Aliased))
|
|
9845
|
-
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
10540
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
9846
10541
|
} else if (is(field, Column)) {
|
|
9847
10542
|
let name2;
|
|
9848
10543
|
if (isSingleTable)
|
|
9849
10544
|
name2 = field.isAlias ? sql.identifier(getOriginalColumnFromAlias2(field).name) : sql.identifier(field.name);
|
|
9850
10545
|
else
|
|
9851
10546
|
name2 = field.isAlias ? getOriginalColumnFromAlias2(field) : field;
|
|
9852
|
-
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2);
|
|
10547
|
+
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2, override);
|
|
9853
10548
|
chunk.push(field.isAlias ? sql`${casted} as ${field}` : casted);
|
|
9854
|
-
} else if (is(field, Subquery))
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
field._.sql.decoder = fieldDecoder;
|
|
9861
|
-
}
|
|
9862
|
-
chunk.push(field);
|
|
9863
|
-
}
|
|
10549
|
+
} else if (is(field, Subquery))
|
|
10550
|
+
if (column && !ignoreCastCodecs && !field._.isWith) {
|
|
10551
|
+
const innerCasted = this.codecs.apply(column, "cast", sql`(${field._.sql})`, override);
|
|
10552
|
+
chunk.push(sql`${innerCasted} ${sql.identifier(field._.alias)}`);
|
|
10553
|
+
} else
|
|
10554
|
+
chunk.push(column ? this.codecs.apply(column, "cast", field) : field, override);
|
|
9864
10555
|
if (i < columnsLen - 1)
|
|
9865
10556
|
chunk.push(sql`, `);
|
|
9866
10557
|
return chunk;
|
|
@@ -9911,8 +10602,10 @@ var PgDialect2 = class {
|
|
|
9911
10602
|
}
|
|
9912
10603
|
return table;
|
|
9913
10604
|
}
|
|
9914
|
-
buildSelectQuery({ withList,
|
|
9915
|
-
|
|
10605
|
+
buildSelectQuery({ withList, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, comment, ignoreSelectionCastCodecs }) {
|
|
10606
|
+
if (!fieldsFlat)
|
|
10607
|
+
throw new Error("Select query builder must be provided with `fieldsFlat` on `buildSelectQuery` invocation");
|
|
10608
|
+
const fieldsList = fieldsFlat;
|
|
9916
10609
|
for (const f of fieldsList)
|
|
9917
10610
|
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)) {
|
|
9918
10611
|
const tableName = getTableName(f.field.table);
|
|
@@ -9925,7 +10618,7 @@ var PgDialect2 = class {
|
|
|
9925
10618
|
distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
|
|
9926
10619
|
const selection = this.buildSelection(fieldsList, {
|
|
9927
10620
|
isSingleTable,
|
|
9928
|
-
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
10621
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs || setOperators.length > 0
|
|
9929
10622
|
});
|
|
9930
10623
|
const tableSql = this.buildFromTable(table);
|
|
9931
10624
|
const joinsSql = this.buildJoins(joins);
|
|
@@ -9952,26 +10645,67 @@ var PgDialect2 = class {
|
|
|
9952
10645
|
}
|
|
9953
10646
|
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClauseSql}${comment !== undefined ? sql` ${comment}` : undefined}`;
|
|
9954
10647
|
if (setOperators.length > 0)
|
|
9955
|
-
return this.buildSetOperations(finalQuery, setOperators);
|
|
10648
|
+
return this.buildSetOperations(finalQuery, fieldsList, ignoreSelectionCastCodecs, setOperators);
|
|
9956
10649
|
return finalQuery;
|
|
9957
10650
|
}
|
|
9958
|
-
buildSetOperations(leftSelect, setOperators) {
|
|
9959
|
-
const
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
10651
|
+
buildSetOperations(leftSelect, leftSelection, ignoreSelectionCastCodecs, setOperators) {
|
|
10652
|
+
const outputSelection = leftSelection;
|
|
10653
|
+
for (let i = 0;i < setOperators.length; ++i) {
|
|
10654
|
+
const setOperator = setOperators[i];
|
|
10655
|
+
if (!setOperator)
|
|
10656
|
+
throw new Error("Cannot pass undefined values to any set operator");
|
|
10657
|
+
leftSelect = this.buildSetOperationQuery({
|
|
9964
10658
|
leftSelect,
|
|
9965
10659
|
setOperator
|
|
9966
10660
|
});
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
10661
|
+
const rightSelection = orderSelectedFields2(setOperator.rightSelect.getSelectedFields());
|
|
10662
|
+
for (let j = 0;j < outputSelection.length; ++j) {
|
|
10663
|
+
const l = outputSelection[j];
|
|
10664
|
+
const lPath = l.path.join(".");
|
|
10665
|
+
const r = rightSelection.find((e) => e.path.join(".") === lPath);
|
|
10666
|
+
const lc = l.codecOverride ?? l.column?.codec;
|
|
10667
|
+
const rc = r.codecOverride ?? r.column?.codec;
|
|
10668
|
+
outputSelection[j].codecOverride = lc && rc ? unionsTypeTable[lc]?.[rc] : lc;
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
for (let i = 0;i < outputSelection.length; ++i) {
|
|
10672
|
+
const out = outputSelection[i];
|
|
10673
|
+
out.codec = out.codecOverride ? this.codecs.get(out.column, "normalize", out.codecOverride) : out.codec;
|
|
10674
|
+
}
|
|
10675
|
+
return ignoreSelectionCastCodecs ? leftSelect : sql`select ${this.buildSelection(outputSelection.map((field) => {
|
|
10676
|
+
if (is(field.field, SQL.Aliased)) {
|
|
10677
|
+
const ref = field.field.clone();
|
|
10678
|
+
ref.isSelectionField = true;
|
|
10679
|
+
return {
|
|
10680
|
+
...field,
|
|
10681
|
+
field: ref
|
|
10682
|
+
};
|
|
10683
|
+
}
|
|
10684
|
+
if (is(field.field, Column) && field.field.isAlias) {
|
|
10685
|
+
const ref = new SQL.Aliased(sql`${sql.identifier(field.field.name)}`, field.field.name);
|
|
10686
|
+
ref.isSelectionField = true;
|
|
10687
|
+
return {
|
|
10688
|
+
...field,
|
|
10689
|
+
field: ref
|
|
10690
|
+
};
|
|
10691
|
+
}
|
|
10692
|
+
if (is(field.field, Subquery)) {
|
|
10693
|
+
const ref = new SQL.Aliased(sql`${field.field.getSQL()}`, field.field._.alias);
|
|
10694
|
+
ref.isSelectionField = true;
|
|
10695
|
+
return {
|
|
10696
|
+
...field,
|
|
10697
|
+
field: ref
|
|
10698
|
+
};
|
|
10699
|
+
}
|
|
10700
|
+
return field;
|
|
10701
|
+
}), {
|
|
10702
|
+
isSingleTable: true,
|
|
10703
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
10704
|
+
})} from (${leftSelect}) ${sql.identifier("drizzle_union")}`;
|
|
9971
10705
|
}
|
|
9972
10706
|
buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset } }) {
|
|
9973
10707
|
const leftChunk = sql`(${leftSelect.getSQL()}) `;
|
|
9974
|
-
const rightChunk = sql`(${rightSelect.getSQL()})`;
|
|
10708
|
+
const rightChunk = sql`(${rightSelect.withoutSelectionCastCodecs().getSQL()})`;
|
|
9975
10709
|
let orderBySql;
|
|
9976
10710
|
if (orderBy && orderBy.length > 0) {
|
|
9977
10711
|
const orderByValues = [];
|
|
@@ -9997,8 +10731,9 @@ var PgDialect2 = class {
|
|
|
9997
10731
|
buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_, comment, ignoreSelectionCastCodecs }) {
|
|
9998
10732
|
const valuesSqlList = [];
|
|
9999
10733
|
const columns = table[Table.Symbol.Columns];
|
|
10000
|
-
const colEntries = Object.entries(columns)
|
|
10001
|
-
const
|
|
10734
|
+
const colEntries = Object.entries(columns);
|
|
10735
|
+
const colFilteredEntries = select && !is(valuesOrSelect, SQL) ? Object.keys(valuesOrSelect.getSelectedFields()).map((key) => [key, columns[key]]) : overridingSystemValue_ ? colEntries : colEntries.filter(([_, col]) => !col.shouldDisableInsert());
|
|
10736
|
+
const insertOrder = colFilteredEntries.map(([, column]) => sql.identifier(column.name));
|
|
10002
10737
|
if (select) {
|
|
10003
10738
|
const select2 = valuesOrSelect;
|
|
10004
10739
|
if (is(select2, SQL))
|
|
@@ -10010,7 +10745,7 @@ var PgDialect2 = class {
|
|
|
10010
10745
|
valuesSqlList.push(sql.raw("values "));
|
|
10011
10746
|
for (const [valueIndex, value] of values.entries()) {
|
|
10012
10747
|
const valueList = [];
|
|
10013
|
-
for (const [fieldName, col] of
|
|
10748
|
+
for (const [fieldName, col] of colFilteredEntries) {
|
|
10014
10749
|
const colValue = value[fieldName];
|
|
10015
10750
|
if (colValue === undefined || is(colValue, Param) && colValue.value === undefined)
|
|
10016
10751
|
if (col.defaultFn !== undefined) {
|
|
@@ -10061,31 +10796,48 @@ var PgDialect2 = class {
|
|
|
10061
10796
|
tagged: true
|
|
10062
10797
|
});
|
|
10063
10798
|
}
|
|
10064
|
-
|
|
10799
|
+
buildRqbColumn(table, field, key, inJson) {
|
|
10800
|
+
if (is(field, Column)) {
|
|
10801
|
+
const name2 = sql`${table}.${sql.identifier(field.name)}`;
|
|
10802
|
+
return sql`${inJson && field.jsonSelectIdentifier ? field.jsonSelectIdentifier(name2, sql, field.dimensions) : this.codecs.apply(field, inJson ? "castInJson" : "cast", name2)} as ${sql.identifier(key)}`;
|
|
10803
|
+
}
|
|
10804
|
+
if (is(field, SQL.Aliased)) {
|
|
10805
|
+
const column = getColumnFromDecoder2(field);
|
|
10806
|
+
const q = sql`${table}.${sql.identifier(field.fieldAlias)}`;
|
|
10807
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
10808
|
+
}
|
|
10809
|
+
if (isSQLWrapper(field)) {
|
|
10810
|
+
const column = getColumnFromDecoder2(field);
|
|
10811
|
+
const q = sql`${table}.${sql.identifier(key)}`;
|
|
10812
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
10813
|
+
}
|
|
10065
10814
|
throw new DrizzleError2({ message: `Views with nested selections are not supported by the relational query builder` });
|
|
10066
10815
|
}
|
|
10067
|
-
|
|
10068
|
-
if (is(
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10816
|
+
resolveSelection(field, key, inJson) {
|
|
10817
|
+
if (is(field, Column))
|
|
10818
|
+
return {
|
|
10819
|
+
key,
|
|
10820
|
+
field,
|
|
10821
|
+
codec: this.codecs.get(field, inJson ? "normalizeInJson" : "normalize"),
|
|
10822
|
+
arrayDimensions: field.dimensions
|
|
10823
|
+
};
|
|
10824
|
+
const decoderColumn = getColumnFromDecoder2(field);
|
|
10825
|
+
return decoderColumn ? {
|
|
10826
|
+
key,
|
|
10827
|
+
field,
|
|
10828
|
+
codec: decoderColumn && (!inJson || !decoderColumn.mapFromJsonValue) ? this.codecs.get(decoderColumn, inJson ? "normalizeInJson" : "normalize") : undefined,
|
|
10829
|
+
arrayDimensions: decoderColumn.dimensions
|
|
10830
|
+
} : {
|
|
10831
|
+
key,
|
|
10832
|
+
field
|
|
10833
|
+
};
|
|
10073
10834
|
}
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
field: v2
|
|
10081
|
-
} : {
|
|
10082
|
-
key: k,
|
|
10083
|
-
field: v2
|
|
10084
|
-
});
|
|
10085
|
-
return this.buildRqbColumn(table, v2, k, inJson);
|
|
10086
|
-
}), sql`, `);
|
|
10087
|
-
};
|
|
10088
|
-
buildColumns = (table, selection, inJson, config) => config?.columns ? (() => {
|
|
10835
|
+
buildColumns = (table, selection, inJson, config) => {
|
|
10836
|
+
if (!config?.columns)
|
|
10837
|
+
return sql.join(Object.entries(table[TableColumns]).map(([k, v2]) => {
|
|
10838
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
10839
|
+
return this.buildRqbColumn(table, v2, k, inJson);
|
|
10840
|
+
}), sql`, `);
|
|
10089
10841
|
const entries = Object.entries(config.columns);
|
|
10090
10842
|
const columnContainer = table[TableColumns];
|
|
10091
10843
|
const columnIdentifiers = [];
|
|
@@ -10097,15 +10849,7 @@ var PgDialect2 = class {
|
|
|
10097
10849
|
if (v2) {
|
|
10098
10850
|
const column = columnContainer[k];
|
|
10099
10851
|
columnIdentifiers.push(this.buildRqbColumn(table, column, k, inJson));
|
|
10100
|
-
selection.push(
|
|
10101
|
-
key: k,
|
|
10102
|
-
codec: this.codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
10103
|
-
arrayDimensions: column.dimensions,
|
|
10104
|
-
field: column
|
|
10105
|
-
} : {
|
|
10106
|
-
key: k,
|
|
10107
|
-
field: column
|
|
10108
|
-
});
|
|
10852
|
+
selection.push(this.resolveSelection(column, k, inJson));
|
|
10109
10853
|
}
|
|
10110
10854
|
}
|
|
10111
10855
|
if (colSelectionMode === false)
|
|
@@ -10113,18 +10857,10 @@ var PgDialect2 = class {
|
|
|
10113
10857
|
if (config.columns[k] === false)
|
|
10114
10858
|
continue;
|
|
10115
10859
|
columnIdentifiers.push(this.buildRqbColumn(table, v2, k, inJson));
|
|
10116
|
-
selection.push(
|
|
10117
|
-
key: k,
|
|
10118
|
-
codec: this.codecs.get(v2, inJson ? "normalizeInJson" : "normalize"),
|
|
10119
|
-
arrayDimensions: v2.dimensions,
|
|
10120
|
-
field: v2
|
|
10121
|
-
} : {
|
|
10122
|
-
key: k,
|
|
10123
|
-
field: v2
|
|
10124
|
-
});
|
|
10860
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
10125
10861
|
}
|
|
10126
10862
|
return columnIdentifiers.length ? sql.join(columnIdentifiers, sql`, `) : undefined;
|
|
10127
|
-
}
|
|
10863
|
+
};
|
|
10128
10864
|
buildRelationalQuery({ schema, table, tableConfig, queryConfig: config, relationWhere, mode, errorPath, depth, throughJoin, nested }) {
|
|
10129
10865
|
const selection = [];
|
|
10130
10866
|
const isSingle = mode === "first";
|
|
@@ -10138,7 +10874,7 @@ var PgDialect2 = class {
|
|
|
10138
10874
|
const where = params?.where && relationWhere ? and(relationsFilterToSQL2(table, params.where, tableConfig.relations, schema), relationWhere) : params?.where ? relationsFilterToSQL2(table, params.where, tableConfig.relations, schema) : relationWhere;
|
|
10139
10875
|
const order = params?.orderBy ? relationsOrderToSQL2(table, params.orderBy) : undefined;
|
|
10140
10876
|
const columns = this.buildColumns(table, selection, !!nested, params);
|
|
10141
|
-
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras) : undefined;
|
|
10877
|
+
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras, this.codecs, nested) : undefined;
|
|
10142
10878
|
if (extras)
|
|
10143
10879
|
selection.push(...extras.selection);
|
|
10144
10880
|
const selectionArr = columns ? [columns] : [];
|
|
@@ -10288,11 +11024,6 @@ var PgInsertBuilder2 = class {
|
|
|
10288
11024
|
this.overridingSystemValue_ = overridingSystemValue_;
|
|
10289
11025
|
this.builder = builder;
|
|
10290
11026
|
}
|
|
10291
|
-
authToken;
|
|
10292
|
-
setToken(token) {
|
|
10293
|
-
this.authToken = token;
|
|
10294
|
-
return this;
|
|
10295
|
-
}
|
|
10296
11027
|
overridingSystemValue() {
|
|
10297
11028
|
this.overridingSystemValue_ = true;
|
|
10298
11029
|
return this;
|
|
@@ -10310,27 +11041,25 @@ var PgInsertBuilder2 = class {
|
|
|
10310
11041
|
}
|
|
10311
11042
|
return result;
|
|
10312
11043
|
});
|
|
10313
|
-
|
|
10314
|
-
if ("setToken" in builder)
|
|
10315
|
-
builder.setToken(this.authToken);
|
|
10316
|
-
return builder;
|
|
11044
|
+
return new this.builder(this.table, mappedValues, this.session, this.dialect, this.withList, false, this.overridingSystemValue_);
|
|
10317
11045
|
}
|
|
10318
11046
|
select(selectQuery) {
|
|
10319
11047
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder2) : selectQuery;
|
|
10320
11048
|
if ("withoutSelectionCastCodecs" in select)
|
|
10321
11049
|
select.withoutSelectionCastCodecs();
|
|
10322
|
-
if (!is(select, SQL)
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
11050
|
+
if (!is(select, SQL)) {
|
|
11051
|
+
const insertCols = Object.keys(this.table[Table.Symbol.Columns]);
|
|
11052
|
+
const selected = Object.keys(select._.selectedFields);
|
|
11053
|
+
for (const col of selected)
|
|
11054
|
+
if (!insertCols.includes(col))
|
|
11055
|
+
throw new Error(`Insert select error: column "${col}" does not exist in table "${this.table[Table.Symbol.Name]}"`);
|
|
11056
|
+
}
|
|
11057
|
+
return new this.builder(this.table, select, this.session, this.dialect, this.withList, true, this.overridingSystemValue_);
|
|
10328
11058
|
}
|
|
10329
11059
|
};
|
|
10330
11060
|
var PgInsertBase2 = class {
|
|
10331
11061
|
static [entityKind] = "PgInsert";
|
|
10332
11062
|
config;
|
|
10333
|
-
cacheConfig;
|
|
10334
11063
|
constructor(table, values, session, dialect, withList, select, overridingSystemValue_) {
|
|
10335
11064
|
this.session = session;
|
|
10336
11065
|
this.dialect = dialect;
|
|
@@ -10400,7 +11129,7 @@ var PgInsertBase2 = class {
|
|
|
10400
11129
|
var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
10401
11130
|
static [entityKind] = "PgAsyncInsert";
|
|
10402
11131
|
_prepare(name2, generateName = false) {
|
|
10403
|
-
const { session, config, dialect
|
|
11132
|
+
const { session, config, dialect } = this;
|
|
10404
11133
|
const { returning: fields } = config;
|
|
10405
11134
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10406
11135
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -10408,7 +11137,7 @@ var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
|
10408
11137
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
10409
11138
|
type: "insert",
|
|
10410
11139
|
tables: [...extractUsedTable(this.config.table)]
|
|
10411
|
-
}
|
|
11140
|
+
});
|
|
10412
11141
|
});
|
|
10413
11142
|
}
|
|
10414
11143
|
prepare(name2) {
|
|
@@ -10453,10 +11182,10 @@ applyMixins2(PgAsyncRelationalQuery2, [QueryPromise2]);
|
|
|
10453
11182
|
// node_modules/drizzle-orm/pg-core/query-builders/raw.js
|
|
10454
11183
|
var PgRaw = class {
|
|
10455
11184
|
static [entityKind] = "PgRaw";
|
|
10456
|
-
constructor(sql2, query
|
|
11185
|
+
constructor(prepared, sql2, query) {
|
|
11186
|
+
this.prepared = prepared;
|
|
10457
11187
|
this.sql = sql2;
|
|
10458
11188
|
this.query = query;
|
|
10459
|
-
this.mapBatchResult = mapBatchResult;
|
|
10460
11189
|
}
|
|
10461
11190
|
getSQL() {
|
|
10462
11191
|
return this.sql;
|
|
@@ -10464,20 +11193,22 @@ var PgRaw = class {
|
|
|
10464
11193
|
getQuery() {
|
|
10465
11194
|
return this.query;
|
|
10466
11195
|
}
|
|
10467
|
-
|
|
10468
|
-
return
|
|
11196
|
+
_prepare() {
|
|
11197
|
+
return this.prepared;
|
|
10469
11198
|
}
|
|
10470
11199
|
};
|
|
10471
11200
|
|
|
10472
11201
|
// node_modules/drizzle-orm/pg-core/async/raw.js
|
|
10473
11202
|
var PgAsyncRaw2 = class extends PgRaw {
|
|
10474
11203
|
static [entityKind] = "PgAsyncRaw";
|
|
10475
|
-
constructor(
|
|
10476
|
-
super(sql2, query
|
|
10477
|
-
|
|
11204
|
+
constructor(prepared, sql2, query) {
|
|
11205
|
+
super(prepared, sql2, query);
|
|
11206
|
+
}
|
|
11207
|
+
execute(placeholderValues) {
|
|
11208
|
+
return this.prepared.execute(placeholderValues);
|
|
10478
11209
|
}
|
|
10479
11210
|
_prepare() {
|
|
10480
|
-
return this;
|
|
11211
|
+
return this.prepared;
|
|
10481
11212
|
}
|
|
10482
11213
|
};
|
|
10483
11214
|
applyMixins2(PgAsyncRaw2, [QueryPromise2]);
|
|
@@ -10535,12 +11266,11 @@ applyMixins2(PgAsyncRefreshMaterializedView2, [QueryPromise2]);
|
|
|
10535
11266
|
var PgAsyncSelectBase2 = class extends PgSelectBase2 {
|
|
10536
11267
|
static [entityKind] = "PgAsyncSelectQueryBuilder";
|
|
10537
11268
|
_prepare(name2, generateName = false) {
|
|
10538
|
-
const { session,
|
|
10539
|
-
const { fields } = config;
|
|
11269
|
+
const { session, dialect, cacheConfig, usedTables } = this;
|
|
10540
11270
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10541
|
-
const query = this.config.
|
|
10542
|
-
const fieldsList =
|
|
10543
|
-
const mapper = this.dialect.mapperGenerators.rows(fieldsList, joinsNotNullableMap);
|
|
11271
|
+
const query = this.config.tagged ? dialect._sqlToQuery(this.getSQL()) : dialect.sqlToQuery(this.getSQL());
|
|
11272
|
+
const fieldsList = this.config.fieldsFlat;
|
|
11273
|
+
const mapper = this.dialect.mapperGenerators.rows(fieldsList, this.joinsNotNullableMap);
|
|
10544
11274
|
return session.prepareQuery(query, "arrays", name2 ?? generateName, mapper, {
|
|
10545
11275
|
type: "select",
|
|
10546
11276
|
tables: [...usedTables]
|
|
@@ -10568,16 +11298,8 @@ var PgUpdateBuilder2 = class {
|
|
|
10568
11298
|
this.withList = withList;
|
|
10569
11299
|
this.builder = builder;
|
|
10570
11300
|
}
|
|
10571
|
-
authToken;
|
|
10572
|
-
setToken(token) {
|
|
10573
|
-
this.authToken = token;
|
|
10574
|
-
return this;
|
|
10575
|
-
}
|
|
10576
11301
|
set(values) {
|
|
10577
|
-
|
|
10578
|
-
if ("setToken" in builder)
|
|
10579
|
-
builder.setToken(this.authToken);
|
|
10580
|
-
return builder;
|
|
11302
|
+
return new this.builder(this.table, mapUpdateSet2(this.table, values), this.session, this.dialect, this.withList);
|
|
10581
11303
|
}
|
|
10582
11304
|
};
|
|
10583
11305
|
var PgUpdateBase2 = class {
|
|
@@ -10585,7 +11307,6 @@ var PgUpdateBase2 = class {
|
|
|
10585
11307
|
config;
|
|
10586
11308
|
tableName;
|
|
10587
11309
|
joinsNotNullableMap;
|
|
10588
|
-
cacheConfig;
|
|
10589
11310
|
constructor(table, set, session, dialect, withList) {
|
|
10590
11311
|
this.session = session;
|
|
10591
11312
|
this.dialect = dialect;
|
|
@@ -10714,7 +11435,7 @@ var PgUpdateBase2 = class {
|
|
|
10714
11435
|
var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
10715
11436
|
static [entityKind] = "PgAsyncUpdate";
|
|
10716
11437
|
_prepare(name2, generateName = false) {
|
|
10717
|
-
const { session, config, dialect, joinsNotNullableMap
|
|
11438
|
+
const { session, config, dialect, joinsNotNullableMap } = this;
|
|
10718
11439
|
const { returning: fields } = config;
|
|
10719
11440
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10720
11441
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -10722,7 +11443,7 @@ var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
|
10722
11443
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
10723
11444
|
type: "update",
|
|
10724
11445
|
tables: [...extractUsedTable(this.config.table)]
|
|
10725
|
-
}
|
|
11446
|
+
});
|
|
10726
11447
|
});
|
|
10727
11448
|
}
|
|
10728
11449
|
prepare(name2) {
|
|
@@ -10862,8 +11583,7 @@ var PgAsyncDatabase2 = class {
|
|
|
10862
11583
|
execute(query) {
|
|
10863
11584
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
10864
11585
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
10865
|
-
|
|
10866
|
-
return new PgAsyncRaw2(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
11586
|
+
return new PgAsyncRaw2(this.session.prepareQuery(builtQuery, "raw", false), sequel, builtQuery);
|
|
10867
11587
|
}
|
|
10868
11588
|
transaction(transaction, config) {
|
|
10869
11589
|
return this.session.transaction(transaction, config);
|
|
@@ -10876,9 +11596,6 @@ var PgBasePreparedQuery2 = class {
|
|
|
10876
11596
|
constructor(query) {
|
|
10877
11597
|
this.query = query;
|
|
10878
11598
|
}
|
|
10879
|
-
mapResult(_, __) {
|
|
10880
|
-
throw new Error("Method not implemented.");
|
|
10881
|
-
}
|
|
10882
11599
|
getQuery() {
|
|
10883
11600
|
return this.query;
|
|
10884
11601
|
}
|
|
@@ -11180,5 +11897,5 @@ export {
|
|
|
11180
11897
|
createInMemoryVaultStore
|
|
11181
11898
|
};
|
|
11182
11899
|
|
|
11183
|
-
//# debugId=
|
|
11900
|
+
//# debugId=52ACBAC2C365275864756E2164756E21
|
|
11184
11901
|
//# sourceMappingURL=index.js.map
|