@webstudio-is/sdk 0.126.0 → 0.127.0
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/lib/index.js +21 -12
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -522,19 +522,28 @@ var loadResource = async (resourceData) => {
|
|
|
522
522
|
if (method !== "get" && body !== void 0) {
|
|
523
523
|
requestInit.body = body;
|
|
524
524
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
525
|
+
try {
|
|
526
|
+
const response = await fetch(url, requestInit);
|
|
527
|
+
let data;
|
|
528
|
+
if (response.ok && // accept json by default and when specified explicitly
|
|
529
|
+
(requestHeaders.has("accept") === false || requestHeaders.get("accept") === "application/json")) {
|
|
530
|
+
data = await response.json();
|
|
531
|
+
} else {
|
|
532
|
+
data = await response.text();
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
data,
|
|
536
|
+
status: response.status,
|
|
537
|
+
statusText: response.statusText
|
|
538
|
+
};
|
|
539
|
+
} catch (error) {
|
|
540
|
+
const message = error.message;
|
|
541
|
+
return {
|
|
542
|
+
data: void 0,
|
|
543
|
+
status: 500,
|
|
544
|
+
statusText: message
|
|
545
|
+
};
|
|
532
546
|
}
|
|
533
|
-
return {
|
|
534
|
-
data,
|
|
535
|
-
status: response.status,
|
|
536
|
-
statusText: response.statusText
|
|
537
|
-
};
|
|
538
547
|
};
|
|
539
548
|
export {
|
|
540
549
|
Asset,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.127.0",
|
|
4
4
|
"description": "Webstudio project data schema",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "^3.21.4",
|
|
22
|
-
"@webstudio-is/
|
|
23
|
-
"@webstudio-is/
|
|
22
|
+
"@webstudio-is/css-engine": "0.127.0",
|
|
23
|
+
"@webstudio-is/fonts": "0.127.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@jest/globals": "^29.7.0",
|
|
27
|
-
"@webstudio-is/
|
|
28
|
-
"@webstudio-is/
|
|
27
|
+
"@webstudio-is/jest-config": "1.0.7",
|
|
28
|
+
"@webstudio-is/tsconfig": "1.0.7"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"typecheck": "tsc",
|