@embeddable.com/sdk-core 2.4.20 → 2.4.22
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/templates/style.css.template +1 -0
package/lib/index.esm.js
CHANGED
|
@@ -340,11 +340,11 @@ const EMB_TYPE_FILE_REGEX = /^(.*)\.type\.emb\.[jt]s$/;
|
|
|
340
340
|
const EMB_OPTIONS_FILE_REGEX = /^(.*)\.options\.emb\.[jt]s$/;
|
|
341
341
|
var buildTypes = async (ctx) => {
|
|
342
342
|
const ora = (await oraP$4).default;
|
|
343
|
-
const progress = ora("
|
|
343
|
+
const progress = ora("Building types...").start();
|
|
344
344
|
await generate$1(ctx);
|
|
345
345
|
await build$1(ctx);
|
|
346
346
|
await cleanup$1(ctx);
|
|
347
|
-
progress.succeed("
|
|
347
|
+
progress.succeed("Types built completed");
|
|
348
348
|
};
|
|
349
349
|
async function generate$1(ctx) {
|
|
350
350
|
const typeFiles = await findFiles(ctx.client.srcDir, EMB_TYPE_FILE_REGEX);
|
|
@@ -4508,7 +4508,7 @@ const checkNodeVersion$1 = () => {
|
|
|
4508
4508
|
var validate = async (ctx, exitIfInvalid = true) => {
|
|
4509
4509
|
checkNodeVersion$1();
|
|
4510
4510
|
const ora = (await import('ora')).default;
|
|
4511
|
-
const spinnerValidate = ora("
|
|
4511
|
+
const spinnerValidate = ora("Data model validation...").start();
|
|
4512
4512
|
const filesList = await findFiles(ctx.client.srcDir, CUBE_YAML_FILE_REGEX);
|
|
4513
4513
|
const securityContextFilesList = await findFiles(ctx.client.srcDir, SECURITY_CONTEXT_FILE_REGEX);
|
|
4514
4514
|
const dataModelErrors = await dataModelsValidation(filesList);
|
|
@@ -4519,7 +4519,7 @@ var validate = async (ctx, exitIfInvalid = true) => {
|
|
|
4519
4519
|
process.exit(1);
|
|
4520
4520
|
}
|
|
4521
4521
|
}
|
|
4522
|
-
spinnerValidate.succeed("
|
|
4522
|
+
spinnerValidate.succeed("Data model validation completed");
|
|
4523
4523
|
const securityContextErrors = await securityContextValidation(securityContextFilesList);
|
|
4524
4524
|
if (securityContextErrors.length) {
|
|
4525
4525
|
spinnerValidate.fail("One or more security context files are invalid:");
|
|
@@ -4546,9 +4546,18 @@ async function dataModelsValidation(filesList) {
|
|
|
4546
4546
|
}
|
|
4547
4547
|
async function securityContextValidation(filesList) {
|
|
4548
4548
|
const errors = [];
|
|
4549
|
+
const nameSet = new Set();
|
|
4549
4550
|
for (const [_, filePath] of filesList) {
|
|
4550
4551
|
const fileContentRaw = await fs$1.readFile(filePath, "utf8");
|
|
4551
4552
|
const cube = YAML.parse(fileContentRaw);
|
|
4553
|
+
cube.forEach((item) => {
|
|
4554
|
+
if (nameSet.has(item.name)) {
|
|
4555
|
+
errors.push(`${filePath}: security context with name "${item.name}" already exists`);
|
|
4556
|
+
}
|
|
4557
|
+
else {
|
|
4558
|
+
nameSet.add(item.name);
|
|
4559
|
+
}
|
|
4560
|
+
});
|
|
4552
4561
|
const safeParse = securityContextSchema.safeParse(cube);
|
|
4553
4562
|
if (!safeParse.success) {
|
|
4554
4563
|
errorFormatter(safeParse.error.issues).forEach((error) => {
|
|
@@ -19920,7 +19929,7 @@ const oraP$3 = import('ora');
|
|
|
19920
19929
|
let ora$2;
|
|
19921
19930
|
const checkNodeVersion = async () => {
|
|
19922
19931
|
ora$2 = (await oraP$3).default;
|
|
19923
|
-
ora$2("
|
|
19932
|
+
ora$2("Checking node version...");
|
|
19924
19933
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
19925
19934
|
const engines = require("../package.json").engines.node;
|
|
19926
19935
|
const [minMajor, minMinor] = engines
|
|
@@ -19965,7 +19974,7 @@ const openP = import('open');
|
|
|
19965
19974
|
var login = async () => {
|
|
19966
19975
|
var _a;
|
|
19967
19976
|
const ora = (await oraP$2).default;
|
|
19968
|
-
const authenticationSpinner = ora("
|
|
19977
|
+
const authenticationSpinner = ora("Waiting for code verification...").start();
|
|
19969
19978
|
try {
|
|
19970
19979
|
const open = (await openP).default;
|
|
19971
19980
|
const config = await provideConfig();
|
|
@@ -19989,12 +19998,12 @@ var login = async () => {
|
|
|
19989
19998
|
try {
|
|
19990
19999
|
const tokenResponse = await axios.post(`https://${config.authDomain}/oauth/token`, tokenPayload);
|
|
19991
20000
|
await fs$1.writeFile(CREDENTIALS_FILE, JSON.stringify(tokenResponse.data));
|
|
19992
|
-
authenticationSpinner.succeed("
|
|
20001
|
+
authenticationSpinner.succeed("You are successfully authenticated now!");
|
|
19993
20002
|
break;
|
|
19994
20003
|
}
|
|
19995
20004
|
catch (e) {
|
|
19996
20005
|
if (((_a = e.response.data) === null || _a === void 0 ? void 0 : _a.error) !== "authorization_pending") {
|
|
19997
|
-
authenticationSpinner.fail("
|
|
20006
|
+
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
19998
20007
|
process.exit(1);
|
|
19999
20008
|
}
|
|
20000
20009
|
await sleep(deviceCodeResponse.data["interval"] * 1000);
|
|
@@ -20002,7 +20011,7 @@ var login = async () => {
|
|
|
20002
20011
|
}
|
|
20003
20012
|
}
|
|
20004
20013
|
catch (error) {
|
|
20005
|
-
authenticationSpinner.fail("
|
|
20014
|
+
authenticationSpinner.fail("Authentication failed. Please try again.");
|
|
20006
20015
|
await reportErrorToRollbar(error);
|
|
20007
20016
|
console.log(error);
|
|
20008
20017
|
process.exit(1);
|
|
@@ -20049,13 +20058,13 @@ var push = async () => {
|
|
|
20049
20058
|
const config = await provideConfig();
|
|
20050
20059
|
const token = await verify(config);
|
|
20051
20060
|
const { workspaceId, name: workspaceName } = await selectWorkspace(config, token);
|
|
20052
|
-
const spinnerArchive = ora$1("
|
|
20061
|
+
const spinnerArchive = ora$1("Building...").start();
|
|
20053
20062
|
const filesList = await findFiles(config.client.srcDir, YAML_OR_JS_FILES);
|
|
20054
20063
|
await archive(config, filesList);
|
|
20055
|
-
spinnerArchive.succeed("
|
|
20056
|
-
const spinnerPushing = ora$1(`
|
|
20064
|
+
spinnerArchive.succeed("Bundling competed");
|
|
20065
|
+
const spinnerPushing = ora$1(`Publishing to ${workspaceName} using ${config.pushBaseUrl}...`).start();
|
|
20057
20066
|
await sendBuild(config, { workspaceId, token });
|
|
20058
|
-
spinnerPushing.succeed(`
|
|
20067
|
+
spinnerPushing.succeed(`Published to ${workspaceName} using ${config.pushBaseUrl}`);
|
|
20059
20068
|
}
|
|
20060
20069
|
catch (error) {
|
|
20061
20070
|
console.log(error);
|
|
@@ -20279,11 +20288,11 @@ const sendDataModels = async (ctx) => {
|
|
|
20279
20288
|
const isValid = await validate(ctx, false);
|
|
20280
20289
|
if (isValid) {
|
|
20281
20290
|
const token = await getToken();
|
|
20282
|
-
const sending = ora("
|
|
20291
|
+
const sending = ora("Synchronising data models...").start();
|
|
20283
20292
|
const filesList = await findFiles(ctx.client.srcDir, YAML_OR_JS_FILES);
|
|
20284
20293
|
await archive(ctx, filesList, false);
|
|
20285
20294
|
await sendBuild(ctx, { workspaceId: previewWorkspace, token });
|
|
20286
|
-
sending.succeed(`
|
|
20295
|
+
sending.succeed(`Data models synchronized`);
|
|
20287
20296
|
sendMessage("dataModelsUpdateSuccess");
|
|
20288
20297
|
}
|
|
20289
20298
|
else {
|