@vizejs/data 0.804.0 → 0.805.0
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 +3 -1
- package/dist/index.d.mts +13 -1
- package/dist/index.mjs +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,9 @@ const article = await data.load(
|
|
|
38
38
|
|
|
39
39
|
Server renderers can call `serializeDataSnapshot(data)` and hydrate the client with
|
|
40
40
|
`hydrateDataClient(snapshot)`. Hydrated success entries satisfy the first client load without
|
|
41
|
-
issuing duplicate network work; `policy: "replace"` opts back into a fresh request.
|
|
41
|
+
issuing duplicate network work; `policy: "replace"` opts back into a fresh request. A failed fetch
|
|
42
|
+
serializes as its name, message, and status: the decoded error body stays on the server unless
|
|
43
|
+
`serializeError` returns it.
|
|
42
44
|
|
|
43
45
|
## Cache, races, and optimistic work
|
|
44
46
|
|
package/dist/index.d.mts
CHANGED
|
@@ -209,12 +209,24 @@ declare function createDataManifest<const Resources extends readonly AnyDataReso
|
|
|
209
209
|
declare function streamDataSnapshot(snapshot: DataSnapshot): AsyncGenerator<SerializedDataState, void, void>;
|
|
210
210
|
//#endregion
|
|
211
211
|
//#region src/adapters.d.ts
|
|
212
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* HTTP loader failure with the response status and decoded error body.
|
|
214
|
+
*
|
|
215
|
+
* The body stays in process. The JSON form, which is what an SSR snapshot
|
|
216
|
+
* sends to every visitor, carries the status alone; return the fields a
|
|
217
|
+
* client needs from `serializeError`.
|
|
218
|
+
*/
|
|
213
219
|
declare class DataHttpError extends Error {
|
|
214
220
|
readonly status: number;
|
|
215
221
|
readonly statusText: string;
|
|
216
222
|
readonly body: unknown;
|
|
217
223
|
constructor(response: Response, body: unknown);
|
|
224
|
+
toJSON(): {
|
|
225
|
+
name: string;
|
|
226
|
+
message: string;
|
|
227
|
+
status: number;
|
|
228
|
+
statusText: string;
|
|
229
|
+
};
|
|
218
230
|
}
|
|
219
231
|
/** Typed HTTP endpoint and decoding policy for a fetch-backed resource. */
|
|
220
232
|
interface FetchDataResourceOptions<Key extends DataResourceKey, Input, Data, ErrorPayload = unknown, Meta extends DataResourceMeta = DataResourceMeta> {
|
package/dist/index.mjs
CHANGED
|
@@ -320,7 +320,13 @@ function validateResource(resource) {
|
|
|
320
320
|
}
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/adapters.ts
|
|
323
|
-
/**
|
|
323
|
+
/**
|
|
324
|
+
* HTTP loader failure with the response status and decoded error body.
|
|
325
|
+
*
|
|
326
|
+
* The body stays in process. The JSON form, which is what an SSR snapshot
|
|
327
|
+
* sends to every visitor, carries the status alone; return the fields a
|
|
328
|
+
* client needs from `serializeError`.
|
|
329
|
+
*/
|
|
324
330
|
var DataHttpError = class extends Error {
|
|
325
331
|
status;
|
|
326
332
|
statusText;
|
|
@@ -332,6 +338,14 @@ var DataHttpError = class extends Error {
|
|
|
332
338
|
this.statusText = response.statusText;
|
|
333
339
|
this.body = body;
|
|
334
340
|
}
|
|
341
|
+
toJSON() {
|
|
342
|
+
return {
|
|
343
|
+
name: this.name,
|
|
344
|
+
message: this.message,
|
|
345
|
+
status: this.status,
|
|
346
|
+
statusText: this.statusText
|
|
347
|
+
};
|
|
348
|
+
}
|
|
335
349
|
};
|
|
336
350
|
/** Adapt a typed HTTP endpoint without reading `fetch` during module evaluation. */
|
|
337
351
|
function createFetchDataResource(options) {
|