@drakkar.software/starfish-client 3.0.0-alpha.31 → 3.0.0-alpha.35
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/README.md +5 -1
- package/dist/bindings/zustand.d.ts +13 -1
- package/dist/bindings/zustand.js +134 -73
- package/dist/bindings/zustand.js.map +2 -2
- package/dist/client.d.ts +38 -6
- package/dist/index.js +115 -73
- package/dist/index.js.map +2 -2
- package/dist/sync.d.ts +12 -0
- package/dist/types.d.ts +13 -7
- package/package.json +3 -3
package/dist/sync.d.ts
CHANGED
|
@@ -106,6 +106,18 @@ export declare class SyncManager {
|
|
|
106
106
|
*/
|
|
107
107
|
seedFromCache(): Promise<boolean>;
|
|
108
108
|
getCheckpoint(): number;
|
|
109
|
+
/**
|
|
110
|
+
* Apply a freshly-fetched `PullResult` to this manager's state WITHOUT
|
|
111
|
+
* firing a network request. Used by the zustand binding's `mergeResult`
|
|
112
|
+
* action to absorb a background revalidation result (delivered via
|
|
113
|
+
* {@link StarfishClientOptions.onRevalidated}) into the store.
|
|
114
|
+
*
|
|
115
|
+
* Unlike {@link pull}, `ingest` never does a deep-merge with the previous
|
|
116
|
+
* checkpoint — the revalidated result is always a full fresh snapshot. It
|
|
117
|
+
* sets `lastFromCache = false` (a revalidation is a live response) so the
|
|
118
|
+
* binding can clear its `stale` flag.
|
|
119
|
+
*/
|
|
120
|
+
ingest(result: PullResult): Promise<void>;
|
|
109
121
|
pull(): Promise<PullResult>;
|
|
110
122
|
push(data: Record<string, unknown>): Promise<{
|
|
111
123
|
hash: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -144,15 +144,21 @@ export interface StarfishClientOptions {
|
|
|
144
144
|
*/
|
|
145
145
|
cacheFallbackStatuses?: number[];
|
|
146
146
|
/**
|
|
147
|
-
* Called after a background revalidation
|
|
148
|
-
*
|
|
149
|
-
* the fresh snapshot has been written through to the cache.
|
|
147
|
+
* Called after a background revalidation delivers a fresh snapshot to the
|
|
148
|
+
* cache. Fires for two revalidation paths:
|
|
150
149
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
150
|
+
* 1. **Error-triggered** ({@link cacheFallbackStatuses} hit): the server
|
|
151
|
+
* returned a transient error (429/5xx), `pull()` served the stale cache,
|
|
152
|
+
* and the background retry loop eventually got a live response.
|
|
153
|
+
* 2. **SWR-on-read** ({@link PullOptions.staleWhileRevalidate}): `pull()`
|
|
154
|
+
* served the cache immediately and the background fetch completed.
|
|
153
155
|
*
|
|
154
|
-
* `
|
|
155
|
-
*
|
|
156
|
+
* In both cases `result` is the fresh `PullResult` just written to cache.
|
|
157
|
+
* Use this to signal reachability recovery and/or push the fresh data into
|
|
158
|
+
* any store that is showing the stale snapshot.
|
|
159
|
+
*
|
|
160
|
+
* `path` is the namespaced document path (namespace prefix + path + query
|
|
161
|
+
* string, matching the cache key written by {@link StarfishClient.pull}).
|
|
156
162
|
*/
|
|
157
163
|
onRevalidated?: (path: string, result: PullResult) => void;
|
|
158
164
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drakkar.software/starfish-client",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.35",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Drakkar-Software/starfish.git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@drakkar.software/starfish-protocol": "3.0.0-alpha.
|
|
67
|
+
"@drakkar.software/starfish-protocol": "3.0.0-alpha.35"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@legendapp/state": "^2.0.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"react": "^19.2.4",
|
|
79
79
|
"react-dom": "^19.2.4",
|
|
80
80
|
"typescript": "^5.5.0",
|
|
81
|
-
"vitest": "^3.
|
|
81
|
+
"vitest": "^3.2.6",
|
|
82
82
|
"zustand": "^5.0.11"
|
|
83
83
|
},
|
|
84
84
|
"files": [
|