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