@abraca/dabra 1.0.11 → 1.0.12
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.
|
@@ -7465,12 +7465,16 @@ function txPromise(store, request) {
|
|
|
7465
7465
|
request.onerror = () => reject(request.error);
|
|
7466
7466
|
});
|
|
7467
7467
|
}
|
|
7468
|
-
var FileBlobStore = class extends EventEmitter {
|
|
7468
|
+
var FileBlobStore = class FileBlobStore extends EventEmitter {
|
|
7469
|
+
static {
|
|
7470
|
+
this.NOT_FOUND_TTL = 300 * 1e3;
|
|
7471
|
+
}
|
|
7469
7472
|
constructor(serverOrigin, client) {
|
|
7470
7473
|
super();
|
|
7471
7474
|
this.dbPromise = null;
|
|
7472
7475
|
this.db = null;
|
|
7473
7476
|
this.objectUrls = /* @__PURE__ */ new Map();
|
|
7477
|
+
this._notFound = /* @__PURE__ */ new Map();
|
|
7474
7478
|
this._flushing = false;
|
|
7475
7479
|
this.origin = serverOrigin;
|
|
7476
7480
|
this.client = client ?? null;
|
|
@@ -7512,10 +7516,13 @@ var FileBlobStore = class extends EventEmitter {
|
|
|
7512
7516
|
}
|
|
7513
7517
|
}
|
|
7514
7518
|
if (!this.client) return null;
|
|
7519
|
+
const nfTime = this._notFound.get(key);
|
|
7520
|
+
if (nfTime && Date.now() - nfTime < FileBlobStore.NOT_FOUND_TTL) return null;
|
|
7515
7521
|
let blob;
|
|
7516
7522
|
try {
|
|
7517
7523
|
blob = await this.client.getUpload(docId, uploadId);
|
|
7518
|
-
} catch {
|
|
7524
|
+
} catch (err) {
|
|
7525
|
+
if (err?.status === 404) this._notFound.set(key, Date.now());
|
|
7519
7526
|
return null;
|
|
7520
7527
|
}
|
|
7521
7528
|
if (db) {
|
|
@@ -7539,6 +7546,7 @@ var FileBlobStore = class extends EventEmitter {
|
|
|
7539
7546
|
async putBlob(docId, uploadId, blob, filename) {
|
|
7540
7547
|
if (typeof window === "undefined") return URL.createObjectURL(blob);
|
|
7541
7548
|
const key = this.blobKey(docId, uploadId);
|
|
7549
|
+
this._notFound.delete(key);
|
|
7542
7550
|
const existing = this.objectUrls.get(key);
|
|
7543
7551
|
if (existing) return existing;
|
|
7544
7552
|
const db = await this.getDb();
|