@embeddable.com/sdk-core 3.13.3-next.1 → 3.13.3

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