@jigs.design/client 0.3.2 → 0.3.4
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/client.d.ts +10 -2
- package/dist/client.js +2 -0
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HeadersOption, Transport } from "./transport.js";
|
|
2
|
-
import { Diagnostic, JigsErrorData, MutationResult, PageProps, Program, QueryResult, SessionBody, SessionEvent } from "@jigs.design/protocol";
|
|
2
|
+
import { Diagnostic, JigsErrorData, JsonValue, MutationResult, PageProps, Program, QueryResult, SessionBody, SessionEvent } from "@jigs.design/protocol";
|
|
3
3
|
//#region src/client.d.ts
|
|
4
4
|
interface CacheOptions {
|
|
5
5
|
/**
|
|
@@ -46,8 +46,14 @@ export type ClientOptions = CacheOptions & ConfirmOptions & ({
|
|
|
46
46
|
headers?: never;
|
|
47
47
|
transport: Transport;
|
|
48
48
|
});
|
|
49
|
-
/** A page's program and
|
|
49
|
+
/** A page's program, its diagnostics and the data it keeps, as the server served them. */
|
|
50
50
|
export interface PageData {
|
|
51
|
+
/**
|
|
52
|
+
* Provided data the page is drawn with, by slot: what the server kept
|
|
53
|
+
* with a saved page. Empty for a shipped page. Pass it to the view with
|
|
54
|
+
* the page's own slots: `data={{ ...page.data, ...own }}`.
|
|
55
|
+
*/
|
|
56
|
+
data: Readonly<Record<string, JsonValue>>;
|
|
51
57
|
/**
|
|
52
58
|
* A saved page is compiled leniently, so these may hold errors: show a
|
|
53
59
|
* notice beside the program when one is an error or a warning.
|
|
@@ -57,6 +63,8 @@ export interface PageData {
|
|
|
57
63
|
}
|
|
58
64
|
/** A page as `observePage` reports it. */
|
|
59
65
|
export interface PageResult {
|
|
66
|
+
/** The provided data the page keeps; empty until a program arrives. */
|
|
67
|
+
data: Readonly<Record<string, JsonValue>>;
|
|
60
68
|
/** The program's diagnostics; empty until one arrives. */
|
|
61
69
|
diagnostics: ReadonlyArray<Diagnostic>;
|
|
62
70
|
/** `{ code, message }` when `status` is "error". */
|
package/dist/client.js
CHANGED
|
@@ -113,6 +113,7 @@ function pageKey(name, props) {
|
|
|
113
113
|
}
|
|
114
114
|
function toPageResult(result) {
|
|
115
115
|
return {
|
|
116
|
+
data: result.data?.data ?? {},
|
|
116
117
|
diagnostics: result.data?.diagnostics ?? [],
|
|
117
118
|
error: result.status === "error" ? errorDataOf(result.error) : null,
|
|
118
119
|
program: result.data?.program ?? null,
|
|
@@ -169,6 +170,7 @@ function createJigsClient(options) {
|
|
|
169
170
|
}, { signal: context.signal });
|
|
170
171
|
noteVersion(reply.version, pageKey(name, props));
|
|
171
172
|
return {
|
|
173
|
+
data: reply.data,
|
|
172
174
|
diagnostics: reply.diagnostics,
|
|
173
175
|
program: reply.program
|
|
174
176
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jigs.design/client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "createJigsClient: the browser's transport and query cache. No React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tanstack/query-core": "5.104.4",
|
|
29
|
-
"@jigs.design/
|
|
30
|
-
"@jigs.design/
|
|
29
|
+
"@jigs.design/protocol": "0.3.4",
|
|
30
|
+
"@jigs.design/runtime": "0.3.4"
|
|
31
31
|
}
|
|
32
32
|
}
|