@embeddable.com/sdk-core 3.12.4 → 3.12.5

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
@@ -21468,7 +21468,7 @@ async function resolveFiles() {
21468
21468
  }
21469
21469
 
21470
21470
  async function getWorkspaces(ctx, token, workspaceSpinner) {
21471
- var _a, _b;
21471
+ var _a, _b, _c;
21472
21472
  try {
21473
21473
  const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
21474
21474
  headers: {
@@ -21478,7 +21478,11 @@ async function getWorkspaces(ctx, token, workspaceSpinner) {
21478
21478
  return (_a = response.data) === null || _a === void 0 ? void 0 : _a.filter((w) => !w.devWorkspace);
21479
21479
  }
21480
21480
  catch (e) {
21481
- if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
21481
+ if ((_b = ctx.dev) === null || _b === void 0 ? void 0 : _b.watch) {
21482
+ workspaceSpinner.stop();
21483
+ throw e;
21484
+ }
21485
+ if (((_c = e.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
21482
21486
  workspaceSpinner.fail('Unauthorized. Please login using "embeddable login" command.');
21483
21487
  }
21484
21488
  else {
@@ -21607,7 +21611,9 @@ async function buildArchive(config) {
21607
21611
  const spinnerArchive = ora$1("Building...").start();
21608
21612
  const cubeFilesList = await findFiles(config.client.modelsSrc || config.client.srcDir, CUBE_FILES);
21609
21613
  const contextFilesList = await findFiles(config.client.presetsSrc || config.client.srcDir, PRESET_FILES);
21610
- await archive(config, [...cubeFilesList, ...contextFilesList]);
21614
+ // Map the files to include their full filenames
21615
+ const filesList = [...cubeFilesList, ...contextFilesList].map((entry) => [path$1.basename(entry[1]), entry[1]]);
21616
+ await archive(config, filesList);
21611
21617
  return spinnerArchive.succeed("Bundling completed");
21612
21618
  }
21613
21619
  async function archive(ctx, yamlFiles, isDev = false) {
@@ -21623,9 +21629,8 @@ async function archive(ctx, yamlFiles, isDev = false) {
21623
21629
  });
21624
21630
  }
21625
21631
  for (const fileData of yamlFiles) {
21626
- const fileName = fileData[1].split("/").pop();
21627
21632
  _archiver.file(fileData[1], {
21628
- name: fileName,
21633
+ name: fileData[0],
21629
21634
  });
21630
21635
  }
21631
21636
  await _archiver.finalize();
@@ -21702,7 +21707,7 @@ const chokidarWatchOptions = {
21702
21707
  },
21703
21708
  };
21704
21709
  var dev = async () => {
21705
- var _a, _b;
21710
+ var _a, _b, _c;
21706
21711
  await initLogger("dev");
21707
21712
  const breadcrumbs = [];
21708
21713
  try {
@@ -21735,14 +21740,22 @@ var dev = async () => {
21735
21740
  const finalhandler = require("finalhandler");
21736
21741
  const serveStatic = require("serve-static");
21737
21742
  const serve = serveStatic(config.client.buildDir);
21738
- const workspacePreparation = ora("Preparing workspace...").start();
21743
+ let workspacePreparation = ora("Preparing workspace...").start();
21739
21744
  breadcrumbs.push("get preview workspace");
21740
21745
  try {
21741
21746
  previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
21742
21747
  }
21743
21748
  catch (e) {
21744
- workspacePreparation.fail(((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorMessage) || "Unknown error: " + e.message);
21745
- process.exit(1);
21749
+ if (((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
21750
+ // login and retry
21751
+ await login();
21752
+ workspacePreparation = ora("Preparing workspace...").start();
21753
+ previewWorkspace = await getPreviewWorkspace(workspacePreparation, config);
21754
+ }
21755
+ else {
21756
+ workspacePreparation.fail(((_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.errorMessage) || "Unknown error: " + e.message);
21757
+ process.exit(1);
21758
+ }
21746
21759
  }
21747
21760
  workspacePreparation.succeed("Workspace is ready");
21748
21761
  const server = http.createServer((request, res) => {
@@ -21751,7 +21764,6 @@ var dev = async () => {
21751
21764
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
21752
21765
  res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
21753
21766
  if (request.method === "OPTIONS") {
21754
- // Respond to OPTIONS requests with just the CORS headers and a 200 status code
21755
21767
  res.writeHead(200);
21756
21768
  res.end();
21757
21769
  return;
@@ -21768,7 +21780,21 @@ var dev = async () => {
21768
21780
  serve(request, res, done);
21769
21781
  });
21770
21782
  wss = new WebSocketServer({ server });
21783
+ wss.on("connection", (ws) => {
21784
+ console.log("🔌 New WebSocket connection established");
21785
+ ws.on("error", (error) => {
21786
+ console.error("WebSocket error:", error);
21787
+ });
21788
+ ws.on("close", () => {
21789
+ console.log("WebSocket connection closed");
21790
+ });
21791
+ });
21792
+ wss.on("error", (error) => {
21793
+ console.error("WebSocket server error:", error);
21794
+ });
21771
21795
  server.listen(SERVER_PORT, async () => {
21796
+ console.log(`\n�� Dev server running and ready to connect`);
21797
+ console.log("ℹ️ Your app will automatically connect to the dev server when you open the workspace");
21772
21798
  const watchers = [];
21773
21799
  if (sys === null || sys === void 0 ? void 0 : sys.onProcessInterrupt) {
21774
21800
  sys.onProcessInterrupt(async () => await onClose(server, sys, watchers, config));
@@ -21886,10 +21912,11 @@ const sendDataModelsAndContextsChanges = async (ctx) => {
21886
21912
  const sending = ora("Synchronising data models and/or security contexts...").start();
21887
21913
  const cubeFilesList = await findFiles(ctx.client.modelsSrc, CUBE_FILES);
21888
21914
  const contextFilesList = await findFiles(ctx.client.presetsSrc, PRESET_FILES);
21889
- const filesList = [...cubeFilesList, ...contextFilesList];
21915
+ // Map the files to include their full filenames
21916
+ const filesList = [...cubeFilesList, ...contextFilesList].map((entry) => [path$1.basename(entry[1]), entry[1]]);
21890
21917
  // add manifest to the archive
21891
21918
  filesList.push([
21892
- "embeddable-manifest",
21919
+ "embeddable-manifest.json",
21893
21920
  path$1.resolve(ctx.client.buildDir, "embeddable-manifest.json"),
21894
21921
  ]);
21895
21922
  await archive(ctx, filesList, true);
@@ -22040,7 +22067,7 @@ var defineConfig = ({ plugins, region = "legacy-US", pushBaseUrl, audienceUrl, a
22040
22067
  };
22041
22068
 
22042
22069
  var name = "@embeddable.com/sdk-core";
22043
- var version = "3.12.3";
22070
+ var version = "3.12.4";
22044
22071
  var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
22045
22072
  var keywords = [
22046
22073
  "embeddable",
@@ -22068,7 +22095,8 @@ var files = [
22068
22095
  "lib/",
22069
22096
  "loader/",
22070
22097
  "templates/",
22071
- "configs/"
22098
+ "configs/",
22099
+ "certs"
22072
22100
  ];
22073
22101
  var bin = {
22074
22102
  embeddable: "bin/embeddable"
@@ -22078,7 +22106,7 @@ var engines = {
22078
22106
  };
22079
22107
  var license = "MIT";
22080
22108
  var dependencies = {
22081
- "@embeddable.com/sdk-utils": "0.6.1",
22109
+ "@embeddable.com/sdk-utils": "0.6.2",
22082
22110
  "@inquirer/prompts": "^7.2.1",
22083
22111
  "@stencil/core": "^4.23.0",
22084
22112
  "@swc-node/register": "^1.10.9",