@constructor-io/constructorio-connect-cli 1.9.2 → 1.10.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.
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +5 -2
- package/dist/functions/execute-template.d.ts.map +1 -1
- package/dist/functions/execute-template.js +4 -0
- package/dist/helpers/print-warnings.d.ts +3 -0
- package/dist/helpers/print-warnings.d.ts.map +1 -0
- package/dist/helpers/print-warnings.js +33 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;AA8B7C,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,qBAAa,OAAQ,SAAQ,OAAO;IAClC,MAAM,CAAC,KAAK;;;;;MAgBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC1B;;OAEG;IACH,OAAO,CAAC,eAAe;YAKT,UAAU;YAsBV,oBAAoB;YA+CpB,qBAAqB;YA0BrB,wBAAwB;CAevC"}
|
package/dist/commands/execute.js
CHANGED
|
@@ -21,6 +21,7 @@ const path_1 = require("../customer/path");
|
|
|
21
21
|
const config_1 = require("../customer/config");
|
|
22
22
|
const template_source_code_1 = require("../customer/template-source-code");
|
|
23
23
|
const ux_action_1 = require("../helpers/ux-action");
|
|
24
|
+
const print_warnings_1 = require("../helpers/print-warnings");
|
|
24
25
|
exports.executePromptMessages = {
|
|
25
26
|
template: "Select a template to execute",
|
|
26
27
|
fixture: "Select a catalog fixture to run the template against",
|
|
@@ -53,13 +54,12 @@ class Execute extends core_1.Command {
|
|
|
53
54
|
];
|
|
54
55
|
input = {};
|
|
55
56
|
async run() {
|
|
56
|
-
let result = null;
|
|
57
57
|
try {
|
|
58
58
|
const templateInput = await this.getTemplateExecInput();
|
|
59
59
|
const config = await (0, ux_action_1.uxAction)("📡 Reading your config", async () => {
|
|
60
60
|
return await (0, config_1.getRepositoryConfigFile)();
|
|
61
61
|
})();
|
|
62
|
-
result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
|
|
62
|
+
const result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
|
|
63
63
|
template: (0, file_loaders_1.getJSONataTemplate)(templateInput.templatePath).toString(),
|
|
64
64
|
helpers: (await (0, template_source_code_1.getHelpersSourceCode)(config.helpers)) ?? "",
|
|
65
65
|
targetData: (0, file_loaders_1.getCatalogFixture)(templateInput.fixturePath),
|
|
@@ -70,6 +70,9 @@ class Execute extends core_1.Command {
|
|
|
70
70
|
templateType: this.getTemplateType(templateInput.templatePath),
|
|
71
71
|
});
|
|
72
72
|
(0, render_template_result_1.renderTemplateResult)(result);
|
|
73
|
+
if (result.warnings.length > 0) {
|
|
74
|
+
(0, print_warnings_1.printExecutionWarnings)(result.warnings);
|
|
75
|
+
}
|
|
73
76
|
if (!result?.success) {
|
|
74
77
|
this.exit(1);
|
|
75
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,qEAMf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,gCAuBjE"}
|
|
@@ -12,6 +12,7 @@ const template_source_code_1 = require("../customer/template-source-code");
|
|
|
12
12
|
const file_loaders_1 = require("../helpers/file-loaders");
|
|
13
13
|
const config_1 = require("../customer/config");
|
|
14
14
|
const get_connections_request_1 = require("../http/get-connections-request");
|
|
15
|
+
const print_warnings_1 = require("../helpers/print-warnings");
|
|
15
16
|
exports.TYPE_OPTIONS = [
|
|
16
17
|
"item",
|
|
17
18
|
"variation",
|
|
@@ -47,6 +48,9 @@ async function executeTemplate(options) {
|
|
|
47
48
|
if (!result.success) {
|
|
48
49
|
throw new Error(`Error executing template: ${result.error.message}`);
|
|
49
50
|
}
|
|
51
|
+
if (result.warnings.length > 0) {
|
|
52
|
+
(0, print_warnings_1.printExecutionWarnings)(result.warnings);
|
|
53
|
+
}
|
|
50
54
|
return result.data;
|
|
51
55
|
}
|
|
52
56
|
function initializeOptions(options) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print-warnings.d.ts","sourceRoot":"","sources":["../../src/helpers/print-warnings.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,QA8B1E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.printExecutionWarnings = printExecutionWarnings;
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
const kleur_1 = __importDefault(require("kleur"));
|
|
9
|
+
function printExecutionWarnings(warnings) {
|
|
10
|
+
const originalLength = warnings.length;
|
|
11
|
+
if (warnings.length > 10) {
|
|
12
|
+
warnings = warnings.slice(0, 10);
|
|
13
|
+
}
|
|
14
|
+
core_1.ux.log();
|
|
15
|
+
core_1.ux.log(kleur_1.default.yellow(`⚠️ WARNINGS :`), kleur_1.default.yellow(`We found ${originalLength} warnings when validating your template!`), kleur_1.default.bold(kleur_1.default.yellow(`⬇️ Warnings ⬇️`)));
|
|
16
|
+
core_1.ux.log();
|
|
17
|
+
warnings.forEach((warning) => {
|
|
18
|
+
printSingleWarning(warning);
|
|
19
|
+
});
|
|
20
|
+
if (originalLength > 10) {
|
|
21
|
+
core_1.ux.log(`... and ${originalLength - 10} more`);
|
|
22
|
+
}
|
|
23
|
+
core_1.ux.log();
|
|
24
|
+
core_1.ux.log(kleur_1.default.bold(`See Documentation ➡️ :`), kleur_1.default.underline(`https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-template-types-transformation-templates`));
|
|
25
|
+
}
|
|
26
|
+
function printSingleWarning(warning) {
|
|
27
|
+
if (warning.critical) {
|
|
28
|
+
core_1.ux.log(kleur_1.default.red(`🚨 [${warning.type}]:`), warning.message);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
core_1.ux.log(kleur_1.default.yellow(`⚠️ [${warning.type}]:`), warning.message);
|
|
32
|
+
}
|
|
33
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -26,13 +26,20 @@ interface TemplateError {
|
|
|
26
26
|
token?: string;
|
|
27
27
|
snippet?: string[];
|
|
28
28
|
}
|
|
29
|
+
export interface TemplateValidatorWarning {
|
|
30
|
+
type: string;
|
|
31
|
+
critical: boolean;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
29
34
|
export interface TemplateExecutionSuccessResponse {
|
|
30
35
|
success: true;
|
|
31
36
|
data: Record<string, any>;
|
|
37
|
+
warnings: TemplateValidatorWarning[];
|
|
32
38
|
}
|
|
33
39
|
export interface TemplateExecutionErrorResponse {
|
|
34
40
|
success: false;
|
|
35
41
|
error: TemplateError;
|
|
42
|
+
warnings: TemplateValidatorWarning[];
|
|
36
43
|
}
|
|
37
44
|
export declare enum CatalogFixtureType {
|
|
38
45
|
ITEM = "item",
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7C,cAAc,EAAE,MAAM,EAAE,CAAC;SAC1B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,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IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,aAAa,qEAMhB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"wBAAe,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"wBAAe,QAAQ;AAAvB,wBAAwB"}
|
package/dist/version.js
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED