@constructor-io/constructorio-connect-cli 1.8.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/README.md CHANGED
@@ -38,6 +38,7 @@ With the new repository initialized, you can start developing your catalog integ
38
38
  * [`constructorio-connect-cli generate-fixture`](#constructorio-connect-cli-generate-fixture)
39
39
  * [`constructorio-connect-cli help [COMMAND]`](#constructorio-connect-cli-help-command)
40
40
  * [`constructorio-connect-cli init NAME`](#constructorio-connect-cli-init-name)
41
+ * [`constructorio-connect-cli trigger-catalog-sync`](#constructorio-connect-cli-trigger-catalog-sync)
41
42
 
42
43
  ## `constructorio-connect-cli deploy ENV`
43
44
 
@@ -165,6 +166,25 @@ EXAMPLES
165
166
  $ constructorio-connect-cli init new-repo-name
166
167
  ```
167
168
 
169
+
170
+ ## `constructorio-connect-cli trigger-catalog-sync`
171
+
172
+ Triggers a catalog sync for selected connection.
173
+
174
+ ```
175
+ USAGE
176
+ $ constructorio-connect-cli trigger-catalog-sync
177
+
178
+ DESCRIPTION
179
+
180
+ Triggers a catalog sync for selected connection.
181
+
182
+ The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.
183
+
184
+ EXAMPLES
185
+ $ constructorio-connect-cli
186
+ ```
187
+
168
188
  <!-- commandsstop -->
169
189
 
170
190
  ## Development
@@ -50,6 +50,7 @@ to create a .env file with the contents of .env.example and fill in the `CONNECT
50
50
  ## Associating Templates with Connections
51
51
 
52
52
  With that configured, visit the `connectrc.js` file. This is where you can describe the relationships between your templates and the connections you want to use them with. Any arbitrary list of connections (identified by their ID) can be connected with any of your template files. You can create as many of these relationships as you need, with the following restrictions:
53
+
53
54
  - A connection can only be associated with one set of templates.
54
55
  - The environment declared for each relationship must match the environment for all connections that belong to it (e.g. only development connections may be listed in a relationship configured with `environment: "development"`)
55
56
 
@@ -63,7 +64,6 @@ This file serves as an example of how the data would be passed to the connector
63
64
 
64
65
  In summary, this command is a crucial part of testing your templates on the Constructor Connect platform. It allows you to generate test data, customize it to your needs, and see how your templates will handle it.
65
66
 
66
-
67
67
  ## `npm run generate-fixture`
68
68
 
69
69
  ```
@@ -84,6 +84,23 @@ EXAMPLES
84
84
  $ constructorio-connect-cli generate-fixture
85
85
  ```
86
86
 
87
+ ## `npm run trigger-catalog-sync`
88
+
89
+ ```
90
+ USAGE
91
+ $ constructorio-connect-cli trigger-catalog-sync
92
+
93
+ DESCRIPTION
94
+
95
+ Triggers a catalog sync for selected connection.
96
+
97
+ The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.
98
+
99
+
100
+ EXAMPLES
101
+ $ constructorio-connect-cli trigger-catalog-sync
102
+ ```
103
+
87
104
  # Executing Templates
88
105
 
89
106
  Once you have written some templates and you would like to quickly test their output, you can use the `execute` command. This command will allow you to see the result of executing your template against a specific fixture of JSON catalog data.
@@ -502,6 +519,7 @@ using just one field called `prices`.
502
519
  }
503
520
  }
504
521
  ```
522
+
505
523
  </td>
506
524
 
507
525
  <td>
@@ -524,6 +542,7 @@ using just one field called `prices`.
524
542
  }
525
543
  }
526
544
  ```
545
+
527
546
  </td>
528
547
  </tr>
529
548
  </table>
@@ -4,17 +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
- "generate-fixture": "constructorio-connect-cli generate-fixture"
11
+ "generate-fixture": "constructorio-connect-cli generate-fixture",
12
+ "trigger-catalog-sync": "constructorio-connect-cli trigger-catalog-sync"
12
13
  },
13
14
  "devDependencies": {
14
- "@babel/preset-env": "^7.24.8",
15
- "@stylistic/eslint-plugin-js": "^2.4.0",
16
- "@types/jest": "^29.5.12",
17
- "eslint": "^8.47.0",
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",
18
19
  "jest": "^29.7.0"
19
20
  },
20
21
  "keywords": [],
@@ -2,4 +2,5 @@
2
2
  * This template allows you to customize your item data.
3
3
  * @see https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-template-types-transformation-templates#item-template
4
4
  */
5
- {}
5
+
6
+ {}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAM,MAAM,aAAa,CAAC;AA6BjD,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;YAiCZ,UAAU;YAsBV,oBAAoB;YA+CpB,qBAAqB;YA0BrB,wBAAwB;CAevC"}
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"}
@@ -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":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAM,MAAM,aAAa,CAAC;AAa1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAIhB;IAEF,MAAM,CAAC,QAAQ,WAA4C;IAErD,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IA6DzB,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":"AAEA,OAAO,EAAE,OAAO,EAAM,MAAM,aAAa,CAAC;AAa1C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAIhB;IAEF,MAAM,CAAC,QAAQ,WAA4C;IAErD,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAkDzB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAU9C"}
@@ -12,9 +12,9 @@ const render_tip_1 = require("../rendering/render-tip");
12
12
  const render_prompt_1 = require("../prompt-data/render-prompt");
13
13
  const types_1 = require("../types");
14
14
  const get_fixture_1 = require("../http/get-fixture");
15
- const get_connections_request_1 = require("../http/get-connections-request");
16
15
  const file_exists_1 = require("../helpers/file-exists");
17
16
  const path_2 = require("../customer/path");
17
+ const select_connections_1 = require("../prompt-data/select-connections");
18
18
  class GenerateFixture extends core_1.Command {
19
19
  static args = {};
20
20
  static description = `
@@ -24,16 +24,7 @@ Finally, if the file already exists you'll be prompted to overwrite it.
24
24
  `;
25
25
  static examples = ["$ <%= config.bin %> generate-fixture"];
26
26
  async run() {
27
- const connections = await (0, ux_action_1.uxAction)("📡 Reading your connections...", async () => {
28
- return await (0, get_connections_request_1.getConnections)({ showLogs: true });
29
- })();
30
- const connectionId = await (0, render_prompt_1.renderPrompt)({
31
- promptMessage: "Choose the connection to generate the fixture for",
32
- choices: connections.map((connection) => ({
33
- name: `[${connection.environment}] - ${connection.name} `,
34
- value: connection.id,
35
- })),
36
- });
27
+ const connectionId = await (0, select_connections_1.selectConnections)("Choose the connection to generate the fixture for");
37
28
  const type = await (0, render_prompt_1.renderPrompt)({
38
29
  promptMessage: "Choose the type of fixture you want to generate",
39
30
  choices: Object.keys(types_1.CatalogFixtureType).map((catalogFixtureType) => ({
@@ -0,0 +1,8 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class TriggerCatalogSync extends Command {
3
+ static args: {};
4
+ static description: string;
5
+ static examples: string[];
6
+ run(): Promise<any>;
7
+ }
8
+ //# sourceMappingURL=trigger-catalog-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-catalog-sync.d.ts","sourceRoot":"","sources":["../../src/commands/trigger-catalog-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMtC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IACrD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAGqF;IAEvG,MAAM,CAAC,QAAQ,WAA2B;IAEpC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAS1B"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const trigger_catalog_sync_1 = require("../http/trigger-catalog-sync");
5
+ const render_tip_1 = require("../rendering/render-tip");
6
+ const select_connections_1 = require("../prompt-data/select-connections");
7
+ class TriggerCatalogSync extends core_1.Command {
8
+ static args = {};
9
+ static description = `
10
+ Triggers a catalog sync for selected connection.
11
+
12
+ The script will use the \`CONNECT_AUTH_TOKEN\` environment variable to authenticate with Constructor.`;
13
+ static examples = ["$ <%= config.bin %>"];
14
+ async run() {
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 });
17
+ (0, render_tip_1.renderTip)(["🚀 Catalog sync triggered successfully!"]);
18
+ }
19
+ }
20
+ exports.default = TriggerCatalogSync;
@@ -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,CAwBxD"}
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,29 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uxAction = uxAction;
4
- const core_1 = require("@oclif/core");
4
+ const nanospinner_1 = require("nanospinner");
5
5
  function uxAction(title, func) {
6
6
  return function (...args) {
7
- core_1.ux.action.start(title);
7
+ const spinner = (0, nanospinner_1.createSpinner)(title).start();
8
8
  let result;
9
9
  try {
10
10
  result = func(...args);
11
11
  }
12
- catch (e) {
13
- core_1.ux.action.stop("❌");
14
- throw e;
12
+ catch (error) {
13
+ spinner.error({ text: title, mark: "❌" });
14
+ throw error;
15
15
  }
16
16
  if (result?.then) {
17
17
  result
18
18
  .then(() => {
19
- core_1.ux.action.stop("✅");
19
+ spinner.success({ text: title, mark: "✅" });
20
20
  })
21
21
  .catch(() => {
22
- core_1.ux.action.stop("❌");
22
+ spinner.error({ text: title, mark: "❌" });
23
23
  });
24
24
  }
25
25
  else {
26
- core_1.ux.action.stop("✅");
26
+ spinner.success({ text: title, mark: "✅" });
27
27
  }
28
28
  return result;
29
29
  };
@@ -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;AA0B5C;;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,cAQjE"}
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"}
@@ -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: 3,
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
- console.log(`🧐 Retrying request after ${retryAfterMs}ms. Currently on retry number ${retryCount}.`);
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
  }
@@ -0,0 +1,9 @@
1
+ export declare function triggerCatalogSync(args: TriggerCatalogSyncArgs): Promise<TriggerCatalogSyncResponseDto>;
2
+ interface TriggerCatalogSyncArgs {
3
+ connectionId: string;
4
+ }
5
+ export interface TriggerCatalogSyncResponseDto {
6
+ data: any;
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=trigger-catalog-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-catalog-sync.d.ts","sourceRoot":"","sources":["../../src/http/trigger-catalog-sync.ts"],"names":[],"mappings":"AAOA,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,6BAA6B,CAAC,CAkBxC;AAED,UAAU,sBAAsB;IAC9B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,GAAG,CAAC;CACX"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.triggerCatalogSync = triggerCatalogSync;
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 triggerCatalogSync(args) {
9
+ const client = await (0, http_client_1.getHttpClient)();
10
+ try {
11
+ const response = await (0, ux_action_1.uxAction)("📡 Triggering catalog sync", async () => {
12
+ return await client.post(`/connections/sync/${args.connectionId}`);
13
+ })();
14
+ return response.data;
15
+ }
16
+ catch (error) {
17
+ if ((0, axios_1.isAxiosError)(error) && error.response) {
18
+ throw new errors_1.CLIError("Something went wrong while triggering catalog sync: \n" +
19
+ error.response.data.message);
20
+ }
21
+ throw error;
22
+ }
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare const selectConnections: (message?: string) => Promise<string>;
2
+ //# sourceMappingURL=select-connections.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.selectConnections = void 0;
4
+ const get_connections_request_1 = require("../http/get-connections-request");
5
+ const ux_action_1 = require("../helpers/ux-action");
6
+ const get_connect_token_1 = require("../customer/get-connect-token");
7
+ const render_prompt_1 = require("../prompt-data/render-prompt");
8
+ const selectConnections = async (message = "Choose the connection") => {
9
+ const connections = await (0, ux_action_1.uxAction)("📡 Reading your connections...", async () => {
10
+ return await (0, get_connections_request_1.getConnections)({ showLogs: true });
11
+ })();
12
+ // Load the connect token to ensure we can authenticate with Constructor.
13
+ // We do this here because the terminal output gets weird when there is a prompt during a ux action.
14
+ await (0, get_connect_token_1.getConnectToken)();
15
+ const connectionId = await (0, render_prompt_1.renderPrompt)({
16
+ promptMessage: message,
17
+ choices: connections.map((connection) => ({
18
+ name: `[${connection.environment}] - ${connection.name}`,
19
+ value: connection.id,
20
+ })),
21
+ });
22
+ return connectionId;
23
+ };
24
+ exports.selectConnections = selectConnections;
@@ -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" })}\n`);
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":"AAQA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAMxC"}
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] = `💡 ${lines[0]}`;
19
- const message = lines.join(NEW_LINE_WITH_SPACING);
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
@@ -1,3 +1,3 @@
1
- declare const _default: "1.8.0";
1
+ declare const _default: "1.9.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.8.0';
3
+ exports.default = '1.9.1';
@@ -146,7 +146,30 @@
146
146
  "commands",
147
147
  "init.js"
148
148
  ]
149
+ },
150
+ "trigger-catalog-sync": {
151
+ "aliases": [],
152
+ "args": {},
153
+ "description": "\n Triggers a catalog sync for selected connection.\n\n The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.",
154
+ "examples": [
155
+ "$ <%= config.bin %>"
156
+ ],
157
+ "flags": {},
158
+ "hasDynamicHelp": false,
159
+ "hiddenAliases": [],
160
+ "id": "trigger-catalog-sync",
161
+ "pluginAlias": "@constructor-io/constructorio-connect-cli",
162
+ "pluginName": "@constructor-io/constructorio-connect-cli",
163
+ "pluginType": "core",
164
+ "strict": true,
165
+ "enableJsonFlag": false,
166
+ "isESM": false,
167
+ "relativePath": [
168
+ "dist",
169
+ "commands",
170
+ "trigger-catalog-sync.js"
171
+ ]
149
172
  }
150
173
  },
151
- "version": "1.8.0"
174
+ "version": "1.9.1"
152
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.8.0",
3
+ "version": "1.9.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",
@@ -71,6 +71,7 @@
71
71
  "fs-extra": "^11.2.0",
72
72
  "json-stringify-pretty-compact": "^3.0.0",
73
73
  "kleur": "^4.1.5",
74
+ "nanospinner": "^1.2.2",
74
75
  "remeda": "^2.5.0",
75
76
  "replace-in-file": "^7.2.0"
76
77
  },
@@ -89,7 +90,7 @@
89
90
  "jest": "^29.7.0",
90
91
  "license-checker": "^25.0.1",
91
92
  "mock-fs": "^5.2.0",
92
- "nock": "^13.5.4",
93
+ "nock": "^14.0.0",
93
94
  "oclif": "^4.6.3",
94
95
  "prettier": "^3.2.5",
95
96
  "prettier-2": "npm:prettier@^2.8.8",