@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.1
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/dev.cjs +9 -5
- package/dist/dev.js +9 -5
- package/dist/server.cjs +94 -4
- package/dist/server.js +94 -5
- package/dist/web.cjs +6 -5
- package/dist/web.js +6 -5
- package/frames/dist/client.cjs +1 -1
- package/frames/dist/client.dev.cjs +1 -1
- package/frames/dist/client.dev.js +1 -1
- package/frames/dist/client.js +1 -1
- package/frames/dist/server.cjs +92 -3
- package/frames/dist/server.js +92 -3
- package/package.json +4 -3
- package/serialization/dist/decode.cjs +13 -1
- package/serialization/dist/decode.js +13 -1
- package/serialization/dist/serialization.cjs +13 -1
- package/serialization/dist/serialization.js +13 -1
- package/server-functions/dist/client.cjs +150 -3
- package/server-functions/dist/client.js +150 -4
- package/server-functions/dist/server.cjs +125 -31
- package/server-functions/dist/server.dev.cjs +125 -31
- package/server-functions/dist/server.dev.js +124 -32
- package/server-functions/dist/server.js +124 -32
- package/types/index.d.ts +16 -2
- package/types/jsx.d.ts +9 -0
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/server.d.ts +28 -0
- package/types-cjs/index.d.cts +16 -2
- package/types-cjs/jsx.d.cts +9 -0
- package/types-cjs/server-functions/client.d.cts +30 -0
- package/types-cjs/server-functions/server.d.cts +28 -0
|
@@ -156,6 +156,36 @@ export function GET<A extends readonly any[], R>(
|
|
|
156
156
|
fn: (...args: A) => R
|
|
157
157
|
): ServerFunction<A, Awaited<R>>;
|
|
158
158
|
|
|
159
|
+
/** Wire-state transitions a live call's iterable can report. */
|
|
160
|
+
export type LiveSourceStatus = "connected" | "reconnecting" | "closed";
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A live call's answer: the source's iterable, plus an optional `onstatus`
|
|
164
|
+
* side channel for the wire facts the reconnect loop erases from the value
|
|
165
|
+
* stream — `"connected"` on each successful (re)connect, `"reconnecting"`
|
|
166
|
+
* (with the error) on each post-connect death, `"closed"` when the source
|
|
167
|
+
* completes or the consumer ends it.
|
|
168
|
+
*/
|
|
169
|
+
export type LiveSource<R> = R & {
|
|
170
|
+
onstatus?: (state: LiveSourceStatus, error?: unknown) => void;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Declares a value-shaped live source: a server function returning an async
|
|
175
|
+
* iterable whose yields are successive VALUES of one logical query, with the
|
|
176
|
+
* contract that the source re-yields current state on every invocation.
|
|
177
|
+
* Calls to the returned reference produce an iterable that survives the
|
|
178
|
+
* connection — post-connect deaths re-invoke with exponential backoff
|
|
179
|
+
* (reset per healthy value, woken early by connectivity returning),
|
|
180
|
+
* first-connect failures reject like a normal call, and `break` aborts the
|
|
181
|
+
* in-flight request. Live calls are reads and never opt into single-flight
|
|
182
|
+
* enveloping. Wire state, if wanted, rides the returned iterable's
|
|
183
|
+
* `onstatus` hook. Compose with `GET` inside-out: `live(GET(fn))`.
|
|
184
|
+
*/
|
|
185
|
+
export function live<A extends readonly any[], R>(
|
|
186
|
+
fn: (...args: A) => R
|
|
187
|
+
): ServerFunction<A, LiveSource<Awaited<R>>>;
|
|
188
|
+
|
|
159
189
|
/**
|
|
160
190
|
* Compiler ABI — emitted by compiled `"use server"` client output where a
|
|
161
191
|
* server function was referenced; produces the fetch-backed callable for
|
|
@@ -392,6 +392,34 @@ export function GET<A extends readonly any[], R>(
|
|
|
392
392
|
fn: (...args: A) => R
|
|
393
393
|
): ServerFunction<A, Awaited<R>>;
|
|
394
394
|
|
|
395
|
+
/** Wire-state transitions a live call's iterable can report (client side). */
|
|
396
|
+
export type LiveSourceStatus = "connected" | "reconnecting" | "closed";
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Type-level mirror of the client's live answer shape so isomorphic code
|
|
400
|
+
* assigning `onstatus` typechecks against either build's declarations. On
|
|
401
|
+
* the server the hook is inert: in-process calls hand back the source's
|
|
402
|
+
* own iterable — there is no connection to report on.
|
|
403
|
+
*/
|
|
404
|
+
export type LiveSource<R> = R & {
|
|
405
|
+
onstatus?: (state: LiveSourceStatus, error?: unknown) => void;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Declares a value-shaped live source: a server function returning an async
|
|
410
|
+
* iterable whose yields are successive VALUES of one logical query, with
|
|
411
|
+
* the contract that the source re-yields current state on every invocation.
|
|
412
|
+
* Writes `live: true` on the metadata channel and brands the resolved
|
|
413
|
+
* iterable (registered symbol `solid.LiveSource`) so SSR faces meeting the
|
|
414
|
+
* value in-process can apply live policy (document face: first value, then
|
|
415
|
+
* client takeover). Dispatch is untouched — over-the-wire calls stream the
|
|
416
|
+
* raw registered function's result. Declare live outermost:
|
|
417
|
+
* `live(GET(fn))`.
|
|
418
|
+
*/
|
|
419
|
+
export function live<A extends readonly any[], R>(
|
|
420
|
+
fn: (...args: A) => R
|
|
421
|
+
): ServerFunction<A, LiveSource<Awaited<R>>>;
|
|
422
|
+
|
|
395
423
|
/** Identity of the currently executing server function call. */
|
|
396
424
|
export interface ServerFunctionInvocation {
|
|
397
425
|
id: string;
|