@embeddable.com/sdk-core 3.13.3-next.0 → 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,25 +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([JSON.stringify({ authorEmail: email, description: message })], { type: "application/json" });
21726
- form.set("metadata", metadataBlob, "metadata.json");
21723
+ const metadataBlob = new Blob([JSON.stringify(metadata)], {
21724
+ type: "application/json",
21725
+ });
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
+ });
21727
21736
  const response = await uploadFile(form, `${ctx.pushBaseUrl}/api/v1/bundle/upload`, apiKey);
21728
21737
  await fs.rm(ctx.client.archiveFile);
21729
- return { bundleId: (_a = response.data) === null || _a === undefined ? undefined : _a.bundleId, email, message };
21738
+ return { ...response.data, message };
21730
21739
  }
21731
21740
  async function sendBuild(ctx, { workspaceId, token }) {
21732
- const { FormData } = await import('formdata-node');
21733
- const { fileFromPath } = await Promise.resolve().then(function () { return fileFromPath$1; });
21734
- const file = await fileFromPath(ctx.client.archiveFile, "embeddable-build.zip");
21735
- const form = new FormData();
21736
- 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
+ });
21737
21747
  await uploadFile(form, `${ctx.pushBaseUrl}/bundle/${workspaceId}/upload`, token);
21738
21748
  await fs.rm(ctx.client.archiveFile);
21739
21749
  }
@@ -21980,7 +21990,6 @@ const sendDataModelsAndContextsChanges = async (ctx) => {
21980
21990
  ctx,
21981
21991
  filesList,
21982
21992
  isDev: true,
21983
- includeComponents: false,
21984
21993
  });
21985
21994
  await sendBuild(ctx, { workspaceId: previewWorkspace, token });
21986
21995
  sending.succeed(`Data models and/or security context synchronized`);