@xylabs/indexed-db 4.12.44 → 4.13.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/browser/index.d.ts +81 -0
- package/dist/neutral/index.d.ts +81 -0
- package/dist/node/index.d.ts +81 -0
- package/package.json +11 -11
- package/dist/types/IndexDescription.d.ts +0 -30
- package/dist/types/IndexDescription.d.ts.map +0 -1
- package/dist/types/IndexedDbKeyValueStore.d.ts +0 -17
- package/dist/types/IndexedDbKeyValueStore.d.ts.map +0 -1
- package/dist/types/ObjectStore.d.ts +0 -5
- package/dist/types/ObjectStore.d.ts.map +0 -1
- package/dist/types/checkDbNeedsUpgrade.d.ts +0 -4
- package/dist/types/checkDbNeedsUpgrade.d.ts.map +0 -1
- package/dist/types/checkStoreNeedsUpgrade.d.ts +0 -6
- package/dist/types/checkStoreNeedsUpgrade.d.ts.map +0 -1
- package/dist/types/createStoreDuringUpgrade.d.ts +0 -5
- package/dist/types/createStoreDuringUpgrade.d.ts.map +0 -1
- package/dist/types/getExistingIndexes.d.ts +0 -7
- package/dist/types/getExistingIndexes.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/withDb.d.ts +0 -6
- package/dist/types/withDb.d.ts.map +0 -1
- package/dist/types/withDbByVersion.d.ts +0 -6
- package/dist/types/withDbByVersion.d.ts.map +0 -1
- package/dist/types/withReadOnlyStore.d.ts +0 -6
- package/dist/types/withReadOnlyStore.d.ts.map +0 -1
- package/dist/types/withReadWriteStore.d.ts +0 -6
- package/dist/types/withReadWriteStore.d.ts.map +0 -1
- package/dist/types/withStore.d.ts +0 -8
- package/dist/types/withStore.d.ts.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { DBSchema } from 'idb';
|
|
2
|
+
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
+
import type { IDBPDatabase } from 'idb';
|
|
4
|
+
import type { IDBPObjectStore } from 'idb';
|
|
5
|
+
import type { KeyValueStore } from '@xylabs/storage';
|
|
6
|
+
import type { Logger } from '@xylabs/logger';
|
|
7
|
+
import type { StoreKey } from 'idb';
|
|
8
|
+
import type { StoreNames } from 'idb';
|
|
9
|
+
import type { StoreValue } from 'idb';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Given an index description, this will build the index
|
|
13
|
+
* name in standard form
|
|
14
|
+
* @param index The index description
|
|
15
|
+
* @returns The index name in standard form
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
18
|
+
|
|
19
|
+
export declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
20
|
+
|
|
21
|
+
export declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
22
|
+
|
|
23
|
+
export declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Description of index(es) to be created on a store
|
|
27
|
+
*/
|
|
28
|
+
export declare type IndexDescription = {
|
|
29
|
+
/**
|
|
30
|
+
* The key(s) to index
|
|
31
|
+
*/
|
|
32
|
+
key: Record<string, IndexDirection>;
|
|
33
|
+
/**
|
|
34
|
+
* Is the indexed value an array
|
|
35
|
+
*/
|
|
36
|
+
multiEntry?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If true, the index must enforce uniqueness on the key
|
|
39
|
+
*/
|
|
40
|
+
unique?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The index direction (1 for ascending, -1 for descending)
|
|
45
|
+
*/
|
|
46
|
+
export declare type IndexDirection = -1 | 1;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An IndexedDB key/value store.
|
|
50
|
+
*/
|
|
51
|
+
export declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
52
|
+
readonly dbName: string;
|
|
53
|
+
readonly storeName: S;
|
|
54
|
+
constructor(dbName: string, storeName: S);
|
|
55
|
+
clear?(): Promise<void>;
|
|
56
|
+
delete(key: StoreKey<T, S>): Promise<void>;
|
|
57
|
+
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
58
|
+
keys?(): Promise<StoreKey<T, S>[]>;
|
|
59
|
+
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
60
|
+
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const IndexSeparator = "-";
|
|
64
|
+
|
|
65
|
+
export declare interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
66
|
+
[s: string]: T;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function withDb<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
70
|
+
|
|
71
|
+
export declare function withDbByVersion<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
72
|
+
|
|
73
|
+
export declare function withReadOnlyStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readonly'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
74
|
+
|
|
75
|
+
export declare function withReadWriteStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readwrite'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
76
|
+
|
|
77
|
+
export declare function withStore<T extends EmptyObject = EmptyObject, R = T, M extends 'readonly' | 'readwrite' = 'readonly'>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [
|
|
78
|
+
StoreNames<ObjectStore<T>>
|
|
79
|
+
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
80
|
+
|
|
81
|
+
export { }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { DBSchema } from 'idb';
|
|
2
|
+
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
+
import type { IDBPDatabase } from 'idb';
|
|
4
|
+
import type { IDBPObjectStore } from 'idb';
|
|
5
|
+
import type { KeyValueStore } from '@xylabs/storage';
|
|
6
|
+
import type { Logger } from '@xylabs/logger';
|
|
7
|
+
import type { StoreKey } from 'idb';
|
|
8
|
+
import type { StoreNames } from 'idb';
|
|
9
|
+
import type { StoreValue } from 'idb';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Given an index description, this will build the index
|
|
13
|
+
* name in standard form
|
|
14
|
+
* @param index The index description
|
|
15
|
+
* @returns The index name in standard form
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
18
|
+
|
|
19
|
+
export declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
20
|
+
|
|
21
|
+
export declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
22
|
+
|
|
23
|
+
export declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Description of index(es) to be created on a store
|
|
27
|
+
*/
|
|
28
|
+
export declare type IndexDescription = {
|
|
29
|
+
/**
|
|
30
|
+
* The key(s) to index
|
|
31
|
+
*/
|
|
32
|
+
key: Record<string, IndexDirection>;
|
|
33
|
+
/**
|
|
34
|
+
* Is the indexed value an array
|
|
35
|
+
*/
|
|
36
|
+
multiEntry?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If true, the index must enforce uniqueness on the key
|
|
39
|
+
*/
|
|
40
|
+
unique?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The index direction (1 for ascending, -1 for descending)
|
|
45
|
+
*/
|
|
46
|
+
export declare type IndexDirection = -1 | 1;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An IndexedDB key/value store.
|
|
50
|
+
*/
|
|
51
|
+
export declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
52
|
+
readonly dbName: string;
|
|
53
|
+
readonly storeName: S;
|
|
54
|
+
constructor(dbName: string, storeName: S);
|
|
55
|
+
clear?(): Promise<void>;
|
|
56
|
+
delete(key: StoreKey<T, S>): Promise<void>;
|
|
57
|
+
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
58
|
+
keys?(): Promise<StoreKey<T, S>[]>;
|
|
59
|
+
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
60
|
+
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const IndexSeparator = "-";
|
|
64
|
+
|
|
65
|
+
export declare interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
66
|
+
[s: string]: T;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function withDb<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
70
|
+
|
|
71
|
+
export declare function withDbByVersion<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
72
|
+
|
|
73
|
+
export declare function withReadOnlyStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readonly'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
74
|
+
|
|
75
|
+
export declare function withReadWriteStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readwrite'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
76
|
+
|
|
77
|
+
export declare function withStore<T extends EmptyObject = EmptyObject, R = T, M extends 'readonly' | 'readwrite' = 'readonly'>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [
|
|
78
|
+
StoreNames<ObjectStore<T>>
|
|
79
|
+
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
80
|
+
|
|
81
|
+
export { }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { DBSchema } from 'idb';
|
|
2
|
+
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
+
import type { IDBPDatabase } from 'idb';
|
|
4
|
+
import type { IDBPObjectStore } from 'idb';
|
|
5
|
+
import type { KeyValueStore } from '@xylabs/storage';
|
|
6
|
+
import type { Logger } from '@xylabs/logger';
|
|
7
|
+
import type { StoreKey } from 'idb';
|
|
8
|
+
import type { StoreNames } from 'idb';
|
|
9
|
+
import type { StoreValue } from 'idb';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Given an index description, this will build the index
|
|
13
|
+
* name in standard form
|
|
14
|
+
* @param index The index description
|
|
15
|
+
* @returns The index name in standard form
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
18
|
+
|
|
19
|
+
export declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
20
|
+
|
|
21
|
+
export declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
22
|
+
|
|
23
|
+
export declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Description of index(es) to be created on a store
|
|
27
|
+
*/
|
|
28
|
+
export declare type IndexDescription = {
|
|
29
|
+
/**
|
|
30
|
+
* The key(s) to index
|
|
31
|
+
*/
|
|
32
|
+
key: Record<string, IndexDirection>;
|
|
33
|
+
/**
|
|
34
|
+
* Is the indexed value an array
|
|
35
|
+
*/
|
|
36
|
+
multiEntry?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* If true, the index must enforce uniqueness on the key
|
|
39
|
+
*/
|
|
40
|
+
unique?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The index direction (1 for ascending, -1 for descending)
|
|
45
|
+
*/
|
|
46
|
+
export declare type IndexDirection = -1 | 1;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An IndexedDB key/value store.
|
|
50
|
+
*/
|
|
51
|
+
export declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
52
|
+
readonly dbName: string;
|
|
53
|
+
readonly storeName: S;
|
|
54
|
+
constructor(dbName: string, storeName: S);
|
|
55
|
+
clear?(): Promise<void>;
|
|
56
|
+
delete(key: StoreKey<T, S>): Promise<void>;
|
|
57
|
+
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
58
|
+
keys?(): Promise<StoreKey<T, S>[]>;
|
|
59
|
+
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
60
|
+
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const IndexSeparator = "-";
|
|
64
|
+
|
|
65
|
+
export declare interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
66
|
+
[s: string]: T;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare function withDb<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
70
|
+
|
|
71
|
+
export declare function withDbByVersion<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
72
|
+
|
|
73
|
+
export declare function withReadOnlyStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readonly'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
74
|
+
|
|
75
|
+
export declare function withReadWriteStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readwrite'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
76
|
+
|
|
77
|
+
export declare function withStore<T extends EmptyObject = EmptyObject, R = T, M extends 'readonly' | 'readwrite' = 'readonly'>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [
|
|
78
|
+
StoreNames<ObjectStore<T>>
|
|
79
|
+
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
80
|
+
|
|
81
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/indexed-db",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.1",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hex",
|
|
@@ -29,36 +29,36 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"node": {
|
|
32
|
-
"types": "./dist/
|
|
32
|
+
"types": "./dist/node/index.d.ts",
|
|
33
33
|
"default": "./dist/node/index.mjs"
|
|
34
34
|
},
|
|
35
35
|
"browser": {
|
|
36
|
-
"types": "./dist/
|
|
36
|
+
"types": "./dist/browser/index.d.ts",
|
|
37
37
|
"default": "./dist/browser/index.mjs"
|
|
38
38
|
},
|
|
39
39
|
"neutral": {
|
|
40
|
-
"types": "./dist/
|
|
40
|
+
"types": "./dist/neutral/index.d.ts",
|
|
41
41
|
"default": "./dist/neutral/index.mjs"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"./package.json": "./package.json"
|
|
45
45
|
},
|
|
46
46
|
"module": "./dist/browser/index.mjs",
|
|
47
|
-
"types": "./dist/
|
|
47
|
+
"types": "./dist/browser/index.d.ts",
|
|
48
48
|
"workspaces": [
|
|
49
49
|
"packages/**/*"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@xylabs/exists": "^4.
|
|
53
|
-
"@xylabs/logger": "^4.
|
|
54
|
-
"@xylabs/object": "^4.
|
|
55
|
-
"@xylabs/storage": "^4.
|
|
52
|
+
"@xylabs/exists": "^4.13.1",
|
|
53
|
+
"@xylabs/logger": "^4.13.1",
|
|
54
|
+
"@xylabs/object": "^4.13.1",
|
|
55
|
+
"@xylabs/storage": "^4.13.1",
|
|
56
56
|
"async-mutex": "^0.5.0",
|
|
57
57
|
"idb": "^8.0.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
61
|
-
"@xylabs/tsconfig-dom": "^
|
|
60
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.7",
|
|
61
|
+
"@xylabs/tsconfig-dom": "^7.0.0-rc.7",
|
|
62
62
|
"fake-indexeddb": "^6.0.1",
|
|
63
63
|
"jsdom": "^26.1.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The index direction (1 for ascending, -1 for descending)
|
|
3
|
-
*/
|
|
4
|
-
export type IndexDirection = -1 | 1;
|
|
5
|
-
/**
|
|
6
|
-
* Description of index(es) to be created on a store
|
|
7
|
-
*/
|
|
8
|
-
export type IndexDescription = {
|
|
9
|
-
/**
|
|
10
|
-
* The key(s) to index
|
|
11
|
-
*/
|
|
12
|
-
key: Record<string, IndexDirection>;
|
|
13
|
-
/**
|
|
14
|
-
* Is the indexed value an array
|
|
15
|
-
*/
|
|
16
|
-
multiEntry?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* If true, the index must enforce uniqueness on the key
|
|
19
|
-
*/
|
|
20
|
-
unique?: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare const IndexSeparator = "-";
|
|
23
|
-
/**
|
|
24
|
-
* Given an index description, this will build the index
|
|
25
|
-
* name in standard form
|
|
26
|
-
* @param index The index description
|
|
27
|
-
* @returns The index name in standard form
|
|
28
|
-
*/
|
|
29
|
-
export declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
30
|
-
//# sourceMappingURL=IndexDescription.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndexDescription.d.ts","sourceRoot":"","sources":["../../src/IndexDescription.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAEnC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,cAAc,MAAM,CAAA;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,gBAAgB,WAK7D,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { KeyValueStore } from '@xylabs/storage';
|
|
2
|
-
import type { DBSchema, IDBPDatabase, StoreKey, StoreNames, StoreValue } from 'idb';
|
|
3
|
-
/**
|
|
4
|
-
* An IndexedDB key/value store.
|
|
5
|
-
*/
|
|
6
|
-
export declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
7
|
-
readonly dbName: string;
|
|
8
|
-
readonly storeName: S;
|
|
9
|
-
constructor(dbName: string, storeName: S);
|
|
10
|
-
clear?(): Promise<void>;
|
|
11
|
-
delete(key: StoreKey<T, S>): Promise<void>;
|
|
12
|
-
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
13
|
-
keys?(): Promise<StoreKey<T, S>[]>;
|
|
14
|
-
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
15
|
-
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=IndexedDbKeyValueStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedDbKeyValueStore.d.ts","sourceRoot":"","sources":["../../src/IndexedDbKeyValueStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAC/C,MAAM,KAAK,CAAA;AAIZ;;GAEG;AACH,qBAAa,sBAAsB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7H,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;gBAArC,MAAM,EAAE,MAAM,EAAW,SAAS,EAAE,CAAC;IAEpD,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAMvB,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAMvB,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAMlC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhE,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAC/B,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;CAMnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectStore.d.ts","sourceRoot":"","sources":["../../src/ObjectStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC9D,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAA;CACf"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
3
|
-
export declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
4
|
-
//# sourceMappingURL=checkDbNeedsUpgrade.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkDbNeedsUpgrade.d.ts","sourceRoot":"","sources":["../../src/checkDbNeedsUpgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,mBAUpH"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { IDBPDatabase } from 'idb';
|
|
3
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
4
|
-
import type { ObjectStore } from './ObjectStore.ts';
|
|
5
|
-
export declare function checkStoreNeedsUpgrade(db: IDBPDatabase<ObjectStore<object>>, storeName: string, indexes: IndexDescription[], logger?: Logger): Promise<boolean>;
|
|
6
|
-
//# sourceMappingURL=checkStoreNeedsUpgrade.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkStoreNeedsUpgrade.d.ts","sourceRoot":"","sources":["../../src/checkStoreNeedsUpgrade.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,oBAelJ"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { DBSchema, IDBPDatabase, StoreNames } from 'idb';
|
|
3
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
4
|
-
export declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
5
|
-
//# sourceMappingURL=createStoreDuringUpgrade.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStoreDuringUpgrade.d.ts","sourceRoot":"","sources":["../../src/createStoreDuringUpgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAA+B,UAAU,EACtD,MAAM,KAAK,CAAA;AAEZ,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAA;AAE9B,wBAAgB,wBAAwB,CAAC,OAAO,SAAS,QAAQ,GAAG,OAAO,GAAG,OAAO,EACnF,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EACzB,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,EAC9B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,MAAM,CAAC,EAAE,MAAM,QA4BhB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { IDBPDatabase, StoreNames } from 'idb';
|
|
4
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
5
|
-
import type { ObjectStore } from './ObjectStore.ts';
|
|
6
|
-
export declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
7
|
-
//# sourceMappingURL=getExistingIndexes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getExistingIndexes.d.ts","sourceRoot":"","sources":["../../src/getExistingIndexes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAiCnD,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC1E,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EACzC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAQpC"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './checkDbNeedsUpgrade.ts';
|
|
2
|
-
export * from './createStoreDuringUpgrade.ts';
|
|
3
|
-
export * from './getExistingIndexes.ts';
|
|
4
|
-
export * from './IndexDescription.ts';
|
|
5
|
-
export * from './IndexedDbKeyValueStore.ts';
|
|
6
|
-
export * from './ObjectStore.ts';
|
|
7
|
-
export * from './withDb.ts';
|
|
8
|
-
export * from './withDbByVersion.ts';
|
|
9
|
-
export * from './withReadOnlyStore.ts';
|
|
10
|
-
export * from './withReadWriteStore.ts';
|
|
11
|
-
export * from './withStore.ts';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,gBAAgB,CAAA"}
|
package/dist/types/withDb.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { DBSchema, IDBPDatabase } from 'idb';
|
|
4
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
5
|
-
export declare function withDb<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
6
|
-
//# sourceMappingURL=withDb.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withDb.d.ts","sourceRoot":"","sources":["../../src/withDb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAGjD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAK7D,wBAAsB,MAAM,CAAC,OAAO,SAAS,QAAQ,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EACxF,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACvD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EACpD,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,UAAO,GACV,OAAO,CAAC,CAAC,CAAC,CASZ"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { DBSchema, IDBPDatabase } from 'idb';
|
|
4
|
-
import { type IndexDescription } from './IndexDescription.ts';
|
|
5
|
-
export declare function withDbByVersion<DBTypes extends DBSchema | unknown = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
|
|
6
|
-
//# sourceMappingURL=withDbByVersion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withDbByVersion.d.ts","sourceRoot":"","sources":["../../src/withDbByVersion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,KAAK,EACV,QAAQ,EAAE,YAAY,EACvB,MAAM,KAAK,CAAA;AAIZ,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAIrF,wBAAsB,eAAe,CAAC,OAAO,SAAS,QAAQ,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EACjG,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACvD,OAAO,CAAC,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EACpD,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,UAAO,GACV,OAAO,CAAC,CAAC,CAAC,CAgDZ"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
|
|
4
|
-
import type { ObjectStore } from './ObjectStore.ts';
|
|
5
|
-
export declare function withReadOnlyStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readonly'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
6
|
-
//# sourceMappingURL=withReadOnlyStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withReadOnlyStore.d.ts","sourceRoot":"","sources":["../../src/withReadOnlyStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EAChF,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAChC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACjJ,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAEZ"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
|
|
4
|
-
import type { ObjectStore } from './ObjectStore.ts';
|
|
5
|
-
export declare function withReadWriteStore<T extends EmptyObject = EmptyObject, R = T>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [StoreNames<ObjectStore<T>>], StoreNames<ObjectStore<T>>, 'readwrite'> | null) => Promise<R> | R, logger?: Logger): Promise<R>;
|
|
6
|
-
//# sourceMappingURL=withReadWriteStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withReadWriteStore.d.ts","sourceRoot":"","sources":["../../src/withReadWriteStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EACjF,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAChC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAClJ,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAEZ"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@xylabs/logger';
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
3
|
-
import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
|
|
4
|
-
import type { ObjectStore } from './ObjectStore.ts';
|
|
5
|
-
export declare function withStore<T extends EmptyObject = EmptyObject, R = T, M extends 'readonly' | 'readwrite' = 'readonly'>(db: IDBPDatabase<ObjectStore<T>>, storeName: StoreNames<ObjectStore<T>>, callback: (store: IDBPObjectStore<ObjectStore<T>, [
|
|
6
|
-
StoreNames<ObjectStore<T>>
|
|
7
|
-
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
8
|
-
//# sourceMappingURL=withStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withStore.d.ts","sourceRoot":"","sources":["../../src/withStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAmB,UAAU,EAC3D,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,wBAAsB,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,UAAU,GAAG,WAAW,GAAG,UAAU,EACzH,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAChC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,EAC9C;IAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACxF,IAAI,EAAE,CAAC,EACP,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAkBZ"}
|