@superblocksteam/sdk 0.0.16 → 0.0.17

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 CHANGED
@@ -4,6 +4,7 @@ exports.fetchCurrentUser = exports.uploadComponents = exports.registerComponents
4
4
  const axios_1 = require("axios");
5
5
  const BASE_SERVER_URL = "api/v1";
6
6
  async function fetchApplication(applicationId, token, superblocksBaseUrl, viewMode) {
7
+ var _a;
7
8
  const url = `/api/v2/applications/${applicationId}?viewMode=${viewMode}`;
8
9
  try {
9
10
  const config = {
@@ -17,7 +18,7 @@ async function fetchApplication(applicationId, token, superblocksBaseUrl, viewMo
17
18
  return response.data.data;
18
19
  }
19
20
  catch (e) {
20
- if (e.status === 404) {
21
+ if (axios_1.default.isAxiosError(e) && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
21
22
  throw new Error(`Application ${applicationId} was not found`);
22
23
  }
23
24
  throw new Error("Could not fetch application");
@@ -42,6 +43,7 @@ async function fetchApplications(token, superblocksBaseUrl) {
42
43
  }
43
44
  exports.fetchApplications = fetchApplications;
44
45
  async function fetchApi(apiId, token, superblocksBaseUrl, viewMode) {
46
+ var _a;
45
47
  try {
46
48
  const config = {
47
49
  method: "get",
@@ -54,7 +56,7 @@ async function fetchApi(apiId, token, superblocksBaseUrl, viewMode) {
54
56
  return response.data.data;
55
57
  }
56
58
  catch (e) {
57
- if (e.status === 404) {
59
+ if (axios_1.default.isAxiosError(e) && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
58
60
  throw new Error(`Api ${apiId} was not found`);
59
61
  }
60
62
  throw new Error("Could not fetch api");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Superblocks JS SDK",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
package/src/client.ts CHANGED
@@ -21,8 +21,8 @@ export async function fetchApplication(
21
21
  };
22
22
  const response = await axios(config);
23
23
  return response.data.data;
24
- } catch (e: any) {
25
- if (e.status === 404) {
24
+ } catch (e) {
25
+ if (axios.isAxiosError(e) && e.response?.status === 404) {
26
26
  throw new Error(`Application ${applicationId} was not found`);
27
27
  }
28
28
  throw new Error("Could not fetch application");
@@ -67,8 +67,8 @@ export async function fetchApi(
67
67
  };
68
68
  const response = await axios(config);
69
69
  return response.data.data;
70
- } catch (e: any) {
71
- if (e.status === 404) {
70
+ } catch (e) {
71
+ if (axios.isAxiosError(e) && e.response?.status === 404) {
72
72
  throw new Error(`Api ${apiId} was not found`);
73
73
  }
74
74
  throw new Error("Could not fetch api");