@superblocksteam/sdk 1.0.0 → 1.0.2
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/client.js +14 -7
- package/package.json +3 -3
- package/src/client.ts +12 -7
package/dist/client.js
CHANGED
|
@@ -164,7 +164,7 @@ async function registerComponents(applicationId, componentConfigs, token, superb
|
|
|
164
164
|
}
|
|
165
165
|
exports.registerComponents = registerComponents;
|
|
166
166
|
async function uploadComponents({ applicationId, componentConfigs, files, token, superblocksBaseUrl, }) {
|
|
167
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
167
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
168
168
|
superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
|
|
169
169
|
const bucketeerBaseUrl = (0, util_1.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
|
|
170
170
|
// parse files to source and bundled files based on path
|
|
@@ -224,13 +224,20 @@ You can reduce your component bundle size by uploading static assets to a separa
|
|
|
224
224
|
if (e instanceof axios_1.AxiosError && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 413) {
|
|
225
225
|
throw new Error(`Could not upload application components, file size limit exceeded`);
|
|
226
226
|
}
|
|
227
|
-
else
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
else {
|
|
228
|
+
let message;
|
|
229
|
+
if (e instanceof axios_1.AxiosError) {
|
|
230
|
+
message =
|
|
231
|
+
(_g = (_e = (_d = (_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.responseMeta) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : (_f = e.response) === null || _f === void 0 ? void 0 : _f.data) !== null && _g !== void 0 ? _g : (_h = e.response) === null || _h === void 0 ? void 0 : _h.statusText;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
message = e.message;
|
|
235
|
+
}
|
|
236
|
+
if (typeof message !== "string") {
|
|
237
|
+
message = JSON.stringify(message, null, 2);
|
|
238
|
+
}
|
|
239
|
+
throw new Error(`Could not upload application components\n${message}`);
|
|
231
240
|
}
|
|
232
|
-
throw new Error(`Could not upload application components
|
|
233
|
-
${e.message}`);
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
243
|
exports.uploadComponents = uploadComponents;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Superblocks JS SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
26
26
|
"@typescript-eslint/parser": "^5.60.1",
|
|
27
|
-
"eslint": "^8.
|
|
27
|
+
"eslint": "^8.48.0",
|
|
28
28
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
29
29
|
"prettier": "^2.8.8",
|
|
30
30
|
"typescript": "^5.1.3"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@superblocksteam/util": "1.0.
|
|
33
|
+
"@superblocksteam/util": "1.0.2",
|
|
34
34
|
"axios": "^1.3.5"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://www.superblocks.com",
|
package/src/client.ts
CHANGED
|
@@ -334,14 +334,19 @@ You can reduce your component bundle size by uploading static assets to a separa
|
|
|
334
334
|
throw new Error(
|
|
335
335
|
`Could not upload application components, file size limit exceeded`
|
|
336
336
|
);
|
|
337
|
-
} else
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
337
|
+
} else {
|
|
338
|
+
let message: any;
|
|
339
|
+
if (e instanceof AxiosError) {
|
|
340
|
+
message =
|
|
341
|
+
e.response?.data?.responseMeta?.message ?? e.response?.data ?? e.response?.statusText;
|
|
342
|
+
} else {
|
|
343
|
+
message = e.message;
|
|
344
|
+
}
|
|
345
|
+
if (typeof message !== "string") {
|
|
346
|
+
message = JSON.stringify(message, null, 2);
|
|
347
|
+
}
|
|
348
|
+
throw new Error(`Could not upload application components\n${message}`);
|
|
342
349
|
}
|
|
343
|
-
throw new Error(`Could not upload application components
|
|
344
|
-
${e.message as string}`);
|
|
345
350
|
}
|
|
346
351
|
}
|
|
347
352
|
|