@embeddable.com/sdk-core 2.4.15 → 2.4.17

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.js CHANGED
@@ -4521,7 +4521,7 @@ var z = /*#__PURE__*/Object.freeze({
4521
4521
  ZodError: ZodError
4522
4522
  });
4523
4523
 
4524
- const CUBE_YAML_FILE_REGEX$1 = /^(.*)\.cube\.ya?ml$/;
4524
+ const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
4525
4525
  const checkNodeVersion$1 = () => {
4526
4526
  const [major, minor] = process.versions.node.split(".").map(Number);
4527
4527
  const engines = require("../package.json").engines.node;
@@ -4534,7 +4534,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
4534
4534
  checkNodeVersion$1();
4535
4535
  const ora = (await import('ora')).default;
4536
4536
  const spinnerValidate = ora("data model validation...").start();
4537
- const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX$1);
4537
+ const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
4538
4538
  const dataModelErrors = await dataModelsValidation(filesList);
4539
4539
  if (dataModelErrors.length) {
4540
4540
  spinnerValidate.fail("One or more cube.yaml files are invalid:");
@@ -19954,7 +19954,7 @@ var build = async () => {
19954
19954
  catch (error) {
19955
19955
  await reportErrorToRollbar(error);
19956
19956
  console.log(error);
19957
- throw error;
19957
+ process.exit(1);
19958
19958
  }
19959
19959
  };
19960
19960
 
@@ -19962,8 +19962,9 @@ const oraP$2 = import('ora');
19962
19962
  const openP = import('open');
19963
19963
  var login = async () => {
19964
19964
  var _a;
19965
+ const ora = (await oraP$2).default;
19966
+ const authenticationSpinner = ora("waiting for code verification...").start();
19965
19967
  try {
19966
- const ora = (await oraP$2).default;
19967
19968
  const open = (await openP).default;
19968
19969
  const config = await provideConfig();
19969
19970
  await resolveFiles();
@@ -19977,7 +19978,6 @@ var login = async () => {
19977
19978
  device_code: deviceCodeResponse.data["device_code"],
19978
19979
  client_id: config.authClientId,
19979
19980
  };
19980
- const authenticationSpinner = ora("waiting for code verification...").start();
19981
19981
  await open(deviceCodeResponse.data["verification_uri_complete"]);
19982
19982
  /**
19983
19983
  * This is a recommended way to poll, since it take some time for a user to enter a `user_code` in a browser.
@@ -20000,9 +20000,10 @@ var login = async () => {
20000
20000
  }
20001
20001
  }
20002
20002
  catch (error) {
20003
+ authenticationSpinner.fail("authentication failed. please try again.");
20003
20004
  await reportErrorToRollbar(error);
20004
20005
  console.log(error);
20005
- throw error;
20006
+ process.exit(1);
20006
20007
  }
20007
20008
  };
20008
20009
  async function getToken() {
@@ -20036,7 +20037,7 @@ async function resolveFiles() {
20036
20037
 
20037
20038
  const oraP$1 = import('ora');
20038
20039
  const inquirerSelect = import('@inquirer/select');
20039
- const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
20040
+ const CUBE_YAML_OR_JS_FILE_REGEX = /^(.*)\.cube\.(ya?ml|js)$/;
20040
20041
  let ora$1;
20041
20042
  var push = async () => {
20042
20043
  try {
@@ -20046,7 +20047,7 @@ var push = async () => {
20046
20047
  const token = await verify(config);
20047
20048
  const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
20048
20049
  const spinnerArchive = ora$1("archivation...").start();
20049
- const filesList = await findFiles(config.client.srcDir, CUBE_YAML_FILE_REGEX);
20050
+ const filesList = await findFiles(config.client.srcDir, CUBE_YAML_OR_JS_FILE_REGEX);
20050
20051
  await archive(config, filesList);
20051
20052
  spinnerArchive.succeed("archivation competed");
20052
20053
  const spinnerPushing = ora$1(`publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
@@ -20114,7 +20115,10 @@ async function archive(ctx, yamlFiles, includeBuild = true) {
20114
20115
  _archiver.directory(ctx.client.buildDir, false);
20115
20116
  }
20116
20117
  for (const fileData of yamlFiles) {
20117
- _archiver.file(fileData[1], { name: `${fileData[0]}.cube.yaml` });
20118
+ const fileExtension = fileData[1].split(".").pop();
20119
+ _archiver.file(fileData[1], {
20120
+ name: `${fileData[0]}.cube.${fileExtension}`,
20121
+ });
20118
20122
  }
20119
20123
  await _archiver.finalize();
20120
20124
  return new Promise((resolve, _reject) => {
@@ -20273,7 +20277,7 @@ const sendDataModels = async (ctx) => {
20273
20277
  if (isValid) {
20274
20278
  const token = await getToken();
20275
20279
  const sending = ora("synchronising data models...").start();
20276
- const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
20280
+ const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_OR_JS_FILE_REGEX);
20277
20281
  await archive(ctx, filesList, false);
20278
20282
  await sendBuild(ctx, { workspaceId: previewWorkspace, token });
20279
20283
  sending.succeed(`data models synchronized`);