@constructor-io/constructorio-connect-cli 1.12.0 โ†’ 1.12.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.
@@ -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));
@@ -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
+ }
@@ -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.1";
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.1';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.0"
193
+ "version": "1.12.1"
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.1",
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",