@delta-comic/db 1.3.0 → 1.3.1
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/lib/favourite.d.ts +100 -0
- package/dist/lib/history.d.ts +60 -0
- package/dist/lib/index.d.ts +25 -0
- package/dist/lib/itemStore.d.ts +37 -0
- package/dist/lib/migrations/1_initial.d.ts +8 -0
- package/dist/lib/migrations/2_fix-display_name.d.ts +8 -0
- package/dist/lib/migrations/3_fix_fvi_foreign_key.d.ts +8 -0
- package/dist/lib/nativeStore/index.d.ts +2 -0
- package/dist/lib/plugin.d.ts +109 -0
- package/dist/lib/recentView.d.ts +59 -0
- package/dist/lib/subscribe.d.ts +75 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/pack.tgz +0 -0
- package/package.json +3 -3
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Kysely, Selectable, SelectQueryBuilder } from 'kysely';
|
|
2
|
+
import { CommonQueryKey } from './utils';
|
|
3
|
+
import { DB } from '.';
|
|
4
|
+
import * as ItemStoreDB from './itemStore';
|
|
5
|
+
export interface CardTable {
|
|
6
|
+
title: string;
|
|
7
|
+
private: boolean;
|
|
8
|
+
description: string;
|
|
9
|
+
/** @description primary key */
|
|
10
|
+
createAt: number;
|
|
11
|
+
}
|
|
12
|
+
export type Card = Selectable<CardTable>;
|
|
13
|
+
export interface ItemTable {
|
|
14
|
+
itemKey: string;
|
|
15
|
+
/** @description foreign key */
|
|
16
|
+
belongTo: CardTable['createAt'];
|
|
17
|
+
addTime: number;
|
|
18
|
+
}
|
|
19
|
+
export type Item = Selectable<ItemTable>;
|
|
20
|
+
export declare enum QueryKey {
|
|
21
|
+
item = "db:favouriteItem:",
|
|
22
|
+
card = "db:favouriteCard:"
|
|
23
|
+
}
|
|
24
|
+
export declare const useUpsertItem: () => {
|
|
25
|
+
upsert: (vars: {
|
|
26
|
+
item: ItemStoreDB.StorableItem;
|
|
27
|
+
belongTos: Item["belongTo"][];
|
|
28
|
+
trx?: Kysely<DB>;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
key: (CommonQueryKey | ItemStoreDB.QueryKey | QueryKey)[];
|
|
31
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
32
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
33
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
34
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
35
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
36
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
37
|
+
variables: import('vue').ShallowRef<{
|
|
38
|
+
item: ItemStoreDB.StorableItem;
|
|
39
|
+
belongTos: Item["belongTo"][];
|
|
40
|
+
trx?: Kysely<DB>;
|
|
41
|
+
} | undefined>;
|
|
42
|
+
mutate: (vars: {
|
|
43
|
+
item: ItemStoreDB.StorableItem;
|
|
44
|
+
belongTos: Item["belongTo"][];
|
|
45
|
+
trx?: Kysely<DB>;
|
|
46
|
+
}) => void;
|
|
47
|
+
reset: () => void;
|
|
48
|
+
};
|
|
49
|
+
export declare const useMoveItem: () => {
|
|
50
|
+
move: (vars: {
|
|
51
|
+
item: ItemStoreDB.StorableItem;
|
|
52
|
+
from: Item["belongTo"];
|
|
53
|
+
aims: Item["belongTo"][];
|
|
54
|
+
trx?: Kysely<DB>;
|
|
55
|
+
}) => Promise<void>;
|
|
56
|
+
key: QueryKey[];
|
|
57
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
58
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
59
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
60
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
61
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
62
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
63
|
+
variables: import('vue').ShallowRef<{
|
|
64
|
+
item: ItemStoreDB.StorableItem;
|
|
65
|
+
from: Item["belongTo"];
|
|
66
|
+
aims: Item["belongTo"][];
|
|
67
|
+
trx?: Kysely<DB>;
|
|
68
|
+
} | undefined>;
|
|
69
|
+
mutate: (vars: {
|
|
70
|
+
item: ItemStoreDB.StorableItem;
|
|
71
|
+
from: Item["belongTo"];
|
|
72
|
+
aims: Item["belongTo"][];
|
|
73
|
+
trx?: Kysely<DB>;
|
|
74
|
+
}) => void;
|
|
75
|
+
reset: () => void;
|
|
76
|
+
};
|
|
77
|
+
export declare const useCreateCard: () => {
|
|
78
|
+
createCard: (vars: {
|
|
79
|
+
card: Card;
|
|
80
|
+
trx?: Kysely<DB>;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
key: QueryKey[];
|
|
83
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
84
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
85
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
86
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
87
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
88
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
89
|
+
variables: import('vue').ShallowRef<{
|
|
90
|
+
card: Card;
|
|
91
|
+
trx?: Kysely<DB>;
|
|
92
|
+
} | undefined>;
|
|
93
|
+
mutate: (vars: {
|
|
94
|
+
card: Card;
|
|
95
|
+
trx?: Kysely<DB>;
|
|
96
|
+
}) => void;
|
|
97
|
+
reset: () => void;
|
|
98
|
+
};
|
|
99
|
+
export declare const useQueryItem: <T>(query: (db: SelectQueryBuilder<DB, "favouriteItem", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
100
|
+
export declare const useQueryCard: <T>(query: (db: SelectQueryBuilder<DB, "favouriteCard", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { uni } from '@delta-comic/model';
|
|
2
|
+
import { JSONColumnType, Kysely, Selectable, SelectQueryBuilder } from 'kysely';
|
|
3
|
+
import { CommonQueryKey } from './utils';
|
|
4
|
+
import { DB } from '.';
|
|
5
|
+
import * as ItemStoreDB from './itemStore';
|
|
6
|
+
export interface Table {
|
|
7
|
+
/** @description primary key */
|
|
8
|
+
timestamp: number;
|
|
9
|
+
itemKey: string;
|
|
10
|
+
ep: JSONColumnType<uni.ep.RawEp>;
|
|
11
|
+
}
|
|
12
|
+
export type Item = Selectable<Table>;
|
|
13
|
+
export declare enum QueryKey {
|
|
14
|
+
item = "db:history:"
|
|
15
|
+
}
|
|
16
|
+
export declare const useUpsert: () => {
|
|
17
|
+
upsert: (vars: {
|
|
18
|
+
item: ItemStoreDB.StorableItem;
|
|
19
|
+
trx?: Kysely<DB>;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
key: (CommonQueryKey | ItemStoreDB.QueryKey | QueryKey)[];
|
|
22
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
23
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
24
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
25
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
26
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
27
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
28
|
+
variables: import('vue').ShallowRef<{
|
|
29
|
+
item: ItemStoreDB.StorableItem;
|
|
30
|
+
trx?: Kysely<DB>;
|
|
31
|
+
} | undefined>;
|
|
32
|
+
mutate: (vars: {
|
|
33
|
+
item: ItemStoreDB.StorableItem;
|
|
34
|
+
trx?: Kysely<DB>;
|
|
35
|
+
}) => void;
|
|
36
|
+
reset: () => void;
|
|
37
|
+
};
|
|
38
|
+
export declare const useRemove: () => {
|
|
39
|
+
remove: (vars: {
|
|
40
|
+
keys: Item["timestamp"][];
|
|
41
|
+
trx?: Kysely<DB>;
|
|
42
|
+
}) => Promise<void>;
|
|
43
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
44
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
45
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
46
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
47
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
48
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
49
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
50
|
+
variables: import('vue').ShallowRef<{
|
|
51
|
+
keys: Item["timestamp"][];
|
|
52
|
+
trx?: Kysely<DB>;
|
|
53
|
+
} | undefined>;
|
|
54
|
+
mutate: (vars: {
|
|
55
|
+
keys: Item["timestamp"][];
|
|
56
|
+
trx?: Kysely<DB>;
|
|
57
|
+
}) => void;
|
|
58
|
+
reset: () => void;
|
|
59
|
+
};
|
|
60
|
+
export declare const useQuery: <T>(query: (db: SelectQueryBuilder<DB, "history", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Kysely } from 'kysely';
|
|
2
|
+
import type * as FavouriteDB from './favourite';
|
|
3
|
+
export * as PluginArchiveDB from './plugin';
|
|
4
|
+
import type * as HistoryDB from './history';
|
|
5
|
+
export * as FavouriteDB from './favourite';
|
|
6
|
+
import type * as ItemStoreDB from './itemStore';
|
|
7
|
+
export * as HistoryDB from './history';
|
|
8
|
+
import type * as PluginArchiveDB from './plugin';
|
|
9
|
+
export * as ItemStoreDB from './itemStore';
|
|
10
|
+
import type * as RecentDB from './recentView';
|
|
11
|
+
export * as SubscribeDB from './subscribe';
|
|
12
|
+
import type * as SubscribeDB from './subscribe';
|
|
13
|
+
export * as RecentDB from './recentView';
|
|
14
|
+
export interface DB {
|
|
15
|
+
itemStore: ItemStoreDB.Table;
|
|
16
|
+
favouriteCard: FavouriteDB.CardTable;
|
|
17
|
+
favouriteItem: FavouriteDB.ItemTable;
|
|
18
|
+
history: HistoryDB.Table;
|
|
19
|
+
recentView: RecentDB.Table;
|
|
20
|
+
subscribe: SubscribeDB.Table;
|
|
21
|
+
plugin: PluginArchiveDB.Table;
|
|
22
|
+
}
|
|
23
|
+
export declare const db: Kysely<DB>;
|
|
24
|
+
export * as DBUtils from './utils';
|
|
25
|
+
export * from './nativeStore';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SourcedValue, uni } from '@delta-comic/model';
|
|
2
|
+
import { JSONColumnType, Kysely, Selectable } from 'kysely';
|
|
3
|
+
import { CommonQueryKey } from './utils';
|
|
4
|
+
import { DB } from '.';
|
|
5
|
+
export interface Table {
|
|
6
|
+
/** @description primary key */
|
|
7
|
+
key: string;
|
|
8
|
+
item: JSONColumnType<uni.item.RawItem>;
|
|
9
|
+
}
|
|
10
|
+
export type StorableItem = uni.item.Item | uni.item.RawItem;
|
|
11
|
+
export type StoredItem = Selectable<Table>;
|
|
12
|
+
export declare const itemKey: SourcedValue<[string, string]>;
|
|
13
|
+
export declare enum QueryKey {
|
|
14
|
+
item = "db:itemStore:"
|
|
15
|
+
}
|
|
16
|
+
export declare const useUpsert: () => {
|
|
17
|
+
upsert: (vars: {
|
|
18
|
+
item: StorableItem;
|
|
19
|
+
trx?: Kysely<DB>;
|
|
20
|
+
}) => Promise<string>;
|
|
21
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
22
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<string, Error, undefined>>;
|
|
23
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
24
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
25
|
+
data: import('vue').ShallowRef<string | undefined>;
|
|
26
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
27
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
28
|
+
variables: import('vue').ShallowRef<{
|
|
29
|
+
item: StorableItem;
|
|
30
|
+
trx?: Kysely<DB>;
|
|
31
|
+
} | undefined>;
|
|
32
|
+
mutate: (vars: {
|
|
33
|
+
item: StorableItem;
|
|
34
|
+
trx?: Kysely<DB>;
|
|
35
|
+
}) => void;
|
|
36
|
+
reset: () => void;
|
|
37
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { JSONColumnType, Kysely, Selectable, SelectQueryBuilder } from 'kysely';
|
|
2
|
+
import { CommonQueryKey } from './utils';
|
|
3
|
+
import { DB } from '.';
|
|
4
|
+
export interface Meta {
|
|
5
|
+
name: {
|
|
6
|
+
display: string;
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
version: {
|
|
10
|
+
plugin: string;
|
|
11
|
+
supportCore: string;
|
|
12
|
+
};
|
|
13
|
+
author: string;
|
|
14
|
+
description: string;
|
|
15
|
+
require: {
|
|
16
|
+
id: string;
|
|
17
|
+
download?: string | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
entry?: {
|
|
20
|
+
jsPath: string;
|
|
21
|
+
cssPath?: string;
|
|
22
|
+
};
|
|
23
|
+
beforeBoot?: {
|
|
24
|
+
path: string;
|
|
25
|
+
slot: string;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
export interface Table {
|
|
29
|
+
installerName: string;
|
|
30
|
+
loaderName: string;
|
|
31
|
+
/** @description primary key */
|
|
32
|
+
pluginName: string;
|
|
33
|
+
meta: JSONColumnType<Meta>;
|
|
34
|
+
enable: boolean;
|
|
35
|
+
installInput: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
}
|
|
38
|
+
/** @description Not Blue */
|
|
39
|
+
export type Archive = Selectable<Table>;
|
|
40
|
+
export declare enum QueryKey {
|
|
41
|
+
item = "db:plugin:"
|
|
42
|
+
}
|
|
43
|
+
export declare const useUpsert: () => {
|
|
44
|
+
upsert: (vars: {
|
|
45
|
+
archives: Archive[];
|
|
46
|
+
trx?: Kysely<DB>;
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
49
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
50
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
51
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
52
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
53
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
54
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
55
|
+
variables: import('vue').ShallowRef<{
|
|
56
|
+
archives: Archive[];
|
|
57
|
+
trx?: Kysely<DB>;
|
|
58
|
+
} | undefined>;
|
|
59
|
+
mutate: (vars: {
|
|
60
|
+
archives: Archive[];
|
|
61
|
+
trx?: Kysely<DB>;
|
|
62
|
+
}) => void;
|
|
63
|
+
reset: () => void;
|
|
64
|
+
};
|
|
65
|
+
export declare const useRemove: () => {
|
|
66
|
+
remove: (vars: {
|
|
67
|
+
keys: Archive["pluginName"][];
|
|
68
|
+
trx?: Kysely<DB>;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
71
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
72
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
73
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
74
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
75
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
76
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
77
|
+
variables: import('vue').ShallowRef<{
|
|
78
|
+
keys: Archive["pluginName"][];
|
|
79
|
+
trx?: Kysely<DB>;
|
|
80
|
+
} | undefined>;
|
|
81
|
+
mutate: (vars: {
|
|
82
|
+
keys: Archive["pluginName"][];
|
|
83
|
+
trx?: Kysely<DB>;
|
|
84
|
+
}) => void;
|
|
85
|
+
reset: () => void;
|
|
86
|
+
};
|
|
87
|
+
export declare const useToggleEnable: () => {
|
|
88
|
+
toggle: (vars: {
|
|
89
|
+
keys: Archive["pluginName"][];
|
|
90
|
+
trx?: Kysely<DB>;
|
|
91
|
+
}) => Promise<import('kysely').UpdateResult[] | undefined>;
|
|
92
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
93
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<import('kysely').UpdateResult[] | undefined, Error, undefined>>;
|
|
94
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
95
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
96
|
+
data: import('vue').ShallowRef<import('kysely').UpdateResult[] | undefined>;
|
|
97
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
98
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
99
|
+
variables: import('vue').ShallowRef<{
|
|
100
|
+
keys: Archive["pluginName"][];
|
|
101
|
+
trx?: Kysely<DB>;
|
|
102
|
+
} | undefined>;
|
|
103
|
+
mutate: (vars: {
|
|
104
|
+
keys: Archive["pluginName"][];
|
|
105
|
+
trx?: Kysely<DB>;
|
|
106
|
+
}) => void;
|
|
107
|
+
reset: () => void;
|
|
108
|
+
};
|
|
109
|
+
export declare const useQuery: <T>(query: (db: SelectQueryBuilder<DB, "plugin", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Kysely, Selectable, SelectQueryBuilder } from 'kysely';
|
|
2
|
+
import { CommonQueryKey } from './utils';
|
|
3
|
+
import { DB } from '.';
|
|
4
|
+
import * as ItemStoreDB from './itemStore';
|
|
5
|
+
export interface Table {
|
|
6
|
+
/** @description primary key */
|
|
7
|
+
timestamp: number;
|
|
8
|
+
itemKey: string;
|
|
9
|
+
isViewed: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type Item = Selectable<Table>;
|
|
12
|
+
export declare enum QueryKey {
|
|
13
|
+
item = "db:recentView:"
|
|
14
|
+
}
|
|
15
|
+
export declare const useUpsert: () => {
|
|
16
|
+
upsert: (vars: {
|
|
17
|
+
item: ItemStoreDB.StorableItem;
|
|
18
|
+
trx?: Kysely<DB>;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
key: (CommonQueryKey | ItemStoreDB.QueryKey | QueryKey)[];
|
|
21
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
22
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
23
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
24
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
25
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
26
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
27
|
+
variables: import('vue').ShallowRef<{
|
|
28
|
+
item: ItemStoreDB.StorableItem;
|
|
29
|
+
trx?: Kysely<DB>;
|
|
30
|
+
} | undefined>;
|
|
31
|
+
mutate: (vars: {
|
|
32
|
+
item: ItemStoreDB.StorableItem;
|
|
33
|
+
trx?: Kysely<DB>;
|
|
34
|
+
}) => void;
|
|
35
|
+
reset: () => void;
|
|
36
|
+
};
|
|
37
|
+
export declare const useRemove: () => {
|
|
38
|
+
remove: (vars: {
|
|
39
|
+
items: Item["timestamp"][];
|
|
40
|
+
trx?: Kysely<DB>;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
43
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
44
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
45
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
46
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
47
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
48
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
49
|
+
variables: import('vue').ShallowRef<{
|
|
50
|
+
items: Item["timestamp"][];
|
|
51
|
+
trx?: Kysely<DB>;
|
|
52
|
+
} | undefined>;
|
|
53
|
+
mutate: (vars: {
|
|
54
|
+
items: Item["timestamp"][];
|
|
55
|
+
trx?: Kysely<DB>;
|
|
56
|
+
}) => void;
|
|
57
|
+
reset: () => void;
|
|
58
|
+
};
|
|
59
|
+
export declare const useQuery: <T>(query: (db: SelectQueryBuilder<DB, "recentView", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { SourcedValue, SourcedKeyType, uni } from '@delta-comic/model';
|
|
2
|
+
import { JSONColumnType, Kysely, Selectable, SelectQueryBuilder } from 'kysely';
|
|
3
|
+
import { CommonQueryKey } from './utils';
|
|
4
|
+
import { DB } from '.';
|
|
5
|
+
export declare const key: SourcedValue<[plugin: string, label: string]>;
|
|
6
|
+
export type Key_ = SourcedKeyType<typeof key>;
|
|
7
|
+
export type Key = Exclude<Key_, string>;
|
|
8
|
+
export interface AuthorTable {
|
|
9
|
+
author: JSONColumnType<uni.item.Author>;
|
|
10
|
+
itemKey: null;
|
|
11
|
+
type: 'author';
|
|
12
|
+
/** @description primary key */
|
|
13
|
+
key: string;
|
|
14
|
+
plugin: string;
|
|
15
|
+
}
|
|
16
|
+
export type AuthorItem = Selectable<AuthorTable>;
|
|
17
|
+
export interface EpTable {
|
|
18
|
+
author: null;
|
|
19
|
+
itemKey: string;
|
|
20
|
+
type: 'ep';
|
|
21
|
+
/** @description primary key */
|
|
22
|
+
key: string;
|
|
23
|
+
plugin: string;
|
|
24
|
+
}
|
|
25
|
+
export type EpItem = Selectable<EpTable>;
|
|
26
|
+
export type Table = AuthorTable | EpTable;
|
|
27
|
+
export type Item = AuthorItem | EpItem;
|
|
28
|
+
export declare enum QueryKey {
|
|
29
|
+
item = "db:subscribe:"
|
|
30
|
+
}
|
|
31
|
+
export declare const useUpsert: () => {
|
|
32
|
+
upsert: (vars: {
|
|
33
|
+
items: Item[];
|
|
34
|
+
trx?: Kysely<DB>;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
37
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
38
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
39
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
40
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
41
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
42
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
43
|
+
variables: import('vue').ShallowRef<{
|
|
44
|
+
items: Item[];
|
|
45
|
+
trx?: Kysely<DB>;
|
|
46
|
+
} | undefined>;
|
|
47
|
+
mutate: (vars: {
|
|
48
|
+
items: Item[];
|
|
49
|
+
trx?: Kysely<DB>;
|
|
50
|
+
}) => void;
|
|
51
|
+
reset: () => void;
|
|
52
|
+
};
|
|
53
|
+
export declare const useRemove: () => {
|
|
54
|
+
remove: (vars: {
|
|
55
|
+
keys: Item["key"][];
|
|
56
|
+
trx?: Kysely<DB>;
|
|
57
|
+
}) => Promise<void>;
|
|
58
|
+
key: (CommonQueryKey | QueryKey)[];
|
|
59
|
+
state: import('vue').ComputedRef<import('@pinia/colada').DataState<void, Error, undefined>>;
|
|
60
|
+
status: import('vue').ShallowRef<import('@pinia/colada').DataStateStatus>;
|
|
61
|
+
asyncStatus: import('vue').ShallowRef<import('@pinia/colada').AsyncStatus>;
|
|
62
|
+
data: import('vue').ShallowRef<void | undefined>;
|
|
63
|
+
error: import('vue').ShallowRef<Error | null>;
|
|
64
|
+
isLoading: import('vue').ComputedRef<boolean>;
|
|
65
|
+
variables: import('vue').ShallowRef<{
|
|
66
|
+
keys: Item["key"][];
|
|
67
|
+
trx?: Kysely<DB>;
|
|
68
|
+
} | undefined>;
|
|
69
|
+
mutate: (vars: {
|
|
70
|
+
keys: Item["key"][];
|
|
71
|
+
trx?: Kysely<DB>;
|
|
72
|
+
}) => void;
|
|
73
|
+
reset: () => void;
|
|
74
|
+
};
|
|
75
|
+
export declare const useQuery: <T>(query: (db: SelectQueryBuilder<DB, "subscribe", {}>) => Promise<T>, otherKeys?: any[], initialData?: () => T) => import('@pinia/colada').UseQueryReturn<T, Error, T>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Kysely, SelectQueryBuilder } from 'kysely';
|
|
2
|
+
import { DB } from '.';
|
|
3
|
+
export declare const withTransition: <T>(handler: (trx: Kysely<DB>) => Promise<T>, trx?: Kysely<DB>) => Promise<T>;
|
|
4
|
+
export declare function countDb(sql: SelectQueryBuilder<DB, any, object>): Promise<number>;
|
|
5
|
+
export declare enum CommonQueryKey {
|
|
6
|
+
common = "db"
|
|
7
|
+
}
|
package/dist/pack.tgz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delta-comic/db",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "空阙虱楼",
|
|
5
5
|
"homepage": "https://github.com/delta-comic/delta-comic",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"kysely": "^0.28",
|
|
46
46
|
"vue": "^3.5",
|
|
47
|
-
"@delta-comic/model": "1.3.
|
|
48
|
-
"@delta-comic/utils": "1.3.
|
|
47
|
+
"@delta-comic/model": "1.3.1",
|
|
48
|
+
"@delta-comic/utils": "1.3.1"
|
|
49
49
|
},
|
|
50
50
|
"release": {
|
|
51
51
|
"tagFormat": "db-${version}"
|