@embeddable.com/sdk-core 3.13.3-next.1 → 3.13.4-next.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/lib/index.esm.js CHANGED
@@ -21615,11 +21615,12 @@ var push = async () => {
21615
21615
  breadcrumbs.push("select workspace");
21616
21616
  const { workspaceId, name: workspaceName } = await selectWorkspace(ora, config, token);
21617
21617
  const workspacePreviewUrl = `${config.previewBaseUrl}/workspace/${workspaceId}`;
21618
+ const message = getArgumentByKey(["--message", "-m"]);
21618
21619
  breadcrumbs.push("build archive");
21619
21620
  await buildArchive(config);
21620
21621
  spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
21621
21622
  breadcrumbs.push("send build");
21622
- await sendBuild(config, { workspaceId, token });
21623
+ await sendBuild(config, { workspaceId, token, message });
21623
21624
  spinnerPushing.succeed(`Published to ${workspaceName} using ${workspacePreviewUrl}`);
21624
21625
  }
21625
21626
  catch (error) {
@@ -21688,18 +21689,17 @@ async function buildArchive(config) {
21688
21689
  ctx: config,
21689
21690
  filesList,
21690
21691
  isDev: false,
21691
- includeComponents: config.pushComponents,
21692
21692
  });
21693
21693
  return spinnerArchive.succeed("Bundling completed");
21694
21694
  }
21695
21695
  async function archive(args) {
21696
- const { ctx, filesList, isDev, includeComponents } = args;
21696
+ const { ctx, filesList, isDev } = args;
21697
21697
  const output = fs$1.createWriteStream(ctx.client.archiveFile);
21698
21698
  const archive = archiver.create("zip", {
21699
21699
  zlib: { level: 9 },
21700
21700
  });
21701
21701
  archive.pipe(output);
21702
- if (!isDev && includeComponents) {
21702
+ if (!isDev) {
21703
21703
  archive.directory(ctx.client.buildDir, false);
21704
21704
  archive.file(ctx.client.globalCss, {
21705
21705
  name: "global.css",
@@ -21715,32 +21715,36 @@ async function archive(args) {
21715
21715
  output.on("close", resolve);
21716
21716
  });
21717
21717
  }
21718
- async function sendBuildByApiKey(ctx, { apiKey, email, message, }) {
21719
- var _a;
21718
+ async function createFormData(filePath, metadata) {
21720
21719
  const { FormData, Blob } = await import('formdata-node');
21721
21720
  const { fileFromPath } = await Promise.resolve().then(function () { return fileFromPath$1; });
21722
- const file = await fileFromPath(ctx.client.archiveFile, "embeddable-build.zip");
21721
+ const file = await fileFromPath(filePath, "embeddable-build.zip");
21723
21722
  const form = new FormData();
21724
21723
  form.set("file", file, "embeddable-build.zip");
21725
- const metadataBlob = new Blob([
21726
- JSON.stringify({
21727
- pushModels: ctx.pushModels,
21728
- pushComponents: ctx.pushComponents,
21729
- authorEmail: email,
21730
- description: message,
21731
- }),
21732
- ], { type: "application/json" });
21724
+ const metadataBlob = new Blob([JSON.stringify(metadata)], {
21725
+ type: "application/json",
21726
+ });
21733
21727
  form.set("request", metadataBlob, "request.json");
21728
+ return form;
21729
+ }
21730
+ async function sendBuildByApiKey(ctx, { apiKey, email, message, }) {
21731
+ const form = await createFormData(ctx.client.archiveFile, {
21732
+ pushModels: ctx.pushModels,
21733
+ pushComponents: ctx.pushComponents,
21734
+ authorEmail: email,
21735
+ description: message,
21736
+ });
21734
21737
  const response = await uploadFile(form, `${ctx.pushBaseUrl}/api/v1/bundle/upload`, apiKey);
21735
21738
  await fs.rm(ctx.client.archiveFile);
21736
- return { bundleId: (_a = response.data) === null || _a === undefined ? undefined : _a.bundleId, email, message };
21737
- }
21738
- async function sendBuild(ctx, { workspaceId, token }) {
21739
- const { FormData } = await import('formdata-node');
21740
- const { fileFromPath } = await Promise.resolve().then(function () { return fileFromPath$1; });
21741
- const file = await fileFromPath(ctx.client.archiveFile, "embeddable-build.zip");
21742
- const form = new FormData();
21743
- form.set("file", file, "embeddable-build.zip");
21739
+ return { ...response.data, message };
21740
+ }
21741
+ async function sendBuild(ctx, { workspaceId, token, message, }) {
21742
+ const form = await createFormData(ctx.client.archiveFile, {
21743
+ pushModels: ctx.pushModels,
21744
+ pushComponents: ctx.pushComponents,
21745
+ authorEmail: "",
21746
+ description: message,
21747
+ });
21744
21748
  await uploadFile(form, `${ctx.pushBaseUrl}/bundle/${workspaceId}/upload`, token);
21745
21749
  await fs.rm(ctx.client.archiveFile);
21746
21750
  }
@@ -21987,7 +21991,6 @@ const sendDataModelsAndContextsChanges = async (ctx) => {
21987
21991
  ctx,
21988
21992
  filesList,
21989
21993
  isDev: true,
21990
- includeComponents: false,
21991
21994
  });
21992
21995
  await sendBuild(ctx, { workspaceId: previewWorkspace, token });
21993
21996
  sending.succeed(`Data models and/or security context synchronized`);