@solidjs/web 2.0.0-rc.11 → 2.0.0-rc.14
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 +705 -151
- package/dist/server.js +604 -123
- package/dist/server.observe.js +617 -124
- package/dist/web.dev.js +102 -41
- package/dist/web.js +75 -37
- package/dist/web.observe.js +75 -39
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +693 -919
- package/frames/dist/client.js +636 -917
- package/frames/dist/client.observe.js +637 -917
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +607 -212
- package/frames/dist/server.js +554 -212
- package/frames/dist/server.observe.js +554 -212
- package/frames/dist/trace.js +42 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -3
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +37 -8
- package/serialization/dist/serialization.js +39 -10
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +178 -72
- package/server-functions/dist/client.js +99 -61
- package/server-functions/dist/client.observe.js +178 -72
- package/server-functions/dist/server.dev.js +117 -56
- package/server-functions/dist/server.js +117 -56
- package/server-functions/dist/server.observe.js +117 -56
- package/skills/server-components/SKILL.md +228 -0
- package/types/client.d.ts +37 -2
- package/types/constants.d.ts +2 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -96
- package/types/frames/frame-container-plugin.d.ts +2 -10
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +53 -1
- 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 +116 -0
- package/types/index.d.ts +38 -0
- package/types/index.server.d.ts +10 -1
- package/types/jsx.d.ts +11 -1
- package/types/observe.d.ts +182 -12
- package/types/request-error-hook.d.ts +5 -0
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +26 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +13 -1
- package/types/server-observe.d.ts +8 -0
- package/types/server.d.ts +125 -12
|
@@ -16,20 +16,60 @@ function isDeferredBody(value) {
|
|
|
16
16
|
if (typeof v[Symbol.asyncIterator] === "function") return true;
|
|
17
17
|
return typeof v[Symbol.iterator] === "function" && !Array.isArray(value) && !(value instanceof Map) && !(value instanceof Set) && !ArrayBuffer.isView(value);
|
|
18
18
|
}
|
|
19
|
-
function observeCall(id, method, args) {
|
|
19
|
+
function observeCall(id, method, args, name) {
|
|
20
20
|
const channel = records();
|
|
21
|
-
if (channel === undefined
|
|
21
|
+
if (channel === undefined) return undefined;
|
|
22
|
+
const observedCall = channel.observed("call");
|
|
23
|
+
const observedRequest = channel.observed("request");
|
|
24
|
+
if (!observedCall && !observedRequest) return undefined;
|
|
22
25
|
const at = performance.now();
|
|
26
|
+
const bodies = channel.observed("call", "bodies");
|
|
27
|
+
const requestBodies = bodies || channel.observed("request", "bodies");
|
|
23
28
|
const origin = currentOrigin();
|
|
29
|
+
const live = {
|
|
30
|
+
args
|
|
31
|
+
};
|
|
24
32
|
let response;
|
|
33
|
+
let clone;
|
|
25
34
|
let settled = false;
|
|
26
35
|
return {
|
|
36
|
+
request(url, init) {
|
|
37
|
+
const at = observedRequest ? performance.now() : 0;
|
|
38
|
+
if (requestBodies) {
|
|
39
|
+
const request = reconstructRequest(url, init);
|
|
40
|
+
if (request !== undefined) live.request = request;
|
|
41
|
+
}
|
|
42
|
+
if (!observedRequest) return;
|
|
43
|
+
const event = {
|
|
44
|
+
side: "client",
|
|
45
|
+
id,
|
|
46
|
+
at,
|
|
47
|
+
method
|
|
48
|
+
};
|
|
49
|
+
if (name !== undefined) event.name = name;
|
|
50
|
+
if (origin !== undefined) event.origin = origin;
|
|
51
|
+
channel.emit("request", event, live);
|
|
52
|
+
},
|
|
27
53
|
response(r) {
|
|
28
54
|
response = r;
|
|
55
|
+
if (!bodies) return;
|
|
56
|
+
const type = r.headers.get("content-type");
|
|
57
|
+
if (type !== null && type.startsWith("text/event-stream")) return;
|
|
58
|
+
try {
|
|
59
|
+
clone = r.clone();
|
|
60
|
+
} catch {}
|
|
29
61
|
},
|
|
30
62
|
settle(outcome, value) {
|
|
31
63
|
if (settled) return;
|
|
32
64
|
settled = true;
|
|
65
|
+
const deferred = outcome === "ok" && isDeferredBody(value);
|
|
66
|
+
if (outcome === "ok") live.result = value;else live.error = value;
|
|
67
|
+
if (deferred && clone !== undefined) {
|
|
68
|
+
cancelBody(clone);
|
|
69
|
+
clone = undefined;
|
|
70
|
+
}
|
|
71
|
+
if (clone !== undefined) live.response = clone;else if (response !== undefined) live.response = response;
|
|
72
|
+
if (!observedCall) return;
|
|
33
73
|
const event = {
|
|
34
74
|
id,
|
|
35
75
|
at,
|
|
@@ -37,20 +77,35 @@ function observeCall(id, method, args) {
|
|
|
37
77
|
method,
|
|
38
78
|
outcome
|
|
39
79
|
};
|
|
80
|
+
if (name !== undefined) event.name = name;
|
|
40
81
|
if (response !== undefined) event.status = response.status;
|
|
41
82
|
if (origin !== undefined) event.origin = origin;
|
|
42
|
-
|
|
43
|
-
args
|
|
44
|
-
};
|
|
45
|
-
if (response !== undefined) live.response = response;
|
|
46
|
-
if (outcome === "ok") {
|
|
47
|
-
live.result = value;
|
|
48
|
-
if (isDeferredBody(value)) event.deferred = true;
|
|
49
|
-
} else live.error = value;
|
|
83
|
+
if (deferred) event.deferred = true;
|
|
50
84
|
channel.emit("call", event, live);
|
|
51
85
|
}
|
|
52
86
|
};
|
|
53
87
|
}
|
|
88
|
+
function reconstructRequest(url, init) {
|
|
89
|
+
try {
|
|
90
|
+
return new Request(new URL(url, globalThis.location?.href), {
|
|
91
|
+
...init,
|
|
92
|
+
body: reconstructableBody(init.body)
|
|
93
|
+
});
|
|
94
|
+
} catch {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function reconstructableBody(body) {
|
|
99
|
+
if (body == null || typeof body === "string") return body;
|
|
100
|
+
if (body instanceof URLSearchParams || typeof FormData !== "undefined" && body instanceof FormData || typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return body;
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
function cancelBody(response) {
|
|
104
|
+
try {
|
|
105
|
+
const body = response.body;
|
|
106
|
+
if (body !== null) body.cancel().catch(() => {});
|
|
107
|
+
} catch {}
|
|
108
|
+
}
|
|
54
109
|
|
|
55
110
|
const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
|
|
56
111
|
function getServerFunctionMetadata(fn) {
|
|
@@ -103,7 +158,7 @@ function provideServerFunctionRPC(rpc) {
|
|
|
103
158
|
}
|
|
104
159
|
|
|
105
160
|
const FLASH_COOKIE = "flash";
|
|
106
|
-
const FLASH_MATCHER =
|
|
161
|
+
const FLASH_MATCHER = /(?:^|;\s*)flash=([^;]+)/;
|
|
107
162
|
function hasFlashCookie(cookieHeader) {
|
|
108
163
|
return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
|
|
109
164
|
}
|
|
@@ -149,6 +204,7 @@ function hasFlightMetadata(response) {
|
|
|
149
204
|
return response.headers.has(REDIRECT_HEADER) || response.headers.has(REVALIDATE_HEADER);
|
|
150
205
|
}
|
|
151
206
|
async function deliverFlightData(response, data) {
|
|
207
|
+
if (data) await Promise.allSettled(Object.values(data).flatMap(s => s && typeof s == "object" ? Object.values(s) : []));
|
|
152
208
|
const folded = (response.headers.get(SINGLE_FLIGHT_HEADER) || "").split(",");
|
|
153
209
|
const metadata = hasFlightMetadata(response);
|
|
154
210
|
for (const source of getFlightDataSourceIds()) {
|
|
@@ -468,26 +524,42 @@ async function extractBody(source, codecOptions, wire) {
|
|
|
468
524
|
return undefined;
|
|
469
525
|
}
|
|
470
526
|
function createChunk(data) {
|
|
471
|
-
const
|
|
472
|
-
const encodeData = encoder.encode(data);
|
|
527
|
+
const encodeData = CHUNK_ENCODER.encode(data);
|
|
473
528
|
const bytes = encodeData.length;
|
|
529
|
+
if (bytes > MAX_CHUNK_BYTES) {
|
|
530
|
+
throw new RangeError("Server function chunk is too large to frame.");
|
|
531
|
+
}
|
|
474
532
|
const chunk = new Uint8Array(12 + bytes);
|
|
475
|
-
chunk.set(
|
|
533
|
+
chunk.set(CHUNK_ENCODER.encode(`;0x${bytes.toString(16).padStart(8, "0")};`));
|
|
476
534
|
chunk.set(encodeData, 12);
|
|
477
535
|
return chunk;
|
|
478
536
|
}
|
|
537
|
+
const CHUNK_ENCODER = /* @__PURE__ */new TextEncoder();
|
|
538
|
+
const CHUNK_DECODER = /* @__PURE__ */new TextDecoder("utf-8", {
|
|
539
|
+
fatal: true
|
|
540
|
+
});
|
|
541
|
+
const MAX_CHUNK_BYTES = 0xffffffff;
|
|
542
|
+
const RETAINED_STORE_BYTES = 64 * 1024;
|
|
543
|
+
const DONE = {
|
|
544
|
+
done: true,
|
|
545
|
+
value: undefined
|
|
546
|
+
};
|
|
547
|
+
function malformedStream() {
|
|
548
|
+
return new Error("Malformed server function stream.");
|
|
549
|
+
}
|
|
479
550
|
class ChunkReader {
|
|
480
551
|
constructor(stream) {
|
|
481
552
|
this.reader = stream.getReader();
|
|
482
553
|
this.store = new Uint8Array(0);
|
|
483
554
|
this.buffer = this.store;
|
|
484
555
|
this.done = false;
|
|
556
|
+
this.cancelled = false;
|
|
485
557
|
}
|
|
486
558
|
async readChunk() {
|
|
487
559
|
const chunk = await this.reader.read();
|
|
488
560
|
if (chunk.done) {
|
|
489
561
|
this.done = true;
|
|
490
|
-
return;
|
|
562
|
+
return this.cancelled;
|
|
491
563
|
}
|
|
492
564
|
const incoming = chunk.value;
|
|
493
565
|
const store = this.store;
|
|
@@ -508,55 +580,66 @@ class ChunkReader {
|
|
|
508
580
|
this.store = grown;
|
|
509
581
|
this.buffer = grown.subarray(0, needed);
|
|
510
582
|
}
|
|
583
|
+
return this.cancelled;
|
|
511
584
|
}
|
|
512
585
|
async next() {
|
|
586
|
+
if (this.cancelled) return DONE;
|
|
513
587
|
while (this.buffer.length < 12) {
|
|
514
588
|
if (this.done) {
|
|
515
|
-
if (this.buffer.length === 0) return
|
|
516
|
-
|
|
517
|
-
value: undefined
|
|
518
|
-
};
|
|
519
|
-
throw new Error("Malformed server function stream.");
|
|
589
|
+
if (this.buffer.length === 0) return DONE;
|
|
590
|
+
throw malformedStream();
|
|
520
591
|
}
|
|
521
|
-
await this.readChunk();
|
|
522
|
-
}
|
|
523
|
-
const decoder = new TextDecoder();
|
|
524
|
-
const bytes = Number.parseInt(decoder.decode(this.buffer.subarray(1, 11)), 16);
|
|
525
|
-
if (Number.isNaN(bytes)) {
|
|
526
|
-
throw new Error("Malformed server function stream.");
|
|
592
|
+
if (await this.readChunk()) return DONE;
|
|
527
593
|
}
|
|
594
|
+
const header = String.fromCharCode(...this.buffer.subarray(0, 12));
|
|
595
|
+
if (!/^;0x[\dA-Fa-f]{8};$/.test(header)) throw malformedStream();
|
|
596
|
+
const bytes = parseInt(header.slice(3, 11), 16);
|
|
528
597
|
while (bytes > this.buffer.length - 12) {
|
|
529
598
|
if (this.done) {
|
|
530
|
-
throw
|
|
599
|
+
throw malformedStream();
|
|
531
600
|
}
|
|
532
|
-
await this.readChunk();
|
|
601
|
+
if (await this.readChunk()) return DONE;
|
|
602
|
+
}
|
|
603
|
+
let partial;
|
|
604
|
+
try {
|
|
605
|
+
partial = CHUNK_DECODER.decode(this.buffer.subarray(12, 12 + bytes));
|
|
606
|
+
} catch {
|
|
607
|
+
throw malformedStream();
|
|
533
608
|
}
|
|
534
|
-
const partial = decoder.decode(this.buffer.subarray(12, 12 + bytes));
|
|
535
609
|
this.buffer = this.buffer.subarray(12 + bytes);
|
|
610
|
+
if (this.store.length > RETAINED_STORE_BYTES && this.buffer.length <= RETAINED_STORE_BYTES) {
|
|
611
|
+
this.store = this.buffer = this.buffer.slice();
|
|
612
|
+
}
|
|
536
613
|
return {
|
|
537
614
|
done: false,
|
|
538
615
|
value: partial
|
|
539
616
|
};
|
|
540
617
|
}
|
|
541
618
|
async drain(interpret) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
619
|
+
try {
|
|
620
|
+
while (true) {
|
|
621
|
+
const result = await this.next();
|
|
622
|
+
if (result.done) {
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
interpret(result.value);
|
|
546
626
|
}
|
|
547
|
-
|
|
627
|
+
} catch (error) {
|
|
628
|
+
this.cancel(error).catch(() => {});
|
|
629
|
+
throw error;
|
|
548
630
|
}
|
|
549
631
|
}
|
|
550
632
|
cancel(reason) {
|
|
633
|
+
this.cancelled = true;
|
|
551
634
|
return this.reader.cancel(reason);
|
|
552
635
|
}
|
|
553
636
|
}
|
|
554
637
|
function createEventChunk(data, id) {
|
|
555
638
|
let event = id !== undefined && !id.includes("\0") ? `id: ${id}\n` : "";
|
|
556
639
|
for (const line of data.split(/\r\n|\r|\n/)) event += `data: ${line}\n`;
|
|
557
|
-
return
|
|
640
|
+
return CHUNK_ENCODER.encode(event + "\n");
|
|
558
641
|
}
|
|
559
|
-
const EVENT_STREAM_HEARTBEAT = new TextEncoder().encode(":\n\n");
|
|
642
|
+
const EVENT_STREAM_HEARTBEAT = /* @__PURE__ */new TextEncoder().encode(":\n\n");
|
|
560
643
|
function isEventStream(source) {
|
|
561
644
|
const contentType = source.headers.get("content-type");
|
|
562
645
|
return !!contentType && contentType.startsWith("text/event-stream");
|
|
@@ -699,40 +782,44 @@ async function deserializeStream(source, codecOptions, wire) {
|
|
|
699
782
|
throw new Error("missing body");
|
|
700
783
|
}
|
|
701
784
|
const reader = wire && isEventStream(source) ? wire.open(source.body) : new ChunkReader(source.body);
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
if (result.
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
const {
|
|
708
|
-
createJSONDeserializer
|
|
709
|
-
} = await import('@solidjs/web/serialization/decode');
|
|
710
|
-
const deserializeChunk = createJSONDeserializer(codecOptions);
|
|
711
|
-
function interpretChunk(chunk) {
|
|
712
|
-
if (chunk.startsWith(ERROR_TRAILER_PREFIX)) {
|
|
713
|
-
throw errorFromTrailer(chunk);
|
|
785
|
+
try {
|
|
786
|
+
const result = await reader.next();
|
|
787
|
+
if (!result.done) {
|
|
788
|
+
if (result.value.startsWith(ERROR_TRAILER_PREFIX)) {
|
|
789
|
+
throw errorFromTrailer(result.value);
|
|
714
790
|
}
|
|
715
|
-
|
|
791
|
+
const {
|
|
792
|
+
createJSONDeserializer
|
|
793
|
+
} = await import('@solidjs/web/serialization/decode');
|
|
794
|
+
const deserializeChunk = createJSONDeserializer(codecOptions);
|
|
795
|
+
function interpretChunk(chunk) {
|
|
796
|
+
if (chunk.startsWith(ERROR_TRAILER_PREFIX)) {
|
|
797
|
+
throw errorFromTrailer(chunk);
|
|
798
|
+
}
|
|
799
|
+
return deserializeChunk(JSON.parse(chunk));
|
|
800
|
+
}
|
|
801
|
+
const connection = wire && wire.connection;
|
|
802
|
+
let endConnection;
|
|
803
|
+
if (connection) connection.ended = new Promise(resolve => endConnection = resolve);
|
|
804
|
+
const end = error => {
|
|
805
|
+
const sweep = () => deserializeChunk.abort(error);
|
|
806
|
+
if (connection) {
|
|
807
|
+
const close = () => deserializeChunk.close();
|
|
808
|
+
endConnection({
|
|
809
|
+
open: deserializeChunk.open(),
|
|
810
|
+
error,
|
|
811
|
+
sweep,
|
|
812
|
+
close
|
|
813
|
+
});
|
|
814
|
+
} else sweep();
|
|
815
|
+
};
|
|
816
|
+
reader.drain(interpretChunk).then(() => end(new Error("Server function stream ended unexpectedly.")), error => end(error));
|
|
817
|
+
return interpretChunk(result.value);
|
|
716
818
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
const end = error => {
|
|
721
|
-
const sweep = () => deserializeChunk.abort(error);
|
|
722
|
-
if (connection) {
|
|
723
|
-
const close = () => deserializeChunk.close();
|
|
724
|
-
endConnection({
|
|
725
|
-
open: deserializeChunk.open(),
|
|
726
|
-
error,
|
|
727
|
-
sweep,
|
|
728
|
-
close
|
|
729
|
-
});
|
|
730
|
-
} else sweep();
|
|
731
|
-
};
|
|
732
|
-
reader.drain(interpretChunk).then(() => end(new Error("Server function stream ended unexpectedly.")), error => end(error));
|
|
733
|
-
return interpretChunk(result.value);
|
|
819
|
+
} catch (error) {
|
|
820
|
+
reader.cancel(error).catch(() => {});
|
|
821
|
+
throw error;
|
|
734
822
|
}
|
|
735
|
-
return undefined;
|
|
736
823
|
}
|
|
737
824
|
async function decodeResponse(response, codecOptions) {
|
|
738
825
|
if (!response.body) return undefined;
|
|
@@ -751,6 +838,7 @@ async function decodeResponsePayload(response, codecOptions) {
|
|
|
751
838
|
};
|
|
752
839
|
}
|
|
753
840
|
|
|
841
|
+
const CALL_OBSERVATION = Symbol("solid.CallObservation");
|
|
754
842
|
const config = {
|
|
755
843
|
endpoint: "/_server",
|
|
756
844
|
fetch: undefined,
|
|
@@ -843,6 +931,13 @@ async function createRequest(base, id, options, meta) {
|
|
|
843
931
|
if (wire.position !== undefined) headers[LAST_EVENT_ID_HEADER] = wire.position;
|
|
844
932
|
if (wire.headers) Object.assign(headers, wire.headers);
|
|
845
933
|
}
|
|
934
|
+
const observation = options[CALL_OBSERVATION] ;
|
|
935
|
+
if (observation) {
|
|
936
|
+
options = {
|
|
937
|
+
...options
|
|
938
|
+
};
|
|
939
|
+
delete options[CALL_OBSERVATION];
|
|
940
|
+
}
|
|
846
941
|
const flightSources = getFlightDataSourceIds();
|
|
847
942
|
if (flightSources.length > 0 && !isReadCall(options)) {
|
|
848
943
|
headers[SINGLE_FLIGHT_HEADER] = flightSources.join(",");
|
|
@@ -867,6 +962,7 @@ async function createRequest(base, id, options, meta) {
|
|
|
867
962
|
}
|
|
868
963
|
init = prepared || init;
|
|
869
964
|
}
|
|
965
|
+
if (observation) observation.request(base, init);
|
|
870
966
|
const send = config.fetch || fetch;
|
|
871
967
|
return send(base, init);
|
|
872
968
|
}
|
|
@@ -931,7 +1027,7 @@ async function initializeResponse(base, id, options, args, meta) {
|
|
|
931
1027
|
}, meta);
|
|
932
1028
|
}
|
|
933
1029
|
async function observedFetch(base, id, options, args, meta, callArgs = args) {
|
|
934
|
-
const observation = observeCall(id, options.method && options.method.toUpperCase() === "GET" ? "GET" : "POST", callArgs);
|
|
1030
|
+
const observation = observeCall(id, options.method && options.method.toUpperCase() === "GET" ? "GET" : "POST", callArgs, meta && meta.name);
|
|
935
1031
|
if (!observation) return dispatchServerFunction(base, id, options, args, meta, callArgs);
|
|
936
1032
|
let result;
|
|
937
1033
|
try {
|
|
@@ -950,11 +1046,16 @@ async function dispatchServerFunction(base, id, options, args, meta, callArgs =
|
|
|
950
1046
|
id,
|
|
951
1047
|
meta
|
|
952
1048
|
}) : undefined;
|
|
1049
|
+
const sent = options;
|
|
953
1050
|
const controller = options.signal ? undefined : new AbortController();
|
|
954
1051
|
if (controller) options = {
|
|
955
1052
|
...options,
|
|
956
1053
|
signal: controller.signal
|
|
957
1054
|
};
|
|
1055
|
+
if (observation) options = {
|
|
1056
|
+
...options,
|
|
1057
|
+
[CALL_OBSERVATION]: observation
|
|
1058
|
+
};
|
|
958
1059
|
const response = await initializeResponse(base, id, options, args, meta);
|
|
959
1060
|
if (observation) observation.response(response);
|
|
960
1061
|
if (handler) {
|
|
@@ -962,7 +1063,8 @@ async function dispatchServerFunction(base, id, options, args, meta, callArgs =
|
|
|
962
1063
|
id,
|
|
963
1064
|
meta,
|
|
964
1065
|
args: callArgs,
|
|
965
|
-
context
|
|
1066
|
+
context,
|
|
1067
|
+
retry: () => fetchServerFunction(base, id, sent, args, meta, callArgs)
|
|
966
1068
|
};
|
|
967
1069
|
if (options[LIVE_WIRE]) ctx[LIVE_WIRE] = options[LIVE_WIRE];
|
|
968
1070
|
const handled = handler.handle(response, ctx);
|
|
@@ -1026,7 +1128,8 @@ function createServerReference(id, name, base) {
|
|
|
1026
1128
|
const hit = handler.intercept({
|
|
1027
1129
|
id,
|
|
1028
1130
|
meta: metadata,
|
|
1029
|
-
args
|
|
1131
|
+
args,
|
|
1132
|
+
retry: send
|
|
1030
1133
|
});
|
|
1031
1134
|
if (hit !== undefined) return localOrSend(hit, send);
|
|
1032
1135
|
}
|
|
@@ -1057,12 +1160,14 @@ function GET(fn) {
|
|
|
1057
1160
|
const run = async (args, invokeOptions) => {
|
|
1058
1161
|
const handler = config.responseHandler;
|
|
1059
1162
|
if (handler && handler.intercept && !adoptedCall(invokeOptions)) {
|
|
1163
|
+
const retry = () => send(args, invokeOptions);
|
|
1060
1164
|
const hit = handler.intercept({
|
|
1061
1165
|
id,
|
|
1062
1166
|
meta: metadata,
|
|
1063
|
-
args
|
|
1167
|
+
args,
|
|
1168
|
+
retry
|
|
1064
1169
|
});
|
|
1065
|
-
if (hit !== undefined) return localOrSend(hit,
|
|
1170
|
+
if (hit !== undefined) return localOrSend(hit, retry);
|
|
1066
1171
|
}
|
|
1067
1172
|
return send(args, invokeOptions);
|
|
1068
1173
|
};
|
|
@@ -1120,6 +1225,7 @@ function live(fn) {
|
|
|
1120
1225
|
};
|
|
1121
1226
|
const makeIterable = (args, invokeOptions) => {
|
|
1122
1227
|
const handler = config.responseHandler;
|
|
1228
|
+
handler && handler.onLive && handler.onLive();
|
|
1123
1229
|
const local = handler && handler.intercept ? handler.intercept({
|
|
1124
1230
|
id,
|
|
1125
1231
|
meta: metadata,
|