@delta-comic/db 0.0.3 → 0.0.6
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/index.js +112 -118
- package/dist/index.js.map +1 -1
- package/dist/pack.tgz +0 -0
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var C = Object.defineProperty, w = (e, t) => {
|
|
|
10
10
|
});
|
|
11
11
|
return t || C(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
12
|
};
|
|
13
|
-
async function
|
|
13
|
+
async function ee(e) {
|
|
14
14
|
await e.schema.createTable("itemStore").addColumn("key", "text", (e) => e.primaryKey().notNull()).addColumn("item", "text", (e) => e.notNull()).execute(), await e.schema.createIndex("item_store_key").on("itemStore").column("key").execute(), await e.schema.createTable("history").addColumn("ep", "text", (e) => e.notNull()).addColumn("timestamp", "datetime", (e) => e.notNull().primaryKey()).addColumn("itemKey", "text", (e) => e.notNull().unique()).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).execute(), await e.schema.createIndex("history_timestamp").on("history").column("timestamp desc").execute(), await e.schema.createTable("recentView").addColumn("timestamp", "datetime", (e) => e.notNull().primaryKey()).addColumn("itemKey", "text", (e) => e.notNull().unique()).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).addColumn("isViewed", "boolean", (e) => e.notNull()).execute(), await e.schema.createIndex("recent_timestamp").on("recentView").column("timestamp desc").execute(), await e.schema.createTable("favouriteCard").addColumn("createAt", "datetime", (e) => e.notNull().primaryKey()).addColumn("title", "text", (e) => e.notNull()).addColumn("private", "boolean", (e) => e.notNull()).addColumn("description", "text", (e) => e.notNull()).execute(), await e.insertInto("favouriteCard").values({
|
|
15
15
|
createAt: 0,
|
|
16
16
|
title: "默认收藏夹",
|
|
@@ -22,24 +22,24 @@ async function T(e) {
|
|
|
22
22
|
"itemKey"
|
|
23
23
|
]).addUniqueConstraint("uniqueKey", ["belongTo", "itemKey"]).addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["createAt"], (e) => e.onDelete("cascade")).addForeignKeyConstraint("belongToForeign", ["belongTo"], "favouriteCard", ["key"], (e) => e.onDelete("cascade")).execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute(), await e.schema.createTable("subscribe").addColumn("itemKey", "text").addForeignKeyConstraint("itemKeyForeign", ["itemKey"], "itemStore", ["key"], (e) => e.onDelete("cascade")).addColumn("author", "text").addColumn("type", "text", (e) => e.notNull()).addColumn("key", "text", (e) => e.notNull()).addColumn("plugin", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", ["plugin", "key"]).execute(), await e.schema.createIndex("subscribe_key_plugin").on("subscribe").column("key").column("plugin").execute(), await e.schema.createTable("plugin").addColumn("installerName", "text", (e) => e.notNull()).addColumn("loaderName", "text", (e) => e.notNull()).addColumn("pluginName", "text", (e) => e.notNull().primaryKey()).addColumn("meta", "json", (e) => e.notNull()).addColumn("enable", "text", (e) => e.notNull()).addColumn("installInput", "text", (e) => e.notNull()).execute(), await e.schema.createIndex("plugin_enable").on("plugin").column("enable").execute(), await e.schema.createIndex("plugin_pluginName").on("plugin").column("pluginName").execute();
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
25
|
+
async function te(e) {
|
|
26
26
|
await e.schema.dropTable("itemStore").ifExists().execute(), await e.schema.dropTable("history").ifExists().execute(), await e.schema.dropTable("recentView").ifExists().execute(), await e.schema.dropTable("favouriteCard").ifExists().execute(), await e.schema.dropTable("favouriteItem").ifExists().execute(), await e.schema.dropTable("subscribe").ifExists().execute(), await e.schema.dropTable("plugin").ifExists().execute();
|
|
27
27
|
}
|
|
28
|
-
var
|
|
29
|
-
up:
|
|
30
|
-
down:
|
|
28
|
+
var ne = {
|
|
29
|
+
up: ee,
|
|
30
|
+
down: te
|
|
31
31
|
};
|
|
32
|
-
async function
|
|
32
|
+
async function re(e) {
|
|
33
33
|
await e.schema.alterTable("plugin").addColumn("displayName", "text").execute();
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
35
|
+
async function ie(e) {
|
|
36
36
|
await e.schema.alterTable("plugin").dropColumn("displayName").execute();
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
up:
|
|
40
|
-
down:
|
|
38
|
+
var ae = {
|
|
39
|
+
up: re,
|
|
40
|
+
down: ie
|
|
41
41
|
};
|
|
42
|
-
async function
|
|
42
|
+
async function oe(e) {
|
|
43
43
|
await e.schema.alterTable("favouriteItem").renameTo("favouriteItem_old").execute(), await e.schema.createTable("favouriteItem").addColumn("addTime", "datetime", (e) => e.notNull()).addColumn("belongTo", "integer", (e) => e.notNull()).addColumn("itemKey", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", [
|
|
44
44
|
"addTime",
|
|
45
45
|
"belongTo",
|
|
@@ -54,7 +54,7 @@ async function ae(e) {
|
|
|
54
54
|
"itemKey"
|
|
55
55
|
])).execute(), await e.schema.dropTable("favouriteItem_old").execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute();
|
|
56
56
|
}
|
|
57
|
-
async function
|
|
57
|
+
async function T(e) {
|
|
58
58
|
await e.schema.alterTable("favouriteItem").renameTo("favouriteItem_new").execute(), await e.schema.createTable("favouriteItem").addColumn("addTime", "datetime", (e) => e.notNull()).addColumn("belongTo", "integer", (e) => e.notNull()).addColumn("itemKey", "text", (e) => e.notNull()).addPrimaryKeyConstraint("primary_key", [
|
|
59
59
|
"addTime",
|
|
60
60
|
"belongTo",
|
|
@@ -70,8 +70,8 @@ async function oe(e) {
|
|
|
70
70
|
])).execute(), await e.schema.dropTable("favouriteItem_new").execute(), await e.schema.createIndex("favourite_item_belongTo_addTime").on("favouriteItem").column("addTime desc").column("belongTo").execute();
|
|
71
71
|
}
|
|
72
72
|
var se = {
|
|
73
|
-
up:
|
|
74
|
-
down:
|
|
73
|
+
up: oe,
|
|
74
|
+
down: T
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
77
77
|
* Sends a message to the backend.
|
|
@@ -244,13 +244,7 @@ function O(e, t, { signal: n, edges: r } = {}) {
|
|
|
244
244
|
};
|
|
245
245
|
return h.schedule = d, h.cancel = p, h.flush = m, n?.addEventListener("abort", p, { once: !0 }), h;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
return typeof e == "string";
|
|
249
|
-
}
|
|
250
|
-
function le(e) {
|
|
251
|
-
return e === void 0;
|
|
252
|
-
}
|
|
253
|
-
var ue = class {
|
|
247
|
+
var ce = class {
|
|
254
248
|
/**
|
|
255
249
|
* Base class that implements {@link Dialect}
|
|
256
250
|
* @param create function that create {@link Driver}
|
|
@@ -268,7 +262,7 @@ var ue = class {
|
|
|
268
262
|
createIntrospector(e) {
|
|
269
263
|
return new a(e);
|
|
270
264
|
}
|
|
271
|
-
},
|
|
265
|
+
}, le = class {
|
|
272
266
|
promise;
|
|
273
267
|
resolve;
|
|
274
268
|
async lock() {
|
|
@@ -285,8 +279,8 @@ var ue = class {
|
|
|
285
279
|
async function k(e, n, i, a, o) {
|
|
286
280
|
await i.executeQuery(o(r.createWithChildren([r.createWithSql(`${e} `), t.create(a)]), n()));
|
|
287
281
|
}
|
|
288
|
-
var
|
|
289
|
-
mutex = new
|
|
282
|
+
var ue = class {
|
|
283
|
+
mutex = new le();
|
|
290
284
|
conn;
|
|
291
285
|
savepoint;
|
|
292
286
|
releaseSavepoint;
|
|
@@ -318,7 +312,7 @@ var fe = class {
|
|
|
318
312
|
this.mutex.unlock();
|
|
319
313
|
}
|
|
320
314
|
};
|
|
321
|
-
function
|
|
315
|
+
function de(e) {
|
|
322
316
|
return async (t, n, r) => {
|
|
323
317
|
let i = await e.all(n, r);
|
|
324
318
|
return t || i.length ? { rows: i } : {
|
|
@@ -330,17 +324,17 @@ function pe(e) {
|
|
|
330
324
|
function A(e) {
|
|
331
325
|
return e == null ? void 0 : BigInt(e);
|
|
332
326
|
}
|
|
333
|
-
var
|
|
327
|
+
var fe = class extends ue {
|
|
334
328
|
db;
|
|
335
329
|
constructor(e, t) {
|
|
336
330
|
super(async () => {
|
|
337
|
-
this.db = await e(), this.conn = new
|
|
331
|
+
this.db = await e(), this.conn = new pe(this.db), await t?.(this.conn);
|
|
338
332
|
});
|
|
339
333
|
}
|
|
340
334
|
async destroy() {
|
|
341
335
|
await this.db?.close();
|
|
342
336
|
}
|
|
343
|
-
},
|
|
337
|
+
}, pe = class {
|
|
344
338
|
constructor(e) {
|
|
345
339
|
this.db = e;
|
|
346
340
|
}
|
|
@@ -352,7 +346,7 @@ var me = class extends fe {
|
|
|
352
346
|
async executeQuery({ parameters: t, query: n, sql: r }) {
|
|
353
347
|
return await this.db.query(e.is(n), r, t);
|
|
354
348
|
}
|
|
355
|
-
},
|
|
349
|
+
}, me = class extends ce {
|
|
356
350
|
/**
|
|
357
351
|
* Dialect for generic SQLite that run SQLs in current thread
|
|
358
352
|
*
|
|
@@ -360,9 +354,9 @@ var me = class extends fe {
|
|
|
360
354
|
* @param onCreateConnection optional callback after connection created
|
|
361
355
|
*/
|
|
362
356
|
constructor(e, t) {
|
|
363
|
-
super(() => new
|
|
357
|
+
super(() => new fe(e, t));
|
|
364
358
|
}
|
|
365
|
-
}, j = class extends
|
|
359
|
+
}, j = class extends me {
|
|
366
360
|
/**
|
|
367
361
|
* SQLite dialect for Tauri, using [official sql plugin](https://github.com/tauri-apps/plugins-workspace/tree/dev/plugins/sql)
|
|
368
362
|
*/
|
|
@@ -372,7 +366,7 @@ var me = class extends fe {
|
|
|
372
366
|
let e = typeof t == "function" ? await t("sqlite:") : t;
|
|
373
367
|
return {
|
|
374
368
|
db: e,
|
|
375
|
-
query:
|
|
369
|
+
query: de({
|
|
376
370
|
all: async (t, n) => await e.select(t, n),
|
|
377
371
|
run: async (t, n) => {
|
|
378
372
|
let { rowsAffected: r, lastInsertId: i } = await e.execute(t, n);
|
|
@@ -386,7 +380,7 @@ var me = class extends fe {
|
|
|
386
380
|
};
|
|
387
381
|
}, n);
|
|
388
382
|
}
|
|
389
|
-
},
|
|
383
|
+
}, he = class extends s {
|
|
390
384
|
serializer;
|
|
391
385
|
constructor(e) {
|
|
392
386
|
super(), this.serializer = e;
|
|
@@ -415,8 +409,8 @@ var me = class extends fe {
|
|
|
415
409
|
value: this.serializer(e.value)
|
|
416
410
|
};
|
|
417
411
|
}
|
|
418
|
-
},
|
|
419
|
-
if (
|
|
412
|
+
}, ge = (e) => {
|
|
413
|
+
if (M(e) || typeof e == "string") return e;
|
|
420
414
|
if (typeof e == "boolean") return "" + e;
|
|
421
415
|
if (e instanceof Date) return e.toISOString();
|
|
422
416
|
try {
|
|
@@ -424,25 +418,25 @@ var me = class extends fe {
|
|
|
424
418
|
} catch {
|
|
425
419
|
return e;
|
|
426
420
|
}
|
|
427
|
-
},
|
|
428
|
-
if (
|
|
421
|
+
}, _e = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/, ve = (e) => {
|
|
422
|
+
if (M(e)) return e;
|
|
429
423
|
if (typeof e == "string") {
|
|
430
424
|
if (e === "true") return !0;
|
|
431
425
|
if (e === "false") return !1;
|
|
432
|
-
if (
|
|
433
|
-
if (
|
|
426
|
+
if (_e.test(e)) return new Date(e);
|
|
427
|
+
if (ye(e)) try {
|
|
434
428
|
return JSON.parse(e);
|
|
435
429
|
} catch {}
|
|
436
430
|
return e;
|
|
437
431
|
}
|
|
438
432
|
};
|
|
439
|
-
function
|
|
433
|
+
function ye(e) {
|
|
440
434
|
return e.startsWith("{") && e.endsWith("}") || e.startsWith("[") && e.endsWith("]");
|
|
441
435
|
}
|
|
442
|
-
function
|
|
436
|
+
function M(e) {
|
|
443
437
|
return e == null || typeof e == "bigint" || typeof e == "number" || typeof e == "object" && "buffer" in e;
|
|
444
438
|
}
|
|
445
|
-
var
|
|
439
|
+
var N = class {
|
|
446
440
|
transformer;
|
|
447
441
|
deserializer;
|
|
448
442
|
skipNodeSet;
|
|
@@ -451,7 +445,7 @@ var xe = class {
|
|
|
451
445
|
* Base class for {@link SerializePlugin}, without default options
|
|
452
446
|
*/
|
|
453
447
|
constructor(e, t, n) {
|
|
454
|
-
this.transformer = new
|
|
448
|
+
this.transformer = new he(e), this.deserializer = t, n.length && (this.skipNodeSet = new Set(n), this.ctx = /* @__PURE__ */ new WeakSet());
|
|
455
449
|
}
|
|
456
450
|
transformQuery({ node: e, queryId: t }) {
|
|
457
451
|
return this.skipNodeSet?.has(e.kind) ? (this.ctx?.add(t), e) : this.transformer.transformNode(e);
|
|
@@ -472,7 +466,7 @@ var xe = class {
|
|
|
472
466
|
}
|
|
473
467
|
return t;
|
|
474
468
|
}
|
|
475
|
-
}, P = class extends
|
|
469
|
+
}, P = class extends N {
|
|
476
470
|
/**
|
|
477
471
|
* _**THIS PLUGIN SHOULD BE PLACED AT THE END OF PLUGINS ARRAY !!!**_
|
|
478
472
|
*
|
|
@@ -535,7 +529,7 @@ var xe = class {
|
|
|
535
529
|
* ```
|
|
536
530
|
*/
|
|
537
531
|
constructor(e = {}) {
|
|
538
|
-
let { deserializer: t =
|
|
532
|
+
let { deserializer: t = ve, serializer: n = ge, skipNodeKind: r = [] } = e;
|
|
539
533
|
super(n, t, r);
|
|
540
534
|
}
|
|
541
535
|
};
|
|
@@ -560,24 +554,24 @@ function F(e) {
|
|
|
560
554
|
}
|
|
561
555
|
};
|
|
562
556
|
}
|
|
563
|
-
var
|
|
564
|
-
get: () =>
|
|
565
|
-
getByEnabled: () =>
|
|
566
|
-
toggleEnable: () =>
|
|
557
|
+
var be = /* @__PURE__ */ w({
|
|
558
|
+
get: () => Se,
|
|
559
|
+
getByEnabled: () => xe,
|
|
560
|
+
toggleEnable: () => Ce
|
|
567
561
|
});
|
|
568
|
-
async function
|
|
562
|
+
async function xe(e) {
|
|
569
563
|
let { db: t } = await import("./index.js");
|
|
570
564
|
return t.value.selectFrom("plugin").where("enable", "=", e).selectAll().execute();
|
|
571
565
|
}
|
|
572
|
-
async function
|
|
566
|
+
async function Se(e) {
|
|
573
567
|
let { db: t } = await import("./index.js");
|
|
574
568
|
return t.value.selectFrom("plugin").where("pluginName", "=", e).selectAll().executeTakeFirstOrThrow();
|
|
575
569
|
}
|
|
576
|
-
async function
|
|
570
|
+
async function Ce(e) {
|
|
577
571
|
let { db: t } = await import("./index.js"), n = await t.value.selectFrom("plugin").where("pluginName", "=", e).select("enable").executeTakeFirstOrThrow();
|
|
578
572
|
return t.value.updateTable("plugin").where("pluginName", "=", e).set({ enable: !n.enable }).execute();
|
|
579
573
|
}
|
|
580
|
-
var
|
|
574
|
+
var we = /* @__PURE__ */ w({
|
|
581
575
|
key: () => I,
|
|
582
576
|
upsert: () => L
|
|
583
577
|
});
|
|
@@ -589,11 +583,11 @@ async function L(e) {
|
|
|
589
583
|
key: n
|
|
590
584
|
}).execute(), n;
|
|
591
585
|
}
|
|
592
|
-
var
|
|
593
|
-
moveItem: () =>
|
|
594
|
-
upsertItem: () =>
|
|
586
|
+
var Te = /* @__PURE__ */ w({
|
|
587
|
+
moveItem: () => De,
|
|
588
|
+
upsertItem: () => Ee
|
|
595
589
|
});
|
|
596
|
-
async function
|
|
590
|
+
async function Ee(e, ...t) {
|
|
597
591
|
let { db: n } = await import("./index.js"), r = await L(e);
|
|
598
592
|
for (let e of t) await n.value.replaceInto("favouriteItem").values({
|
|
599
593
|
addTime: Date.now(),
|
|
@@ -601,7 +595,7 @@ async function Oe(e, ...t) {
|
|
|
601
595
|
belongTo: e
|
|
602
596
|
}).execute();
|
|
603
597
|
}
|
|
604
|
-
async function
|
|
598
|
+
async function De(e, t, ...n) {
|
|
605
599
|
let { db: r } = await import("./index.js");
|
|
606
600
|
await r.value.deleteFrom("favouriteItem").where("itemKey", "=", e.id).where("belongTo", "=", t).execute();
|
|
607
601
|
for (let t of n) await r.value.replaceInto("favouriteItem").values({
|
|
@@ -610,8 +604,8 @@ async function ke(e, t, ...n) {
|
|
|
610
604
|
belongTo: t
|
|
611
605
|
}).execute();
|
|
612
606
|
}
|
|
613
|
-
var
|
|
614
|
-
async function
|
|
607
|
+
var Oe = /* @__PURE__ */ w({ upsert: () => ke });
|
|
608
|
+
async function ke(e) {
|
|
615
609
|
let { db: t } = await import("./index.js"), n = await L(e);
|
|
616
610
|
await t.value.replaceInto("history").values({
|
|
617
611
|
itemKey: n,
|
|
@@ -619,17 +613,17 @@ async function je(e) {
|
|
|
619
613
|
ep: x.toRaw(e)
|
|
620
614
|
}).execute();
|
|
621
615
|
}
|
|
622
|
-
var
|
|
623
|
-
getAll: () =>
|
|
624
|
-
key: () =>
|
|
625
|
-
upsert: () =>
|
|
616
|
+
var Ae = /* @__PURE__ */ w({
|
|
617
|
+
getAll: () => Me,
|
|
618
|
+
key: () => je,
|
|
619
|
+
upsert: () => Ne
|
|
626
620
|
});
|
|
627
|
-
const
|
|
628
|
-
async function
|
|
621
|
+
const je = new b();
|
|
622
|
+
async function Me() {
|
|
629
623
|
let { db: e } = await import("./index.js");
|
|
630
624
|
return e.value.selectFrom("subscribe").selectAll().execute();
|
|
631
625
|
}
|
|
632
|
-
async function
|
|
626
|
+
async function Ne(e) {
|
|
633
627
|
let { db: t } = await import("./index.js");
|
|
634
628
|
return t.value.replaceInto("subscribe").values({
|
|
635
629
|
type: e.type,
|
|
@@ -639,8 +633,8 @@ async function Fe(e) {
|
|
|
639
633
|
author: JSON.stringify(e.author)
|
|
640
634
|
}).execute();
|
|
641
635
|
}
|
|
642
|
-
var
|
|
643
|
-
async function
|
|
636
|
+
var Pe = /* @__PURE__ */ w({ upsert: () => Fe });
|
|
637
|
+
async function Fe(e) {
|
|
644
638
|
let { db: t } = await import("./index.js"), n = await L(e);
|
|
645
639
|
await t.value.replaceInto("recentView").values({
|
|
646
640
|
isViewed: !1,
|
|
@@ -648,22 +642,22 @@ async function Le(e) {
|
|
|
648
642
|
timestamp: Date.now()
|
|
649
643
|
}).execute();
|
|
650
644
|
}
|
|
651
|
-
async function
|
|
645
|
+
async function Ie(e) {
|
|
652
646
|
await e.schema.createTable("store").addColumn("item", "text", (e) => e.notNull()).addColumn("name", "text", (e) => e.notNull()).addColumn("namespace", "text", (e) => e.notNull()).addPrimaryKeyConstraint("key", ["name", "namespace"]).execute();
|
|
653
647
|
}
|
|
654
|
-
async function
|
|
648
|
+
async function Le(e) {
|
|
655
649
|
await e.schema.dropTable("store").ifExists().execute();
|
|
656
650
|
}
|
|
657
|
-
var
|
|
658
|
-
up:
|
|
659
|
-
down:
|
|
660
|
-
},
|
|
651
|
+
var Re = {
|
|
652
|
+
up: Ie,
|
|
653
|
+
down: Le
|
|
654
|
+
}, R = typeof window < "u" && typeof document < "u";
|
|
661
655
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
662
|
-
var
|
|
656
|
+
var ze = Object.prototype.toString, Be = (e) => ze.call(e) === "[object Object]";
|
|
663
657
|
/**
|
|
664
658
|
* @internal
|
|
665
659
|
*/
|
|
666
|
-
function
|
|
660
|
+
function Ve(e, t) {
|
|
667
661
|
function n(...n) {
|
|
668
662
|
return new Promise((r, i) => {
|
|
669
663
|
Promise.resolve(e(() => t.apply(this, n), {
|
|
@@ -675,65 +669,65 @@ function He(e, t) {
|
|
|
675
669
|
}
|
|
676
670
|
return n;
|
|
677
671
|
}
|
|
678
|
-
var
|
|
679
|
-
function
|
|
672
|
+
var He = (e) => e();
|
|
673
|
+
function z(e) {
|
|
680
674
|
return Array.isArray(e) ? e : [e];
|
|
681
675
|
}
|
|
682
|
-
function
|
|
683
|
-
let { eventFilter: r =
|
|
684
|
-
return y(e,
|
|
676
|
+
function Ue(e, t, n = {}) {
|
|
677
|
+
let { eventFilter: r = He, ...i } = n;
|
|
678
|
+
return y(e, Ve(r, t), i);
|
|
685
679
|
}
|
|
686
680
|
/**
|
|
687
681
|
* Shorthand for watching value with {immediate: true}
|
|
688
682
|
*
|
|
689
683
|
* @see https://vueuse.org/watchImmediate
|
|
690
684
|
*/
|
|
691
|
-
function
|
|
685
|
+
function We(e, t, n) {
|
|
692
686
|
return y(e, t, {
|
|
693
687
|
...n,
|
|
694
688
|
immediate: !0
|
|
695
689
|
});
|
|
696
690
|
}
|
|
697
|
-
var
|
|
698
|
-
|
|
691
|
+
var B = R ? window : void 0;
|
|
692
|
+
R && window.document, R && window.navigator, R && window.location;
|
|
699
693
|
/**
|
|
700
694
|
* Get the dom element of a ref of element or Vue component instance
|
|
701
695
|
*
|
|
702
696
|
* @param elRef
|
|
703
697
|
*/
|
|
704
|
-
function
|
|
698
|
+
function Ge(e) {
|
|
705
699
|
let t = g(e);
|
|
706
700
|
return t?.$el ?? t;
|
|
707
701
|
}
|
|
708
|
-
function
|
|
702
|
+
function Ke(...e) {
|
|
709
703
|
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = f(() => {
|
|
710
|
-
let t =
|
|
704
|
+
let t = z(g(e[0])).filter((e) => e != null);
|
|
711
705
|
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
712
706
|
});
|
|
713
|
-
return
|
|
714
|
-
n.value?.map((e) =>
|
|
715
|
-
|
|
716
|
-
|
|
707
|
+
return We(() => [
|
|
708
|
+
n.value?.map((e) => Ge(e)) ?? [B].filter((e) => e != null),
|
|
709
|
+
z(g(n.value ? e[1] : e[0])),
|
|
710
|
+
z(v(n.value ? e[2] : e[1])),
|
|
717
711
|
g(n.value ? e[3] : e[2])
|
|
718
712
|
], ([e, n, r, i], a, o) => {
|
|
719
713
|
if (!e?.length || !n?.length || !r?.length) return;
|
|
720
|
-
let s =
|
|
714
|
+
let s = Be(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
721
715
|
o(() => {
|
|
722
716
|
c.forEach((e) => e());
|
|
723
717
|
});
|
|
724
718
|
}, { flush: "post" });
|
|
725
719
|
}
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
return
|
|
720
|
+
var V = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, H = "__vueuse_ssr_handlers__", qe = /* @__PURE__ */ Je();
|
|
721
|
+
function Je() {
|
|
722
|
+
return H in V || (V[H] = V[H] || {}), V[H];
|
|
729
723
|
}
|
|
730
|
-
function
|
|
731
|
-
return
|
|
724
|
+
function Ye(e, t) {
|
|
725
|
+
return qe[e] || t;
|
|
732
726
|
}
|
|
733
|
-
function
|
|
727
|
+
function Xe(e) {
|
|
734
728
|
return e == null ? "any" : e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof Date ? "date" : typeof e == "boolean" ? "boolean" : typeof e == "string" ? "string" : typeof e == "object" ? "object" : Number.isNaN(e) ? "any" : "number";
|
|
735
729
|
}
|
|
736
|
-
var
|
|
730
|
+
var Ze = {
|
|
737
731
|
boolean: {
|
|
738
732
|
read: (e) => e === "true",
|
|
739
733
|
write: (e) => String(e)
|
|
@@ -776,12 +770,12 @@ var Qe = {
|
|
|
776
770
|
* @param storage
|
|
777
771
|
* @param options
|
|
778
772
|
*/
|
|
779
|
-
function
|
|
780
|
-
let { flush: i = "pre", deep: a = !0, listenToStorageChanges: o = !0, writeDefaults: s = !0, mergeDefaults: c = !1, shallow: l, window: u =
|
|
773
|
+
function U(e, t, n, r = {}) {
|
|
774
|
+
let { flush: i = "pre", deep: a = !0, listenToStorageChanges: o = !0, writeDefaults: s = !0, mergeDefaults: c = !1, shallow: l, window: u = B, eventFilter: d, onError: f = (e) => {
|
|
781
775
|
console.error(e);
|
|
782
|
-
}, onReady: h } = r, _ = g(t), v =
|
|
776
|
+
}, onReady: h } = r, _ = g(t), v = Xe(_), y = (l ? m : p)(g(t)), b = r.serializer ?? Ze[v];
|
|
783
777
|
if (!n) try {
|
|
784
|
-
n =
|
|
778
|
+
n = Ye("getDefaultStorageAsync", () => B?.localStorage)();
|
|
785
779
|
} catch (e) {
|
|
786
780
|
f(e);
|
|
787
781
|
}
|
|
@@ -805,7 +799,7 @@ function $e(e, t, n, r = {}) {
|
|
|
805
799
|
h?.(y.value), e(y);
|
|
806
800
|
});
|
|
807
801
|
});
|
|
808
|
-
return u && o &&
|
|
802
|
+
return u && o && Ke(u, "storage", (e) => Promise.resolve().then(() => x(e)), { passive: !0 }), n && Ue(y, async () => {
|
|
809
803
|
try {
|
|
810
804
|
y.value == null ? await n.removeItem(e) : await n.setItem(e, await b.write(y.value));
|
|
811
805
|
} catch (e) {
|
|
@@ -820,8 +814,8 @@ function $e(e, t, n, r = {}) {
|
|
|
820
814
|
catch: S.catch.bind(S)
|
|
821
815
|
}), y;
|
|
822
816
|
}
|
|
823
|
-
var
|
|
824
|
-
console.debug("[db sync] db changed"),
|
|
817
|
+
var Qe = /* @__PURE__ */ Object.assign({ "./migrations/1_initial.ts": Re }), W = d(await D.load("sqlite:native_store.db"), "core/store/raw"), $e = F(), G = /\b(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER)\b/i, K = O(() => {
|
|
818
|
+
console.debug("[db sync] db changed"), $e.emit("onChange"), _(q);
|
|
825
819
|
}, 300), q = d(await (async () => {
|
|
826
820
|
let e = m(new u({
|
|
827
821
|
dialect: new j({ database: {
|
|
@@ -845,34 +839,34 @@ var et = /* @__PURE__ */ Object.assign({ "./migrations/1_initial.ts": ze }), W =
|
|
|
845
839
|
return await new o({
|
|
846
840
|
db: e.value,
|
|
847
841
|
provider: { async getMigrations() {
|
|
848
|
-
return
|
|
842
|
+
return Qe;
|
|
849
843
|
} }
|
|
850
844
|
}).migrateToLatest(), e;
|
|
851
845
|
})(), "core/store/ins"), J = new b();
|
|
852
|
-
const
|
|
846
|
+
const et = (e, t, n) => U(J.toString([e, h(t).value]), n, {
|
|
853
847
|
async removeItem(e) {
|
|
854
848
|
let [t, n] = J.toJSON(e);
|
|
855
849
|
await q.value.deleteFrom("store").where("namespace", "=", t).where("name", "=", n).execute();
|
|
856
850
|
},
|
|
857
851
|
async getItem(e) {
|
|
858
852
|
let [t, n] = J.toJSON(e);
|
|
859
|
-
return await q.value.selectFrom("store").selectAll().where("namespace", "=", t).where("name", "=", n).executeTakeFirst()
|
|
853
|
+
return (await q.value.selectFrom("store").selectAll().where("namespace", "=", t).where("name", "=", n).executeTakeFirst())?.item ?? null;
|
|
860
854
|
},
|
|
861
855
|
async setItem(e, t) {
|
|
862
856
|
let [n, r] = J.toJSON(e);
|
|
863
857
|
await q.value.replaceInto("store").values({
|
|
864
858
|
namespace: n,
|
|
865
859
|
name: r,
|
|
866
|
-
item:
|
|
860
|
+
item: t
|
|
867
861
|
}).execute();
|
|
868
862
|
}
|
|
869
863
|
});
|
|
870
|
-
var
|
|
871
|
-
"./migrations/1_initial.ts":
|
|
872
|
-
"./migrations/2_fix-display_name.ts":
|
|
864
|
+
var tt = /* @__PURE__ */ Object.assign({
|
|
865
|
+
"./migrations/1_initial.ts": ne,
|
|
866
|
+
"./migrations/2_fix-display_name.ts": ae,
|
|
873
867
|
"./migrations/3_fix_fvi_foreign_key.ts": se
|
|
874
|
-
}), Y = d(await D.load("sqlite:app.db"), "core/db/raw"),
|
|
875
|
-
console.debug("[db sync] db changed"),
|
|
868
|
+
}), Y = d(await D.load("sqlite:app.db"), "core/db/raw"), nt = F(), X = /\b(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER)\b/i, Z = O(() => {
|
|
869
|
+
console.debug("[db sync] db changed"), nt.emit("onChange"), _(Q);
|
|
876
870
|
}, 300);
|
|
877
871
|
const Q = d(await (async () => {
|
|
878
872
|
let e = m(new u({
|
|
@@ -897,7 +891,7 @@ const Q = d(await (async () => {
|
|
|
897
891
|
return await new o({
|
|
898
892
|
db: e.value,
|
|
899
893
|
provider: { async getMigrations() {
|
|
900
|
-
return
|
|
894
|
+
return tt;
|
|
901
895
|
} }
|
|
902
896
|
}).migrateToLatest(), e;
|
|
903
897
|
})(), "core/db/ins");
|
|
@@ -908,6 +902,6 @@ let $;
|
|
|
908
902
|
}
|
|
909
903
|
e.countDb = t;
|
|
910
904
|
})($ ||= {});
|
|
911
|
-
export { $ as DBUtils,
|
|
905
|
+
export { $ as DBUtils, Te as FavouriteDB, Oe as HistoryDB, we as ItemStoreDB, be as PluginArchiveDB, Pe as RecentDB, Ae as SubscribeDB, Q as db, et as useNativeStore };
|
|
912
906
|
|
|
913
907
|
//# sourceMappingURL=index.js.map
|