@embeddable.com/sdk-core 3.14.1 → 3.14.2-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 +2 -0
- package/lib/index.esm.js +14 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/push.d.ts +4 -2
- package/package.json +1 -1
- package/src/defineConfig.test.ts +1 -0
- package/src/defineConfig.ts +2 -0
- package/src/push.test.ts +10 -3
- package/src/push.ts +15 -8
package/lib/defineConfig.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export type ResolvedEmbeddableConfig = {
|
|
|
85
85
|
logger: any;
|
|
86
86
|
sys: any;
|
|
87
87
|
};
|
|
88
|
+
region: Region;
|
|
88
89
|
[PLUGIN_NAME]: {
|
|
89
90
|
rootDir: string;
|
|
90
91
|
templatesDir: string;
|
|
@@ -244,6 +245,7 @@ declare const _default: (config: EmbeddableConfig) => {
|
|
|
244
245
|
logger: undefined;
|
|
245
246
|
sys: undefined;
|
|
246
247
|
};
|
|
248
|
+
region: Region;
|
|
247
249
|
pushModels: boolean;
|
|
248
250
|
pushComponents: boolean;
|
|
249
251
|
pushBaseUrl: string;
|
package/lib/index.esm.js
CHANGED
|
@@ -21876,6 +21876,7 @@ var push = async () => {
|
|
|
21876
21876
|
breadcrumbs.push("checkNodeVersion");
|
|
21877
21877
|
const isBuildSuccess = await checkBuildSuccess();
|
|
21878
21878
|
const config = await provideConfig();
|
|
21879
|
+
const cubeVersion = getArgumentByKey(["--cube-version"]);
|
|
21879
21880
|
if (!isBuildSuccess && config.pushComponents) {
|
|
21880
21881
|
console.error("Build failed or not completed. Please run `embeddable:build` first.");
|
|
21881
21882
|
process.exit(1);
|
|
@@ -21884,12 +21885,13 @@ var push = async () => {
|
|
|
21884
21885
|
spinnerPushing = ora("Using API key...").start();
|
|
21885
21886
|
breadcrumbs.push("push by api key");
|
|
21886
21887
|
try {
|
|
21887
|
-
await pushByApiKey(config, spinnerPushing);
|
|
21888
|
+
await pushByApiKey(config, spinnerPushing, cubeVersion);
|
|
21888
21889
|
}
|
|
21889
21890
|
catch (error) {
|
|
21890
21891
|
if (((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errorCode) === "BUILDER-998") {
|
|
21891
|
-
spinnerPushing.fail(`Authentication failure. Server responded with: "${(_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.errorMessage}".
|
|
21892
|
-
|
|
21892
|
+
spinnerPushing.fail(`Authentication failure. Server responded with: "${(_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.errorMessage}".
|
|
21893
|
+
Ensure that your API key is valid for the region specified in the embeddable.config.ts|js file.
|
|
21894
|
+
You are using the following region: ${config.region.replace("legacy-", "")} (${config.previewBaseUrl.replace("https://", "")} via ${config.pushBaseUrl})
|
|
21893
21895
|
Read more about deployment regions at https://docs.embeddable.com/deployment/deployment-regions`);
|
|
21894
21896
|
process.exit(1);
|
|
21895
21897
|
}
|
|
@@ -21914,7 +21916,7 @@ Read more about deployment regions at https://docs.embeddable.com/deployment/dep
|
|
|
21914
21916
|
await buildArchive(config);
|
|
21915
21917
|
spinnerPushing.info(`Publishing to ${workspaceName} using ${workspacePreviewUrl}...`);
|
|
21916
21918
|
breadcrumbs.push("send build");
|
|
21917
|
-
await sendBuild(config, { workspaceId, token, message });
|
|
21919
|
+
await sendBuild(config, { workspaceId, token, message, cubeVersion });
|
|
21918
21920
|
publishedSectionFeedback(config, spinnerPushing);
|
|
21919
21921
|
spinnerPushing.succeed(`Published to ${workspaceName} using ${workspacePreviewUrl}`);
|
|
21920
21922
|
}
|
|
@@ -21930,7 +21932,7 @@ const publishedSectionFeedback = (config, spinnerPushing) => {
|
|
|
21930
21932
|
config.pushModels && spinnerPushing.succeed("Models published");
|
|
21931
21933
|
config.pushComponents && spinnerPushing.succeed("Components published");
|
|
21932
21934
|
};
|
|
21933
|
-
async function pushByApiKey(config, spinner) {
|
|
21935
|
+
async function pushByApiKey(config, spinner, cubeVersion) {
|
|
21934
21936
|
const apiKey = getArgumentByKey(["--api-key", "-k"]);
|
|
21935
21937
|
if (!apiKey) {
|
|
21936
21938
|
spinner.fail("No API key provided");
|
|
@@ -21948,6 +21950,7 @@ async function pushByApiKey(config, spinner) {
|
|
|
21948
21950
|
apiKey,
|
|
21949
21951
|
email,
|
|
21950
21952
|
message,
|
|
21953
|
+
cubeVersion,
|
|
21951
21954
|
});
|
|
21952
21955
|
}
|
|
21953
21956
|
async function verify(ctx) {
|
|
@@ -22035,23 +22038,25 @@ async function createFormData(filePath, metadata) {
|
|
|
22035
22038
|
form.set("request", metadataBlob, "request.json");
|
|
22036
22039
|
return form;
|
|
22037
22040
|
}
|
|
22038
|
-
async function sendBuildByApiKey(ctx, { apiKey, email, message, }) {
|
|
22041
|
+
async function sendBuildByApiKey(ctx, { apiKey, email, message, cubeVersion, }) {
|
|
22039
22042
|
const form = await createFormData(ctx.client.archiveFile, {
|
|
22040
22043
|
pushModels: ctx.pushModels,
|
|
22041
22044
|
pushComponents: ctx.pushComponents,
|
|
22042
22045
|
authorEmail: email,
|
|
22043
22046
|
description: message,
|
|
22047
|
+
...(cubeVersion ? { cubeVersion } : {}),
|
|
22044
22048
|
});
|
|
22045
22049
|
const response = await uploadFile(form, `${ctx.pushBaseUrl}/api/v1/bundle/upload`, apiKey);
|
|
22046
22050
|
await fs.rm(ctx.client.archiveFile);
|
|
22047
|
-
return { ...response.data, message };
|
|
22051
|
+
return { ...response.data, message, cubeVersion };
|
|
22048
22052
|
}
|
|
22049
|
-
async function sendBuild(ctx, { workspaceId, token, message, }) {
|
|
22053
|
+
async function sendBuild(ctx, { workspaceId, token, message, cubeVersion, }) {
|
|
22050
22054
|
const form = await createFormData(ctx.client.archiveFile, {
|
|
22051
22055
|
pushModels: ctx.pushModels,
|
|
22052
22056
|
pushComponents: ctx.pushComponents,
|
|
22053
22057
|
authorEmail: "",
|
|
22054
22058
|
description: message,
|
|
22059
|
+
...(cubeVersion ? { cubeVersion } : {}),
|
|
22055
22060
|
});
|
|
22056
22061
|
await uploadFile(form, `${ctx.pushBaseUrl}/bundle/${workspaceId}/upload`, token);
|
|
22057
22062
|
await fs.rm(ctx.client.archiveFile);
|
|
@@ -22557,6 +22562,7 @@ var defineConfig = (config) => {
|
|
|
22557
22562
|
logger: undefined,
|
|
22558
22563
|
sys: undefined,
|
|
22559
22564
|
},
|
|
22565
|
+
region,
|
|
22560
22566
|
pushModels,
|
|
22561
22567
|
pushComponents,
|
|
22562
22568
|
pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== void 0 ? pushBaseUrl : regionConfig.pushBaseUrl,
|