jukebox-media-server 0.6.0 → 0.7.0

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.
Files changed (31) hide show
  1. package/dist/client/assets/{Watch-Ja4PAA8Y.js → Watch-BiR2iXrC.js} +33 -33
  2. package/dist/client/assets/index-CKZbQJYY.css +1 -0
  3. package/dist/client/assets/index-CoxOmmZz.js +87 -0
  4. package/dist/client/index.html +2 -2
  5. package/dist/client/sw.js +1 -1
  6. package/dist/server/HttpApiBuilder-DWwOvarr.js +42786 -0
  7. package/dist/server/{better-sqlite3-6WoM5xG0.js → better-sqlite3-CkwhTVXW.js} +3 -3
  8. package/dist/server/bun-database-CqinoQgb.js +14 -0
  9. package/dist/server/bun-database-oVoIc-C8.js +15 -0
  10. package/dist/server/{bun-sqlite-BBdvu820.js → bun-sqlite-Bk_yjDLi.js} +2 -2
  11. package/dist/server/chunk-CrysgU_F.js +36 -0
  12. package/dist/server/config-CCAveLuN.js +12 -0
  13. package/dist/server/esm-Dm4Gq4cv.js +40975 -0
  14. package/dist/server/index.js +3889 -5608
  15. package/dist/server/{indexes-VMR6QVVl.js → indexes-vPbUiKXP.js} +4 -100
  16. package/dist/server/{session-DfEK0QWr.js → logger-ygdFSBOU.js} +250 -249
  17. package/dist/server/{migrator-C_0LpHsF.js → migrator-CpDrzLY4.js} +1 -1
  18. package/dist/server/{migrator-CXTJWgtg.js → migrator-D9F-ETAB.js} +1 -1
  19. package/dist/server/schema-1sWMC8cP.js +59 -0
  20. package/dist/server/schema-B7-kIAVY.js +145 -0
  21. package/dist/server/select-62doObBa.js +101 -0
  22. package/drizzle/0011_loose_eternity.sql +1 -0
  23. package/drizzle/meta/0011_snapshot.json +1066 -0
  24. package/drizzle/meta/_journal.json +8 -1
  25. package/drizzle-telemetry/0000_great_thor.sql +45 -0
  26. package/drizzle-telemetry/meta/0000_snapshot.json +320 -0
  27. package/drizzle-telemetry/meta/_journal.json +13 -0
  28. package/package.json +22 -8
  29. package/dist/client/assets/index-AENKhh_8.css +0 -1
  30. package/dist/client/assets/index-Cm9WIhoR.js +0 -58
  31. /package/dist/server/{migrator-CAdL3H58.js → migrator-8uumkKvi.js} +0 -0
@@ -745,105 +745,6 @@ function isConfig(data) {
745
745
  }
746
746
  const textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
747
747
  //#endregion
748
- //#region node_modules/drizzle-orm/sql/expressions/conditions.js
749
- function bindIfParam(value, column) {
750
- if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) return new Param(value, column);
751
- return value;
752
- }
753
- const eq = (left, right) => {
754
- return sql`${left} = ${bindIfParam(right, left)}`;
755
- };
756
- const ne = (left, right) => {
757
- return sql`${left} <> ${bindIfParam(right, left)}`;
758
- };
759
- function and(...unfilteredConditions) {
760
- const conditions = unfilteredConditions.filter((c) => c !== void 0);
761
- if (conditions.length === 0) return;
762
- if (conditions.length === 1) return new SQL(conditions);
763
- return new SQL([
764
- new StringChunk("("),
765
- sql.join(conditions, new StringChunk(" and ")),
766
- new StringChunk(")")
767
- ]);
768
- }
769
- function or(...unfilteredConditions) {
770
- const conditions = unfilteredConditions.filter((c) => c !== void 0);
771
- if (conditions.length === 0) return;
772
- if (conditions.length === 1) return new SQL(conditions);
773
- return new SQL([
774
- new StringChunk("("),
775
- sql.join(conditions, new StringChunk(" or ")),
776
- new StringChunk(")")
777
- ]);
778
- }
779
- function not(condition) {
780
- return sql`not ${condition}`;
781
- }
782
- const gt = (left, right) => {
783
- return sql`${left} > ${bindIfParam(right, left)}`;
784
- };
785
- const gte = (left, right) => {
786
- return sql`${left} >= ${bindIfParam(right, left)}`;
787
- };
788
- const lt = (left, right) => {
789
- return sql`${left} < ${bindIfParam(right, left)}`;
790
- };
791
- const lte = (left, right) => {
792
- return sql`${left} <= ${bindIfParam(right, left)}`;
793
- };
794
- function inArray(column, values) {
795
- if (Array.isArray(values)) {
796
- if (values.length === 0) return sql`false`;
797
- return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;
798
- }
799
- return sql`${column} in ${bindIfParam(values, column)}`;
800
- }
801
- function notInArray(column, values) {
802
- if (Array.isArray(values)) {
803
- if (values.length === 0) return sql`true`;
804
- return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;
805
- }
806
- return sql`${column} not in ${bindIfParam(values, column)}`;
807
- }
808
- function isNull(value) {
809
- return sql`${value} is null`;
810
- }
811
- function isNotNull(value) {
812
- return sql`${value} is not null`;
813
- }
814
- function exists(subquery) {
815
- return sql`exists ${subquery}`;
816
- }
817
- function notExists(subquery) {
818
- return sql`not exists ${subquery}`;
819
- }
820
- function between(column, min, max) {
821
- return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
822
- }
823
- function notBetween(column, min, max) {
824
- return sql`${column} not between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
825
- }
826
- function like(column, value) {
827
- return sql`${column} like ${value}`;
828
- }
829
- function notLike(column, value) {
830
- return sql`${column} not like ${value}`;
831
- }
832
- function ilike(column, value) {
833
- return sql`${column} ilike ${value}`;
834
- }
835
- function notIlike(column, value) {
836
- return sql`${column} not ilike ${value}`;
837
- }
838
- //#endregion
839
- //#region node_modules/drizzle-orm/sql/expressions/select.js
840
- function asc(column) {
841
- return sql`${column} asc`;
842
- }
843
- function desc(column) {
844
- return sql`${column} desc`;
845
- }
846
- //#endregion
847
748
  //#region node_modules/drizzle-orm/sqlite-core/foreign-keys.js
848
749
  var ForeignKeyBuilder = class {
849
750
  static [entityKind] = "SQLiteForeignKeyBuilder";
@@ -1402,8 +1303,11 @@ var Index = class {
1402
1303
  };
1403
1304
  }
1404
1305
  };
1306
+ function index(name) {
1307
+ return new IndexBuilderOn(name, false);
1308
+ }
1405
1309
  function uniqueIndex(name) {
1406
1310
  return new IndexBuilderOn(name, true);
1407
1311
  }
1408
1312
  //#endregion
1409
- export { is as $, or as A, SQL as B, ne as C, notIlike as D, notExists as E, isConfig as F, Table as G, fillPlaceholders as H, mapResultRow as I, ViewBaseConfig as J, getTableName as K, mapUpdateSet as L, getTableColumns as M, getTableLikeName as N, notInArray as O, haveSameKeys as P, entityKind as Q, orderSelectedFields as R, lte as S, notBetween as T, sql as U, View as V, Columns as W, WithSubquery as X, Subquery as Y, Column as Z, inArray as _, real as a, like as b, asc as c, between as d, eq as f, ilike as g, gte as h, text as i, applyMixins as j, notLike as k, desc as l, gt as m, SQLiteTable as n, integer as o, exists as p, getTableUniqueName as q, sqliteTable as r, SQLiteColumn as s, uniqueIndex as t, and as u, isNotNull as v, not as w, lt as x, isNull as y, Param as z };
1313
+ export { ViewBaseConfig as A, isDriverValueEncoder as C, Table as D, Columns as E, is as F, WithSubquery as M, Column as N, getTableName as O, entityKind as P, fillPlaceholders as S, sql as T, Param as _, text as a, StringChunk as b, SQLiteColumn as c, getTableLikeName as d, haveSameKeys as f, orderSelectedFields as g, mapUpdateSet as h, sqliteTable as i, Subquery as j, getTableUniqueName as k, applyMixins as l, mapResultRow as m, uniqueIndex as n, real as o, isConfig as p, SQLiteTable as r, integer as s, index as t, getTableColumns as u, Placeholder as v, isSQLWrapper as w, View as x, SQL as y };
@@ -1,4 +1,5 @@
1
- import { $ as is, A as or, B as SQL, C as ne, D as notIlike, E as notExists, G as Table, J as ViewBaseConfig, K as getTableName, L as mapUpdateSet, M as getTableColumns, N as getTableLikeName, O as notInArray, P as haveSameKeys, Q as entityKind, R as orderSelectedFields, S as lte, T as notBetween, U as sql, V as View, W as Columns, X as WithSubquery, Y as Subquery, Z as Column, _ as inArray, b as like, c as asc, d as between, f as eq, g as ilike, h as gte, j as applyMixins, k as notLike, l as desc, m as gt, n as SQLiteTable, p as exists, q as getTableUniqueName, s as SQLiteColumn, u as and, v as isNotNull, w as not, x as lt, y as isNull, z as Param } from "./indexes-VMR6QVVl.js";
1
+ import { A as ViewBaseConfig, D as Table, E as Columns, F as is, M as WithSubquery, N as Column, O as getTableName, P as entityKind, T as sql, _ as Param, c as SQLiteColumn, d as getTableLikeName, f as haveSameKeys, g as orderSelectedFields, h as mapUpdateSet, j as Subquery, k as getTableUniqueName, l as applyMixins, r as SQLiteTable, u as getTableColumns, x as View, y as SQL } from "./indexes-vPbUiKXP.js";
2
+ import { C as or, S as notLike, _ as not, a as eq, b as notIlike, c as gte, d as isNotNull, f as isNull, g as ne, h as lte, i as between, l as ilike, m as lt, n as desc, o as exists, p as like, r as and, s as gt, t as asc, u as inArray, v as notBetween, x as notInArray, y as notExists } from "./select-62doObBa.js";
2
3
  //#region node_modules/drizzle-orm/alias.js
3
4
  var ColumnAliasProxyHandler = class {
4
5
  constructor(table) {
@@ -57,6 +58,223 @@ function mapColumnsInSQLToAlias(query, alias) {
57
58
  }));
58
59
  }
59
60
  //#endregion
61
+ //#region node_modules/drizzle-orm/selection-proxy.js
62
+ var SelectionProxyHandler = class SelectionProxyHandler {
63
+ static [entityKind] = "SelectionProxyHandler";
64
+ config;
65
+ constructor(config) {
66
+ this.config = { ...config };
67
+ }
68
+ get(subquery, prop) {
69
+ if (prop === "_") return {
70
+ ...subquery["_"],
71
+ selectedFields: new Proxy(subquery._.selectedFields, this)
72
+ };
73
+ if (prop === ViewBaseConfig) return {
74
+ ...subquery[ViewBaseConfig],
75
+ selectedFields: new Proxy(subquery[ViewBaseConfig].selectedFields, this)
76
+ };
77
+ if (typeof prop === "symbol") return subquery[prop];
78
+ const value = (is(subquery, Subquery) ? subquery._.selectedFields : is(subquery, View) ? subquery[ViewBaseConfig].selectedFields : subquery)[prop];
79
+ if (is(value, SQL.Aliased)) {
80
+ if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) return value.sql;
81
+ const newValue = value.clone();
82
+ newValue.isSelectionField = true;
83
+ return newValue;
84
+ }
85
+ if (is(value, SQL)) {
86
+ if (this.config.sqlBehavior === "sql") return value;
87
+ throw new Error(`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`);
88
+ }
89
+ if (is(value, Column)) {
90
+ if (this.config.alias) return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(value.table, new TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false))));
91
+ return value;
92
+ }
93
+ if (typeof value !== "object" || value === null) return value;
94
+ return new Proxy(value, new SelectionProxyHandler(this.config));
95
+ }
96
+ };
97
+ //#endregion
98
+ //#region node_modules/drizzle-orm/query-promise.js
99
+ var QueryPromise = class {
100
+ static [entityKind] = "QueryPromise";
101
+ [Symbol.toStringTag] = "QueryPromise";
102
+ catch(onRejected) {
103
+ return this.then(void 0, onRejected);
104
+ }
105
+ finally(onFinally) {
106
+ return this.then((value) => {
107
+ onFinally?.();
108
+ return value;
109
+ }, (reason) => {
110
+ onFinally?.();
111
+ throw reason;
112
+ });
113
+ }
114
+ then(onFulfilled, onRejected) {
115
+ return this.execute().then(onFulfilled, onRejected);
116
+ }
117
+ };
118
+ //#endregion
119
+ //#region node_modules/drizzle-orm/sqlite-core/utils.js
120
+ function extractUsedTable(table) {
121
+ if (is(table, SQLiteTable)) return [`${table[Table.Symbol.BaseName]}`];
122
+ if (is(table, Subquery)) return table._.usedTables ?? [];
123
+ if (is(table, SQL)) return table.usedTables ?? [];
124
+ return [];
125
+ }
126
+ //#endregion
127
+ //#region node_modules/drizzle-orm/sqlite-core/query-builders/delete.js
128
+ var SQLiteDeleteBase = class extends QueryPromise {
129
+ constructor(table, session, dialect, withList) {
130
+ super();
131
+ this.table = table;
132
+ this.session = session;
133
+ this.dialect = dialect;
134
+ this.config = {
135
+ table,
136
+ withList
137
+ };
138
+ }
139
+ static [entityKind] = "SQLiteDelete";
140
+ /** @internal */
141
+ config;
142
+ /**
143
+ * Adds a `where` clause to the query.
144
+ *
145
+ * Calling this method will delete only those rows that fulfill a specified condition.
146
+ *
147
+ * See docs: {@link https://orm.drizzle.team/docs/delete}
148
+ *
149
+ * @param where the `where` clause.
150
+ *
151
+ * @example
152
+ * You can use conditional operators and `sql function` to filter the rows to be deleted.
153
+ *
154
+ * ```ts
155
+ * // Delete all cars with green color
156
+ * db.delete(cars).where(eq(cars.color, 'green'));
157
+ * // or
158
+ * db.delete(cars).where(sql`${cars.color} = 'green'`)
159
+ * ```
160
+ *
161
+ * You can logically combine conditional operators with `and()` and `or()` operators:
162
+ *
163
+ * ```ts
164
+ * // Delete all BMW cars with a green color
165
+ * db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
166
+ *
167
+ * // Delete all cars with the green or blue color
168
+ * db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
169
+ * ```
170
+ */
171
+ where(where) {
172
+ this.config.where = where;
173
+ return this;
174
+ }
175
+ orderBy(...columns) {
176
+ if (typeof columns[0] === "function") {
177
+ const orderBy = columns[0](new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
178
+ sqlAliasedBehavior: "alias",
179
+ sqlBehavior: "sql"
180
+ })));
181
+ const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
182
+ this.config.orderBy = orderByArray;
183
+ } else {
184
+ const orderByArray = columns;
185
+ this.config.orderBy = orderByArray;
186
+ }
187
+ return this;
188
+ }
189
+ limit(limit) {
190
+ this.config.limit = limit;
191
+ return this;
192
+ }
193
+ returning(fields = this.table[SQLiteTable.Symbol.Columns]) {
194
+ this.config.returning = orderSelectedFields(fields);
195
+ return this;
196
+ }
197
+ /** @internal */
198
+ getSQL() {
199
+ return this.dialect.buildDeleteQuery(this.config);
200
+ }
201
+ toSQL() {
202
+ const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
203
+ return rest;
204
+ }
205
+ /** @internal */
206
+ _prepare(isOneTimeQuery = true) {
207
+ return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), this.config.returning, this.config.returning ? "all" : "run", true, void 0, {
208
+ type: "delete",
209
+ tables: extractUsedTable(this.config.table)
210
+ });
211
+ }
212
+ prepare() {
213
+ return this._prepare(false);
214
+ }
215
+ run = (placeholderValues) => {
216
+ return this._prepare().run(placeholderValues);
217
+ };
218
+ all = (placeholderValues) => {
219
+ return this._prepare().all(placeholderValues);
220
+ };
221
+ get = (placeholderValues) => {
222
+ return this._prepare().get(placeholderValues);
223
+ };
224
+ values = (placeholderValues) => {
225
+ return this._prepare().values(placeholderValues);
226
+ };
227
+ async execute(placeholderValues) {
228
+ return this._prepare().execute(placeholderValues);
229
+ }
230
+ $dynamic() {
231
+ return this;
232
+ }
233
+ };
234
+ //#endregion
235
+ //#region node_modules/drizzle-orm/casing.js
236
+ function toSnakeCase(input) {
237
+ return (input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? []).map((word) => word.toLowerCase()).join("_");
238
+ }
239
+ function toCamelCase(input) {
240
+ return (input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? []).reduce((acc, word, i) => {
241
+ return acc + (i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`);
242
+ }, "");
243
+ }
244
+ function noopCase(input) {
245
+ return input;
246
+ }
247
+ var CasingCache = class {
248
+ static [entityKind] = "CasingCache";
249
+ /** @internal */
250
+ cache = {};
251
+ cachedTables = {};
252
+ convert;
253
+ constructor(casing) {
254
+ this.convert = casing === "snake_case" ? toSnakeCase : casing === "camelCase" ? toCamelCase : noopCase;
255
+ }
256
+ getColumnCasing(column) {
257
+ if (!column.keyAsName) return column.name;
258
+ const key = `${column.table[Table.Symbol.Schema] ?? "public"}.${column.table[Table.Symbol.OriginalName]}.${column.name}`;
259
+ if (!this.cache[key]) this.cacheTable(column.table);
260
+ return this.cache[key];
261
+ }
262
+ cacheTable(table) {
263
+ const tableKey = `${table[Table.Symbol.Schema] ?? "public"}.${table[Table.Symbol.OriginalName]}`;
264
+ if (!this.cachedTables[tableKey]) {
265
+ for (const column of Object.values(table[Table.Symbol.Columns])) {
266
+ const columnKey = `${tableKey}.${column.name}`;
267
+ this.cache[columnKey] = this.convert(column.name);
268
+ }
269
+ this.cachedTables[tableKey] = true;
270
+ }
271
+ }
272
+ clearCache() {
273
+ this.cache = {};
274
+ this.cachedTables = {};
275
+ }
276
+ };
277
+ //#endregion
60
278
  //#region node_modules/drizzle-orm/errors.js
61
279
  var DrizzleError = class extends Error {
62
280
  static [entityKind] = "DrizzleError";
@@ -84,57 +302,6 @@ var TransactionRollbackError = class extends DrizzleError {
84
302
  }
85
303
  };
86
304
  //#endregion
87
- //#region node_modules/drizzle-orm/logger.js
88
- var ConsoleLogWriter = class {
89
- static [entityKind] = "ConsoleLogWriter";
90
- write(message) {
91
- console.log(message);
92
- }
93
- };
94
- var DefaultLogger = class {
95
- static [entityKind] = "DefaultLogger";
96
- writer;
97
- constructor(config) {
98
- this.writer = config?.writer ?? new ConsoleLogWriter();
99
- }
100
- logQuery(query, params) {
101
- const stringifiedParams = params.map((p) => {
102
- try {
103
- return JSON.stringify(p);
104
- } catch {
105
- return String(p);
106
- }
107
- });
108
- const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(", ")}]` : "";
109
- this.writer.write(`Query: ${query}${paramsStr}`);
110
- }
111
- };
112
- var NoopLogger = class {
113
- static [entityKind] = "NoopLogger";
114
- logQuery() {}
115
- };
116
- //#endregion
117
- //#region node_modules/drizzle-orm/query-promise.js
118
- var QueryPromise = class {
119
- static [entityKind] = "QueryPromise";
120
- [Symbol.toStringTag] = "QueryPromise";
121
- catch(onRejected) {
122
- return this.then(void 0, onRejected);
123
- }
124
- finally(onFinally) {
125
- return this.then((value) => {
126
- onFinally?.();
127
- return value;
128
- }, (reason) => {
129
- onFinally?.();
130
- throw reason;
131
- });
132
- }
133
- then(onFulfilled, onRejected) {
134
- return this.execute().then(onFulfilled, onRejected);
135
- }
136
- };
137
- //#endregion
138
305
  //#region node_modules/drizzle-orm/pg-core/table.js
139
306
  const InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
140
307
  const EnableRLS = Symbol.for("drizzle:EnableRLS");
@@ -361,202 +528,6 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
361
528
  return result;
362
529
  }
363
530
  //#endregion
364
- //#region node_modules/drizzle-orm/selection-proxy.js
365
- var SelectionProxyHandler = class SelectionProxyHandler {
366
- static [entityKind] = "SelectionProxyHandler";
367
- config;
368
- constructor(config) {
369
- this.config = { ...config };
370
- }
371
- get(subquery, prop) {
372
- if (prop === "_") return {
373
- ...subquery["_"],
374
- selectedFields: new Proxy(subquery._.selectedFields, this)
375
- };
376
- if (prop === ViewBaseConfig) return {
377
- ...subquery[ViewBaseConfig],
378
- selectedFields: new Proxy(subquery[ViewBaseConfig].selectedFields, this)
379
- };
380
- if (typeof prop === "symbol") return subquery[prop];
381
- const value = (is(subquery, Subquery) ? subquery._.selectedFields : is(subquery, View) ? subquery[ViewBaseConfig].selectedFields : subquery)[prop];
382
- if (is(value, SQL.Aliased)) {
383
- if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) return value.sql;
384
- const newValue = value.clone();
385
- newValue.isSelectionField = true;
386
- return newValue;
387
- }
388
- if (is(value, SQL)) {
389
- if (this.config.sqlBehavior === "sql") return value;
390
- throw new Error(`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`);
391
- }
392
- if (is(value, Column)) {
393
- if (this.config.alias) return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(value.table, new TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false))));
394
- return value;
395
- }
396
- if (typeof value !== "object" || value === null) return value;
397
- return new Proxy(value, new SelectionProxyHandler(this.config));
398
- }
399
- };
400
- //#endregion
401
- //#region node_modules/drizzle-orm/sqlite-core/utils.js
402
- function extractUsedTable(table) {
403
- if (is(table, SQLiteTable)) return [`${table[Table.Symbol.BaseName]}`];
404
- if (is(table, Subquery)) return table._.usedTables ?? [];
405
- if (is(table, SQL)) return table.usedTables ?? [];
406
- return [];
407
- }
408
- //#endregion
409
- //#region node_modules/drizzle-orm/sqlite-core/query-builders/delete.js
410
- var SQLiteDeleteBase = class extends QueryPromise {
411
- constructor(table, session, dialect, withList) {
412
- super();
413
- this.table = table;
414
- this.session = session;
415
- this.dialect = dialect;
416
- this.config = {
417
- table,
418
- withList
419
- };
420
- }
421
- static [entityKind] = "SQLiteDelete";
422
- /** @internal */
423
- config;
424
- /**
425
- * Adds a `where` clause to the query.
426
- *
427
- * Calling this method will delete only those rows that fulfill a specified condition.
428
- *
429
- * See docs: {@link https://orm.drizzle.team/docs/delete}
430
- *
431
- * @param where the `where` clause.
432
- *
433
- * @example
434
- * You can use conditional operators and `sql function` to filter the rows to be deleted.
435
- *
436
- * ```ts
437
- * // Delete all cars with green color
438
- * db.delete(cars).where(eq(cars.color, 'green'));
439
- * // or
440
- * db.delete(cars).where(sql`${cars.color} = 'green'`)
441
- * ```
442
- *
443
- * You can logically combine conditional operators with `and()` and `or()` operators:
444
- *
445
- * ```ts
446
- * // Delete all BMW cars with a green color
447
- * db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
448
- *
449
- * // Delete all cars with the green or blue color
450
- * db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
451
- * ```
452
- */
453
- where(where) {
454
- this.config.where = where;
455
- return this;
456
- }
457
- orderBy(...columns) {
458
- if (typeof columns[0] === "function") {
459
- const orderBy = columns[0](new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
460
- sqlAliasedBehavior: "alias",
461
- sqlBehavior: "sql"
462
- })));
463
- const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
464
- this.config.orderBy = orderByArray;
465
- } else {
466
- const orderByArray = columns;
467
- this.config.orderBy = orderByArray;
468
- }
469
- return this;
470
- }
471
- limit(limit) {
472
- this.config.limit = limit;
473
- return this;
474
- }
475
- returning(fields = this.table[SQLiteTable.Symbol.Columns]) {
476
- this.config.returning = orderSelectedFields(fields);
477
- return this;
478
- }
479
- /** @internal */
480
- getSQL() {
481
- return this.dialect.buildDeleteQuery(this.config);
482
- }
483
- toSQL() {
484
- const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
485
- return rest;
486
- }
487
- /** @internal */
488
- _prepare(isOneTimeQuery = true) {
489
- return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), this.config.returning, this.config.returning ? "all" : "run", true, void 0, {
490
- type: "delete",
491
- tables: extractUsedTable(this.config.table)
492
- });
493
- }
494
- prepare() {
495
- return this._prepare(false);
496
- }
497
- run = (placeholderValues) => {
498
- return this._prepare().run(placeholderValues);
499
- };
500
- all = (placeholderValues) => {
501
- return this._prepare().all(placeholderValues);
502
- };
503
- get = (placeholderValues) => {
504
- return this._prepare().get(placeholderValues);
505
- };
506
- values = (placeholderValues) => {
507
- return this._prepare().values(placeholderValues);
508
- };
509
- async execute(placeholderValues) {
510
- return this._prepare().execute(placeholderValues);
511
- }
512
- $dynamic() {
513
- return this;
514
- }
515
- };
516
- //#endregion
517
- //#region node_modules/drizzle-orm/casing.js
518
- function toSnakeCase(input) {
519
- return (input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? []).map((word) => word.toLowerCase()).join("_");
520
- }
521
- function toCamelCase(input) {
522
- return (input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? []).reduce((acc, word, i) => {
523
- return acc + (i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`);
524
- }, "");
525
- }
526
- function noopCase(input) {
527
- return input;
528
- }
529
- var CasingCache = class {
530
- static [entityKind] = "CasingCache";
531
- /** @internal */
532
- cache = {};
533
- cachedTables = {};
534
- convert;
535
- constructor(casing) {
536
- this.convert = casing === "snake_case" ? toSnakeCase : casing === "camelCase" ? toCamelCase : noopCase;
537
- }
538
- getColumnCasing(column) {
539
- if (!column.keyAsName) return column.name;
540
- const key = `${column.table[Table.Symbol.Schema] ?? "public"}.${column.table[Table.Symbol.OriginalName]}.${column.name}`;
541
- if (!this.cache[key]) this.cacheTable(column.table);
542
- return this.cache[key];
543
- }
544
- cacheTable(table) {
545
- const tableKey = `${table[Table.Symbol.Schema] ?? "public"}.${table[Table.Symbol.OriginalName]}`;
546
- if (!this.cachedTables[tableKey]) {
547
- for (const column of Object.values(table[Table.Symbol.Columns])) {
548
- const columnKey = `${tableKey}.${column.name}`;
549
- this.cache[columnKey] = this.convert(column.name);
550
- }
551
- this.cachedTables[tableKey] = true;
552
- }
553
- }
554
- clearCache() {
555
- this.cache = {};
556
- this.cachedTables = {};
557
- }
558
- };
559
- //#endregion
560
531
  //#region node_modules/drizzle-orm/sqlite-core/view-base.js
561
532
  var SQLiteViewBase = class extends View {
562
533
  static [entityKind] = "SQLiteViewBase";
@@ -2580,4 +2551,34 @@ var SQLiteTransaction = class extends BaseSQLiteDatabase {
2580
2551
  }
2581
2552
  };
2582
2553
  //#endregion
2583
- export { BaseSQLiteDatabase as a, extractTablesRelationalConfig as c, NoopCache as i, DefaultLogger as l, SQLiteSession as n, SQLiteSyncDialect as o, SQLiteTransaction as r, createTableRelationsHelpers as s, SQLitePreparedQuery as t, NoopLogger as u };
2554
+ //#region node_modules/drizzle-orm/logger.js
2555
+ var ConsoleLogWriter = class {
2556
+ static [entityKind] = "ConsoleLogWriter";
2557
+ write(message) {
2558
+ console.log(message);
2559
+ }
2560
+ };
2561
+ var DefaultLogger = class {
2562
+ static [entityKind] = "DefaultLogger";
2563
+ writer;
2564
+ constructor(config) {
2565
+ this.writer = config?.writer ?? new ConsoleLogWriter();
2566
+ }
2567
+ logQuery(query, params) {
2568
+ const stringifiedParams = params.map((p) => {
2569
+ try {
2570
+ return JSON.stringify(p);
2571
+ } catch {
2572
+ return String(p);
2573
+ }
2574
+ });
2575
+ const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(", ")}]` : "";
2576
+ this.writer.write(`Query: ${query}${paramsStr}`);
2577
+ }
2578
+ };
2579
+ var NoopLogger = class {
2580
+ static [entityKind] = "NoopLogger";
2581
+ logQuery() {}
2582
+ };
2583
+ //#endregion
2584
+ export { SQLiteTransaction as a, SQLiteSyncDialect as c, SQLiteSession as i, createTableRelationsHelpers as l, NoopLogger as n, NoopCache as o, SQLitePreparedQuery as r, BaseSQLiteDatabase as s, DefaultLogger as t, extractTablesRelationalConfig as u };
@@ -1,4 +1,4 @@
1
- import { t as readMigrationFiles } from "./migrator-CAdL3H58.js";
1
+ import { t as readMigrationFiles } from "./migrator-8uumkKvi.js";
2
2
  //#region node_modules/drizzle-orm/better-sqlite3/migrator.js
3
3
  function migrate(db, config) {
4
4
  const migrations = readMigrationFiles(config);
@@ -1,4 +1,4 @@
1
- import { t as readMigrationFiles } from "./migrator-CAdL3H58.js";
1
+ import { t as readMigrationFiles } from "./migrator-8uumkKvi.js";
2
2
  //#region node_modules/drizzle-orm/bun-sqlite/migrator.js
3
3
  function migrate(db, config) {
4
4
  const migrations = readMigrationFiles(config);