@redocly/replay 0.27.0-next.3 → 0.27.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/replay-AiChatProvider-BGXsZqW2.js +6 -0
- package/dist/replay-AiChatProvider-CVvR1kSd.js +1004 -0
- package/dist/replay-AiChatSqliteDBStorage-BFHRKFlk.js +88 -0
- package/dist/replay-AiChatSqliteDBStorage-DVJ9f2EK.js +1 -0
- package/dist/replay-AiPanel-CynVcVmm.js +2873 -0
- package/dist/replay-AiPanel-qVp_s4gD.js +849 -0
- package/dist/replay-HistorySqliteDBStorage-BrILW8Fu.js +1 -0
- package/dist/replay-HistorySqliteDBStorage-CtF6-vY8.js +113 -0
- package/dist/replay-SqliteDBStorage-CSz7NYH4.js +2857 -0
- package/dist/replay-SqliteDBStorage-eRBPh4E8.js +14 -0
- package/dist/replay-StepContextSqliteDBStorage-BSepLyBI.js +1 -0
- package/dist/replay-StepContextSqliteDBStorage-BfAAKDwA.js +83 -0
- package/dist/replay-agent-loop-C60p47KY.js +1 -0
- package/dist/replay-agent-loop-CEZz1kj-.js +1533 -0
- package/dist/replay-ai-chat-mappers-BAHU6JIc.js +99 -0
- package/dist/replay-ai-chat-mappers-Dqg-QVZy.js +1 -0
- package/dist/replay-ai-message-parts.schema-BBdjwldJ.js +1 -0
- package/dist/replay-ai-message-parts.schema-E9u9-nqr.js +60 -0
- package/dist/replay-create-model-C2NQtDcL.js +38224 -0
- package/dist/replay-create-model-CUL-l-eX.js +104 -0
- package/dist/replay-db-C4jAfGtc.js +64 -0
- package/dist/replay-db-Dw-X2WGx.js +306 -0
- package/dist/replay-defaults-CzR6jw9a.js +32 -0
- package/dist/replay-defaults-DVvOnvnR.js +27 -0
- package/dist/replay-external-resolver-DAkLV0nr.js +34 -0
- package/dist/replay-external-resolver-DN_PWq_2.js +2 -0
- package/dist/replay-history.schema-5ce6X0R1.js +28 -0
- package/dist/replay-history.schema-miM3Etuf.js +1 -0
- package/dist/replay-index-BmX1FPBL.js +6877 -0
- package/dist/replay-index-DR1uVBvc.js +503 -0
- package/dist/replay-index-DSKZHOXq.js +1 -0
- package/dist/{replay-index-gw_CfN4i.js → replay-index-DT5gdiBA.js} +1 -1
- package/dist/replay-index-O_Pq5an3.js +92924 -0
- package/dist/{replay-index-CiP3e-cc.js → replay-index-m00jnWFr.js} +6 -6
- package/dist/replay-index-qZlgEmbq.js +1 -0
- package/dist/replay-index-rRWvC2pp.js +1 -0
- package/dist/replay-indexes-CfsvVMi_.js +1242 -0
- package/dist/replay-indexes-Dqjl8m6C.js +1 -0
- package/dist/replay-lint-CcVVykW7.js +33217 -0
- package/dist/replay-lint-ON47l7Vu.js +184 -0
- package/dist/{replay-lint-graphql-DV4sCSe6.js → replay-lint-graphql-5cGt2KR_.js} +5 -5
- package/dist/{replay-lint-graphql-Cbptkd8N.js → replay-lint-graphql-DlD7bblx.js} +2 -2
- package/dist/replay-resolve-BTzo-fSv.js +47 -0
- package/dist/replay-resolve-Ca3DUbGq.js +3683 -0
- package/dist/{replay-respect-run-ChMawzhr.js → replay-respect-run-BtC2agF9.js} +54 -54
- package/dist/{replay-respect-run-BscBAlnT.js → replay-respect-run-eSRzH2dk.js} +447 -447
- package/dist/replay-step-context.schema-BuuXkAck.js +1 -0
- package/dist/replay-step-context.schema-DBk4jufr.js +21 -0
- package/dist/{replay-tauri-path-BMmQuI9X.js → replay-tauri-path-C-oxFOHe.js} +4 -4
- package/dist/{replay-tauri-path-kR-IXn3X.js → replay-tauri-path-CKcvIl_h.js} +1 -1
- package/dist/replay-useAiChatQueries-CVTxcu2Z.js +192 -0
- package/dist/replay-useAiChatQueries-vdKvbmp2.js +3413 -0
- package/dist/replay-validate-key-CwIopif3.js +28 -0
- package/dist/replay-validate-key-VkgZoK1f.js +1 -0
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.ts +2 -0
- package/dist/replay.js +21 -21
- package/package.json +22 -25
- package/dist/replay-index-CUY_5IyO.js +0 -8308
- package/dist/replay-index-CUdCFVnz.js +0 -178626
- package/dist/replay-index-D8qtqDhF.js +0 -1
- package/dist/replay-index-DgjC0DLq.js +0 -1
|
@@ -0,0 +1,1242 @@
|
|
|
1
|
+
const s = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
|
|
2
|
+
function u(t, e) {
|
|
3
|
+
if (!t || typeof t != "object")
|
|
4
|
+
return !1;
|
|
5
|
+
if (t instanceof e)
|
|
6
|
+
return !0;
|
|
7
|
+
if (!Object.prototype.hasOwnProperty.call(e, s))
|
|
8
|
+
throw new Error(
|
|
9
|
+
`Class "${e.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.`
|
|
10
|
+
);
|
|
11
|
+
let r = Object.getPrototypeOf(t).constructor;
|
|
12
|
+
if (r)
|
|
13
|
+
for (; r; ) {
|
|
14
|
+
if (s in r && r[s] === e[s])
|
|
15
|
+
return !0;
|
|
16
|
+
r = Object.getPrototypeOf(r);
|
|
17
|
+
}
|
|
18
|
+
return !1;
|
|
19
|
+
}
|
|
20
|
+
const L = /* @__PURE__ */ Symbol.for("drizzle:Name"), $ = /* @__PURE__ */ Symbol.for("drizzle:Schema"), U = /* @__PURE__ */ Symbol.for("drizzle:Columns"), K = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigColumns"), z = /* @__PURE__ */ Symbol.for("drizzle:OriginalName"), V = /* @__PURE__ */ Symbol.for("drizzle:BaseName"), F = /* @__PURE__ */ Symbol.for("drizzle:IsAlias"), E = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigBuilder"), k = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleTable");
|
|
21
|
+
class d {
|
|
22
|
+
static [s] = "Table";
|
|
23
|
+
/** @internal */
|
|
24
|
+
static Symbol = {
|
|
25
|
+
Name: L,
|
|
26
|
+
Schema: $,
|
|
27
|
+
OriginalName: z,
|
|
28
|
+
Columns: U,
|
|
29
|
+
ExtraConfigColumns: K,
|
|
30
|
+
BaseName: V,
|
|
31
|
+
IsAlias: F,
|
|
32
|
+
ExtraConfigBuilder: E
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* Can be changed if the table is aliased.
|
|
37
|
+
*/
|
|
38
|
+
[L];
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
* Used to store the original name of the table, before any aliasing.
|
|
42
|
+
*/
|
|
43
|
+
[z];
|
|
44
|
+
/** @internal */
|
|
45
|
+
[$];
|
|
46
|
+
/** @internal */
|
|
47
|
+
[U];
|
|
48
|
+
/** @internal */
|
|
49
|
+
[K];
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
53
|
+
*/
|
|
54
|
+
[V];
|
|
55
|
+
/** @internal */
|
|
56
|
+
[F] = !1;
|
|
57
|
+
/** @internal */
|
|
58
|
+
[k] = !0;
|
|
59
|
+
/** @internal */
|
|
60
|
+
[E] = void 0;
|
|
61
|
+
constructor(e, r, n) {
|
|
62
|
+
this[L] = this[z] = e, this[$] = r, this[V] = n;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function J(t) {
|
|
66
|
+
return t[L];
|
|
67
|
+
}
|
|
68
|
+
function Re(t) {
|
|
69
|
+
return `${t[$] ?? "public"}.${t[L]}`;
|
|
70
|
+
}
|
|
71
|
+
class B {
|
|
72
|
+
constructor(e, r) {
|
|
73
|
+
this.table = e, this.config = r, this.name = r.name, this.keyAsName = r.keyAsName, this.notNull = r.notNull, this.default = r.default, this.defaultFn = r.defaultFn, this.onUpdateFn = r.onUpdateFn, this.hasDefault = r.hasDefault, this.primary = r.primaryKey, this.isUnique = r.isUnique, this.uniqueName = r.uniqueName, this.uniqueType = r.uniqueType, this.dataType = r.dataType, this.columnType = r.columnType, this.generated = r.generated, this.generatedIdentity = r.generatedIdentity;
|
|
74
|
+
}
|
|
75
|
+
static [s] = "Column";
|
|
76
|
+
name;
|
|
77
|
+
keyAsName;
|
|
78
|
+
primary;
|
|
79
|
+
notNull;
|
|
80
|
+
default;
|
|
81
|
+
defaultFn;
|
|
82
|
+
onUpdateFn;
|
|
83
|
+
hasDefault;
|
|
84
|
+
isUnique;
|
|
85
|
+
uniqueName;
|
|
86
|
+
uniqueType;
|
|
87
|
+
dataType;
|
|
88
|
+
columnType;
|
|
89
|
+
enumValues = void 0;
|
|
90
|
+
generated = void 0;
|
|
91
|
+
generatedIdentity = void 0;
|
|
92
|
+
config;
|
|
93
|
+
mapFromDriverValue(e) {
|
|
94
|
+
return e;
|
|
95
|
+
}
|
|
96
|
+
mapToDriverValue(e) {
|
|
97
|
+
return e;
|
|
98
|
+
}
|
|
99
|
+
// ** @internal */
|
|
100
|
+
shouldDisableInsert() {
|
|
101
|
+
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class ee {
|
|
105
|
+
static [s] = "ColumnBuilder";
|
|
106
|
+
config;
|
|
107
|
+
constructor(e, r, n) {
|
|
108
|
+
this.config = {
|
|
109
|
+
name: e,
|
|
110
|
+
keyAsName: e === "",
|
|
111
|
+
notNull: !1,
|
|
112
|
+
default: void 0,
|
|
113
|
+
hasDefault: !1,
|
|
114
|
+
primaryKey: !1,
|
|
115
|
+
isUnique: !1,
|
|
116
|
+
uniqueName: void 0,
|
|
117
|
+
uniqueType: void 0,
|
|
118
|
+
dataType: r,
|
|
119
|
+
columnType: n,
|
|
120
|
+
generated: void 0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const users = pgTable('users', {
|
|
129
|
+
* id: integer('id').$type<UserId>().primaryKey(),
|
|
130
|
+
* details: json('details').$type<UserDetails>().notNull(),
|
|
131
|
+
* });
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
$type() {
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Adds a `not null` clause to the column definition.
|
|
139
|
+
*
|
|
140
|
+
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
141
|
+
*/
|
|
142
|
+
notNull() {
|
|
143
|
+
return this.config.notNull = !0, this;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Adds a `default <value>` clause to the column definition.
|
|
147
|
+
*
|
|
148
|
+
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
149
|
+
*
|
|
150
|
+
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
151
|
+
*/
|
|
152
|
+
default(e) {
|
|
153
|
+
return this.config.default = e, this.config.hasDefault = !0, this;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Adds a dynamic default value to the column.
|
|
157
|
+
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
158
|
+
*
|
|
159
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
160
|
+
*/
|
|
161
|
+
$defaultFn(e) {
|
|
162
|
+
return this.config.defaultFn = e, this.config.hasDefault = !0, this;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Alias for {@link $defaultFn}.
|
|
166
|
+
*/
|
|
167
|
+
$default = this.$defaultFn;
|
|
168
|
+
/**
|
|
169
|
+
* Adds a dynamic update value to the column.
|
|
170
|
+
* 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.
|
|
171
|
+
* 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.
|
|
172
|
+
*
|
|
173
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
174
|
+
*/
|
|
175
|
+
$onUpdateFn(e) {
|
|
176
|
+
return this.config.onUpdateFn = e, this.config.hasDefault = !0, this;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Alias for {@link $onUpdateFn}.
|
|
180
|
+
*/
|
|
181
|
+
$onUpdate = this.$onUpdateFn;
|
|
182
|
+
/**
|
|
183
|
+
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
184
|
+
*
|
|
185
|
+
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
186
|
+
*/
|
|
187
|
+
primaryKey() {
|
|
188
|
+
return this.config.primaryKey = !0, this.config.notNull = !0, this;
|
|
189
|
+
}
|
|
190
|
+
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
191
|
+
setName(e) {
|
|
192
|
+
this.config.name === "" && (this.config.name = e);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const _ = /* @__PURE__ */ Symbol.for("drizzle:isPgEnum");
|
|
196
|
+
function te(t) {
|
|
197
|
+
return !!t && typeof t == "function" && _ in t && t[_] === !0;
|
|
198
|
+
}
|
|
199
|
+
class C {
|
|
200
|
+
static [s] = "Subquery";
|
|
201
|
+
constructor(e, r, n, a = !1, o = []) {
|
|
202
|
+
this._ = {
|
|
203
|
+
brand: "Subquery",
|
|
204
|
+
sql: e,
|
|
205
|
+
selectedFields: r,
|
|
206
|
+
alias: n,
|
|
207
|
+
isWith: a,
|
|
208
|
+
usedTables: o
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// getSQL(): SQL<unknown> {
|
|
212
|
+
// return new SQL([this]);
|
|
213
|
+
// }
|
|
214
|
+
}
|
|
215
|
+
class We extends C {
|
|
216
|
+
static [s] = "WithSubquery";
|
|
217
|
+
}
|
|
218
|
+
const re = {
|
|
219
|
+
startActiveSpan(t, e) {
|
|
220
|
+
return e();
|
|
221
|
+
}
|
|
222
|
+
}, N = /* @__PURE__ */ Symbol.for("drizzle:ViewBaseConfig");
|
|
223
|
+
function M(t) {
|
|
224
|
+
return t != null && typeof t.getSQL == "function";
|
|
225
|
+
}
|
|
226
|
+
function ne(t) {
|
|
227
|
+
const e = { sql: "", params: [] };
|
|
228
|
+
for (const r of t)
|
|
229
|
+
e.sql += r.sql, e.params.push(...r.params), r.typings?.length && (e.typings || (e.typings = []), e.typings.push(...r.typings));
|
|
230
|
+
return e;
|
|
231
|
+
}
|
|
232
|
+
class S {
|
|
233
|
+
static [s] = "StringChunk";
|
|
234
|
+
value;
|
|
235
|
+
constructor(e) {
|
|
236
|
+
this.value = Array.isArray(e) ? e : [e];
|
|
237
|
+
}
|
|
238
|
+
getSQL() {
|
|
239
|
+
return new m([this]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
class m {
|
|
243
|
+
constructor(e) {
|
|
244
|
+
this.queryChunks = e;
|
|
245
|
+
for (const r of e)
|
|
246
|
+
if (u(r, d)) {
|
|
247
|
+
const n = r[d.Symbol.Schema];
|
|
248
|
+
this.usedTables.push(
|
|
249
|
+
n === void 0 ? r[d.Symbol.Name] : n + "." + r[d.Symbol.Name]
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
static [s] = "SQL";
|
|
254
|
+
/** @internal */
|
|
255
|
+
decoder = G;
|
|
256
|
+
shouldInlineParams = !1;
|
|
257
|
+
/** @internal */
|
|
258
|
+
usedTables = [];
|
|
259
|
+
append(e) {
|
|
260
|
+
return this.queryChunks.push(...e.queryChunks), this;
|
|
261
|
+
}
|
|
262
|
+
toQuery(e) {
|
|
263
|
+
return re.startActiveSpan("drizzle.buildSQL", (r) => {
|
|
264
|
+
const n = this.buildQueryFromSourceParams(this.queryChunks, e);
|
|
265
|
+
return r?.setAttributes({
|
|
266
|
+
"drizzle.query.text": n.sql,
|
|
267
|
+
"drizzle.query.params": JSON.stringify(n.params)
|
|
268
|
+
}), n;
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
buildQueryFromSourceParams(e, r) {
|
|
272
|
+
const n = Object.assign({}, r, {
|
|
273
|
+
inlineParams: r.inlineParams || this.shouldInlineParams,
|
|
274
|
+
paramStartIndex: r.paramStartIndex || { value: 0 }
|
|
275
|
+
}), {
|
|
276
|
+
casing: a,
|
|
277
|
+
escapeName: o,
|
|
278
|
+
escapeParam: g,
|
|
279
|
+
prepareTyping: f,
|
|
280
|
+
inlineParams: p,
|
|
281
|
+
paramStartIndex: h
|
|
282
|
+
} = n;
|
|
283
|
+
return ne(e.map((i) => {
|
|
284
|
+
if (u(i, S))
|
|
285
|
+
return { sql: i.value.join(""), params: [] };
|
|
286
|
+
if (u(i, P))
|
|
287
|
+
return { sql: o(i.value), params: [] };
|
|
288
|
+
if (i === void 0)
|
|
289
|
+
return { sql: "", params: [] };
|
|
290
|
+
if (Array.isArray(i)) {
|
|
291
|
+
const c = [new S("(")];
|
|
292
|
+
for (const [y, I] of i.entries())
|
|
293
|
+
c.push(I), y < i.length - 1 && c.push(new S(", "));
|
|
294
|
+
return c.push(new S(")")), this.buildQueryFromSourceParams(c, n);
|
|
295
|
+
}
|
|
296
|
+
if (u(i, m))
|
|
297
|
+
return this.buildQueryFromSourceParams(i.queryChunks, {
|
|
298
|
+
...n,
|
|
299
|
+
inlineParams: p || i.shouldInlineParams
|
|
300
|
+
});
|
|
301
|
+
if (u(i, d)) {
|
|
302
|
+
const c = i[d.Symbol.Schema], y = i[d.Symbol.Name];
|
|
303
|
+
return {
|
|
304
|
+
sql: c === void 0 || i[F] ? o(y) : o(c) + "." + o(y),
|
|
305
|
+
params: []
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
if (u(i, B)) {
|
|
309
|
+
const c = a.getColumnCasing(i);
|
|
310
|
+
if (r.invokeSource === "indexes")
|
|
311
|
+
return { sql: o(c), params: [] };
|
|
312
|
+
const y = i.table[d.Symbol.Schema];
|
|
313
|
+
return {
|
|
314
|
+
sql: i.table[F] || y === void 0 ? o(i.table[d.Symbol.Name]) + "." + o(c) : o(y) + "." + o(i.table[d.Symbol.Name]) + "." + o(c),
|
|
315
|
+
params: []
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
if (u(i, A)) {
|
|
319
|
+
const c = i[N].schema, y = i[N].name;
|
|
320
|
+
return {
|
|
321
|
+
sql: c === void 0 || i[N].isAlias ? o(y) : o(c) + "." + o(y),
|
|
322
|
+
params: []
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
if (u(i, T)) {
|
|
326
|
+
if (u(i.value, x))
|
|
327
|
+
return { sql: g(h.value++, i), params: [i], typings: ["none"] };
|
|
328
|
+
const c = i.value === null ? null : i.encoder.mapToDriverValue(i.value);
|
|
329
|
+
if (u(c, m))
|
|
330
|
+
return this.buildQueryFromSourceParams([c], n);
|
|
331
|
+
if (p)
|
|
332
|
+
return { sql: this.mapInlineParam(c, n), params: [] };
|
|
333
|
+
let y = ["none"];
|
|
334
|
+
return f && (y = [f(i.encoder)]), { sql: g(h.value++, c), params: [c], typings: y };
|
|
335
|
+
}
|
|
336
|
+
return u(i, x) ? { sql: g(h.value++, i), params: [i], typings: ["none"] } : u(i, m.Aliased) && i.fieldAlias !== void 0 ? { sql: o(i.fieldAlias), params: [] } : u(i, C) ? i._.isWith ? { sql: o(i._.alias), params: [] } : this.buildQueryFromSourceParams([
|
|
337
|
+
new S("("),
|
|
338
|
+
i._.sql,
|
|
339
|
+
new S(") "),
|
|
340
|
+
new P(i._.alias)
|
|
341
|
+
], n) : te(i) ? i.schema ? { sql: o(i.schema) + "." + o(i.enumName), params: [] } : { sql: o(i.enumName), params: [] } : M(i) ? i.shouldOmitSQLParens?.() ? this.buildQueryFromSourceParams([i.getSQL()], n) : this.buildQueryFromSourceParams([
|
|
342
|
+
new S("("),
|
|
343
|
+
i.getSQL(),
|
|
344
|
+
new S(")")
|
|
345
|
+
], n) : p ? { sql: this.mapInlineParam(i, n), params: [] } : { sql: g(h.value++, i), params: [i], typings: ["none"] };
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
mapInlineParam(e, { escapeString: r }) {
|
|
349
|
+
if (e === null)
|
|
350
|
+
return "null";
|
|
351
|
+
if (typeof e == "number" || typeof e == "boolean")
|
|
352
|
+
return e.toString();
|
|
353
|
+
if (typeof e == "string")
|
|
354
|
+
return r(e);
|
|
355
|
+
if (typeof e == "object") {
|
|
356
|
+
const n = e.toString();
|
|
357
|
+
return r(n === "[object Object]" ? JSON.stringify(e) : n);
|
|
358
|
+
}
|
|
359
|
+
throw new Error("Unexpected param value: " + e);
|
|
360
|
+
}
|
|
361
|
+
getSQL() {
|
|
362
|
+
return this;
|
|
363
|
+
}
|
|
364
|
+
as(e) {
|
|
365
|
+
return e === void 0 ? this : new m.Aliased(this, e);
|
|
366
|
+
}
|
|
367
|
+
mapWith(e) {
|
|
368
|
+
return this.decoder = typeof e == "function" ? { mapFromDriverValue: e } : e, this;
|
|
369
|
+
}
|
|
370
|
+
inlineParams() {
|
|
371
|
+
return this.shouldInlineParams = !0, this;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* This method is used to conditionally include a part of the query.
|
|
375
|
+
*
|
|
376
|
+
* @param condition - Condition to check
|
|
377
|
+
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
378
|
+
*/
|
|
379
|
+
if(e) {
|
|
380
|
+
return e ? this : void 0;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
class P {
|
|
384
|
+
constructor(e) {
|
|
385
|
+
this.value = e;
|
|
386
|
+
}
|
|
387
|
+
static [s] = "Name";
|
|
388
|
+
brand;
|
|
389
|
+
getSQL() {
|
|
390
|
+
return new m([this]);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function ie(t) {
|
|
394
|
+
return typeof t == "object" && t !== null && "mapToDriverValue" in t && typeof t.mapToDriverValue == "function";
|
|
395
|
+
}
|
|
396
|
+
const G = {
|
|
397
|
+
mapFromDriverValue: (t) => t
|
|
398
|
+
}, H = {
|
|
399
|
+
mapToDriverValue: (t) => t
|
|
400
|
+
};
|
|
401
|
+
({
|
|
402
|
+
...G,
|
|
403
|
+
...H
|
|
404
|
+
});
|
|
405
|
+
class T {
|
|
406
|
+
/**
|
|
407
|
+
* @param value - Parameter value
|
|
408
|
+
* @param encoder - Encoder to convert the value to a driver parameter
|
|
409
|
+
*/
|
|
410
|
+
constructor(e, r = H) {
|
|
411
|
+
this.value = e, this.encoder = r;
|
|
412
|
+
}
|
|
413
|
+
static [s] = "Param";
|
|
414
|
+
brand;
|
|
415
|
+
getSQL() {
|
|
416
|
+
return new m([this]);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function l(t, ...e) {
|
|
420
|
+
const r = [];
|
|
421
|
+
(e.length > 0 || t.length > 0 && t[0] !== "") && r.push(new S(t[0]));
|
|
422
|
+
for (const [n, a] of e.entries())
|
|
423
|
+
r.push(a, new S(t[n + 1]));
|
|
424
|
+
return new m(r);
|
|
425
|
+
}
|
|
426
|
+
((t) => {
|
|
427
|
+
function e() {
|
|
428
|
+
return new m([]);
|
|
429
|
+
}
|
|
430
|
+
t.empty = e;
|
|
431
|
+
function r(p) {
|
|
432
|
+
return new m(p);
|
|
433
|
+
}
|
|
434
|
+
t.fromList = r;
|
|
435
|
+
function n(p) {
|
|
436
|
+
return new m([new S(p)]);
|
|
437
|
+
}
|
|
438
|
+
t.raw = n;
|
|
439
|
+
function a(p, h) {
|
|
440
|
+
const i = [];
|
|
441
|
+
for (const [c, y] of p.entries())
|
|
442
|
+
c > 0 && h !== void 0 && i.push(h), i.push(y);
|
|
443
|
+
return new m(i);
|
|
444
|
+
}
|
|
445
|
+
t.join = a;
|
|
446
|
+
function o(p) {
|
|
447
|
+
return new P(p);
|
|
448
|
+
}
|
|
449
|
+
t.identifier = o;
|
|
450
|
+
function g(p) {
|
|
451
|
+
return new x(p);
|
|
452
|
+
}
|
|
453
|
+
t.placeholder = g;
|
|
454
|
+
function f(p, h) {
|
|
455
|
+
return new T(p, h);
|
|
456
|
+
}
|
|
457
|
+
t.param = f;
|
|
458
|
+
})(l || (l = {}));
|
|
459
|
+
((t) => {
|
|
460
|
+
class e {
|
|
461
|
+
constructor(n, a) {
|
|
462
|
+
this.sql = n, this.fieldAlias = a;
|
|
463
|
+
}
|
|
464
|
+
static [s] = "SQL.Aliased";
|
|
465
|
+
/** @internal */
|
|
466
|
+
isSelectionField = !1;
|
|
467
|
+
getSQL() {
|
|
468
|
+
return this.sql;
|
|
469
|
+
}
|
|
470
|
+
/** @internal */
|
|
471
|
+
clone() {
|
|
472
|
+
return new e(this.sql, this.fieldAlias);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
t.Aliased = e;
|
|
476
|
+
})(m || (m = {}));
|
|
477
|
+
class x {
|
|
478
|
+
constructor(e) {
|
|
479
|
+
this.name = e;
|
|
480
|
+
}
|
|
481
|
+
static [s] = "Placeholder";
|
|
482
|
+
getSQL() {
|
|
483
|
+
return new m([this]);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function Me(t, e) {
|
|
487
|
+
return t.map((r) => {
|
|
488
|
+
if (u(r, x)) {
|
|
489
|
+
if (!(r.name in e))
|
|
490
|
+
throw new Error(`No value for placeholder "${r.name}" was provided`);
|
|
491
|
+
return e[r.name];
|
|
492
|
+
}
|
|
493
|
+
if (u(r, T) && u(r.value, x)) {
|
|
494
|
+
if (!(r.value.name in e))
|
|
495
|
+
throw new Error(`No value for placeholder "${r.value.name}" was provided`);
|
|
496
|
+
return r.encoder.mapToDriverValue(e[r.value.name]);
|
|
497
|
+
}
|
|
498
|
+
return r;
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
const se = /* @__PURE__ */ Symbol.for("drizzle:IsDrizzleView");
|
|
502
|
+
class A {
|
|
503
|
+
static [s] = "View";
|
|
504
|
+
/** @internal */
|
|
505
|
+
[N];
|
|
506
|
+
/** @internal */
|
|
507
|
+
[se] = !0;
|
|
508
|
+
constructor({ name: e, schema: r, selectedFields: n, query: a }) {
|
|
509
|
+
this[N] = {
|
|
510
|
+
name: e,
|
|
511
|
+
originalName: e,
|
|
512
|
+
schema: r,
|
|
513
|
+
selectedFields: n,
|
|
514
|
+
query: a,
|
|
515
|
+
isExisting: !a,
|
|
516
|
+
isAlias: !1
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
getSQL() {
|
|
520
|
+
return new m([this]);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
B.prototype.getSQL = function() {
|
|
524
|
+
return new m([this]);
|
|
525
|
+
};
|
|
526
|
+
d.prototype.getSQL = function() {
|
|
527
|
+
return new m([this]);
|
|
528
|
+
};
|
|
529
|
+
C.prototype.getSQL = function() {
|
|
530
|
+
return new m([this]);
|
|
531
|
+
};
|
|
532
|
+
function Ge(t, e, r) {
|
|
533
|
+
const n = {}, a = t.reduce(
|
|
534
|
+
(o, { path: g, field: f }, p) => {
|
|
535
|
+
let h;
|
|
536
|
+
u(f, B) ? h = f : u(f, m) ? h = f.decoder : u(f, C) ? h = f._.sql.decoder : h = f.sql.decoder;
|
|
537
|
+
let i = o;
|
|
538
|
+
for (const [c, y] of g.entries())
|
|
539
|
+
if (c < g.length - 1)
|
|
540
|
+
y in i || (i[y] = {}), i = i[y];
|
|
541
|
+
else {
|
|
542
|
+
const I = e[p], Z = i[y] = I === null ? null : h.mapFromDriverValue(I);
|
|
543
|
+
if (r && u(f, B) && g.length === 2) {
|
|
544
|
+
const D = g[0];
|
|
545
|
+
D in n ? typeof n[D] == "string" && n[D] !== J(f.table) && (n[D] = !1) : n[D] = Z === null ? J(f.table) : !1;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return o;
|
|
549
|
+
},
|
|
550
|
+
{}
|
|
551
|
+
);
|
|
552
|
+
if (r && Object.keys(n).length > 0)
|
|
553
|
+
for (const [o, g] of Object.entries(n))
|
|
554
|
+
typeof g == "string" && !r[g] && (a[o] = null);
|
|
555
|
+
return a;
|
|
556
|
+
}
|
|
557
|
+
function R(t, e) {
|
|
558
|
+
return Object.entries(t).reduce((r, [n, a]) => {
|
|
559
|
+
if (typeof n != "string")
|
|
560
|
+
return r;
|
|
561
|
+
const o = e ? [...e, n] : [n];
|
|
562
|
+
return u(a, B) || u(a, m) || u(a, m.Aliased) || u(a, C) ? r.push({ path: o, field: a }) : u(a, d) ? r.push(...R(a[d.Symbol.Columns], o)) : r.push(...R(a, o)), r;
|
|
563
|
+
}, []);
|
|
564
|
+
}
|
|
565
|
+
function He(t, e) {
|
|
566
|
+
const r = Object.keys(t), n = Object.keys(e);
|
|
567
|
+
if (r.length !== n.length)
|
|
568
|
+
return !1;
|
|
569
|
+
for (const [a, o] of r.entries())
|
|
570
|
+
if (o !== n[a])
|
|
571
|
+
return !1;
|
|
572
|
+
return !0;
|
|
573
|
+
}
|
|
574
|
+
function Xe(t, e) {
|
|
575
|
+
const r = Object.entries(e).filter(([, n]) => n !== void 0).map(([n, a]) => u(a, m) || u(a, B) ? [n, a] : [n, new T(a, t[d.Symbol.Columns][n])]);
|
|
576
|
+
if (r.length === 0)
|
|
577
|
+
throw new Error("No values to set");
|
|
578
|
+
return Object.fromEntries(r);
|
|
579
|
+
}
|
|
580
|
+
function Ye(t, e) {
|
|
581
|
+
for (const r of e)
|
|
582
|
+
for (const n of Object.getOwnPropertyNames(r.prototype))
|
|
583
|
+
n !== "constructor" && Object.defineProperty(
|
|
584
|
+
t.prototype,
|
|
585
|
+
n,
|
|
586
|
+
Object.getOwnPropertyDescriptor(r.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
function Ze(t) {
|
|
590
|
+
return t[d.Symbol.Columns];
|
|
591
|
+
}
|
|
592
|
+
function ke(t) {
|
|
593
|
+
return u(t, C) ? t._.alias : u(t, A) ? t[N].name : u(t, m) ? void 0 : t[d.Symbol.IsAlias] ? t[d.Symbol.Name] : t[d.Symbol.BaseName];
|
|
594
|
+
}
|
|
595
|
+
function q(t, e) {
|
|
596
|
+
return {
|
|
597
|
+
name: typeof t == "string" && t.length > 0 ? t : "",
|
|
598
|
+
config: typeof t == "object" ? t : e
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
const X = typeof TextDecoder > "u" ? null : new TextDecoder();
|
|
602
|
+
function b(t, e) {
|
|
603
|
+
return ie(e) && !M(t) && !u(t, T) && !u(t, x) && !u(t, B) && !u(t, d) && !u(t, A) ? new T(t, e) : t;
|
|
604
|
+
}
|
|
605
|
+
const et = (t, e) => l`${t} = ${b(e, t)}`, tt = (t, e) => l`${t} <> ${b(e, t)}`;
|
|
606
|
+
function rt(...t) {
|
|
607
|
+
const e = t.filter(
|
|
608
|
+
(r) => r !== void 0
|
|
609
|
+
);
|
|
610
|
+
if (e.length !== 0)
|
|
611
|
+
return e.length === 1 ? new m(e) : new m([
|
|
612
|
+
new S("("),
|
|
613
|
+
l.join(e, new S(" and ")),
|
|
614
|
+
new S(")")
|
|
615
|
+
]);
|
|
616
|
+
}
|
|
617
|
+
function nt(...t) {
|
|
618
|
+
const e = t.filter(
|
|
619
|
+
(r) => r !== void 0
|
|
620
|
+
);
|
|
621
|
+
if (e.length !== 0)
|
|
622
|
+
return e.length === 1 ? new m(e) : new m([
|
|
623
|
+
new S("("),
|
|
624
|
+
l.join(e, new S(" or ")),
|
|
625
|
+
new S(")")
|
|
626
|
+
]);
|
|
627
|
+
}
|
|
628
|
+
function it(t) {
|
|
629
|
+
return l`not ${t}`;
|
|
630
|
+
}
|
|
631
|
+
const st = (t, e) => l`${t} > ${b(e, t)}`, ot = (t, e) => l`${t} >= ${b(e, t)}`, at = (t, e) => l`${t} < ${b(e, t)}`, ut = (t, e) => l`${t} <= ${b(e, t)}`;
|
|
632
|
+
function lt(t, e) {
|
|
633
|
+
return Array.isArray(e) ? e.length === 0 ? l`false` : l`${t} in ${e.map((r) => b(r, t))}` : l`${t} in ${b(e, t)}`;
|
|
634
|
+
}
|
|
635
|
+
function mt(t, e) {
|
|
636
|
+
return Array.isArray(e) ? e.length === 0 ? l`true` : l`${t} not in ${e.map((r) => b(r, t))}` : l`${t} not in ${b(e, t)}`;
|
|
637
|
+
}
|
|
638
|
+
function ct(t) {
|
|
639
|
+
return l`${t} is null`;
|
|
640
|
+
}
|
|
641
|
+
function ft(t) {
|
|
642
|
+
return l`${t} is not null`;
|
|
643
|
+
}
|
|
644
|
+
function dt(t) {
|
|
645
|
+
return l`exists ${t}`;
|
|
646
|
+
}
|
|
647
|
+
function pt(t) {
|
|
648
|
+
return l`not exists ${t}`;
|
|
649
|
+
}
|
|
650
|
+
function gt(t, e, r) {
|
|
651
|
+
return l`${t} between ${b(e, t)} and ${b(
|
|
652
|
+
r,
|
|
653
|
+
t
|
|
654
|
+
)}`;
|
|
655
|
+
}
|
|
656
|
+
function yt(t, e, r) {
|
|
657
|
+
return l`${t} not between ${b(
|
|
658
|
+
e,
|
|
659
|
+
t
|
|
660
|
+
)} and ${b(r, t)}`;
|
|
661
|
+
}
|
|
662
|
+
function ht(t, e) {
|
|
663
|
+
return l`${t} like ${e}`;
|
|
664
|
+
}
|
|
665
|
+
function St(t, e) {
|
|
666
|
+
return l`${t} not like ${e}`;
|
|
667
|
+
}
|
|
668
|
+
function bt(t, e) {
|
|
669
|
+
return l`${t} ilike ${e}`;
|
|
670
|
+
}
|
|
671
|
+
function wt(t, e) {
|
|
672
|
+
return l`${t} not ilike ${e}`;
|
|
673
|
+
}
|
|
674
|
+
function Qt(t) {
|
|
675
|
+
return l`${t} asc`;
|
|
676
|
+
}
|
|
677
|
+
function Lt(t) {
|
|
678
|
+
return l`${t} desc`;
|
|
679
|
+
}
|
|
680
|
+
class oe {
|
|
681
|
+
static [s] = "SQLiteForeignKeyBuilder";
|
|
682
|
+
/** @internal */
|
|
683
|
+
reference;
|
|
684
|
+
/** @internal */
|
|
685
|
+
_onUpdate;
|
|
686
|
+
/** @internal */
|
|
687
|
+
_onDelete;
|
|
688
|
+
constructor(e, r) {
|
|
689
|
+
this.reference = () => {
|
|
690
|
+
const { name: n, columns: a, foreignColumns: o } = e();
|
|
691
|
+
return { name: n, columns: a, foreignTable: o[0].table, foreignColumns: o };
|
|
692
|
+
}, r && (this._onUpdate = r.onUpdate, this._onDelete = r.onDelete);
|
|
693
|
+
}
|
|
694
|
+
onUpdate(e) {
|
|
695
|
+
return this._onUpdate = e, this;
|
|
696
|
+
}
|
|
697
|
+
onDelete(e) {
|
|
698
|
+
return this._onDelete = e, this;
|
|
699
|
+
}
|
|
700
|
+
/** @internal */
|
|
701
|
+
build(e) {
|
|
702
|
+
return new ae(e, this);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class ae {
|
|
706
|
+
constructor(e, r) {
|
|
707
|
+
this.table = e, this.reference = r.reference, this.onUpdate = r._onUpdate, this.onDelete = r._onDelete;
|
|
708
|
+
}
|
|
709
|
+
static [s] = "SQLiteForeignKey";
|
|
710
|
+
reference;
|
|
711
|
+
onUpdate;
|
|
712
|
+
onDelete;
|
|
713
|
+
getName() {
|
|
714
|
+
const { name: e, columns: r, foreignColumns: n } = this.reference(), a = r.map((f) => f.name), o = n.map((f) => f.name), g = [
|
|
715
|
+
this.table[L],
|
|
716
|
+
...a,
|
|
717
|
+
n[0].table[L],
|
|
718
|
+
...o
|
|
719
|
+
];
|
|
720
|
+
return e ?? `${g.join("_")}_fk`;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
function ue(t, e) {
|
|
724
|
+
return `${t[L]}_${e.join("_")}_unique`;
|
|
725
|
+
}
|
|
726
|
+
class w extends ee {
|
|
727
|
+
static [s] = "SQLiteColumnBuilder";
|
|
728
|
+
foreignKeyConfigs = [];
|
|
729
|
+
references(e, r = {}) {
|
|
730
|
+
return this.foreignKeyConfigs.push({ ref: e, actions: r }), this;
|
|
731
|
+
}
|
|
732
|
+
unique(e) {
|
|
733
|
+
return this.config.isUnique = !0, this.config.uniqueName = e, this;
|
|
734
|
+
}
|
|
735
|
+
generatedAlwaysAs(e, r) {
|
|
736
|
+
return this.config.generated = {
|
|
737
|
+
as: e,
|
|
738
|
+
type: "always",
|
|
739
|
+
mode: r?.mode ?? "virtual"
|
|
740
|
+
}, this;
|
|
741
|
+
}
|
|
742
|
+
/** @internal */
|
|
743
|
+
buildForeignKeys(e, r) {
|
|
744
|
+
return this.foreignKeyConfigs.map(({ ref: n, actions: a }) => ((o, g) => {
|
|
745
|
+
const f = new oe(() => {
|
|
746
|
+
const p = o();
|
|
747
|
+
return { columns: [e], foreignColumns: [p] };
|
|
748
|
+
});
|
|
749
|
+
return g.onUpdate && f.onUpdate(g.onUpdate), g.onDelete && f.onDelete(g.onDelete), f.build(r);
|
|
750
|
+
})(n, a));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
class Q extends B {
|
|
754
|
+
constructor(e, r) {
|
|
755
|
+
r.uniqueName || (r.uniqueName = ue(e, [r.name])), super(e, r), this.table = e;
|
|
756
|
+
}
|
|
757
|
+
static [s] = "SQLiteColumn";
|
|
758
|
+
}
|
|
759
|
+
class le extends w {
|
|
760
|
+
static [s] = "SQLiteBigIntBuilder";
|
|
761
|
+
constructor(e) {
|
|
762
|
+
super(e, "bigint", "SQLiteBigInt");
|
|
763
|
+
}
|
|
764
|
+
/** @internal */
|
|
765
|
+
build(e) {
|
|
766
|
+
return new me(e, this.config);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
class me extends Q {
|
|
770
|
+
static [s] = "SQLiteBigInt";
|
|
771
|
+
getSQLType() {
|
|
772
|
+
return "blob";
|
|
773
|
+
}
|
|
774
|
+
mapFromDriverValue(e) {
|
|
775
|
+
if (typeof Buffer < "u" && Buffer.from) {
|
|
776
|
+
const r = Buffer.isBuffer(e) ? e : e instanceof ArrayBuffer ? Buffer.from(e) : e.buffer ? Buffer.from(e.buffer, e.byteOffset, e.byteLength) : Buffer.from(e);
|
|
777
|
+
return BigInt(r.toString("utf8"));
|
|
778
|
+
}
|
|
779
|
+
return BigInt(X.decode(e));
|
|
780
|
+
}
|
|
781
|
+
mapToDriverValue(e) {
|
|
782
|
+
return Buffer.from(e.toString());
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
class ce extends w {
|
|
786
|
+
static [s] = "SQLiteBlobJsonBuilder";
|
|
787
|
+
constructor(e) {
|
|
788
|
+
super(e, "json", "SQLiteBlobJson");
|
|
789
|
+
}
|
|
790
|
+
/** @internal */
|
|
791
|
+
build(e) {
|
|
792
|
+
return new fe(
|
|
793
|
+
e,
|
|
794
|
+
this.config
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
class fe extends Q {
|
|
799
|
+
static [s] = "SQLiteBlobJson";
|
|
800
|
+
getSQLType() {
|
|
801
|
+
return "blob";
|
|
802
|
+
}
|
|
803
|
+
mapFromDriverValue(e) {
|
|
804
|
+
if (typeof Buffer < "u" && Buffer.from) {
|
|
805
|
+
const r = Buffer.isBuffer(e) ? e : e instanceof ArrayBuffer ? Buffer.from(e) : e.buffer ? Buffer.from(e.buffer, e.byteOffset, e.byteLength) : Buffer.from(e);
|
|
806
|
+
return JSON.parse(r.toString("utf8"));
|
|
807
|
+
}
|
|
808
|
+
return JSON.parse(X.decode(e));
|
|
809
|
+
}
|
|
810
|
+
mapToDriverValue(e) {
|
|
811
|
+
return Buffer.from(JSON.stringify(e));
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
class de extends w {
|
|
815
|
+
static [s] = "SQLiteBlobBufferBuilder";
|
|
816
|
+
constructor(e) {
|
|
817
|
+
super(e, "buffer", "SQLiteBlobBuffer");
|
|
818
|
+
}
|
|
819
|
+
/** @internal */
|
|
820
|
+
build(e) {
|
|
821
|
+
return new pe(e, this.config);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
class pe extends Q {
|
|
825
|
+
static [s] = "SQLiteBlobBuffer";
|
|
826
|
+
mapFromDriverValue(e) {
|
|
827
|
+
return Buffer.isBuffer(e) ? e : Buffer.from(e);
|
|
828
|
+
}
|
|
829
|
+
getSQLType() {
|
|
830
|
+
return "blob";
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
function ge(t, e) {
|
|
834
|
+
const { name: r, config: n } = q(t, e);
|
|
835
|
+
return n?.mode === "json" ? new ce(r) : n?.mode === "bigint" ? new le(r) : new de(r);
|
|
836
|
+
}
|
|
837
|
+
class ye extends w {
|
|
838
|
+
static [s] = "SQLiteCustomColumnBuilder";
|
|
839
|
+
constructor(e, r, n) {
|
|
840
|
+
super(e, "custom", "SQLiteCustomColumn"), this.config.fieldConfig = r, this.config.customTypeParams = n;
|
|
841
|
+
}
|
|
842
|
+
/** @internal */
|
|
843
|
+
build(e) {
|
|
844
|
+
return new he(
|
|
845
|
+
e,
|
|
846
|
+
this.config
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
class he extends Q {
|
|
851
|
+
static [s] = "SQLiteCustomColumn";
|
|
852
|
+
sqlName;
|
|
853
|
+
mapTo;
|
|
854
|
+
mapFrom;
|
|
855
|
+
constructor(e, r) {
|
|
856
|
+
super(e, r), this.sqlName = r.customTypeParams.dataType(r.fieldConfig), this.mapTo = r.customTypeParams.toDriver, this.mapFrom = r.customTypeParams.fromDriver;
|
|
857
|
+
}
|
|
858
|
+
getSQLType() {
|
|
859
|
+
return this.sqlName;
|
|
860
|
+
}
|
|
861
|
+
mapFromDriverValue(e) {
|
|
862
|
+
return typeof this.mapFrom == "function" ? this.mapFrom(e) : e;
|
|
863
|
+
}
|
|
864
|
+
mapToDriverValue(e) {
|
|
865
|
+
return typeof this.mapTo == "function" ? this.mapTo(e) : e;
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function Se(t) {
|
|
869
|
+
return (e, r) => {
|
|
870
|
+
const { name: n, config: a } = q(e, r);
|
|
871
|
+
return new ye(
|
|
872
|
+
n,
|
|
873
|
+
a,
|
|
874
|
+
t
|
|
875
|
+
);
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
class j extends w {
|
|
879
|
+
static [s] = "SQLiteBaseIntegerBuilder";
|
|
880
|
+
constructor(e, r, n) {
|
|
881
|
+
super(e, r, n), this.config.autoIncrement = !1;
|
|
882
|
+
}
|
|
883
|
+
primaryKey(e) {
|
|
884
|
+
return e?.autoIncrement && (this.config.autoIncrement = !0), this.config.hasDefault = !0, super.primaryKey();
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
class v extends Q {
|
|
888
|
+
static [s] = "SQLiteBaseInteger";
|
|
889
|
+
autoIncrement = this.config.autoIncrement;
|
|
890
|
+
getSQLType() {
|
|
891
|
+
return "integer";
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
class be extends j {
|
|
895
|
+
static [s] = "SQLiteIntegerBuilder";
|
|
896
|
+
constructor(e) {
|
|
897
|
+
super(e, "number", "SQLiteInteger");
|
|
898
|
+
}
|
|
899
|
+
build(e) {
|
|
900
|
+
return new we(
|
|
901
|
+
e,
|
|
902
|
+
this.config
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
class we extends v {
|
|
907
|
+
static [s] = "SQLiteInteger";
|
|
908
|
+
}
|
|
909
|
+
class Qe extends j {
|
|
910
|
+
static [s] = "SQLiteTimestampBuilder";
|
|
911
|
+
constructor(e, r) {
|
|
912
|
+
super(e, "date", "SQLiteTimestamp"), this.config.mode = r;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* @deprecated Use `default()` with your own expression instead.
|
|
916
|
+
*
|
|
917
|
+
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
|
|
918
|
+
*/
|
|
919
|
+
defaultNow() {
|
|
920
|
+
return this.default(l`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
|
|
921
|
+
}
|
|
922
|
+
build(e) {
|
|
923
|
+
return new Le(
|
|
924
|
+
e,
|
|
925
|
+
this.config
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
class Le extends v {
|
|
930
|
+
static [s] = "SQLiteTimestamp";
|
|
931
|
+
mode = this.config.mode;
|
|
932
|
+
mapFromDriverValue(e) {
|
|
933
|
+
return this.config.mode === "timestamp" ? new Date(e * 1e3) : new Date(e);
|
|
934
|
+
}
|
|
935
|
+
mapToDriverValue(e) {
|
|
936
|
+
const r = e.getTime();
|
|
937
|
+
return this.config.mode === "timestamp" ? Math.floor(r / 1e3) : r;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
class Be extends j {
|
|
941
|
+
static [s] = "SQLiteBooleanBuilder";
|
|
942
|
+
constructor(e, r) {
|
|
943
|
+
super(e, "boolean", "SQLiteBoolean"), this.config.mode = r;
|
|
944
|
+
}
|
|
945
|
+
build(e) {
|
|
946
|
+
return new Ne(
|
|
947
|
+
e,
|
|
948
|
+
this.config
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
class Ne extends v {
|
|
953
|
+
static [s] = "SQLiteBoolean";
|
|
954
|
+
mode = this.config.mode;
|
|
955
|
+
mapFromDriverValue(e) {
|
|
956
|
+
return Number(e) === 1;
|
|
957
|
+
}
|
|
958
|
+
mapToDriverValue(e) {
|
|
959
|
+
return e ? 1 : 0;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function Te(t, e) {
|
|
963
|
+
const { name: r, config: n } = q(t, e);
|
|
964
|
+
return n?.mode === "timestamp" || n?.mode === "timestamp_ms" ? new Qe(r, n.mode) : n?.mode === "boolean" ? new Be(r, n.mode) : new be(r);
|
|
965
|
+
}
|
|
966
|
+
class xe extends w {
|
|
967
|
+
static [s] = "SQLiteNumericBuilder";
|
|
968
|
+
constructor(e) {
|
|
969
|
+
super(e, "string", "SQLiteNumeric");
|
|
970
|
+
}
|
|
971
|
+
/** @internal */
|
|
972
|
+
build(e) {
|
|
973
|
+
return new Ce(
|
|
974
|
+
e,
|
|
975
|
+
this.config
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
class Ce extends Q {
|
|
980
|
+
static [s] = "SQLiteNumeric";
|
|
981
|
+
mapFromDriverValue(e) {
|
|
982
|
+
return typeof e == "string" ? e : String(e);
|
|
983
|
+
}
|
|
984
|
+
getSQLType() {
|
|
985
|
+
return "numeric";
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
class De extends w {
|
|
989
|
+
static [s] = "SQLiteNumericNumberBuilder";
|
|
990
|
+
constructor(e) {
|
|
991
|
+
super(e, "number", "SQLiteNumericNumber");
|
|
992
|
+
}
|
|
993
|
+
/** @internal */
|
|
994
|
+
build(e) {
|
|
995
|
+
return new qe(
|
|
996
|
+
e,
|
|
997
|
+
this.config
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
class qe extends Q {
|
|
1002
|
+
static [s] = "SQLiteNumericNumber";
|
|
1003
|
+
mapFromDriverValue(e) {
|
|
1004
|
+
return typeof e == "number" ? e : Number(e);
|
|
1005
|
+
}
|
|
1006
|
+
mapToDriverValue = String;
|
|
1007
|
+
getSQLType() {
|
|
1008
|
+
return "numeric";
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
class Ie extends w {
|
|
1012
|
+
static [s] = "SQLiteNumericBigIntBuilder";
|
|
1013
|
+
constructor(e) {
|
|
1014
|
+
super(e, "bigint", "SQLiteNumericBigInt");
|
|
1015
|
+
}
|
|
1016
|
+
/** @internal */
|
|
1017
|
+
build(e) {
|
|
1018
|
+
return new $e(
|
|
1019
|
+
e,
|
|
1020
|
+
this.config
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
class $e extends Q {
|
|
1025
|
+
static [s] = "SQLiteNumericBigInt";
|
|
1026
|
+
mapFromDriverValue = BigInt;
|
|
1027
|
+
mapToDriverValue = String;
|
|
1028
|
+
getSQLType() {
|
|
1029
|
+
return "numeric";
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
function Fe(t, e) {
|
|
1033
|
+
const { name: r, config: n } = q(t, e), a = n?.mode;
|
|
1034
|
+
return a === "number" ? new De(r) : a === "bigint" ? new Ie(r) : new xe(r);
|
|
1035
|
+
}
|
|
1036
|
+
class ze extends w {
|
|
1037
|
+
static [s] = "SQLiteRealBuilder";
|
|
1038
|
+
constructor(e) {
|
|
1039
|
+
super(e, "number", "SQLiteReal");
|
|
1040
|
+
}
|
|
1041
|
+
/** @internal */
|
|
1042
|
+
build(e) {
|
|
1043
|
+
return new Ve(e, this.config);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
class Ve extends Q {
|
|
1047
|
+
static [s] = "SQLiteReal";
|
|
1048
|
+
getSQLType() {
|
|
1049
|
+
return "real";
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function Pe(t) {
|
|
1053
|
+
return new ze(t ?? "");
|
|
1054
|
+
}
|
|
1055
|
+
class Oe extends w {
|
|
1056
|
+
static [s] = "SQLiteTextBuilder";
|
|
1057
|
+
constructor(e, r) {
|
|
1058
|
+
super(e, "string", "SQLiteText"), this.config.enumValues = r.enum, this.config.length = r.length;
|
|
1059
|
+
}
|
|
1060
|
+
/** @internal */
|
|
1061
|
+
build(e) {
|
|
1062
|
+
return new Ae(
|
|
1063
|
+
e,
|
|
1064
|
+
this.config
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
class Ae extends Q {
|
|
1069
|
+
static [s] = "SQLiteText";
|
|
1070
|
+
enumValues = this.config.enumValues;
|
|
1071
|
+
length = this.config.length;
|
|
1072
|
+
constructor(e, r) {
|
|
1073
|
+
super(e, r);
|
|
1074
|
+
}
|
|
1075
|
+
getSQLType() {
|
|
1076
|
+
return `text${this.config.length ? `(${this.config.length})` : ""}`;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
class je extends w {
|
|
1080
|
+
static [s] = "SQLiteTextJsonBuilder";
|
|
1081
|
+
constructor(e) {
|
|
1082
|
+
super(e, "json", "SQLiteTextJson");
|
|
1083
|
+
}
|
|
1084
|
+
/** @internal */
|
|
1085
|
+
build(e) {
|
|
1086
|
+
return new ve(
|
|
1087
|
+
e,
|
|
1088
|
+
this.config
|
|
1089
|
+
);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
class ve extends Q {
|
|
1093
|
+
static [s] = "SQLiteTextJson";
|
|
1094
|
+
getSQLType() {
|
|
1095
|
+
return "text";
|
|
1096
|
+
}
|
|
1097
|
+
mapFromDriverValue(e) {
|
|
1098
|
+
return JSON.parse(e);
|
|
1099
|
+
}
|
|
1100
|
+
mapToDriverValue(e) {
|
|
1101
|
+
return JSON.stringify(e);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
function Ue(t, e = {}) {
|
|
1105
|
+
const { name: r, config: n } = q(t, e);
|
|
1106
|
+
return n.mode === "json" ? new je(r) : new Oe(r, n);
|
|
1107
|
+
}
|
|
1108
|
+
function Ke() {
|
|
1109
|
+
return {
|
|
1110
|
+
blob: ge,
|
|
1111
|
+
customType: Se,
|
|
1112
|
+
integer: Te,
|
|
1113
|
+
numeric: Fe,
|
|
1114
|
+
real: Pe,
|
|
1115
|
+
text: Ue
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
const O = /* @__PURE__ */ Symbol.for("drizzle:SQLiteInlineForeignKeys");
|
|
1119
|
+
class W extends d {
|
|
1120
|
+
static [s] = "SQLiteTable";
|
|
1121
|
+
/** @internal */
|
|
1122
|
+
static Symbol = Object.assign({}, d.Symbol, {
|
|
1123
|
+
InlineForeignKeys: O
|
|
1124
|
+
});
|
|
1125
|
+
/** @internal */
|
|
1126
|
+
[d.Symbol.Columns];
|
|
1127
|
+
/** @internal */
|
|
1128
|
+
[O] = [];
|
|
1129
|
+
/** @internal */
|
|
1130
|
+
[d.Symbol.ExtraConfigBuilder] = void 0;
|
|
1131
|
+
}
|
|
1132
|
+
function Ee(t, e, r, n, a = t) {
|
|
1133
|
+
const o = new W(t, n, a), g = typeof e == "function" ? e(Ke()) : e, f = Object.fromEntries(
|
|
1134
|
+
Object.entries(g).map(([h, i]) => {
|
|
1135
|
+
const c = i;
|
|
1136
|
+
c.setName(h);
|
|
1137
|
+
const y = c.build(o);
|
|
1138
|
+
return o[O].push(...c.buildForeignKeys(y, o)), [h, y];
|
|
1139
|
+
})
|
|
1140
|
+
), p = Object.assign(o, f);
|
|
1141
|
+
return p[d.Symbol.Columns] = f, p[d.Symbol.ExtraConfigColumns] = f, r && (p[W.Symbol.ExtraConfigBuilder] = r), p;
|
|
1142
|
+
}
|
|
1143
|
+
const Bt = (t, e, r) => Ee(t, e, r);
|
|
1144
|
+
class Y {
|
|
1145
|
+
constructor(e, r) {
|
|
1146
|
+
this.name = e, this.unique = r;
|
|
1147
|
+
}
|
|
1148
|
+
static [s] = "SQLiteIndexBuilderOn";
|
|
1149
|
+
on(...e) {
|
|
1150
|
+
return new Je(this.name, e, this.unique);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
class Je {
|
|
1154
|
+
static [s] = "SQLiteIndexBuilder";
|
|
1155
|
+
/** @internal */
|
|
1156
|
+
config;
|
|
1157
|
+
constructor(e, r, n) {
|
|
1158
|
+
this.config = {
|
|
1159
|
+
name: e,
|
|
1160
|
+
columns: r,
|
|
1161
|
+
unique: n,
|
|
1162
|
+
where: void 0
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Condition for partial index.
|
|
1167
|
+
*/
|
|
1168
|
+
where(e) {
|
|
1169
|
+
return this.config.where = e, this;
|
|
1170
|
+
}
|
|
1171
|
+
/** @internal */
|
|
1172
|
+
build(e) {
|
|
1173
|
+
return new _e(this.config, e);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
class _e {
|
|
1177
|
+
static [s] = "SQLiteIndex";
|
|
1178
|
+
config;
|
|
1179
|
+
constructor(e, r) {
|
|
1180
|
+
this.config = { ...e, table: r };
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function Nt(t) {
|
|
1184
|
+
return new Y(t, !1);
|
|
1185
|
+
}
|
|
1186
|
+
function Tt(t) {
|
|
1187
|
+
return new Y(t, !0);
|
|
1188
|
+
}
|
|
1189
|
+
export {
|
|
1190
|
+
gt as A,
|
|
1191
|
+
C as B,
|
|
1192
|
+
B as C,
|
|
1193
|
+
A as D,
|
|
1194
|
+
W as E,
|
|
1195
|
+
R as F,
|
|
1196
|
+
J as G,
|
|
1197
|
+
Q as H,
|
|
1198
|
+
Ze as I,
|
|
1199
|
+
ke as J,
|
|
1200
|
+
He as K,
|
|
1201
|
+
Ye as L,
|
|
1202
|
+
U as M,
|
|
1203
|
+
Xe as N,
|
|
1204
|
+
Me as O,
|
|
1205
|
+
T as P,
|
|
1206
|
+
Ge as Q,
|
|
1207
|
+
Bt as R,
|
|
1208
|
+
m as S,
|
|
1209
|
+
d as T,
|
|
1210
|
+
Te as U,
|
|
1211
|
+
N as V,
|
|
1212
|
+
We as W,
|
|
1213
|
+
Ue as X,
|
|
1214
|
+
Nt as Y,
|
|
1215
|
+
Tt as Z,
|
|
1216
|
+
Qt as a,
|
|
1217
|
+
rt as b,
|
|
1218
|
+
s as c,
|
|
1219
|
+
Lt as d,
|
|
1220
|
+
et as e,
|
|
1221
|
+
wt as f,
|
|
1222
|
+
Re as g,
|
|
1223
|
+
St as h,
|
|
1224
|
+
u as i,
|
|
1225
|
+
pt as j,
|
|
1226
|
+
yt as k,
|
|
1227
|
+
it as l,
|
|
1228
|
+
tt as m,
|
|
1229
|
+
mt as n,
|
|
1230
|
+
nt as o,
|
|
1231
|
+
ut as p,
|
|
1232
|
+
at as q,
|
|
1233
|
+
ht as r,
|
|
1234
|
+
l as s,
|
|
1235
|
+
ft as t,
|
|
1236
|
+
ct as u,
|
|
1237
|
+
lt as v,
|
|
1238
|
+
bt as w,
|
|
1239
|
+
ot as x,
|
|
1240
|
+
st as y,
|
|
1241
|
+
dt as z
|
|
1242
|
+
};
|