@absolutejs/auth 0.56.8 → 0.56.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.js +1459 -737
- package/dist/agents/index.js.map +31 -31
- package/dist/agents/postgresStores.d.ts +30 -10
- package/dist/cli/migrate.js +48 -43
- package/dist/cli/migrate.js.map +4 -4
- package/dist/index.js +1729 -947
- package/dist/index.js.map +33 -33
- package/dist/oidc/index.d.ts +1 -0
- package/dist/oidc/index.js +1464 -708
- package/dist/oidc/index.js.map +32 -31
- package/dist/oidc/operator.d.ts +14 -0
- package/dist/oidc/types.d.ts +4 -0
- package/dist/server.js +1729 -947
- package/dist/server.js.map +33 -33
- package/dist/vault/index.js +1449 -732
- package/dist/vault/index.js.map +30 -30
- package/package.json +2 -2
package/dist/oidc/index.js
CHANGED
|
@@ -125,6 +125,24 @@ var verifyJwt = async (token, publicJwk) => {
|
|
|
125
125
|
payload
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
|
+
// src/oidc/operator.ts
|
|
129
|
+
var operatorDelete = (store, storeName) => {
|
|
130
|
+
if (!store.deleteForClient)
|
|
131
|
+
throw new Error(`${storeName} does not support operator revocation`);
|
|
132
|
+
return store.deleteForClient;
|
|
133
|
+
};
|
|
134
|
+
var revokeOAuthClientCredentials = async (clientId, stores) => {
|
|
135
|
+
const revokedAuthorizationCodes = await operatorDelete(stores.authorizationCodeStore, "Authorization code store")(clientId);
|
|
136
|
+
const revokedDeviceAuthorizations = await operatorDelete(stores.deviceAuthorizationStore, "Device authorization store")(clientId);
|
|
137
|
+
const revokedRefreshTokens = await operatorDelete(stores.refreshTokenStore, "Refresh token store")(clientId);
|
|
138
|
+
const revokedRegistrationTokens = await operatorDelete(stores.clientRegistrationTokenStore, "Client registration token store")(clientId);
|
|
139
|
+
return {
|
|
140
|
+
revokedAuthorizationCodes,
|
|
141
|
+
revokedDeviceAuthorizations,
|
|
142
|
+
revokedRefreshTokens,
|
|
143
|
+
revokedRegistrationTokens
|
|
144
|
+
};
|
|
145
|
+
};
|
|
128
146
|
// node_modules/drizzle-orm/entity.js
|
|
129
147
|
var entityKind = Symbol.for("drizzle:entityKind");
|
|
130
148
|
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
@@ -539,6 +557,9 @@ var SQL = class SQL2 {
|
|
|
539
557
|
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
540
558
|
return this;
|
|
541
559
|
}
|
|
560
|
+
nullable() {
|
|
561
|
+
return this;
|
|
562
|
+
}
|
|
542
563
|
inlineParams() {
|
|
543
564
|
this.shouldInlineParams = true;
|
|
544
565
|
return this;
|
|
@@ -724,9 +745,10 @@ function fillPlaceholders(params, values) {
|
|
|
724
745
|
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
725
746
|
if (!(p.value.name in values))
|
|
726
747
|
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
748
|
+
const value = values[p.value.name];
|
|
749
|
+
if (value === null)
|
|
750
|
+
return value;
|
|
751
|
+
const mapped = p.encoder.mapToDriverValue.isNoop ? value : p.encoder.mapToDriverValue(value);
|
|
730
752
|
return p.codec ? p.codec(mapped) : mapped;
|
|
731
753
|
}
|
|
732
754
|
return p;
|
|
@@ -1096,6 +1118,9 @@ var PgColumn = class extends Column {
|
|
|
1096
1118
|
}
|
|
1097
1119
|
return this;
|
|
1098
1120
|
}
|
|
1121
|
+
shouldDisableInsert() {
|
|
1122
|
+
return this.config.generatedIdentity !== undefined && this.config.generatedIdentity.type !== "byDefault" || this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
1123
|
+
}
|
|
1099
1124
|
mapArrayElements(value, mapper, depth) {
|
|
1100
1125
|
if (depth > 0 && Array.isArray(value))
|
|
1101
1126
|
return value.map((v) => v === null ? null : this.mapArrayElements(v, mapper, depth - 1));
|
|
@@ -1361,20 +1386,59 @@ function orderSelectedFields2(fields, pathPrefix, codecs) {
|
|
|
1361
1386
|
path: newPath,
|
|
1362
1387
|
field,
|
|
1363
1388
|
codec: codecs?.get(field, "normalize"),
|
|
1364
|
-
arrayDimensions: field.dimensions
|
|
1389
|
+
arrayDimensions: field.dimensions,
|
|
1390
|
+
column: field
|
|
1365
1391
|
});
|
|
1366
|
-
else if (is(field,
|
|
1367
|
-
|
|
1392
|
+
else if (is(field, SQL) || is(field, SQL.Aliased)) {
|
|
1393
|
+
const col = getColumnFromDecoder2(field);
|
|
1394
|
+
result.push(col ? {
|
|
1395
|
+
path: newPath,
|
|
1396
|
+
field,
|
|
1397
|
+
codec: codecs?.get(col, "normalize"),
|
|
1398
|
+
arrayDimensions: col.dimensions,
|
|
1399
|
+
column: col
|
|
1400
|
+
} : {
|
|
1401
|
+
path: newPath,
|
|
1402
|
+
field
|
|
1403
|
+
});
|
|
1404
|
+
} else if (is(field, Subquery)) {
|
|
1405
|
+
let column;
|
|
1406
|
+
const entry = Object.values(field._.selectedFields)[0];
|
|
1407
|
+
let fieldDecoder;
|
|
1408
|
+
if (is(entry, Column)) {
|
|
1409
|
+
column = entry;
|
|
1410
|
+
fieldDecoder = entry;
|
|
1411
|
+
} else if (is(entry, SQL)) {
|
|
1412
|
+
column = getColumnFromDecoder2(entry);
|
|
1413
|
+
fieldDecoder = entry.decoder;
|
|
1414
|
+
} else {
|
|
1415
|
+
column = getColumnFromDecoder2(entry);
|
|
1416
|
+
fieldDecoder = entry.sql.decoder;
|
|
1417
|
+
}
|
|
1418
|
+
if (fieldDecoder)
|
|
1419
|
+
field._.sql.decoder = fieldDecoder;
|
|
1420
|
+
result.push(column ? {
|
|
1421
|
+
path: newPath,
|
|
1422
|
+
field,
|
|
1423
|
+
codec: codecs?.get(column, "normalize"),
|
|
1424
|
+
arrayDimensions: column.dimensions,
|
|
1425
|
+
column
|
|
1426
|
+
} : {
|
|
1368
1427
|
path: newPath,
|
|
1369
1428
|
field
|
|
1370
1429
|
});
|
|
1371
|
-
else if (is(field, Table))
|
|
1430
|
+
} else if (is(field, Table))
|
|
1372
1431
|
result.push(...orderSelectedFields2(field[Table.Symbol.Columns], newPath, codecs));
|
|
1373
1432
|
else
|
|
1374
1433
|
result.push(...orderSelectedFields2(field, newPath, codecs));
|
|
1375
1434
|
return result;
|
|
1376
1435
|
}, []);
|
|
1377
1436
|
}
|
|
1437
|
+
function getColumnFromDecoder2(source) {
|
|
1438
|
+
const query = source.getSQL();
|
|
1439
|
+
if (is(query.decoder, Column))
|
|
1440
|
+
return query.decoder;
|
|
1441
|
+
}
|
|
1378
1442
|
function haveSameKeys2(left, right) {
|
|
1379
1443
|
const leftKeys = Object.keys(left);
|
|
1380
1444
|
const rightKeys = Object.keys(right);
|
|
@@ -1518,481 +1582,169 @@ var PgBoolean = class extends PgColumn {
|
|
|
1518
1582
|
function boolean(name2) {
|
|
1519
1583
|
return new PgBooleanBuilder(name2 ?? "");
|
|
1520
1584
|
}
|
|
1521
|
-
// node_modules/drizzle-orm/pg-core/
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
return "double precision";
|
|
1585
|
+
// node_modules/drizzle-orm/pg-core/array.js
|
|
1586
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
1587
|
+
for (let i = startFrom;i < arrayString.length; i++) {
|
|
1588
|
+
const char = arrayString[i];
|
|
1589
|
+
if (char === "\\") {
|
|
1590
|
+
i++;
|
|
1591
|
+
continue;
|
|
1592
|
+
}
|
|
1593
|
+
if (char === '"')
|
|
1594
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
1595
|
+
if (inQuotes)
|
|
1596
|
+
continue;
|
|
1597
|
+
if (char === "," || char === "}")
|
|
1598
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
1536
1599
|
}
|
|
1537
|
-
|
|
1538
|
-
function doublePrecision(name2) {
|
|
1539
|
-
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
1600
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
1540
1601
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1602
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
1603
|
+
const result = [];
|
|
1604
|
+
let i = startFrom;
|
|
1605
|
+
let lastCharIsComma = false;
|
|
1606
|
+
while (i < arrayString.length) {
|
|
1607
|
+
const char = arrayString[i];
|
|
1608
|
+
if (char === ",") {
|
|
1609
|
+
if (lastCharIsComma || i === startFrom)
|
|
1610
|
+
result.push("");
|
|
1611
|
+
lastCharIsComma = true;
|
|
1612
|
+
i++;
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
lastCharIsComma = false;
|
|
1616
|
+
if (char === "\\") {
|
|
1617
|
+
i += 2;
|
|
1618
|
+
continue;
|
|
1619
|
+
}
|
|
1620
|
+
if (char === '"') {
|
|
1621
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
1622
|
+
result.push(value2);
|
|
1623
|
+
i = startFrom2;
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
if (char === "}")
|
|
1627
|
+
return [result, i + 1];
|
|
1628
|
+
if (char === "{") {
|
|
1629
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
1630
|
+
result.push(value2);
|
|
1631
|
+
i = startFrom2;
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1634
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
1635
|
+
result.push(value);
|
|
1636
|
+
i = newStartFrom;
|
|
1556
1637
|
}
|
|
1557
|
-
|
|
1558
|
-
function integer(name2) {
|
|
1559
|
-
return new PgIntegerBuilder(name2 ?? "");
|
|
1638
|
+
return [result, i];
|
|
1560
1639
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
constructor(name2) {
|
|
1565
|
-
super(name2, "object json", "PgJsonb");
|
|
1566
|
-
}
|
|
1567
|
-
build(table) {
|
|
1568
|
-
return new PgJsonb(table, this.config);
|
|
1569
|
-
}
|
|
1570
|
-
};
|
|
1571
|
-
var PgJsonb = class extends PgColumn {
|
|
1572
|
-
static [entityKind] = "PgJsonb";
|
|
1573
|
-
codec = "jsonb";
|
|
1574
|
-
constructor(table, config) {
|
|
1575
|
-
super(table, config);
|
|
1576
|
-
}
|
|
1577
|
-
getSQLType() {
|
|
1578
|
-
return "jsonb";
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
function jsonb(name2) {
|
|
1582
|
-
return new PgJsonbBuilder(name2 ?? "");
|
|
1640
|
+
function parsePgArray(arrayString) {
|
|
1641
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
1642
|
+
return result;
|
|
1583
1643
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1644
|
+
function makePgArray(array) {
|
|
1645
|
+
return `{${array.map((item) => {
|
|
1646
|
+
if (Array.isArray(item))
|
|
1647
|
+
return makePgArray(item);
|
|
1648
|
+
if (typeof item === "string")
|
|
1649
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
1650
|
+
return `${item}`;
|
|
1651
|
+
}).join(",")}}`;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
1655
|
+
function hexToBytes(hex) {
|
|
1656
|
+
const bytes = [];
|
|
1657
|
+
for (let c = 0;c < hex.length; c += 2)
|
|
1658
|
+
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
1659
|
+
return new Uint8Array(bytes);
|
|
1660
|
+
}
|
|
1661
|
+
function bytesToFloat64(bytes, offset) {
|
|
1662
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
1663
|
+
const view = new DataView(buffer);
|
|
1664
|
+
for (let i = 0;i < 8; i++)
|
|
1665
|
+
view.setUint8(i, bytes[offset + i]);
|
|
1666
|
+
return view.getFloat64(0, true);
|
|
1667
|
+
}
|
|
1668
|
+
function parseEWKB(hex) {
|
|
1669
|
+
const bytes = hexToBytes(hex);
|
|
1670
|
+
let offset = 0;
|
|
1671
|
+
const byteOrder = bytes[offset];
|
|
1672
|
+
offset += 1;
|
|
1673
|
+
const view = new DataView(bytes.buffer);
|
|
1674
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
1675
|
+
offset += 4;
|
|
1676
|
+
let srid;
|
|
1677
|
+
if (geomType & 536870912) {
|
|
1678
|
+
srid = view.getUint32(offset, byteOrder === 1);
|
|
1679
|
+
offset += 4;
|
|
1589
1680
|
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1681
|
+
if ((geomType & 65535) === 1) {
|
|
1682
|
+
const x = bytesToFloat64(bytes, offset);
|
|
1683
|
+
offset += 8;
|
|
1684
|
+
const y = bytesToFloat64(bytes, offset);
|
|
1685
|
+
offset += 8;
|
|
1686
|
+
return {
|
|
1687
|
+
srid,
|
|
1688
|
+
point: [x, y]
|
|
1689
|
+
};
|
|
1592
1690
|
}
|
|
1691
|
+
throw new Error("Unsupported geometry type");
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
// node_modules/drizzle-orm/codecs.js
|
|
1695
|
+
var noopCodecs = {};
|
|
1696
|
+
var arrayToItemTypeCodecNameMap = {
|
|
1697
|
+
cast: "cast",
|
|
1698
|
+
castArray: "cast",
|
|
1699
|
+
castInJson: "castInJson",
|
|
1700
|
+
castArrayInJson: "castInJson",
|
|
1701
|
+
castParam: "castParam",
|
|
1702
|
+
castArrayParam: "castParam",
|
|
1703
|
+
normalize: "normalize",
|
|
1704
|
+
normalizeArray: "normalize",
|
|
1705
|
+
normalizeInJson: "normalizeInJson",
|
|
1706
|
+
normalizeArrayInJson: "normalizeInJson",
|
|
1707
|
+
normalizeParam: "normalizeParam",
|
|
1708
|
+
normalizeParamArray: "normalizeParam"
|
|
1593
1709
|
};
|
|
1594
|
-
var
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1710
|
+
var itemToArrayTypeCodecNameMap = {
|
|
1711
|
+
cast: "castArray",
|
|
1712
|
+
castArray: "castArray",
|
|
1713
|
+
castInJson: "castArrayInJson",
|
|
1714
|
+
castArrayInJson: "castArrayInJson",
|
|
1715
|
+
castParam: "castArrayParam",
|
|
1716
|
+
castArrayParam: "castArrayParam",
|
|
1717
|
+
normalize: "normalizeArray",
|
|
1718
|
+
normalizeArray: "normalizeArray",
|
|
1719
|
+
normalizeInJson: "normalizeArrayInJson",
|
|
1720
|
+
normalizeArrayInJson: "normalizeArrayInJson",
|
|
1721
|
+
normalizeParam: "normalizeParamArray",
|
|
1722
|
+
normalizeParamArray: "normalizeParamArray"
|
|
1600
1723
|
};
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
static [entityKind] = "PgTextBuilder";
|
|
1607
|
-
constructor(name2, config) {
|
|
1608
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
1609
|
-
this.config.enumValues = config.enum;
|
|
1610
|
-
}
|
|
1611
|
-
build(table) {
|
|
1612
|
-
return new PgText(table, this.config, this.config.enumValues);
|
|
1724
|
+
var CodecsCollection = class {
|
|
1725
|
+
static [entityKind] = "CodecsCollection";
|
|
1726
|
+
constructor(resolveTypes, codecs = noopCodecs) {
|
|
1727
|
+
this.resolveTypes = resolveTypes;
|
|
1728
|
+
this.codecs = codecs;
|
|
1613
1729
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
super(table, config);
|
|
1621
|
-
this.enumValues = enumValues;
|
|
1730
|
+
get(column, type, override) {
|
|
1731
|
+
const sqlType = override ?? column.codec;
|
|
1732
|
+
if (!sqlType)
|
|
1733
|
+
return;
|
|
1734
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1735
|
+
return this.codecs[sqlType]?.[codecType];
|
|
1622
1736
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
defaultNow() {
|
|
1635
|
-
return this.default(sql`now()`);
|
|
1636
|
-
}
|
|
1637
|
-
};
|
|
1638
|
-
|
|
1639
|
-
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
1640
|
-
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
1641
|
-
static [entityKind] = "PgTimestampBuilder";
|
|
1642
|
-
constructor(name2, withTimezone, precision) {
|
|
1643
|
-
super(name2, "object date", "PgTimestamp");
|
|
1644
|
-
this.config.withTimezone = withTimezone;
|
|
1645
|
-
this.config.precision = precision;
|
|
1646
|
-
}
|
|
1647
|
-
build(table) {
|
|
1648
|
-
return new PgTimestamp(table, this.config);
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
var PgTimestamp = class extends PgColumn {
|
|
1652
|
-
static [entityKind] = "PgTimestamp";
|
|
1653
|
-
codec;
|
|
1654
|
-
withTimezone;
|
|
1655
|
-
precision;
|
|
1656
|
-
constructor(table, config) {
|
|
1657
|
-
super(table, config);
|
|
1658
|
-
this.withTimezone = config.withTimezone;
|
|
1659
|
-
this.precision = config.precision;
|
|
1660
|
-
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
1661
|
-
}
|
|
1662
|
-
getSQLType() {
|
|
1663
|
-
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
1664
|
-
}
|
|
1665
|
-
mapToDriverValue = (value) => {
|
|
1666
|
-
if (typeof value === "string")
|
|
1667
|
-
return value;
|
|
1668
|
-
return value.toISOString();
|
|
1669
|
-
};
|
|
1670
|
-
};
|
|
1671
|
-
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
1672
|
-
static [entityKind] = "PgTimestampStringBuilder";
|
|
1673
|
-
constructor(name2, withTimezone, precision) {
|
|
1674
|
-
super(name2, "string timestamp", "PgTimestampString");
|
|
1675
|
-
this.config.withTimezone = withTimezone;
|
|
1676
|
-
this.config.precision = precision;
|
|
1677
|
-
}
|
|
1678
|
-
build(table) {
|
|
1679
|
-
return new PgTimestampString(table, this.config);
|
|
1680
|
-
}
|
|
1681
|
-
};
|
|
1682
|
-
var PgTimestampString = class extends PgColumn {
|
|
1683
|
-
static [entityKind] = "PgTimestampString";
|
|
1684
|
-
codec;
|
|
1685
|
-
withTimezone;
|
|
1686
|
-
precision;
|
|
1687
|
-
constructor(table, config) {
|
|
1688
|
-
super(table, config);
|
|
1689
|
-
this.withTimezone = config.withTimezone;
|
|
1690
|
-
this.precision = config.precision;
|
|
1691
|
-
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
1692
|
-
}
|
|
1693
|
-
getSQLType() {
|
|
1694
|
-
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
1695
|
-
}
|
|
1696
|
-
mapToDriverValue = (value) => {
|
|
1697
|
-
if (typeof value === "string")
|
|
1698
|
-
return value;
|
|
1699
|
-
return value.toISOString();
|
|
1700
|
-
};
|
|
1701
|
-
};
|
|
1702
|
-
function timestamp(a, b = {}) {
|
|
1703
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1704
|
-
if (config?.mode === "string")
|
|
1705
|
-
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
1706
|
-
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
1707
|
-
}
|
|
1708
|
-
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
1709
|
-
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
1710
|
-
static [entityKind] = "PgVarcharBuilder";
|
|
1711
|
-
constructor(name2, config) {
|
|
1712
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
1713
|
-
this.config.length = config.length;
|
|
1714
|
-
this.config.enumValues = config.enum;
|
|
1715
|
-
}
|
|
1716
|
-
build(table) {
|
|
1717
|
-
return new PgVarchar(table, this.config);
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
var PgVarchar = class extends PgColumn {
|
|
1721
|
-
static [entityKind] = "PgVarchar";
|
|
1722
|
-
codec = "varchar";
|
|
1723
|
-
enumValues;
|
|
1724
|
-
constructor(table, config) {
|
|
1725
|
-
super(table, config);
|
|
1726
|
-
this.enumValues = config.enumValues;
|
|
1727
|
-
}
|
|
1728
|
-
getSQLType() {
|
|
1729
|
-
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
1730
|
-
}
|
|
1731
|
-
};
|
|
1732
|
-
function varchar(a, b = {}) {
|
|
1733
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1734
|
-
return new PgVarcharBuilder(name2, config);
|
|
1735
|
-
}
|
|
1736
|
-
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
1737
|
-
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
1738
|
-
static [entityKind] = "PgBigSerial53Builder";
|
|
1739
|
-
constructor(name2) {
|
|
1740
|
-
super(name2, "number int53", "PgBigSerial53");
|
|
1741
|
-
this.config.hasDefault = true;
|
|
1742
|
-
this.config.notNull = true;
|
|
1743
|
-
}
|
|
1744
|
-
build(table) {
|
|
1745
|
-
return new PgBigSerial53(table, this.config);
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
1748
|
-
var PgBigSerial53 = class extends PgColumn {
|
|
1749
|
-
static [entityKind] = "PgBigSerial53";
|
|
1750
|
-
codec = "bigserial:number";
|
|
1751
|
-
getSQLType() {
|
|
1752
|
-
return "bigserial";
|
|
1753
|
-
}
|
|
1754
|
-
};
|
|
1755
|
-
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
1756
|
-
static [entityKind] = "PgBigSerial64Builder";
|
|
1757
|
-
constructor(name2) {
|
|
1758
|
-
super(name2, "bigint int64", "PgBigSerial64");
|
|
1759
|
-
this.config.hasDefault = true;
|
|
1760
|
-
this.config.notNull = true;
|
|
1761
|
-
}
|
|
1762
|
-
build(table) {
|
|
1763
|
-
return new PgBigSerial64(table, this.config);
|
|
1764
|
-
}
|
|
1765
|
-
};
|
|
1766
|
-
var PgBigSerial64 = class extends PgColumn {
|
|
1767
|
-
static [entityKind] = "PgBigSerial64";
|
|
1768
|
-
codec = "bigserial";
|
|
1769
|
-
getSQLType() {
|
|
1770
|
-
return "bigserial";
|
|
1771
|
-
}
|
|
1772
|
-
};
|
|
1773
|
-
function bigserial(a, b) {
|
|
1774
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1775
|
-
if (config.mode === "number")
|
|
1776
|
-
return new PgBigSerial53Builder(name2);
|
|
1777
|
-
return new PgBigSerial64Builder(name2);
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
1781
|
-
var PgCharBuilder = class extends PgColumnBuilder {
|
|
1782
|
-
static [entityKind] = "PgCharBuilder";
|
|
1783
|
-
constructor(name2, config) {
|
|
1784
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
1785
|
-
this.config.length = config.length ?? 1;
|
|
1786
|
-
this.config.setLength = config.length !== undefined;
|
|
1787
|
-
this.config.enumValues = config.enum;
|
|
1788
|
-
}
|
|
1789
|
-
build(table) {
|
|
1790
|
-
return new PgChar(table, this.config);
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
var PgChar = class extends PgColumn {
|
|
1794
|
-
static [entityKind] = "PgChar";
|
|
1795
|
-
codec = "char";
|
|
1796
|
-
enumValues;
|
|
1797
|
-
setLength;
|
|
1798
|
-
constructor(table, config) {
|
|
1799
|
-
super(table, config);
|
|
1800
|
-
this.enumValues = config.enumValues;
|
|
1801
|
-
this.setLength = config.setLength;
|
|
1802
|
-
}
|
|
1803
|
-
getSQLType() {
|
|
1804
|
-
return this.setLength ? `char(${this.length})` : `char`;
|
|
1805
|
-
}
|
|
1806
|
-
};
|
|
1807
|
-
function char(a, b = {}) {
|
|
1808
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
1809
|
-
return new PgCharBuilder(name2, config);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
1813
|
-
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
1814
|
-
static [entityKind] = "PgCidrBuilder";
|
|
1815
|
-
constructor(name2) {
|
|
1816
|
-
super(name2, "string cidr", "PgCidr");
|
|
1817
|
-
}
|
|
1818
|
-
build(table) {
|
|
1819
|
-
return new PgCidr(table, this.config);
|
|
1820
|
-
}
|
|
1821
|
-
};
|
|
1822
|
-
var PgCidr = class extends PgColumn {
|
|
1823
|
-
static [entityKind] = "PgCidr";
|
|
1824
|
-
codec = "cidr";
|
|
1825
|
-
getSQLType() {
|
|
1826
|
-
return "cidr";
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
function cidr(name2) {
|
|
1830
|
-
return new PgCidrBuilder(name2 ?? "");
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
// node_modules/drizzle-orm/pg-core/array.js
|
|
1834
|
-
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
1835
|
-
for (let i = startFrom;i < arrayString.length; i++) {
|
|
1836
|
-
const char2 = arrayString[i];
|
|
1837
|
-
if (char2 === "\\") {
|
|
1838
|
-
i++;
|
|
1839
|
-
continue;
|
|
1840
|
-
}
|
|
1841
|
-
if (char2 === '"')
|
|
1842
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
1843
|
-
if (inQuotes)
|
|
1844
|
-
continue;
|
|
1845
|
-
if (char2 === "," || char2 === "}")
|
|
1846
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
1847
|
-
}
|
|
1848
|
-
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
1849
|
-
}
|
|
1850
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
1851
|
-
const result = [];
|
|
1852
|
-
let i = startFrom;
|
|
1853
|
-
let lastCharIsComma = false;
|
|
1854
|
-
while (i < arrayString.length) {
|
|
1855
|
-
const char2 = arrayString[i];
|
|
1856
|
-
if (char2 === ",") {
|
|
1857
|
-
if (lastCharIsComma || i === startFrom)
|
|
1858
|
-
result.push("");
|
|
1859
|
-
lastCharIsComma = true;
|
|
1860
|
-
i++;
|
|
1861
|
-
continue;
|
|
1862
|
-
}
|
|
1863
|
-
lastCharIsComma = false;
|
|
1864
|
-
if (char2 === "\\") {
|
|
1865
|
-
i += 2;
|
|
1866
|
-
continue;
|
|
1867
|
-
}
|
|
1868
|
-
if (char2 === '"') {
|
|
1869
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
1870
|
-
result.push(value2);
|
|
1871
|
-
i = startFrom2;
|
|
1872
|
-
continue;
|
|
1873
|
-
}
|
|
1874
|
-
if (char2 === "}")
|
|
1875
|
-
return [result, i + 1];
|
|
1876
|
-
if (char2 === "{") {
|
|
1877
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
1878
|
-
result.push(value2);
|
|
1879
|
-
i = startFrom2;
|
|
1880
|
-
continue;
|
|
1881
|
-
}
|
|
1882
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
1883
|
-
result.push(value);
|
|
1884
|
-
i = newStartFrom;
|
|
1885
|
-
}
|
|
1886
|
-
return [result, i];
|
|
1887
|
-
}
|
|
1888
|
-
function parsePgArray(arrayString) {
|
|
1889
|
-
const [result] = parsePgNestedArray(arrayString, 1);
|
|
1890
|
-
return result;
|
|
1891
|
-
}
|
|
1892
|
-
function makePgArray(array) {
|
|
1893
|
-
return `{${array.map((item) => {
|
|
1894
|
-
if (Array.isArray(item))
|
|
1895
|
-
return makePgArray(item);
|
|
1896
|
-
if (typeof item === "string")
|
|
1897
|
-
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
1898
|
-
return `${item}`;
|
|
1899
|
-
}).join(",")}}`;
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
1903
|
-
function hexToBytes(hex) {
|
|
1904
|
-
const bytes = [];
|
|
1905
|
-
for (let c = 0;c < hex.length; c += 2)
|
|
1906
|
-
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
1907
|
-
return new Uint8Array(bytes);
|
|
1908
|
-
}
|
|
1909
|
-
function bytesToFloat64(bytes, offset) {
|
|
1910
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
1911
|
-
const view = new DataView(buffer);
|
|
1912
|
-
for (let i = 0;i < 8; i++)
|
|
1913
|
-
view.setUint8(i, bytes[offset + i]);
|
|
1914
|
-
return view.getFloat64(0, true);
|
|
1915
|
-
}
|
|
1916
|
-
function parseEWKB(hex) {
|
|
1917
|
-
const bytes = hexToBytes(hex);
|
|
1918
|
-
let offset = 0;
|
|
1919
|
-
const byteOrder = bytes[offset];
|
|
1920
|
-
offset += 1;
|
|
1921
|
-
const view = new DataView(bytes.buffer);
|
|
1922
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
1923
|
-
offset += 4;
|
|
1924
|
-
let srid;
|
|
1925
|
-
if (geomType & 536870912) {
|
|
1926
|
-
srid = view.getUint32(offset, byteOrder === 1);
|
|
1927
|
-
offset += 4;
|
|
1928
|
-
}
|
|
1929
|
-
if ((geomType & 65535) === 1) {
|
|
1930
|
-
const x = bytesToFloat64(bytes, offset);
|
|
1931
|
-
offset += 8;
|
|
1932
|
-
const y = bytesToFloat64(bytes, offset);
|
|
1933
|
-
offset += 8;
|
|
1934
|
-
return {
|
|
1935
|
-
srid,
|
|
1936
|
-
point: [x, y]
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
throw new Error("Unsupported geometry type");
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
// node_modules/drizzle-orm/codecs.js
|
|
1943
|
-
var noopCodecs = {};
|
|
1944
|
-
var arrayToItemTypeCodecNameMap = {
|
|
1945
|
-
cast: "cast",
|
|
1946
|
-
castArray: "cast",
|
|
1947
|
-
castInJson: "castInJson",
|
|
1948
|
-
castArrayInJson: "castInJson",
|
|
1949
|
-
castParam: "castParam",
|
|
1950
|
-
castArrayParam: "castParam",
|
|
1951
|
-
normalize: "normalize",
|
|
1952
|
-
normalizeArray: "normalize",
|
|
1953
|
-
normalizeInJson: "normalizeInJson",
|
|
1954
|
-
normalizeArrayInJson: "normalizeInJson",
|
|
1955
|
-
normalizeParam: "normalizeParam",
|
|
1956
|
-
normalizeParamArray: "normalizeParam"
|
|
1957
|
-
};
|
|
1958
|
-
var itemToArrayTypeCodecNameMap = {
|
|
1959
|
-
cast: "castArray",
|
|
1960
|
-
castArray: "castArray",
|
|
1961
|
-
castInJson: "castArrayInJson",
|
|
1962
|
-
castArrayInJson: "castArrayInJson",
|
|
1963
|
-
castParam: "castArrayParam",
|
|
1964
|
-
castArrayParam: "castArrayParam",
|
|
1965
|
-
normalize: "normalizeArray",
|
|
1966
|
-
normalizeArray: "normalizeArray",
|
|
1967
|
-
normalizeInJson: "normalizeArrayInJson",
|
|
1968
|
-
normalizeArrayInJson: "normalizeArrayInJson",
|
|
1969
|
-
normalizeParam: "normalizeParamArray",
|
|
1970
|
-
normalizeParamArray: "normalizeParamArray"
|
|
1971
|
-
};
|
|
1972
|
-
var CodecsCollection = class {
|
|
1973
|
-
static [entityKind] = "CodecsCollection";
|
|
1974
|
-
constructor(resolveTypes, codecs = noopCodecs) {
|
|
1975
|
-
this.resolveTypes = resolveTypes;
|
|
1976
|
-
this.codecs = codecs;
|
|
1977
|
-
}
|
|
1978
|
-
get(column, type) {
|
|
1979
|
-
const sqlType = column.codec;
|
|
1980
|
-
if (!sqlType)
|
|
1981
|
-
return;
|
|
1982
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1983
|
-
return this.codecs[sqlType]?.[codecType];
|
|
1984
|
-
}
|
|
1985
|
-
apply(column, type, value) {
|
|
1986
|
-
const sqlType = column.codec;
|
|
1987
|
-
if (!sqlType)
|
|
1988
|
-
return value;
|
|
1989
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1990
|
-
const codec = this.codecs[sqlType]?.[codecType];
|
|
1991
|
-
if (!codec)
|
|
1992
|
-
return value;
|
|
1993
|
-
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
1994
|
-
return codec(value, column, column.dimensions);
|
|
1995
|
-
return codec(value, column.dimensions);
|
|
1737
|
+
apply(column, type, value, override) {
|
|
1738
|
+
const sqlType = override ?? column.codec;
|
|
1739
|
+
if (!sqlType)
|
|
1740
|
+
return value;
|
|
1741
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
1742
|
+
const codec = this.codecs[sqlType]?.[codecType];
|
|
1743
|
+
if (!codec)
|
|
1744
|
+
return value;
|
|
1745
|
+
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
1746
|
+
return codec(value, column, column.dimensions);
|
|
1747
|
+
return codec(value, column.dimensions);
|
|
1996
1748
|
}
|
|
1997
1749
|
};
|
|
1998
1750
|
function refineCodecs(source, extension = {}) {
|
|
@@ -2037,9 +1789,636 @@ var PG_ALIAS_TO_TYPE_MAP = {
|
|
|
2037
1789
|
boolean: "bool",
|
|
2038
1790
|
"bit varying": "varbit"
|
|
2039
1791
|
};
|
|
2040
|
-
function resolvePgTypeAlias(type) {
|
|
2041
|
-
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
2042
|
-
}
|
|
1792
|
+
function resolvePgTypeAlias(type) {
|
|
1793
|
+
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
1794
|
+
}
|
|
1795
|
+
var unionsTypeTable = {
|
|
1796
|
+
smallint: {
|
|
1797
|
+
smallint: "smallint",
|
|
1798
|
+
int: "int",
|
|
1799
|
+
bigint: "bigint:number",
|
|
1800
|
+
"bigint:number": "bigint:number",
|
|
1801
|
+
"bigint:string": "bigint:number",
|
|
1802
|
+
numeric: "numeric:number",
|
|
1803
|
+
"numeric:number": "numeric:number",
|
|
1804
|
+
"numeric:bigint": "numeric:number",
|
|
1805
|
+
float4: "float4",
|
|
1806
|
+
float8: "float8",
|
|
1807
|
+
smallserial: "smallint",
|
|
1808
|
+
serial: "int",
|
|
1809
|
+
bigserial: "bigint:number",
|
|
1810
|
+
"bigserial:number": "bigint:number",
|
|
1811
|
+
oid: "oid",
|
|
1812
|
+
regproc: "regproc",
|
|
1813
|
+
regprocedure: "regprocedure",
|
|
1814
|
+
regoper: "regoper",
|
|
1815
|
+
regoperator: "regoperator",
|
|
1816
|
+
regclass: "regclass",
|
|
1817
|
+
regtype: "regtype",
|
|
1818
|
+
regrole: "regrole",
|
|
1819
|
+
regnamespace: "regnamespace",
|
|
1820
|
+
regconfig: "regconfig",
|
|
1821
|
+
regdictionary: "regdictionary"
|
|
1822
|
+
},
|
|
1823
|
+
int: {
|
|
1824
|
+
smallint: "int",
|
|
1825
|
+
int: "int",
|
|
1826
|
+
bigint: "bigint:number",
|
|
1827
|
+
"bigint:number": "bigint:number",
|
|
1828
|
+
"bigint:string": "bigint:number",
|
|
1829
|
+
numeric: "numeric:number",
|
|
1830
|
+
"numeric:number": "numeric:number",
|
|
1831
|
+
"numeric:bigint": "numeric:number",
|
|
1832
|
+
float4: "float4",
|
|
1833
|
+
float8: "float8",
|
|
1834
|
+
smallserial: "int",
|
|
1835
|
+
serial: "int",
|
|
1836
|
+
bigserial: "bigint:number",
|
|
1837
|
+
"bigserial:number": "bigint:number",
|
|
1838
|
+
oid: "oid",
|
|
1839
|
+
regproc: "regproc",
|
|
1840
|
+
regprocedure: "regprocedure",
|
|
1841
|
+
regoper: "regoper",
|
|
1842
|
+
regoperator: "regoperator",
|
|
1843
|
+
regclass: "regclass",
|
|
1844
|
+
regtype: "regtype",
|
|
1845
|
+
regrole: "regrole",
|
|
1846
|
+
regnamespace: "regnamespace",
|
|
1847
|
+
regconfig: "regconfig",
|
|
1848
|
+
regdictionary: "regdictionary"
|
|
1849
|
+
},
|
|
1850
|
+
bigint: {
|
|
1851
|
+
smallint: "bigint",
|
|
1852
|
+
int: "bigint",
|
|
1853
|
+
bigint: "bigint",
|
|
1854
|
+
"bigint:number": "bigint",
|
|
1855
|
+
"bigint:string": "bigint",
|
|
1856
|
+
numeric: "numeric:bigint",
|
|
1857
|
+
"numeric:number": "numeric:bigint",
|
|
1858
|
+
"numeric:bigint": "numeric:bigint",
|
|
1859
|
+
float4: "float4",
|
|
1860
|
+
float8: "float8",
|
|
1861
|
+
smallserial: "bigint",
|
|
1862
|
+
serial: "bigint",
|
|
1863
|
+
bigserial: "bigint",
|
|
1864
|
+
"bigserial:number": "bigint",
|
|
1865
|
+
oid: "oid",
|
|
1866
|
+
regproc: "regproc",
|
|
1867
|
+
regprocedure: "regprocedure",
|
|
1868
|
+
regoper: "regoper",
|
|
1869
|
+
regoperator: "regoperator",
|
|
1870
|
+
regclass: "regclass",
|
|
1871
|
+
regtype: "regtype",
|
|
1872
|
+
regrole: "regrole",
|
|
1873
|
+
regnamespace: "regnamespace",
|
|
1874
|
+
regconfig: "regconfig",
|
|
1875
|
+
regdictionary: "regdictionary"
|
|
1876
|
+
},
|
|
1877
|
+
"bigint:number": {
|
|
1878
|
+
smallint: "bigint:number",
|
|
1879
|
+
int: "bigint:number",
|
|
1880
|
+
bigint: "bigint:number",
|
|
1881
|
+
"bigint:number": "bigint:number",
|
|
1882
|
+
"bigint:string": "bigint:number",
|
|
1883
|
+
numeric: "numeric:number",
|
|
1884
|
+
"numeric:number": "numeric:number",
|
|
1885
|
+
"numeric:bigint": "numeric:number",
|
|
1886
|
+
float4: "float4",
|
|
1887
|
+
float8: "float8",
|
|
1888
|
+
smallserial: "bigint:number",
|
|
1889
|
+
serial: "bigint:number",
|
|
1890
|
+
bigserial: "bigint:number",
|
|
1891
|
+
"bigserial:number": "bigint:number",
|
|
1892
|
+
oid: "oid",
|
|
1893
|
+
regproc: "regproc",
|
|
1894
|
+
regprocedure: "regprocedure",
|
|
1895
|
+
regoper: "regoper",
|
|
1896
|
+
regoperator: "regoperator",
|
|
1897
|
+
regclass: "regclass",
|
|
1898
|
+
regtype: "regtype",
|
|
1899
|
+
regrole: "regrole",
|
|
1900
|
+
regnamespace: "regnamespace",
|
|
1901
|
+
regconfig: "regconfig",
|
|
1902
|
+
regdictionary: "regdictionary"
|
|
1903
|
+
},
|
|
1904
|
+
"bigint:string": {
|
|
1905
|
+
smallint: "bigint:string",
|
|
1906
|
+
int: "bigint:string",
|
|
1907
|
+
bigint: "bigint:string",
|
|
1908
|
+
"bigint:number": "bigint:string",
|
|
1909
|
+
"bigint:string": "bigint:string",
|
|
1910
|
+
numeric: "numeric",
|
|
1911
|
+
"numeric:number": "numeric",
|
|
1912
|
+
"numeric:bigint": "numeric",
|
|
1913
|
+
float4: "float4",
|
|
1914
|
+
float8: "float8",
|
|
1915
|
+
smallserial: "bigint:string",
|
|
1916
|
+
serial: "bigint:string",
|
|
1917
|
+
bigserial: "bigint:string",
|
|
1918
|
+
"bigserial:number": "bigint:string",
|
|
1919
|
+
oid: "oid",
|
|
1920
|
+
regproc: "regproc",
|
|
1921
|
+
regprocedure: "regprocedure",
|
|
1922
|
+
regoper: "regoper",
|
|
1923
|
+
regoperator: "regoperator",
|
|
1924
|
+
regclass: "regclass",
|
|
1925
|
+
regtype: "regtype",
|
|
1926
|
+
regrole: "regrole",
|
|
1927
|
+
regnamespace: "regnamespace",
|
|
1928
|
+
regconfig: "regconfig",
|
|
1929
|
+
regdictionary: "regdictionary"
|
|
1930
|
+
},
|
|
1931
|
+
numeric: {
|
|
1932
|
+
smallint: "numeric",
|
|
1933
|
+
int: "numeric",
|
|
1934
|
+
bigint: "numeric",
|
|
1935
|
+
"bigint:number": "numeric",
|
|
1936
|
+
"bigint:string": "numeric",
|
|
1937
|
+
numeric: "numeric",
|
|
1938
|
+
"numeric:number": "numeric",
|
|
1939
|
+
"numeric:bigint": "numeric",
|
|
1940
|
+
float4: "float4",
|
|
1941
|
+
float8: "float8",
|
|
1942
|
+
smallserial: "numeric",
|
|
1943
|
+
serial: "numeric",
|
|
1944
|
+
bigserial: "numeric",
|
|
1945
|
+
"bigserial:number": "numeric"
|
|
1946
|
+
},
|
|
1947
|
+
"numeric:number": {
|
|
1948
|
+
smallint: "numeric:number",
|
|
1949
|
+
int: "numeric:number",
|
|
1950
|
+
bigint: "numeric:number",
|
|
1951
|
+
"bigint:number": "numeric:number",
|
|
1952
|
+
"bigint:string": "numeric:number",
|
|
1953
|
+
numeric: "numeric:number",
|
|
1954
|
+
"numeric:number": "numeric:number",
|
|
1955
|
+
"numeric:bigint": "numeric:number",
|
|
1956
|
+
float4: "float4",
|
|
1957
|
+
float8: "float8",
|
|
1958
|
+
smallserial: "numeric:number",
|
|
1959
|
+
serial: "numeric:number",
|
|
1960
|
+
bigserial: "numeric:number",
|
|
1961
|
+
"bigserial:number": "numeric:number"
|
|
1962
|
+
},
|
|
1963
|
+
"numeric:bigint": {
|
|
1964
|
+
smallint: "numeric:bigint",
|
|
1965
|
+
int: "numeric:bigint",
|
|
1966
|
+
bigint: "numeric:bigint",
|
|
1967
|
+
"bigint:number": "numeric:bigint",
|
|
1968
|
+
"bigint:string": "numeric:bigint",
|
|
1969
|
+
numeric: "numeric:bigint",
|
|
1970
|
+
"numeric:number": "numeric:bigint",
|
|
1971
|
+
"numeric:bigint": "numeric:bigint",
|
|
1972
|
+
float4: "float4",
|
|
1973
|
+
float8: "float8",
|
|
1974
|
+
smallserial: "numeric:bigint",
|
|
1975
|
+
serial: "numeric:bigint",
|
|
1976
|
+
bigserial: "numeric:bigint",
|
|
1977
|
+
"bigserial:number": "numeric:bigint"
|
|
1978
|
+
},
|
|
1979
|
+
float4: {
|
|
1980
|
+
smallint: "float4",
|
|
1981
|
+
int: "float4",
|
|
1982
|
+
bigint: "float4",
|
|
1983
|
+
"bigint:number": "float4",
|
|
1984
|
+
"bigint:string": "float4",
|
|
1985
|
+
numeric: "float4",
|
|
1986
|
+
"numeric:number": "float4",
|
|
1987
|
+
"numeric:bigint": "float4",
|
|
1988
|
+
float4: "float4",
|
|
1989
|
+
float8: "float8",
|
|
1990
|
+
smallserial: "float4",
|
|
1991
|
+
serial: "float4",
|
|
1992
|
+
bigserial: "float4",
|
|
1993
|
+
"bigserial:number": "float4"
|
|
1994
|
+
},
|
|
1995
|
+
float8: {
|
|
1996
|
+
smallint: "float8",
|
|
1997
|
+
int: "float8",
|
|
1998
|
+
bigint: "float8",
|
|
1999
|
+
"bigint:number": "float8",
|
|
2000
|
+
"bigint:string": "float8",
|
|
2001
|
+
numeric: "float8",
|
|
2002
|
+
"numeric:number": "float8",
|
|
2003
|
+
"numeric:bigint": "float8",
|
|
2004
|
+
float4: "float8",
|
|
2005
|
+
float8: "float8",
|
|
2006
|
+
smallserial: "float8",
|
|
2007
|
+
serial: "float8",
|
|
2008
|
+
bigserial: "float8",
|
|
2009
|
+
"bigserial:number": "float8"
|
|
2010
|
+
},
|
|
2011
|
+
money: { money: "money" },
|
|
2012
|
+
smallserial: {
|
|
2013
|
+
smallint: "smallint",
|
|
2014
|
+
int: "int",
|
|
2015
|
+
bigint: "bigint:number",
|
|
2016
|
+
"bigint:number": "bigint:number",
|
|
2017
|
+
"bigint:string": "bigint:number",
|
|
2018
|
+
numeric: "numeric:number",
|
|
2019
|
+
"numeric:number": "numeric:number",
|
|
2020
|
+
"numeric:bigint": "numeric:number",
|
|
2021
|
+
float4: "float4",
|
|
2022
|
+
float8: "float8",
|
|
2023
|
+
smallserial: "smallint",
|
|
2024
|
+
serial: "int",
|
|
2025
|
+
bigserial: "bigint:number",
|
|
2026
|
+
"bigserial:number": "bigint:number",
|
|
2027
|
+
oid: "oid",
|
|
2028
|
+
regproc: "regproc",
|
|
2029
|
+
regprocedure: "regprocedure",
|
|
2030
|
+
regoper: "regoper",
|
|
2031
|
+
regoperator: "regoperator",
|
|
2032
|
+
regclass: "regclass",
|
|
2033
|
+
regtype: "regtype",
|
|
2034
|
+
regrole: "regrole",
|
|
2035
|
+
regnamespace: "regnamespace",
|
|
2036
|
+
regconfig: "regconfig",
|
|
2037
|
+
regdictionary: "regdictionary"
|
|
2038
|
+
},
|
|
2039
|
+
serial: {
|
|
2040
|
+
smallint: "int",
|
|
2041
|
+
int: "int",
|
|
2042
|
+
bigint: "bigint:number",
|
|
2043
|
+
"bigint:number": "bigint:number",
|
|
2044
|
+
"bigint:string": "bigint:number",
|
|
2045
|
+
numeric: "numeric:number",
|
|
2046
|
+
"numeric:number": "numeric:number",
|
|
2047
|
+
"numeric:bigint": "numeric:number",
|
|
2048
|
+
float4: "float4",
|
|
2049
|
+
float8: "float8",
|
|
2050
|
+
smallserial: "int",
|
|
2051
|
+
serial: "int",
|
|
2052
|
+
bigserial: "bigint:number",
|
|
2053
|
+
"bigserial:number": "bigint:number",
|
|
2054
|
+
oid: "oid",
|
|
2055
|
+
regproc: "regproc",
|
|
2056
|
+
regprocedure: "regprocedure",
|
|
2057
|
+
regoper: "regoper",
|
|
2058
|
+
regoperator: "regoperator",
|
|
2059
|
+
regclass: "regclass",
|
|
2060
|
+
regtype: "regtype",
|
|
2061
|
+
regrole: "regrole",
|
|
2062
|
+
regnamespace: "regnamespace",
|
|
2063
|
+
regconfig: "regconfig",
|
|
2064
|
+
regdictionary: "regdictionary"
|
|
2065
|
+
},
|
|
2066
|
+
bigserial: {
|
|
2067
|
+
smallint: "bigint",
|
|
2068
|
+
int: "bigint",
|
|
2069
|
+
bigint: "bigint",
|
|
2070
|
+
"bigint:number": "bigint",
|
|
2071
|
+
"bigint:string": "bigint",
|
|
2072
|
+
numeric: "numeric:bigint",
|
|
2073
|
+
"numeric:number": "numeric:bigint",
|
|
2074
|
+
"numeric:bigint": "numeric:bigint",
|
|
2075
|
+
float4: "float4",
|
|
2076
|
+
float8: "float8",
|
|
2077
|
+
smallserial: "bigint",
|
|
2078
|
+
serial: "bigint",
|
|
2079
|
+
bigserial: "bigint",
|
|
2080
|
+
"bigserial:number": "bigint",
|
|
2081
|
+
oid: "oid",
|
|
2082
|
+
regproc: "regproc",
|
|
2083
|
+
regprocedure: "regprocedure",
|
|
2084
|
+
regoper: "regoper",
|
|
2085
|
+
regoperator: "regoperator",
|
|
2086
|
+
regclass: "regclass",
|
|
2087
|
+
regtype: "regtype",
|
|
2088
|
+
regrole: "regrole",
|
|
2089
|
+
regnamespace: "regnamespace",
|
|
2090
|
+
regconfig: "regconfig",
|
|
2091
|
+
regdictionary: "regdictionary"
|
|
2092
|
+
},
|
|
2093
|
+
"bigserial:number": {
|
|
2094
|
+
smallint: "bigint:number",
|
|
2095
|
+
int: "bigint:number",
|
|
2096
|
+
bigint: "bigint:number",
|
|
2097
|
+
"bigint:number": "bigint:number",
|
|
2098
|
+
"bigint:string": "bigint:number",
|
|
2099
|
+
numeric: "numeric:number",
|
|
2100
|
+
"numeric:number": "numeric:number",
|
|
2101
|
+
"numeric:bigint": "numeric:number",
|
|
2102
|
+
float4: "float4",
|
|
2103
|
+
float8: "float8",
|
|
2104
|
+
smallserial: "bigint:number",
|
|
2105
|
+
serial: "bigint:number",
|
|
2106
|
+
bigserial: "bigint:number",
|
|
2107
|
+
"bigserial:number": "bigint:number",
|
|
2108
|
+
oid: "oid",
|
|
2109
|
+
regproc: "regproc",
|
|
2110
|
+
regprocedure: "regprocedure",
|
|
2111
|
+
regoper: "regoper",
|
|
2112
|
+
regoperator: "regoperator",
|
|
2113
|
+
regclass: "regclass",
|
|
2114
|
+
regtype: "regtype",
|
|
2115
|
+
regrole: "regrole",
|
|
2116
|
+
regnamespace: "regnamespace",
|
|
2117
|
+
regconfig: "regconfig",
|
|
2118
|
+
regdictionary: "regdictionary"
|
|
2119
|
+
},
|
|
2120
|
+
char: {
|
|
2121
|
+
char: "char",
|
|
2122
|
+
varchar: "char",
|
|
2123
|
+
text: "char"
|
|
2124
|
+
},
|
|
2125
|
+
varchar: {
|
|
2126
|
+
char: "varchar",
|
|
2127
|
+
varchar: "varchar",
|
|
2128
|
+
text: "varchar"
|
|
2129
|
+
},
|
|
2130
|
+
text: {
|
|
2131
|
+
char: "text",
|
|
2132
|
+
varchar: "text",
|
|
2133
|
+
text: "text"
|
|
2134
|
+
},
|
|
2135
|
+
bytea: { bytea: "bytea" },
|
|
2136
|
+
date: {
|
|
2137
|
+
date: "date",
|
|
2138
|
+
"date:string": "date",
|
|
2139
|
+
timestamp: "timestamp",
|
|
2140
|
+
"timestamp:string": "timestamp",
|
|
2141
|
+
timestamptz: "timestamptz",
|
|
2142
|
+
"timestamptz:string": "timestamptz"
|
|
2143
|
+
},
|
|
2144
|
+
"date:string": {
|
|
2145
|
+
date: "date:string",
|
|
2146
|
+
"date:string": "date:string",
|
|
2147
|
+
timestamp: "timestamp:string",
|
|
2148
|
+
"timestamp:string": "timestamp:string",
|
|
2149
|
+
timestamptz: "timestamptz:string",
|
|
2150
|
+
"timestamptz:string": "timestamptz:string"
|
|
2151
|
+
},
|
|
2152
|
+
time: {
|
|
2153
|
+
time: "time",
|
|
2154
|
+
timetz: "timetz"
|
|
2155
|
+
},
|
|
2156
|
+
timetz: {
|
|
2157
|
+
time: "timetz",
|
|
2158
|
+
timetz: "timetz"
|
|
2159
|
+
},
|
|
2160
|
+
timestamp: {
|
|
2161
|
+
date: "timestamp",
|
|
2162
|
+
"date:string": "timestamp",
|
|
2163
|
+
timestamp: "timestamp",
|
|
2164
|
+
"timestamp:string": "timestamp",
|
|
2165
|
+
timestamptz: "timestamptz",
|
|
2166
|
+
"timestamptz:string": "timestamptz"
|
|
2167
|
+
},
|
|
2168
|
+
"timestamp:string": {
|
|
2169
|
+
date: "timestamp:string",
|
|
2170
|
+
"date:string": "timestamp:string",
|
|
2171
|
+
timestamp: "timestamp:string",
|
|
2172
|
+
"timestamp:string": "timestamp:string",
|
|
2173
|
+
timestamptz: "timestamptz:string",
|
|
2174
|
+
"timestamptz:string": "timestamptz:string"
|
|
2175
|
+
},
|
|
2176
|
+
timestamptz: {
|
|
2177
|
+
date: "timestamptz",
|
|
2178
|
+
"date:string": "timestamptz",
|
|
2179
|
+
timestamp: "timestamptz",
|
|
2180
|
+
"timestamp:string": "timestamptz",
|
|
2181
|
+
timestamptz: "timestamptz",
|
|
2182
|
+
"timestamptz:string": "timestamptz"
|
|
2183
|
+
},
|
|
2184
|
+
"timestamptz:string": {
|
|
2185
|
+
date: "timestamptz:string",
|
|
2186
|
+
"date:string": "timestamptz:string",
|
|
2187
|
+
timestamp: "timestamptz:string",
|
|
2188
|
+
"timestamp:string": "timestamptz:string",
|
|
2189
|
+
timestamptz: "timestamptz:string",
|
|
2190
|
+
"timestamptz:string": "timestamptz:string"
|
|
2191
|
+
},
|
|
2192
|
+
interval: {
|
|
2193
|
+
interval: "interval",
|
|
2194
|
+
"interval:tuple": "interval"
|
|
2195
|
+
},
|
|
2196
|
+
"interval:tuple": {
|
|
2197
|
+
interval: "interval:tuple",
|
|
2198
|
+
"interval:tuple": "interval:tuple"
|
|
2199
|
+
},
|
|
2200
|
+
bool: { bool: "bool" },
|
|
2201
|
+
enum: { enum: "enum" },
|
|
2202
|
+
point: {
|
|
2203
|
+
point: "point",
|
|
2204
|
+
"point:tuple": "point"
|
|
2205
|
+
},
|
|
2206
|
+
"point:tuple": {
|
|
2207
|
+
point: "point:tuple",
|
|
2208
|
+
"point:tuple": "point:tuple"
|
|
2209
|
+
},
|
|
2210
|
+
line: {
|
|
2211
|
+
line: "line",
|
|
2212
|
+
"line:tuple": "line"
|
|
2213
|
+
},
|
|
2214
|
+
"line:tuple": {
|
|
2215
|
+
line: "line:tuple",
|
|
2216
|
+
"line:tuple": "line:tuple"
|
|
2217
|
+
},
|
|
2218
|
+
lseg: { lseg: "lseg" },
|
|
2219
|
+
box: { box: "box" },
|
|
2220
|
+
path: { path: "path" },
|
|
2221
|
+
polygon: { polygon: "polygon" },
|
|
2222
|
+
circle: { circle: "circle" },
|
|
2223
|
+
cidr: {
|
|
2224
|
+
cidr: "cidr",
|
|
2225
|
+
inet: "inet"
|
|
2226
|
+
},
|
|
2227
|
+
inet: {
|
|
2228
|
+
cidr: "inet",
|
|
2229
|
+
inet: "inet"
|
|
2230
|
+
},
|
|
2231
|
+
macaddr: {
|
|
2232
|
+
macaddr: "macaddr",
|
|
2233
|
+
macaddr8: "macaddr"
|
|
2234
|
+
},
|
|
2235
|
+
macaddr8: {
|
|
2236
|
+
macaddr: "macaddr8",
|
|
2237
|
+
macaddr8: "macaddr8"
|
|
2238
|
+
},
|
|
2239
|
+
bit: {
|
|
2240
|
+
bit: "bit",
|
|
2241
|
+
varbit: "bit"
|
|
2242
|
+
},
|
|
2243
|
+
varbit: {
|
|
2244
|
+
bit: "varbit",
|
|
2245
|
+
varbit: "varbit"
|
|
2246
|
+
},
|
|
2247
|
+
tsvector: { tsvector: "tsvector" },
|
|
2248
|
+
tsquery: { tsquery: "tsquery" },
|
|
2249
|
+
uuid: { uuid: "uuid" },
|
|
2250
|
+
xml: { xml: "xml" },
|
|
2251
|
+
json: { json: "json" },
|
|
2252
|
+
jsonb: { jsonb: "jsonb" },
|
|
2253
|
+
int4range: { int4range: "int4range" },
|
|
2254
|
+
int8range: { int8range: "int8range" },
|
|
2255
|
+
numrange: { numrange: "numrange" },
|
|
2256
|
+
tsrange: { tsrange: "tsrange" },
|
|
2257
|
+
tstzrange: { tstzrange: "tstzrange" },
|
|
2258
|
+
daterange: { daterange: "daterange" },
|
|
2259
|
+
int4multirange: { int4multirange: "int4multirange" },
|
|
2260
|
+
int8multirange: { int8multirange: "int8multirange" },
|
|
2261
|
+
nummultirange: { nummultirange: "nummultirange" },
|
|
2262
|
+
tsmultirange: { tsmultirange: "tsmultirange" },
|
|
2263
|
+
tstzmultirange: { tstzmultirange: "tstzmultirange" },
|
|
2264
|
+
datemultirange: { datemultirange: "datemultirange" },
|
|
2265
|
+
oid: {
|
|
2266
|
+
smallint: "oid",
|
|
2267
|
+
int: "oid",
|
|
2268
|
+
bigint: "oid",
|
|
2269
|
+
"bigint:number": "oid",
|
|
2270
|
+
"bigint:string": "oid",
|
|
2271
|
+
smallserial: "oid",
|
|
2272
|
+
serial: "oid",
|
|
2273
|
+
bigserial: "oid",
|
|
2274
|
+
"bigserial:number": "oid",
|
|
2275
|
+
oid: "oid",
|
|
2276
|
+
regproc: "oid",
|
|
2277
|
+
regprocedure: "oid",
|
|
2278
|
+
regoper: "oid",
|
|
2279
|
+
regoperator: "oid",
|
|
2280
|
+
regclass: "oid",
|
|
2281
|
+
regtype: "oid",
|
|
2282
|
+
regrole: "oid",
|
|
2283
|
+
regnamespace: "oid",
|
|
2284
|
+
regconfig: "oid",
|
|
2285
|
+
regdictionary: "oid"
|
|
2286
|
+
},
|
|
2287
|
+
regproc: {
|
|
2288
|
+
smallint: "regproc",
|
|
2289
|
+
int: "regproc",
|
|
2290
|
+
bigint: "regproc",
|
|
2291
|
+
"bigint:number": "regproc",
|
|
2292
|
+
"bigint:string": "regproc",
|
|
2293
|
+
smallserial: "regproc",
|
|
2294
|
+
serial: "regproc",
|
|
2295
|
+
bigserial: "regproc",
|
|
2296
|
+
"bigserial:number": "regproc",
|
|
2297
|
+
oid: "regproc",
|
|
2298
|
+
regproc: "regproc",
|
|
2299
|
+
regprocedure: "regproc"
|
|
2300
|
+
},
|
|
2301
|
+
regprocedure: {
|
|
2302
|
+
smallint: "regprocedure",
|
|
2303
|
+
int: "regprocedure",
|
|
2304
|
+
bigint: "regprocedure",
|
|
2305
|
+
"bigint:number": "regprocedure",
|
|
2306
|
+
"bigint:string": "regprocedure",
|
|
2307
|
+
smallserial: "regprocedure",
|
|
2308
|
+
serial: "regprocedure",
|
|
2309
|
+
bigserial: "regprocedure",
|
|
2310
|
+
"bigserial:number": "regprocedure",
|
|
2311
|
+
oid: "regprocedure",
|
|
2312
|
+
regproc: "regprocedure",
|
|
2313
|
+
regprocedure: "regprocedure"
|
|
2314
|
+
},
|
|
2315
|
+
regoper: {
|
|
2316
|
+
smallint: "regoper",
|
|
2317
|
+
int: "regoper",
|
|
2318
|
+
bigint: "regoper",
|
|
2319
|
+
"bigint:number": "regoper",
|
|
2320
|
+
"bigint:string": "regoper",
|
|
2321
|
+
smallserial: "regoper",
|
|
2322
|
+
serial: "regoper",
|
|
2323
|
+
bigserial: "regoper",
|
|
2324
|
+
"bigserial:number": "regoper",
|
|
2325
|
+
oid: "regoper",
|
|
2326
|
+
regoper: "regoper",
|
|
2327
|
+
regoperator: "regoper"
|
|
2328
|
+
},
|
|
2329
|
+
regoperator: {
|
|
2330
|
+
smallint: "regoperator",
|
|
2331
|
+
int: "regoperator",
|
|
2332
|
+
bigint: "regoperator",
|
|
2333
|
+
"bigint:number": "regoperator",
|
|
2334
|
+
"bigint:string": "regoperator",
|
|
2335
|
+
smallserial: "regoperator",
|
|
2336
|
+
serial: "regoperator",
|
|
2337
|
+
bigserial: "regoperator",
|
|
2338
|
+
"bigserial:number": "regoperator",
|
|
2339
|
+
oid: "regoperator",
|
|
2340
|
+
regoper: "regoperator",
|
|
2341
|
+
regoperator: "regoperator"
|
|
2342
|
+
},
|
|
2343
|
+
regclass: {
|
|
2344
|
+
smallint: "regclass",
|
|
2345
|
+
int: "regclass",
|
|
2346
|
+
bigint: "regclass",
|
|
2347
|
+
"bigint:number": "regclass",
|
|
2348
|
+
"bigint:string": "regclass",
|
|
2349
|
+
smallserial: "regclass",
|
|
2350
|
+
serial: "regclass",
|
|
2351
|
+
bigserial: "regclass",
|
|
2352
|
+
"bigserial:number": "regclass",
|
|
2353
|
+
oid: "regclass",
|
|
2354
|
+
regclass: "regclass"
|
|
2355
|
+
},
|
|
2356
|
+
regtype: {
|
|
2357
|
+
smallint: "regtype",
|
|
2358
|
+
int: "regtype",
|
|
2359
|
+
bigint: "regtype",
|
|
2360
|
+
"bigint:number": "regtype",
|
|
2361
|
+
"bigint:string": "regtype",
|
|
2362
|
+
smallserial: "regtype",
|
|
2363
|
+
serial: "regtype",
|
|
2364
|
+
bigserial: "regtype",
|
|
2365
|
+
"bigserial:number": "regtype",
|
|
2366
|
+
oid: "regtype",
|
|
2367
|
+
regtype: "regtype"
|
|
2368
|
+
},
|
|
2369
|
+
regrole: {
|
|
2370
|
+
smallint: "regrole",
|
|
2371
|
+
int: "regrole",
|
|
2372
|
+
bigint: "regrole",
|
|
2373
|
+
"bigint:number": "regrole",
|
|
2374
|
+
"bigint:string": "regrole",
|
|
2375
|
+
smallserial: "regrole",
|
|
2376
|
+
serial: "regrole",
|
|
2377
|
+
bigserial: "regrole",
|
|
2378
|
+
"bigserial:number": "regrole",
|
|
2379
|
+
oid: "regrole",
|
|
2380
|
+
regrole: "regrole"
|
|
2381
|
+
},
|
|
2382
|
+
regnamespace: {
|
|
2383
|
+
smallint: "regnamespace",
|
|
2384
|
+
int: "regnamespace",
|
|
2385
|
+
bigint: "regnamespace",
|
|
2386
|
+
"bigint:number": "regnamespace",
|
|
2387
|
+
"bigint:string": "regnamespace",
|
|
2388
|
+
smallserial: "regnamespace",
|
|
2389
|
+
serial: "regnamespace",
|
|
2390
|
+
bigserial: "regnamespace",
|
|
2391
|
+
"bigserial:number": "regnamespace",
|
|
2392
|
+
oid: "regnamespace",
|
|
2393
|
+
regnamespace: "regnamespace"
|
|
2394
|
+
},
|
|
2395
|
+
regconfig: {
|
|
2396
|
+
smallint: "regconfig",
|
|
2397
|
+
int: "regconfig",
|
|
2398
|
+
bigint: "regconfig",
|
|
2399
|
+
"bigint:number": "regconfig",
|
|
2400
|
+
"bigint:string": "regconfig",
|
|
2401
|
+
smallserial: "regconfig",
|
|
2402
|
+
serial: "regconfig",
|
|
2403
|
+
bigserial: "regconfig",
|
|
2404
|
+
"bigserial:number": "regconfig",
|
|
2405
|
+
oid: "regconfig",
|
|
2406
|
+
regconfig: "regconfig"
|
|
2407
|
+
},
|
|
2408
|
+
regdictionary: {
|
|
2409
|
+
smallint: "regdictionary",
|
|
2410
|
+
int: "regdictionary",
|
|
2411
|
+
bigint: "regdictionary",
|
|
2412
|
+
"bigint:number": "regdictionary",
|
|
2413
|
+
"bigint:string": "regdictionary",
|
|
2414
|
+
smallserial: "regdictionary",
|
|
2415
|
+
serial: "regdictionary",
|
|
2416
|
+
bigserial: "regdictionary",
|
|
2417
|
+
"bigserial:number": "regdictionary",
|
|
2418
|
+
oid: "regdictionary",
|
|
2419
|
+
regdictionary: "regdictionary"
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2043
2422
|
var castToText = (name2) => sql`${name2}::text`;
|
|
2044
2423
|
var castToTextArr = (name2, arrayDimensions) => sql`${name2}::text${sql.raw("[]".repeat(arrayDimensions))}`;
|
|
2045
2424
|
var arrayCompatCast = (cast) => (name2, arrayDimensions) => {
|
|
@@ -2293,57 +2672,368 @@ var genericPgCodecs = {
|
|
|
2293
2672
|
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
2294
2673
|
}
|
|
2295
2674
|
};
|
|
2296
|
-
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
2675
|
+
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
2676
|
+
|
|
2677
|
+
// node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
2678
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
2679
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
2680
|
+
constructor(name2, fieldConfig, customTypeParams) {
|
|
2681
|
+
super(name2, "custom", "PgCustomColumn");
|
|
2682
|
+
this.config.fieldConfig = fieldConfig;
|
|
2683
|
+
this.config.customTypeParams = customTypeParams;
|
|
2684
|
+
}
|
|
2685
|
+
build(table) {
|
|
2686
|
+
return new PgCustomColumn(table, this.config);
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
var PgCustomColumn = class extends PgColumn {
|
|
2690
|
+
static [entityKind] = "PgCustomColumn";
|
|
2691
|
+
codec;
|
|
2692
|
+
sqlName;
|
|
2693
|
+
mapFromJsonValue;
|
|
2694
|
+
jsonSelectIdentifier;
|
|
2695
|
+
constructor(table, config) {
|
|
2696
|
+
super(table, config);
|
|
2697
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
2698
|
+
this.mapToDriverValue = config.customTypeParams.toDriver ?? this.mapToDriverValue;
|
|
2699
|
+
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
2700
|
+
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
2701
|
+
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
2702
|
+
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
2703
|
+
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
2704
|
+
if (this.dimensions && config.customTypeParams.fromJson)
|
|
2705
|
+
this.mapFromJsonValue = (value) => {
|
|
2706
|
+
if (value === null)
|
|
2707
|
+
return value;
|
|
2708
|
+
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
2709
|
+
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
mapJsonArrayElements(value, mapper, depth) {
|
|
2713
|
+
if (depth > 0 && Array.isArray(value))
|
|
2714
|
+
return value.map((v) => v === null ? null : this.mapJsonArrayElements(v, mapper, depth - 1));
|
|
2715
|
+
return mapper(value);
|
|
2716
|
+
}
|
|
2717
|
+
getSQLType() {
|
|
2718
|
+
return this.sqlName;
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
function customType(customTypeParams) {
|
|
2722
|
+
return (a, b) => {
|
|
2723
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2724
|
+
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
2725
|
+
};
|
|
2726
|
+
}
|
|
2727
|
+
// node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
2728
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
2729
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
2730
|
+
constructor(name2) {
|
|
2731
|
+
super(name2, "number double", "PgDoublePrecision");
|
|
2732
|
+
}
|
|
2733
|
+
build(table) {
|
|
2734
|
+
return new PgDoublePrecision(table, this.config);
|
|
2735
|
+
}
|
|
2736
|
+
};
|
|
2737
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
2738
|
+
static [entityKind] = "PgDoublePrecision";
|
|
2739
|
+
codec = "float8";
|
|
2740
|
+
getSQLType() {
|
|
2741
|
+
return "double precision";
|
|
2742
|
+
}
|
|
2743
|
+
};
|
|
2744
|
+
function doublePrecision(name2) {
|
|
2745
|
+
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
2746
|
+
}
|
|
2747
|
+
// node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
2748
|
+
var PgIntegerBuilder = class extends PgIntColumnBuilder {
|
|
2749
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
2750
|
+
constructor(name2) {
|
|
2751
|
+
super(name2, "number int32", "PgInteger");
|
|
2752
|
+
}
|
|
2753
|
+
build(table) {
|
|
2754
|
+
return new PgInteger(table, this.config);
|
|
2755
|
+
}
|
|
2756
|
+
};
|
|
2757
|
+
var PgInteger = class extends PgColumn {
|
|
2758
|
+
static [entityKind] = "PgInteger";
|
|
2759
|
+
codec = "int";
|
|
2760
|
+
getSQLType() {
|
|
2761
|
+
return "integer";
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
function integer(name2) {
|
|
2765
|
+
return new PgIntegerBuilder(name2 ?? "");
|
|
2766
|
+
}
|
|
2767
|
+
// node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
2768
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
2769
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
2770
|
+
constructor(name2) {
|
|
2771
|
+
super(name2, "object json", "PgJsonb");
|
|
2772
|
+
}
|
|
2773
|
+
build(table) {
|
|
2774
|
+
return new PgJsonb(table, this.config);
|
|
2775
|
+
}
|
|
2776
|
+
};
|
|
2777
|
+
var PgJsonb = class extends PgColumn {
|
|
2778
|
+
static [entityKind] = "PgJsonb";
|
|
2779
|
+
codec = "jsonb";
|
|
2780
|
+
constructor(table, config) {
|
|
2781
|
+
super(table, config);
|
|
2782
|
+
}
|
|
2783
|
+
getSQLType() {
|
|
2784
|
+
return "jsonb";
|
|
2785
|
+
}
|
|
2786
|
+
};
|
|
2787
|
+
function jsonb(name2) {
|
|
2788
|
+
return new PgJsonbBuilder(name2 ?? "");
|
|
2789
|
+
}
|
|
2790
|
+
// node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
2791
|
+
var PgSmallIntBuilder = class extends PgIntColumnBuilder {
|
|
2792
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
2793
|
+
constructor(name2) {
|
|
2794
|
+
super(name2, "number int16", "PgSmallInt");
|
|
2795
|
+
}
|
|
2796
|
+
build(table) {
|
|
2797
|
+
return new PgSmallInt(table, this.config);
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
var PgSmallInt = class extends PgColumn {
|
|
2801
|
+
static [entityKind] = "PgSmallInt";
|
|
2802
|
+
codec = "smallint";
|
|
2803
|
+
getSQLType() {
|
|
2804
|
+
return "smallint";
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2807
|
+
function smallint(name2) {
|
|
2808
|
+
return new PgSmallIntBuilder(name2 ?? "");
|
|
2809
|
+
}
|
|
2810
|
+
// node_modules/drizzle-orm/pg-core/columns/text.js
|
|
2811
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
2812
|
+
static [entityKind] = "PgTextBuilder";
|
|
2813
|
+
constructor(name2, config) {
|
|
2814
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
2815
|
+
this.config.enumValues = config.enum;
|
|
2816
|
+
}
|
|
2817
|
+
build(table) {
|
|
2818
|
+
return new PgText(table, this.config, this.config.enumValues);
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
var PgText = class extends PgColumn {
|
|
2822
|
+
static [entityKind] = "PgText";
|
|
2823
|
+
enumValues;
|
|
2824
|
+
codec = "text";
|
|
2825
|
+
constructor(table, config, enumValues) {
|
|
2826
|
+
super(table, config);
|
|
2827
|
+
this.enumValues = enumValues;
|
|
2828
|
+
}
|
|
2829
|
+
getSQLType() {
|
|
2830
|
+
return "text";
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
function text(a, b = {}) {
|
|
2834
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2835
|
+
return new PgTextBuilder(name2, config);
|
|
2836
|
+
}
|
|
2837
|
+
// node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
2838
|
+
var PgDateColumnBuilder = class extends PgColumnBuilder {
|
|
2839
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
2840
|
+
defaultNow() {
|
|
2841
|
+
return this.default(sql`now()`);
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2844
|
+
|
|
2845
|
+
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
2846
|
+
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
2847
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
2848
|
+
constructor(name2, withTimezone, precision) {
|
|
2849
|
+
super(name2, "object date", "PgTimestamp");
|
|
2850
|
+
this.config.withTimezone = withTimezone;
|
|
2851
|
+
this.config.precision = precision;
|
|
2852
|
+
}
|
|
2853
|
+
build(table) {
|
|
2854
|
+
return new PgTimestamp(table, this.config);
|
|
2855
|
+
}
|
|
2856
|
+
};
|
|
2857
|
+
var PgTimestamp = class extends PgColumn {
|
|
2858
|
+
static [entityKind] = "PgTimestamp";
|
|
2859
|
+
codec;
|
|
2860
|
+
withTimezone;
|
|
2861
|
+
precision;
|
|
2862
|
+
constructor(table, config) {
|
|
2863
|
+
super(table, config);
|
|
2864
|
+
this.withTimezone = config.withTimezone;
|
|
2865
|
+
this.precision = config.precision;
|
|
2866
|
+
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
2867
|
+
}
|
|
2868
|
+
getSQLType() {
|
|
2869
|
+
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
2870
|
+
}
|
|
2871
|
+
mapToDriverValue = (value) => {
|
|
2872
|
+
if (typeof value === "string")
|
|
2873
|
+
return value;
|
|
2874
|
+
return value.toISOString();
|
|
2875
|
+
};
|
|
2876
|
+
};
|
|
2877
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
2878
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
2879
|
+
constructor(name2, withTimezone, precision) {
|
|
2880
|
+
super(name2, "string timestamp", "PgTimestampString");
|
|
2881
|
+
this.config.withTimezone = withTimezone;
|
|
2882
|
+
this.config.precision = precision;
|
|
2883
|
+
}
|
|
2884
|
+
build(table) {
|
|
2885
|
+
return new PgTimestampString(table, this.config);
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
var PgTimestampString = class extends PgColumn {
|
|
2889
|
+
static [entityKind] = "PgTimestampString";
|
|
2890
|
+
codec;
|
|
2891
|
+
withTimezone;
|
|
2892
|
+
precision;
|
|
2893
|
+
constructor(table, config) {
|
|
2894
|
+
super(table, config);
|
|
2895
|
+
this.withTimezone = config.withTimezone;
|
|
2896
|
+
this.precision = config.precision;
|
|
2897
|
+
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
2898
|
+
}
|
|
2899
|
+
getSQLType() {
|
|
2900
|
+
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
2901
|
+
}
|
|
2902
|
+
mapToDriverValue = (value) => {
|
|
2903
|
+
if (typeof value === "string")
|
|
2904
|
+
return value;
|
|
2905
|
+
return value.toISOString();
|
|
2906
|
+
};
|
|
2907
|
+
};
|
|
2908
|
+
function timestamp(a, b = {}) {
|
|
2909
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2910
|
+
if (config?.mode === "string")
|
|
2911
|
+
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
2912
|
+
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
2913
|
+
}
|
|
2914
|
+
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
2915
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
2916
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
2917
|
+
constructor(name2, config) {
|
|
2918
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
2919
|
+
this.config.length = config.length;
|
|
2920
|
+
this.config.enumValues = config.enum;
|
|
2921
|
+
}
|
|
2922
|
+
build(table) {
|
|
2923
|
+
return new PgVarchar(table, this.config);
|
|
2924
|
+
}
|
|
2925
|
+
};
|
|
2926
|
+
var PgVarchar = class extends PgColumn {
|
|
2927
|
+
static [entityKind] = "PgVarchar";
|
|
2928
|
+
codec = "varchar";
|
|
2929
|
+
enumValues;
|
|
2930
|
+
constructor(table, config) {
|
|
2931
|
+
super(table, config);
|
|
2932
|
+
this.enumValues = config.enumValues;
|
|
2933
|
+
}
|
|
2934
|
+
getSQLType() {
|
|
2935
|
+
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
function varchar(a, b = {}) {
|
|
2939
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2940
|
+
return new PgVarcharBuilder(name2, config);
|
|
2941
|
+
}
|
|
2942
|
+
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
2943
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
2944
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
2945
|
+
constructor(name2) {
|
|
2946
|
+
super(name2, "number int53", "PgBigSerial53");
|
|
2947
|
+
this.config.hasDefault = true;
|
|
2948
|
+
this.config.notNull = true;
|
|
2949
|
+
}
|
|
2950
|
+
build(table) {
|
|
2951
|
+
return new PgBigSerial53(table, this.config);
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
2955
|
+
static [entityKind] = "PgBigSerial53";
|
|
2956
|
+
codec = "bigserial:number";
|
|
2957
|
+
getSQLType() {
|
|
2958
|
+
return "bigserial";
|
|
2959
|
+
}
|
|
2960
|
+
};
|
|
2961
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
2962
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
2963
|
+
constructor(name2) {
|
|
2964
|
+
super(name2, "bigint int64", "PgBigSerial64");
|
|
2965
|
+
this.config.hasDefault = true;
|
|
2966
|
+
this.config.notNull = true;
|
|
2967
|
+
}
|
|
2968
|
+
build(table) {
|
|
2969
|
+
return new PgBigSerial64(table, this.config);
|
|
2970
|
+
}
|
|
2971
|
+
};
|
|
2972
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
2973
|
+
static [entityKind] = "PgBigSerial64";
|
|
2974
|
+
codec = "bigserial";
|
|
2975
|
+
getSQLType() {
|
|
2976
|
+
return "bigserial";
|
|
2977
|
+
}
|
|
2978
|
+
};
|
|
2979
|
+
function bigserial(a, b) {
|
|
2980
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2981
|
+
if (config.mode === "number")
|
|
2982
|
+
return new PgBigSerial53Builder(name2);
|
|
2983
|
+
return new PgBigSerial64Builder(name2);
|
|
2984
|
+
}
|
|
2297
2985
|
|
|
2298
|
-
// node_modules/drizzle-orm/pg-core/columns/
|
|
2299
|
-
var
|
|
2300
|
-
static [entityKind] = "
|
|
2301
|
-
constructor(name2,
|
|
2302
|
-
super(name2, "
|
|
2303
|
-
this.config.
|
|
2304
|
-
this.config.
|
|
2986
|
+
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
2987
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
2988
|
+
static [entityKind] = "PgCharBuilder";
|
|
2989
|
+
constructor(name2, config) {
|
|
2990
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
2991
|
+
this.config.length = config.length ?? 1;
|
|
2992
|
+
this.config.setLength = config.length !== undefined;
|
|
2993
|
+
this.config.enumValues = config.enum;
|
|
2305
2994
|
}
|
|
2306
2995
|
build(table) {
|
|
2307
|
-
return new
|
|
2996
|
+
return new PgChar(table, this.config);
|
|
2308
2997
|
}
|
|
2309
2998
|
};
|
|
2310
|
-
var
|
|
2311
|
-
static [entityKind] = "
|
|
2312
|
-
codec;
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
jsonSelectIdentifier;
|
|
2999
|
+
var PgChar = class extends PgColumn {
|
|
3000
|
+
static [entityKind] = "PgChar";
|
|
3001
|
+
codec = "char";
|
|
3002
|
+
enumValues;
|
|
3003
|
+
setLength;
|
|
2316
3004
|
constructor(table, config) {
|
|
2317
3005
|
super(table, config);
|
|
2318
|
-
this.
|
|
2319
|
-
this.
|
|
2320
|
-
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
2321
|
-
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
2322
|
-
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
2323
|
-
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
2324
|
-
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
2325
|
-
if (this.dimensions && config.customTypeParams.fromJson)
|
|
2326
|
-
this.mapFromJsonValue = (value) => {
|
|
2327
|
-
if (value === null)
|
|
2328
|
-
return value;
|
|
2329
|
-
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
2330
|
-
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
2331
|
-
};
|
|
3006
|
+
this.enumValues = config.enumValues;
|
|
3007
|
+
this.setLength = config.setLength;
|
|
2332
3008
|
}
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
3009
|
+
getSQLType() {
|
|
3010
|
+
return this.setLength ? `char(${this.length})` : `char`;
|
|
3011
|
+
}
|
|
3012
|
+
};
|
|
3013
|
+
function char(a, b = {}) {
|
|
3014
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3015
|
+
return new PgCharBuilder(name2, config);
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
3019
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
3020
|
+
static [entityKind] = "PgCidrBuilder";
|
|
3021
|
+
constructor(name2) {
|
|
3022
|
+
super(name2, "string cidr", "PgCidr");
|
|
3023
|
+
}
|
|
3024
|
+
build(table) {
|
|
3025
|
+
return new PgCidr(table, this.config);
|
|
2337
3026
|
}
|
|
3027
|
+
};
|
|
3028
|
+
var PgCidr = class extends PgColumn {
|
|
3029
|
+
static [entityKind] = "PgCidr";
|
|
3030
|
+
codec = "cidr";
|
|
2338
3031
|
getSQLType() {
|
|
2339
|
-
return
|
|
3032
|
+
return "cidr";
|
|
2340
3033
|
}
|
|
2341
3034
|
};
|
|
2342
|
-
function
|
|
2343
|
-
return (
|
|
2344
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
2345
|
-
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
2346
|
-
};
|
|
3035
|
+
function cidr(name2) {
|
|
3036
|
+
return new PgCidrBuilder(name2 ?? "");
|
|
2347
3037
|
}
|
|
2348
3038
|
|
|
2349
3039
|
// node_modules/drizzle-orm/pg-core/columns/date.js
|
|
@@ -8357,12 +9047,12 @@ async function hashQuery(sql2, params) {
|
|
|
8357
9047
|
var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
8358
9048
|
static [entityKind] = "PgCountBuilder";
|
|
8359
9049
|
dialect;
|
|
8360
|
-
static
|
|
9050
|
+
static buildCount(source, filters, parens) {
|
|
8361
9051
|
const query = sql`select count(*) from ${source}${sql` where ${filters}`.if(filters)}`;
|
|
8362
9052
|
return parens ? sql`(${query})` : query;
|
|
8363
9053
|
}
|
|
8364
9054
|
constructor(countConfig) {
|
|
8365
|
-
super(PgCountBuilder2.
|
|
9055
|
+
super(PgCountBuilder2.buildCount(countConfig.source, countConfig.filters, true).queryChunks);
|
|
8366
9056
|
this.countConfig = countConfig;
|
|
8367
9057
|
this.dialect = countConfig.dialect;
|
|
8368
9058
|
this.mapWith((e) => {
|
|
@@ -8371,10 +9061,13 @@ var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
|
8371
9061
|
return Number(e ?? 0);
|
|
8372
9062
|
});
|
|
8373
9063
|
}
|
|
9064
|
+
executableSql;
|
|
8374
9065
|
build() {
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
9066
|
+
if (!this.executableSql) {
|
|
9067
|
+
const { source, filters } = this.countConfig;
|
|
9068
|
+
this.executableSql = PgCountBuilder2.buildCount(source, filters);
|
|
9069
|
+
}
|
|
9070
|
+
return this.dialect.sqlToQuery(this.executableSql);
|
|
8378
9071
|
}
|
|
8379
9072
|
};
|
|
8380
9073
|
|
|
@@ -8626,7 +9319,6 @@ var SelectionProxyHandler = class SelectionProxyHandler2 {
|
|
|
8626
9319
|
var PgDeleteBase2 = class {
|
|
8627
9320
|
static [entityKind] = "PgDelete";
|
|
8628
9321
|
config;
|
|
8629
|
-
cacheConfig;
|
|
8630
9322
|
constructor(table, session, dialect, withList) {
|
|
8631
9323
|
this.session = session;
|
|
8632
9324
|
this.dialect = dialect;
|
|
@@ -8674,7 +9366,7 @@ var PgDeleteBase2 = class {
|
|
|
8674
9366
|
var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
8675
9367
|
static [entityKind] = "PgAsyncDelete";
|
|
8676
9368
|
_prepare(name2, generateName = false) {
|
|
8677
|
-
const { session, config, dialect
|
|
9369
|
+
const { session, config, dialect } = this;
|
|
8678
9370
|
const { returning: fields } = config;
|
|
8679
9371
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
8680
9372
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -8682,7 +9374,7 @@ var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
|
8682
9374
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
8683
9375
|
type: "delete",
|
|
8684
9376
|
tables: [...extractUsedTable(this.config.table)]
|
|
8685
|
-
}
|
|
9377
|
+
});
|
|
8686
9378
|
});
|
|
8687
9379
|
}
|
|
8688
9380
|
prepare(name2) {
|
|
@@ -8729,7 +9421,6 @@ var PgSelectBuilder2 = class {
|
|
|
8729
9421
|
if (config.withList)
|
|
8730
9422
|
this.withList = config.withList;
|
|
8731
9423
|
this.distinct = config.distinct;
|
|
8732
|
-
this.tagged = config.tagged;
|
|
8733
9424
|
}
|
|
8734
9425
|
from(source) {
|
|
8735
9426
|
const isPartialSelect = !!this.fields;
|
|
@@ -8752,8 +9443,7 @@ var PgSelectBuilder2 = class {
|
|
|
8752
9443
|
session: this.session,
|
|
8753
9444
|
dialect: this.dialect,
|
|
8754
9445
|
withList: this.withList,
|
|
8755
|
-
distinct: this.distinct
|
|
8756
|
-
tagged: this.tagged
|
|
9446
|
+
distinct: this.distinct
|
|
8757
9447
|
});
|
|
8758
9448
|
}
|
|
8759
9449
|
};
|
|
@@ -8777,8 +9467,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
8777
9467
|
table: config.table,
|
|
8778
9468
|
fields: { ...config.fields },
|
|
8779
9469
|
distinct: config.distinct,
|
|
8780
|
-
setOperators: []
|
|
8781
|
-
_tagged: config.tagged
|
|
9470
|
+
setOperators: []
|
|
8782
9471
|
};
|
|
8783
9472
|
this.isPartialSelect = config.isPartialSelect;
|
|
8784
9473
|
this._ = {
|
|
@@ -8955,6 +9644,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
8955
9644
|
return this;
|
|
8956
9645
|
}
|
|
8957
9646
|
getSQL() {
|
|
9647
|
+
this.config.fieldsFlat = orderSelectedFields2(this.config.fields, undefined, this.dialect.codecs);
|
|
8958
9648
|
return this.dialect.buildSelectQuery(this.config);
|
|
8959
9649
|
}
|
|
8960
9650
|
toSQL() {
|
|
@@ -9050,7 +9740,6 @@ params: ${params}`);
|
|
|
9050
9740
|
this.cause = cause;
|
|
9051
9741
|
}
|
|
9052
9742
|
};
|
|
9053
|
-
|
|
9054
9743
|
// node_modules/drizzle-orm/relations.js
|
|
9055
9744
|
var Relation2 = class {
|
|
9056
9745
|
static [entityKind] = "RelationV2";
|
|
@@ -9131,15 +9820,13 @@ var orderByOperators2 = {
|
|
|
9131
9820
|
asc,
|
|
9132
9821
|
desc
|
|
9133
9822
|
};
|
|
9134
|
-
function mapRelationalRow2(rows, isOne, buildQueryResultSelection,
|
|
9823
|
+
function mapRelationalRow2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false, useJsonMappers = true) {
|
|
9135
9824
|
const maxIdx = isOne ? 1 : rows.length;
|
|
9136
9825
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
9137
9826
|
let decoder;
|
|
9138
|
-
if (is(field, Column))
|
|
9139
|
-
if (useJsonMappers && field.mapFromJsonValue)
|
|
9140
|
-
return (v2) => field.mapFromJsonValue(v2);
|
|
9827
|
+
if (is(field, Column))
|
|
9141
9828
|
decoder = field;
|
|
9142
|
-
|
|
9829
|
+
else if (is(field, SQL))
|
|
9143
9830
|
decoder = field.decoder;
|
|
9144
9831
|
else if (is(field, SQL.Aliased))
|
|
9145
9832
|
decoder = field.sql.decoder;
|
|
@@ -9147,6 +9834,8 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9147
9834
|
decoder = noopDecoder;
|
|
9148
9835
|
else
|
|
9149
9836
|
decoder = field.getSQL().decoder;
|
|
9837
|
+
if (useJsonMappers && field.mapFromJsonValue)
|
|
9838
|
+
return (v2) => field.mapFromJsonValue(v2);
|
|
9150
9839
|
return decoder.mapFromDriverValue.isNoop ? codec ? (value) => codec(value, arrayDimensions) : undefined : codec ? (value) => decoder.mapFromDriverValue(codec(value, arrayDimensions)) : (value) => decoder.mapFromDriverValue(value);
|
|
9151
9840
|
});
|
|
9152
9841
|
for (let i = 0;i < maxIdx; ++i) {
|
|
@@ -9163,14 +9852,12 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9163
9852
|
} else if (parseJsonIfString && typeof row[selectionItem.key] === "string")
|
|
9164
9853
|
row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
9165
9854
|
if (selectionItem.isArray) {
|
|
9166
|
-
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection,
|
|
9855
|
+
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection, false, parseJsonIfString);
|
|
9167
9856
|
continue;
|
|
9168
9857
|
}
|
|
9169
|
-
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection,
|
|
9858
|
+
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection, false, parseJsonIfString);
|
|
9170
9859
|
continue;
|
|
9171
9860
|
}
|
|
9172
|
-
if (mapColumnValue)
|
|
9173
|
-
row[selectionItem.key] = mapColumnValue(row[selectionItem.key]);
|
|
9174
9861
|
if (row[selectionItem.key] === null)
|
|
9175
9862
|
continue;
|
|
9176
9863
|
const decoder = decoders[selectionItemIdx];
|
|
@@ -9181,7 +9868,7 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
9181
9868
|
}
|
|
9182
9869
|
return rows;
|
|
9183
9870
|
}
|
|
9184
|
-
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection,
|
|
9871
|
+
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false) {
|
|
9185
9872
|
const maxIdx = isOne ? 1 : rows.length;
|
|
9186
9873
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
9187
9874
|
let decoder;
|
|
@@ -9218,14 +9905,12 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
9218
9905
|
} else if (parseJsonIfString && typeof value === "string")
|
|
9219
9906
|
value = JSON.parse(value);
|
|
9220
9907
|
if (selectionItem.isArray)
|
|
9221
|
-
mapRelationalRow2(value, false, selectionItem.selection,
|
|
9908
|
+
mapRelationalRow2(value, false, selectionItem.selection, false, parseJsonIfString);
|
|
9222
9909
|
else
|
|
9223
|
-
mapRelationalRow2(value, true, selectionItem.selection,
|
|
9910
|
+
mapRelationalRow2(value, true, selectionItem.selection, false, parseJsonIfString);
|
|
9224
9911
|
result[selectionItem.key] = value;
|
|
9225
9912
|
continue;
|
|
9226
9913
|
}
|
|
9227
|
-
if (mapColumnValue)
|
|
9228
|
-
value = mapColumnValue(value);
|
|
9229
9914
|
if (value === null) {
|
|
9230
9915
|
result[selectionItem.key] = null;
|
|
9231
9916
|
continue;
|
|
@@ -9237,14 +9922,14 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
9237
9922
|
}
|
|
9238
9923
|
return isOne ? results[0] : results;
|
|
9239
9924
|
}
|
|
9240
|
-
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
9925
|
+
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
9241
9926
|
return (rows) => {
|
|
9242
9927
|
if (isFirst && !rows[0])
|
|
9243
9928
|
return rows[0];
|
|
9244
|
-
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection,
|
|
9929
|
+
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString) : mapRelationalRow2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString, rootJsonMappers);
|
|
9245
9930
|
};
|
|
9246
9931
|
}
|
|
9247
|
-
function makeJitRqbMapperInner(selection, rowExpr, selectionVar,
|
|
9932
|
+
function makeJitRqbMapperInner(selection, rowExpr, selectionVar, parseJson, parseJsonIfString, useJsonMappers, preFn, counter, accessByIdx) {
|
|
9248
9933
|
const bodyStmts = [];
|
|
9249
9934
|
const literalEntries = [];
|
|
9250
9935
|
let hasWork = false;
|
|
@@ -9268,7 +9953,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9268
9953
|
preFn.push(`const { selection: ${nestedSelVar} } = ${sel};`);
|
|
9269
9954
|
if (isArray) {
|
|
9270
9955
|
const j = `j${counter.n++}`;
|
|
9271
|
-
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar,
|
|
9956
|
+
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
9272
9957
|
if (inner.hasWork) {
|
|
9273
9958
|
hasWork = true;
|
|
9274
9959
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -9281,7 +9966,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9281
9966
|
} else
|
|
9282
9967
|
preFn.splice(savedPreFnLen, 1);
|
|
9283
9968
|
} else {
|
|
9284
|
-
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar,
|
|
9969
|
+
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
9285
9970
|
if (inner.hasWork) {
|
|
9286
9971
|
hasWork = true;
|
|
9287
9972
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -9310,21 +9995,39 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9310
9995
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9311
9996
|
}
|
|
9312
9997
|
} else if (is(field, SQL)) {
|
|
9313
|
-
if (
|
|
9998
|
+
if (useJsonMappers && field.decoder.mapFromJsonValue) {
|
|
9999
|
+
bypassCodecs = true;
|
|
10000
|
+
const id = counter.n++;
|
|
10001
|
+
destructure = `field: { decoder: dec${id} }`;
|
|
10002
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10003
|
+
} else if (!field.decoder.mapFromDriverValue.isNoop) {
|
|
9314
10004
|
const id = counter.n++;
|
|
9315
10005
|
destructure = `field: { decoder: dec${id} }`;
|
|
9316
10006
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9317
10007
|
}
|
|
9318
10008
|
} else if (is(field, SQL.Aliased)) {
|
|
9319
|
-
if (
|
|
10009
|
+
if (useJsonMappers && field.sql.decoder.mapFromJsonValue) {
|
|
10010
|
+
bypassCodecs = true;
|
|
9320
10011
|
const id = counter.n++;
|
|
9321
10012
|
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
10013
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10014
|
+
} else if (!field.sql.decoder.mapFromDriverValue.isNoop) {
|
|
10015
|
+
const id = counter.n++;
|
|
10016
|
+
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
10017
|
+
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
10018
|
+
}
|
|
10019
|
+
} else if (is(field, Table) || is(field, View)) {} else {
|
|
10020
|
+
const sqlExpr = field.getSQL();
|
|
10021
|
+
if (useJsonMappers && sqlExpr.decoder.mapFromJsonValue) {
|
|
10022
|
+
bypassCodecs = true;
|
|
10023
|
+
const id = counter.n++;
|
|
10024
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
10025
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
10026
|
+
} else if (!sqlExpr.decoder.mapFromDriverValue.isNoop) {
|
|
10027
|
+
const id = counter.n++;
|
|
10028
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
9322
10029
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9323
10030
|
}
|
|
9324
|
-
} else if (is(field, Table) || is(field, View)) {} else if (!field.getSQL().decoder.mapFromDriverValue.isNoop) {
|
|
9325
|
-
const id = counter.n++;
|
|
9326
|
-
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
9327
|
-
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
9328
10031
|
}
|
|
9329
10032
|
let codecVar = "";
|
|
9330
10033
|
if (!bypassCodecs && codec)
|
|
@@ -9337,19 +10040,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9337
10040
|
parts.push(`codec: ${codecVar}`);
|
|
9338
10041
|
preFn.push(`const { ${parts.join(", ")} } = ${sel};`);
|
|
9339
10042
|
}
|
|
9340
|
-
if (
|
|
9341
|
-
hasWork = true;
|
|
9342
|
-
bodyStmts.push(`${slot} = mapColumnValue(${slot});`);
|
|
9343
|
-
if (decoderExpr || codecVar) {
|
|
9344
|
-
let decoded = slot;
|
|
9345
|
-
if (codecVar)
|
|
9346
|
-
decoded = `${codecVar}(${decoded}, ${arrayDimensions})`;
|
|
9347
|
-
if (decoderExpr)
|
|
9348
|
-
decoded = `${decoderExpr}(${decoded})`;
|
|
9349
|
-
bodyStmts.push(`if (${slot} !== null) ${slot} = ${decoded};`);
|
|
9350
|
-
}
|
|
9351
|
-
literalEntries.push(`${keyStr}: ${slot}`);
|
|
9352
|
-
} else if (decoderExpr || codecVar) {
|
|
10043
|
+
if (decoderExpr || codecVar) {
|
|
9353
10044
|
hasWork = true;
|
|
9354
10045
|
let decoded = slot;
|
|
9355
10046
|
if (codecVar)
|
|
@@ -9366,12 +10057,12 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
9366
10057
|
hasWork
|
|
9367
10058
|
};
|
|
9368
10059
|
}
|
|
9369
|
-
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
10060
|
+
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
9370
10061
|
const preFn = [];
|
|
9371
|
-
const inner = makeJitRqbMapperInner(selection, "row", "selection",
|
|
10062
|
+
const inner = makeJitRqbMapperInner(selection, "row", "selection", parseJson, parseJsonIfString, arrayModeRoot ? false : rootJsonMappers, preFn, { n: 0 }, !!arrayModeRoot);
|
|
9372
10063
|
const lines = [];
|
|
9373
10064
|
lines.push(` "use strict";
|
|
9374
|
-
const { selection
|
|
10065
|
+
const { selection } = this;`);
|
|
9375
10066
|
for (const p2 of preFn)
|
|
9376
10067
|
lines.push(` ${p2}`);
|
|
9377
10068
|
if (arrayModeRoot)
|
|
@@ -9413,10 +10104,7 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
|
|
|
9413
10104
|
lines.push("\t//# sourceURL=drizzle:jit-relational-query-mapper");
|
|
9414
10105
|
const compiled = lines.join(`
|
|
9415
10106
|
`);
|
|
9416
|
-
return Object.assign(new FnConstructor2("rows", compiled).bind({
|
|
9417
|
-
selection,
|
|
9418
|
-
mapColumnValue
|
|
9419
|
-
}), { body: `function jitRqbMapper (rows) {
|
|
10107
|
+
return Object.assign(new FnConstructor2("rows", compiled).bind({ selection }), { body: `function jitRqbMapper (rows) {
|
|
9420
10108
|
${compiled}
|
|
9421
10109
|
}` });
|
|
9422
10110
|
}
|
|
@@ -9539,17 +10227,23 @@ function relationsOrderToSQL2(table, orders) {
|
|
|
9539
10227
|
return;
|
|
9540
10228
|
return sql.join(entries.map(([target, value]) => (value === "asc" ? asc : desc)(fieldSelectionToSQL2(table, target))), sql`, `);
|
|
9541
10229
|
}
|
|
9542
|
-
function relationExtrasToSQL2(table, extras) {
|
|
10230
|
+
function relationExtrasToSQL2(table, extras, codecs, inJson) {
|
|
9543
10231
|
const subqueries = [];
|
|
9544
10232
|
const selection = [];
|
|
9545
10233
|
for (const [key, field] of Object.entries(extras)) {
|
|
9546
10234
|
if (!field)
|
|
9547
10235
|
continue;
|
|
9548
|
-
const
|
|
9549
|
-
const
|
|
9550
|
-
query
|
|
10236
|
+
const subq = (typeof field === "function" ? field(table, { sql: operators2.sql }) : field).getSQL();
|
|
10237
|
+
const column = codecs ? getColumnFromDecoder2(subq) : undefined;
|
|
10238
|
+
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)}`;
|
|
10239
|
+
query.decoder = subq.decoder;
|
|
9551
10240
|
subqueries.push(query);
|
|
9552
|
-
selection.push({
|
|
10241
|
+
selection.push(column && (!inJson || !column.mapFromJsonValue) ? {
|
|
10242
|
+
key,
|
|
10243
|
+
field: query,
|
|
10244
|
+
codec: codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
10245
|
+
arrayDimensions: column.dimensions
|
|
10246
|
+
} : {
|
|
9553
10247
|
key,
|
|
9554
10248
|
field: query
|
|
9555
10249
|
});
|
|
@@ -9658,43 +10352,58 @@ var PgDialect2 = class {
|
|
|
9658
10352
|
}
|
|
9659
10353
|
buildSelection(fields, { isSingleTable = false, ignoreCastCodecs = false } = {}) {
|
|
9660
10354
|
const columnsLen = fields.length;
|
|
9661
|
-
const chunks = fields.flatMap(({ field }, i) => {
|
|
10355
|
+
const chunks = fields.flatMap(({ field, codecOverride, column }, i) => {
|
|
9662
10356
|
const chunk = [];
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
10357
|
+
const override = codecOverride;
|
|
10358
|
+
if (is(field, SQL.Aliased))
|
|
10359
|
+
if (field.isSelectionField) {
|
|
10360
|
+
const query = !isSingleTable && field.origin !== undefined ? sql`${sql.identifier(field.origin)}.${sql.identifier(field.fieldAlias)}` : sql.identifier(field.fieldAlias);
|
|
10361
|
+
if (column && !ignoreCastCodecs)
|
|
10362
|
+
chunk.push(this.codecs.apply(column, "cast", query, override));
|
|
10363
|
+
else
|
|
10364
|
+
chunk.push(query);
|
|
10365
|
+
} else {
|
|
10366
|
+
const query = field.sql;
|
|
10367
|
+
if (isSingleTable) {
|
|
10368
|
+
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
10369
|
+
if (is(c, PgColumn))
|
|
10370
|
+
return sql.identifier(c.name);
|
|
10371
|
+
return c;
|
|
10372
|
+
}));
|
|
10373
|
+
if (query.shouldInlineParams)
|
|
10374
|
+
newSql.inlineParams();
|
|
10375
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
10376
|
+
} else
|
|
10377
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
10378
|
+
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
10379
|
+
}
|
|
10380
|
+
else if (is(field, SQL)) {
|
|
10381
|
+
const query = field;
|
|
9669
10382
|
if (isSingleTable) {
|
|
9670
10383
|
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
9671
10384
|
if (is(c, PgColumn))
|
|
9672
10385
|
return sql.identifier(c.name);
|
|
9673
10386
|
return c;
|
|
9674
10387
|
}));
|
|
9675
|
-
|
|
10388
|
+
if (query.shouldInlineParams)
|
|
10389
|
+
newSql.inlineParams();
|
|
10390
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
9676
10391
|
} else
|
|
9677
|
-
chunk.push(query);
|
|
9678
|
-
if (is(field, SQL.Aliased))
|
|
9679
|
-
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
10392
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
9680
10393
|
} else if (is(field, Column)) {
|
|
9681
10394
|
let name2;
|
|
9682
10395
|
if (isSingleTable)
|
|
9683
10396
|
name2 = field.isAlias ? sql.identifier(getOriginalColumnFromAlias2(field).name) : sql.identifier(field.name);
|
|
9684
10397
|
else
|
|
9685
10398
|
name2 = field.isAlias ? getOriginalColumnFromAlias2(field) : field;
|
|
9686
|
-
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2);
|
|
10399
|
+
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2, override);
|
|
9687
10400
|
chunk.push(field.isAlias ? sql`${casted} as ${field}` : casted);
|
|
9688
|
-
} else if (is(field, Subquery))
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
field._.sql.decoder = fieldDecoder;
|
|
9695
|
-
}
|
|
9696
|
-
chunk.push(field);
|
|
9697
|
-
}
|
|
10401
|
+
} else if (is(field, Subquery))
|
|
10402
|
+
if (column && !ignoreCastCodecs && !field._.isWith) {
|
|
10403
|
+
const innerCasted = this.codecs.apply(column, "cast", sql`(${field._.sql})`, override);
|
|
10404
|
+
chunk.push(sql`${innerCasted} ${sql.identifier(field._.alias)}`);
|
|
10405
|
+
} else
|
|
10406
|
+
chunk.push(column ? this.codecs.apply(column, "cast", field) : field, override);
|
|
9698
10407
|
if (i < columnsLen - 1)
|
|
9699
10408
|
chunk.push(sql`, `);
|
|
9700
10409
|
return chunk;
|
|
@@ -9745,8 +10454,10 @@ var PgDialect2 = class {
|
|
|
9745
10454
|
}
|
|
9746
10455
|
return table;
|
|
9747
10456
|
}
|
|
9748
|
-
buildSelectQuery({ withList,
|
|
9749
|
-
|
|
10457
|
+
buildSelectQuery({ withList, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, comment, ignoreSelectionCastCodecs }) {
|
|
10458
|
+
if (!fieldsFlat)
|
|
10459
|
+
throw new Error("Select query builder must be provided with `fieldsFlat` on `buildSelectQuery` invocation");
|
|
10460
|
+
const fieldsList = fieldsFlat;
|
|
9750
10461
|
for (const f of fieldsList)
|
|
9751
10462
|
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)) {
|
|
9752
10463
|
const tableName = getTableName(f.field.table);
|
|
@@ -9759,7 +10470,7 @@ var PgDialect2 = class {
|
|
|
9759
10470
|
distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
|
|
9760
10471
|
const selection = this.buildSelection(fieldsList, {
|
|
9761
10472
|
isSingleTable,
|
|
9762
|
-
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
10473
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs || setOperators.length > 0
|
|
9763
10474
|
});
|
|
9764
10475
|
const tableSql = this.buildFromTable(table);
|
|
9765
10476
|
const joinsSql = this.buildJoins(joins);
|
|
@@ -9786,26 +10497,67 @@ var PgDialect2 = class {
|
|
|
9786
10497
|
}
|
|
9787
10498
|
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClauseSql}${comment !== undefined ? sql` ${comment}` : undefined}`;
|
|
9788
10499
|
if (setOperators.length > 0)
|
|
9789
|
-
return this.buildSetOperations(finalQuery, setOperators);
|
|
10500
|
+
return this.buildSetOperations(finalQuery, fieldsList, ignoreSelectionCastCodecs, setOperators);
|
|
9790
10501
|
return finalQuery;
|
|
9791
10502
|
}
|
|
9792
|
-
buildSetOperations(leftSelect, setOperators) {
|
|
9793
|
-
const
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
10503
|
+
buildSetOperations(leftSelect, leftSelection, ignoreSelectionCastCodecs, setOperators) {
|
|
10504
|
+
const outputSelection = leftSelection;
|
|
10505
|
+
for (let i = 0;i < setOperators.length; ++i) {
|
|
10506
|
+
const setOperator = setOperators[i];
|
|
10507
|
+
if (!setOperator)
|
|
10508
|
+
throw new Error("Cannot pass undefined values to any set operator");
|
|
10509
|
+
leftSelect = this.buildSetOperationQuery({
|
|
9798
10510
|
leftSelect,
|
|
9799
10511
|
setOperator
|
|
9800
10512
|
});
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
10513
|
+
const rightSelection = orderSelectedFields2(setOperator.rightSelect.getSelectedFields());
|
|
10514
|
+
for (let j = 0;j < outputSelection.length; ++j) {
|
|
10515
|
+
const l = outputSelection[j];
|
|
10516
|
+
const lPath = l.path.join(".");
|
|
10517
|
+
const r = rightSelection.find((e) => e.path.join(".") === lPath);
|
|
10518
|
+
const lc = l.codecOverride ?? l.column?.codec;
|
|
10519
|
+
const rc = r.codecOverride ?? r.column?.codec;
|
|
10520
|
+
outputSelection[j].codecOverride = lc && rc ? unionsTypeTable[lc]?.[rc] : lc;
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10523
|
+
for (let i = 0;i < outputSelection.length; ++i) {
|
|
10524
|
+
const out = outputSelection[i];
|
|
10525
|
+
out.codec = out.codecOverride ? this.codecs.get(out.column, "normalize", out.codecOverride) : out.codec;
|
|
10526
|
+
}
|
|
10527
|
+
return ignoreSelectionCastCodecs ? leftSelect : sql`select ${this.buildSelection(outputSelection.map((field) => {
|
|
10528
|
+
if (is(field.field, SQL.Aliased)) {
|
|
10529
|
+
const ref = field.field.clone();
|
|
10530
|
+
ref.isSelectionField = true;
|
|
10531
|
+
return {
|
|
10532
|
+
...field,
|
|
10533
|
+
field: ref
|
|
10534
|
+
};
|
|
10535
|
+
}
|
|
10536
|
+
if (is(field.field, Column) && field.field.isAlias) {
|
|
10537
|
+
const ref = new SQL.Aliased(sql`${sql.identifier(field.field.name)}`, field.field.name);
|
|
10538
|
+
ref.isSelectionField = true;
|
|
10539
|
+
return {
|
|
10540
|
+
...field,
|
|
10541
|
+
field: ref
|
|
10542
|
+
};
|
|
10543
|
+
}
|
|
10544
|
+
if (is(field.field, Subquery)) {
|
|
10545
|
+
const ref = new SQL.Aliased(sql`${field.field.getSQL()}`, field.field._.alias);
|
|
10546
|
+
ref.isSelectionField = true;
|
|
10547
|
+
return {
|
|
10548
|
+
...field,
|
|
10549
|
+
field: ref
|
|
10550
|
+
};
|
|
10551
|
+
}
|
|
10552
|
+
return field;
|
|
10553
|
+
}), {
|
|
10554
|
+
isSingleTable: true,
|
|
10555
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
10556
|
+
})} from (${leftSelect}) ${sql.identifier("drizzle_union")}`;
|
|
9805
10557
|
}
|
|
9806
10558
|
buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset } }) {
|
|
9807
10559
|
const leftChunk = sql`(${leftSelect.getSQL()}) `;
|
|
9808
|
-
const rightChunk = sql`(${rightSelect.getSQL()})`;
|
|
10560
|
+
const rightChunk = sql`(${rightSelect.withoutSelectionCastCodecs().getSQL()})`;
|
|
9809
10561
|
let orderBySql;
|
|
9810
10562
|
if (orderBy && orderBy.length > 0) {
|
|
9811
10563
|
const orderByValues = [];
|
|
@@ -9831,8 +10583,9 @@ var PgDialect2 = class {
|
|
|
9831
10583
|
buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_, comment, ignoreSelectionCastCodecs }) {
|
|
9832
10584
|
const valuesSqlList = [];
|
|
9833
10585
|
const columns = table[Table.Symbol.Columns];
|
|
9834
|
-
const colEntries = Object.entries(columns)
|
|
9835
|
-
const
|
|
10586
|
+
const colEntries = Object.entries(columns);
|
|
10587
|
+
const colFilteredEntries = select && !is(valuesOrSelect, SQL) ? Object.keys(valuesOrSelect.getSelectedFields()).map((key) => [key, columns[key]]) : overridingSystemValue_ ? colEntries : colEntries.filter(([_, col]) => !col.shouldDisableInsert());
|
|
10588
|
+
const insertOrder = colFilteredEntries.map(([, column]) => sql.identifier(column.name));
|
|
9836
10589
|
if (select) {
|
|
9837
10590
|
const select2 = valuesOrSelect;
|
|
9838
10591
|
if (is(select2, SQL))
|
|
@@ -9844,7 +10597,7 @@ var PgDialect2 = class {
|
|
|
9844
10597
|
valuesSqlList.push(sql.raw("values "));
|
|
9845
10598
|
for (const [valueIndex, value] of values.entries()) {
|
|
9846
10599
|
const valueList = [];
|
|
9847
|
-
for (const [fieldName, col] of
|
|
10600
|
+
for (const [fieldName, col] of colFilteredEntries) {
|
|
9848
10601
|
const colValue = value[fieldName];
|
|
9849
10602
|
if (colValue === undefined || is(colValue, Param) && colValue.value === undefined)
|
|
9850
10603
|
if (col.defaultFn !== undefined) {
|
|
@@ -9895,31 +10648,48 @@ var PgDialect2 = class {
|
|
|
9895
10648
|
tagged: true
|
|
9896
10649
|
});
|
|
9897
10650
|
}
|
|
9898
|
-
|
|
10651
|
+
buildRqbColumn(table, field, key, inJson) {
|
|
10652
|
+
if (is(field, Column)) {
|
|
10653
|
+
const name2 = sql`${table}.${sql.identifier(field.name)}`;
|
|
10654
|
+
return sql`${inJson && field.jsonSelectIdentifier ? field.jsonSelectIdentifier(name2, sql, field.dimensions) : this.codecs.apply(field, inJson ? "castInJson" : "cast", name2)} as ${sql.identifier(key)}`;
|
|
10655
|
+
}
|
|
10656
|
+
if (is(field, SQL.Aliased)) {
|
|
10657
|
+
const column = getColumnFromDecoder2(field);
|
|
10658
|
+
const q = sql`${table}.${sql.identifier(field.fieldAlias)}`;
|
|
10659
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
10660
|
+
}
|
|
10661
|
+
if (isSQLWrapper(field)) {
|
|
10662
|
+
const column = getColumnFromDecoder2(field);
|
|
10663
|
+
const q = sql`${table}.${sql.identifier(key)}`;
|
|
10664
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
10665
|
+
}
|
|
9899
10666
|
throw new DrizzleError2({ message: `Views with nested selections are not supported by the relational query builder` });
|
|
9900
10667
|
}
|
|
9901
|
-
|
|
9902
|
-
if (is(
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
10668
|
+
resolveSelection(field, key, inJson) {
|
|
10669
|
+
if (is(field, Column))
|
|
10670
|
+
return {
|
|
10671
|
+
key,
|
|
10672
|
+
field,
|
|
10673
|
+
codec: this.codecs.get(field, inJson ? "normalizeInJson" : "normalize"),
|
|
10674
|
+
arrayDimensions: field.dimensions
|
|
10675
|
+
};
|
|
10676
|
+
const decoderColumn = getColumnFromDecoder2(field);
|
|
10677
|
+
return decoderColumn ? {
|
|
10678
|
+
key,
|
|
10679
|
+
field,
|
|
10680
|
+
codec: decoderColumn && (!inJson || !decoderColumn.mapFromJsonValue) ? this.codecs.get(decoderColumn, inJson ? "normalizeInJson" : "normalize") : undefined,
|
|
10681
|
+
arrayDimensions: decoderColumn.dimensions
|
|
10682
|
+
} : {
|
|
10683
|
+
key,
|
|
10684
|
+
field
|
|
10685
|
+
};
|
|
9907
10686
|
}
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
field: v2
|
|
9915
|
-
} : {
|
|
9916
|
-
key: k,
|
|
9917
|
-
field: v2
|
|
9918
|
-
});
|
|
9919
|
-
return this.buildRqbColumn(table, v2, k, inJson);
|
|
9920
|
-
}), sql`, `);
|
|
9921
|
-
};
|
|
9922
|
-
buildColumns = (table, selection, inJson, config) => config?.columns ? (() => {
|
|
10687
|
+
buildColumns = (table, selection, inJson, config) => {
|
|
10688
|
+
if (!config?.columns)
|
|
10689
|
+
return sql.join(Object.entries(table[TableColumns]).map(([k, v2]) => {
|
|
10690
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
10691
|
+
return this.buildRqbColumn(table, v2, k, inJson);
|
|
10692
|
+
}), sql`, `);
|
|
9923
10693
|
const entries = Object.entries(config.columns);
|
|
9924
10694
|
const columnContainer = table[TableColumns];
|
|
9925
10695
|
const columnIdentifiers = [];
|
|
@@ -9931,15 +10701,7 @@ var PgDialect2 = class {
|
|
|
9931
10701
|
if (v2) {
|
|
9932
10702
|
const column = columnContainer[k];
|
|
9933
10703
|
columnIdentifiers.push(this.buildRqbColumn(table, column, k, inJson));
|
|
9934
|
-
selection.push(
|
|
9935
|
-
key: k,
|
|
9936
|
-
codec: this.codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
9937
|
-
arrayDimensions: column.dimensions,
|
|
9938
|
-
field: column
|
|
9939
|
-
} : {
|
|
9940
|
-
key: k,
|
|
9941
|
-
field: column
|
|
9942
|
-
});
|
|
10704
|
+
selection.push(this.resolveSelection(column, k, inJson));
|
|
9943
10705
|
}
|
|
9944
10706
|
}
|
|
9945
10707
|
if (colSelectionMode === false)
|
|
@@ -9947,18 +10709,10 @@ var PgDialect2 = class {
|
|
|
9947
10709
|
if (config.columns[k] === false)
|
|
9948
10710
|
continue;
|
|
9949
10711
|
columnIdentifiers.push(this.buildRqbColumn(table, v2, k, inJson));
|
|
9950
|
-
selection.push(
|
|
9951
|
-
key: k,
|
|
9952
|
-
codec: this.codecs.get(v2, inJson ? "normalizeInJson" : "normalize"),
|
|
9953
|
-
arrayDimensions: v2.dimensions,
|
|
9954
|
-
field: v2
|
|
9955
|
-
} : {
|
|
9956
|
-
key: k,
|
|
9957
|
-
field: v2
|
|
9958
|
-
});
|
|
10712
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
9959
10713
|
}
|
|
9960
10714
|
return columnIdentifiers.length ? sql.join(columnIdentifiers, sql`, `) : undefined;
|
|
9961
|
-
}
|
|
10715
|
+
};
|
|
9962
10716
|
buildRelationalQuery({ schema, table, tableConfig, queryConfig: config, relationWhere, mode, errorPath, depth, throughJoin, nested }) {
|
|
9963
10717
|
const selection = [];
|
|
9964
10718
|
const isSingle = mode === "first";
|
|
@@ -9972,7 +10726,7 @@ var PgDialect2 = class {
|
|
|
9972
10726
|
const where = params?.where && relationWhere ? and(relationsFilterToSQL2(table, params.where, tableConfig.relations, schema), relationWhere) : params?.where ? relationsFilterToSQL2(table, params.where, tableConfig.relations, schema) : relationWhere;
|
|
9973
10727
|
const order = params?.orderBy ? relationsOrderToSQL2(table, params.orderBy) : undefined;
|
|
9974
10728
|
const columns = this.buildColumns(table, selection, !!nested, params);
|
|
9975
|
-
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras) : undefined;
|
|
10729
|
+
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras, this.codecs, nested) : undefined;
|
|
9976
10730
|
if (extras)
|
|
9977
10731
|
selection.push(...extras.selection);
|
|
9978
10732
|
const selectionArr = columns ? [columns] : [];
|
|
@@ -10122,11 +10876,6 @@ var PgInsertBuilder2 = class {
|
|
|
10122
10876
|
this.overridingSystemValue_ = overridingSystemValue_;
|
|
10123
10877
|
this.builder = builder;
|
|
10124
10878
|
}
|
|
10125
|
-
authToken;
|
|
10126
|
-
setToken(token) {
|
|
10127
|
-
this.authToken = token;
|
|
10128
|
-
return this;
|
|
10129
|
-
}
|
|
10130
10879
|
overridingSystemValue() {
|
|
10131
10880
|
this.overridingSystemValue_ = true;
|
|
10132
10881
|
return this;
|
|
@@ -10144,27 +10893,25 @@ var PgInsertBuilder2 = class {
|
|
|
10144
10893
|
}
|
|
10145
10894
|
return result;
|
|
10146
10895
|
});
|
|
10147
|
-
|
|
10148
|
-
if ("setToken" in builder)
|
|
10149
|
-
builder.setToken(this.authToken);
|
|
10150
|
-
return builder;
|
|
10896
|
+
return new this.builder(this.table, mappedValues, this.session, this.dialect, this.withList, false, this.overridingSystemValue_);
|
|
10151
10897
|
}
|
|
10152
10898
|
select(selectQuery) {
|
|
10153
10899
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder2) : selectQuery;
|
|
10154
10900
|
if ("withoutSelectionCastCodecs" in select)
|
|
10155
10901
|
select.withoutSelectionCastCodecs();
|
|
10156
|
-
if (!is(select, SQL)
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10902
|
+
if (!is(select, SQL)) {
|
|
10903
|
+
const insertCols = Object.keys(this.table[Table.Symbol.Columns]);
|
|
10904
|
+
const selected = Object.keys(select._.selectedFields);
|
|
10905
|
+
for (const col of selected)
|
|
10906
|
+
if (!insertCols.includes(col))
|
|
10907
|
+
throw new Error(`Insert select error: column "${col}" does not exist in table "${this.table[Table.Symbol.Name]}"`);
|
|
10908
|
+
}
|
|
10909
|
+
return new this.builder(this.table, select, this.session, this.dialect, this.withList, true, this.overridingSystemValue_);
|
|
10162
10910
|
}
|
|
10163
10911
|
};
|
|
10164
10912
|
var PgInsertBase2 = class {
|
|
10165
10913
|
static [entityKind] = "PgInsert";
|
|
10166
10914
|
config;
|
|
10167
|
-
cacheConfig;
|
|
10168
10915
|
constructor(table, values, session, dialect, withList, select, overridingSystemValue_) {
|
|
10169
10916
|
this.session = session;
|
|
10170
10917
|
this.dialect = dialect;
|
|
@@ -10234,7 +10981,7 @@ var PgInsertBase2 = class {
|
|
|
10234
10981
|
var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
10235
10982
|
static [entityKind] = "PgAsyncInsert";
|
|
10236
10983
|
_prepare(name2, generateName = false) {
|
|
10237
|
-
const { session, config, dialect
|
|
10984
|
+
const { session, config, dialect } = this;
|
|
10238
10985
|
const { returning: fields } = config;
|
|
10239
10986
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10240
10987
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -10242,7 +10989,7 @@ var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
|
10242
10989
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
10243
10990
|
type: "insert",
|
|
10244
10991
|
tables: [...extractUsedTable(this.config.table)]
|
|
10245
|
-
}
|
|
10992
|
+
});
|
|
10246
10993
|
});
|
|
10247
10994
|
}
|
|
10248
10995
|
prepare(name2) {
|
|
@@ -10287,10 +11034,10 @@ applyMixins2(PgAsyncRelationalQuery2, [QueryPromise2]);
|
|
|
10287
11034
|
// node_modules/drizzle-orm/pg-core/query-builders/raw.js
|
|
10288
11035
|
var PgRaw = class {
|
|
10289
11036
|
static [entityKind] = "PgRaw";
|
|
10290
|
-
constructor(sql2, query
|
|
11037
|
+
constructor(prepared, sql2, query) {
|
|
11038
|
+
this.prepared = prepared;
|
|
10291
11039
|
this.sql = sql2;
|
|
10292
11040
|
this.query = query;
|
|
10293
|
-
this.mapBatchResult = mapBatchResult;
|
|
10294
11041
|
}
|
|
10295
11042
|
getSQL() {
|
|
10296
11043
|
return this.sql;
|
|
@@ -10298,20 +11045,22 @@ var PgRaw = class {
|
|
|
10298
11045
|
getQuery() {
|
|
10299
11046
|
return this.query;
|
|
10300
11047
|
}
|
|
10301
|
-
|
|
10302
|
-
return
|
|
11048
|
+
_prepare() {
|
|
11049
|
+
return this.prepared;
|
|
10303
11050
|
}
|
|
10304
11051
|
};
|
|
10305
11052
|
|
|
10306
11053
|
// node_modules/drizzle-orm/pg-core/async/raw.js
|
|
10307
11054
|
var PgAsyncRaw2 = class extends PgRaw {
|
|
10308
11055
|
static [entityKind] = "PgAsyncRaw";
|
|
10309
|
-
constructor(
|
|
10310
|
-
super(sql2, query
|
|
10311
|
-
|
|
11056
|
+
constructor(prepared, sql2, query) {
|
|
11057
|
+
super(prepared, sql2, query);
|
|
11058
|
+
}
|
|
11059
|
+
execute(placeholderValues) {
|
|
11060
|
+
return this.prepared.execute(placeholderValues);
|
|
10312
11061
|
}
|
|
10313
11062
|
_prepare() {
|
|
10314
|
-
return this;
|
|
11063
|
+
return this.prepared;
|
|
10315
11064
|
}
|
|
10316
11065
|
};
|
|
10317
11066
|
applyMixins2(PgAsyncRaw2, [QueryPromise2]);
|
|
@@ -10369,12 +11118,11 @@ applyMixins2(PgAsyncRefreshMaterializedView2, [QueryPromise2]);
|
|
|
10369
11118
|
var PgAsyncSelectBase2 = class extends PgSelectBase2 {
|
|
10370
11119
|
static [entityKind] = "PgAsyncSelectQueryBuilder";
|
|
10371
11120
|
_prepare(name2, generateName = false) {
|
|
10372
|
-
const { session,
|
|
10373
|
-
const { fields } = config;
|
|
11121
|
+
const { session, dialect, cacheConfig, usedTables } = this;
|
|
10374
11122
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10375
|
-
const query = this.config.
|
|
10376
|
-
const fieldsList =
|
|
10377
|
-
const mapper = this.dialect.mapperGenerators.rows(fieldsList, joinsNotNullableMap);
|
|
11123
|
+
const query = this.config.tagged ? dialect._sqlToQuery(this.getSQL()) : dialect.sqlToQuery(this.getSQL());
|
|
11124
|
+
const fieldsList = this.config.fieldsFlat;
|
|
11125
|
+
const mapper = this.dialect.mapperGenerators.rows(fieldsList, this.joinsNotNullableMap);
|
|
10378
11126
|
return session.prepareQuery(query, "arrays", name2 ?? generateName, mapper, {
|
|
10379
11127
|
type: "select",
|
|
10380
11128
|
tables: [...usedTables]
|
|
@@ -10402,16 +11150,8 @@ var PgUpdateBuilder2 = class {
|
|
|
10402
11150
|
this.withList = withList;
|
|
10403
11151
|
this.builder = builder;
|
|
10404
11152
|
}
|
|
10405
|
-
authToken;
|
|
10406
|
-
setToken(token) {
|
|
10407
|
-
this.authToken = token;
|
|
10408
|
-
return this;
|
|
10409
|
-
}
|
|
10410
11153
|
set(values) {
|
|
10411
|
-
|
|
10412
|
-
if ("setToken" in builder)
|
|
10413
|
-
builder.setToken(this.authToken);
|
|
10414
|
-
return builder;
|
|
11154
|
+
return new this.builder(this.table, mapUpdateSet2(this.table, values), this.session, this.dialect, this.withList);
|
|
10415
11155
|
}
|
|
10416
11156
|
};
|
|
10417
11157
|
var PgUpdateBase2 = class {
|
|
@@ -10419,7 +11159,6 @@ var PgUpdateBase2 = class {
|
|
|
10419
11159
|
config;
|
|
10420
11160
|
tableName;
|
|
10421
11161
|
joinsNotNullableMap;
|
|
10422
|
-
cacheConfig;
|
|
10423
11162
|
constructor(table, set, session, dialect, withList) {
|
|
10424
11163
|
this.session = session;
|
|
10425
11164
|
this.dialect = dialect;
|
|
@@ -10548,7 +11287,7 @@ var PgUpdateBase2 = class {
|
|
|
10548
11287
|
var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
10549
11288
|
static [entityKind] = "PgAsyncUpdate";
|
|
10550
11289
|
_prepare(name2, generateName = false) {
|
|
10551
|
-
const { session, config, dialect, joinsNotNullableMap
|
|
11290
|
+
const { session, config, dialect, joinsNotNullableMap } = this;
|
|
10552
11291
|
const { returning: fields } = config;
|
|
10553
11292
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10554
11293
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -10556,7 +11295,7 @@ var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
|
10556
11295
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
10557
11296
|
type: "update",
|
|
10558
11297
|
tables: [...extractUsedTable(this.config.table)]
|
|
10559
|
-
}
|
|
11298
|
+
});
|
|
10560
11299
|
});
|
|
10561
11300
|
}
|
|
10562
11301
|
prepare(name2) {
|
|
@@ -10696,8 +11435,7 @@ var PgAsyncDatabase2 = class {
|
|
|
10696
11435
|
execute(query) {
|
|
10697
11436
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
10698
11437
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
10699
|
-
|
|
10700
|
-
return new PgAsyncRaw2(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
11438
|
+
return new PgAsyncRaw2(this.session.prepareQuery(builtQuery, "raw", false), sequel, builtQuery);
|
|
10701
11439
|
}
|
|
10702
11440
|
transaction(transaction, config) {
|
|
10703
11441
|
return this.session.transaction(transaction, config);
|
|
@@ -10710,9 +11448,6 @@ var PgBasePreparedQuery2 = class {
|
|
|
10710
11448
|
constructor(query) {
|
|
10711
11449
|
this.query = query;
|
|
10712
11450
|
}
|
|
10713
|
-
mapResult(_, __) {
|
|
10714
|
-
throw new Error("Method not implemented.");
|
|
10715
|
-
}
|
|
10716
11451
|
getQuery() {
|
|
10717
11452
|
return this.query;
|
|
10718
11453
|
}
|
|
@@ -11190,6 +11925,10 @@ var createPostgresAuthorizationCodeStore = (db) => ({
|
|
|
11190
11925
|
const [row] = await db.delete(oauthCodesTable).where(eq(oauthCodesTable.code_hash, codeHash)).returning();
|
|
11191
11926
|
return row ? toCode(row) : undefined;
|
|
11192
11927
|
},
|
|
11928
|
+
deleteForClient: async (clientId) => {
|
|
11929
|
+
const deleted = await db.delete(oauthCodesTable).where(eq(oauthCodesTable.client_id, clientId)).returning({ codeHash: oauthCodesTable.code_hash });
|
|
11930
|
+
return deleted.length;
|
|
11931
|
+
},
|
|
11193
11932
|
deleteForUserClient: async (userId, clientId) => {
|
|
11194
11933
|
const deleted = await db.delete(oauthCodesTable).where(and(eq(oauthCodesTable.user_id, userId), eq(oauthCodesTable.client_id, clientId))).returning({ codeHash: oauthCodesTable.code_hash });
|
|
11195
11934
|
return deleted.length;
|
|
@@ -11219,6 +11958,12 @@ var createPostgresClientRegistrationTokenStore = (db) => ({
|
|
|
11219
11958
|
deleteByClientId: async (clientId) => {
|
|
11220
11959
|
await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, clientId));
|
|
11221
11960
|
},
|
|
11961
|
+
deleteForClient: async (clientId) => {
|
|
11962
|
+
const deleted = await db.delete(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.client_id, clientId)).returning({
|
|
11963
|
+
tokenHash: oauthClientRegistrationTokensTable.token_hash
|
|
11964
|
+
});
|
|
11965
|
+
return deleted.length;
|
|
11966
|
+
},
|
|
11222
11967
|
findByTokenHash: async (tokenHash) => {
|
|
11223
11968
|
const [row] = await db.select().from(oauthClientRegistrationTokensTable).where(eq(oauthClientRegistrationTokensTable.token_hash, tokenHash)).limit(1);
|
|
11224
11969
|
if (!row)
|
|
@@ -11243,6 +11988,12 @@ var createPostgresDeviceAuthorizationStore = (db) => ({
|
|
|
11243
11988
|
deleteByDeviceCodeHash: async (deviceCodeHash) => {
|
|
11244
11989
|
await db.delete(oauthDeviceAuthorizationsTable).where(eq(oauthDeviceAuthorizationsTable.device_code_hash, deviceCodeHash));
|
|
11245
11990
|
},
|
|
11991
|
+
deleteForClient: async (clientId) => {
|
|
11992
|
+
const deleted = await db.delete(oauthDeviceAuthorizationsTable).where(eq(oauthDeviceAuthorizationsTable.client_id, clientId)).returning({
|
|
11993
|
+
deviceCodeHash: oauthDeviceAuthorizationsTable.device_code_hash
|
|
11994
|
+
});
|
|
11995
|
+
return deleted.length;
|
|
11996
|
+
},
|
|
11246
11997
|
deleteForUserClient: async (userId, clientId) => {
|
|
11247
11998
|
const deleted = await db.delete(oauthDeviceAuthorizationsTable).where(and(eq(oauthDeviceAuthorizationsTable.user_sub, userId), eq(oauthDeviceAuthorizationsTable.client_id, clientId))).returning({
|
|
11248
11999
|
deviceCodeHash: oauthDeviceAuthorizationsTable.device_code_hash
|
|
@@ -11337,6 +12088,10 @@ var createPostgresOidcRefreshTokenStore = (db) => ({
|
|
|
11337
12088
|
const [row] = await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.token_hash, tokenHash)).returning();
|
|
11338
12089
|
return row ? toRefresh(row) : undefined;
|
|
11339
12090
|
},
|
|
12091
|
+
deleteForClient: async (clientId) => {
|
|
12092
|
+
const deleted = await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.client_id, clientId)).returning({ tokenHash: oauthRefreshTokensTable.token_hash });
|
|
12093
|
+
return deleted.length;
|
|
12094
|
+
},
|
|
11340
12095
|
deleteForUser: async (userId) => {
|
|
11341
12096
|
await db.delete(oauthRefreshTokensTable).where(eq(oauthRefreshTokensTable.user_id, userId));
|
|
11342
12097
|
},
|
|
@@ -11436,6 +12191,7 @@ export {
|
|
|
11436
12191
|
verifyJwt,
|
|
11437
12192
|
toPublicJwk,
|
|
11438
12193
|
signJwt,
|
|
12194
|
+
revokeOAuthClientCredentials,
|
|
11439
12195
|
jwkThumbprint,
|
|
11440
12196
|
generateSigningKey,
|
|
11441
12197
|
createPostgresOidcRefreshTokenStore,
|
|
@@ -11454,5 +12210,5 @@ export {
|
|
|
11454
12210
|
createNeonAuthorizationCodeStore
|
|
11455
12211
|
};
|
|
11456
12212
|
|
|
11457
|
-
//# debugId=
|
|
12213
|
+
//# debugId=3782E808539F50C164756E2164756E21
|
|
11458
12214
|
//# sourceMappingURL=index.js.map
|