@constructor-io/constructorio-connect-cli 1.3.0 → 1.4.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/boilerplate-repo/.github/workflows/test.yml +33 -0
- package/boilerplate-repo/.vscode/settings.json +3 -0
- package/boilerplate-repo/README.md +31 -2
- package/boilerplate-repo/babel.config.json +10 -0
- package/boilerplate-repo/eslint.config.js +12 -0
- package/boilerplate-repo/jest.config.js +27 -0
- package/boilerplate-repo/package.json +8 -8
- package/boilerplate-repo/src/fixtures/item_group/item_group.json +1 -1
- package/boilerplate-repo/src/templates/item_group/item_group.jsonata +1 -2
- package/boilerplate-repo/test/global-setup.js +13 -0
- package/boilerplate-repo/test/setup-tests-after-env.js +16 -0
- package/boilerplate-repo/test/setup-tests.js +8 -0
- package/boilerplate-repo/test/templates/grouping/grouping.spec.mjs +26 -0
- package/boilerplate-repo/test/templates/item/item.spec.mjs +86 -0
- package/boilerplate-repo/test/templates/item_group/item_group.spec.mjs +23 -0
- package/boilerplate-repo/test/templates/mapping/mapping.spec.mjs +78 -0
- package/boilerplate-repo/test/templates/variation/variation.spec.mjs +37 -0
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +6 -4
- package/dist/commands/generate-fixture.js +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -1
- package/dist/customer/config.js +1 -2
- package/dist/customer/get-connect-token.d.ts.map +1 -1
- package/dist/customer/get-connect-token.js +2 -2
- package/dist/customer/path.js +4 -5
- package/dist/customer/template-source-code.d.ts +5 -0
- package/dist/customer/template-source-code.d.ts.map +1 -1
- package/dist/customer/template-source-code.js +7 -3
- package/dist/functions/build-fixture.d.ts +13 -0
- package/dist/functions/build-fixture.d.ts.map +1 -0
- package/dist/functions/build-fixture.js +21 -0
- package/dist/functions/execute-template.d.ts +22 -0
- package/dist/functions/execute-template.d.ts.map +1 -0
- package/dist/functions/execute-template.js +89 -0
- package/dist/helpers/build-config-file.d.ts.map +1 -1
- package/dist/helpers/build-config-file.js +9 -5
- package/dist/helpers/file-exists.js +1 -2
- package/dist/helpers/file-loaders.d.ts +0 -2
- package/dist/helpers/file-loaders.d.ts.map +1 -1
- package/dist/helpers/file-loaders.js +2 -2
- package/dist/helpers/find-deep-files.js +1 -2
- package/dist/helpers/generate-command-input.js +1 -2
- package/dist/helpers/is-git-repo-initialized.js +1 -2
- package/dist/helpers/ux-action.d.ts.map +1 -1
- package/dist/helpers/ux-action.js +1 -2
- package/dist/http/deploy-request.js +1 -2
- package/dist/http/get-connections-request.d.ts +4 -1
- package/dist/http/get-connections-request.d.ts.map +1 -1
- package/dist/http/get-connections-request.js +12 -6
- package/dist/http/get-fixture.js +1 -2
- package/dist/http/http-client.d.ts +8 -0
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +55 -2
- package/dist/http/send-template-execute-request.d.ts +12 -0
- package/dist/http/send-template-execute-request.d.ts.map +1 -0
- package/dist/http/send-template-execute-request.js +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/prompt-data/filter-connections-by-template.js +1 -2
- package/dist/prompt-data/get-candidate-fixtures.js +1 -2
- package/dist/prompt-data/get-external-data-files.js +1 -2
- package/dist/prompt-data/get-template-files.js +2 -2
- package/dist/prompt-data/render-prompt.js +1 -2
- package/dist/rendering/render-repeat-input.js +1 -2
- package/dist/rendering/render-template-result.js +1 -2
- package/dist/rendering/render-tip.js +1 -2
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +5 -3
- package/boilerplate-repo/.eslintrc.json +0 -11
- package/dist/http/execute-templates-request.d.ts +0 -10
- package/dist/http/execute-templates-request.d.ts.map +0 -1
- package/dist/http/execute-templates-request.js +0 -28
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getExternalDataFiles =
|
|
6
|
+
exports.getExternalDataFiles = getExternalDataFiles;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const find_deep_files_1 = require("../helpers/find-deep-files");
|
|
9
9
|
function getExternalDataFiles() {
|
|
@@ -25,4 +25,3 @@ function getExternalDataFiles() {
|
|
|
25
25
|
throw error;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
exports.getExternalDataFiles = getExternalDataFiles;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.templateTypes = void 0;
|
|
7
|
+
exports.getTemplateFiles = getTemplateFiles;
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const find_deep_files_1 = require("../helpers/find-deep-files");
|
|
9
10
|
exports.templateTypes = [
|
|
@@ -28,7 +29,6 @@ async function getTemplateFiles() {
|
|
|
28
29
|
value: file.replace("src/templates/", ""),
|
|
29
30
|
}));
|
|
30
31
|
}
|
|
31
|
-
exports.getTemplateFiles = getTemplateFiles;
|
|
32
32
|
/**
|
|
33
33
|
* @param typePath The full type path. E.g.
|
|
34
34
|
* - src/templates/item
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderPrompt =
|
|
3
|
+
exports.renderPrompt = renderPrompt;
|
|
4
4
|
const prompts_1 = require("@inquirer/prompts");
|
|
5
5
|
const errors_1 = require("@oclif/core/lib/errors");
|
|
6
6
|
async function renderPrompt({ choices, promptMessage, emptyMessage, }) {
|
|
@@ -13,4 +13,3 @@ async function renderPrompt({ choices, promptMessage, emptyMessage, }) {
|
|
|
13
13
|
return await (0, prompts_1.select)({ message: promptMessage, choices });
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
exports.renderPrompt = renderPrompt;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderRepeatInput =
|
|
6
|
+
exports.renderRepeatInput = renderRepeatInput;
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
9
|
const generate_command_input_1 = require("../helpers/generate-command-input");
|
|
@@ -22,4 +22,3 @@ function renderRepeatInput(command, inputFlags) {
|
|
|
22
22
|
core_1.ux.log(kleur_1.default.bold(`\nInput to replicate this command ⬇️\n`) +
|
|
23
23
|
kleur_1.default.magenta((0, generate_command_input_1.generateCommandInput)({ commandName: command.id ?? "", inputFlags })));
|
|
24
24
|
}
|
|
25
|
-
exports.renderRepeatInput = renderRepeatInput;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderTemplateResult =
|
|
6
|
+
exports.renderTemplateResult = renderTemplateResult;
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
9
|
const cli_highlight_1 = __importDefault(require("cli-highlight"));
|
|
@@ -16,7 +16,6 @@ function renderTemplateResult(result) {
|
|
|
16
16
|
}
|
|
17
17
|
renderTemplateSuccess(result);
|
|
18
18
|
}
|
|
19
|
-
exports.renderTemplateResult = renderTemplateResult;
|
|
20
19
|
function isTemplateFailure(result) {
|
|
21
20
|
return !!result.error;
|
|
22
21
|
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderTip =
|
|
6
|
+
exports.renderTip = renderTip;
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const kleur_1 = __importDefault(require("kleur"));
|
|
9
9
|
/**
|
|
@@ -19,4 +19,3 @@ function renderTip(lines) {
|
|
|
19
19
|
const message = lines.join(NEW_LINE_WITH_SPACING);
|
|
20
20
|
core_1.ux.log(kleur_1.default.gray(message));
|
|
21
21
|
}
|
|
22
|
-
exports.renderTip = renderTip;
|
package/dist/types.d.ts
CHANGED
|
@@ -15,11 +15,12 @@ export interface Config {
|
|
|
15
15
|
}>;
|
|
16
16
|
}>;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export interface PartialConnection {
|
|
19
19
|
id: string;
|
|
20
20
|
slug: string;
|
|
21
21
|
environment: string;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
|
+
export type ConnectionConfigDict = Record<string, PartialConnection>;
|
|
23
24
|
export type PromptChoices<T> = Array<{
|
|
24
25
|
name: string;
|
|
25
26
|
value: T;
|
|
@@ -32,6 +33,10 @@ interface TemplateError {
|
|
|
32
33
|
token?: string;
|
|
33
34
|
snippet?: string[];
|
|
34
35
|
}
|
|
36
|
+
export interface TemplateExecutionSuccessResponse {
|
|
37
|
+
success: true;
|
|
38
|
+
data: Record<string, any>;
|
|
39
|
+
}
|
|
35
40
|
export interface TemplateExecutionErrorResponse {
|
|
36
41
|
success: false;
|
|
37
42
|
error: TemplateError;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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AC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAErE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEjE,UAAU,aAAa;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;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-connect-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "CLI tool to enable users to interface with the Constructor Connect Ecosystem",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -65,15 +65,17 @@
|
|
|
65
65
|
"@oclif/core": "3.25.3",
|
|
66
66
|
"@oclif/plugin-help": "^6.0.21",
|
|
67
67
|
"axios": "^1.6.8",
|
|
68
|
+
"axios-retry": "^4.4.1",
|
|
68
69
|
"cli-highlight": "^2.1.11",
|
|
69
70
|
"dotenv": "^16.4.5",
|
|
70
71
|
"fs-extra": "^11.2.0",
|
|
71
72
|
"json-stringify-pretty-compact": "^3.0.0",
|
|
72
73
|
"kleur": "^4.1.5",
|
|
73
|
-
"
|
|
74
|
+
"remeda": "^2.5.0",
|
|
75
|
+
"replace-in-file": "^7.2.0"
|
|
74
76
|
},
|
|
75
77
|
"devDependencies": {
|
|
76
|
-
"@oclif/test": "^
|
|
78
|
+
"@oclif/test": "^4.0.5",
|
|
77
79
|
"@types/fs-extra": "^11.0.4",
|
|
78
80
|
"@types/jest": "^29.5.12",
|
|
79
81
|
"@types/mock-fs": "^4.13.4",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function executeTemplates({ template, helpers, targetData, externalData, connectionId, }: Args): Promise<any>;
|
|
2
|
-
interface Args {
|
|
3
|
-
template: string;
|
|
4
|
-
helpers: string;
|
|
5
|
-
targetData: any;
|
|
6
|
-
externalData: any;
|
|
7
|
-
connectionId: string;
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=execute-templates-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execute-templates-request.d.ts","sourceRoot":"","sources":["../../src/http/execute-templates-request.ts"],"names":[],"mappings":"AAOA,wBAAsB,gBAAgB,CAAC,EACrC,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,YAAY,GACb,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAuBrB;AAED,UAAU,IAAI;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,GAAG,CAAC;IAChB,YAAY,EAAE,GAAG,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeTemplates = void 0;
|
|
4
|
-
const axios_1 = require("axios");
|
|
5
|
-
const errors_1 = require("@oclif/core/lib/errors");
|
|
6
|
-
const ux_action_1 = require("../helpers/ux-action");
|
|
7
|
-
const http_client_1 = require("./http-client");
|
|
8
|
-
async function executeTemplates({ template, helpers, targetData, externalData, connectionId, }) {
|
|
9
|
-
const client = await (0, http_client_1.getHttpClient)();
|
|
10
|
-
try {
|
|
11
|
-
return await (0, ux_action_1.uxAction)("📟 Executing your template", async () => {
|
|
12
|
-
return (await client.patch("templates/standalone/execute", {
|
|
13
|
-
raw_template: template,
|
|
14
|
-
helpers,
|
|
15
|
-
target_data: targetData,
|
|
16
|
-
external_data: externalData,
|
|
17
|
-
connection_id: connectionId,
|
|
18
|
-
})).data;
|
|
19
|
-
})();
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
if ((0, axios_1.isAxiosError)(error) && error.response) {
|
|
23
|
-
throw new errors_1.CLIError(`Something went wrong while executing your template: ${JSON.stringify(error.response.data)}`);
|
|
24
|
-
}
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.executeTemplates = executeTemplates;
|