@superblocksteam/sdk 1.1.0 → 1.1.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/client.d.ts CHANGED
@@ -47,7 +47,7 @@ export declare function fetchApplicationWithComponents({ applicationId, branch,
47
47
  export declare function fetchApplications(token: string, superblocksBaseUrl: string, injectedHeaders?: Record<string, string>): Promise<any>;
48
48
  export declare function fetchApi(apiId: string, token: string, superblocksBaseUrl: string, viewMode: ViewMode): Promise<any>;
49
49
  export declare function fetchApis(token: string, superblocksBaseUrl: string): Promise<any>;
50
- export declare function registerComponents(applicationId: string, componentConfigs: Record<string, any>, token: string, superblocksBaseUrl: string, injectedHeaders?: Record<string, string>): Promise<any>;
50
+ export declare function registerComponents(applicationId: string, componentConfigs: Record<string, any>, token: string, superblocksBaseUrl: string, branch: string | null, injectedHeaders?: Record<string, string>): Promise<any>;
51
51
  export declare function uploadComponents({ applicationId, componentConfigs, files, token, superblocksBaseUrl, branch, }: {
52
52
  applicationId: string;
53
53
  componentConfigs: Record<string, any>;
package/dist/client.js CHANGED
@@ -162,13 +162,14 @@ async function fetchApis(token, superblocksBaseUrl) {
162
162
  }
163
163
  }
164
164
  exports.fetchApis = fetchApis;
165
- async function registerComponents(applicationId, componentConfigs, token, superblocksBaseUrl, injectedHeaders) {
165
+ async function registerComponents(applicationId, componentConfigs, token, superblocksBaseUrl, branch, injectedHeaders) {
166
166
  var _a, _b, _c, _d, _e, _f, _g;
167
167
  try {
168
168
  const [rootSettings] = await (0, util_1.getSuperblocksMonorepoConfigJson)(true);
169
+ const branchPath = branch ? `/branches/${encodeURIComponent(branch)}` : "";
169
170
  const config = {
170
171
  method: "put",
171
- url: new URL(`${BASE_SERVER_URL}/public/application/${applicationId}/components`, superblocksBaseUrl).toString(),
172
+ url: new URL(`${BASE_SERVER_URL}/public/application/${applicationId}${branchPath}/components`, superblocksBaseUrl).toString(),
172
173
  headers: {
173
174
  Authorization: "Bearer " + token,
174
175
  [CLI_VERSION_HEADER]: rootSettings.metadata.cliVersion,
package/dist/sdk.d.ts CHANGED
@@ -21,7 +21,7 @@ export declare class SuperblocksSdk {
21
21
  fetchApplications(headers?: Record<string, string>): Promise<any>;
22
22
  fetchApi(apiId: string, viewMode?: ViewMode): Promise<any>;
23
23
  fetchApis(): Promise<any>;
24
- registerComponents(applicationId: string, componentConfigs: Record<string, any>, injectedHeaders?: Record<string, string>): Promise<any>;
24
+ registerComponents(applicationId: string, componentConfigs: Record<string, any>, branch: string | null, injectedHeaders?: Record<string, string>): Promise<any>;
25
25
  uploadComponents(applicationId: string, componentConfigs: Record<string, any>, files: string[], branch: string | null): Promise<any>;
26
26
  fetchCurrentUser(): Promise<any>;
27
27
  pushApplication({ applicationId, applicationConfig, branch, headers, }: {
package/dist/sdk.js CHANGED
@@ -46,8 +46,8 @@ class SuperblocksSdk {
46
46
  async fetchApis() {
47
47
  return (0, client_1.fetchApis)(this.token, this.superblocksBaseUrl);
48
48
  }
49
- async registerComponents(applicationId, componentConfigs, injectedHeaders) {
50
- return (0, client_1.registerComponents)(applicationId, componentConfigs, this.token, this.superblocksBaseUrl, injectedHeaders);
49
+ async registerComponents(applicationId, componentConfigs, branch, injectedHeaders) {
50
+ return (0, client_1.registerComponents)(applicationId, componentConfigs, this.token, this.superblocksBaseUrl, branch, injectedHeaders);
51
51
  }
52
52
  async uploadComponents(applicationId, componentConfigs, files, branch) {
53
53
  return (0, client_1.uploadComponents)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superblocksteam/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Superblocks JS SDK",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "typescript": "^5.1.3"
31
31
  },
32
32
  "dependencies": {
33
- "@superblocksteam/util": "1.1.0",
33
+ "@superblocksteam/util": "1.1.1",
34
34
  "axios": "^1.3.5"
35
35
  },
36
36
  "homepage": "https://www.superblocks.com",
package/src/client.ts CHANGED
@@ -264,14 +264,16 @@ export async function registerComponents(
264
264
  componentConfigs: Record<string, any>,
265
265
  token: string,
266
266
  superblocksBaseUrl: string,
267
+ branch: string | null,
267
268
  injectedHeaders?: Record<string, string>
268
269
  ) {
269
270
  try {
270
271
  const [rootSettings] = await getSuperblocksMonorepoConfigJson(true);
272
+ const branchPath = branch ? `/branches/${encodeURIComponent(branch)}` : "";
271
273
  const config: AxiosRequestConfig = {
272
274
  method: "put",
273
275
  url: new URL(
274
- `${BASE_SERVER_URL}/public/application/${applicationId}/components`,
276
+ `${BASE_SERVER_URL}/public/application/${applicationId}${branchPath}/components`,
275
277
  superblocksBaseUrl
276
278
  ).toString(),
277
279
  headers: {
package/src/sdk.ts CHANGED
@@ -88,6 +88,7 @@ export class SuperblocksSdk {
88
88
  async registerComponents(
89
89
  applicationId: string,
90
90
  componentConfigs: Record<string, any>,
91
+ branch: string | null,
91
92
  injectedHeaders?: Record<string, string>
92
93
  ) {
93
94
  return registerComponents(
@@ -95,6 +96,7 @@ export class SuperblocksSdk {
95
96
  componentConfigs,
96
97
  this.token,
97
98
  this.superblocksBaseUrl,
99
+ branch,
98
100
  injectedHeaders
99
101
  );
100
102
  }