@solidjs/web 2.0.0-rc.16 → 2.0.0-rc.18
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/server.dev.js +195 -35
- package/dist/server.js +190 -35
- package/dist/server.observe.js +190 -35
- package/dist/web.dev.js +53 -1
- package/dist/web.js +4 -1
- package/dist/web.observe.js +4 -1
- package/frames/dist/server.dev.js +356 -43
- package/frames/dist/server.js +355 -43
- package/frames/dist/server.observe.js +355 -43
- package/frames/dist/wire.js +110 -14
- package/package.json +4 -4
- package/serialization/dist/decode.js +10 -5
- package/serialization/dist/serialization.js +121 -61
- package/serialization/types/index.d.ts +12 -4
- package/serialization/types/serializer.d.ts +12 -4
- package/server-functions/dist/client.dev.js +10 -21
- package/server-functions/dist/client.js +10 -21
- package/server-functions/dist/client.observe.js +10 -21
- package/server-functions/dist/rich-args.js +54 -3
- package/server-functions/dist/server.dev.js +313 -11
- package/server-functions/dist/server.js +313 -11
- package/server-functions/dist/server.observe.js +313 -11
- package/types/client.d.ts +12 -0
- package/types/diagnostics.d.ts +16 -0
- package/types/frames/frame-morph.d.ts +1 -0
- package/types/frames/serializer.d.ts +12 -4
- package/types/serializer.d.ts +12 -4
- package/types/server-functions/argument-codec.d.ts +11 -2
- package/types/server-functions/client.d.ts +13 -4
- package/types/server-functions/server.d.ts +33 -0
- package/types/server-functions/shared.d.ts +9 -0
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server.d.ts +1 -1
|
@@ -351,6 +351,18 @@ export interface ServerFunctionsServerConfig {
|
|
|
351
351
|
* outside the dev build; `0`/`undefined` is off.
|
|
352
352
|
*/
|
|
353
353
|
chaosReconnectEvery?: number;
|
|
354
|
+
/**
|
|
355
|
+
* Id of the build this server was bundled with. A call whose
|
|
356
|
+
* `X-Server-Function-Build` header names another build is answered `409`
|
|
357
|
+
* and the function does not run: the page was loaded from a build whose
|
|
358
|
+
* functions may take other arguments or return another shape. The answer
|
|
359
|
+
* carries the unknown-function label, so the client rejects with
|
|
360
|
+
* `unknownFunction: true`, the same as for an id this build does not
|
|
361
|
+
* have. The client runtime does not send the header itself: the build
|
|
362
|
+
* integration adds it through `prepareRequest`. Calls without the header
|
|
363
|
+
* are not checked. Leave unset to check nothing.
|
|
364
|
+
*/
|
|
365
|
+
buildId?: string;
|
|
354
366
|
}
|
|
355
367
|
/**
|
|
356
368
|
* A registered server function: its build-stable id paired with the
|
|
@@ -394,6 +406,14 @@ export interface ServerFunctionInvocation {
|
|
|
394
406
|
* `false` for the data and bare addresses, and for in-process calls.
|
|
395
407
|
*/
|
|
396
408
|
live: boolean;
|
|
409
|
+
/** A live call to a `broadcast` declaration: its answer is shared. */
|
|
410
|
+
broadcast?: boolean;
|
|
411
|
+
/**
|
|
412
|
+
* For a broadcast call, the arguments as they arrived on the wire: callers
|
|
413
|
+
* whose encodings are equal share one render. Absent when the encoding
|
|
414
|
+
* wasn't kept (an unbuffered body), and then the call is not shared.
|
|
415
|
+
*/
|
|
416
|
+
shareKey?: string;
|
|
397
417
|
}
|
|
398
418
|
/**
|
|
399
419
|
* Hooks layering framework policy onto `handleServerFunctionRequest`.
|
|
@@ -519,6 +539,16 @@ export declare function registerServerReference<T extends any[], R>(id: string,
|
|
|
519
539
|
export declare function createServerReference<T extends any[], R>(reference: ServerFunctionReference<T, R>): (...args: T) => R;
|
|
520
540
|
export declare function GET<A extends readonly any[], R>(fn: (...args: A) => R): ServerFunction<A, Awaited<R>>;
|
|
521
541
|
export declare function live<A extends readonly any[], R>(fn: (...args: A) => R): ServerFunction<A, LiveSource<Awaited<R>>>;
|
|
542
|
+
/**
|
|
543
|
+
* Declares a live server function whose answer is the same for every
|
|
544
|
+
* viewer: implies `live` and `GET`, and at the live address every caller
|
|
545
|
+
* with the same arguments shares ONE render (frames server half) or ONE
|
|
546
|
+
* data source (see sharedSourceResponse). The outer body still runs per
|
|
547
|
+
* call — a gate (auth, redirects) — but what it returns is the shared
|
|
548
|
+
* answer's to render.
|
|
549
|
+
* @experimental
|
|
550
|
+
*/
|
|
551
|
+
export declare function broadcast<A extends readonly any[], R>(fn: (...args: A) => R): ServerFunction<A, LiveSource<Awaited<R>>>;
|
|
522
552
|
export declare function getServerFunctionInvocation(): ServerFunctionInvocation | undefined;
|
|
523
553
|
export declare function getEventServerFunctionInvocation(event: RequestEvent | undefined): ServerFunctionInvocation | undefined;
|
|
524
554
|
export declare function foldSetCookies(headers: Headers, setCookies: readonly string[]): Headers;
|
|
@@ -546,6 +576,9 @@ export declare function guardFailures(value: any, state: any): any;
|
|
|
546
576
|
* encodeLiveResult): the same payloads one per event, a comment heartbeat
|
|
547
577
|
* while idle, and each yield's position — parked on `live.pending` by the
|
|
548
578
|
* live adapter — riding as the `id:` of the record that carries the yield.
|
|
579
|
+
* A broadcast's shared stream (`live.nodes`) is nobody's body: it carries
|
|
580
|
+
* no heartbeat or chaos (each tap arms its own), and records which node
|
|
581
|
+
* each chunk carries for the fan-out to read (see startSharedSource).
|
|
549
582
|
*/
|
|
550
583
|
export declare function serializeResponseStream(value: any, codecOptions: any, signal: any, scope: any, live: any): ReadableStream<any>;
|
|
551
584
|
/**
|
|
@@ -296,6 +296,15 @@ export declare const LIVE_WIRE: unique symbol;
|
|
|
296
296
|
* Nothing distinguishes it otherwise: a CDN 404 and a skew 404 look alike.
|
|
297
297
|
*/
|
|
298
298
|
export declare const UNKNOWN_HEADER = "X-Server-Function-Unknown";
|
|
299
|
+
/**
|
|
300
|
+
* Header carrying a build id. The build integration adds it to calls
|
|
301
|
+
* through `prepareRequest`; the client runtime never sends it. A server
|
|
302
|
+
* configured with another `buildId` answers `409` with its own id under the
|
|
303
|
+
* same header and the `UNKNOWN_HEADER` label, and does not run the function.
|
|
304
|
+
* This catches the skew the unknown-id 404 cannot: a function whose id
|
|
305
|
+
* survived the deploy but whose arguments or result changed shape.
|
|
306
|
+
*/
|
|
307
|
+
export declare const BUILD_HEADER = "X-Server-Function-Build";
|
|
299
308
|
/**
|
|
300
309
|
* Header carrying a redirect to scripted callers. fetch FOLLOWS redirect
|
|
301
310
|
* statuses before the transport can read them, so a scripted answer masks
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const UPLOAD_ARGS_PART = "args";
|
|
2
|
+
export declare const UPLOAD_FILE_PART = "file";
|
|
3
|
+
/**
|
|
4
|
+
* True for a file or a blob. One from another frame is an instance of that
|
|
5
|
+
* frame's `Blob`, so its shape tells instead.
|
|
6
|
+
*/
|
|
7
|
+
declare function isBlob(value: any): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The client half. Each file or blob in the arguments serializes as its
|
|
10
|
+
* index in `files`. A file that appears twice is pushed once, so it arrives
|
|
11
|
+
* as one value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUploadSerializer(files: any): {
|
|
14
|
+
tag: string;
|
|
15
|
+
test: typeof isBlob;
|
|
16
|
+
parse: {
|
|
17
|
+
sync: (value: any, ctx: any) => {
|
|
18
|
+
i: any;
|
|
19
|
+
};
|
|
20
|
+
async: (value: any, ctx: any) => Promise<{
|
|
21
|
+
i: any;
|
|
22
|
+
}>;
|
|
23
|
+
stream: (value: any, ctx: any) => {
|
|
24
|
+
i: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
serialize: (node: any, ctx: any) => any;
|
|
28
|
+
deserialize: () => never;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The server half, made for one request. Each index turns back into its
|
|
32
|
+
* part of `form`. A bad index or a missing part fails the decode.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createUploadDeserializer(form: any): {
|
|
35
|
+
tag: string;
|
|
36
|
+
test: () => boolean;
|
|
37
|
+
parse: {
|
|
38
|
+
sync: () => never;
|
|
39
|
+
async: () => never;
|
|
40
|
+
stream: () => never;
|
|
41
|
+
};
|
|
42
|
+
serialize: () => never;
|
|
43
|
+
deserialize: (node: any, ctx: any) => any;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The request body for a call with files. `FormData` only takes blobs of its
|
|
47
|
+
* own frame, so a blob from another frame is copied first.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createUploadBody(serialized: any, files: any): Promise<FormData>;
|
|
50
|
+
export {};
|
package/types/server.d.ts
CHANGED
|
@@ -689,5 +689,5 @@ export declare function claimElement<T extends Element>(node: T, owner?: Owner |
|
|
|
689
689
|
export declare function claimElementTree<T extends Node>(root: T): T;
|
|
690
690
|
/** Server: `fn()`. No event is dispatched during SSR, so there is no interaction to join. */
|
|
691
691
|
export declare function dispatchAsInteraction<T>(_e: Event, fn: () => T): T;
|
|
692
|
-
export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as readShallow, notSup as acquireAsset };
|
|
692
|
+
export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as setStatefulProperty, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as readShallow, notSup as acquireAsset };
|
|
693
693
|
declare function notSup(): void;
|