@superblocksteam/sdk 0.0.22 → 1.0.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/dist/client.d.ts CHANGED
@@ -4,13 +4,27 @@ export interface UploadFile {
4
4
  filename: string;
5
5
  ContentType: string;
6
6
  }
7
+ export interface ApplicationWrapper {
8
+ application: Record<string, any>;
9
+ page: Record<string, any>;
10
+ apis: Record<string, any>[];
11
+ }
7
12
  export declare function fetchApplication({ applicationId, token, superblocksBaseUrl, viewMode, injectedHeaders, }: {
8
13
  applicationId: string;
9
14
  token: string;
10
15
  superblocksBaseUrl: string;
11
16
  viewMode: ViewMode;
12
17
  injectedHeaders: Record<string, string>;
13
- }): Promise<any>;
18
+ }): Promise<ApplicationWrapper | undefined>;
19
+ export declare function fetchApplicationWithComponents({ applicationId, token, superblocksBaseUrl, viewMode, injectedHeaders, }: {
20
+ applicationId: string;
21
+ token: string;
22
+ superblocksBaseUrl: string;
23
+ viewMode: ViewMode;
24
+ injectedHeaders: Record<string, string>;
25
+ }): Promise<(ApplicationWrapper & {
26
+ componentFiles: any;
27
+ }) | undefined>;
14
28
  export declare function fetchApplications(token: string, superblocksBaseUrl: string, injectedHeaders?: Record<string, string>): Promise<any>;
15
29
  export declare function fetchApi(apiId: string, token: string, superblocksBaseUrl: string, viewMode: ViewMode): Promise<any>;
16
30
  export declare function fetchApis(token: string, superblocksBaseUrl: string): Promise<any>;
package/dist/client.js CHANGED
@@ -1,17 +1,59 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchCurrentUser = exports.uploadComponents = exports.registerComponents = exports.fetchApis = exports.fetchApi = exports.fetchApplications = exports.fetchApplication = void 0;
3
+ exports.fetchCurrentUser = exports.uploadComponents = exports.registerComponents = exports.fetchApis = exports.fetchApi = exports.fetchApplications = exports.fetchApplicationWithComponents = exports.fetchApplication = void 0;
4
4
  const fs = require("fs");
5
5
  const util_1 = require("@superblocksteam/util");
6
- const util_2 = require("@superblocksteam/util");
7
6
  const axios_1 = require("axios");
8
7
  const FormData = require("form-data");
8
+ const lodash_1 = require("lodash");
9
9
  const BASE_SERVER_URL = "api/v1";
10
10
  const BASE_BUCKETEER_URL = "api/v1";
11
+ const SUPERBLOCKS_MAX_FILE_SIZE_MB = 10;
11
12
  const CLI_VERSION_HEADER = "x-superblocks-cli-version";
12
13
  const SUPERBLOCKS_URL_HEADER = "x-superblocks-url";
13
14
  async function fetchApplication({ applicationId, token, superblocksBaseUrl, viewMode, injectedHeaders = {}, }) {
14
- var _a;
15
+ var _a, _b;
16
+ const serverURL = new URL(`api/v2/applications/${applicationId}?viewMode=${viewMode}`, superblocksBaseUrl);
17
+ let serverResponse;
18
+ try {
19
+ const config = {
20
+ method: "get",
21
+ url: serverURL.toString(),
22
+ headers: {
23
+ Authorization: "Bearer " + token,
24
+ ...injectedHeaders,
25
+ },
26
+ };
27
+ serverResponse = await (0, axios_1.default)(config);
28
+ }
29
+ catch (e) {
30
+ if (axios_1.default.isAxiosError(e) && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
31
+ throw new util_1.NotFoundError(`Application ${applicationId} was not found`);
32
+ }
33
+ throw new Error("Could not fetch application");
34
+ }
35
+ return (_b = serverResponse === null || serverResponse === void 0 ? void 0 : serverResponse.data) === null || _b === void 0 ? void 0 : _b.data;
36
+ }
37
+ exports.fetchApplication = fetchApplication;
38
+ async function fetchApplicationWithComponents({ applicationId, token, superblocksBaseUrl, viewMode, injectedHeaders = {}, }) {
39
+ var _a, _b, _c;
40
+ const applicationWrapper = await fetchApplication({
41
+ applicationId,
42
+ token,
43
+ superblocksBaseUrl,
44
+ viewMode,
45
+ injectedHeaders,
46
+ });
47
+ if ((0, lodash_1.isEmpty)(applicationWrapper)) {
48
+ return;
49
+ }
50
+ // if there are no custom components, just return here without trying to initialize them using bucketeer
51
+ if ((0, lodash_1.isEmpty)((_b = (_a = applicationWrapper.application) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.registeredComponents)) {
52
+ return {
53
+ ...applicationWrapper,
54
+ componentFiles: null,
55
+ };
56
+ }
15
57
  // TODO(jason) update this with commit ID once we enable fetching by commit
16
58
  const commitId = "latest";
17
59
  superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
@@ -32,13 +74,13 @@ async function fetchApplication({ applicationId, token, superblocksBaseUrl, view
32
74
  return response.data;
33
75
  }
34
76
  catch (e) {
35
- if (axios_1.default.isAxiosError(e) && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
36
- throw new Error(`Application ${applicationId} was not found`);
77
+ if (axios_1.default.isAxiosError(e) && ((_c = e.response) === null || _c === void 0 ? void 0 : _c.status) === 404) {
78
+ throw new util_1.NotFoundError(`Application ${applicationId} was not found`);
37
79
  }
38
80
  throw new Error("Could not fetch application");
39
81
  }
40
82
  }
41
- exports.fetchApplication = fetchApplication;
83
+ exports.fetchApplicationWithComponents = fetchApplicationWithComponents;
42
84
  async function fetchApplications(token, superblocksBaseUrl, injectedHeaders = {}) {
43
85
  try {
44
86
  const config = {
@@ -72,7 +114,7 @@ async function fetchApi(apiId, token, superblocksBaseUrl, viewMode) {
72
114
  }
73
115
  catch (e) {
74
116
  if (axios_1.default.isAxiosError(e) && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
75
- throw new Error(`Api ${apiId} was not found`);
117
+ throw new util_1.NotFoundError(`Api ${apiId} was not found`);
76
118
  }
77
119
  throw new Error("Could not fetch api");
78
120
  }
@@ -98,7 +140,7 @@ exports.fetchApis = fetchApis;
98
140
  async function registerComponents(applicationId, componentConfigs, token, superblocksBaseUrl, injectedHeaders) {
99
141
  var _a, _b, _c, _d, _e, _f, _g;
100
142
  try {
101
- const [rootSettings] = await (0, util_2.getSuperblocksMonorepoConfigJson)(true);
143
+ const [rootSettings] = await (0, util_1.getSuperblocksMonorepoConfigJson)(true);
102
144
  const config = {
103
145
  method: "put",
104
146
  url: new URL(`${BASE_SERVER_URL}/public/application/${applicationId}/components`, superblocksBaseUrl).toString(),
@@ -122,7 +164,7 @@ async function registerComponents(applicationId, componentConfigs, token, superb
122
164
  }
123
165
  exports.registerComponents = registerComponents;
124
166
  async function uploadComponents({ applicationId, componentConfigs, files, token, superblocksBaseUrl, }) {
125
- var _a, _b, _c, _d, _e, _f;
167
+ var _a, _b, _c, _d, _e, _f, _g;
126
168
  superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
127
169
  const bucketeerBaseUrl = (0, util_1.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
128
170
  // parse files to source and bundled files based on path
@@ -133,7 +175,8 @@ async function uploadComponents({ applicationId, componentConfigs, files, token,
133
175
  }
134
176
  return {
135
177
  name: `file${ind + 1}`,
136
- filename: file,
178
+ // win32 => posix filepath. Bucketeer does not accept windows style filepaths
179
+ filename: file.replace(/\\/g, "/"),
137
180
  ContentType: contentType,
138
181
  };
139
182
  });
@@ -146,14 +189,25 @@ async function uploadComponents({ applicationId, componentConfigs, files, token,
146
189
  buildFiles,
147
190
  });
148
191
  const postURL = new URL(`${BASE_BUCKETEER_URL}/components/upload`, bucketeerBaseUrl).toString();
192
+ let totalFileSizeMB = 0;
149
193
  const formData = new FormData();
150
194
  formData.append("format", formatJSON);
151
195
  uploadFiles.forEach((uploadFile) => {
196
+ const uploadFileStats = fs.statSync(uploadFile.filename);
197
+ totalFileSizeMB += uploadFileStats.size / (1024 * 1024);
152
198
  formData.append(uploadFile.name, fs.createReadStream(uploadFile.filename));
153
199
  });
200
+ if (totalFileSizeMB > SUPERBLOCKS_MAX_FILE_SIZE_MB) {
201
+ throw new Error(`upload size exceeded maximum allowed size.
202
+
203
+ Current Size: ${totalFileSizeMB.toFixed(2)} MB
204
+ Max Allowed Size: ${SUPERBLOCKS_MAX_FILE_SIZE_MB.toFixed(0)} MB
205
+
206
+ You can reduce your component bundle size by uploading static assets to a separate service.`);
207
+ }
154
208
  const formHeaders = formData.getHeaders();
155
209
  try {
156
- const [rootSettings] = await (0, util_2.getSuperblocksMonorepoConfigJson)(true);
210
+ const [rootSettings] = await (0, util_1.getSuperblocksMonorepoConfigJson)(true);
157
211
  const config = {
158
212
  headers: {
159
213
  Authorization: "Bearer " + token,
@@ -167,10 +221,13 @@ async function uploadComponents({ applicationId, componentConfigs, files, token,
167
221
  return response.data;
168
222
  }
169
223
  catch (e) {
170
- if (e instanceof axios_1.AxiosError) {
171
- const message = (_d = (_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.responseMeta) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : (_e = e.response) === null || _e === void 0 ? void 0 : _e.data;
224
+ if (e instanceof axios_1.AxiosError && ((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 413) {
225
+ throw new Error(`Could not upload application components, file size limit exceeded`);
226
+ }
227
+ else if (e instanceof axios_1.AxiosError) {
228
+ const message = (_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;
172
229
  throw new Error(`Could not upload application components
173
- ${message !== null && message !== void 0 ? message : (_f = e.response) === null || _f === void 0 ? void 0 : _f.statusText}`);
230
+ ${message !== null && message !== void 0 ? message : (_g = e.response) === null || _g === void 0 ? void 0 : _g.statusText}`);
174
231
  }
175
232
  throw new Error(`Could not upload application components
176
233
  ${e.message}`);
package/dist/sdk.d.ts CHANGED
@@ -7,7 +7,14 @@ export declare class SuperblocksSdk {
7
7
  applicationId: string;
8
8
  headers?: Record<string, string>;
9
9
  viewMode?: ViewMode;
10
- }): Promise<any>;
10
+ }): Promise<import("./client").ApplicationWrapper | undefined>;
11
+ fetchApplicationWithComponents({ applicationId, headers, viewMode, }: {
12
+ applicationId: string;
13
+ headers?: Record<string, string>;
14
+ viewMode?: ViewMode;
15
+ }): Promise<(import("./client").ApplicationWrapper & {
16
+ componentFiles: any;
17
+ }) | undefined>;
11
18
  fetchApplications(headers?: Record<string, string>): Promise<any>;
12
19
  fetchApi(apiId: string, viewMode?: ViewMode): Promise<any>;
13
20
  fetchApis(): Promise<any>;
package/dist/sdk.js CHANGED
@@ -18,6 +18,15 @@ class SuperblocksSdk {
18
18
  injectedHeaders: headers,
19
19
  });
20
20
  }
21
+ async fetchApplicationWithComponents({ applicationId, headers = {}, viewMode = "export-live", }) {
22
+ return (0, client_1.fetchApplicationWithComponents)({
23
+ applicationId,
24
+ token: this.token,
25
+ superblocksBaseUrl: this.superblocksBaseUrl,
26
+ viewMode,
27
+ injectedHeaders: headers,
28
+ });
29
+ }
21
30
  async fetchApplications(headers) {
22
31
  return (0, client_1.fetchApplications)(this.token, this.superblocksBaseUrl, headers);
23
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/sdk",
3
- "version": "0.0.22",
3
+ "version": "1.0.0",
4
4
  "description": "Superblocks JS SDK",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -17,7 +17,8 @@
17
17
  "clean": "npm run clean:build && rm -rf node_modules",
18
18
  "clean:build": "tsc --build --clean && rm -rf dist tsconfig.tsbuildinfo",
19
19
  "lint": "eslint . --ext .ts --config .eslintrc.json",
20
- "lint:fix": "eslint . --ext .ts --config .eslintrc.json --fix"
20
+ "lint:fix": "eslint . --ext .ts --config .eslintrc.json --fix",
21
+ "typecheck": "tsc --noEmit"
21
22
  },
22
23
  "license": "Superblocks Community Software License",
23
24
  "devDependencies": {
@@ -29,11 +30,12 @@
29
30
  "typescript": "^5.1.3"
30
31
  },
31
32
  "dependencies": {
32
- "@superblocksteam/util": "*",
33
+ "@superblocksteam/util": "1.0.0",
33
34
  "axios": "^1.3.5"
34
35
  },
35
36
  "homepage": "https://www.superblocks.com",
36
37
  "engines": {
37
- "node": ">=14.0.0"
38
+ "node": ">=16.0.0",
39
+ "npm": ">=8.0.0"
38
40
  }
39
41
  }
package/src/client.ts CHANGED
@@ -2,16 +2,20 @@ import * as fs from "fs";
2
2
  import {
3
3
  ComponentEvent,
4
4
  getBucketeerUrlFromSuperblocksUrl,
5
+ getSuperblocksMonorepoConfigJson,
5
6
  getContentType,
6
7
  COMPONENT_EVENT_HEADER,
8
+ NotFoundError,
7
9
  } from "@superblocksteam/util";
8
- import { getSuperblocksMonorepoConfigJson } from "@superblocksteam/util";
9
- import axios, { AxiosError } from "axios";
10
+ import axios, { AxiosError, AxiosRequestConfig } from "axios";
10
11
  import * as FormData from "form-data";
12
+ import { isEmpty } from "lodash";
11
13
 
12
14
  const BASE_SERVER_URL = "api/v1";
13
15
  const BASE_BUCKETEER_URL = "api/v1";
14
16
 
17
+ const SUPERBLOCKS_MAX_FILE_SIZE_MB = 10;
18
+
15
19
  const CLI_VERSION_HEADER = "x-superblocks-cli-version";
16
20
  const SUPERBLOCKS_URL_HEADER = "x-superblocks-url";
17
21
 
@@ -23,6 +27,14 @@ export interface UploadFile {
23
27
  ContentType: string;
24
28
  }
25
29
 
30
+ export interface ApplicationWrapper {
31
+ application: Record<string, any>;
32
+ page: Record<string, any>;
33
+ apis: Record<string, any>[];
34
+ }
35
+
36
+ type ResponseWithMeta<T> = { responseMeta: unknown; data: T };
37
+
26
38
  export async function fetchApplication({
27
39
  applicationId,
28
40
  token,
@@ -35,7 +47,66 @@ export async function fetchApplication({
35
47
  superblocksBaseUrl: string;
36
48
  viewMode: ViewMode;
37
49
  injectedHeaders: Record<string, string>;
38
- }) {
50
+ }): Promise<ApplicationWrapper | undefined> {
51
+ const serverURL = new URL(
52
+ `api/v2/applications/${applicationId}?viewMode=${viewMode}`,
53
+ superblocksBaseUrl
54
+ );
55
+ let serverResponse;
56
+
57
+ try {
58
+ const config: AxiosRequestConfig = {
59
+ method: "get",
60
+ url: serverURL.toString(),
61
+ headers: {
62
+ Authorization: "Bearer " + token,
63
+ ...injectedHeaders,
64
+ },
65
+ };
66
+ serverResponse = await axios<ResponseWithMeta<ApplicationWrapper>>(config);
67
+ } catch (e) {
68
+ if (axios.isAxiosError(e) && e.response?.status === 404) {
69
+ throw new NotFoundError(`Application ${applicationId} was not found`);
70
+ }
71
+ throw new Error("Could not fetch application");
72
+ }
73
+
74
+ return serverResponse?.data?.data;
75
+ }
76
+
77
+ export async function fetchApplicationWithComponents({
78
+ applicationId,
79
+ token,
80
+ superblocksBaseUrl,
81
+ viewMode,
82
+ injectedHeaders = {},
83
+ }: {
84
+ applicationId: string;
85
+ token: string;
86
+ superblocksBaseUrl: string;
87
+ viewMode: ViewMode;
88
+ injectedHeaders: Record<string, string>;
89
+ }): Promise<(ApplicationWrapper & { componentFiles: any }) | undefined> {
90
+ const applicationWrapper = await fetchApplication({
91
+ applicationId,
92
+ token,
93
+ superblocksBaseUrl,
94
+ viewMode,
95
+ injectedHeaders,
96
+ });
97
+
98
+ if (isEmpty(applicationWrapper)) {
99
+ return;
100
+ }
101
+
102
+ // if there are no custom components, just return here without trying to initialize them using bucketeer
103
+ if (isEmpty(applicationWrapper.application?.settings?.registeredComponents)) {
104
+ return {
105
+ ...applicationWrapper,
106
+ componentFiles: null,
107
+ };
108
+ }
109
+
39
110
  // TODO(jason) update this with commit ID once we enable fetching by commit
40
111
  const commitId = "latest";
41
112
  superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
@@ -49,7 +120,7 @@ export async function fetchApplication({
49
120
  ).toString();
50
121
 
51
122
  try {
52
- const config = {
123
+ const config: AxiosRequestConfig = {
53
124
  method: "get",
54
125
  url: componentFileURL,
55
126
  headers: {
@@ -62,7 +133,7 @@ export async function fetchApplication({
62
133
  return response.data;
63
134
  } catch (e) {
64
135
  if (axios.isAxiosError(e) && e.response?.status === 404) {
65
- throw new Error(`Application ${applicationId} was not found`);
136
+ throw new NotFoundError(`Application ${applicationId} was not found`);
66
137
  }
67
138
  throw new Error("Could not fetch application");
68
139
  }
@@ -74,7 +145,7 @@ export async function fetchApplications(
74
145
  injectedHeaders: Record<string, string> = {}
75
146
  ) {
76
147
  try {
77
- const config = {
148
+ const config: AxiosRequestConfig = {
78
149
  method: "get",
79
150
  url: new URL(`/api/v2/applications`, superblocksBaseUrl).toString(),
80
151
  headers: {
@@ -96,7 +167,7 @@ export async function fetchApi(
96
167
  viewMode: ViewMode
97
168
  ) {
98
169
  try {
99
- const config = {
170
+ const config: AxiosRequestConfig = {
100
171
  method: "get",
101
172
  url: new URL(
102
173
  `/api/v3/apis/${apiId}?viewMode=${viewMode}`,
@@ -110,7 +181,7 @@ export async function fetchApi(
110
181
  return response.data.data;
111
182
  } catch (e) {
112
183
  if (axios.isAxiosError(e) && e.response?.status === 404) {
113
- throw new Error(`Api ${apiId} was not found`);
184
+ throw new NotFoundError(`Api ${apiId} was not found`);
114
185
  }
115
186
  throw new Error("Could not fetch api");
116
187
  }
@@ -118,7 +189,7 @@ export async function fetchApi(
118
189
 
119
190
  export async function fetchApis(token: string, superblocksBaseUrl: string) {
120
191
  try {
121
- const config = {
192
+ const config: AxiosRequestConfig = {
122
193
  method: "get",
123
194
  url: new URL(`/api/v3/apis`, superblocksBaseUrl).toString(),
124
195
  headers: {
@@ -141,7 +212,7 @@ export async function registerComponents(
141
212
  ) {
142
213
  try {
143
214
  const [rootSettings] = await getSuperblocksMonorepoConfigJson(true);
144
- const config = {
215
+ const config: AxiosRequestConfig = {
145
216
  method: "put",
146
217
  url: new URL(
147
218
  `${BASE_SERVER_URL}/public/application/${applicationId}/components`,
@@ -200,7 +271,8 @@ export async function uploadComponents({
200
271
  }
201
272
  return {
202
273
  name: `file${ind + 1}`,
203
- filename: file,
274
+ // win32 => posix filepath. Bucketeer does not accept windows style filepaths
275
+ filename: file.replace(/\\/g, "/"),
204
276
  ContentType: contentType,
205
277
  } as UploadFile;
206
278
  });
@@ -223,16 +295,28 @@ export async function uploadComponents({
223
295
  bucketeerBaseUrl
224
296
  ).toString();
225
297
 
298
+ let totalFileSizeMB = 0;
226
299
  const formData = new FormData();
227
300
  formData.append("format", formatJSON);
228
301
  uploadFiles.forEach((uploadFile) => {
302
+ const uploadFileStats = fs.statSync(uploadFile.filename);
303
+ totalFileSizeMB += uploadFileStats.size / (1024 * 1024);
229
304
  formData.append(uploadFile.name, fs.createReadStream(uploadFile.filename));
230
305
  });
306
+
307
+ if (totalFileSizeMB > SUPERBLOCKS_MAX_FILE_SIZE_MB) {
308
+ throw new Error(`upload size exceeded maximum allowed size.
309
+
310
+ Current Size: ${totalFileSizeMB.toFixed(2)} MB
311
+ Max Allowed Size: ${SUPERBLOCKS_MAX_FILE_SIZE_MB.toFixed(0)} MB
312
+
313
+ You can reduce your component bundle size by uploading static assets to a separate service.`);
314
+ }
231
315
  const formHeaders = formData.getHeaders();
232
316
 
233
317
  try {
234
318
  const [rootSettings] = await getSuperblocksMonorepoConfigJson(true);
235
- const config = {
319
+ const config: AxiosRequestConfig = {
236
320
  headers: {
237
321
  Authorization: "Bearer " + token,
238
322
  [CLI_VERSION_HEADER]: rootSettings.metadata.cliVersion,
@@ -246,7 +330,11 @@ export async function uploadComponents({
246
330
 
247
331
  return response.data;
248
332
  } catch (e: any) {
249
- if (e instanceof AxiosError) {
333
+ if (e instanceof AxiosError && e.response?.status === 413) {
334
+ throw new Error(
335
+ `Could not upload application components, file size limit exceeded`
336
+ );
337
+ } else if (e instanceof AxiosError) {
250
338
  const message =
251
339
  (e.response?.data?.responseMeta?.message as string) ?? e.response?.data;
252
340
  throw new Error(`Could not upload application components
@@ -262,7 +350,7 @@ export async function fetchCurrentUser(
262
350
  superblocksBaseUrl: string
263
351
  ) {
264
352
  try {
265
- const config = {
353
+ const config: AxiosRequestConfig = {
266
354
  method: "get",
267
355
  url: new URL(`/api/v1/users/me`, superblocksBaseUrl).toString(),
268
356
  headers: {
package/src/sdk.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  fetchApi,
3
3
  fetchApis,
4
- fetchApplication as fetchApplicationClient,
4
+ fetchApplication,
5
+ fetchApplicationWithComponents,
5
6
  fetchApplications,
6
7
  registerComponents,
7
8
  uploadComponents,
@@ -27,7 +28,25 @@ export class SuperblocksSdk {
27
28
  headers?: Record<string, string>;
28
29
  viewMode?: ViewMode;
29
30
  }) {
30
- return fetchApplicationClient({
31
+ return fetchApplication({
32
+ applicationId,
33
+ token: this.token,
34
+ superblocksBaseUrl: this.superblocksBaseUrl,
35
+ viewMode,
36
+ injectedHeaders: headers,
37
+ });
38
+ }
39
+
40
+ async fetchApplicationWithComponents({
41
+ applicationId,
42
+ headers = {},
43
+ viewMode = "export-live",
44
+ }: {
45
+ applicationId: string;
46
+ headers?: Record<string, string>;
47
+ viewMode?: ViewMode;
48
+ }) {
49
+ return fetchApplicationWithComponents({
31
50
  applicationId,
32
51
  token: this.token,
33
52
  superblocksBaseUrl: this.superblocksBaseUrl,