@edihasaj/recall 0.6.7 → 0.7.1
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/README.md +57 -1
- package/dist/chunk-37K4DPRI.js +17 -0
- package/dist/chunk-37K4DPRI.js.map +1 -0
- package/dist/chunk-AKODTKWM.js +123 -0
- package/dist/chunk-AKODTKWM.js.map +1 -0
- package/dist/{chunk-4P3NKEIJ.js → chunk-CPOANMKD.js} +18 -9
- package/dist/{chunk-4P3NKEIJ.js.map → chunk-CPOANMKD.js.map} +1 -1
- package/dist/{chunk-AJAAK4FK.js → chunk-GNXTOM5K.js} +159 -9
- package/dist/chunk-GNXTOM5K.js.map +1 -0
- package/dist/chunk-JRIM7VBY.js +2346 -0
- package/dist/chunk-JRIM7VBY.js.map +1 -0
- package/dist/chunk-PG2ZVVAT.js +6525 -0
- package/dist/chunk-PG2ZVVAT.js.map +1 -0
- package/dist/{chunk-LFWG3CBM.js → chunk-PH6YNVHR.js} +206 -2381
- package/dist/chunk-PH6YNVHR.js.map +1 -0
- package/dist/chunk-QDA5M3AJ.js +2617 -0
- package/dist/chunk-QDA5M3AJ.js.map +1 -0
- package/dist/chunk-QSJKGEID.js +235 -0
- package/dist/chunk-QSJKGEID.js.map +1 -0
- package/dist/chunk-UBPGOOAN.js +462 -0
- package/dist/chunk-UBPGOOAN.js.map +1 -0
- package/dist/{chunk-XUM7JEJU.js → chunk-YL23MKB3.js} +10 -4
- package/dist/{chunk-XUM7JEJU.js.map → chunk-YL23MKB3.js.map} +1 -1
- package/dist/chunk-Z6RT5BUO.js +282 -0
- package/dist/chunk-Z6RT5BUO.js.map +1 -0
- package/dist/{cleanup-JM3CGHUV.js → cleanup-YGHZIYLJ.js} +6 -3
- package/dist/cli.js +160 -26
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +662 -42
- package/dist/daemon.js.map +1 -1
- package/dist/{dispatcher-C5S7SYY6.js → dispatcher-5MDL3QQT.js} +6 -3
- package/dist/embeddings-GKNH2E3N.js +48 -0
- package/dist/ingest-JWXX22QX.js +19 -0
- package/dist/mcp.js +9 -4
- package/dist/mcp.js.map +1 -1
- package/dist/{quality-YTQKAEY6.js → quality-2JOLSIC3.js} +4 -3
- package/dist/quality-2JOLSIC3.js.map +1 -0
- package/dist/retrieval-GLAEYWGA.js +13 -0
- package/dist/retrieval-GLAEYWGA.js.map +1 -0
- package/dist/store-2BPQPOOZ.js +31 -0
- package/dist/store-2BPQPOOZ.js.map +1 -0
- package/dist/{tasks-KHLJT7MP.js → tasks-6J3LULYO.js} +6 -3
- package/dist/tasks-6J3LULYO.js.map +1 -0
- package/dist/{usage-DU4TKVJH.js → usage-YBS74UEU.js} +8 -4
- package/dist/{usage-DU4TKVJH.js.map → usage-YBS74UEU.js.map} +1 -1
- package/dist/webui/assets/index-BJt1Lf-q.css +1 -0
- package/dist/webui/assets/index-Bfhwll2B.js +5224 -0
- package/dist/webui/assets/index-Bfhwll2B.js.map +1 -0
- package/dist/webui/index.html +15 -0
- package/dist/webui/recall-icon.png +0 -0
- package/drizzle/0008_premium_red_hulk.sql +44 -0
- package/drizzle/meta/0008_snapshot.json +2491 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +8 -3
- package/dist/chunk-A6XEULA4.js +0 -470
- package/dist/chunk-A6XEULA4.js.map +0 -1
- package/dist/chunk-AJAAK4FK.js.map +0 -1
- package/dist/chunk-DSNYEUZW.js +0 -2993
- package/dist/chunk-DSNYEUZW.js.map +0 -1
- package/dist/chunk-LFWG3CBM.js.map +0 -1
- /package/dist/{cleanup-JM3CGHUV.js.map → cleanup-YGHZIYLJ.js.map} +0 -0
- /package/dist/{dispatcher-C5S7SYY6.js.map → dispatcher-5MDL3QQT.js.map} +0 -0
- /package/dist/{quality-YTQKAEY6.js.map → embeddings-GKNH2E3N.js.map} +0 -0
- /package/dist/{tasks-KHLJT7MP.js.map → ingest-JWXX22QX.js.map} +0 -0
|
@@ -0,0 +1,2617 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-4CV4JOE5.js";
|
|
4
|
+
|
|
5
|
+
// node_modules/drizzle-orm/entity.js
|
|
6
|
+
var entityKind = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
|
|
7
|
+
function is(value, type) {
|
|
8
|
+
if (!value || typeof value !== "object") {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (value instanceof type) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
`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.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
let cls = Object.getPrototypeOf(value).constructor;
|
|
20
|
+
if (cls) {
|
|
21
|
+
while (cls) {
|
|
22
|
+
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
cls = Object.getPrototypeOf(cls);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// node_modules/drizzle-orm/column-builder.js
|
|
32
|
+
var ColumnBuilder = class {
|
|
33
|
+
static [entityKind] = "ColumnBuilder";
|
|
34
|
+
config;
|
|
35
|
+
constructor(name, dataType, columnType) {
|
|
36
|
+
this.config = {
|
|
37
|
+
name,
|
|
38
|
+
keyAsName: name === "",
|
|
39
|
+
notNull: false,
|
|
40
|
+
default: void 0,
|
|
41
|
+
hasDefault: false,
|
|
42
|
+
primaryKey: false,
|
|
43
|
+
isUnique: false,
|
|
44
|
+
uniqueName: void 0,
|
|
45
|
+
uniqueType: void 0,
|
|
46
|
+
dataType,
|
|
47
|
+
columnType,
|
|
48
|
+
generated: void 0
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const users = pgTable('users', {
|
|
57
|
+
* id: integer('id').$type<UserId>().primaryKey(),
|
|
58
|
+
* details: json('details').$type<UserDetails>().notNull(),
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
$type() {
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Adds a `not null` clause to the column definition.
|
|
67
|
+
*
|
|
68
|
+
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
69
|
+
*/
|
|
70
|
+
notNull() {
|
|
71
|
+
this.config.notNull = true;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Adds a `default <value>` clause to the column definition.
|
|
76
|
+
*
|
|
77
|
+
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
78
|
+
*
|
|
79
|
+
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
80
|
+
*/
|
|
81
|
+
default(value) {
|
|
82
|
+
this.config.default = value;
|
|
83
|
+
this.config.hasDefault = true;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Adds a dynamic default value to the column.
|
|
88
|
+
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
89
|
+
*
|
|
90
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
91
|
+
*/
|
|
92
|
+
$defaultFn(fn) {
|
|
93
|
+
this.config.defaultFn = fn;
|
|
94
|
+
this.config.hasDefault = true;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Alias for {@link $defaultFn}.
|
|
99
|
+
*/
|
|
100
|
+
$default = this.$defaultFn;
|
|
101
|
+
/**
|
|
102
|
+
* Adds a dynamic update value to the column.
|
|
103
|
+
* 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.
|
|
104
|
+
* 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.
|
|
105
|
+
*
|
|
106
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
107
|
+
*/
|
|
108
|
+
$onUpdateFn(fn) {
|
|
109
|
+
this.config.onUpdateFn = fn;
|
|
110
|
+
this.config.hasDefault = true;
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Alias for {@link $onUpdateFn}.
|
|
115
|
+
*/
|
|
116
|
+
$onUpdate = this.$onUpdateFn;
|
|
117
|
+
/**
|
|
118
|
+
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
119
|
+
*
|
|
120
|
+
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
121
|
+
*/
|
|
122
|
+
primaryKey() {
|
|
123
|
+
this.config.primaryKey = true;
|
|
124
|
+
this.config.notNull = true;
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
128
|
+
setName(name) {
|
|
129
|
+
if (this.config.name !== "") return;
|
|
130
|
+
this.config.name = name;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// node_modules/drizzle-orm/column.js
|
|
135
|
+
var Column = class {
|
|
136
|
+
constructor(table, config) {
|
|
137
|
+
this.table = table;
|
|
138
|
+
this.config = config;
|
|
139
|
+
this.name = config.name;
|
|
140
|
+
this.keyAsName = config.keyAsName;
|
|
141
|
+
this.notNull = config.notNull;
|
|
142
|
+
this.default = config.default;
|
|
143
|
+
this.defaultFn = config.defaultFn;
|
|
144
|
+
this.onUpdateFn = config.onUpdateFn;
|
|
145
|
+
this.hasDefault = config.hasDefault;
|
|
146
|
+
this.primary = config.primaryKey;
|
|
147
|
+
this.isUnique = config.isUnique;
|
|
148
|
+
this.uniqueName = config.uniqueName;
|
|
149
|
+
this.uniqueType = config.uniqueType;
|
|
150
|
+
this.dataType = config.dataType;
|
|
151
|
+
this.columnType = config.columnType;
|
|
152
|
+
this.generated = config.generated;
|
|
153
|
+
this.generatedIdentity = config.generatedIdentity;
|
|
154
|
+
}
|
|
155
|
+
static [entityKind] = "Column";
|
|
156
|
+
name;
|
|
157
|
+
keyAsName;
|
|
158
|
+
primary;
|
|
159
|
+
notNull;
|
|
160
|
+
default;
|
|
161
|
+
defaultFn;
|
|
162
|
+
onUpdateFn;
|
|
163
|
+
hasDefault;
|
|
164
|
+
isUnique;
|
|
165
|
+
uniqueName;
|
|
166
|
+
uniqueType;
|
|
167
|
+
dataType;
|
|
168
|
+
columnType;
|
|
169
|
+
enumValues = void 0;
|
|
170
|
+
generated = void 0;
|
|
171
|
+
generatedIdentity = void 0;
|
|
172
|
+
config;
|
|
173
|
+
mapFromDriverValue(value) {
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
mapToDriverValue(value) {
|
|
177
|
+
return value;
|
|
178
|
+
}
|
|
179
|
+
// ** @internal */
|
|
180
|
+
shouldDisableInsert() {
|
|
181
|
+
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// node_modules/drizzle-orm/table.utils.js
|
|
186
|
+
var TableName = /* @__PURE__ */ Symbol.for("drizzle:Name");
|
|
187
|
+
|
|
188
|
+
// node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
189
|
+
var ForeignKeyBuilder = class {
|
|
190
|
+
static [entityKind] = "PgForeignKeyBuilder";
|
|
191
|
+
/** @internal */
|
|
192
|
+
reference;
|
|
193
|
+
/** @internal */
|
|
194
|
+
_onUpdate = "no action";
|
|
195
|
+
/** @internal */
|
|
196
|
+
_onDelete = "no action";
|
|
197
|
+
constructor(config, actions) {
|
|
198
|
+
this.reference = () => {
|
|
199
|
+
const { name, columns, foreignColumns } = config();
|
|
200
|
+
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
201
|
+
};
|
|
202
|
+
if (actions) {
|
|
203
|
+
this._onUpdate = actions.onUpdate;
|
|
204
|
+
this._onDelete = actions.onDelete;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
onUpdate(action) {
|
|
208
|
+
this._onUpdate = action === void 0 ? "no action" : action;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
onDelete(action) {
|
|
212
|
+
this._onDelete = action === void 0 ? "no action" : action;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
/** @internal */
|
|
216
|
+
build(table) {
|
|
217
|
+
return new ForeignKey(table, this);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var ForeignKey = class {
|
|
221
|
+
constructor(table, builder) {
|
|
222
|
+
this.table = table;
|
|
223
|
+
this.reference = builder.reference;
|
|
224
|
+
this.onUpdate = builder._onUpdate;
|
|
225
|
+
this.onDelete = builder._onDelete;
|
|
226
|
+
}
|
|
227
|
+
static [entityKind] = "PgForeignKey";
|
|
228
|
+
reference;
|
|
229
|
+
onUpdate;
|
|
230
|
+
onDelete;
|
|
231
|
+
getName() {
|
|
232
|
+
const { name, columns, foreignColumns } = this.reference();
|
|
233
|
+
const columnNames = columns.map((column) => column.name);
|
|
234
|
+
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
235
|
+
const chunks = [
|
|
236
|
+
this.table[TableName],
|
|
237
|
+
...columnNames,
|
|
238
|
+
foreignColumns[0].table[TableName],
|
|
239
|
+
...foreignColumnNames
|
|
240
|
+
];
|
|
241
|
+
return name ?? `${chunks.join("_")}_fk`;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// node_modules/drizzle-orm/tracing-utils.js
|
|
246
|
+
function iife(fn, ...args) {
|
|
247
|
+
return fn(...args);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
251
|
+
function uniqueKeyName(table, columns) {
|
|
252
|
+
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
253
|
+
}
|
|
254
|
+
var UniqueConstraintBuilder = class {
|
|
255
|
+
constructor(columns, name) {
|
|
256
|
+
this.name = name;
|
|
257
|
+
this.columns = columns;
|
|
258
|
+
}
|
|
259
|
+
static [entityKind] = "PgUniqueConstraintBuilder";
|
|
260
|
+
/** @internal */
|
|
261
|
+
columns;
|
|
262
|
+
/** @internal */
|
|
263
|
+
nullsNotDistinctConfig = false;
|
|
264
|
+
nullsNotDistinct() {
|
|
265
|
+
this.nullsNotDistinctConfig = true;
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
/** @internal */
|
|
269
|
+
build(table) {
|
|
270
|
+
return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var UniqueOnConstraintBuilder = class {
|
|
274
|
+
static [entityKind] = "PgUniqueOnConstraintBuilder";
|
|
275
|
+
/** @internal */
|
|
276
|
+
name;
|
|
277
|
+
constructor(name) {
|
|
278
|
+
this.name = name;
|
|
279
|
+
}
|
|
280
|
+
on(...columns) {
|
|
281
|
+
return new UniqueConstraintBuilder(columns, this.name);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var UniqueConstraint = class {
|
|
285
|
+
constructor(table, columns, nullsNotDistinct, name) {
|
|
286
|
+
this.table = table;
|
|
287
|
+
this.columns = columns;
|
|
288
|
+
this.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));
|
|
289
|
+
this.nullsNotDistinct = nullsNotDistinct;
|
|
290
|
+
}
|
|
291
|
+
static [entityKind] = "PgUniqueConstraint";
|
|
292
|
+
columns;
|
|
293
|
+
name;
|
|
294
|
+
nullsNotDistinct = false;
|
|
295
|
+
getName() {
|
|
296
|
+
return this.name;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// node_modules/drizzle-orm/pg-core/utils/array.js
|
|
301
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
302
|
+
for (let i = startFrom; i < arrayString.length; i++) {
|
|
303
|
+
const char = arrayString[i];
|
|
304
|
+
if (char === "\\") {
|
|
305
|
+
i++;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (char === '"') {
|
|
309
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
310
|
+
}
|
|
311
|
+
if (inQuotes) {
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (char === "," || char === "}") {
|
|
315
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
319
|
+
}
|
|
320
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
321
|
+
const result = [];
|
|
322
|
+
let i = startFrom;
|
|
323
|
+
let lastCharIsComma = false;
|
|
324
|
+
while (i < arrayString.length) {
|
|
325
|
+
const char = arrayString[i];
|
|
326
|
+
if (char === ",") {
|
|
327
|
+
if (lastCharIsComma || i === startFrom) {
|
|
328
|
+
result.push("");
|
|
329
|
+
}
|
|
330
|
+
lastCharIsComma = true;
|
|
331
|
+
i++;
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
lastCharIsComma = false;
|
|
335
|
+
if (char === "\\") {
|
|
336
|
+
i += 2;
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (char === '"') {
|
|
340
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
341
|
+
result.push(value2);
|
|
342
|
+
i = startFrom2;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
if (char === "}") {
|
|
346
|
+
return [result, i + 1];
|
|
347
|
+
}
|
|
348
|
+
if (char === "{") {
|
|
349
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
350
|
+
result.push(value2);
|
|
351
|
+
i = startFrom2;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
355
|
+
result.push(value);
|
|
356
|
+
i = newStartFrom;
|
|
357
|
+
}
|
|
358
|
+
return [result, i];
|
|
359
|
+
}
|
|
360
|
+
function parsePgArray(arrayString) {
|
|
361
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
362
|
+
return result;
|
|
363
|
+
}
|
|
364
|
+
function makePgArray(array) {
|
|
365
|
+
return `{${array.map((item) => {
|
|
366
|
+
if (Array.isArray(item)) {
|
|
367
|
+
return makePgArray(item);
|
|
368
|
+
}
|
|
369
|
+
if (typeof item === "string") {
|
|
370
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
371
|
+
}
|
|
372
|
+
return `${item}`;
|
|
373
|
+
}).join(",")}}`;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// node_modules/drizzle-orm/pg-core/columns/common.js
|
|
377
|
+
var PgColumnBuilder = class extends ColumnBuilder {
|
|
378
|
+
foreignKeyConfigs = [];
|
|
379
|
+
static [entityKind] = "PgColumnBuilder";
|
|
380
|
+
array(size) {
|
|
381
|
+
return new PgArrayBuilder(this.config.name, this, size);
|
|
382
|
+
}
|
|
383
|
+
references(ref, actions = {}) {
|
|
384
|
+
this.foreignKeyConfigs.push({ ref, actions });
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
unique(name, config) {
|
|
388
|
+
this.config.isUnique = true;
|
|
389
|
+
this.config.uniqueName = name;
|
|
390
|
+
this.config.uniqueType = config?.nulls;
|
|
391
|
+
return this;
|
|
392
|
+
}
|
|
393
|
+
generatedAlwaysAs(as) {
|
|
394
|
+
this.config.generated = {
|
|
395
|
+
as,
|
|
396
|
+
type: "always",
|
|
397
|
+
mode: "stored"
|
|
398
|
+
};
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
401
|
+
/** @internal */
|
|
402
|
+
buildForeignKeys(column, table) {
|
|
403
|
+
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
404
|
+
return iife(
|
|
405
|
+
(ref2, actions2) => {
|
|
406
|
+
const builder = new ForeignKeyBuilder(() => {
|
|
407
|
+
const foreignColumn = ref2();
|
|
408
|
+
return { columns: [column], foreignColumns: [foreignColumn] };
|
|
409
|
+
});
|
|
410
|
+
if (actions2.onUpdate) {
|
|
411
|
+
builder.onUpdate(actions2.onUpdate);
|
|
412
|
+
}
|
|
413
|
+
if (actions2.onDelete) {
|
|
414
|
+
builder.onDelete(actions2.onDelete);
|
|
415
|
+
}
|
|
416
|
+
return builder.build(table);
|
|
417
|
+
},
|
|
418
|
+
ref,
|
|
419
|
+
actions
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/** @internal */
|
|
424
|
+
buildExtraConfigColumn(table) {
|
|
425
|
+
return new ExtraConfigColumn(table, this.config);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var PgColumn = class extends Column {
|
|
429
|
+
constructor(table, config) {
|
|
430
|
+
if (!config.uniqueName) {
|
|
431
|
+
config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
432
|
+
}
|
|
433
|
+
super(table, config);
|
|
434
|
+
this.table = table;
|
|
435
|
+
}
|
|
436
|
+
static [entityKind] = "PgColumn";
|
|
437
|
+
};
|
|
438
|
+
var ExtraConfigColumn = class extends PgColumn {
|
|
439
|
+
static [entityKind] = "ExtraConfigColumn";
|
|
440
|
+
getSQLType() {
|
|
441
|
+
return this.getSQLType();
|
|
442
|
+
}
|
|
443
|
+
indexConfig = {
|
|
444
|
+
order: this.config.order ?? "asc",
|
|
445
|
+
nulls: this.config.nulls ?? "last",
|
|
446
|
+
opClass: this.config.opClass
|
|
447
|
+
};
|
|
448
|
+
defaultConfig = {
|
|
449
|
+
order: "asc",
|
|
450
|
+
nulls: "last",
|
|
451
|
+
opClass: void 0
|
|
452
|
+
};
|
|
453
|
+
asc() {
|
|
454
|
+
this.indexConfig.order = "asc";
|
|
455
|
+
return this;
|
|
456
|
+
}
|
|
457
|
+
desc() {
|
|
458
|
+
this.indexConfig.order = "desc";
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
nullsFirst() {
|
|
462
|
+
this.indexConfig.nulls = "first";
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
nullsLast() {
|
|
466
|
+
this.indexConfig.nulls = "last";
|
|
467
|
+
return this;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* ### PostgreSQL documentation quote
|
|
471
|
+
*
|
|
472
|
+
* > An operator class with optional parameters can be specified for each column of an index.
|
|
473
|
+
* The operator class identifies the operators to be used by the index for that column.
|
|
474
|
+
* For example, a B-tree index on four-byte integers would use the int4_ops class;
|
|
475
|
+
* this operator class includes comparison functions for four-byte integers.
|
|
476
|
+
* In practice the default operator class for the column's data type is usually sufficient.
|
|
477
|
+
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
|
|
478
|
+
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
|
|
479
|
+
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
|
|
480
|
+
* More information about operator classes check:
|
|
481
|
+
*
|
|
482
|
+
* ### Useful links
|
|
483
|
+
* https://www.postgresql.org/docs/current/sql-createindex.html
|
|
484
|
+
*
|
|
485
|
+
* https://www.postgresql.org/docs/current/indexes-opclass.html
|
|
486
|
+
*
|
|
487
|
+
* https://www.postgresql.org/docs/current/xindex.html
|
|
488
|
+
*
|
|
489
|
+
* ### Additional types
|
|
490
|
+
* If you have the `pg_vector` extension installed in your database, you can use the
|
|
491
|
+
* `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.
|
|
492
|
+
*
|
|
493
|
+
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
|
|
494
|
+
*
|
|
495
|
+
* @param opClass
|
|
496
|
+
* @returns
|
|
497
|
+
*/
|
|
498
|
+
op(opClass) {
|
|
499
|
+
this.indexConfig.opClass = opClass;
|
|
500
|
+
return this;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
var IndexedColumn = class {
|
|
504
|
+
static [entityKind] = "IndexedColumn";
|
|
505
|
+
constructor(name, keyAsName, type, indexConfig) {
|
|
506
|
+
this.name = name;
|
|
507
|
+
this.keyAsName = keyAsName;
|
|
508
|
+
this.type = type;
|
|
509
|
+
this.indexConfig = indexConfig;
|
|
510
|
+
}
|
|
511
|
+
name;
|
|
512
|
+
keyAsName;
|
|
513
|
+
type;
|
|
514
|
+
indexConfig;
|
|
515
|
+
};
|
|
516
|
+
var PgArrayBuilder = class extends PgColumnBuilder {
|
|
517
|
+
static [entityKind] = "PgArrayBuilder";
|
|
518
|
+
constructor(name, baseBuilder, size) {
|
|
519
|
+
super(name, "array", "PgArray");
|
|
520
|
+
this.config.baseBuilder = baseBuilder;
|
|
521
|
+
this.config.size = size;
|
|
522
|
+
}
|
|
523
|
+
/** @internal */
|
|
524
|
+
build(table) {
|
|
525
|
+
const baseColumn = this.config.baseBuilder.build(table);
|
|
526
|
+
return new PgArray(
|
|
527
|
+
table,
|
|
528
|
+
this.config,
|
|
529
|
+
baseColumn
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
var PgArray = class _PgArray extends PgColumn {
|
|
534
|
+
constructor(table, config, baseColumn, range) {
|
|
535
|
+
super(table, config);
|
|
536
|
+
this.baseColumn = baseColumn;
|
|
537
|
+
this.range = range;
|
|
538
|
+
this.size = config.size;
|
|
539
|
+
}
|
|
540
|
+
size;
|
|
541
|
+
static [entityKind] = "PgArray";
|
|
542
|
+
getSQLType() {
|
|
543
|
+
return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`;
|
|
544
|
+
}
|
|
545
|
+
mapFromDriverValue(value) {
|
|
546
|
+
if (typeof value === "string") {
|
|
547
|
+
value = parsePgArray(value);
|
|
548
|
+
}
|
|
549
|
+
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
550
|
+
}
|
|
551
|
+
mapToDriverValue(value, isNestedArray = false) {
|
|
552
|
+
const a = value.map(
|
|
553
|
+
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
|
554
|
+
);
|
|
555
|
+
if (isNestedArray) return a;
|
|
556
|
+
return makePgArray(a);
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
561
|
+
var PgEnumObjectColumnBuilder = class extends PgColumnBuilder {
|
|
562
|
+
static [entityKind] = "PgEnumObjectColumnBuilder";
|
|
563
|
+
constructor(name, enumInstance) {
|
|
564
|
+
super(name, "string", "PgEnumObjectColumn");
|
|
565
|
+
this.config.enum = enumInstance;
|
|
566
|
+
}
|
|
567
|
+
/** @internal */
|
|
568
|
+
build(table) {
|
|
569
|
+
return new PgEnumObjectColumn(
|
|
570
|
+
table,
|
|
571
|
+
this.config
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
var PgEnumObjectColumn = class extends PgColumn {
|
|
576
|
+
static [entityKind] = "PgEnumObjectColumn";
|
|
577
|
+
enum;
|
|
578
|
+
enumValues = this.config.enum.enumValues;
|
|
579
|
+
constructor(table, config) {
|
|
580
|
+
super(table, config);
|
|
581
|
+
this.enum = config.enum;
|
|
582
|
+
}
|
|
583
|
+
getSQLType() {
|
|
584
|
+
return this.enum.enumName;
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
var isPgEnumSym = /* @__PURE__ */ Symbol.for("drizzle:isPgEnum");
|
|
588
|
+
function isPgEnum(obj) {
|
|
589
|
+
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
590
|
+
}
|
|
591
|
+
var PgEnumColumnBuilder = class extends PgColumnBuilder {
|
|
592
|
+
static [entityKind] = "PgEnumColumnBuilder";
|
|
593
|
+
constructor(name, enumInstance) {
|
|
594
|
+
super(name, "string", "PgEnumColumn");
|
|
595
|
+
this.config.enum = enumInstance;
|
|
596
|
+
}
|
|
597
|
+
/** @internal */
|
|
598
|
+
build(table) {
|
|
599
|
+
return new PgEnumColumn(
|
|
600
|
+
table,
|
|
601
|
+
this.config
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
var PgEnumColumn = class extends PgColumn {
|
|
606
|
+
static [entityKind] = "PgEnumColumn";
|
|
607
|
+
enum = this.config.enum;
|
|
608
|
+
enumValues = this.config.enum.enumValues;
|
|
609
|
+
constructor(table, config) {
|
|
610
|
+
super(table, config);
|
|
611
|
+
this.enum = config.enum;
|
|
612
|
+
}
|
|
613
|
+
getSQLType() {
|
|
614
|
+
return this.enum.enumName;
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
// node_modules/drizzle-orm/subquery.js
|
|
619
|
+
var Subquery = class {
|
|
620
|
+
static [entityKind] = "Subquery";
|
|
621
|
+
constructor(sql2, fields, alias, isWith = false, usedTables = []) {
|
|
622
|
+
this._ = {
|
|
623
|
+
brand: "Subquery",
|
|
624
|
+
sql: sql2,
|
|
625
|
+
selectedFields: fields,
|
|
626
|
+
alias,
|
|
627
|
+
isWith,
|
|
628
|
+
usedTables
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
// getSQL(): SQL<unknown> {
|
|
632
|
+
// return new SQL([this]);
|
|
633
|
+
// }
|
|
634
|
+
};
|
|
635
|
+
var WithSubquery = class extends Subquery {
|
|
636
|
+
static [entityKind] = "WithSubquery";
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
// node_modules/drizzle-orm/version.js
|
|
640
|
+
var version = "0.45.2";
|
|
641
|
+
|
|
642
|
+
// node_modules/drizzle-orm/tracing.js
|
|
643
|
+
var otel;
|
|
644
|
+
var rawTracer;
|
|
645
|
+
var tracer = {
|
|
646
|
+
startActiveSpan(name, fn) {
|
|
647
|
+
if (!otel) {
|
|
648
|
+
return fn();
|
|
649
|
+
}
|
|
650
|
+
if (!rawTracer) {
|
|
651
|
+
rawTracer = otel.trace.getTracer("drizzle-orm", version);
|
|
652
|
+
}
|
|
653
|
+
return iife(
|
|
654
|
+
(otel2, rawTracer2) => rawTracer2.startActiveSpan(
|
|
655
|
+
name,
|
|
656
|
+
(span) => {
|
|
657
|
+
try {
|
|
658
|
+
return fn(span);
|
|
659
|
+
} catch (e) {
|
|
660
|
+
span.setStatus({
|
|
661
|
+
code: otel2.SpanStatusCode.ERROR,
|
|
662
|
+
message: e instanceof Error ? e.message : "Unknown error"
|
|
663
|
+
// eslint-disable-line no-instanceof/no-instanceof
|
|
664
|
+
});
|
|
665
|
+
throw e;
|
|
666
|
+
} finally {
|
|
667
|
+
span.end();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
),
|
|
671
|
+
otel,
|
|
672
|
+
rawTracer
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
// node_modules/drizzle-orm/view-common.js
|
|
678
|
+
var ViewBaseConfig = /* @__PURE__ */ Symbol.for("drizzle:ViewBaseConfig");
|
|
679
|
+
|
|
680
|
+
// node_modules/drizzle-orm/table.js
|
|
681
|
+
var Schema = /* @__PURE__ */ Symbol.for("drizzle:Schema");
|
|
682
|
+
var Columns = /* @__PURE__ */ Symbol.for("drizzle:Columns");
|
|
683
|
+
var ExtraConfigColumns = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigColumns");
|
|
684
|
+
var OriginalName = /* @__PURE__ */ Symbol.for("drizzle:OriginalName");
|
|
685
|
+
var BaseName = /* @__PURE__ */ Symbol.for("drizzle:BaseName");
|
|
686
|
+
var IsAlias = /* @__PURE__ */ Symbol.for("drizzle:IsAlias");
|
|
687
|
+
var ExtraConfigBuilder = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigBuilder");
|
|
688
|
+
var IsDrizzleTable = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleTable");
|
|
689
|
+
var Table = class {
|
|
690
|
+
static [entityKind] = "Table";
|
|
691
|
+
/** @internal */
|
|
692
|
+
static Symbol = {
|
|
693
|
+
Name: TableName,
|
|
694
|
+
Schema,
|
|
695
|
+
OriginalName,
|
|
696
|
+
Columns,
|
|
697
|
+
ExtraConfigColumns,
|
|
698
|
+
BaseName,
|
|
699
|
+
IsAlias,
|
|
700
|
+
ExtraConfigBuilder
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* @internal
|
|
704
|
+
* Can be changed if the table is aliased.
|
|
705
|
+
*/
|
|
706
|
+
[TableName];
|
|
707
|
+
/**
|
|
708
|
+
* @internal
|
|
709
|
+
* Used to store the original name of the table, before any aliasing.
|
|
710
|
+
*/
|
|
711
|
+
[OriginalName];
|
|
712
|
+
/** @internal */
|
|
713
|
+
[Schema];
|
|
714
|
+
/** @internal */
|
|
715
|
+
[Columns];
|
|
716
|
+
/** @internal */
|
|
717
|
+
[ExtraConfigColumns];
|
|
718
|
+
/**
|
|
719
|
+
* @internal
|
|
720
|
+
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
721
|
+
*/
|
|
722
|
+
[BaseName];
|
|
723
|
+
/** @internal */
|
|
724
|
+
[IsAlias] = false;
|
|
725
|
+
/** @internal */
|
|
726
|
+
[IsDrizzleTable] = true;
|
|
727
|
+
/** @internal */
|
|
728
|
+
[ExtraConfigBuilder] = void 0;
|
|
729
|
+
constructor(name, schema, baseName) {
|
|
730
|
+
this[TableName] = this[OriginalName] = name;
|
|
731
|
+
this[Schema] = schema;
|
|
732
|
+
this[BaseName] = baseName;
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
function getTableName(table) {
|
|
736
|
+
return table[TableName];
|
|
737
|
+
}
|
|
738
|
+
function getTableUniqueName(table) {
|
|
739
|
+
return `${table[Schema] ?? "public"}.${table[TableName]}`;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// node_modules/drizzle-orm/sql/sql.js
|
|
743
|
+
var FakePrimitiveParam = class {
|
|
744
|
+
static [entityKind] = "FakePrimitiveParam";
|
|
745
|
+
};
|
|
746
|
+
function isSQLWrapper(value) {
|
|
747
|
+
return value !== null && value !== void 0 && typeof value.getSQL === "function";
|
|
748
|
+
}
|
|
749
|
+
function mergeQueries(queries) {
|
|
750
|
+
const result = { sql: "", params: [] };
|
|
751
|
+
for (const query of queries) {
|
|
752
|
+
result.sql += query.sql;
|
|
753
|
+
result.params.push(...query.params);
|
|
754
|
+
if (query.typings?.length) {
|
|
755
|
+
if (!result.typings) {
|
|
756
|
+
result.typings = [];
|
|
757
|
+
}
|
|
758
|
+
result.typings.push(...query.typings);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
763
|
+
var StringChunk = class {
|
|
764
|
+
static [entityKind] = "StringChunk";
|
|
765
|
+
value;
|
|
766
|
+
constructor(value) {
|
|
767
|
+
this.value = Array.isArray(value) ? value : [value];
|
|
768
|
+
}
|
|
769
|
+
getSQL() {
|
|
770
|
+
return new SQL([this]);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
var SQL = class _SQL {
|
|
774
|
+
constructor(queryChunks) {
|
|
775
|
+
this.queryChunks = queryChunks;
|
|
776
|
+
for (const chunk of queryChunks) {
|
|
777
|
+
if (is(chunk, Table)) {
|
|
778
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
779
|
+
this.usedTables.push(
|
|
780
|
+
schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
static [entityKind] = "SQL";
|
|
786
|
+
/** @internal */
|
|
787
|
+
decoder = noopDecoder;
|
|
788
|
+
shouldInlineParams = false;
|
|
789
|
+
/** @internal */
|
|
790
|
+
usedTables = [];
|
|
791
|
+
append(query) {
|
|
792
|
+
this.queryChunks.push(...query.queryChunks);
|
|
793
|
+
return this;
|
|
794
|
+
}
|
|
795
|
+
toQuery(config) {
|
|
796
|
+
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
797
|
+
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
798
|
+
span?.setAttributes({
|
|
799
|
+
"drizzle.query.text": query.sql,
|
|
800
|
+
"drizzle.query.params": JSON.stringify(query.params)
|
|
801
|
+
});
|
|
802
|
+
return query;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
buildQueryFromSourceParams(chunks, _config) {
|
|
806
|
+
const config = Object.assign({}, _config, {
|
|
807
|
+
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
808
|
+
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
809
|
+
});
|
|
810
|
+
const {
|
|
811
|
+
casing,
|
|
812
|
+
escapeName,
|
|
813
|
+
escapeParam,
|
|
814
|
+
prepareTyping,
|
|
815
|
+
inlineParams,
|
|
816
|
+
paramStartIndex
|
|
817
|
+
} = config;
|
|
818
|
+
return mergeQueries(chunks.map((chunk) => {
|
|
819
|
+
if (is(chunk, StringChunk)) {
|
|
820
|
+
return { sql: chunk.value.join(""), params: [] };
|
|
821
|
+
}
|
|
822
|
+
if (is(chunk, Name)) {
|
|
823
|
+
return { sql: escapeName(chunk.value), params: [] };
|
|
824
|
+
}
|
|
825
|
+
if (chunk === void 0) {
|
|
826
|
+
return { sql: "", params: [] };
|
|
827
|
+
}
|
|
828
|
+
if (Array.isArray(chunk)) {
|
|
829
|
+
const result = [new StringChunk("(")];
|
|
830
|
+
for (const [i, p] of chunk.entries()) {
|
|
831
|
+
result.push(p);
|
|
832
|
+
if (i < chunk.length - 1) {
|
|
833
|
+
result.push(new StringChunk(", "));
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
result.push(new StringChunk(")"));
|
|
837
|
+
return this.buildQueryFromSourceParams(result, config);
|
|
838
|
+
}
|
|
839
|
+
if (is(chunk, _SQL)) {
|
|
840
|
+
return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
841
|
+
...config,
|
|
842
|
+
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
if (is(chunk, Table)) {
|
|
846
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
847
|
+
const tableName = chunk[Table.Symbol.Name];
|
|
848
|
+
return {
|
|
849
|
+
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
850
|
+
params: []
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
if (is(chunk, Column)) {
|
|
854
|
+
const columnName = casing.getColumnCasing(chunk);
|
|
855
|
+
if (_config.invokeSource === "indexes") {
|
|
856
|
+
return { sql: escapeName(columnName), params: [] };
|
|
857
|
+
}
|
|
858
|
+
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
859
|
+
return {
|
|
860
|
+
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),
|
|
861
|
+
params: []
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
if (is(chunk, View)) {
|
|
865
|
+
const schemaName = chunk[ViewBaseConfig].schema;
|
|
866
|
+
const viewName = chunk[ViewBaseConfig].name;
|
|
867
|
+
return {
|
|
868
|
+
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
869
|
+
params: []
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
if (is(chunk, Param)) {
|
|
873
|
+
if (is(chunk.value, Placeholder)) {
|
|
874
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
875
|
+
}
|
|
876
|
+
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
877
|
+
if (is(mappedValue, _SQL)) {
|
|
878
|
+
return this.buildQueryFromSourceParams([mappedValue], config);
|
|
879
|
+
}
|
|
880
|
+
if (inlineParams) {
|
|
881
|
+
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
|
|
882
|
+
}
|
|
883
|
+
let typings = ["none"];
|
|
884
|
+
if (prepareTyping) {
|
|
885
|
+
typings = [prepareTyping(chunk.encoder)];
|
|
886
|
+
}
|
|
887
|
+
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
|
|
888
|
+
}
|
|
889
|
+
if (is(chunk, Placeholder)) {
|
|
890
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
891
|
+
}
|
|
892
|
+
if (is(chunk, _SQL.Aliased) && chunk.fieldAlias !== void 0) {
|
|
893
|
+
return { sql: escapeName(chunk.fieldAlias), params: [] };
|
|
894
|
+
}
|
|
895
|
+
if (is(chunk, Subquery)) {
|
|
896
|
+
if (chunk._.isWith) {
|
|
897
|
+
return { sql: escapeName(chunk._.alias), params: [] };
|
|
898
|
+
}
|
|
899
|
+
return this.buildQueryFromSourceParams([
|
|
900
|
+
new StringChunk("("),
|
|
901
|
+
chunk._.sql,
|
|
902
|
+
new StringChunk(") "),
|
|
903
|
+
new Name(chunk._.alias)
|
|
904
|
+
], config);
|
|
905
|
+
}
|
|
906
|
+
if (isPgEnum(chunk)) {
|
|
907
|
+
if (chunk.schema) {
|
|
908
|
+
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
|
|
909
|
+
}
|
|
910
|
+
return { sql: escapeName(chunk.enumName), params: [] };
|
|
911
|
+
}
|
|
912
|
+
if (isSQLWrapper(chunk)) {
|
|
913
|
+
if (chunk.shouldOmitSQLParens?.()) {
|
|
914
|
+
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
915
|
+
}
|
|
916
|
+
return this.buildQueryFromSourceParams([
|
|
917
|
+
new StringChunk("("),
|
|
918
|
+
chunk.getSQL(),
|
|
919
|
+
new StringChunk(")")
|
|
920
|
+
], config);
|
|
921
|
+
}
|
|
922
|
+
if (inlineParams) {
|
|
923
|
+
return { sql: this.mapInlineParam(chunk, config), params: [] };
|
|
924
|
+
}
|
|
925
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
926
|
+
}));
|
|
927
|
+
}
|
|
928
|
+
mapInlineParam(chunk, { escapeString }) {
|
|
929
|
+
if (chunk === null) {
|
|
930
|
+
return "null";
|
|
931
|
+
}
|
|
932
|
+
if (typeof chunk === "number" || typeof chunk === "boolean") {
|
|
933
|
+
return chunk.toString();
|
|
934
|
+
}
|
|
935
|
+
if (typeof chunk === "string") {
|
|
936
|
+
return escapeString(chunk);
|
|
937
|
+
}
|
|
938
|
+
if (typeof chunk === "object") {
|
|
939
|
+
const mappedValueAsString = chunk.toString();
|
|
940
|
+
if (mappedValueAsString === "[object Object]") {
|
|
941
|
+
return escapeString(JSON.stringify(chunk));
|
|
942
|
+
}
|
|
943
|
+
return escapeString(mappedValueAsString);
|
|
944
|
+
}
|
|
945
|
+
throw new Error("Unexpected param value: " + chunk);
|
|
946
|
+
}
|
|
947
|
+
getSQL() {
|
|
948
|
+
return this;
|
|
949
|
+
}
|
|
950
|
+
as(alias) {
|
|
951
|
+
if (alias === void 0) {
|
|
952
|
+
return this;
|
|
953
|
+
}
|
|
954
|
+
return new _SQL.Aliased(this, alias);
|
|
955
|
+
}
|
|
956
|
+
mapWith(decoder) {
|
|
957
|
+
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
958
|
+
return this;
|
|
959
|
+
}
|
|
960
|
+
inlineParams() {
|
|
961
|
+
this.shouldInlineParams = true;
|
|
962
|
+
return this;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* This method is used to conditionally include a part of the query.
|
|
966
|
+
*
|
|
967
|
+
* @param condition - Condition to check
|
|
968
|
+
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
969
|
+
*/
|
|
970
|
+
if(condition) {
|
|
971
|
+
return condition ? this : void 0;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
var Name = class {
|
|
975
|
+
constructor(value) {
|
|
976
|
+
this.value = value;
|
|
977
|
+
}
|
|
978
|
+
static [entityKind] = "Name";
|
|
979
|
+
brand;
|
|
980
|
+
getSQL() {
|
|
981
|
+
return new SQL([this]);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
function isDriverValueEncoder(value) {
|
|
985
|
+
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
|
|
986
|
+
}
|
|
987
|
+
var noopDecoder = {
|
|
988
|
+
mapFromDriverValue: (value) => value
|
|
989
|
+
};
|
|
990
|
+
var noopEncoder = {
|
|
991
|
+
mapToDriverValue: (value) => value
|
|
992
|
+
};
|
|
993
|
+
var noopMapper = {
|
|
994
|
+
...noopDecoder,
|
|
995
|
+
...noopEncoder
|
|
996
|
+
};
|
|
997
|
+
var Param = class {
|
|
998
|
+
/**
|
|
999
|
+
* @param value - Parameter value
|
|
1000
|
+
* @param encoder - Encoder to convert the value to a driver parameter
|
|
1001
|
+
*/
|
|
1002
|
+
constructor(value, encoder = noopEncoder) {
|
|
1003
|
+
this.value = value;
|
|
1004
|
+
this.encoder = encoder;
|
|
1005
|
+
}
|
|
1006
|
+
static [entityKind] = "Param";
|
|
1007
|
+
brand;
|
|
1008
|
+
getSQL() {
|
|
1009
|
+
return new SQL([this]);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
function sql(strings, ...params) {
|
|
1013
|
+
const queryChunks = [];
|
|
1014
|
+
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
|
|
1015
|
+
queryChunks.push(new StringChunk(strings[0]));
|
|
1016
|
+
}
|
|
1017
|
+
for (const [paramIndex, param2] of params.entries()) {
|
|
1018
|
+
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
1019
|
+
}
|
|
1020
|
+
return new SQL(queryChunks);
|
|
1021
|
+
}
|
|
1022
|
+
((sql2) => {
|
|
1023
|
+
function empty() {
|
|
1024
|
+
return new SQL([]);
|
|
1025
|
+
}
|
|
1026
|
+
sql2.empty = empty;
|
|
1027
|
+
function fromList(list) {
|
|
1028
|
+
return new SQL(list);
|
|
1029
|
+
}
|
|
1030
|
+
sql2.fromList = fromList;
|
|
1031
|
+
function raw(str) {
|
|
1032
|
+
return new SQL([new StringChunk(str)]);
|
|
1033
|
+
}
|
|
1034
|
+
sql2.raw = raw;
|
|
1035
|
+
function join(chunks, separator) {
|
|
1036
|
+
const result = [];
|
|
1037
|
+
for (const [i, chunk] of chunks.entries()) {
|
|
1038
|
+
if (i > 0 && separator !== void 0) {
|
|
1039
|
+
result.push(separator);
|
|
1040
|
+
}
|
|
1041
|
+
result.push(chunk);
|
|
1042
|
+
}
|
|
1043
|
+
return new SQL(result);
|
|
1044
|
+
}
|
|
1045
|
+
sql2.join = join;
|
|
1046
|
+
function identifier(value) {
|
|
1047
|
+
return new Name(value);
|
|
1048
|
+
}
|
|
1049
|
+
sql2.identifier = identifier;
|
|
1050
|
+
function placeholder2(name2) {
|
|
1051
|
+
return new Placeholder(name2);
|
|
1052
|
+
}
|
|
1053
|
+
sql2.placeholder = placeholder2;
|
|
1054
|
+
function param2(value, encoder) {
|
|
1055
|
+
return new Param(value, encoder);
|
|
1056
|
+
}
|
|
1057
|
+
sql2.param = param2;
|
|
1058
|
+
})(sql || (sql = {}));
|
|
1059
|
+
((SQL2) => {
|
|
1060
|
+
class Aliased {
|
|
1061
|
+
constructor(sql2, fieldAlias) {
|
|
1062
|
+
this.sql = sql2;
|
|
1063
|
+
this.fieldAlias = fieldAlias;
|
|
1064
|
+
}
|
|
1065
|
+
static [entityKind] = "SQL.Aliased";
|
|
1066
|
+
/** @internal */
|
|
1067
|
+
isSelectionField = false;
|
|
1068
|
+
getSQL() {
|
|
1069
|
+
return this.sql;
|
|
1070
|
+
}
|
|
1071
|
+
/** @internal */
|
|
1072
|
+
clone() {
|
|
1073
|
+
return new Aliased(this.sql, this.fieldAlias);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
SQL2.Aliased = Aliased;
|
|
1077
|
+
})(SQL || (SQL = {}));
|
|
1078
|
+
var Placeholder = class {
|
|
1079
|
+
constructor(name2) {
|
|
1080
|
+
this.name = name2;
|
|
1081
|
+
}
|
|
1082
|
+
static [entityKind] = "Placeholder";
|
|
1083
|
+
getSQL() {
|
|
1084
|
+
return new SQL([this]);
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
function fillPlaceholders(params, values) {
|
|
1088
|
+
return params.map((p) => {
|
|
1089
|
+
if (is(p, Placeholder)) {
|
|
1090
|
+
if (!(p.name in values)) {
|
|
1091
|
+
throw new Error(`No value for placeholder "${p.name}" was provided`);
|
|
1092
|
+
}
|
|
1093
|
+
return values[p.name];
|
|
1094
|
+
}
|
|
1095
|
+
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
1096
|
+
if (!(p.value.name in values)) {
|
|
1097
|
+
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
1098
|
+
}
|
|
1099
|
+
return p.encoder.mapToDriverValue(values[p.value.name]);
|
|
1100
|
+
}
|
|
1101
|
+
return p;
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
var IsDrizzleView = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleView");
|
|
1105
|
+
var View = class {
|
|
1106
|
+
static [entityKind] = "View";
|
|
1107
|
+
/** @internal */
|
|
1108
|
+
[ViewBaseConfig];
|
|
1109
|
+
/** @internal */
|
|
1110
|
+
[IsDrizzleView] = true;
|
|
1111
|
+
constructor({ name: name2, schema, selectedFields, query }) {
|
|
1112
|
+
this[ViewBaseConfig] = {
|
|
1113
|
+
name: name2,
|
|
1114
|
+
originalName: name2,
|
|
1115
|
+
schema,
|
|
1116
|
+
selectedFields,
|
|
1117
|
+
query,
|
|
1118
|
+
isExisting: !query,
|
|
1119
|
+
isAlias: false
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
getSQL() {
|
|
1123
|
+
return new SQL([this]);
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
Column.prototype.getSQL = function() {
|
|
1127
|
+
return new SQL([this]);
|
|
1128
|
+
};
|
|
1129
|
+
Table.prototype.getSQL = function() {
|
|
1130
|
+
return new SQL([this]);
|
|
1131
|
+
};
|
|
1132
|
+
Subquery.prototype.getSQL = function() {
|
|
1133
|
+
return new SQL([this]);
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
// node_modules/drizzle-orm/sql/expressions/conditions.js
|
|
1137
|
+
function bindIfParam(value, column) {
|
|
1138
|
+
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
|
|
1139
|
+
return new Param(value, column);
|
|
1140
|
+
}
|
|
1141
|
+
return value;
|
|
1142
|
+
}
|
|
1143
|
+
var eq = (left, right) => {
|
|
1144
|
+
return sql`${left} = ${bindIfParam(right, left)}`;
|
|
1145
|
+
};
|
|
1146
|
+
var ne = (left, right) => {
|
|
1147
|
+
return sql`${left} <> ${bindIfParam(right, left)}`;
|
|
1148
|
+
};
|
|
1149
|
+
function and(...unfilteredConditions) {
|
|
1150
|
+
const conditions = unfilteredConditions.filter(
|
|
1151
|
+
(c) => c !== void 0
|
|
1152
|
+
);
|
|
1153
|
+
if (conditions.length === 0) {
|
|
1154
|
+
return void 0;
|
|
1155
|
+
}
|
|
1156
|
+
if (conditions.length === 1) {
|
|
1157
|
+
return new SQL(conditions);
|
|
1158
|
+
}
|
|
1159
|
+
return new SQL([
|
|
1160
|
+
new StringChunk("("),
|
|
1161
|
+
sql.join(conditions, new StringChunk(" and ")),
|
|
1162
|
+
new StringChunk(")")
|
|
1163
|
+
]);
|
|
1164
|
+
}
|
|
1165
|
+
function or(...unfilteredConditions) {
|
|
1166
|
+
const conditions = unfilteredConditions.filter(
|
|
1167
|
+
(c) => c !== void 0
|
|
1168
|
+
);
|
|
1169
|
+
if (conditions.length === 0) {
|
|
1170
|
+
return void 0;
|
|
1171
|
+
}
|
|
1172
|
+
if (conditions.length === 1) {
|
|
1173
|
+
return new SQL(conditions);
|
|
1174
|
+
}
|
|
1175
|
+
return new SQL([
|
|
1176
|
+
new StringChunk("("),
|
|
1177
|
+
sql.join(conditions, new StringChunk(" or ")),
|
|
1178
|
+
new StringChunk(")")
|
|
1179
|
+
]);
|
|
1180
|
+
}
|
|
1181
|
+
function not(condition) {
|
|
1182
|
+
return sql`not ${condition}`;
|
|
1183
|
+
}
|
|
1184
|
+
var gt = (left, right) => {
|
|
1185
|
+
return sql`${left} > ${bindIfParam(right, left)}`;
|
|
1186
|
+
};
|
|
1187
|
+
var gte = (left, right) => {
|
|
1188
|
+
return sql`${left} >= ${bindIfParam(right, left)}`;
|
|
1189
|
+
};
|
|
1190
|
+
var lt = (left, right) => {
|
|
1191
|
+
return sql`${left} < ${bindIfParam(right, left)}`;
|
|
1192
|
+
};
|
|
1193
|
+
var lte = (left, right) => {
|
|
1194
|
+
return sql`${left} <= ${bindIfParam(right, left)}`;
|
|
1195
|
+
};
|
|
1196
|
+
function inArray(column, values) {
|
|
1197
|
+
if (Array.isArray(values)) {
|
|
1198
|
+
if (values.length === 0) {
|
|
1199
|
+
return sql`false`;
|
|
1200
|
+
}
|
|
1201
|
+
return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;
|
|
1202
|
+
}
|
|
1203
|
+
return sql`${column} in ${bindIfParam(values, column)}`;
|
|
1204
|
+
}
|
|
1205
|
+
function notInArray(column, values) {
|
|
1206
|
+
if (Array.isArray(values)) {
|
|
1207
|
+
if (values.length === 0) {
|
|
1208
|
+
return sql`true`;
|
|
1209
|
+
}
|
|
1210
|
+
return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;
|
|
1211
|
+
}
|
|
1212
|
+
return sql`${column} not in ${bindIfParam(values, column)}`;
|
|
1213
|
+
}
|
|
1214
|
+
function isNull(value) {
|
|
1215
|
+
return sql`${value} is null`;
|
|
1216
|
+
}
|
|
1217
|
+
function isNotNull(value) {
|
|
1218
|
+
return sql`${value} is not null`;
|
|
1219
|
+
}
|
|
1220
|
+
function exists(subquery) {
|
|
1221
|
+
return sql`exists ${subquery}`;
|
|
1222
|
+
}
|
|
1223
|
+
function notExists(subquery) {
|
|
1224
|
+
return sql`not exists ${subquery}`;
|
|
1225
|
+
}
|
|
1226
|
+
function between(column, min, max) {
|
|
1227
|
+
return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam(
|
|
1228
|
+
max,
|
|
1229
|
+
column
|
|
1230
|
+
)}`;
|
|
1231
|
+
}
|
|
1232
|
+
function notBetween(column, min, max) {
|
|
1233
|
+
return sql`${column} not between ${bindIfParam(
|
|
1234
|
+
min,
|
|
1235
|
+
column
|
|
1236
|
+
)} and ${bindIfParam(max, column)}`;
|
|
1237
|
+
}
|
|
1238
|
+
function like(column, value) {
|
|
1239
|
+
return sql`${column} like ${value}`;
|
|
1240
|
+
}
|
|
1241
|
+
function notLike(column, value) {
|
|
1242
|
+
return sql`${column} not like ${value}`;
|
|
1243
|
+
}
|
|
1244
|
+
function ilike(column, value) {
|
|
1245
|
+
return sql`${column} ilike ${value}`;
|
|
1246
|
+
}
|
|
1247
|
+
function notIlike(column, value) {
|
|
1248
|
+
return sql`${column} not ilike ${value}`;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
// src/db/schema.ts
|
|
1252
|
+
var schema_exports = {};
|
|
1253
|
+
__export(schema_exports, {
|
|
1254
|
+
activityEvents: () => activityEvents,
|
|
1255
|
+
approvalRequests: () => approvalRequests,
|
|
1256
|
+
auditTrail: () => auditTrail,
|
|
1257
|
+
contradictions: () => contradictions,
|
|
1258
|
+
entities: () => entities,
|
|
1259
|
+
entityRelations: () => entityRelations,
|
|
1260
|
+
evalSessions: () => evalSessions,
|
|
1261
|
+
feedbackEvents: () => feedbackEvents,
|
|
1262
|
+
historyInjections: () => historyInjections,
|
|
1263
|
+
historySnippetEmbeddings: () => historySnippetEmbeddings,
|
|
1264
|
+
historySnippets: () => historySnippets,
|
|
1265
|
+
hookCalls: () => hookCalls,
|
|
1266
|
+
implicitSignals: () => implicitSignals,
|
|
1267
|
+
llmUsage: () => llmUsage,
|
|
1268
|
+
maintenanceCleanupLog: () => maintenanceCleanupLog,
|
|
1269
|
+
memories: () => memories,
|
|
1270
|
+
memoryEmbeddings: () => memoryEmbeddings,
|
|
1271
|
+
memoryEntities: () => memoryEntities,
|
|
1272
|
+
memoryInjections: () => memoryInjections,
|
|
1273
|
+
memoryMaintenanceTasks: () => memoryMaintenanceTasks,
|
|
1274
|
+
policyRules: () => policyRules,
|
|
1275
|
+
qualitySnapshots: () => qualitySnapshots,
|
|
1276
|
+
syncState: () => syncState
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
// node_modules/drizzle-orm/utils.js
|
|
1280
|
+
function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
1281
|
+
const nullifyMap = {};
|
|
1282
|
+
const result = columns.reduce(
|
|
1283
|
+
(result2, { path, field }, columnIndex) => {
|
|
1284
|
+
let decoder;
|
|
1285
|
+
if (is(field, Column)) {
|
|
1286
|
+
decoder = field;
|
|
1287
|
+
} else if (is(field, SQL)) {
|
|
1288
|
+
decoder = field.decoder;
|
|
1289
|
+
} else if (is(field, Subquery)) {
|
|
1290
|
+
decoder = field._.sql.decoder;
|
|
1291
|
+
} else {
|
|
1292
|
+
decoder = field.sql.decoder;
|
|
1293
|
+
}
|
|
1294
|
+
let node = result2;
|
|
1295
|
+
for (const [pathChunkIndex, pathChunk] of path.entries()) {
|
|
1296
|
+
if (pathChunkIndex < path.length - 1) {
|
|
1297
|
+
if (!(pathChunk in node)) {
|
|
1298
|
+
node[pathChunk] = {};
|
|
1299
|
+
}
|
|
1300
|
+
node = node[pathChunk];
|
|
1301
|
+
} else {
|
|
1302
|
+
const rawValue = row[columnIndex];
|
|
1303
|
+
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
|
1304
|
+
if (joinsNotNullableMap && is(field, Column) && path.length === 2) {
|
|
1305
|
+
const objectName = path[0];
|
|
1306
|
+
if (!(objectName in nullifyMap)) {
|
|
1307
|
+
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
|
1308
|
+
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
|
|
1309
|
+
nullifyMap[objectName] = false;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
return result2;
|
|
1315
|
+
},
|
|
1316
|
+
{}
|
|
1317
|
+
);
|
|
1318
|
+
if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) {
|
|
1319
|
+
for (const [objectName, tableName] of Object.entries(nullifyMap)) {
|
|
1320
|
+
if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) {
|
|
1321
|
+
result[objectName] = null;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return result;
|
|
1326
|
+
}
|
|
1327
|
+
function orderSelectedFields(fields, pathPrefix) {
|
|
1328
|
+
return Object.entries(fields).reduce((result, [name, field]) => {
|
|
1329
|
+
if (typeof name !== "string") {
|
|
1330
|
+
return result;
|
|
1331
|
+
}
|
|
1332
|
+
const newPath = pathPrefix ? [...pathPrefix, name] : [name];
|
|
1333
|
+
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
|
|
1334
|
+
result.push({ path: newPath, field });
|
|
1335
|
+
} else if (is(field, Table)) {
|
|
1336
|
+
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
|
1337
|
+
} else {
|
|
1338
|
+
result.push(...orderSelectedFields(field, newPath));
|
|
1339
|
+
}
|
|
1340
|
+
return result;
|
|
1341
|
+
}, []);
|
|
1342
|
+
}
|
|
1343
|
+
function haveSameKeys(left, right) {
|
|
1344
|
+
const leftKeys = Object.keys(left);
|
|
1345
|
+
const rightKeys = Object.keys(right);
|
|
1346
|
+
if (leftKeys.length !== rightKeys.length) {
|
|
1347
|
+
return false;
|
|
1348
|
+
}
|
|
1349
|
+
for (const [index2, key] of leftKeys.entries()) {
|
|
1350
|
+
if (key !== rightKeys[index2]) {
|
|
1351
|
+
return false;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return true;
|
|
1355
|
+
}
|
|
1356
|
+
function mapUpdateSet(table, values) {
|
|
1357
|
+
const entries = Object.entries(values).filter(([, value]) => value !== void 0).map(([key, value]) => {
|
|
1358
|
+
if (is(value, SQL) || is(value, Column)) {
|
|
1359
|
+
return [key, value];
|
|
1360
|
+
} else {
|
|
1361
|
+
return [key, new Param(value, table[Table.Symbol.Columns][key])];
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
if (entries.length === 0) {
|
|
1365
|
+
throw new Error("No values to set");
|
|
1366
|
+
}
|
|
1367
|
+
return Object.fromEntries(entries);
|
|
1368
|
+
}
|
|
1369
|
+
function applyMixins(baseClass, extendedClasses) {
|
|
1370
|
+
for (const extendedClass of extendedClasses) {
|
|
1371
|
+
for (const name of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
|
1372
|
+
if (name === "constructor") continue;
|
|
1373
|
+
Object.defineProperty(
|
|
1374
|
+
baseClass.prototype,
|
|
1375
|
+
name,
|
|
1376
|
+
Object.getOwnPropertyDescriptor(extendedClass.prototype, name) || /* @__PURE__ */ Object.create(null)
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function getTableColumns(table) {
|
|
1382
|
+
return table[Table.Symbol.Columns];
|
|
1383
|
+
}
|
|
1384
|
+
function getTableLikeName(table) {
|
|
1385
|
+
return is(table, Subquery) ? table._.alias : is(table, View) ? table[ViewBaseConfig].name : is(table, SQL) ? void 0 : table[Table.Symbol.IsAlias] ? table[Table.Symbol.Name] : table[Table.Symbol.BaseName];
|
|
1386
|
+
}
|
|
1387
|
+
function getColumnNameAndConfig(a, b) {
|
|
1388
|
+
return {
|
|
1389
|
+
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
1390
|
+
config: typeof a === "object" ? a : b
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
function isConfig(data) {
|
|
1394
|
+
if (typeof data !== "object" || data === null) return false;
|
|
1395
|
+
if (data.constructor.name !== "Object") return false;
|
|
1396
|
+
if ("logger" in data) {
|
|
1397
|
+
const type = typeof data["logger"];
|
|
1398
|
+
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
|
|
1399
|
+
return true;
|
|
1400
|
+
}
|
|
1401
|
+
if ("schema" in data) {
|
|
1402
|
+
const type = typeof data["schema"];
|
|
1403
|
+
if (type !== "object" && type !== "undefined") return false;
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
if ("casing" in data) {
|
|
1407
|
+
const type = typeof data["casing"];
|
|
1408
|
+
if (type !== "string" && type !== "undefined") return false;
|
|
1409
|
+
return true;
|
|
1410
|
+
}
|
|
1411
|
+
if ("mode" in data) {
|
|
1412
|
+
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
|
|
1413
|
+
return true;
|
|
1414
|
+
}
|
|
1415
|
+
if ("connection" in data) {
|
|
1416
|
+
const type = typeof data["connection"];
|
|
1417
|
+
if (type !== "string" && type !== "object" && type !== "undefined") return false;
|
|
1418
|
+
return true;
|
|
1419
|
+
}
|
|
1420
|
+
if ("client" in data) {
|
|
1421
|
+
const type = typeof data["client"];
|
|
1422
|
+
if (type !== "object" && type !== "function" && type !== "undefined") return false;
|
|
1423
|
+
return true;
|
|
1424
|
+
}
|
|
1425
|
+
if (Object.keys(data).length === 0) return true;
|
|
1426
|
+
return false;
|
|
1427
|
+
}
|
|
1428
|
+
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
|
|
1429
|
+
|
|
1430
|
+
// node_modules/drizzle-orm/sqlite-core/foreign-keys.js
|
|
1431
|
+
var ForeignKeyBuilder2 = class {
|
|
1432
|
+
static [entityKind] = "SQLiteForeignKeyBuilder";
|
|
1433
|
+
/** @internal */
|
|
1434
|
+
reference;
|
|
1435
|
+
/** @internal */
|
|
1436
|
+
_onUpdate;
|
|
1437
|
+
/** @internal */
|
|
1438
|
+
_onDelete;
|
|
1439
|
+
constructor(config, actions) {
|
|
1440
|
+
this.reference = () => {
|
|
1441
|
+
const { name, columns, foreignColumns } = config();
|
|
1442
|
+
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
1443
|
+
};
|
|
1444
|
+
if (actions) {
|
|
1445
|
+
this._onUpdate = actions.onUpdate;
|
|
1446
|
+
this._onDelete = actions.onDelete;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
onUpdate(action) {
|
|
1450
|
+
this._onUpdate = action;
|
|
1451
|
+
return this;
|
|
1452
|
+
}
|
|
1453
|
+
onDelete(action) {
|
|
1454
|
+
this._onDelete = action;
|
|
1455
|
+
return this;
|
|
1456
|
+
}
|
|
1457
|
+
/** @internal */
|
|
1458
|
+
build(table) {
|
|
1459
|
+
return new ForeignKey2(table, this);
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
var ForeignKey2 = class {
|
|
1463
|
+
constructor(table, builder) {
|
|
1464
|
+
this.table = table;
|
|
1465
|
+
this.reference = builder.reference;
|
|
1466
|
+
this.onUpdate = builder._onUpdate;
|
|
1467
|
+
this.onDelete = builder._onDelete;
|
|
1468
|
+
}
|
|
1469
|
+
static [entityKind] = "SQLiteForeignKey";
|
|
1470
|
+
reference;
|
|
1471
|
+
onUpdate;
|
|
1472
|
+
onDelete;
|
|
1473
|
+
getName() {
|
|
1474
|
+
const { name, columns, foreignColumns } = this.reference();
|
|
1475
|
+
const columnNames = columns.map((column) => column.name);
|
|
1476
|
+
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
1477
|
+
const chunks = [
|
|
1478
|
+
this.table[TableName],
|
|
1479
|
+
...columnNames,
|
|
1480
|
+
foreignColumns[0].table[TableName],
|
|
1481
|
+
...foreignColumnNames
|
|
1482
|
+
];
|
|
1483
|
+
return name ?? `${chunks.join("_")}_fk`;
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// node_modules/drizzle-orm/sqlite-core/unique-constraint.js
|
|
1488
|
+
function uniqueKeyName2(table, columns) {
|
|
1489
|
+
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
1490
|
+
}
|
|
1491
|
+
var UniqueConstraintBuilder2 = class {
|
|
1492
|
+
constructor(columns, name) {
|
|
1493
|
+
this.name = name;
|
|
1494
|
+
this.columns = columns;
|
|
1495
|
+
}
|
|
1496
|
+
static [entityKind] = "SQLiteUniqueConstraintBuilder";
|
|
1497
|
+
/** @internal */
|
|
1498
|
+
columns;
|
|
1499
|
+
/** @internal */
|
|
1500
|
+
build(table) {
|
|
1501
|
+
return new UniqueConstraint2(table, this.columns, this.name);
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
var UniqueOnConstraintBuilder2 = class {
|
|
1505
|
+
static [entityKind] = "SQLiteUniqueOnConstraintBuilder";
|
|
1506
|
+
/** @internal */
|
|
1507
|
+
name;
|
|
1508
|
+
constructor(name) {
|
|
1509
|
+
this.name = name;
|
|
1510
|
+
}
|
|
1511
|
+
on(...columns) {
|
|
1512
|
+
return new UniqueConstraintBuilder2(columns, this.name);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
var UniqueConstraint2 = class {
|
|
1516
|
+
constructor(table, columns, name) {
|
|
1517
|
+
this.table = table;
|
|
1518
|
+
this.columns = columns;
|
|
1519
|
+
this.name = name ?? uniqueKeyName2(this.table, this.columns.map((column) => column.name));
|
|
1520
|
+
}
|
|
1521
|
+
static [entityKind] = "SQLiteUniqueConstraint";
|
|
1522
|
+
columns;
|
|
1523
|
+
name;
|
|
1524
|
+
getName() {
|
|
1525
|
+
return this.name;
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
|
|
1529
|
+
// node_modules/drizzle-orm/sqlite-core/columns/common.js
|
|
1530
|
+
var SQLiteColumnBuilder = class extends ColumnBuilder {
|
|
1531
|
+
static [entityKind] = "SQLiteColumnBuilder";
|
|
1532
|
+
foreignKeyConfigs = [];
|
|
1533
|
+
references(ref, actions = {}) {
|
|
1534
|
+
this.foreignKeyConfigs.push({ ref, actions });
|
|
1535
|
+
return this;
|
|
1536
|
+
}
|
|
1537
|
+
unique(name) {
|
|
1538
|
+
this.config.isUnique = true;
|
|
1539
|
+
this.config.uniqueName = name;
|
|
1540
|
+
return this;
|
|
1541
|
+
}
|
|
1542
|
+
generatedAlwaysAs(as, config) {
|
|
1543
|
+
this.config.generated = {
|
|
1544
|
+
as,
|
|
1545
|
+
type: "always",
|
|
1546
|
+
mode: config?.mode ?? "virtual"
|
|
1547
|
+
};
|
|
1548
|
+
return this;
|
|
1549
|
+
}
|
|
1550
|
+
/** @internal */
|
|
1551
|
+
buildForeignKeys(column, table) {
|
|
1552
|
+
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
1553
|
+
return ((ref2, actions2) => {
|
|
1554
|
+
const builder = new ForeignKeyBuilder2(() => {
|
|
1555
|
+
const foreignColumn = ref2();
|
|
1556
|
+
return { columns: [column], foreignColumns: [foreignColumn] };
|
|
1557
|
+
});
|
|
1558
|
+
if (actions2.onUpdate) {
|
|
1559
|
+
builder.onUpdate(actions2.onUpdate);
|
|
1560
|
+
}
|
|
1561
|
+
if (actions2.onDelete) {
|
|
1562
|
+
builder.onDelete(actions2.onDelete);
|
|
1563
|
+
}
|
|
1564
|
+
return builder.build(table);
|
|
1565
|
+
})(ref, actions);
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
var SQLiteColumn = class extends Column {
|
|
1570
|
+
constructor(table, config) {
|
|
1571
|
+
if (!config.uniqueName) {
|
|
1572
|
+
config.uniqueName = uniqueKeyName2(table, [config.name]);
|
|
1573
|
+
}
|
|
1574
|
+
super(table, config);
|
|
1575
|
+
this.table = table;
|
|
1576
|
+
}
|
|
1577
|
+
static [entityKind] = "SQLiteColumn";
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
// node_modules/drizzle-orm/sqlite-core/columns/blob.js
|
|
1581
|
+
var SQLiteBigIntBuilder = class extends SQLiteColumnBuilder {
|
|
1582
|
+
static [entityKind] = "SQLiteBigIntBuilder";
|
|
1583
|
+
constructor(name) {
|
|
1584
|
+
super(name, "bigint", "SQLiteBigInt");
|
|
1585
|
+
}
|
|
1586
|
+
/** @internal */
|
|
1587
|
+
build(table) {
|
|
1588
|
+
return new SQLiteBigInt(table, this.config);
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
var SQLiteBigInt = class extends SQLiteColumn {
|
|
1592
|
+
static [entityKind] = "SQLiteBigInt";
|
|
1593
|
+
getSQLType() {
|
|
1594
|
+
return "blob";
|
|
1595
|
+
}
|
|
1596
|
+
mapFromDriverValue(value) {
|
|
1597
|
+
if (typeof Buffer !== "undefined" && Buffer.from) {
|
|
1598
|
+
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);
|
|
1599
|
+
return BigInt(buf.toString("utf8"));
|
|
1600
|
+
}
|
|
1601
|
+
return BigInt(textDecoder.decode(value));
|
|
1602
|
+
}
|
|
1603
|
+
mapToDriverValue(value) {
|
|
1604
|
+
return Buffer.from(value.toString());
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
var SQLiteBlobJsonBuilder = class extends SQLiteColumnBuilder {
|
|
1608
|
+
static [entityKind] = "SQLiteBlobJsonBuilder";
|
|
1609
|
+
constructor(name) {
|
|
1610
|
+
super(name, "json", "SQLiteBlobJson");
|
|
1611
|
+
}
|
|
1612
|
+
/** @internal */
|
|
1613
|
+
build(table) {
|
|
1614
|
+
return new SQLiteBlobJson(
|
|
1615
|
+
table,
|
|
1616
|
+
this.config
|
|
1617
|
+
);
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
var SQLiteBlobJson = class extends SQLiteColumn {
|
|
1621
|
+
static [entityKind] = "SQLiteBlobJson";
|
|
1622
|
+
getSQLType() {
|
|
1623
|
+
return "blob";
|
|
1624
|
+
}
|
|
1625
|
+
mapFromDriverValue(value) {
|
|
1626
|
+
if (typeof Buffer !== "undefined" && Buffer.from) {
|
|
1627
|
+
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);
|
|
1628
|
+
return JSON.parse(buf.toString("utf8"));
|
|
1629
|
+
}
|
|
1630
|
+
return JSON.parse(textDecoder.decode(value));
|
|
1631
|
+
}
|
|
1632
|
+
mapToDriverValue(value) {
|
|
1633
|
+
return Buffer.from(JSON.stringify(value));
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
var SQLiteBlobBufferBuilder = class extends SQLiteColumnBuilder {
|
|
1637
|
+
static [entityKind] = "SQLiteBlobBufferBuilder";
|
|
1638
|
+
constructor(name) {
|
|
1639
|
+
super(name, "buffer", "SQLiteBlobBuffer");
|
|
1640
|
+
}
|
|
1641
|
+
/** @internal */
|
|
1642
|
+
build(table) {
|
|
1643
|
+
return new SQLiteBlobBuffer(table, this.config);
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
var SQLiteBlobBuffer = class extends SQLiteColumn {
|
|
1647
|
+
static [entityKind] = "SQLiteBlobBuffer";
|
|
1648
|
+
mapFromDriverValue(value) {
|
|
1649
|
+
if (Buffer.isBuffer(value)) {
|
|
1650
|
+
return value;
|
|
1651
|
+
}
|
|
1652
|
+
return Buffer.from(value);
|
|
1653
|
+
}
|
|
1654
|
+
getSQLType() {
|
|
1655
|
+
return "blob";
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
function blob(a, b) {
|
|
1659
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1660
|
+
if (config?.mode === "json") {
|
|
1661
|
+
return new SQLiteBlobJsonBuilder(name);
|
|
1662
|
+
}
|
|
1663
|
+
if (config?.mode === "bigint") {
|
|
1664
|
+
return new SQLiteBigIntBuilder(name);
|
|
1665
|
+
}
|
|
1666
|
+
return new SQLiteBlobBufferBuilder(name);
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
// node_modules/drizzle-orm/sqlite-core/columns/custom.js
|
|
1670
|
+
var SQLiteCustomColumnBuilder = class extends SQLiteColumnBuilder {
|
|
1671
|
+
static [entityKind] = "SQLiteCustomColumnBuilder";
|
|
1672
|
+
constructor(name, fieldConfig, customTypeParams) {
|
|
1673
|
+
super(name, "custom", "SQLiteCustomColumn");
|
|
1674
|
+
this.config.fieldConfig = fieldConfig;
|
|
1675
|
+
this.config.customTypeParams = customTypeParams;
|
|
1676
|
+
}
|
|
1677
|
+
/** @internal */
|
|
1678
|
+
build(table) {
|
|
1679
|
+
return new SQLiteCustomColumn(
|
|
1680
|
+
table,
|
|
1681
|
+
this.config
|
|
1682
|
+
);
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
var SQLiteCustomColumn = class extends SQLiteColumn {
|
|
1686
|
+
static [entityKind] = "SQLiteCustomColumn";
|
|
1687
|
+
sqlName;
|
|
1688
|
+
mapTo;
|
|
1689
|
+
mapFrom;
|
|
1690
|
+
constructor(table, config) {
|
|
1691
|
+
super(table, config);
|
|
1692
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
1693
|
+
this.mapTo = config.customTypeParams.toDriver;
|
|
1694
|
+
this.mapFrom = config.customTypeParams.fromDriver;
|
|
1695
|
+
}
|
|
1696
|
+
getSQLType() {
|
|
1697
|
+
return this.sqlName;
|
|
1698
|
+
}
|
|
1699
|
+
mapFromDriverValue(value) {
|
|
1700
|
+
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
1701
|
+
}
|
|
1702
|
+
mapToDriverValue(value) {
|
|
1703
|
+
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
function customType(customTypeParams) {
|
|
1707
|
+
return (a, b) => {
|
|
1708
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1709
|
+
return new SQLiteCustomColumnBuilder(
|
|
1710
|
+
name,
|
|
1711
|
+
config,
|
|
1712
|
+
customTypeParams
|
|
1713
|
+
);
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// node_modules/drizzle-orm/sqlite-core/columns/integer.js
|
|
1718
|
+
var SQLiteBaseIntegerBuilder = class extends SQLiteColumnBuilder {
|
|
1719
|
+
static [entityKind] = "SQLiteBaseIntegerBuilder";
|
|
1720
|
+
constructor(name, dataType, columnType) {
|
|
1721
|
+
super(name, dataType, columnType);
|
|
1722
|
+
this.config.autoIncrement = false;
|
|
1723
|
+
}
|
|
1724
|
+
primaryKey(config) {
|
|
1725
|
+
if (config?.autoIncrement) {
|
|
1726
|
+
this.config.autoIncrement = true;
|
|
1727
|
+
}
|
|
1728
|
+
this.config.hasDefault = true;
|
|
1729
|
+
return super.primaryKey();
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
var SQLiteBaseInteger = class extends SQLiteColumn {
|
|
1733
|
+
static [entityKind] = "SQLiteBaseInteger";
|
|
1734
|
+
autoIncrement = this.config.autoIncrement;
|
|
1735
|
+
getSQLType() {
|
|
1736
|
+
return "integer";
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
var SQLiteIntegerBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
1740
|
+
static [entityKind] = "SQLiteIntegerBuilder";
|
|
1741
|
+
constructor(name) {
|
|
1742
|
+
super(name, "number", "SQLiteInteger");
|
|
1743
|
+
}
|
|
1744
|
+
build(table) {
|
|
1745
|
+
return new SQLiteInteger(
|
|
1746
|
+
table,
|
|
1747
|
+
this.config
|
|
1748
|
+
);
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
var SQLiteInteger = class extends SQLiteBaseInteger {
|
|
1752
|
+
static [entityKind] = "SQLiteInteger";
|
|
1753
|
+
};
|
|
1754
|
+
var SQLiteTimestampBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
1755
|
+
static [entityKind] = "SQLiteTimestampBuilder";
|
|
1756
|
+
constructor(name, mode) {
|
|
1757
|
+
super(name, "date", "SQLiteTimestamp");
|
|
1758
|
+
this.config.mode = mode;
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* @deprecated Use `default()` with your own expression instead.
|
|
1762
|
+
*
|
|
1763
|
+
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
|
|
1764
|
+
*/
|
|
1765
|
+
defaultNow() {
|
|
1766
|
+
return this.default(sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
|
|
1767
|
+
}
|
|
1768
|
+
build(table) {
|
|
1769
|
+
return new SQLiteTimestamp(
|
|
1770
|
+
table,
|
|
1771
|
+
this.config
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
var SQLiteTimestamp = class extends SQLiteBaseInteger {
|
|
1776
|
+
static [entityKind] = "SQLiteTimestamp";
|
|
1777
|
+
mode = this.config.mode;
|
|
1778
|
+
mapFromDriverValue(value) {
|
|
1779
|
+
if (this.config.mode === "timestamp") {
|
|
1780
|
+
return new Date(value * 1e3);
|
|
1781
|
+
}
|
|
1782
|
+
return new Date(value);
|
|
1783
|
+
}
|
|
1784
|
+
mapToDriverValue(value) {
|
|
1785
|
+
const unix = value.getTime();
|
|
1786
|
+
if (this.config.mode === "timestamp") {
|
|
1787
|
+
return Math.floor(unix / 1e3);
|
|
1788
|
+
}
|
|
1789
|
+
return unix;
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
var SQLiteBooleanBuilder = class extends SQLiteBaseIntegerBuilder {
|
|
1793
|
+
static [entityKind] = "SQLiteBooleanBuilder";
|
|
1794
|
+
constructor(name, mode) {
|
|
1795
|
+
super(name, "boolean", "SQLiteBoolean");
|
|
1796
|
+
this.config.mode = mode;
|
|
1797
|
+
}
|
|
1798
|
+
build(table) {
|
|
1799
|
+
return new SQLiteBoolean(
|
|
1800
|
+
table,
|
|
1801
|
+
this.config
|
|
1802
|
+
);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
var SQLiteBoolean = class extends SQLiteBaseInteger {
|
|
1806
|
+
static [entityKind] = "SQLiteBoolean";
|
|
1807
|
+
mode = this.config.mode;
|
|
1808
|
+
mapFromDriverValue(value) {
|
|
1809
|
+
return Number(value) === 1;
|
|
1810
|
+
}
|
|
1811
|
+
mapToDriverValue(value) {
|
|
1812
|
+
return value ? 1 : 0;
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
function integer(a, b) {
|
|
1816
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1817
|
+
if (config?.mode === "timestamp" || config?.mode === "timestamp_ms") {
|
|
1818
|
+
return new SQLiteTimestampBuilder(name, config.mode);
|
|
1819
|
+
}
|
|
1820
|
+
if (config?.mode === "boolean") {
|
|
1821
|
+
return new SQLiteBooleanBuilder(name, config.mode);
|
|
1822
|
+
}
|
|
1823
|
+
return new SQLiteIntegerBuilder(name);
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// node_modules/drizzle-orm/sqlite-core/columns/numeric.js
|
|
1827
|
+
var SQLiteNumericBuilder = class extends SQLiteColumnBuilder {
|
|
1828
|
+
static [entityKind] = "SQLiteNumericBuilder";
|
|
1829
|
+
constructor(name) {
|
|
1830
|
+
super(name, "string", "SQLiteNumeric");
|
|
1831
|
+
}
|
|
1832
|
+
/** @internal */
|
|
1833
|
+
build(table) {
|
|
1834
|
+
return new SQLiteNumeric(
|
|
1835
|
+
table,
|
|
1836
|
+
this.config
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
var SQLiteNumeric = class extends SQLiteColumn {
|
|
1841
|
+
static [entityKind] = "SQLiteNumeric";
|
|
1842
|
+
mapFromDriverValue(value) {
|
|
1843
|
+
if (typeof value === "string") return value;
|
|
1844
|
+
return String(value);
|
|
1845
|
+
}
|
|
1846
|
+
getSQLType() {
|
|
1847
|
+
return "numeric";
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
var SQLiteNumericNumberBuilder = class extends SQLiteColumnBuilder {
|
|
1851
|
+
static [entityKind] = "SQLiteNumericNumberBuilder";
|
|
1852
|
+
constructor(name) {
|
|
1853
|
+
super(name, "number", "SQLiteNumericNumber");
|
|
1854
|
+
}
|
|
1855
|
+
/** @internal */
|
|
1856
|
+
build(table) {
|
|
1857
|
+
return new SQLiteNumericNumber(
|
|
1858
|
+
table,
|
|
1859
|
+
this.config
|
|
1860
|
+
);
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
var SQLiteNumericNumber = class extends SQLiteColumn {
|
|
1864
|
+
static [entityKind] = "SQLiteNumericNumber";
|
|
1865
|
+
mapFromDriverValue(value) {
|
|
1866
|
+
if (typeof value === "number") return value;
|
|
1867
|
+
return Number(value);
|
|
1868
|
+
}
|
|
1869
|
+
mapToDriverValue = String;
|
|
1870
|
+
getSQLType() {
|
|
1871
|
+
return "numeric";
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
var SQLiteNumericBigIntBuilder = class extends SQLiteColumnBuilder {
|
|
1875
|
+
static [entityKind] = "SQLiteNumericBigIntBuilder";
|
|
1876
|
+
constructor(name) {
|
|
1877
|
+
super(name, "bigint", "SQLiteNumericBigInt");
|
|
1878
|
+
}
|
|
1879
|
+
/** @internal */
|
|
1880
|
+
build(table) {
|
|
1881
|
+
return new SQLiteNumericBigInt(
|
|
1882
|
+
table,
|
|
1883
|
+
this.config
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
var SQLiteNumericBigInt = class extends SQLiteColumn {
|
|
1888
|
+
static [entityKind] = "SQLiteNumericBigInt";
|
|
1889
|
+
mapFromDriverValue = BigInt;
|
|
1890
|
+
mapToDriverValue = String;
|
|
1891
|
+
getSQLType() {
|
|
1892
|
+
return "numeric";
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
function numeric(a, b) {
|
|
1896
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1897
|
+
const mode = config?.mode;
|
|
1898
|
+
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
// node_modules/drizzle-orm/sqlite-core/columns/real.js
|
|
1902
|
+
var SQLiteRealBuilder = class extends SQLiteColumnBuilder {
|
|
1903
|
+
static [entityKind] = "SQLiteRealBuilder";
|
|
1904
|
+
constructor(name) {
|
|
1905
|
+
super(name, "number", "SQLiteReal");
|
|
1906
|
+
}
|
|
1907
|
+
/** @internal */
|
|
1908
|
+
build(table) {
|
|
1909
|
+
return new SQLiteReal(table, this.config);
|
|
1910
|
+
}
|
|
1911
|
+
};
|
|
1912
|
+
var SQLiteReal = class extends SQLiteColumn {
|
|
1913
|
+
static [entityKind] = "SQLiteReal";
|
|
1914
|
+
getSQLType() {
|
|
1915
|
+
return "real";
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
function real(name) {
|
|
1919
|
+
return new SQLiteRealBuilder(name ?? "");
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
// node_modules/drizzle-orm/sqlite-core/columns/text.js
|
|
1923
|
+
var SQLiteTextBuilder = class extends SQLiteColumnBuilder {
|
|
1924
|
+
static [entityKind] = "SQLiteTextBuilder";
|
|
1925
|
+
constructor(name, config) {
|
|
1926
|
+
super(name, "string", "SQLiteText");
|
|
1927
|
+
this.config.enumValues = config.enum;
|
|
1928
|
+
this.config.length = config.length;
|
|
1929
|
+
}
|
|
1930
|
+
/** @internal */
|
|
1931
|
+
build(table) {
|
|
1932
|
+
return new SQLiteText(
|
|
1933
|
+
table,
|
|
1934
|
+
this.config
|
|
1935
|
+
);
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
var SQLiteText = class extends SQLiteColumn {
|
|
1939
|
+
static [entityKind] = "SQLiteText";
|
|
1940
|
+
enumValues = this.config.enumValues;
|
|
1941
|
+
length = this.config.length;
|
|
1942
|
+
constructor(table, config) {
|
|
1943
|
+
super(table, config);
|
|
1944
|
+
}
|
|
1945
|
+
getSQLType() {
|
|
1946
|
+
return `text${this.config.length ? `(${this.config.length})` : ""}`;
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
var SQLiteTextJsonBuilder = class extends SQLiteColumnBuilder {
|
|
1950
|
+
static [entityKind] = "SQLiteTextJsonBuilder";
|
|
1951
|
+
constructor(name) {
|
|
1952
|
+
super(name, "json", "SQLiteTextJson");
|
|
1953
|
+
}
|
|
1954
|
+
/** @internal */
|
|
1955
|
+
build(table) {
|
|
1956
|
+
return new SQLiteTextJson(
|
|
1957
|
+
table,
|
|
1958
|
+
this.config
|
|
1959
|
+
);
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
var SQLiteTextJson = class extends SQLiteColumn {
|
|
1963
|
+
static [entityKind] = "SQLiteTextJson";
|
|
1964
|
+
getSQLType() {
|
|
1965
|
+
return "text";
|
|
1966
|
+
}
|
|
1967
|
+
mapFromDriverValue(value) {
|
|
1968
|
+
return JSON.parse(value);
|
|
1969
|
+
}
|
|
1970
|
+
mapToDriverValue(value) {
|
|
1971
|
+
return JSON.stringify(value);
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
function text(a, b = {}) {
|
|
1975
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
1976
|
+
if (config.mode === "json") {
|
|
1977
|
+
return new SQLiteTextJsonBuilder(name);
|
|
1978
|
+
}
|
|
1979
|
+
return new SQLiteTextBuilder(name, config);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// node_modules/drizzle-orm/sqlite-core/columns/all.js
|
|
1983
|
+
function getSQLiteColumnBuilders() {
|
|
1984
|
+
return {
|
|
1985
|
+
blob,
|
|
1986
|
+
customType,
|
|
1987
|
+
integer,
|
|
1988
|
+
numeric,
|
|
1989
|
+
real,
|
|
1990
|
+
text
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// node_modules/drizzle-orm/sqlite-core/table.js
|
|
1995
|
+
var InlineForeignKeys = /* @__PURE__ */ Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
1996
|
+
var SQLiteTable = class extends Table {
|
|
1997
|
+
static [entityKind] = "SQLiteTable";
|
|
1998
|
+
/** @internal */
|
|
1999
|
+
static Symbol = Object.assign({}, Table.Symbol, {
|
|
2000
|
+
InlineForeignKeys
|
|
2001
|
+
});
|
|
2002
|
+
/** @internal */
|
|
2003
|
+
[Table.Symbol.Columns];
|
|
2004
|
+
/** @internal */
|
|
2005
|
+
[InlineForeignKeys] = [];
|
|
2006
|
+
/** @internal */
|
|
2007
|
+
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
2008
|
+
};
|
|
2009
|
+
function sqliteTableBase(name, columns, extraConfig, schema, baseName = name) {
|
|
2010
|
+
const rawTable = new SQLiteTable(name, schema, baseName);
|
|
2011
|
+
const parsedColumns = typeof columns === "function" ? columns(getSQLiteColumnBuilders()) : columns;
|
|
2012
|
+
const builtColumns = Object.fromEntries(
|
|
2013
|
+
Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
2014
|
+
const colBuilder = colBuilderBase;
|
|
2015
|
+
colBuilder.setName(name2);
|
|
2016
|
+
const column = colBuilder.build(rawTable);
|
|
2017
|
+
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
2018
|
+
return [name2, column];
|
|
2019
|
+
})
|
|
2020
|
+
);
|
|
2021
|
+
const table = Object.assign(rawTable, builtColumns);
|
|
2022
|
+
table[Table.Symbol.Columns] = builtColumns;
|
|
2023
|
+
table[Table.Symbol.ExtraConfigColumns] = builtColumns;
|
|
2024
|
+
if (extraConfig) {
|
|
2025
|
+
table[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
2026
|
+
}
|
|
2027
|
+
return table;
|
|
2028
|
+
}
|
|
2029
|
+
var sqliteTable = (name, columns, extraConfig) => {
|
|
2030
|
+
return sqliteTableBase(name, columns, extraConfig);
|
|
2031
|
+
};
|
|
2032
|
+
|
|
2033
|
+
// node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
2034
|
+
var IndexBuilderOn = class {
|
|
2035
|
+
constructor(name, unique) {
|
|
2036
|
+
this.name = name;
|
|
2037
|
+
this.unique = unique;
|
|
2038
|
+
}
|
|
2039
|
+
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
2040
|
+
on(...columns) {
|
|
2041
|
+
return new IndexBuilder(this.name, columns, this.unique);
|
|
2042
|
+
}
|
|
2043
|
+
};
|
|
2044
|
+
var IndexBuilder = class {
|
|
2045
|
+
static [entityKind] = "SQLiteIndexBuilder";
|
|
2046
|
+
/** @internal */
|
|
2047
|
+
config;
|
|
2048
|
+
constructor(name, columns, unique) {
|
|
2049
|
+
this.config = {
|
|
2050
|
+
name,
|
|
2051
|
+
columns,
|
|
2052
|
+
unique,
|
|
2053
|
+
where: void 0
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
/**
|
|
2057
|
+
* Condition for partial index.
|
|
2058
|
+
*/
|
|
2059
|
+
where(condition) {
|
|
2060
|
+
this.config.where = condition;
|
|
2061
|
+
return this;
|
|
2062
|
+
}
|
|
2063
|
+
/** @internal */
|
|
2064
|
+
build(table) {
|
|
2065
|
+
return new Index(this.config, table);
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
var Index = class {
|
|
2069
|
+
static [entityKind] = "SQLiteIndex";
|
|
2070
|
+
config;
|
|
2071
|
+
constructor(config, table) {
|
|
2072
|
+
this.config = { ...config, table };
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
function index(name) {
|
|
2076
|
+
return new IndexBuilderOn(name, false);
|
|
2077
|
+
}
|
|
2078
|
+
function uniqueIndex(name) {
|
|
2079
|
+
return new IndexBuilderOn(name, true);
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
// src/db/schema.ts
|
|
2083
|
+
var memories = sqliteTable("memories", {
|
|
2084
|
+
id: text("id").primaryKey(),
|
|
2085
|
+
type: text("type", {
|
|
2086
|
+
enum: ["rule", "command", "gotcha", "decision", "review_pattern"]
|
|
2087
|
+
}).notNull(),
|
|
2088
|
+
text: text("text").notNull(),
|
|
2089
|
+
scope: text("scope", {
|
|
2090
|
+
enum: ["session", "path", "repo", "team", "global"]
|
|
2091
|
+
}).notNull(),
|
|
2092
|
+
path_scope: text("path_scope"),
|
|
2093
|
+
repo: text("repo"),
|
|
2094
|
+
status: text("status", {
|
|
2095
|
+
enum: ["transient", "candidate", "active", "rejected"]
|
|
2096
|
+
}).notNull(),
|
|
2097
|
+
confidence: real("confidence").notNull().default(0),
|
|
2098
|
+
source: text("source", {
|
|
2099
|
+
enum: [
|
|
2100
|
+
"user_correction",
|
|
2101
|
+
"user_reported_review",
|
|
2102
|
+
"repo_scan",
|
|
2103
|
+
"config_parse"
|
|
2104
|
+
]
|
|
2105
|
+
}).notNull(),
|
|
2106
|
+
evidence: text("evidence", { mode: "json" }).notNull().default("[]"),
|
|
2107
|
+
capture_context: text("capture_context", { mode: "json" }),
|
|
2108
|
+
supersedes: text("supersedes"),
|
|
2109
|
+
dedupe_key: text("dedupe_key"),
|
|
2110
|
+
created_at: text("created_at").notNull(),
|
|
2111
|
+
updated_at: text("updated_at").notNull(),
|
|
2112
|
+
last_validated_at: text("last_validated_at"),
|
|
2113
|
+
last_injected_at: text("last_injected_at"),
|
|
2114
|
+
injection_count: integer("injection_count").notNull().default(0),
|
|
2115
|
+
override_count: integer("override_count").notNull().default(0),
|
|
2116
|
+
repetition_count: integer("repetition_count").notNull().default(0),
|
|
2117
|
+
// Phase 2: sync + embeddings
|
|
2118
|
+
team_id: text("team_id"),
|
|
2119
|
+
sync_version: integer("sync_version").notNull().default(0),
|
|
2120
|
+
// When false, the memory stays queryable via MCP but is excluded from the
|
|
2121
|
+
// auto-injected SessionStart context block. Used to suppress noisy
|
|
2122
|
+
// command-type memories that the agent re-derives from the repo anyway.
|
|
2123
|
+
auto_inject: integer("auto_inject", { mode: "boolean" }).notNull().default(true)
|
|
2124
|
+
}, (table) => [
|
|
2125
|
+
index("idx_memories_repo").on(table.repo),
|
|
2126
|
+
index("idx_memories_status").on(table.status),
|
|
2127
|
+
index("idx_memories_repo_status").on(table.repo, table.status),
|
|
2128
|
+
index("idx_memories_team").on(table.team_id),
|
|
2129
|
+
uniqueIndex("uq_memories_dedupe_key").on(table.dedupe_key)
|
|
2130
|
+
]);
|
|
2131
|
+
var memoryEmbeddings = sqliteTable("memory_embeddings", {
|
|
2132
|
+
memory_id: text("memory_id").primaryKey().references(() => memories.id, { onDelete: "cascade" }),
|
|
2133
|
+
model: text("model").notNull(),
|
|
2134
|
+
embedding_dimensions: integer("embedding_dimensions").notNull(),
|
|
2135
|
+
index_dimensions: integer("index_dimensions").notNull(),
|
|
2136
|
+
version: text("version").notNull(),
|
|
2137
|
+
content_hash: text("content_hash").notNull(),
|
|
2138
|
+
updated_at: text("updated_at").notNull(),
|
|
2139
|
+
embedding: blob("embedding", { mode: "buffer" }).notNull()
|
|
2140
|
+
}, (table) => [
|
|
2141
|
+
index("idx_memory_embeddings_model").on(table.model),
|
|
2142
|
+
index("idx_memory_embeddings_updated").on(table.updated_at)
|
|
2143
|
+
]);
|
|
2144
|
+
var historySnippets = sqliteTable("history_snippets", {
|
|
2145
|
+
id: text("id").primaryKey(),
|
|
2146
|
+
repo: text("repo"),
|
|
2147
|
+
session_id: text("session_id"),
|
|
2148
|
+
kind: text("kind", {
|
|
2149
|
+
enum: ["session_summary", "correction_summary", "decision_summary", "review_summary", "compile_summary", "repo_synthesis"]
|
|
2150
|
+
}).notNull(),
|
|
2151
|
+
text: text("text").notNull(),
|
|
2152
|
+
dedupe_key: text("dedupe_key"),
|
|
2153
|
+
source_activity_ids: text("source_activity_ids", { mode: "json" }).notNull().default("[]"),
|
|
2154
|
+
created_at: text("created_at").notNull(),
|
|
2155
|
+
updated_at: text("updated_at").notNull()
|
|
2156
|
+
}, (table) => [
|
|
2157
|
+
index("idx_history_repo").on(table.repo),
|
|
2158
|
+
index("idx_history_session").on(table.session_id),
|
|
2159
|
+
index("idx_history_kind").on(table.kind),
|
|
2160
|
+
index("idx_history_created").on(table.created_at),
|
|
2161
|
+
uniqueIndex("uq_history_snippets_dedupe_key").on(table.dedupe_key)
|
|
2162
|
+
]);
|
|
2163
|
+
var historySnippetEmbeddings = sqliteTable("history_snippet_embeddings", {
|
|
2164
|
+
snippet_id: text("snippet_id").primaryKey().references(() => historySnippets.id, { onDelete: "cascade" }),
|
|
2165
|
+
model: text("model").notNull(),
|
|
2166
|
+
embedding_dimensions: integer("embedding_dimensions").notNull(),
|
|
2167
|
+
index_dimensions: integer("index_dimensions").notNull(),
|
|
2168
|
+
version: text("version").notNull(),
|
|
2169
|
+
content_hash: text("content_hash").notNull(),
|
|
2170
|
+
updated_at: text("updated_at").notNull(),
|
|
2171
|
+
embedding: blob("embedding", { mode: "buffer" }).notNull()
|
|
2172
|
+
}, (table) => [
|
|
2173
|
+
index("idx_history_embeddings_model").on(table.model),
|
|
2174
|
+
index("idx_history_embeddings_updated").on(table.updated_at)
|
|
2175
|
+
]);
|
|
2176
|
+
var historyInjections = sqliteTable("history_injections", {
|
|
2177
|
+
id: text("id").primaryKey(),
|
|
2178
|
+
snippet_id: text("snippet_id").notNull().references(() => historySnippets.id, { onDelete: "cascade" }),
|
|
2179
|
+
session_id: text("session_id").notNull(),
|
|
2180
|
+
repo: text("repo"),
|
|
2181
|
+
injected_at: text("injected_at").notNull()
|
|
2182
|
+
}, (table) => [
|
|
2183
|
+
index("idx_history_injections_snippet").on(table.snippet_id),
|
|
2184
|
+
index("idx_history_injections_session").on(table.session_id),
|
|
2185
|
+
index("idx_history_injections_repo").on(table.repo),
|
|
2186
|
+
uniqueIndex("uq_history_injections_snippet_session").on(table.snippet_id, table.session_id)
|
|
2187
|
+
]);
|
|
2188
|
+
var feedbackEvents = sqliteTable("feedback_events", {
|
|
2189
|
+
id: text("id").primaryKey(),
|
|
2190
|
+
memory_id: text("memory_id").notNull().references(() => memories.id),
|
|
2191
|
+
session_id: text("session_id").notNull(),
|
|
2192
|
+
injected: integer("injected", { mode: "boolean" }).notNull(),
|
|
2193
|
+
outcome: text("outcome", {
|
|
2194
|
+
enum: ["followed", "overridden", "ignored", "contradicted"]
|
|
2195
|
+
}).notNull(),
|
|
2196
|
+
timestamp: text("timestamp").notNull()
|
|
2197
|
+
}, (table) => [
|
|
2198
|
+
index("idx_feedback_memory").on(table.memory_id),
|
|
2199
|
+
index("idx_feedback_session").on(table.session_id)
|
|
2200
|
+
]);
|
|
2201
|
+
var memoryInjections = sqliteTable("memory_injections", {
|
|
2202
|
+
id: text("id").primaryKey(),
|
|
2203
|
+
memory_id: text("memory_id").notNull().references(() => memories.id, { onDelete: "cascade" }),
|
|
2204
|
+
session_id: text("session_id").notNull(),
|
|
2205
|
+
repo: text("repo"),
|
|
2206
|
+
injected_at: text("injected_at").notNull(),
|
|
2207
|
+
outcome: text("outcome", {
|
|
2208
|
+
enum: ["followed", "overridden", "ignored", "contradicted"]
|
|
2209
|
+
}),
|
|
2210
|
+
outcome_at: text("outcome_at")
|
|
2211
|
+
}, (table) => [
|
|
2212
|
+
index("idx_memory_injections_memory").on(table.memory_id),
|
|
2213
|
+
index("idx_memory_injections_session").on(table.session_id),
|
|
2214
|
+
uniqueIndex("uq_memory_injections_memory_session").on(table.memory_id, table.session_id)
|
|
2215
|
+
]);
|
|
2216
|
+
var activityEvents = sqliteTable("activity_events", {
|
|
2217
|
+
id: text("id").primaryKey(),
|
|
2218
|
+
session_id: text("session_id"),
|
|
2219
|
+
repo: text("repo"),
|
|
2220
|
+
path: text("path"),
|
|
2221
|
+
// source is a free-form string tagged as "<transport>[:<client>]"
|
|
2222
|
+
// (e.g. "mcp", "mcp:claude-code", "hook:codex", "cli", "daemon").
|
|
2223
|
+
// The runtime regex in src/types.ts validates the shape.
|
|
2224
|
+
source: text("source").notNull(),
|
|
2225
|
+
event_type: text("event_type", {
|
|
2226
|
+
enum: [
|
|
2227
|
+
"compile",
|
|
2228
|
+
"query",
|
|
2229
|
+
"scan",
|
|
2230
|
+
"correction",
|
|
2231
|
+
"review",
|
|
2232
|
+
"feedback",
|
|
2233
|
+
"signal",
|
|
2234
|
+
"session_start",
|
|
2235
|
+
"session_event",
|
|
2236
|
+
"session_end",
|
|
2237
|
+
"tool_call"
|
|
2238
|
+
]
|
|
2239
|
+
}).notNull(),
|
|
2240
|
+
memory_ids: text("memory_ids", { mode: "json" }).notNull().default("[]"),
|
|
2241
|
+
dedupe_key: text("dedupe_key"),
|
|
2242
|
+
request: text("request", { mode: "json" }).notNull().default("{}"),
|
|
2243
|
+
result: text("result", { mode: "json" }).notNull().default("{}"),
|
|
2244
|
+
created_at: text("created_at").notNull()
|
|
2245
|
+
}, (table) => [
|
|
2246
|
+
index("idx_activity_session").on(table.session_id),
|
|
2247
|
+
index("idx_activity_repo").on(table.repo),
|
|
2248
|
+
index("idx_activity_event_type").on(table.event_type),
|
|
2249
|
+
index("idx_activity_created").on(table.created_at),
|
|
2250
|
+
uniqueIndex("uq_activity_events_dedupe_key").on(table.dedupe_key)
|
|
2251
|
+
]);
|
|
2252
|
+
var hookCalls = sqliteTable("hook_calls", {
|
|
2253
|
+
id: text("id").primaryKey(),
|
|
2254
|
+
event: text("event", {
|
|
2255
|
+
enum: ["session_started", "prompt_submitted", "tool_invoked", "session_ended"]
|
|
2256
|
+
}).notNull(),
|
|
2257
|
+
agent: text("agent").notNull(),
|
|
2258
|
+
dedupe_key: text("dedupe_key"),
|
|
2259
|
+
duration_ms: integer("duration_ms").notNull(),
|
|
2260
|
+
ok: integer("ok", { mode: "boolean" }).notNull(),
|
|
2261
|
+
created_at: text("created_at").notNull()
|
|
2262
|
+
}, (table) => [
|
|
2263
|
+
index("idx_hook_calls_event").on(table.event),
|
|
2264
|
+
index("idx_hook_calls_agent").on(table.agent),
|
|
2265
|
+
index("idx_hook_calls_created").on(table.created_at),
|
|
2266
|
+
uniqueIndex("uq_hook_calls_dedupe_key").on(table.dedupe_key)
|
|
2267
|
+
]);
|
|
2268
|
+
var syncState = sqliteTable("sync_state", {
|
|
2269
|
+
id: text("id").primaryKey(),
|
|
2270
|
+
// "local" singleton
|
|
2271
|
+
remote_url: text("remote_url"),
|
|
2272
|
+
team_id: text("team_id"),
|
|
2273
|
+
last_push_at: text("last_push_at"),
|
|
2274
|
+
last_pull_at: text("last_pull_at"),
|
|
2275
|
+
last_push_version: integer("last_push_version").notNull().default(0),
|
|
2276
|
+
last_pull_version: integer("last_pull_version").notNull().default(0)
|
|
2277
|
+
});
|
|
2278
|
+
var evalSessions = sqliteTable("eval_sessions", {
|
|
2279
|
+
id: text("id").primaryKey(),
|
|
2280
|
+
repo: text("repo").notNull(),
|
|
2281
|
+
started_at: text("started_at").notNull(),
|
|
2282
|
+
ended_at: text("ended_at"),
|
|
2283
|
+
memories_injected: integer("memories_injected").notNull().default(0),
|
|
2284
|
+
memories_followed: integer("memories_followed").notNull().default(0),
|
|
2285
|
+
memories_overridden: integer("memories_overridden").notNull().default(0),
|
|
2286
|
+
user_corrections: integer("user_corrections").notNull().default(0),
|
|
2287
|
+
test_passes: integer("test_passes").notNull().default(0),
|
|
2288
|
+
test_failures: integer("test_failures").notNull().default(0)
|
|
2289
|
+
}, (table) => [
|
|
2290
|
+
index("idx_eval_repo").on(table.repo)
|
|
2291
|
+
]);
|
|
2292
|
+
var policyRules = sqliteTable("policy_rules", {
|
|
2293
|
+
id: text("id").primaryKey(),
|
|
2294
|
+
org_id: text("org_id").notNull(),
|
|
2295
|
+
rule_type: text("rule_type", {
|
|
2296
|
+
enum: [
|
|
2297
|
+
"min_confidence",
|
|
2298
|
+
"require_approval",
|
|
2299
|
+
"allowed_sources",
|
|
2300
|
+
"blocked_scopes",
|
|
2301
|
+
"auto_approve_pattern",
|
|
2302
|
+
"max_active_per_repo",
|
|
2303
|
+
"require_evidence_count"
|
|
2304
|
+
]
|
|
2305
|
+
}).notNull(),
|
|
2306
|
+
config: text("config", { mode: "json" }).notNull().default("{}"),
|
|
2307
|
+
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
2308
|
+
created_at: text("created_at").notNull(),
|
|
2309
|
+
updated_at: text("updated_at").notNull()
|
|
2310
|
+
}, (table) => [
|
|
2311
|
+
index("idx_policy_org").on(table.org_id)
|
|
2312
|
+
]);
|
|
2313
|
+
var approvalRequests = sqliteTable("approval_requests", {
|
|
2314
|
+
id: text("id").primaryKey(),
|
|
2315
|
+
memory_id: text("memory_id").notNull().references(() => memories.id),
|
|
2316
|
+
org_id: text("org_id").notNull(),
|
|
2317
|
+
requested_by: text("requested_by").notNull(),
|
|
2318
|
+
status: text("status", {
|
|
2319
|
+
enum: ["pending", "approved", "denied"]
|
|
2320
|
+
}).notNull().default("pending"),
|
|
2321
|
+
reviewed_by: text("reviewed_by"),
|
|
2322
|
+
reason: text("reason"),
|
|
2323
|
+
created_at: text("created_at").notNull(),
|
|
2324
|
+
resolved_at: text("resolved_at")
|
|
2325
|
+
}, (table) => [
|
|
2326
|
+
index("idx_approval_org").on(table.org_id),
|
|
2327
|
+
index("idx_approval_status").on(table.status)
|
|
2328
|
+
]);
|
|
2329
|
+
var contradictions = sqliteTable("contradictions", {
|
|
2330
|
+
id: text("id").primaryKey(),
|
|
2331
|
+
memory_a_id: text("memory_a_id").notNull().references(() => memories.id),
|
|
2332
|
+
memory_b_id: text("memory_b_id").notNull().references(() => memories.id),
|
|
2333
|
+
contradiction_type: text("contradiction_type", {
|
|
2334
|
+
enum: ["direct_negation", "conflicting_rules", "scope_overlap", "superseded"]
|
|
2335
|
+
}).notNull(),
|
|
2336
|
+
severity: text("severity", { enum: ["low", "medium", "high"] }).notNull(),
|
|
2337
|
+
description: text("description").notNull(),
|
|
2338
|
+
resolved: integer("resolved", { mode: "boolean" }).notNull().default(false),
|
|
2339
|
+
resolution: text("resolution"),
|
|
2340
|
+
detected_at: text("detected_at").notNull(),
|
|
2341
|
+
resolved_at: text("resolved_at")
|
|
2342
|
+
}, (table) => [
|
|
2343
|
+
index("idx_contradictions_resolved").on(table.resolved)
|
|
2344
|
+
]);
|
|
2345
|
+
var auditTrail = sqliteTable("audit_trail", {
|
|
2346
|
+
id: text("id").primaryKey(),
|
|
2347
|
+
memory_id: text("memory_id").notNull(),
|
|
2348
|
+
action: text("action", {
|
|
2349
|
+
enum: [
|
|
2350
|
+
"created",
|
|
2351
|
+
"promoted",
|
|
2352
|
+
"demoted",
|
|
2353
|
+
"rejected",
|
|
2354
|
+
"confirmed",
|
|
2355
|
+
"reactivated",
|
|
2356
|
+
"edited",
|
|
2357
|
+
"pruned",
|
|
2358
|
+
"policy_applied",
|
|
2359
|
+
"approval_requested",
|
|
2360
|
+
"approval_resolved",
|
|
2361
|
+
"contradiction_detected",
|
|
2362
|
+
"contradiction_resolved",
|
|
2363
|
+
"rolled_back"
|
|
2364
|
+
]
|
|
2365
|
+
}).notNull(),
|
|
2366
|
+
actor: text("actor").notNull(),
|
|
2367
|
+
before_snapshot: text("before_snapshot"),
|
|
2368
|
+
after_snapshot: text("after_snapshot"),
|
|
2369
|
+
reason: text("reason"),
|
|
2370
|
+
timestamp: text("timestamp").notNull()
|
|
2371
|
+
}, (table) => [
|
|
2372
|
+
index("idx_audit_memory").on(table.memory_id),
|
|
2373
|
+
index("idx_audit_timestamp").on(table.timestamp)
|
|
2374
|
+
]);
|
|
2375
|
+
var memoryMaintenanceTasks = sqliteTable("memory_maintenance_tasks", {
|
|
2376
|
+
id: text("id").primaryKey(),
|
|
2377
|
+
kind: text("kind", {
|
|
2378
|
+
enum: [
|
|
2379
|
+
"summarize_history",
|
|
2380
|
+
"merge_duplicates",
|
|
2381
|
+
"refine_candidate",
|
|
2382
|
+
"summarize_session",
|
|
2383
|
+
"synthesize_repo",
|
|
2384
|
+
"verify_capture",
|
|
2385
|
+
"extract_rules_from_prompt"
|
|
2386
|
+
]
|
|
2387
|
+
}).notNull(),
|
|
2388
|
+
status: text("status", {
|
|
2389
|
+
enum: ["pending", "claimed", "submitted", "completed", "abandoned"]
|
|
2390
|
+
}).notNull(),
|
|
2391
|
+
priority: integer("priority").notNull().default(0),
|
|
2392
|
+
repo: text("repo"),
|
|
2393
|
+
target_key: text("target_key").notNull(),
|
|
2394
|
+
payload: text("payload", { mode: "json" }).notNull(),
|
|
2395
|
+
result: text("result", { mode: "json" }),
|
|
2396
|
+
failure_reason: text("failure_reason"),
|
|
2397
|
+
claimed_by: text("claimed_by"),
|
|
2398
|
+
claimed_at: text("claimed_at"),
|
|
2399
|
+
claim_expires_at: text("claim_expires_at"),
|
|
2400
|
+
submitted_at: text("submitted_at"),
|
|
2401
|
+
completed_at: text("completed_at"),
|
|
2402
|
+
created_at: text("created_at").notNull(),
|
|
2403
|
+
attempts: integer("attempts").notNull().default(0),
|
|
2404
|
+
max_attempts: integer("max_attempts").notNull().default(3)
|
|
2405
|
+
}, (table) => [
|
|
2406
|
+
index("idx_mmt_status_priority").on(table.status, table.priority, table.created_at),
|
|
2407
|
+
index("idx_mmt_repo_status").on(table.repo, table.status),
|
|
2408
|
+
index("idx_mmt_claim_expires").on(table.claim_expires_at),
|
|
2409
|
+
index("idx_mmt_kind_target").on(table.kind, table.target_key)
|
|
2410
|
+
]);
|
|
2411
|
+
var implicitSignals = sqliteTable("implicit_signals", {
|
|
2412
|
+
id: text("id").primaryKey(),
|
|
2413
|
+
memory_id: text("memory_id").notNull().references(() => memories.id),
|
|
2414
|
+
session_id: text("session_id").notNull(),
|
|
2415
|
+
signal_type: text("signal_type", {
|
|
2416
|
+
enum: [
|
|
2417
|
+
"test_pass",
|
|
2418
|
+
"test_fail",
|
|
2419
|
+
"file_unchanged",
|
|
2420
|
+
"file_rewritten",
|
|
2421
|
+
"task_accepted",
|
|
2422
|
+
"task_rejected"
|
|
2423
|
+
]
|
|
2424
|
+
}).notNull(),
|
|
2425
|
+
timestamp: text("timestamp").notNull(),
|
|
2426
|
+
context: text("context")
|
|
2427
|
+
}, (table) => [
|
|
2428
|
+
index("idx_implicit_memory").on(table.memory_id),
|
|
2429
|
+
index("idx_implicit_session").on(table.session_id)
|
|
2430
|
+
]);
|
|
2431
|
+
var llmUsage = sqliteTable("llm_usage", {
|
|
2432
|
+
id: text("id").primaryKey(),
|
|
2433
|
+
provider: text("provider").notNull(),
|
|
2434
|
+
model: text("model").notNull(),
|
|
2435
|
+
task_kind: text("task_kind").notNull(),
|
|
2436
|
+
task_id: text("task_id"),
|
|
2437
|
+
repo: text("repo"),
|
|
2438
|
+
prompt_tokens: integer("prompt_tokens").notNull().default(0),
|
|
2439
|
+
completion_tokens: integer("completion_tokens").notNull().default(0),
|
|
2440
|
+
total_tokens: integer("total_tokens").notNull().default(0),
|
|
2441
|
+
cost_usd: real("cost_usd"),
|
|
2442
|
+
duration_ms: integer("duration_ms").notNull().default(0),
|
|
2443
|
+
ok: integer("ok", { mode: "boolean" }).notNull().default(true),
|
|
2444
|
+
error: text("error"),
|
|
2445
|
+
created_at: text("created_at").notNull()
|
|
2446
|
+
}, (table) => [
|
|
2447
|
+
index("idx_llm_usage_created").on(table.created_at),
|
|
2448
|
+
index("idx_llm_usage_provider_model").on(table.provider, table.model),
|
|
2449
|
+
index("idx_llm_usage_task_kind").on(table.task_kind),
|
|
2450
|
+
index("idx_llm_usage_repo").on(table.repo)
|
|
2451
|
+
]);
|
|
2452
|
+
var qualitySnapshots = sqliteTable("quality_snapshots", {
|
|
2453
|
+
id: text("id").primaryKey(),
|
|
2454
|
+
taken_at: text("taken_at").notNull(),
|
|
2455
|
+
window_start: text("window_start").notNull(),
|
|
2456
|
+
window_end: text("window_end").notNull(),
|
|
2457
|
+
injections_total: integer("injections_total").notNull(),
|
|
2458
|
+
injections_resolved: integer("injections_resolved").notNull(),
|
|
2459
|
+
injections_followed: integer("injections_followed").notNull(),
|
|
2460
|
+
injections_overridden: integer("injections_overridden").notNull(),
|
|
2461
|
+
injections_contradicted: integer("injections_contradicted").notNull(),
|
|
2462
|
+
injections_ignored: integer("injections_ignored").notNull(),
|
|
2463
|
+
followed_rate_resolved: real("followed_rate_resolved"),
|
|
2464
|
+
active_rule_count: integer("active_rule_count").notNull(),
|
|
2465
|
+
active_command_count: integer("active_command_count").notNull(),
|
|
2466
|
+
candidate_correction_count: integer("candidate_correction_count").notNull(),
|
|
2467
|
+
history_injections_total: integer("history_injections_total").notNull().default(0),
|
|
2468
|
+
history_snippets_injected: integer("history_snippets_injected").notNull().default(0),
|
|
2469
|
+
notes: text("notes")
|
|
2470
|
+
}, (table) => [
|
|
2471
|
+
index("idx_quality_snapshots_taken").on(table.taken_at)
|
|
2472
|
+
]);
|
|
2473
|
+
var entities = sqliteTable("entities", {
|
|
2474
|
+
id: text("id").primaryKey(),
|
|
2475
|
+
kind: text("kind", {
|
|
2476
|
+
enum: ["file", "function", "library", "tool", "concept", "repo_path", "command", "url"]
|
|
2477
|
+
}).notNull(),
|
|
2478
|
+
name: text("name").notNull(),
|
|
2479
|
+
normalized_name: text("normalized_name").notNull(),
|
|
2480
|
+
repo: text("repo"),
|
|
2481
|
+
description: text("description"),
|
|
2482
|
+
first_seen_memory_id: text("first_seen_memory_id"),
|
|
2483
|
+
mention_count: integer("mention_count").notNull().default(0),
|
|
2484
|
+
created_at: text("created_at").notNull(),
|
|
2485
|
+
updated_at: text("updated_at").notNull()
|
|
2486
|
+
}, (table) => [
|
|
2487
|
+
index("idx_entities_normalized").on(table.normalized_name),
|
|
2488
|
+
index("idx_entities_kind").on(table.kind),
|
|
2489
|
+
index("idx_entities_repo").on(table.repo)
|
|
2490
|
+
]);
|
|
2491
|
+
var entityRelations = sqliteTable("entity_relations", {
|
|
2492
|
+
id: text("id").primaryKey(),
|
|
2493
|
+
source_entity_id: text("source_entity_id").notNull().references(() => entities.id),
|
|
2494
|
+
target_entity_id: text("target_entity_id").notNull().references(() => entities.id),
|
|
2495
|
+
relation_type: text("relation_type", {
|
|
2496
|
+
enum: ["uses", "replaces", "conflicts_with", "tested_by", "depends_on", "references", "part_of"]
|
|
2497
|
+
}).notNull(),
|
|
2498
|
+
source_memory_id: text("source_memory_id"),
|
|
2499
|
+
confidence: real("confidence").notNull().default(0.6),
|
|
2500
|
+
created_at: text("created_at").notNull()
|
|
2501
|
+
}, (table) => [
|
|
2502
|
+
index("idx_entity_relations_source").on(table.source_entity_id),
|
|
2503
|
+
index("idx_entity_relations_target").on(table.target_entity_id),
|
|
2504
|
+
index("idx_entity_relations_type").on(table.relation_type)
|
|
2505
|
+
]);
|
|
2506
|
+
var memoryEntities = sqliteTable("memory_entities", {
|
|
2507
|
+
id: text("id").primaryKey(),
|
|
2508
|
+
memory_id: text("memory_id").notNull().references(() => memories.id),
|
|
2509
|
+
entity_id: text("entity_id").notNull().references(() => entities.id),
|
|
2510
|
+
/** Where in the text the mention occurred; 'extracted' for LLM/heuristic output. */
|
|
2511
|
+
source: text("source", { enum: ["heuristic", "llm", "manual"] }).notNull().default("heuristic"),
|
|
2512
|
+
weight: real("weight").notNull().default(1),
|
|
2513
|
+
created_at: text("created_at").notNull()
|
|
2514
|
+
}, (table) => [
|
|
2515
|
+
index("idx_memory_entities_memory").on(table.memory_id),
|
|
2516
|
+
index("idx_memory_entities_entity").on(table.entity_id)
|
|
2517
|
+
]);
|
|
2518
|
+
var maintenanceCleanupLog = sqliteTable("maintenance_cleanup_log", {
|
|
2519
|
+
id: text("id").primaryKey(),
|
|
2520
|
+
run_id: text("run_id").notNull(),
|
|
2521
|
+
action: text("action", {
|
|
2522
|
+
enum: [
|
|
2523
|
+
"dedupe_exact_merge",
|
|
2524
|
+
"reject_fragment_candidate",
|
|
2525
|
+
"promote_repeat_correction",
|
|
2526
|
+
"suppress_unproductive_command",
|
|
2527
|
+
"globalize_cross_repo"
|
|
2528
|
+
]
|
|
2529
|
+
}).notNull(),
|
|
2530
|
+
memory_id: text("memory_id").notNull(),
|
|
2531
|
+
related_memory_id: text("related_memory_id"),
|
|
2532
|
+
before_snapshot: text("before_snapshot", { mode: "json" }),
|
|
2533
|
+
after_snapshot: text("after_snapshot", { mode: "json" }),
|
|
2534
|
+
details: text("details", { mode: "json" }).notNull().default("{}"),
|
|
2535
|
+
reverted: integer("reverted", { mode: "boolean" }).notNull().default(false),
|
|
2536
|
+
reverted_at: text("reverted_at"),
|
|
2537
|
+
created_at: text("created_at").notNull()
|
|
2538
|
+
}, (table) => [
|
|
2539
|
+
index("idx_cleanup_log_run").on(table.run_id),
|
|
2540
|
+
index("idx_cleanup_log_memory").on(table.memory_id),
|
|
2541
|
+
index("idx_cleanup_log_action").on(table.action),
|
|
2542
|
+
index("idx_cleanup_log_created").on(table.created_at)
|
|
2543
|
+
]);
|
|
2544
|
+
|
|
2545
|
+
export {
|
|
2546
|
+
entityKind,
|
|
2547
|
+
is,
|
|
2548
|
+
Columns,
|
|
2549
|
+
Table,
|
|
2550
|
+
getTableName,
|
|
2551
|
+
getTableUniqueName,
|
|
2552
|
+
Column,
|
|
2553
|
+
Subquery,
|
|
2554
|
+
WithSubquery,
|
|
2555
|
+
ViewBaseConfig,
|
|
2556
|
+
SQL,
|
|
2557
|
+
Param,
|
|
2558
|
+
sql,
|
|
2559
|
+
fillPlaceholders,
|
|
2560
|
+
View,
|
|
2561
|
+
mapResultRow,
|
|
2562
|
+
orderSelectedFields,
|
|
2563
|
+
haveSameKeys,
|
|
2564
|
+
mapUpdateSet,
|
|
2565
|
+
applyMixins,
|
|
2566
|
+
getTableColumns,
|
|
2567
|
+
getTableLikeName,
|
|
2568
|
+
isConfig,
|
|
2569
|
+
eq,
|
|
2570
|
+
ne,
|
|
2571
|
+
and,
|
|
2572
|
+
or,
|
|
2573
|
+
not,
|
|
2574
|
+
gt,
|
|
2575
|
+
gte,
|
|
2576
|
+
lt,
|
|
2577
|
+
lte,
|
|
2578
|
+
inArray,
|
|
2579
|
+
notInArray,
|
|
2580
|
+
isNull,
|
|
2581
|
+
isNotNull,
|
|
2582
|
+
exists,
|
|
2583
|
+
notExists,
|
|
2584
|
+
between,
|
|
2585
|
+
notBetween,
|
|
2586
|
+
like,
|
|
2587
|
+
notLike,
|
|
2588
|
+
ilike,
|
|
2589
|
+
notIlike,
|
|
2590
|
+
SQLiteColumn,
|
|
2591
|
+
SQLiteTable,
|
|
2592
|
+
memories,
|
|
2593
|
+
memoryEmbeddings,
|
|
2594
|
+
historySnippets,
|
|
2595
|
+
historySnippetEmbeddings,
|
|
2596
|
+
historyInjections,
|
|
2597
|
+
feedbackEvents,
|
|
2598
|
+
memoryInjections,
|
|
2599
|
+
activityEvents,
|
|
2600
|
+
hookCalls,
|
|
2601
|
+
syncState,
|
|
2602
|
+
evalSessions,
|
|
2603
|
+
policyRules,
|
|
2604
|
+
approvalRequests,
|
|
2605
|
+
contradictions,
|
|
2606
|
+
auditTrail,
|
|
2607
|
+
memoryMaintenanceTasks,
|
|
2608
|
+
implicitSignals,
|
|
2609
|
+
llmUsage,
|
|
2610
|
+
qualitySnapshots,
|
|
2611
|
+
entities,
|
|
2612
|
+
entityRelations,
|
|
2613
|
+
memoryEntities,
|
|
2614
|
+
maintenanceCleanupLog,
|
|
2615
|
+
schema_exports
|
|
2616
|
+
};
|
|
2617
|
+
//# sourceMappingURL=chunk-QDA5M3AJ.js.map
|