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

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.
@@ -2,5 +2,14 @@ import { Command } from "@oclif/core";
2
2
  export declare abstract class RefreshConnectionsCommand extends Command {
3
3
  abstract runCommand(): Promise<any>;
4
4
  run(): Promise<any>;
5
+ /**
6
+ * Checks if the connections list should be automatically refreshed if
7
+ * 1) IS_CI environment variable is not true; and
8
+ * 2) AUTO_REFRESH_CONNECTIONS environment variable set to "true", true,
9
+ * or if it is undefined (in which case it will be set to true).
10
+ *
11
+ * @returns {boolean} - true if the connections list should be refreshed, false otherwise.
12
+ */
13
+ private shouldAutoRefreshConnections;
5
14
  }
6
15
  //# sourceMappingURL=refresh-connections-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-connections-command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAM1B"}
1
+ {"version":3,"file":"refresh-connections-command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAOzB;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;CAerC"}
@@ -3,12 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefreshConnectionsCommand = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const refresh_connections_list_1 = require("../helpers/refresh-connections-list");
6
+ const prepend_file_sync_1 = require("../helpers/prepend-file-sync");
6
7
  class RefreshConnectionsCommand extends core_1.Command {
7
8
  async run() {
8
- if (!process.env.IS_CI && process.env.AUTO_REFRESH_CONNECTIONS) {
9
+ if (this.shouldAutoRefreshConnections()) {
9
10
  await (0, refresh_connections_list_1.refreshConnectionsList)();
10
11
  }
11
12
  return await this.runCommand();
12
13
  }
14
+ /**
15
+ * Checks if the connections list should be automatically refreshed if
16
+ * 1) IS_CI environment variable is not true; and
17
+ * 2) AUTO_REFRESH_CONNECTIONS environment variable set to "true", true,
18
+ * or if it is undefined (in which case it will be set to true).
19
+ *
20
+ * @returns {boolean} - true if the connections list should be refreshed, false otherwise.
21
+ */
22
+ shouldAutoRefreshConnections() {
23
+ if (process.env.IS_CI === "true") {
24
+ return false;
25
+ }
26
+ if (process.env.AUTO_REFRESH_CONNECTIONS === undefined) {
27
+ (0, prepend_file_sync_1.prependFileSync)(".env", `AUTO_REFRESH_CONNECTIONS=true\n`);
28
+ // Manually set it to true otherwise any access to it within
29
+ // the same process will be outdated (will still return undefined)
30
+ process.env.AUTO_REFRESH_CONNECTIONS = "true";
31
+ }
32
+ return process.env.AUTO_REFRESH_CONNECTIONS === "true";
33
+ }
13
34
  }
14
35
  exports.RefreshConnectionsCommand = RefreshConnectionsCommand;
@@ -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,eAIvB,OAAO,KACf,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,CAyCnB;AAED,eAAO,MAAM,eAAe,aA5Cf,OAAO,KACf,OAAO,CAAC,MAAM,CA2CkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-fixture.d.ts","sourceRoot":"","sources":["../../src/functions/build-fixture.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,SACjB,MAAM,QACN,MAAM,iBACE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAKtC,CAAC"}
1
+ {"version":3,"file":"build-fixture.d.ts","sourceRoot":"","sources":["../../src/functions/build-fixture.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,eAAc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,UAK3C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Makes use of fs.readFileSync and fs.writeFileSync to prepend data to a file synchronously.
3
+ * @param filePath - The path to the file to which data will be prepended.
4
+ * @param newData - The data to prepend to the file.
5
+ */
6
+ export declare function prependFileSync(filePath: string, newData: string): void;
7
+ //# sourceMappingURL=prepend-file-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepend-file-sync.d.ts","sourceRoot":"","sources":["../../src/helpers/prepend-file-sync.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAUvE"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.prependFileSync = prependFileSync;
37
+ const fs = __importStar(require("fs-extra"));
38
+ /**
39
+ * Makes use of fs.readFileSync and fs.writeFileSync to prepend data to a file synchronously.
40
+ * @param filePath - The path to the file to which data will be prepended.
41
+ * @param newData - The data to prepend to the file.
42
+ */
43
+ function prependFileSync(filePath, newData) {
44
+ try {
45
+ const existingData = fs.readFileSync(filePath, "utf8");
46
+ fs.writeFileSync(filePath, newData + existingData);
47
+ }
48
+ catch (error) {
49
+ if (error instanceof Error && error.message?.includes("ENOENT")) {
50
+ // If the file does not exist, create it with the new data
51
+ fs.writeFileSync(filePath, newData);
52
+ }
53
+ }
54
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ux-action.d.ts","sourceRoot":"","sources":["../../src/helpers/ux-action.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,aAEmB,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,CA0BxD"}
1
+ {"version":3,"file":"ux-action.d.ts","sourceRoot":"","sources":["../../src/helpers/ux-action.ts"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,IAEU,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,CA0BxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"select-connections.d.ts","sourceRoot":"","sources":["../../src/prompt-data/select-connections.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,aACnB,MAAM,6EA2BhB,CAAC"}
1
+ {"version":3,"file":"select-connections.d.ts","sourceRoot":"","sources":["../../src/prompt-data/select-connections.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,GAC5B,UAAS,MAAgC,6EA2B1C,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.12.2";
1
+ declare const _default: "1.12.3";
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.2';
3
+ exports.default = '1.12.3';
@@ -190,5 +190,5 @@
190
190
  ]
191
191
  }
192
192
  },
193
- "version": "1.12.2"
193
+ "version": "1.12.3"
194
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
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",