@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20
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 +1 -1
- package/dist/server.dev.js +5065 -0
- package/dist/server.js +1757 -355
- package/dist/{server.cjs → server.observe.js} +1951 -558
- package/dist/{dev.cjs → web.dev.js} +945 -550
- package/dist/web.js +635 -332
- package/dist/{dev.js → web.observe.js} +688 -403
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2549 -0
- package/frames/dist/server.js +1688 -3005
- package/frames/dist/server.observe.js +2548 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +242 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +85 -158
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +109 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +84 -1
- package/server-functions/dist/server.dev.js +2714 -297
- package/server-functions/dist/server.js +2595 -271
- package/server-functions/dist/server.observe.js +3594 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +85 -158
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +85 -158
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +238 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +539 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-mock.d.ts +120 -13
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +571 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import type { ChangeOrigin, Records } from "solid-js";
|
|
2
|
+
import type { RequestEvent } from "./server.js";
|
|
3
|
+
import type { TraceContext } from "./trace.js";
|
|
4
|
+
/**
|
|
5
|
+
* The records channel — `OBSERVE.records` — or `undefined` outside observe
|
|
6
|
+
* builds and where no observing core has loaded. An emitter's first check.
|
|
7
|
+
*/
|
|
8
|
+
export declare function records(): Records | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* One server function execution, delivered on
|
|
11
|
+
* `OBSERVE.records.subscribe("invocation", …)` once it settled.
|
|
12
|
+
* Serializable — the live handles (`event`, `args`, the thrown error)
|
|
13
|
+
* travel beside it in `InvocationLive`, not on it.
|
|
14
|
+
*/
|
|
15
|
+
export interface InvocationEvent {
|
|
16
|
+
/** The function id — the name a span or a log line carries. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** `true` for an in-process call during SSR, `false` for HTTP dispatch. */
|
|
19
|
+
direct: boolean;
|
|
20
|
+
/** `performance.now()` when the execution started. */
|
|
21
|
+
at: number;
|
|
22
|
+
/**
|
|
23
|
+
* Start → settle of the execution, in milliseconds. The execution is the
|
|
24
|
+
* `wrapInvocation`-wrapped run: what the request spent on the call,
|
|
25
|
+
* policy included (auth guards, per-function middleware). A generator or
|
|
26
|
+
* stream body settles at handoff — see `deferred`.
|
|
27
|
+
*/
|
|
28
|
+
durationMs: number;
|
|
29
|
+
outcome: "ok" | "error";
|
|
30
|
+
/**
|
|
31
|
+
* The settled value is a body the caller drives — a generator, a
|
|
32
|
+
* `ReadableStream` — so `durationMs` covers the call that produced it,
|
|
33
|
+
* not its consumption.
|
|
34
|
+
*/
|
|
35
|
+
deferred?: true;
|
|
36
|
+
/**
|
|
37
|
+
* Direct calls only: the hydration id of the `<Loading>` boundary whose
|
|
38
|
+
* render pass made the call — the `id` of that boundary's `"boundary"`
|
|
39
|
+
* record — so a boundary's wait can be read as the server-function calls
|
|
40
|
+
* it consisted of. Absent for a call outside any boundary's pass (the
|
|
41
|
+
* shell, or HTTP dispatch).
|
|
42
|
+
*/
|
|
43
|
+
boundary?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The live half of an invocation, for in-process consumers. Not part of the
|
|
47
|
+
* record: `args` and `result` are application data (name/PII policy belongs
|
|
48
|
+
* to the consumer), `error` is the value AS THROWN — before the HTTP
|
|
49
|
+
* handler's production sanitization replaces it on the wire — and `event`
|
|
50
|
+
* is the request event the call ran under (the per-call derived event for
|
|
51
|
+
* direct calls).
|
|
52
|
+
*/
|
|
53
|
+
export interface InvocationLive {
|
|
54
|
+
event: RequestEvent;
|
|
55
|
+
/** HTTP dispatch only; absent for direct calls. */
|
|
56
|
+
request?: Request;
|
|
57
|
+
args: unknown[];
|
|
58
|
+
/** The settled value, when `outcome` is `"ok"`. */
|
|
59
|
+
result?: unknown;
|
|
60
|
+
/** The thrown value, when `outcome` is `"error"`. */
|
|
61
|
+
error?: unknown;
|
|
62
|
+
}
|
|
63
|
+
export type InvocationListener = (event: InvocationEvent, live: InvocationLive) => void;
|
|
64
|
+
/**
|
|
65
|
+
* One server render — a `renderToString` or a `renderToStream` (a document,
|
|
66
|
+
* or a frame stream over the same core) — delivered on
|
|
67
|
+
* `OBSERVE.records.subscribe("render", …)` once it ended: the document
|
|
68
|
+
* returned, the stream's last fragment written, or the render torn down.
|
|
69
|
+
* The server-side account of the head's timing: what the shell cost, and
|
|
70
|
+
* how many `<Loading>` boundaries it waited on (each also a `"boundary"`
|
|
71
|
+
* record) — the facts the response's `Server-Timing` `solid-shell` metric
|
|
72
|
+
* is projected from. Serializable; the request the render served and its
|
|
73
|
+
* trace ride beside it in `RenderLive`.
|
|
74
|
+
*/
|
|
75
|
+
export interface RenderEvent {
|
|
76
|
+
/** `"string"` for `renderToString`, `"stream"` for `renderToStream`. */
|
|
77
|
+
mode: "string" | "stream";
|
|
78
|
+
/** `performance.now()` when the render began. */
|
|
79
|
+
at: number;
|
|
80
|
+
/**
|
|
81
|
+
* Render start → the shell complete, in milliseconds: for a stream, the
|
|
82
|
+
* head and shell handed to the sink (the head is frozen from here — a
|
|
83
|
+
* fragment can no longer add to it); for a string, the document assembled
|
|
84
|
+
* (the whole render). What `solid-shell` carries. Absent when the render
|
|
85
|
+
* ended before its shell — torn down or failed pre-shell.
|
|
86
|
+
*/
|
|
87
|
+
shellMs?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Render start → the render's end, in milliseconds: the document
|
|
90
|
+
* returned (`"string"`, equal to `shellMs`), the stream complete (every
|
|
91
|
+
* fragment written), or the teardown for the other outcomes.
|
|
92
|
+
*/
|
|
93
|
+
durationMs: number;
|
|
94
|
+
/**
|
|
95
|
+
* `<Loading>` boundaries the shell waited on — discovered with pending
|
|
96
|
+
* async and settled before the shell completed, each a `"boundary"`
|
|
97
|
+
* record with `streamed: false` and a `solid-boundary` metric. A boundary
|
|
98
|
+
* that settled after the shell streamed as a fragment and is not counted
|
|
99
|
+
* here (its own record says `streamed: true`). Counted from the
|
|
100
|
+
* `"boundary"` records the render filed, under that record's gate: in an
|
|
101
|
+
* observe build with a `"render"` listener but no `"boundary"` listener
|
|
102
|
+
* the boundaries are not measured and this is `0`.
|
|
103
|
+
*/
|
|
104
|
+
boundaries: number;
|
|
105
|
+
/**
|
|
106
|
+
* `"complete"` — the render ran to its end; `"abandoned"` — the consumer
|
|
107
|
+
* left mid-stream (the sink threw, the readable was cancelled — the
|
|
108
|
+
* `SSR_STREAM_ABANDONED` finding is that request's account) and the
|
|
109
|
+
* render was torn down, or `createSSRResponse` discarded the page for a
|
|
110
|
+
* pre-flush redirect (no finding); `"error"` — the render failed: a
|
|
111
|
+
* string render threw, a stream's uncontained failure wound it down
|
|
112
|
+
* through `onError`.
|
|
113
|
+
*/
|
|
114
|
+
outcome: "complete" | "abandoned" | "error";
|
|
115
|
+
/**
|
|
116
|
+
* The route the render resolved to, as the router declared it while
|
|
117
|
+
* building its context under this render (`OBSERVE.attribution.withOrigin`
|
|
118
|
+
* with an `initial` ref — the same declaration the client's first
|
|
119
|
+
* `"navigation"` record comes from): `name` the matched pattern
|
|
120
|
+
* (`/users/:id`), `to` the concrete path, `params` what the pattern
|
|
121
|
+
* bound. Read from the router's ref when the render settles, so a match
|
|
122
|
+
* refined during the render is what lands. Absent when no router declared
|
|
123
|
+
* one — a render without a router, or a router that does not yet. What a
|
|
124
|
+
* consumer names the request by (`http.route`), where the URL would
|
|
125
|
+
* scatter one page across as many names as it has parameters.
|
|
126
|
+
*/
|
|
127
|
+
route?: RenderRoute;
|
|
128
|
+
}
|
|
129
|
+
/** `RenderEvent.route` — the route a render resolved to, as the router matched it. */
|
|
130
|
+
export interface RenderRoute {
|
|
131
|
+
/** The matched route pattern — `/users/:id`. */
|
|
132
|
+
name?: string;
|
|
133
|
+
/** The concrete path. */
|
|
134
|
+
to?: string;
|
|
135
|
+
/** The params the pattern bound (optional params unbound: `undefined`). */
|
|
136
|
+
params?: Readonly<Record<string, string | undefined>>;
|
|
137
|
+
}
|
|
138
|
+
/** The live half of a render record. */
|
|
139
|
+
export interface RenderLive {
|
|
140
|
+
/** The request event the render ran under; absent for a render outside a request scope. */
|
|
141
|
+
event?: RequestEvent;
|
|
142
|
+
/** The trace the render belongs to — `getTraceContext()`'s answer for it. */
|
|
143
|
+
trace: TraceContext;
|
|
144
|
+
}
|
|
145
|
+
export type RenderListener = (event: RenderEvent, live: RenderLive) => void;
|
|
146
|
+
/**
|
|
147
|
+
* One server-function call made from the browser — the fetch and its
|
|
148
|
+
* decode, as the caller awaited it — delivered on
|
|
149
|
+
* `OBSERVE.records.subscribe("call", …)` once it settled. The client twin
|
|
150
|
+
* of the server's `"invocation"` record: the two join by `id` (this is the
|
|
151
|
+
* call; that is the execution it caused), and the difference between their
|
|
152
|
+
* durations is the wire. A call an integration answered locally (a
|
|
153
|
+
* handler's `intercept`, at t = 0) made no request and emits nothing.
|
|
154
|
+
*/
|
|
155
|
+
export interface CallEvent {
|
|
156
|
+
/** The function id — the same `id` the server's `"invocation"` record carries. */
|
|
157
|
+
id: string;
|
|
158
|
+
/**
|
|
159
|
+
* The function's source name, from the reference's metadata
|
|
160
|
+
* (`ServerFunctionMetadata.name`): the compiled function's name, which
|
|
161
|
+
* the compiler seeds in development builds only, or an explicit label
|
|
162
|
+
* (`withMeta`, the `name` argument to `createServerReference`), which
|
|
163
|
+
* survives to production. A label, not an identity: not unique, and
|
|
164
|
+
* absent when the metadata carries none.
|
|
165
|
+
*/
|
|
166
|
+
name?: string;
|
|
167
|
+
/** `performance.now()` when the call was made. */
|
|
168
|
+
at: number;
|
|
169
|
+
/**
|
|
170
|
+
* Call → settle, in milliseconds: the request built and sent, the
|
|
171
|
+
* response received and decoded (or claimed by the configured
|
|
172
|
+
* `responseHandler`) — the whole await the caller saw. A streaming
|
|
173
|
+
* result settles at handoff — see `deferred`.
|
|
174
|
+
*/
|
|
175
|
+
durationMs: number;
|
|
176
|
+
/** `GET` for a GET-encoded read (`GET(fn)`), `POST` otherwise. */
|
|
177
|
+
method: "GET" | "POST";
|
|
178
|
+
outcome: "ok" | "error";
|
|
179
|
+
/**
|
|
180
|
+
* The response's HTTP status, once one arrived. Absent when the call
|
|
181
|
+
* failed before a response (the fetch itself rejected).
|
|
182
|
+
*/
|
|
183
|
+
status?: number;
|
|
184
|
+
/**
|
|
185
|
+
* What the call ran for, when the attribution engine
|
|
186
|
+
* (`solid-js/attribution`) is enabled and knows: the interaction whose
|
|
187
|
+
* handler made it (`kind: "interaction"`), the navigation whose data
|
|
188
|
+
* needed it (`kind: "navigation"`, its `interaction` the click), the
|
|
189
|
+
* effect or action step, the async landing whose recompute called again —
|
|
190
|
+
* the engine's own origin object, so it IS `InteractionEvent.origin` /
|
|
191
|
+
* `NavigationEvent.origin` / `HoldEvent.origin` by identity: an observer
|
|
192
|
+
* puts the call under the interaction's record without a time join. Read
|
|
193
|
+
* at dispatch, so a call made after an `await` in a handler stamps
|
|
194
|
+
* nothing (the same escape a write there has). Absent without an engine.
|
|
195
|
+
*/
|
|
196
|
+
origin?: ChangeOrigin;
|
|
197
|
+
/**
|
|
198
|
+
* The settled value is a body the caller drives — an async iterable
|
|
199
|
+
* (a `live()` source, a generator result) — so `durationMs` covers the
|
|
200
|
+
* call that produced it, not its consumption.
|
|
201
|
+
*/
|
|
202
|
+
deferred?: true;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The live half of a call, for in-process consumers — ONE object across
|
|
206
|
+
* the call's records: the same `CallLive` is handed to the `"request"`
|
|
207
|
+
* listener at the send and to the `"call"` listener at settle, filled in
|
|
208
|
+
* as the call proceeds (`args` from the start, `request` at the send,
|
|
209
|
+
* `response` and `result`/`error` at settle — filled on every settle,
|
|
210
|
+
* whether or not a `"call"` record goes out, so a `"request"` listener
|
|
211
|
+
* holding it reads the outcome off it too), so an in-process consumer
|
|
212
|
+
* joins a call's request to its settle by identity — the way `origin`
|
|
213
|
+
* joins a record to the interaction's — with no id-plus-time join and no
|
|
214
|
+
* sequence number. One MUTABLE object shared by both records' listeners:
|
|
215
|
+
* treat it as read-only — a write shows up on the other record's
|
|
216
|
+
* listener. `error` is the value as thrown to the caller — a
|
|
217
|
+
* decoded server error, or the transport's own failure. The bodies —
|
|
218
|
+
* `request`, and `response` as an unread clone — are a body viewer's
|
|
219
|
+
* (devtools' network panel), and are taken only while a listener asked for
|
|
220
|
+
* them (`OBSERVE.records.subscribe("call", fn, { bodies: true })`, or the
|
|
221
|
+
* same on `"request"` for the request alone): each costs the call a
|
|
222
|
+
* reconstruction and a transient double-buffer of the payload, which a
|
|
223
|
+
* consumer that reads ids, statuses and timings never pays. With no such
|
|
224
|
+
* listener `request` is absent and `response` is the transport's own
|
|
225
|
+
* object, consumed by its decode. Whether bodies are taken is read once,
|
|
226
|
+
* as the call starts.
|
|
227
|
+
*/
|
|
228
|
+
export interface CallLive {
|
|
229
|
+
args: unknown[];
|
|
230
|
+
/**
|
|
231
|
+
* Bodies opted in — by a `"call"` listener or a `"request"` listener
|
|
232
|
+
* (`observed("call", "bodies") || observed("request", "bodies")`): the
|
|
233
|
+
* request as dispatched — the final url and `RequestInit` (the
|
|
234
|
+
* transport's headers, the `prepareRequest` hook applied), built into a
|
|
235
|
+
* `Request` of the listener's own at the send, so its headers and body
|
|
236
|
+
* are readable in full and reading them touches nothing the transport
|
|
237
|
+
* sent. Set before the `"request"` record is delivered, so that listener
|
|
238
|
+
* reads it too — and it is ONE `Request`, shared by the call's
|
|
239
|
+
* `"request"` and `"call"` records: a body reads once, so a listener that
|
|
240
|
+
* wants it reads through `request.clone()` (`live.request.clone().text()`)
|
|
241
|
+
* and the other record's listener can still read it; a direct
|
|
242
|
+
* `live.request.text()` leaves `bodyUsed` true for whoever reads next.
|
|
243
|
+
* Built WITH the body only when the body has a shape a
|
|
244
|
+
* second `Request` can hold without a competing consumer — `string`,
|
|
245
|
+
* `URLSearchParams`, `FormData`, `Blob`, `ArrayBuffer` or a view of one
|
|
246
|
+
* — and WITHOUT it otherwise (a `ReadableStream` or an async iterable,
|
|
247
|
+
* the transport's streaming-upload contract: reconstructing one would
|
|
248
|
+
* consume it ahead of the send), so the request then reads as bodyless.
|
|
249
|
+
* Absent without the opt-in; when the call failed before the request was
|
|
250
|
+
* built (argument serialization threw); when the address is relative and
|
|
251
|
+
* there is no `location` to resolve it against (absent beats a URL that
|
|
252
|
+
* was never sent); and when the reconstruction itself failed (an init
|
|
253
|
+
* the `Request` constructor rejects but the configured `fetch`
|
|
254
|
+
* tolerates) — a reconstruction never fails the call.
|
|
255
|
+
*/
|
|
256
|
+
request?: Request;
|
|
257
|
+
/**
|
|
258
|
+
* The response: with bodies opted in, one with an UNREAD body — a
|
|
259
|
+
* `clone()` taken as the response arrived, before the transport's
|
|
260
|
+
* decode, so the listener reads status, headers and body while the
|
|
261
|
+
* caller still gets its result from the original. The transport's own
|
|
262
|
+
* object instead — status and headers readable, body consumed by the
|
|
263
|
+
* transport's decode — without the opt-in, and, with it, for a response
|
|
264
|
+
* whose clone would be a branch nobody drains: an event-stream response
|
|
265
|
+
* (a `live()` source, `text/event-stream`, a connection open for the
|
|
266
|
+
* page's life), a deferred result (a generator's stream, `deferred:
|
|
267
|
+
* true`, served for the stream's life — its clone, taken before the
|
|
268
|
+
* result's shape was known, is cancelled at settle), and a response the
|
|
269
|
+
* `clone()` refused (one a configured `fetch` handed over already read).
|
|
270
|
+
* A response a `responseHandler` claimed whose result is not a deferred
|
|
271
|
+
* body — a non-live `application/x-frame-stream` frame render the frames
|
|
272
|
+
* transport claims, say — keeps its clone, so under the opt-in the
|
|
273
|
+
* clone's branch buffers that render until the listener reads it or
|
|
274
|
+
* drops the record; live frames are `text/event-stream` and are never
|
|
275
|
+
* cloned. Absent when the fetch itself rejected.
|
|
276
|
+
*/
|
|
277
|
+
response?: Response;
|
|
278
|
+
/** The settled value, when `outcome` is `"ok"`. */
|
|
279
|
+
result?: unknown;
|
|
280
|
+
/** The thrown value, when `outcome` is `"error"`. */
|
|
281
|
+
error?: unknown;
|
|
282
|
+
}
|
|
283
|
+
export type CallListener = (event: CallEvent, live: CallLive) => void;
|
|
284
|
+
/**
|
|
285
|
+
* One server-function request LEFT the browser — delivered on
|
|
286
|
+
* `OBSERVE.records.subscribe("request", …)` at the send: after the
|
|
287
|
+
* arguments were serialized and `prepareRequest` had its say, immediately
|
|
288
|
+
* before the transport's `fetch` is handed the request. "Left" means
|
|
289
|
+
* HANDED TO `fetch`, not that it reached the network: a `fetch` that
|
|
290
|
+
* throws synchronously still has its `"request"` (and a `"call"` with
|
|
291
|
+
* `outcome: "error"`). The `"call"` record of the same call follows at
|
|
292
|
+
* settle; this one exists because that one cannot show a call that is
|
|
293
|
+
* still in flight, or one that never settles (a hung fetch) — a network
|
|
294
|
+
* panel's pending row. The two records share their `CallLive` by identity
|
|
295
|
+
* (see `CallLive`): the object handed here is the object handed to the
|
|
296
|
+
* `"call"` listener, so an in-process consumer joins them with no
|
|
297
|
+
* id-plus-time join and no sequence number.
|
|
298
|
+
*
|
|
299
|
+
* Emitted only for a request that was handed over: a call that failed
|
|
300
|
+
* before its request was built (argument serialization threw, or
|
|
301
|
+
* `prepareRequest` did) emits no `"request"` — only its `"call"` settle; a
|
|
302
|
+
* call an integration answered locally (a handler's `intercept`) made no
|
|
303
|
+
* request and emits neither. A deferred or streaming result emits
|
|
304
|
+
* `"request"` at the send and `"call"` at handoff, as today. Serializable;
|
|
305
|
+
* `live.request` (under `bodies`) rides beside it.
|
|
306
|
+
*
|
|
307
|
+
* Listeners run synchronously, on the call's path, BEFORE the send: a slow
|
|
308
|
+
* listener delays the fetch and the time it spends is inside the call's
|
|
309
|
+
* `durationMs`. Read what is needed and hand the work off to a microtask
|
|
310
|
+
* (the same guidance the engine's records give).
|
|
311
|
+
*/
|
|
312
|
+
export interface CallRequestEvent {
|
|
313
|
+
/**
|
|
314
|
+
* Which end recorded it. Only `"client"` exists today — the request left
|
|
315
|
+
* the browser. The server half (the request arrived, ahead of its
|
|
316
|
+
* `"invocation"`) is `"server"`, additive later, the way the `"frame"`
|
|
317
|
+
* record has two halves.
|
|
318
|
+
*/
|
|
319
|
+
side: "client";
|
|
320
|
+
/** The function id — the same `id` the call's `"call"` and the server's `"invocation"` carry. */
|
|
321
|
+
id: string;
|
|
322
|
+
/** The function's source name, by the same rule as `CallEvent.name`. */
|
|
323
|
+
name?: string;
|
|
324
|
+
/**
|
|
325
|
+
* `performance.now()` at the send — when the request was handed to
|
|
326
|
+
* `fetch`, after serialization and `prepareRequest`. NOT the call's
|
|
327
|
+
* `CallEvent.at`, which is when the call was made: the gap between them
|
|
328
|
+
* is what building the request cost (an async `prepareRequest`
|
|
329
|
+
* included), and `CallEvent.at + durationMs` is never before this.
|
|
330
|
+
*/
|
|
331
|
+
at: number;
|
|
332
|
+
/** `GET` for a GET-encoded read (`GET(fn)`), `POST` otherwise — as on `CallEvent`. */
|
|
333
|
+
method: "GET" | "POST";
|
|
334
|
+
/**
|
|
335
|
+
* What the call ran for — the same object `CallEvent.origin` carries,
|
|
336
|
+
* read at dispatch (see `CallEvent.origin` for the rule).
|
|
337
|
+
*/
|
|
338
|
+
origin?: ChangeOrigin;
|
|
339
|
+
}
|
|
340
|
+
export type CallRequestListener = (event: CallRequestEvent, live: CallLive) => void;
|
|
341
|
+
interface FrameEventBase {
|
|
342
|
+
/**
|
|
343
|
+
* The frame id on the wire: the server function's id when the stream is a
|
|
344
|
+
* server-function response (the same `id` that call's `"invocation"` and
|
|
345
|
+
* `"call"` records carry), or what the producer named it; `""` for a bare
|
|
346
|
+
* `renderToFrameStream` with no `frame` option.
|
|
347
|
+
*/
|
|
348
|
+
id: string;
|
|
349
|
+
/**
|
|
350
|
+
* The stream version: as the producer stamped it on the server; as the
|
|
351
|
+
* client restamped it on the client (the consumer owns versions — one
|
|
352
|
+
* per stream a boundary consumed — so this is the number the frame's
|
|
353
|
+
* stale-guard saw).
|
|
354
|
+
*/
|
|
355
|
+
version: number;
|
|
356
|
+
/** `performance.now()` at the stream's `start` chunk — written, or read. */
|
|
357
|
+
at: number;
|
|
358
|
+
/**
|
|
359
|
+
* Start → `complete`, in milliseconds: the whole stream, fragments
|
|
360
|
+
* included. On the client this is the body's read and apply — the
|
|
361
|
+
* request that produced the response is the `"call"` record's time.
|
|
362
|
+
*/
|
|
363
|
+
durationMs: number;
|
|
364
|
+
/**
|
|
365
|
+
* Start → the shell (`html`) chunk, in milliseconds: the time to first
|
|
366
|
+
* content. Absent when the stream carried no shell (the server's
|
|
367
|
+
* synchronous failure path).
|
|
368
|
+
*/
|
|
369
|
+
shellMs?: number;
|
|
370
|
+
/** Chunks between `start` and `complete` (exclusive), all types. */
|
|
371
|
+
chunks: number;
|
|
372
|
+
/** `fragment` chunks: `<Loading>` content that settled after the shell. */
|
|
373
|
+
fragments: number;
|
|
374
|
+
/** `slot` chunks: render-prop invocations the client fills. */
|
|
375
|
+
slots: number;
|
|
376
|
+
/**
|
|
377
|
+
* Nested server-content regions (a server JSX slot argument): `html`
|
|
378
|
+
* chunks addressed to a child frame id rather than the stream's own.
|
|
379
|
+
*/
|
|
380
|
+
regions: number;
|
|
381
|
+
/** `error` chunks: fragments that failed (their fallback still revealed), plus a sync failure. */
|
|
382
|
+
errors: number;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* The server half of a `"frame"` record: one frame stream produced — a
|
|
386
|
+
* server component rendered to the frame transport
|
|
387
|
+
* (`renderServerComponent` / `renderToFrameStream`), from its `start`
|
|
388
|
+
* chunk to its `complete` — delivered once it completed.
|
|
389
|
+
*/
|
|
390
|
+
export interface FrameProducedEvent extends FrameEventBase {
|
|
391
|
+
side: "server";
|
|
392
|
+
/**
|
|
393
|
+
* `complete` — the render ran to the end (fragment failures, if any, are
|
|
394
|
+
* in `errors`); `error` — the render threw synchronously, the stream
|
|
395
|
+
* carried the failure as its only content and completed.
|
|
396
|
+
*/
|
|
397
|
+
outcome: "complete" | "error";
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The client half of a `"frame"` record: one frame stream applied — a
|
|
401
|
+
* frame-stream response read chunk by chunk into the frame host
|
|
402
|
+
* (`applyFrameResponse`), from its `start` to its `complete` — delivered
|
|
403
|
+
* once the stream ended. A single-flight response carries one stream per
|
|
404
|
+
* frame it refreshed; each is its own record, as on the server.
|
|
405
|
+
*/
|
|
406
|
+
export interface FrameAppliedEvent extends FrameEventBase {
|
|
407
|
+
side: "client";
|
|
408
|
+
/**
|
|
409
|
+
* The local id the chunks were applied under, when the consumer remapped
|
|
410
|
+
* the producer's root id onto its own boundary (`applyFrameResponse`'s
|
|
411
|
+
* `as` — the call's address, for the server-component transport).
|
|
412
|
+
* Absent when applied under the wire id.
|
|
413
|
+
*/
|
|
414
|
+
address?: string;
|
|
415
|
+
/**
|
|
416
|
+
* `complete` — the `complete` chunk arrived; `truncated` — the body ended
|
|
417
|
+
* before it (the connection dropped, the producer abandoned the stream);
|
|
418
|
+
* `error` — the read failed (a malformed chunk, a body error), with the
|
|
419
|
+
* failure in `live.error`.
|
|
420
|
+
*/
|
|
421
|
+
outcome: "complete" | "truncated" | "error";
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* One frame stream, from whichever end observed it — delivered on
|
|
425
|
+
* `OBSERVE.records.subscribe("frame", …)`; `side` says which. The two
|
|
426
|
+
* halves share their shape (the same census, the same timings measured
|
|
427
|
+
* where each stands), so a consumer joins them by `id` and `version` and
|
|
428
|
+
* the difference is the wire.
|
|
429
|
+
*/
|
|
430
|
+
export type FrameEvent = FrameProducedEvent | FrameAppliedEvent;
|
|
431
|
+
/** The live half of a frame record. */
|
|
432
|
+
export interface FrameLive {
|
|
433
|
+
/** The value thrown: the server's sync failure, or the client's read failure. */
|
|
434
|
+
error?: unknown;
|
|
435
|
+
/** Client only: the response the stream was read from. */
|
|
436
|
+
response?: Response;
|
|
437
|
+
}
|
|
438
|
+
export type FrameListener = (event: FrameEvent, live: FrameLive) => void;
|
|
439
|
+
declare module "solid-js" {
|
|
440
|
+
interface HostRecordTypes {
|
|
441
|
+
/** Server-function executions, on the server — see `InvocationEvent`. */
|
|
442
|
+
invocation: {
|
|
443
|
+
event: InvocationEvent;
|
|
444
|
+
live: InvocationLive;
|
|
445
|
+
};
|
|
446
|
+
/** Server renders — a document or a frame stream — see `RenderEvent`. */
|
|
447
|
+
render: {
|
|
448
|
+
event: RenderEvent;
|
|
449
|
+
live: RenderLive;
|
|
450
|
+
};
|
|
451
|
+
/** Server-function calls, from the client — see `CallEvent`. */
|
|
452
|
+
call: {
|
|
453
|
+
event: CallEvent;
|
|
454
|
+
live: CallLive;
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Server-function requests left, from the client — see
|
|
458
|
+
* `CallRequestEvent`; the `live` is the call's own, shared with its
|
|
459
|
+
* `"call"` record.
|
|
460
|
+
*/
|
|
461
|
+
request: {
|
|
462
|
+
event: CallRequestEvent;
|
|
463
|
+
live: CallLive;
|
|
464
|
+
};
|
|
465
|
+
/** Frame streams, produced or applied — see `FrameEvent`. */
|
|
466
|
+
frame: {
|
|
467
|
+
event: FrameEvent;
|
|
468
|
+
live: FrameLive;
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
export declare function settledPromise(value: unknown): Promise<unknown> | undefined;
|
|
473
|
+
export declare function isDeferredBody(value: unknown): boolean;
|
|
474
|
+
/**
|
|
475
|
+
* The census of one wire message (frame-sink.ts), kept by either half so
|
|
476
|
+
* both add up to the same numbers: a message counts once, and each record
|
|
477
|
+
* by what it writes — the root's content (`""`) a shell (or, addressed to
|
|
478
|
+
* a nested region, a region), `seg:<k>` content a fragment, `slot:<k>` a
|
|
479
|
+
* slot, any `:error` record an error. The end of the response (`:complete`,
|
|
480
|
+
* `:bound`) is not counted: a message writing only that is none.
|
|
481
|
+
*/
|
|
482
|
+
export declare function frameRecordCensus(event: FrameEventBase, message: {
|
|
483
|
+
type?: string;
|
|
484
|
+
r?: Record<string, any>;
|
|
485
|
+
}, own: boolean): void;
|
|
486
|
+
/** What the client runtime hands a call observation as the call proceeds. */
|
|
487
|
+
export interface CallObservation {
|
|
488
|
+
/**
|
|
489
|
+
* The request is about to be sent: the address and the final
|
|
490
|
+
* `RequestInit` — what the transport's `fetch` receives, hook applied.
|
|
491
|
+
* The `"request"` record is delivered from here.
|
|
492
|
+
*/
|
|
493
|
+
request(url: string, init: RequestInit): void;
|
|
494
|
+
/** The response arrived (before decode); its status goes on the record. */
|
|
495
|
+
response(response: Response): void;
|
|
496
|
+
/** The call settled as the caller sees it: the value returned, or the error thrown. */
|
|
497
|
+
settle(outcome: "ok" | "error", value: unknown): void;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Opens the observation of one server-function call from the client, as
|
|
501
|
+
* the request is about to be built; the runtime reports the request as it
|
|
502
|
+
* is sent (the `"request"` record), the response when it arrives and the
|
|
503
|
+
* settle when the caller gets its answer (the `"call"` record). `undefined`
|
|
504
|
+
* with no listener for either record or outside observe builds — the
|
|
505
|
+
* runtime then does nothing extra, not even read the clock.
|
|
506
|
+
*/
|
|
507
|
+
export declare function observeCall(id: string, method: "GET" | "POST", args: unknown[], name?: string): CallObservation | undefined;
|
|
508
|
+
/** What the client's stream reader hands a frame observation. */
|
|
509
|
+
export interface FrameApplyObservation {
|
|
510
|
+
/**
|
|
511
|
+
* Every message read, after the consumer's remapping (`as`, `version`) —
|
|
512
|
+
* `wireId` is the id the message carried before it.
|
|
513
|
+
*/
|
|
514
|
+
chunk(chunk: {
|
|
515
|
+
type?: string;
|
|
516
|
+
id: string;
|
|
517
|
+
version: number;
|
|
518
|
+
r?: Record<string, unknown>;
|
|
519
|
+
}, wireId: string): void;
|
|
520
|
+
/**
|
|
521
|
+
* The apply ended — cleanly, or with the failure it threw (a read that
|
|
522
|
+
* failed, a chunk that would not parse, a host that rejected a chunk).
|
|
523
|
+
*/
|
|
524
|
+
end(error?: unknown): void;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Opens the observation of one frame-stream response on the client: every
|
|
528
|
+
* `start` chunk opens a stream record (a single-flight response carries
|
|
529
|
+
* several, in sequence), every chunk until its `complete` is counted to
|
|
530
|
+
* it, and the record is delivered at `complete` — or at the body's end as
|
|
531
|
+
* `truncated`, or at a read failure as `error`. `undefined` with no
|
|
532
|
+
* listener or outside observe builds.
|
|
533
|
+
*/
|
|
534
|
+
export declare function observeFrameApply(response: Response): FrameApplyObservation | undefined;
|
|
535
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function reconcileArrays(parentNode: Node, a: Node[], b: Node[], marker?: Node | null): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare let spreadName: string | undefined;
|
|
2
|
+
export declare let spreadLoc: string | undefined;
|
|
3
|
+
export declare function setSpreadName(name: string | undefined, loc?: string): void;
|
|
4
|
+
/** Dev: remember the element the running binding effect writes (first one wins). */
|
|
5
|
+
export declare function tagElement(node: Node): void;
|
|
6
|
+
export declare function effect<T>(fn: (prev?: T) => T, effectFn: (value: T, prev?: T) => void | (() => void), options?: {
|
|
7
|
+
scope?: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
loc?: string;
|
|
10
|
+
}): void;
|
|
11
|
+
export declare function memo<T>(fn: () => T): () => T;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServerErrorHook } from "solid-js";
|
|
2
|
+
/** Files a render's `onError` as the hook of the request it serves. */
|
|
3
|
+
export declare function setRequestErrorHook(event: object, hook: ServerErrorHook | undefined): void;
|
|
4
|
+
/** The hook of the render serving `event`'s request, if one was given. */
|
|
5
|
+
export declare function requestErrorHook(event: object | undefined): ServerErrorHook | undefined;
|