@constructor-io/constructorio-connect-cli 1.12.4 → 1.13.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.
Files changed (41) hide show
  1. package/bin/dev.js +1 -1
  2. package/boilerplate-repo/package.json +2 -2
  3. package/dist/commands/deploy.d.ts +1 -1
  4. package/dist/commands/deploy.d.ts.map +1 -1
  5. package/dist/commands/deploy.js +2 -2
  6. package/dist/commands/execute.d.ts +4 -4
  7. package/dist/commands/execute.js +5 -6
  8. package/dist/commands/generate-fixture.js +1 -1
  9. package/dist/commands/init.d.ts +1 -1
  10. package/dist/commands/init.d.ts.map +1 -1
  11. package/dist/commands/init.js +6 -6
  12. package/dist/customer/config.js +1 -1
  13. package/dist/customer/get-connect-token.d.ts.map +1 -1
  14. package/dist/customer/get-connect-token.js +8 -9
  15. package/dist/customer/template-source-code.js +1 -1
  16. package/dist/helpers/extract-template-type.js +1 -1
  17. package/dist/helpers/file-loaders.d.ts +1 -1
  18. package/dist/helpers/file-loaders.d.ts.map +1 -1
  19. package/dist/helpers/file-loaders.js +1 -1
  20. package/dist/helpers/print-warnings.js +8 -8
  21. package/dist/helpers/refresh-connections-list.js +3 -3
  22. package/dist/http/deploy-request.js +1 -1
  23. package/dist/http/get-connections-request.js +1 -1
  24. package/dist/http/get-fixture.js +1 -1
  25. package/dist/http/http-client.js +1 -1
  26. package/dist/http/obtain-token-request.js +1 -1
  27. package/dist/http/send-template-execute-request.js +1 -1
  28. package/dist/http/trigger-catalog-sync.js +1 -1
  29. package/dist/prompt-data/filter-connections-by-template.d.ts +2 -2
  30. package/dist/prompt-data/filter-connections-by-template.d.ts.map +1 -1
  31. package/dist/prompt-data/filter-connections-by-template.js +1 -6
  32. package/dist/prompt-data/get-candidate-fixtures.js +1 -1
  33. package/dist/prompt-data/render-prompt.js +1 -1
  34. package/dist/rendering/render-repeat-input.js +1 -1
  35. package/dist/rendering/render-template-result.d.ts.map +1 -1
  36. package/dist/rendering/render-template-result.js +11 -10
  37. package/dist/rendering/render-tip.js +1 -1
  38. package/dist/version.d.ts +1 -1
  39. package/dist/version.js +1 -1
  40. package/oclif.manifest.json +1 -1
  41. package/package.json +9 -8
package/bin/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env -S npx ts-node
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
2
 
3
3
  void (async () => {
4
4
  const { config } = await import("dotenv");
@@ -12,7 +12,7 @@
12
12
  "trigger-catalog-sync": "constructorio-connect-cli trigger-catalog-sync"
13
13
  },
14
14
  "devDependencies": {
15
- "@babel/preset-env": "^7.26.7",
15
+ "@babel/preset-env": "^7.26.9",
16
16
  "@stylistic/eslint-plugin-js": "^2.13.0",
17
17
  "@types/jest": "^29.5.14",
18
18
  "eslint": "^9.19.0",
@@ -21,4 +21,4 @@
21
21
  "keywords": [],
22
22
  "author": "",
23
23
  "license": "ISC"
24
- }
24
+ }
@@ -1,7 +1,7 @@
1
1
  import { RefreshConnectionsCommand } from "./refresh-connections-command";
2
2
  export default class Deploy extends RefreshConnectionsCommand {
3
3
  static args: {
4
- env: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
4
+ env: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,yBAAyB;IAC3D,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,WAAW,SAGqF;IAEvG,MAAM,CAAC,QAAQ,WAIb;IAEI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CAgDjC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,yBAAyB;IAC3D,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,WAAW,SAGqF;IAEvG,MAAM,CAAC,QAAQ,WAIb;IAEI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CAgDjC"}
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const core_1 = require("@oclif/core");
7
- const errors_1 = require("@oclif/core/lib/errors");
7
+ const errors_1 = require("@oclif/core/errors");
8
8
  const kleur_1 = __importDefault(require("kleur"));
9
9
  const config_1 = require("../customer/config");
10
10
  const get_connect_token_1 = require("../customer/get-connect-token");
@@ -55,7 +55,7 @@ class Deploy extends refresh_connections_command_1.RefreshConnectionsCommand {
55
55
  config,
56
56
  });
57
57
  })();
58
- core_1.ux.log(`\n${kleur_1.default.bold("🎉 Deploy completed!")}\n`);
58
+ this.log(`\n${kleur_1.default.bold("🎉 Deploy completed!")}\n`);
59
59
  (0, render_tip_1.renderTip)(["Future catalog ingestions will use the new templates."]);
60
60
  (0, render_tip_1.renderTip)([
61
61
  "Check the Constructor dashboard to see your latest ingestion results.",
@@ -17,10 +17,10 @@ interface ExecuteInputFlags {
17
17
  }
18
18
  export declare class Execute extends RefreshConnectionsCommand {
19
19
  static flags: {
20
- "template-path": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
- "fixture-path": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
- "external-data-path": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
23
- "connection-id": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ "template-path": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ "fixture-path": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ "external-data-path": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ "connection-id": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
24
  };
25
25
  static description: string;
26
26
  static examples: string[];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Execute = exports.executePromptMessages = void 0;
4
4
  const core_1 = require("@oclif/core");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const file_loaders_1 = require("../helpers/file-loaders");
7
7
  const get_connections_request_1 = require("../http/get-connections-request");
8
8
  const send_template_execute_request_1 = require("../http/send-template-execute-request");
@@ -150,11 +150,10 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
150
150
  }
151
151
  async getConnectionForTemplate(templatePath, allConnections) {
152
152
  const choices = await (0, filter_connections_by_template_1.filterConnectionsByTemplate)(templatePath, allConnections);
153
- return await (0, render_prompt_1.renderPrompt)({
154
- choices,
155
- promptMessage: exports.executePromptMessages.connection,
156
- emptyMessage: "No mapped connections found for this template",
157
- });
153
+ if (choices.length === 0) {
154
+ throw new errors_1.CLIError(`No mapped connections found for this template`);
155
+ }
156
+ return choices[0];
158
157
  }
159
158
  }
160
159
  exports.Execute = Execute;
@@ -66,7 +66,7 @@ Finally, if the file already exists you'll be prompted to overwrite it.
66
66
  });
67
67
  await (0, fs_extra_1.outputFile)(filepath, JSON.stringify(response.data, null, 2));
68
68
  })();
69
- core_1.ux.info(`🎉 ${type} fixture generated at ${filepath}`);
69
+ core_1.ux.stdout(`🎉 ${type} fixture generated at ${filepath}`);
70
70
  }
71
71
  catch (err) {
72
72
  core_1.ux.error(`🙈 ${err.message}`);
@@ -3,7 +3,7 @@ export default class Init extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
- name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
7
  };
8
8
  run(): Promise<void>;
9
9
  private createRepo;
@@ -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;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"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AA0B5C,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"}
@@ -73,10 +73,10 @@ class Init extends core_1.Command {
73
73
  async run() {
74
74
  const { args } = await this.parse(Init);
75
75
  const repoPath = path.join(process.cwd(), args.name);
76
- core_1.ux.info([`👋 Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`].join("\n"));
76
+ this.log([`👋 Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`].join("\n"));
77
77
  const hasGit = (0, is_git_installed_1.isGitInstalled)();
78
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"));
79
+ this.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
80
  return;
81
81
  }
82
82
  const connectAuthToken = await (0, get_connect_token_1.getConnectToken)(false);
@@ -103,7 +103,7 @@ class Init extends core_1.Command {
103
103
  this.initGitRepoAndCommit(args);
104
104
  }
105
105
  else {
106
- core_1.ux.log(`\n💡 Git repository already exists at this path, skipping initialization.`);
106
+ this.log(`\n💡 Git repository already exists at this path, skipping initialization.`);
107
107
  }
108
108
  this.printSuccessfulInitMessage(args.repoName);
109
109
  }
@@ -114,7 +114,7 @@ class Init extends core_1.Command {
114
114
  })();
115
115
  }
116
116
  async updateRepo(args) {
117
- core_1.ux.log(`\nYou are trying to initialize a new repo that already exists.`);
117
+ this.log(`\nYou are trying to initialize a new repo that already exists.`);
118
118
  const shouldRefresh = await (0, prompts_1.confirm)({
119
119
  message: "Do you want to regenerate the base repository files?",
120
120
  });
@@ -125,7 +125,7 @@ class Init extends core_1.Command {
125
125
  this.printSuccessfulInitMessage(args.repoName);
126
126
  return;
127
127
  }
128
- core_1.ux.log(`\n🙅 Constructor.io Connect CLI repository not updated! 🙅
128
+ this.log(`\n🙅 Constructor.io Connect CLI repository not updated! 🙅
129
129
  `);
130
130
  }
131
131
  async generateRepositoryFiles(args) {
@@ -182,7 +182,7 @@ class Init extends core_1.Command {
182
182
  (0, child_process_1.execSync)(`(cd ${repoPath} && npm run lint:fix)`);
183
183
  }
184
184
  printSuccessfulInitMessage(repoName) {
185
- core_1.ux.log(kleur_1.default.bold([
185
+ this.log(kleur_1.default.bold([
186
186
  "\n",
187
187
  `🎉 Constructor.io Connect CLI repository initialized at ./${repoName}! 🎉`,
188
188
  `\n`,
@@ -37,7 +37,7 @@ exports.getRepositoryConfigFile = getRepositoryConfigFile;
37
37
  exports.getRepositoryConnectionsAndConfig = getRepositoryConnectionsAndConfig;
38
38
  const fs = __importStar(require("fs/promises"));
39
39
  const core_1 = require("@oclif/core");
40
- const errors_1 = require("@oclif/core/lib/errors");
40
+ const errors_1 = require("@oclif/core/errors");
41
41
  const print_warnings_1 = require("../helpers/print-warnings");
42
42
  const path_1 = require("./path");
43
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"get-connect-token.d.ts","sourceRoot":"","sources":["../../src/customer/get-connect-token.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,KAIhC,UAAS,OAAc,KACtB,OAAO,CAAC,MAAM,CAAC,CAyCnB;AAED,eAAO,MAAM,eAAe,aA5Cf,OAAO,KACf,OAAO,CAAC,MAAM,CA2CkC,CAAC"}
1
+ {"version":3,"file":"get-connect-token.d.ts","sourceRoot":"","sources":["../../src/customer/get-connect-token.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,KAIhC,UAAS,OAAc,KACtB,OAAO,CAAC,MAAM,CAAC,CAwCnB;AAED,eAAO,MAAM,eAAe,aA3Cf,OAAO,KACf,OAAO,CAAC,MAAM,CA0CkC,CAAC"}
@@ -68,12 +68,11 @@ function getConnectTokenStore() {
68
68
  return connectToken;
69
69
  }
70
70
  renderAuthHelperText();
71
- core_1.ux.log();
72
- const apiKey = await core_1.ux.prompt("Enter your Index key 🔑", {
73
- type: "normal",
74
- });
75
- const apiToken = await core_1.ux.prompt("Enter your API token 🔐", {
76
- type: "mask",
71
+ core_1.ux.stdout();
72
+ const apiKey = await (0, prompts_1.input)({ message: "Enter your Index key 🔑" });
73
+ const apiToken = await (0, prompts_1.password)({
74
+ message: "Enter your API token 🔐",
75
+ mask: true,
77
76
  });
78
77
  connectToken = await (0, obtain_token_request_1.obtainToken)({
79
78
  api_key: apiKey,
@@ -86,18 +85,18 @@ function getConnectTokenStore() {
86
85
  if (saveToken) {
87
86
  fs.appendFileSync(".env", `CONNECT_AUTH_TOKEN=${connectToken}\n`);
88
87
  }
89
- core_1.ux.log();
88
+ core_1.ux.stdout();
90
89
  }
91
90
  return connectToken;
92
91
  };
93
92
  }
94
93
  exports.getConnectToken = getConnectTokenStore();
95
94
  function renderAuthHelperText() {
96
- core_1.ux.info([
95
+ core_1.ux.stdout([
97
96
  "Working with this CLI requires you to have a Constructor Index Key and Constructor API Token.",
98
97
  `If you have any questions, please reach out over at partners@constructor.io.`,
99
98
  ].join("\n"));
100
- core_1.ux.log("");
99
+ core_1.ux.stdout("");
101
100
  (0, render_tip_1.renderTip)([
102
101
  `The ${kleur_1.default.bold("Index Key")} should follow this format: key_xxxxxxxxxxxxxxxx`,
103
102
  ]);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTemplatesSourceCode = getTemplatesSourceCode;
4
4
  exports.getHelpersSourceCode = getHelpersSourceCode;
5
5
  const promises_1 = require("fs/promises");
6
- const errors_1 = require("@oclif/core/lib/errors");
6
+ const errors_1 = require("@oclif/core/errors");
7
7
  const path_1 = require("./path");
8
8
  /**
9
9
  * Loads the source code of a template from the file system.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractTemplateType = extractTemplateType;
4
- const errors_1 = require("@oclif/core/lib/errors");
4
+ const errors_1 = require("@oclif/core/errors");
5
5
  const types_1 = require("../types");
6
6
  /**
7
7
  * Checks for any nested folder that matches a known template type.
@@ -3,7 +3,7 @@ export declare const getCatalogFixture: (name: string, options?: fs.JsonReadOpti
3
3
  export declare const getExternalDataFixture: (name: string, options?: fs.JsonReadOptions) => any;
4
4
  export declare const getJSONataTemplate: (name: string, options?: BufferEncoding | (fs.ObjectEncodingOptions & {
5
5
  flag?: string | undefined;
6
- }) | null | undefined) => string | Buffer;
6
+ }) | null | undefined) => string | Buffer<ArrayBufferLike>;
7
7
  export declare function createFileLoader<T, S extends any[]>({ prefix, fileLoader, suggestions, }: Args<T, S>): (name: string, ...args: S) => T;
8
8
  interface Args<T, S extends any[]> {
9
9
  prefix: string;
@@ -1 +1 @@
1
- {"version":3,"file":"file-loaders.d.ts","sourceRoot":"","sources":["../../src/helpers/file-loaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,UAAU,CAAC;AAI1B,eAAO,MAAM,iBAAiB,SAqBP,MAAM,sCAjB3B,CAAC;AAEH,eAAO,MAAM,sBAAsB,SAeZ,MAAM,sCAX3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,SASR,MAAM;;yCAN3B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,EAAE,EACnD,MAAM,EACN,UAAU,EACV,WAAgB,GACjB,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAkB9C;AAED,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
1
+ {"version":3,"file":"file-loaders.d.ts","sourceRoot":"","sources":["../../src/helpers/file-loaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,UAAU,CAAC;AAI1B,eAAO,MAAM,iBAAiB,SAqBP,MAAM,sCAjB3B,CAAC;AAEH,eAAO,MAAM,sBAAsB,SAeZ,MAAM,sCAX3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,SASR,MAAM;;0DAN3B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,EAAE,EACnD,MAAM,EACN,UAAU,EACV,WAAgB,GACjB,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAkB9C;AAED,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getJSONataTemplate = exports.getExternalDataFixture = exports.getCatalogFixture = void 0;
7
7
  exports.createFileLoader = createFileLoader;
8
8
  const path_1 = __importDefault(require("path"));
9
- const errors_1 = require("@oclif/core/lib/errors");
9
+ const errors_1 = require("@oclif/core/errors");
10
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
11
11
  const path_2 = require("../customer/path");
12
12
  exports.getCatalogFixture = createFileLoader({
@@ -17,25 +17,25 @@ function printExecutionWarnings({ warnings, showDocsLink = true, }) {
17
17
  if (warnings.length > 10) {
18
18
  warnings = warnings.slice(0, 10);
19
19
  }
20
- core_1.ux.log();
21
- core_1.ux.log(kleur_1.default.yellow(`⚠️ WARNINGS :`), kleur_1.default.yellow(`We found ${originalLength} warnings when validating your template!`), kleur_1.default.bold(kleur_1.default.yellow(`⬇️ Warnings ⬇️`)));
22
- core_1.ux.log();
20
+ core_1.ux.stdout();
21
+ core_1.ux.stdout(kleur_1.default.yellow(`⚠️ WARNINGS :`), kleur_1.default.yellow(`We found ${originalLength} warnings when validating your template!`), kleur_1.default.bold(kleur_1.default.yellow(`⬇️ Warnings ⬇️`)));
22
+ core_1.ux.stdout();
23
23
  warnings.forEach((warning) => {
24
24
  printSingleWarning(warning);
25
25
  });
26
26
  if (originalLength > 10) {
27
- core_1.ux.log(`... and ${originalLength - 10} more`);
27
+ core_1.ux.stdout(`... and ${originalLength - 10} more`);
28
28
  }
29
- core_1.ux.log();
29
+ core_1.ux.stdout();
30
30
  if (showDocsLink) {
31
- core_1.ux.log(kleur_1.default.bold(`${(0, terminal_link_1.default)(kleur_1.default.bold("See documentation!"), `https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-template-types-transformation-templates`)}`));
31
+ core_1.ux.stdout(kleur_1.default.bold(`${(0, terminal_link_1.default)(kleur_1.default.bold("See documentation!"), `https://docs.constructor.com/docs/integrating-with-constructor-connect-cli-template-types-transformation-templates`)}`));
32
32
  }
33
33
  }
34
34
  function printSingleWarning(warning) {
35
35
  if (warning.critical) {
36
- core_1.ux.log(kleur_1.default.red(`🚨 [${warning.type}]:`), warning.message);
36
+ core_1.ux.stdout(kleur_1.default.red(`🚨 [${warning.type}]:`), warning.message);
37
37
  }
38
38
  else {
39
- core_1.ux.log(kleur_1.default.yellow(`⚠️ [${warning.type}]:`), warning.message);
39
+ core_1.ux.stdout(kleur_1.default.yellow(`⚠️ [${warning.type}]:`), warning.message);
40
40
  }
41
41
  }
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.refreshConnectionsList = refreshConnectionsList;
37
37
  const fs = __importStar(require("fs/promises"));
38
- const cli_ux_1 = require("@oclif/core/lib/cli-ux");
38
+ const core_1 = require("@oclif/core");
39
39
  const config_1 = require("../customer/config");
40
40
  const get_connections_request_1 = require("../http/get-connections-request");
41
41
  const render_prompt_1 = require("../prompt-data/render-prompt");
@@ -52,7 +52,7 @@ async function refreshConnectionsList() {
52
52
  await updateConfigFile();
53
53
  }
54
54
  catch (error) {
55
- cli_ux_1.ux.log(`Error refreshing connections list: ${error.message}`);
55
+ core_1.ux.stdout(`Error refreshing connections list: ${error.message}`);
56
56
  }
57
57
  }
58
58
  async function fetchNewConnections() {
@@ -99,5 +99,5 @@ async function updateConfigFile() {
99
99
  `const connections = ${JSON.stringify(formattedConnections, null, 2)};`);
100
100
  await fs.writeFile(rcPath, updatedContent, "utf-8");
101
101
  })();
102
- cli_ux_1.ux.log("🎉 Successfully updated connections in connectrc.js");
102
+ core_1.ux.stdout("🎉 Successfully updated connections in connectrc.js");
103
103
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.performDeploy = performDeploy;
4
4
  /* eslint-disable @typescript-eslint/no-base-to-string */
5
5
  const axios_1 = require("axios");
6
- const errors_1 = require("@oclif/core/lib/errors");
7
6
  const core_1 = require("@oclif/core");
7
+ const errors_1 = require("@oclif/core/errors");
8
8
  const http_client_1 = require("./http-client");
9
9
  /**
10
10
  * Calls the /templates endpoint of the Constructor API to deploy templates.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConnections = getConnections;
4
4
  const axios_1 = require("axios");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
8
  async function getConnections({ showLogs, }) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFixture = getFixture;
4
4
  const axios_1 = require("axios");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
8
  async function getFixture(args) {
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getHttpClient = getHttpClient;
40
40
  exports.checkRetryCondition = checkRetryCondition;
41
41
  exports.calculateRetryDelay = calculateRetryDelay;
42
- const errors_1 = require("@oclif/core/lib/errors");
42
+ const errors_1 = require("@oclif/core/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");
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.obtainToken = obtainToken;
4
4
  const axios_1 = require("axios");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
8
  async function obtainToken(args) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendTemplateExecuteRequest = sendTemplateExecuteRequest;
4
4
  const axios_1 = require("axios");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
8
  async function sendTemplateExecuteRequest({ template, helpers, targetData, externalData, connectionId, templateType, showLogs = true, }) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.triggerCatalogSync = triggerCatalogSync;
4
4
  const axios_1 = require("axios");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
8
  async function triggerCatalogSync(args) {
@@ -1,8 +1,8 @@
1
- import { type TemplatePath, type PromptChoices } from "../types";
1
+ import { type TemplatePath } from "../types";
2
2
  import { type ConnectionResponseDto } from "../http/get-connections-request";
3
3
  /**
4
4
  * Returns all connections that are associated with a template by checking
5
5
  * the config file.
6
6
  */
7
- export declare function filterConnectionsByTemplate(templatePath: TemplatePath, connections: ConnectionResponseDto[]): Promise<PromptChoices<ConnectionResponseDto>>;
7
+ export declare function filterConnectionsByTemplate(templatePath: TemplatePath, connections: ConnectionResponseDto[]): Promise<ConnectionResponseDto[]>;
8
8
  //# sourceMappingURL=filter-connections-by-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-connections-by-template.d.ts","sourceRoot":"","sources":["../../src/prompt-data/filter-connections-by-template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAG7E;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,qBAAqB,EAAE,GACnC,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAoC/C"}
1
+ {"version":3,"file":"filter-connections-by-template.d.ts","sourceRoot":"","sources":["../../src/prompt-data/filter-connections-by-template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAG7E;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,qBAAqB,EAAE,GACnC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CA+BlC"}
@@ -24,10 +24,5 @@ async function filterConnectionsByTemplate(templatePath, connections) {
24
24
  return connectionIds;
25
25
  }, new Set());
26
26
  const filteredConnections = connections.filter((connection) => configConnectionIds.has(connection.id));
27
- return filteredConnections.map((connection) => {
28
- return {
29
- name: connection.name,
30
- value: connection,
31
- };
32
- });
27
+ return filteredConnections;
33
28
  }
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getCandidateFixtures = getCandidateFixtures;
7
7
  const path_1 = __importDefault(require("path"));
8
- const errors_1 = require("@oclif/core/lib/errors");
8
+ const errors_1 = require("@oclif/core/errors");
9
9
  const find_deep_files_1 = require("../helpers/find-deep-files");
10
10
  const extract_template_type_1 = require("../helpers/extract-template-type");
11
11
  const path_2 = require("../customer/path");
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderPrompt = renderPrompt;
4
4
  const prompts_1 = require("@inquirer/prompts");
5
- const errors_1 = require("@oclif/core/lib/errors");
5
+ const errors_1 = require("@oclif/core/errors");
6
6
  async function renderPrompt({ choices, promptMessage, emptyMessage, }) {
7
7
  switch (choices.length) {
8
8
  case 0:
@@ -19,6 +19,6 @@ const generate_command_input_1 = require("../helpers/generate-command-input");
19
19
  * @param inputFlags A map of flag names to the values that should be printed in the command.
20
20
  */
21
21
  function renderRepeatInput(command, inputFlags) {
22
- core_1.ux.log(kleur_1.default.bold(`\nInput to replicate this command ⬇️\n`) +
22
+ core_1.ux.stdout(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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-template-result.d.ts","sourceRoot":"","sources":["../../src/rendering/render-template-result.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,QAO/C"}
1
+ {"version":3,"file":"render-template-result.d.ts","sourceRoot":"","sources":["../../src/rendering/render-template-result.ts"],"names":[],"mappings":"AAUA,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,QAO/C"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.renderTemplateResult = renderTemplateResult;
7
+ /* eslint-disable import/no-named-as-default */
7
8
  const core_1 = require("@oclif/core");
8
9
  const kleur_1 = __importDefault(require("kleur"));
9
10
  const cli_highlight_1 = __importDefault(require("cli-highlight"));
@@ -20,19 +21,19 @@ function isTemplateFailure(result) {
20
21
  return !!result.error;
21
22
  }
22
23
  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" })}`);
24
+ core_1.ux.stdout(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
25
  }
25
26
  function renderTemplateError(result) {
26
- core_1.ux.log(kleur_1.default.bold(kleur_1.default.red("💥 Error while executing your template: ") + "⬇️ Error ⬇️"));
27
- core_1.ux.log();
27
+ core_1.ux.stdout(kleur_1.default.bold(kleur_1.default.red("💥 Error while executing your template: ") + "⬇️ Error ⬇️"));
28
+ core_1.ux.stdout();
28
29
  if (result.error.message) {
29
- core_1.ux.log(kleur_1.default.red("Error Message: "), kleur_1.default.yellow(result.error.message));
30
+ core_1.ux.stdout(kleur_1.default.red("Error Message: "), kleur_1.default.yellow(result.error.message));
30
31
  }
31
32
  if (result.error.line) {
32
- core_1.ux.log(kleur_1.default.red("Line number: "), kleur_1.default.yellow(result.error.line));
33
+ core_1.ux.stdout(kleur_1.default.red("Line number: "), kleur_1.default.yellow(result.error.line));
33
34
  }
34
35
  if (result.error.token) {
35
- core_1.ux.log(kleur_1.default.red("Token: "), kleur_1.default.yellow(result.error.token));
36
+ core_1.ux.stdout(kleur_1.default.red("Token: "), kleur_1.default.yellow(result.error.token));
36
37
  }
37
38
  if (result.error.snippet) {
38
39
  let highlightedSnippet = (0, cli_highlight_1.default)(result.error.snippet?.join("\n"), {
@@ -47,13 +48,13 @@ function renderTemplateError(result) {
47
48
  .split("\n")
48
49
  .map((line, i) => kleur_1.default.gray(`${i + 1 + startLine} `) + line)
49
50
  .join("\n");
50
- core_1.ux.log(highlightedSnippet);
51
- core_1.ux.log("\n");
51
+ core_1.ux.stdout(highlightedSnippet);
52
+ core_1.ux.stdout("\n");
52
53
  (0, render_tip_1.renderTip)([
53
54
  "The above snippet shows the built template, so line numbers can have a slight offset depending on the provided helpers.",
54
55
  ]);
55
56
  (0, render_tip_1.renderTip)(["Check for missing ';' or trailing ',' in the above lines."]);
56
- core_1.ux.log();
57
+ core_1.ux.stdout();
57
58
  }
58
- core_1.ux.log(kleur_1.default.bold(kleur_1.default.red("💥 Error while executing your template: ") + "⬆️ Error ⬆️"));
59
+ core_1.ux.stdout(kleur_1.default.bold(kleur_1.default.red("💥 Error while executing your template: ") + "⬆️ Error ⬆️"));
59
60
  }
@@ -25,5 +25,5 @@ function renderTip(lines, { breakFirstLine = false, emoji = "💡" } = {}) {
25
25
  message += FIRST_LINE_WITH_SPACING;
26
26
  }
27
27
  message += lines.join(NEW_LINE_WITH_SPACING);
28
- core_1.ux.log(kleur_1.default.gray(message));
28
+ core_1.ux.stdout(kleur_1.default.gray(message));
29
29
  }
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.12.4";
1
+ declare const _default: "1.13.0";
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.4';
3
+ exports.default = '1.13.0';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.4"
193
+ "version": "1.13.0"
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.12.4",
3
+ "version": "1.13.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",
@@ -15,7 +15,7 @@
15
15
  "constructorio-connect-cli": "bin/run.js"
16
16
  },
17
17
  "scripts": {
18
- "dev": "bin/dev.js",
18
+ "dev": "node bin/dev.js",
19
19
  "dev:debug": "node --inspect-brk bin/dev.js",
20
20
  "prod": "npm run build && bin/run.js",
21
21
  "generate-readme": "ts-node scripts/generate-readme.ts",
@@ -61,9 +61,9 @@
61
61
  },
62
62
  "homepage": "https://github.com/Constructor-io/constructorio-connect-cli#readme",
63
63
  "dependencies": {
64
- "@inquirer/prompts": "^7.0.1",
65
- "@oclif/core": "3.25.3",
66
- "@oclif/plugin-help": "^6.0.21",
64
+ "@inquirer/prompts": "^7.4.0",
65
+ "@oclif/core": "4.2.10",
66
+ "@oclif/plugin-help": "^6.2.27",
67
67
  "axios": "^1.6.8",
68
68
  "axios-retry": "^4.4.1",
69
69
  "cli-highlight": "^2.1.11",
@@ -77,7 +77,7 @@
77
77
  "terminal-link": "^2.1.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@oclif/test": "^4.0.5",
80
+ "@oclif/test": "^4.1.12",
81
81
  "@types/fs-extra": "^11.0.4",
82
82
  "@types/jest": "^29.5.12",
83
83
  "@types/mock-fs": "^4.13.4",
@@ -85,14 +85,15 @@
85
85
  "eslint": "^8.57.0",
86
86
  "eslint-config-prettier": "^10.0.1",
87
87
  "eslint-config-standard-with-typescript": "^43.0.1",
88
+ "eslint-import-resolver-typescript": "^4.3.1",
88
89
  "eslint-plugin-import": "^2.29.1",
89
90
  "eslint-plugin-prettier": "^5.1.3",
90
91
  "eslint-plugin-promise": "^6.1.1",
91
92
  "jest": "^29.7.0",
92
93
  "license-checker": "^25.0.1",
93
94
  "mock-fs": "^5.2.0",
94
- "nock": "^14.0.0",
95
- "oclif": "^4.6.3",
95
+ "nock": "14.0.0",
96
+ "oclif": "^4.17.42",
96
97
  "prettier": "^3.2.5",
97
98
  "prettier-2": "npm:prettier@^2.8.8",
98
99
  "shx": "^0.4.0",