@keystrokehq/cli 1.0.29 → 1.0.31
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/{dist-6-Bdz4wY.mjs → dist-BIWbmT4y.mjs} +765 -3664
- package/dist/dist-BIWbmT4y.mjs.map +1 -0
- package/dist/dist-Bacq9ds5.mjs +3 -0
- package/dist/{dist-B3MtYrDr.mjs → dist-CRP2joPp.mjs} +3 -3
- package/dist/{dist-B3MtYrDr.mjs.map → dist-CRP2joPp.mjs.map} +1 -1
- package/dist/index.mjs +6 -6
- package/package.json +8 -2
- package/dist/dist-6-Bdz4wY.mjs.map +0 -1
- package/dist/dist-zR2BWACn.mjs +0 -3
|
@@ -25,8 +25,13 @@ import "node:child_process";
|
|
|
25
25
|
import { pathToFileURL } from "node:url";
|
|
26
26
|
import { createHash } from "node:crypto";
|
|
27
27
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
28
|
+
import { boolean, doublePrecision, index, integer, jsonb, pgEnum, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
29
|
+
import { index as index$1, integer as integer$1, primaryKey as primaryKey$1, real, sqliteTable, text as text$1, uniqueIndex as uniqueIndex$1 } from "drizzle-orm/sqlite-core";
|
|
28
30
|
import { sql } from "drizzle-orm";
|
|
29
31
|
import "better-sqlite3";
|
|
32
|
+
import "drizzle-orm/better-sqlite3";
|
|
33
|
+
import "drizzle-orm/migrator";
|
|
34
|
+
import "drizzle-orm/better-sqlite3/migrator";
|
|
30
35
|
import "@aws-sdk/client-s3";
|
|
31
36
|
import "@aws-sdk/s3-request-presigner";
|
|
32
37
|
import process$1 from "node:process";
|
|
@@ -3886,3011 +3891,6 @@ function registerWorkflowRunGetter(fn) {
|
|
|
3886
3891
|
registry$1().getter = fn;
|
|
3887
3892
|
}
|
|
3888
3893
|
new AsyncLocalStorage();
|
|
3889
|
-
//#endregion
|
|
3890
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/entity.js
|
|
3891
|
-
const entityKind = Symbol.for("drizzle:entityKind");
|
|
3892
|
-
function is(value, type) {
|
|
3893
|
-
if (!value || typeof value !== "object") return false;
|
|
3894
|
-
if (value instanceof type) return true;
|
|
3895
|
-
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) 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.`);
|
|
3896
|
-
let cls = Object.getPrototypeOf(value).constructor;
|
|
3897
|
-
if (cls) while (cls) {
|
|
3898
|
-
if (entityKind in cls && cls[entityKind] === type[entityKind]) return true;
|
|
3899
|
-
cls = Object.getPrototypeOf(cls);
|
|
3900
|
-
}
|
|
3901
|
-
return false;
|
|
3902
|
-
}
|
|
3903
|
-
//#endregion
|
|
3904
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/column.js
|
|
3905
|
-
var Column = class {
|
|
3906
|
-
constructor(table, config) {
|
|
3907
|
-
this.table = table;
|
|
3908
|
-
this.config = config;
|
|
3909
|
-
this.name = config.name;
|
|
3910
|
-
this.keyAsName = config.keyAsName;
|
|
3911
|
-
this.notNull = config.notNull;
|
|
3912
|
-
this.default = config.default;
|
|
3913
|
-
this.defaultFn = config.defaultFn;
|
|
3914
|
-
this.onUpdateFn = config.onUpdateFn;
|
|
3915
|
-
this.hasDefault = config.hasDefault;
|
|
3916
|
-
this.primary = config.primaryKey;
|
|
3917
|
-
this.isUnique = config.isUnique;
|
|
3918
|
-
this.uniqueName = config.uniqueName;
|
|
3919
|
-
this.uniqueType = config.uniqueType;
|
|
3920
|
-
this.dataType = config.dataType;
|
|
3921
|
-
this.columnType = config.columnType;
|
|
3922
|
-
this.generated = config.generated;
|
|
3923
|
-
this.generatedIdentity = config.generatedIdentity;
|
|
3924
|
-
}
|
|
3925
|
-
static [entityKind] = "Column";
|
|
3926
|
-
name;
|
|
3927
|
-
keyAsName;
|
|
3928
|
-
primary;
|
|
3929
|
-
notNull;
|
|
3930
|
-
default;
|
|
3931
|
-
defaultFn;
|
|
3932
|
-
onUpdateFn;
|
|
3933
|
-
hasDefault;
|
|
3934
|
-
isUnique;
|
|
3935
|
-
uniqueName;
|
|
3936
|
-
uniqueType;
|
|
3937
|
-
dataType;
|
|
3938
|
-
columnType;
|
|
3939
|
-
enumValues = void 0;
|
|
3940
|
-
generated = void 0;
|
|
3941
|
-
generatedIdentity = void 0;
|
|
3942
|
-
config;
|
|
3943
|
-
mapFromDriverValue(value) {
|
|
3944
|
-
return value;
|
|
3945
|
-
}
|
|
3946
|
-
mapToDriverValue(value) {
|
|
3947
|
-
return value;
|
|
3948
|
-
}
|
|
3949
|
-
shouldDisableInsert() {
|
|
3950
|
-
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
3951
|
-
}
|
|
3952
|
-
};
|
|
3953
|
-
//#endregion
|
|
3954
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/column-builder.js
|
|
3955
|
-
var ColumnBuilder = class {
|
|
3956
|
-
static [entityKind] = "ColumnBuilder";
|
|
3957
|
-
config;
|
|
3958
|
-
constructor(name, dataType, columnType) {
|
|
3959
|
-
this.config = {
|
|
3960
|
-
name,
|
|
3961
|
-
keyAsName: name === "",
|
|
3962
|
-
notNull: false,
|
|
3963
|
-
default: void 0,
|
|
3964
|
-
hasDefault: false,
|
|
3965
|
-
primaryKey: false,
|
|
3966
|
-
isUnique: false,
|
|
3967
|
-
uniqueName: void 0,
|
|
3968
|
-
uniqueType: void 0,
|
|
3969
|
-
dataType,
|
|
3970
|
-
columnType,
|
|
3971
|
-
generated: void 0
|
|
3972
|
-
};
|
|
3973
|
-
}
|
|
3974
|
-
/**
|
|
3975
|
-
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
3976
|
-
*
|
|
3977
|
-
* @example
|
|
3978
|
-
* ```ts
|
|
3979
|
-
* const users = pgTable('users', {
|
|
3980
|
-
* id: integer('id').$type<UserId>().primaryKey(),
|
|
3981
|
-
* details: json('details').$type<UserDetails>().notNull(),
|
|
3982
|
-
* });
|
|
3983
|
-
* ```
|
|
3984
|
-
*/
|
|
3985
|
-
$type() {
|
|
3986
|
-
return this;
|
|
3987
|
-
}
|
|
3988
|
-
/**
|
|
3989
|
-
* Adds a `not null` clause to the column definition.
|
|
3990
|
-
*
|
|
3991
|
-
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
3992
|
-
*/
|
|
3993
|
-
notNull() {
|
|
3994
|
-
this.config.notNull = true;
|
|
3995
|
-
return this;
|
|
3996
|
-
}
|
|
3997
|
-
/**
|
|
3998
|
-
* Adds a `default <value>` clause to the column definition.
|
|
3999
|
-
*
|
|
4000
|
-
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
4001
|
-
*
|
|
4002
|
-
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
4003
|
-
*/
|
|
4004
|
-
default(value) {
|
|
4005
|
-
this.config.default = value;
|
|
4006
|
-
this.config.hasDefault = true;
|
|
4007
|
-
return this;
|
|
4008
|
-
}
|
|
4009
|
-
/**
|
|
4010
|
-
* Adds a dynamic default value to the column.
|
|
4011
|
-
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
4012
|
-
*
|
|
4013
|
-
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
4014
|
-
*/
|
|
4015
|
-
$defaultFn(fn) {
|
|
4016
|
-
this.config.defaultFn = fn;
|
|
4017
|
-
this.config.hasDefault = true;
|
|
4018
|
-
return this;
|
|
4019
|
-
}
|
|
4020
|
-
/**
|
|
4021
|
-
* Alias for {@link $defaultFn}.
|
|
4022
|
-
*/
|
|
4023
|
-
$default = this.$defaultFn;
|
|
4024
|
-
/**
|
|
4025
|
-
* Adds a dynamic update value to the column.
|
|
4026
|
-
* The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
|
|
4027
|
-
* If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
|
|
4028
|
-
*
|
|
4029
|
-
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
4030
|
-
*/
|
|
4031
|
-
$onUpdateFn(fn) {
|
|
4032
|
-
this.config.onUpdateFn = fn;
|
|
4033
|
-
this.config.hasDefault = true;
|
|
4034
|
-
return this;
|
|
4035
|
-
}
|
|
4036
|
-
/**
|
|
4037
|
-
* Alias for {@link $onUpdateFn}.
|
|
4038
|
-
*/
|
|
4039
|
-
$onUpdate = this.$onUpdateFn;
|
|
4040
|
-
/**
|
|
4041
|
-
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
4042
|
-
*
|
|
4043
|
-
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
4044
|
-
*/
|
|
4045
|
-
primaryKey() {
|
|
4046
|
-
this.config.primaryKey = true;
|
|
4047
|
-
this.config.notNull = true;
|
|
4048
|
-
return this;
|
|
4049
|
-
}
|
|
4050
|
-
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
4051
|
-
setName(name) {
|
|
4052
|
-
if (this.config.name !== "") return;
|
|
4053
|
-
this.config.name = name;
|
|
4054
|
-
}
|
|
4055
|
-
};
|
|
4056
|
-
//#endregion
|
|
4057
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/table.utils.js
|
|
4058
|
-
const TableName = Symbol.for("drizzle:Name");
|
|
4059
|
-
//#endregion
|
|
4060
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
4061
|
-
var ForeignKeyBuilder$1 = class {
|
|
4062
|
-
static [entityKind] = "PgForeignKeyBuilder";
|
|
4063
|
-
/** @internal */
|
|
4064
|
-
reference;
|
|
4065
|
-
/** @internal */
|
|
4066
|
-
_onUpdate = "no action";
|
|
4067
|
-
/** @internal */
|
|
4068
|
-
_onDelete = "no action";
|
|
4069
|
-
constructor(config, actions) {
|
|
4070
|
-
this.reference = () => {
|
|
4071
|
-
const { name, columns, foreignColumns } = config();
|
|
4072
|
-
return {
|
|
4073
|
-
name,
|
|
4074
|
-
columns,
|
|
4075
|
-
foreignTable: foreignColumns[0].table,
|
|
4076
|
-
foreignColumns
|
|
4077
|
-
};
|
|
4078
|
-
};
|
|
4079
|
-
if (actions) {
|
|
4080
|
-
this._onUpdate = actions.onUpdate;
|
|
4081
|
-
this._onDelete = actions.onDelete;
|
|
4082
|
-
}
|
|
4083
|
-
}
|
|
4084
|
-
onUpdate(action) {
|
|
4085
|
-
this._onUpdate = action === void 0 ? "no action" : action;
|
|
4086
|
-
return this;
|
|
4087
|
-
}
|
|
4088
|
-
onDelete(action) {
|
|
4089
|
-
this._onDelete = action === void 0 ? "no action" : action;
|
|
4090
|
-
return this;
|
|
4091
|
-
}
|
|
4092
|
-
/** @internal */
|
|
4093
|
-
build(table) {
|
|
4094
|
-
return new ForeignKey$1(table, this);
|
|
4095
|
-
}
|
|
4096
|
-
};
|
|
4097
|
-
var ForeignKey$1 = class {
|
|
4098
|
-
constructor(table, builder) {
|
|
4099
|
-
this.table = table;
|
|
4100
|
-
this.reference = builder.reference;
|
|
4101
|
-
this.onUpdate = builder._onUpdate;
|
|
4102
|
-
this.onDelete = builder._onDelete;
|
|
4103
|
-
}
|
|
4104
|
-
static [entityKind] = "PgForeignKey";
|
|
4105
|
-
reference;
|
|
4106
|
-
onUpdate;
|
|
4107
|
-
onDelete;
|
|
4108
|
-
getName() {
|
|
4109
|
-
const { name, columns, foreignColumns } = this.reference();
|
|
4110
|
-
const columnNames = columns.map((column) => column.name);
|
|
4111
|
-
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
4112
|
-
const chunks = [
|
|
4113
|
-
this.table[TableName],
|
|
4114
|
-
...columnNames,
|
|
4115
|
-
foreignColumns[0].table[TableName],
|
|
4116
|
-
...foreignColumnNames
|
|
4117
|
-
];
|
|
4118
|
-
return name ?? `${chunks.join("_")}_fk`;
|
|
4119
|
-
}
|
|
4120
|
-
};
|
|
4121
|
-
//#endregion
|
|
4122
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/tracing-utils.js
|
|
4123
|
-
function iife(fn, ...args) {
|
|
4124
|
-
return fn(...args);
|
|
4125
|
-
}
|
|
4126
|
-
//#endregion
|
|
4127
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
4128
|
-
function uniqueKeyName$1(table, columns) {
|
|
4129
|
-
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
4130
|
-
}
|
|
4131
|
-
//#endregion
|
|
4132
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/utils/array.js
|
|
4133
|
-
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
4134
|
-
for (let i = startFrom; i < arrayString.length; i++) {
|
|
4135
|
-
const char = arrayString[i];
|
|
4136
|
-
if (char === "\\") {
|
|
4137
|
-
i++;
|
|
4138
|
-
continue;
|
|
4139
|
-
}
|
|
4140
|
-
if (char === "\"") return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
4141
|
-
if (inQuotes) continue;
|
|
4142
|
-
if (char === "," || char === "}") return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
4143
|
-
}
|
|
4144
|
-
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
4145
|
-
}
|
|
4146
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
4147
|
-
const result = [];
|
|
4148
|
-
let i = startFrom;
|
|
4149
|
-
let lastCharIsComma = false;
|
|
4150
|
-
while (i < arrayString.length) {
|
|
4151
|
-
const char = arrayString[i];
|
|
4152
|
-
if (char === ",") {
|
|
4153
|
-
if (lastCharIsComma || i === startFrom) result.push("");
|
|
4154
|
-
lastCharIsComma = true;
|
|
4155
|
-
i++;
|
|
4156
|
-
continue;
|
|
4157
|
-
}
|
|
4158
|
-
lastCharIsComma = false;
|
|
4159
|
-
if (char === "\\") {
|
|
4160
|
-
i += 2;
|
|
4161
|
-
continue;
|
|
4162
|
-
}
|
|
4163
|
-
if (char === "\"") {
|
|
4164
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
4165
|
-
result.push(value2);
|
|
4166
|
-
i = startFrom2;
|
|
4167
|
-
continue;
|
|
4168
|
-
}
|
|
4169
|
-
if (char === "}") return [result, i + 1];
|
|
4170
|
-
if (char === "{") {
|
|
4171
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
4172
|
-
result.push(value2);
|
|
4173
|
-
i = startFrom2;
|
|
4174
|
-
continue;
|
|
4175
|
-
}
|
|
4176
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
4177
|
-
result.push(value);
|
|
4178
|
-
i = newStartFrom;
|
|
4179
|
-
}
|
|
4180
|
-
return [result, i];
|
|
4181
|
-
}
|
|
4182
|
-
function parsePgArray(arrayString) {
|
|
4183
|
-
const [result] = parsePgNestedArray(arrayString, 1);
|
|
4184
|
-
return result;
|
|
4185
|
-
}
|
|
4186
|
-
function makePgArray(array) {
|
|
4187
|
-
return `{${array.map((item) => {
|
|
4188
|
-
if (Array.isArray(item)) return makePgArray(item);
|
|
4189
|
-
if (typeof item === "string") return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
4190
|
-
return `${item}`;
|
|
4191
|
-
}).join(",")}}`;
|
|
4192
|
-
}
|
|
4193
|
-
//#endregion
|
|
4194
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
4195
|
-
var PgColumnBuilder = class extends ColumnBuilder {
|
|
4196
|
-
foreignKeyConfigs = [];
|
|
4197
|
-
static [entityKind] = "PgColumnBuilder";
|
|
4198
|
-
array(size) {
|
|
4199
|
-
return new PgArrayBuilder(this.config.name, this, size);
|
|
4200
|
-
}
|
|
4201
|
-
references(ref, actions = {}) {
|
|
4202
|
-
this.foreignKeyConfigs.push({
|
|
4203
|
-
ref,
|
|
4204
|
-
actions
|
|
4205
|
-
});
|
|
4206
|
-
return this;
|
|
4207
|
-
}
|
|
4208
|
-
unique(name, config) {
|
|
4209
|
-
this.config.isUnique = true;
|
|
4210
|
-
this.config.uniqueName = name;
|
|
4211
|
-
this.config.uniqueType = config?.nulls;
|
|
4212
|
-
return this;
|
|
4213
|
-
}
|
|
4214
|
-
generatedAlwaysAs(as) {
|
|
4215
|
-
this.config.generated = {
|
|
4216
|
-
as,
|
|
4217
|
-
type: "always",
|
|
4218
|
-
mode: "stored"
|
|
4219
|
-
};
|
|
4220
|
-
return this;
|
|
4221
|
-
}
|
|
4222
|
-
/** @internal */
|
|
4223
|
-
buildForeignKeys(column, table) {
|
|
4224
|
-
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
4225
|
-
return iife((ref2, actions2) => {
|
|
4226
|
-
const builder = new ForeignKeyBuilder$1(() => {
|
|
4227
|
-
const foreignColumn = ref2();
|
|
4228
|
-
return {
|
|
4229
|
-
columns: [column],
|
|
4230
|
-
foreignColumns: [foreignColumn]
|
|
4231
|
-
};
|
|
4232
|
-
});
|
|
4233
|
-
if (actions2.onUpdate) builder.onUpdate(actions2.onUpdate);
|
|
4234
|
-
if (actions2.onDelete) builder.onDelete(actions2.onDelete);
|
|
4235
|
-
return builder.build(table);
|
|
4236
|
-
}, ref, actions);
|
|
4237
|
-
});
|
|
4238
|
-
}
|
|
4239
|
-
/** @internal */
|
|
4240
|
-
buildExtraConfigColumn(table) {
|
|
4241
|
-
return new ExtraConfigColumn(table, this.config);
|
|
4242
|
-
}
|
|
4243
|
-
};
|
|
4244
|
-
var PgColumn = class extends Column {
|
|
4245
|
-
constructor(table, config) {
|
|
4246
|
-
if (!config.uniqueName) config.uniqueName = uniqueKeyName$1(table, [config.name]);
|
|
4247
|
-
super(table, config);
|
|
4248
|
-
this.table = table;
|
|
4249
|
-
}
|
|
4250
|
-
static [entityKind] = "PgColumn";
|
|
4251
|
-
};
|
|
4252
|
-
var ExtraConfigColumn = class extends PgColumn {
|
|
4253
|
-
static [entityKind] = "ExtraConfigColumn";
|
|
4254
|
-
getSQLType() {
|
|
4255
|
-
return this.getSQLType();
|
|
4256
|
-
}
|
|
4257
|
-
indexConfig = {
|
|
4258
|
-
order: this.config.order ?? "asc",
|
|
4259
|
-
nulls: this.config.nulls ?? "last",
|
|
4260
|
-
opClass: this.config.opClass
|
|
4261
|
-
};
|
|
4262
|
-
defaultConfig = {
|
|
4263
|
-
order: "asc",
|
|
4264
|
-
nulls: "last",
|
|
4265
|
-
opClass: void 0
|
|
4266
|
-
};
|
|
4267
|
-
asc() {
|
|
4268
|
-
this.indexConfig.order = "asc";
|
|
4269
|
-
return this;
|
|
4270
|
-
}
|
|
4271
|
-
desc() {
|
|
4272
|
-
this.indexConfig.order = "desc";
|
|
4273
|
-
return this;
|
|
4274
|
-
}
|
|
4275
|
-
nullsFirst() {
|
|
4276
|
-
this.indexConfig.nulls = "first";
|
|
4277
|
-
return this;
|
|
4278
|
-
}
|
|
4279
|
-
nullsLast() {
|
|
4280
|
-
this.indexConfig.nulls = "last";
|
|
4281
|
-
return this;
|
|
4282
|
-
}
|
|
4283
|
-
/**
|
|
4284
|
-
* ### PostgreSQL documentation quote
|
|
4285
|
-
*
|
|
4286
|
-
* > An operator class with optional parameters can be specified for each column of an index.
|
|
4287
|
-
* The operator class identifies the operators to be used by the index for that column.
|
|
4288
|
-
* For example, a B-tree index on four-byte integers would use the int4_ops class;
|
|
4289
|
-
* this operator class includes comparison functions for four-byte integers.
|
|
4290
|
-
* In practice the default operator class for the column's data type is usually sufficient.
|
|
4291
|
-
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
|
|
4292
|
-
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
|
|
4293
|
-
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
|
|
4294
|
-
* More information about operator classes check:
|
|
4295
|
-
*
|
|
4296
|
-
* ### Useful links
|
|
4297
|
-
* https://www.postgresql.org/docs/current/sql-createindex.html
|
|
4298
|
-
*
|
|
4299
|
-
* https://www.postgresql.org/docs/current/indexes-opclass.html
|
|
4300
|
-
*
|
|
4301
|
-
* https://www.postgresql.org/docs/current/xindex.html
|
|
4302
|
-
*
|
|
4303
|
-
* ### Additional types
|
|
4304
|
-
* If you have the `pg_vector` extension installed in your database, you can use the
|
|
4305
|
-
* `vector_l2_ops`, `vector_ip_ops`, `vector_cosine_ops`, `vector_l1_ops`, `bit_hamming_ops`, `bit_jaccard_ops`, `halfvec_l2_ops`, `sparsevec_l2_ops` options, which are predefined types.
|
|
4306
|
-
*
|
|
4307
|
-
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
|
|
4308
|
-
*
|
|
4309
|
-
* @param opClass
|
|
4310
|
-
* @returns
|
|
4311
|
-
*/
|
|
4312
|
-
op(opClass) {
|
|
4313
|
-
this.indexConfig.opClass = opClass;
|
|
4314
|
-
return this;
|
|
4315
|
-
}
|
|
4316
|
-
};
|
|
4317
|
-
var IndexedColumn = class {
|
|
4318
|
-
static [entityKind] = "IndexedColumn";
|
|
4319
|
-
constructor(name, keyAsName, type, indexConfig) {
|
|
4320
|
-
this.name = name;
|
|
4321
|
-
this.keyAsName = keyAsName;
|
|
4322
|
-
this.type = type;
|
|
4323
|
-
this.indexConfig = indexConfig;
|
|
4324
|
-
}
|
|
4325
|
-
name;
|
|
4326
|
-
keyAsName;
|
|
4327
|
-
type;
|
|
4328
|
-
indexConfig;
|
|
4329
|
-
};
|
|
4330
|
-
var PgArrayBuilder = class extends PgColumnBuilder {
|
|
4331
|
-
static [entityKind] = "PgArrayBuilder";
|
|
4332
|
-
constructor(name, baseBuilder, size) {
|
|
4333
|
-
super(name, "array", "PgArray");
|
|
4334
|
-
this.config.baseBuilder = baseBuilder;
|
|
4335
|
-
this.config.size = size;
|
|
4336
|
-
}
|
|
4337
|
-
/** @internal */
|
|
4338
|
-
build(table) {
|
|
4339
|
-
const baseColumn = this.config.baseBuilder.build(table);
|
|
4340
|
-
return new PgArray(table, this.config, baseColumn);
|
|
4341
|
-
}
|
|
4342
|
-
};
|
|
4343
|
-
var PgArray = class PgArray extends PgColumn {
|
|
4344
|
-
constructor(table, config, baseColumn, range) {
|
|
4345
|
-
super(table, config);
|
|
4346
|
-
this.baseColumn = baseColumn;
|
|
4347
|
-
this.range = range;
|
|
4348
|
-
this.size = config.size;
|
|
4349
|
-
}
|
|
4350
|
-
size;
|
|
4351
|
-
static [entityKind] = "PgArray";
|
|
4352
|
-
getSQLType() {
|
|
4353
|
-
return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`;
|
|
4354
|
-
}
|
|
4355
|
-
mapFromDriverValue(value) {
|
|
4356
|
-
if (typeof value === "string") value = parsePgArray(value);
|
|
4357
|
-
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
4358
|
-
}
|
|
4359
|
-
mapToDriverValue(value, isNestedArray = false) {
|
|
4360
|
-
const a = value.map((v) => v === null ? null : is(this.baseColumn, PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v));
|
|
4361
|
-
if (isNestedArray) return a;
|
|
4362
|
-
return makePgArray(a);
|
|
4363
|
-
}
|
|
4364
|
-
};
|
|
4365
|
-
//#endregion
|
|
4366
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
4367
|
-
var PgEnumObjectColumnBuilder = class extends PgColumnBuilder {
|
|
4368
|
-
static [entityKind] = "PgEnumObjectColumnBuilder";
|
|
4369
|
-
constructor(name, enumInstance) {
|
|
4370
|
-
super(name, "string", "PgEnumObjectColumn");
|
|
4371
|
-
this.config.enum = enumInstance;
|
|
4372
|
-
}
|
|
4373
|
-
/** @internal */
|
|
4374
|
-
build(table) {
|
|
4375
|
-
return new PgEnumObjectColumn(table, this.config);
|
|
4376
|
-
}
|
|
4377
|
-
};
|
|
4378
|
-
var PgEnumObjectColumn = class extends PgColumn {
|
|
4379
|
-
static [entityKind] = "PgEnumObjectColumn";
|
|
4380
|
-
enum;
|
|
4381
|
-
enumValues = this.config.enum.enumValues;
|
|
4382
|
-
constructor(table, config) {
|
|
4383
|
-
super(table, config);
|
|
4384
|
-
this.enum = config.enum;
|
|
4385
|
-
}
|
|
4386
|
-
getSQLType() {
|
|
4387
|
-
return this.enum.enumName;
|
|
4388
|
-
}
|
|
4389
|
-
};
|
|
4390
|
-
const isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
4391
|
-
function isPgEnum(obj) {
|
|
4392
|
-
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
4393
|
-
}
|
|
4394
|
-
var PgEnumColumnBuilder = class extends PgColumnBuilder {
|
|
4395
|
-
static [entityKind] = "PgEnumColumnBuilder";
|
|
4396
|
-
constructor(name, enumInstance) {
|
|
4397
|
-
super(name, "string", "PgEnumColumn");
|
|
4398
|
-
this.config.enum = enumInstance;
|
|
4399
|
-
}
|
|
4400
|
-
/** @internal */
|
|
4401
|
-
build(table) {
|
|
4402
|
-
return new PgEnumColumn(table, this.config);
|
|
4403
|
-
}
|
|
4404
|
-
};
|
|
4405
|
-
var PgEnumColumn = class extends PgColumn {
|
|
4406
|
-
static [entityKind] = "PgEnumColumn";
|
|
4407
|
-
enum = this.config.enum;
|
|
4408
|
-
enumValues = this.config.enum.enumValues;
|
|
4409
|
-
constructor(table, config) {
|
|
4410
|
-
super(table, config);
|
|
4411
|
-
this.enum = config.enum;
|
|
4412
|
-
}
|
|
4413
|
-
getSQLType() {
|
|
4414
|
-
return this.enum.enumName;
|
|
4415
|
-
}
|
|
4416
|
-
};
|
|
4417
|
-
function pgEnum(enumName, input) {
|
|
4418
|
-
return Array.isArray(input) ? pgEnumWithSchema(enumName, [...input], void 0) : pgEnumObjectWithSchema(enumName, input, void 0);
|
|
4419
|
-
}
|
|
4420
|
-
function pgEnumWithSchema(enumName, values, schema) {
|
|
4421
|
-
const enumInstance = Object.assign((name) => new PgEnumColumnBuilder(name ?? "", enumInstance), {
|
|
4422
|
-
enumName,
|
|
4423
|
-
enumValues: values,
|
|
4424
|
-
schema,
|
|
4425
|
-
[isPgEnumSym]: true
|
|
4426
|
-
});
|
|
4427
|
-
return enumInstance;
|
|
4428
|
-
}
|
|
4429
|
-
function pgEnumObjectWithSchema(enumName, values, schema) {
|
|
4430
|
-
const enumInstance = Object.assign((name) => new PgEnumObjectColumnBuilder(name ?? "", enumInstance), {
|
|
4431
|
-
enumName,
|
|
4432
|
-
enumValues: Object.values(values),
|
|
4433
|
-
schema,
|
|
4434
|
-
[isPgEnumSym]: true
|
|
4435
|
-
});
|
|
4436
|
-
return enumInstance;
|
|
4437
|
-
}
|
|
4438
|
-
//#endregion
|
|
4439
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/subquery.js
|
|
4440
|
-
var Subquery = class {
|
|
4441
|
-
static [entityKind] = "Subquery";
|
|
4442
|
-
constructor(sql, fields, alias, isWith = false, usedTables = []) {
|
|
4443
|
-
this._ = {
|
|
4444
|
-
brand: "Subquery",
|
|
4445
|
-
sql,
|
|
4446
|
-
selectedFields: fields,
|
|
4447
|
-
alias,
|
|
4448
|
-
isWith,
|
|
4449
|
-
usedTables
|
|
4450
|
-
};
|
|
4451
|
-
}
|
|
4452
|
-
};
|
|
4453
|
-
//#endregion
|
|
4454
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/tracing.js
|
|
4455
|
-
const tracer = { startActiveSpan(name, fn) {
|
|
4456
|
-
return fn();
|
|
4457
|
-
} };
|
|
4458
|
-
//#endregion
|
|
4459
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/view-common.js
|
|
4460
|
-
const ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
4461
|
-
//#endregion
|
|
4462
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/table.js
|
|
4463
|
-
const Schema = Symbol.for("drizzle:Schema");
|
|
4464
|
-
const Columns = Symbol.for("drizzle:Columns");
|
|
4465
|
-
const ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
4466
|
-
const OriginalName = Symbol.for("drizzle:OriginalName");
|
|
4467
|
-
const BaseName = Symbol.for("drizzle:BaseName");
|
|
4468
|
-
const IsAlias = Symbol.for("drizzle:IsAlias");
|
|
4469
|
-
const ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
4470
|
-
const IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
4471
|
-
var Table = class {
|
|
4472
|
-
static [entityKind] = "Table";
|
|
4473
|
-
/** @internal */
|
|
4474
|
-
static Symbol = {
|
|
4475
|
-
Name: TableName,
|
|
4476
|
-
Schema,
|
|
4477
|
-
OriginalName,
|
|
4478
|
-
Columns,
|
|
4479
|
-
ExtraConfigColumns,
|
|
4480
|
-
BaseName,
|
|
4481
|
-
IsAlias,
|
|
4482
|
-
ExtraConfigBuilder
|
|
4483
|
-
};
|
|
4484
|
-
/**
|
|
4485
|
-
* @internal
|
|
4486
|
-
* Can be changed if the table is aliased.
|
|
4487
|
-
*/
|
|
4488
|
-
[TableName];
|
|
4489
|
-
/**
|
|
4490
|
-
* @internal
|
|
4491
|
-
* Used to store the original name of the table, before any aliasing.
|
|
4492
|
-
*/
|
|
4493
|
-
[OriginalName];
|
|
4494
|
-
/** @internal */
|
|
4495
|
-
[Schema];
|
|
4496
|
-
/** @internal */
|
|
4497
|
-
[Columns];
|
|
4498
|
-
/** @internal */
|
|
4499
|
-
[ExtraConfigColumns];
|
|
4500
|
-
/**
|
|
4501
|
-
* @internal
|
|
4502
|
-
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
4503
|
-
*/
|
|
4504
|
-
[BaseName];
|
|
4505
|
-
/** @internal */
|
|
4506
|
-
[IsAlias] = false;
|
|
4507
|
-
/** @internal */
|
|
4508
|
-
[IsDrizzleTable] = true;
|
|
4509
|
-
/** @internal */
|
|
4510
|
-
[ExtraConfigBuilder] = void 0;
|
|
4511
|
-
constructor(name, schema, baseName) {
|
|
4512
|
-
this[TableName] = this[OriginalName] = name;
|
|
4513
|
-
this[Schema] = schema;
|
|
4514
|
-
this[BaseName] = baseName;
|
|
4515
|
-
}
|
|
4516
|
-
};
|
|
4517
|
-
//#endregion
|
|
4518
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sql/sql.js
|
|
4519
|
-
function isSQLWrapper(value) {
|
|
4520
|
-
return value !== null && value !== void 0 && typeof value.getSQL === "function";
|
|
4521
|
-
}
|
|
4522
|
-
function mergeQueries(queries) {
|
|
4523
|
-
const result = {
|
|
4524
|
-
sql: "",
|
|
4525
|
-
params: []
|
|
4526
|
-
};
|
|
4527
|
-
for (const query of queries) {
|
|
4528
|
-
result.sql += query.sql;
|
|
4529
|
-
result.params.push(...query.params);
|
|
4530
|
-
if (query.typings?.length) {
|
|
4531
|
-
if (!result.typings) result.typings = [];
|
|
4532
|
-
result.typings.push(...query.typings);
|
|
4533
|
-
}
|
|
4534
|
-
}
|
|
4535
|
-
return result;
|
|
4536
|
-
}
|
|
4537
|
-
var StringChunk = class {
|
|
4538
|
-
static [entityKind] = "StringChunk";
|
|
4539
|
-
value;
|
|
4540
|
-
constructor(value) {
|
|
4541
|
-
this.value = Array.isArray(value) ? value : [value];
|
|
4542
|
-
}
|
|
4543
|
-
getSQL() {
|
|
4544
|
-
return new SQL([this]);
|
|
4545
|
-
}
|
|
4546
|
-
};
|
|
4547
|
-
var SQL = class SQL {
|
|
4548
|
-
constructor(queryChunks) {
|
|
4549
|
-
this.queryChunks = queryChunks;
|
|
4550
|
-
for (const chunk of queryChunks) if (is(chunk, Table)) {
|
|
4551
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
4552
|
-
this.usedTables.push(schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
|
|
4553
|
-
}
|
|
4554
|
-
}
|
|
4555
|
-
static [entityKind] = "SQL";
|
|
4556
|
-
/** @internal */
|
|
4557
|
-
decoder = noopDecoder;
|
|
4558
|
-
shouldInlineParams = false;
|
|
4559
|
-
/** @internal */
|
|
4560
|
-
usedTables = [];
|
|
4561
|
-
append(query) {
|
|
4562
|
-
this.queryChunks.push(...query.queryChunks);
|
|
4563
|
-
return this;
|
|
4564
|
-
}
|
|
4565
|
-
toQuery(config) {
|
|
4566
|
-
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
4567
|
-
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
4568
|
-
span?.setAttributes({
|
|
4569
|
-
"drizzle.query.text": query.sql,
|
|
4570
|
-
"drizzle.query.params": JSON.stringify(query.params)
|
|
4571
|
-
});
|
|
4572
|
-
return query;
|
|
4573
|
-
});
|
|
4574
|
-
}
|
|
4575
|
-
buildQueryFromSourceParams(chunks, _config) {
|
|
4576
|
-
const config = Object.assign({}, _config, {
|
|
4577
|
-
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
4578
|
-
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
4579
|
-
});
|
|
4580
|
-
const { casing, escapeName, escapeParam, prepareTyping, inlineParams, paramStartIndex } = config;
|
|
4581
|
-
return mergeQueries(chunks.map((chunk) => {
|
|
4582
|
-
if (is(chunk, StringChunk)) return {
|
|
4583
|
-
sql: chunk.value.join(""),
|
|
4584
|
-
params: []
|
|
4585
|
-
};
|
|
4586
|
-
if (is(chunk, Name)) return {
|
|
4587
|
-
sql: escapeName(chunk.value),
|
|
4588
|
-
params: []
|
|
4589
|
-
};
|
|
4590
|
-
if (chunk === void 0) return {
|
|
4591
|
-
sql: "",
|
|
4592
|
-
params: []
|
|
4593
|
-
};
|
|
4594
|
-
if (Array.isArray(chunk)) {
|
|
4595
|
-
const result = [new StringChunk("(")];
|
|
4596
|
-
for (const [i, p] of chunk.entries()) {
|
|
4597
|
-
result.push(p);
|
|
4598
|
-
if (i < chunk.length - 1) result.push(new StringChunk(", "));
|
|
4599
|
-
}
|
|
4600
|
-
result.push(new StringChunk(")"));
|
|
4601
|
-
return this.buildQueryFromSourceParams(result, config);
|
|
4602
|
-
}
|
|
4603
|
-
if (is(chunk, SQL)) return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
4604
|
-
...config,
|
|
4605
|
-
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
4606
|
-
});
|
|
4607
|
-
if (is(chunk, Table)) {
|
|
4608
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
4609
|
-
const tableName = chunk[Table.Symbol.Name];
|
|
4610
|
-
return {
|
|
4611
|
-
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
4612
|
-
params: []
|
|
4613
|
-
};
|
|
4614
|
-
}
|
|
4615
|
-
if (is(chunk, Column)) {
|
|
4616
|
-
const columnName = casing.getColumnCasing(chunk);
|
|
4617
|
-
if (_config.invokeSource === "indexes") return {
|
|
4618
|
-
sql: escapeName(columnName),
|
|
4619
|
-
params: []
|
|
4620
|
-
};
|
|
4621
|
-
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
4622
|
-
return {
|
|
4623
|
-
sql: chunk.table[IsAlias] || schemaName === void 0 ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
|
|
4624
|
-
params: []
|
|
4625
|
-
};
|
|
4626
|
-
}
|
|
4627
|
-
if (is(chunk, View)) {
|
|
4628
|
-
const schemaName = chunk[ViewBaseConfig].schema;
|
|
4629
|
-
const viewName = chunk[ViewBaseConfig].name;
|
|
4630
|
-
return {
|
|
4631
|
-
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
4632
|
-
params: []
|
|
4633
|
-
};
|
|
4634
|
-
}
|
|
4635
|
-
if (is(chunk, Param)) {
|
|
4636
|
-
if (is(chunk.value, Placeholder)) return {
|
|
4637
|
-
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
4638
|
-
params: [chunk],
|
|
4639
|
-
typings: ["none"]
|
|
4640
|
-
};
|
|
4641
|
-
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
4642
|
-
if (is(mappedValue, SQL)) return this.buildQueryFromSourceParams([mappedValue], config);
|
|
4643
|
-
if (inlineParams) return {
|
|
4644
|
-
sql: this.mapInlineParam(mappedValue, config),
|
|
4645
|
-
params: []
|
|
4646
|
-
};
|
|
4647
|
-
let typings = ["none"];
|
|
4648
|
-
if (prepareTyping) typings = [prepareTyping(chunk.encoder)];
|
|
4649
|
-
return {
|
|
4650
|
-
sql: escapeParam(paramStartIndex.value++, mappedValue),
|
|
4651
|
-
params: [mappedValue],
|
|
4652
|
-
typings
|
|
4653
|
-
};
|
|
4654
|
-
}
|
|
4655
|
-
if (is(chunk, Placeholder)) return {
|
|
4656
|
-
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
4657
|
-
params: [chunk],
|
|
4658
|
-
typings: ["none"]
|
|
4659
|
-
};
|
|
4660
|
-
if (is(chunk, SQL.Aliased) && chunk.fieldAlias !== void 0) return {
|
|
4661
|
-
sql: escapeName(chunk.fieldAlias),
|
|
4662
|
-
params: []
|
|
4663
|
-
};
|
|
4664
|
-
if (is(chunk, Subquery)) {
|
|
4665
|
-
if (chunk._.isWith) return {
|
|
4666
|
-
sql: escapeName(chunk._.alias),
|
|
4667
|
-
params: []
|
|
4668
|
-
};
|
|
4669
|
-
return this.buildQueryFromSourceParams([
|
|
4670
|
-
new StringChunk("("),
|
|
4671
|
-
chunk._.sql,
|
|
4672
|
-
new StringChunk(") "),
|
|
4673
|
-
new Name(chunk._.alias)
|
|
4674
|
-
], config);
|
|
4675
|
-
}
|
|
4676
|
-
if (isPgEnum(chunk)) {
|
|
4677
|
-
if (chunk.schema) return {
|
|
4678
|
-
sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName),
|
|
4679
|
-
params: []
|
|
4680
|
-
};
|
|
4681
|
-
return {
|
|
4682
|
-
sql: escapeName(chunk.enumName),
|
|
4683
|
-
params: []
|
|
4684
|
-
};
|
|
4685
|
-
}
|
|
4686
|
-
if (isSQLWrapper(chunk)) {
|
|
4687
|
-
if (chunk.shouldOmitSQLParens?.()) return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
4688
|
-
return this.buildQueryFromSourceParams([
|
|
4689
|
-
new StringChunk("("),
|
|
4690
|
-
chunk.getSQL(),
|
|
4691
|
-
new StringChunk(")")
|
|
4692
|
-
], config);
|
|
4693
|
-
}
|
|
4694
|
-
if (inlineParams) return {
|
|
4695
|
-
sql: this.mapInlineParam(chunk, config),
|
|
4696
|
-
params: []
|
|
4697
|
-
};
|
|
4698
|
-
return {
|
|
4699
|
-
sql: escapeParam(paramStartIndex.value++, chunk),
|
|
4700
|
-
params: [chunk],
|
|
4701
|
-
typings: ["none"]
|
|
4702
|
-
};
|
|
4703
|
-
}));
|
|
4704
|
-
}
|
|
4705
|
-
mapInlineParam(chunk, { escapeString }) {
|
|
4706
|
-
if (chunk === null) return "null";
|
|
4707
|
-
if (typeof chunk === "number" || typeof chunk === "boolean") return chunk.toString();
|
|
4708
|
-
if (typeof chunk === "string") return escapeString(chunk);
|
|
4709
|
-
if (typeof chunk === "object") {
|
|
4710
|
-
const mappedValueAsString = chunk.toString();
|
|
4711
|
-
if (mappedValueAsString === "[object Object]") return escapeString(JSON.stringify(chunk));
|
|
4712
|
-
return escapeString(mappedValueAsString);
|
|
4713
|
-
}
|
|
4714
|
-
throw new Error("Unexpected param value: " + chunk);
|
|
4715
|
-
}
|
|
4716
|
-
getSQL() {
|
|
4717
|
-
return this;
|
|
4718
|
-
}
|
|
4719
|
-
as(alias) {
|
|
4720
|
-
if (alias === void 0) return this;
|
|
4721
|
-
return new SQL.Aliased(this, alias);
|
|
4722
|
-
}
|
|
4723
|
-
mapWith(decoder) {
|
|
4724
|
-
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
4725
|
-
return this;
|
|
4726
|
-
}
|
|
4727
|
-
inlineParams() {
|
|
4728
|
-
this.shouldInlineParams = true;
|
|
4729
|
-
return this;
|
|
4730
|
-
}
|
|
4731
|
-
/**
|
|
4732
|
-
* This method is used to conditionally include a part of the query.
|
|
4733
|
-
*
|
|
4734
|
-
* @param condition - Condition to check
|
|
4735
|
-
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
4736
|
-
*/
|
|
4737
|
-
if(condition) {
|
|
4738
|
-
return condition ? this : void 0;
|
|
4739
|
-
}
|
|
4740
|
-
};
|
|
4741
|
-
var Name = class {
|
|
4742
|
-
constructor(value) {
|
|
4743
|
-
this.value = value;
|
|
4744
|
-
}
|
|
4745
|
-
static [entityKind] = "Name";
|
|
4746
|
-
brand;
|
|
4747
|
-
getSQL() {
|
|
4748
|
-
return new SQL([this]);
|
|
4749
|
-
}
|
|
4750
|
-
};
|
|
4751
|
-
const noopDecoder = { mapFromDriverValue: (value) => value };
|
|
4752
|
-
const noopEncoder = { mapToDriverValue: (value) => value };
|
|
4753
|
-
({
|
|
4754
|
-
...noopDecoder,
|
|
4755
|
-
...noopEncoder
|
|
4756
|
-
});
|
|
4757
|
-
var Param = class {
|
|
4758
|
-
/**
|
|
4759
|
-
* @param value - Parameter value
|
|
4760
|
-
* @param encoder - Encoder to convert the value to a driver parameter
|
|
4761
|
-
*/
|
|
4762
|
-
constructor(value, encoder = noopEncoder) {
|
|
4763
|
-
this.value = value;
|
|
4764
|
-
this.encoder = encoder;
|
|
4765
|
-
}
|
|
4766
|
-
static [entityKind] = "Param";
|
|
4767
|
-
brand;
|
|
4768
|
-
getSQL() {
|
|
4769
|
-
return new SQL([this]);
|
|
4770
|
-
}
|
|
4771
|
-
};
|
|
4772
|
-
function sql$1(strings, ...params) {
|
|
4773
|
-
const queryChunks = [];
|
|
4774
|
-
if (params.length > 0 || strings.length > 0 && strings[0] !== "") queryChunks.push(new StringChunk(strings[0]));
|
|
4775
|
-
for (const [paramIndex, param2] of params.entries()) queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
4776
|
-
return new SQL(queryChunks);
|
|
4777
|
-
}
|
|
4778
|
-
((sql2) => {
|
|
4779
|
-
function empty() {
|
|
4780
|
-
return new SQL([]);
|
|
4781
|
-
}
|
|
4782
|
-
sql2.empty = empty;
|
|
4783
|
-
function fromList(list) {
|
|
4784
|
-
return new SQL(list);
|
|
4785
|
-
}
|
|
4786
|
-
sql2.fromList = fromList;
|
|
4787
|
-
function raw(str) {
|
|
4788
|
-
return new SQL([new StringChunk(str)]);
|
|
4789
|
-
}
|
|
4790
|
-
sql2.raw = raw;
|
|
4791
|
-
function join(chunks, separator) {
|
|
4792
|
-
const result = [];
|
|
4793
|
-
for (const [i, chunk] of chunks.entries()) {
|
|
4794
|
-
if (i > 0 && separator !== void 0) result.push(separator);
|
|
4795
|
-
result.push(chunk);
|
|
4796
|
-
}
|
|
4797
|
-
return new SQL(result);
|
|
4798
|
-
}
|
|
4799
|
-
sql2.join = join;
|
|
4800
|
-
function identifier(value) {
|
|
4801
|
-
return new Name(value);
|
|
4802
|
-
}
|
|
4803
|
-
sql2.identifier = identifier;
|
|
4804
|
-
function placeholder2(name2) {
|
|
4805
|
-
return new Placeholder(name2);
|
|
4806
|
-
}
|
|
4807
|
-
sql2.placeholder = placeholder2;
|
|
4808
|
-
function param2(value, encoder) {
|
|
4809
|
-
return new Param(value, encoder);
|
|
4810
|
-
}
|
|
4811
|
-
sql2.param = param2;
|
|
4812
|
-
})(sql$1 || (sql$1 = {}));
|
|
4813
|
-
((SQL2) => {
|
|
4814
|
-
class Aliased {
|
|
4815
|
-
constructor(sql2, fieldAlias) {
|
|
4816
|
-
this.sql = sql2;
|
|
4817
|
-
this.fieldAlias = fieldAlias;
|
|
4818
|
-
}
|
|
4819
|
-
static [entityKind] = "SQL.Aliased";
|
|
4820
|
-
/** @internal */
|
|
4821
|
-
isSelectionField = false;
|
|
4822
|
-
getSQL() {
|
|
4823
|
-
return this.sql;
|
|
4824
|
-
}
|
|
4825
|
-
/** @internal */
|
|
4826
|
-
clone() {
|
|
4827
|
-
return new Aliased(this.sql, this.fieldAlias);
|
|
4828
|
-
}
|
|
4829
|
-
}
|
|
4830
|
-
SQL2.Aliased = Aliased;
|
|
4831
|
-
})(SQL || (SQL = {}));
|
|
4832
|
-
var Placeholder = class {
|
|
4833
|
-
constructor(name2) {
|
|
4834
|
-
this.name = name2;
|
|
4835
|
-
}
|
|
4836
|
-
static [entityKind] = "Placeholder";
|
|
4837
|
-
getSQL() {
|
|
4838
|
-
return new SQL([this]);
|
|
4839
|
-
}
|
|
4840
|
-
};
|
|
4841
|
-
const IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
4842
|
-
var View = class {
|
|
4843
|
-
static [entityKind] = "View";
|
|
4844
|
-
/** @internal */
|
|
4845
|
-
[ViewBaseConfig];
|
|
4846
|
-
/** @internal */
|
|
4847
|
-
[IsDrizzleView] = true;
|
|
4848
|
-
constructor({ name: name2, schema, selectedFields, query }) {
|
|
4849
|
-
this[ViewBaseConfig] = {
|
|
4850
|
-
name: name2,
|
|
4851
|
-
originalName: name2,
|
|
4852
|
-
schema,
|
|
4853
|
-
selectedFields,
|
|
4854
|
-
query,
|
|
4855
|
-
isExisting: !query,
|
|
4856
|
-
isAlias: false
|
|
4857
|
-
};
|
|
4858
|
-
}
|
|
4859
|
-
getSQL() {
|
|
4860
|
-
return new SQL([this]);
|
|
4861
|
-
}
|
|
4862
|
-
};
|
|
4863
|
-
Column.prototype.getSQL = function() {
|
|
4864
|
-
return new SQL([this]);
|
|
4865
|
-
};
|
|
4866
|
-
Table.prototype.getSQL = function() {
|
|
4867
|
-
return new SQL([this]);
|
|
4868
|
-
};
|
|
4869
|
-
Subquery.prototype.getSQL = function() {
|
|
4870
|
-
return new SQL([this]);
|
|
4871
|
-
};
|
|
4872
|
-
//#endregion
|
|
4873
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/utils.js
|
|
4874
|
-
function getColumnNameAndConfig(a, b) {
|
|
4875
|
-
return {
|
|
4876
|
-
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
4877
|
-
config: typeof a === "object" ? a : b
|
|
4878
|
-
};
|
|
4879
|
-
}
|
|
4880
|
-
const textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
|
|
4881
|
-
//#endregion
|
|
4882
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/int.common.js
|
|
4883
|
-
var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
|
|
4884
|
-
static [entityKind] = "PgIntColumnBaseBuilder";
|
|
4885
|
-
generatedAlwaysAsIdentity(sequence) {
|
|
4886
|
-
if (sequence) {
|
|
4887
|
-
const { name, ...options } = sequence;
|
|
4888
|
-
this.config.generatedIdentity = {
|
|
4889
|
-
type: "always",
|
|
4890
|
-
sequenceName: name,
|
|
4891
|
-
sequenceOptions: options
|
|
4892
|
-
};
|
|
4893
|
-
} else this.config.generatedIdentity = { type: "always" };
|
|
4894
|
-
this.config.hasDefault = true;
|
|
4895
|
-
this.config.notNull = true;
|
|
4896
|
-
return this;
|
|
4897
|
-
}
|
|
4898
|
-
generatedByDefaultAsIdentity(sequence) {
|
|
4899
|
-
if (sequence) {
|
|
4900
|
-
const { name, ...options } = sequence;
|
|
4901
|
-
this.config.generatedIdentity = {
|
|
4902
|
-
type: "byDefault",
|
|
4903
|
-
sequenceName: name,
|
|
4904
|
-
sequenceOptions: options
|
|
4905
|
-
};
|
|
4906
|
-
} else this.config.generatedIdentity = { type: "byDefault" };
|
|
4907
|
-
this.config.hasDefault = true;
|
|
4908
|
-
this.config.notNull = true;
|
|
4909
|
-
return this;
|
|
4910
|
-
}
|
|
4911
|
-
};
|
|
4912
|
-
//#endregion
|
|
4913
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/bigint.js
|
|
4914
|
-
var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
|
|
4915
|
-
static [entityKind] = "PgBigInt53Builder";
|
|
4916
|
-
constructor(name) {
|
|
4917
|
-
super(name, "number", "PgBigInt53");
|
|
4918
|
-
}
|
|
4919
|
-
/** @internal */
|
|
4920
|
-
build(table) {
|
|
4921
|
-
return new PgBigInt53(table, this.config);
|
|
4922
|
-
}
|
|
4923
|
-
};
|
|
4924
|
-
var PgBigInt53 = class extends PgColumn {
|
|
4925
|
-
static [entityKind] = "PgBigInt53";
|
|
4926
|
-
getSQLType() {
|
|
4927
|
-
return "bigint";
|
|
4928
|
-
}
|
|
4929
|
-
mapFromDriverValue(value) {
|
|
4930
|
-
if (typeof value === "number") return value;
|
|
4931
|
-
return Number(value);
|
|
4932
|
-
}
|
|
4933
|
-
};
|
|
4934
|
-
var PgBigInt64Builder = class extends PgIntColumnBaseBuilder {
|
|
4935
|
-
static [entityKind] = "PgBigInt64Builder";
|
|
4936
|
-
constructor(name) {
|
|
4937
|
-
super(name, "bigint", "PgBigInt64");
|
|
4938
|
-
}
|
|
4939
|
-
/** @internal */
|
|
4940
|
-
build(table) {
|
|
4941
|
-
return new PgBigInt64(table, this.config);
|
|
4942
|
-
}
|
|
4943
|
-
};
|
|
4944
|
-
var PgBigInt64 = class extends PgColumn {
|
|
4945
|
-
static [entityKind] = "PgBigInt64";
|
|
4946
|
-
getSQLType() {
|
|
4947
|
-
return "bigint";
|
|
4948
|
-
}
|
|
4949
|
-
mapFromDriverValue(value) {
|
|
4950
|
-
return BigInt(value);
|
|
4951
|
-
}
|
|
4952
|
-
};
|
|
4953
|
-
function bigint(a, b) {
|
|
4954
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
4955
|
-
if (config.mode === "number") return new PgBigInt53Builder(name);
|
|
4956
|
-
return new PgBigInt64Builder(name);
|
|
4957
|
-
}
|
|
4958
|
-
//#endregion
|
|
4959
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
4960
|
-
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
4961
|
-
static [entityKind] = "PgBigSerial53Builder";
|
|
4962
|
-
constructor(name) {
|
|
4963
|
-
super(name, "number", "PgBigSerial53");
|
|
4964
|
-
this.config.hasDefault = true;
|
|
4965
|
-
this.config.notNull = true;
|
|
4966
|
-
}
|
|
4967
|
-
/** @internal */
|
|
4968
|
-
build(table) {
|
|
4969
|
-
return new PgBigSerial53(table, this.config);
|
|
4970
|
-
}
|
|
4971
|
-
};
|
|
4972
|
-
var PgBigSerial53 = class extends PgColumn {
|
|
4973
|
-
static [entityKind] = "PgBigSerial53";
|
|
4974
|
-
getSQLType() {
|
|
4975
|
-
return "bigserial";
|
|
4976
|
-
}
|
|
4977
|
-
mapFromDriverValue(value) {
|
|
4978
|
-
if (typeof value === "number") return value;
|
|
4979
|
-
return Number(value);
|
|
4980
|
-
}
|
|
4981
|
-
};
|
|
4982
|
-
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
4983
|
-
static [entityKind] = "PgBigSerial64Builder";
|
|
4984
|
-
constructor(name) {
|
|
4985
|
-
super(name, "bigint", "PgBigSerial64");
|
|
4986
|
-
this.config.hasDefault = true;
|
|
4987
|
-
}
|
|
4988
|
-
/** @internal */
|
|
4989
|
-
build(table) {
|
|
4990
|
-
return new PgBigSerial64(table, this.config);
|
|
4991
|
-
}
|
|
4992
|
-
};
|
|
4993
|
-
var PgBigSerial64 = class extends PgColumn {
|
|
4994
|
-
static [entityKind] = "PgBigSerial64";
|
|
4995
|
-
getSQLType() {
|
|
4996
|
-
return "bigserial";
|
|
4997
|
-
}
|
|
4998
|
-
mapFromDriverValue(value) {
|
|
4999
|
-
return BigInt(value);
|
|
5000
|
-
}
|
|
5001
|
-
};
|
|
5002
|
-
function bigserial(a, b) {
|
|
5003
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5004
|
-
if (config.mode === "number") return new PgBigSerial53Builder(name);
|
|
5005
|
-
return new PgBigSerial64Builder(name);
|
|
5006
|
-
}
|
|
5007
|
-
//#endregion
|
|
5008
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/boolean.js
|
|
5009
|
-
var PgBooleanBuilder = class extends PgColumnBuilder {
|
|
5010
|
-
static [entityKind] = "PgBooleanBuilder";
|
|
5011
|
-
constructor(name) {
|
|
5012
|
-
super(name, "boolean", "PgBoolean");
|
|
5013
|
-
}
|
|
5014
|
-
/** @internal */
|
|
5015
|
-
build(table) {
|
|
5016
|
-
return new PgBoolean(table, this.config);
|
|
5017
|
-
}
|
|
5018
|
-
};
|
|
5019
|
-
var PgBoolean = class extends PgColumn {
|
|
5020
|
-
static [entityKind] = "PgBoolean";
|
|
5021
|
-
getSQLType() {
|
|
5022
|
-
return "boolean";
|
|
5023
|
-
}
|
|
5024
|
-
};
|
|
5025
|
-
function boolean(name) {
|
|
5026
|
-
return new PgBooleanBuilder(name ?? "");
|
|
5027
|
-
}
|
|
5028
|
-
//#endregion
|
|
5029
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/char.js
|
|
5030
|
-
var PgCharBuilder = class extends PgColumnBuilder {
|
|
5031
|
-
static [entityKind] = "PgCharBuilder";
|
|
5032
|
-
constructor(name, config) {
|
|
5033
|
-
super(name, "string", "PgChar");
|
|
5034
|
-
this.config.length = config.length;
|
|
5035
|
-
this.config.enumValues = config.enum;
|
|
5036
|
-
}
|
|
5037
|
-
/** @internal */
|
|
5038
|
-
build(table) {
|
|
5039
|
-
return new PgChar(table, this.config);
|
|
5040
|
-
}
|
|
5041
|
-
};
|
|
5042
|
-
var PgChar = class extends PgColumn {
|
|
5043
|
-
static [entityKind] = "PgChar";
|
|
5044
|
-
length = this.config.length;
|
|
5045
|
-
enumValues = this.config.enumValues;
|
|
5046
|
-
getSQLType() {
|
|
5047
|
-
return this.length === void 0 ? `char` : `char(${this.length})`;
|
|
5048
|
-
}
|
|
5049
|
-
};
|
|
5050
|
-
function char(a, b = {}) {
|
|
5051
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5052
|
-
return new PgCharBuilder(name, config);
|
|
5053
|
-
}
|
|
5054
|
-
//#endregion
|
|
5055
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
5056
|
-
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
5057
|
-
static [entityKind] = "PgCidrBuilder";
|
|
5058
|
-
constructor(name) {
|
|
5059
|
-
super(name, "string", "PgCidr");
|
|
5060
|
-
}
|
|
5061
|
-
/** @internal */
|
|
5062
|
-
build(table) {
|
|
5063
|
-
return new PgCidr(table, this.config);
|
|
5064
|
-
}
|
|
5065
|
-
};
|
|
5066
|
-
var PgCidr = class extends PgColumn {
|
|
5067
|
-
static [entityKind] = "PgCidr";
|
|
5068
|
-
getSQLType() {
|
|
5069
|
-
return "cidr";
|
|
5070
|
-
}
|
|
5071
|
-
};
|
|
5072
|
-
function cidr(name) {
|
|
5073
|
-
return new PgCidrBuilder(name ?? "");
|
|
5074
|
-
}
|
|
5075
|
-
//#endregion
|
|
5076
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
5077
|
-
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
5078
|
-
static [entityKind] = "PgCustomColumnBuilder";
|
|
5079
|
-
constructor(name, fieldConfig, customTypeParams) {
|
|
5080
|
-
super(name, "custom", "PgCustomColumn");
|
|
5081
|
-
this.config.fieldConfig = fieldConfig;
|
|
5082
|
-
this.config.customTypeParams = customTypeParams;
|
|
5083
|
-
}
|
|
5084
|
-
/** @internal */
|
|
5085
|
-
build(table) {
|
|
5086
|
-
return new PgCustomColumn(table, this.config);
|
|
5087
|
-
}
|
|
5088
|
-
};
|
|
5089
|
-
var PgCustomColumn = class extends PgColumn {
|
|
5090
|
-
static [entityKind] = "PgCustomColumn";
|
|
5091
|
-
sqlName;
|
|
5092
|
-
mapTo;
|
|
5093
|
-
mapFrom;
|
|
5094
|
-
constructor(table, config) {
|
|
5095
|
-
super(table, config);
|
|
5096
|
-
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
5097
|
-
this.mapTo = config.customTypeParams.toDriver;
|
|
5098
|
-
this.mapFrom = config.customTypeParams.fromDriver;
|
|
5099
|
-
}
|
|
5100
|
-
getSQLType() {
|
|
5101
|
-
return this.sqlName;
|
|
5102
|
-
}
|
|
5103
|
-
mapFromDriverValue(value) {
|
|
5104
|
-
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
5105
|
-
}
|
|
5106
|
-
mapToDriverValue(value) {
|
|
5107
|
-
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
5108
|
-
}
|
|
5109
|
-
};
|
|
5110
|
-
function customType$1(customTypeParams) {
|
|
5111
|
-
return (a, b) => {
|
|
5112
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5113
|
-
return new PgCustomColumnBuilder(name, config, customTypeParams);
|
|
5114
|
-
};
|
|
5115
|
-
}
|
|
5116
|
-
//#endregion
|
|
5117
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
5118
|
-
var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
|
|
5119
|
-
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
5120
|
-
defaultNow() {
|
|
5121
|
-
return this.default(sql$1`now()`);
|
|
5122
|
-
}
|
|
5123
|
-
};
|
|
5124
|
-
//#endregion
|
|
5125
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/date.js
|
|
5126
|
-
var PgDateBuilder = class extends PgDateColumnBaseBuilder {
|
|
5127
|
-
static [entityKind] = "PgDateBuilder";
|
|
5128
|
-
constructor(name) {
|
|
5129
|
-
super(name, "date", "PgDate");
|
|
5130
|
-
}
|
|
5131
|
-
/** @internal */
|
|
5132
|
-
build(table) {
|
|
5133
|
-
return new PgDate(table, this.config);
|
|
5134
|
-
}
|
|
5135
|
-
};
|
|
5136
|
-
var PgDate = class extends PgColumn {
|
|
5137
|
-
static [entityKind] = "PgDate";
|
|
5138
|
-
getSQLType() {
|
|
5139
|
-
return "date";
|
|
5140
|
-
}
|
|
5141
|
-
mapFromDriverValue(value) {
|
|
5142
|
-
if (typeof value === "string") return new Date(value);
|
|
5143
|
-
return value;
|
|
5144
|
-
}
|
|
5145
|
-
mapToDriverValue(value) {
|
|
5146
|
-
return value.toISOString();
|
|
5147
|
-
}
|
|
5148
|
-
};
|
|
5149
|
-
var PgDateStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
5150
|
-
static [entityKind] = "PgDateStringBuilder";
|
|
5151
|
-
constructor(name) {
|
|
5152
|
-
super(name, "string", "PgDateString");
|
|
5153
|
-
}
|
|
5154
|
-
/** @internal */
|
|
5155
|
-
build(table) {
|
|
5156
|
-
return new PgDateString(table, this.config);
|
|
5157
|
-
}
|
|
5158
|
-
};
|
|
5159
|
-
var PgDateString = class extends PgColumn {
|
|
5160
|
-
static [entityKind] = "PgDateString";
|
|
5161
|
-
getSQLType() {
|
|
5162
|
-
return "date";
|
|
5163
|
-
}
|
|
5164
|
-
mapFromDriverValue(value) {
|
|
5165
|
-
if (typeof value === "string") return value;
|
|
5166
|
-
return value.toISOString().slice(0, -14);
|
|
5167
|
-
}
|
|
5168
|
-
};
|
|
5169
|
-
function date(a, b) {
|
|
5170
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5171
|
-
if (config?.mode === "date") return new PgDateBuilder(name);
|
|
5172
|
-
return new PgDateStringBuilder(name);
|
|
5173
|
-
}
|
|
5174
|
-
//#endregion
|
|
5175
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
5176
|
-
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
5177
|
-
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
5178
|
-
constructor(name) {
|
|
5179
|
-
super(name, "number", "PgDoublePrecision");
|
|
5180
|
-
}
|
|
5181
|
-
/** @internal */
|
|
5182
|
-
build(table) {
|
|
5183
|
-
return new PgDoublePrecision(table, this.config);
|
|
5184
|
-
}
|
|
5185
|
-
};
|
|
5186
|
-
var PgDoublePrecision = class extends PgColumn {
|
|
5187
|
-
static [entityKind] = "PgDoublePrecision";
|
|
5188
|
-
getSQLType() {
|
|
5189
|
-
return "double precision";
|
|
5190
|
-
}
|
|
5191
|
-
mapFromDriverValue(value) {
|
|
5192
|
-
if (typeof value === "string") return Number.parseFloat(value);
|
|
5193
|
-
return value;
|
|
5194
|
-
}
|
|
5195
|
-
};
|
|
5196
|
-
function doublePrecision(name) {
|
|
5197
|
-
return new PgDoublePrecisionBuilder(name ?? "");
|
|
5198
|
-
}
|
|
5199
|
-
//#endregion
|
|
5200
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/inet.js
|
|
5201
|
-
var PgInetBuilder = class extends PgColumnBuilder {
|
|
5202
|
-
static [entityKind] = "PgInetBuilder";
|
|
5203
|
-
constructor(name) {
|
|
5204
|
-
super(name, "string", "PgInet");
|
|
5205
|
-
}
|
|
5206
|
-
/** @internal */
|
|
5207
|
-
build(table) {
|
|
5208
|
-
return new PgInet(table, this.config);
|
|
5209
|
-
}
|
|
5210
|
-
};
|
|
5211
|
-
var PgInet = class extends PgColumn {
|
|
5212
|
-
static [entityKind] = "PgInet";
|
|
5213
|
-
getSQLType() {
|
|
5214
|
-
return "inet";
|
|
5215
|
-
}
|
|
5216
|
-
};
|
|
5217
|
-
function inet(name) {
|
|
5218
|
-
return new PgInetBuilder(name ?? "");
|
|
5219
|
-
}
|
|
5220
|
-
//#endregion
|
|
5221
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
5222
|
-
var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
|
|
5223
|
-
static [entityKind] = "PgIntegerBuilder";
|
|
5224
|
-
constructor(name) {
|
|
5225
|
-
super(name, "number", "PgInteger");
|
|
5226
|
-
}
|
|
5227
|
-
/** @internal */
|
|
5228
|
-
build(table) {
|
|
5229
|
-
return new PgInteger(table, this.config);
|
|
5230
|
-
}
|
|
5231
|
-
};
|
|
5232
|
-
var PgInteger = class extends PgColumn {
|
|
5233
|
-
static [entityKind] = "PgInteger";
|
|
5234
|
-
getSQLType() {
|
|
5235
|
-
return "integer";
|
|
5236
|
-
}
|
|
5237
|
-
mapFromDriverValue(value) {
|
|
5238
|
-
if (typeof value === "string") return Number.parseInt(value);
|
|
5239
|
-
return value;
|
|
5240
|
-
}
|
|
5241
|
-
};
|
|
5242
|
-
function integer$1(name) {
|
|
5243
|
-
return new PgIntegerBuilder(name ?? "");
|
|
5244
|
-
}
|
|
5245
|
-
//#endregion
|
|
5246
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/interval.js
|
|
5247
|
-
var PgIntervalBuilder = class extends PgColumnBuilder {
|
|
5248
|
-
static [entityKind] = "PgIntervalBuilder";
|
|
5249
|
-
constructor(name, intervalConfig) {
|
|
5250
|
-
super(name, "string", "PgInterval");
|
|
5251
|
-
this.config.intervalConfig = intervalConfig;
|
|
5252
|
-
}
|
|
5253
|
-
/** @internal */
|
|
5254
|
-
build(table) {
|
|
5255
|
-
return new PgInterval(table, this.config);
|
|
5256
|
-
}
|
|
5257
|
-
};
|
|
5258
|
-
var PgInterval = class extends PgColumn {
|
|
5259
|
-
static [entityKind] = "PgInterval";
|
|
5260
|
-
fields = this.config.intervalConfig.fields;
|
|
5261
|
-
precision = this.config.intervalConfig.precision;
|
|
5262
|
-
getSQLType() {
|
|
5263
|
-
return `interval${this.fields ? ` ${this.fields}` : ""}${this.precision ? `(${this.precision})` : ""}`;
|
|
5264
|
-
}
|
|
5265
|
-
};
|
|
5266
|
-
function interval(a, b = {}) {
|
|
5267
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5268
|
-
return new PgIntervalBuilder(name, config);
|
|
5269
|
-
}
|
|
5270
|
-
//#endregion
|
|
5271
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/json.js
|
|
5272
|
-
var PgJsonBuilder = class extends PgColumnBuilder {
|
|
5273
|
-
static [entityKind] = "PgJsonBuilder";
|
|
5274
|
-
constructor(name) {
|
|
5275
|
-
super(name, "json", "PgJson");
|
|
5276
|
-
}
|
|
5277
|
-
/** @internal */
|
|
5278
|
-
build(table) {
|
|
5279
|
-
return new PgJson(table, this.config);
|
|
5280
|
-
}
|
|
5281
|
-
};
|
|
5282
|
-
var PgJson = class extends PgColumn {
|
|
5283
|
-
static [entityKind] = "PgJson";
|
|
5284
|
-
constructor(table, config) {
|
|
5285
|
-
super(table, config);
|
|
5286
|
-
}
|
|
5287
|
-
getSQLType() {
|
|
5288
|
-
return "json";
|
|
5289
|
-
}
|
|
5290
|
-
mapToDriverValue(value) {
|
|
5291
|
-
return JSON.stringify(value);
|
|
5292
|
-
}
|
|
5293
|
-
mapFromDriverValue(value) {
|
|
5294
|
-
if (typeof value === "string") try {
|
|
5295
|
-
return JSON.parse(value);
|
|
5296
|
-
} catch {
|
|
5297
|
-
return value;
|
|
5298
|
-
}
|
|
5299
|
-
return value;
|
|
5300
|
-
}
|
|
5301
|
-
};
|
|
5302
|
-
function json(name) {
|
|
5303
|
-
return new PgJsonBuilder(name ?? "");
|
|
5304
|
-
}
|
|
5305
|
-
//#endregion
|
|
5306
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
5307
|
-
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
5308
|
-
static [entityKind] = "PgJsonbBuilder";
|
|
5309
|
-
constructor(name) {
|
|
5310
|
-
super(name, "json", "PgJsonb");
|
|
5311
|
-
}
|
|
5312
|
-
/** @internal */
|
|
5313
|
-
build(table) {
|
|
5314
|
-
return new PgJsonb(table, this.config);
|
|
5315
|
-
}
|
|
5316
|
-
};
|
|
5317
|
-
var PgJsonb = class extends PgColumn {
|
|
5318
|
-
static [entityKind] = "PgJsonb";
|
|
5319
|
-
constructor(table, config) {
|
|
5320
|
-
super(table, config);
|
|
5321
|
-
}
|
|
5322
|
-
getSQLType() {
|
|
5323
|
-
return "jsonb";
|
|
5324
|
-
}
|
|
5325
|
-
mapToDriverValue(value) {
|
|
5326
|
-
return JSON.stringify(value);
|
|
5327
|
-
}
|
|
5328
|
-
mapFromDriverValue(value) {
|
|
5329
|
-
if (typeof value === "string") try {
|
|
5330
|
-
return JSON.parse(value);
|
|
5331
|
-
} catch {
|
|
5332
|
-
return value;
|
|
5333
|
-
}
|
|
5334
|
-
return value;
|
|
5335
|
-
}
|
|
5336
|
-
};
|
|
5337
|
-
function jsonb(name) {
|
|
5338
|
-
return new PgJsonbBuilder(name ?? "");
|
|
5339
|
-
}
|
|
5340
|
-
//#endregion
|
|
5341
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/line.js
|
|
5342
|
-
var PgLineBuilder = class extends PgColumnBuilder {
|
|
5343
|
-
static [entityKind] = "PgLineBuilder";
|
|
5344
|
-
constructor(name) {
|
|
5345
|
-
super(name, "array", "PgLine");
|
|
5346
|
-
}
|
|
5347
|
-
/** @internal */
|
|
5348
|
-
build(table) {
|
|
5349
|
-
return new PgLineTuple(table, this.config);
|
|
5350
|
-
}
|
|
5351
|
-
};
|
|
5352
|
-
var PgLineTuple = class extends PgColumn {
|
|
5353
|
-
static [entityKind] = "PgLine";
|
|
5354
|
-
getSQLType() {
|
|
5355
|
-
return "line";
|
|
5356
|
-
}
|
|
5357
|
-
mapFromDriverValue(value) {
|
|
5358
|
-
const [a, b, c] = value.slice(1, -1).split(",");
|
|
5359
|
-
return [
|
|
5360
|
-
Number.parseFloat(a),
|
|
5361
|
-
Number.parseFloat(b),
|
|
5362
|
-
Number.parseFloat(c)
|
|
5363
|
-
];
|
|
5364
|
-
}
|
|
5365
|
-
mapToDriverValue(value) {
|
|
5366
|
-
return `{${value[0]},${value[1]},${value[2]}}`;
|
|
5367
|
-
}
|
|
5368
|
-
};
|
|
5369
|
-
var PgLineABCBuilder = class extends PgColumnBuilder {
|
|
5370
|
-
static [entityKind] = "PgLineABCBuilder";
|
|
5371
|
-
constructor(name) {
|
|
5372
|
-
super(name, "json", "PgLineABC");
|
|
5373
|
-
}
|
|
5374
|
-
/** @internal */
|
|
5375
|
-
build(table) {
|
|
5376
|
-
return new PgLineABC(table, this.config);
|
|
5377
|
-
}
|
|
5378
|
-
};
|
|
5379
|
-
var PgLineABC = class extends PgColumn {
|
|
5380
|
-
static [entityKind] = "PgLineABC";
|
|
5381
|
-
getSQLType() {
|
|
5382
|
-
return "line";
|
|
5383
|
-
}
|
|
5384
|
-
mapFromDriverValue(value) {
|
|
5385
|
-
const [a, b, c] = value.slice(1, -1).split(",");
|
|
5386
|
-
return {
|
|
5387
|
-
a: Number.parseFloat(a),
|
|
5388
|
-
b: Number.parseFloat(b),
|
|
5389
|
-
c: Number.parseFloat(c)
|
|
5390
|
-
};
|
|
5391
|
-
}
|
|
5392
|
-
mapToDriverValue(value) {
|
|
5393
|
-
return `{${value.a},${value.b},${value.c}}`;
|
|
5394
|
-
}
|
|
5395
|
-
};
|
|
5396
|
-
function line(a, b) {
|
|
5397
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5398
|
-
if (!config?.mode || config.mode === "tuple") return new PgLineBuilder(name);
|
|
5399
|
-
return new PgLineABCBuilder(name);
|
|
5400
|
-
}
|
|
5401
|
-
//#endregion
|
|
5402
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/macaddr.js
|
|
5403
|
-
var PgMacaddrBuilder = class extends PgColumnBuilder {
|
|
5404
|
-
static [entityKind] = "PgMacaddrBuilder";
|
|
5405
|
-
constructor(name) {
|
|
5406
|
-
super(name, "string", "PgMacaddr");
|
|
5407
|
-
}
|
|
5408
|
-
/** @internal */
|
|
5409
|
-
build(table) {
|
|
5410
|
-
return new PgMacaddr(table, this.config);
|
|
5411
|
-
}
|
|
5412
|
-
};
|
|
5413
|
-
var PgMacaddr = class extends PgColumn {
|
|
5414
|
-
static [entityKind] = "PgMacaddr";
|
|
5415
|
-
getSQLType() {
|
|
5416
|
-
return "macaddr";
|
|
5417
|
-
}
|
|
5418
|
-
};
|
|
5419
|
-
function macaddr(name) {
|
|
5420
|
-
return new PgMacaddrBuilder(name ?? "");
|
|
5421
|
-
}
|
|
5422
|
-
//#endregion
|
|
5423
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
|
|
5424
|
-
var PgMacaddr8Builder = class extends PgColumnBuilder {
|
|
5425
|
-
static [entityKind] = "PgMacaddr8Builder";
|
|
5426
|
-
constructor(name) {
|
|
5427
|
-
super(name, "string", "PgMacaddr8");
|
|
5428
|
-
}
|
|
5429
|
-
/** @internal */
|
|
5430
|
-
build(table) {
|
|
5431
|
-
return new PgMacaddr8(table, this.config);
|
|
5432
|
-
}
|
|
5433
|
-
};
|
|
5434
|
-
var PgMacaddr8 = class extends PgColumn {
|
|
5435
|
-
static [entityKind] = "PgMacaddr8";
|
|
5436
|
-
getSQLType() {
|
|
5437
|
-
return "macaddr8";
|
|
5438
|
-
}
|
|
5439
|
-
};
|
|
5440
|
-
function macaddr8(name) {
|
|
5441
|
-
return new PgMacaddr8Builder(name ?? "");
|
|
5442
|
-
}
|
|
5443
|
-
//#endregion
|
|
5444
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/numeric.js
|
|
5445
|
-
var PgNumericBuilder = class extends PgColumnBuilder {
|
|
5446
|
-
static [entityKind] = "PgNumericBuilder";
|
|
5447
|
-
constructor(name, precision, scale) {
|
|
5448
|
-
super(name, "string", "PgNumeric");
|
|
5449
|
-
this.config.precision = precision;
|
|
5450
|
-
this.config.scale = scale;
|
|
5451
|
-
}
|
|
5452
|
-
/** @internal */
|
|
5453
|
-
build(table) {
|
|
5454
|
-
return new PgNumeric(table, this.config);
|
|
5455
|
-
}
|
|
5456
|
-
};
|
|
5457
|
-
var PgNumeric = class extends PgColumn {
|
|
5458
|
-
static [entityKind] = "PgNumeric";
|
|
5459
|
-
precision;
|
|
5460
|
-
scale;
|
|
5461
|
-
constructor(table, config) {
|
|
5462
|
-
super(table, config);
|
|
5463
|
-
this.precision = config.precision;
|
|
5464
|
-
this.scale = config.scale;
|
|
5465
|
-
}
|
|
5466
|
-
mapFromDriverValue(value) {
|
|
5467
|
-
if (typeof value === "string") return value;
|
|
5468
|
-
return String(value);
|
|
5469
|
-
}
|
|
5470
|
-
getSQLType() {
|
|
5471
|
-
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
5472
|
-
else if (this.precision === void 0) return "numeric";
|
|
5473
|
-
else return `numeric(${this.precision})`;
|
|
5474
|
-
}
|
|
5475
|
-
};
|
|
5476
|
-
var PgNumericNumberBuilder = class extends PgColumnBuilder {
|
|
5477
|
-
static [entityKind] = "PgNumericNumberBuilder";
|
|
5478
|
-
constructor(name, precision, scale) {
|
|
5479
|
-
super(name, "number", "PgNumericNumber");
|
|
5480
|
-
this.config.precision = precision;
|
|
5481
|
-
this.config.scale = scale;
|
|
5482
|
-
}
|
|
5483
|
-
/** @internal */
|
|
5484
|
-
build(table) {
|
|
5485
|
-
return new PgNumericNumber(table, this.config);
|
|
5486
|
-
}
|
|
5487
|
-
};
|
|
5488
|
-
var PgNumericNumber = class extends PgColumn {
|
|
5489
|
-
static [entityKind] = "PgNumericNumber";
|
|
5490
|
-
precision;
|
|
5491
|
-
scale;
|
|
5492
|
-
constructor(table, config) {
|
|
5493
|
-
super(table, config);
|
|
5494
|
-
this.precision = config.precision;
|
|
5495
|
-
this.scale = config.scale;
|
|
5496
|
-
}
|
|
5497
|
-
mapFromDriverValue(value) {
|
|
5498
|
-
if (typeof value === "number") return value;
|
|
5499
|
-
return Number(value);
|
|
5500
|
-
}
|
|
5501
|
-
mapToDriverValue = String;
|
|
5502
|
-
getSQLType() {
|
|
5503
|
-
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
5504
|
-
else if (this.precision === void 0) return "numeric";
|
|
5505
|
-
else return `numeric(${this.precision})`;
|
|
5506
|
-
}
|
|
5507
|
-
};
|
|
5508
|
-
var PgNumericBigIntBuilder = class extends PgColumnBuilder {
|
|
5509
|
-
static [entityKind] = "PgNumericBigIntBuilder";
|
|
5510
|
-
constructor(name, precision, scale) {
|
|
5511
|
-
super(name, "bigint", "PgNumericBigInt");
|
|
5512
|
-
this.config.precision = precision;
|
|
5513
|
-
this.config.scale = scale;
|
|
5514
|
-
}
|
|
5515
|
-
/** @internal */
|
|
5516
|
-
build(table) {
|
|
5517
|
-
return new PgNumericBigInt(table, this.config);
|
|
5518
|
-
}
|
|
5519
|
-
};
|
|
5520
|
-
var PgNumericBigInt = class extends PgColumn {
|
|
5521
|
-
static [entityKind] = "PgNumericBigInt";
|
|
5522
|
-
precision;
|
|
5523
|
-
scale;
|
|
5524
|
-
constructor(table, config) {
|
|
5525
|
-
super(table, config);
|
|
5526
|
-
this.precision = config.precision;
|
|
5527
|
-
this.scale = config.scale;
|
|
5528
|
-
}
|
|
5529
|
-
mapFromDriverValue = BigInt;
|
|
5530
|
-
mapToDriverValue = String;
|
|
5531
|
-
getSQLType() {
|
|
5532
|
-
if (this.precision !== void 0 && this.scale !== void 0) return `numeric(${this.precision}, ${this.scale})`;
|
|
5533
|
-
else if (this.precision === void 0) return "numeric";
|
|
5534
|
-
else return `numeric(${this.precision})`;
|
|
5535
|
-
}
|
|
5536
|
-
};
|
|
5537
|
-
function numeric$1(a, b) {
|
|
5538
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5539
|
-
const mode = config?.mode;
|
|
5540
|
-
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);
|
|
5541
|
-
}
|
|
5542
|
-
//#endregion
|
|
5543
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/point.js
|
|
5544
|
-
var PgPointTupleBuilder = class extends PgColumnBuilder {
|
|
5545
|
-
static [entityKind] = "PgPointTupleBuilder";
|
|
5546
|
-
constructor(name) {
|
|
5547
|
-
super(name, "array", "PgPointTuple");
|
|
5548
|
-
}
|
|
5549
|
-
/** @internal */
|
|
5550
|
-
build(table) {
|
|
5551
|
-
return new PgPointTuple(table, this.config);
|
|
5552
|
-
}
|
|
5553
|
-
};
|
|
5554
|
-
var PgPointTuple = class extends PgColumn {
|
|
5555
|
-
static [entityKind] = "PgPointTuple";
|
|
5556
|
-
getSQLType() {
|
|
5557
|
-
return "point";
|
|
5558
|
-
}
|
|
5559
|
-
mapFromDriverValue(value) {
|
|
5560
|
-
if (typeof value === "string") {
|
|
5561
|
-
const [x, y] = value.slice(1, -1).split(",");
|
|
5562
|
-
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
5563
|
-
}
|
|
5564
|
-
return [value.x, value.y];
|
|
5565
|
-
}
|
|
5566
|
-
mapToDriverValue(value) {
|
|
5567
|
-
return `(${value[0]},${value[1]})`;
|
|
5568
|
-
}
|
|
5569
|
-
};
|
|
5570
|
-
var PgPointObjectBuilder = class extends PgColumnBuilder {
|
|
5571
|
-
static [entityKind] = "PgPointObjectBuilder";
|
|
5572
|
-
constructor(name) {
|
|
5573
|
-
super(name, "json", "PgPointObject");
|
|
5574
|
-
}
|
|
5575
|
-
/** @internal */
|
|
5576
|
-
build(table) {
|
|
5577
|
-
return new PgPointObject(table, this.config);
|
|
5578
|
-
}
|
|
5579
|
-
};
|
|
5580
|
-
var PgPointObject = class extends PgColumn {
|
|
5581
|
-
static [entityKind] = "PgPointObject";
|
|
5582
|
-
getSQLType() {
|
|
5583
|
-
return "point";
|
|
5584
|
-
}
|
|
5585
|
-
mapFromDriverValue(value) {
|
|
5586
|
-
if (typeof value === "string") {
|
|
5587
|
-
const [x, y] = value.slice(1, -1).split(",");
|
|
5588
|
-
return {
|
|
5589
|
-
x: Number.parseFloat(x),
|
|
5590
|
-
y: Number.parseFloat(y)
|
|
5591
|
-
};
|
|
5592
|
-
}
|
|
5593
|
-
return value;
|
|
5594
|
-
}
|
|
5595
|
-
mapToDriverValue(value) {
|
|
5596
|
-
return `(${value.x},${value.y})`;
|
|
5597
|
-
}
|
|
5598
|
-
};
|
|
5599
|
-
function point(a, b) {
|
|
5600
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5601
|
-
if (!config?.mode || config.mode === "tuple") return new PgPointTupleBuilder(name);
|
|
5602
|
-
return new PgPointObjectBuilder(name);
|
|
5603
|
-
}
|
|
5604
|
-
//#endregion
|
|
5605
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
5606
|
-
function hexToBytes(hex) {
|
|
5607
|
-
const bytes = [];
|
|
5608
|
-
for (let c = 0; c < hex.length; c += 2) bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
5609
|
-
return new Uint8Array(bytes);
|
|
5610
|
-
}
|
|
5611
|
-
function bytesToFloat64(bytes, offset) {
|
|
5612
|
-
const view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
5613
|
-
for (let i = 0; i < 8; i++) view.setUint8(i, bytes[offset + i]);
|
|
5614
|
-
return view.getFloat64(0, true);
|
|
5615
|
-
}
|
|
5616
|
-
function parseEWKB(hex) {
|
|
5617
|
-
const bytes = hexToBytes(hex);
|
|
5618
|
-
let offset = 0;
|
|
5619
|
-
const byteOrder = bytes[offset];
|
|
5620
|
-
offset += 1;
|
|
5621
|
-
const view = new DataView(bytes.buffer);
|
|
5622
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
5623
|
-
offset += 4;
|
|
5624
|
-
if (geomType & 536870912) {
|
|
5625
|
-
view.getUint32(offset, byteOrder === 1);
|
|
5626
|
-
offset += 4;
|
|
5627
|
-
}
|
|
5628
|
-
if ((geomType & 65535) === 1) {
|
|
5629
|
-
const x = bytesToFloat64(bytes, offset);
|
|
5630
|
-
offset += 8;
|
|
5631
|
-
const y = bytesToFloat64(bytes, offset);
|
|
5632
|
-
offset += 8;
|
|
5633
|
-
return [x, y];
|
|
5634
|
-
}
|
|
5635
|
-
throw new Error("Unsupported geometry type");
|
|
5636
|
-
}
|
|
5637
|
-
//#endregion
|
|
5638
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
|
|
5639
|
-
var PgGeometryBuilder = class extends PgColumnBuilder {
|
|
5640
|
-
static [entityKind] = "PgGeometryBuilder";
|
|
5641
|
-
constructor(name) {
|
|
5642
|
-
super(name, "array", "PgGeometry");
|
|
5643
|
-
}
|
|
5644
|
-
/** @internal */
|
|
5645
|
-
build(table) {
|
|
5646
|
-
return new PgGeometry(table, this.config);
|
|
5647
|
-
}
|
|
5648
|
-
};
|
|
5649
|
-
var PgGeometry = class extends PgColumn {
|
|
5650
|
-
static [entityKind] = "PgGeometry";
|
|
5651
|
-
getSQLType() {
|
|
5652
|
-
return "geometry(point)";
|
|
5653
|
-
}
|
|
5654
|
-
mapFromDriverValue(value) {
|
|
5655
|
-
return parseEWKB(value);
|
|
5656
|
-
}
|
|
5657
|
-
mapToDriverValue(value) {
|
|
5658
|
-
return `point(${value[0]} ${value[1]})`;
|
|
5659
|
-
}
|
|
5660
|
-
};
|
|
5661
|
-
var PgGeometryObjectBuilder = class extends PgColumnBuilder {
|
|
5662
|
-
static [entityKind] = "PgGeometryObjectBuilder";
|
|
5663
|
-
constructor(name) {
|
|
5664
|
-
super(name, "json", "PgGeometryObject");
|
|
5665
|
-
}
|
|
5666
|
-
/** @internal */
|
|
5667
|
-
build(table) {
|
|
5668
|
-
return new PgGeometryObject(table, this.config);
|
|
5669
|
-
}
|
|
5670
|
-
};
|
|
5671
|
-
var PgGeometryObject = class extends PgColumn {
|
|
5672
|
-
static [entityKind] = "PgGeometryObject";
|
|
5673
|
-
getSQLType() {
|
|
5674
|
-
return "geometry(point)";
|
|
5675
|
-
}
|
|
5676
|
-
mapFromDriverValue(value) {
|
|
5677
|
-
const parsed = parseEWKB(value);
|
|
5678
|
-
return {
|
|
5679
|
-
x: parsed[0],
|
|
5680
|
-
y: parsed[1]
|
|
5681
|
-
};
|
|
5682
|
-
}
|
|
5683
|
-
mapToDriverValue(value) {
|
|
5684
|
-
return `point(${value.x} ${value.y})`;
|
|
5685
|
-
}
|
|
5686
|
-
};
|
|
5687
|
-
function geometry(a, b) {
|
|
5688
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5689
|
-
if (!config?.mode || config.mode === "tuple") return new PgGeometryBuilder(name);
|
|
5690
|
-
return new PgGeometryObjectBuilder(name);
|
|
5691
|
-
}
|
|
5692
|
-
//#endregion
|
|
5693
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/real.js
|
|
5694
|
-
var PgRealBuilder = class extends PgColumnBuilder {
|
|
5695
|
-
static [entityKind] = "PgRealBuilder";
|
|
5696
|
-
constructor(name, length) {
|
|
5697
|
-
super(name, "number", "PgReal");
|
|
5698
|
-
this.config.length = length;
|
|
5699
|
-
}
|
|
5700
|
-
/** @internal */
|
|
5701
|
-
build(table) {
|
|
5702
|
-
return new PgReal(table, this.config);
|
|
5703
|
-
}
|
|
5704
|
-
};
|
|
5705
|
-
var PgReal = class extends PgColumn {
|
|
5706
|
-
static [entityKind] = "PgReal";
|
|
5707
|
-
constructor(table, config) {
|
|
5708
|
-
super(table, config);
|
|
5709
|
-
}
|
|
5710
|
-
getSQLType() {
|
|
5711
|
-
return "real";
|
|
5712
|
-
}
|
|
5713
|
-
mapFromDriverValue = (value) => {
|
|
5714
|
-
if (typeof value === "string") return Number.parseFloat(value);
|
|
5715
|
-
return value;
|
|
5716
|
-
};
|
|
5717
|
-
};
|
|
5718
|
-
function real$1(name) {
|
|
5719
|
-
return new PgRealBuilder(name ?? "");
|
|
5720
|
-
}
|
|
5721
|
-
//#endregion
|
|
5722
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/serial.js
|
|
5723
|
-
var PgSerialBuilder = class extends PgColumnBuilder {
|
|
5724
|
-
static [entityKind] = "PgSerialBuilder";
|
|
5725
|
-
constructor(name) {
|
|
5726
|
-
super(name, "number", "PgSerial");
|
|
5727
|
-
this.config.hasDefault = true;
|
|
5728
|
-
this.config.notNull = true;
|
|
5729
|
-
}
|
|
5730
|
-
/** @internal */
|
|
5731
|
-
build(table) {
|
|
5732
|
-
return new PgSerial(table, this.config);
|
|
5733
|
-
}
|
|
5734
|
-
};
|
|
5735
|
-
var PgSerial = class extends PgColumn {
|
|
5736
|
-
static [entityKind] = "PgSerial";
|
|
5737
|
-
getSQLType() {
|
|
5738
|
-
return "serial";
|
|
5739
|
-
}
|
|
5740
|
-
};
|
|
5741
|
-
function serial(name) {
|
|
5742
|
-
return new PgSerialBuilder(name ?? "");
|
|
5743
|
-
}
|
|
5744
|
-
//#endregion
|
|
5745
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
5746
|
-
var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
|
|
5747
|
-
static [entityKind] = "PgSmallIntBuilder";
|
|
5748
|
-
constructor(name) {
|
|
5749
|
-
super(name, "number", "PgSmallInt");
|
|
5750
|
-
}
|
|
5751
|
-
/** @internal */
|
|
5752
|
-
build(table) {
|
|
5753
|
-
return new PgSmallInt(table, this.config);
|
|
5754
|
-
}
|
|
5755
|
-
};
|
|
5756
|
-
var PgSmallInt = class extends PgColumn {
|
|
5757
|
-
static [entityKind] = "PgSmallInt";
|
|
5758
|
-
getSQLType() {
|
|
5759
|
-
return "smallint";
|
|
5760
|
-
}
|
|
5761
|
-
mapFromDriverValue = (value) => {
|
|
5762
|
-
if (typeof value === "string") return Number(value);
|
|
5763
|
-
return value;
|
|
5764
|
-
};
|
|
5765
|
-
};
|
|
5766
|
-
function smallint(name) {
|
|
5767
|
-
return new PgSmallIntBuilder(name ?? "");
|
|
5768
|
-
}
|
|
5769
|
-
//#endregion
|
|
5770
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/smallserial.js
|
|
5771
|
-
var PgSmallSerialBuilder = class extends PgColumnBuilder {
|
|
5772
|
-
static [entityKind] = "PgSmallSerialBuilder";
|
|
5773
|
-
constructor(name) {
|
|
5774
|
-
super(name, "number", "PgSmallSerial");
|
|
5775
|
-
this.config.hasDefault = true;
|
|
5776
|
-
this.config.notNull = true;
|
|
5777
|
-
}
|
|
5778
|
-
/** @internal */
|
|
5779
|
-
build(table) {
|
|
5780
|
-
return new PgSmallSerial(table, this.config);
|
|
5781
|
-
}
|
|
5782
|
-
};
|
|
5783
|
-
var PgSmallSerial = class extends PgColumn {
|
|
5784
|
-
static [entityKind] = "PgSmallSerial";
|
|
5785
|
-
getSQLType() {
|
|
5786
|
-
return "smallserial";
|
|
5787
|
-
}
|
|
5788
|
-
};
|
|
5789
|
-
function smallserial(name) {
|
|
5790
|
-
return new PgSmallSerialBuilder(name ?? "");
|
|
5791
|
-
}
|
|
5792
|
-
//#endregion
|
|
5793
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/text.js
|
|
5794
|
-
var PgTextBuilder = class extends PgColumnBuilder {
|
|
5795
|
-
static [entityKind] = "PgTextBuilder";
|
|
5796
|
-
constructor(name, config) {
|
|
5797
|
-
super(name, "string", "PgText");
|
|
5798
|
-
this.config.enumValues = config.enum;
|
|
5799
|
-
}
|
|
5800
|
-
/** @internal */
|
|
5801
|
-
build(table) {
|
|
5802
|
-
return new PgText(table, this.config);
|
|
5803
|
-
}
|
|
5804
|
-
};
|
|
5805
|
-
var PgText = class extends PgColumn {
|
|
5806
|
-
static [entityKind] = "PgText";
|
|
5807
|
-
enumValues = this.config.enumValues;
|
|
5808
|
-
getSQLType() {
|
|
5809
|
-
return "text";
|
|
5810
|
-
}
|
|
5811
|
-
};
|
|
5812
|
-
function text$1(a, b = {}) {
|
|
5813
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5814
|
-
return new PgTextBuilder(name, config);
|
|
5815
|
-
}
|
|
5816
|
-
//#endregion
|
|
5817
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/time.js
|
|
5818
|
-
var PgTimeBuilder = class extends PgDateColumnBaseBuilder {
|
|
5819
|
-
constructor(name, withTimezone, precision) {
|
|
5820
|
-
super(name, "string", "PgTime");
|
|
5821
|
-
this.withTimezone = withTimezone;
|
|
5822
|
-
this.precision = precision;
|
|
5823
|
-
this.config.withTimezone = withTimezone;
|
|
5824
|
-
this.config.precision = precision;
|
|
5825
|
-
}
|
|
5826
|
-
static [entityKind] = "PgTimeBuilder";
|
|
5827
|
-
/** @internal */
|
|
5828
|
-
build(table) {
|
|
5829
|
-
return new PgTime(table, this.config);
|
|
5830
|
-
}
|
|
5831
|
-
};
|
|
5832
|
-
var PgTime = class extends PgColumn {
|
|
5833
|
-
static [entityKind] = "PgTime";
|
|
5834
|
-
withTimezone;
|
|
5835
|
-
precision;
|
|
5836
|
-
constructor(table, config) {
|
|
5837
|
-
super(table, config);
|
|
5838
|
-
this.withTimezone = config.withTimezone;
|
|
5839
|
-
this.precision = config.precision;
|
|
5840
|
-
}
|
|
5841
|
-
getSQLType() {
|
|
5842
|
-
return `time${this.precision === void 0 ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
5843
|
-
}
|
|
5844
|
-
};
|
|
5845
|
-
function time(a, b = {}) {
|
|
5846
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5847
|
-
return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
|
|
5848
|
-
}
|
|
5849
|
-
//#endregion
|
|
5850
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
5851
|
-
var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
|
|
5852
|
-
static [entityKind] = "PgTimestampBuilder";
|
|
5853
|
-
constructor(name, withTimezone, precision) {
|
|
5854
|
-
super(name, "date", "PgTimestamp");
|
|
5855
|
-
this.config.withTimezone = withTimezone;
|
|
5856
|
-
this.config.precision = precision;
|
|
5857
|
-
}
|
|
5858
|
-
/** @internal */
|
|
5859
|
-
build(table) {
|
|
5860
|
-
return new PgTimestamp(table, this.config);
|
|
5861
|
-
}
|
|
5862
|
-
};
|
|
5863
|
-
var PgTimestamp = class extends PgColumn {
|
|
5864
|
-
static [entityKind] = "PgTimestamp";
|
|
5865
|
-
withTimezone;
|
|
5866
|
-
precision;
|
|
5867
|
-
constructor(table, config) {
|
|
5868
|
-
super(table, config);
|
|
5869
|
-
this.withTimezone = config.withTimezone;
|
|
5870
|
-
this.precision = config.precision;
|
|
5871
|
-
}
|
|
5872
|
-
getSQLType() {
|
|
5873
|
-
return `timestamp${this.precision === void 0 ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
5874
|
-
}
|
|
5875
|
-
mapFromDriverValue(value) {
|
|
5876
|
-
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
5877
|
-
return value;
|
|
5878
|
-
}
|
|
5879
|
-
mapToDriverValue = (value) => {
|
|
5880
|
-
return value.toISOString();
|
|
5881
|
-
};
|
|
5882
|
-
};
|
|
5883
|
-
var PgTimestampStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
5884
|
-
static [entityKind] = "PgTimestampStringBuilder";
|
|
5885
|
-
constructor(name, withTimezone, precision) {
|
|
5886
|
-
super(name, "string", "PgTimestampString");
|
|
5887
|
-
this.config.withTimezone = withTimezone;
|
|
5888
|
-
this.config.precision = precision;
|
|
5889
|
-
}
|
|
5890
|
-
/** @internal */
|
|
5891
|
-
build(table) {
|
|
5892
|
-
return new PgTimestampString(table, this.config);
|
|
5893
|
-
}
|
|
5894
|
-
};
|
|
5895
|
-
var PgTimestampString = class extends PgColumn {
|
|
5896
|
-
static [entityKind] = "PgTimestampString";
|
|
5897
|
-
withTimezone;
|
|
5898
|
-
precision;
|
|
5899
|
-
constructor(table, config) {
|
|
5900
|
-
super(table, config);
|
|
5901
|
-
this.withTimezone = config.withTimezone;
|
|
5902
|
-
this.precision = config.precision;
|
|
5903
|
-
}
|
|
5904
|
-
getSQLType() {
|
|
5905
|
-
return `timestamp${this.precision === void 0 ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
5906
|
-
}
|
|
5907
|
-
mapFromDriverValue(value) {
|
|
5908
|
-
if (typeof value === "string") return value;
|
|
5909
|
-
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
5910
|
-
if (this.withTimezone) {
|
|
5911
|
-
const offset = value.getTimezoneOffset();
|
|
5912
|
-
return `${shortened}${offset <= 0 ? "+" : "-"}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
5913
|
-
}
|
|
5914
|
-
return shortened;
|
|
5915
|
-
}
|
|
5916
|
-
};
|
|
5917
|
-
function timestamp(a, b = {}) {
|
|
5918
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5919
|
-
if (config?.mode === "string") return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
|
|
5920
|
-
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
|
|
5921
|
-
}
|
|
5922
|
-
//#endregion
|
|
5923
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/uuid.js
|
|
5924
|
-
var PgUUIDBuilder = class extends PgColumnBuilder {
|
|
5925
|
-
static [entityKind] = "PgUUIDBuilder";
|
|
5926
|
-
constructor(name) {
|
|
5927
|
-
super(name, "string", "PgUUID");
|
|
5928
|
-
}
|
|
5929
|
-
/**
|
|
5930
|
-
* Adds `default gen_random_uuid()` to the column definition.
|
|
5931
|
-
*/
|
|
5932
|
-
defaultRandom() {
|
|
5933
|
-
return this.default(sql$1`gen_random_uuid()`);
|
|
5934
|
-
}
|
|
5935
|
-
/** @internal */
|
|
5936
|
-
build(table) {
|
|
5937
|
-
return new PgUUID(table, this.config);
|
|
5938
|
-
}
|
|
5939
|
-
};
|
|
5940
|
-
var PgUUID = class extends PgColumn {
|
|
5941
|
-
static [entityKind] = "PgUUID";
|
|
5942
|
-
getSQLType() {
|
|
5943
|
-
return "uuid";
|
|
5944
|
-
}
|
|
5945
|
-
};
|
|
5946
|
-
function uuid(name) {
|
|
5947
|
-
return new PgUUIDBuilder(name ?? "");
|
|
5948
|
-
}
|
|
5949
|
-
//#endregion
|
|
5950
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
5951
|
-
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
5952
|
-
static [entityKind] = "PgVarcharBuilder";
|
|
5953
|
-
constructor(name, config) {
|
|
5954
|
-
super(name, "string", "PgVarchar");
|
|
5955
|
-
this.config.length = config.length;
|
|
5956
|
-
this.config.enumValues = config.enum;
|
|
5957
|
-
}
|
|
5958
|
-
/** @internal */
|
|
5959
|
-
build(table) {
|
|
5960
|
-
return new PgVarchar(table, this.config);
|
|
5961
|
-
}
|
|
5962
|
-
};
|
|
5963
|
-
var PgVarchar = class extends PgColumn {
|
|
5964
|
-
static [entityKind] = "PgVarchar";
|
|
5965
|
-
length = this.config.length;
|
|
5966
|
-
enumValues = this.config.enumValues;
|
|
5967
|
-
getSQLType() {
|
|
5968
|
-
return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
|
|
5969
|
-
}
|
|
5970
|
-
};
|
|
5971
|
-
function varchar(a, b = {}) {
|
|
5972
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5973
|
-
return new PgVarcharBuilder(name, config);
|
|
5974
|
-
}
|
|
5975
|
-
//#endregion
|
|
5976
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
|
|
5977
|
-
var PgBinaryVectorBuilder = class extends PgColumnBuilder {
|
|
5978
|
-
static [entityKind] = "PgBinaryVectorBuilder";
|
|
5979
|
-
constructor(name, config) {
|
|
5980
|
-
super(name, "string", "PgBinaryVector");
|
|
5981
|
-
this.config.dimensions = config.dimensions;
|
|
5982
|
-
}
|
|
5983
|
-
/** @internal */
|
|
5984
|
-
build(table) {
|
|
5985
|
-
return new PgBinaryVector(table, this.config);
|
|
5986
|
-
}
|
|
5987
|
-
};
|
|
5988
|
-
var PgBinaryVector = class extends PgColumn {
|
|
5989
|
-
static [entityKind] = "PgBinaryVector";
|
|
5990
|
-
dimensions = this.config.dimensions;
|
|
5991
|
-
getSQLType() {
|
|
5992
|
-
return `bit(${this.dimensions})`;
|
|
5993
|
-
}
|
|
5994
|
-
};
|
|
5995
|
-
function bit(a, b) {
|
|
5996
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
5997
|
-
return new PgBinaryVectorBuilder(name, config);
|
|
5998
|
-
}
|
|
5999
|
-
//#endregion
|
|
6000
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
|
|
6001
|
-
var PgHalfVectorBuilder = class extends PgColumnBuilder {
|
|
6002
|
-
static [entityKind] = "PgHalfVectorBuilder";
|
|
6003
|
-
constructor(name, config) {
|
|
6004
|
-
super(name, "array", "PgHalfVector");
|
|
6005
|
-
this.config.dimensions = config.dimensions;
|
|
6006
|
-
}
|
|
6007
|
-
/** @internal */
|
|
6008
|
-
build(table) {
|
|
6009
|
-
return new PgHalfVector(table, this.config);
|
|
6010
|
-
}
|
|
6011
|
-
};
|
|
6012
|
-
var PgHalfVector = class extends PgColumn {
|
|
6013
|
-
static [entityKind] = "PgHalfVector";
|
|
6014
|
-
dimensions = this.config.dimensions;
|
|
6015
|
-
getSQLType() {
|
|
6016
|
-
return `halfvec(${this.dimensions})`;
|
|
6017
|
-
}
|
|
6018
|
-
mapToDriverValue(value) {
|
|
6019
|
-
return JSON.stringify(value);
|
|
6020
|
-
}
|
|
6021
|
-
mapFromDriverValue(value) {
|
|
6022
|
-
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
6023
|
-
}
|
|
6024
|
-
};
|
|
6025
|
-
function halfvec(a, b) {
|
|
6026
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6027
|
-
return new PgHalfVectorBuilder(name, config);
|
|
6028
|
-
}
|
|
6029
|
-
//#endregion
|
|
6030
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
|
|
6031
|
-
var PgSparseVectorBuilder = class extends PgColumnBuilder {
|
|
6032
|
-
static [entityKind] = "PgSparseVectorBuilder";
|
|
6033
|
-
constructor(name, config) {
|
|
6034
|
-
super(name, "string", "PgSparseVector");
|
|
6035
|
-
this.config.dimensions = config.dimensions;
|
|
6036
|
-
}
|
|
6037
|
-
/** @internal */
|
|
6038
|
-
build(table) {
|
|
6039
|
-
return new PgSparseVector(table, this.config);
|
|
6040
|
-
}
|
|
6041
|
-
};
|
|
6042
|
-
var PgSparseVector = class extends PgColumn {
|
|
6043
|
-
static [entityKind] = "PgSparseVector";
|
|
6044
|
-
dimensions = this.config.dimensions;
|
|
6045
|
-
getSQLType() {
|
|
6046
|
-
return `sparsevec(${this.dimensions})`;
|
|
6047
|
-
}
|
|
6048
|
-
};
|
|
6049
|
-
function sparsevec(a, b) {
|
|
6050
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6051
|
-
return new PgSparseVectorBuilder(name, config);
|
|
6052
|
-
}
|
|
6053
|
-
//#endregion
|
|
6054
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
|
|
6055
|
-
var PgVectorBuilder = class extends PgColumnBuilder {
|
|
6056
|
-
static [entityKind] = "PgVectorBuilder";
|
|
6057
|
-
constructor(name, config) {
|
|
6058
|
-
super(name, "array", "PgVector");
|
|
6059
|
-
this.config.dimensions = config.dimensions;
|
|
6060
|
-
}
|
|
6061
|
-
/** @internal */
|
|
6062
|
-
build(table) {
|
|
6063
|
-
return new PgVector(table, this.config);
|
|
6064
|
-
}
|
|
6065
|
-
};
|
|
6066
|
-
var PgVector = class extends PgColumn {
|
|
6067
|
-
static [entityKind] = "PgVector";
|
|
6068
|
-
dimensions = this.config.dimensions;
|
|
6069
|
-
getSQLType() {
|
|
6070
|
-
return `vector(${this.dimensions})`;
|
|
6071
|
-
}
|
|
6072
|
-
mapToDriverValue(value) {
|
|
6073
|
-
return JSON.stringify(value);
|
|
6074
|
-
}
|
|
6075
|
-
mapFromDriverValue(value) {
|
|
6076
|
-
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
6077
|
-
}
|
|
6078
|
-
};
|
|
6079
|
-
function vector(a, b) {
|
|
6080
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6081
|
-
return new PgVectorBuilder(name, config);
|
|
6082
|
-
}
|
|
6083
|
-
//#endregion
|
|
6084
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/columns/all.js
|
|
6085
|
-
function getPgColumnBuilders() {
|
|
6086
|
-
return {
|
|
6087
|
-
bigint,
|
|
6088
|
-
bigserial,
|
|
6089
|
-
boolean,
|
|
6090
|
-
char,
|
|
6091
|
-
cidr,
|
|
6092
|
-
customType: customType$1,
|
|
6093
|
-
date,
|
|
6094
|
-
doublePrecision,
|
|
6095
|
-
inet,
|
|
6096
|
-
integer: integer$1,
|
|
6097
|
-
interval,
|
|
6098
|
-
json,
|
|
6099
|
-
jsonb,
|
|
6100
|
-
line,
|
|
6101
|
-
macaddr,
|
|
6102
|
-
macaddr8,
|
|
6103
|
-
numeric: numeric$1,
|
|
6104
|
-
point,
|
|
6105
|
-
geometry,
|
|
6106
|
-
real: real$1,
|
|
6107
|
-
serial,
|
|
6108
|
-
smallint,
|
|
6109
|
-
smallserial,
|
|
6110
|
-
text: text$1,
|
|
6111
|
-
time,
|
|
6112
|
-
timestamp,
|
|
6113
|
-
uuid,
|
|
6114
|
-
varchar,
|
|
6115
|
-
bit,
|
|
6116
|
-
halfvec,
|
|
6117
|
-
sparsevec,
|
|
6118
|
-
vector
|
|
6119
|
-
};
|
|
6120
|
-
}
|
|
6121
|
-
//#endregion
|
|
6122
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/table.js
|
|
6123
|
-
const InlineForeignKeys$1 = Symbol.for("drizzle:PgInlineForeignKeys");
|
|
6124
|
-
const EnableRLS = Symbol.for("drizzle:EnableRLS");
|
|
6125
|
-
var PgTable = class extends Table {
|
|
6126
|
-
static [entityKind] = "PgTable";
|
|
6127
|
-
/** @internal */
|
|
6128
|
-
static Symbol = Object.assign({}, Table.Symbol, {
|
|
6129
|
-
InlineForeignKeys: InlineForeignKeys$1,
|
|
6130
|
-
EnableRLS
|
|
6131
|
-
});
|
|
6132
|
-
/**@internal */
|
|
6133
|
-
[InlineForeignKeys$1] = [];
|
|
6134
|
-
/** @internal */
|
|
6135
|
-
[EnableRLS] = false;
|
|
6136
|
-
/** @internal */
|
|
6137
|
-
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
6138
|
-
/** @internal */
|
|
6139
|
-
[Table.Symbol.ExtraConfigColumns] = {};
|
|
6140
|
-
};
|
|
6141
|
-
function pgTableWithSchema(name, columns, extraConfig, schema, baseName = name) {
|
|
6142
|
-
const rawTable = new PgTable(name, schema, baseName);
|
|
6143
|
-
const parsedColumns = typeof columns === "function" ? columns(getPgColumnBuilders()) : columns;
|
|
6144
|
-
const builtColumns = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
6145
|
-
const colBuilder = colBuilderBase;
|
|
6146
|
-
colBuilder.setName(name2);
|
|
6147
|
-
const column = colBuilder.build(rawTable);
|
|
6148
|
-
rawTable[InlineForeignKeys$1].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
6149
|
-
return [name2, column];
|
|
6150
|
-
}));
|
|
6151
|
-
const builtColumnsForExtraConfig = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
6152
|
-
const colBuilder = colBuilderBase;
|
|
6153
|
-
colBuilder.setName(name2);
|
|
6154
|
-
return [name2, colBuilder.buildExtraConfigColumn(rawTable)];
|
|
6155
|
-
}));
|
|
6156
|
-
const table = Object.assign(rawTable, builtColumns);
|
|
6157
|
-
table[Table.Symbol.Columns] = builtColumns;
|
|
6158
|
-
table[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
|
6159
|
-
if (extraConfig) table[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
6160
|
-
return Object.assign(table, { enableRLS: () => {
|
|
6161
|
-
table[PgTable.Symbol.EnableRLS] = true;
|
|
6162
|
-
return table;
|
|
6163
|
-
} });
|
|
6164
|
-
}
|
|
6165
|
-
const pgTable = (name, columns, extraConfig) => {
|
|
6166
|
-
return pgTableWithSchema(name, columns, extraConfig, void 0);
|
|
6167
|
-
};
|
|
6168
|
-
//#endregion
|
|
6169
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/indexes.js
|
|
6170
|
-
var IndexBuilderOn$1 = class {
|
|
6171
|
-
constructor(unique, name) {
|
|
6172
|
-
this.unique = unique;
|
|
6173
|
-
this.name = name;
|
|
6174
|
-
}
|
|
6175
|
-
static [entityKind] = "PgIndexBuilderOn";
|
|
6176
|
-
on(...columns) {
|
|
6177
|
-
return new IndexBuilder$1(columns.map((it) => {
|
|
6178
|
-
if (is(it, SQL)) return it;
|
|
6179
|
-
it = it;
|
|
6180
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
6181
|
-
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
6182
|
-
return clonedIndexedColumn;
|
|
6183
|
-
}), this.unique, false, this.name);
|
|
6184
|
-
}
|
|
6185
|
-
onOnly(...columns) {
|
|
6186
|
-
return new IndexBuilder$1(columns.map((it) => {
|
|
6187
|
-
if (is(it, SQL)) return it;
|
|
6188
|
-
it = it;
|
|
6189
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
6190
|
-
it.indexConfig = it.defaultConfig;
|
|
6191
|
-
return clonedIndexedColumn;
|
|
6192
|
-
}), this.unique, true, this.name);
|
|
6193
|
-
}
|
|
6194
|
-
/**
|
|
6195
|
-
* Specify what index method to use. Choices are `btree`, `hash`, `gist`, `spgist`, `gin`, `brin`, or user-installed access methods like `bloom`. The default method is `btree.
|
|
6196
|
-
*
|
|
6197
|
-
* If you have the `pg_vector` extension installed in your database, you can use the `hnsw` and `ivfflat` options, which are predefined types.
|
|
6198
|
-
*
|
|
6199
|
-
* **You can always specify any string you want in the method, in case Drizzle doesn't have it natively in its types**
|
|
6200
|
-
*
|
|
6201
|
-
* @param method The name of the index method to be used
|
|
6202
|
-
* @param columns
|
|
6203
|
-
* @returns
|
|
6204
|
-
*/
|
|
6205
|
-
using(method, ...columns) {
|
|
6206
|
-
return new IndexBuilder$1(columns.map((it) => {
|
|
6207
|
-
if (is(it, SQL)) return it;
|
|
6208
|
-
it = it;
|
|
6209
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
6210
|
-
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
6211
|
-
return clonedIndexedColumn;
|
|
6212
|
-
}), this.unique, true, this.name, method);
|
|
6213
|
-
}
|
|
6214
|
-
};
|
|
6215
|
-
var IndexBuilder$1 = class {
|
|
6216
|
-
static [entityKind] = "PgIndexBuilder";
|
|
6217
|
-
/** @internal */
|
|
6218
|
-
config;
|
|
6219
|
-
constructor(columns, unique, only, name, method = "btree") {
|
|
6220
|
-
this.config = {
|
|
6221
|
-
name,
|
|
6222
|
-
columns,
|
|
6223
|
-
unique,
|
|
6224
|
-
only,
|
|
6225
|
-
method
|
|
6226
|
-
};
|
|
6227
|
-
}
|
|
6228
|
-
concurrently() {
|
|
6229
|
-
this.config.concurrently = true;
|
|
6230
|
-
return this;
|
|
6231
|
-
}
|
|
6232
|
-
with(obj) {
|
|
6233
|
-
this.config.with = obj;
|
|
6234
|
-
return this;
|
|
6235
|
-
}
|
|
6236
|
-
where(condition) {
|
|
6237
|
-
this.config.where = condition;
|
|
6238
|
-
return this;
|
|
6239
|
-
}
|
|
6240
|
-
/** @internal */
|
|
6241
|
-
build(table) {
|
|
6242
|
-
return new Index$1(this.config, table);
|
|
6243
|
-
}
|
|
6244
|
-
};
|
|
6245
|
-
var Index$1 = class {
|
|
6246
|
-
static [entityKind] = "PgIndex";
|
|
6247
|
-
config;
|
|
6248
|
-
constructor(config, table) {
|
|
6249
|
-
this.config = {
|
|
6250
|
-
...config,
|
|
6251
|
-
table
|
|
6252
|
-
};
|
|
6253
|
-
}
|
|
6254
|
-
};
|
|
6255
|
-
function index$1(name) {
|
|
6256
|
-
return new IndexBuilderOn$1(false, name);
|
|
6257
|
-
}
|
|
6258
|
-
function uniqueIndex$1(name) {
|
|
6259
|
-
return new IndexBuilderOn$1(true, name);
|
|
6260
|
-
}
|
|
6261
|
-
//#endregion
|
|
6262
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/pg-core/primary-keys.js
|
|
6263
|
-
function primaryKey$1(...config) {
|
|
6264
|
-
if (config[0].columns) return new PrimaryKeyBuilder$1(config[0].columns, config[0].name);
|
|
6265
|
-
return new PrimaryKeyBuilder$1(config);
|
|
6266
|
-
}
|
|
6267
|
-
var PrimaryKeyBuilder$1 = class {
|
|
6268
|
-
static [entityKind] = "PgPrimaryKeyBuilder";
|
|
6269
|
-
/** @internal */
|
|
6270
|
-
columns;
|
|
6271
|
-
/** @internal */
|
|
6272
|
-
name;
|
|
6273
|
-
constructor(columns, name) {
|
|
6274
|
-
this.columns = columns;
|
|
6275
|
-
this.name = name;
|
|
6276
|
-
}
|
|
6277
|
-
/** @internal */
|
|
6278
|
-
build(table) {
|
|
6279
|
-
return new PrimaryKey$1(table, this.columns, this.name);
|
|
6280
|
-
}
|
|
6281
|
-
};
|
|
6282
|
-
var PrimaryKey$1 = class {
|
|
6283
|
-
constructor(table, columns, name) {
|
|
6284
|
-
this.table = table;
|
|
6285
|
-
this.columns = columns;
|
|
6286
|
-
this.name = name;
|
|
6287
|
-
}
|
|
6288
|
-
static [entityKind] = "PgPrimaryKey";
|
|
6289
|
-
columns;
|
|
6290
|
-
name;
|
|
6291
|
-
getName() {
|
|
6292
|
-
return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
|
|
6293
|
-
}
|
|
6294
|
-
};
|
|
6295
|
-
//#endregion
|
|
6296
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
6297
|
-
var ForeignKeyBuilder = class {
|
|
6298
|
-
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
6299
|
-
/** @internal */
|
|
6300
|
-
reference;
|
|
6301
|
-
/** @internal */
|
|
6302
|
-
_onUpdate;
|
|
6303
|
-
/** @internal */
|
|
6304
|
-
_onDelete;
|
|
6305
|
-
constructor(config, actions) {
|
|
6306
|
-
this.reference = () => {
|
|
6307
|
-
const { name, columns, foreignColumns } = config();
|
|
6308
|
-
return {
|
|
6309
|
-
name,
|
|
6310
|
-
columns,
|
|
6311
|
-
foreignTable: foreignColumns[0].table,
|
|
6312
|
-
foreignColumns
|
|
6313
|
-
};
|
|
6314
|
-
};
|
|
6315
|
-
if (actions) {
|
|
6316
|
-
this._onUpdate = actions.onUpdate;
|
|
6317
|
-
this._onDelete = actions.onDelete;
|
|
6318
|
-
}
|
|
6319
|
-
}
|
|
6320
|
-
onUpdate(action) {
|
|
6321
|
-
this._onUpdate = action;
|
|
6322
|
-
return this;
|
|
6323
|
-
}
|
|
6324
|
-
onDelete(action) {
|
|
6325
|
-
this._onDelete = action;
|
|
6326
|
-
return this;
|
|
6327
|
-
}
|
|
6328
|
-
/** @internal */
|
|
6329
|
-
build(table) {
|
|
6330
|
-
return new ForeignKey(table, this);
|
|
6331
|
-
}
|
|
6332
|
-
};
|
|
6333
|
-
var ForeignKey = class {
|
|
6334
|
-
constructor(table, builder) {
|
|
6335
|
-
this.table = table;
|
|
6336
|
-
this.reference = builder.reference;
|
|
6337
|
-
this.onUpdate = builder._onUpdate;
|
|
6338
|
-
this.onDelete = builder._onDelete;
|
|
6339
|
-
}
|
|
6340
|
-
static [entityKind] = "SQLiteForeignKey";
|
|
6341
|
-
reference;
|
|
6342
|
-
onUpdate;
|
|
6343
|
-
onDelete;
|
|
6344
|
-
getName() {
|
|
6345
|
-
const { name, columns, foreignColumns } = this.reference();
|
|
6346
|
-
const columnNames = columns.map((column) => column.name);
|
|
6347
|
-
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
6348
|
-
const chunks = [
|
|
6349
|
-
this.table[TableName],
|
|
6350
|
-
...columnNames,
|
|
6351
|
-
foreignColumns[0].table[TableName],
|
|
6352
|
-
...foreignColumnNames
|
|
6353
|
-
];
|
|
6354
|
-
return name ?? `${chunks.join("_")}_fk`;
|
|
6355
|
-
}
|
|
6356
|
-
};
|
|
6357
|
-
//#endregion
|
|
6358
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
6359
|
-
function uniqueKeyName(table, columns) {
|
|
6360
|
-
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
6361
|
-
}
|
|
6362
|
-
//#endregion
|
|
6363
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
6364
|
-
var SQLiteColumnBuilder = class extends ColumnBuilder {
|
|
6365
|
-
static [entityKind] = "SQLiteColumnBuilder";
|
|
6366
|
-
foreignKeyConfigs = [];
|
|
6367
|
-
references(ref, actions = {}) {
|
|
6368
|
-
this.foreignKeyConfigs.push({
|
|
6369
|
-
ref,
|
|
6370
|
-
actions
|
|
6371
|
-
});
|
|
6372
|
-
return this;
|
|
6373
|
-
}
|
|
6374
|
-
unique(name) {
|
|
6375
|
-
this.config.isUnique = true;
|
|
6376
|
-
this.config.uniqueName = name;
|
|
6377
|
-
return this;
|
|
6378
|
-
}
|
|
6379
|
-
generatedAlwaysAs(as, config) {
|
|
6380
|
-
this.config.generated = {
|
|
6381
|
-
as,
|
|
6382
|
-
type: "always",
|
|
6383
|
-
mode: config?.mode ?? "virtual"
|
|
6384
|
-
};
|
|
6385
|
-
return this;
|
|
6386
|
-
}
|
|
6387
|
-
/** @internal */
|
|
6388
|
-
buildForeignKeys(column, table) {
|
|
6389
|
-
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
6390
|
-
return ((ref2, actions2) => {
|
|
6391
|
-
const builder = new ForeignKeyBuilder(() => {
|
|
6392
|
-
const foreignColumn = ref2();
|
|
6393
|
-
return {
|
|
6394
|
-
columns: [column],
|
|
6395
|
-
foreignColumns: [foreignColumn]
|
|
6396
|
-
};
|
|
6397
|
-
});
|
|
6398
|
-
if (actions2.onUpdate) builder.onUpdate(actions2.onUpdate);
|
|
6399
|
-
if (actions2.onDelete) builder.onDelete(actions2.onDelete);
|
|
6400
|
-
return builder.build(table);
|
|
6401
|
-
})(ref, actions);
|
|
6402
|
-
});
|
|
6403
|
-
}
|
|
6404
|
-
};
|
|
6405
|
-
var SQLiteColumn = class extends Column {
|
|
6406
|
-
constructor(table, config) {
|
|
6407
|
-
if (!config.uniqueName) config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
6408
|
-
super(table, config);
|
|
6409
|
-
this.table = table;
|
|
6410
|
-
}
|
|
6411
|
-
static [entityKind] = "SQLiteColumn";
|
|
6412
|
-
};
|
|
6413
|
-
//#endregion
|
|
6414
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
6415
|
-
var SQLiteBigIntBuilder = class extends SQLiteColumnBuilder {
|
|
6416
|
-
static [entityKind] = "SQLiteBigIntBuilder";
|
|
6417
|
-
constructor(name) {
|
|
6418
|
-
super(name, "bigint", "SQLiteBigInt");
|
|
6419
|
-
}
|
|
6420
|
-
/** @internal */
|
|
6421
|
-
build(table) {
|
|
6422
|
-
return new SQLiteBigInt(table, this.config);
|
|
6423
|
-
}
|
|
6424
|
-
};
|
|
6425
|
-
var SQLiteBigInt = class extends SQLiteColumn {
|
|
6426
|
-
static [entityKind] = "SQLiteBigInt";
|
|
6427
|
-
getSQLType() {
|
|
6428
|
-
return "blob";
|
|
6429
|
-
}
|
|
6430
|
-
mapFromDriverValue(value) {
|
|
6431
|
-
if (typeof Buffer !== "undefined" && Buffer.from) {
|
|
6432
|
-
const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
|
|
6433
|
-
return BigInt(buf.toString("utf8"));
|
|
6434
|
-
}
|
|
6435
|
-
return BigInt(textDecoder.decode(value));
|
|
6436
|
-
}
|
|
6437
|
-
mapToDriverValue(value) {
|
|
6438
|
-
return Buffer.from(value.toString());
|
|
6439
|
-
}
|
|
6440
|
-
};
|
|
6441
|
-
var SQLiteBlobJsonBuilder = class extends SQLiteColumnBuilder {
|
|
6442
|
-
static [entityKind] = "SQLiteBlobJsonBuilder";
|
|
6443
|
-
constructor(name) {
|
|
6444
|
-
super(name, "json", "SQLiteBlobJson");
|
|
6445
|
-
}
|
|
6446
|
-
/** @internal */
|
|
6447
|
-
build(table) {
|
|
6448
|
-
return new SQLiteBlobJson(table, this.config);
|
|
6449
|
-
}
|
|
6450
|
-
};
|
|
6451
|
-
var SQLiteBlobJson = class extends SQLiteColumn {
|
|
6452
|
-
static [entityKind] = "SQLiteBlobJson";
|
|
6453
|
-
getSQLType() {
|
|
6454
|
-
return "blob";
|
|
6455
|
-
}
|
|
6456
|
-
mapFromDriverValue(value) {
|
|
6457
|
-
if (typeof Buffer !== "undefined" && Buffer.from) {
|
|
6458
|
-
const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
|
|
6459
|
-
return JSON.parse(buf.toString("utf8"));
|
|
6460
|
-
}
|
|
6461
|
-
return JSON.parse(textDecoder.decode(value));
|
|
6462
|
-
}
|
|
6463
|
-
mapToDriverValue(value) {
|
|
6464
|
-
return Buffer.from(JSON.stringify(value));
|
|
6465
|
-
}
|
|
6466
|
-
};
|
|
6467
|
-
var SQLiteBlobBufferBuilder = class extends SQLiteColumnBuilder {
|
|
6468
|
-
static [entityKind] = "SQLiteBlobBufferBuilder";
|
|
6469
|
-
constructor(name) {
|
|
6470
|
-
super(name, "buffer", "SQLiteBlobBuffer");
|
|
6471
|
-
}
|
|
6472
|
-
/** @internal */
|
|
6473
|
-
build(table) {
|
|
6474
|
-
return new SQLiteBlobBuffer(table, this.config);
|
|
6475
|
-
}
|
|
6476
|
-
};
|
|
6477
|
-
var SQLiteBlobBuffer = class extends SQLiteColumn {
|
|
6478
|
-
static [entityKind] = "SQLiteBlobBuffer";
|
|
6479
|
-
mapFromDriverValue(value) {
|
|
6480
|
-
if (Buffer.isBuffer(value)) return value;
|
|
6481
|
-
return Buffer.from(value);
|
|
6482
|
-
}
|
|
6483
|
-
getSQLType() {
|
|
6484
|
-
return "blob";
|
|
6485
|
-
}
|
|
6486
|
-
};
|
|
6487
|
-
function blob(a, b) {
|
|
6488
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6489
|
-
if (config?.mode === "json") return new SQLiteBlobJsonBuilder(name);
|
|
6490
|
-
if (config?.mode === "bigint") return new SQLiteBigIntBuilder(name);
|
|
6491
|
-
return new SQLiteBlobBufferBuilder(name);
|
|
6492
|
-
}
|
|
6493
|
-
//#endregion
|
|
6494
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
6495
|
-
var SQLiteCustomColumnBuilder = class extends SQLiteColumnBuilder {
|
|
6496
|
-
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
6497
|
-
constructor(name, fieldConfig, customTypeParams) {
|
|
6498
|
-
super(name, "custom", "SQLiteCustomColumn");
|
|
6499
|
-
this.config.fieldConfig = fieldConfig;
|
|
6500
|
-
this.config.customTypeParams = customTypeParams;
|
|
6501
|
-
}
|
|
6502
|
-
/** @internal */
|
|
6503
|
-
build(table) {
|
|
6504
|
-
return new SQLiteCustomColumn(table, this.config);
|
|
6505
|
-
}
|
|
6506
|
-
};
|
|
6507
|
-
var SQLiteCustomColumn = class extends SQLiteColumn {
|
|
6508
|
-
static [entityKind] = "SQLiteCustomColumn";
|
|
6509
|
-
sqlName;
|
|
6510
|
-
mapTo;
|
|
6511
|
-
mapFrom;
|
|
6512
|
-
constructor(table, config) {
|
|
6513
|
-
super(table, config);
|
|
6514
|
-
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
6515
|
-
this.mapTo = config.customTypeParams.toDriver;
|
|
6516
|
-
this.mapFrom = config.customTypeParams.fromDriver;
|
|
6517
|
-
}
|
|
6518
|
-
getSQLType() {
|
|
6519
|
-
return this.sqlName;
|
|
6520
|
-
}
|
|
6521
|
-
mapFromDriverValue(value) {
|
|
6522
|
-
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
6523
|
-
}
|
|
6524
|
-
mapToDriverValue(value) {
|
|
6525
|
-
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
6526
|
-
}
|
|
6527
|
-
};
|
|
6528
|
-
function customType(customTypeParams) {
|
|
6529
|
-
return (a, b) => {
|
|
6530
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6531
|
-
return new SQLiteCustomColumnBuilder(name, config, customTypeParams);
|
|
6532
|
-
};
|
|
6533
|
-
}
|
|
6534
|
-
//#endregion
|
|
6535
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
6536
|
-
var SQLiteBaseIntegerBuilder = class extends SQLiteColumnBuilder {
|
|
6537
|
-
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
6538
|
-
constructor(name, dataType, columnType) {
|
|
6539
|
-
super(name, dataType, columnType);
|
|
6540
|
-
this.config.autoIncrement = false;
|
|
6541
|
-
}
|
|
6542
|
-
primaryKey(config) {
|
|
6543
|
-
if (config?.autoIncrement) this.config.autoIncrement = true;
|
|
6544
|
-
this.config.hasDefault = true;
|
|
6545
|
-
return super.primaryKey();
|
|
6546
|
-
}
|
|
6547
|
-
};
|
|
6548
|
-
var SQLiteBaseInteger = class extends SQLiteColumn {
|
|
6549
|
-
static [entityKind] = "SQLiteBaseInteger";
|
|
6550
|
-
autoIncrement = this.config.autoIncrement;
|
|
6551
|
-
getSQLType() {
|
|
6552
|
-
return "integer";
|
|
6553
|
-
}
|
|
6554
|
-
};
|
|
6555
|
-
var SQLiteIntegerBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
6556
|
-
static [entityKind] = "SQLiteIntegerBuilder";
|
|
6557
|
-
constructor(name) {
|
|
6558
|
-
super(name, "number", "SQLiteInteger");
|
|
6559
|
-
}
|
|
6560
|
-
build(table) {
|
|
6561
|
-
return new SQLiteInteger(table, this.config);
|
|
6562
|
-
}
|
|
6563
|
-
};
|
|
6564
|
-
var SQLiteInteger = class extends SQLiteBaseInteger {
|
|
6565
|
-
static [entityKind] = "SQLiteInteger";
|
|
6566
|
-
};
|
|
6567
|
-
var SQLiteTimestampBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
6568
|
-
static [entityKind] = "SQLiteTimestampBuilder";
|
|
6569
|
-
constructor(name, mode) {
|
|
6570
|
-
super(name, "date", "SQLiteTimestamp");
|
|
6571
|
-
this.config.mode = mode;
|
|
6572
|
-
}
|
|
6573
|
-
/**
|
|
6574
|
-
* @deprecated Use `default()` with your own expression instead.
|
|
6575
|
-
*
|
|
6576
|
-
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
|
|
6577
|
-
*/
|
|
6578
|
-
defaultNow() {
|
|
6579
|
-
return this.default(sql$1`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
|
|
6580
|
-
}
|
|
6581
|
-
build(table) {
|
|
6582
|
-
return new SQLiteTimestamp(table, this.config);
|
|
6583
|
-
}
|
|
6584
|
-
};
|
|
6585
|
-
var SQLiteTimestamp = class extends SQLiteBaseInteger {
|
|
6586
|
-
static [entityKind] = "SQLiteTimestamp";
|
|
6587
|
-
mode = this.config.mode;
|
|
6588
|
-
mapFromDriverValue(value) {
|
|
6589
|
-
if (this.config.mode === "timestamp") return /* @__PURE__ */ new Date(value * 1e3);
|
|
6590
|
-
return new Date(value);
|
|
6591
|
-
}
|
|
6592
|
-
mapToDriverValue(value) {
|
|
6593
|
-
const unix = value.getTime();
|
|
6594
|
-
if (this.config.mode === "timestamp") return Math.floor(unix / 1e3);
|
|
6595
|
-
return unix;
|
|
6596
|
-
}
|
|
6597
|
-
};
|
|
6598
|
-
var SQLiteBooleanBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
6599
|
-
static [entityKind] = "SQLiteBooleanBuilder";
|
|
6600
|
-
constructor(name, mode) {
|
|
6601
|
-
super(name, "boolean", "SQLiteBoolean");
|
|
6602
|
-
this.config.mode = mode;
|
|
6603
|
-
}
|
|
6604
|
-
build(table) {
|
|
6605
|
-
return new SQLiteBoolean(table, this.config);
|
|
6606
|
-
}
|
|
6607
|
-
};
|
|
6608
|
-
var SQLiteBoolean = class extends SQLiteBaseInteger {
|
|
6609
|
-
static [entityKind] = "SQLiteBoolean";
|
|
6610
|
-
mode = this.config.mode;
|
|
6611
|
-
mapFromDriverValue(value) {
|
|
6612
|
-
return Number(value) === 1;
|
|
6613
|
-
}
|
|
6614
|
-
mapToDriverValue(value) {
|
|
6615
|
-
return value ? 1 : 0;
|
|
6616
|
-
}
|
|
6617
|
-
};
|
|
6618
|
-
function integer(a, b) {
|
|
6619
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6620
|
-
if (config?.mode === "timestamp" || config?.mode === "timestamp_ms") return new SQLiteTimestampBuilder(name, config.mode);
|
|
6621
|
-
if (config?.mode === "boolean") return new SQLiteBooleanBuilder(name, config.mode);
|
|
6622
|
-
return new SQLiteIntegerBuilder(name);
|
|
6623
|
-
}
|
|
6624
|
-
//#endregion
|
|
6625
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
6626
|
-
var SQLiteNumericBuilder = class extends SQLiteColumnBuilder {
|
|
6627
|
-
static [entityKind] = "SQLiteNumericBuilder";
|
|
6628
|
-
constructor(name) {
|
|
6629
|
-
super(name, "string", "SQLiteNumeric");
|
|
6630
|
-
}
|
|
6631
|
-
/** @internal */
|
|
6632
|
-
build(table) {
|
|
6633
|
-
return new SQLiteNumeric(table, this.config);
|
|
6634
|
-
}
|
|
6635
|
-
};
|
|
6636
|
-
var SQLiteNumeric = class extends SQLiteColumn {
|
|
6637
|
-
static [entityKind] = "SQLiteNumeric";
|
|
6638
|
-
mapFromDriverValue(value) {
|
|
6639
|
-
if (typeof value === "string") return value;
|
|
6640
|
-
return String(value);
|
|
6641
|
-
}
|
|
6642
|
-
getSQLType() {
|
|
6643
|
-
return "numeric";
|
|
6644
|
-
}
|
|
6645
|
-
};
|
|
6646
|
-
var SQLiteNumericNumberBuilder = class extends SQLiteColumnBuilder {
|
|
6647
|
-
static [entityKind] = "SQLiteNumericNumberBuilder";
|
|
6648
|
-
constructor(name) {
|
|
6649
|
-
super(name, "number", "SQLiteNumericNumber");
|
|
6650
|
-
}
|
|
6651
|
-
/** @internal */
|
|
6652
|
-
build(table) {
|
|
6653
|
-
return new SQLiteNumericNumber(table, this.config);
|
|
6654
|
-
}
|
|
6655
|
-
};
|
|
6656
|
-
var SQLiteNumericNumber = class extends SQLiteColumn {
|
|
6657
|
-
static [entityKind] = "SQLiteNumericNumber";
|
|
6658
|
-
mapFromDriverValue(value) {
|
|
6659
|
-
if (typeof value === "number") return value;
|
|
6660
|
-
return Number(value);
|
|
6661
|
-
}
|
|
6662
|
-
mapToDriverValue = String;
|
|
6663
|
-
getSQLType() {
|
|
6664
|
-
return "numeric";
|
|
6665
|
-
}
|
|
6666
|
-
};
|
|
6667
|
-
var SQLiteNumericBigIntBuilder = class extends SQLiteColumnBuilder {
|
|
6668
|
-
static [entityKind] = "SQLiteNumericBigIntBuilder";
|
|
6669
|
-
constructor(name) {
|
|
6670
|
-
super(name, "bigint", "SQLiteNumericBigInt");
|
|
6671
|
-
}
|
|
6672
|
-
/** @internal */
|
|
6673
|
-
build(table) {
|
|
6674
|
-
return new SQLiteNumericBigInt(table, this.config);
|
|
6675
|
-
}
|
|
6676
|
-
};
|
|
6677
|
-
var SQLiteNumericBigInt = class extends SQLiteColumn {
|
|
6678
|
-
static [entityKind] = "SQLiteNumericBigInt";
|
|
6679
|
-
mapFromDriverValue = BigInt;
|
|
6680
|
-
mapToDriverValue = String;
|
|
6681
|
-
getSQLType() {
|
|
6682
|
-
return "numeric";
|
|
6683
|
-
}
|
|
6684
|
-
};
|
|
6685
|
-
function numeric(a, b) {
|
|
6686
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6687
|
-
const mode = config?.mode;
|
|
6688
|
-
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
6689
|
-
}
|
|
6690
|
-
//#endregion
|
|
6691
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
6692
|
-
var SQLiteRealBuilder = class extends SQLiteColumnBuilder {
|
|
6693
|
-
static [entityKind] = "SQLiteRealBuilder";
|
|
6694
|
-
constructor(name) {
|
|
6695
|
-
super(name, "number", "SQLiteReal");
|
|
6696
|
-
}
|
|
6697
|
-
/** @internal */
|
|
6698
|
-
build(table) {
|
|
6699
|
-
return new SQLiteReal(table, this.config);
|
|
6700
|
-
}
|
|
6701
|
-
};
|
|
6702
|
-
var SQLiteReal = class extends SQLiteColumn {
|
|
6703
|
-
static [entityKind] = "SQLiteReal";
|
|
6704
|
-
getSQLType() {
|
|
6705
|
-
return "real";
|
|
6706
|
-
}
|
|
6707
|
-
};
|
|
6708
|
-
function real(name) {
|
|
6709
|
-
return new SQLiteRealBuilder(name ?? "");
|
|
6710
|
-
}
|
|
6711
|
-
//#endregion
|
|
6712
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
6713
|
-
var SQLiteTextBuilder = class extends SQLiteColumnBuilder {
|
|
6714
|
-
static [entityKind] = "SQLiteTextBuilder";
|
|
6715
|
-
constructor(name, config) {
|
|
6716
|
-
super(name, "string", "SQLiteText");
|
|
6717
|
-
this.config.enumValues = config.enum;
|
|
6718
|
-
this.config.length = config.length;
|
|
6719
|
-
}
|
|
6720
|
-
/** @internal */
|
|
6721
|
-
build(table) {
|
|
6722
|
-
return new SQLiteText(table, this.config);
|
|
6723
|
-
}
|
|
6724
|
-
};
|
|
6725
|
-
var SQLiteText = class extends SQLiteColumn {
|
|
6726
|
-
static [entityKind] = "SQLiteText";
|
|
6727
|
-
enumValues = this.config.enumValues;
|
|
6728
|
-
length = this.config.length;
|
|
6729
|
-
constructor(table, config) {
|
|
6730
|
-
super(table, config);
|
|
6731
|
-
}
|
|
6732
|
-
getSQLType() {
|
|
6733
|
-
return `text${this.config.length ? `(${this.config.length})` : ""}`;
|
|
6734
|
-
}
|
|
6735
|
-
};
|
|
6736
|
-
var SQLiteTextJsonBuilder = class extends SQLiteColumnBuilder {
|
|
6737
|
-
static [entityKind] = "SQLiteTextJsonBuilder";
|
|
6738
|
-
constructor(name) {
|
|
6739
|
-
super(name, "json", "SQLiteTextJson");
|
|
6740
|
-
}
|
|
6741
|
-
/** @internal */
|
|
6742
|
-
build(table) {
|
|
6743
|
-
return new SQLiteTextJson(table, this.config);
|
|
6744
|
-
}
|
|
6745
|
-
};
|
|
6746
|
-
var SQLiteTextJson = class extends SQLiteColumn {
|
|
6747
|
-
static [entityKind] = "SQLiteTextJson";
|
|
6748
|
-
getSQLType() {
|
|
6749
|
-
return "text";
|
|
6750
|
-
}
|
|
6751
|
-
mapFromDriverValue(value) {
|
|
6752
|
-
return JSON.parse(value);
|
|
6753
|
-
}
|
|
6754
|
-
mapToDriverValue(value) {
|
|
6755
|
-
return JSON.stringify(value);
|
|
6756
|
-
}
|
|
6757
|
-
};
|
|
6758
|
-
function text(a, b = {}) {
|
|
6759
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
6760
|
-
if (config.mode === "json") return new SQLiteTextJsonBuilder(name);
|
|
6761
|
-
return new SQLiteTextBuilder(name, config);
|
|
6762
|
-
}
|
|
6763
|
-
//#endregion
|
|
6764
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
6765
|
-
function getSQLiteColumnBuilders() {
|
|
6766
|
-
return {
|
|
6767
|
-
blob,
|
|
6768
|
-
customType,
|
|
6769
|
-
integer,
|
|
6770
|
-
numeric,
|
|
6771
|
-
real,
|
|
6772
|
-
text
|
|
6773
|
-
};
|
|
6774
|
-
}
|
|
6775
|
-
//#endregion
|
|
6776
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/table.js
|
|
6777
|
-
const InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
6778
|
-
var SQLiteTable = class extends Table {
|
|
6779
|
-
static [entityKind] = "SQLiteTable";
|
|
6780
|
-
/** @internal */
|
|
6781
|
-
static Symbol = Object.assign({}, Table.Symbol, { InlineForeignKeys });
|
|
6782
|
-
/** @internal */
|
|
6783
|
-
[Table.Symbol.Columns];
|
|
6784
|
-
/** @internal */
|
|
6785
|
-
[InlineForeignKeys] = [];
|
|
6786
|
-
/** @internal */
|
|
6787
|
-
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
6788
|
-
};
|
|
6789
|
-
function sqliteTableBase(name, columns, extraConfig, schema, baseName = name) {
|
|
6790
|
-
const rawTable = new SQLiteTable(name, schema, baseName);
|
|
6791
|
-
const parsedColumns = typeof columns === "function" ? columns(getSQLiteColumnBuilders()) : columns;
|
|
6792
|
-
const builtColumns = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
6793
|
-
const colBuilder = colBuilderBase;
|
|
6794
|
-
colBuilder.setName(name2);
|
|
6795
|
-
const column = colBuilder.build(rawTable);
|
|
6796
|
-
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
6797
|
-
return [name2, column];
|
|
6798
|
-
}));
|
|
6799
|
-
const table = Object.assign(rawTable, builtColumns);
|
|
6800
|
-
table[Table.Symbol.Columns] = builtColumns;
|
|
6801
|
-
table[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
|
6802
|
-
if (extraConfig) table[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
6803
|
-
return table;
|
|
6804
|
-
}
|
|
6805
|
-
const sqliteTable = (name, columns, extraConfig) => {
|
|
6806
|
-
return sqliteTableBase(name, columns, extraConfig);
|
|
6807
|
-
};
|
|
6808
|
-
//#endregion
|
|
6809
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
6810
|
-
var IndexBuilderOn = class {
|
|
6811
|
-
constructor(name, unique) {
|
|
6812
|
-
this.name = name;
|
|
6813
|
-
this.unique = unique;
|
|
6814
|
-
}
|
|
6815
|
-
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
6816
|
-
on(...columns) {
|
|
6817
|
-
return new IndexBuilder(this.name, columns, this.unique);
|
|
6818
|
-
}
|
|
6819
|
-
};
|
|
6820
|
-
var IndexBuilder = class {
|
|
6821
|
-
static [entityKind] = "SQLiteIndexBuilder";
|
|
6822
|
-
/** @internal */
|
|
6823
|
-
config;
|
|
6824
|
-
constructor(name, columns, unique) {
|
|
6825
|
-
this.config = {
|
|
6826
|
-
name,
|
|
6827
|
-
columns,
|
|
6828
|
-
unique,
|
|
6829
|
-
where: void 0
|
|
6830
|
-
};
|
|
6831
|
-
}
|
|
6832
|
-
/**
|
|
6833
|
-
* Condition for partial index.
|
|
6834
|
-
*/
|
|
6835
|
-
where(condition) {
|
|
6836
|
-
this.config.where = condition;
|
|
6837
|
-
return this;
|
|
6838
|
-
}
|
|
6839
|
-
/** @internal */
|
|
6840
|
-
build(table) {
|
|
6841
|
-
return new Index(this.config, table);
|
|
6842
|
-
}
|
|
6843
|
-
};
|
|
6844
|
-
var Index = class {
|
|
6845
|
-
static [entityKind] = "SQLiteIndex";
|
|
6846
|
-
config;
|
|
6847
|
-
constructor(config, table) {
|
|
6848
|
-
this.config = {
|
|
6849
|
-
...config,
|
|
6850
|
-
table
|
|
6851
|
-
};
|
|
6852
|
-
}
|
|
6853
|
-
};
|
|
6854
|
-
function index(name) {
|
|
6855
|
-
return new IndexBuilderOn(name, false);
|
|
6856
|
-
}
|
|
6857
|
-
function uniqueIndex(name) {
|
|
6858
|
-
return new IndexBuilderOn(name, true);
|
|
6859
|
-
}
|
|
6860
|
-
//#endregion
|
|
6861
|
-
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@opentelemetry+api@1.9.1_@types+better-sqlite3@7.6.13_@types+pg@8.20_77911661b3ede76946c974aead4d265f/node_modules/drizzle-orm/sqlite-core/primary-keys.js
|
|
6862
|
-
function primaryKey(...config) {
|
|
6863
|
-
if (config[0].columns) return new PrimaryKeyBuilder(config[0].columns, config[0].name);
|
|
6864
|
-
return new PrimaryKeyBuilder(config);
|
|
6865
|
-
}
|
|
6866
|
-
var PrimaryKeyBuilder = class {
|
|
6867
|
-
static [entityKind] = "SQLitePrimaryKeyBuilder";
|
|
6868
|
-
/** @internal */
|
|
6869
|
-
columns;
|
|
6870
|
-
/** @internal */
|
|
6871
|
-
name;
|
|
6872
|
-
constructor(columns, name) {
|
|
6873
|
-
this.columns = columns;
|
|
6874
|
-
this.name = name;
|
|
6875
|
-
}
|
|
6876
|
-
/** @internal */
|
|
6877
|
-
build(table) {
|
|
6878
|
-
return new PrimaryKey(table, this.columns, this.name);
|
|
6879
|
-
}
|
|
6880
|
-
};
|
|
6881
|
-
var PrimaryKey = class {
|
|
6882
|
-
constructor(table, columns, name) {
|
|
6883
|
-
this.table = table;
|
|
6884
|
-
this.columns = columns;
|
|
6885
|
-
this.name = name;
|
|
6886
|
-
}
|
|
6887
|
-
static [entityKind] = "SQLitePrimaryKey";
|
|
6888
|
-
columns;
|
|
6889
|
-
name;
|
|
6890
|
-
getName() {
|
|
6891
|
-
return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
|
|
6892
|
-
}
|
|
6893
|
-
};
|
|
6894
3894
|
new AsyncLocalStorage();
|
|
6895
3895
|
new AsyncLocalStorage();
|
|
6896
3896
|
new AsyncLocalStorage();
|
|
@@ -6902,23 +3902,6 @@ function buildSqliteSchema$1(registry) {
|
|
|
6902
3902
|
return Object.fromEntries(Object.entries(registry).map(([name, { sqlite }]) => [name, sqlite]));
|
|
6903
3903
|
}
|
|
6904
3904
|
const agents = pgTable("agents", {
|
|
6905
|
-
id: text$1("id").primaryKey(),
|
|
6906
|
-
projectId: text$1("project_id").notNull(),
|
|
6907
|
-
slug: text$1("slug").notNull(),
|
|
6908
|
-
name: text$1("name"),
|
|
6909
|
-
description: text$1("description"),
|
|
6910
|
-
route: text$1("route").notNull(),
|
|
6911
|
-
moduleFile: text$1("module_file").notNull(),
|
|
6912
|
-
model: text$1("model").notNull(),
|
|
6913
|
-
systemPrompt: text$1("system_prompt").notNull(),
|
|
6914
|
-
toolCount: integer$1("tool_count"),
|
|
6915
|
-
credentialCount: integer$1("credential_count"),
|
|
6916
|
-
appSlugs: jsonb("app_slugs").$type(),
|
|
6917
|
-
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
6918
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
6919
|
-
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
6920
|
-
}, (table) => [uniqueIndex$1("agents_project_id_slug_idx").on(table.projectId, table.slug), uniqueIndex$1("agents_project_id_route_idx").on(table.projectId, table.route)]);
|
|
6921
|
-
const agentsSqlite = sqliteTable("agents", {
|
|
6922
3905
|
id: text("id").primaryKey(),
|
|
6923
3906
|
projectId: text("project_id").notNull(),
|
|
6924
3907
|
slug: text("slug").notNull(),
|
|
@@ -6930,74 +3913,79 @@ const agentsSqlite = sqliteTable("agents", {
|
|
|
6930
3913
|
systemPrompt: text("system_prompt").notNull(),
|
|
6931
3914
|
toolCount: integer("tool_count"),
|
|
6932
3915
|
credentialCount: integer("credential_count"),
|
|
6933
|
-
appSlugs:
|
|
6934
|
-
registeredAt:
|
|
6935
|
-
updatedAt:
|
|
6936
|
-
deletedAt:
|
|
3916
|
+
appSlugs: jsonb("app_slugs").$type(),
|
|
3917
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
3918
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
3919
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
6937
3920
|
}, (table) => [uniqueIndex("agents_project_id_slug_idx").on(table.projectId, table.slug), uniqueIndex("agents_project_id_route_idx").on(table.projectId, table.route)]);
|
|
6938
|
-
const
|
|
3921
|
+
const agentsSqlite = sqliteTable("agents", {
|
|
6939
3922
|
id: text$1("id").primaryKey(),
|
|
6940
3923
|
projectId: text$1("project_id").notNull(),
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
3924
|
+
slug: text$1("slug").notNull(),
|
|
3925
|
+
name: text$1("name"),
|
|
3926
|
+
description: text$1("description"),
|
|
3927
|
+
route: text$1("route").notNull(),
|
|
3928
|
+
moduleFile: text$1("module_file").notNull(),
|
|
3929
|
+
model: text$1("model").notNull(),
|
|
3930
|
+
systemPrompt: text$1("system_prompt").notNull(),
|
|
3931
|
+
toolCount: integer$1("tool_count"),
|
|
3932
|
+
credentialCount: integer$1("credential_count"),
|
|
3933
|
+
appSlugs: text$1("app_slugs", { mode: "json" }).$type(),
|
|
3934
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
3935
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
3936
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
3937
|
+
}, (table) => [uniqueIndex$1("agents_project_id_slug_idx").on(table.projectId, table.slug), uniqueIndex$1("agents_project_id_route_idx").on(table.projectId, table.route)]);
|
|
3938
|
+
const agentSessions = pgTable("agent_sessions", {
|
|
6955
3939
|
id: text("id").primaryKey(),
|
|
6956
3940
|
projectId: text("project_id").notNull(),
|
|
6957
|
-
agentId: text("agent_id").notNull().references(() =>
|
|
3941
|
+
agentId: text("agent_id").notNull().references(() => agents.id),
|
|
6958
3942
|
sourceKind: text("source_kind").$type().notNull().default("api"),
|
|
6959
3943
|
sourceId: text("source_id"),
|
|
6960
3944
|
parentSpanId: text("parent_span_id"),
|
|
6961
3945
|
ranByUserId: text("ran_by_user_id"),
|
|
6962
3946
|
title: text("title"),
|
|
6963
|
-
canceledAt:
|
|
3947
|
+
canceledAt: timestamp("canceled_at", { withTimezone: true }),
|
|
6964
3948
|
totalDurationMs: integer("total_duration_ms").notNull().default(0),
|
|
6965
|
-
liveMessage:
|
|
6966
|
-
createdAt:
|
|
6967
|
-
updatedAt:
|
|
6968
|
-
deletedAt:
|
|
3949
|
+
liveMessage: jsonb("live_message"),
|
|
3950
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
3951
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
3952
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
6969
3953
|
}, (table) => [index("agent_sessions_agent_updated_idx").on(table.agentId, table.updatedAt)]);
|
|
6970
|
-
const
|
|
3954
|
+
const agentSessionsSqlite = sqliteTable("agent_sessions", {
|
|
6971
3955
|
id: text$1("id").primaryKey(),
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
3956
|
+
projectId: text$1("project_id").notNull(),
|
|
3957
|
+
agentId: text$1("agent_id").notNull().references(() => agentsSqlite.id),
|
|
3958
|
+
sourceKind: text$1("source_kind").$type().notNull().default("api"),
|
|
3959
|
+
sourceId: text$1("source_id"),
|
|
3960
|
+
parentSpanId: text$1("parent_span_id"),
|
|
3961
|
+
ranByUserId: text$1("ran_by_user_id"),
|
|
3962
|
+
title: text$1("title"),
|
|
3963
|
+
canceledAt: integer$1("canceled_at", { mode: "timestamp_ms" }),
|
|
3964
|
+
totalDurationMs: integer$1("total_duration_ms").notNull().default(0),
|
|
3965
|
+
liveMessage: text$1("live_message", { mode: "json" }),
|
|
3966
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
3967
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
3968
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
3969
|
+
}, (table) => [index$1("agent_sessions_agent_updated_idx").on(table.agentId, table.updatedAt)]);
|
|
3970
|
+
const agentEvents = pgTable("agent_events", {
|
|
3971
|
+
id: text("id").primaryKey(),
|
|
3972
|
+
sessionId: text("session_id").notNull().references(() => agentSessions.id),
|
|
3973
|
+
seq: integer("seq").notNull(),
|
|
3974
|
+
eventType: text("event_type").notNull(),
|
|
6975
3975
|
payload: jsonb("payload").notNull(),
|
|
6976
3976
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
6977
3977
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
6978
3978
|
});
|
|
6979
3979
|
const agentEventsSqlite = sqliteTable("agent_events", {
|
|
6980
|
-
id: text("id").primaryKey(),
|
|
6981
|
-
sessionId: text("session_id").notNull().references(() => agentSessionsSqlite.id),
|
|
6982
|
-
seq: integer("seq").notNull(),
|
|
6983
|
-
eventType: text("event_type").notNull(),
|
|
6984
|
-
payload: text("payload", { mode: "json" }).notNull(),
|
|
6985
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
6986
|
-
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
3980
|
+
id: text$1("id").primaryKey(),
|
|
3981
|
+
sessionId: text$1("session_id").notNull().references(() => agentSessionsSqlite.id),
|
|
3982
|
+
seq: integer$1("seq").notNull(),
|
|
3983
|
+
eventType: text$1("event_type").notNull(),
|
|
3984
|
+
payload: text$1("payload", { mode: "json" }).notNull(),
|
|
3985
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
3986
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
6987
3987
|
});
|
|
6988
3988
|
const usageRecords = pgTable("usage_records", {
|
|
6989
|
-
id: text$1("id").primaryKey(),
|
|
6990
|
-
runId: text$1("run_id").notNull(),
|
|
6991
|
-
runKind: text$1("run_kind").$type().notNull(),
|
|
6992
|
-
kind: text$1("kind").notNull(),
|
|
6993
|
-
label: text$1("label").notNull(),
|
|
6994
|
-
quantity: integer$1("quantity"),
|
|
6995
|
-
unit: text$1("unit"),
|
|
6996
|
-
amount: doublePrecision("amount").notNull(),
|
|
6997
|
-
metadata: jsonb("metadata"),
|
|
6998
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
6999
|
-
}, (table) => [index$1("usage_records_run_run_kind_idx").on(table.runId, table.runKind), index$1("usage_records_kind_idx").on(table.kind)]);
|
|
7000
|
-
const usageRecordsSqlite = sqliteTable("usage_records", {
|
|
7001
3989
|
id: text("id").primaryKey(),
|
|
7002
3990
|
runId: text("run_id").notNull(),
|
|
7003
3991
|
runKind: text("run_kind").$type().notNull(),
|
|
@@ -7005,36 +3993,23 @@ const usageRecordsSqlite = sqliteTable("usage_records", {
|
|
|
7005
3993
|
label: text("label").notNull(),
|
|
7006
3994
|
quantity: integer("quantity"),
|
|
7007
3995
|
unit: text("unit"),
|
|
7008
|
-
amount:
|
|
7009
|
-
metadata:
|
|
7010
|
-
createdAt:
|
|
3996
|
+
amount: doublePrecision("amount").notNull(),
|
|
3997
|
+
metadata: jsonb("metadata"),
|
|
3998
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
7011
3999
|
}, (table) => [index("usage_records_run_run_kind_idx").on(table.runId, table.runKind), index("usage_records_kind_idx").on(table.kind)]);
|
|
7012
|
-
const
|
|
4000
|
+
const usageRecordsSqlite = sqliteTable("usage_records", {
|
|
7013
4001
|
id: text$1("id").primaryKey(),
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
kind: text$1("kind")
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
lifecycle: jsonb("lifecycle").$type(),
|
|
7026
|
-
createdBySessionId: text$1("created_by_session_id"),
|
|
7027
|
-
triggerHash: text$1("trigger_hash"),
|
|
7028
|
-
overviewMarkdown: text$1("overview_markdown"),
|
|
7029
|
-
overviewHash: text$1("overview_hash"),
|
|
7030
|
-
overviewModel: text$1("overview_model"),
|
|
7031
|
-
overviewStatus: text$1("overview_status").$type().notNull().default("idle"),
|
|
7032
|
-
overviewGeneratedAt: timestamp("overview_generated_at", { withTimezone: true }),
|
|
7033
|
-
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
7034
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7035
|
-
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7036
|
-
}, (table) => [uniqueIndex$1("triggers_project_id_slug_idx").on(table.projectId, table.slug), index$1("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
|
|
7037
|
-
const triggersSqlite = sqliteTable("triggers", {
|
|
4002
|
+
runId: text$1("run_id").notNull(),
|
|
4003
|
+
runKind: text$1("run_kind").$type().notNull(),
|
|
4004
|
+
kind: text$1("kind").notNull(),
|
|
4005
|
+
label: text$1("label").notNull(),
|
|
4006
|
+
quantity: integer$1("quantity"),
|
|
4007
|
+
unit: text$1("unit"),
|
|
4008
|
+
amount: real("amount").notNull(),
|
|
4009
|
+
metadata: text$1("metadata", { mode: "json" }),
|
|
4010
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull()
|
|
4011
|
+
}, (table) => [index$1("usage_records_run_run_kind_idx").on(table.runId, table.runKind), index$1("usage_records_kind_idx").on(table.kind)]);
|
|
4012
|
+
const triggers = pgTable("triggers", {
|
|
7038
4013
|
id: text("id").primaryKey(),
|
|
7039
4014
|
projectId: text("project_id").notNull(),
|
|
7040
4015
|
slug: text("slug").notNull(),
|
|
@@ -7043,118 +4018,122 @@ const triggersSqlite = sqliteTable("triggers", {
|
|
|
7043
4018
|
description: text("description"),
|
|
7044
4019
|
moduleFile: text("module_file").notNull(),
|
|
7045
4020
|
origin: text("origin").$type().notNull().default("project"),
|
|
7046
|
-
config:
|
|
4021
|
+
config: jsonb("config").$type(),
|
|
7047
4022
|
schedule: text("schedule"),
|
|
7048
|
-
nextRunAt:
|
|
4023
|
+
nextRunAt: timestamp("next_run_at", { withTimezone: true }),
|
|
7049
4024
|
enabled: integer("enabled").notNull().default(1),
|
|
7050
|
-
lifecycle:
|
|
4025
|
+
lifecycle: jsonb("lifecycle").$type(),
|
|
7051
4026
|
createdBySessionId: text("created_by_session_id"),
|
|
7052
4027
|
triggerHash: text("trigger_hash"),
|
|
7053
4028
|
overviewMarkdown: text("overview_markdown"),
|
|
7054
4029
|
overviewHash: text("overview_hash"),
|
|
7055
4030
|
overviewModel: text("overview_model"),
|
|
7056
4031
|
overviewStatus: text("overview_status").$type().notNull().default("idle"),
|
|
7057
|
-
overviewGeneratedAt:
|
|
7058
|
-
registeredAt:
|
|
7059
|
-
updatedAt:
|
|
7060
|
-
deletedAt:
|
|
4032
|
+
overviewGeneratedAt: timestamp("overview_generated_at", { withTimezone: true }),
|
|
4033
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
4034
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4035
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7061
4036
|
}, (table) => [uniqueIndex("triggers_project_id_slug_idx").on(table.projectId, table.slug), index("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
|
|
7062
|
-
const
|
|
4037
|
+
const triggersSqlite = sqliteTable("triggers", {
|
|
7063
4038
|
id: text$1("id").primaryKey(),
|
|
7064
4039
|
projectId: text$1("project_id").notNull(),
|
|
7065
|
-
triggerId: text$1("trigger_id").notNull().references(() => triggers.id),
|
|
7066
4040
|
slug: text$1("slug").notNull(),
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
4041
|
+
kind: text$1("kind").$type().notNull(),
|
|
4042
|
+
name: text$1("name"),
|
|
4043
|
+
description: text$1("description"),
|
|
4044
|
+
moduleFile: text$1("module_file").notNull(),
|
|
4045
|
+
origin: text$1("origin").$type().notNull().default("project"),
|
|
4046
|
+
config: text$1("config", { mode: "json" }).$type(),
|
|
4047
|
+
schedule: text$1("schedule"),
|
|
4048
|
+
nextRunAt: integer$1("next_run_at", { mode: "timestamp_ms" }),
|
|
4049
|
+
enabled: integer$1("enabled").notNull().default(1),
|
|
4050
|
+
lifecycle: text$1("lifecycle", { mode: "json" }).$type(),
|
|
4051
|
+
createdBySessionId: text$1("created_by_session_id"),
|
|
4052
|
+
triggerHash: text$1("trigger_hash"),
|
|
4053
|
+
overviewMarkdown: text$1("overview_markdown"),
|
|
4054
|
+
overviewHash: text$1("overview_hash"),
|
|
4055
|
+
overviewModel: text$1("overview_model"),
|
|
4056
|
+
overviewStatus: text$1("overview_status").$type().notNull().default("idle"),
|
|
4057
|
+
overviewGeneratedAt: integer$1("overview_generated_at", { mode: "timestamp_ms" }),
|
|
4058
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4059
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4060
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4061
|
+
}, (table) => [uniqueIndex$1("triggers_project_id_slug_idx").on(table.projectId, table.slug), index$1("triggers_next_run_at_enabled_idx").on(table.nextRunAt, table.enabled)]);
|
|
4062
|
+
const triggerAttachments = pgTable("trigger_attachments", {
|
|
7076
4063
|
id: text("id").primaryKey(),
|
|
7077
4064
|
projectId: text("project_id").notNull(),
|
|
7078
|
-
triggerId: text("trigger_id").notNull().references(() =>
|
|
4065
|
+
triggerId: text("trigger_id").notNull().references(() => triggers.id),
|
|
7079
4066
|
slug: text("slug").notNull(),
|
|
7080
4067
|
targetKind: text("target_kind").$type().notNull().default("workflow"),
|
|
7081
4068
|
workflowSlug: text("workflow_slug"),
|
|
7082
4069
|
agentSlug: text("agent_slug"),
|
|
7083
4070
|
prompt: text("prompt"),
|
|
7084
|
-
registeredAt:
|
|
7085
|
-
updatedAt:
|
|
7086
|
-
deletedAt:
|
|
4071
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
4072
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4073
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7087
4074
|
}, (table) => [uniqueIndex("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
7088
|
-
const
|
|
4075
|
+
const triggerAttachmentsSqlite = sqliteTable("trigger_attachments", {
|
|
7089
4076
|
id: text$1("id").primaryKey(),
|
|
7090
4077
|
projectId: text$1("project_id").notNull(),
|
|
7091
|
-
triggerId: text$1("trigger_id").notNull().references(() =>
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
4078
|
+
triggerId: text$1("trigger_id").notNull().references(() => triggersSqlite.id),
|
|
4079
|
+
slug: text$1("slug").notNull(),
|
|
4080
|
+
targetKind: text$1("target_kind").$type().notNull().default("workflow"),
|
|
4081
|
+
workflowSlug: text$1("workflow_slug"),
|
|
4082
|
+
agentSlug: text$1("agent_slug"),
|
|
4083
|
+
prompt: text$1("prompt"),
|
|
4084
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4085
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4086
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4087
|
+
}, (table) => [uniqueIndex$1("trigger_attachments_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
4088
|
+
const triggerRuns = pgTable("trigger_runs", {
|
|
7101
4089
|
id: text("id").primaryKey(),
|
|
7102
4090
|
projectId: text("project_id").notNull(),
|
|
7103
|
-
triggerId: text("trigger_id").notNull().references(() =>
|
|
4091
|
+
triggerId: text("trigger_id").notNull().references(() => triggers.id),
|
|
7104
4092
|
sourcePath: text("source_path"),
|
|
7105
4093
|
triggerType: text("trigger_type").$type().notNull(),
|
|
7106
4094
|
outcome: text("outcome").$type().notNull().default("dispatched"),
|
|
7107
4095
|
reason: text("reason").$type(),
|
|
7108
4096
|
detail: text("detail"),
|
|
7109
|
-
payload:
|
|
7110
|
-
triggeredAt:
|
|
4097
|
+
payload: jsonb("payload"),
|
|
4098
|
+
triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull()
|
|
7111
4099
|
}, (table) => [index("trigger_runs_project_trigger_triggered_idx").on(table.projectId, table.triggerId, table.triggeredAt), index("trigger_runs_project_triggered_idx").on(table.projectId, table.triggeredAt)]);
|
|
7112
|
-
const
|
|
4100
|
+
const triggerRunsSqlite = sqliteTable("trigger_runs", {
|
|
7113
4101
|
id: text$1("id").primaryKey(),
|
|
7114
4102
|
projectId: text$1("project_id").notNull(),
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
4103
|
+
triggerId: text$1("trigger_id").notNull().references(() => triggersSqlite.id),
|
|
4104
|
+
sourcePath: text$1("source_path"),
|
|
4105
|
+
triggerType: text$1("trigger_type").$type().notNull(),
|
|
4106
|
+
outcome: text$1("outcome").$type().notNull().default("dispatched"),
|
|
4107
|
+
reason: text$1("reason").$type(),
|
|
4108
|
+
detail: text$1("detail"),
|
|
4109
|
+
payload: text$1("payload", { mode: "json" }),
|
|
4110
|
+
triggeredAt: integer$1("triggered_at", { mode: "timestamp_ms" }).notNull()
|
|
4111
|
+
}, (table) => [index$1("trigger_runs_project_trigger_triggered_idx").on(table.projectId, table.triggerId, table.triggeredAt), index$1("trigger_runs_project_triggered_idx").on(table.projectId, table.triggeredAt)]);
|
|
4112
|
+
const workflowSubscriptions = pgTable("workflow_subscriptions", {
|
|
7122
4113
|
id: text("id").primaryKey(),
|
|
7123
4114
|
projectId: text("project_id").notNull(),
|
|
7124
4115
|
workflowSlug: text("workflow_slug").notNull(),
|
|
7125
4116
|
userId: text("user_id").notNull(),
|
|
7126
|
-
enabled: integer("enabled"
|
|
7127
|
-
createdAt:
|
|
7128
|
-
updatedAt:
|
|
4117
|
+
enabled: integer("enabled").notNull(),
|
|
4118
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4119
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7129
4120
|
}, (table) => [uniqueIndex("workflow_subscriptions_project_workflow_user").on(table.projectId, table.workflowSlug, table.userId)]);
|
|
7130
|
-
const
|
|
4121
|
+
const workflowSubscriptionsSqlite = sqliteTable("workflow_subscriptions", {
|
|
7131
4122
|
id: text$1("id").primaryKey(),
|
|
7132
4123
|
projectId: text$1("project_id").notNull(),
|
|
7133
4124
|
workflowSlug: text$1("workflow_slug").notNull(),
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
sourceId: text$1("source_id"),
|
|
7141
|
-
ranByUserId: text$1("ran_by_user_id"),
|
|
7142
|
-
status: text$1("status").$type().notNull(),
|
|
7143
|
-
trigger: text$1("trigger").$type().notNull(),
|
|
7144
|
-
triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull(),
|
|
7145
|
-
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
7146
|
-
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
7147
|
-
input: jsonb("input"),
|
|
7148
|
-
output: jsonb("output"),
|
|
7149
|
-
error: jsonb("error")
|
|
7150
|
-
}, (table) => [index$1("workflow_runs_project_workflow_triggered_idx").on(table.projectId, table.workflowSlug, table.triggeredAt)]);
|
|
7151
|
-
const workflowRunsSqlite = sqliteTable("workflow_runs", {
|
|
4125
|
+
userId: text$1("user_id").notNull(),
|
|
4126
|
+
enabled: integer$1("enabled", { mode: "boolean" }).notNull(),
|
|
4127
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4128
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4129
|
+
}, (table) => [uniqueIndex$1("workflow_subscriptions_project_workflow_user").on(table.projectId, table.workflowSlug, table.userId)]);
|
|
4130
|
+
const workflowRuns = pgTable("workflow_runs", {
|
|
7152
4131
|
id: text("id").primaryKey(),
|
|
7153
4132
|
projectId: text("project_id").notNull(),
|
|
7154
4133
|
workflowSlug: text("workflow_slug").notNull(),
|
|
7155
|
-
attachmentId: text("attachment_id").references(() =>
|
|
7156
|
-
subscriptionId: text("subscription_id").references(() =>
|
|
7157
|
-
triggerRunId: text("trigger_run_id").references(() =>
|
|
4134
|
+
attachmentId: text("attachment_id").references(() => triggerAttachments.id),
|
|
4135
|
+
subscriptionId: text("subscription_id").references(() => workflowSubscriptions.id),
|
|
4136
|
+
triggerRunId: text("trigger_run_id").references(() => triggerRuns.id),
|
|
7158
4137
|
parentWorkflowRunId: text("parent_workflow_run_id"),
|
|
7159
4138
|
parentSpanId: text("parent_span_id"),
|
|
7160
4139
|
sourceKind: text("source_kind").$type().notNull().default("api"),
|
|
@@ -7162,88 +4141,89 @@ const workflowRunsSqlite = sqliteTable("workflow_runs", {
|
|
|
7162
4141
|
ranByUserId: text("ran_by_user_id"),
|
|
7163
4142
|
status: text("status").$type().notNull(),
|
|
7164
4143
|
trigger: text("trigger").$type().notNull(),
|
|
7165
|
-
triggeredAt:
|
|
7166
|
-
startedAt:
|
|
7167
|
-
finishedAt:
|
|
7168
|
-
input:
|
|
7169
|
-
output:
|
|
7170
|
-
error:
|
|
4144
|
+
triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull(),
|
|
4145
|
+
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
4146
|
+
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
4147
|
+
input: jsonb("input"),
|
|
4148
|
+
output: jsonb("output"),
|
|
4149
|
+
error: jsonb("error")
|
|
7171
4150
|
}, (table) => [index("workflow_runs_project_workflow_triggered_idx").on(table.projectId, table.workflowSlug, table.triggeredAt)]);
|
|
4151
|
+
const workflowRunsSqlite = sqliteTable("workflow_runs", {
|
|
4152
|
+
id: text$1("id").primaryKey(),
|
|
4153
|
+
projectId: text$1("project_id").notNull(),
|
|
4154
|
+
workflowSlug: text$1("workflow_slug").notNull(),
|
|
4155
|
+
attachmentId: text$1("attachment_id").references(() => triggerAttachmentsSqlite.id),
|
|
4156
|
+
subscriptionId: text$1("subscription_id").references(() => workflowSubscriptionsSqlite.id),
|
|
4157
|
+
triggerRunId: text$1("trigger_run_id").references(() => triggerRunsSqlite.id),
|
|
4158
|
+
parentWorkflowRunId: text$1("parent_workflow_run_id"),
|
|
4159
|
+
parentSpanId: text$1("parent_span_id"),
|
|
4160
|
+
sourceKind: text$1("source_kind").$type().notNull().default("api"),
|
|
4161
|
+
sourceId: text$1("source_id"),
|
|
4162
|
+
ranByUserId: text$1("ran_by_user_id"),
|
|
4163
|
+
status: text$1("status").$type().notNull(),
|
|
4164
|
+
trigger: text$1("trigger").$type().notNull(),
|
|
4165
|
+
triggeredAt: integer$1("triggered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4166
|
+
startedAt: integer$1("started_at", { mode: "timestamp_ms" }),
|
|
4167
|
+
finishedAt: integer$1("finished_at", { mode: "timestamp_ms" }),
|
|
4168
|
+
input: text$1("input", { mode: "json" }),
|
|
4169
|
+
output: text$1("output", { mode: "json" }),
|
|
4170
|
+
error: text$1("error", { mode: "json" })
|
|
4171
|
+
}, (table) => [index$1("workflow_runs_project_workflow_triggered_idx").on(table.projectId, table.workflowSlug, table.triggeredAt)]);
|
|
7172
4172
|
/**
|
|
7173
4173
|
* Append-only durable execution log. One row per workflow lifecycle transition.
|
|
7174
4174
|
* Replay reads these in `seq` order and short-circuits already-completed primitives.
|
|
7175
4175
|
*/
|
|
7176
4176
|
const workflowEvents = pgTable("workflow_events", {
|
|
7177
|
-
id: text$1("id").primaryKey(),
|
|
7178
|
-
runId: text$1("run_id").notNull().references(() => workflowRuns.id),
|
|
7179
|
-
projectId: text$1("project_id").notNull(),
|
|
7180
|
-
seq: integer$1("seq").notNull(),
|
|
7181
|
-
type: text$1("type").$type().notNull(),
|
|
7182
|
-
correlationId: text$1("correlation_id"),
|
|
7183
|
-
data: jsonb("data"),
|
|
7184
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
7185
|
-
}, (table) => [
|
|
7186
|
-
uniqueIndex$1("workflow_events_run_id_seq_unique").on(table.runId, table.seq),
|
|
7187
|
-
index$1("workflow_events_run_id_type_idx").on(table.runId, table.type),
|
|
7188
|
-
index$1("workflow_events_correlation_id_idx").on(table.correlationId)
|
|
7189
|
-
]);
|
|
7190
|
-
const workflowEventsSqlite = sqliteTable("workflow_events", {
|
|
7191
4177
|
id: text("id").primaryKey(),
|
|
7192
|
-
runId: text("run_id").notNull().references(() =>
|
|
4178
|
+
runId: text("run_id").notNull().references(() => workflowRuns.id),
|
|
7193
4179
|
projectId: text("project_id").notNull(),
|
|
7194
4180
|
seq: integer("seq").notNull(),
|
|
7195
4181
|
type: text("type").$type().notNull(),
|
|
7196
4182
|
correlationId: text("correlation_id"),
|
|
7197
|
-
data:
|
|
7198
|
-
createdAt:
|
|
4183
|
+
data: jsonb("data"),
|
|
4184
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
7199
4185
|
}, (table) => [
|
|
7200
4186
|
uniqueIndex("workflow_events_run_id_seq_unique").on(table.runId, table.seq),
|
|
7201
4187
|
index("workflow_events_run_id_type_idx").on(table.runId, table.type),
|
|
7202
4188
|
index("workflow_events_correlation_id_idx").on(table.correlationId)
|
|
7203
4189
|
]);
|
|
7204
|
-
const
|
|
7205
|
-
|
|
7206
|
-
runId: text$1("run_id").notNull().references(() =>
|
|
4190
|
+
const workflowEventsSqlite = sqliteTable("workflow_events", {
|
|
4191
|
+
id: text$1("id").primaryKey(),
|
|
4192
|
+
runId: text$1("run_id").notNull().references(() => workflowRunsSqlite.id),
|
|
7207
4193
|
projectId: text$1("project_id").notNull(),
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
createdAt:
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
4194
|
+
seq: integer$1("seq").notNull(),
|
|
4195
|
+
type: text$1("type").$type().notNull(),
|
|
4196
|
+
correlationId: text$1("correlation_id"),
|
|
4197
|
+
data: text$1("data", { mode: "json" }),
|
|
4198
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull()
|
|
4199
|
+
}, (table) => [
|
|
4200
|
+
uniqueIndex$1("workflow_events_run_id_seq_unique").on(table.runId, table.seq),
|
|
4201
|
+
index$1("workflow_events_run_id_type_idx").on(table.runId, table.type),
|
|
4202
|
+
index$1("workflow_events_correlation_id_idx").on(table.correlationId)
|
|
4203
|
+
]);
|
|
4204
|
+
const workflowHooks = pgTable("workflow_hooks", {
|
|
7216
4205
|
hookId: text("hook_id").primaryKey(),
|
|
7217
|
-
runId: text("run_id").notNull().references(() =>
|
|
4206
|
+
runId: text("run_id").notNull().references(() => workflowRuns.id),
|
|
7218
4207
|
projectId: text("project_id").notNull(),
|
|
7219
4208
|
token: text("token").notNull(),
|
|
7220
4209
|
correlationId: text("correlation_id").notNull(),
|
|
7221
4210
|
status: text("status").$type().notNull(),
|
|
7222
|
-
payload:
|
|
7223
|
-
createdAt:
|
|
7224
|
-
resumedAt:
|
|
4211
|
+
payload: jsonb("payload"),
|
|
4212
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4213
|
+
resumedAt: timestamp("resumed_at", { withTimezone: true })
|
|
7225
4214
|
}, (table) => [uniqueIndex("workflow_hooks_token_unique").on(table.token), index("workflow_hooks_run_id_idx").on(table.runId)]);
|
|
7226
|
-
const
|
|
7227
|
-
|
|
4215
|
+
const workflowHooksSqlite = sqliteTable("workflow_hooks", {
|
|
4216
|
+
hookId: text$1("hook_id").primaryKey(),
|
|
4217
|
+
runId: text$1("run_id").notNull().references(() => workflowRunsSqlite.id),
|
|
7228
4218
|
projectId: text$1("project_id").notNull(),
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
ciphertext: text$1("ciphertext"),
|
|
7238
|
-
connectionId: text$1("connection_id"),
|
|
7239
|
-
/** MCP entity id that owns connection_id when multiple scopes share one connection. */
|
|
7240
|
-
sharedConnectionId: text$1("shared_connection_id"),
|
|
7241
|
-
grantedScopes: jsonb("granted_scopes").$type(),
|
|
7242
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7243
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7244
|
-
lastUsedAt: timestamp("last_used_at", { withTimezone: true })
|
|
7245
|
-
}, (table) => [uniqueIndex$1("credential_instances_project_scope_slug_unique").on(table.projectId, table.scopeType, table.scopeId, table.slug), index$1("credential_instances_project_app_slug_scope_idx").on(table.projectId, table.appSlug, table.scopeType, table.scopeId)]);
|
|
7246
|
-
const credentialInstancesSqlite = sqliteTable("credential_instances", {
|
|
4219
|
+
token: text$1("token").notNull(),
|
|
4220
|
+
correlationId: text$1("correlation_id").notNull(),
|
|
4221
|
+
status: text$1("status").$type().notNull(),
|
|
4222
|
+
payload: text$1("payload", { mode: "json" }),
|
|
4223
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4224
|
+
resumedAt: integer$1("resumed_at", { mode: "timestamp_ms" })
|
|
4225
|
+
}, (table) => [uniqueIndex$1("workflow_hooks_token_unique").on(table.token), index$1("workflow_hooks_run_id_idx").on(table.runId)]);
|
|
4226
|
+
const credentialInstances = pgTable("credential_instances", {
|
|
7247
4227
|
id: text("id").primaryKey(),
|
|
7248
4228
|
projectId: text("project_id").notNull(),
|
|
7249
4229
|
appSlug: text("app_slug").notNull(),
|
|
@@ -7252,89 +4232,95 @@ const credentialInstancesSqlite = sqliteTable("credential_instances", {
|
|
|
7252
4232
|
scopeType: text("scope_type").$type().notNull(),
|
|
7253
4233
|
scopeId: text("scope_id"),
|
|
7254
4234
|
label: text("label"),
|
|
7255
|
-
isDefault: integer("is_default"
|
|
4235
|
+
isDefault: integer("is_default").notNull(),
|
|
7256
4236
|
authKind: text("auth_kind").$type().notNull(),
|
|
7257
4237
|
ciphertext: text("ciphertext"),
|
|
7258
4238
|
connectionId: text("connection_id"),
|
|
7259
4239
|
/** MCP entity id that owns connection_id when multiple scopes share one connection. */
|
|
7260
4240
|
sharedConnectionId: text("shared_connection_id"),
|
|
7261
|
-
grantedScopes:
|
|
7262
|
-
createdAt:
|
|
7263
|
-
updatedAt:
|
|
7264
|
-
lastUsedAt:
|
|
4241
|
+
grantedScopes: jsonb("granted_scopes").$type(),
|
|
4242
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4243
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4244
|
+
lastUsedAt: timestamp("last_used_at", { withTimezone: true })
|
|
7265
4245
|
}, (table) => [uniqueIndex("credential_instances_project_scope_slug_unique").on(table.projectId, table.scopeType, table.scopeId, table.slug), index("credential_instances_project_app_slug_scope_idx").on(table.projectId, table.appSlug, table.scopeType, table.scopeId)]);
|
|
7266
|
-
const
|
|
4246
|
+
const credentialInstancesSqlite = sqliteTable("credential_instances", {
|
|
7267
4247
|
id: text$1("id").primaryKey(),
|
|
7268
4248
|
projectId: text$1("project_id").notNull(),
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
4249
|
+
appSlug: text$1("app_slug").notNull(),
|
|
4250
|
+
slug: text$1("slug").notNull(),
|
|
4251
|
+
name: text$1("name"),
|
|
4252
|
+
scopeType: text$1("scope_type").$type().notNull(),
|
|
4253
|
+
scopeId: text$1("scope_id"),
|
|
4254
|
+
label: text$1("label"),
|
|
4255
|
+
isDefault: integer$1("is_default", { mode: "boolean" }).notNull(),
|
|
4256
|
+
authKind: text$1("auth_kind").$type().notNull(),
|
|
4257
|
+
ciphertext: text$1("ciphertext"),
|
|
4258
|
+
connectionId: text$1("connection_id"),
|
|
4259
|
+
/** MCP entity id that owns connection_id when multiple scopes share one connection. */
|
|
4260
|
+
sharedConnectionId: text$1("shared_connection_id"),
|
|
4261
|
+
grantedScopes: text$1("granted_scopes", { mode: "json" }).$type(),
|
|
4262
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4263
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4264
|
+
lastUsedAt: integer$1("last_used_at", { mode: "timestamp_ms" })
|
|
4265
|
+
}, (table) => [uniqueIndex$1("credential_instances_project_scope_slug_unique").on(table.projectId, table.scopeType, table.scopeId, table.slug), index$1("credential_instances_project_app_slug_scope_idx").on(table.projectId, table.appSlug, table.scopeType, table.scopeId)]);
|
|
4266
|
+
const credentialAssignments = pgTable("credential_assignments", {
|
|
7279
4267
|
id: text("id").primaryKey(),
|
|
7280
4268
|
projectId: text("project_id").notNull(),
|
|
7281
4269
|
targetType: text("target_type").$type().notNull(),
|
|
7282
4270
|
targetKey: text("target_key").notNull(),
|
|
4271
|
+
/** '*' = wildcard; else runtime consumer id (step correlation id or tool slug). */
|
|
7283
4272
|
consumerId: text("consumer_id").notNull(),
|
|
7284
4273
|
credentialSlug: text("credential_slug").notNull(),
|
|
7285
4274
|
instanceId: text("instance_id").notNull(),
|
|
7286
|
-
createdAt:
|
|
7287
|
-
updatedAt:
|
|
4275
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4276
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7288
4277
|
}, (table) => [uniqueIndex("credential_assignments_project_target_consumer_slug").on(table.projectId, table.targetType, table.targetKey, table.consumerId, table.credentialSlug), index("credential_assignments_project_target_idx").on(table.projectId, table.targetType, table.targetKey)]);
|
|
7289
|
-
const
|
|
4278
|
+
const credentialAssignmentsSqlite = sqliteTable("credential_assignments", {
|
|
7290
4279
|
id: text$1("id").primaryKey(),
|
|
7291
4280
|
projectId: text$1("project_id").notNull(),
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
leasedBy: text$1("leased_by"),
|
|
7302
|
-
leaseExpiresAt: timestamp("lease_expires_at", { withTimezone: true }),
|
|
7303
|
-
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
7304
|
-
error: jsonb("error")
|
|
7305
|
-
});
|
|
7306
|
-
const jobsSqlite = sqliteTable("jobs", {
|
|
4281
|
+
targetType: text$1("target_type").$type().notNull(),
|
|
4282
|
+
targetKey: text$1("target_key").notNull(),
|
|
4283
|
+
consumerId: text$1("consumer_id").notNull(),
|
|
4284
|
+
credentialSlug: text$1("credential_slug").notNull(),
|
|
4285
|
+
instanceId: text$1("instance_id").notNull(),
|
|
4286
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4287
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4288
|
+
}, (table) => [uniqueIndex$1("credential_assignments_project_target_consumer_slug").on(table.projectId, table.targetType, table.targetKey, table.consumerId, table.credentialSlug), index$1("credential_assignments_project_target_idx").on(table.projectId, table.targetType, table.targetKey)]);
|
|
4289
|
+
const jobs = pgTable("jobs", {
|
|
7307
4290
|
id: text("id").primaryKey(),
|
|
7308
4291
|
projectId: text("project_id").notNull(),
|
|
7309
4292
|
kind: text("kind").$type().notNull(),
|
|
7310
4293
|
targetId: text("target_id").notNull(),
|
|
7311
4294
|
runId: text("run_id").notNull(),
|
|
7312
4295
|
trigger: text("trigger").$type().notNull(),
|
|
7313
|
-
payload:
|
|
4296
|
+
payload: jsonb("payload"),
|
|
7314
4297
|
status: text("status").$type().notNull(),
|
|
7315
|
-
scheduledAt:
|
|
4298
|
+
scheduledAt: timestamp("scheduled_at", { withTimezone: true }).notNull(),
|
|
7316
4299
|
attempt: integer("attempt").notNull(),
|
|
7317
4300
|
maxAttempts: integer("max_attempts").notNull(),
|
|
7318
4301
|
leasedBy: text("leased_by"),
|
|
7319
|
-
leaseExpiresAt:
|
|
7320
|
-
completedAt:
|
|
7321
|
-
error:
|
|
4302
|
+
leaseExpiresAt: timestamp("lease_expires_at", { withTimezone: true }),
|
|
4303
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
4304
|
+
error: jsonb("error")
|
|
7322
4305
|
});
|
|
7323
|
-
const
|
|
4306
|
+
const jobsSqlite = sqliteTable("jobs", {
|
|
7324
4307
|
id: text$1("id").primaryKey(),
|
|
7325
4308
|
projectId: text$1("project_id").notNull(),
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
4309
|
+
kind: text$1("kind").$type().notNull(),
|
|
4310
|
+
targetId: text$1("target_id").notNull(),
|
|
4311
|
+
runId: text$1("run_id").notNull(),
|
|
4312
|
+
trigger: text$1("trigger").$type().notNull(),
|
|
4313
|
+
payload: text$1("payload", { mode: "json" }),
|
|
4314
|
+
status: text$1("status").$type().notNull(),
|
|
4315
|
+
scheduledAt: integer$1("scheduled_at", { mode: "timestamp_ms" }).notNull(),
|
|
4316
|
+
attempt: integer$1("attempt").notNull(),
|
|
4317
|
+
maxAttempts: integer$1("max_attempts").notNull(),
|
|
4318
|
+
leasedBy: text$1("leased_by"),
|
|
4319
|
+
leaseExpiresAt: integer$1("lease_expires_at", { mode: "timestamp_ms" }),
|
|
4320
|
+
completedAt: integer$1("completed_at", { mode: "timestamp_ms" }),
|
|
4321
|
+
error: text$1("error", { mode: "json" })
|
|
4322
|
+
});
|
|
4323
|
+
const gatewayAttachments = pgTable("gateway_attachments", {
|
|
7338
4324
|
id: text("id").primaryKey(),
|
|
7339
4325
|
projectId: text("project_id").notNull(),
|
|
7340
4326
|
slug: text("slug").notNull(),
|
|
@@ -7343,41 +4329,42 @@ const gatewayAttachmentsSqlite = sqliteTable("gateway_attachments", {
|
|
|
7343
4329
|
platform: text("platform").notNull(),
|
|
7344
4330
|
teamId: text("team_id"),
|
|
7345
4331
|
channelId: text("channel_id").notNull(),
|
|
7346
|
-
source:
|
|
7347
|
-
registeredAt:
|
|
7348
|
-
updatedAt:
|
|
7349
|
-
deletedAt:
|
|
4332
|
+
source: jsonb("source").$type().notNull(),
|
|
4333
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
4334
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4335
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7350
4336
|
}, (table) => [uniqueIndex("gateway_attachments_project_id_slug_idx").on(table.projectId, table.slug), uniqueIndex("gateway_attachments_project_platform_channel_active").on(table.projectId, table.platform, table.channelId).where(sql`${table.deletedAt} is null`)]);
|
|
4337
|
+
const gatewayAttachmentsSqlite = sqliteTable("gateway_attachments", {
|
|
4338
|
+
id: text$1("id").primaryKey(),
|
|
4339
|
+
projectId: text$1("project_id").notNull(),
|
|
4340
|
+
slug: text$1("slug").notNull(),
|
|
4341
|
+
agentSlug: text$1("agent_slug").notNull(),
|
|
4342
|
+
moduleFile: text$1("module_file"),
|
|
4343
|
+
platform: text$1("platform").notNull(),
|
|
4344
|
+
teamId: text$1("team_id"),
|
|
4345
|
+
channelId: text$1("channel_id").notNull(),
|
|
4346
|
+
source: text$1("source", { mode: "json" }).$type().notNull(),
|
|
4347
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4348
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4349
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4350
|
+
}, (table) => [uniqueIndex$1("gateway_attachments_project_id_slug_idx").on(table.projectId, table.slug), uniqueIndex$1("gateway_attachments_project_platform_channel_active").on(table.projectId, table.platform, table.channelId).where(sql`${table.deletedAt} is null`)]);
|
|
7351
4351
|
const gatewayThreadSessions = pgTable("gateway_thread_sessions", {
|
|
7352
|
-
threadId: text
|
|
7353
|
-
agentId: text
|
|
7354
|
-
sessionId: text
|
|
7355
|
-
attachmentId: text
|
|
4352
|
+
threadId: text("thread_id").primaryKey(),
|
|
4353
|
+
agentId: text("agent_id").notNull().references(() => agents.id),
|
|
4354
|
+
sessionId: text("session_id").notNull().references(() => agentSessions.id),
|
|
4355
|
+
attachmentId: text("attachment_id").notNull().references(() => gatewayAttachments.id),
|
|
7356
4356
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7357
4357
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7358
4358
|
});
|
|
7359
4359
|
const gatewayThreadSessionsSqlite = sqliteTable("gateway_thread_sessions", {
|
|
7360
|
-
threadId: text("thread_id").primaryKey(),
|
|
7361
|
-
agentId: text("agent_id").notNull().references(() => agentsSqlite.id),
|
|
7362
|
-
sessionId: text("session_id").notNull().references(() => agentSessionsSqlite.id),
|
|
7363
|
-
attachmentId: text("attachment_id").notNull().references(() => gatewayAttachmentsSqlite.id),
|
|
7364
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
7365
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4360
|
+
threadId: text$1("thread_id").primaryKey(),
|
|
4361
|
+
agentId: text$1("agent_id").notNull().references(() => agentsSqlite.id),
|
|
4362
|
+
sessionId: text$1("session_id").notNull().references(() => agentSessionsSqlite.id),
|
|
4363
|
+
attachmentId: text$1("attachment_id").notNull().references(() => gatewayAttachmentsSqlite.id),
|
|
4364
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4365
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
7366
4366
|
});
|
|
7367
4367
|
const traceSpans = pgTable("trace_spans", {
|
|
7368
|
-
id: text$1("id").primaryKey(),
|
|
7369
|
-
traceId: text$1("trace_id").notNull(),
|
|
7370
|
-
parentSpanId: text$1("parent_span_id"),
|
|
7371
|
-
kind: text$1("kind").$type().notNull(),
|
|
7372
|
-
refId: text$1("ref_id").notNull(),
|
|
7373
|
-
name: text$1("name").notNull(),
|
|
7374
|
-
status: text$1("status").$type().notNull(),
|
|
7375
|
-
startedAt: timestamp("started_at", { withTimezone: true }).notNull(),
|
|
7376
|
-
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
7377
|
-
metadata: jsonb("metadata"),
|
|
7378
|
-
error: jsonb("error")
|
|
7379
|
-
});
|
|
7380
|
-
const traceSpansSqlite = sqliteTable("trace_spans", {
|
|
7381
4368
|
id: text("id").primaryKey(),
|
|
7382
4369
|
traceId: text("trace_id").notNull(),
|
|
7383
4370
|
parentSpanId: text("parent_span_id"),
|
|
@@ -7385,95 +4372,108 @@ const traceSpansSqlite = sqliteTable("trace_spans", {
|
|
|
7385
4372
|
refId: text("ref_id").notNull(),
|
|
7386
4373
|
name: text("name").notNull(),
|
|
7387
4374
|
status: text("status").$type().notNull(),
|
|
7388
|
-
startedAt:
|
|
7389
|
-
finishedAt:
|
|
7390
|
-
metadata:
|
|
7391
|
-
error:
|
|
4375
|
+
startedAt: timestamp("started_at", { withTimezone: true }).notNull(),
|
|
4376
|
+
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
4377
|
+
metadata: jsonb("metadata"),
|
|
4378
|
+
error: jsonb("error")
|
|
7392
4379
|
});
|
|
7393
|
-
const
|
|
4380
|
+
const traceSpansSqlite = sqliteTable("trace_spans", {
|
|
7394
4381
|
id: text$1("id").primaryKey(),
|
|
7395
|
-
traceId: text$1("trace_id").notNull(),
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
4382
|
+
traceId: text$1("trace_id").notNull(),
|
|
4383
|
+
parentSpanId: text$1("parent_span_id"),
|
|
4384
|
+
kind: text$1("kind").$type().notNull(),
|
|
4385
|
+
refId: text$1("ref_id").notNull(),
|
|
4386
|
+
name: text$1("name").notNull(),
|
|
4387
|
+
status: text$1("status").$type().notNull(),
|
|
4388
|
+
startedAt: integer$1("started_at", { mode: "timestamp_ms" }).notNull(),
|
|
4389
|
+
finishedAt: integer$1("finished_at", { mode: "timestamp_ms" }),
|
|
4390
|
+
metadata: text$1("metadata", { mode: "json" }),
|
|
4391
|
+
error: text$1("error", { mode: "json" })
|
|
4392
|
+
});
|
|
4393
|
+
const traceLogs = pgTable("trace_logs", {
|
|
7405
4394
|
id: text("id").primaryKey(),
|
|
7406
4395
|
traceId: text("trace_id").notNull(),
|
|
7407
|
-
spanId: text("span_id").notNull().references(() =>
|
|
4396
|
+
spanId: text("span_id").notNull().references(() => traceSpans.id),
|
|
7408
4397
|
seq: integer("seq").notNull(),
|
|
7409
4398
|
level: text("level").$type().notNull(),
|
|
7410
4399
|
message: text("message").notNull(),
|
|
7411
|
-
data:
|
|
4400
|
+
data: jsonb("data"),
|
|
7412
4401
|
source: text("source").$type().notNull(),
|
|
7413
|
-
createdAt:
|
|
4402
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
7414
4403
|
}, (table) => [index("trace_logs_trace_id_seq_idx").on(table.traceId, table.seq), index("trace_logs_span_id_seq_idx").on(table.spanId, table.seq)]);
|
|
7415
|
-
const
|
|
4404
|
+
const traceLogsSqlite = sqliteTable("trace_logs", {
|
|
7416
4405
|
id: text$1("id").primaryKey(),
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
}, (table) => [
|
|
7426
|
-
const
|
|
4406
|
+
traceId: text$1("trace_id").notNull(),
|
|
4407
|
+
spanId: text$1("span_id").notNull().references(() => traceSpansSqlite.id),
|
|
4408
|
+
seq: integer$1("seq").notNull(),
|
|
4409
|
+
level: text$1("level").$type().notNull(),
|
|
4410
|
+
message: text$1("message").notNull(),
|
|
4411
|
+
data: text$1("data", { mode: "json" }),
|
|
4412
|
+
source: text$1("source").$type().notNull(),
|
|
4413
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull()
|
|
4414
|
+
}, (table) => [index$1("trace_logs_trace_id_seq_idx").on(table.traceId, table.seq), index$1("trace_logs_span_id_seq_idx").on(table.spanId, table.seq)]);
|
|
4415
|
+
const skills = pgTable("skills", {
|
|
7427
4416
|
id: text("id").primaryKey(),
|
|
7428
4417
|
projectId: text("project_id").notNull(),
|
|
7429
4418
|
slug: text("slug").notNull(),
|
|
7430
4419
|
name: text("name"),
|
|
7431
4420
|
description: text("description"),
|
|
7432
4421
|
moduleFile: text("module_file").notNull(),
|
|
7433
|
-
registeredAt:
|
|
7434
|
-
updatedAt:
|
|
7435
|
-
deletedAt:
|
|
4422
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
4423
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4424
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7436
4425
|
}, (table) => [uniqueIndex("skills_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
7437
|
-
const
|
|
4426
|
+
const skillsSqlite = sqliteTable("skills", {
|
|
7438
4427
|
id: text$1("id").primaryKey(),
|
|
7439
4428
|
projectId: text$1("project_id").notNull(),
|
|
7440
4429
|
slug: text$1("slug").notNull(),
|
|
7441
4430
|
name: text$1("name"),
|
|
7442
4431
|
description: text$1("description"),
|
|
7443
4432
|
moduleFile: text$1("module_file").notNull(),
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
const workflowsSqlite = sqliteTable("workflows", {
|
|
4433
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4434
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4435
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4436
|
+
}, (table) => [uniqueIndex$1("skills_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
4437
|
+
const workflows = pgTable("workflows", {
|
|
7450
4438
|
id: text("id").primaryKey(),
|
|
7451
4439
|
projectId: text("project_id").notNull(),
|
|
7452
4440
|
slug: text("slug").notNull(),
|
|
7453
4441
|
name: text("name"),
|
|
7454
4442
|
description: text("description"),
|
|
7455
4443
|
moduleFile: text("module_file").notNull(),
|
|
7456
|
-
subscribable: integer("subscribable"
|
|
7457
|
-
registeredAt:
|
|
7458
|
-
updatedAt:
|
|
7459
|
-
deletedAt:
|
|
4444
|
+
subscribable: integer("subscribable").notNull(),
|
|
4445
|
+
registeredAt: timestamp("registered_at", { withTimezone: true }).notNull(),
|
|
4446
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4447
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7460
4448
|
}, (table) => [uniqueIndex("workflows_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
7461
|
-
const
|
|
4449
|
+
const workflowsSqlite = sqliteTable("workflows", {
|
|
7462
4450
|
id: text$1("id").primaryKey(),
|
|
7463
4451
|
projectId: text$1("project_id").notNull(),
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
4452
|
+
slug: text$1("slug").notNull(),
|
|
4453
|
+
name: text$1("name"),
|
|
4454
|
+
description: text$1("description"),
|
|
4455
|
+
moduleFile: text$1("module_file").notNull(),
|
|
4456
|
+
subscribable: integer$1("subscribable", { mode: "boolean" }).notNull(),
|
|
4457
|
+
registeredAt: integer$1("registered_at", { mode: "timestamp_ms" }).notNull(),
|
|
4458
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4459
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4460
|
+
}, (table) => [uniqueIndex$1("workflows_project_id_slug_idx").on(table.projectId, table.slug)]);
|
|
4461
|
+
const resourceActivity = pgTable("resource_activity", {
|
|
7470
4462
|
id: text("id").primaryKey(),
|
|
7471
4463
|
projectId: text("project_id").notNull(),
|
|
7472
4464
|
userId: text("user_id").notNull(),
|
|
7473
4465
|
resourceKind: text("resource_kind").notNull(),
|
|
7474
4466
|
resourceId: text("resource_id").notNull(),
|
|
7475
|
-
lastOpenedAt:
|
|
4467
|
+
lastOpenedAt: timestamp("last_opened_at", { withTimezone: true }).notNull()
|
|
7476
4468
|
}, (table) => [uniqueIndex("resource_activity_project_user_kind_resource").on(table.projectId, table.userId, table.resourceKind, table.resourceId), index("resource_activity_user_last_opened_at").on(table.userId, table.lastOpenedAt)]);
|
|
4469
|
+
const resourceActivitySqlite = sqliteTable("resource_activity", {
|
|
4470
|
+
id: text$1("id").primaryKey(),
|
|
4471
|
+
projectId: text$1("project_id").notNull(),
|
|
4472
|
+
userId: text$1("user_id").notNull(),
|
|
4473
|
+
resourceKind: text$1("resource_kind").notNull(),
|
|
4474
|
+
resourceId: text$1("resource_id").notNull(),
|
|
4475
|
+
lastOpenedAt: integer$1("last_opened_at", { mode: "timestamp_ms" }).notNull()
|
|
4476
|
+
}, (table) => [uniqueIndex$1("resource_activity_project_user_kind_resource").on(table.projectId, table.userId, table.resourceKind, table.resourceId), index$1("resource_activity_user_last_opened_at").on(table.userId, table.lastOpenedAt)]);
|
|
7477
4477
|
/**
|
|
7478
4478
|
* Project server tables — Postgres (hosted) or SQLite (local dev).
|
|
7479
4479
|
*/
|
|
@@ -7566,131 +4566,220 @@ const tableRegistry$1 = {
|
|
|
7566
4566
|
buildPgSchema$1(tableRegistry$1);
|
|
7567
4567
|
buildSqliteSchema$1(tableRegistry$1);
|
|
7568
4568
|
//#endregion
|
|
7569
|
-
//#region ../../packages/platform-database/dist/
|
|
4569
|
+
//#region ../../packages/platform-database/dist/mcp-oauth-SRTcHMWZ.mjs
|
|
7570
4570
|
const users = pgTable("users", {
|
|
7571
|
-
id: text
|
|
7572
|
-
name: text
|
|
7573
|
-
email: text
|
|
4571
|
+
id: text("id").primaryKey(),
|
|
4572
|
+
name: text("name").notNull(),
|
|
4573
|
+
email: text("email").notNull().unique(),
|
|
7574
4574
|
emailVerified: boolean("email_verified").notNull(),
|
|
7575
|
-
image: text
|
|
4575
|
+
image: text("image"),
|
|
7576
4576
|
preferences: jsonb("preferences"),
|
|
7577
4577
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7578
4578
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7579
4579
|
});
|
|
7580
4580
|
const usersSqlite = sqliteTable("users", {
|
|
7581
|
-
id: text("id").primaryKey(),
|
|
7582
|
-
name: text("name").notNull(),
|
|
7583
|
-
email: text("email").notNull().unique(),
|
|
7584
|
-
emailVerified: integer("email_verified", { mode: "boolean" }).notNull(),
|
|
7585
|
-
image: text("image"),
|
|
7586
|
-
preferences: text("preferences", { mode: "json" }),
|
|
7587
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
7588
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4581
|
+
id: text$1("id").primaryKey(),
|
|
4582
|
+
name: text$1("name").notNull(),
|
|
4583
|
+
email: text$1("email").notNull().unique(),
|
|
4584
|
+
emailVerified: integer$1("email_verified", { mode: "boolean" }).notNull(),
|
|
4585
|
+
image: text$1("image"),
|
|
4586
|
+
preferences: text$1("preferences", { mode: "json" }),
|
|
4587
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4588
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
7589
4589
|
});
|
|
7590
4590
|
const authAccounts = pgTable("accounts", {
|
|
7591
|
-
id: text$1("id").primaryKey(),
|
|
7592
|
-
accountId: text$1("account_id").notNull(),
|
|
7593
|
-
providerId: text$1("provider_id").notNull(),
|
|
7594
|
-
userId: text$1("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
7595
|
-
accessToken: text$1("access_token"),
|
|
7596
|
-
refreshToken: text$1("refresh_token"),
|
|
7597
|
-
idToken: text$1("id_token"),
|
|
7598
|
-
accessTokenExpiresAt: timestamp("access_token_expires_at", { withTimezone: true }),
|
|
7599
|
-
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", { withTimezone: true }),
|
|
7600
|
-
scope: text$1("scope"),
|
|
7601
|
-
password: text$1("password"),
|
|
7602
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7603
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7604
|
-
}, (table) => [index$1("account_user_id_idx").on(table.userId)]);
|
|
7605
|
-
const authAccountsSqlite = sqliteTable("accounts", {
|
|
7606
4591
|
id: text("id").primaryKey(),
|
|
7607
4592
|
accountId: text("account_id").notNull(),
|
|
7608
4593
|
providerId: text("provider_id").notNull(),
|
|
7609
|
-
userId: text("user_id").notNull().references(() =>
|
|
4594
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
7610
4595
|
accessToken: text("access_token"),
|
|
7611
4596
|
refreshToken: text("refresh_token"),
|
|
7612
4597
|
idToken: text("id_token"),
|
|
7613
|
-
accessTokenExpiresAt:
|
|
7614
|
-
refreshTokenExpiresAt:
|
|
4598
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", { withTimezone: true }),
|
|
4599
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", { withTimezone: true }),
|
|
7615
4600
|
scope: text("scope"),
|
|
7616
4601
|
password: text("password"),
|
|
7617
|
-
createdAt:
|
|
7618
|
-
updatedAt:
|
|
4602
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4603
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7619
4604
|
}, (table) => [index("account_user_id_idx").on(table.userId)]);
|
|
7620
|
-
const
|
|
4605
|
+
const authAccountsSqlite = sqliteTable("accounts", {
|
|
7621
4606
|
id: text$1("id").primaryKey(),
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
userId: text$1("user_id"),
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
scope: text$1("scope")
|
|
7631
|
-
|
|
7632
|
-
|
|
4607
|
+
accountId: text$1("account_id").notNull(),
|
|
4608
|
+
providerId: text$1("provider_id").notNull(),
|
|
4609
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
4610
|
+
accessToken: text$1("access_token"),
|
|
4611
|
+
refreshToken: text$1("refresh_token"),
|
|
4612
|
+
idToken: text$1("id_token"),
|
|
4613
|
+
accessTokenExpiresAt: integer$1("access_token_expires_at", { mode: "timestamp_ms" }),
|
|
4614
|
+
refreshTokenExpiresAt: integer$1("refresh_token_expires_at", { mode: "timestamp_ms" }),
|
|
4615
|
+
scope: text$1("scope"),
|
|
4616
|
+
password: text$1("password"),
|
|
4617
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4618
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4619
|
+
}, (table) => [index$1("account_user_id_idx").on(table.userId)]);
|
|
4620
|
+
const authDeviceCodes = pgTable("device_auth_codes", {
|
|
7633
4621
|
id: text("id").primaryKey(),
|
|
7634
4622
|
deviceCode: text("device_code").notNull(),
|
|
7635
4623
|
userCode: text("user_code").notNull(),
|
|
7636
4624
|
userId: text("user_id"),
|
|
7637
|
-
expiresAt:
|
|
4625
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
7638
4626
|
status: text("status").notNull(),
|
|
7639
|
-
lastPolledAt:
|
|
4627
|
+
lastPolledAt: timestamp("last_polled_at", { withTimezone: true }),
|
|
7640
4628
|
pollingInterval: integer("polling_interval"),
|
|
7641
4629
|
clientId: text("client_id"),
|
|
7642
4630
|
scope: text("scope")
|
|
7643
4631
|
});
|
|
7644
|
-
const
|
|
4632
|
+
const authDeviceCodesSqlite = sqliteTable("device_auth_codes", {
|
|
7645
4633
|
id: text$1("id").primaryKey(),
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
expiresAt:
|
|
4634
|
+
deviceCode: text$1("device_code").notNull(),
|
|
4635
|
+
userCode: text$1("user_code").notNull(),
|
|
4636
|
+
userId: text$1("user_id"),
|
|
4637
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" }).notNull(),
|
|
4638
|
+
status: text$1("status").notNull(),
|
|
4639
|
+
lastPolledAt: integer$1("last_polled_at", { mode: "timestamp_ms" }),
|
|
4640
|
+
pollingInterval: integer$1("polling_interval"),
|
|
4641
|
+
clientId: text$1("client_id"),
|
|
4642
|
+
scope: text$1("scope")
|
|
7650
4643
|
});
|
|
7651
|
-
const
|
|
4644
|
+
const authJwks = pgTable("jwks", {
|
|
7652
4645
|
id: text("id").primaryKey(),
|
|
7653
4646
|
publicKey: text("public_key").notNull(),
|
|
7654
4647
|
privateKey: text("private_key").notNull(),
|
|
7655
|
-
createdAt:
|
|
7656
|
-
expiresAt:
|
|
4648
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4649
|
+
expiresAt: timestamp("expires_at", { withTimezone: true })
|
|
7657
4650
|
});
|
|
7658
|
-
const
|
|
4651
|
+
const authJwksSqlite = sqliteTable("jwks", {
|
|
7659
4652
|
id: text$1("id").primaryKey(),
|
|
4653
|
+
publicKey: text$1("public_key").notNull(),
|
|
4654
|
+
privateKey: text$1("private_key").notNull(),
|
|
4655
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4656
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" })
|
|
4657
|
+
});
|
|
4658
|
+
const authSessions = pgTable("sessions", {
|
|
4659
|
+
id: text("id").primaryKey(),
|
|
7660
4660
|
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
7661
|
-
token: text
|
|
4661
|
+
token: text("token").notNull().unique(),
|
|
7662
4662
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7663
4663
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7664
|
-
ipAddress: text$1("ip_address"),
|
|
7665
|
-
userAgent: text$1("user_agent"),
|
|
7666
|
-
userId: text$1("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
|
|
7667
|
-
}, (table) => [index$1("session_user_id_idx").on(table.userId)]);
|
|
7668
|
-
const authSessionsSqlite = sqliteTable("sessions", {
|
|
7669
|
-
id: text("id").primaryKey(),
|
|
7670
|
-
expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),
|
|
7671
|
-
token: text("token").notNull().unique(),
|
|
7672
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
7673
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
7674
4664
|
ipAddress: text("ip_address"),
|
|
7675
4665
|
userAgent: text("user_agent"),
|
|
7676
|
-
userId: text("user_id").notNull().references(() =>
|
|
4666
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" })
|
|
7677
4667
|
}, (table) => [index("session_user_id_idx").on(table.userId)]);
|
|
4668
|
+
const authSessionsSqlite = sqliteTable("sessions", {
|
|
4669
|
+
id: text$1("id").primaryKey(),
|
|
4670
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" }).notNull(),
|
|
4671
|
+
token: text$1("token").notNull().unique(),
|
|
4672
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4673
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4674
|
+
ipAddress: text$1("ip_address"),
|
|
4675
|
+
userAgent: text$1("user_agent"),
|
|
4676
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" })
|
|
4677
|
+
}, (table) => [index$1("session_user_id_idx").on(table.userId)]);
|
|
7678
4678
|
const authVerifications = pgTable("verification", {
|
|
4679
|
+
id: text("id").primaryKey(),
|
|
4680
|
+
identifier: text("identifier").notNull(),
|
|
4681
|
+
value: text("value").notNull(),
|
|
4682
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
|
|
4683
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4684
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
4685
|
+
}, (table) => [index("verification_identifier_idx").on(table.identifier)]);
|
|
4686
|
+
const authVerificationsSqlite = sqliteTable("verification", {
|
|
7679
4687
|
id: text$1("id").primaryKey(),
|
|
7680
4688
|
identifier: text$1("identifier").notNull(),
|
|
7681
4689
|
value: text$1("value").notNull(),
|
|
7682
|
-
expiresAt:
|
|
4690
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" }).notNull(),
|
|
4691
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4692
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4693
|
+
}, (table) => [index$1("verification_identifier_idx").on(table.identifier)]);
|
|
4694
|
+
/**
|
|
4695
|
+
* Tables backing keystroke as an OAuth 2.1 Authorization Server for the
|
|
4696
|
+
* Universal MCP server: dynamically-registered MCP/AI clients, their issued
|
|
4697
|
+
* access/refresh tokens, and consent records.
|
|
4698
|
+
*
|
|
4699
|
+
* NOT to be confused with `oauth_apps` / `oauth_connections`, which model the
|
|
4700
|
+
* inverse — keystroke as an OAuth *client* storing our users' connections to
|
|
4701
|
+
* third-party providers. These `mcp_oauth_*` tables are the provider side.
|
|
4702
|
+
*
|
|
4703
|
+
* Wired to Better Auth via the Drizzle adapter (`authSchemaFor`). Better Auth
|
|
4704
|
+
* addresses these by its fixed model names (`oauthApplication`,
|
|
4705
|
+
* `oauthAccessToken`, `oauthConsent`) and by field name (the JS property keys
|
|
4706
|
+
* below); the physical table/column names are ours to choose.
|
|
4707
|
+
*
|
|
4708
|
+
* Note: access/refresh tokens are stored as opaque plaintext bearer strings
|
|
4709
|
+
* (the Better Auth mcp plugin looks them up directly and cannot hash them),
|
|
4710
|
+
* consistent with how the `sessions` table stores session tokens. They are
|
|
4711
|
+
* short-lived; rely on DB access controls + at-rest encryption.
|
|
4712
|
+
*/
|
|
4713
|
+
const mcpOauthClient = pgTable("mcp_oauth_client", {
|
|
4714
|
+
id: text("id").primaryKey(),
|
|
4715
|
+
name: text("name").notNull(),
|
|
4716
|
+
icon: text("icon"),
|
|
4717
|
+
metadata: text("metadata"),
|
|
4718
|
+
clientId: text("client_id").notNull().unique(),
|
|
4719
|
+
clientSecret: text("client_secret"),
|
|
4720
|
+
redirectUrls: text("redirect_urls").notNull(),
|
|
4721
|
+
type: text("type").notNull(),
|
|
4722
|
+
disabled: boolean("disabled").notNull().default(false),
|
|
4723
|
+
userId: text("user_id").references(() => users.id, { onDelete: "cascade" }),
|
|
7683
4724
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7684
4725
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7685
|
-
}, (table) => [index
|
|
7686
|
-
const
|
|
4726
|
+
}, (table) => [index("mcp_oauth_client_user_id_idx").on(table.userId)]);
|
|
4727
|
+
const mcpOauthClientSqlite = sqliteTable("mcp_oauth_client", {
|
|
4728
|
+
id: text$1("id").primaryKey(),
|
|
4729
|
+
name: text$1("name").notNull(),
|
|
4730
|
+
icon: text$1("icon"),
|
|
4731
|
+
metadata: text$1("metadata"),
|
|
4732
|
+
clientId: text$1("client_id").notNull().unique(),
|
|
4733
|
+
clientSecret: text$1("client_secret"),
|
|
4734
|
+
redirectUrls: text$1("redirect_urls").notNull(),
|
|
4735
|
+
type: text$1("type").notNull(),
|
|
4736
|
+
disabled: integer$1("disabled", { mode: "boolean" }).notNull().default(false),
|
|
4737
|
+
userId: text$1("user_id").references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
4738
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4739
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4740
|
+
}, (table) => [index$1("mcp_oauth_client_user_id_idx").on(table.userId)]);
|
|
4741
|
+
const mcpOauthAccessToken = pgTable("mcp_oauth_access_token", {
|
|
7687
4742
|
id: text("id").primaryKey(),
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
4743
|
+
accessToken: text("access_token").notNull().unique(),
|
|
4744
|
+
refreshToken: text("refresh_token").unique(),
|
|
4745
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at", { withTimezone: true }),
|
|
4746
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at", { withTimezone: true }),
|
|
4747
|
+
clientId: text("client_id").notNull(),
|
|
4748
|
+
userId: text("user_id").references(() => users.id, { onDelete: "cascade" }),
|
|
4749
|
+
scopes: text("scopes"),
|
|
4750
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4751
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
4752
|
+
}, (table) => [index("mcp_oauth_access_token_client_id_idx").on(table.clientId), index("mcp_oauth_access_token_user_id_idx").on(table.userId)]);
|
|
4753
|
+
const mcpOauthAccessTokenSqlite = sqliteTable("mcp_oauth_access_token", {
|
|
4754
|
+
id: text$1("id").primaryKey(),
|
|
4755
|
+
accessToken: text$1("access_token").notNull().unique(),
|
|
4756
|
+
refreshToken: text$1("refresh_token").unique(),
|
|
4757
|
+
accessTokenExpiresAt: integer$1("access_token_expires_at", { mode: "timestamp_ms" }),
|
|
4758
|
+
refreshTokenExpiresAt: integer$1("refresh_token_expires_at", { mode: "timestamp_ms" }),
|
|
4759
|
+
clientId: text$1("client_id").notNull(),
|
|
4760
|
+
userId: text$1("user_id").references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
4761
|
+
scopes: text$1("scopes"),
|
|
4762
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4763
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4764
|
+
}, (table) => [index$1("mcp_oauth_access_token_client_id_idx").on(table.clientId), index$1("mcp_oauth_access_token_user_id_idx").on(table.userId)]);
|
|
4765
|
+
const mcpOauthConsent = pgTable("mcp_oauth_consent", {
|
|
4766
|
+
id: text("id").primaryKey(),
|
|
4767
|
+
clientId: text("client_id").notNull(),
|
|
4768
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
4769
|
+
scopes: text("scopes"),
|
|
4770
|
+
consentGiven: boolean("consent_given").notNull().default(false),
|
|
4771
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4772
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
4773
|
+
}, (table) => [index("mcp_oauth_consent_client_id_idx").on(table.clientId), index("mcp_oauth_consent_user_id_idx").on(table.userId)]);
|
|
4774
|
+
const mcpOauthConsentSqlite = sqliteTable("mcp_oauth_consent", {
|
|
4775
|
+
id: text$1("id").primaryKey(),
|
|
4776
|
+
clientId: text$1("client_id").notNull(),
|
|
4777
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
4778
|
+
scopes: text$1("scopes"),
|
|
4779
|
+
consentGiven: integer$1("consent_given", { mode: "boolean" }).notNull().default(false),
|
|
4780
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4781
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4782
|
+
}, (table) => [index$1("mcp_oauth_consent_client_id_idx").on(table.clientId), index$1("mcp_oauth_consent_user_id_idx").on(table.userId)]);
|
|
7694
4783
|
createRequire(import.meta.url);
|
|
7695
4784
|
function buildPgSchema(registry) {
|
|
7696
4785
|
return Object.fromEntries(Object.entries(registry).map(([name, { pg }]) => [name, pg]));
|
|
@@ -7700,92 +4789,66 @@ function buildSqliteSchema(registry) {
|
|
|
7700
4789
|
}
|
|
7701
4790
|
/** Better Auth API Key shape (`apikey` model → physical `api_keys`). */
|
|
7702
4791
|
const authApiKeys = pgTable("api_keys", {
|
|
7703
|
-
id: text$1("id").primaryKey(),
|
|
7704
|
-
configId: text$1("config_id").notNull().default("default"),
|
|
7705
|
-
name: text$1("name"),
|
|
7706
|
-
start: text$1("start"),
|
|
7707
|
-
prefix: text$1("prefix"),
|
|
7708
|
-
/** Hashed secret for verification (Better Auth `key`). */
|
|
7709
|
-
key: text$1("key").notNull(),
|
|
7710
|
-
/** Encrypted plaintext secret — keystroke extension for re-display. */
|
|
7711
|
-
keyCiphertext: text$1("key_ciphertext"),
|
|
7712
|
-
referenceId: text$1("reference_id").notNull(),
|
|
7713
|
-
refillInterval: integer$1("refill_interval"),
|
|
7714
|
-
refillAmount: integer$1("refill_amount"),
|
|
7715
|
-
lastRefillAt: timestamp("last_refill_at", { withTimezone: true }),
|
|
7716
|
-
enabled: boolean("enabled").default(true),
|
|
7717
|
-
rateLimitEnabled: boolean("rate_limit_enabled").default(true),
|
|
7718
|
-
rateLimitTimeWindow: integer$1("rate_limit_time_window"),
|
|
7719
|
-
rateLimitMax: integer$1("rate_limit_max"),
|
|
7720
|
-
requestCount: integer$1("request_count").default(0),
|
|
7721
|
-
remaining: integer$1("remaining"),
|
|
7722
|
-
lastRequest: timestamp("last_request", { withTimezone: true }),
|
|
7723
|
-
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
7724
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7725
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7726
|
-
permissions: text$1("permissions"),
|
|
7727
|
-
metadata: text$1("metadata")
|
|
7728
|
-
}, (table) => [
|
|
7729
|
-
index$1("api_keys_reference_id_idx").on(table.referenceId),
|
|
7730
|
-
index$1("api_keys_config_id_idx").on(table.configId),
|
|
7731
|
-
index$1("api_keys_key_idx").on(table.key)
|
|
7732
|
-
]);
|
|
7733
|
-
const authApiKeysSqlite = sqliteTable("api_keys", {
|
|
7734
4792
|
id: text("id").primaryKey(),
|
|
7735
4793
|
configId: text("config_id").notNull().default("default"),
|
|
7736
4794
|
name: text("name"),
|
|
7737
4795
|
start: text("start"),
|
|
7738
4796
|
prefix: text("prefix"),
|
|
4797
|
+
/** Hashed secret for verification (Better Auth `key`). */
|
|
7739
4798
|
key: text("key").notNull(),
|
|
4799
|
+
/** Encrypted plaintext secret — keystroke extension for re-display. */
|
|
7740
4800
|
keyCiphertext: text("key_ciphertext"),
|
|
7741
4801
|
referenceId: text("reference_id").notNull(),
|
|
7742
4802
|
refillInterval: integer("refill_interval"),
|
|
7743
4803
|
refillAmount: integer("refill_amount"),
|
|
7744
|
-
lastRefillAt:
|
|
7745
|
-
enabled:
|
|
7746
|
-
rateLimitEnabled:
|
|
4804
|
+
lastRefillAt: timestamp("last_refill_at", { withTimezone: true }),
|
|
4805
|
+
enabled: boolean("enabled").default(true),
|
|
4806
|
+
rateLimitEnabled: boolean("rate_limit_enabled").default(true),
|
|
7747
4807
|
rateLimitTimeWindow: integer("rate_limit_time_window"),
|
|
7748
4808
|
rateLimitMax: integer("rate_limit_max"),
|
|
7749
4809
|
requestCount: integer("request_count").default(0),
|
|
7750
4810
|
remaining: integer("remaining"),
|
|
7751
|
-
lastRequest:
|
|
7752
|
-
expiresAt:
|
|
7753
|
-
createdAt:
|
|
7754
|
-
updatedAt:
|
|
4811
|
+
lastRequest: timestamp("last_request", { withTimezone: true }),
|
|
4812
|
+
expiresAt: timestamp("expires_at", { withTimezone: true }),
|
|
4813
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4814
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7755
4815
|
permissions: text("permissions"),
|
|
7756
4816
|
metadata: text("metadata")
|
|
7757
4817
|
}, (table) => [
|
|
7758
|
-
index("api_keys_reference_id_idx").on(table.referenceId),
|
|
7759
|
-
index("api_keys_config_id_idx").on(table.configId),
|
|
7760
|
-
index("api_keys_key_idx").on(table.key)
|
|
4818
|
+
index("api_keys_reference_id_idx").on(table.referenceId),
|
|
4819
|
+
index("api_keys_config_id_idx").on(table.configId),
|
|
4820
|
+
index("api_keys_key_idx").on(table.key)
|
|
4821
|
+
]);
|
|
4822
|
+
const authApiKeysSqlite = sqliteTable("api_keys", {
|
|
4823
|
+
id: text$1("id").primaryKey(),
|
|
4824
|
+
configId: text$1("config_id").notNull().default("default"),
|
|
4825
|
+
name: text$1("name"),
|
|
4826
|
+
start: text$1("start"),
|
|
4827
|
+
prefix: text$1("prefix"),
|
|
4828
|
+
key: text$1("key").notNull(),
|
|
4829
|
+
keyCiphertext: text$1("key_ciphertext"),
|
|
4830
|
+
referenceId: text$1("reference_id").notNull(),
|
|
4831
|
+
refillInterval: integer$1("refill_interval"),
|
|
4832
|
+
refillAmount: integer$1("refill_amount"),
|
|
4833
|
+
lastRefillAt: integer$1("last_refill_at", { mode: "timestamp_ms" }),
|
|
4834
|
+
enabled: integer$1("enabled", { mode: "boolean" }).default(true),
|
|
4835
|
+
rateLimitEnabled: integer$1("rate_limit_enabled", { mode: "boolean" }).default(true),
|
|
4836
|
+
rateLimitTimeWindow: integer$1("rate_limit_time_window"),
|
|
4837
|
+
rateLimitMax: integer$1("rate_limit_max"),
|
|
4838
|
+
requestCount: integer$1("request_count").default(0),
|
|
4839
|
+
remaining: integer$1("remaining"),
|
|
4840
|
+
lastRequest: integer$1("last_request", { mode: "timestamp_ms" }),
|
|
4841
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" }),
|
|
4842
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4843
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4844
|
+
permissions: text$1("permissions"),
|
|
4845
|
+
metadata: text$1("metadata")
|
|
4846
|
+
}, (table) => [
|
|
4847
|
+
index$1("api_keys_reference_id_idx").on(table.referenceId),
|
|
4848
|
+
index$1("api_keys_config_id_idx").on(table.configId),
|
|
4849
|
+
index$1("api_keys_key_idx").on(table.key)
|
|
7761
4850
|
]);
|
|
7762
4851
|
const organizations = pgTable("organizations", {
|
|
7763
|
-
id: text$1("id").primaryKey(),
|
|
7764
|
-
name: text$1("name").notNull(),
|
|
7765
|
-
slug: text$1("slug").notNull(),
|
|
7766
|
-
dbSchema: text$1("db_schema").notNull(),
|
|
7767
|
-
dbUser: text$1("db_user").notNull(),
|
|
7768
|
-
dbPasswordCiphertext: text$1("db_password_ciphertext").notNull(),
|
|
7769
|
-
hostingAppName: text$1("hosting_app_name"),
|
|
7770
|
-
runtimeId: text$1("runtime_id"),
|
|
7771
|
-
baseUrl: text$1("base_url"),
|
|
7772
|
-
storageBucket: text$1("storage_bucket"),
|
|
7773
|
-
storageEndpoint: text$1("storage_endpoint"),
|
|
7774
|
-
storageAccessKeyIdCiphertext: text$1("storage_access_key_id_ciphertext"),
|
|
7775
|
-
storageSecretAccessKeyCiphertext: text$1("storage_secret_access_key_ciphertext"),
|
|
7776
|
-
storageRegion: text$1("storage_region"),
|
|
7777
|
-
storageForcePathStyle: boolean("storage_force_path_style"),
|
|
7778
|
-
customLogoEnabled: boolean("custom_logo_enabled").notNull().default(false),
|
|
7779
|
-
customLogoExplicitlyDisabled: boolean("custom_logo_explicitly_disabled").notNull().default(false),
|
|
7780
|
-
logoLightUrl: text$1("logo_light_url"),
|
|
7781
|
-
logoDarkUrl: text$1("logo_dark_url"),
|
|
7782
|
-
logoHeightPx: integer$1("logo_height_px").notNull().default(20),
|
|
7783
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7784
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7785
|
-
verifiedAt: timestamp("verified_at", { withTimezone: true }),
|
|
7786
|
-
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7787
|
-
}, (table) => [uniqueIndex$1("organizations_slug_unique").on(table.slug)]);
|
|
7788
|
-
const organizationsSqlite = sqliteTable("organizations", {
|
|
7789
4852
|
id: text("id").primaryKey(),
|
|
7790
4853
|
name: text("name").notNull(),
|
|
7791
4854
|
slug: text("slug").notNull(),
|
|
@@ -7800,66 +4863,78 @@ const organizationsSqlite = sqliteTable("organizations", {
|
|
|
7800
4863
|
storageAccessKeyIdCiphertext: text("storage_access_key_id_ciphertext"),
|
|
7801
4864
|
storageSecretAccessKeyCiphertext: text("storage_secret_access_key_ciphertext"),
|
|
7802
4865
|
storageRegion: text("storage_region"),
|
|
7803
|
-
storageForcePathStyle:
|
|
7804
|
-
customLogoEnabled:
|
|
7805
|
-
customLogoExplicitlyDisabled:
|
|
4866
|
+
storageForcePathStyle: boolean("storage_force_path_style"),
|
|
4867
|
+
customLogoEnabled: boolean("custom_logo_enabled").notNull().default(false),
|
|
4868
|
+
customLogoExplicitlyDisabled: boolean("custom_logo_explicitly_disabled").notNull().default(false),
|
|
7806
4869
|
logoLightUrl: text("logo_light_url"),
|
|
7807
4870
|
logoDarkUrl: text("logo_dark_url"),
|
|
7808
4871
|
logoHeightPx: integer("logo_height_px").notNull().default(20),
|
|
7809
|
-
createdAt:
|
|
7810
|
-
updatedAt:
|
|
7811
|
-
verifiedAt:
|
|
7812
|
-
deletedAt:
|
|
4872
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4873
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
4874
|
+
verifiedAt: timestamp("verified_at", { withTimezone: true }),
|
|
4875
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7813
4876
|
}, (table) => [uniqueIndex("organizations_slug_unique").on(table.slug)]);
|
|
7814
|
-
const
|
|
4877
|
+
const organizationsSqlite = sqliteTable("organizations", {
|
|
7815
4878
|
id: text$1("id").primaryKey(),
|
|
7816
|
-
organizationId: text$1("organization_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
7817
|
-
slug: text$1("slug").notNull(),
|
|
7818
4879
|
name: text$1("name").notNull(),
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
4880
|
+
slug: text$1("slug").notNull(),
|
|
4881
|
+
dbSchema: text$1("db_schema").notNull(),
|
|
4882
|
+
dbUser: text$1("db_user").notNull(),
|
|
4883
|
+
dbPasswordCiphertext: text$1("db_password_ciphertext").notNull(),
|
|
4884
|
+
hostingAppName: text$1("hosting_app_name"),
|
|
4885
|
+
runtimeId: text$1("runtime_id"),
|
|
4886
|
+
baseUrl: text$1("base_url"),
|
|
4887
|
+
storageBucket: text$1("storage_bucket"),
|
|
4888
|
+
storageEndpoint: text$1("storage_endpoint"),
|
|
4889
|
+
storageAccessKeyIdCiphertext: text$1("storage_access_key_id_ciphertext"),
|
|
4890
|
+
storageSecretAccessKeyCiphertext: text$1("storage_secret_access_key_ciphertext"),
|
|
4891
|
+
storageRegion: text$1("storage_region"),
|
|
4892
|
+
storageForcePathStyle: integer$1("storage_force_path_style", { mode: "boolean" }),
|
|
4893
|
+
customLogoEnabled: integer$1("custom_logo_enabled", { mode: "boolean" }).notNull().default(false),
|
|
4894
|
+
customLogoExplicitlyDisabled: integer$1("custom_logo_explicitly_disabled", { mode: "boolean" }).notNull().default(false),
|
|
4895
|
+
logoLightUrl: text$1("logo_light_url"),
|
|
4896
|
+
logoDarkUrl: text$1("logo_dark_url"),
|
|
4897
|
+
logoHeightPx: integer$1("logo_height_px").notNull().default(20),
|
|
4898
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4899
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
4900
|
+
verifiedAt: integer$1("verified_at", { mode: "timestamp_ms" }),
|
|
4901
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
4902
|
+
}, (table) => [uniqueIndex$1("organizations_slug_unique").on(table.slug)]);
|
|
4903
|
+
const apps = pgTable("apps", {
|
|
7831
4904
|
id: text("id").primaryKey(),
|
|
7832
|
-
organizationId: text("organization_id").references(() =>
|
|
4905
|
+
organizationId: text("organization_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
7833
4906
|
slug: text("slug").notNull(),
|
|
7834
4907
|
name: text("name").notNull(),
|
|
7835
4908
|
description: text("description").notNull(),
|
|
7836
4909
|
category: text("category").notNull(),
|
|
7837
4910
|
logo: text("logo"),
|
|
7838
4911
|
authKind: text("auth_kind").$type().notNull(),
|
|
7839
|
-
oauthScopes:
|
|
7840
|
-
credentialFields:
|
|
4912
|
+
oauthScopes: jsonb("oauth_scopes").$type().notNull(),
|
|
4913
|
+
credentialFields: jsonb("credential_fields").$type().notNull().default({}),
|
|
7841
4914
|
credentialScheme: text("credential_scheme").$type(),
|
|
7842
4915
|
source: text("source").$type().notNull(),
|
|
7843
|
-
createdAt:
|
|
7844
|
-
updatedAt:
|
|
4916
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4917
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7845
4918
|
}, (table) => [uniqueIndex("apps_slug_idx").on(table.slug), index("apps_organization_id_idx").on(table.organizationId)]);
|
|
7846
|
-
const
|
|
4919
|
+
const appsSqlite = sqliteTable("apps", {
|
|
7847
4920
|
id: text$1("id").primaryKey(),
|
|
7848
|
-
organizationId: text$1("organization_id").
|
|
7849
|
-
provider: text$1("provider").notNull(),
|
|
4921
|
+
organizationId: text$1("organization_id").references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
7850
4922
|
slug: text$1("slug").notNull(),
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
4923
|
+
name: text$1("name").notNull(),
|
|
4924
|
+
description: text$1("description").notNull(),
|
|
4925
|
+
category: text$1("category").notNull(),
|
|
4926
|
+
logo: text$1("logo"),
|
|
4927
|
+
authKind: text$1("auth_kind").$type().notNull(),
|
|
4928
|
+
oauthScopes: text$1("oauth_scopes", { mode: "json" }).$type().notNull(),
|
|
4929
|
+
credentialFields: text$1("credential_fields", { mode: "json" }).$type().notNull().default({}),
|
|
4930
|
+
credentialScheme: text$1("credential_scheme").$type(),
|
|
4931
|
+
source: text$1("source").$type().notNull(),
|
|
4932
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4933
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4934
|
+
}, (table) => [uniqueIndex$1("apps_slug_idx").on(table.slug), index$1("apps_organization_id_idx").on(table.organizationId)]);
|
|
4935
|
+
const oauthApps = pgTable("oauth_apps", {
|
|
7861
4936
|
id: text("id").primaryKey(),
|
|
7862
|
-
organizationId: text("organization_id").notNull().references(() =>
|
|
4937
|
+
organizationId: text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
7863
4938
|
provider: text("provider").notNull(),
|
|
7864
4939
|
slug: text("slug").notNull(),
|
|
7865
4940
|
tokenStrategy: text("token_strategy").$type().notNull(),
|
|
@@ -7867,84 +4942,98 @@ const oauthAppsSqlite = sqliteTable("oauth_apps", {
|
|
|
7867
4942
|
clientSecretCiphertext: text("client_secret_ciphertext").notNull(),
|
|
7868
4943
|
signingSecretCiphertext: text("signing_secret_ciphertext"),
|
|
7869
4944
|
redirectUri: text("redirect_uri"),
|
|
7870
|
-
metadata:
|
|
7871
|
-
createdAt:
|
|
7872
|
-
updatedAt:
|
|
4945
|
+
metadata: jsonb("metadata").$type(),
|
|
4946
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
4947
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7873
4948
|
}, (table) => [uniqueIndex("oauth_apps_organization_id_slug_idx").on(table.organizationId, table.slug), index("oauth_apps_slug_idx").on(table.slug)]);
|
|
7874
|
-
const
|
|
4949
|
+
const oauthAppsSqlite = sqliteTable("oauth_apps", {
|
|
7875
4950
|
id: text$1("id").primaryKey(),
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
4951
|
+
organizationId: text$1("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
4952
|
+
provider: text$1("provider").notNull(),
|
|
4953
|
+
slug: text$1("slug").notNull(),
|
|
4954
|
+
tokenStrategy: text$1("token_strategy").$type().notNull(),
|
|
4955
|
+
clientIdCiphertext: text$1("client_id_ciphertext").notNull(),
|
|
4956
|
+
clientSecretCiphertext: text$1("client_secret_ciphertext").notNull(),
|
|
4957
|
+
signingSecretCiphertext: text$1("signing_secret_ciphertext"),
|
|
4958
|
+
redirectUri: text$1("redirect_uri"),
|
|
4959
|
+
metadata: text$1("metadata", { mode: "json" }).$type(),
|
|
4960
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
4961
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4962
|
+
}, (table) => [uniqueIndex$1("oauth_apps_organization_id_slug_idx").on(table.organizationId, table.slug), index$1("oauth_apps_slug_idx").on(table.slug)]);
|
|
4963
|
+
const oauthConnections = pgTable("oauth_connections", {
|
|
4964
|
+
id: text("id").primaryKey(),
|
|
4965
|
+
appId: text("app_id").notNull().references(() => oauthApps.id, { onDelete: "cascade" }),
|
|
4966
|
+
externalId: text("external_id").notNull(),
|
|
4967
|
+
accessTokenCiphertext: text("access_token_ciphertext").notNull(),
|
|
4968
|
+
refreshTokenCiphertext: text("refresh_token_ciphertext"),
|
|
7880
4969
|
accessTokenExpiresAt: timestamp("access_token_expires_at", { withTimezone: true }),
|
|
7881
4970
|
grantedScopes: jsonb("granted_scopes").$type(),
|
|
7882
4971
|
metadata: jsonb("metadata").$type(),
|
|
7883
4972
|
connectedAt: timestamp("connected_at", { withTimezone: true }).notNull(),
|
|
7884
4973
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
7885
|
-
}, (table) => [uniqueIndex$1("oauth_connections_app_external_unique").on(table.appId, table.externalId), index$1("oauth_connections_external_id_idx").on(table.externalId)]);
|
|
7886
|
-
const oauthConnectionsSqlite = sqliteTable("oauth_connections", {
|
|
7887
|
-
id: text("id").primaryKey(),
|
|
7888
|
-
appId: text("app_id").notNull().references(() => oauthAppsSqlite.id, { onDelete: "cascade" }),
|
|
7889
|
-
externalId: text("external_id").notNull(),
|
|
7890
|
-
accessTokenCiphertext: text("access_token_ciphertext").notNull(),
|
|
7891
|
-
refreshTokenCiphertext: text("refresh_token_ciphertext"),
|
|
7892
|
-
accessTokenExpiresAt: integer("access_token_expires_at", { mode: "timestamp_ms" }),
|
|
7893
|
-
grantedScopes: text("granted_scopes", { mode: "json" }).$type(),
|
|
7894
|
-
metadata: text("metadata", { mode: "json" }).$type(),
|
|
7895
|
-
connectedAt: integer("connected_at", { mode: "timestamp_ms" }).notNull(),
|
|
7896
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
7897
4974
|
}, (table) => [uniqueIndex("oauth_connections_app_external_unique").on(table.appId, table.externalId), index("oauth_connections_external_id_idx").on(table.externalId)]);
|
|
4975
|
+
const oauthConnectionsSqlite = sqliteTable("oauth_connections", {
|
|
4976
|
+
id: text$1("id").primaryKey(),
|
|
4977
|
+
appId: text$1("app_id").notNull().references(() => oauthAppsSqlite.id, { onDelete: "cascade" }),
|
|
4978
|
+
externalId: text$1("external_id").notNull(),
|
|
4979
|
+
accessTokenCiphertext: text$1("access_token_ciphertext").notNull(),
|
|
4980
|
+
refreshTokenCiphertext: text$1("refresh_token_ciphertext"),
|
|
4981
|
+
accessTokenExpiresAt: integer$1("access_token_expires_at", { mode: "timestamp_ms" }),
|
|
4982
|
+
grantedScopes: text$1("granted_scopes", { mode: "json" }).$type(),
|
|
4983
|
+
metadata: text$1("metadata", { mode: "json" }).$type(),
|
|
4984
|
+
connectedAt: integer$1("connected_at", { mode: "timestamp_ms" }).notNull(),
|
|
4985
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
4986
|
+
}, (table) => [uniqueIndex$1("oauth_connections_app_external_unique").on(table.appId, table.externalId), index$1("oauth_connections_external_id_idx").on(table.externalId)]);
|
|
7898
4987
|
const organizationUsers = pgTable("organization_users", {
|
|
7899
|
-
organizationId: text
|
|
7900
|
-
userId: text
|
|
7901
|
-
role: text
|
|
7902
|
-
status: text
|
|
4988
|
+
organizationId: text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
4989
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
4990
|
+
role: text("role").notNull().$type(),
|
|
4991
|
+
status: text("status").notNull().$type().default("active"),
|
|
7903
4992
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7904
4993
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7905
4994
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7906
|
-
}, (table) => [primaryKey$1({ columns: [table.organizationId, table.userId] }), index$1("organization_users_user_id_idx").on(table.userId)]);
|
|
7907
|
-
const organizationUsersSqlite = sqliteTable("organization_users", {
|
|
7908
|
-
organizationId: text("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
7909
|
-
userId: text("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
7910
|
-
role: text("role").notNull().$type(),
|
|
7911
|
-
status: text("status").notNull().$type().default("active"),
|
|
7912
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
7913
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
7914
|
-
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
7915
4995
|
}, (table) => [primaryKey({ columns: [table.organizationId, table.userId] }), index("organization_users_user_id_idx").on(table.userId)]);
|
|
7916
|
-
const
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
userId: text$1("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
7920
|
-
email: text$1("email").notNull(),
|
|
4996
|
+
const organizationUsersSqlite = sqliteTable("organization_users", {
|
|
4997
|
+
organizationId: text$1("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
4998
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
7921
4999
|
role: text$1("role").notNull().$type(),
|
|
7922
|
-
status: text$1("status").notNull().$type(),
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
index$1("organization_invitations_user_id_idx").on(table.userId),
|
|
7929
|
-
index$1("organization_invitations_organization_id_idx").on(table.organizationId),
|
|
7930
|
-
uniqueIndex$1("organization_invitations_org_user_pending_unique").on(table.organizationId, table.userId).where(sql`${table.status} = 'pending'`)
|
|
7931
|
-
]);
|
|
7932
|
-
const organizationInvitationsSqlite = sqliteTable("organization_invitations", {
|
|
5000
|
+
status: text$1("status").notNull().$type().default("active"),
|
|
5001
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5002
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
5003
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
5004
|
+
}, (table) => [primaryKey$1({ columns: [table.organizationId, table.userId] }), index$1("organization_users_user_id_idx").on(table.userId)]);
|
|
5005
|
+
const organizationInvitations = pgTable("organization_invitations", {
|
|
7933
5006
|
id: text("id").primaryKey(),
|
|
7934
|
-
organizationId: text("organization_id").notNull().references(() =>
|
|
7935
|
-
userId: text("user_id").notNull().references(() =>
|
|
5007
|
+
organizationId: text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
5008
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
7936
5009
|
email: text("email").notNull(),
|
|
7937
5010
|
role: text("role").notNull().$type(),
|
|
7938
5011
|
status: text("status").notNull().$type(),
|
|
7939
|
-
invitedByUserId: text("invited_by_user_id").notNull().references(() =>
|
|
7940
|
-
createdAt:
|
|
7941
|
-
updatedAt:
|
|
7942
|
-
expiresAt:
|
|
5012
|
+
invitedByUserId: text("invited_by_user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
5013
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
5014
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
5015
|
+
expiresAt: timestamp("expires_at", { withTimezone: true })
|
|
7943
5016
|
}, (table) => [
|
|
7944
5017
|
index("organization_invitations_user_id_idx").on(table.userId),
|
|
7945
5018
|
index("organization_invitations_organization_id_idx").on(table.organizationId),
|
|
7946
5019
|
uniqueIndex("organization_invitations_org_user_pending_unique").on(table.organizationId, table.userId).where(sql`${table.status} = 'pending'`)
|
|
7947
5020
|
]);
|
|
5021
|
+
const organizationInvitationsSqlite = sqliteTable("organization_invitations", {
|
|
5022
|
+
id: text$1("id").primaryKey(),
|
|
5023
|
+
organizationId: text$1("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
5024
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
5025
|
+
email: text$1("email").notNull(),
|
|
5026
|
+
role: text$1("role").notNull().$type(),
|
|
5027
|
+
status: text$1("status").notNull().$type(),
|
|
5028
|
+
invitedByUserId: text$1("invited_by_user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
5029
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5030
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
5031
|
+
expiresAt: integer$1("expires_at", { mode: "timestamp_ms" })
|
|
5032
|
+
}, (table) => [
|
|
5033
|
+
index$1("organization_invitations_user_id_idx").on(table.userId),
|
|
5034
|
+
index$1("organization_invitations_organization_id_idx").on(table.organizationId),
|
|
5035
|
+
uniqueIndex$1("organization_invitations_org_user_pending_unique").on(table.organizationId, table.userId).where(sql`${table.status} = 'pending'`)
|
|
5036
|
+
]);
|
|
7948
5037
|
const projectStatusEnum = pgEnum("project_status", [
|
|
7949
5038
|
"inactive",
|
|
7950
5039
|
"starting",
|
|
@@ -7952,106 +5041,106 @@ const projectStatusEnum = pgEnum("project_status", [
|
|
|
7952
5041
|
"failed"
|
|
7953
5042
|
]);
|
|
7954
5043
|
const projects = pgTable("projects", {
|
|
7955
|
-
id: text$1("id").primaryKey(),
|
|
7956
|
-
organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
7957
|
-
name: text$1("name").notNull(),
|
|
7958
|
-
slug: text$1("slug").notNull(),
|
|
7959
|
-
description: text$1("description"),
|
|
7960
|
-
defaultMemberRole: text$1("default_member_role").notNull().$type().default("builder"),
|
|
7961
|
-
invitePermission: text$1("invite_permission").notNull().$type().default("admin"),
|
|
7962
|
-
createdByUserId: text$1("created_by_user_id").references(() => users.id, { onDelete: "set null" }),
|
|
7963
|
-
status: projectStatusEnum("status").notNull(),
|
|
7964
|
-
baseUrl: text$1("base_url"),
|
|
7965
|
-
runtimeId: text$1("runtime_id"),
|
|
7966
|
-
activeArtifactId: text$1("active_artifact_id"),
|
|
7967
|
-
pendingArtifactId: text$1("pending_artifact_id"),
|
|
7968
|
-
lastError: text$1("last_error"),
|
|
7969
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
7970
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
7971
|
-
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7972
|
-
}, (table) => [index$1("projects_organization_id_idx").on(table.organizationId), uniqueIndex$1("projects_organization_slug_unique").on(table.organizationId, table.slug).where(sql`${table.deletedAt} IS NULL`)]);
|
|
7973
|
-
const projectsSqlite = sqliteTable("projects", {
|
|
7974
5044
|
id: text("id").primaryKey(),
|
|
7975
|
-
organizationId: text("organization_id").notNull().references(() =>
|
|
5045
|
+
organizationId: text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
7976
5046
|
name: text("name").notNull(),
|
|
7977
5047
|
slug: text("slug").notNull(),
|
|
7978
5048
|
description: text("description"),
|
|
7979
5049
|
defaultMemberRole: text("default_member_role").notNull().$type().default("builder"),
|
|
7980
5050
|
invitePermission: text("invite_permission").notNull().$type().default("admin"),
|
|
7981
|
-
createdByUserId: text("created_by_user_id").references(() =>
|
|
7982
|
-
status:
|
|
5051
|
+
createdByUserId: text("created_by_user_id").references(() => users.id, { onDelete: "set null" }),
|
|
5052
|
+
status: projectStatusEnum("status").notNull(),
|
|
7983
5053
|
baseUrl: text("base_url"),
|
|
7984
5054
|
runtimeId: text("runtime_id"),
|
|
7985
5055
|
activeArtifactId: text("active_artifact_id"),
|
|
7986
5056
|
pendingArtifactId: text("pending_artifact_id"),
|
|
7987
5057
|
lastError: text("last_error"),
|
|
7988
|
-
createdAt:
|
|
7989
|
-
updatedAt:
|
|
7990
|
-
deletedAt:
|
|
5058
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
5059
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
5060
|
+
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
7991
5061
|
}, (table) => [index("projects_organization_id_idx").on(table.organizationId), uniqueIndex("projects_organization_slug_unique").on(table.organizationId, table.slug).where(sql`${table.deletedAt} IS NULL`)]);
|
|
5062
|
+
const projectsSqlite = sqliteTable("projects", {
|
|
5063
|
+
id: text$1("id").primaryKey(),
|
|
5064
|
+
organizationId: text$1("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
5065
|
+
name: text$1("name").notNull(),
|
|
5066
|
+
slug: text$1("slug").notNull(),
|
|
5067
|
+
description: text$1("description"),
|
|
5068
|
+
defaultMemberRole: text$1("default_member_role").notNull().$type().default("builder"),
|
|
5069
|
+
invitePermission: text$1("invite_permission").notNull().$type().default("admin"),
|
|
5070
|
+
createdByUserId: text$1("created_by_user_id").references(() => usersSqlite.id, { onDelete: "set null" }),
|
|
5071
|
+
status: text$1("status").$type().notNull(),
|
|
5072
|
+
baseUrl: text$1("base_url"),
|
|
5073
|
+
runtimeId: text$1("runtime_id"),
|
|
5074
|
+
activeArtifactId: text$1("active_artifact_id"),
|
|
5075
|
+
pendingArtifactId: text$1("pending_artifact_id"),
|
|
5076
|
+
lastError: text$1("last_error"),
|
|
5077
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5078
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
5079
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
5080
|
+
}, (table) => [index$1("projects_organization_id_idx").on(table.organizationId), uniqueIndex$1("projects_organization_slug_unique").on(table.organizationId, table.slug).where(sql`${table.deletedAt} IS NULL`)]);
|
|
7992
5081
|
const projectArtifactStatusEnum = pgEnum("project_artifact_status", ["pending", "ready"]);
|
|
7993
5082
|
const projectArtifacts = pgTable("project_artifacts", {
|
|
7994
|
-
id: text
|
|
7995
|
-
projectId: text
|
|
7996
|
-
storageKey: text
|
|
5083
|
+
id: text("id").primaryKey(),
|
|
5084
|
+
projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
5085
|
+
storageKey: text("storage_key").notNull(),
|
|
7997
5086
|
manifestJson: jsonb("manifest_json"),
|
|
7998
5087
|
sourceManifestJson: jsonb("source_manifest_json"),
|
|
7999
|
-
version: integer
|
|
8000
|
-
createdByUserId: text
|
|
5088
|
+
version: integer("version").notNull(),
|
|
5089
|
+
createdByUserId: text("created_by_user_id").references(() => users.id, { onDelete: "set null" }),
|
|
8001
5090
|
status: projectArtifactStatusEnum("status").notNull(),
|
|
8002
5091
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
8003
5092
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
8004
|
-
}, (table) => [index$1("project_artifacts_project_id_idx").on(table.projectId)]);
|
|
8005
|
-
const projectArtifactsSqlite = sqliteTable("project_artifacts", {
|
|
8006
|
-
id: text("id").primaryKey(),
|
|
8007
|
-
projectId: text("project_id").notNull().references(() => projectsSqlite.id, { onDelete: "cascade" }),
|
|
8008
|
-
storageKey: text("storage_key").notNull(),
|
|
8009
|
-
manifestJson: text("manifest_json", { mode: "json" }),
|
|
8010
|
-
sourceManifestJson: text("source_manifest_json", { mode: "json" }),
|
|
8011
|
-
version: integer("version").notNull(),
|
|
8012
|
-
createdByUserId: text("created_by_user_id").references(() => usersSqlite.id, { onDelete: "set null" }),
|
|
8013
|
-
status: text("status").$type().notNull(),
|
|
8014
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
8015
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
8016
5093
|
}, (table) => [index("project_artifacts_project_id_idx").on(table.projectId)]);
|
|
5094
|
+
const projectArtifactsSqlite = sqliteTable("project_artifacts", {
|
|
5095
|
+
id: text$1("id").primaryKey(),
|
|
5096
|
+
projectId: text$1("project_id").notNull().references(() => projectsSqlite.id, { onDelete: "cascade" }),
|
|
5097
|
+
storageKey: text$1("storage_key").notNull(),
|
|
5098
|
+
manifestJson: text$1("manifest_json", { mode: "json" }),
|
|
5099
|
+
sourceManifestJson: text$1("source_manifest_json", { mode: "json" }),
|
|
5100
|
+
version: integer$1("version").notNull(),
|
|
5101
|
+
createdByUserId: text$1("created_by_user_id").references(() => usersSqlite.id, { onDelete: "set null" }),
|
|
5102
|
+
status: text$1("status").$type().notNull(),
|
|
5103
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5104
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
5105
|
+
}, (table) => [index$1("project_artifacts_project_id_idx").on(table.projectId)]);
|
|
8017
5106
|
const projectUsers = pgTable("project_users", {
|
|
8018
|
-
projectId: text
|
|
8019
|
-
userId: text
|
|
8020
|
-
role: text
|
|
8021
|
-
status: text
|
|
5107
|
+
projectId: text("project_id").notNull().references(() => projects.id, { onDelete: "cascade" }),
|
|
5108
|
+
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
5109
|
+
role: text("role").notNull().$type(),
|
|
5110
|
+
status: text("status").notNull().$type().default("active"),
|
|
8022
5111
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
8023
5112
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
8024
5113
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
8025
|
-
}, (table) => [primaryKey$1({ columns: [table.projectId, table.userId] }), index$1("project_users_user_id_idx").on(table.userId)]);
|
|
8026
|
-
const projectUsersSqlite = sqliteTable("project_users", {
|
|
8027
|
-
projectId: text("project_id").notNull().references(() => projectsSqlite.id, { onDelete: "cascade" }),
|
|
8028
|
-
userId: text("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
8029
|
-
role: text("role").notNull().$type(),
|
|
8030
|
-
status: text("status").notNull().$type().default("active"),
|
|
8031
|
-
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
8032
|
-
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
8033
|
-
deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
|
|
8034
5114
|
}, (table) => [primaryKey({ columns: [table.projectId, table.userId] }), index("project_users_user_id_idx").on(table.userId)]);
|
|
5115
|
+
const projectUsersSqlite = sqliteTable("project_users", {
|
|
5116
|
+
projectId: text$1("project_id").notNull().references(() => projectsSqlite.id, { onDelete: "cascade" }),
|
|
5117
|
+
userId: text$1("user_id").notNull().references(() => usersSqlite.id, { onDelete: "cascade" }),
|
|
5118
|
+
role: text$1("role").notNull().$type(),
|
|
5119
|
+
status: text$1("status").notNull().$type().default("active"),
|
|
5120
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5121
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
5122
|
+
deletedAt: integer$1("deleted_at", { mode: "timestamp_ms" })
|
|
5123
|
+
}, (table) => [primaryKey$1({ columns: [table.projectId, table.userId] }), index$1("project_users_user_id_idx").on(table.userId)]);
|
|
8035
5124
|
const secretValues = pgTable("secret_values", {
|
|
8036
|
-
id: text$1("id").primaryKey(),
|
|
8037
|
-
organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
8038
|
-
refKind: text$1("ref_kind").$type().notNull(),
|
|
8039
|
-
refId: text$1("ref_id").notNull(),
|
|
8040
|
-
field: text$1("field").$type().notNull(),
|
|
8041
|
-
ciphertext: text$1("ciphertext").notNull(),
|
|
8042
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
8043
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
8044
|
-
}, (table) => [uniqueIndex$1("secret_values_ref_unique").on(table.organizationId, table.refKind, table.refId, table.field), index$1("secret_values_ref_idx").on(table.organizationId, table.refKind, table.refId)]);
|
|
8045
|
-
const secretValuesSqlite = sqliteTable("secret_values", {
|
|
8046
5125
|
id: text("id").primaryKey(),
|
|
8047
|
-
organizationId: text("organization_id").notNull().references(() =>
|
|
5126
|
+
organizationId: text("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
8048
5127
|
refKind: text("ref_kind").$type().notNull(),
|
|
8049
5128
|
refId: text("ref_id").notNull(),
|
|
8050
5129
|
field: text("field").$type().notNull(),
|
|
8051
5130
|
ciphertext: text("ciphertext").notNull(),
|
|
8052
|
-
createdAt:
|
|
8053
|
-
updatedAt:
|
|
5131
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
5132
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
8054
5133
|
}, (table) => [uniqueIndex("secret_values_ref_unique").on(table.organizationId, table.refKind, table.refId, table.field), index("secret_values_ref_idx").on(table.organizationId, table.refKind, table.refId)]);
|
|
5134
|
+
const secretValuesSqlite = sqliteTable("secret_values", {
|
|
5135
|
+
id: text$1("id").primaryKey(),
|
|
5136
|
+
organizationId: text$1("organization_id").notNull().references(() => organizationsSqlite.id, { onDelete: "cascade" }),
|
|
5137
|
+
refKind: text$1("ref_kind").$type().notNull(),
|
|
5138
|
+
refId: text$1("ref_id").notNull(),
|
|
5139
|
+
field: text$1("field").$type().notNull(),
|
|
5140
|
+
ciphertext: text$1("ciphertext").notNull(),
|
|
5141
|
+
createdAt: integer$1("created_at", { mode: "timestamp_ms" }).notNull(),
|
|
5142
|
+
updatedAt: integer$1("updated_at", { mode: "timestamp_ms" }).notNull()
|
|
5143
|
+
}, (table) => [uniqueIndex$1("secret_values_ref_unique").on(table.organizationId, table.refKind, table.refId, table.field), index$1("secret_values_ref_idx").on(table.organizationId, table.refKind, table.refId)]);
|
|
8055
5144
|
/**
|
|
8056
5145
|
* Platform control-plane tables — Postgres (hosted) or SQLite (local dev).
|
|
8057
5146
|
*/
|
|
@@ -8120,6 +5209,18 @@ const tableRegistry = {
|
|
|
8120
5209
|
pg: oauthConnections,
|
|
8121
5210
|
sqlite: oauthConnectionsSqlite
|
|
8122
5211
|
},
|
|
5212
|
+
mcpOauthClient: {
|
|
5213
|
+
pg: mcpOauthClient,
|
|
5214
|
+
sqlite: mcpOauthClientSqlite
|
|
5215
|
+
},
|
|
5216
|
+
mcpOauthAccessToken: {
|
|
5217
|
+
pg: mcpOauthAccessToken,
|
|
5218
|
+
sqlite: mcpOauthAccessTokenSqlite
|
|
5219
|
+
},
|
|
5220
|
+
mcpOauthConsent: {
|
|
5221
|
+
pg: mcpOauthConsent,
|
|
5222
|
+
sqlite: mcpOauthConsentSqlite
|
|
5223
|
+
},
|
|
8123
5224
|
secretValues: {
|
|
8124
5225
|
pg: secretValues,
|
|
8125
5226
|
sqlite: secretValuesSqlite
|
|
@@ -15549,4 +12650,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
|
|
|
15549
12650
|
//#endregion
|
|
15550
12651
|
export { discoverEntries as A, validateImportedTriggerAttachment as C, webhookRouteFromEndpoint as D, webhookMatchSchemaForBindings as E, walkTypeScriptFiles as F, entryIdFromFile as M, readKeystrokeIgnoreDirective as N, workflowRouteFromKey as O, shouldSkipKeystrokeModuleFile as P, toStoredRouteManifest as S, webhookManifestAttachmentSchemasFromBindings as T, importWorkflowDefinition as _, buildWebhookBindingsByRoute as a, schemaToJson as b, countAgentCredentials as c, discoverTriggerAttachments as d, discoverWorkflowEntries as f, importTriggerAttachments as g, importAgentDefinition as h, buildStoredRouteManifestFromContext as i, discoverModuleFileEntries as j, packAssetDirs as k, discoverAgentEntries as l, emitStoredRouteManifestForProject as m, agentRouteFromKey as n, collectAgentAppSlugs as o, discoverWorkflows as p, buildStoredRouteManifestForProject as r, collectAgentToolSlugs as s, agentManifestEntry as t, discoverSkillManifestEntries as u, persistStoredRouteManifest as v, validateImportedWorkflowDefinition as w, serializeRouteManifest as x, pollGroupId as y };
|
|
15551
12652
|
|
|
15552
|
-
//# sourceMappingURL=dist-
|
|
12653
|
+
//# sourceMappingURL=dist-BIWbmT4y.mjs.map
|