@embeddable.com/sdk-core 4.1.4 → 4.1.5-next.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/defineConfig.d.ts +6 -0
- package/lib/index.esm.js +10 -2
- package/lib/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/defineConfig.test.ts +8 -0
- package/src/defineConfig.ts +8 -0
- package/src/push.ts +7 -1
package/lib/defineConfig.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type EmbeddableConfig = {
|
|
|
31
31
|
};
|
|
32
32
|
rollupOptions?: RollupOptions;
|
|
33
33
|
region?: Region;
|
|
34
|
+
starterEmbeddables?: Partial<Record<Region, string[]>>;
|
|
34
35
|
componentLibraries?: string[] | ComponentLibraryConfig[];
|
|
35
36
|
customizationFile?: string;
|
|
36
37
|
lifecycleHooksFile?: string;
|
|
@@ -87,6 +88,7 @@ export type ResolvedEmbeddableConfig = {
|
|
|
87
88
|
sys: any;
|
|
88
89
|
};
|
|
89
90
|
region: Region;
|
|
91
|
+
starterEmbeddables?: Partial<Record<Region, string[]>>;
|
|
90
92
|
[PLUGIN_NAME]: {
|
|
91
93
|
rootDir: string;
|
|
92
94
|
templatesDir: string;
|
|
@@ -100,6 +102,7 @@ export type ResolvedEmbeddableConfig = {
|
|
|
100
102
|
export declare const embeddableConfigSchema: z.ZodObject<{
|
|
101
103
|
plugins: z.ZodArray<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>, "many">;
|
|
102
104
|
region: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"EU">, z.ZodLiteral<"US">, z.ZodLiteral<"legacy-US">]>>;
|
|
105
|
+
starterEmbeddables: z.ZodOptional<z.ZodRecord<z.ZodEnum<["EU", "US", "legacy-US"]>, z.ZodArray<z.ZodString, "many">>>;
|
|
103
106
|
pushModels: z.ZodOptional<z.ZodBoolean>;
|
|
104
107
|
pushComponents: z.ZodOptional<z.ZodBoolean>;
|
|
105
108
|
pushBaseUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -150,6 +153,7 @@ export declare const embeddableConfigSchema: z.ZodObject<{
|
|
|
150
153
|
}, "strict", z.ZodTypeAny, {
|
|
151
154
|
plugins: ((...args: unknown[]) => unknown)[];
|
|
152
155
|
region?: "EU" | "US" | "legacy-US" | undefined;
|
|
156
|
+
starterEmbeddables?: Partial<Record<"EU" | "US" | "legacy-US", string[]>> | undefined;
|
|
153
157
|
pushModels?: boolean | undefined;
|
|
154
158
|
pushComponents?: boolean | undefined;
|
|
155
159
|
pushBaseUrl?: string | undefined;
|
|
@@ -180,6 +184,7 @@ export declare const embeddableConfigSchema: z.ZodObject<{
|
|
|
180
184
|
}, {
|
|
181
185
|
plugins: ((...args: unknown[]) => unknown)[];
|
|
182
186
|
region?: "EU" | "US" | "legacy-US" | undefined;
|
|
187
|
+
starterEmbeddables?: Partial<Record<"EU" | "US" | "legacy-US", string[]>> | undefined;
|
|
183
188
|
pushModels?: boolean | undefined;
|
|
184
189
|
pushComponents?: boolean | undefined;
|
|
185
190
|
pushBaseUrl?: string | undefined;
|
|
@@ -248,6 +253,7 @@ declare const _default: (config: EmbeddableConfig) => {
|
|
|
248
253
|
sys: undefined;
|
|
249
254
|
};
|
|
250
255
|
region: Region;
|
|
256
|
+
starterEmbeddables: Partial<Record<Region, string[]>> | undefined;
|
|
251
257
|
pushModels: boolean;
|
|
252
258
|
pushComponents: boolean;
|
|
253
259
|
pushBaseUrl: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -22043,14 +22043,20 @@ async function sendBuildByApiKey(ctx, { apiKey, email, message, cubeVersion, })
|
|
|
22043
22043
|
return { ...response.data, message, cubeVersion };
|
|
22044
22044
|
}
|
|
22045
22045
|
async function sendBuild(ctx, { workspaceId, token, message, cubeVersion, }) {
|
|
22046
|
+
var _a;
|
|
22046
22047
|
const form = await createFormData(ctx.client.archiveFile, {
|
|
22047
22048
|
pushModels: ctx.pushModels,
|
|
22048
22049
|
pushComponents: ctx.pushComponents,
|
|
22050
|
+
starterEmbeddableIds: (_a = ctx.starterEmbeddables) === null || _a === void 0 ? void 0 : _a[ctx.region],
|
|
22049
22051
|
authorEmail: "",
|
|
22050
22052
|
description: message,
|
|
22051
22053
|
...(cubeVersion ? { cubeVersion } : {}),
|
|
22052
22054
|
});
|
|
22053
|
-
await uploadFile(form, `${ctx.pushBaseUrl}/bundle/${workspaceId}/upload`, token);
|
|
22055
|
+
const response = await uploadFile(form, `${ctx.pushBaseUrl}/bundle/${workspaceId}/upload`, token);
|
|
22056
|
+
const warnings = response.data.warnings || [];
|
|
22057
|
+
if (warnings.length > 0) {
|
|
22058
|
+
console.warn(warnings.join("\n"));
|
|
22059
|
+
}
|
|
22054
22060
|
await fs.rm(ctx.client.archiveFile);
|
|
22055
22061
|
}
|
|
22056
22062
|
async function uploadFile(formData, url, token) {
|
|
@@ -22495,6 +22501,7 @@ const embeddableConfigSchema = z
|
|
|
22495
22501
|
region: z
|
|
22496
22502
|
.union([z.literal("EU"), z.literal("US"), z.literal("legacy-US")])
|
|
22497
22503
|
.optional(),
|
|
22504
|
+
starterEmbeddables: z.record(z.enum(["EU", "US", "legacy-US"]), z.array(z.string().uuid())).optional(),
|
|
22498
22505
|
pushModels: z.boolean().optional(),
|
|
22499
22506
|
pushComponents: z.boolean().optional(),
|
|
22500
22507
|
pushBaseUrl: z.string().optional(),
|
|
@@ -22537,7 +22544,7 @@ var defineConfig = (config) => {
|
|
|
22537
22544
|
if (errors.length > 0) {
|
|
22538
22545
|
throw new Error(`Invalid Embeddable Configuration: ${errors.join("\n")}}`);
|
|
22539
22546
|
}
|
|
22540
|
-
let { plugins, region = "legacy-US", pushModels = true, 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;
|
|
22547
|
+
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;
|
|
22541
22548
|
const regionConfig = REGION_CONFIGS[region];
|
|
22542
22549
|
const __dirname = import.meta.dirname;
|
|
22543
22550
|
const coreRoot = path$1.resolve(__dirname, "..");
|
|
@@ -22598,6 +22605,7 @@ var defineConfig = (config) => {
|
|
|
22598
22605
|
sys: undefined,
|
|
22599
22606
|
},
|
|
22600
22607
|
region,
|
|
22608
|
+
starterEmbeddables,
|
|
22601
22609
|
pushModels,
|
|
22602
22610
|
pushComponents,
|
|
22603
22611
|
pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== void 0 ? pushBaseUrl : regionConfig.pushBaseUrl,
|