@constructor-io/constructorio-connect-cli 1.12.3 → 1.12.5

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 (57) 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 +5 -9
  7. package/dist/commands/execute.d.ts.map +1 -1
  8. package/dist/commands/execute.js +17 -26
  9. package/dist/commands/generate-fixture.js +3 -3
  10. package/dist/commands/init.d.ts +1 -1
  11. package/dist/commands/init.d.ts.map +1 -1
  12. package/dist/commands/init.js +6 -6
  13. package/dist/customer/config.js +3 -3
  14. package/dist/customer/get-connect-token.d.ts.map +1 -1
  15. package/dist/customer/get-connect-token.js +8 -9
  16. package/dist/customer/path.d.ts +17 -18
  17. package/dist/customer/path.d.ts.map +1 -1
  18. package/dist/customer/path.js +41 -41
  19. package/dist/customer/template-source-code.js +2 -2
  20. package/dist/helpers/extract-template-type.d.ts +6 -0
  21. package/dist/helpers/extract-template-type.d.ts.map +1 -0
  22. package/dist/helpers/extract-template-type.js +23 -0
  23. package/dist/helpers/file-exists.d.ts.map +1 -1
  24. package/dist/helpers/file-exists.js +4 -2
  25. package/dist/helpers/file-loaders.d.ts +1 -1
  26. package/dist/helpers/file-loaders.d.ts.map +1 -1
  27. package/dist/helpers/file-loaders.js +5 -5
  28. package/dist/helpers/find-deep-files.d.ts.map +1 -1
  29. package/dist/helpers/find-deep-files.js +3 -2
  30. package/dist/helpers/print-warnings.js +8 -8
  31. package/dist/helpers/refresh-connections-list.js +5 -5
  32. package/dist/http/deploy-request.js +1 -1
  33. package/dist/http/get-connections-request.js +1 -1
  34. package/dist/http/get-fixture.js +1 -1
  35. package/dist/http/http-client.js +1 -1
  36. package/dist/http/obtain-token-request.js +1 -1
  37. package/dist/http/send-template-execute-request.js +1 -1
  38. package/dist/http/trigger-catalog-sync.js +1 -1
  39. package/dist/prompt-data/filter-connections-by-template.d.ts +2 -2
  40. package/dist/prompt-data/filter-connections-by-template.d.ts.map +1 -1
  41. package/dist/prompt-data/filter-connections-by-template.js +3 -13
  42. package/dist/prompt-data/get-candidate-fixtures.d.ts +5 -2
  43. package/dist/prompt-data/get-candidate-fixtures.d.ts.map +1 -1
  44. package/dist/prompt-data/get-candidate-fixtures.js +8 -24
  45. package/dist/prompt-data/get-template-files.d.ts.map +1 -1
  46. package/dist/prompt-data/get-template-files.js +8 -5
  47. package/dist/prompt-data/render-prompt.js +1 -1
  48. package/dist/rendering/render-repeat-input.js +1 -1
  49. package/dist/rendering/render-template-result.d.ts.map +1 -1
  50. package/dist/rendering/render-template-result.js +11 -10
  51. package/dist/rendering/render-tip.js +1 -1
  52. package/dist/types.d.ts +9 -0
  53. package/dist/types.d.ts.map +1 -1
  54. package/dist/version.d.ts +1 -1
  55. package/dist/version.js +1 -1
  56. package/oclif.manifest.json +1 -1
  57. 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,22 +17,18 @@ 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[];
27
27
  input: ExecuteInputFlags;
28
28
  runCommand(): Promise<void>;
29
- /**
30
- * Returns the template type, which is always equal to the folder name of the template path.
31
- */
32
- private getTemplateType;
33
29
  private parseFlags;
34
30
  private getTemplateExecInput;
35
- private calculateConnectionId;
31
+ private validateAndGetConnection;
36
32
  private getConnectionForTemplate;
37
33
  }
38
34
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,C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- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Execute = exports.executePromptMessages = void 0;
7
- const os_1 = __importDefault(require("os"));
8
4
  const core_1 = require("@oclif/core");
9
- const errors_1 = require("@oclif/core/lib/errors");
10
- const config_1 = require("../customer/config");
11
- const path_1 = require("../customer/path");
12
- const template_source_code_1 = require("../customer/template-source-code");
5
+ const errors_1 = require("@oclif/core/errors");
13
6
  const file_loaders_1 = require("../helpers/file-loaders");
14
- const print_warnings_1 = require("../helpers/print-warnings");
15
- const ux_action_1 = require("../helpers/ux-action");
16
7
  const get_connections_request_1 = require("../http/get-connections-request");
17
8
  const send_template_execute_request_1 = require("../http/send-template-execute-request");
18
9
  const filter_connections_by_template_1 = require("../prompt-data/filter-connections-by-template");
@@ -22,6 +13,12 @@ const get_template_files_1 = require("../prompt-data/get-template-files");
22
13
  const render_prompt_1 = require("../prompt-data/render-prompt");
23
14
  const render_repeat_input_1 = require("../rendering/render-repeat-input");
24
15
  const render_template_result_1 = require("../rendering/render-template-result");
16
+ const path_1 = require("../customer/path");
17
+ const config_1 = require("../customer/config");
18
+ const template_source_code_1 = require("../customer/template-source-code");
19
+ const ux_action_1 = require("../helpers/ux-action");
20
+ const print_warnings_1 = require("../helpers/print-warnings");
21
+ const extract_template_type_1 = require("../helpers/extract-template-type");
25
22
  const refresh_connections_command_1 = require("./refresh-connections-command");
26
23
  exports.executePromptMessages = {
27
24
  template: "Select a template to execute",
@@ -68,7 +65,7 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
68
65
  ? (0, file_loaders_1.getExternalDataFixture)(templateInput.externalDataPath)
69
66
  : {},
70
67
  connectionId: templateInput.connectionId,
71
- templateType: this.getTemplateType(templateInput.templatePath),
68
+ templateType: (0, extract_template_type_1.extractTemplateType)(templateInput.templatePath),
72
69
  });
73
70
  (0, render_template_result_1.renderTemplateResult)(result);
74
71
  if (result.warnings.length > 0) {
@@ -84,23 +81,16 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
84
81
  (0, render_repeat_input_1.renderRepeatInput)(this, this.input);
85
82
  }
86
83
  }
87
- /**
88
- * Returns the template type, which is always equal to the folder name of the template path.
89
- */
90
- getTemplateType(templatePath) {
91
- const platformFileDelimiter = os_1.default.platform() === "win32" ? "\\" : "/";
92
- return templatePath.split(platformFileDelimiter)?.[0];
93
- }
94
84
  async parseFlags() {
95
85
  const { flags } = await this.parse(Execute);
96
86
  if (flags["template-path"]) {
97
- this.input["template-path"] = (0, path_1.cleanupTemplatePath)(flags["template-path"]);
87
+ this.input["template-path"] = (0, path_1.cleanupPath)(flags["template-path"]);
98
88
  }
99
89
  if (flags["fixture-path"]) {
100
- this.input["fixture-path"] = (0, path_1.cleanupFixturePath)(flags["fixture-path"]);
90
+ this.input["fixture-path"] = (0, path_1.cleanupPath)(flags["fixture-path"]);
101
91
  }
102
92
  if (flags["external-data-path"]) {
103
- this.input["external-data-path"] = (0, path_1.cleanupExternalDataPath)(flags["external-data-path"]);
93
+ this.input["external-data-path"] = (0, path_1.cleanupPath)(flags["external-data-path"]);
104
94
  }
105
95
  if (flags["connection-id"]) {
106
96
  this.input["connection-id"] = flags["connection-id"];
@@ -112,9 +102,8 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
112
102
  });
113
103
  await this.parseFlags();
114
104
  if (!this.input["template-path"]) {
115
- const choices = await (0, get_template_files_1.getTemplateFiles)();
116
105
  this.input["template-path"] = await (0, render_prompt_1.renderPrompt)({
117
- choices,
106
+ choices: await (0, get_template_files_1.getTemplateFiles)(),
118
107
  promptMessage: exports.executePromptMessages.template,
119
108
  emptyMessage: "No templates found",
120
109
  });
@@ -136,7 +125,10 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
136
125
  });
137
126
  }
138
127
  }
139
- const connectionId = await this.calculateConnectionId(allConnections, this.input["template-path"]);
128
+ const connectionId = await this.validateAndGetConnection(allConnections, this.input["template-path"]);
129
+ // Let's make sure to re-set the input value since the user might
130
+ // have just chosen one
131
+ this.input["connection-id"] = connectionId;
140
132
  return {
141
133
  templatePath: this.input["template-path"],
142
134
  fixturePath: this.input["fixture-path"],
@@ -144,7 +136,7 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
144
136
  connectionId,
145
137
  };
146
138
  }
147
- async calculateConnectionId(allConnections, templatePath) {
139
+ async validateAndGetConnection(allConnections, templatePath) {
148
140
  let connection = allConnections.find((c) => c.id === this.input["connection-id"]);
149
141
  if (this.input["connection-id"] && !connection) {
150
142
  throw new errors_1.CLIError(`Connection with ID ${this.input["connection-id"]} not found`, {
@@ -153,7 +145,6 @@ class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
153
145
  }
154
146
  if (!connection) {
155
147
  connection = await this.getConnectionForTemplate(templatePath, allConnections);
156
- this.input["connection-id"] = connection.id;
157
148
  }
158
149
  return connection.id;
159
150
  }
@@ -12,10 +12,10 @@ const file_exists_1 = require("../helpers/file-exists");
12
12
  const ux_action_1 = require("../helpers/ux-action");
13
13
  const get_fixture_1 = require("../http/get-fixture");
14
14
  const render_prompt_1 = require("../prompt-data/render-prompt");
15
- const select_connections_1 = require("../prompt-data/select-connections");
16
15
  const render_tip_1 = require("../rendering/render-tip");
17
16
  const types_1 = require("../types");
18
17
  const check_if_connection_needs_mapping_1 = require("../helpers/check-if-connection-needs-mapping");
18
+ const select_connections_1 = require("../prompt-data/select-connections");
19
19
  const refresh_connections_command_1 = require("./refresh-connections-command");
20
20
  class GenerateFixture extends refresh_connections_command_1.RefreshConnectionsCommand {
21
21
  static args = {};
@@ -66,14 +66,14 @@ 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}`);
73
73
  }
74
74
  }
75
75
  getFixturePath(type, filename) {
76
- return (0, path_2.getCustomerPath)(path_1.default.join("src", "fixtures", type, filename.replace(/\.[^/.]+$/, "") + ".json"));
76
+ return (0, path_2.getCustomerOSSpecificPath)(path_1.default.join("src", "fixtures", type, filename.replace(/\.[^/.]+$/, "") + ".json"));
77
77
  }
78
78
  }
79
79
  exports.default = GenerateFixture;
@@ -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
  /**
@@ -47,7 +47,7 @@ const path_1 = require("./path");
47
47
  * If the file is not found, it throws a CLIError with a message indicating the expected path.
48
48
  */
49
49
  async function getRepositoryConfigFile() {
50
- const configPath = (0, path_1.getCustomerPath)("connectrc.js");
50
+ const configPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
51
51
  try {
52
52
  return require(configPath);
53
53
  }
@@ -81,7 +81,7 @@ pointing to the correct connectrc.js directory.`,
81
81
  * @returns The connections object and the content of the connectrc.js file in {@link RawConfigContent}
82
82
  */
83
83
  async function getRepositoryConnectionsAndConfig() {
84
- const configPath = (0, path_1.getCustomerPath)("connectrc.js");
84
+ const configPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
85
85
  const fileContent = await readRawConfigFile(configPath);
86
86
  // Get the connections object from the content of the connectrc.js file
87
87
  const configMatch = fileContent.match(/const\s+connections\s*=\s*({[\s\S]*?});/);
@@ -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
  ]);
@@ -1,26 +1,25 @@
1
1
  /**
2
- * @returns The provided path prepended with the root directory.
3
- */
4
- export declare function getCustomerPath(path: string): string;
5
- /**
6
- * Cleans up the template path, removing the root directory and the 'src/templates' prefix.
2
+ * @returns The provided path prepended with the root directory - in the user's OS path pattern.
7
3
  *
8
- * This is needed to support the use of absolute paths in the templates, since those will
9
- * be added later on when reading the files.
4
+ * E.g. Unix: /path/to/file
5
+ * E.g. Windows: C:\path\to\file
10
6
  */
11
- export declare function cleanupTemplatePath(path: string | undefined): string;
7
+ export declare function getCustomerOSSpecificPath(path: string): string;
12
8
  /**
13
- * Cleans up the fixture path, removing the root directory and the 'src/fixtures' prefix.
9
+ * Receives either a relative or absolute path for a given template file.
14
10
  *
15
- * This is needed to support the use of absolute paths in the templates, since those will
16
- * be added later on when reading the files.
17
- */
18
- export declare function cleanupFixturePath(path: string | undefined): string;
19
- /**
20
- * Cleans up the external data path, removing the root directory and the 'src/external-data' prefix.
11
+ * Unix
12
+ * - src/templates/variation/variation.jsonata
13
+ * - ./src/templates/variation/variation.jsonata
14
+ * - /usr/username/templates-folder/src/templates/variation/variation.jsonata
15
+ *
16
+ * Windows
17
+ * - src\templates\variation\variation.jsonata
18
+ * - .\src\templates\variation\variation.jsonata
19
+ * - C:\users\username\templates-folder\src\templates\variation\variation.jsonata
21
20
  *
22
- * This is needed to support the use of absolute paths in the templates, since those will
23
- * be added later on when reading the files.
21
+ * And returns a relative unix path WITHOUT its type prefix (e.g "src/templates"), like so:
22
+ * - variation/variation.jsonata
24
23
  */
25
- export declare function cleanupExternalDataPath(path: string | undefined): string;
24
+ export declare function cleanupPath(filePath: string | undefined): string;
26
25
  //# sourceMappingURL=path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/customer/path.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,UAE3C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,UAI3D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,UAI1D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,UAI/D"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/customer/path.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,UAErD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,UAiCvD"}
@@ -1,59 +1,59 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCustomerPath = getCustomerPath;
7
- exports.cleanupTemplatePath = cleanupTemplatePath;
8
- exports.cleanupFixturePath = cleanupFixturePath;
9
- exports.cleanupExternalDataPath = cleanupExternalDataPath;
3
+ exports.getCustomerOSSpecificPath = getCustomerOSSpecificPath;
4
+ exports.cleanupPath = cleanupPath;
10
5
  /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
11
6
  const path_1 = require("path");
12
- const os_1 = __importDefault(require("os"));
13
7
  /**
14
- * @returns The provided path prepended with the root directory.
8
+ * @returns The provided path prepended with the root directory - in the user's OS path pattern.
9
+ *
10
+ * E.g. Unix: /path/to/file
11
+ * E.g. Windows: C:\path\to\file
15
12
  */
16
- function getCustomerPath(path) {
13
+ function getCustomerOSSpecificPath(path) {
17
14
  return (0, path_1.join)(process.cwd(), process.env.REPOSITORY_ROOT_DIRECTORY || "", path);
18
15
  }
19
16
  /**
20
- * Cleans up the template path, removing the root directory and the 'src/templates' prefix.
17
+ * Receives either a relative or absolute path for a given template file.
21
18
  *
22
- * This is needed to support the use of absolute paths in the templates, since those will
23
- * be added later on when reading the files.
24
- */
25
- function cleanupTemplatePath(path) {
26
- return cleanupDelimiters(cleanupAbsolutePath(path).replace((0, path_1.join)("src", "templates"), ""));
27
- }
28
- /**
29
- * Cleans up the fixture path, removing the root directory and the 'src/fixtures' prefix.
19
+ * Unix
20
+ * - src/templates/variation/variation.jsonata
21
+ * - ./src/templates/variation/variation.jsonata
22
+ * - /usr/username/templates-folder/src/templates/variation/variation.jsonata
30
23
  *
31
- * This is needed to support the use of absolute paths in the templates, since those will
32
- * be added later on when reading the files.
33
- */
34
- function cleanupFixturePath(path) {
35
- return cleanupDelimiters(cleanupAbsolutePath(path).replace((0, path_1.join)("src", "fixtures"), ""));
36
- }
37
- /**
38
- * Cleans up the external data path, removing the root directory and the 'src/external-data' prefix.
24
+ * Windows
25
+ * - src\templates\variation\variation.jsonata
26
+ * - .\src\templates\variation\variation.jsonata
27
+ * - C:\users\username\templates-folder\src\templates\variation\variation.jsonata
39
28
  *
40
- * This is needed to support the use of absolute paths in the templates, since those will
41
- * be added later on when reading the files.
29
+ * And returns a relative unix path WITHOUT its type prefix (e.g "src/templates"), like so:
30
+ * - variation/variation.jsonata
42
31
  */
43
- function cleanupExternalDataPath(path) {
44
- return cleanupDelimiters(cleanupAbsolutePath(path).replace((0, path_1.join)("src", "external-data"), ""));
45
- }
46
- function cleanupAbsolutePath(path) {
47
- if (!path) {
32
+ function cleanupPath(filePath) {
33
+ if (!filePath) {
48
34
  return "";
49
35
  }
50
- const replacedPath = path.replace(process.cwd(), "");
51
- return cleanupDelimiters(replacedPath);
52
- }
53
- function cleanupDelimiters(path) {
54
- const platformFileDelimiter = os_1.default.platform() === "win32" ? "\\" : "/";
55
- let replacedPath = path.replace(process.cwd(), "");
56
- if (replacedPath.startsWith(`${platformFileDelimiter}${platformFileDelimiter}`)) {
36
+ /**
37
+ * E.g /src/templates/variation/variation.jsonata
38
+ * E.g ./src/templates/variation/variation.jsonata
39
+ * E.g src/templates/variation/variation.jsonata
40
+ */
41
+ const relativePath = filePath
42
+ .replace(process.cwd(), "") //
43
+ .replace(/\\/g, "/");
44
+ /**
45
+ * E.g variation/variation.jsonata
46
+ * E.g /variation/variation.jsonata
47
+ * E.g ./variation/variation.jsonata
48
+ */
49
+ let replacedPath = relativePath
50
+ .replace("src/templates/", "")
51
+ .replace("src/fixtures/", "")
52
+ .replace("src/external-data/", "");
53
+ if (replacedPath.startsWith("/")) {
54
+ replacedPath = replacedPath.slice(1);
55
+ }
56
+ if (replacedPath.startsWith("./")) {
57
57
  replacedPath = replacedPath.slice(2);
58
58
  }
59
59
  return replacedPath;
@@ -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.
@@ -13,7 +13,7 @@ async function loadSourceCode(path) {
13
13
  return undefined;
14
14
  }
15
15
  try {
16
- return await (0, promises_1.readFile)((0, path_1.getCustomerPath)(path), "utf-8");
16
+ return await (0, promises_1.readFile)((0, path_1.getCustomerOSSpecificPath)(path), "utf-8");
17
17
  }
18
18
  catch (error) {
19
19
  throw new errors_1.CLIError(`Could not load "${path}" file. Please check your connectrc.js file.`);
@@ -0,0 +1,6 @@
1
+ import { type TemplatePath, type TemplateType } from "../types";
2
+ /**
3
+ * Checks for any nested folder that matches a known template type.
4
+ */
5
+ export declare function extractTemplateType(templatePath: TemplatePath): TemplateType;
6
+ //# sourceMappingURL=extract-template-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-template-type.d.ts","sourceRoot":"","sources":["../../src/helpers/extract-template-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAiB,MAAM,UAAU,CAAC;AAE/E;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CAkB5E"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractTemplateType = extractTemplateType;
4
+ const errors_1 = require("@oclif/core/errors");
5
+ const types_1 = require("../types");
6
+ /**
7
+ * Checks for any nested folder that matches a known template type.
8
+ */
9
+ function extractTemplateType(templatePath) {
10
+ for (const type of types_1.TemplateTypes) {
11
+ if (templatePath.includes(`${type}/`)) {
12
+ return type;
13
+ }
14
+ }
15
+ throw new errors_1.CLIError(`Couldn't find the template type by looking at its path: ${templatePath}`, {
16
+ suggestions: [
17
+ "Check that the template file path is correct",
18
+ "Check that your templates are in the correctly named directory for their type (e.g. 'item.jsonata' in the 'templates/item' directory",
19
+ "Check that you are using a valid template type: " +
20
+ types_1.TemplateTypes.join(", "),
21
+ ],
22
+ });
23
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"file-exists.d.ts","sourceRoot":"","sources":["../../src/helpers/file-exists.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,GAAG,OAAO,CAO5E"}
1
+ {"version":3,"file":"file-exists.d.ts","sourceRoot":"","sources":["../../src/helpers/file-exists.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,UAAQ,GAAG,OAAO,CAU5E"}
@@ -9,9 +9,11 @@ const path_1 = require("../customer/path");
9
9
  * @returns boolean
10
10
  */
11
11
  function fileExists(filepath, isCustomerPath = false) {
12
- const fullpath = isCustomerPath ? filepath : (0, path_1.getCustomerPath)(filepath);
12
+ const fullPath = isCustomerPath
13
+ ? filepath
14
+ : (0, path_1.getCustomerOSSpecificPath)(filepath);
13
15
  try {
14
- return (0, fs_extra_1.existsSync)(fullpath);
16
+ return (0, fs_extra_1.existsSync)(fullPath);
15
17
  }
16
18
  catch {
17
19
  return false;
@@ -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,CA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,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({
@@ -24,13 +24,13 @@ exports.getJSONataTemplate = createFileLoader({
24
24
  fileLoader: fs_extra_1.default.readFileSync,
25
25
  });
26
26
  function createFileLoader({ prefix, fileLoader, suggestions = [], }) {
27
- return function (name, ...args) {
28
- const filePath = (0, path_2.getCustomerPath)(path_1.default.join(prefix, name));
27
+ return function (filename, ...args) {
28
+ const absolutePath = (0, path_2.getCustomerOSSpecificPath)(path_1.default.join(prefix, filename));
29
29
  try {
30
- return fileLoader(filePath, ...args);
30
+ return fileLoader(absolutePath, ...args);
31
31
  }
32
32
  catch (error) {
33
- throw new errors_1.CLIError(`Error while loading ${filePath}: ${error.message}`, {
33
+ throw new errors_1.CLIError(`Error while loading ${absolutePath}: ${error.message}`, {
34
34
  suggestions: [
35
35
  "Ensure the file exists and is named correctly",
36
36
  ...suggestions,
@@ -1 +1 @@
1
- {"version":3,"file":"find-deep-files.d.ts","sourceRoot":"","sources":["../../src/helpers/find-deep-files.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAWnD"}
1
+ {"version":3,"file":"find-deep-files.d.ts","sourceRoot":"","sources":["../../src/helpers/find-deep-files.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAanD"}
@@ -13,10 +13,11 @@ const path_2 = require("../customer/path");
13
13
  * @returns All files in the given directory, including in subdirectories
14
14
  */
15
15
  function findDeepFiles(dir) {
16
- const files = fs_extra_1.default.readdirSync((0, path_2.getCustomerPath)(dir));
16
+ const files = fs_extra_1.default.readdirSync((0, path_2.getCustomerOSSpecificPath)(dir));
17
17
  return files.reduce((files, currentPath) => {
18
18
  const fullPath = path_1.default.join(dir, currentPath);
19
- if (fs_extra_1.default.statSync((0, path_2.getCustomerPath)(fullPath)).isDirectory()) {
19
+ const resolvedPath = (0, path_2.getCustomerOSSpecificPath)(fullPath);
20
+ if (fs_extra_1.default.statSync(resolvedPath).isDirectory()) {
20
21
  return [...files, ...findDeepFiles(fullPath)];
21
22
  }
22
23
  else {
@@ -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,11 +35,11 @@ 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
- const path_1 = require("../customer/path");
41
40
  const get_connections_request_1 = require("../http/get-connections-request");
42
41
  const render_prompt_1 = require("../prompt-data/render-prompt");
42
+ const path_1 = require("../customer/path");
43
43
  const build_config_file_1 = require("./build-config-file");
44
44
  const should_update_connections_list_1 = require("./should-update-connections-list");
45
45
  const ux_action_1 = require("./ux-action");
@@ -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() {
@@ -86,7 +86,7 @@ async function checkConfigFileState() {
86
86
  }
87
87
  async function updateConfigFile() {
88
88
  const formattedConnections = await fetchNewConnections();
89
- const rcPath = (0, path_1.getCustomerPath)("connectrc.js");
89
+ const rcPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
90
90
  const { fileContent } = await (0, config_1.getRepositoryConnectionsAndConfig)();
91
91
  if (!fileContent) {
92
92
  return;
@@ -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
2
  import { type ConnectionResponseDto } from "../http/get-connections-request";
2
- import { type PromptChoices } from "../types";
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: string, connections: ConnectionResponseDto[]): Promise<PromptChoices<ConnectionResponseDto>>;
7
+ export declare function filterConnectionsByTemplate(templatePath: TemplatePath, connections: ConnectionResponseDto[]): Promise<PromptChoices<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":"AAGA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,qBAAqB,EAAE,GACnC,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CA2C/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,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,30 +1,20 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.filterConnectionsByTemplate = filterConnectionsByTemplate;
7
- const path_1 = __importDefault(require("path"));
8
4
  const config_1 = require("../customer/config");
5
+ const path_1 = require("../customer/path");
9
6
  /**
10
7
  * Returns all connections that are associated with a template by checking
11
8
  * the config file.
12
9
  */
13
10
  async function filterConnectionsByTemplate(templatePath, connections) {
14
11
  const config = await (0, config_1.getRepositoryConfigFile)();
15
- const prefix = path_1.default.join("src", "templates");
16
- let fullPath = templatePath;
17
- if (!templatePath.startsWith(prefix)) {
18
- fullPath = path_1.default.join(prefix, templatePath);
19
- }
20
12
  // All connection ids that references this template
21
13
  const configConnectionIds = config.environments.reduce((connectionIds, environment) => {
22
14
  for (const templateConfig of environment.templates) {
23
- const templatePaths = Object.values(templateConfig.paths)
24
- .map((filePath) => path_1.default.normalize(path_1.default.resolve(filePath)))
25
- .map((filePath) => filePath.replace(/\\/g, "/")); // this is needed to check the path in all OS
15
+ const templatePaths = Object.values(templateConfig.paths).map((filePath) => (0, path_1.cleanupPath)(filePath));
26
16
  // environment doesn't even target this template
27
- if (!templatePaths.includes(path_1.default.resolve(fullPath).replace(/\\/g, "/"))) {
17
+ if (!templatePaths.includes(templatePath)) {
28
18
  continue;
29
19
  }
30
20
  for (const id of templateConfig.connection_ids) {
@@ -1,3 +1,6 @@
1
- import { type PromptChoices } from "../types";
2
- export declare function getCandidateFixtures(templatePath: string): PromptChoices<string>;
1
+ import { type PromptChoices, type TemplatePath } from "../types";
2
+ /**
3
+ * @returns The CLEANED fixtures paths as prompt choices
4
+ */
5
+ export declare function getCandidateFixtures(templatePath: TemplatePath): PromptChoices<string>;
3
6
  //# sourceMappingURL=get-candidate-fixtures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-candidate-fixtures.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-candidate-fixtures.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhF,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,GACnB,aAAa,CAAC,MAAM,CAAC,CAqDvB"}
1
+ {"version":3,"file":"get-candidate-fixtures.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-candidate-fixtures.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAIlB;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,YAAY,GACzB,aAAa,CAAC,MAAM,CAAC,CAqCvB"}
@@ -5,21 +5,15 @@ 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
- const types_1 = require("../types");
10
+ const extract_template_type_1 = require("../helpers/extract-template-type");
11
+ const path_2 = require("../customer/path");
12
+ /**
13
+ * @returns The CLEANED fixtures paths as prompt choices
14
+ */
11
15
  function getCandidateFixtures(templatePath) {
12
- const templateType = extractTemplateType(templatePath);
13
- if (!templateType) {
14
- throw new errors_1.CLIError(`Couldn't find the template type by looking at its path: ${templatePath}`, {
15
- suggestions: [
16
- "Check that the template file path is correct",
17
- "Check that your templates are in the correctly named directory for their type (e.g. 'item.jsonata' in the 'templates/item' directory",
18
- "Check that you are using a valid template type: " +
19
- types_1.TemplateTypes.join(", "),
20
- ],
21
- });
22
- }
16
+ const templateType = (0, extract_template_type_1.extractTemplateType)(templatePath);
23
17
  const fixtureType = templateType === "grouping"
24
18
  ? "variation" //
25
19
  : templateType;
@@ -41,20 +35,10 @@ function getCandidateFixtures(templatePath) {
41
35
  return fixtureFullPaths
42
36
  .filter((fixturePath) => path_1.default.extname(fixturePath) === ".json")
43
37
  .map((fixturePath) => {
44
- const fixtureRelativePath = path_1.default.relative(path_1.default.join("src", "fixtures"), fixturePath);
38
+ const fixtureRelativePath = (0, path_2.cleanupPath)(fixturePath);
45
39
  return {
46
40
  name: fixtureRelativePath,
47
41
  value: fixtureRelativePath,
48
42
  };
49
43
  });
50
44
  }
51
- /**
52
- * Checks for any nested folder that matches a known template type.
53
- */
54
- function extractTemplateType(templatePath) {
55
- for (const type of types_1.TemplateTypes) {
56
- if (templatePath.includes(path_1.default.join(`${type}/`))) {
57
- return type;
58
- }
59
- }
60
- }
@@ -1 +1 @@
1
- {"version":3,"file":"get-template-files.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-template-files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAavE"}
1
+ {"version":3,"file":"get-template-files.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-template-files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAgBvE"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getTemplateFiles = getTemplateFiles;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const find_deep_files_1 = require("../helpers/find-deep-files");
9
+ const path_2 = require("../customer/path");
9
10
  /**
10
11
  * Get a prompt-ready list of template files in the user repository
11
12
  */
@@ -13,11 +14,13 @@ async function getTemplateFiles() {
13
14
  const filePath = path_1.default.join("src", "templates");
14
15
  const files = getTemplatePaths(filePath);
15
16
  const filteredFiles = files.filter((file) => file.endsWith(".jsonata") && !file.includes("helpers"));
16
- const filePathSlash = path_1.default.join(filePath, " ").trim(); // needed to add a space to the end to avoid removing the last slash
17
- return filteredFiles.map((file) => ({
18
- name: file.replace(filePathSlash, ""),
19
- value: file.replace(filePathSlash, ""),
20
- }));
17
+ return filteredFiles.map((file) => {
18
+ const relativePath = (0, path_2.cleanupPath)(file);
19
+ return {
20
+ name: relativePath,
21
+ value: relativePath,
22
+ };
23
+ });
21
24
  }
22
25
  /**
23
26
  * @param typePath The full type path. E.g.
@@ -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/types.d.ts CHANGED
@@ -49,6 +49,15 @@ export declare enum CatalogFixtureType {
49
49
  MAPPING = "mapping"
50
50
  }
51
51
  export declare const TemplateTypes: readonly ["item", "variation", "item_group", "grouping", "mapping"];
52
+ /**
53
+ * The unix relative path of a given template.
54
+ * With NO prefixed "/" or "./".
55
+ *
56
+ * E.g
57
+ * - staging/item/en_CA/item.jsonata
58
+ * - variation/variation.jsonata
59
+ */
60
+ export type TemplatePath = string;
52
61
  export type TemplateType = (typeof TemplateTypes)[number];
53
62
  export {};
54
63
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAA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IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,aAAa,qEAMhB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.12.3";
1
+ declare const _default: "1.12.5";
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.3';
3
+ exports.default = '1.12.5';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.3"
193
+ "version": "1.12.5"
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.12.3",
3
+ "version": "1.12.5",
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",