@embeddable.com/sdk-core 3.1.6 → 3.1.8

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
@@ -4542,7 +4542,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
4542
4542
  const ora = (await import('ora')).default;
4543
4543
  const spinnerValidate = ora("Data model validation...").start();
4544
4544
  const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
4545
- const securityContextFilesList = await findFiles(ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
4545
+ const securityContextFilesList = await findFiles(ctx.client.modelsSrc || ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
4546
4546
  const dataModelErrors = await dataModelsValidation(filesList);
4547
4547
  if (dataModelErrors.length) {
4548
4548
  spinnerValidate.fail("One or more cube.yaml files are invalid:");
@@ -4658,13 +4658,14 @@ const cubeModelSchema = z
4658
4658
  path: ["cubes"],
4659
4659
  });
4660
4660
  const viewModelSchema = z.object({
4661
- views: z.object({
4661
+ views: z
4662
+ .object({
4662
4663
  name: z.string(),
4663
4664
  cubes: z
4664
4665
  .object({
4665
4666
  join_path: z.string(),
4666
4667
  })
4667
- .array()
4668
+ .array(),
4668
4669
  })
4669
4670
  .array()
4670
4671
  .min(1),
@@ -20253,7 +20254,7 @@ async function verify(ctx) {
20253
20254
  }
20254
20255
  async function buildArchive(config) {
20255
20256
  const spinnerArchive = ora$1("Building...").start();
20256
- const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
20257
+ const filesList = await findFiles(config.client.modelsSrc || config.client.srcDir, YAML_OR_JS_FILES);
20257
20258
  await archive(config, filesList);
20258
20259
  return spinnerArchive.succeed("Bundling completed");
20259
20260
  }
@@ -20514,9 +20515,21 @@ const getPreviewWorkspace = async (ctx) => {
20514
20515
  }
20515
20516
  };
20516
20517
 
20517
- var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, }) => {
20518
+ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, componentsSrc = "src", }) => {
20518
20519
  const coreRoot = path__namespace.resolve(__dirname, "..");
20519
20520
  const clientRoot = process.cwd();
20521
+ if (!path__namespace.isAbsolute(componentsSrc)) {
20522
+ componentsSrc = path__namespace.resolve(clientRoot, componentsSrc);
20523
+ if (!fs$2.existsSync(componentsSrc)) {
20524
+ throw new Error(`componentsSrc directory ${componentsSrc} does not exist`);
20525
+ }
20526
+ }
20527
+ if (modelsSrc && !path__namespace.isAbsolute(modelsSrc)) {
20528
+ modelsSrc = path__namespace.resolve(clientRoot, modelsSrc);
20529
+ if (!fs$2.existsSync(modelsSrc)) {
20530
+ throw new Error(`modelsSrc directory ${modelsSrc} does not exist`);
20531
+ }
20532
+ }
20520
20533
  return {
20521
20534
  core: {
20522
20535
  rootDir: coreRoot,
@@ -20525,8 +20538,9 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
20525
20538
  },
20526
20539
  client: {
20527
20540
  rootDir: clientRoot,
20541
+ srcDir: path__namespace.resolve(clientRoot, componentsSrc),
20542
+ modelsSrc: modelsSrc ? path__namespace.resolve(clientRoot, modelsSrc) : undefined,
20528
20543
  buildDir: path__namespace.resolve(clientRoot, ".embeddable-build"),
20529
- srcDir: path__namespace.resolve(clientRoot, "src"),
20530
20544
  tmpDir: path__namespace.resolve(clientRoot, ".embeddable-tmp"),
20531
20545
  componentDir: path__namespace.resolve(clientRoot, ".embeddable-build", "component"),
20532
20546
  stencilBuild: path__namespace.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),