@async/framework 0.11.12 → 0.11.13
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/CHANGELOG.md +15 -0
- package/README.md +8 -0
- package/browser.js +60 -17
- package/browser.min.js +1 -1
- package/browser.ts +60 -17
- package/browser.umd.js +60 -17
- package/browser.umd.min.js +1 -1
- package/framework.ts +60 -17
- package/package.json +1 -1
- package/server.js +60 -17
package/server.js
CHANGED
|
@@ -2575,12 +2575,17 @@ const __serverModule = (() => {
|
|
|
2575
2575
|
if (!element) {
|
|
2576
2576
|
return {};
|
|
2577
2577
|
}
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
value
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2578
|
+
const input = {};
|
|
2579
|
+
if ("value" in element) {
|
|
2580
|
+
input.value = element.value;
|
|
2581
|
+
}
|
|
2582
|
+
if ("checked" in element) {
|
|
2583
|
+
input.checked = element.checked;
|
|
2584
|
+
}
|
|
2585
|
+
if (element.dataset) {
|
|
2586
|
+
input.dataset = { ...element.dataset };
|
|
2587
|
+
}
|
|
2588
|
+
return input;
|
|
2584
2589
|
}
|
|
2585
2590
|
|
|
2586
2591
|
function createServerNamespace(run, root = {}, contextProvider = () => ({})) {
|
|
@@ -2767,38 +2772,76 @@ const __serverModule = (() => {
|
|
|
2767
2772
|
return output;
|
|
2768
2773
|
}
|
|
2769
2774
|
|
|
2770
|
-
function assertJsonTransportable(value, stack = new Set()) {
|
|
2771
|
-
if (
|
|
2772
|
-
|
|
2775
|
+
function assertJsonTransportable(value, path = "$", stack = new Set()) {
|
|
2776
|
+
if (value === null) {
|
|
2777
|
+
return;
|
|
2773
2778
|
}
|
|
2774
|
-
|
|
2779
|
+
|
|
2780
|
+
const type = typeof value;
|
|
2781
|
+
if (type === "boolean" || type === "string") {
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
if (type === "number") {
|
|
2785
|
+
if (!Number.isFinite(value)) {
|
|
2786
|
+
throw new Error(`Server proxy JSON transport does not support non-finite numbers at ${path}.`);
|
|
2787
|
+
}
|
|
2775
2788
|
return;
|
|
2776
2789
|
}
|
|
2790
|
+
if (type === "bigint") {
|
|
2791
|
+
throw new Error(`Server proxy JSON transport does not support BigInt values at ${path}.`);
|
|
2792
|
+
}
|
|
2793
|
+
if (type === "undefined") {
|
|
2794
|
+
throw new Error(`Server proxy JSON transport does not support undefined values at ${path}.`);
|
|
2795
|
+
}
|
|
2796
|
+
if (type === "function" || type === "symbol") {
|
|
2797
|
+
throw new Error(`Server proxy JSON transport does not support ${type} values at ${path}.`);
|
|
2798
|
+
}
|
|
2799
|
+
if (type !== "object") {
|
|
2800
|
+
throw new Error(`Server proxy JSON transport does not support ${type} values at ${path}.`);
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2777
2803
|
if (stack.has(value)) {
|
|
2778
|
-
throw new Error(
|
|
2804
|
+
throw new Error(`Server proxy JSON transport does not support circular values at ${path}.`);
|
|
2779
2805
|
}
|
|
2780
2806
|
stack.add(value);
|
|
2781
2807
|
|
|
2782
2808
|
const tag = Object.prototype.toString.call(value);
|
|
2783
2809
|
if (tag === "[object File]" || tag === "[object Blob]" || tag === "[object FormData]") {
|
|
2784
|
-
throw new Error(
|
|
2810
|
+
throw new Error(`Server proxy JSON transport does not support File, Blob, or FormData values yet at ${path}.`);
|
|
2785
2811
|
}
|
|
2786
2812
|
if (isUnsupportedJsonTransportObject(value, tag)) {
|
|
2787
|
-
throw new Error(
|
|
2813
|
+
throw new Error(`Server proxy JSON transport does not support URLSearchParams, Headers, Request, Response, ReadableStream, ArrayBuffer, or typed array values yet at ${path}.`);
|
|
2788
2814
|
}
|
|
2789
2815
|
if (Array.isArray(value)) {
|
|
2790
|
-
for (
|
|
2791
|
-
|
|
2816
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
2817
|
+
if (!Object.hasOwn(value, index)) {
|
|
2818
|
+
throw new Error(`Server proxy JSON transport does not support sparse arrays at ${path}[${index}].`);
|
|
2819
|
+
}
|
|
2820
|
+
assertJsonTransportable(value[index], `${path}[${index}]`, stack);
|
|
2792
2821
|
}
|
|
2793
2822
|
stack.delete(value);
|
|
2794
2823
|
return;
|
|
2795
2824
|
}
|
|
2796
|
-
|
|
2797
|
-
|
|
2825
|
+
|
|
2826
|
+
if (!isPlainJsonObject(value)) {
|
|
2827
|
+
throw new Error(`Server proxy JSON transport only supports plain objects at ${path}.`);
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
for (const [key, item] of Object.entries(value)) {
|
|
2831
|
+
assertJsonTransportable(item, propertyPath(path, key), stack);
|
|
2798
2832
|
}
|
|
2799
2833
|
stack.delete(value);
|
|
2800
2834
|
}
|
|
2801
2835
|
|
|
2836
|
+
function isPlainJsonObject(value) {
|
|
2837
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2838
|
+
return prototype === Object.prototype || prototype === null;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
function propertyPath(path, key) {
|
|
2842
|
+
return /^[A-Za-z_$][\w$]*$/.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2802
2845
|
function isUnsupportedJsonTransportObject(value, tag = Object.prototype.toString.call(value)) {
|
|
2803
2846
|
return tag === "[object URLSearchParams]"
|
|
2804
2847
|
|| tag === "[object Headers]"
|