@drakkar.software/starfish-client 3.0.0-alpha.26 → 3.0.0-alpha.27
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/bindings/zustand.js +14 -1
- package/dist/bindings/zustand.js.map +2 -2
- package/dist/index.js +14 -1
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/bindings/zustand.js
CHANGED
|
@@ -679,7 +679,20 @@ var StarfishClient = class {
|
|
|
679
679
|
if (!res.ok) {
|
|
680
680
|
throw new StarfishHttpError(res.status, await res.text());
|
|
681
681
|
}
|
|
682
|
-
|
|
682
|
+
const result = await res.json();
|
|
683
|
+
if (this.cache) {
|
|
684
|
+
const pullPath = sendPath.replace("/push/", "/pull/");
|
|
685
|
+
const cacheKey = pullCacheKey(pullPath);
|
|
686
|
+
const snapshot = {
|
|
687
|
+
data,
|
|
688
|
+
hash: result.hash,
|
|
689
|
+
timestamp: result.timestamp,
|
|
690
|
+
cachedAt: Date.now()
|
|
691
|
+
};
|
|
692
|
+
void this.cache.set(cacheKey, JSON.stringify(snapshot)).catch(() => {
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
return result;
|
|
683
696
|
}
|
|
684
697
|
/**
|
|
685
698
|
* Append an element to an appendOnly (`by_timestamp`) collection.
|