@pmate/chat-sdk 0.12.0-next.72 → 0.12.0-next.73
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.
|
@@ -229,7 +229,8 @@ export class IndexedDbMessageStore {
|
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
async scopeAccess() {
|
|
232
|
-
const
|
|
232
|
+
const read = () => this.accessRows.get(this.key);
|
|
233
|
+
const access = (await (Dexie.currentTransaction?.db === this.db ? read() : this.transact("r", this.accessRows, read))) ?? { scope: this.key, version: 0, revoked: false };
|
|
233
234
|
if (!Number.isSafeInteger(access.version) || access.version < 0 || typeof access.revoked !== "boolean")
|
|
234
235
|
throw new Error("INVALID_MESSAGE_SCOPE_ACCESS");
|
|
235
236
|
return access;
|
|
@@ -48,7 +48,7 @@ export class IndexedDbResponseCache {
|
|
|
48
48
|
if (!this.options.access)
|
|
49
49
|
return;
|
|
50
50
|
const access = await this.options.access();
|
|
51
|
-
const stored = await this.epochs.get(this.scope);
|
|
51
|
+
const stored = await this.transact("r", this.epochs, () => this.epochs.get(this.scope));
|
|
52
52
|
const storedVersion = stored?.accessVersion ?? 0;
|
|
53
53
|
if (access.version < storedVersion)
|
|
54
54
|
throw new Error("RESPONSE_CACHE_SCOPE_CHANGED");
|
package/package.json
CHANGED