@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/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 succeeds following a
148
- * {@link cacheFallbackStatuses} hit: the server returned a live response and
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
- * Use this to signal to the host app that the server is reachable again (e.g.
152
- * call `reportReachability(true)`) so any stale views can re-pull and recover.
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
- * `path` is the namespaced document path sent to the server (namespace prefix
155
- * + path + query string, matching the key under which the snapshot was cached).
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.31",
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.31"
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.0.0",
81
+ "vitest": "^3.2.6",
82
82
  "zustand": "^5.0.11"
83
83
  },
84
84
  "files": [