@dynamic-labs-sdk/client 1.33.3 → 1.33.4
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/{apiClient-CpfEx6Uc.native.esm.js → apiClient-BGh68_e6.native.esm.js} +2 -2
- package/dist/{apiClient-CpfEx6Uc.native.esm.js.map → apiClient-BGh68_e6.native.esm.js.map} +1 -1
- package/dist/core.cjs +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/{getNetworkProviderFromNetworkId-Cf-CfYM4.esm.js → getNetworkProviderFromNetworkId-BqiVs3Ni.esm.js} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-Cf-CfYM4.esm.js.map → getNetworkProviderFromNetworkId-BqiVs3Ni.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-Cez8TM-n.cjs → getNetworkProviderFromNetworkId-C_bqlRFD.cjs} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-Cez8TM-n.cjs.map → getNetworkProviderFromNetworkId-C_bqlRFD.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CuTEQ9dg.native.esm.js → getNetworkProviderFromNetworkId-TczZgKDH.native.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-CuTEQ9dg.native.esm.js.map → getNetworkProviderFromNetworkId-TczZgKDH.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-Cx7WP4ZJ.esm.js → getSignedSessionId-DRJW9tb8.esm.js} +3 -3
- package/dist/{getSignedSessionId-Cx7WP4ZJ.esm.js.map → getSignedSessionId-DRJW9tb8.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DiVxv0qz.cjs → getSignedSessionId-Dc6_q9ph.cjs} +3 -3
- package/dist/{getSignedSessionId-DiVxv0qz.cjs.map → getSignedSessionId-Dc6_q9ph.cjs.map} +1 -1
- package/dist/{getSignedSessionId-Bt4obN3w.native.esm.js → getSignedSessionId-h-zAmDnk.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-Bt4obN3w.native.esm.js.map → getSignedSessionId-h-zAmDnk.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js → getVerifiedCredentialForWalletAccount-BWtWpYjd.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-DfKRbqco.esm.js.map → getVerifiedCredentialForWalletAccount-BWtWpYjd.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs → getVerifiedCredentialForWalletAccount-CgI__iTv.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-UIcOv7IN.cjs.map → getVerifiedCredentialForWalletAccount-CgI__iTv.cjs.map} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +8 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +8 -8
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-Czx-uPFY.cjs → isMfaRequiredForAction-Aov24tU3.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-Czx-uPFY.cjs.map → isMfaRequiredForAction-Aov24tU3.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-CxYft5KR.native.esm.js → isMfaRequiredForAction-FW_GM4tb.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CxYft5KR.native.esm.js.map → isMfaRequiredForAction-FW_GM4tb.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DS8fcwxO.esm.js → isMfaRequiredForAction-mcAjTfRu.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DS8fcwxO.esm.js.map → isMfaRequiredForAction-mcAjTfRu.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-COmYFW26.esm.js → isUserOnboardingComplete-BTvFsIW7.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-COmYFW26.esm.js.map → isUserOnboardingComplete-BTvFsIW7.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-DYnRDLep.native.esm.js → isUserOnboardingComplete-BzEm_9UF.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DYnRDLep.native.esm.js.map → isUserOnboardingComplete-BzEm_9UF.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-FbjleMQm.cjs → isUserOnboardingComplete-Deq_CabI.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-FbjleMQm.cjs.map → isUserOnboardingComplete-Deq_CabI.cjs.map} +1 -1
- package/dist/{logoutWithReason-BKwWBsCT.cjs → logoutWithReason-BqgbyO5j.cjs} +29 -3
- package/dist/logoutWithReason-BqgbyO5j.cjs.map +1 -0
- package/dist/{logoutWithReason-DO0kP7nf.esm.js → logoutWithReason-Demgc354.esm.js} +24 -4
- package/dist/logoutWithReason-Demgc354.esm.js.map +1 -0
- package/dist/{logoutWithReason-DWkIKoLk.native.esm.js → logoutWithReason-rupibyb3.native.esm.js} +24 -4
- package/dist/logoutWithReason-rupibyb3.native.esm.js.map +1 -0
- package/dist/{migrateFromFireblocks-ycJIYcrm.cjs → migrateFromFireblocks-C1El-Dce.cjs} +2 -2
- package/dist/{migrateFromFireblocks-ycJIYcrm.cjs.map → migrateFromFireblocks-C1El-Dce.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-BwYnNAAh.native.esm.js → migrateFromFireblocks-Cc6JO6e2.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-BwYnNAAh.native.esm.js.map → migrateFromFireblocks-Cc6JO6e2.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-C_cap--b.esm.js → migrateFromFireblocks-DSgWzuHJ.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-C_cap--b.esm.js.map → migrateFromFireblocks-DSgWzuHJ.esm.js.map} +1 -1
- package/dist/services/resilientIndexedDbStore/createResilientIndexedDbStore/createResilientIndexedDbStore.d.ts +44 -0
- package/dist/services/resilientIndexedDbStore/createResilientIndexedDbStore/createResilientIndexedDbStore.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/createResilientIndexedDbStore/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/createResilientIndexedDbStore/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/errors/TransactionNotCompletedError.d.ts +5 -0
- package/dist/services/resilientIndexedDbStore/errors/TransactionNotCompletedError.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/resilientIndexedDbStore.types.d.ts +79 -0
- package/dist/services/resilientIndexedDbStore/resilientIndexedDbStore.types.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/applyMutation/applyMutation.d.ts +29 -0
- package/dist/services/resilientIndexedDbStore/utils/applyMutation/applyMutation.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/applyMutation/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/applyMutation/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/constants.d.ts +24 -0
- package/dist/services/resilientIndexedDbStore/utils/constants.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/createTombstoneStore/createTombstoneStore.d.ts +61 -0
- package/dist/services/resilientIndexedDbStore/utils/createTombstoneStore/createTombstoneStore.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/createTombstoneStore/index.d.ts +3 -0
- package/dist/services/resilientIndexedDbStore/utils/createTombstoneStore/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/createWorkQueue/createWorkQueue.d.ts +60 -0
- package/dist/services/resilientIndexedDbStore/utils/createWorkQueue/createWorkQueue.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/createWorkQueue/index.d.ts +3 -0
- package/dist/services/resilientIndexedDbStore/utils/createWorkQueue/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/deleteRecord/deleteRecord.d.ts +35 -0
- package/dist/services/resilientIndexedDbStore/utils/deleteRecord/deleteRecord.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/deleteRecord/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/deleteRecord/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getBackoffDelay/getBackoffDelay.d.ts +22 -0
- package/dist/services/resilientIndexedDbStore/utils/getBackoffDelay/getBackoffDelay.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getBackoffDelay/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/getBackoffDelay/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecord/getRecord.d.ts +32 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecord/getRecord.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecord/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecord/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecordKey/getRecordKey.d.ts +27 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecordKey/getRecordKey.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecordKey/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/getRecordKey/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getTransactionError/getTransactionError.d.ts +28 -0
- package/dist/services/resilientIndexedDbStore/utils/getTransactionError/getTransactionError.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/getTransactionError/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/getTransactionError/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/isPermanentWriteError/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/isPermanentWriteError/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/isPermanentWriteError/isPermanentWriteError.d.ts +20 -0
- package/dist/services/resilientIndexedDbStore/utils/isPermanentWriteError/isPermanentWriteError.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/openDatabase/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/openDatabase/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/openDatabase/openDatabase.d.ts +31 -0
- package/dist/services/resilientIndexedDbStore/utils/openDatabase/openDatabase.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/putRecord/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/putRecord/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/putRecord/putRecord.d.ts +37 -0
- package/dist/services/resilientIndexedDbStore/utils/putRecord/putRecord.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/readStoredValue/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/readStoredValue/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/readStoredValue/readStoredValue.d.ts +42 -0
- package/dist/services/resilientIndexedDbStore/utils/readStoredValue/readStoredValue.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/replayTombstones/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/replayTombstones/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/replayTombstones/replayTombstones.d.ts +31 -0
- package/dist/services/resilientIndexedDbStore/utils/replayTombstones/replayTombstones.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/runWithTimeout/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/runWithTimeout/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/runWithTimeout/runWithTimeout.d.ts +34 -0
- package/dist/services/resilientIndexedDbStore/utils/runWithTimeout/runWithTimeout.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/withDatabase/index.d.ts +2 -0
- package/dist/services/resilientIndexedDbStore/utils/withDatabase/index.d.ts.map +1 -0
- package/dist/services/resilientIndexedDbStore/utils/withDatabase/withDatabase.d.ts +39 -0
- package/dist/services/resilientIndexedDbStore/utils/withDatabase/withDatabase.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/retryOnFail/retryOnFail.d.ts.map +1 -1
- package/dist/utils/retryOnFetchError/retryOnFetchError.d.ts.map +1 -1
- package/dist/utils/waitForDelay/index.d.ts +2 -0
- package/dist/utils/waitForDelay/index.d.ts.map +1 -0
- package/dist/utils/waitForDelay/waitForDelay.d.ts +21 -0
- package/dist/utils/waitForDelay/waitForDelay.d.ts.map +1 -0
- package/dist/{waas-DjivkzyT.esm.js → waas-BAcC_ZEU.esm.js} +4 -4
- package/dist/{waas-DjivkzyT.esm.js.map → waas-BAcC_ZEU.esm.js.map} +1 -1
- package/dist/{waas-C4jtRxx1.native.esm.js → waas-BnBxnaH4.native.esm.js} +4 -4
- package/dist/{waas-C4jtRxx1.native.esm.js.map → waas-BnBxnaH4.native.esm.js.map} +1 -1
- package/dist/{waas-CioG-_yp.cjs → waas-EJACWt9Q.cjs} +4 -4
- package/dist/{waas-CioG-_yp.cjs.map → waas-EJACWt9Q.cjs.map} +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +4 -4
- package/dist/waas.native.esm.js +4 -4
- package/dist/waasCore.cjs +5 -5
- package/dist/waasCore.esm.js +5 -5
- package/dist/waasCore.native.esm.js +5 -5
- package/package.json +2 -2
- package/dist/logoutWithReason-BKwWBsCT.cjs.map +0 -1
- package/dist/logoutWithReason-DO0kP7nf.esm.js.map +0 -1
- package/dist/logoutWithReason-DWkIKoLk.native.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/deleteRecord/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type GetBackoffDelayParams = {
|
|
2
|
+
/** How many attempts have already failed. */
|
|
3
|
+
attempt: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Exponential backoff between IndexedDB attempts, capped so a caller waiting
|
|
7
|
+
* on a read never sits through a multi-second gap.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* await waitForDelay({ delayMs: getBackoffDelay({ attempt: 3 }) });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param params.attempt - How many attempts have already failed.
|
|
15
|
+
* @returns The delay in milliseconds to wait before the next attempt.
|
|
16
|
+
* @see waitForDelay
|
|
17
|
+
* @see readStoredValue
|
|
18
|
+
* @notInstrumented
|
|
19
|
+
*/
|
|
20
|
+
export declare const getBackoffDelay: ({ attempt }: GetBackoffDelayParams) => number;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=getBackoffDelay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBackoffDelay.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getBackoffDelay/getBackoffDelay.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IAC3B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,gBAAiB,qBAAqB,KAAG,MAIpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getBackoffDelay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type GetRecordParams = {
|
|
2
|
+
/** An open connection to the store's database. */
|
|
3
|
+
db: IDBDatabase;
|
|
4
|
+
/** Key of the record to read. */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Name of the object store to read from. */
|
|
7
|
+
storeName: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Reads a single record from an object store.
|
|
11
|
+
*
|
|
12
|
+
* Values come back exactly as they were written, through structured clone, so
|
|
13
|
+
* types that cannot be serialized (such as a non-extractable `CryptoKey`)
|
|
14
|
+
* survive the round trip.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const record = await getRecord<StoredKey>({ db, key: 'session', storeName: 'keys' });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param params.db - An open connection to the store's database.
|
|
22
|
+
* @param params.key - Key of the record to read.
|
|
23
|
+
* @param params.storeName - Name of the object store to read from.
|
|
24
|
+
* @returns The stored value, or undefined when the key has no record.
|
|
25
|
+
* @throws When IndexedDB rejects the read.
|
|
26
|
+
* @see withDatabase
|
|
27
|
+
* @see readStoredValue
|
|
28
|
+
* @notInstrumented
|
|
29
|
+
*/
|
|
30
|
+
export declare const getRecord: <TValue>({ db, key, storeName, }: GetRecordParams) => Promise<TValue | undefined>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=getRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRecord.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getRecord/getRecord.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB,kDAAkD;IAClD,EAAE,EAAE,WAAW,CAAC;IAEhB,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IAEZ,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,2BAI7B,eAAe,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAQ3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getRecord/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type GetRecordKeyParams<TValue> = {
|
|
2
|
+
/** Property of a value that holds its key. */
|
|
3
|
+
keyPath: string;
|
|
4
|
+
/** The value to read the key from. */
|
|
5
|
+
value: TValue;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The key IndexedDB stores a value under, read from the value itself.
|
|
9
|
+
*
|
|
10
|
+
* A value whose key path holds no string has no key to be stored under, so the
|
|
11
|
+
* caller learns that before IndexedDB rejects the write.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const key = getRecordKey({ keyPath: 'keyName', value: storedKey });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param params.keyPath - Property of a value that holds its key.
|
|
19
|
+
* @param params.value - The value to read the key from.
|
|
20
|
+
* @returns The key, or undefined when the key path holds no string.
|
|
21
|
+
* @see createResilientIndexedDbStore
|
|
22
|
+
* @see putRecord
|
|
23
|
+
* @notInstrumented
|
|
24
|
+
*/
|
|
25
|
+
export declare const getRecordKey: <TValue>({ keyPath, value, }: GetRecordKeyParams<TValue>) => string | undefined;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=getRecordKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRecordKey.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getRecordKey/getRecordKey.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,CAAC,MAAM,IAAI;IAChC,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAEhB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,uBAGhC,kBAAkB,CAAC,MAAM,CAAC,KAAG,MAAM,GAAG,SAcxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getRecordKey/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/services/resilientIndexedDbStore/utils/getTransactionError/getTransactionError.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type GetTransactionErrorParams = {
|
|
2
|
+
/** The request that ran inside the transaction. */
|
|
3
|
+
request: IDBRequest;
|
|
4
|
+
/** The transaction that failed or was aborted. */
|
|
5
|
+
transaction: IDBTransaction;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The reason a write transaction did not commit.
|
|
9
|
+
*
|
|
10
|
+
* A transaction aborted by the browser rather than by a failing request, as
|
|
11
|
+
* happens when a connection closes mid-transaction, carries no error on either
|
|
12
|
+
* object, so the caller still gets something to log and retry on.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* transaction.onabort = () => reject(getTransactionError({ request, transaction }));
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param params.request - The request that ran inside the transaction.
|
|
20
|
+
* @param params.transaction - The transaction that failed or was aborted.
|
|
21
|
+
* @returns The error to reject the write with.
|
|
22
|
+
* @see putRecord
|
|
23
|
+
* @see deleteRecord
|
|
24
|
+
* @notInstrumented
|
|
25
|
+
*/
|
|
26
|
+
export declare const getTransactionError: ({ request, transaction, }: GetTransactionErrorParams) => Error;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=getTransactionError.d.ts.map
|
package/dist/services/resilientIndexedDbStore/utils/getTransactionError/getTransactionError.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactionError.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getTransactionError/getTransactionError.ts"],"names":[],"mappings":"AAEA,KAAK,yBAAyB,GAAG;IAC/B,mDAAmD;IACnD,OAAO,EAAE,UAAU,CAAC;IAEpB,kDAAkD;IAClD,WAAW,EAAE,cAAc,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,8BAG7B,yBAAyB,KAAG,KAQ9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/getTransactionError/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/isPermanentWriteError/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/services/resilientIndexedDbStore/utils/isPermanentWriteError/isPermanentWriteError.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether IndexedDB rejected a write because of what it was asked to write,
|
|
3
|
+
* which tells a retrying caller to give the write up instead of repeating it
|
|
4
|
+
* for as long as the process lives.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* if (isPermanentWriteError(error)) {
|
|
9
|
+
* logger?.debug('Dropping a mutation IndexedDB will never accept', error);
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param error - Whatever the write rejected with.
|
|
14
|
+
* @returns Whether repeating the write is pointless.
|
|
15
|
+
* @see createWorkQueue
|
|
16
|
+
* @see applyMutation
|
|
17
|
+
* @notInstrumented
|
|
18
|
+
*/
|
|
19
|
+
export declare const isPermanentWriteError: (error: unknown) => boolean;
|
|
20
|
+
//# sourceMappingURL=isPermanentWriteError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPermanentWriteError.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/isPermanentWriteError/isPermanentWriteError.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,UAAW,OAAO,KAAG,OACiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/openDatabase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StoreDatabaseConfig } from '../../resilientIndexedDbStore.types';
|
|
2
|
+
type OpenDatabaseParams = {
|
|
3
|
+
/** Where the store keeps its records. */
|
|
4
|
+
database: StoreDatabaseConfig;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Opens the store's IndexedDB connection, recovering from a corrupted schema.
|
|
8
|
+
*
|
|
9
|
+
* If the database exists but is missing the expected object store (an upgrade
|
|
10
|
+
* interrupted by a reload on iOS WebKit leaves the database committed at its
|
|
11
|
+
* version with the store creation rolled back), it reopens at the next version
|
|
12
|
+
* so `onupgradeneeded` fires and recreates only the missing store. Stored data
|
|
13
|
+
* is preserved: the database is never deleted.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const db = await openDatabase({
|
|
18
|
+
* database: { dbName: 'dynamic_keychain', keyPath: 'keyName', storeName: 'keys' },
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param params.database - Where the store keeps its records.
|
|
23
|
+
* @returns An open connection whose object store is guaranteed to exist.
|
|
24
|
+
* @throws When IndexedDB refuses to open the database.
|
|
25
|
+
* @see withDatabase
|
|
26
|
+
* @see createResilientIndexedDbStore
|
|
27
|
+
* @notInstrumented
|
|
28
|
+
*/
|
|
29
|
+
export declare const openDatabase: ({ database, }: OpenDatabaseParams) => Promise<IDBDatabase>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=openDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openDatabase.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/openDatabase/openDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,KAAK,kBAAkB,GAAG;IACxB,yCAAyC;IACzC,QAAQ,EAAE,mBAAmB,CAAC;CAC/B,CAAC;AAmCF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,kBAEtB,kBAAkB,KAAG,OAAO,CAAC,WAAW,CAe1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/putRecord/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type PutRecordParams<TValue> = {
|
|
2
|
+
/** An open connection to the store's database. */
|
|
3
|
+
db: IDBDatabase;
|
|
4
|
+
/** Name of the object store to write to. */
|
|
5
|
+
storeName: string;
|
|
6
|
+
/** The value to write. It carries its own key under the store's key path. */
|
|
7
|
+
value: TValue;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Writes a single record to an object store, resolving once the transaction
|
|
11
|
+
* commits.
|
|
12
|
+
*
|
|
13
|
+
* A successful request only means the write ran inside the transaction, and a
|
|
14
|
+
* transaction can still abort after that, so the caller learns the value is
|
|
15
|
+
* stored only once IndexedDB has committed it.
|
|
16
|
+
*
|
|
17
|
+
* The value is written as it is, through structured clone, so types that cannot
|
|
18
|
+
* be serialized (such as a non-extractable `CryptoKey`) survive the round trip.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* await putRecord({ db, storeName: 'keys', value: storedKey });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param params.db - An open connection to the store's database.
|
|
26
|
+
* @param params.storeName - Name of the object store to write to.
|
|
27
|
+
* @param params.value - The value to write.
|
|
28
|
+
* @returns A promise that resolves once the write is committed.
|
|
29
|
+
* @throws When IndexedDB rejects the write or the transaction does not commit.
|
|
30
|
+
* @see getTransactionError
|
|
31
|
+
* @see withDatabase
|
|
32
|
+
* @see applyMutation
|
|
33
|
+
* @notInstrumented
|
|
34
|
+
*/
|
|
35
|
+
export declare const putRecord: <TValue>({ db, storeName, value, }: PutRecordParams<TValue>) => Promise<void>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=putRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"putRecord.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/putRecord/putRecord.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,CAAC,MAAM,IAAI;IAC7B,kDAAkD;IAClD,EAAE,EAAE,WAAW,CAAC;IAEhB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAElB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,6BAI7B,eAAe,CAAC,MAAM,CAAC,KAAG,OAAO,CAAC,IAAI,CASrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/readStoredValue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { StoreDatabaseConfig, StoreReadResult } from '../../resilientIndexedDbStore.types';
|
|
2
|
+
type ReadStoredValueParams = {
|
|
3
|
+
/** Where the store keeps its records. */
|
|
4
|
+
database: StoreDatabaseConfig;
|
|
5
|
+
/** Key of the value to read. */
|
|
6
|
+
key: string;
|
|
7
|
+
/** How long the read may keep retrying before reporting unavailability. */
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Reads a value from IndexedDB, retrying with backoff while the database is
|
|
12
|
+
* unusable and resolving deterministically once the timeout budget is spent.
|
|
13
|
+
*
|
|
14
|
+
* Each attempt is bounded by whatever is left of the budget, so an open the
|
|
15
|
+
* browser leaves blocked and a request it never settles both end the read
|
|
16
|
+
* within the budget instead of holding it forever.
|
|
17
|
+
*
|
|
18
|
+
* The caller is usually a user waiting on an interaction, so the result is
|
|
19
|
+
* always one of found, absent, or unavailable: never a hanging promise and
|
|
20
|
+
* never a thrown IndexedDB error.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const result = await readStoredValue<StoredKey>({
|
|
25
|
+
* database,
|
|
26
|
+
* key: 'session',
|
|
27
|
+
* timeoutMs: DEFAULT_READ_TIMEOUT_MS,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param params.database - Where the store keeps its records.
|
|
32
|
+
* @param params.key - Key of the value to read.
|
|
33
|
+
* @param params.timeoutMs - How long the read may keep retrying.
|
|
34
|
+
* @returns Whether the value was found, is absent, or could not be read.
|
|
35
|
+
* @see createResilientIndexedDbStore
|
|
36
|
+
* @see getBackoffDelay
|
|
37
|
+
* @see runWithTimeout
|
|
38
|
+
* @notInstrumented
|
|
39
|
+
*/
|
|
40
|
+
export declare const readStoredValue: <TValue>({ database, key, timeoutMs, }: ReadStoredValueParams) => Promise<StoreReadResult<TValue>>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=readStoredValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readStoredValue.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/readStoredValue/readStoredValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,qBAAqB,GAAG;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IAEZ,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM,iCAIzC,qBAAqB,KAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CA+BzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/replayTombstones/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Logger } from '../../../logger';
|
|
2
|
+
import type { TombstoneStore } from '../createTombstoneStore';
|
|
3
|
+
import type { WorkQueue } from '../createWorkQueue';
|
|
4
|
+
type ReplayTombstonesParams<TValue> = {
|
|
5
|
+
/** Reports degraded storage. */
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
/** Queue the deletions are registered with. */
|
|
8
|
+
queue: WorkQueue<TValue>;
|
|
9
|
+
/** Durable record of deletions that IndexedDB has not acknowledged. */
|
|
10
|
+
tombstones: TombstoneStore;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Re-queues the deletions an earlier instance recorded but IndexedDB never
|
|
14
|
+
* acknowledged, so a value the caller was told is gone cannot come back.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* await replayTombstones({ logger, queue, tombstones });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param params.logger - Reports degraded storage.
|
|
22
|
+
* @param params.queue - Queue the deletions are registered with.
|
|
23
|
+
* @param params.tombstones - Durable record of unacknowledged deletions.
|
|
24
|
+
* @returns A promise that resolves once the deletions are queued.
|
|
25
|
+
* @see createResilientIndexedDbStore
|
|
26
|
+
* @see createTombstoneStore
|
|
27
|
+
* @notInstrumented
|
|
28
|
+
*/
|
|
29
|
+
export declare const replayTombstones: <TValue>({ logger, queue, tombstones, }: ReplayTombstonesParams<TValue>) => Promise<void>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=replayTombstones.d.ts.map
|
package/dist/services/resilientIndexedDbStore/utils/replayTombstones/replayTombstones.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replayTombstones.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/replayTombstones/replayTombstones.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,KAAK,sBAAsB,CAAC,MAAM,IAAI;IACpC,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAEzB,uEAAuE;IACvE,UAAU,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAU,MAAM,kCAI1C,sBAAsB,CAAC,MAAM,CAAC,KAAG,OAAO,CAAC,IAAI,CAgB/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/runWithTimeout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type RunWithTimeoutParams<TResult> = {
|
|
2
|
+
/** Runs when the budget is spent, to release what the operation acquired. */
|
|
3
|
+
onTimeout?: () => void;
|
|
4
|
+
/** Work that may never settle. */
|
|
5
|
+
operation: Promise<TResult>;
|
|
6
|
+
/** How long the operation may take before it is given up on. */
|
|
7
|
+
timeoutMs: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Bounds work that may never settle, which an IndexedDB request can do: an
|
|
11
|
+
* open blocked by another connection emits neither success nor error, and a
|
|
12
|
+
* request on a connection the browser closed can stay pending.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const db = await runWithTimeout({
|
|
17
|
+
* operation: openDatabase({ database }),
|
|
18
|
+
* timeoutMs: DATABASE_OPERATION_TIMEOUT_MS,
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param params.onTimeout - Runs when the budget is spent.
|
|
23
|
+
* @param params.operation - Work that may never settle.
|
|
24
|
+
* @param params.timeoutMs - How long the operation may take.
|
|
25
|
+
* @returns Whatever the operation resolves with.
|
|
26
|
+
* @throws A `TimeoutError` `DOMException` once the budget is spent, or whatever
|
|
27
|
+
* the operation rejects with.
|
|
28
|
+
* @see withDatabase
|
|
29
|
+
* @see createWorkQueue
|
|
30
|
+
* @notInstrumented
|
|
31
|
+
*/
|
|
32
|
+
export declare const runWithTimeout: <TResult>({ onTimeout, operation, timeoutMs, }: RunWithTimeoutParams<TResult>) => Promise<TResult>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=runWithTimeout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWithTimeout.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/runWithTimeout/runWithTimeout.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,CAAC,OAAO,IAAI;IACnC,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5B,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,wCAInC,oBAAoB,CAAC,OAAO,CAAC,KAAG,OAAO,CAAC,OAAO,CAyB9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/withDatabase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { StoreDatabaseConfig } from '../../resilientIndexedDbStore.types';
|
|
2
|
+
type WithDatabaseParams<TResult> = {
|
|
3
|
+
/** Where the store keeps its records. */
|
|
4
|
+
database: StoreDatabaseConfig;
|
|
5
|
+
/** Work to run against an open connection. */
|
|
6
|
+
operation: (db: IDBDatabase) => Promise<TResult>;
|
|
7
|
+
/** How long one open-and-operate attempt may take. */
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Scopes a database connection to the lifetime of a callback.
|
|
12
|
+
*
|
|
13
|
+
* Opens a connection, passes it to the operation, and closes the connection
|
|
14
|
+
* once the operation completes or throws. Retries once with a fresh connection
|
|
15
|
+
* on a transient IndexedDB error, and gives each attempt up before its timeout
|
|
16
|
+
* so an open or a request that settles neither way cannot hang the caller.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const record = await withDatabase({
|
|
21
|
+
* database,
|
|
22
|
+
* operation: (db) => getRecord({ db, key: 'session', storeName: 'keys' }),
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param params.database - Where the store keeps its records.
|
|
27
|
+
* @param params.operation - Work to run against an open connection.
|
|
28
|
+
* @param params.timeoutMs - How long one attempt may take.
|
|
29
|
+
* @returns Whatever the operation resolves with.
|
|
30
|
+
* @throws When the operation fails and is not retryable, fails twice, or does
|
|
31
|
+
* not settle within the timeout.
|
|
32
|
+
* @see openDatabase
|
|
33
|
+
* @see runWithTimeout
|
|
34
|
+
* @see applyMutation
|
|
35
|
+
* @notInstrumented
|
|
36
|
+
*/
|
|
37
|
+
export declare const withDatabase: <TResult>(params: WithDatabaseParams<TResult>) => Promise<TResult>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=withDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withDatabase.d.ts","sourceRoot":"","sources":["../../../../../src/services/resilientIndexedDbStore/utils/withDatabase/withDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAK/E,KAAK,kBAAkB,CAAC,OAAO,IAAI;IACjC,yCAAyC;IACzC,QAAQ,EAAE,mBAAmB,CAAC;IAE9B,8CAA8C;IAC9C,SAAS,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjD,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAmDF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,YAAY,GAAU,OAAO,UAChC,kBAAkB,CAAC,OAAO,CAAC,KAClC,OAAO,CAAC,OAAO,CAUjB,CAAC"}
|