@delta-comic/db 0.0.6 → 0.0.8
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/esm-BGcGAQ5-.js +2 -0
- package/dist/{esm-Di_XcAT-.js → esm-YHRn16YB.js} +13 -5429
- package/dist/{esm-Di_XcAT-.js.map → esm-YHRn16YB.js.map} +1 -1
- package/dist/index.js +264 -412
- package/dist/index.js.map +1 -1
- package/dist/lib/nativeStore/index.d.ts +1 -1
- package/dist/pack.tgz +0 -0
- package/package.json +5 -5
- package/dist/esm-CzppQRXP.js +0 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Pn as e, Wr as t, c as n, lr as r, n as i, r as a, s as o, sn as s, t as c, u as l, y as u } from "./esm-
|
|
1
|
+
import { Pn as e, Wr as t, c as n, lr as r, n as i, r as a, s as o, sn as s, t as c, u as l, y as u } from "./esm-YHRn16YB.js";
|
|
2
2
|
import { useGlobalVar as d } from "@delta-comic/utils";
|
|
3
|
-
import { computed as f,
|
|
4
|
-
import { SourcedValue as
|
|
5
|
-
var
|
|
3
|
+
import { computed as f, customRef as p, getCurrentInstance as m, nextTick as h, onMounted as g, readonly as _, ref as v, shallowRef as y, toRef as b, toValue as x, triggerRef as S, unref as C, watch as w } from "vue";
|
|
4
|
+
import { SourcedValue as T, Struct as E, uni as D } from "@delta-comic/model";
|
|
5
|
+
var O = Object.defineProperty, k = (e, t) => {
|
|
6
6
|
let n = {};
|
|
7
|
-
for (var r in e)
|
|
7
|
+
for (var r in e) O(n, r, {
|
|
8
8
|
get: e[r],
|
|
9
9
|
enumerable: !0
|
|
10
10
|
});
|
|
11
|
-
return t ||
|
|
11
|
+
return t || O(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
12
12
|
};
|
|
13
|
-
async function
|
|
13
|
+
async function A(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 ee(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 j(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 M = {
|
|
29
|
+
up: A,
|
|
30
|
+
down: j
|
|
31
31
|
};
|
|
32
|
-
async function
|
|
32
|
+
async function ee(e) {
|
|
33
33
|
await e.schema.alterTable("plugin").addColumn("displayName", "text").execute();
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
35
|
+
async function te(e) {
|
|
36
36
|
await e.schema.alterTable("plugin").dropColumn("displayName").execute();
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
up:
|
|
40
|
-
down:
|
|
38
|
+
var ne = {
|
|
39
|
+
up: ee,
|
|
40
|
+
down: te
|
|
41
41
|
};
|
|
42
|
-
async function
|
|
42
|
+
async function re(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 oe(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 ie(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",
|
|
@@ -69,109 +69,25 @@ async function T(e) {
|
|
|
69
69
|
"itemKey"
|
|
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
|
-
var
|
|
73
|
-
up:
|
|
74
|
-
down:
|
|
72
|
+
var ae = {
|
|
73
|
+
up: re,
|
|
74
|
+
down: ie
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
* Sends a message to the backend.
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import { invoke } from '@tauri-apps/api/core';
|
|
81
|
-
* await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @param cmd The command name.
|
|
85
|
-
* @param args The optional arguments to pass to the command.
|
|
86
|
-
* @param options The request options.
|
|
87
|
-
* @return A promise resolving or rejecting to the backend response.
|
|
88
|
-
*
|
|
89
|
-
* @since 1.0.0
|
|
90
|
-
*/
|
|
91
|
-
async function E(e, t = {}, n) {
|
|
76
|
+
async function N(e, t = {}, n) {
|
|
92
77
|
return window.__TAURI_INTERNALS__.invoke(e, t, n);
|
|
93
78
|
}
|
|
94
|
-
|
|
95
|
-
* **Database**
|
|
96
|
-
*
|
|
97
|
-
* The `Database` class serves as the primary interface for
|
|
98
|
-
* communicating with the rust side of the sql plugin.
|
|
99
|
-
*/
|
|
100
|
-
var D = class e {
|
|
79
|
+
var oe = class e {
|
|
101
80
|
constructor(e) {
|
|
102
81
|
this.path = e;
|
|
103
82
|
}
|
|
104
|
-
/**
|
|
105
|
-
* **load**
|
|
106
|
-
*
|
|
107
|
-
* A static initializer which connects to the underlying database and
|
|
108
|
-
* returns a `Database` instance once a connection to the database is established.
|
|
109
|
-
*
|
|
110
|
-
* # Sqlite
|
|
111
|
-
*
|
|
112
|
-
* The path is relative to `tauri::path::BaseDirectory::App` and must start with `sqlite:`.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```ts
|
|
116
|
-
* const db = await Database.load("sqlite:test.db");
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
83
|
static async load(t) {
|
|
120
|
-
return new e(await
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* **get**
|
|
124
|
-
*
|
|
125
|
-
* A static initializer which synchronously returns an instance of
|
|
126
|
-
* the Database class while deferring the actual database connection
|
|
127
|
-
* until the first invocation or selection on the database.
|
|
128
|
-
*
|
|
129
|
-
* # Sqlite
|
|
130
|
-
*
|
|
131
|
-
* The path is relative to `tauri::path::BaseDirectory::App` and must start with `sqlite:`.
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```ts
|
|
135
|
-
* const db = Database.get("sqlite:test.db");
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
84
|
+
return new e(await N("plugin:sql|load", { db: t }));
|
|
85
|
+
}
|
|
138
86
|
static get(t) {
|
|
139
87
|
return new e(t);
|
|
140
88
|
}
|
|
141
|
-
/**
|
|
142
|
-
* **execute**
|
|
143
|
-
*
|
|
144
|
-
* Passes a SQL expression to the database for execution.
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```ts
|
|
148
|
-
* // for sqlite & postgres
|
|
149
|
-
* // INSERT example
|
|
150
|
-
* const result = await db.execute(
|
|
151
|
-
* "INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
|
|
152
|
-
* [ todos.id, todos.title, todos.status ]
|
|
153
|
-
* );
|
|
154
|
-
* // UPDATE example
|
|
155
|
-
* const result = await db.execute(
|
|
156
|
-
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
|
|
157
|
-
* [ todos.title, todos.status, todos.id ]
|
|
158
|
-
* );
|
|
159
|
-
*
|
|
160
|
-
* // for mysql
|
|
161
|
-
* // INSERT example
|
|
162
|
-
* const result = await db.execute(
|
|
163
|
-
* "INSERT into todos (id, title, status) VALUES (?, ?, ?)",
|
|
164
|
-
* [ todos.id, todos.title, todos.status ]
|
|
165
|
-
* );
|
|
166
|
-
* // UPDATE example
|
|
167
|
-
* const result = await db.execute(
|
|
168
|
-
* "UPDATE todos SET title = ?, completed = ? WHERE id = ?",
|
|
169
|
-
* [ todos.title, todos.status, todos.id ]
|
|
170
|
-
* );
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
89
|
async execute(e, t) {
|
|
174
|
-
let [n, r] = await
|
|
90
|
+
let [n, r] = await N("plugin:sql|execute", {
|
|
175
91
|
db: this.path,
|
|
176
92
|
query: e,
|
|
177
93
|
values: t ?? []
|
|
@@ -181,47 +97,18 @@ var D = class e {
|
|
|
181
97
|
rowsAffected: n
|
|
182
98
|
};
|
|
183
99
|
}
|
|
184
|
-
/**
|
|
185
|
-
* **select**
|
|
186
|
-
*
|
|
187
|
-
* Passes in a SELECT query to the database for execution.
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* ```ts
|
|
191
|
-
* // for sqlite & postgres
|
|
192
|
-
* const result = await db.select(
|
|
193
|
-
* "SELECT * from todos WHERE id = $1", [ id ]
|
|
194
|
-
* );
|
|
195
|
-
*
|
|
196
|
-
* // for mysql
|
|
197
|
-
* const result = await db.select(
|
|
198
|
-
* "SELECT * from todos WHERE id = ?", [ id ]
|
|
199
|
-
* );
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
100
|
async select(e, t) {
|
|
203
|
-
return await
|
|
101
|
+
return await N("plugin:sql|select", {
|
|
204
102
|
db: this.path,
|
|
205
103
|
query: e,
|
|
206
104
|
values: t ?? []
|
|
207
105
|
});
|
|
208
106
|
}
|
|
209
|
-
/**
|
|
210
|
-
* **close**
|
|
211
|
-
*
|
|
212
|
-
* Closes the database connection pool.
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* ```ts
|
|
216
|
-
* const success = await db.close()
|
|
217
|
-
* ```
|
|
218
|
-
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
|
219
|
-
*/
|
|
220
107
|
async close(e) {
|
|
221
|
-
return await
|
|
108
|
+
return await N("plugin:sql|close", { db: e });
|
|
222
109
|
}
|
|
223
110
|
};
|
|
224
|
-
function
|
|
111
|
+
function P(e, t, { signal: n, edges: r } = {}) {
|
|
225
112
|
let i, a = null, o = r != null && r.includes("leading"), s = r == null || r.includes("trailing"), c = () => {
|
|
226
113
|
a !== null && (e.apply(i, a), i = void 0, a = null);
|
|
227
114
|
}, l = () => {
|
|
@@ -244,11 +131,7 @@ function O(e, t, { signal: n, edges: r } = {}) {
|
|
|
244
131
|
};
|
|
245
132
|
return h.schedule = d, h.cancel = p, h.flush = m, n?.addEventListener("abort", p, { once: !0 }), h;
|
|
246
133
|
}
|
|
247
|
-
var
|
|
248
|
-
/**
|
|
249
|
-
* Base class that implements {@link Dialect}
|
|
250
|
-
* @param create function that create {@link Driver}
|
|
251
|
-
*/
|
|
134
|
+
var se = class {
|
|
252
135
|
constructor(e) {
|
|
253
136
|
this.createDriver = e;
|
|
254
137
|
}
|
|
@@ -262,7 +145,7 @@ var ce = class {
|
|
|
262
145
|
createIntrospector(e) {
|
|
263
146
|
return new a(e);
|
|
264
147
|
}
|
|
265
|
-
},
|
|
148
|
+
}, ce = class {
|
|
266
149
|
promise;
|
|
267
150
|
resolve;
|
|
268
151
|
async lock() {
|
|
@@ -276,24 +159,19 @@ var ce = class {
|
|
|
276
159
|
this.promise = void 0, this.resolve = void 0, e?.();
|
|
277
160
|
}
|
|
278
161
|
};
|
|
279
|
-
async function
|
|
162
|
+
async function F(e, n, i, a, o) {
|
|
280
163
|
await i.executeQuery(o(r.createWithChildren([r.createWithSql(`${e} `), t.create(a)]), n()));
|
|
281
164
|
}
|
|
282
|
-
var
|
|
283
|
-
mutex = new
|
|
165
|
+
var le = class {
|
|
166
|
+
mutex = new ce();
|
|
284
167
|
conn;
|
|
285
168
|
savepoint;
|
|
286
169
|
releaseSavepoint;
|
|
287
170
|
rollbackToSavepoint;
|
|
288
171
|
init;
|
|
289
|
-
/**
|
|
290
|
-
* Base abstract class that implements {@link Driver}
|
|
291
|
-
*
|
|
292
|
-
* You **MUST** assign `this.conn` in `init` and implement `destroy` method
|
|
293
|
-
*/
|
|
294
172
|
constructor(e) {
|
|
295
|
-
this.init = () => import("./esm-
|
|
296
|
-
e && (this.savepoint =
|
|
173
|
+
this.init = () => import("./esm-BGcGAQ5-.js").then(({ createQueryId: e }) => {
|
|
174
|
+
e && (this.savepoint = F.bind(null, "savepoint", e), this.releaseSavepoint = F.bind(null, "release", e), this.rollbackToSavepoint = F.bind(null, "rollback to", e));
|
|
297
175
|
}).then(e);
|
|
298
176
|
}
|
|
299
177
|
async acquireConnection() {
|
|
@@ -312,7 +190,7 @@ var ue = class {
|
|
|
312
190
|
this.mutex.unlock();
|
|
313
191
|
}
|
|
314
192
|
};
|
|
315
|
-
function
|
|
193
|
+
function ue(e) {
|
|
316
194
|
return async (t, n, r) => {
|
|
317
195
|
let i = await e.all(n, r);
|
|
318
196
|
return t || i.length ? { rows: i } : {
|
|
@@ -321,20 +199,20 @@ function de(e) {
|
|
|
321
199
|
};
|
|
322
200
|
};
|
|
323
201
|
}
|
|
324
|
-
function
|
|
202
|
+
function I(e) {
|
|
325
203
|
return e == null ? void 0 : BigInt(e);
|
|
326
204
|
}
|
|
327
|
-
var
|
|
205
|
+
var de = class extends le {
|
|
328
206
|
db;
|
|
329
207
|
constructor(e, t) {
|
|
330
208
|
super(async () => {
|
|
331
|
-
this.db = await e(), this.conn = new
|
|
209
|
+
this.db = await e(), this.conn = new fe(this.db), await t?.(this.conn);
|
|
332
210
|
});
|
|
333
211
|
}
|
|
334
212
|
async destroy() {
|
|
335
213
|
await this.db?.close();
|
|
336
214
|
}
|
|
337
|
-
},
|
|
215
|
+
}, fe = class {
|
|
338
216
|
constructor(e) {
|
|
339
217
|
this.db = e;
|
|
340
218
|
}
|
|
@@ -346,33 +224,24 @@ var fe = class extends ue {
|
|
|
346
224
|
async executeQuery({ parameters: t, query: n, sql: r }) {
|
|
347
225
|
return await this.db.query(e.is(n), r, t);
|
|
348
226
|
}
|
|
349
|
-
},
|
|
350
|
-
/**
|
|
351
|
-
* Dialect for generic SQLite that run SQLs in current thread
|
|
352
|
-
*
|
|
353
|
-
* @param executor function to create {@link IGenericSqlite}
|
|
354
|
-
* @param onCreateConnection optional callback after connection created
|
|
355
|
-
*/
|
|
227
|
+
}, pe = class extends se {
|
|
356
228
|
constructor(e, t) {
|
|
357
|
-
super(() => new
|
|
229
|
+
super(() => new de(e, t));
|
|
358
230
|
}
|
|
359
|
-
},
|
|
360
|
-
/**
|
|
361
|
-
* SQLite dialect for Tauri, using [official sql plugin](https://github.com/tauri-apps/plugins-workspace/tree/dev/plugins/sql)
|
|
362
|
-
*/
|
|
231
|
+
}, L = class extends pe {
|
|
363
232
|
constructor(e) {
|
|
364
233
|
let { database: t, onCreateConnection: n } = e;
|
|
365
234
|
super(async () => {
|
|
366
235
|
let e = typeof t == "function" ? await t("sqlite:") : t;
|
|
367
236
|
return {
|
|
368
237
|
db: e,
|
|
369
|
-
query:
|
|
238
|
+
query: ue({
|
|
370
239
|
all: async (t, n) => await e.select(t, n),
|
|
371
240
|
run: async (t, n) => {
|
|
372
241
|
let { rowsAffected: r, lastInsertId: i } = await e.execute(t, n);
|
|
373
242
|
return {
|
|
374
|
-
numAffectedRows:
|
|
375
|
-
insertId:
|
|
243
|
+
numAffectedRows: I(r),
|
|
244
|
+
insertId: I(i)
|
|
376
245
|
};
|
|
377
246
|
}
|
|
378
247
|
}),
|
|
@@ -380,7 +249,7 @@ var fe = class extends ue {
|
|
|
380
249
|
};
|
|
381
250
|
}, n);
|
|
382
251
|
}
|
|
383
|
-
},
|
|
252
|
+
}, me = class extends s {
|
|
384
253
|
serializer;
|
|
385
254
|
constructor(e) {
|
|
386
255
|
super(), this.serializer = e;
|
|
@@ -409,8 +278,8 @@ var fe = class extends ue {
|
|
|
409
278
|
value: this.serializer(e.value)
|
|
410
279
|
};
|
|
411
280
|
}
|
|
412
|
-
},
|
|
413
|
-
if (
|
|
281
|
+
}, he = (e) => {
|
|
282
|
+
if (R(e) || typeof e == "string") return e;
|
|
414
283
|
if (typeof e == "boolean") return "" + e;
|
|
415
284
|
if (e instanceof Date) return e.toISOString();
|
|
416
285
|
try {
|
|
@@ -418,34 +287,31 @@ var fe = class extends ue {
|
|
|
418
287
|
} catch {
|
|
419
288
|
return e;
|
|
420
289
|
}
|
|
421
|
-
},
|
|
422
|
-
if (
|
|
290
|
+
}, ge = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$/, _e = (e) => {
|
|
291
|
+
if (R(e)) return e;
|
|
423
292
|
if (typeof e == "string") {
|
|
424
293
|
if (e === "true") return !0;
|
|
425
294
|
if (e === "false") return !1;
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
295
|
+
if (ge.test(e)) return new Date(e);
|
|
296
|
+
if (ve(e)) try {
|
|
428
297
|
return JSON.parse(e);
|
|
429
298
|
} catch {}
|
|
430
299
|
return e;
|
|
431
300
|
}
|
|
432
301
|
};
|
|
433
|
-
function
|
|
302
|
+
function ve(e) {
|
|
434
303
|
return e.startsWith("{") && e.endsWith("}") || e.startsWith("[") && e.endsWith("]");
|
|
435
304
|
}
|
|
436
|
-
function
|
|
305
|
+
function R(e) {
|
|
437
306
|
return e == null || typeof e == "bigint" || typeof e == "number" || typeof e == "object" && "buffer" in e;
|
|
438
307
|
}
|
|
439
|
-
var
|
|
308
|
+
var ye = class {
|
|
440
309
|
transformer;
|
|
441
310
|
deserializer;
|
|
442
311
|
skipNodeSet;
|
|
443
312
|
ctx;
|
|
444
|
-
/**
|
|
445
|
-
* Base class for {@link SerializePlugin}, without default options
|
|
446
|
-
*/
|
|
447
313
|
constructor(e, t, n) {
|
|
448
|
-
this.transformer = new
|
|
314
|
+
this.transformer = new me(e), this.deserializer = t, n.length && (this.skipNodeSet = new Set(n), this.ctx = new WeakSet());
|
|
449
315
|
}
|
|
450
316
|
transformQuery({ node: e, queryId: t }) {
|
|
451
317
|
return this.skipNodeSet?.has(e.kind) ? (this.ctx?.add(t), e) : this.transformer.transformNode(e);
|
|
@@ -466,76 +332,15 @@ var N = class {
|
|
|
466
332
|
}
|
|
467
333
|
return t;
|
|
468
334
|
}
|
|
469
|
-
},
|
|
470
|
-
/**
|
|
471
|
-
* _**THIS PLUGIN SHOULD BE PLACED AT THE END OF PLUGINS ARRAY !!!**_
|
|
472
|
-
*
|
|
473
|
-
* reference from https://github.com/koskimas/kysely/pull/138
|
|
474
|
-
*
|
|
475
|
-
* The following example will return an error when using sqlite dialects, unless using this plugin:
|
|
476
|
-
* ```ts
|
|
477
|
-
* interface TestTable {
|
|
478
|
-
* id: Generated<number>
|
|
479
|
-
* person: { name: string; age: number; time: Date } | null
|
|
480
|
-
* gender: boolean
|
|
481
|
-
* blob: Uint8Array | null
|
|
482
|
-
* date: Date
|
|
483
|
-
* }
|
|
484
|
-
*
|
|
485
|
-
* interface Database {
|
|
486
|
-
* test: TestTable
|
|
487
|
-
* }
|
|
488
|
-
*
|
|
489
|
-
* const db = new Kysely<Database>({
|
|
490
|
-
* dialect: new SqliteDialect({
|
|
491
|
-
* database: new Database(':memory:'),
|
|
492
|
-
* }),
|
|
493
|
-
* plugins: [
|
|
494
|
-
* new SerializePlugin(),
|
|
495
|
-
* ],
|
|
496
|
-
* })
|
|
497
|
-
*
|
|
498
|
-
* await db.insertInto('test').values({
|
|
499
|
-
* gender: true,
|
|
500
|
-
* person: { name: 'test', age: 2, time: new Date() },
|
|
501
|
-
* blob: Uint8Array.from([1, 2, 3]),
|
|
502
|
-
* date: new Date(),
|
|
503
|
-
* }).execute()
|
|
504
|
-
* ```
|
|
505
|
-
*
|
|
506
|
-
* You can also provide a custom serializer function:
|
|
507
|
-
*
|
|
508
|
-
* ```ts
|
|
509
|
-
* const db = new Kysely<Database>({
|
|
510
|
-
* dialect: new SqliteDialect({
|
|
511
|
-
* database: new Database(":memory:"),
|
|
512
|
-
* }),
|
|
513
|
-
* plugins: [
|
|
514
|
-
* new SerializePlugin({
|
|
515
|
-
* serializer: (value) => {
|
|
516
|
-
* if (value instanceof Date) {
|
|
517
|
-
* return formatDatetime(value)
|
|
518
|
-
* }
|
|
519
|
-
*
|
|
520
|
-
* if (value !== null && typeof value === 'object') {
|
|
521
|
-
* return JSON.stringify(value)
|
|
522
|
-
* }
|
|
523
|
-
*
|
|
524
|
-
* return value
|
|
525
|
-
* }
|
|
526
|
-
* }),
|
|
527
|
-
* ],
|
|
528
|
-
* })
|
|
529
|
-
* ```
|
|
530
|
-
*/
|
|
335
|
+
}, z = class extends ye {
|
|
531
336
|
constructor(e = {}) {
|
|
532
|
-
let { deserializer: t =
|
|
337
|
+
let { deserializer: t = _e, serializer: n = he, skipNodeKind: r = [] } = e;
|
|
533
338
|
super(n, t, r);
|
|
534
339
|
}
|
|
535
340
|
};
|
|
536
|
-
function
|
|
341
|
+
function B(e) {
|
|
537
342
|
return {
|
|
538
|
-
all: e ||=
|
|
343
|
+
all: e ||= new Map(),
|
|
539
344
|
on: function(t, n) {
|
|
540
345
|
var r = e.get(t);
|
|
541
346
|
r ? r.push(n) : e.set(t, [n]);
|
|
@@ -554,7 +359,7 @@ function F(e) {
|
|
|
554
359
|
}
|
|
555
360
|
};
|
|
556
361
|
}
|
|
557
|
-
var be =
|
|
362
|
+
var be = k({
|
|
558
363
|
get: () => Se,
|
|
559
364
|
getByEnabled: () => xe,
|
|
560
365
|
toggleEnable: () => Ce
|
|
@@ -571,24 +376,24 @@ async function Ce(e) {
|
|
|
571
376
|
let { db: t } = await import("./index.js"), n = await t.value.selectFrom("plugin").where("pluginName", "=", e).select("enable").executeTakeFirstOrThrow();
|
|
572
377
|
return t.value.updateTable("plugin").where("pluginName", "=", e).set({ enable: !n.enable }).execute();
|
|
573
378
|
}
|
|
574
|
-
var we =
|
|
575
|
-
key: () =>
|
|
576
|
-
upsert: () =>
|
|
379
|
+
var we = k({
|
|
380
|
+
key: () => V,
|
|
381
|
+
upsert: () => H
|
|
577
382
|
});
|
|
578
|
-
const
|
|
579
|
-
async function
|
|
580
|
-
let { db: t } = await import("./index.js"), n =
|
|
383
|
+
const V = new T("*");
|
|
384
|
+
async function H(e) {
|
|
385
|
+
let { db: t } = await import("./index.js"), n = V.toString([D.content.ContentPage.contentPage.toString(e.contentType), e.id]);
|
|
581
386
|
return await t.value.replaceInto("itemStore").values({
|
|
582
|
-
item:
|
|
387
|
+
item: E.toRaw(e),
|
|
583
388
|
key: n
|
|
584
389
|
}).execute(), n;
|
|
585
390
|
}
|
|
586
|
-
var Te =
|
|
391
|
+
var Te = k({
|
|
587
392
|
moveItem: () => De,
|
|
588
393
|
upsertItem: () => Ee
|
|
589
394
|
});
|
|
590
395
|
async function Ee(e, ...t) {
|
|
591
|
-
let { db: n } = await import("./index.js"), r = await
|
|
396
|
+
let { db: n } = await import("./index.js"), r = await H(e);
|
|
592
397
|
for (let e of t) await n.value.replaceInto("favouriteItem").values({
|
|
593
398
|
addTime: Date.now(),
|
|
594
399
|
itemKey: r,
|
|
@@ -604,21 +409,21 @@ async function De(e, t, ...n) {
|
|
|
604
409
|
belongTo: t
|
|
605
410
|
}).execute();
|
|
606
411
|
}
|
|
607
|
-
var Oe =
|
|
412
|
+
var Oe = k({ upsert: () => ke });
|
|
608
413
|
async function ke(e) {
|
|
609
|
-
let { db: t } = await import("./index.js"), n = await
|
|
414
|
+
let { db: t } = await import("./index.js"), n = await H(e);
|
|
610
415
|
await t.value.replaceInto("history").values({
|
|
611
416
|
itemKey: n,
|
|
612
417
|
timestamp: Date.now(),
|
|
613
|
-
ep:
|
|
418
|
+
ep: E.toRaw(e)
|
|
614
419
|
}).execute();
|
|
615
420
|
}
|
|
616
|
-
var Ae =
|
|
421
|
+
var Ae = k({
|
|
617
422
|
getAll: () => Me,
|
|
618
423
|
key: () => je,
|
|
619
424
|
upsert: () => Ne
|
|
620
425
|
});
|
|
621
|
-
const je = new
|
|
426
|
+
const je = new T();
|
|
622
427
|
async function Me() {
|
|
623
428
|
let { db: e } = await import("./index.js");
|
|
624
429
|
return e.value.selectFrom("subscribe").selectAll().execute();
|
|
@@ -633,9 +438,9 @@ async function Ne(e) {
|
|
|
633
438
|
author: JSON.stringify(e.author)
|
|
634
439
|
}).execute();
|
|
635
440
|
}
|
|
636
|
-
var Pe =
|
|
441
|
+
var Pe = k({ upsert: () => Fe });
|
|
637
442
|
async function Fe(e) {
|
|
638
|
-
let { db: t } = await import("./index.js"), n = await
|
|
443
|
+
let { db: t } = await import("./index.js"), n = await H(e);
|
|
639
444
|
await t.value.replaceInto("recentView").values({
|
|
640
445
|
isViewed: !1,
|
|
641
446
|
itemKey: n,
|
|
@@ -651,13 +456,18 @@ async function Le(e) {
|
|
|
651
456
|
var Re = {
|
|
652
457
|
up: Ie,
|
|
653
458
|
down: Le
|
|
654
|
-
},
|
|
459
|
+
}, U = typeof window < "u" && typeof document < "u";
|
|
655
460
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
656
|
-
var ze = Object.prototype.toString, Be = (e) => ze.call(e) === "[object Object]";
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
function
|
|
461
|
+
var ze = Object.prototype.toString, Be = (e) => ze.call(e) === "[object Object]", Ve = () => {};
|
|
462
|
+
function He(...e) {
|
|
463
|
+
if (e.length !== 1) return b(...e);
|
|
464
|
+
let t = e[0];
|
|
465
|
+
return typeof t == "function" ? _(p(() => ({
|
|
466
|
+
get: t,
|
|
467
|
+
set: Ve
|
|
468
|
+
}))) : v(t);
|
|
469
|
+
}
|
|
470
|
+
function Ue(e, t) {
|
|
661
471
|
function n(...n) {
|
|
662
472
|
return new Promise((r, i) => {
|
|
663
473
|
Promise.resolve(e(() => t.apply(this, n), {
|
|
@@ -669,46 +479,71 @@ function Ve(e, t) {
|
|
|
669
479
|
}
|
|
670
480
|
return n;
|
|
671
481
|
}
|
|
672
|
-
var
|
|
673
|
-
function
|
|
482
|
+
var W = (e) => e();
|
|
483
|
+
function We(e = W, t = {}) {
|
|
484
|
+
let { initialState: n = "active" } = t, r = He(n === "active");
|
|
485
|
+
function i() {
|
|
486
|
+
r.value = !1;
|
|
487
|
+
}
|
|
488
|
+
function a() {
|
|
489
|
+
r.value = !0;
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
isActive: _(r),
|
|
493
|
+
pause: i,
|
|
494
|
+
resume: a,
|
|
495
|
+
eventFilter: (...t) => {
|
|
496
|
+
r.value && e(...t);
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function G(e) {
|
|
674
501
|
return Array.isArray(e) ? e : [e];
|
|
675
502
|
}
|
|
676
|
-
function
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
503
|
+
function Ge(e) {
|
|
504
|
+
return e || m();
|
|
505
|
+
}
|
|
506
|
+
function Ke(e, t, n = {}) {
|
|
507
|
+
let { eventFilter: r = W, ...i } = n;
|
|
508
|
+
return w(e, Ue(r, t), i);
|
|
509
|
+
}
|
|
510
|
+
function qe(e, t, n = {}) {
|
|
511
|
+
let { eventFilter: r, initialState: i = "active", ...a } = n, { eventFilter: o, pause: s, resume: c, isActive: l } = We(r, { initialState: i });
|
|
512
|
+
return {
|
|
513
|
+
stop: Ke(e, t, {
|
|
514
|
+
...a,
|
|
515
|
+
eventFilter: o
|
|
516
|
+
}),
|
|
517
|
+
pause: s,
|
|
518
|
+
resume: c,
|
|
519
|
+
isActive: l
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function Je(e, t = !0, n) {
|
|
523
|
+
Ge(n) ? g(e, n) : t ? e() : h(e);
|
|
524
|
+
}
|
|
525
|
+
function Ye(e, t, n) {
|
|
526
|
+
return w(e, t, {
|
|
687
527
|
...n,
|
|
688
528
|
immediate: !0
|
|
689
529
|
});
|
|
690
530
|
}
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
*
|
|
696
|
-
* @param elRef
|
|
697
|
-
*/
|
|
698
|
-
function Ge(e) {
|
|
699
|
-
let t = g(e);
|
|
531
|
+
var K = U ? window : void 0;
|
|
532
|
+
U && window.document, U && window.navigator, U && window.location;
|
|
533
|
+
function Xe(e) {
|
|
534
|
+
let t = x(e);
|
|
700
535
|
return t?.$el ?? t;
|
|
701
536
|
}
|
|
702
|
-
function
|
|
537
|
+
function q(...e) {
|
|
703
538
|
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = f(() => {
|
|
704
|
-
let t =
|
|
539
|
+
let t = G(x(e[0])).filter((e) => e != null);
|
|
705
540
|
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
706
541
|
});
|
|
707
|
-
return
|
|
708
|
-
n.value?.map((e) =>
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
542
|
+
return Ye(() => [
|
|
543
|
+
n.value?.map((e) => Xe(e)) ?? [K].filter((e) => e != null),
|
|
544
|
+
G(x(n.value ? e[1] : e[0])),
|
|
545
|
+
G(C(n.value ? e[2] : e[1])),
|
|
546
|
+
x(n.value ? e[3] : e[2])
|
|
712
547
|
], ([e, n, r, i], a, o) => {
|
|
713
548
|
if (!e?.length || !n?.length || !r?.length) return;
|
|
714
549
|
let s = Be(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
@@ -717,17 +552,17 @@ function Ke(...e) {
|
|
|
717
552
|
});
|
|
718
553
|
}, { flush: "post" });
|
|
719
554
|
}
|
|
720
|
-
var
|
|
721
|
-
function
|
|
722
|
-
return
|
|
555
|
+
var J = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Y = "__vueuse_ssr_handlers__", Ze = Qe();
|
|
556
|
+
function Qe() {
|
|
557
|
+
return Y in J || (J[Y] = J[Y] || {}), J[Y];
|
|
723
558
|
}
|
|
724
|
-
function
|
|
725
|
-
return
|
|
559
|
+
function $e(e, t) {
|
|
560
|
+
return Ze[e] || t;
|
|
726
561
|
}
|
|
727
|
-
function
|
|
562
|
+
function et(e) {
|
|
728
563
|
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";
|
|
729
564
|
}
|
|
730
|
-
var
|
|
565
|
+
var tt = {
|
|
731
566
|
boolean: {
|
|
732
567
|
read: (e) => e === "true",
|
|
733
568
|
write: (e) => String(e)
|
|
@@ -760,138 +595,155 @@ var Ze = {
|
|
|
760
595
|
read: (e) => new Date(e),
|
|
761
596
|
write: (e) => e.toISOString()
|
|
762
597
|
}
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
*
|
|
767
|
-
* @see https://vueuse.org/useStorageAsync
|
|
768
|
-
* @param key
|
|
769
|
-
* @param initialValue
|
|
770
|
-
* @param storage
|
|
771
|
-
* @param options
|
|
772
|
-
*/
|
|
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) => {
|
|
598
|
+
}, X = "vueuse-storage";
|
|
599
|
+
function nt(e, t, n, r = {}) {
|
|
600
|
+
let { flush: i = "pre", deep: a = !0, listenToStorageChanges: o = !0, writeDefaults: s = !0, mergeDefaults: c = !1, shallow: l, window: u = K, eventFilter: d, onError: p = (e) => {
|
|
775
601
|
console.error(e);
|
|
776
|
-
},
|
|
602
|
+
}, initOnMounted: m } = r, g = (l ? y : v)(typeof t == "function" ? t() : t), _ = f(() => x(e));
|
|
777
603
|
if (!n) try {
|
|
778
|
-
n =
|
|
604
|
+
n = $e("getDefaultStorage", () => K?.localStorage)();
|
|
779
605
|
} catch (e) {
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
async function x(t) {
|
|
783
|
-
if (!(!n || t && t.key !== e)) try {
|
|
784
|
-
let r = t ? t.newValue : await n.getItem(e);
|
|
785
|
-
if (r == null) y.value = _, s && _ !== null && await n.setItem(e, await b.write(_));
|
|
786
|
-
else if (c) {
|
|
787
|
-
let e = await b.read(r);
|
|
788
|
-
typeof c == "function" ? y.value = c(e, _) : v === "object" && !Array.isArray(e) ? y.value = {
|
|
789
|
-
..._,
|
|
790
|
-
...e
|
|
791
|
-
} : y.value = e;
|
|
792
|
-
} else y.value = await b.read(r);
|
|
793
|
-
} catch (e) {
|
|
794
|
-
f(e);
|
|
795
|
-
}
|
|
606
|
+
p(e);
|
|
796
607
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
608
|
+
if (!n) return g;
|
|
609
|
+
let b = x(t), S = et(b), C = r.serializer ?? tt[S], { pause: T, resume: E } = qe(g, (e) => k(e), {
|
|
610
|
+
flush: i,
|
|
611
|
+
deep: a,
|
|
612
|
+
eventFilter: d
|
|
801
613
|
});
|
|
802
|
-
|
|
614
|
+
w(_, () => j(), { flush: i });
|
|
615
|
+
let D = !1;
|
|
616
|
+
u && o && (n instanceof Storage ? q(u, "storage", (e) => {
|
|
617
|
+
m && !D || j(e);
|
|
618
|
+
}, { passive: !0 }) : q(u, X, (e) => {
|
|
619
|
+
m && !D || M(e);
|
|
620
|
+
})), m ? Je(() => {
|
|
621
|
+
D = !0, j();
|
|
622
|
+
}) : j();
|
|
623
|
+
function O(e, t) {
|
|
624
|
+
if (u) {
|
|
625
|
+
let r = {
|
|
626
|
+
key: _.value,
|
|
627
|
+
oldValue: e,
|
|
628
|
+
newValue: t,
|
|
629
|
+
storageArea: n
|
|
630
|
+
};
|
|
631
|
+
u.dispatchEvent(n instanceof Storage ? new StorageEvent("storage", r) : new CustomEvent(X, { detail: r }));
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function k(e) {
|
|
803
635
|
try {
|
|
804
|
-
|
|
636
|
+
let t = n.getItem(_.value);
|
|
637
|
+
if (e == null) O(t, null), n.removeItem(_.value);
|
|
638
|
+
else {
|
|
639
|
+
let r = C.write(e);
|
|
640
|
+
t !== r && (n.setItem(_.value, r), O(t, r));
|
|
641
|
+
}
|
|
805
642
|
} catch (e) {
|
|
806
|
-
|
|
643
|
+
p(e);
|
|
807
644
|
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
645
|
+
}
|
|
646
|
+
function A(e) {
|
|
647
|
+
let t = e ? e.newValue : n.getItem(_.value);
|
|
648
|
+
if (t == null) return s && b != null && n.setItem(_.value, C.write(b)), b;
|
|
649
|
+
if (!e && c) {
|
|
650
|
+
let e = C.read(t);
|
|
651
|
+
return typeof c == "function" ? c(e, b) : S === "object" && !Array.isArray(e) ? {
|
|
652
|
+
...b,
|
|
653
|
+
...e
|
|
654
|
+
} : e;
|
|
655
|
+
} else if (typeof t != "string") return t;
|
|
656
|
+
else return C.read(t);
|
|
657
|
+
}
|
|
658
|
+
function j(e) {
|
|
659
|
+
if (!(e && e.storageArea !== n)) {
|
|
660
|
+
if (e && e.key == null) {
|
|
661
|
+
g.value = b;
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
if (!(e && e.key !== _.value)) {
|
|
665
|
+
T();
|
|
666
|
+
try {
|
|
667
|
+
let t = C.write(g.value);
|
|
668
|
+
(e === void 0 || e?.newValue !== t) && (g.value = A(e));
|
|
669
|
+
} catch (e) {
|
|
670
|
+
p(e);
|
|
671
|
+
} finally {
|
|
672
|
+
e ? h(E) : E();
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function M(e) {
|
|
678
|
+
j(e.detail);
|
|
679
|
+
}
|
|
680
|
+
return g;
|
|
681
|
+
}
|
|
682
|
+
function rt(e, t, n = {}) {
|
|
683
|
+
let { window: r = K } = n;
|
|
684
|
+
return nt(e, t, r?.localStorage, n);
|
|
685
|
+
}
|
|
686
|
+
var it = Object.assign({ "./migrations/1_initial.ts": Re }), Z = d(await oe.load("sqlite:native_store.db"), "core/store/raw"), at = B(), ot = /\b(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER)\b/i, st = P(() => {
|
|
687
|
+
console.debug("[db sync] db changed"), at.emit("onChange"), S(ct);
|
|
688
|
+
}, 300), ct = d(await (async () => {
|
|
689
|
+
let e = y(new u({
|
|
690
|
+
dialect: new L({ database: {
|
|
822
691
|
close(e) {
|
|
823
|
-
return
|
|
692
|
+
return Z.close(e);
|
|
824
693
|
},
|
|
825
|
-
path:
|
|
694
|
+
path: Z.path,
|
|
826
695
|
async select(e, t) {
|
|
827
696
|
console.debug("sql!", e, t);
|
|
828
|
-
let n = await
|
|
829
|
-
return
|
|
697
|
+
let n = await Z.select(e, t);
|
|
698
|
+
return ot.test(e) && st(), n;
|
|
830
699
|
},
|
|
831
700
|
async execute(e, t) {
|
|
832
701
|
console.debug("sql!", e, t);
|
|
833
|
-
let n = await
|
|
834
|
-
return
|
|
702
|
+
let n = await Z.execute(e, t);
|
|
703
|
+
return ot.test(e) && st(), n;
|
|
835
704
|
}
|
|
836
705
|
} }),
|
|
837
|
-
plugins: [new c(), new
|
|
706
|
+
plugins: [new c(), new z()]
|
|
838
707
|
}));
|
|
839
708
|
return await new o({
|
|
840
709
|
db: e.value,
|
|
841
710
|
provider: { async getMigrations() {
|
|
842
|
-
return
|
|
711
|
+
return it;
|
|
843
712
|
} }
|
|
844
713
|
}).migrateToLatest(), e;
|
|
845
|
-
})(), "core/store/ins"),
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
return (await q.value.selectFrom("store").selectAll().where("namespace", "=", t).where("name", "=", n).executeTakeFirst())?.item ?? null;
|
|
854
|
-
},
|
|
855
|
-
async setItem(e, t) {
|
|
856
|
-
let [n, r] = J.toJSON(e);
|
|
857
|
-
await q.value.replaceInto("store").values({
|
|
858
|
-
namespace: n,
|
|
859
|
-
name: r,
|
|
860
|
-
item: t
|
|
861
|
-
}).execute();
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
var tt = /* @__PURE__ */ Object.assign({
|
|
865
|
-
"./migrations/1_initial.ts": ne,
|
|
866
|
-
"./migrations/2_fix-display_name.ts": ae,
|
|
867
|
-
"./migrations/3_fix_fvi_foreign_key.ts": se
|
|
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);
|
|
714
|
+
})(), "core/store/ins"), lt = new T();
|
|
715
|
+
const ut = (e, t, n) => rt(lt.toString([e, x(t)]), n);
|
|
716
|
+
var dt = Object.assign({
|
|
717
|
+
"./migrations/1_initial.ts": M,
|
|
718
|
+
"./migrations/2_fix-display_name.ts": ne,
|
|
719
|
+
"./migrations/3_fix_fvi_foreign_key.ts": ae
|
|
720
|
+
}), Q = d(await oe.load("sqlite:app.db"), "core/db/raw"), ft = B(), pt = /\b(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER)\b/i, mt = P(() => {
|
|
721
|
+
console.debug("[db sync] db changed"), ft.emit("onChange"), S(ht);
|
|
870
722
|
}, 300);
|
|
871
|
-
const
|
|
872
|
-
let e =
|
|
873
|
-
dialect: new
|
|
723
|
+
const ht = d(await (async () => {
|
|
724
|
+
let e = y(new u({
|
|
725
|
+
dialect: new L({ database: {
|
|
874
726
|
close(e) {
|
|
875
|
-
return
|
|
727
|
+
return Q.close(e);
|
|
876
728
|
},
|
|
877
|
-
path:
|
|
729
|
+
path: Q.path,
|
|
878
730
|
async select(e, t) {
|
|
879
731
|
console.debug("sql!", e, t);
|
|
880
|
-
let n = await
|
|
881
|
-
return
|
|
732
|
+
let n = await Q.select(e, t);
|
|
733
|
+
return pt.test(e) && mt(), n;
|
|
882
734
|
},
|
|
883
735
|
async execute(e, t) {
|
|
884
736
|
console.debug("sql!", e, t);
|
|
885
|
-
let n = await
|
|
886
|
-
return
|
|
737
|
+
let n = await Q.execute(e, t);
|
|
738
|
+
return pt.test(e) && mt(), n;
|
|
887
739
|
}
|
|
888
740
|
} }),
|
|
889
|
-
plugins: [new c(), new
|
|
741
|
+
plugins: [new c(), new z()]
|
|
890
742
|
}));
|
|
891
743
|
return await new o({
|
|
892
744
|
db: e.value,
|
|
893
745
|
provider: { async getMigrations() {
|
|
894
|
-
return
|
|
746
|
+
return dt;
|
|
895
747
|
} }
|
|
896
748
|
}).migrateToLatest(), e;
|
|
897
749
|
})(), "core/db/ins");
|
|
@@ -902,6 +754,6 @@ let $;
|
|
|
902
754
|
}
|
|
903
755
|
e.countDb = t;
|
|
904
756
|
})($ ||= {});
|
|
905
|
-
export { $ as DBUtils, Te as FavouriteDB, Oe as HistoryDB, we as ItemStoreDB, be as PluginArchiveDB, Pe as RecentDB, Ae as SubscribeDB,
|
|
757
|
+
export { $ as DBUtils, Te as FavouriteDB, Oe as HistoryDB, we as ItemStoreDB, be as PluginArchiveDB, Pe as RecentDB, Ae as SubscribeDB, ht as db, ut as useNativeStore };
|
|
906
758
|
|
|
907
759
|
//# sourceMappingURL=index.js.map
|