@constructor-io/constructorio-connect-cli 1.9.0 → 1.9.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/boilerplate-repo/package.json +6 -6
- package/boilerplate-repo/src/templates/item/item.jsonata +2 -1
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +0 -2
- package/dist/helpers/ux-action.d.ts.map +1 -1
- package/dist/helpers/ux-action.js +2 -2
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +9 -2
- package/dist/rendering/render-template-result.js +1 -1
- package/dist/rendering/render-tip.d.ts +6 -1
- package/dist/rendering/render-tip.d.ts.map +1 -1
- package/dist/rendering/render-tip.js +11 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
"description": "🔧 Repository to interface with the Constructor Connect ecosystem.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "TZ=UTC node --trace-warnings node_modules/.bin/jest --runInBand --config=jest.config.js",
|
|
7
|
-
"lint": "eslint",
|
|
8
|
-
"lint:fix": "eslint --fix",
|
|
7
|
+
"lint": "eslint .",
|
|
8
|
+
"lint:fix": "eslint . --fix",
|
|
9
9
|
"execute": "constructorio-connect-cli execute",
|
|
10
10
|
"deploy": "constructorio-connect-cli deploy",
|
|
11
11
|
"generate-fixture": "constructorio-connect-cli generate-fixture",
|
|
12
12
|
"trigger-catalog-sync": "constructorio-connect-cli trigger-catalog-sync"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@babel/preset-env": "^7.
|
|
16
|
-
"@stylistic/eslint-plugin-js": "^2.
|
|
17
|
-
"@types/jest": "^29.5.
|
|
18
|
-
"eslint": "^
|
|
15
|
+
"@babel/preset-env": "^7.26.7",
|
|
16
|
+
"@stylistic/eslint-plugin-js": "^2.13.0",
|
|
17
|
+
"@types/jest": "^29.5.14",
|
|
18
|
+
"eslint": "^9.19.0",
|
|
19
19
|
"jest": "^29.7.0"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;AA6B7C,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;YA+BZ,UAAU;YAsBV,oBAAoB;YA+CpB,qBAAqB;YA0BrB,wBAAwB;CAevC"}
|
package/dist/commands/execute.js
CHANGED
|
@@ -55,7 +55,6 @@ class Execute extends core_1.Command {
|
|
|
55
55
|
const config = await (0, ux_action_1.uxAction)("📡 Reading your config", async () => {
|
|
56
56
|
return await (0, config_1.getRepositoryConfigFile)();
|
|
57
57
|
})();
|
|
58
|
-
core_1.ux.log("\n");
|
|
59
58
|
result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
|
|
60
59
|
template: (0, file_loaders_1.getJSONataTemplate)(templateInput.templatePath).toString(),
|
|
61
60
|
helpers: (await (0, template_source_code_1.getHelpersSourceCode)(config.helpers)) ?? "",
|
|
@@ -65,7 +64,6 @@ class Execute extends core_1.Command {
|
|
|
65
64
|
: {},
|
|
66
65
|
connectionId: templateInput.connectionId,
|
|
67
66
|
});
|
|
68
|
-
core_1.ux.log("\n");
|
|
69
67
|
(0, render_template_result_1.renderTemplateResult)(result);
|
|
70
68
|
if (!result?.success) {
|
|
71
69
|
this.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ux-action.d.ts","sourceRoot":"","sources":["../../src/helpers/ux-action.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,aAEmB,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ux-action.d.ts","sourceRoot":"","sources":["../../src/helpers/ux-action.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,aAEmB,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,CA0BxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AA6B5C;;GAEG;AACH,wBAAsB,aAAa,iCAwDlC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,WAK7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,cAcjE"}
|
package/dist/http/http-client.js
CHANGED
|
@@ -43,6 +43,7 @@ const errors_1 = require("@oclif/core/lib/errors");
|
|
|
43
43
|
const axios_1 = __importStar(require("axios"));
|
|
44
44
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
45
45
|
const get_connect_token_1 = require("../customer/get-connect-token");
|
|
46
|
+
const render_tip_1 = require("../rendering/render-tip");
|
|
46
47
|
const version_1 = __importDefault(require("../version"));
|
|
47
48
|
const RETRY_IGNORED_HTTP_STATUS_CODES = [
|
|
48
49
|
/**
|
|
@@ -61,6 +62,7 @@ const RETRY_IGNORED_HTTP_STATUS_CODES = [
|
|
|
61
62
|
*/
|
|
62
63
|
403,
|
|
63
64
|
];
|
|
65
|
+
const MAX_RETRIES = 3;
|
|
64
66
|
/**
|
|
65
67
|
* @returns An axios instance with the correct base URL and auth token.
|
|
66
68
|
*/
|
|
@@ -75,7 +77,7 @@ async function getHttpClient() {
|
|
|
75
77
|
},
|
|
76
78
|
});
|
|
77
79
|
(0, axios_retry_1.default)(instance, {
|
|
78
|
-
retries:
|
|
80
|
+
retries: MAX_RETRIES,
|
|
79
81
|
/**
|
|
80
82
|
* Avoid retrying requests that failed because of an authentication error.
|
|
81
83
|
*/
|
|
@@ -120,6 +122,11 @@ function checkRetryCondition(error) {
|
|
|
120
122
|
*/
|
|
121
123
|
function calculateRetryDelay(retryCount, error) {
|
|
122
124
|
const retryAfterMs = error?.response?.status === 429 ? 2000 : 500;
|
|
123
|
-
|
|
125
|
+
(0, render_tip_1.renderTip)([
|
|
126
|
+
`Retrying request after ${retryAfterMs}ms, currently on retry number ${retryCount}/${MAX_RETRIES}.`,
|
|
127
|
+
], {
|
|
128
|
+
breakFirstLine: true,
|
|
129
|
+
emoji: "🤔",
|
|
130
|
+
});
|
|
124
131
|
return retryAfterMs;
|
|
125
132
|
}
|
|
@@ -20,7 +20,7 @@ function isTemplateFailure(result) {
|
|
|
20
20
|
return !!result.error;
|
|
21
21
|
}
|
|
22
22
|
function renderTemplateSuccess(result) {
|
|
23
|
-
core_1.ux.log(kleur_1.default.bold(kleur_1.default.green("🏁 Template executed successfully! 🏁 ") + "⬇️ Result ⬇️") + `\n\n${(0, cli_highlight_1.default)((0, json_stringify_pretty_compact_1.default)(result.data), { language: "json" })}
|
|
23
|
+
core_1.ux.log(kleur_1.default.bold(kleur_1.default.green("🏁 Template executed successfully! 🏁 ") + "⬇️ Result ⬇️") + `\n\n${(0, cli_highlight_1.default)((0, json_stringify_pretty_compact_1.default)(result.data), { language: "json" })}`);
|
|
24
24
|
}
|
|
25
25
|
function renderTemplateError(result) {
|
|
26
26
|
core_1.ux.log(kleur_1.default.bold(kleur_1.default.red("💥 Error while executing your template: ") + "⬇️ Error ⬇️"));
|
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
* Prints a tip to the user to provide helpful information.
|
|
3
3
|
* It'll automatically insert the tip emoji (💡) and auto align the lines on the terminal.
|
|
4
4
|
*/
|
|
5
|
-
export declare function renderTip(lines: string[]): void;
|
|
5
|
+
export declare function renderTip(lines: string[], { breakFirstLine, emoji }?: Options): void;
|
|
6
|
+
interface Options {
|
|
7
|
+
emoji?: string;
|
|
8
|
+
breakFirstLine?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
6
11
|
//# sourceMappingURL=render-tip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-tip.d.ts","sourceRoot":"","sources":["../../src/rendering/render-tip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-tip.d.ts","sourceRoot":"","sources":["../../src/rendering/render-tip.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EAAE,EACf,EAAE,cAAsB,EAAE,KAAY,EAAE,GAAE,OAAY,QAavD;AAED,UAAU,OAAO;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -10,12 +10,20 @@ const kleur_1 = __importDefault(require("kleur"));
|
|
|
10
10
|
* New line character with the necessary spacing to align the text on the terminal.
|
|
11
11
|
*/
|
|
12
12
|
const NEW_LINE_WITH_SPACING = "\n ";
|
|
13
|
+
/**
|
|
14
|
+
* New line character with spacing to align on the terminal, when breaking the first line.
|
|
15
|
+
*/
|
|
16
|
+
const FIRST_LINE_WITH_SPACING = "\n ";
|
|
13
17
|
/**
|
|
14
18
|
* Prints a tip to the user to provide helpful information.
|
|
15
19
|
* It'll automatically insert the tip emoji (💡) and auto align the lines on the terminal.
|
|
16
20
|
*/
|
|
17
|
-
function renderTip(lines) {
|
|
18
|
-
lines[0] =
|
|
19
|
-
|
|
21
|
+
function renderTip(lines, { breakFirstLine = false, emoji = "💡" } = {}) {
|
|
22
|
+
lines[0] = `${emoji} ${lines[0]}`;
|
|
23
|
+
let message = "";
|
|
24
|
+
if (breakFirstLine) {
|
|
25
|
+
message += FIRST_LINE_WITH_SPACING;
|
|
26
|
+
}
|
|
27
|
+
message += lines.join(NEW_LINE_WITH_SPACING);
|
|
20
28
|
core_1.ux.log(kleur_1.default.gray(message));
|
|
21
29
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED