1 | import { IRepoPlugin, IKeyValue, IModel, Repo, ICoordinator, ICoordinatorOptions, PluginEventType, IFinderPlugin, IModelMapper } from 'typestore';
|
2 | import { IndexedDBPlugin } from "./IndexedDBPlugin";
|
3 | import Dexie from "dexie";
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare class IndexedDBKeyValue implements IKeyValue {
|
12 | args: any[];
|
13 | indexedDBKey: boolean;
|
14 | constructor(...args: any[]);
|
15 | }
|
16 | export declare class IndexedDBRepoPlugin<M extends IModel> implements IRepoPlugin<M>, IFinderPlugin {
|
17 | private store;
|
18 | repo: Repo<M>;
|
19 | type: number;
|
20 | supportedModels: any[];
|
21 | private coordinator;
|
22 | private keys;
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | constructor(store: IndexedDBPlugin, repo: Repo<M>);
|
31 | /**
|
32 | * Create a finder method with descriptor
|
33 | * and signature
|
34 | *
|
35 | * @param repo
|
36 | * @param finderKey
|
37 | * @returns {any}
|
38 | */
|
39 | decorateFinder(repo: Repo<any>, finderKey: string): (...args: any[]) => Promise<M | M[]>;
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | handle(eventType: PluginEventType, ...args: any[]): boolean | any;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 | readonly mapper: IModelMapper<M>;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 | readonly table: Dexie.Table<any, any>;
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 | readonly db: Dexie;
|
66 | init(coordinator: ICoordinator, opts: ICoordinatorOptions): Promise<ICoordinator>;
|
67 | start(): Promise<ICoordinator>;
|
68 | stop(): Promise<ICoordinator>;
|
69 | key(...args: any[]): IndexedDBKeyValue;
|
70 | keyFromObject(o: any): IndexedDBKeyValue;
|
71 | dbKeyFromKey(key: IndexedDBKeyValue): any;
|
72 | get(key: IndexedDBKeyValue): Promise<M>;
|
73 | save(model: M): Promise<M>;
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | remove(key: IndexedDBKeyValue): Promise<any>;
|
81 | count(): Promise<number>;
|
82 | |
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | bulkGet(...keys: IndexedDBKeyValue[]): Promise<M[]>;
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | bulkSave(...models: M[]): Promise<M[]>;
|
96 | |
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | bulkRemove(...keys: IndexedDBKeyValue[]): Promise<any[]>;
|
103 | }
|