@client-compose/client 0.6.0 → 0.8.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 +40 -4
- package/dist/index.d.ts +71 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +288 -25
- package/dist/index.js.map +1 -1
- package/dist/proxy.d.ts +9 -1
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +87 -21
- package/dist/proxy.js.map +1 -1
- package/dist/testing.d.ts +49 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +202 -21
- package/dist/testing.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +362 -28
- package/src/proxy.ts +107 -25
- package/src/testing.ts +256 -23
package/README.md
CHANGED
|
@@ -39,8 +39,34 @@ container.replaceChildren(...islands.map((island) => island.render()));
|
|
|
39
39
|
never returns one it can't.
|
|
40
40
|
- **`plan`** returns renderable islands in order. Errored islands are omitted unless you pass
|
|
41
41
|
`onError`; islands with an unknown type, version or status are skipped and reported.
|
|
42
|
-
- **`fetchScreen`**
|
|
43
|
-
accepts a custom `fetch`
|
|
42
|
+
- **`fetchScreen`** reads the screen's stream to its end, and returns it whole. It throws
|
|
43
|
+
`ScreenFetchError` (with `status` and `body`) for non-2xx responses, and accepts a custom `fetch`
|
|
44
|
+
as its fourth argument.
|
|
45
|
+
|
|
46
|
+
## Streams
|
|
47
|
+
|
|
48
|
+
A screen arrives as a stream (spec §4.6): its head, with any island not yet ready `pending`, then
|
|
49
|
+
each of those as the composer resolves it. **`openScreen`** resolves once the head is in, so you can
|
|
50
|
+
show the screen and fill it in:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const stream = await openScreen(baseUrl, request, init);
|
|
54
|
+
let screen = stream.head;
|
|
55
|
+
show(plan(registry, screen)); // pending islands are their placeholders, or left out
|
|
56
|
+
for await (const island of stream.islands) {
|
|
57
|
+
screen = withIsland(screen, island);
|
|
58
|
+
show(plan(registry, screen));
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- Register a placeholder for an island with `registry.registerPlaceholder(Descriptor, () => …)`:
|
|
63
|
+
`plan` shows it while the island is pending. Without one, the island is left out until it arrives.
|
|
64
|
+
- An island the stream never brings (the connection dropped) arrives as an error, `incomplete`,
|
|
65
|
+
retryable.
|
|
66
|
+
- `collectScreen(stream)` reads the rest and returns the whole screen.
|
|
67
|
+
- The body is read as it comes when your `fetch` gives a readable stream (browsers, Node, Deno, Bun,
|
|
68
|
+
and `expo/fetch` in React Native). React Native's built-in `fetch` doesn't, so there the screen
|
|
69
|
+
arrives all at once.
|
|
44
70
|
|
|
45
71
|
## Actions
|
|
46
72
|
|
|
@@ -66,12 +92,22 @@ Props aren't validated at runtime; generate types with
|
|
|
66
92
|
[`@client-compose/codegen`](https://www.npmjs.com/package/@client-compose/codegen) to keep them in
|
|
67
93
|
sync with the composer.
|
|
68
94
|
|
|
95
|
+
## Islands with pages
|
|
96
|
+
|
|
97
|
+
An island entry carries `next` while the island has more pages (spec §4.5).
|
|
98
|
+
`fetchIsland(baseUrl, buildIslandRequest(screen, params, entry, client, entry.next))` fetches the
|
|
99
|
+
next one: the island's entry again, with that page's props and its own `next`. Without a cursor, it
|
|
100
|
+
resolves the island again from its first page. The React binding's `usePages` does this for you.
|
|
101
|
+
|
|
69
102
|
## Testing
|
|
70
103
|
|
|
71
104
|
`@client-compose/client/testing` is a fake composer for tests, with no test framework of its own.
|
|
72
105
|
`createFakeGateway` answers screen and action requests from handlers and records them; pass its
|
|
73
106
|
`fetch` to the client. Build responses with `island`, `islandError`, `screen`, `screenError`,
|
|
74
|
-
`actionOk`, `actionError` and `actionFailure`, typed by the generated descriptors.
|
|
107
|
+
`actionOk`, `actionError` and `actionFailure`, typed by the generated descriptors. A `screen` is
|
|
108
|
+
sent whole (a head and an end); to control when each island arrives, answer with
|
|
109
|
+
`streamedScreen(id, [island(…), pending(key, Descriptor)])`, then call its `send(entry)`, `end()`,
|
|
110
|
+
or `cut()` for a dropped connection.
|
|
75
111
|
|
|
76
112
|
```ts
|
|
77
113
|
import { actionError, createFakeGateway } from "@client-compose/client/testing";
|
|
@@ -90,7 +126,7 @@ For React, `@client-compose/react/testing` adds a provider config built around i
|
|
|
90
126
|
|
|
91
127
|
## Through your own server
|
|
92
128
|
|
|
93
|
-
`@client-compose/client/proxy` passes a browser's screen and action requests to the composer
|
|
129
|
+
`@client-compose/client/proxy` passes a browser's screen, island and action requests to the composer
|
|
94
130
|
through your server, so it can add what the browser mustn't hold, such as a session kept in an
|
|
95
131
|
httpOnly cookie. `createComposerProxy({ baseUrl, client, headers, onActionResponse })` checks each
|
|
96
132
|
request (anyone can call a server endpoint with anything), sets the client context and headers,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActionDescriptor, type ActionRequest, type ActionResponse, type Capabilities, type ClientContext, type DeclaredError, type IslandDescriptor, type IslandEntry, type ScreenRequest, type ScreenResponse } from "@client-compose/protocol";
|
|
1
|
+
import { type ActionDescriptor, type ActionRequest, type ActionResponse, type Capabilities, type ClientContext, type DeclaredError, type IslandDescriptor, type IslandEntry, type IslandRequest, type ScreenHead, type ScreenRequest, type ScreenResponse } from "@client-compose/protocol";
|
|
2
2
|
type OkEntry<P = unknown> = IslandEntry<P> & {
|
|
3
3
|
status: "ok";
|
|
4
4
|
};
|
|
@@ -6,11 +6,22 @@ type ErrorEntry = IslandEntry & {
|
|
|
6
6
|
status: "error";
|
|
7
7
|
};
|
|
8
8
|
export type IslandRenderer<R, P = unknown> = (props: P, entry: OkEntry<P>) => R;
|
|
9
|
+
/** What a client shows for an island still pending in a stream's head (spec §4.6). */
|
|
10
|
+
export type IslandPlaceholder<R> = () => R;
|
|
9
11
|
export declare class IslandRegistry<R> {
|
|
10
12
|
private renderers;
|
|
13
|
+
private placeholders;
|
|
14
|
+
/**
|
|
15
|
+
* Register a placeholder for an island version, shown while it's pending in a stream's head
|
|
16
|
+
* (spec §4.6). Each app draws its own: the protocol says nothing about how one looks.
|
|
17
|
+
*/
|
|
18
|
+
registerPlaceholder(island: IslandDescriptor<unknown>, placeholder: IslandPlaceholder<R>): this;
|
|
19
|
+
/** The placeholder for an island version, if one was registered. */
|
|
20
|
+
placeholder(type: string, version: number): IslandPlaceholder<R> | undefined;
|
|
11
21
|
/** Register a renderer for a generated island descriptor: `register(ProfileHeaderV2, (props) => …)`. */
|
|
12
22
|
register<P>(island: IslandDescriptor<P>, render: IslandRenderer<R, P>): this;
|
|
13
23
|
register<P>(type: string, version: number, render: IslandRenderer<R, P>): this;
|
|
24
|
+
private add;
|
|
14
25
|
capabilities(): Capabilities;
|
|
15
26
|
get(type: string, version: number): IslandRenderer<R> | undefined;
|
|
16
27
|
}
|
|
@@ -18,6 +29,8 @@ export declare function buildRequest(registry: IslandRegistry<unknown>, screen:
|
|
|
18
29
|
export interface PlannedIsland<R> {
|
|
19
30
|
key: string;
|
|
20
31
|
render: () => R;
|
|
32
|
+
/** It's a placeholder, for an island still pending in a stream's head (spec §4.6). */
|
|
33
|
+
pending?: boolean;
|
|
21
34
|
}
|
|
22
35
|
export type SkipReason = "unknown_island" | "unknown_status";
|
|
23
36
|
export interface PlanOptions<R> {
|
|
@@ -26,8 +39,11 @@ export interface PlanOptions<R> {
|
|
|
26
39
|
/** Called for islands the client can't render (spec §4.4). Useful for telemetry. */
|
|
27
40
|
onSkipped?: (entry: IslandEntry, reason: SkipReason) => void;
|
|
28
41
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Turn a screen, or a stream's head (spec §4.6), into an ordered list of renderable islands. An
|
|
44
|
+
* island still pending is its registered placeholder, or left out until it arrives.
|
|
45
|
+
*/
|
|
46
|
+
export declare function plan<R>(registry: IslandRegistry<R>, response: ScreenResponse | ScreenHead, options?: PlanOptions<R>): PlannedIsland<R>[];
|
|
31
47
|
export declare class ScreenFetchError extends Error {
|
|
32
48
|
readonly status: number;
|
|
33
49
|
readonly body: string;
|
|
@@ -35,7 +51,59 @@ export declare class ScreenFetchError extends Error {
|
|
|
35
51
|
readonly code: string | undefined;
|
|
36
52
|
constructor(status: number, body: string);
|
|
37
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Fetch a screen, all of it: its stream (spec §4.6) read to the end. Throws ScreenFetchError for a
|
|
56
|
+
* non-2xx response (e.g. `not_found`) or one that isn't a screen. To show its islands as they
|
|
57
|
+
* arrive, use openScreen.
|
|
58
|
+
*/
|
|
38
59
|
export declare function fetchScreen(baseUrl: string, request: ScreenRequest, init?: RequestInit, fetchImpl?: typeof fetch): Promise<ScreenResponse>;
|
|
60
|
+
/** A screen as it arrives: its head, then each pending island as the composer resolves it. */
|
|
61
|
+
export interface ScreenStream {
|
|
62
|
+
/** The screen, its islands resolved or pending. */
|
|
63
|
+
head: ScreenHead;
|
|
64
|
+
/**
|
|
65
|
+
* Each pending island's entry, as it arrives. If the stream ends early, those that never came
|
|
66
|
+
* arrive as errors: `incomplete`, retryable.
|
|
67
|
+
*/
|
|
68
|
+
islands: AsyncIterable<IslandEntry>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Request a screen, and resolve once its head has arrived. Throws ScreenFetchError for a non-2xx
|
|
72
|
+
* response (e.g. `not_found`) or one that isn't a screen's stream.
|
|
73
|
+
*/
|
|
74
|
+
export declare function openScreen(baseUrl: string, request: ScreenRequest, init?: RequestInit, fetchImpl?: typeof fetch): Promise<ScreenStream>;
|
|
75
|
+
/** Reads the rest of a stream, and returns the screen with every island in place. */
|
|
76
|
+
export declare function collectScreen(stream: ScreenStream): Promise<ScreenResponse>;
|
|
77
|
+
/** The head with a pending island's entry in its place; unchanged if the key isn't pending. */
|
|
78
|
+
export declare function withIsland(head: ScreenHead, entry: IslandEntry): ScreenHead;
|
|
79
|
+
/** A screen's head and end as a stream, for a screen that's already complete (spec §4.6). */
|
|
80
|
+
export declare function screenLines(screen: ScreenResponse): string;
|
|
81
|
+
/**
|
|
82
|
+
* A request for one island of a screen: the page `cursor` asks for (an entry's `next`), or the
|
|
83
|
+
* island from its first page without one. `params` are the screen's own.
|
|
84
|
+
*/
|
|
85
|
+
export declare function buildIslandRequest(screen: string, params: Record<string, string> | undefined, entry: {
|
|
86
|
+
key: string;
|
|
87
|
+
version: number;
|
|
88
|
+
}, client: ClientContext, cursor?: string): IslandRequest;
|
|
89
|
+
/**
|
|
90
|
+
* POST an island request. Resolves with the island's entry: its props (and `next`, if it has more
|
|
91
|
+
* pages) or the error it failed with. Throws IslandFetchError for a non-2xx response (e.g.
|
|
92
|
+
* `invalid_cursor`, `unknown_island`, `unauthenticated`), or an answer that isn't this island.
|
|
93
|
+
*/
|
|
94
|
+
export declare function fetchIsland(baseUrl: string, request: IslandRequest, init?: RequestInit, fetchImpl?: typeof fetch): Promise<IslandEntry>;
|
|
95
|
+
/**
|
|
96
|
+
* An island request failed: a non-2xx response such as `invalid_cursor`, `unknown_island` or
|
|
97
|
+
* `unauthenticated`, or an answer that isn't the island asked for. An island that failed on the
|
|
98
|
+
* composer isn't thrown: it's an entry with `status: "error"`.
|
|
99
|
+
*/
|
|
100
|
+
export declare class IslandFetchError extends Error {
|
|
101
|
+
readonly status: number;
|
|
102
|
+
readonly body: string;
|
|
103
|
+
/** The protocol error code from the response body (e.g. "invalid_cursor"), if there was one. */
|
|
104
|
+
readonly code: string | undefined;
|
|
105
|
+
constructor(status: number, body: string);
|
|
106
|
+
}
|
|
39
107
|
/**
|
|
40
108
|
* The composer didn't perform the action: a non-2xx response such as `invalid_input`,
|
|
41
109
|
* `unauthenticated` or `action_failed`. Declared errors are not thrown; they're outcomes.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KA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O,CAAC,cAAc,CAAC,CAgBzB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,aAAa,EAC/D,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACjC,QAAQ,EAAE,OAAO,GAChB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAYtB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,aAAa,EAC5D,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACjC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAW/B"}
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,38 @@
|
|
|
3
3
|
import { PROTOCOL_VERSION, } from "@client-compose/protocol";
|
|
4
4
|
export class IslandRegistry {
|
|
5
5
|
renderers = new Map();
|
|
6
|
+
placeholders = new Map();
|
|
7
|
+
/**
|
|
8
|
+
* Register a placeholder for an island version, shown while it's pending in a stream's head
|
|
9
|
+
* (spec §4.6). Each app draws its own: the protocol says nothing about how one looks.
|
|
10
|
+
*/
|
|
11
|
+
registerPlaceholder(island, placeholder) {
|
|
12
|
+
this.placeholders.set(`${island.type}@${island.version}`, placeholder);
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
/** The placeholder for an island version, if one was registered. */
|
|
16
|
+
placeholder(type, version) {
|
|
17
|
+
return this.placeholders.get(`${type}@${version}`);
|
|
18
|
+
}
|
|
6
19
|
register(islandOrType, versionOrRender, maybeRender) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
if (typeof islandOrType !== "string") {
|
|
21
|
+
if (typeof versionOrRender === "number") {
|
|
22
|
+
throw new Error("register(descriptor, render): pass the renderer, not a version");
|
|
23
|
+
}
|
|
24
|
+
return this.add(islandOrType.type, islandOrType.version, versionOrRender);
|
|
25
|
+
}
|
|
26
|
+
if (typeof versionOrRender !== "number" || !maybeRender) {
|
|
27
|
+
throw new Error("register(type, version, render): pass a version and a renderer");
|
|
28
|
+
}
|
|
29
|
+
return this.add(islandOrType, versionOrRender, maybeRender);
|
|
30
|
+
}
|
|
31
|
+
add(type, version, render) {
|
|
32
|
+
const versions = this.renderers.get(type) ?? new Map();
|
|
33
|
+
// The registry hands each renderer the props of its own island type and version, so the
|
|
34
|
+
// renderer's props type holds. TypeScript can't see that through one map of every island.
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
36
|
+
versions.set(version, render);
|
|
37
|
+
this.renderers.set(type, versions);
|
|
14
38
|
return this;
|
|
15
39
|
}
|
|
16
40
|
capabilities() {
|
|
@@ -24,16 +48,39 @@ export class IslandRegistry {
|
|
|
24
48
|
}
|
|
25
49
|
}
|
|
26
50
|
export function buildRequest(registry, screen, client, params) {
|
|
27
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
protocol: PROTOCOL_VERSION,
|
|
53
|
+
screen,
|
|
54
|
+
params,
|
|
55
|
+
client,
|
|
56
|
+
islands: registry.capabilities(),
|
|
57
|
+
};
|
|
28
58
|
}
|
|
29
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Turn a screen, or a stream's head (spec §4.6), into an ordered list of renderable islands. An
|
|
61
|
+
* island still pending is its registered placeholder, or left out until it arrives.
|
|
62
|
+
*/
|
|
30
63
|
export function plan(registry, response, options = {}) {
|
|
31
64
|
const out = [];
|
|
32
65
|
for (const entry of response.islands) {
|
|
66
|
+
if (entry.status === "pending") {
|
|
67
|
+
const placeholder = registry.get(entry.type, entry.version)
|
|
68
|
+
? registry.placeholder(entry.type, entry.version)
|
|
69
|
+
: undefined;
|
|
70
|
+
if (placeholder) {
|
|
71
|
+
out.push({
|
|
72
|
+
key: entry.key,
|
|
73
|
+
render: placeholder,
|
|
74
|
+
pending: true,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
33
79
|
if (entry.status === "error") {
|
|
34
80
|
const fallback = options.onError?.(entry);
|
|
35
|
-
if (fallback !== undefined)
|
|
81
|
+
if (fallback !== undefined) {
|
|
36
82
|
out.push({ key: entry.key, render: () => fallback });
|
|
83
|
+
}
|
|
37
84
|
continue;
|
|
38
85
|
}
|
|
39
86
|
if (entry.status !== "ok") {
|
|
@@ -49,6 +96,30 @@ export function plan(registry, response, options = {}) {
|
|
|
49
96
|
}
|
|
50
97
|
return out;
|
|
51
98
|
}
|
|
99
|
+
// ---- Reading what the composer answered ----
|
|
100
|
+
function isRecord(value) {
|
|
101
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
102
|
+
}
|
|
103
|
+
/** The body as JSON, or undefined if it isn't JSON. */
|
|
104
|
+
function parseJson(text) {
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(text);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function isIslandEntry(value) {
|
|
113
|
+
if (!isRecord(value)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const named = typeof value.key === "string" && typeof value.type === "string";
|
|
117
|
+
return named && typeof value.version === "number" && typeof value.status === "string";
|
|
118
|
+
}
|
|
119
|
+
/** An action's outcome: what a client needs of one is its status (the client fixtures, spec §8.2). */
|
|
120
|
+
function isActionResponse(value) {
|
|
121
|
+
return isRecord(value) && (value.status === "ok" || value.status === "error");
|
|
122
|
+
}
|
|
52
123
|
export class ScreenFetchError extends Error {
|
|
53
124
|
status;
|
|
54
125
|
body;
|
|
@@ -63,23 +134,209 @@ export class ScreenFetchError extends Error {
|
|
|
63
134
|
}
|
|
64
135
|
function errorCode(body) {
|
|
65
136
|
try {
|
|
66
|
-
const
|
|
137
|
+
const parsed = JSON.parse(body);
|
|
138
|
+
const error = isRecord(parsed) ? parsed.error : undefined;
|
|
139
|
+
const code = isRecord(error) ? error.code : undefined;
|
|
67
140
|
return typeof code === "string" ? code : undefined;
|
|
68
141
|
}
|
|
69
142
|
catch {
|
|
70
143
|
return undefined;
|
|
71
144
|
}
|
|
72
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The caller's headers, given any way fetch takes them, sent as JSON unless they say otherwise.
|
|
148
|
+
* (Spreading a `Headers` object would drop them all.)
|
|
149
|
+
*/
|
|
150
|
+
function jsonHeaders(init) {
|
|
151
|
+
const headers = new Headers(init);
|
|
152
|
+
if (!headers.has("content-type")) {
|
|
153
|
+
headers.set("content-type", "application/json");
|
|
154
|
+
}
|
|
155
|
+
return headers;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Fetch a screen, all of it: its stream (spec §4.6) read to the end. Throws ScreenFetchError for a
|
|
159
|
+
* non-2xx response (e.g. `not_found`) or one that isn't a screen. To show its islands as they
|
|
160
|
+
* arrive, use openScreen.
|
|
161
|
+
*/
|
|
73
162
|
export async function fetchScreen(baseUrl, request, init = {}, fetchImpl = fetch) {
|
|
163
|
+
return collectScreen(await openScreen(baseUrl, request, init, fetchImpl));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Request a screen, and resolve once its head has arrived. Throws ScreenFetchError for a non-2xx
|
|
167
|
+
* response (e.g. `not_found`) or one that isn't a screen's stream.
|
|
168
|
+
*/
|
|
169
|
+
export async function openScreen(baseUrl, request, init = {}, fetchImpl = fetch) {
|
|
74
170
|
const res = await fetchImpl(`${baseUrl}/screens/${encodeURIComponent(request.screen)}`, {
|
|
75
171
|
...init,
|
|
76
172
|
method: "POST",
|
|
77
|
-
headers:
|
|
173
|
+
headers: jsonHeaders(init.headers),
|
|
78
174
|
body: JSON.stringify(request),
|
|
79
175
|
});
|
|
80
|
-
if (!res.ok)
|
|
176
|
+
if (!res.ok) {
|
|
81
177
|
throw new ScreenFetchError(res.status, await res.text());
|
|
82
|
-
|
|
178
|
+
}
|
|
179
|
+
const lines = linesOf(res)[Symbol.asyncIterator]();
|
|
180
|
+
const first = await lines.next();
|
|
181
|
+
const head = first.done ? undefined : parseJson(first.value);
|
|
182
|
+
if (!isRecord(head) || head.kind !== "head" || !isScreenHead(head)) {
|
|
183
|
+
await lines.return?.();
|
|
184
|
+
throw new ScreenFetchError(res.status, first.done ? "" : first.value);
|
|
185
|
+
}
|
|
186
|
+
const { kind: _kind, ...screen } = head;
|
|
187
|
+
return { head: screen, islands: pendingIslands(screen, lines) };
|
|
188
|
+
}
|
|
189
|
+
/** Reads the rest of a stream, and returns the screen with every island in place. */
|
|
190
|
+
export async function collectScreen(stream) {
|
|
191
|
+
let head = stream.head;
|
|
192
|
+
for await (const entry of stream.islands) {
|
|
193
|
+
head = withIsland(head, entry);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
...head,
|
|
197
|
+
islands: head.islands.filter((e) => e.status !== "pending"),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** The head with a pending island's entry in its place; unchanged if the key isn't pending. */
|
|
201
|
+
export function withIsland(head, entry) {
|
|
202
|
+
return {
|
|
203
|
+
...head,
|
|
204
|
+
islands: head.islands.map((e) => (e.key === entry.key && e.status === "pending" ? entry : e)),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/** A screen's head and end as a stream, for a screen that's already complete (spec §4.6). */
|
|
208
|
+
export function screenLines(screen) {
|
|
209
|
+
return `${JSON.stringify({ kind: "head", ...screen })}\n${JSON.stringify({ kind: "end" })}\n`;
|
|
210
|
+
}
|
|
211
|
+
function isScreenHead(value) {
|
|
212
|
+
return (typeof value.screen === "string" &&
|
|
213
|
+
Array.isArray(value.islands) &&
|
|
214
|
+
value.islands.every(isIslandEntry));
|
|
215
|
+
}
|
|
216
|
+
/** The islands pending in `head`, as `lines` bring them, until the end line. */
|
|
217
|
+
async function* pendingIslands(head, lines) {
|
|
218
|
+
const waiting = new Map(head.islands.filter((e) => e.status === "pending").map((e) => [e.key, e]));
|
|
219
|
+
try {
|
|
220
|
+
while (waiting.size > 0) {
|
|
221
|
+
const next = await lines.next();
|
|
222
|
+
if (next.done) {
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
const line = parseJson(next.value);
|
|
226
|
+
if (!isRecord(line) || line.kind === "end") {
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
// Lines of a kind it doesn't know, or for an island that isn't pending, are skipped (spec §4.6).
|
|
230
|
+
const entry = line.kind === "island" && isRecord(line.island) ? line.island : undefined;
|
|
231
|
+
if (entry?.status !== "pending" && isIslandEntry(entry) && waiting.delete(entry.key)) {
|
|
232
|
+
yield entry;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
await lines.return?.();
|
|
238
|
+
}
|
|
239
|
+
for (const e of waiting.values()) {
|
|
240
|
+
yield {
|
|
241
|
+
key: e.key,
|
|
242
|
+
type: e.type,
|
|
243
|
+
version: e.version,
|
|
244
|
+
status: "error",
|
|
245
|
+
error: { code: "incomplete", retryable: true },
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/** A body's lines, as they arrive if the body can be read as a stream, or all at once. */
|
|
250
|
+
async function* linesOf(res) {
|
|
251
|
+
if (!res.body) {
|
|
252
|
+
yield* (await res.text()).split("\n").filter((line) => line !== "");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const reader = res.body.getReader();
|
|
256
|
+
const decoder = new TextDecoder();
|
|
257
|
+
let buffered = "";
|
|
258
|
+
try {
|
|
259
|
+
for (;;) {
|
|
260
|
+
const { done, value } = await reader.read();
|
|
261
|
+
if (done) {
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
buffered += decoder.decode(value, { stream: true });
|
|
265
|
+
const lines = buffered.split("\n");
|
|
266
|
+
buffered = lines.pop() ?? "";
|
|
267
|
+
yield* lines.filter((line) => line !== "");
|
|
268
|
+
}
|
|
269
|
+
buffered += decoder.decode();
|
|
270
|
+
if (buffered.trim() !== "") {
|
|
271
|
+
yield buffered;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
await reader.cancel().catch(() => undefined);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// ---- Island requests (spec §4.5) ----
|
|
279
|
+
/**
|
|
280
|
+
* A request for one island of a screen: the page `cursor` asks for (an entry's `next`), or the
|
|
281
|
+
* island from its first page without one. `params` are the screen's own.
|
|
282
|
+
*/
|
|
283
|
+
export function buildIslandRequest(screen, params, entry, client, cursor) {
|
|
284
|
+
return {
|
|
285
|
+
protocol: PROTOCOL_VERSION,
|
|
286
|
+
screen,
|
|
287
|
+
key: entry.key,
|
|
288
|
+
version: entry.version,
|
|
289
|
+
params,
|
|
290
|
+
client,
|
|
291
|
+
...(cursor !== undefined && { cursor }),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* POST an island request. Resolves with the island's entry: its props (and `next`, if it has more
|
|
296
|
+
* pages) or the error it failed with. Throws IslandFetchError for a non-2xx response (e.g.
|
|
297
|
+
* `invalid_cursor`, `unknown_island`, `unauthenticated`), or an answer that isn't this island.
|
|
298
|
+
*/
|
|
299
|
+
export async function fetchIsland(baseUrl, request, init = {}, fetchImpl = fetch) {
|
|
300
|
+
const path = `${encodeURIComponent(request.screen)}/islands/${encodeURIComponent(request.key)}`;
|
|
301
|
+
const res = await fetchImpl(`${baseUrl}/screens/${path}`, {
|
|
302
|
+
...init,
|
|
303
|
+
method: "POST",
|
|
304
|
+
headers: jsonHeaders(init.headers),
|
|
305
|
+
body: JSON.stringify(request),
|
|
306
|
+
});
|
|
307
|
+
const text = await res.text();
|
|
308
|
+
if (!res.ok) {
|
|
309
|
+
throw new IslandFetchError(res.status, text);
|
|
310
|
+
}
|
|
311
|
+
const response = parseJson(text);
|
|
312
|
+
if (!isIslandResponse(response) || !isIslandAsked(response.island, request)) {
|
|
313
|
+
throw new IslandFetchError(res.status, text);
|
|
314
|
+
}
|
|
315
|
+
return response.island;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* An island request failed: a non-2xx response such as `invalid_cursor`, `unknown_island` or
|
|
319
|
+
* `unauthenticated`, or an answer that isn't the island asked for. An island that failed on the
|
|
320
|
+
* composer isn't thrown: it's an entry with `status: "error"`.
|
|
321
|
+
*/
|
|
322
|
+
export class IslandFetchError extends Error {
|
|
323
|
+
status;
|
|
324
|
+
body;
|
|
325
|
+
/** The protocol error code from the response body (e.g. "invalid_cursor"), if there was one. */
|
|
326
|
+
code;
|
|
327
|
+
constructor(status, body) {
|
|
328
|
+
super(`Island request failed with status ${status}`);
|
|
329
|
+
this.status = status;
|
|
330
|
+
this.body = body;
|
|
331
|
+
this.code = errorCode(body);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function isIslandResponse(value) {
|
|
335
|
+
return isRecord(value) && typeof value.screen === "string" && isIslandEntry(value.island);
|
|
336
|
+
}
|
|
337
|
+
/** Whether the answer is the island the request asked for, at the version it asked for. */
|
|
338
|
+
function isIslandAsked(island, request) {
|
|
339
|
+
return island.key === request.key && island.version === request.version;
|
|
83
340
|
}
|
|
84
341
|
// ---- Actions (spec §5) ----
|
|
85
342
|
/**
|
|
@@ -100,9 +357,11 @@ export class ActionFetchError extends Error {
|
|
|
100
357
|
}
|
|
101
358
|
/** A fresh idempotency key: one per user intent, reused when retrying it (spec §5.2). */
|
|
102
359
|
export function newIdempotencyKey() {
|
|
360
|
+
// React Native's Hermes may have no crypto, or crypto without randomUUID.
|
|
103
361
|
const c = globalThis.crypto;
|
|
104
|
-
if (c?.randomUUID)
|
|
362
|
+
if (c?.randomUUID) {
|
|
105
363
|
return c.randomUUID();
|
|
364
|
+
}
|
|
106
365
|
// React Native's Hermes has no crypto.randomUUID. Uniqueness, not secrecy, is what matters here.
|
|
107
366
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (ch) => {
|
|
108
367
|
const r = (Math.random() * 16) | 0;
|
|
@@ -128,18 +387,18 @@ export async function fetchAction(baseUrl, request, init = {}, fetchImpl = fetch
|
|
|
128
387
|
const res = await fetchImpl(`${baseUrl}/actions/${encodeURIComponent(request.action)}`, {
|
|
129
388
|
...init,
|
|
130
389
|
method: "POST",
|
|
131
|
-
headers:
|
|
390
|
+
headers: jsonHeaders(init.headers),
|
|
132
391
|
body: JSON.stringify(request),
|
|
133
392
|
});
|
|
134
393
|
const text = await res.text();
|
|
135
|
-
if (!res.ok)
|
|
394
|
+
if (!res.ok) {
|
|
136
395
|
throw new ActionFetchError(res.status, text);
|
|
137
|
-
try {
|
|
138
|
-
return JSON.parse(text);
|
|
139
396
|
}
|
|
140
|
-
|
|
397
|
+
const response = parseJson(text);
|
|
398
|
+
if (!isActionResponse(response)) {
|
|
141
399
|
throw new ActionFetchError(res.status, text);
|
|
142
400
|
}
|
|
401
|
+
return response;
|
|
143
402
|
}
|
|
144
403
|
/**
|
|
145
404
|
* The response, if it's a result or one of this action's own declared errors. Anything else throws
|
|
@@ -147,12 +406,16 @@ export async function fetchAction(baseUrl, request, init = {}, fetchImpl = fetch
|
|
|
147
406
|
* or a code the action doesn't declare, such as one added after this app was built (spec §5.1).
|
|
148
407
|
*/
|
|
149
408
|
export function checkActionResponse(action, response) {
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (
|
|
409
|
+
const error = isRecord(response) ? response.error : undefined;
|
|
410
|
+
const code = isRecord(error) ? error.code : undefined;
|
|
411
|
+
const status = isRecord(response) ? response.status : undefined;
|
|
412
|
+
const declared = status === "error" && typeof code === "string" && action.errors.includes(code);
|
|
413
|
+
if (isActionResponse(response) && (status === "ok" || declared)) {
|
|
414
|
+
// The result's and error's types are the action's: generated from its manifest, which the
|
|
415
|
+
// composer checks its outcomes against. They exist only at the type level.
|
|
416
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
155
417
|
return response;
|
|
418
|
+
}
|
|
156
419
|
throw new ActionFetchError(200, JSON.stringify(response));
|
|
157
420
|
}
|
|
158
421
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kFAAkF;AAElF,OAAO,EASL,gBAAgB,GAGjB,MAAM,0BAA0B,CAAC;AAOlC,MAAM,OAAO,cAAc;IACjB,SAAS,GAAG,IAAI,GAAG,EAA0C,CAAC;IAKtE,QAAQ,CACN,YAA0C,EAC1C,eAA8C,EAC9C,WAAkC;QAElC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,GAC3B,OAAO,YAAY,KAAK,QAAQ;YAC9B,CAAC,CAAC,CAAC,YAAY,EAAE,eAAyB,EAAE,WAAY,CAAC;YACzD,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,eAAuC,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACnE,iFAAiF;QACjF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAA2B,CAAC,CAAC;Q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