@embeddable.com/sdk-core 4.3.3-next.0 → 4.4.0-next.0

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.
@@ -12,6 +12,7 @@ export type EmbeddableConfig = {
12
12
  })[];
13
13
  pushModels?: boolean;
14
14
  pushComponents?: boolean;
15
+ pushEmbeddables?: boolean;
15
16
  pushBaseUrl?: string;
16
17
  audienceUrl?: string;
17
18
  authDomain?: string;
@@ -74,6 +75,7 @@ export type ResolvedEmbeddableConfig = {
74
75
  };
75
76
  pushModels: boolean;
76
77
  pushComponents: boolean;
78
+ pushEmbeddables: boolean;
77
79
  pushBaseUrl: string;
78
80
  audienceUrl: string;
79
81
  previewBaseUrl: string;
@@ -106,6 +108,7 @@ export declare const embeddableConfigSchema: z.ZodObject<{
106
108
  starterEmbeddables: z.ZodOptional<z.ZodRecord<z.ZodEnum<["EU", "US", "legacy-US"]>, z.ZodArray<z.ZodString, "many">>>;
107
109
  pushModels: z.ZodOptional<z.ZodBoolean>;
108
110
  pushComponents: z.ZodOptional<z.ZodBoolean>;
111
+ pushEmbeddables: z.ZodOptional<z.ZodBoolean>;
109
112
  pushBaseUrl: z.ZodOptional<z.ZodString>;
110
113
  audienceUrl: z.ZodOptional<z.ZodString>;
111
114
  authDomain: z.ZodOptional<z.ZodString>;
@@ -157,6 +160,7 @@ export declare const embeddableConfigSchema: z.ZodObject<{
157
160
  starterEmbeddables?: Partial<Record<"EU" | "US" | "legacy-US", string[]>> | undefined;
158
161
  pushModels?: boolean | undefined;
159
162
  pushComponents?: boolean | undefined;
163
+ pushEmbeddables?: boolean | undefined;
160
164
  pushBaseUrl?: string | undefined;
161
165
  audienceUrl?: string | undefined;
162
166
  authDomain?: string | undefined;
@@ -188,6 +192,7 @@ export declare const embeddableConfigSchema: z.ZodObject<{
188
192
  starterEmbeddables?: Partial<Record<"EU" | "US" | "legacy-US", string[]>> | undefined;
189
193
  pushModels?: boolean | undefined;
190
194
  pushComponents?: boolean | undefined;
195
+ pushEmbeddables?: boolean | undefined;
191
196
  pushBaseUrl?: string | undefined;
192
197
  audienceUrl?: string | undefined;
193
198
  authDomain?: string | undefined;
@@ -257,6 +262,7 @@ declare const _default: (config: EmbeddableConfig) => {
257
262
  starterEmbeddables: Partial<Record<Region, string[]>> | undefined;
258
263
  pushModels: boolean;
259
264
  pushComponents: boolean;
265
+ pushEmbeddables: boolean;
260
266
  pushBaseUrl: string;
261
267
  audienceUrl: string;
262
268
  previewBaseUrl: string;
package/lib/index.esm.js CHANGED
@@ -21447,6 +21447,7 @@ async function selectWorkspace(ora, ctx, token) {
21447
21447
  const CUBE_FILES = /^(.*)\.cube\.(ya?ml|js)$/;
21448
21448
  const CLIENT_CONTEXT_FILES = /^(.*)\.cc\.ya?ml$/;
21449
21449
  const SECURITY_CONTEXT_FILES = /^(.*)\.sc\.ya?ml$/;
21450
+ const EMBEDDABLE_FILES = /^(.*)\.embeddable\.ya?ml$/;
21450
21451
  var push = async () => {
21451
21452
  var _a, _b, _c, _d, _f, _g;
21452
21453
  await initLogger("push");
@@ -21512,6 +21513,7 @@ Read more about deployment regions at https://docs.embeddable.com/deployment/dep
21512
21513
  const publishedSectionFeedback = (config, spinnerPushing) => {
21513
21514
  config.pushModels && spinnerPushing.succeed("Models published");
21514
21515
  config.pushComponents && spinnerPushing.succeed("Components published");
21516
+ config.pushEmbeddables && spinnerPushing.succeed("Embeddables published");
21515
21517
  };
21516
21518
  async function pushByApiKey(config, spinner, cubeVersion) {
21517
21519
  const apiKey = getArgumentByKey(["--api-key", "-k"]);
@@ -21554,8 +21556,8 @@ async function verify(ctx) {
21554
21556
  }
21555
21557
  async function buildArchive(config) {
21556
21558
  const spinnerArchive = ora("Building...").start();
21557
- if (!config.pushModels && !config.pushComponents) {
21558
- spinnerArchive.fail("Cannot push: both pushModels and pushComponents are disabled");
21559
+ if (!config.pushModels && !config.pushComponents && !config.pushEmbeddables) {
21560
+ spinnerArchive.fail("Cannot push: pushModels, pushComponents, and pushEmbeddables are all disabled");
21559
21561
  process.exit(1);
21560
21562
  }
21561
21563
  const filesList = [];
@@ -21577,6 +21579,13 @@ async function buildArchive(config) {
21577
21579
  entry[1],
21578
21580
  ]));
21579
21581
  }
21582
+ if (config.pushEmbeddables) {
21583
+ const embeddableFilesList = await findFiles(config.client.srcDir, EMBEDDABLE_FILES);
21584
+ filesList.push(...embeddableFilesList.map((entry) => [
21585
+ path.basename(entry[1]),
21586
+ entry[1],
21587
+ ]));
21588
+ }
21580
21589
  await archive({
21581
21590
  ctx: config,
21582
21591
  filesList,
@@ -22111,6 +22120,13 @@ const cubeSecurityContextAndClientContextWatcher = async (ctx) => {
22111
22120
  ]);
22112
22121
  filesToWatch = [...filesToWatch, ...cubeFiles, ...securityContextFiles];
22113
22122
  }
22123
+ if (ctx.pushEmbeddables) {
22124
+ const embeddableFiles = await fg("**/*.embeddable.{yaml,yml}", {
22125
+ cwd: ctx.client.srcDir,
22126
+ absolute: true,
22127
+ });
22128
+ filesToWatch = [...filesToWatch, ...embeddableFiles];
22129
+ }
22114
22130
  const fsWatcher = chokidar.watch(filesToWatch, chokidarWatchOptions);
22115
22131
  fsWatcher.on("all", () => sendBuildChanges(ctx));
22116
22132
  return fsWatcher;
@@ -22129,7 +22145,7 @@ const sendBuildChanges = async (ctx) => {
22129
22145
  return sendMessage("dataModelsAndOrSecurityContextUpdateError");
22130
22146
  }
22131
22147
  sendMessage("dataModelsAndOrSecurityContextUpdateStart");
22132
- const sending = ora("Synchronising data models and/or security contexts...").start();
22148
+ const sending = ora("Synchronising data models and/or security contexts and/or embeddables...").start();
22133
22149
  let filesList = [];
22134
22150
  if (ctx.pushComponents) {
22135
22151
  const clientContextFilesList = await findFiles(ctx.client.presetsSrc, CLIENT_CONTEXT_FILES);
@@ -22154,6 +22170,16 @@ const sendBuildChanges = async (ctx) => {
22154
22170
  ].map((entry) => [path.basename(entry[1]), entry[1]]);
22155
22171
  filesList = [...filesList, ...cubeAndSecurityContextFileList];
22156
22172
  }
22173
+ if (ctx.pushEmbeddables) {
22174
+ const embeddableFilesList = await findFiles(ctx.client.srcDir, EMBEDDABLE_FILES);
22175
+ filesList = [
22176
+ ...filesList,
22177
+ ...embeddableFilesList.map((entry) => [
22178
+ path.basename(entry[1]),
22179
+ entry[1],
22180
+ ]),
22181
+ ];
22182
+ }
22157
22183
  try {
22158
22184
  const token = await getToken();
22159
22185
  await archive({
@@ -22165,10 +22191,10 @@ const sendBuildChanges = async (ctx) => {
22165
22191
  }
22166
22192
  catch (e) {
22167
22193
  const errorMessage = (_d = (_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorMessage) !== null && _c !== void 0 ? _c : e.message) !== null && _d !== void 0 ? _d : "Unknown error";
22168
- sending.fail(`Data models and/or security context synchronization failed with error: ${errorMessage}`);
22194
+ sending.fail(`Data models and/or security context and/or embeddables synchronization failed with error: ${errorMessage}`);
22169
22195
  return sendMessage("dataModelsAndOrSecurityContextUpdateError", { error: errorMessage });
22170
22196
  }
22171
- sending.succeed(`Data models and/or security context synchronized`);
22197
+ sending.succeed(`Data models and/or security context and/or embeddables synchronized`);
22172
22198
  sendMessage("dataModelsAndOrSecurityContextUpdateSuccess");
22173
22199
  };
22174
22200
  const onClose = async (server, sys, watchers, config) => {
@@ -22297,6 +22323,7 @@ const embeddableConfigSchema = objectType({
22297
22323
  starterEmbeddables: recordType(enumType(["EU", "US", "legacy-US"]), arrayType(stringType().uuid())).optional(),
22298
22324
  pushModels: booleanType().optional(),
22299
22325
  pushComponents: booleanType().optional(),
22326
+ pushEmbeddables: booleanType().optional(),
22300
22327
  pushBaseUrl: stringType().optional(),
22301
22328
  audienceUrl: stringType().optional(),
22302
22329
  authDomain: stringType().optional(),
@@ -22334,7 +22361,7 @@ var defineConfig = (config) => {
22334
22361
  if (errors.length > 0) {
22335
22362
  throw new Error(`Invalid Embeddable Configuration: ${errors.join("\n")}}`);
22336
22363
  }
22337
- let { plugins, region = "legacy-US", pushModels = true, starterEmbeddables, pushComponents = true, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", presetsSrc = "src", componentsSrc = "src", customCanvasCss = "src/custom-canvas.css", viteConfig = {}, rollupOptions = {}, componentLibraries = [], customizationFile = "embeddable.theme.ts", lifecycleHooksFile = "lifecycle.config.ts", } = config;
22364
+ let { plugins, region = "legacy-US", pushModels = true, starterEmbeddables, pushComponents = true, pushEmbeddables = true, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", presetsSrc = "src", componentsSrc = "src", customCanvasCss = "src/custom-canvas.css", viteConfig = {}, rollupOptions = {}, componentLibraries = [], customizationFile = "embeddable.theme.ts", lifecycleHooksFile = "lifecycle.config.ts", } = config;
22338
22365
  const regionConfig = REGION_CONFIGS[region];
22339
22366
  const __dirname = import.meta.dirname;
22340
22367
  const coreRoot = path$1.resolve(__dirname, "..");
@@ -22398,6 +22425,7 @@ var defineConfig = (config) => {
22398
22425
  starterEmbeddables,
22399
22426
  pushModels,
22400
22427
  pushComponents,
22428
+ pushEmbeddables,
22401
22429
  pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== void 0 ? pushBaseUrl : regionConfig.pushBaseUrl,
22402
22430
  audienceUrl: audienceUrl !== null && audienceUrl !== void 0 ? audienceUrl : regionConfig.audienceUrl,
22403
22431
  previewBaseUrl: previewBaseUrl !== null && previewBaseUrl !== void 0 ? previewBaseUrl : regionConfig.previewBaseUrl,