@xylabs/indexed-db 4.13.15 → 4.13.17
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/README.md +22 -31
- package/dist/browser/index.d.ts +12 -74
- package/dist/browser/spec/upgrade.spec.d.ts +2 -0
- package/dist/browser/spec/upgrade.spec.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +12 -74
- package/dist/neutral/spec/upgrade.spec.d.ts +2 -0
- package/dist/neutral/spec/upgrade.spec.d.ts.map +1 -0
- package/dist/node/index.d.ts +12 -74
- package/dist/node/spec/upgrade.spec.d.ts +2 -0
- package/dist/node/spec/upgrade.spec.d.ts.map +1 -0
- package/package.json +7 -7
- package/build/browser/index.d.ts +0 -12
- package/build/neutral/index.d.ts +0 -12
- package/build/node/index.d.ts +0 -12
- /package/{build → dist}/browser/IndexDescription.d.ts +0 -0
- /package/{build → dist}/browser/IndexDescription.d.ts.map +0 -0
- /package/{build → dist}/browser/IndexedDbKeyValueStore.d.ts +0 -0
- /package/{build → dist}/browser/IndexedDbKeyValueStore.d.ts.map +0 -0
- /package/{build → dist}/browser/ObjectStore.d.ts +0 -0
- /package/{build → dist}/browser/ObjectStore.d.ts.map +0 -0
- /package/{build → dist}/browser/checkDbNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/browser/checkDbNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/browser/checkStoreNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/browser/checkStoreNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/browser/createStoreDuringUpgrade.d.ts +0 -0
- /package/{build → dist}/browser/createStoreDuringUpgrade.d.ts.map +0 -0
- /package/{build → dist}/browser/getExistingIndexes.d.ts +0 -0
- /package/{build → dist}/browser/getExistingIndexes.d.ts.map +0 -0
- /package/{build → dist}/browser/index.d.ts.map +0 -0
- /package/{build → dist}/browser/withDb.d.ts +0 -0
- /package/{build → dist}/browser/withDb.d.ts.map +0 -0
- /package/{build → dist}/browser/withDbByVersion.d.ts +0 -0
- /package/{build → dist}/browser/withDbByVersion.d.ts.map +0 -0
- /package/{build → dist}/browser/withReadOnlyStore.d.ts +0 -0
- /package/{build → dist}/browser/withReadOnlyStore.d.ts.map +0 -0
- /package/{build → dist}/browser/withReadWriteStore.d.ts +0 -0
- /package/{build → dist}/browser/withReadWriteStore.d.ts.map +0 -0
- /package/{build → dist}/browser/withStore.d.ts +0 -0
- /package/{build → dist}/browser/withStore.d.ts.map +0 -0
- /package/{build → dist}/neutral/IndexDescription.d.ts +0 -0
- /package/{build → dist}/neutral/IndexDescription.d.ts.map +0 -0
- /package/{build → dist}/neutral/IndexedDbKeyValueStore.d.ts +0 -0
- /package/{build → dist}/neutral/IndexedDbKeyValueStore.d.ts.map +0 -0
- /package/{build → dist}/neutral/ObjectStore.d.ts +0 -0
- /package/{build → dist}/neutral/ObjectStore.d.ts.map +0 -0
- /package/{build → dist}/neutral/checkDbNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/neutral/checkDbNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/neutral/checkStoreNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/neutral/checkStoreNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/neutral/createStoreDuringUpgrade.d.ts +0 -0
- /package/{build → dist}/neutral/createStoreDuringUpgrade.d.ts.map +0 -0
- /package/{build → dist}/neutral/getExistingIndexes.d.ts +0 -0
- /package/{build → dist}/neutral/getExistingIndexes.d.ts.map +0 -0
- /package/{build → dist}/neutral/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/withDb.d.ts +0 -0
- /package/{build → dist}/neutral/withDb.d.ts.map +0 -0
- /package/{build → dist}/neutral/withDbByVersion.d.ts +0 -0
- /package/{build → dist}/neutral/withDbByVersion.d.ts.map +0 -0
- /package/{build → dist}/neutral/withReadOnlyStore.d.ts +0 -0
- /package/{build → dist}/neutral/withReadOnlyStore.d.ts.map +0 -0
- /package/{build → dist}/neutral/withReadWriteStore.d.ts +0 -0
- /package/{build → dist}/neutral/withReadWriteStore.d.ts.map +0 -0
- /package/{build → dist}/neutral/withStore.d.ts +0 -0
- /package/{build → dist}/neutral/withStore.d.ts.map +0 -0
- /package/{build → dist}/node/IndexDescription.d.ts +0 -0
- /package/{build → dist}/node/IndexDescription.d.ts.map +0 -0
- /package/{build → dist}/node/IndexedDbKeyValueStore.d.ts +0 -0
- /package/{build → dist}/node/IndexedDbKeyValueStore.d.ts.map +0 -0
- /package/{build → dist}/node/ObjectStore.d.ts +0 -0
- /package/{build → dist}/node/ObjectStore.d.ts.map +0 -0
- /package/{build → dist}/node/checkDbNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/node/checkDbNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/node/checkStoreNeedsUpgrade.d.ts +0 -0
- /package/{build → dist}/node/checkStoreNeedsUpgrade.d.ts.map +0 -0
- /package/{build → dist}/node/createStoreDuringUpgrade.d.ts +0 -0
- /package/{build → dist}/node/createStoreDuringUpgrade.d.ts.map +0 -0
- /package/{build → dist}/node/getExistingIndexes.d.ts +0 -0
- /package/{build → dist}/node/getExistingIndexes.d.ts.map +0 -0
- /package/{build → dist}/node/index.d.ts.map +0 -0
- /package/{build → dist}/node/withDb.d.ts +0 -0
- /package/{build → dist}/node/withDb.d.ts.map +0 -0
- /package/{build → dist}/node/withDbByVersion.d.ts +0 -0
- /package/{build → dist}/node/withDbByVersion.d.ts.map +0 -0
- /package/{build → dist}/node/withReadOnlyStore.d.ts +0 -0
- /package/{build → dist}/node/withReadOnlyStore.d.ts.map +0 -0
- /package/{build → dist}/node/withReadWriteStore.d.ts +0 -0
- /package/{build → dist}/node/withReadWriteStore.d.ts.map +0 -0
- /package/{build → dist}/node/withStore.d.ts +0 -0
- /package/{build → dist}/node/withStore.d.ts.map +0 -0
package/README.md
CHANGED
|
@@ -1,63 +1,54 @@
|
|
|
1
|
-
[![logo][]](https://xylabs.com)
|
|
2
|
-
|
|
3
1
|
# @xylabs/indexed-db
|
|
4
2
|
|
|
3
|
+
[![logo][]](https://xylabs.com)
|
|
4
|
+
|
|
5
|
+
[![main-build][]][main-build-link]
|
|
5
6
|
[![npm-badge][]][npm-link]
|
|
6
7
|
[![npm-downloads-badge][]][npm-link]
|
|
7
8
|
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
9
|
[![npm-license-badge][]](LICENSE)
|
|
10
|
+
[![codacy-badge][]][codacy-link]
|
|
11
|
+
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
+
[![snyk-badge][]][snyk-link]
|
|
9
13
|
[![socket-badge][]][socket-link]
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
- [Description](#description)
|
|
16
|
-
- [Install](#install)
|
|
17
|
-
- [Maintainers](#maintainers)
|
|
18
|
-
- [License](#license)
|
|
19
|
-
- [Credits](#credits)
|
|
20
|
-
|
|
21
|
-
## Description
|
|
15
|
+
Version: 4.13.15
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
24
18
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
Using npm:
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
npm i --save @xylabs/indexed-db
|
|
31
|
-
```
|
|
19
|
+
## Documentation
|
|
32
20
|
|
|
33
|
-
|
|
21
|
+
Coming Soon!
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
yarn add @xylabs/indexed-db
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Documentation
|
|
40
|
-
[Developer Reference](https://xylabs.github.io/sdk-js)
|
|
23
|
+
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
41
24
|
|
|
42
25
|
## Maintainers
|
|
43
26
|
|
|
44
27
|
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
45
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
46
28
|
- [Matt Jones](https://github.com/jonesmac)
|
|
29
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
47
30
|
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
48
31
|
|
|
49
32
|
## License
|
|
50
33
|
|
|
51
|
-
See the [LICENSE](LICENSE) file for license details
|
|
34
|
+
> See the [LICENSE](LICENSE) file for license details
|
|
52
35
|
|
|
53
36
|
## Credits
|
|
54
37
|
|
|
55
|
-
[Made with 🔥and ❄️ by
|
|
38
|
+
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
56
39
|
|
|
57
40
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
58
41
|
|
|
42
|
+
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
43
|
+
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
59
44
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/indexed-db.svg
|
|
60
45
|
[npm-link]: https://www.npmjs.com/package/@xylabs/indexed-db
|
|
46
|
+
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
|
|
47
|
+
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
|
|
48
|
+
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
49
|
+
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
50
|
+
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
51
|
+
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
61
52
|
|
|
62
53
|
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/indexed-db
|
|
63
54
|
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/indexed-db
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,74 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
type IndexDescription = {
|
|
14
|
-
/**
|
|
15
|
-
* The key(s) to index
|
|
16
|
-
*/
|
|
17
|
-
key: Record<string, IndexDirection>;
|
|
18
|
-
/**
|
|
19
|
-
* Is the indexed value an array
|
|
20
|
-
*/
|
|
21
|
-
multiEntry?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* If true, the index must enforce uniqueness on the key
|
|
24
|
-
*/
|
|
25
|
-
unique?: boolean;
|
|
26
|
-
};
|
|
27
|
-
declare const IndexSeparator = "-";
|
|
28
|
-
/**
|
|
29
|
-
* Given an index description, this will build the index
|
|
30
|
-
* name in standard form
|
|
31
|
-
* @param index The index description
|
|
32
|
-
* @returns The index name in standard form
|
|
33
|
-
*/
|
|
34
|
-
declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
35
|
-
|
|
36
|
-
declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
37
|
-
|
|
38
|
-
declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
39
|
-
|
|
40
|
-
interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
41
|
-
[s: string]: T;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* An IndexedDB key/value store.
|
|
48
|
-
*/
|
|
49
|
-
declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
50
|
-
readonly dbName: string;
|
|
51
|
-
readonly storeName: S;
|
|
52
|
-
constructor(dbName: string, storeName: S);
|
|
53
|
-
clear?(): Promise<void>;
|
|
54
|
-
delete(key: StoreKey<T, S>): Promise<void>;
|
|
55
|
-
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
56
|
-
keys?(): Promise<StoreKey<T, S>[]>;
|
|
57
|
-
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
58
|
-
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
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>;
|
|
62
|
-
|
|
63
|
-
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>;
|
|
64
|
-
|
|
65
|
-
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>;
|
|
66
|
-
|
|
67
|
-
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>;
|
|
68
|
-
|
|
69
|
-
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>, [
|
|
70
|
-
StoreNames<ObjectStore<T>>
|
|
71
|
-
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
72
|
-
|
|
73
|
-
export { IndexSeparator, IndexedDbKeyValueStore, buildStandardIndexName, checkDbNeedsUpgrade, createStoreDuringUpgrade, getExistingIndexes, withDb, withDbByVersion, withReadOnlyStore, withReadWriteStore, withStore };
|
|
74
|
-
export type { IndexDescription, IndexDirection, ObjectStore };
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/upgrade.spec.ts"],"names":[],"mappings":"AAGA,OAAO,qBAAqB,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,74 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
type IndexDescription = {
|
|
14
|
-
/**
|
|
15
|
-
* The key(s) to index
|
|
16
|
-
*/
|
|
17
|
-
key: Record<string, IndexDirection>;
|
|
18
|
-
/**
|
|
19
|
-
* Is the indexed value an array
|
|
20
|
-
*/
|
|
21
|
-
multiEntry?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* If true, the index must enforce uniqueness on the key
|
|
24
|
-
*/
|
|
25
|
-
unique?: boolean;
|
|
26
|
-
};
|
|
27
|
-
declare const IndexSeparator = "-";
|
|
28
|
-
/**
|
|
29
|
-
* Given an index description, this will build the index
|
|
30
|
-
* name in standard form
|
|
31
|
-
* @param index The index description
|
|
32
|
-
* @returns The index name in standard form
|
|
33
|
-
*/
|
|
34
|
-
declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
35
|
-
|
|
36
|
-
declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
37
|
-
|
|
38
|
-
declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
39
|
-
|
|
40
|
-
interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
41
|
-
[s: string]: T;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* An IndexedDB key/value store.
|
|
48
|
-
*/
|
|
49
|
-
declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
50
|
-
readonly dbName: string;
|
|
51
|
-
readonly storeName: S;
|
|
52
|
-
constructor(dbName: string, storeName: S);
|
|
53
|
-
clear?(): Promise<void>;
|
|
54
|
-
delete(key: StoreKey<T, S>): Promise<void>;
|
|
55
|
-
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
56
|
-
keys?(): Promise<StoreKey<T, S>[]>;
|
|
57
|
-
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
58
|
-
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
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>;
|
|
62
|
-
|
|
63
|
-
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>;
|
|
64
|
-
|
|
65
|
-
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>;
|
|
66
|
-
|
|
67
|
-
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>;
|
|
68
|
-
|
|
69
|
-
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>, [
|
|
70
|
-
StoreNames<ObjectStore<T>>
|
|
71
|
-
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
72
|
-
|
|
73
|
-
export { IndexSeparator, IndexedDbKeyValueStore, buildStandardIndexName, checkDbNeedsUpgrade, createStoreDuringUpgrade, getExistingIndexes, withDb, withDbByVersion, withReadOnlyStore, withReadWriteStore, withStore };
|
|
74
|
-
export type { IndexDescription, IndexDirection, ObjectStore };
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/upgrade.spec.ts"],"names":[],"mappings":"AAGA,OAAO,qBAAqB,CAAA"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,74 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
type IndexDescription = {
|
|
14
|
-
/**
|
|
15
|
-
* The key(s) to index
|
|
16
|
-
*/
|
|
17
|
-
key: Record<string, IndexDirection>;
|
|
18
|
-
/**
|
|
19
|
-
* Is the indexed value an array
|
|
20
|
-
*/
|
|
21
|
-
multiEntry?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* If true, the index must enforce uniqueness on the key
|
|
24
|
-
*/
|
|
25
|
-
unique?: boolean;
|
|
26
|
-
};
|
|
27
|
-
declare const IndexSeparator = "-";
|
|
28
|
-
/**
|
|
29
|
-
* Given an index description, this will build the index
|
|
30
|
-
* name in standard form
|
|
31
|
-
* @param index The index description
|
|
32
|
-
* @returns The index name in standard form
|
|
33
|
-
*/
|
|
34
|
-
declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
35
|
-
|
|
36
|
-
declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger): Promise<number>;
|
|
37
|
-
|
|
38
|
-
declare function createStoreDuringUpgrade<DBTypes extends DBSchema | unknown = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
|
|
39
|
-
|
|
40
|
-
interface ObjectStore<T extends EmptyObject = EmptyObject> {
|
|
41
|
-
[s: string]: T;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
declare function getExistingIndexes<T extends EmptyObject = EmptyObject>(db: IDBPDatabase<ObjectStore<T>> | string, storeName: StoreNames<ObjectStore<T>>, logger?: Logger): Promise<IndexDescription[] | null>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* An IndexedDB key/value store.
|
|
48
|
-
*/
|
|
49
|
-
declare class IndexedDbKeyValueStore<T extends DBSchema, S extends StoreNames<T>> implements KeyValueStore<StoreValue<T, S>, StoreKey<T, S>> {
|
|
50
|
-
readonly dbName: string;
|
|
51
|
-
readonly storeName: S;
|
|
52
|
-
constructor(dbName: string, storeName: S);
|
|
53
|
-
clear?(): Promise<void>;
|
|
54
|
-
delete(key: StoreKey<T, S>): Promise<void>;
|
|
55
|
-
get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
|
|
56
|
-
keys?(): Promise<StoreKey<T, S>[]>;
|
|
57
|
-
set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
|
|
58
|
-
withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
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>;
|
|
62
|
-
|
|
63
|
-
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>;
|
|
64
|
-
|
|
65
|
-
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>;
|
|
66
|
-
|
|
67
|
-
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>;
|
|
68
|
-
|
|
69
|
-
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>, [
|
|
70
|
-
StoreNames<ObjectStore<T>>
|
|
71
|
-
], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
|
|
72
|
-
|
|
73
|
-
export { IndexSeparator, IndexedDbKeyValueStore, buildStandardIndexName, checkDbNeedsUpgrade, createStoreDuringUpgrade, getExistingIndexes, withDb, withDbByVersion, withReadOnlyStore, withReadWriteStore, withStore };
|
|
74
|
-
export type { IndexDescription, IndexDirection, ObjectStore };
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/upgrade.spec.ts"],"names":[],"mappings":"AAGA,OAAO,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/indexed-db",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.17",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hex",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"packages/**/*"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@xylabs/exists": "^4.13.
|
|
53
|
-
"@xylabs/logger": "^4.13.
|
|
54
|
-
"@xylabs/object": "^4.13.
|
|
55
|
-
"@xylabs/storage": "^4.13.
|
|
52
|
+
"@xylabs/exists": "^4.13.17",
|
|
53
|
+
"@xylabs/logger": "^4.13.17",
|
|
54
|
+
"@xylabs/object": "^4.13.17",
|
|
55
|
+
"@xylabs/storage": "^4.13.17",
|
|
56
56
|
"async-mutex": "^0.5.0",
|
|
57
57
|
"idb": "^8.0.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
61
|
-
"@xylabs/tsconfig-dom": "^7.0.0-rc.
|
|
60
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
|
|
61
|
+
"@xylabs/tsconfig-dom": "^7.0.0-rc.27",
|
|
62
62
|
"fake-indexeddb": "^6.0.1",
|
|
63
63
|
"jsdom": "^26.1.0",
|
|
64
64
|
"typescript": "^5.8.3",
|
package/build/browser/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
|
package/build/neutral/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
|
package/build/node/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|