@embeddable.com/sdk-core 2.4.20 → 2.4.21
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 +24 -15
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +24 -15
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -366,11 +366,11 @@ const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
|
|
|
366
366
|
const EMB_OPTIONS_FILE_REGEX = /^(.*)\.options\.emb\.[jt]s$/;
|
|
367
367
|
var buildTypes = async (ctx) => {
|
|
368
368
|
const ora = (await oraP$4).default;
|
|
369
|
-
const progress = ora("
|
|
369
|
+
const progress = ora("Building types...").start();
|
|
370
370
|
await generate$1(ctx);
|
|
371
371
|
await build$1(ctx);
|
|
372
372
|
await cleanup$1(ctx);
|
|
373
|
-
progress.succeed("
|
|
373
|
+
progress.succeed("Types built completed");
|
|
374
374
|
};
|
|
375
375
|
async function generate$1(ctx) {
|
|
376
376
|
const typeFiles = await findFiles(ctx.client.srcDir, EMB_TYPE_FILE_REGEX);
|
|
@@ -4534,7 +4534,7 @@ const checkNodeVersion$1 = () => {
|
|
|
4534
4534
|
var validate = async (ctx, exitIfInvalid = true) => {
|
|
4535
4535
|
checkNodeVersion$1();
|
|
4536
4536
|
const ora = (await import('ora')).default;
|
|
4537
|
-
const spinnerValidate = ora("
|
|
4537
|
+
const spinnerValidate = ora("Data model validation...").start();
|
|
4538
4538
|
const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
|
|
4539
4539
|
const securityContextFilesList = await findFiles(ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4540
4540
|
const dataModelErrors = await dataModelsValidation(filesList);
|
|
@@ -4545,7 +4545,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
4545
4545
|
process.exit(1);
|
|
4546
4546
|
}
|
|
4547
4547
|
}
|
|
4548
|
-
spinnerValidate.succeed("
|
|
4548
|
+
spinnerValidate.succeed("Data model validation completed");
|
|
4549
4549
|
const securityContextErrors = await securityContextValidation(securityContextFilesList);
|
|
4550
4550
|
if (securityContextErrors.length) {
|
|
4551
4551
|
spinnerValidate.fail("One or more security context files are invalid:");
|
|
@@ -4572,9 +4572,18 @@ async function dataModelsValidation(filesList) {
|
|
|
4572
4572
|
}
|
|
4573
4573
|
async function securityContextValidation(filesList) {
|
|
4574
4574
|
const errors = [];
|
|
4575
|
+
const nameSet = new Set();
|
|
4575
4576
|
for (const [_, filePath] of filesList) {
|
|
4576
4577
|
const fileContentRaw = await fs__namespace.readFile(filePath, "utf8");
|
|
4577
4578
|
const cube = YAML__namespace.parse(fileContentRaw);
|
|
4579
|
+
cube.forEach((item) => {
|
|
4580
|
+
if (nameSet.has(item.name)) {
|
|
4581
|
+
errors.push(`${filePath}: security context with name "${item.name}" already exists`);
|
|
4582
|
+
}
|
|
4583
|
+
else {
|
|
4584
|
+
nameSet.add(item.name);
|
|
4585
|
+
}
|
|
4586
|
+
});
|
|
4578
4587
|
const safeParse = securityContextSchema.safeParse(cube);
|
|
4579
4588
|
if (!safeParse.success) {
|
|
4580
4589
|
errorFormatter(safeParse.error.issues).forEach((error) => {
|
|
@@ -19946,7 +19955,7 @@ const oraP$3 = import('ora');
|
|
|
19946
19955
|
let ora$2;
|
|
19947
19956
|
const checkNodeVersion = async () => {
|
|
19948
19957
|
ora$2 = (await oraP$3).default;
|
|
19949
|
-
ora$2("
|
|
19958
|
+
ora$2("Checking node version...");
|
|
19950
19959
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
19951
19960
|
const engines = require("../package.json").engines.node;
|
|
19952
19961
|
const [minMajor, minMinor] = engines
|
|
@@ -19991,7 +20000,7 @@ const openP = import('open');
|
|
|
19991
20000
|
var login = async () => {
|
|
19992
20001
|
var _a;
|
|
19993
20002
|
const ora = (await oraP$2).default;
|
|
19994
|
-
const authenticationSpinner = ora("
|
|
20003
|
+
const authenticationSpinner = ora("Waiting for code verification...").start();
|
|
19995
20004
|
try {
|
|
19996
20005
|
const open = (await openP).default;
|
|
19997
20006
|
const config = await provideConfig();
|
|
@@ -20015,12 +20024,12 @@ var login = async () => {
|
|
|
20015
20024
|
try {
|
|
20016
20025
|
const tokenResponse = await axios.post(`https://${config.authDomain}/oauth/token`, tokenPayload);
|
|
20017
20026
|
await fs__namespace.writeFile(CREDENTIALS_FILE, JSON.stringify(tokenResponse.data));
|
|
20018
|
-
authenticationSpinner.succeed("
|
|
20027
|
+
authenticationSpinner.succeed("You are successfully authenticated now!");
|
|
20019
20028
|
break;
|
|
20020
20029
|
}
|
|
20021
20030
|
catch (e) {
|
|
20022
20031
|
if (((_a = e.response.data) === null || _a === void 0 ? void 0 : _a.error) !== "authorization_pending") {
|
|
20023
|
-
authenticationSpinner.fail("
|
|
20032
|
+
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
20024
20033
|
process.exit(1);
|
|
20025
20034
|
}
|
|
20026
20035
|
await sleep(deviceCodeResponse.data["interval"] * 1000);
|
|
@@ -20028,7 +20037,7 @@ var login = async () => {
|
|
|
20028
20037
|
}
|
|
20029
20038
|
}
|
|
20030
20039
|
catch (error) {
|
|
20031
|
-
authenticationSpinner.fail("
|
|
20040
|
+
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
20032
20041
|
await reportErrorToRollbar(error);
|
|
20033
20042
|
console.log(error);
|
|
20034
20043
|
process.exit(1);
|
|
@@ -20075,13 +20084,13 @@ var push = async () => {
|
|
|
20075
20084
|
const config = await provideConfig();
|
|
20076
20085
|
const token = await verify(config);
|
|
20077
20086
|
const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
|
|
20078
|
-
const spinnerArchive = ora$1("
|
|
20087
|
+
const spinnerArchive = ora$1("Building...").start();
|
|
20079
20088
|
const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
|
|
20080
20089
|
await archive(config, filesList);
|
|
20081
|
-
spinnerArchive.succeed("
|
|
20082
|
-
const spinnerPushing = ora$1(`
|
|
20090
|
+
spinnerArchive.succeed("Bundling competed");
|
|
20091
|
+
const spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
|
|
20083
20092
|
await sendBuild(config, { workspaceId, token });
|
|
20084
|
-
spinnerPushing.succeed(`
|
|
20093
|
+
spinnerPushing.succeed(`Published to ${workspaceName} using ${config.pushBaseUrl}`);
|
|
20085
20094
|
}
|
|
20086
20095
|
catch (error) {
|
|
20087
20096
|
console.log(error);
|
|
@@ -20305,11 +20314,11 @@ const sendDataModels = async (ctx) => {
|
|
|
20305
20314
|
const isValid = await validate(ctx, false);
|
|
20306
20315
|
if (isValid) {
|
|
20307
20316
|
const token = await getToken();
|
|
20308
|
-
const sending = ora("
|
|
20317
|
+
const sending = ora("Synchronising data models...").start();
|
|
20309
20318
|
const filesList = await findFiles(ctx.client.srcDir, YAML_OR_JS_FILES);
|
|
20310
20319
|
await archive(ctx, filesList, false);
|
|
20311
20320
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
20312
|
-
sending.succeed(`
|
|
20321
|
+
sending.succeed(`Data models synchronized`);
|
|
20313
20322
|
sendMessage("dataModelsUpdateSuccess");
|
|
20314
20323
|
}
|
|
20315
20324
|
else {
|