@constructor-io/constructorio-connect-cli 1.9.2 → 1.11.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.
package/README.md CHANGED
@@ -14,7 +14,7 @@ This package is a CLI tool that helps you **build, test and deploy your connecto
14
14
  Before you begin, note that this package is intended for use with partner connections. If you don't have a connector
15
15
  running yet, please take a look at [our documentation](https://docs.constructor.com/docs/integrating-with-constructor-platform-connectors) to see how you can get started.
16
16
 
17
- Finally, make sure you have your **connect auth token** available. If you don't have this yet, please get in touch with our team and we'll set this up.
17
+ Finally, make sure you have your **Index Key** and **API token** available. If you don't have this yet, please get in touch with our team and we'll set this up.
18
18
 
19
19
  ## 2. Install
20
20
 
@@ -28,7 +28,7 @@ Where `my-repo` is the name of the folder and repository you want to create.
28
28
 
29
29
  With the new repository initialized, you can start developing your catalog integration. Please refer to our [documentation](https://docs.constructor.com/docs/integrating-with-constructor-platform-connectors) for more information on how to build your templates.
30
30
 
31
- ## 3. Commands
31
+ ## 3. Commands
32
32
 
33
33
  <!-- Generated code below. Do not update! -->
34
34
 
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;AA6B7C,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,qBAAa,OAAQ,SAAQ,OAAO;IAClC,MAAM,CAAC,KAAK;;;;;MAgBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC1B;;OAEG;IACH,OAAO,CAAC,eAAe;YAKT,UAAU;YAsBV,oBAAoB;YA+CpB,qBAAqB;YA0BrB,wBAAwB;CAevC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,OAAO,EAAE,MAAM,aAAa,CAAC;AA8B7C,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,qBAAa,OAAQ,SAAQ,OAAO;IAClC,MAAM,CAAC,KAAK;;;;;MAgBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC1B;;OAEG;IACH,OAAO,CAAC,eAAe;YAKT,UAAU;YAsBV,oBAAoB;YA+CpB,qBAAqB;YA0BrB,wBAAwB;CAevC"}
@@ -21,6 +21,7 @@ const path_1 = require("../customer/path");
21
21
  const config_1 = require("../customer/config");
22
22
  const template_source_code_1 = require("../customer/template-source-code");
23
23
  const ux_action_1 = require("../helpers/ux-action");
24
+ const print_warnings_1 = require("../helpers/print-warnings");
24
25
  exports.executePromptMessages = {
25
26
  template: "Select a template to execute",
26
27
  fixture: "Select a catalog fixture to run the template against",
@@ -53,13 +54,12 @@ class Execute extends core_1.Command {
53
54
  ];
54
55
  input = {};
55
56
  async run() {
56
- let result = null;
57
57
  try {
58
58
  const templateInput = await this.getTemplateExecInput();
59
59
  const config = await (0, ux_action_1.uxAction)("📡 Reading your config", async () => {
60
60
  return await (0, config_1.getRepositoryConfigFile)();
61
61
  })();
62
- result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
62
+ const result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
63
63
  template: (0, file_loaders_1.getJSONataTemplate)(templateInput.templatePath).toString(),
64
64
  helpers: (await (0, template_source_code_1.getHelpersSourceCode)(config.helpers)) ?? "",
65
65
  targetData: (0, file_loaders_1.getCatalogFixture)(templateInput.fixturePath),
@@ -70,6 +70,9 @@ class Execute extends core_1.Command {
70
70
  templateType: this.getTemplateType(templateInput.templatePath),
71
71
  });
72
72
  (0, render_template_result_1.renderTemplateResult)(result);
73
+ if (result.warnings.length > 0) {
74
+ (0, print_warnings_1.printExecutionWarnings)(result.warnings);
75
+ }
73
76
  if (!result?.success) {
74
77
  this.exit(1);
75
78
  }
@@ -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;AAyBhD,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;YA+BnB,UAAU;IAmBxB,OAAO,CAAC,oBAAoB;YAUd,UAAU;YAsBV,uBAAuB;WA+BvB,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,EAAM,MAAM,aAAa,CAAC;AAyBhD,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;YA8BnB,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"}
@@ -72,11 +72,7 @@ class Init extends core_1.Command {
72
72
  async run() {
73
73
  const { args } = await this.parse(Init);
74
74
  const repoPath = path.join(process.cwd(), args.name);
75
- core_1.ux.info([
76
- `👋 Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`,
77
- "Working with this CLI requires a Constructor Connect Auth Token. This is not the same as your Constructor API Token.",
78
- `If you don't have one yet, please reach out over at partners@constructor.io.`,
79
- ].join("\n"));
75
+ core_1.ux.info([`👋 Welcome to the ${kleur_1.default.bold("Constructor.io Connect CLI")}!\n`].join("\n"));
80
76
  const connectAuthToken = await (0, get_connect_token_1.getConnectToken)(false);
81
77
  const newDirExists = fs_extra_1.default.existsSync(repoPath);
82
78
  if (!newDirExists) {
@@ -127,7 +123,6 @@ class Init extends core_1.Command {
127
123
  `);
128
124
  }
129
125
  async generateRepositoryFiles(args) {
130
- core_1.ux.log("\n");
131
126
  const connections = await (0, get_connections_request_1.getConnections)({ showLogs: true });
132
127
  const shouldCreateMappingTemplates = connections.some((connection) => connection.partner === "omni");
133
128
  const connectionsDict = (0, build_config_file_1.buildConnectionsDictFromList)(connections);
@@ -1 +1 @@
1
- {"version":3,"file":"get-connect-token.d.ts","sourceRoot":"","sources":["../../src/customer/get-connect-token.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,eAIvB,OAAO,KACf,OAAO,CAAC,MAAM,CAAC,CA2BnB;AAED,eAAO,MAAM,eAAe,aA9Bf,OAAO,KACf,OAAO,CAAC,MAAM,CA6BkC,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,eAIvB,OAAO,KACf,OAAO,CAAC,MAAM,CAAC,CAyCnB;AAED,eAAO,MAAM,eAAe,aA5Cf,OAAO,KACf,OAAO,CAAC,MAAM,CA2CkC,CAAC"}
@@ -32,12 +32,19 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.getConnectToken = void 0;
37
40
  exports.getConnectTokenStore = getConnectTokenStore;
38
41
  const fs = __importStar(require("fs-extra"));
39
42
  const prompts_1 = require("@inquirer/prompts");
40
43
  const core_1 = require("@oclif/core");
44
+ const kleur_1 = __importDefault(require("kleur"));
45
+ const terminal_link_1 = __importDefault(require("terminal-link"));
46
+ const obtain_token_request_1 = require("../http/obtain-token-request");
47
+ const render_tip_1 = require("../rendering/render-tip");
41
48
  /**
42
49
  * Gets the Connect Auth token that should be used for the API requests to the Connect API.
43
50
  * First attempts to read from the environment variable CONNECT_AUTH_TOKEN. If it is not present
@@ -53,27 +60,54 @@ const core_1 = require("@oclif/core");
53
60
  function getConnectTokenStore() {
54
61
  let connectToken;
55
62
  return async function getConnectToken(canSave = true) {
56
- if (!connectToken) {
57
- if (!process.env.CONNECT_AUTH_TOKEN) {
58
- core_1.ux.log();
59
- connectToken = await core_1.ux.prompt("Enter your Connect Auth token 🔐", {
60
- type: "mask",
61
- });
62
- if (canSave) {
63
- const saveToken = await (0, prompts_1.confirm)({
64
- message: "💾 Do you want to save this token in your .env for future use?",
65
- });
66
- if (saveToken) {
67
- fs.appendFileSync(".env", `CONNECT_AUTH_TOKEN=${connectToken}\n`);
68
- }
69
- core_1.ux.log();
70
- }
71
- }
72
- else {
73
- connectToken = process.env.CONNECT_AUTH_TOKEN;
63
+ if (connectToken) {
64
+ return connectToken;
65
+ }
66
+ if (process.env.CONNECT_AUTH_TOKEN) {
67
+ connectToken = process.env.CONNECT_AUTH_TOKEN;
68
+ return connectToken;
69
+ }
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",
77
+ });
78
+ connectToken = await (0, obtain_token_request_1.obtainToken)({
79
+ api_key: apiKey,
80
+ api_token: apiToken,
81
+ });
82
+ if (canSave) {
83
+ const saveToken = await (0, prompts_1.confirm)({
84
+ message: "💾 Do you want to save this token in your .env for future use?",
85
+ });
86
+ if (saveToken) {
87
+ fs.appendFileSync(".env", `CONNECT_AUTH_TOKEN=${connectToken}\n`);
74
88
  }
89
+ core_1.ux.log();
75
90
  }
76
91
  return connectToken;
77
92
  };
78
93
  }
79
94
  exports.getConnectToken = getConnectTokenStore();
95
+ function renderAuthHelperText() {
96
+ core_1.ux.info([
97
+ "Working with this CLI requires you to have a Constructor Index Key and Constructor API Token.",
98
+ `If you have any questions, please reach out over at partners@constructor.io.`,
99
+ ].join("\n"));
100
+ core_1.ux.log("");
101
+ (0, render_tip_1.renderTip)([
102
+ `The ${kleur_1.default.bold("Index Key")} should follow this format: key_xxxxxxxxxxxxxxxx`,
103
+ ]);
104
+ (0, render_tip_1.renderTip)([
105
+ `The ${kleur_1.default.bold("API Token")} should follow this format: tok_xxxxxxxxxxxxxxxx`,
106
+ ]);
107
+ (0, render_tip_1.renderTip)([
108
+ `You can obtain an Index key and API Token from the customer dashboard under the ${(0, terminal_link_1.default)(kleur_1.default.bold("Integration > API Integration"), "https://app.constructor.io/dashboard/integration/api_tokens")} tab.`,
109
+ ], { emoji: "🔗" });
110
+ (0, render_tip_1.renderTip)([
111
+ `For more information about authentication, refer to ${(0, terminal_link_1.default)(kleur_1.default.bold("the documentation"), "https://docs.constructor.com/reference/main-authentication")}.`,
112
+ ], { emoji: "📚" });
113
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,qEAMf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,gCAqBjE"}
1
+ {"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,qEAMf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,gCAuBjE"}
@@ -12,6 +12,7 @@ const template_source_code_1 = require("../customer/template-source-code");
12
12
  const file_loaders_1 = require("../helpers/file-loaders");
13
13
  const config_1 = require("../customer/config");
14
14
  const get_connections_request_1 = require("../http/get-connections-request");
15
+ const print_warnings_1 = require("../helpers/print-warnings");
15
16
  exports.TYPE_OPTIONS = [
16
17
  "item",
17
18
  "variation",
@@ -47,6 +48,9 @@ async function executeTemplate(options) {
47
48
  if (!result.success) {
48
49
  throw new Error(`Error executing template: ${result.error.message}`);
49
50
  }
51
+ if (result.warnings.length > 0) {
52
+ (0, print_warnings_1.printExecutionWarnings)(result.warnings);
53
+ }
50
54
  return result.data;
51
55
  }
52
56
  function initializeOptions(options) {
@@ -0,0 +1,3 @@
1
+ import { type TemplateValidatorWarning } from "../types";
2
+ export declare function printExecutionWarnings(warnings: TemplateValidatorWarning[]): void;
3
+ //# sourceMappingURL=print-warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-warnings.d.ts","sourceRoot":"","sources":["../../src/helpers/print-warnings.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,QA6B1E"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.printExecutionWarnings = printExecutionWarnings;
7
+ const core_1 = require("@oclif/core");
8
+ const kleur_1 = __importDefault(require("kleur"));
9
+ const terminal_link_1 = __importDefault(require("terminal-link"));
10
+ function printExecutionWarnings(warnings) {
11
+ const originalLength = warnings.length;
12
+ if (warnings.length > 10) {
13
+ warnings = warnings.slice(0, 10);
14
+ }
15
+ core_1.ux.log();
16
+ 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 ⬇️`)));
17
+ core_1.ux.log();
18
+ warnings.forEach((warning) => {
19
+ printSingleWarning(warning);
20
+ });
21
+ if (originalLength > 10) {
22
+ core_1.ux.log(`... and ${originalLength - 10} more`);
23
+ }
24
+ core_1.ux.log();
25
+ 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`)}`));
26
+ }
27
+ function printSingleWarning(warning) {
28
+ if (warning.critical) {
29
+ core_1.ux.log(kleur_1.default.red(`🚨 [${warning.type}]:`), warning.message);
30
+ }
31
+ else {
32
+ core_1.ux.log(kleur_1.default.yellow(`⚠️ [${warning.type}]:`), warning.message);
33
+ }
34
+ }
@@ -1,8 +1,11 @@
1
1
  import axios from "axios";
2
+ interface HttpClientPayload {
3
+ requiresAuth: boolean;
4
+ }
2
5
  /**
3
6
  * @returns An axios instance with the correct base URL and auth token.
4
7
  */
5
- export declare function getHttpClient(): Promise<axios.AxiosInstance>;
8
+ export declare function getHttpClient({ requiresAuth }?: HttpClientPayload): Promise<axios.AxiosInstance>;
6
9
  /**
7
10
  * Checks if a request should be retried.
8
11
  */
@@ -11,4 +14,5 @@ export declare function checkRetryCondition(error: any): boolean;
11
14
  * Calculates the time in ms to wait before retrying the request.
12
15
  */
13
16
  export declare function calculateRetryDelay(retryCount: number, error: any): 2000 | 500;
17
+ export {};
14
18
  //# sourceMappingURL=http-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AA6B5C;;GAEG;AACH,wBAAsB,aAAa,iCAwDlC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,WAK7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,cAcjE"}
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAA6C,MAAM,OAAO,CAAC;AA6BlE,UAAU,iBAAiB;IACzB,YAAY,EAAE,OAAO,CAAC;CACvB;AAOD;;GAEG;AACH,wBAAsB,aAAa,CACjC,EAAE,YAAY,EAAE,GAAE,iBAEjB,gCA6DF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,WAK7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,cAcjE"}
@@ -66,15 +66,20 @@ const MAX_RETRIES = 3;
66
66
  /**
67
67
  * @returns An axios instance with the correct base URL and auth token.
68
68
  */
69
- async function getHttpClient() {
70
- const token = await (0, get_connect_token_1.getConnectToken)();
69
+ async function getHttpClient({ requiresAuth } = {
70
+ requiresAuth: true,
71
+ }) {
72
+ const headers = {
73
+ "X-CLI-Version": version_1.default,
74
+ };
75
+ if (requiresAuth) {
76
+ const token = await (0, get_connect_token_1.getConnectToken)();
77
+ headers.Authorization = `Bearer ${token}`;
78
+ }
71
79
  const baseURL = process.env.HOST ?? "https://connect.cnstrc.com";
72
80
  const instance = axios_1.default.create({
73
81
  baseURL,
74
- headers: {
75
- Authorization: `Bearer ${token}`,
76
- "X-CLI-Version": version_1.default,
77
- },
82
+ headers,
78
83
  });
79
84
  (0, axios_retry_1.default)(instance, {
80
85
  retries: MAX_RETRIES,
@@ -0,0 +1,7 @@
1
+ export declare function obtainToken(args: ObtainTokenArgs): Promise<string>;
2
+ interface ObtainTokenArgs {
3
+ api_key: string;
4
+ api_token: string;
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=obtain-token-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obtain-token-request.d.ts","sourceRoot":"","sources":["../../src/http/obtain-token-request.ts"],"names":[],"mappings":"AAOA,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBxE;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.obtainToken = obtainToken;
4
+ const axios_1 = require("axios");
5
+ const errors_1 = require("@oclif/core/lib/errors");
6
+ const ux_action_1 = require("../helpers/ux-action");
7
+ const http_client_1 = require("./http-client");
8
+ async function obtainToken(args) {
9
+ const client = await (0, http_client_1.getHttpClient)({ requiresAuth: false });
10
+ try {
11
+ const response = await (0, ux_action_1.uxAction)("📡 Obtaining connect auth token", async () => {
12
+ return await client.post(`/auth/obtain-token`, args);
13
+ })();
14
+ return response.data.connect_auth_token;
15
+ }
16
+ catch (error) {
17
+ if ((0, axios_1.isAxiosError)(error) && error.response) {
18
+ throw new errors_1.CLIError("Something went wrong while obtaining connect auth token: \n" +
19
+ error.response.data.message +
20
+ "\n" +
21
+ "Please reach out over at partners@constructor.io.");
22
+ }
23
+ throw error;
24
+ }
25
+ }
package/dist/types.d.ts CHANGED
@@ -26,13 +26,20 @@ interface TemplateError {
26
26
  token?: string;
27
27
  snippet?: string[];
28
28
  }
29
+ export interface TemplateValidatorWarning {
30
+ type: string;
31
+ critical: boolean;
32
+ message: string;
33
+ }
29
34
  export interface TemplateExecutionSuccessResponse {
30
35
  success: true;
31
36
  data: Record<string, any>;
37
+ warnings: TemplateValidatorWarning[];
32
38
  }
33
39
  export interface TemplateExecutionErrorResponse {
34
40
  success: false;
35
41
  error: TemplateError;
42
+ warnings: TemplateValidatorWarning[];
36
43
  }
37
44
  export declare enum CatalogFixtureType {
38
45
  ITEM = "item",
@@ -1 +1 @@
1
- {"version":3,"file":"types.d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,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,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,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.9.2";
1
+ declare const _default: "1.11.0";
2
2
  export default _default;
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"wBAAe,OAAO;AAAtB,wBAAuB"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"wBAAe,QAAQ;AAAvB,wBAAwB"}
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.9.2';
3
+ exports.default = '1.11.0';
@@ -171,5 +171,5 @@
171
171
  ]
172
172
  }
173
173
  },
174
- "version": "1.9.2"
174
+ "version": "1.11.0"
175
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.9.2",
3
+ "version": "1.11.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",
@@ -73,7 +73,8 @@
73
73
  "kleur": "^4.1.5",
74
74
  "nanospinner": "^1.2.2",
75
75
  "remeda": "^2.5.0",
76
- "replace-in-file": "^7.2.0"
76
+ "replace-in-file": "^7.2.0",
77
+ "terminal-link": "^2.1.1"
77
78
  },
78
79
  "devDependencies": {
79
80
  "@oclif/test": "^4.0.5",