@embeddable.com/sdk-core 3.12.0 → 3.12.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/index.js CHANGED
@@ -5010,7 +5010,7 @@ var z = /*#__PURE__*/Object.freeze({
5010
5010
  const CUBE_YAML_FILE_REGEX = /^(.*)\.cube\.ya?ml$/;
5011
5011
  const SECURITY_CONTEXT_FILE_REGEX = /^(.*)\.sc\.ya?ml$/;
5012
5012
  const CLIENT_CONTEXT_FILE_REGEX = /^(.*)\.cc\.ya?ml$/;
5013
- var validate = async (ctx, exitIfInvalid = true) => {
5013
+ var validate = async (ctx) => {
5014
5014
  checkNodeVersion();
5015
5015
  const ora = (await import('ora')).default;
5016
5016
  const spinnerValidate = ora("Data model validation...").start();
@@ -5021,9 +5021,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
5021
5021
  if (dataModelErrors.length) {
5022
5022
  spinnerValidate.fail("One or more cube.yaml files are invalid:");
5023
5023
  dataModelErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
5024
- if (exitIfInvalid) {
5025
- process.exit(1);
5026
- }
5024
+ process.exit(1);
5027
5025
  }
5028
5026
  spinnerValidate.succeed("Data model validation completed");
5029
5027
  const securityContextErrors = await securityContextValidation(securityContextFilesList);
@@ -5031,16 +5029,12 @@ var validate = async (ctx, exitIfInvalid = true) => {
5031
5029
  if (securityContextErrors.length) {
5032
5030
  spinnerValidate.fail("One or more security context files are invalid:");
5033
5031
  securityContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
5034
- if (exitIfInvalid) {
5035
- process.exit(1);
5036
- }
5032
+ process.exit(1);
5037
5033
  }
5038
5034
  if (clientContextErrors.length) {
5039
5035
  spinnerValidate.fail("One or more client context files are invalid:");
5040
5036
  clientContextErrors.forEach((errorMessage) => spinnerValidate.info(errorMessage));
5041
- if (exitIfInvalid) {
5042
- process.exit(1);
5043
- }
5037
+ process.exit(1);
5044
5038
  }
5045
5039
  return (dataModelErrors.length === 0 &&
5046
5040
  securityContextErrors.length === 0 &&
@@ -21353,7 +21347,7 @@ async function rotateLogIfNeeded() {
21353
21347
  function setupGlobalErrorHandlers(command) {
21354
21348
  process.on("uncaughtException", async (error) => {
21355
21349
  await logError({ command, breadcrumbs: ["uncaughtException"], error });
21356
- console.error("An uncaught error occurred. Check the log file for details.");
21350
+ console.error(error);
21357
21351
  process.exit(1);
21358
21352
  });
21359
21353
  process.on("unhandledRejection", async (reason) => {
@@ -21362,7 +21356,7 @@ function setupGlobalErrorHandlers(command) {
21362
21356
  breadcrumbs: ["unhandledRejection"],
21363
21357
  error: reason,
21364
21358
  });
21365
- console.error("An unhandled rejection occurred. Check the log file for details.");
21359
+ console.error(reason);
21366
21360
  process.exit(1);
21367
21361
  });
21368
21362
  }
@@ -21432,11 +21426,19 @@ var login = async () => {
21432
21426
  client_id: config.authClientId,
21433
21427
  };
21434
21428
  await open(deviceCodeResponse.data["verification_uri_complete"]);
21429
+ let isTerminated = false;
21430
+ const signalHandler = () => {
21431
+ isTerminated = true;
21432
+ authenticationSpinner.fail("Authentication process interrupted");
21433
+ process.exit(0);
21434
+ };
21435
+ process.on("SIGTERM", signalHandler);
21436
+ process.on("SIGINT", signalHandler);
21435
21437
  /**
21436
21438
  * This is a recommended way to poll, since it take some time for a user to enter a `user_code` in a browser.
21437
21439
  * deviceCodeResponse.data['interval'] is a recommended/calculated polling interval specified in seconds.
21438
21440
  */
21439
- while (true) {
21441
+ while (!isTerminated) {
21440
21442
  try {
21441
21443
  const tokenResponse = await axios.post(`https://${config.authDomain}/oauth/token`, tokenPayload);
21442
21444
  await fs__namespace.writeFile(CREDENTIALS_FILE, JSON.stringify(tokenResponse.data));
@@ -21451,6 +21453,9 @@ var login = async () => {
21451
21453
  await sleep(deviceCodeResponse.data["interval"] * 1000);
21452
21454
  }
21453
21455
  }
21456
+ // Clean up signal handlers
21457
+ process.off("SIGTERM", signalHandler);
21458
+ process.off("SIGINT", signalHandler);
21454
21459
  }
21455
21460
  catch (error) {
21456
21461
  authenticationSpinner.fail("Authentication failed. Please try again.");
@@ -21584,6 +21589,7 @@ var push = async () => {
21584
21589
  spinnerPushing === null || spinnerPushing === void 0 ? void 0 : spinnerPushing.fail("Publishing failed");
21585
21590
  await logError({ command: "push", breadcrumbs, error });
21586
21591
  await reportErrorToRollbar(error);
21592
+ console.log(error);
21587
21593
  process.exit(1);
21588
21594
  }
21589
21595
  };
@@ -21825,6 +21831,7 @@ var dev = async () => {
21825
21831
  }
21826
21832
  catch (error) {
21827
21833
  await logError({ command: "dev", breadcrumbs, error });
21834
+ console.log(error);
21828
21835
  process.exit(1);
21829
21836
  }
21830
21837
  };
@@ -21898,7 +21905,7 @@ const globalCssWatcher = (ctx) => {
21898
21905
  };
21899
21906
  const sendDataModelsAndContextsChanges = async (ctx) => {
21900
21907
  sendMessage("dataModelsAndOrSecurityContextUpdateStart");
21901
- const isValid = await validate(ctx, false);
21908
+ const isValid = await validate(ctx);
21902
21909
  if (isValid) {
21903
21910
  const token = await getToken();
21904
21911
  const sending = ora("Synchronising data models and/or security contexts...").start();
@@ -21937,6 +21944,8 @@ const onClose = async (server, sys, watchers, config) => {
21937
21944
  process.exit(0);
21938
21945
  };
21939
21946
  const getPreviewWorkspace = async (startedOra, ctx) => {
21947
+ // login and retry
21948
+ await login();
21940
21949
  const token = await getToken();
21941
21950
  const params = minimist(process.argv.slice(2));
21942
21951
  let primaryWorkspace = params.w || params.workspace;
@@ -22027,7 +22036,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
22027
22036
  };
22028
22037
 
22029
22038
  var name = "@embeddable.com/sdk-core";
22030
- var version = "3.12.0";
22039
+ var version = "3.12.0-next.2";
22031
22040
  var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
22032
22041
  var keywords = [
22033
22042
  "embeddable",
@@ -22065,7 +22074,7 @@ var engines = {
22065
22074
  };
22066
22075
  var license = "MIT";
22067
22076
  var dependencies = {
22068
- "@embeddable.com/sdk-utils": "0.6.0",
22077
+ "@embeddable.com/sdk-utils": "0.6.0-next.0",
22069
22078
  "@inquirer/prompts": "^7.1.0",
22070
22079
  "@stencil/core": "^4.22.3",
22071
22080
  "@swc-node/register": "^1.10.9",