@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.
|
@@ -7495,12 +7495,16 @@ function txPromise(store, request) {
|
|
|
7495
7495
|
request.onerror = () => reject(request.error);
|
|
7496
7496
|
});
|
|
7497
7497
|
}
|
|
7498
|
-
var FileBlobStore = class extends EventEmitter {
|
|
7498
|
+
var FileBlobStore = class FileBlobStore extends EventEmitter {
|
|
7499
|
+
static {
|
|
7500
|
+
this.NOT_FOUND_TTL = 300 * 1e3;
|
|
7501
|
+
}
|
|
7499
7502
|
constructor(serverOrigin, client) {
|
|
7500
7503
|
super();
|
|
7501
7504
|
this.dbPromise = null;
|
|
7502
7505
|
this.db = null;
|
|
7503
7506
|
this.objectUrls = /* @__PURE__ */ new Map();
|
|
7507
|
+
this._notFound = /* @__PURE__ */ new Map();
|
|
7504
7508
|
this._flushing = false;
|
|
7505
7509
|
this.origin = serverOrigin;
|
|
7506
7510
|
this.client = client ?? null;
|
|
@@ -7542,10 +7546,13 @@ var FileBlobStore = class extends EventEmitter {
|
|
|
7542
7546
|
}
|
|
7543
7547
|
}
|
|
7544
7548
|
if (!this.client) return null;
|
|
7549
|
+
const nfTime = this._notFound.get(key);
|
|
7550
|
+
if (nfTime && Date.now() - nfTime < FileBlobStore.NOT_FOUND_TTL) return null;
|
|
7545
7551
|
let blob;
|
|
7546
7552
|
try {
|
|
7547
7553
|
blob = await this.client.getUpload(docId, uploadId);
|
|
7548
|
-
} catch {
|
|
7554
|
+
} catch (err) {
|
|
7555
|
+
if (err?.status === 404) this._notFound.set(key, Date.now());
|
|
7549
7556
|
return null;
|
|
7550
7557
|
}
|
|
7551
7558
|
if (db) {
|
|
@@ -7569,6 +7576,7 @@ var FileBlobStore = class extends EventEmitter {
|
|
|
7569
7576
|
async putBlob(docId, uploadId, blob, filename) {
|
|
7570
7577
|
if (typeof window === "undefined") return URL.createObjectURL(blob);
|
|
7571
7578
|
const key = this.blobKey(docId, uploadId);
|
|
7579
|
+
this._notFound.delete(key);
|
|
7572
7580
|
const existing = this.objectUrls.get(key);
|
|
7573
7581
|
if (existing) return existing;
|
|
7574
7582
|
const db = await this.getDb();
|