integrate-sdk 0.9.55 → 0.9.56
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/adapters/index.js +2364 -0
- package/dist/adapters/solid-start.js +2364 -0
- package/dist/adapters/svelte-kit.js +2364 -0
- package/dist/database/adapters/drizzle.d.ts +23 -0
- package/dist/database/adapters/drizzle.d.ts.map +1 -0
- package/dist/database/adapters/drizzle.js +646 -0
- package/dist/database/adapters/mongodb.d.ts +17 -0
- package/dist/database/adapters/mongodb.d.ts.map +1 -0
- package/dist/database/adapters/mongodb.js +643 -0
- package/dist/database/adapters/prisma.d.ts +18 -0
- package/dist/database/adapters/prisma.d.ts.map +1 -0
- package/dist/database/adapters/prisma.js +679 -0
- package/dist/database/index.d.ts +9 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +1128 -0
- package/dist/server.js +3515 -1
- package/dist/src/config/types.d.ts +25 -1
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/database/adapters/drizzle.d.ts +23 -0
- package/dist/src/database/adapters/drizzle.d.ts.map +1 -0
- package/dist/src/database/adapters/mongodb.d.ts +17 -0
- package/dist/src/database/adapters/mongodb.d.ts.map +1 -0
- package/dist/src/database/adapters/prisma.d.ts +18 -0
- package/dist/src/database/adapters/prisma.d.ts.map +1 -0
- package/dist/src/database/factory.d.ts +9 -0
- package/dist/src/database/factory.d.ts.map +1 -0
- package/dist/src/database/index.d.ts +9 -0
- package/dist/src/database/index.d.ts.map +1 -0
- package/dist/src/database/schemas/drizzle.d.ts +508 -0
- package/dist/src/database/schemas/drizzle.d.ts.map +1 -0
- package/dist/src/database/token-store.d.ts +18 -0
- package/dist/src/database/token-store.d.ts.map +1 -0
- package/dist/src/database/trigger-store.d.ts +23 -0
- package/dist/src/database/trigger-store.d.ts.map +1 -0
- package/dist/src/database/types.d.ts +132 -0
- package/dist/src/database/types.d.ts.map +1 -0
- package/dist/src/integrations/integration-docs-metadata.d.ts +40 -0
- package/dist/src/integrations/integration-docs-metadata.d.ts.map +1 -0
- package/dist/src/server.d.ts +4 -3
- package/dist/src/server.d.ts.map +1 -1
- package/package.json +32 -5
|
@@ -5535,7 +5535,2371 @@ var logger199 = createLogger("Zoho Writer");
|
|
|
5535
5535
|
// ../integrations/zoho_sprints.ts
|
|
5536
5536
|
init_logger();
|
|
5537
5537
|
var logger200 = createLogger("Zoho Sprints");
|
|
5538
|
+
// ../database/token-store.ts
|
|
5539
|
+
var USABLE_ACCESS_TOKEN_BUFFER_MS = 30 * 1000;
|
|
5540
|
+
var MIN_MEANINGFUL_EXPIRY_MS = Date.UTC(2000, 0, 1);
|
|
5541
|
+
// ../../node_modules/drizzle-orm/entity.js
|
|
5542
|
+
var entityKind = Symbol.for("drizzle:entityKind");
|
|
5543
|
+
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
5544
|
+
function is(value, type) {
|
|
5545
|
+
if (!value || typeof value !== "object") {
|
|
5546
|
+
return false;
|
|
5547
|
+
}
|
|
5548
|
+
if (value instanceof type) {
|
|
5549
|
+
return true;
|
|
5550
|
+
}
|
|
5551
|
+
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
5552
|
+
throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
|
|
5553
|
+
}
|
|
5554
|
+
let cls = Object.getPrototypeOf(value).constructor;
|
|
5555
|
+
if (cls) {
|
|
5556
|
+
while (cls) {
|
|
5557
|
+
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
5558
|
+
return true;
|
|
5559
|
+
}
|
|
5560
|
+
cls = Object.getPrototypeOf(cls);
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
return false;
|
|
5564
|
+
}
|
|
5565
|
+
|
|
5566
|
+
// ../../node_modules/drizzle-orm/column.js
|
|
5567
|
+
class Column {
|
|
5568
|
+
constructor(table, config) {
|
|
5569
|
+
this.table = table;
|
|
5570
|
+
this.config = config;
|
|
5571
|
+
this.name = config.name;
|
|
5572
|
+
this.keyAsName = config.keyAsName;
|
|
5573
|
+
this.notNull = config.notNull;
|
|
5574
|
+
this.default = config.default;
|
|
5575
|
+
this.defaultFn = config.defaultFn;
|
|
5576
|
+
this.onUpdateFn = config.onUpdateFn;
|
|
5577
|
+
this.hasDefault = config.hasDefault;
|
|
5578
|
+
this.primary = config.primaryKey;
|
|
5579
|
+
this.isUnique = config.isUnique;
|
|
5580
|
+
this.uniqueName = config.uniqueName;
|
|
5581
|
+
this.uniqueType = config.uniqueType;
|
|
5582
|
+
this.dataType = config.dataType;
|
|
5583
|
+
this.columnType = config.columnType;
|
|
5584
|
+
this.generated = config.generated;
|
|
5585
|
+
this.generatedIdentity = config.generatedIdentity;
|
|
5586
|
+
}
|
|
5587
|
+
static [entityKind] = "Column";
|
|
5588
|
+
name;
|
|
5589
|
+
keyAsName;
|
|
5590
|
+
primary;
|
|
5591
|
+
notNull;
|
|
5592
|
+
default;
|
|
5593
|
+
defaultFn;
|
|
5594
|
+
onUpdateFn;
|
|
5595
|
+
hasDefault;
|
|
5596
|
+
isUnique;
|
|
5597
|
+
uniqueName;
|
|
5598
|
+
uniqueType;
|
|
5599
|
+
dataType;
|
|
5600
|
+
columnType;
|
|
5601
|
+
enumValues = undefined;
|
|
5602
|
+
generated = undefined;
|
|
5603
|
+
generatedIdentity = undefined;
|
|
5604
|
+
config;
|
|
5605
|
+
mapFromDriverValue(value) {
|
|
5606
|
+
return value;
|
|
5607
|
+
}
|
|
5608
|
+
mapToDriverValue(value) {
|
|
5609
|
+
return value;
|
|
5610
|
+
}
|
|
5611
|
+
shouldDisableInsert() {
|
|
5612
|
+
return this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5616
|
+
// ../../node_modules/drizzle-orm/column-builder.js
|
|
5617
|
+
class ColumnBuilder {
|
|
5618
|
+
static [entityKind] = "ColumnBuilder";
|
|
5619
|
+
config;
|
|
5620
|
+
constructor(name, dataType, columnType) {
|
|
5621
|
+
this.config = {
|
|
5622
|
+
name,
|
|
5623
|
+
keyAsName: name === "",
|
|
5624
|
+
notNull: false,
|
|
5625
|
+
default: undefined,
|
|
5626
|
+
hasDefault: false,
|
|
5627
|
+
primaryKey: false,
|
|
5628
|
+
isUnique: false,
|
|
5629
|
+
uniqueName: undefined,
|
|
5630
|
+
uniqueType: undefined,
|
|
5631
|
+
dataType,
|
|
5632
|
+
columnType,
|
|
5633
|
+
generated: undefined
|
|
5634
|
+
};
|
|
5635
|
+
}
|
|
5636
|
+
$type() {
|
|
5637
|
+
return this;
|
|
5638
|
+
}
|
|
5639
|
+
notNull() {
|
|
5640
|
+
this.config.notNull = true;
|
|
5641
|
+
return this;
|
|
5642
|
+
}
|
|
5643
|
+
default(value) {
|
|
5644
|
+
this.config.default = value;
|
|
5645
|
+
this.config.hasDefault = true;
|
|
5646
|
+
return this;
|
|
5647
|
+
}
|
|
5648
|
+
$defaultFn(fn) {
|
|
5649
|
+
this.config.defaultFn = fn;
|
|
5650
|
+
this.config.hasDefault = true;
|
|
5651
|
+
return this;
|
|
5652
|
+
}
|
|
5653
|
+
$default = this.$defaultFn;
|
|
5654
|
+
$onUpdateFn(fn) {
|
|
5655
|
+
this.config.onUpdateFn = fn;
|
|
5656
|
+
this.config.hasDefault = true;
|
|
5657
|
+
return this;
|
|
5658
|
+
}
|
|
5659
|
+
$onUpdate = this.$onUpdateFn;
|
|
5660
|
+
primaryKey() {
|
|
5661
|
+
this.config.primaryKey = true;
|
|
5662
|
+
this.config.notNull = true;
|
|
5663
|
+
return this;
|
|
5664
|
+
}
|
|
5665
|
+
setName(name) {
|
|
5666
|
+
if (this.config.name !== "")
|
|
5667
|
+
return;
|
|
5668
|
+
this.config.name = name;
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
|
|
5672
|
+
// ../../node_modules/drizzle-orm/table.utils.js
|
|
5673
|
+
var TableName = Symbol.for("drizzle:Name");
|
|
5674
|
+
|
|
5675
|
+
// ../../node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
5676
|
+
class ForeignKeyBuilder {
|
|
5677
|
+
static [entityKind] = "PgForeignKeyBuilder";
|
|
5678
|
+
reference;
|
|
5679
|
+
_onUpdate = "no action";
|
|
5680
|
+
_onDelete = "no action";
|
|
5681
|
+
constructor(config, actions) {
|
|
5682
|
+
this.reference = () => {
|
|
5683
|
+
const { name, columns, foreignColumns } = config();
|
|
5684
|
+
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
5685
|
+
};
|
|
5686
|
+
if (actions) {
|
|
5687
|
+
this._onUpdate = actions.onUpdate;
|
|
5688
|
+
this._onDelete = actions.onDelete;
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5691
|
+
onUpdate(action) {
|
|
5692
|
+
this._onUpdate = action === undefined ? "no action" : action;
|
|
5693
|
+
return this;
|
|
5694
|
+
}
|
|
5695
|
+
onDelete(action) {
|
|
5696
|
+
this._onDelete = action === undefined ? "no action" : action;
|
|
5697
|
+
return this;
|
|
5698
|
+
}
|
|
5699
|
+
build(table) {
|
|
5700
|
+
return new ForeignKey(table, this);
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
|
|
5704
|
+
class ForeignKey {
|
|
5705
|
+
constructor(table, builder) {
|
|
5706
|
+
this.table = table;
|
|
5707
|
+
this.reference = builder.reference;
|
|
5708
|
+
this.onUpdate = builder._onUpdate;
|
|
5709
|
+
this.onDelete = builder._onDelete;
|
|
5710
|
+
}
|
|
5711
|
+
static [entityKind] = "PgForeignKey";
|
|
5712
|
+
reference;
|
|
5713
|
+
onUpdate;
|
|
5714
|
+
onDelete;
|
|
5715
|
+
getName() {
|
|
5716
|
+
const { name, columns, foreignColumns } = this.reference();
|
|
5717
|
+
const columnNames = columns.map((column) => column.name);
|
|
5718
|
+
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
5719
|
+
const chunks = [
|
|
5720
|
+
this.table[TableName],
|
|
5721
|
+
...columnNames,
|
|
5722
|
+
foreignColumns[0].table[TableName],
|
|
5723
|
+
...foreignColumnNames
|
|
5724
|
+
];
|
|
5725
|
+
return name ?? `${chunks.join("_")}_fk`;
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
|
|
5729
|
+
// ../../node_modules/drizzle-orm/tracing-utils.js
|
|
5730
|
+
function iife(fn, ...args) {
|
|
5731
|
+
return fn(...args);
|
|
5732
|
+
}
|
|
5733
|
+
|
|
5734
|
+
// ../../node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
5735
|
+
function uniqueKeyName(table, columns) {
|
|
5736
|
+
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
5737
|
+
}
|
|
5738
|
+
|
|
5739
|
+
// ../../node_modules/drizzle-orm/pg-core/utils/array.js
|
|
5740
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
5741
|
+
for (let i = startFrom;i < arrayString.length; i++) {
|
|
5742
|
+
const char = arrayString[i];
|
|
5743
|
+
if (char === "\\") {
|
|
5744
|
+
i++;
|
|
5745
|
+
continue;
|
|
5746
|
+
}
|
|
5747
|
+
if (char === '"') {
|
|
5748
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
5749
|
+
}
|
|
5750
|
+
if (inQuotes) {
|
|
5751
|
+
continue;
|
|
5752
|
+
}
|
|
5753
|
+
if (char === "," || char === "}") {
|
|
5754
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
5758
|
+
}
|
|
5759
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
5760
|
+
const result = [];
|
|
5761
|
+
let i = startFrom;
|
|
5762
|
+
let lastCharIsComma = false;
|
|
5763
|
+
while (i < arrayString.length) {
|
|
5764
|
+
const char = arrayString[i];
|
|
5765
|
+
if (char === ",") {
|
|
5766
|
+
if (lastCharIsComma || i === startFrom) {
|
|
5767
|
+
result.push("");
|
|
5768
|
+
}
|
|
5769
|
+
lastCharIsComma = true;
|
|
5770
|
+
i++;
|
|
5771
|
+
continue;
|
|
5772
|
+
}
|
|
5773
|
+
lastCharIsComma = false;
|
|
5774
|
+
if (char === "\\") {
|
|
5775
|
+
i += 2;
|
|
5776
|
+
continue;
|
|
5777
|
+
}
|
|
5778
|
+
if (char === '"') {
|
|
5779
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
5780
|
+
result.push(value2);
|
|
5781
|
+
i = startFrom2;
|
|
5782
|
+
continue;
|
|
5783
|
+
}
|
|
5784
|
+
if (char === "}") {
|
|
5785
|
+
return [result, i + 1];
|
|
5786
|
+
}
|
|
5787
|
+
if (char === "{") {
|
|
5788
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
5789
|
+
result.push(value2);
|
|
5790
|
+
i = startFrom2;
|
|
5791
|
+
continue;
|
|
5792
|
+
}
|
|
5793
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
5794
|
+
result.push(value);
|
|
5795
|
+
i = newStartFrom;
|
|
5796
|
+
}
|
|
5797
|
+
return [result, i];
|
|
5798
|
+
}
|
|
5799
|
+
function parsePgArray(arrayString) {
|
|
5800
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
5801
|
+
return result;
|
|
5802
|
+
}
|
|
5803
|
+
function makePgArray(array2) {
|
|
5804
|
+
return `{${array2.map((item) => {
|
|
5805
|
+
if (Array.isArray(item)) {
|
|
5806
|
+
return makePgArray(item);
|
|
5807
|
+
}
|
|
5808
|
+
if (typeof item === "string") {
|
|
5809
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
5810
|
+
}
|
|
5811
|
+
return `${item}`;
|
|
5812
|
+
}).join(",")}}`;
|
|
5813
|
+
}
|
|
5814
|
+
|
|
5815
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/common.js
|
|
5816
|
+
class PgColumnBuilder extends ColumnBuilder {
|
|
5817
|
+
foreignKeyConfigs = [];
|
|
5818
|
+
static [entityKind] = "PgColumnBuilder";
|
|
5819
|
+
array(size) {
|
|
5820
|
+
return new PgArrayBuilder(this.config.name, this, size);
|
|
5821
|
+
}
|
|
5822
|
+
references(ref, actions = {}) {
|
|
5823
|
+
this.foreignKeyConfigs.push({ ref, actions });
|
|
5824
|
+
return this;
|
|
5825
|
+
}
|
|
5826
|
+
unique(name, config) {
|
|
5827
|
+
this.config.isUnique = true;
|
|
5828
|
+
this.config.uniqueName = name;
|
|
5829
|
+
this.config.uniqueType = config?.nulls;
|
|
5830
|
+
return this;
|
|
5831
|
+
}
|
|
5832
|
+
generatedAlwaysAs(as) {
|
|
5833
|
+
this.config.generated = {
|
|
5834
|
+
as,
|
|
5835
|
+
type: "always",
|
|
5836
|
+
mode: "stored"
|
|
5837
|
+
};
|
|
5838
|
+
return this;
|
|
5839
|
+
}
|
|
5840
|
+
buildForeignKeys(column, table) {
|
|
5841
|
+
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
5842
|
+
return iife((ref2, actions2) => {
|
|
5843
|
+
const builder = new ForeignKeyBuilder(() => {
|
|
5844
|
+
const foreignColumn = ref2();
|
|
5845
|
+
return { columns: [column], foreignColumns: [foreignColumn] };
|
|
5846
|
+
});
|
|
5847
|
+
if (actions2.onUpdate) {
|
|
5848
|
+
builder.onUpdate(actions2.onUpdate);
|
|
5849
|
+
}
|
|
5850
|
+
if (actions2.onDelete) {
|
|
5851
|
+
builder.onDelete(actions2.onDelete);
|
|
5852
|
+
}
|
|
5853
|
+
return builder.build(table);
|
|
5854
|
+
}, ref, actions);
|
|
5855
|
+
});
|
|
5856
|
+
}
|
|
5857
|
+
buildExtraConfigColumn(table) {
|
|
5858
|
+
return new ExtraConfigColumn(table, this.config);
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
|
|
5862
|
+
class PgColumn extends Column {
|
|
5863
|
+
constructor(table, config) {
|
|
5864
|
+
if (!config.uniqueName) {
|
|
5865
|
+
config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
5866
|
+
}
|
|
5867
|
+
super(table, config);
|
|
5868
|
+
this.table = table;
|
|
5869
|
+
}
|
|
5870
|
+
static [entityKind] = "PgColumn";
|
|
5871
|
+
}
|
|
5872
|
+
|
|
5873
|
+
class ExtraConfigColumn extends PgColumn {
|
|
5874
|
+
static [entityKind] = "ExtraConfigColumn";
|
|
5875
|
+
getSQLType() {
|
|
5876
|
+
return this.getSQLType();
|
|
5877
|
+
}
|
|
5878
|
+
indexConfig = {
|
|
5879
|
+
order: this.config.order ?? "asc",
|
|
5880
|
+
nulls: this.config.nulls ?? "last",
|
|
5881
|
+
opClass: this.config.opClass
|
|
5882
|
+
};
|
|
5883
|
+
defaultConfig = {
|
|
5884
|
+
order: "asc",
|
|
5885
|
+
nulls: "last",
|
|
5886
|
+
opClass: undefined
|
|
5887
|
+
};
|
|
5888
|
+
asc() {
|
|
5889
|
+
this.indexConfig.order = "asc";
|
|
5890
|
+
return this;
|
|
5891
|
+
}
|
|
5892
|
+
desc() {
|
|
5893
|
+
this.indexConfig.order = "desc";
|
|
5894
|
+
return this;
|
|
5895
|
+
}
|
|
5896
|
+
nullsFirst() {
|
|
5897
|
+
this.indexConfig.nulls = "first";
|
|
5898
|
+
return this;
|
|
5899
|
+
}
|
|
5900
|
+
nullsLast() {
|
|
5901
|
+
this.indexConfig.nulls = "last";
|
|
5902
|
+
return this;
|
|
5903
|
+
}
|
|
5904
|
+
op(opClass) {
|
|
5905
|
+
this.indexConfig.opClass = opClass;
|
|
5906
|
+
return this;
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
|
|
5910
|
+
class IndexedColumn {
|
|
5911
|
+
static [entityKind] = "IndexedColumn";
|
|
5912
|
+
constructor(name, keyAsName, type, indexConfig) {
|
|
5913
|
+
this.name = name;
|
|
5914
|
+
this.keyAsName = keyAsName;
|
|
5915
|
+
this.type = type;
|
|
5916
|
+
this.indexConfig = indexConfig;
|
|
5917
|
+
}
|
|
5918
|
+
name;
|
|
5919
|
+
keyAsName;
|
|
5920
|
+
type;
|
|
5921
|
+
indexConfig;
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
class PgArrayBuilder extends PgColumnBuilder {
|
|
5925
|
+
static [entityKind] = "PgArrayBuilder";
|
|
5926
|
+
constructor(name, baseBuilder, size) {
|
|
5927
|
+
super(name, "array", "PgArray");
|
|
5928
|
+
this.config.baseBuilder = baseBuilder;
|
|
5929
|
+
this.config.size = size;
|
|
5930
|
+
}
|
|
5931
|
+
build(table) {
|
|
5932
|
+
const baseColumn = this.config.baseBuilder.build(table);
|
|
5933
|
+
return new PgArray(table, this.config, baseColumn);
|
|
5934
|
+
}
|
|
5935
|
+
}
|
|
5936
|
+
|
|
5937
|
+
class PgArray extends PgColumn {
|
|
5938
|
+
constructor(table, config, baseColumn, range) {
|
|
5939
|
+
super(table, config);
|
|
5940
|
+
this.baseColumn = baseColumn;
|
|
5941
|
+
this.range = range;
|
|
5942
|
+
this.size = config.size;
|
|
5943
|
+
}
|
|
5944
|
+
size;
|
|
5945
|
+
static [entityKind] = "PgArray";
|
|
5946
|
+
getSQLType() {
|
|
5947
|
+
return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`;
|
|
5948
|
+
}
|
|
5949
|
+
mapFromDriverValue(value) {
|
|
5950
|
+
if (typeof value === "string") {
|
|
5951
|
+
value = parsePgArray(value);
|
|
5952
|
+
}
|
|
5953
|
+
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
5954
|
+
}
|
|
5955
|
+
mapToDriverValue(value, isNestedArray = false) {
|
|
5956
|
+
const a = value.map((v) => v === null ? null : is(this.baseColumn, PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v));
|
|
5957
|
+
if (isNestedArray)
|
|
5958
|
+
return a;
|
|
5959
|
+
return makePgArray(a);
|
|
5960
|
+
}
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
5964
|
+
class PgEnumObjectColumn extends PgColumn {
|
|
5965
|
+
static [entityKind] = "PgEnumObjectColumn";
|
|
5966
|
+
enum;
|
|
5967
|
+
enumValues = this.config.enum.enumValues;
|
|
5968
|
+
constructor(table, config) {
|
|
5969
|
+
super(table, config);
|
|
5970
|
+
this.enum = config.enum;
|
|
5971
|
+
}
|
|
5972
|
+
getSQLType() {
|
|
5973
|
+
return this.enum.enumName;
|
|
5974
|
+
}
|
|
5975
|
+
}
|
|
5976
|
+
var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
5977
|
+
function isPgEnum(obj) {
|
|
5978
|
+
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
5979
|
+
}
|
|
5980
|
+
class PgEnumColumn extends PgColumn {
|
|
5981
|
+
static [entityKind] = "PgEnumColumn";
|
|
5982
|
+
enum = this.config.enum;
|
|
5983
|
+
enumValues = this.config.enum.enumValues;
|
|
5984
|
+
constructor(table, config) {
|
|
5985
|
+
super(table, config);
|
|
5986
|
+
this.enum = config.enum;
|
|
5987
|
+
}
|
|
5988
|
+
getSQLType() {
|
|
5989
|
+
return this.enum.enumName;
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
|
|
5993
|
+
// ../../node_modules/drizzle-orm/subquery.js
|
|
5994
|
+
class Subquery {
|
|
5995
|
+
static [entityKind] = "Subquery";
|
|
5996
|
+
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
5997
|
+
this._ = {
|
|
5998
|
+
brand: "Subquery",
|
|
5999
|
+
sql,
|
|
6000
|
+
selectedFields: fields,
|
|
6001
|
+
alias,
|
|
6002
|
+
isWith,
|
|
6003
|
+
usedTables
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
|
|
6008
|
+
// ../../node_modules/drizzle-orm/version.js
|
|
6009
|
+
var version = "0.44.7";
|
|
6010
|
+
|
|
6011
|
+
// ../../node_modules/drizzle-orm/tracing.js
|
|
6012
|
+
var otel;
|
|
6013
|
+
var rawTracer;
|
|
6014
|
+
var tracer = {
|
|
6015
|
+
startActiveSpan(name, fn) {
|
|
6016
|
+
if (!otel) {
|
|
6017
|
+
return fn();
|
|
6018
|
+
}
|
|
6019
|
+
if (!rawTracer) {
|
|
6020
|
+
rawTracer = otel.trace.getTracer("drizzle-orm", version);
|
|
6021
|
+
}
|
|
6022
|
+
return iife((otel2, rawTracer2) => rawTracer2.startActiveSpan(name, (span) => {
|
|
6023
|
+
try {
|
|
6024
|
+
return fn(span);
|
|
6025
|
+
} catch (e) {
|
|
6026
|
+
span.setStatus({
|
|
6027
|
+
code: otel2.SpanStatusCode.ERROR,
|
|
6028
|
+
message: e instanceof Error ? e.message : "Unknown error"
|
|
6029
|
+
});
|
|
6030
|
+
throw e;
|
|
6031
|
+
} finally {
|
|
6032
|
+
span.end();
|
|
6033
|
+
}
|
|
6034
|
+
}), otel, rawTracer);
|
|
6035
|
+
}
|
|
6036
|
+
};
|
|
6037
|
+
|
|
6038
|
+
// ../../node_modules/drizzle-orm/view-common.js
|
|
6039
|
+
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
6040
|
+
|
|
6041
|
+
// ../../node_modules/drizzle-orm/table.js
|
|
6042
|
+
var Schema = Symbol.for("drizzle:Schema");
|
|
6043
|
+
var Columns = Symbol.for("drizzle:Columns");
|
|
6044
|
+
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
6045
|
+
var OriginalName = Symbol.for("drizzle:OriginalName");
|
|
6046
|
+
var BaseName = Symbol.for("drizzle:BaseName");
|
|
6047
|
+
var IsAlias = Symbol.for("drizzle:IsAlias");
|
|
6048
|
+
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
6049
|
+
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
6050
|
+
|
|
6051
|
+
class Table {
|
|
6052
|
+
static [entityKind] = "Table";
|
|
6053
|
+
static Symbol = {
|
|
6054
|
+
Name: TableName,
|
|
6055
|
+
Schema,
|
|
6056
|
+
OriginalName,
|
|
6057
|
+
Columns,
|
|
6058
|
+
ExtraConfigColumns,
|
|
6059
|
+
BaseName,
|
|
6060
|
+
IsAlias,
|
|
6061
|
+
ExtraConfigBuilder
|
|
6062
|
+
};
|
|
6063
|
+
[TableName];
|
|
6064
|
+
[OriginalName];
|
|
6065
|
+
[Schema];
|
|
6066
|
+
[Columns];
|
|
6067
|
+
[ExtraConfigColumns];
|
|
6068
|
+
[BaseName];
|
|
6069
|
+
[IsAlias] = false;
|
|
6070
|
+
[IsDrizzleTable] = true;
|
|
6071
|
+
[ExtraConfigBuilder] = undefined;
|
|
6072
|
+
constructor(name, schema, baseName) {
|
|
6073
|
+
this[TableName] = this[OriginalName] = name;
|
|
6074
|
+
this[Schema] = schema;
|
|
6075
|
+
this[BaseName] = baseName;
|
|
6076
|
+
}
|
|
6077
|
+
}
|
|
6078
|
+
|
|
6079
|
+
// ../../node_modules/drizzle-orm/sql/sql.js
|
|
6080
|
+
function isSQLWrapper(value) {
|
|
6081
|
+
return value !== null && value !== undefined && typeof value.getSQL === "function";
|
|
6082
|
+
}
|
|
6083
|
+
function mergeQueries(queries) {
|
|
6084
|
+
const result = { sql: "", params: [] };
|
|
6085
|
+
for (const query of queries) {
|
|
6086
|
+
result.sql += query.sql;
|
|
6087
|
+
result.params.push(...query.params);
|
|
6088
|
+
if (query.typings?.length) {
|
|
6089
|
+
if (!result.typings) {
|
|
6090
|
+
result.typings = [];
|
|
6091
|
+
}
|
|
6092
|
+
result.typings.push(...query.typings);
|
|
6093
|
+
}
|
|
6094
|
+
}
|
|
6095
|
+
return result;
|
|
6096
|
+
}
|
|
6097
|
+
|
|
6098
|
+
class StringChunk {
|
|
6099
|
+
static [entityKind] = "StringChunk";
|
|
6100
|
+
value;
|
|
6101
|
+
constructor(value) {
|
|
6102
|
+
this.value = Array.isArray(value) ? value : [value];
|
|
6103
|
+
}
|
|
6104
|
+
getSQL() {
|
|
6105
|
+
return new SQL([this]);
|
|
6106
|
+
}
|
|
6107
|
+
}
|
|
6108
|
+
|
|
6109
|
+
class SQL {
|
|
6110
|
+
constructor(queryChunks) {
|
|
6111
|
+
this.queryChunks = queryChunks;
|
|
6112
|
+
for (const chunk of queryChunks) {
|
|
6113
|
+
if (is(chunk, Table)) {
|
|
6114
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
6115
|
+
this.usedTables.push(schemaName === undefined ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
|
|
6116
|
+
}
|
|
6117
|
+
}
|
|
6118
|
+
}
|
|
6119
|
+
static [entityKind] = "SQL";
|
|
6120
|
+
decoder = noopDecoder;
|
|
6121
|
+
shouldInlineParams = false;
|
|
6122
|
+
usedTables = [];
|
|
6123
|
+
append(query) {
|
|
6124
|
+
this.queryChunks.push(...query.queryChunks);
|
|
6125
|
+
return this;
|
|
6126
|
+
}
|
|
6127
|
+
toQuery(config) {
|
|
6128
|
+
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
6129
|
+
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
6130
|
+
span?.setAttributes({
|
|
6131
|
+
"drizzle.query.text": query.sql,
|
|
6132
|
+
"drizzle.query.params": JSON.stringify(query.params)
|
|
6133
|
+
});
|
|
6134
|
+
return query;
|
|
6135
|
+
});
|
|
6136
|
+
}
|
|
6137
|
+
buildQueryFromSourceParams(chunks, _config) {
|
|
6138
|
+
const config = Object.assign({}, _config, {
|
|
6139
|
+
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
6140
|
+
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
6141
|
+
});
|
|
6142
|
+
const {
|
|
6143
|
+
casing,
|
|
6144
|
+
escapeName,
|
|
6145
|
+
escapeParam,
|
|
6146
|
+
prepareTyping,
|
|
6147
|
+
inlineParams,
|
|
6148
|
+
paramStartIndex
|
|
6149
|
+
} = config;
|
|
6150
|
+
return mergeQueries(chunks.map((chunk) => {
|
|
6151
|
+
if (is(chunk, StringChunk)) {
|
|
6152
|
+
return { sql: chunk.value.join(""), params: [] };
|
|
6153
|
+
}
|
|
6154
|
+
if (is(chunk, Name)) {
|
|
6155
|
+
return { sql: escapeName(chunk.value), params: [] };
|
|
6156
|
+
}
|
|
6157
|
+
if (chunk === undefined) {
|
|
6158
|
+
return { sql: "", params: [] };
|
|
6159
|
+
}
|
|
6160
|
+
if (Array.isArray(chunk)) {
|
|
6161
|
+
const result = [new StringChunk("(")];
|
|
6162
|
+
for (const [i, p] of chunk.entries()) {
|
|
6163
|
+
result.push(p);
|
|
6164
|
+
if (i < chunk.length - 1) {
|
|
6165
|
+
result.push(new StringChunk(", "));
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
result.push(new StringChunk(")"));
|
|
6169
|
+
return this.buildQueryFromSourceParams(result, config);
|
|
6170
|
+
}
|
|
6171
|
+
if (is(chunk, SQL)) {
|
|
6172
|
+
return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
6173
|
+
...config,
|
|
6174
|
+
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
6175
|
+
});
|
|
6176
|
+
}
|
|
6177
|
+
if (is(chunk, Table)) {
|
|
6178
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
6179
|
+
const tableName = chunk[Table.Symbol.Name];
|
|
6180
|
+
return {
|
|
6181
|
+
sql: schemaName === undefined || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
6182
|
+
params: []
|
|
6183
|
+
};
|
|
6184
|
+
}
|
|
6185
|
+
if (is(chunk, Column)) {
|
|
6186
|
+
const columnName = casing.getColumnCasing(chunk);
|
|
6187
|
+
if (_config.invokeSource === "indexes") {
|
|
6188
|
+
return { sql: escapeName(columnName), params: [] };
|
|
6189
|
+
}
|
|
6190
|
+
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
6191
|
+
return {
|
|
6192
|
+
sql: chunk.table[IsAlias] || schemaName === undefined ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
|
|
6193
|
+
params: []
|
|
6194
|
+
};
|
|
6195
|
+
}
|
|
6196
|
+
if (is(chunk, View)) {
|
|
6197
|
+
const schemaName = chunk[ViewBaseConfig].schema;
|
|
6198
|
+
const viewName = chunk[ViewBaseConfig].name;
|
|
6199
|
+
return {
|
|
6200
|
+
sql: schemaName === undefined || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
6201
|
+
params: []
|
|
6202
|
+
};
|
|
6203
|
+
}
|
|
6204
|
+
if (is(chunk, Param)) {
|
|
6205
|
+
if (is(chunk.value, Placeholder)) {
|
|
6206
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
6207
|
+
}
|
|
6208
|
+
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
6209
|
+
if (is(mappedValue, SQL)) {
|
|
6210
|
+
return this.buildQueryFromSourceParams([mappedValue], config);
|
|
6211
|
+
}
|
|
6212
|
+
if (inlineParams) {
|
|
6213
|
+
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
|
|
6214
|
+
}
|
|
6215
|
+
let typings = ["none"];
|
|
6216
|
+
if (prepareTyping) {
|
|
6217
|
+
typings = [prepareTyping(chunk.encoder)];
|
|
6218
|
+
}
|
|
6219
|
+
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
|
|
6220
|
+
}
|
|
6221
|
+
if (is(chunk, Placeholder)) {
|
|
6222
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
6223
|
+
}
|
|
6224
|
+
if (is(chunk, SQL.Aliased) && chunk.fieldAlias !== undefined) {
|
|
6225
|
+
return { sql: escapeName(chunk.fieldAlias), params: [] };
|
|
6226
|
+
}
|
|
6227
|
+
if (is(chunk, Subquery)) {
|
|
6228
|
+
if (chunk._.isWith) {
|
|
6229
|
+
return { sql: escapeName(chunk._.alias), params: [] };
|
|
6230
|
+
}
|
|
6231
|
+
return this.buildQueryFromSourceParams([
|
|
6232
|
+
new StringChunk("("),
|
|
6233
|
+
chunk._.sql,
|
|
6234
|
+
new StringChunk(") "),
|
|
6235
|
+
new Name(chunk._.alias)
|
|
6236
|
+
], config);
|
|
6237
|
+
}
|
|
6238
|
+
if (isPgEnum(chunk)) {
|
|
6239
|
+
if (chunk.schema) {
|
|
6240
|
+
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
|
|
6241
|
+
}
|
|
6242
|
+
return { sql: escapeName(chunk.enumName), params: [] };
|
|
6243
|
+
}
|
|
6244
|
+
if (isSQLWrapper(chunk)) {
|
|
6245
|
+
if (chunk.shouldOmitSQLParens?.()) {
|
|
6246
|
+
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
6247
|
+
}
|
|
6248
|
+
return this.buildQueryFromSourceParams([
|
|
6249
|
+
new StringChunk("("),
|
|
6250
|
+
chunk.getSQL(),
|
|
6251
|
+
new StringChunk(")")
|
|
6252
|
+
], config);
|
|
6253
|
+
}
|
|
6254
|
+
if (inlineParams) {
|
|
6255
|
+
return { sql: this.mapInlineParam(chunk, config), params: [] };
|
|
6256
|
+
}
|
|
6257
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
6258
|
+
}));
|
|
6259
|
+
}
|
|
6260
|
+
mapInlineParam(chunk, { escapeString }) {
|
|
6261
|
+
if (chunk === null) {
|
|
6262
|
+
return "null";
|
|
6263
|
+
}
|
|
6264
|
+
if (typeof chunk === "number" || typeof chunk === "boolean") {
|
|
6265
|
+
return chunk.toString();
|
|
6266
|
+
}
|
|
6267
|
+
if (typeof chunk === "string") {
|
|
6268
|
+
return escapeString(chunk);
|
|
6269
|
+
}
|
|
6270
|
+
if (typeof chunk === "object") {
|
|
6271
|
+
const mappedValueAsString = chunk.toString();
|
|
6272
|
+
if (mappedValueAsString === "[object Object]") {
|
|
6273
|
+
return escapeString(JSON.stringify(chunk));
|
|
6274
|
+
}
|
|
6275
|
+
return escapeString(mappedValueAsString);
|
|
6276
|
+
}
|
|
6277
|
+
throw new Error("Unexpected param value: " + chunk);
|
|
6278
|
+
}
|
|
6279
|
+
getSQL() {
|
|
6280
|
+
return this;
|
|
6281
|
+
}
|
|
6282
|
+
as(alias) {
|
|
6283
|
+
if (alias === undefined) {
|
|
6284
|
+
return this;
|
|
6285
|
+
}
|
|
6286
|
+
return new SQL.Aliased(this, alias);
|
|
6287
|
+
}
|
|
6288
|
+
mapWith(decoder) {
|
|
6289
|
+
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
6290
|
+
return this;
|
|
6291
|
+
}
|
|
6292
|
+
inlineParams() {
|
|
6293
|
+
this.shouldInlineParams = true;
|
|
6294
|
+
return this;
|
|
6295
|
+
}
|
|
6296
|
+
if(condition) {
|
|
6297
|
+
return condition ? this : undefined;
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
|
|
6301
|
+
class Name {
|
|
6302
|
+
constructor(value) {
|
|
6303
|
+
this.value = value;
|
|
6304
|
+
}
|
|
6305
|
+
static [entityKind] = "Name";
|
|
6306
|
+
brand;
|
|
6307
|
+
getSQL() {
|
|
6308
|
+
return new SQL([this]);
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
var noopDecoder = {
|
|
6312
|
+
mapFromDriverValue: (value) => value
|
|
6313
|
+
};
|
|
6314
|
+
var noopEncoder = {
|
|
6315
|
+
mapToDriverValue: (value) => value
|
|
6316
|
+
};
|
|
6317
|
+
var noopMapper = {
|
|
6318
|
+
...noopDecoder,
|
|
6319
|
+
...noopEncoder
|
|
6320
|
+
};
|
|
6321
|
+
|
|
6322
|
+
class Param {
|
|
6323
|
+
constructor(value, encoder = noopEncoder) {
|
|
6324
|
+
this.value = value;
|
|
6325
|
+
this.encoder = encoder;
|
|
6326
|
+
}
|
|
6327
|
+
static [entityKind] = "Param";
|
|
6328
|
+
brand;
|
|
6329
|
+
getSQL() {
|
|
6330
|
+
return new SQL([this]);
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
function sql(strings, ...params) {
|
|
6334
|
+
const queryChunks = [];
|
|
6335
|
+
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
|
|
6336
|
+
queryChunks.push(new StringChunk(strings[0]));
|
|
6337
|
+
}
|
|
6338
|
+
for (const [paramIndex, param2] of params.entries()) {
|
|
6339
|
+
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
6340
|
+
}
|
|
6341
|
+
return new SQL(queryChunks);
|
|
6342
|
+
}
|
|
6343
|
+
((sql2) => {
|
|
6344
|
+
function empty() {
|
|
6345
|
+
return new SQL([]);
|
|
6346
|
+
}
|
|
6347
|
+
sql2.empty = empty;
|
|
6348
|
+
function fromList(list) {
|
|
6349
|
+
return new SQL(list);
|
|
6350
|
+
}
|
|
6351
|
+
sql2.fromList = fromList;
|
|
6352
|
+
function raw(str) {
|
|
6353
|
+
return new SQL([new StringChunk(str)]);
|
|
6354
|
+
}
|
|
6355
|
+
sql2.raw = raw;
|
|
6356
|
+
function join(chunks, separator) {
|
|
6357
|
+
const result = [];
|
|
6358
|
+
for (const [i, chunk] of chunks.entries()) {
|
|
6359
|
+
if (i > 0 && separator !== undefined) {
|
|
6360
|
+
result.push(separator);
|
|
6361
|
+
}
|
|
6362
|
+
result.push(chunk);
|
|
6363
|
+
}
|
|
6364
|
+
return new SQL(result);
|
|
6365
|
+
}
|
|
6366
|
+
sql2.join = join;
|
|
6367
|
+
function identifier(value) {
|
|
6368
|
+
return new Name(value);
|
|
6369
|
+
}
|
|
6370
|
+
sql2.identifier = identifier;
|
|
6371
|
+
function placeholder2(name2) {
|
|
6372
|
+
return new Placeholder(name2);
|
|
6373
|
+
}
|
|
6374
|
+
sql2.placeholder = placeholder2;
|
|
6375
|
+
function param2(value, encoder) {
|
|
6376
|
+
return new Param(value, encoder);
|
|
6377
|
+
}
|
|
6378
|
+
sql2.param = param2;
|
|
6379
|
+
})(sql || (sql = {}));
|
|
6380
|
+
((SQL2) => {
|
|
6381
|
+
|
|
6382
|
+
class Aliased {
|
|
6383
|
+
constructor(sql2, fieldAlias) {
|
|
6384
|
+
this.sql = sql2;
|
|
6385
|
+
this.fieldAlias = fieldAlias;
|
|
6386
|
+
}
|
|
6387
|
+
static [entityKind] = "SQL.Aliased";
|
|
6388
|
+
isSelectionField = false;
|
|
6389
|
+
getSQL() {
|
|
6390
|
+
return this.sql;
|
|
6391
|
+
}
|
|
6392
|
+
clone() {
|
|
6393
|
+
return new Aliased(this.sql, this.fieldAlias);
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
SQL2.Aliased = Aliased;
|
|
6397
|
+
})(SQL || (SQL = {}));
|
|
6398
|
+
|
|
6399
|
+
class Placeholder {
|
|
6400
|
+
constructor(name2) {
|
|
6401
|
+
this.name = name2;
|
|
6402
|
+
}
|
|
6403
|
+
static [entityKind] = "Placeholder";
|
|
6404
|
+
getSQL() {
|
|
6405
|
+
return new SQL([this]);
|
|
6406
|
+
}
|
|
6407
|
+
}
|
|
6408
|
+
var IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
6409
|
+
|
|
6410
|
+
class View {
|
|
6411
|
+
static [entityKind] = "View";
|
|
6412
|
+
[ViewBaseConfig];
|
|
6413
|
+
[IsDrizzleView] = true;
|
|
6414
|
+
constructor({ name: name2, schema, selectedFields, query }) {
|
|
6415
|
+
this[ViewBaseConfig] = {
|
|
6416
|
+
name: name2,
|
|
6417
|
+
originalName: name2,
|
|
6418
|
+
schema,
|
|
6419
|
+
selectedFields,
|
|
6420
|
+
query,
|
|
6421
|
+
isExisting: !query,
|
|
6422
|
+
isAlias: false
|
|
6423
|
+
};
|
|
6424
|
+
}
|
|
6425
|
+
getSQL() {
|
|
6426
|
+
return new SQL([this]);
|
|
6427
|
+
}
|
|
6428
|
+
}
|
|
6429
|
+
Column.prototype.getSQL = function() {
|
|
6430
|
+
return new SQL([this]);
|
|
6431
|
+
};
|
|
6432
|
+
Table.prototype.getSQL = function() {
|
|
6433
|
+
return new SQL([this]);
|
|
6434
|
+
};
|
|
6435
|
+
Subquery.prototype.getSQL = function() {
|
|
6436
|
+
return new SQL([this]);
|
|
6437
|
+
};
|
|
6438
|
+
|
|
6439
|
+
// ../../node_modules/drizzle-orm/utils.js
|
|
6440
|
+
function getColumnNameAndConfig(a, b) {
|
|
6441
|
+
return {
|
|
6442
|
+
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
6443
|
+
config: typeof a === "object" ? a : b
|
|
6444
|
+
};
|
|
6445
|
+
}
|
|
6446
|
+
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
|
|
6447
|
+
|
|
6448
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/int.common.js
|
|
6449
|
+
class PgIntColumnBaseBuilder extends PgColumnBuilder {
|
|
6450
|
+
static [entityKind] = "PgIntColumnBaseBuilder";
|
|
6451
|
+
generatedAlwaysAsIdentity(sequence) {
|
|
6452
|
+
if (sequence) {
|
|
6453
|
+
const { name, ...options } = sequence;
|
|
6454
|
+
this.config.generatedIdentity = {
|
|
6455
|
+
type: "always",
|
|
6456
|
+
sequenceName: name,
|
|
6457
|
+
sequenceOptions: options
|
|
6458
|
+
};
|
|
6459
|
+
} else {
|
|
6460
|
+
this.config.generatedIdentity = {
|
|
6461
|
+
type: "always"
|
|
6462
|
+
};
|
|
6463
|
+
}
|
|
6464
|
+
this.config.hasDefault = true;
|
|
6465
|
+
this.config.notNull = true;
|
|
6466
|
+
return this;
|
|
6467
|
+
}
|
|
6468
|
+
generatedByDefaultAsIdentity(sequence) {
|
|
6469
|
+
if (sequence) {
|
|
6470
|
+
const { name, ...options } = sequence;
|
|
6471
|
+
this.config.generatedIdentity = {
|
|
6472
|
+
type: "byDefault",
|
|
6473
|
+
sequenceName: name,
|
|
6474
|
+
sequenceOptions: options
|
|
6475
|
+
};
|
|
6476
|
+
} else {
|
|
6477
|
+
this.config.generatedIdentity = {
|
|
6478
|
+
type: "byDefault"
|
|
6479
|
+
};
|
|
6480
|
+
}
|
|
6481
|
+
this.config.hasDefault = true;
|
|
6482
|
+
this.config.notNull = true;
|
|
6483
|
+
return this;
|
|
6484
|
+
}
|
|
6485
|
+
}
|
|
6486
|
+
|
|
6487
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/bigint.js
|
|
6488
|
+
class PgBigInt53Builder extends PgIntColumnBaseBuilder {
|
|
6489
|
+
static [entityKind] = "PgBigInt53Builder";
|
|
6490
|
+
constructor(name) {
|
|
6491
|
+
super(name, "number", "PgBigInt53");
|
|
6492
|
+
}
|
|
6493
|
+
build(table) {
|
|
6494
|
+
return new PgBigInt53(table, this.config);
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
|
|
6498
|
+
class PgBigInt53 extends PgColumn {
|
|
6499
|
+
static [entityKind] = "PgBigInt53";
|
|
6500
|
+
getSQLType() {
|
|
6501
|
+
return "bigint";
|
|
6502
|
+
}
|
|
6503
|
+
mapFromDriverValue(value) {
|
|
6504
|
+
if (typeof value === "number") {
|
|
6505
|
+
return value;
|
|
6506
|
+
}
|
|
6507
|
+
return Number(value);
|
|
6508
|
+
}
|
|
6509
|
+
}
|
|
6510
|
+
|
|
6511
|
+
class PgBigInt64Builder extends PgIntColumnBaseBuilder {
|
|
6512
|
+
static [entityKind] = "PgBigInt64Builder";
|
|
6513
|
+
constructor(name) {
|
|
6514
|
+
super(name, "bigint", "PgBigInt64");
|
|
6515
|
+
}
|
|
6516
|
+
build(table) {
|
|
6517
|
+
return new PgBigInt64(table, this.config);
|
|
6518
|
+
}
|
|
6519
|
+
}
|
|
6520
|
+
|
|
6521
|
+
class PgBigInt64 extends PgColumn {
|
|
6522
|
+
static [entityKind] = "PgBigInt64";
|
|
6523
|
+
getSQLType() {
|
|
6524
|
+
return "bigint";
|
|
6525
|
+
}
|
|
6526
|
+
mapFromDriverValue(value) {
|
|
6527
|
+
return BigInt(value);
|
|
6528
|
+
}
|
|
6529
|
+
}
|
|
6530
|
+
function bigint2(a, b) {
|
|
6531
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6532
|
+
if (config.mode === "number") {
|
|
6533
|
+
return new PgBigInt53Builder(name);
|
|
6534
|
+
}
|
|
6535
|
+
return new PgBigInt64Builder(name);
|
|
6536
|
+
}
|
|
6537
|
+
|
|
6538
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
6539
|
+
class PgBigSerial53Builder extends PgColumnBuilder {
|
|
6540
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
6541
|
+
constructor(name) {
|
|
6542
|
+
super(name, "number", "PgBigSerial53");
|
|
6543
|
+
this.config.hasDefault = true;
|
|
6544
|
+
this.config.notNull = true;
|
|
6545
|
+
}
|
|
6546
|
+
build(table) {
|
|
6547
|
+
return new PgBigSerial53(table, this.config);
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6550
|
+
|
|
6551
|
+
class PgBigSerial53 extends PgColumn {
|
|
6552
|
+
static [entityKind] = "PgBigSerial53";
|
|
6553
|
+
getSQLType() {
|
|
6554
|
+
return "bigserial";
|
|
6555
|
+
}
|
|
6556
|
+
mapFromDriverValue(value) {
|
|
6557
|
+
if (typeof value === "number") {
|
|
6558
|
+
return value;
|
|
6559
|
+
}
|
|
6560
|
+
return Number(value);
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6564
|
+
class PgBigSerial64Builder extends PgColumnBuilder {
|
|
6565
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
6566
|
+
constructor(name) {
|
|
6567
|
+
super(name, "bigint", "PgBigSerial64");
|
|
6568
|
+
this.config.hasDefault = true;
|
|
6569
|
+
}
|
|
6570
|
+
build(table) {
|
|
6571
|
+
return new PgBigSerial64(table, this.config);
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
|
|
6575
|
+
class PgBigSerial64 extends PgColumn {
|
|
6576
|
+
static [entityKind] = "PgBigSerial64";
|
|
6577
|
+
getSQLType() {
|
|
6578
|
+
return "bigserial";
|
|
6579
|
+
}
|
|
6580
|
+
mapFromDriverValue(value) {
|
|
6581
|
+
return BigInt(value);
|
|
6582
|
+
}
|
|
6583
|
+
}
|
|
6584
|
+
function bigserial(a, b) {
|
|
6585
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6586
|
+
if (config.mode === "number") {
|
|
6587
|
+
return new PgBigSerial53Builder(name);
|
|
6588
|
+
}
|
|
6589
|
+
return new PgBigSerial64Builder(name);
|
|
6590
|
+
}
|
|
6591
|
+
|
|
6592
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/boolean.js
|
|
6593
|
+
class PgBooleanBuilder extends PgColumnBuilder {
|
|
6594
|
+
static [entityKind] = "PgBooleanBuilder";
|
|
6595
|
+
constructor(name) {
|
|
6596
|
+
super(name, "boolean", "PgBoolean");
|
|
6597
|
+
}
|
|
6598
|
+
build(table) {
|
|
6599
|
+
return new PgBoolean(table, this.config);
|
|
6600
|
+
}
|
|
6601
|
+
}
|
|
6602
|
+
|
|
6603
|
+
class PgBoolean extends PgColumn {
|
|
6604
|
+
static [entityKind] = "PgBoolean";
|
|
6605
|
+
getSQLType() {
|
|
6606
|
+
return "boolean";
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
function boolean2(name) {
|
|
6610
|
+
return new PgBooleanBuilder(name ?? "");
|
|
6611
|
+
}
|
|
6612
|
+
|
|
6613
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/char.js
|
|
6614
|
+
class PgCharBuilder extends PgColumnBuilder {
|
|
6615
|
+
static [entityKind] = "PgCharBuilder";
|
|
6616
|
+
constructor(name, config) {
|
|
6617
|
+
super(name, "string", "PgChar");
|
|
6618
|
+
this.config.length = config.length;
|
|
6619
|
+
this.config.enumValues = config.enum;
|
|
6620
|
+
}
|
|
6621
|
+
build(table) {
|
|
6622
|
+
return new PgChar(table, this.config);
|
|
6623
|
+
}
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6626
|
+
class PgChar extends PgColumn {
|
|
6627
|
+
static [entityKind] = "PgChar";
|
|
6628
|
+
length = this.config.length;
|
|
6629
|
+
enumValues = this.config.enumValues;
|
|
6630
|
+
getSQLType() {
|
|
6631
|
+
return this.length === undefined ? `char` : `char(${this.length})`;
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
function char(a, b = {}) {
|
|
6635
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6636
|
+
return new PgCharBuilder(name, config);
|
|
6637
|
+
}
|
|
6638
|
+
|
|
6639
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
6640
|
+
class PgCidrBuilder extends PgColumnBuilder {
|
|
6641
|
+
static [entityKind] = "PgCidrBuilder";
|
|
6642
|
+
constructor(name) {
|
|
6643
|
+
super(name, "string", "PgCidr");
|
|
6644
|
+
}
|
|
6645
|
+
build(table) {
|
|
6646
|
+
return new PgCidr(table, this.config);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
|
|
6650
|
+
class PgCidr extends PgColumn {
|
|
6651
|
+
static [entityKind] = "PgCidr";
|
|
6652
|
+
getSQLType() {
|
|
6653
|
+
return "cidr";
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
function cidr(name) {
|
|
6657
|
+
return new PgCidrBuilder(name ?? "");
|
|
6658
|
+
}
|
|
6659
|
+
|
|
6660
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
6661
|
+
class PgCustomColumnBuilder extends PgColumnBuilder {
|
|
6662
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
6663
|
+
constructor(name, fieldConfig, customTypeParams) {
|
|
6664
|
+
super(name, "custom", "PgCustomColumn");
|
|
6665
|
+
this.config.fieldConfig = fieldConfig;
|
|
6666
|
+
this.config.customTypeParams = customTypeParams;
|
|
6667
|
+
}
|
|
6668
|
+
build(table) {
|
|
6669
|
+
return new PgCustomColumn(table, this.config);
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
class PgCustomColumn extends PgColumn {
|
|
6674
|
+
static [entityKind] = "PgCustomColumn";
|
|
6675
|
+
sqlName;
|
|
6676
|
+
mapTo;
|
|
6677
|
+
mapFrom;
|
|
6678
|
+
constructor(table, config) {
|
|
6679
|
+
super(table, config);
|
|
6680
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
6681
|
+
this.mapTo = config.customTypeParams.toDriver;
|
|
6682
|
+
this.mapFrom = config.customTypeParams.fromDriver;
|
|
6683
|
+
}
|
|
6684
|
+
getSQLType() {
|
|
6685
|
+
return this.sqlName;
|
|
6686
|
+
}
|
|
6687
|
+
mapFromDriverValue(value) {
|
|
6688
|
+
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
6689
|
+
}
|
|
6690
|
+
mapToDriverValue(value) {
|
|
6691
|
+
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
6692
|
+
}
|
|
6693
|
+
}
|
|
6694
|
+
function customType(customTypeParams) {
|
|
6695
|
+
return (a, b) => {
|
|
6696
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6697
|
+
return new PgCustomColumnBuilder(name, config, customTypeParams);
|
|
6698
|
+
};
|
|
6699
|
+
}
|
|
6700
|
+
|
|
6701
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
6702
|
+
class PgDateColumnBaseBuilder extends PgColumnBuilder {
|
|
6703
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
6704
|
+
defaultNow() {
|
|
6705
|
+
return this.default(sql`now()`);
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6708
|
+
|
|
6709
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/date.js
|
|
6710
|
+
class PgDateBuilder extends PgDateColumnBaseBuilder {
|
|
6711
|
+
static [entityKind] = "PgDateBuilder";
|
|
6712
|
+
constructor(name) {
|
|
6713
|
+
super(name, "date", "PgDate");
|
|
6714
|
+
}
|
|
6715
|
+
build(table) {
|
|
6716
|
+
return new PgDate(table, this.config);
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
|
|
6720
|
+
class PgDate extends PgColumn {
|
|
6721
|
+
static [entityKind] = "PgDate";
|
|
6722
|
+
getSQLType() {
|
|
6723
|
+
return "date";
|
|
6724
|
+
}
|
|
6725
|
+
mapFromDriverValue(value) {
|
|
6726
|
+
return new Date(value);
|
|
6727
|
+
}
|
|
6728
|
+
mapToDriverValue(value) {
|
|
6729
|
+
return value.toISOString();
|
|
6730
|
+
}
|
|
6731
|
+
}
|
|
6732
|
+
|
|
6733
|
+
class PgDateStringBuilder extends PgDateColumnBaseBuilder {
|
|
6734
|
+
static [entityKind] = "PgDateStringBuilder";
|
|
6735
|
+
constructor(name) {
|
|
6736
|
+
super(name, "string", "PgDateString");
|
|
6737
|
+
}
|
|
6738
|
+
build(table) {
|
|
6739
|
+
return new PgDateString(table, this.config);
|
|
6740
|
+
}
|
|
6741
|
+
}
|
|
6742
|
+
|
|
6743
|
+
class PgDateString extends PgColumn {
|
|
6744
|
+
static [entityKind] = "PgDateString";
|
|
6745
|
+
getSQLType() {
|
|
6746
|
+
return "date";
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
function date2(a, b) {
|
|
6750
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6751
|
+
if (config?.mode === "date") {
|
|
6752
|
+
return new PgDateBuilder(name);
|
|
6753
|
+
}
|
|
6754
|
+
return new PgDateStringBuilder(name);
|
|
6755
|
+
}
|
|
6756
|
+
|
|
6757
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
6758
|
+
class PgDoublePrecisionBuilder extends PgColumnBuilder {
|
|
6759
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
6760
|
+
constructor(name) {
|
|
6761
|
+
super(name, "number", "PgDoublePrecision");
|
|
6762
|
+
}
|
|
6763
|
+
build(table) {
|
|
6764
|
+
return new PgDoublePrecision(table, this.config);
|
|
6765
|
+
}
|
|
6766
|
+
}
|
|
6767
|
+
|
|
6768
|
+
class PgDoublePrecision extends PgColumn {
|
|
6769
|
+
static [entityKind] = "PgDoublePrecision";
|
|
6770
|
+
getSQLType() {
|
|
6771
|
+
return "double precision";
|
|
6772
|
+
}
|
|
6773
|
+
mapFromDriverValue(value) {
|
|
6774
|
+
if (typeof value === "string") {
|
|
6775
|
+
return Number.parseFloat(value);
|
|
6776
|
+
}
|
|
6777
|
+
return value;
|
|
6778
|
+
}
|
|
6779
|
+
}
|
|
6780
|
+
function doublePrecision(name) {
|
|
6781
|
+
return new PgDoublePrecisionBuilder(name ?? "");
|
|
6782
|
+
}
|
|
6783
|
+
|
|
6784
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/inet.js
|
|
6785
|
+
class PgInetBuilder extends PgColumnBuilder {
|
|
6786
|
+
static [entityKind] = "PgInetBuilder";
|
|
6787
|
+
constructor(name) {
|
|
6788
|
+
super(name, "string", "PgInet");
|
|
6789
|
+
}
|
|
6790
|
+
build(table) {
|
|
6791
|
+
return new PgInet(table, this.config);
|
|
6792
|
+
}
|
|
6793
|
+
}
|
|
6794
|
+
|
|
6795
|
+
class PgInet extends PgColumn {
|
|
6796
|
+
static [entityKind] = "PgInet";
|
|
6797
|
+
getSQLType() {
|
|
6798
|
+
return "inet";
|
|
6799
|
+
}
|
|
6800
|
+
}
|
|
6801
|
+
function inet(name) {
|
|
6802
|
+
return new PgInetBuilder(name ?? "");
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6805
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
6806
|
+
class PgIntegerBuilder extends PgIntColumnBaseBuilder {
|
|
6807
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
6808
|
+
constructor(name) {
|
|
6809
|
+
super(name, "number", "PgInteger");
|
|
6810
|
+
}
|
|
6811
|
+
build(table) {
|
|
6812
|
+
return new PgInteger(table, this.config);
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
class PgInteger extends PgColumn {
|
|
6817
|
+
static [entityKind] = "PgInteger";
|
|
6818
|
+
getSQLType() {
|
|
6819
|
+
return "integer";
|
|
6820
|
+
}
|
|
6821
|
+
mapFromDriverValue(value) {
|
|
6822
|
+
if (typeof value === "string") {
|
|
6823
|
+
return Number.parseInt(value);
|
|
6824
|
+
}
|
|
6825
|
+
return value;
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
function integer(name) {
|
|
6829
|
+
return new PgIntegerBuilder(name ?? "");
|
|
6830
|
+
}
|
|
6831
|
+
|
|
6832
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/interval.js
|
|
6833
|
+
class PgIntervalBuilder extends PgColumnBuilder {
|
|
6834
|
+
static [entityKind] = "PgIntervalBuilder";
|
|
6835
|
+
constructor(name, intervalConfig) {
|
|
6836
|
+
super(name, "string", "PgInterval");
|
|
6837
|
+
this.config.intervalConfig = intervalConfig;
|
|
6838
|
+
}
|
|
6839
|
+
build(table) {
|
|
6840
|
+
return new PgInterval(table, this.config);
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6843
|
+
|
|
6844
|
+
class PgInterval extends PgColumn {
|
|
6845
|
+
static [entityKind] = "PgInterval";
|
|
6846
|
+
fields = this.config.intervalConfig.fields;
|
|
6847
|
+
precision = this.config.intervalConfig.precision;
|
|
6848
|
+
getSQLType() {
|
|
6849
|
+
const fields = this.fields ? ` ${this.fields}` : "";
|
|
6850
|
+
const precision = this.precision ? `(${this.precision})` : "";
|
|
6851
|
+
return `interval${fields}${precision}`;
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
function interval(a, b = {}) {
|
|
6855
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6856
|
+
return new PgIntervalBuilder(name, config);
|
|
6857
|
+
}
|
|
6858
|
+
|
|
6859
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/json.js
|
|
6860
|
+
class PgJsonBuilder extends PgColumnBuilder {
|
|
6861
|
+
static [entityKind] = "PgJsonBuilder";
|
|
6862
|
+
constructor(name) {
|
|
6863
|
+
super(name, "json", "PgJson");
|
|
6864
|
+
}
|
|
6865
|
+
build(table) {
|
|
6866
|
+
return new PgJson(table, this.config);
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
|
|
6870
|
+
class PgJson extends PgColumn {
|
|
6871
|
+
static [entityKind] = "PgJson";
|
|
6872
|
+
constructor(table, config) {
|
|
6873
|
+
super(table, config);
|
|
6874
|
+
}
|
|
6875
|
+
getSQLType() {
|
|
6876
|
+
return "json";
|
|
6877
|
+
}
|
|
6878
|
+
mapToDriverValue(value) {
|
|
6879
|
+
return JSON.stringify(value);
|
|
6880
|
+
}
|
|
6881
|
+
mapFromDriverValue(value) {
|
|
6882
|
+
if (typeof value === "string") {
|
|
6883
|
+
try {
|
|
6884
|
+
return JSON.parse(value);
|
|
6885
|
+
} catch {
|
|
6886
|
+
return value;
|
|
6887
|
+
}
|
|
6888
|
+
}
|
|
6889
|
+
return value;
|
|
6890
|
+
}
|
|
6891
|
+
}
|
|
6892
|
+
function json(name) {
|
|
6893
|
+
return new PgJsonBuilder(name ?? "");
|
|
6894
|
+
}
|
|
6895
|
+
|
|
6896
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
6897
|
+
class PgJsonbBuilder extends PgColumnBuilder {
|
|
6898
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
6899
|
+
constructor(name) {
|
|
6900
|
+
super(name, "json", "PgJsonb");
|
|
6901
|
+
}
|
|
6902
|
+
build(table) {
|
|
6903
|
+
return new PgJsonb(table, this.config);
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
|
|
6907
|
+
class PgJsonb extends PgColumn {
|
|
6908
|
+
static [entityKind] = "PgJsonb";
|
|
6909
|
+
constructor(table, config) {
|
|
6910
|
+
super(table, config);
|
|
6911
|
+
}
|
|
6912
|
+
getSQLType() {
|
|
6913
|
+
return "jsonb";
|
|
6914
|
+
}
|
|
6915
|
+
mapToDriverValue(value) {
|
|
6916
|
+
return JSON.stringify(value);
|
|
6917
|
+
}
|
|
6918
|
+
mapFromDriverValue(value) {
|
|
6919
|
+
if (typeof value === "string") {
|
|
6920
|
+
try {
|
|
6921
|
+
return JSON.parse(value);
|
|
6922
|
+
} catch {
|
|
6923
|
+
return value;
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
return value;
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
function jsonb(name) {
|
|
6930
|
+
return new PgJsonbBuilder(name ?? "");
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/line.js
|
|
6934
|
+
class PgLineBuilder extends PgColumnBuilder {
|
|
6935
|
+
static [entityKind] = "PgLineBuilder";
|
|
6936
|
+
constructor(name) {
|
|
6937
|
+
super(name, "array", "PgLine");
|
|
6938
|
+
}
|
|
6939
|
+
build(table) {
|
|
6940
|
+
return new PgLineTuple(table, this.config);
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
|
|
6944
|
+
class PgLineTuple extends PgColumn {
|
|
6945
|
+
static [entityKind] = "PgLine";
|
|
6946
|
+
getSQLType() {
|
|
6947
|
+
return "line";
|
|
6948
|
+
}
|
|
6949
|
+
mapFromDriverValue(value) {
|
|
6950
|
+
const [a, b, c] = value.slice(1, -1).split(",");
|
|
6951
|
+
return [Number.parseFloat(a), Number.parseFloat(b), Number.parseFloat(c)];
|
|
6952
|
+
}
|
|
6953
|
+
mapToDriverValue(value) {
|
|
6954
|
+
return `{${value[0]},${value[1]},${value[2]}}`;
|
|
6955
|
+
}
|
|
6956
|
+
}
|
|
6957
|
+
|
|
6958
|
+
class PgLineABCBuilder extends PgColumnBuilder {
|
|
6959
|
+
static [entityKind] = "PgLineABCBuilder";
|
|
6960
|
+
constructor(name) {
|
|
6961
|
+
super(name, "json", "PgLineABC");
|
|
6962
|
+
}
|
|
6963
|
+
build(table) {
|
|
6964
|
+
return new PgLineABC(table, this.config);
|
|
6965
|
+
}
|
|
6966
|
+
}
|
|
6967
|
+
|
|
6968
|
+
class PgLineABC extends PgColumn {
|
|
6969
|
+
static [entityKind] = "PgLineABC";
|
|
6970
|
+
getSQLType() {
|
|
6971
|
+
return "line";
|
|
6972
|
+
}
|
|
6973
|
+
mapFromDriverValue(value) {
|
|
6974
|
+
const [a, b, c] = value.slice(1, -1).split(",");
|
|
6975
|
+
return { a: Number.parseFloat(a), b: Number.parseFloat(b), c: Number.parseFloat(c) };
|
|
6976
|
+
}
|
|
6977
|
+
mapToDriverValue(value) {
|
|
6978
|
+
return `{${value.a},${value.b},${value.c}}`;
|
|
6979
|
+
}
|
|
6980
|
+
}
|
|
6981
|
+
function line(a, b) {
|
|
6982
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6983
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
6984
|
+
return new PgLineBuilder(name);
|
|
6985
|
+
}
|
|
6986
|
+
return new PgLineABCBuilder(name);
|
|
6987
|
+
}
|
|
6988
|
+
|
|
6989
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/macaddr.js
|
|
6990
|
+
class PgMacaddrBuilder extends PgColumnBuilder {
|
|
6991
|
+
static [entityKind] = "PgMacaddrBuilder";
|
|
6992
|
+
constructor(name) {
|
|
6993
|
+
super(name, "string", "PgMacaddr");
|
|
6994
|
+
}
|
|
6995
|
+
build(table) {
|
|
6996
|
+
return new PgMacaddr(table, this.config);
|
|
6997
|
+
}
|
|
6998
|
+
}
|
|
6999
|
+
|
|
7000
|
+
class PgMacaddr extends PgColumn {
|
|
7001
|
+
static [entityKind] = "PgMacaddr";
|
|
7002
|
+
getSQLType() {
|
|
7003
|
+
return "macaddr";
|
|
7004
|
+
}
|
|
7005
|
+
}
|
|
7006
|
+
function macaddr(name) {
|
|
7007
|
+
return new PgMacaddrBuilder(name ?? "");
|
|
7008
|
+
}
|
|
7009
|
+
|
|
7010
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/macaddr8.js
|
|
7011
|
+
class PgMacaddr8Builder extends PgColumnBuilder {
|
|
7012
|
+
static [entityKind] = "PgMacaddr8Builder";
|
|
7013
|
+
constructor(name) {
|
|
7014
|
+
super(name, "string", "PgMacaddr8");
|
|
7015
|
+
}
|
|
7016
|
+
build(table) {
|
|
7017
|
+
return new PgMacaddr8(table, this.config);
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
|
|
7021
|
+
class PgMacaddr8 extends PgColumn {
|
|
7022
|
+
static [entityKind] = "PgMacaddr8";
|
|
7023
|
+
getSQLType() {
|
|
7024
|
+
return "macaddr8";
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
function macaddr8(name) {
|
|
7028
|
+
return new PgMacaddr8Builder(name ?? "");
|
|
7029
|
+
}
|
|
7030
|
+
|
|
7031
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/numeric.js
|
|
7032
|
+
class PgNumericBuilder extends PgColumnBuilder {
|
|
7033
|
+
static [entityKind] = "PgNumericBuilder";
|
|
7034
|
+
constructor(name, precision, scale) {
|
|
7035
|
+
super(name, "string", "PgNumeric");
|
|
7036
|
+
this.config.precision = precision;
|
|
7037
|
+
this.config.scale = scale;
|
|
7038
|
+
}
|
|
7039
|
+
build(table) {
|
|
7040
|
+
return new PgNumeric(table, this.config);
|
|
7041
|
+
}
|
|
7042
|
+
}
|
|
7043
|
+
|
|
7044
|
+
class PgNumeric extends PgColumn {
|
|
7045
|
+
static [entityKind] = "PgNumeric";
|
|
7046
|
+
precision;
|
|
7047
|
+
scale;
|
|
7048
|
+
constructor(table, config) {
|
|
7049
|
+
super(table, config);
|
|
7050
|
+
this.precision = config.precision;
|
|
7051
|
+
this.scale = config.scale;
|
|
7052
|
+
}
|
|
7053
|
+
mapFromDriverValue(value) {
|
|
7054
|
+
if (typeof value === "string")
|
|
7055
|
+
return value;
|
|
7056
|
+
return String(value);
|
|
7057
|
+
}
|
|
7058
|
+
getSQLType() {
|
|
7059
|
+
if (this.precision !== undefined && this.scale !== undefined) {
|
|
7060
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
7061
|
+
} else if (this.precision === undefined) {
|
|
7062
|
+
return "numeric";
|
|
7063
|
+
} else {
|
|
7064
|
+
return `numeric(${this.precision})`;
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
7068
|
+
|
|
7069
|
+
class PgNumericNumberBuilder extends PgColumnBuilder {
|
|
7070
|
+
static [entityKind] = "PgNumericNumberBuilder";
|
|
7071
|
+
constructor(name, precision, scale) {
|
|
7072
|
+
super(name, "number", "PgNumericNumber");
|
|
7073
|
+
this.config.precision = precision;
|
|
7074
|
+
this.config.scale = scale;
|
|
7075
|
+
}
|
|
7076
|
+
build(table) {
|
|
7077
|
+
return new PgNumericNumber(table, this.config);
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
7080
|
+
|
|
7081
|
+
class PgNumericNumber extends PgColumn {
|
|
7082
|
+
static [entityKind] = "PgNumericNumber";
|
|
7083
|
+
precision;
|
|
7084
|
+
scale;
|
|
7085
|
+
constructor(table, config) {
|
|
7086
|
+
super(table, config);
|
|
7087
|
+
this.precision = config.precision;
|
|
7088
|
+
this.scale = config.scale;
|
|
7089
|
+
}
|
|
7090
|
+
mapFromDriverValue(value) {
|
|
7091
|
+
if (typeof value === "number")
|
|
7092
|
+
return value;
|
|
7093
|
+
return Number(value);
|
|
7094
|
+
}
|
|
7095
|
+
mapToDriverValue = String;
|
|
7096
|
+
getSQLType() {
|
|
7097
|
+
if (this.precision !== undefined && this.scale !== undefined) {
|
|
7098
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
7099
|
+
} else if (this.precision === undefined) {
|
|
7100
|
+
return "numeric";
|
|
7101
|
+
} else {
|
|
7102
|
+
return `numeric(${this.precision})`;
|
|
7103
|
+
}
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7106
|
+
|
|
7107
|
+
class PgNumericBigIntBuilder extends PgColumnBuilder {
|
|
7108
|
+
static [entityKind] = "PgNumericBigIntBuilder";
|
|
7109
|
+
constructor(name, precision, scale) {
|
|
7110
|
+
super(name, "bigint", "PgNumericBigInt");
|
|
7111
|
+
this.config.precision = precision;
|
|
7112
|
+
this.config.scale = scale;
|
|
7113
|
+
}
|
|
7114
|
+
build(table) {
|
|
7115
|
+
return new PgNumericBigInt(table, this.config);
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
|
|
7119
|
+
class PgNumericBigInt extends PgColumn {
|
|
7120
|
+
static [entityKind] = "PgNumericBigInt";
|
|
7121
|
+
precision;
|
|
7122
|
+
scale;
|
|
7123
|
+
constructor(table, config) {
|
|
7124
|
+
super(table, config);
|
|
7125
|
+
this.precision = config.precision;
|
|
7126
|
+
this.scale = config.scale;
|
|
7127
|
+
}
|
|
7128
|
+
mapFromDriverValue = BigInt;
|
|
7129
|
+
mapToDriverValue = String;
|
|
7130
|
+
getSQLType() {
|
|
7131
|
+
if (this.precision !== undefined && this.scale !== undefined) {
|
|
7132
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
7133
|
+
} else if (this.precision === undefined) {
|
|
7134
|
+
return "numeric";
|
|
7135
|
+
} else {
|
|
7136
|
+
return `numeric(${this.precision})`;
|
|
7137
|
+
}
|
|
7138
|
+
}
|
|
7139
|
+
}
|
|
7140
|
+
function numeric(a, b) {
|
|
7141
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7142
|
+
const mode = config?.mode;
|
|
7143
|
+
return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/point.js
|
|
7147
|
+
class PgPointTupleBuilder extends PgColumnBuilder {
|
|
7148
|
+
static [entityKind] = "PgPointTupleBuilder";
|
|
7149
|
+
constructor(name) {
|
|
7150
|
+
super(name, "array", "PgPointTuple");
|
|
7151
|
+
}
|
|
7152
|
+
build(table) {
|
|
7153
|
+
return new PgPointTuple(table, this.config);
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
|
|
7157
|
+
class PgPointTuple extends PgColumn {
|
|
7158
|
+
static [entityKind] = "PgPointTuple";
|
|
7159
|
+
getSQLType() {
|
|
7160
|
+
return "point";
|
|
7161
|
+
}
|
|
7162
|
+
mapFromDriverValue(value) {
|
|
7163
|
+
if (typeof value === "string") {
|
|
7164
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
7165
|
+
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
7166
|
+
}
|
|
7167
|
+
return [value.x, value.y];
|
|
7168
|
+
}
|
|
7169
|
+
mapToDriverValue(value) {
|
|
7170
|
+
return `(${value[0]},${value[1]})`;
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
|
|
7174
|
+
class PgPointObjectBuilder extends PgColumnBuilder {
|
|
7175
|
+
static [entityKind] = "PgPointObjectBuilder";
|
|
7176
|
+
constructor(name) {
|
|
7177
|
+
super(name, "json", "PgPointObject");
|
|
7178
|
+
}
|
|
7179
|
+
build(table) {
|
|
7180
|
+
return new PgPointObject(table, this.config);
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
|
|
7184
|
+
class PgPointObject extends PgColumn {
|
|
7185
|
+
static [entityKind] = "PgPointObject";
|
|
7186
|
+
getSQLType() {
|
|
7187
|
+
return "point";
|
|
7188
|
+
}
|
|
7189
|
+
mapFromDriverValue(value) {
|
|
7190
|
+
if (typeof value === "string") {
|
|
7191
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
7192
|
+
return { x: Number.parseFloat(x), y: Number.parseFloat(y) };
|
|
7193
|
+
}
|
|
7194
|
+
return value;
|
|
7195
|
+
}
|
|
7196
|
+
mapToDriverValue(value) {
|
|
7197
|
+
return `(${value.x},${value.y})`;
|
|
7198
|
+
}
|
|
7199
|
+
}
|
|
7200
|
+
function point(a, b) {
|
|
7201
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7202
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
7203
|
+
return new PgPointTupleBuilder(name);
|
|
7204
|
+
}
|
|
7205
|
+
return new PgPointObjectBuilder(name);
|
|
7206
|
+
}
|
|
7207
|
+
|
|
7208
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
7209
|
+
function hexToBytes(hex) {
|
|
7210
|
+
const bytes = [];
|
|
7211
|
+
for (let c = 0;c < hex.length; c += 2) {
|
|
7212
|
+
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
7213
|
+
}
|
|
7214
|
+
return new Uint8Array(bytes);
|
|
7215
|
+
}
|
|
7216
|
+
function bytesToFloat64(bytes, offset) {
|
|
7217
|
+
const buffer = new ArrayBuffer(8);
|
|
7218
|
+
const view = new DataView(buffer);
|
|
7219
|
+
for (let i = 0;i < 8; i++) {
|
|
7220
|
+
view.setUint8(i, bytes[offset + i]);
|
|
7221
|
+
}
|
|
7222
|
+
return view.getFloat64(0, true);
|
|
7223
|
+
}
|
|
7224
|
+
function parseEWKB(hex) {
|
|
7225
|
+
const bytes = hexToBytes(hex);
|
|
7226
|
+
let offset = 0;
|
|
7227
|
+
const byteOrder = bytes[offset];
|
|
7228
|
+
offset += 1;
|
|
7229
|
+
const view = new DataView(bytes.buffer);
|
|
7230
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
7231
|
+
offset += 4;
|
|
7232
|
+
let _srid;
|
|
7233
|
+
if (geomType & 536870912) {
|
|
7234
|
+
_srid = view.getUint32(offset, byteOrder === 1);
|
|
7235
|
+
offset += 4;
|
|
7236
|
+
}
|
|
7237
|
+
if ((geomType & 65535) === 1) {
|
|
7238
|
+
const x = bytesToFloat64(bytes, offset);
|
|
7239
|
+
offset += 8;
|
|
7240
|
+
const y = bytesToFloat64(bytes, offset);
|
|
7241
|
+
offset += 8;
|
|
7242
|
+
return [x, y];
|
|
7243
|
+
}
|
|
7244
|
+
throw new Error("Unsupported geometry type");
|
|
7245
|
+
}
|
|
7246
|
+
|
|
7247
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
|
|
7248
|
+
class PgGeometryBuilder extends PgColumnBuilder {
|
|
7249
|
+
static [entityKind] = "PgGeometryBuilder";
|
|
7250
|
+
constructor(name) {
|
|
7251
|
+
super(name, "array", "PgGeometry");
|
|
7252
|
+
}
|
|
7253
|
+
build(table) {
|
|
7254
|
+
return new PgGeometry(table, this.config);
|
|
7255
|
+
}
|
|
7256
|
+
}
|
|
7257
|
+
|
|
7258
|
+
class PgGeometry extends PgColumn {
|
|
7259
|
+
static [entityKind] = "PgGeometry";
|
|
7260
|
+
getSQLType() {
|
|
7261
|
+
return "geometry(point)";
|
|
7262
|
+
}
|
|
7263
|
+
mapFromDriverValue(value) {
|
|
7264
|
+
return parseEWKB(value);
|
|
7265
|
+
}
|
|
7266
|
+
mapToDriverValue(value) {
|
|
7267
|
+
return `point(${value[0]} ${value[1]})`;
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
|
|
7271
|
+
class PgGeometryObjectBuilder extends PgColumnBuilder {
|
|
7272
|
+
static [entityKind] = "PgGeometryObjectBuilder";
|
|
7273
|
+
constructor(name) {
|
|
7274
|
+
super(name, "json", "PgGeometryObject");
|
|
7275
|
+
}
|
|
7276
|
+
build(table) {
|
|
7277
|
+
return new PgGeometryObject(table, this.config);
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
|
|
7281
|
+
class PgGeometryObject extends PgColumn {
|
|
7282
|
+
static [entityKind] = "PgGeometryObject";
|
|
7283
|
+
getSQLType() {
|
|
7284
|
+
return "geometry(point)";
|
|
7285
|
+
}
|
|
7286
|
+
mapFromDriverValue(value) {
|
|
7287
|
+
const parsed = parseEWKB(value);
|
|
7288
|
+
return { x: parsed[0], y: parsed[1] };
|
|
7289
|
+
}
|
|
7290
|
+
mapToDriverValue(value) {
|
|
7291
|
+
return `point(${value.x} ${value.y})`;
|
|
7292
|
+
}
|
|
7293
|
+
}
|
|
7294
|
+
function geometry(a, b) {
|
|
7295
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7296
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
7297
|
+
return new PgGeometryBuilder(name);
|
|
7298
|
+
}
|
|
7299
|
+
return new PgGeometryObjectBuilder(name);
|
|
7300
|
+
}
|
|
7301
|
+
|
|
7302
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/real.js
|
|
7303
|
+
class PgRealBuilder extends PgColumnBuilder {
|
|
7304
|
+
static [entityKind] = "PgRealBuilder";
|
|
7305
|
+
constructor(name, length) {
|
|
7306
|
+
super(name, "number", "PgReal");
|
|
7307
|
+
this.config.length = length;
|
|
7308
|
+
}
|
|
7309
|
+
build(table) {
|
|
7310
|
+
return new PgReal(table, this.config);
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
|
|
7314
|
+
class PgReal extends PgColumn {
|
|
7315
|
+
static [entityKind] = "PgReal";
|
|
7316
|
+
constructor(table, config) {
|
|
7317
|
+
super(table, config);
|
|
7318
|
+
}
|
|
7319
|
+
getSQLType() {
|
|
7320
|
+
return "real";
|
|
7321
|
+
}
|
|
7322
|
+
mapFromDriverValue = (value) => {
|
|
7323
|
+
if (typeof value === "string") {
|
|
7324
|
+
return Number.parseFloat(value);
|
|
7325
|
+
}
|
|
7326
|
+
return value;
|
|
7327
|
+
};
|
|
7328
|
+
}
|
|
7329
|
+
function real(name) {
|
|
7330
|
+
return new PgRealBuilder(name ?? "");
|
|
7331
|
+
}
|
|
7332
|
+
|
|
7333
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/serial.js
|
|
7334
|
+
class PgSerialBuilder extends PgColumnBuilder {
|
|
7335
|
+
static [entityKind] = "PgSerialBuilder";
|
|
7336
|
+
constructor(name) {
|
|
7337
|
+
super(name, "number", "PgSerial");
|
|
7338
|
+
this.config.hasDefault = true;
|
|
7339
|
+
this.config.notNull = true;
|
|
7340
|
+
}
|
|
7341
|
+
build(table) {
|
|
7342
|
+
return new PgSerial(table, this.config);
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
|
|
7346
|
+
class PgSerial extends PgColumn {
|
|
7347
|
+
static [entityKind] = "PgSerial";
|
|
7348
|
+
getSQLType() {
|
|
7349
|
+
return "serial";
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7352
|
+
function serial(name) {
|
|
7353
|
+
return new PgSerialBuilder(name ?? "");
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
7357
|
+
class PgSmallIntBuilder extends PgIntColumnBaseBuilder {
|
|
7358
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
7359
|
+
constructor(name) {
|
|
7360
|
+
super(name, "number", "PgSmallInt");
|
|
7361
|
+
}
|
|
7362
|
+
build(table) {
|
|
7363
|
+
return new PgSmallInt(table, this.config);
|
|
7364
|
+
}
|
|
7365
|
+
}
|
|
7366
|
+
|
|
7367
|
+
class PgSmallInt extends PgColumn {
|
|
7368
|
+
static [entityKind] = "PgSmallInt";
|
|
7369
|
+
getSQLType() {
|
|
7370
|
+
return "smallint";
|
|
7371
|
+
}
|
|
7372
|
+
mapFromDriverValue = (value) => {
|
|
7373
|
+
if (typeof value === "string") {
|
|
7374
|
+
return Number(value);
|
|
7375
|
+
}
|
|
7376
|
+
return value;
|
|
7377
|
+
};
|
|
7378
|
+
}
|
|
7379
|
+
function smallint(name) {
|
|
7380
|
+
return new PgSmallIntBuilder(name ?? "");
|
|
7381
|
+
}
|
|
7382
|
+
|
|
7383
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/smallserial.js
|
|
7384
|
+
class PgSmallSerialBuilder extends PgColumnBuilder {
|
|
7385
|
+
static [entityKind] = "PgSmallSerialBuilder";
|
|
7386
|
+
constructor(name) {
|
|
7387
|
+
super(name, "number", "PgSmallSerial");
|
|
7388
|
+
this.config.hasDefault = true;
|
|
7389
|
+
this.config.notNull = true;
|
|
7390
|
+
}
|
|
7391
|
+
build(table) {
|
|
7392
|
+
return new PgSmallSerial(table, this.config);
|
|
7393
|
+
}
|
|
7394
|
+
}
|
|
7395
|
+
|
|
7396
|
+
class PgSmallSerial extends PgColumn {
|
|
7397
|
+
static [entityKind] = "PgSmallSerial";
|
|
7398
|
+
getSQLType() {
|
|
7399
|
+
return "smallserial";
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
function smallserial(name) {
|
|
7403
|
+
return new PgSmallSerialBuilder(name ?? "");
|
|
7404
|
+
}
|
|
7405
|
+
|
|
7406
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/text.js
|
|
7407
|
+
class PgTextBuilder extends PgColumnBuilder {
|
|
7408
|
+
static [entityKind] = "PgTextBuilder";
|
|
7409
|
+
constructor(name, config) {
|
|
7410
|
+
super(name, "string", "PgText");
|
|
7411
|
+
this.config.enumValues = config.enum;
|
|
7412
|
+
}
|
|
7413
|
+
build(table) {
|
|
7414
|
+
return new PgText(table, this.config);
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
|
|
7418
|
+
class PgText extends PgColumn {
|
|
7419
|
+
static [entityKind] = "PgText";
|
|
7420
|
+
enumValues = this.config.enumValues;
|
|
7421
|
+
getSQLType() {
|
|
7422
|
+
return "text";
|
|
7423
|
+
}
|
|
7424
|
+
}
|
|
7425
|
+
function text(a, b = {}) {
|
|
7426
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7427
|
+
return new PgTextBuilder(name, config);
|
|
7428
|
+
}
|
|
7429
|
+
|
|
7430
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/time.js
|
|
7431
|
+
class PgTimeBuilder extends PgDateColumnBaseBuilder {
|
|
7432
|
+
constructor(name, withTimezone, precision) {
|
|
7433
|
+
super(name, "string", "PgTime");
|
|
7434
|
+
this.withTimezone = withTimezone;
|
|
7435
|
+
this.precision = precision;
|
|
7436
|
+
this.config.withTimezone = withTimezone;
|
|
7437
|
+
this.config.precision = precision;
|
|
7438
|
+
}
|
|
7439
|
+
static [entityKind] = "PgTimeBuilder";
|
|
7440
|
+
build(table) {
|
|
7441
|
+
return new PgTime(table, this.config);
|
|
7442
|
+
}
|
|
7443
|
+
}
|
|
7444
|
+
|
|
7445
|
+
class PgTime extends PgColumn {
|
|
7446
|
+
static [entityKind] = "PgTime";
|
|
7447
|
+
withTimezone;
|
|
7448
|
+
precision;
|
|
7449
|
+
constructor(table, config) {
|
|
7450
|
+
super(table, config);
|
|
7451
|
+
this.withTimezone = config.withTimezone;
|
|
7452
|
+
this.precision = config.precision;
|
|
7453
|
+
}
|
|
7454
|
+
getSQLType() {
|
|
7455
|
+
const precision = this.precision === undefined ? "" : `(${this.precision})`;
|
|
7456
|
+
return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
7457
|
+
}
|
|
7458
|
+
}
|
|
7459
|
+
function time(a, b = {}) {
|
|
7460
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7461
|
+
return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
|
|
7462
|
+
}
|
|
7463
|
+
|
|
7464
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
7465
|
+
class PgTimestampBuilder extends PgDateColumnBaseBuilder {
|
|
7466
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
7467
|
+
constructor(name, withTimezone, precision) {
|
|
7468
|
+
super(name, "date", "PgTimestamp");
|
|
7469
|
+
this.config.withTimezone = withTimezone;
|
|
7470
|
+
this.config.precision = precision;
|
|
7471
|
+
}
|
|
7472
|
+
build(table) {
|
|
7473
|
+
return new PgTimestamp(table, this.config);
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
class PgTimestamp extends PgColumn {
|
|
7478
|
+
static [entityKind] = "PgTimestamp";
|
|
7479
|
+
withTimezone;
|
|
7480
|
+
precision;
|
|
7481
|
+
constructor(table, config) {
|
|
7482
|
+
super(table, config);
|
|
7483
|
+
this.withTimezone = config.withTimezone;
|
|
7484
|
+
this.precision = config.precision;
|
|
7485
|
+
}
|
|
7486
|
+
getSQLType() {
|
|
7487
|
+
const precision = this.precision === undefined ? "" : ` (${this.precision})`;
|
|
7488
|
+
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
7489
|
+
}
|
|
7490
|
+
mapFromDriverValue = (value) => {
|
|
7491
|
+
return new Date(this.withTimezone ? value : value + "+0000");
|
|
7492
|
+
};
|
|
7493
|
+
mapToDriverValue = (value) => {
|
|
7494
|
+
return value.toISOString();
|
|
7495
|
+
};
|
|
7496
|
+
}
|
|
7497
|
+
|
|
7498
|
+
class PgTimestampStringBuilder extends PgDateColumnBaseBuilder {
|
|
7499
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
7500
|
+
constructor(name, withTimezone, precision) {
|
|
7501
|
+
super(name, "string", "PgTimestampString");
|
|
7502
|
+
this.config.withTimezone = withTimezone;
|
|
7503
|
+
this.config.precision = precision;
|
|
7504
|
+
}
|
|
7505
|
+
build(table) {
|
|
7506
|
+
return new PgTimestampString(table, this.config);
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
class PgTimestampString extends PgColumn {
|
|
7511
|
+
static [entityKind] = "PgTimestampString";
|
|
7512
|
+
withTimezone;
|
|
7513
|
+
precision;
|
|
7514
|
+
constructor(table, config) {
|
|
7515
|
+
super(table, config);
|
|
7516
|
+
this.withTimezone = config.withTimezone;
|
|
7517
|
+
this.precision = config.precision;
|
|
7518
|
+
}
|
|
7519
|
+
getSQLType() {
|
|
7520
|
+
const precision = this.precision === undefined ? "" : `(${this.precision})`;
|
|
7521
|
+
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
7522
|
+
}
|
|
7523
|
+
}
|
|
7524
|
+
function timestamp(a, b = {}) {
|
|
7525
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7526
|
+
if (config?.mode === "string") {
|
|
7527
|
+
return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
|
|
7528
|
+
}
|
|
7529
|
+
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
|
|
7530
|
+
}
|
|
7531
|
+
|
|
7532
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/uuid.js
|
|
7533
|
+
class PgUUIDBuilder extends PgColumnBuilder {
|
|
7534
|
+
static [entityKind] = "PgUUIDBuilder";
|
|
7535
|
+
constructor(name) {
|
|
7536
|
+
super(name, "string", "PgUUID");
|
|
7537
|
+
}
|
|
7538
|
+
defaultRandom() {
|
|
7539
|
+
return this.default(sql`gen_random_uuid()`);
|
|
7540
|
+
}
|
|
7541
|
+
build(table) {
|
|
7542
|
+
return new PgUUID(table, this.config);
|
|
7543
|
+
}
|
|
7544
|
+
}
|
|
7545
|
+
|
|
7546
|
+
class PgUUID extends PgColumn {
|
|
7547
|
+
static [entityKind] = "PgUUID";
|
|
7548
|
+
getSQLType() {
|
|
7549
|
+
return "uuid";
|
|
7550
|
+
}
|
|
7551
|
+
}
|
|
7552
|
+
function uuid(name) {
|
|
7553
|
+
return new PgUUIDBuilder(name ?? "");
|
|
7554
|
+
}
|
|
7555
|
+
|
|
7556
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
7557
|
+
class PgVarcharBuilder extends PgColumnBuilder {
|
|
7558
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
7559
|
+
constructor(name, config) {
|
|
7560
|
+
super(name, "string", "PgVarchar");
|
|
7561
|
+
this.config.length = config.length;
|
|
7562
|
+
this.config.enumValues = config.enum;
|
|
7563
|
+
}
|
|
7564
|
+
build(table) {
|
|
7565
|
+
return new PgVarchar(table, this.config);
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
7568
|
+
|
|
7569
|
+
class PgVarchar extends PgColumn {
|
|
7570
|
+
static [entityKind] = "PgVarchar";
|
|
7571
|
+
length = this.config.length;
|
|
7572
|
+
enumValues = this.config.enumValues;
|
|
7573
|
+
getSQLType() {
|
|
7574
|
+
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
function varchar(a, b = {}) {
|
|
7578
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7579
|
+
return new PgVarcharBuilder(name, config);
|
|
7580
|
+
}
|
|
7581
|
+
|
|
7582
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
|
|
7583
|
+
class PgBinaryVectorBuilder extends PgColumnBuilder {
|
|
7584
|
+
static [entityKind] = "PgBinaryVectorBuilder";
|
|
7585
|
+
constructor(name, config) {
|
|
7586
|
+
super(name, "string", "PgBinaryVector");
|
|
7587
|
+
this.config.dimensions = config.dimensions;
|
|
7588
|
+
}
|
|
7589
|
+
build(table) {
|
|
7590
|
+
return new PgBinaryVector(table, this.config);
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
|
|
7594
|
+
class PgBinaryVector extends PgColumn {
|
|
7595
|
+
static [entityKind] = "PgBinaryVector";
|
|
7596
|
+
dimensions = this.config.dimensions;
|
|
7597
|
+
getSQLType() {
|
|
7598
|
+
return `bit(${this.dimensions})`;
|
|
7599
|
+
}
|
|
7600
|
+
}
|
|
7601
|
+
function bit(a, b) {
|
|
7602
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7603
|
+
return new PgBinaryVectorBuilder(name, config);
|
|
7604
|
+
}
|
|
7605
|
+
|
|
7606
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
|
|
7607
|
+
class PgHalfVectorBuilder extends PgColumnBuilder {
|
|
7608
|
+
static [entityKind] = "PgHalfVectorBuilder";
|
|
7609
|
+
constructor(name, config) {
|
|
7610
|
+
super(name, "array", "PgHalfVector");
|
|
7611
|
+
this.config.dimensions = config.dimensions;
|
|
7612
|
+
}
|
|
7613
|
+
build(table) {
|
|
7614
|
+
return new PgHalfVector(table, this.config);
|
|
7615
|
+
}
|
|
7616
|
+
}
|
|
7617
|
+
|
|
7618
|
+
class PgHalfVector extends PgColumn {
|
|
7619
|
+
static [entityKind] = "PgHalfVector";
|
|
7620
|
+
dimensions = this.config.dimensions;
|
|
7621
|
+
getSQLType() {
|
|
7622
|
+
return `halfvec(${this.dimensions})`;
|
|
7623
|
+
}
|
|
7624
|
+
mapToDriverValue(value) {
|
|
7625
|
+
return JSON.stringify(value);
|
|
7626
|
+
}
|
|
7627
|
+
mapFromDriverValue(value) {
|
|
7628
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
7629
|
+
}
|
|
7630
|
+
}
|
|
7631
|
+
function halfvec(a, b) {
|
|
7632
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7633
|
+
return new PgHalfVectorBuilder(name, config);
|
|
7634
|
+
}
|
|
7635
|
+
|
|
7636
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
|
|
7637
|
+
class PgSparseVectorBuilder extends PgColumnBuilder {
|
|
7638
|
+
static [entityKind] = "PgSparseVectorBuilder";
|
|
7639
|
+
constructor(name, config) {
|
|
7640
|
+
super(name, "string", "PgSparseVector");
|
|
7641
|
+
this.config.dimensions = config.dimensions;
|
|
7642
|
+
}
|
|
7643
|
+
build(table) {
|
|
7644
|
+
return new PgSparseVector(table, this.config);
|
|
7645
|
+
}
|
|
7646
|
+
}
|
|
7647
|
+
|
|
7648
|
+
class PgSparseVector extends PgColumn {
|
|
7649
|
+
static [entityKind] = "PgSparseVector";
|
|
7650
|
+
dimensions = this.config.dimensions;
|
|
7651
|
+
getSQLType() {
|
|
7652
|
+
return `sparsevec(${this.dimensions})`;
|
|
7653
|
+
}
|
|
7654
|
+
}
|
|
7655
|
+
function sparsevec(a, b) {
|
|
7656
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7657
|
+
return new PgSparseVectorBuilder(name, config);
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
|
|
7661
|
+
class PgVectorBuilder extends PgColumnBuilder {
|
|
7662
|
+
static [entityKind] = "PgVectorBuilder";
|
|
7663
|
+
constructor(name, config) {
|
|
7664
|
+
super(name, "array", "PgVector");
|
|
7665
|
+
this.config.dimensions = config.dimensions;
|
|
7666
|
+
}
|
|
7667
|
+
build(table) {
|
|
7668
|
+
return new PgVector(table, this.config);
|
|
7669
|
+
}
|
|
7670
|
+
}
|
|
7671
|
+
|
|
7672
|
+
class PgVector extends PgColumn {
|
|
7673
|
+
static [entityKind] = "PgVector";
|
|
7674
|
+
dimensions = this.config.dimensions;
|
|
7675
|
+
getSQLType() {
|
|
7676
|
+
return `vector(${this.dimensions})`;
|
|
7677
|
+
}
|
|
7678
|
+
mapToDriverValue(value) {
|
|
7679
|
+
return JSON.stringify(value);
|
|
7680
|
+
}
|
|
7681
|
+
mapFromDriverValue(value) {
|
|
7682
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
7683
|
+
}
|
|
7684
|
+
}
|
|
7685
|
+
function vector(a, b) {
|
|
7686
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
7687
|
+
return new PgVectorBuilder(name, config);
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
// ../../node_modules/drizzle-orm/pg-core/columns/all.js
|
|
7691
|
+
function getPgColumnBuilders() {
|
|
7692
|
+
return {
|
|
7693
|
+
bigint: bigint2,
|
|
7694
|
+
bigserial,
|
|
7695
|
+
boolean: boolean2,
|
|
7696
|
+
char,
|
|
7697
|
+
cidr,
|
|
7698
|
+
customType,
|
|
7699
|
+
date: date2,
|
|
7700
|
+
doublePrecision,
|
|
7701
|
+
inet,
|
|
7702
|
+
integer,
|
|
7703
|
+
interval,
|
|
7704
|
+
json,
|
|
7705
|
+
jsonb,
|
|
7706
|
+
line,
|
|
7707
|
+
macaddr,
|
|
7708
|
+
macaddr8,
|
|
7709
|
+
numeric,
|
|
7710
|
+
point,
|
|
7711
|
+
geometry,
|
|
7712
|
+
real,
|
|
7713
|
+
serial,
|
|
7714
|
+
smallint,
|
|
7715
|
+
smallserial,
|
|
7716
|
+
text,
|
|
7717
|
+
time,
|
|
7718
|
+
timestamp,
|
|
7719
|
+
uuid,
|
|
7720
|
+
varchar,
|
|
7721
|
+
bit,
|
|
7722
|
+
halfvec,
|
|
7723
|
+
sparsevec,
|
|
7724
|
+
vector
|
|
7725
|
+
};
|
|
7726
|
+
}
|
|
7727
|
+
|
|
7728
|
+
// ../../node_modules/drizzle-orm/pg-core/table.js
|
|
7729
|
+
var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
|
7730
|
+
var EnableRLS = Symbol.for("drizzle:EnableRLS");
|
|
7731
|
+
|
|
7732
|
+
class PgTable extends Table {
|
|
7733
|
+
static [entityKind] = "PgTable";
|
|
7734
|
+
static Symbol = Object.assign({}, Table.Symbol, {
|
|
7735
|
+
InlineForeignKeys,
|
|
7736
|
+
EnableRLS
|
|
7737
|
+
});
|
|
7738
|
+
[InlineForeignKeys] = [];
|
|
7739
|
+
[EnableRLS] = false;
|
|
7740
|
+
[Table.Symbol.ExtraConfigBuilder] = undefined;
|
|
7741
|
+
[Table.Symbol.ExtraConfigColumns] = {};
|
|
7742
|
+
}
|
|
7743
|
+
function pgTableWithSchema(name, columns, extraConfig, schema, baseName = name) {
|
|
7744
|
+
const rawTable = new PgTable(name, schema, baseName);
|
|
7745
|
+
const parsedColumns = typeof columns === "function" ? columns(getPgColumnBuilders()) : columns;
|
|
7746
|
+
const builtColumns = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
7747
|
+
const colBuilder = colBuilderBase;
|
|
7748
|
+
colBuilder.setName(name2);
|
|
7749
|
+
const column = colBuilder.build(rawTable);
|
|
7750
|
+
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
7751
|
+
return [name2, column];
|
|
7752
|
+
}));
|
|
7753
|
+
const builtColumnsForExtraConfig = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
7754
|
+
const colBuilder = colBuilderBase;
|
|
7755
|
+
colBuilder.setName(name2);
|
|
7756
|
+
const column = colBuilder.buildExtraConfigColumn(rawTable);
|
|
7757
|
+
return [name2, column];
|
|
7758
|
+
}));
|
|
7759
|
+
const table = Object.assign(rawTable, builtColumns);
|
|
7760
|
+
table[Table.Symbol.Columns] = builtColumns;
|
|
7761
|
+
table[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
|
7762
|
+
if (extraConfig) {
|
|
7763
|
+
table[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
7764
|
+
}
|
|
7765
|
+
return Object.assign(table, {
|
|
7766
|
+
enableRLS: () => {
|
|
7767
|
+
table[PgTable.Symbol.EnableRLS] = true;
|
|
7768
|
+
return table;
|
|
7769
|
+
}
|
|
7770
|
+
});
|
|
7771
|
+
}
|
|
7772
|
+
var pgTable = (name, columns, extraConfig) => {
|
|
7773
|
+
return pgTableWithSchema(name, columns, extraConfig, undefined);
|
|
7774
|
+
};
|
|
7775
|
+
// ../../node_modules/drizzle-orm/pg-core/indexes.js
|
|
7776
|
+
class IndexBuilderOn {
|
|
7777
|
+
constructor(unique, name) {
|
|
7778
|
+
this.unique = unique;
|
|
7779
|
+
this.name = name;
|
|
7780
|
+
}
|
|
7781
|
+
static [entityKind] = "PgIndexBuilderOn";
|
|
7782
|
+
on(...columns) {
|
|
7783
|
+
return new IndexBuilder(columns.map((it) => {
|
|
7784
|
+
if (is(it, SQL)) {
|
|
7785
|
+
return it;
|
|
7786
|
+
}
|
|
7787
|
+
it = it;
|
|
7788
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
7789
|
+
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
7790
|
+
return clonedIndexedColumn;
|
|
7791
|
+
}), this.unique, false, this.name);
|
|
7792
|
+
}
|
|
7793
|
+
onOnly(...columns) {
|
|
7794
|
+
return new IndexBuilder(columns.map((it) => {
|
|
7795
|
+
if (is(it, SQL)) {
|
|
7796
|
+
return it;
|
|
7797
|
+
}
|
|
7798
|
+
it = it;
|
|
7799
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
7800
|
+
it.indexConfig = it.defaultConfig;
|
|
7801
|
+
return clonedIndexedColumn;
|
|
7802
|
+
}), this.unique, true, this.name);
|
|
7803
|
+
}
|
|
7804
|
+
using(method, ...columns) {
|
|
7805
|
+
return new IndexBuilder(columns.map((it) => {
|
|
7806
|
+
if (is(it, SQL)) {
|
|
7807
|
+
return it;
|
|
7808
|
+
}
|
|
7809
|
+
it = it;
|
|
7810
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
7811
|
+
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
7812
|
+
return clonedIndexedColumn;
|
|
7813
|
+
}), this.unique, true, this.name, method);
|
|
7814
|
+
}
|
|
7815
|
+
}
|
|
7816
|
+
|
|
7817
|
+
class IndexBuilder {
|
|
7818
|
+
static [entityKind] = "PgIndexBuilder";
|
|
7819
|
+
config;
|
|
7820
|
+
constructor(columns, unique, only, name, method = "btree") {
|
|
7821
|
+
this.config = {
|
|
7822
|
+
name,
|
|
7823
|
+
columns,
|
|
7824
|
+
unique,
|
|
7825
|
+
only,
|
|
7826
|
+
method
|
|
7827
|
+
};
|
|
7828
|
+
}
|
|
7829
|
+
concurrently() {
|
|
7830
|
+
this.config.concurrently = true;
|
|
7831
|
+
return this;
|
|
7832
|
+
}
|
|
7833
|
+
with(obj) {
|
|
7834
|
+
this.config.with = obj;
|
|
7835
|
+
return this;
|
|
7836
|
+
}
|
|
7837
|
+
where(condition) {
|
|
7838
|
+
this.config.where = condition;
|
|
7839
|
+
return this;
|
|
7840
|
+
}
|
|
7841
|
+
build(table) {
|
|
7842
|
+
return new Index(this.config, table);
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
5538
7845
|
|
|
7846
|
+
class Index {
|
|
7847
|
+
static [entityKind] = "PgIndex";
|
|
7848
|
+
config;
|
|
7849
|
+
constructor(config, table) {
|
|
7850
|
+
this.config = { ...config, table };
|
|
7851
|
+
}
|
|
7852
|
+
}
|
|
7853
|
+
function index(name) {
|
|
7854
|
+
return new IndexBuilderOn(false, name);
|
|
7855
|
+
}
|
|
7856
|
+
function uniqueIndex(name) {
|
|
7857
|
+
return new IndexBuilderOn(true, name);
|
|
7858
|
+
}
|
|
7859
|
+
|
|
7860
|
+
// ../database/schemas/drizzle.ts
|
|
7861
|
+
var integrateProviderToken = pgTable("provider_token", {
|
|
7862
|
+
id: text("id").primaryKey(),
|
|
7863
|
+
userId: text("user_id").notNull(),
|
|
7864
|
+
provider: text("provider").notNull(),
|
|
7865
|
+
accountEmail: text("account_email"),
|
|
7866
|
+
accountId: text("account_id"),
|
|
7867
|
+
accessToken: text("access_token").notNull(),
|
|
7868
|
+
refreshToken: text("refresh_token"),
|
|
7869
|
+
tokenType: text("token_type").notNull().default("Bearer"),
|
|
7870
|
+
expiresAt: timestamp("expires_at"),
|
|
7871
|
+
scope: text("scope"),
|
|
7872
|
+
createdAt: timestamp("created_at", { mode: "date", precision: 3 }).default(sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
7873
|
+
updatedAt: timestamp("updated_at", { mode: "date", precision: 3 }).default(sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
7874
|
+
}, (table) => [
|
|
7875
|
+
index("provider_token_user_id_idx").on(table.userId),
|
|
7876
|
+
index("provider_token_provider_idx").on(table.provider),
|
|
7877
|
+
index("provider_token_user_provider_idx").on(table.userId, table.provider),
|
|
7878
|
+
uniqueIndex("provider_token_user_provider_account_email_uidx").on(table.userId, table.provider, table.accountEmail)
|
|
7879
|
+
]);
|
|
7880
|
+
var integrateTrigger = pgTable("trigger", {
|
|
7881
|
+
id: text("id").primaryKey(),
|
|
7882
|
+
userId: text("user_id"),
|
|
7883
|
+
name: text("name"),
|
|
7884
|
+
description: text("description"),
|
|
7885
|
+
toolName: text("tool_name").notNull(),
|
|
7886
|
+
toolArguments: jsonb("tool_arguments").notNull(),
|
|
7887
|
+
scheduleType: text("schedule_type").notNull(),
|
|
7888
|
+
scheduleValue: text("schedule_value").notNull(),
|
|
7889
|
+
status: text("status").notNull().default("active"),
|
|
7890
|
+
provider: text("provider"),
|
|
7891
|
+
lastRunAt: timestamp("last_run_at", { mode: "date", precision: 3 }),
|
|
7892
|
+
nextRunAt: timestamp("next_run_at", { mode: "date", precision: 3 }),
|
|
7893
|
+
runCount: integer("run_count").notNull().default(0),
|
|
7894
|
+
lastError: text("last_error"),
|
|
7895
|
+
lastResult: jsonb("last_result"),
|
|
7896
|
+
createdAt: timestamp("created_at", { mode: "date", precision: 3 }).default(sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
7897
|
+
updatedAt: timestamp("updated_at", { mode: "date", precision: 3 }).default(sql`CURRENT_TIMESTAMP(3)`).notNull()
|
|
7898
|
+
}, (table) => [
|
|
7899
|
+
index("trigger_user_id_idx").on(table.userId),
|
|
7900
|
+
index("trigger_status_idx").on(table.status),
|
|
7901
|
+
index("trigger_next_run_at_idx").on(table.nextRunAt)
|
|
7902
|
+
]);
|
|
5539
7903
|
// ../server.ts
|
|
5540
7904
|
var SERVER_LOG_CONTEXT3 = "server";
|
|
5541
7905
|
var logger201 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
|