@xylabs/indexed-db 7.0.8 → 8.0.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.
Files changed (104) hide show
  1. package/README.md +1 -864
  2. package/dist/browser/index.d.ts +1 -11
  3. package/dist/browser/index.d.ts.map +1 -1
  4. package/dist/browser/index.mjs +2 -277
  5. package/dist/browser/index.mjs.map +4 -4
  6. package/dist/browser/model.d.ts +1 -2
  7. package/dist/browser/model.d.ts.map +1 -1
  8. package/dist/browser/model.mjs +2 -0
  9. package/dist/browser/model.mjs.map +3 -3
  10. package/dist/neutral/index.d.ts +1 -11
  11. package/dist/neutral/index.d.ts.map +1 -1
  12. package/dist/neutral/index.mjs +2 -277
  13. package/dist/neutral/index.mjs.map +4 -4
  14. package/dist/neutral/model.d.ts +1 -2
  15. package/dist/neutral/model.d.ts.map +1 -1
  16. package/dist/neutral/model.mjs +2 -0
  17. package/dist/neutral/model.mjs.map +3 -3
  18. package/dist/node/index.d.ts +1 -11
  19. package/dist/node/index.d.ts.map +1 -1
  20. package/dist/node/index.mjs +2 -277
  21. package/dist/node/index.mjs.map +4 -4
  22. package/dist/node/model.d.ts +1 -2
  23. package/dist/node/model.d.ts.map +1 -1
  24. package/dist/node/model.mjs +2 -0
  25. package/dist/node/model.mjs.map +3 -3
  26. package/package.json +7 -12
  27. package/dist/browser/IndexDescription.d.ts +0 -31
  28. package/dist/browser/IndexDescription.d.ts.map +0 -1
  29. package/dist/browser/IndexedDbKeyValueStore.d.ts +0 -40
  30. package/dist/browser/IndexedDbKeyValueStore.d.ts.map +0 -1
  31. package/dist/browser/ObjectStore.d.ts +0 -17
  32. package/dist/browser/ObjectStore.d.ts.map +0 -1
  33. package/dist/browser/checkDbNeedsUpgrade.d.ts +0 -11
  34. package/dist/browser/checkDbNeedsUpgrade.d.ts.map +0 -1
  35. package/dist/browser/checkStoreNeedsUpgrade.d.ts +0 -13
  36. package/dist/browser/checkStoreNeedsUpgrade.d.ts.map +0 -1
  37. package/dist/browser/createStoreDuringUpgrade.d.ts +0 -12
  38. package/dist/browser/createStoreDuringUpgrade.d.ts.map +0 -1
  39. package/dist/browser/dbMutex.d.ts +0 -14
  40. package/dist/browser/dbMutex.d.ts.map +0 -1
  41. package/dist/browser/getExistingIndexes.d.ts +0 -12
  42. package/dist/browser/getExistingIndexes.d.ts.map +0 -1
  43. package/dist/browser/withDb.d.ts +0 -16
  44. package/dist/browser/withDb.d.ts.map +0 -1
  45. package/dist/browser/withDbByVersion.d.ts +0 -17
  46. package/dist/browser/withDbByVersion.d.ts.map +0 -1
  47. package/dist/browser/withReadOnlyStore.d.ts +0 -14
  48. package/dist/browser/withReadOnlyStore.d.ts.map +0 -1
  49. package/dist/browser/withReadWriteStore.d.ts +0 -14
  50. package/dist/browser/withReadWriteStore.d.ts.map +0 -1
  51. package/dist/browser/withStore.d.ts +0 -18
  52. package/dist/browser/withStore.d.ts.map +0 -1
  53. package/dist/neutral/IndexDescription.d.ts +0 -31
  54. package/dist/neutral/IndexDescription.d.ts.map +0 -1
  55. package/dist/neutral/IndexedDbKeyValueStore.d.ts +0 -40
  56. package/dist/neutral/IndexedDbKeyValueStore.d.ts.map +0 -1
  57. package/dist/neutral/ObjectStore.d.ts +0 -17
  58. package/dist/neutral/ObjectStore.d.ts.map +0 -1
  59. package/dist/neutral/checkDbNeedsUpgrade.d.ts +0 -11
  60. package/dist/neutral/checkDbNeedsUpgrade.d.ts.map +0 -1
  61. package/dist/neutral/checkStoreNeedsUpgrade.d.ts +0 -13
  62. package/dist/neutral/checkStoreNeedsUpgrade.d.ts.map +0 -1
  63. package/dist/neutral/createStoreDuringUpgrade.d.ts +0 -12
  64. package/dist/neutral/createStoreDuringUpgrade.d.ts.map +0 -1
  65. package/dist/neutral/dbMutex.d.ts +0 -14
  66. package/dist/neutral/dbMutex.d.ts.map +0 -1
  67. package/dist/neutral/getExistingIndexes.d.ts +0 -12
  68. package/dist/neutral/getExistingIndexes.d.ts.map +0 -1
  69. package/dist/neutral/withDb.d.ts +0 -16
  70. package/dist/neutral/withDb.d.ts.map +0 -1
  71. package/dist/neutral/withDbByVersion.d.ts +0 -17
  72. package/dist/neutral/withDbByVersion.d.ts.map +0 -1
  73. package/dist/neutral/withReadOnlyStore.d.ts +0 -14
  74. package/dist/neutral/withReadOnlyStore.d.ts.map +0 -1
  75. package/dist/neutral/withReadWriteStore.d.ts +0 -14
  76. package/dist/neutral/withReadWriteStore.d.ts.map +0 -1
  77. package/dist/neutral/withStore.d.ts +0 -18
  78. package/dist/neutral/withStore.d.ts.map +0 -1
  79. package/dist/node/IndexDescription.d.ts +0 -31
  80. package/dist/node/IndexDescription.d.ts.map +0 -1
  81. package/dist/node/IndexedDbKeyValueStore.d.ts +0 -40
  82. package/dist/node/IndexedDbKeyValueStore.d.ts.map +0 -1
  83. package/dist/node/ObjectStore.d.ts +0 -17
  84. package/dist/node/ObjectStore.d.ts.map +0 -1
  85. package/dist/node/checkDbNeedsUpgrade.d.ts +0 -11
  86. package/dist/node/checkDbNeedsUpgrade.d.ts.map +0 -1
  87. package/dist/node/checkStoreNeedsUpgrade.d.ts +0 -13
  88. package/dist/node/checkStoreNeedsUpgrade.d.ts.map +0 -1
  89. package/dist/node/createStoreDuringUpgrade.d.ts +0 -12
  90. package/dist/node/createStoreDuringUpgrade.d.ts.map +0 -1
  91. package/dist/node/dbMutex.d.ts +0 -14
  92. package/dist/node/dbMutex.d.ts.map +0 -1
  93. package/dist/node/getExistingIndexes.d.ts +0 -12
  94. package/dist/node/getExistingIndexes.d.ts.map +0 -1
  95. package/dist/node/withDb.d.ts +0 -16
  96. package/dist/node/withDb.d.ts.map +0 -1
  97. package/dist/node/withDbByVersion.d.ts +0 -17
  98. package/dist/node/withDbByVersion.d.ts.map +0 -1
  99. package/dist/node/withReadOnlyStore.d.ts +0 -14
  100. package/dist/node/withReadOnlyStore.d.ts.map +0 -1
  101. package/dist/node/withReadWriteStore.d.ts +0 -14
  102. package/dist/node/withReadWriteStore.d.ts.map +0 -1
  103. package/dist/node/withStore.d.ts +0 -18
  104. package/dist/node/withStore.d.ts.map +0 -1
@@ -1,12 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { IDBPDatabase, StoreNames } from 'idb';
3
- import { type IndexDescription } from './IndexDescription.ts';
4
- /**
5
- * Creates an object store with the specified indexes during a version upgrade transaction.
6
- * @param db The IndexedDB database instance (during upgrade)
7
- * @param storeName The name of the store to create
8
- * @param indexes The index descriptions to create on the store
9
- * @param logger Optional logger for diagnostics
10
- */
11
- export declare function createStoreDuringUpgrade<DBTypes = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
12
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,YAAY,EAA+B,UAAU,EACtD,MAAM,KAAK,CAAA;AAEZ,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAG,OAAO,EACxD,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,14 +0,0 @@
1
- import { Mutex } from 'async-mutex';
2
- /**
3
- * Returns the shared mutex for a database name, creating one if needed.
4
- * @param dbName The IndexedDB database name
5
- */
6
- export declare function getDbMutex(dbName: string): Mutex;
7
- /**
8
- * Runs a handler under the shared database mutex when locking is enabled.
9
- * @param dbName The IndexedDB database name
10
- * @param lock Whether to acquire the mutex before running the handler
11
- * @param handler The async function to execute
12
- */
13
- export declare function withDbLock<R>(dbName: string, lock: boolean, handler: () => Promise<R>): Promise<R>;
14
- //# sourceMappingURL=dbMutex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbMutex.d.ts","sourceRoot":"","sources":["../../src/dbMutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAInC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,SAGxC;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,cAK3F"}
@@ -1,12 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { IDBPDatabase } from 'idb';
3
- import { type IndexDescription } from './IndexDescription.ts';
4
- /**
5
- * Retrieves the existing index descriptions for a store. Accepts either a database instance or a database name.
6
- * @param db The IndexedDB database instance or database name
7
- * @param storeName The name of the store to inspect
8
- * @param logger Optional logger for diagnostics
9
- * @returns An array of index descriptions, or null if the store does not exist
10
- */
11
- export declare function getExistingIndexes<DBTypes = unknown>(db: IDBPDatabase<DBTypes> | string, storeName: string, logger?: Logger): Promise<IndexDescription[] | null>;
12
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,KAAK,CAAA;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAA;AAmC9B;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAG,OAAO,EACxD,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,MAAM,EAClC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAQpC"}
@@ -1,16 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase } from 'idb';
4
- import { type IndexDescription } from './IndexDescription.ts';
5
- /**
6
- * Opens an IndexedDB database, automatically upgrading if needed, and passes it to the callback.
7
- * Uses a mutex to serialize access to the same database by default.
8
- * @param dbName The name of the database to open
9
- * @param callback Function to execute with the opened database
10
- * @param expectedIndexes Optional map of store names to their expected indexes (triggers upgrade check)
11
- * @param logger Optional logger for diagnostics
12
- * @param lock Whether to use a mutex to serialize access (defaults to true)
13
- * @returns The result of the callback
14
- */
15
- export declare function withDb<DBTypes = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
16
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAIvC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAG7D;;;;;;;;;GASG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EAC7D,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,CAOZ"}
@@ -1,17 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase } from 'idb';
4
- import { type IndexDescription } from './IndexDescription.ts';
5
- /**
6
- * Opens an IndexedDB database at a specific version, handling upgrade events, and passes it to the callback.
7
- * The database is automatically closed after the callback completes.
8
- * @param dbName The name of the database to open
9
- * @param callback Function to execute with the opened database
10
- * @param version Optional specific version to open (undefined for latest)
11
- * @param expectedIndexes Optional map of store names to indexes to create during upgrade
12
- * @param logger Optional logger for diagnostics
13
- * @param lock Whether to use a mutex to serialize access (defaults to true)
14
- * @returns The result of the callback
15
- */
16
- export declare function withDbByVersion<DBTypes = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
17
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,KAAK,CAAA;AAKnD,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAErF;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EACtE,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,14 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a read-only transaction on the specified store and passes it to the callback.
7
- * @param db The IndexedDB database instance
8
- * @param storeName The name of the object store to open
9
- * @param callback Function to execute with the read-only store
10
- * @param logger Optional logger for diagnostics
11
- * @returns The result of the callback
12
- */
13
- 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>;
14
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;GAOG;AACH,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,14 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a read-write transaction on the specified store and passes it to the callback.
7
- * @param db The IndexedDB database instance
8
- * @param storeName The name of the object store to open
9
- * @param callback Function to execute with the read-write store
10
- * @param logger Optional logger for diagnostics
11
- * @returns The result of the callback
12
- */
13
- 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>;
14
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;GAOG;AACH,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,18 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a transaction on the specified store with the given mode and passes the store to the callback.
7
- * If the store does not exist, the callback receives null.
8
- * @param db The IndexedDB database instance
9
- * @param storeName The name of the object store to open
10
- * @param callback Function to execute with the store (or null if it doesn't exist)
11
- * @param mode The transaction mode ('readonly' or 'readwrite')
12
- * @param logger Optional logger for diagnostics
13
- * @returns The result of the callback
14
- */
15
- 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>, [
16
- StoreNames<ObjectStore<T>>
17
- ], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
18
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAmB,UAAU,EAC3D,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;;;;;GASG;AACH,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"}
@@ -1,31 +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 interface 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
- /** Separator used between key names when building standard index names. */
23
- export declare const IndexSeparator = "-";
24
- /**
25
- * Given an index description, this will build the index
26
- * name in standard form
27
- * @param index The index description
28
- * @returns The index name in standard form
29
- */
30
- export declare const buildStandardIndexName: (index: IndexDescription) => string;
31
- //# 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,WAAW,gBAAgB;IAC/B;;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;AAED,2EAA2E;AAC3E,eAAO,MAAM,cAAc,MAAM,CAAA;AAEjC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,gBAAgB,WAK7D,CAAA"}
@@ -1,40 +0,0 @@
1
- import type { KeyValueStore } from '@xylabs/sdk/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
- /** The name of the IndexedDB database. */
8
- readonly dbName: string;
9
- /** The name of the object store within the database. */
10
- readonly storeName: S;
11
- constructor(dbName: string, storeName: S);
12
- /** Removes all entries from the store. */
13
- clear?(): Promise<void>;
14
- /**
15
- * Deletes the entry with the given key.
16
- * @param key The key of the entry to delete
17
- */
18
- delete(key: StoreKey<T, S>): Promise<void>;
19
- /**
20
- * Retrieves the value associated with the given key.
21
- * @param key The key to look up
22
- * @returns The value, or undefined if not found
23
- */
24
- get(key: StoreKey<T, S>): Promise<StoreValue<T, S> | undefined>;
25
- /** Returns all keys in the store. */
26
- keys?(): Promise<StoreKey<T, S>[]>;
27
- /**
28
- * Sets a value for the given key, creating or updating the entry.
29
- * @param key The key to set
30
- * @param value The value to store
31
- */
32
- set(key: StoreKey<T, S>, value: StoreValue<T, S>): Promise<void>;
33
- /**
34
- * Opens the underlying IndexedDB database and passes it to the callback.
35
- * @param callback Function to execute with the database
36
- * @returns The result of the callback
37
- */
38
- withDb<R = StoreValue<T, S>>(callback: (db: IDBPDatabase<T>) => Promise<R> | R): Promise<R>;
39
- }
40
- //# 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,qBAAqB,CAAA;AACxD,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;IACzI,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;gBAET,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAKxC,0CAA0C;IACpC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAM7B;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhD;;;;OAIG;IACG,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAQ7B,qCAAqC;IAC/B,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAMxC;;;;OAIG;IACG,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtE;;;;OAIG;IACG,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,17 +0,0 @@
1
- import type { EmptyObject } from '@xylabs/sdk/object';
2
- /** IDB schema value shape for a single store (key/value/indexes), exported for callers that want it. */
3
- export interface ObjectStoreValue<T extends object = EmptyObject> {
4
- indexes?: Record<string, IDBValidKey>;
5
- key: IDBValidKey;
6
- value: T;
7
- }
8
- /**
9
- * Generic IndexedDB schema type that maps store names to their value types.
10
- *
11
- * Intentionally does NOT extend `idb`'s `DBSchema` and does not embed `ObjectStoreValue` —
12
- * `idb`'s `StoreNames<T>` filters out string index signatures via `KeyToKeyNoIndex`, so any type
13
- * structurally matching `DBSchema` (i.e. whose values satisfy `DBSchemaValue`'s key/value/indexes
14
- * shape) resolves `StoreNames<T>` to `never`. That makes runtime store-name strings unassignable.
15
- */
16
- export type ObjectStore<T extends EmptyObject = EmptyObject> = Record<string, T>;
17
- //# sourceMappingURL=ObjectStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ObjectStore.d.ts","sourceRoot":"","sources":["../../src/ObjectStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,wGAAwG;AACxG,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACrC,GAAG,EAAE,WAAW,CAAA;IAChB,KAAK,EAAE,CAAC,CAAA;CACT;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA"}
@@ -1,11 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import { type IndexDescription } from './IndexDescription.ts';
3
- /**
4
- * Checks whether any store in the database needs an upgrade and returns the appropriate version number.
5
- * @param dbName The name of the database to check
6
- * @param stores Map of store names to their expected index descriptions
7
- * @param logger Optional logger for diagnostics
8
- * @returns The version to open (current version + 1 if upgrade needed, otherwise current version)
9
- */
10
- export declare function checkDbNeedsUpgrade(dbName: string, stores: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<number>;
11
- //# 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,oBAAoB,CAAA;AAGhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAC1C,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,UAAO,mBAWZ"}
@@ -1,13 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { IDBPDatabase } from 'idb';
3
- import { type IndexDescription } from './IndexDescription.ts';
4
- /**
5
- * Checks whether a store needs an upgrade by comparing its existing indexes against expected indexes.
6
- * @param db The IndexedDB database instance
7
- * @param storeName The name of the store to check
8
- * @param indexes The expected index descriptions
9
- * @param logger Optional logger for diagnostics
10
- * @returns True if the store is missing or has missing indexes
11
- */
12
- export declare function checkStoreNeedsUpgrade<DBTypes = unknown>(db: IDBPDatabase<DBTypes>, storeName: string, indexes: IndexDescription[], logger?: Logger): Promise<boolean>;
13
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAGvC,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAErF;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAG,OAAO,EAC5D,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,EAAE,EAC3B,MAAM,CAAC,EAAE,MAAM,oBAgBhB"}
@@ -1,12 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { IDBPDatabase, StoreNames } from 'idb';
3
- import { type IndexDescription } from './IndexDescription.ts';
4
- /**
5
- * Creates an object store with the specified indexes during a version upgrade transaction.
6
- * @param db The IndexedDB database instance (during upgrade)
7
- * @param storeName The name of the store to create
8
- * @param indexes The index descriptions to create on the store
9
- * @param logger Optional logger for diagnostics
10
- */
11
- export declare function createStoreDuringUpgrade<DBTypes = unknown>(db: IDBPDatabase<DBTypes>, storeName: StoreNames<DBTypes>, indexes: IndexDescription[], logger?: Logger): void;
12
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,YAAY,EAA+B,UAAU,EACtD,MAAM,KAAK,CAAA;AAEZ,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAG,OAAO,EACxD,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,14 +0,0 @@
1
- import { Mutex } from 'async-mutex';
2
- /**
3
- * Returns the shared mutex for a database name, creating one if needed.
4
- * @param dbName The IndexedDB database name
5
- */
6
- export declare function getDbMutex(dbName: string): Mutex;
7
- /**
8
- * Runs a handler under the shared database mutex when locking is enabled.
9
- * @param dbName The IndexedDB database name
10
- * @param lock Whether to acquire the mutex before running the handler
11
- * @param handler The async function to execute
12
- */
13
- export declare function withDbLock<R>(dbName: string, lock: boolean, handler: () => Promise<R>): Promise<R>;
14
- //# sourceMappingURL=dbMutex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dbMutex.d.ts","sourceRoot":"","sources":["../../src/dbMutex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAInC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,SAGxC;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,cAK3F"}
@@ -1,12 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { IDBPDatabase } from 'idb';
3
- import { type IndexDescription } from './IndexDescription.ts';
4
- /**
5
- * Retrieves the existing index descriptions for a store. Accepts either a database instance or a database name.
6
- * @param db The IndexedDB database instance or database name
7
- * @param storeName The name of the store to inspect
8
- * @param logger Optional logger for diagnostics
9
- * @returns An array of index descriptions, or null if the store does not exist
10
- */
11
- export declare function getExistingIndexes<DBTypes = unknown>(db: IDBPDatabase<DBTypes> | string, storeName: string, logger?: Logger): Promise<IndexDescription[] | null>;
12
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,KAAK,CAAA;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,uBAAuB,CAAA;AAmC9B;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAG,OAAO,EACxD,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,MAAM,EAClC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,CAQpC"}
@@ -1,16 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase } from 'idb';
4
- import { type IndexDescription } from './IndexDescription.ts';
5
- /**
6
- * Opens an IndexedDB database, automatically upgrading if needed, and passes it to the callback.
7
- * Uses a mutex to serialize access to the same database by default.
8
- * @param dbName The name of the database to open
9
- * @param callback Function to execute with the opened database
10
- * @param expectedIndexes Optional map of store names to their expected indexes (triggers upgrade check)
11
- * @param logger Optional logger for diagnostics
12
- * @param lock Whether to use a mutex to serialize access (defaults to true)
13
- * @returns The result of the callback
14
- */
15
- export declare function withDb<DBTypes = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
16
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAIvC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAG7D;;;;;;;;;GASG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EAC7D,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,CAOZ"}
@@ -1,17 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase } from 'idb';
4
- import { type IndexDescription } from './IndexDescription.ts';
5
- /**
6
- * Opens an IndexedDB database at a specific version, handling upgrade events, and passes it to the callback.
7
- * The database is automatically closed after the callback completes.
8
- * @param dbName The name of the database to open
9
- * @param callback Function to execute with the opened database
10
- * @param version Optional specific version to open (undefined for latest)
11
- * @param expectedIndexes Optional map of store names to indexes to create during upgrade
12
- * @param logger Optional logger for diagnostics
13
- * @param lock Whether to use a mutex to serialize access (defaults to true)
14
- * @returns The result of the callback
15
- */
16
- export declare function withDbByVersion<DBTypes = unknown, R = EmptyObject>(dbName: string, callback: (db: IDBPDatabase<DBTypes>) => Promise<R> | R, version?: number, expectedIndexes?: Record<string, IndexDescription[]>, logger?: Logger, lock?: boolean): Promise<R>;
17
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,KAAK,CAAA;AAKnD,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAErF;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,WAAW,EACtE,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,14 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a read-only transaction on the specified store and passes it to the callback.
7
- * @param db The IndexedDB database instance
8
- * @param storeName The name of the object store to open
9
- * @param callback Function to execute with the read-only store
10
- * @param logger Optional logger for diagnostics
11
- * @returns The result of the callback
12
- */
13
- 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>;
14
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;GAOG;AACH,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,14 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a read-write transaction on the specified store and passes it to the callback.
7
- * @param db The IndexedDB database instance
8
- * @param storeName The name of the object store to open
9
- * @param callback Function to execute with the read-write store
10
- * @param logger Optional logger for diagnostics
11
- * @returns The result of the callback
12
- */
13
- 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>;
14
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAE,UAAU,EAC1C,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;;;;;;GAOG;AACH,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,18 +0,0 @@
1
- import type { Logger } from '@xylabs/sdk/logger';
2
- import type { EmptyObject } from '@xylabs/sdk/object';
3
- import type { IDBPDatabase, IDBPObjectStore, StoreNames } from 'idb';
4
- import type { ObjectStore } from './ObjectStore.ts';
5
- /**
6
- * Opens a transaction on the specified store with the given mode and passes the store to the callback.
7
- * If the store does not exist, the callback receives null.
8
- * @param db The IndexedDB database instance
9
- * @param storeName The name of the object store to open
10
- * @param callback Function to execute with the store (or null if it doesn't exist)
11
- * @param mode The transaction mode ('readonly' or 'readwrite')
12
- * @param logger Optional logger for diagnostics
13
- * @returns The result of the callback
14
- */
15
- 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>, [
16
- StoreNames<ObjectStore<T>>
17
- ], StoreNames<ObjectStore<T>>, M> | null) => Promise<R> | R, mode: M, logger?: Logger): Promise<R>;
18
- //# 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,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EACV,YAAY,EAAE,eAAe,EAAmB,UAAU,EAC3D,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;;;;;GASG;AACH,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"}