@symbo.ls/fetch 3.4.11 → 3.5.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/dist/iife/index.js +64 -35
- package/package.json +2 -2
package/dist/iife/index.js
CHANGED
|
@@ -96,11 +96,11 @@ var SmblsFetch = (() => {
|
|
|
96
96
|
decodeNewlines: () => decodeNewlines,
|
|
97
97
|
deepClone: () => deepClone,
|
|
98
98
|
deepContains: () => deepContains,
|
|
99
|
-
|
|
99
|
+
deepDestringifyFunctions: () => deepDestringifyFunctions,
|
|
100
100
|
deepExtend: () => deepExtend,
|
|
101
101
|
deepMerge: () => deepMerge,
|
|
102
102
|
deepMergeExtends: () => deepMergeExtends,
|
|
103
|
-
|
|
103
|
+
deepStringifyFunctions: () => deepStringifyFunctions,
|
|
104
104
|
defineSetter: () => defineSetter,
|
|
105
105
|
detectInfiniteLoop: () => detectInfiniteLoop,
|
|
106
106
|
document: () => document2,
|
|
@@ -838,7 +838,7 @@ var SmblsFetch = (() => {
|
|
|
838
838
|
}
|
|
839
839
|
return clone2;
|
|
840
840
|
};
|
|
841
|
-
var
|
|
841
|
+
var deepStringifyFunctions = (obj, stringified = {}) => {
|
|
842
842
|
if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
|
|
843
843
|
;
|
|
844
844
|
(obj.__element || obj.parent?.__element).warn(
|
|
@@ -853,14 +853,14 @@ var SmblsFetch = (() => {
|
|
|
853
853
|
stringified[prop] = objProp.toString();
|
|
854
854
|
} else if (isObject(objProp)) {
|
|
855
855
|
stringified[prop] = {};
|
|
856
|
-
|
|
856
|
+
deepStringifyFunctions(objProp, stringified[prop]);
|
|
857
857
|
} else if (isArray(objProp)) {
|
|
858
858
|
const arr = stringified[prop] = [];
|
|
859
859
|
for (let i = 0; i < objProp.length; i++) {
|
|
860
860
|
const v = objProp[i];
|
|
861
861
|
if (isObject(v)) {
|
|
862
862
|
arr[i] = {};
|
|
863
|
-
|
|
863
|
+
deepStringifyFunctions(v, arr[i]);
|
|
864
864
|
} else if (isFunction(v)) {
|
|
865
865
|
arr[i] = v.toString();
|
|
866
866
|
} else {
|
|
@@ -962,7 +962,7 @@ var SmblsFetch = (() => {
|
|
|
962
962
|
if (RE_JSON_LIKE.test(trimmed) && !hasArrow) return false;
|
|
963
963
|
return true;
|
|
964
964
|
};
|
|
965
|
-
var
|
|
965
|
+
var deepDestringifyFunctions = (obj, destringified = {}) => {
|
|
966
966
|
for (const prop in obj) {
|
|
967
967
|
if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
|
|
968
968
|
const objProp = obj[prop];
|
|
@@ -991,13 +991,13 @@ var SmblsFetch = (() => {
|
|
|
991
991
|
arr.push(arrProp);
|
|
992
992
|
}
|
|
993
993
|
} else if (isObject(arrProp)) {
|
|
994
|
-
arr.push(
|
|
994
|
+
arr.push(deepDestringifyFunctions(arrProp));
|
|
995
995
|
} else {
|
|
996
996
|
arr.push(arrProp);
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
} else if (isObject(objProp)) {
|
|
1000
|
-
destringified[prop] =
|
|
1000
|
+
destringified[prop] = deepDestringifyFunctions(objProp, destringified[prop]);
|
|
1001
1001
|
} else {
|
|
1002
1002
|
destringified[prop] = objProp;
|
|
1003
1003
|
}
|
|
@@ -2401,18 +2401,26 @@ var SmblsFetch = (() => {
|
|
|
2401
2401
|
};
|
|
2402
2402
|
var applyEvent = (param, element, state, context, options) => {
|
|
2403
2403
|
if (!isFunction(param)) return;
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
result.
|
|
2413
|
-
|
|
2404
|
+
try {
|
|
2405
|
+
const result = param.call(
|
|
2406
|
+
element,
|
|
2407
|
+
element,
|
|
2408
|
+
state || element.state,
|
|
2409
|
+
context || element.context,
|
|
2410
|
+
options
|
|
2411
|
+
);
|
|
2412
|
+
if (result && typeof result.then === "function") {
|
|
2413
|
+
result.catch((err) => {
|
|
2414
|
+
element.error = err;
|
|
2415
|
+
console.error("[DomQL] Async event error:", err);
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
return result;
|
|
2419
|
+
} catch (err) {
|
|
2420
|
+
element.error = err;
|
|
2421
|
+
console.error("[DomQL] Event handler error:", err);
|
|
2422
|
+
if (element.context?.strictMode) throw err;
|
|
2414
2423
|
}
|
|
2415
|
-
return result;
|
|
2416
2424
|
};
|
|
2417
2425
|
var triggerEventOn = (param, element, options) => {
|
|
2418
2426
|
if (!element) {
|
|
@@ -2426,19 +2434,27 @@ var SmblsFetch = (() => {
|
|
|
2426
2434
|
};
|
|
2427
2435
|
var applyEventUpdate = (param, updatedObj, element, state, context, options) => {
|
|
2428
2436
|
if (!isFunction(param)) return;
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
result.
|
|
2439
|
-
|
|
2437
|
+
try {
|
|
2438
|
+
const result = param.call(
|
|
2439
|
+
element,
|
|
2440
|
+
updatedObj,
|
|
2441
|
+
element,
|
|
2442
|
+
state || element.state,
|
|
2443
|
+
context || element.context,
|
|
2444
|
+
options
|
|
2445
|
+
);
|
|
2446
|
+
if (result && typeof result.then === "function") {
|
|
2447
|
+
result.catch((err) => {
|
|
2448
|
+
element.error = err;
|
|
2449
|
+
console.error("[DomQL] Async event update error:", err);
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
return result;
|
|
2453
|
+
} catch (err) {
|
|
2454
|
+
element.error = err;
|
|
2455
|
+
console.error("[DomQL] Event update error:", err);
|
|
2456
|
+
if (element.context?.strictMode) throw err;
|
|
2440
2457
|
}
|
|
2441
|
-
return result;
|
|
2442
2458
|
};
|
|
2443
2459
|
var triggerEventOnUpdate = (param, updatedObj, element, options) => {
|
|
2444
2460
|
const appliedFunction = getOnOrPropsEvent(param, element);
|
|
@@ -2754,7 +2770,20 @@ var SmblsFetch = (() => {
|
|
|
2754
2770
|
}
|
|
2755
2771
|
function call(fnKey, ...args) {
|
|
2756
2772
|
const context = this.context;
|
|
2757
|
-
|
|
2773
|
+
const fn = context.utils?.[fnKey] || context.functions?.[fnKey] || context.methods?.[fnKey] || context.snippets?.[fnKey];
|
|
2774
|
+
if (!fn) return;
|
|
2775
|
+
try {
|
|
2776
|
+
const result = fn.call(this, ...args);
|
|
2777
|
+
if (result && typeof result.then === "function") {
|
|
2778
|
+
result.catch((err) => {
|
|
2779
|
+
this.error = err;
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
return result;
|
|
2783
|
+
} catch (err) {
|
|
2784
|
+
this.error = err;
|
|
2785
|
+
if (context?.strictMode) throw err;
|
|
2786
|
+
}
|
|
2758
2787
|
}
|
|
2759
2788
|
function isMethod(param, element) {
|
|
2760
2789
|
return Boolean(METHODS.has(param) || element?.context?.methods?.[param]);
|
|
@@ -2785,7 +2814,7 @@ var SmblsFetch = (() => {
|
|
|
2785
2814
|
};
|
|
2786
2815
|
|
|
2787
2816
|
// index.js
|
|
2788
|
-
var { window: window3, overwriteDeep: overwriteDeep2, deepDestringifyFunctions } = esm_exports;
|
|
2817
|
+
var { window: window3, overwriteDeep: overwriteDeep2, deepDestringifyFunctions: deepDestringifyFunctions2 } = esm_exports;
|
|
2789
2818
|
var IS_DEVELOPMENT = window3 && window3.location ? window3.location.host.includes("dev.") : isDevelopment();
|
|
2790
2819
|
var SERVER_URL = IS_DEVELOPMENT ? "http://localhost:8080/get" : "https://api.symbols.app/get";
|
|
2791
2820
|
var defaultOptions = {
|
|
@@ -2815,7 +2844,7 @@ var SmblsFetch = (() => {
|
|
|
2815
2844
|
const { editor } = options;
|
|
2816
2845
|
if (editor && editor.remote) {
|
|
2817
2846
|
const data = await fetchRemote(key, editor);
|
|
2818
|
-
const evalData = IS_DEVELOPMENT || options.isDevelopment ?
|
|
2847
|
+
const evalData = IS_DEVELOPMENT || options.isDevelopment ? deepDestringifyFunctions2(data) : deepDestringifyFunctions2(data.releases[0]);
|
|
2819
2848
|
if (editor.serviceRoute) {
|
|
2820
2849
|
if (isArray(editor.serviceRoute)) {
|
|
2821
2850
|
editor.serviceRoute.forEach((route) => {
|
|
@@ -2847,7 +2876,7 @@ var SmblsFetch = (() => {
|
|
|
2847
2876
|
const { editor } = options;
|
|
2848
2877
|
if (editor && editor.remote) {
|
|
2849
2878
|
const data = await fetchRemote(key, editor);
|
|
2850
|
-
const evalData = IS_DEVELOPMENT || options.isDevelopment ?
|
|
2879
|
+
const evalData = IS_DEVELOPMENT || options.isDevelopment ? deepDestringifyFunctions2(data) : deepDestringifyFunctions2(data.releases[0]);
|
|
2851
2880
|
callback(evalData);
|
|
2852
2881
|
}
|
|
2853
2882
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/fetch",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@domql/utils": "^3.
|
|
33
|
+
"@domql/utils": "^3.5.1"
|
|
34
34
|
},
|
|
35
35
|
"browser": "./dist/esm/index.js",
|
|
36
36
|
"sideEffects": false
|