@constructor-io/constructorio-connect-cli 1.12.0 โ†’ 1.12.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,yBAAyB;IACpE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAIhB;IAEF,MAAM,CAAC,QAAQ,WAA4C;IAErD,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAkDhC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAU9C"}
1
+ {"version":3,"file":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,yBAAyB;IACpE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAIhB;IAEF,MAAM,CAAC,QAAQ,WAA4C;IAErD,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IA2DhC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAU9C"}
@@ -15,6 +15,7 @@ const render_prompt_1 = require("../prompt-data/render-prompt");
15
15
  const select_connections_1 = require("../prompt-data/select-connections");
16
16
  const render_tip_1 = require("../rendering/render-tip");
17
17
  const types_1 = require("../types");
18
+ const check_if_connection_needs_mapping_1 = require("../helpers/check-if-connection-needs-mapping");
18
19
  const refresh_connections_command_1 = require("./refresh-connections-command");
19
20
  class GenerateFixture extends refresh_connections_command_1.RefreshConnectionsCommand {
20
21
  static args = {};
@@ -25,13 +26,18 @@ Finally, if the file already exists you'll be prompted to overwrite it.
25
26
  `;
26
27
  static examples = ["$ <%= config.bin %> generate-fixture"];
27
28
  async runCommand() {
28
- const connectionId = await (0, select_connections_1.selectConnections)("Choose the connection to generate the fixture for");
29
+ const connection = await (0, select_connections_1.selectConnections)("Choose the connection to generate the fixture for");
30
+ const choices = Object.keys(types_1.CatalogFixtureType).map((catalogFixtureType) => ({
31
+ name: catalogFixtureType,
32
+ value: Object(types_1.CatalogFixtureType)[catalogFixtureType],
33
+ }));
34
+ if (!(0, check_if_connection_needs_mapping_1.checkIfConnectionNeedsMapping)(connection.partner)) {
35
+ const index = choices.findIndex((choice) => choice.value === "mapping");
36
+ choices.splice(index, 1);
37
+ }
29
38
  const type = await (0, render_prompt_1.renderPrompt)({
30
39
  promptMessage: "Choose the type of fixture you want to generate",
31
- choices: Object.keys(types_1.CatalogFixtureType).map((catalogFixtureType) => ({
32
- name: catalogFixtureType,
33
- value: Object(types_1.CatalogFixtureType)[catalogFixtureType],
34
- })),
40
+ choices,
35
41
  });
36
42
  const filename = await (0, prompts_1.input)({
37
43
  message: "Enter the filename",
@@ -55,7 +61,7 @@ Finally, if the file already exists you'll be prompted to overwrite it.
55
61
  try {
56
62
  await (0, ux_action_1.uxAction)("๐Ÿงถ Generating fixtures...", async () => {
57
63
  const response = await (0, get_fixture_1.getFixture)({
58
- connectionId,
64
+ connectionId: connection.id,
59
65
  type: type,
60
66
  });
61
67
  await (0, fs_extra_1.outputFile)(filepath, JSON.stringify(response.data, null, 2));
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,OAAO,EAAM,MAAM,aAAa,CAAC;AAyBhD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAA4D;IAE9E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA8BnB,UAAU;IAmBxB,OAAO,CAAC,oBAAoB;YAUd,UAAU;YAsBV,uBAAuB;WA6BvB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,4BAA4B,EAAE,OAAO,GACpC,IAAI;IAcP,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAWjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAuBlC,OAAO,CAAC,0BAA0B;CA4BnC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,OAAO,EAAM,MAAM,aAAa,CAAC;AA0BhD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAA4D;IAE9E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAyCnB,UAAU;IAmBxB,OAAO,CAAC,oBAAoB;YAUd,UAAU;YAsBV,uBAAuB;WA6BvB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,4BAA4B,EAAE,OAAO,GACpC,IAAI;IAcP,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAWjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAuBlC,OAAO,CAAC,0BAA0B;CA4BnC"}
@@ -49,6 +49,7 @@ const ux_action_1 = require("../helpers/ux-action");
49
49
  const get_connect_token_1 = require("../customer/get-connect-token");
50
50
  const render_tip_1 = require("../rendering/render-tip");
51
51
  const is_git_repo_initialized_1 = require("../helpers/is-git-repo-initialized");
52
+ const is_git_installed_1 = require("../helpers/is-git-installed");
52
53
  const BOILERPLATE_REPO_PATH = "../../boilerplate-repo";
53
54
  /**
54
55
  * This ensures that the path will be fixed in Windows, since we're using `path.join()` to build the path.
@@ -73,6 +74,11 @@ class Init extends core_1.Command {
73
74
  const { args } = await this.parse(Init);
74
75
  const repoPath = path.join(process.cwd(), args.name);
75
76
  core_1.ux.info([`๐Ÿ‘‹ Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`].join("\n"));
77
+ const hasGit = (0, is_git_installed_1.isGitInstalled)();
78
+ if (!hasGit) {
79
+ core_1.ux.log(kleur_1.default.red("โš ๏ธ Git is not installed"), kleur_1.default.bold("Please install Git and try again."), kleur_1.default.dim("\nYou can download it from:"), kleur_1.default.blue("https://git-scm.com/downloads"));
80
+ return;
81
+ }
76
82
  const connectAuthToken = await (0, get_connect_token_1.getConnectToken)(false);
77
83
  const newDirExists = fs_extra_1.default.existsSync(repoPath);
78
84
  if (!newDirExists) {
@@ -12,8 +12,8 @@ class TriggerCatalogSync extends refresh_connections_command_1.RefreshConnection
12
12
  The script will use the \`CONNECT_AUTH_TOKEN\` environment variable to authenticate with Constructor.`;
13
13
  static examples = ["$ <%= config.bin %>"];
14
14
  async runCommand() {
15
- const connectionId = await (0, select_connections_1.selectConnections)("Choose the connection to a trigger catalog sync");
16
- await (0, trigger_catalog_sync_1.triggerCatalogSync)({ connectionId });
15
+ const connection = await (0, select_connections_1.selectConnections)("Choose the connection to a trigger catalog sync");
16
+ await (0, trigger_catalog_sync_1.triggerCatalogSync)({ connectionId: connection.id });
17
17
  (0, render_tip_1.renderTip)(["๐Ÿš€ Catalog sync triggered successfully!"]);
18
18
  }
19
19
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns true if the connection needs mapping fixture type
3
+ * @param partner The connection partner
4
+ * @returns boolean
5
+ */
6
+ export declare const partnersThatNeedMapping: string[];
7
+ export declare function checkIfConnectionNeedsMapping(partner: string): boolean;
8
+ //# sourceMappingURL=check-if-connection-needs-mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-if-connection-needs-mapping.d.ts","sourceRoot":"","sources":["../../src/helpers/check-if-connection-needs-mapping.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB,UAA8B,CAAC;AAEnE,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Returns true if the connection needs mapping fixture type
4
+ * @param partner The connection partner
5
+ * @returns boolean
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.partnersThatNeedMapping = void 0;
9
+ exports.checkIfConnectionNeedsMapping = checkIfConnectionNeedsMapping;
10
+ exports.partnersThatNeedMapping = ["omni", "omni-bloomreach"];
11
+ function checkIfConnectionNeedsMapping(partner) {
12
+ return exports.partnersThatNeedMapping.includes(partner);
13
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Check if Git is installed
3
+ *
4
+ * This function attempts to run the 'git --version' command.
5
+ * It will return true if the command succeeds, indicating Git is installed.
6
+ * It will return false if the command fails for any reason (including Git not being in PATH,
7
+ * not installed, or any other error).
8
+ *
9
+ * This implementation works across different operating systems (Windows, macOS, Linux)
10
+ * as it simply relies on the command execution succeeding or failing.
11
+ *
12
+ * @returns true if Git is installed, false otherwise
13
+ */
14
+ export declare function isGitInstalled(): boolean;
15
+ //# sourceMappingURL=is-git-installed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-git-installed.d.ts","sourceRoot":"","sources":["../../src/helpers/is-git-installed.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGitInstalled = isGitInstalled;
4
+ const child_process_1 = require("child_process");
5
+ // const envWithoutGit = { ...process.env, PATH: "" }; // for manually triggering the error pass this in as the second argument to execSync
6
+ /**
7
+ * Check if Git is installed
8
+ *
9
+ * This function attempts to run the 'git --version' command.
10
+ * It will return true if the command succeeds, indicating Git is installed.
11
+ * It will return false if the command fails for any reason (including Git not being in PATH,
12
+ * not installed, or any other error).
13
+ *
14
+ * This implementation works across different operating systems (Windows, macOS, Linux)
15
+ * as it simply relies on the command execution succeeding or failing.
16
+ *
17
+ * @returns true if Git is installed, false otherwise
18
+ */
19
+ function isGitInstalled() {
20
+ try {
21
+ (0, child_process_1.execSync)("git --version");
22
+ return true;
23
+ }
24
+ catch (error) {
25
+ return false;
26
+ }
27
+ }
@@ -1,2 +1,2 @@
1
- export declare const selectConnections: (message?: string) => Promise<string>;
1
+ export declare const selectConnections: (message?: string) => Promise<import("../http/get-connections-request").ConnectionResponseDto>;
2
2
  //# sourceMappingURL=select-connections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-connections.d.ts","sourceRoot":"","sources":["../../src/prompt-data/select-connections.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,aACnB,MAAM,oBAqBhB,CAAC"}
1
+ {"version":3,"file":"select-connections.d.ts","sourceRoot":"","sources":["../../src/prompt-data/select-connections.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,aACnB,MAAM,6EA2BhB,CAAC"}
@@ -19,6 +19,8 @@ const selectConnections = async (message = "Choose the connection") => {
19
19
  value: connection.id,
20
20
  })),
21
21
  });
22
- return connectionId;
22
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23
+ const selectedConnection = connections.find((connection) => connection.id === connectionId);
24
+ return selectedConnection;
23
25
  };
24
26
  exports.selectConnections = selectConnections;
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.12.0";
1
+ declare const _default: "1.12.2";
2
2
  export default _default;
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.12.0';
3
+ exports.default = '1.12.2';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.0"
193
+ "version": "1.12.2"
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
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",
@@ -95,7 +95,7 @@
95
95
  "oclif": "^4.6.3",
96
96
  "prettier": "^3.2.5",
97
97
  "prettier-2": "npm:prettier@^2.8.8",
98
- "shx": "^0.3.4",
98
+ "shx": "^0.4.0",
99
99
  "stdout-stderr": "^0.1.13",
100
100
  "ts-jest": "^29.1.2",
101
101
  "ts-node": "^10.9.2",