@delta-comic/db 3.0.0-next.10 → 3.0.0-next.12

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.d.mts CHANGED
@@ -1,23 +1,41 @@
1
1
  import { isTauri } from "@tauri-apps/api/core";
2
- import { JSONColumnType, Kysely, SelectQueryBuilder, Selectable } from "kysely";
3
- import { FormResult, FormSingleConfigure, PluginManifest, SourcedKeyType, SourcedValue, UniEpRaw, UniItem, UniItemAuthor, UniItemRaw } from "@delta-comic/model";
2
+ import { InsertObject, JSONColumnType, Kysely, Kysely as Kysely$1, KyselyPlugin, PluginTransformQueryArgs, PluginTransformResultArgs, QueryResult, RootOperationNode, SelectQueryBuilder, Selectable, UnknownRow } from "kysely";
3
+ import { EntryKey } from "@pinia/colada";
4
4
  import { MaybeRefOrGetter, Ref } from "vue";
5
+ import { FormResult, FormSingleConfigure, PluginManifest, SourcedKeyType, SourcedValue, UniEpRaw, UniItem, UniItemAuthor, UniItemRaw } from "@delta-comic/model";
6
+ import { TSchema } from "typebox";
7
+ //#region lib/generated/favourite_card.table.d.ts
8
+ interface FavouriteCardTable {
9
+ createAt: number;
10
+ title: string;
11
+ private: boolean;
12
+ description: string;
13
+ }
14
+ //#endregion
15
+ //#region lib/generated/favourite_item.table.d.ts
16
+ interface FavouriteItemTable {
17
+ addTime: number;
18
+ belongTo: number;
19
+ itemKey: string;
20
+ }
21
+ //#endregion
22
+ //#region lib/generated/item_store.table.d.ts
23
+ interface ItemStoreTable {
24
+ key: string;
25
+ item: JSONColumnType<UniItemRaw>;
26
+ }
5
27
  declare namespace utils_d_exports {
6
28
  export { CommonQueryKey, countDb, withTransition };
7
29
  }
8
- declare const withTransition: <T>(handler: (trx: Kysely<DB>) => Promise<T>, trx?: Kysely<DB>) => Promise<T>;
9
- declare function countDb(sql: SelectQueryBuilder<DB, any, object>): Promise<number>;
30
+ declare const withTransition: <T>(handler: (trx: Kysely$1<DB>) => Promise<T>, trx?: Kysely$1<DB>) => Promise<T>;
31
+ declare function countDb<TB extends keyof DB, O extends object>(sql: SelectQueryBuilder<DB, TB, O>): Promise<number>;
10
32
  declare enum CommonQueryKey {
11
33
  common = "db"
12
34
  }
13
35
  declare namespace itemStore_d_exports {
14
36
  export { QueryKey$5 as QueryKey, StorableItem, StoredItem, Table$6 as Table, itemKey, useUpsert$4 as useUpsert };
15
37
  }
16
- interface Table$6 {
17
- /** @description primary key */
18
- key: string;
19
- item: JSONColumnType<UniItemRaw>;
20
- }
38
+ type Table$6 = ItemStoreTable;
21
39
  type StorableItem = UniItem | UniItemRaw;
22
40
  type StoredItem = Selectable<Table$6>;
23
41
  declare const itemKey: SourcedValue<[string, string]>;
@@ -27,7 +45,7 @@ declare enum QueryKey$5 {
27
45
  declare const useUpsert$4: () => {
28
46
  upsert: (vars: {
29
47
  item: StorableItem;
30
- trx?: Kysely<DB>;
48
+ trx?: Kysely$1<DB>;
31
49
  }) => Promise<string>;
32
50
  key: (CommonQueryKey | QueryKey$5)[];
33
51
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<string, Error, undefined>>;
@@ -38,31 +56,20 @@ declare const useUpsert$4: () => {
38
56
  isLoading: import("vue").ComputedRef<boolean>;
39
57
  variables: import("vue").ShallowRef<{
40
58
  item: StorableItem;
41
- trx?: Kysely<DB>;
59
+ trx?: Kysely$1<DB>;
42
60
  } | undefined>;
43
61
  mutate: (vars: {
44
62
  item: StorableItem;
45
- trx?: Kysely<DB>;
63
+ trx?: Kysely$1<DB>;
46
64
  }) => void;
47
65
  reset: () => void;
48
66
  };
49
67
  declare namespace favourite_d_exports {
50
68
  export { Card, CardTable, Item$3 as Item, ItemTable, QueryKey$4 as QueryKey, useCreateCard, useMoveItem, useQueryCard, useQueryItem, useUpsertItem };
51
69
  }
52
- interface CardTable {
53
- title: string;
54
- private: boolean;
55
- description: string;
56
- /** @description primary key */
57
- createAt: number;
58
- }
70
+ type CardTable = FavouriteCardTable;
59
71
  type Card = Selectable<CardTable>;
60
- interface ItemTable {
61
- itemKey: string;
62
- /** @description foreign key */
63
- belongTo: CardTable['createAt'];
64
- addTime: number;
65
- }
72
+ type ItemTable = FavouriteItemTable;
66
73
  type Item$3 = Selectable<ItemTable>;
67
74
  declare enum QueryKey$4 {
68
75
  item = "db:favouriteItem:",
@@ -72,7 +79,7 @@ declare const useUpsertItem: () => {
72
79
  upsert: (vars: {
73
80
  item: StorableItem;
74
81
  belongTos: Item$3["belongTo"][];
75
- trx?: Kysely<DB>;
82
+ trx?: Kysely$1<DB>;
76
83
  }) => Promise<void>;
77
84
  key: (CommonQueryKey | QueryKey$5 | QueryKey$4)[];
78
85
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -84,12 +91,12 @@ declare const useUpsertItem: () => {
84
91
  variables: import("vue").ShallowRef<{
85
92
  item: StorableItem;
86
93
  belongTos: Item$3["belongTo"][];
87
- trx?: Kysely<DB>;
94
+ trx?: Kysely$1<DB>;
88
95
  } | undefined>;
89
96
  mutate: (vars: {
90
97
  item: StorableItem;
91
98
  belongTos: Item$3["belongTo"][];
92
- trx?: Kysely<DB>;
99
+ trx?: Kysely$1<DB>;
93
100
  }) => void;
94
101
  reset: () => void;
95
102
  };
@@ -98,7 +105,7 @@ declare const useMoveItem: () => {
98
105
  item: StorableItem;
99
106
  from: Item$3["belongTo"];
100
107
  aims: Item$3["belongTo"][];
101
- trx?: Kysely<DB>;
108
+ trx?: Kysely$1<DB>;
102
109
  }) => Promise<void>;
103
110
  key: QueryKey$4[];
104
111
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -111,20 +118,20 @@ declare const useMoveItem: () => {
111
118
  item: StorableItem;
112
119
  from: Item$3["belongTo"];
113
120
  aims: Item$3["belongTo"][];
114
- trx?: Kysely<DB>;
121
+ trx?: Kysely$1<DB>;
115
122
  } | undefined>;
116
123
  mutate: (vars: {
117
124
  item: StorableItem;
118
125
  from: Item$3["belongTo"];
119
126
  aims: Item$3["belongTo"][];
120
- trx?: Kysely<DB>;
127
+ trx?: Kysely$1<DB>;
121
128
  }) => void;
122
129
  reset: () => void;
123
130
  };
124
131
  declare const useCreateCard: () => {
125
132
  createCard: (vars: {
126
133
  card: Card;
127
- trx?: Kysely<DB>;
134
+ trx?: Kysely$1<DB>;
128
135
  }) => Promise<void>;
129
136
  key: QueryKey$4[];
130
137
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -135,40 +142,44 @@ declare const useCreateCard: () => {
135
142
  isLoading: import("vue").ComputedRef<boolean>;
136
143
  variables: import("vue").ShallowRef<{
137
144
  card: Card;
138
- trx?: Kysely<DB>;
145
+ trx?: Kysely$1<DB>;
139
146
  } | undefined>;
140
147
  mutate: (vars: {
141
148
  card: Card;
142
- trx?: Kysely<DB>;
149
+ trx?: Kysely$1<DB>;
143
150
  }) => void;
144
151
  reset: () => void;
145
152
  };
146
- declare const useQueryItem: <T>(query: (db: SelectQueryBuilder<DB, "favouriteItem", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
147
- declare const useQueryCard: <T>(query: (db: SelectQueryBuilder<DB, "favouriteCard", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
148
- declare namespace plugin_d_exports {
149
- export { Archive, Meta, QueryKey$3 as QueryKey, Table$5 as Table, removeByNames, useQuery$3 as useQuery, useRemove$3 as useRemove, useSetKind, useToggleEnable, useUpsert$3 as useUpsert };
150
- }
151
- type Meta = PluginManifest;
152
- interface Table$5 {
153
+ declare const useQueryItem: <T>(query: (db: SelectQueryBuilder<DB, "favouriteItem", {}>) => Promise<T>, otherKeys?: MaybeRefOrGetter<EntryKey>, initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
154
+ declare const useQueryCard: <T>(query: (db: SelectQueryBuilder<DB, "favouriteCard", {}>) => Promise<T>, otherKeys?: MaybeRefOrGetter<EntryKey>, initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
155
+ //#endregion
156
+ //#region lib/generated/plugin.table.d.ts
157
+ interface PluginTable {
153
158
  installerName: string;
154
159
  loaderName: string;
155
- /** @description primary key */
156
160
  pluginName: string;
157
- meta: JSONColumnType<Meta>;
161
+ meta: JSONColumnType<PluginManifest>;
158
162
  enable: boolean;
159
163
  installInput: string;
160
- displayName: string;
164
+ displayName: string | null;
161
165
  }
162
- /** @description Not Blue */
166
+ declare namespace plugin_d_exports {
167
+ export { Archive, Meta, QueryKey$3 as QueryKey, Table$5 as Table, removeByNames, useQuery$4 as useQuery, useRemove$3 as useRemove, useToggleEnable, useUpsert$3 as useUpsert };
168
+ }
169
+ type Meta = PluginManifest;
170
+ type Table$5 = Omit<PluginTable, 'meta' | 'enable'> & {
171
+ meta: Selectable<PluginTable>['meta'];
172
+ enable: boolean;
173
+ };
163
174
  type Archive = Selectable<Table$5>;
164
175
  declare enum QueryKey$3 {
165
176
  item = "db:plugin:"
166
177
  }
167
- declare const removeByNames: (keys: Archive["pluginName"][], trx: Kysely<DB>) => Promise<void>;
178
+ declare const removeByNames: (keys: Archive["pluginName"][], trx: Kysely$1<DB>) => Promise<void>;
168
179
  declare const useUpsert$3: () => {
169
180
  upsert: (vars: {
170
181
  archives: Archive[];
171
- trx?: Kysely<DB>;
182
+ trx?: Kysely$1<DB>;
172
183
  }) => Promise<void>;
173
184
  key: (CommonQueryKey | QueryKey$3)[];
174
185
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -179,18 +190,18 @@ declare const useUpsert$3: () => {
179
190
  isLoading: import("vue").ComputedRef<boolean>;
180
191
  variables: import("vue").ShallowRef<{
181
192
  archives: Archive[];
182
- trx?: Kysely<DB>;
193
+ trx?: Kysely$1<DB>;
183
194
  } | undefined>;
184
195
  mutate: (vars: {
185
196
  archives: Archive[];
186
- trx?: Kysely<DB>;
197
+ trx?: Kysely$1<DB>;
187
198
  }) => void;
188
199
  reset: () => void;
189
200
  };
190
201
  declare const useRemove$3: () => {
191
202
  remove: (vars: {
192
203
  keys: Archive["pluginName"][];
193
- trx?: Kysely<DB>;
204
+ trx?: Kysely$1<DB>;
194
205
  }) => Promise<void>;
195
206
  key: (CommonQueryKey | QueryKey$3)[];
196
207
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -201,18 +212,18 @@ declare const useRemove$3: () => {
201
212
  isLoading: import("vue").ComputedRef<boolean>;
202
213
  variables: import("vue").ShallowRef<{
203
214
  keys: Archive["pluginName"][];
204
- trx?: Kysely<DB>;
215
+ trx?: Kysely$1<DB>;
205
216
  } | undefined>;
206
217
  mutate: (vars: {
207
218
  keys: Archive["pluginName"][];
208
- trx?: Kysely<DB>;
219
+ trx?: Kysely$1<DB>;
209
220
  }) => void;
210
221
  reset: () => void;
211
222
  };
212
223
  declare const useToggleEnable: () => {
213
224
  toggle: (vars: {
214
225
  keys: Archive["pluginName"][];
215
- trx?: Kysely<DB>;
226
+ trx?: Kysely$1<DB>;
216
227
  }) => Promise<import("kysely").UpdateResult[] | undefined>;
217
228
  key: (CommonQueryKey | QueryKey$3)[];
218
229
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<import("kysely").UpdateResult[] | undefined, Error, undefined>>;
@@ -223,46 +234,26 @@ declare const useToggleEnable: () => {
223
234
  isLoading: import("vue").ComputedRef<boolean>;
224
235
  variables: import("vue").ShallowRef<{
225
236
  keys: Archive["pluginName"][];
226
- trx?: Kysely<DB>;
237
+ trx?: Kysely$1<DB>;
227
238
  } | undefined>;
228
239
  mutate: (vars: {
229
240
  keys: Archive["pluginName"][];
230
- trx?: Kysely<DB>;
231
- }) => void;
232
- reset: () => void;
233
- };
234
- declare const useSetKind: () => {
235
- setKind: (vars: {
236
- pluginName: string;
237
- kind: NonNullable<Meta["kind"]>;
238
- }) => Promise<void>;
239
- key: (CommonQueryKey | QueryKey$3)[];
240
- state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
241
- status: import("vue").ShallowRef<import("@pinia/colada").DataStateStatus>;
242
- asyncStatus: import("vue").ShallowRef<import("@pinia/colada").AsyncStatus>;
243
- data: import("vue").ShallowRef<void | undefined>;
244
- error: import("vue").ShallowRef<Error | null>;
245
- isLoading: import("vue").ComputedRef<boolean>;
246
- variables: import("vue").ShallowRef<{
247
- pluginName: string;
248
- kind: NonNullable<Meta["kind"]>;
249
- } | undefined>;
250
- mutate: (vars: {
251
- pluginName: string;
252
- kind: NonNullable<Meta["kind"]>;
241
+ trx?: Kysely$1<DB>;
253
242
  }) => void;
254
243
  reset: () => void;
255
244
  };
256
- declare const useQuery$3: <T>(query: (db: SelectQueryBuilder<DB, "plugin", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
257
- declare namespace history_d_exports {
258
- export { Item$2 as Item, QueryKey$2 as QueryKey, Table$4 as Table, useQuery$2 as useQuery, useRemove$2 as useRemove, useUpsert$2 as useUpsert };
259
- }
260
- interface Table$4 {
261
- /** @description primary key */
245
+ declare const useQuery$4: <T>(query: (db: SelectQueryBuilder<DB, "plugin", {}>) => Promise<T>, otherKeys?: readonly EntryKey[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
246
+ //#endregion
247
+ //#region lib/generated/history.table.d.ts
248
+ interface HistoryTable {
249
+ ep: JSONColumnType<UniEpRaw>;
262
250
  timestamp: number;
263
251
  itemKey: string;
264
- ep: JSONColumnType<UniEpRaw>;
265
252
  }
253
+ declare namespace history_d_exports {
254
+ export { Item$2 as Item, QueryKey$2 as QueryKey, Table$4 as Table, useQuery$3 as useQuery, useRemove$2 as useRemove, useUpsert$2 as useUpsert };
255
+ }
256
+ type Table$4 = HistoryTable;
266
257
  type Item$2 = Selectable<Table$4>;
267
258
  declare enum QueryKey$2 {
268
259
  item = "db:history:"
@@ -270,9 +261,9 @@ declare enum QueryKey$2 {
270
261
  declare const useUpsert$2: () => {
271
262
  upsert: (vars: {
272
263
  item: StorableItem;
273
- trx?: Kysely<DB>;
264
+ trx?: Kysely$1<DB>;
274
265
  }) => Promise<void>;
275
- key: (CommonQueryKey | QueryKey$2 | QueryKey$5)[];
266
+ key: (CommonQueryKey | QueryKey$5 | QueryKey$2)[];
276
267
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
277
268
  status: import("vue").ShallowRef<import("@pinia/colada").DataStateStatus>;
278
269
  asyncStatus: import("vue").ShallowRef<import("@pinia/colada").AsyncStatus>;
@@ -281,18 +272,18 @@ declare const useUpsert$2: () => {
281
272
  isLoading: import("vue").ComputedRef<boolean>;
282
273
  variables: import("vue").ShallowRef<{
283
274
  item: StorableItem;
284
- trx?: Kysely<DB>;
275
+ trx?: Kysely$1<DB>;
285
276
  } | undefined>;
286
277
  mutate: (vars: {
287
278
  item: StorableItem;
288
- trx?: Kysely<DB>;
279
+ trx?: Kysely$1<DB>;
289
280
  }) => void;
290
281
  reset: () => void;
291
282
  };
292
283
  declare const useRemove$2: () => {
293
284
  remove: (vars: {
294
285
  keys: Item$2["timestamp"][];
295
- trx?: Kysely<DB>;
286
+ trx?: Kysely$1<DB>;
296
287
  }) => Promise<void>;
297
288
  key: (CommonQueryKey | QueryKey$2)[];
298
289
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -303,48 +294,53 @@ declare const useRemove$2: () => {
303
294
  isLoading: import("vue").ComputedRef<boolean>;
304
295
  variables: import("vue").ShallowRef<{
305
296
  keys: Item$2["timestamp"][];
306
- trx?: Kysely<DB>;
297
+ trx?: Kysely$1<DB>;
307
298
  } | undefined>;
308
299
  mutate: (vars: {
309
300
  keys: Item$2["timestamp"][];
310
- trx?: Kysely<DB>;
301
+ trx?: Kysely$1<DB>;
311
302
  }) => void;
312
303
  reset: () => void;
313
304
  };
314
- declare const useQuery$2: <T>(query: (db: SelectQueryBuilder<DB, "history", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
315
- declare namespace config_d_exports {
316
- export { ConfigDescription, ConfigRef, Table$3 as Table, useConfig };
317
- }
318
- interface Table$3 {
319
- /** @description config owner, usually plugin name */
305
+ declare const useQuery$3: <T>(query: (db: SelectQueryBuilder<DB, "history", {}>) => Promise<T>, otherKeys?: readonly EntryKey[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
306
+ //#endregion
307
+ //#region lib/generated/config.table.d.ts
308
+ interface ConfigTable {
320
309
  belongTo: string;
321
- /** @description serialized form structure */
322
310
  form: string;
323
- /** @description serialized config data */
324
311
  data: string;
325
312
  }
313
+ declare namespace config_d_exports {
314
+ export { ConfigDescription, ConfigRef, Table$3 as Table, useConfig };
315
+ }
316
+ type Table$3 = ConfigTable;
326
317
  type ConfigRef<T> = Ref<T> & {
327
318
  readonly ready: Promise<void>;
328
319
  };
329
320
  type ConfigDescription = Record<string, Required<Pick<FormSingleConfigure, 'defaultValue'>> & FormSingleConfigure>;
330
321
  declare const useConfig: <T extends ConfigDescription>(belongTo: string, form: T) => ConfigRef<FormResult<T>>;
331
322
  //#endregion
332
- //#region lib/nativeStore/index.d.ts
333
- interface Table {
323
+ //#region lib/generated/native_store.table.d.ts
324
+ interface NativeStoreTable {
334
325
  namespace: string;
335
326
  key: string;
336
327
  value: string;
337
328
  }
329
+ //#endregion
330
+ //#region lib/nativeStore/index.d.ts
331
+ type Table = NativeStoreTable;
338
332
  declare const useNativeStore: <T extends object>(namespace: string, key: MaybeRefOrGetter<string>, defaultValue: MaybeRefOrGetter<T>) => Ref<T, T>;
339
- declare namespace recentView_d_exports {
340
- export { Item$1 as Item, QueryKey$1 as QueryKey, Table$2 as Table, useQuery$1 as useQuery, useRemove$1 as useRemove, useUpsert$1 as useUpsert };
341
- }
342
- interface Table$2 {
343
- /** @description primary key */
333
+ //#endregion
334
+ //#region lib/generated/recent_view.table.d.ts
335
+ interface RecentViewTable {
344
336
  timestamp: number;
345
337
  itemKey: string;
346
338
  isViewed: boolean;
347
339
  }
340
+ declare namespace recentView_d_exports {
341
+ export { Item$1 as Item, QueryKey$1 as QueryKey, Table$2 as Table, useQuery$2 as useQuery, useRemove$1 as useRemove, useUpsert$1 as useUpsert };
342
+ }
343
+ type Table$2 = RecentViewTable;
348
344
  type Item$1 = Selectable<Table$2>;
349
345
  declare enum QueryKey$1 {
350
346
  item = "db:recentView:"
@@ -352,7 +348,7 @@ declare enum QueryKey$1 {
352
348
  declare const useUpsert$1: () => {
353
349
  upsert: (vars: {
354
350
  item: StorableItem;
355
- trx?: Kysely<DB>;
351
+ trx?: Kysely$1<DB>;
356
352
  }) => Promise<void>;
357
353
  key: (CommonQueryKey | QueryKey$5 | QueryKey$1)[];
358
354
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -363,18 +359,18 @@ declare const useUpsert$1: () => {
363
359
  isLoading: import("vue").ComputedRef<boolean>;
364
360
  variables: import("vue").ShallowRef<{
365
361
  item: StorableItem;
366
- trx?: Kysely<DB>;
362
+ trx?: Kysely$1<DB>;
367
363
  } | undefined>;
368
364
  mutate: (vars: {
369
365
  item: StorableItem;
370
- trx?: Kysely<DB>;
366
+ trx?: Kysely$1<DB>;
371
367
  }) => void;
372
368
  reset: () => void;
373
369
  };
374
370
  declare const useRemove$1: () => {
375
371
  remove: (vars: {
376
372
  items: Item$1["timestamp"][];
377
- trx?: Kysely<DB>;
373
+ trx?: Kysely$1<DB>;
378
374
  }) => Promise<void>;
379
375
  key: (CommonQueryKey | QueryKey$1)[];
380
376
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -385,40 +381,43 @@ declare const useRemove$1: () => {
385
381
  isLoading: import("vue").ComputedRef<boolean>;
386
382
  variables: import("vue").ShallowRef<{
387
383
  items: Item$1["timestamp"][];
388
- trx?: Kysely<DB>;
384
+ trx?: Kysely$1<DB>;
389
385
  } | undefined>;
390
386
  mutate: (vars: {
391
387
  items: Item$1["timestamp"][];
392
- trx?: Kysely<DB>;
388
+ trx?: Kysely$1<DB>;
393
389
  }) => void;
394
390
  reset: () => void;
395
391
  };
396
- declare const useQuery$1: <T>(query: (db: SelectQueryBuilder<DB, "recentView", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
392
+ declare const useQuery$2: <T>(query: (db: SelectQueryBuilder<DB, "recentView", {}>) => Promise<T>, otherKeys?: readonly EntryKey[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
393
+ //#endregion
394
+ //#region lib/generated/subscribe.table.d.ts
395
+ interface SubscribeTable {
396
+ itemKey: string | null;
397
+ author: JSONColumnType<UniItemAuthor> | null;
398
+ type: string;
399
+ key: string;
400
+ plugin: string;
401
+ }
397
402
  declare namespace subscribe_d_exports {
398
- export { AuthorItem, AuthorTable, EpItem, EpTable, Item, Key, Key_, QueryKey, Table$1 as Table, key, useQuery, useRemove, useUpsert };
403
+ export { AuthorItem, AuthorTable, EpItem, EpTable, Item, Key, Key_, QueryKey, Table$1 as Table, key, useQuery$1 as useQuery, useRemove, useUpsert };
399
404
  }
400
405
  declare const key: SourcedValue<[plugin: string, label: string]>;
401
406
  type Key_ = SourcedKeyType<typeof key>;
402
407
  type Key = Exclude<Key_, string>;
403
- interface AuthorTable {
404
- author: JSONColumnType<UniItemAuthor>;
408
+ type AuthorTable = Omit<SubscribeTable, 'itemKey' | 'author' | 'type'> & {
409
+ author: Selectable<SubscribeTable>['author'];
405
410
  itemKey: null;
406
411
  type: 'author';
407
- /** @description primary key */
408
- key: string;
409
- plugin: string;
410
- }
411
- type AuthorItem = Selectable<AuthorTable>;
412
- interface EpTable {
412
+ };
413
+ type AuthorItem = AuthorTable;
414
+ type EpTable = Omit<SubscribeTable, 'itemKey' | 'author' | 'type'> & {
413
415
  author: null;
414
416
  itemKey: string;
415
417
  type: 'ep';
416
- /** @description primary key */
417
- key: string;
418
- plugin: string;
419
- }
420
- type EpItem = Selectable<EpTable>;
421
- type Table$1 = AuthorTable | EpTable;
418
+ };
419
+ type EpItem = EpTable;
420
+ type Table$1 = SubscribeTable;
422
421
  type Item = AuthorItem | EpItem;
423
422
  declare enum QueryKey {
424
423
  item = "db:subscribe:"
@@ -426,7 +425,7 @@ declare enum QueryKey {
426
425
  declare const useUpsert: () => {
427
426
  upsert: (vars: {
428
427
  items: Item[];
429
- trx?: Kysely<DB>;
428
+ trx?: Kysely$1<DB>;
430
429
  }) => Promise<void>;
431
430
  key: (CommonQueryKey | QueryKey)[];
432
431
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -437,18 +436,18 @@ declare const useUpsert: () => {
437
436
  isLoading: import("vue").ComputedRef<boolean>;
438
437
  variables: import("vue").ShallowRef<{
439
438
  items: Item[];
440
- trx?: Kysely<DB>;
439
+ trx?: Kysely$1<DB>;
441
440
  } | undefined>;
442
441
  mutate: (vars: {
443
442
  items: Item[];
444
- trx?: Kysely<DB>;
443
+ trx?: Kysely$1<DB>;
445
444
  }) => void;
446
445
  reset: () => void;
447
446
  };
448
447
  declare const useRemove: () => {
449
448
  remove: (vars: {
450
449
  keys: Item["key"][];
451
- trx?: Kysely<DB>;
450
+ trx?: Kysely$1<DB>;
452
451
  }) => Promise<void>;
453
452
  key: (CommonQueryKey | QueryKey)[];
454
453
  state: import("vue").ComputedRef<import("@pinia/colada").DataState<void, Error, undefined>>;
@@ -459,15 +458,456 @@ declare const useRemove: () => {
459
458
  isLoading: import("vue").ComputedRef<boolean>;
460
459
  variables: import("vue").ShallowRef<{
461
460
  keys: Item["key"][];
462
- trx?: Kysely<DB>;
461
+ trx?: Kysely$1<DB>;
463
462
  } | undefined>;
464
463
  mutate: (vars: {
465
464
  keys: Item["key"][];
466
- trx?: Kysely<DB>;
465
+ trx?: Kysely$1<DB>;
467
466
  }) => void;
468
467
  reset: () => void;
469
468
  };
470
- declare const useQuery: <T>(query: (db: SelectQueryBuilder<DB, "subscribe", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
469
+ declare const useQuery$1: <T>(query: (db: SelectQueryBuilder<DB, "subscribe", {}>) => Promise<T>, otherKeys?: readonly EntryKey[], initialData?: () => T) => import("@pinia/colada").UseQueryReturn<T, Error, T>;
470
+ //#endregion
471
+ //#region lib/writeValidation.d.ts
472
+ /**
473
+ * Centralized write gate: validates every insert/replace/update against the
474
+ * generated camelCase row schema before it reaches the dialect. Registered
475
+ * before CamelCasePlugin, so it observes camelCase identifiers and raw values.
476
+ */
477
+ declare class WriteValidationPlugin implements KyselyPlugin {
478
+ transformQuery({ node }: PluginTransformQueryArgs): RootOperationNode;
479
+ transformResult({ result }: PluginTransformResultArgs): Promise<QueryResult<UnknownRow>>;
480
+ }
481
+ //#endregion
482
+ //#region lib/generated/schemas.d.ts
483
+ declare const clientCamelRowSchemas: {
484
+ itemStore: {
485
+ readonly type: "object";
486
+ readonly properties: {
487
+ readonly key: {
488
+ readonly type: "string";
489
+ };
490
+ readonly item: {
491
+ readonly anyOf: readonly [{
492
+ readonly type: "object";
493
+ }, {
494
+ readonly type: "string";
495
+ }];
496
+ };
497
+ };
498
+ readonly required: readonly ["key", "item"];
499
+ readonly additionalProperties: false;
500
+ };
501
+ favouriteCard: {
502
+ readonly type: "object";
503
+ readonly properties: {
504
+ readonly createAt: {
505
+ readonly type: "integer";
506
+ };
507
+ readonly title: {
508
+ readonly type: "string";
509
+ };
510
+ readonly private: {
511
+ readonly anyOf: readonly [{
512
+ readonly type: "boolean";
513
+ }, {
514
+ readonly const: 0;
515
+ }, {
516
+ readonly const: 1;
517
+ }];
518
+ };
519
+ readonly description: {
520
+ readonly type: "string";
521
+ };
522
+ };
523
+ readonly required: readonly ["createAt", "title", "private", "description"];
524
+ readonly additionalProperties: false;
525
+ };
526
+ favouriteItem: {
527
+ readonly type: "object";
528
+ readonly properties: {
529
+ readonly addTime: {
530
+ readonly type: "integer";
531
+ };
532
+ readonly belongTo: {
533
+ readonly type: "integer";
534
+ };
535
+ readonly itemKey: {
536
+ readonly type: "string";
537
+ };
538
+ };
539
+ readonly required: readonly ["addTime", "belongTo", "itemKey"];
540
+ readonly additionalProperties: false;
541
+ };
542
+ history: {
543
+ readonly type: "object";
544
+ readonly properties: {
545
+ readonly ep: {
546
+ readonly anyOf: readonly [{
547
+ readonly type: "object";
548
+ }, {
549
+ readonly type: "string";
550
+ }];
551
+ };
552
+ readonly timestamp: {
553
+ readonly type: "integer";
554
+ };
555
+ readonly itemKey: {
556
+ readonly type: "string";
557
+ };
558
+ };
559
+ readonly required: readonly ["ep", "timestamp", "itemKey"];
560
+ readonly additionalProperties: false;
561
+ };
562
+ recentView: {
563
+ readonly type: "object";
564
+ readonly properties: {
565
+ readonly timestamp: {
566
+ readonly type: "integer";
567
+ };
568
+ readonly itemKey: {
569
+ readonly type: "string";
570
+ };
571
+ readonly isViewed: {
572
+ readonly anyOf: readonly [{
573
+ readonly type: "boolean";
574
+ }, {
575
+ readonly const: 0;
576
+ }, {
577
+ readonly const: 1;
578
+ }];
579
+ };
580
+ };
581
+ readonly required: readonly ["timestamp", "itemKey", "isViewed"];
582
+ readonly additionalProperties: false;
583
+ };
584
+ subscribe: {
585
+ readonly type: "object";
586
+ readonly properties: {
587
+ readonly itemKey: {
588
+ readonly anyOf: readonly [{
589
+ readonly type: "string";
590
+ }, {
591
+ readonly type: "null";
592
+ }];
593
+ };
594
+ readonly author: {
595
+ readonly anyOf: readonly [{
596
+ readonly type: "object";
597
+ }, {
598
+ readonly type: "string";
599
+ }, {
600
+ readonly type: "null";
601
+ }];
602
+ };
603
+ readonly type: {
604
+ readonly type: "string";
605
+ };
606
+ readonly key: {
607
+ readonly type: "string";
608
+ };
609
+ readonly plugin: {
610
+ readonly type: "string";
611
+ };
612
+ };
613
+ readonly required: readonly ["itemKey", "author", "type", "key", "plugin"];
614
+ readonly additionalProperties: false;
615
+ };
616
+ plugin: {
617
+ readonly type: "object";
618
+ readonly properties: {
619
+ readonly installerName: {
620
+ readonly type: "string";
621
+ };
622
+ readonly loaderName: {
623
+ readonly type: "string";
624
+ };
625
+ readonly pluginName: {
626
+ readonly type: "string";
627
+ };
628
+ readonly meta: {
629
+ readonly anyOf: readonly [{
630
+ readonly type: "object";
631
+ }, {
632
+ readonly type: "string";
633
+ }];
634
+ };
635
+ readonly enable: {
636
+ readonly anyOf: readonly [{
637
+ readonly type: "boolean";
638
+ }, {
639
+ readonly const: 0;
640
+ }, {
641
+ readonly const: 1;
642
+ }];
643
+ };
644
+ readonly installInput: {
645
+ readonly type: "string";
646
+ };
647
+ readonly displayName: {
648
+ readonly anyOf: readonly [{
649
+ readonly type: "string";
650
+ }, {
651
+ readonly type: "null";
652
+ }];
653
+ };
654
+ };
655
+ readonly required: readonly ["installerName", "loaderName", "pluginName", "meta", "enable", "installInput", "displayName"];
656
+ readonly additionalProperties: false;
657
+ };
658
+ nativeStore: {
659
+ readonly type: "object";
660
+ readonly properties: {
661
+ readonly namespace: {
662
+ readonly type: "string";
663
+ };
664
+ readonly key: {
665
+ readonly type: "string";
666
+ };
667
+ readonly value: {
668
+ readonly type: "string";
669
+ };
670
+ };
671
+ readonly required: readonly ["namespace", "key", "value"];
672
+ readonly additionalProperties: false;
673
+ };
674
+ config: {
675
+ readonly type: "object";
676
+ readonly properties: {
677
+ readonly belongTo: {
678
+ readonly type: "string";
679
+ };
680
+ readonly form: {
681
+ readonly type: "string";
682
+ };
683
+ readonly data: {
684
+ readonly type: "string";
685
+ };
686
+ };
687
+ readonly required: readonly ["belongTo", "form", "data"];
688
+ readonly additionalProperties: false;
689
+ };
690
+ };
691
+ //#endregion
692
+ //#region lib/validation.d.ts
693
+ type ClientTableName = keyof typeof clientCamelRowSchemas;
694
+ declare const tableSchema: <K extends ClientTableName>(table: K) => {
695
+ itemStore: {
696
+ readonly type: "object";
697
+ readonly properties: {
698
+ readonly key: {
699
+ readonly type: "string";
700
+ };
701
+ readonly item: {
702
+ readonly anyOf: readonly [{
703
+ readonly type: "object";
704
+ }, {
705
+ readonly type: "string";
706
+ }];
707
+ };
708
+ };
709
+ readonly required: readonly ["key", "item"];
710
+ readonly additionalProperties: false;
711
+ };
712
+ favouriteCard: {
713
+ readonly type: "object";
714
+ readonly properties: {
715
+ readonly createAt: {
716
+ readonly type: "integer";
717
+ };
718
+ readonly title: {
719
+ readonly type: "string";
720
+ };
721
+ readonly private: {
722
+ readonly anyOf: readonly [{
723
+ readonly type: "boolean";
724
+ }, {
725
+ readonly const: 0;
726
+ }, {
727
+ readonly const: 1;
728
+ }];
729
+ };
730
+ readonly description: {
731
+ readonly type: "string";
732
+ };
733
+ };
734
+ readonly required: readonly ["createAt", "title", "private", "description"];
735
+ readonly additionalProperties: false;
736
+ };
737
+ favouriteItem: {
738
+ readonly type: "object";
739
+ readonly properties: {
740
+ readonly addTime: {
741
+ readonly type: "integer";
742
+ };
743
+ readonly belongTo: {
744
+ readonly type: "integer";
745
+ };
746
+ readonly itemKey: {
747
+ readonly type: "string";
748
+ };
749
+ };
750
+ readonly required: readonly ["addTime", "belongTo", "itemKey"];
751
+ readonly additionalProperties: false;
752
+ };
753
+ history: {
754
+ readonly type: "object";
755
+ readonly properties: {
756
+ readonly ep: {
757
+ readonly anyOf: readonly [{
758
+ readonly type: "object";
759
+ }, {
760
+ readonly type: "string";
761
+ }];
762
+ };
763
+ readonly timestamp: {
764
+ readonly type: "integer";
765
+ };
766
+ readonly itemKey: {
767
+ readonly type: "string";
768
+ };
769
+ };
770
+ readonly required: readonly ["ep", "timestamp", "itemKey"];
771
+ readonly additionalProperties: false;
772
+ };
773
+ recentView: {
774
+ readonly type: "object";
775
+ readonly properties: {
776
+ readonly timestamp: {
777
+ readonly type: "integer";
778
+ };
779
+ readonly itemKey: {
780
+ readonly type: "string";
781
+ };
782
+ readonly isViewed: {
783
+ readonly anyOf: readonly [{
784
+ readonly type: "boolean";
785
+ }, {
786
+ readonly const: 0;
787
+ }, {
788
+ readonly const: 1;
789
+ }];
790
+ };
791
+ };
792
+ readonly required: readonly ["timestamp", "itemKey", "isViewed"];
793
+ readonly additionalProperties: false;
794
+ };
795
+ subscribe: {
796
+ readonly type: "object";
797
+ readonly properties: {
798
+ readonly itemKey: {
799
+ readonly anyOf: readonly [{
800
+ readonly type: "string";
801
+ }, {
802
+ readonly type: "null";
803
+ }];
804
+ };
805
+ readonly author: {
806
+ readonly anyOf: readonly [{
807
+ readonly type: "object";
808
+ }, {
809
+ readonly type: "string";
810
+ }, {
811
+ readonly type: "null";
812
+ }];
813
+ };
814
+ readonly type: {
815
+ readonly type: "string";
816
+ };
817
+ readonly key: {
818
+ readonly type: "string";
819
+ };
820
+ readonly plugin: {
821
+ readonly type: "string";
822
+ };
823
+ };
824
+ readonly required: readonly ["itemKey", "author", "type", "key", "plugin"];
825
+ readonly additionalProperties: false;
826
+ };
827
+ plugin: {
828
+ readonly type: "object";
829
+ readonly properties: {
830
+ readonly installerName: {
831
+ readonly type: "string";
832
+ };
833
+ readonly loaderName: {
834
+ readonly type: "string";
835
+ };
836
+ readonly pluginName: {
837
+ readonly type: "string";
838
+ };
839
+ readonly meta: {
840
+ readonly anyOf: readonly [{
841
+ readonly type: "object";
842
+ }, {
843
+ readonly type: "string";
844
+ }];
845
+ };
846
+ readonly enable: {
847
+ readonly anyOf: readonly [{
848
+ readonly type: "boolean";
849
+ }, {
850
+ readonly const: 0;
851
+ }, {
852
+ readonly const: 1;
853
+ }];
854
+ };
855
+ readonly installInput: {
856
+ readonly type: "string";
857
+ };
858
+ readonly displayName: {
859
+ readonly anyOf: readonly [{
860
+ readonly type: "string";
861
+ }, {
862
+ readonly type: "null";
863
+ }];
864
+ };
865
+ };
866
+ readonly required: readonly ["installerName", "loaderName", "pluginName", "meta", "enable", "installInput", "displayName"];
867
+ readonly additionalProperties: false;
868
+ };
869
+ nativeStore: {
870
+ readonly type: "object";
871
+ readonly properties: {
872
+ readonly namespace: {
873
+ readonly type: "string";
874
+ };
875
+ readonly key: {
876
+ readonly type: "string";
877
+ };
878
+ readonly value: {
879
+ readonly type: "string";
880
+ };
881
+ };
882
+ readonly required: readonly ["namespace", "key", "value"];
883
+ readonly additionalProperties: false;
884
+ };
885
+ config: {
886
+ readonly type: "object";
887
+ readonly properties: {
888
+ readonly belongTo: {
889
+ readonly type: "string";
890
+ };
891
+ readonly form: {
892
+ readonly type: "string";
893
+ };
894
+ readonly data: {
895
+ readonly type: "string";
896
+ };
897
+ };
898
+ readonly required: readonly ["belongTo", "form", "data"];
899
+ readonly additionalProperties: false;
900
+ };
901
+ }[K];
902
+ /** Validates a row before writing; throws to block invalid data from persisting. */
903
+ declare const assertWrite: <T>(schema: TSchema, table: string, value: T) => T;
904
+ declare const assertWriteRow: <K extends ClientTableName, T>(table: K, value: T) => T;
905
+ /** Validates a row on read; failures are non-intrusive: logged and the value returned as-is. */
906
+ declare const validateRead: <T>(schema: TSchema, table: string, value: T) => T;
907
+ declare const validateReadRow: <K extends ClientTableName, T>(table: K, value: T) => T;
908
+ /** Filters invalid rows on read; failures are non-intrusive: logged and the row dropped. */
909
+ declare const filterValidRows: <T>(schema: TSchema, table: string, rows: readonly T[]) => T[];
910
+ declare const filterValidRowsFor: <K extends ClientTableName, T>(table: K, rows: readonly T[]) => T[];
471
911
  //#endregion
472
912
  //#region lib/index.d.ts
473
913
  interface DB {
@@ -477,12 +917,12 @@ interface DB {
477
917
  history: Table$4;
478
918
  recentView: Table$2;
479
919
  subscribe: Table$1;
480
- plugin: Table$5;
920
+ plugin: PluginTable;
481
921
  nativeStore: Table;
482
922
  config: Table$3;
483
923
  }
484
924
  declare const isTauriRuntime: typeof isTauri;
485
- declare const db: Kysely<DB>;
925
+ declare const db: Kysely$1<DB>;
486
926
  //#endregion
487
- export { config_d_exports as ConfigDB, DB, utils_d_exports as DBUtils, favourite_d_exports as FavouriteDB, history_d_exports as HistoryDB, itemStore_d_exports as ItemStoreDB, plugin_d_exports as PluginArchiveDB, recentView_d_exports as RecentDB, subscribe_d_exports as SubscribeDB, Table, db, isTauriRuntime, useConfig, useNativeStore };
927
+ export { ClientTableName, config_d_exports as ConfigDB, DB, utils_d_exports as DBUtils, favourite_d_exports as FavouriteDB, history_d_exports as HistoryDB, type InsertObject, itemStore_d_exports as ItemStoreDB, type Kysely, plugin_d_exports as PluginArchiveDB, type PluginTable, recentView_d_exports as RecentDB, subscribe_d_exports as SubscribeDB, Table, WriteValidationPlugin, assertWrite, assertWriteRow, db, filterValidRows, filterValidRowsFor, isTauriRuntime, tableSchema, useConfig, useNativeStore, validateRead, validateReadRow };
488
928
  //# sourceMappingURL=index.d.mts.map