@embeddable.com/sdk-core 3.14.2-next.0 → 3.14.2-next.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/lib/push.d.ts CHANGED
@@ -12,13 +12,15 @@ export declare function archive(args: {
12
12
  isDev: boolean;
13
13
  }): Promise<void>;
14
14
  export declare function createFormData(filePath: string, metadata: Record<string, any>): Promise<import("formdata-node").FormData>;
15
- export declare function sendBuildByApiKey(ctx: ResolvedEmbeddableConfig, { apiKey, email, message, }: {
15
+ export declare function sendBuildByApiKey(ctx: ResolvedEmbeddableConfig, { apiKey, email, message, cubeVersion, }: {
16
16
  apiKey: string;
17
17
  email: string;
18
18
  message?: string;
19
+ cubeVersion?: string;
19
20
  }): Promise<any>;
20
- export declare function sendBuild(ctx: ResolvedEmbeddableConfig, { workspaceId, token, message, }: {
21
+ export declare function sendBuild(ctx: ResolvedEmbeddableConfig, { workspaceId, token, message, cubeVersion, }: {
21
22
  workspaceId: string;
22
23
  token: string;
23
24
  message?: string;
25
+ cubeVersion?: string;
24
26
  }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.14.2-next.0",
3
+ "version": "3.14.2-next.1",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
package/src/push.test.ts CHANGED
@@ -320,13 +320,20 @@ describe("push", () => {
320
320
  "valid@email.com",
321
321
  "--message",
322
322
  "test message",
323
+ "--cube-version",
324
+ "v1.34",
323
325
  ],
324
326
  },
325
327
  });
326
328
  vi.mocked(getArgumentByKey)
327
- .mockReturnValueOnce("some-key") // API key
328
- .mockReturnValueOnce("valid@email.com") // Email
329
- .mockReturnValueOnce("test message"); // Message
329
+ .mockImplementation((keysArg) => {
330
+ const key = Array.isArray(keysArg) ? keysArg[0] : keysArg;
331
+ if (key === '--api-key') return 'some-key';
332
+ if (key === '--email') return 'valid@email.com';
333
+ if (key === '--message') return 'test message';
334
+ if (key === '--cube-version') return 'v1.34';
335
+ return undefined;
336
+ });
330
337
 
331
338
  await push();
332
339
 
package/src/push.ts CHANGED
@@ -32,6 +32,7 @@ export default async () => {
32
32
  breadcrumbs.push("checkNodeVersion");
33
33
  const isBuildSuccess = await checkBuildSuccess();
34
34
  const config = await provideConfig();
35
+ const cubeVersion = getArgumentByKey(["--cube-version"]);
35
36
 
36
37
  if (!isBuildSuccess && config.pushComponents) {
37
38
  console.error(
@@ -44,7 +45,7 @@ export default async () => {
44
45
  spinnerPushing = ora("Using API key...").start();
45
46
  breadcrumbs.push("push by api key");
46
47
  try {
47
- await pushByApiKey(config, spinnerPushing);
48
+ await pushByApiKey(config, spinnerPushing, cubeVersion);
48
49
  } catch (error: any) {
49
50
  if (error.response?.data?.errorCode === "BUILDER-998") {
50
51
  spinnerPushing.fail(
@@ -88,7 +89,7 @@ Read more about deployment regions at https://docs.embeddable.com/deployment/dep
88
89
  );
89
90
 
90
91
  breadcrumbs.push("send build");
91
- await sendBuild(config, { workspaceId, token, message });
92
+ await sendBuild(config, { workspaceId, token, message, cubeVersion });
92
93
 
93
94
  publishedSectionFeedback(config, spinnerPushing);
94
95
  spinnerPushing.succeed(
@@ -111,7 +112,7 @@ const publishedSectionFeedback = (
111
112
  config.pushComponents && spinnerPushing.succeed("Components published");
112
113
  };
113
114
 
114
- async function pushByApiKey(config: ResolvedEmbeddableConfig, spinner: any) {
115
+ async function pushByApiKey(config: ResolvedEmbeddableConfig, spinner: any, cubeVersion?: string) {
115
116
  const apiKey = getArgumentByKey(["--api-key", "-k"]);
116
117
 
117
118
  if (!apiKey) {
@@ -137,6 +138,7 @@ async function pushByApiKey(config: ResolvedEmbeddableConfig, spinner: any) {
137
138
  apiKey,
138
139
  email,
139
140
  message,
141
+ cubeVersion,
140
142
  });
141
143
  }
142
144
 
@@ -277,13 +279,15 @@ export async function sendBuildByApiKey(
277
279
  apiKey,
278
280
  email,
279
281
  message,
280
- }: { apiKey: string; email: string; message?: string },
282
+ cubeVersion,
283
+ }: { apiKey: string; email: string; message?: string; cubeVersion?: string },
281
284
  ) {
282
285
  const form = await createFormData(ctx.client.archiveFile, {
283
286
  pushModels: ctx.pushModels,
284
287
  pushComponents: ctx.pushComponents,
285
288
  authorEmail: email,
286
289
  description: message,
290
+ ...(cubeVersion ? { cubeVersion } : {}),
287
291
  });
288
292
 
289
293
  const response = await uploadFile(
@@ -293,7 +297,7 @@ export async function sendBuildByApiKey(
293
297
  );
294
298
  await fs.rm(ctx.client.archiveFile);
295
299
 
296
- return { ...response.data, message };
300
+ return { ...response.data, message, cubeVersion };
297
301
  }
298
302
 
299
303
  export async function sendBuild(
@@ -302,13 +306,15 @@ export async function sendBuild(
302
306
  workspaceId,
303
307
  token,
304
308
  message,
305
- }: { workspaceId: string; token: string; message?: string },
309
+ cubeVersion,
310
+ }: { workspaceId: string; token: string; message?: string; cubeVersion?: string },
306
311
  ) {
307
312
  const form = await createFormData(ctx.client.archiveFile, {
308
313
  pushModels: ctx.pushModels,
309
314
  pushComponents: ctx.pushComponents,
310
315
  authorEmail: "",
311
316
  description: message,
317
+ ...(cubeVersion ? { cubeVersion } : {}),
312
318
  });
313
319
 
314
320
  await uploadFile(