@embeddable.com/sdk-core 3.14.2-next.1 → 3.14.2-next.2

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
@@ -16,6 +16,7 @@ import { loadConfig, createCompiler } from '@stencil/core/compiler';
16
16
  import * as sorcery from 'sorcery';
17
17
  import * as os from 'node:os';
18
18
  import * as YAML from 'yaml';
19
+ import { MEASURE_TYPES, DIMENSION_TYPES } from '@embeddable.com/core';
19
20
  import * as url from 'node:url';
20
21
  import require$$4$1 from 'util';
21
22
  import require$$1 from 'os';
@@ -471,6 +472,7 @@ var buildGlobalHooks = async (ctx) => {
471
472
  const watch = (_a = ctx.dev) === null || _a === void 0 ? void 0 : _a.watch;
472
473
  const progress = watch ? undefined : ora("Building global hooks...").start();
473
474
  try {
475
+ await fs.mkdir(ctx.client.tmpDir, { recursive: true });
474
476
  const { fileName: themeProvider, watcher: themeWatcher } = await buildThemeHook(ctx);
475
477
  const { lifecycleHooks, watcher: lifecycleWatcher } = await buildLifecycleHooks(ctx);
476
478
  await saveGlobalHooksMeta(ctx, themeProvider, lifecycleHooks);
@@ -610,7 +612,7 @@ async function cleanupTemporaryHookFile(ctx) {
610
612
  * Get the path to the temporary hook file in the build directory.
611
613
  */
612
614
  function getTempHookFilePath(ctx) {
613
- return path$1.resolve(ctx.client.buildDir, TEMP_JS_HOOK_FILE);
615
+ return path$1.resolve(ctx.client.tmpDir, TEMP_JS_HOOK_FILE);
614
616
  }
615
617
  function waitForInitialBuild(watcher) {
616
618
  return new Promise((resolve, reject) => {
@@ -1003,6 +1005,10 @@ async function createManifest({ ctx, typesFileName, metaFileName, editorsMetaFil
1003
1005
  await fs.writeFile(path$1.join(ctx.client.tmpDir, "embeddable-manifest.json"), JSON.stringify(manifest));
1004
1006
  }
1005
1007
  async function extractBuild(ctx) {
1008
+ // Ensure tmpDir is removed before attempting to rename a directory to it.
1009
+ // This helps prevent EPERM errors on Windows if tmpDir already exists and is non-empty
1010
+ // from a previous failed run or other reasons.
1011
+ await fs.rm(ctx.client.tmpDir, { recursive: true, force: true });
1006
1012
  const stencilBuildFiles = await findFiles(ctx.client.stencilBuild, /embeddable-wrapper.esm-[a-z0-9]+\.js/);
1007
1013
  const [[, stencilWrapperFilePath]] = stencilBuildFiles || [];
1008
1014
  const stencilWrapperFileName = path$1.basename(stencilWrapperFilePath);
@@ -5552,28 +5558,6 @@ async function clientContextValidation(filesList) {
5552
5558
  }
5553
5559
  return errors;
5554
5560
  }
5555
- var MeasureTypeEnum;
5556
- (function (MeasureTypeEnum) {
5557
- MeasureTypeEnum["string"] = "string";
5558
- MeasureTypeEnum["time"] = "time";
5559
- MeasureTypeEnum["boolean"] = "boolean";
5560
- MeasureTypeEnum["number"] = "number";
5561
- MeasureTypeEnum["count"] = "count";
5562
- MeasureTypeEnum["count_distinct"] = "count_distinct";
5563
- MeasureTypeEnum["count_distinct_approx"] = "count_distinct_approx";
5564
- MeasureTypeEnum["sum"] = "sum";
5565
- MeasureTypeEnum["avg"] = "avg";
5566
- MeasureTypeEnum["min"] = "min";
5567
- MeasureTypeEnum["max"] = "max";
5568
- })(MeasureTypeEnum || (MeasureTypeEnum = {}));
5569
- var DimensionTypeEnum;
5570
- (function (DimensionTypeEnum) {
5571
- DimensionTypeEnum["string"] = "string";
5572
- DimensionTypeEnum["time"] = "time";
5573
- DimensionTypeEnum["boolean"] = "boolean";
5574
- DimensionTypeEnum["number"] = "number";
5575
- DimensionTypeEnum["geo"] = "geo";
5576
- })(DimensionTypeEnum || (DimensionTypeEnum = {}));
5577
5561
  const cubeModelSchema = z
5578
5562
  .object({
5579
5563
  cubes: z
@@ -5582,14 +5566,14 @@ const cubeModelSchema = z
5582
5566
  dimensions: z
5583
5567
  .object({
5584
5568
  name: z.string(),
5585
- type: z.nativeEnum(DimensionTypeEnum),
5569
+ type: z.enum(DIMENSION_TYPES),
5586
5570
  })
5587
5571
  .array()
5588
5572
  .optional(),
5589
5573
  measures: z
5590
5574
  .object({
5591
5575
  name: z.string(),
5592
- type: z.nativeEnum(MeasureTypeEnum),
5576
+ type: z.enum(MEASURE_TYPES),
5593
5577
  })
5594
5578
  .array()
5595
5579
  .optional(),