@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.
- package/dist/commands/generate-fixture.d.ts.map +1 -1
- package/dist/commands/generate-fixture.js +12 -6
- package/dist/commands/trigger-catalog-sync.js +2 -2
- package/dist/helpers/check-if-connection-needs-mapping.d.ts +8 -0
- package/dist/helpers/check-if-connection-needs-mapping.d.ts.map +1 -0
- package/dist/helpers/check-if-connection-needs-mapping.js +13 -0
- package/dist/prompt-data/select-connections.d.ts +1 -1
- package/dist/prompt-data/select-connections.d.ts.map +1 -1
- package/dist/prompt-data/select-connections.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"
|
|
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
|
|
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
|
|
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
|
|
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<
|
|
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,
|
|
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
|
-
|
|
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
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.12.
|
|
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.
|
|
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",
|