@opscompass/opscompass-cli 1.0.46 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/colors.js CHANGED
@@ -3,9 +3,10 @@
3
3
 
4
4
  global.yellowText = "\x1b[33m%s\x1b[0m";
5
5
  global.greenText = "\x1b[32m%s\x1b[0m";
6
+ global.redText = "\x1b[31m%s\x1b[0m";
6
7
 
8
+ const yellowText = global.yellowText;
9
+ const greenText = global.greenText;
10
+ const redText = global.redText;
7
11
 
8
- module.exports = {
9
- yellowText,
10
- greenText
11
- };
12
+ export { yellowText, greenText, redText };
package/credentials.js CHANGED
@@ -1,30 +1,21 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { redeemRefreshToken } = require("./oauth");
4
- const { opscompassHome, cliCommand } = require("./environment/current.js");
5
- const {
6
- writeFileToHome
7
- } = require("./lib/homeInteraction.js");
8
- const {
9
- canReadFile, FilePermissions
10
- } = require("./lib/cliHelpers.js");
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { redeemRefreshToken } from "./oauth.js";
4
+ import { opscompassHome, cliCommand } from "./environment/current.js";
5
+ import { writeFileToHome } from "./lib/homeInteraction.js";
6
+ import { canReadFile, FilePermissions } from "./lib/cliHelpers.js";
11
7
 
12
8
  function canReadStoredCredentials() {
13
- return canReadFile(
14
- path.join(
15
- opscompassHome,
16
- "tokens.json"
17
- )
18
- );
9
+ return canReadFile(path.join(opscompassHome, "tokens.json"));
19
10
  }
20
11
 
21
12
  async function storeCredentials(data) {
22
13
  // calculate the expires_at from the expires_in
23
14
  if (data.expires_in) {
24
- data.expires_at = new Date(Date.now() + (data.expires_in * 1000));
15
+ data.expires_at = new Date(Date.now() + data.expires_in * 1000);
25
16
  }
26
17
 
27
- return writeFileToHome('tokens.json', data, 0o600);
18
+ return writeFileToHome("tokens.json", data, 0o600);
28
19
  }
29
20
 
30
21
  async function getCredentials() {
@@ -32,7 +23,7 @@ async function getCredentials() {
32
23
  return new Promise((resolve, reject) => {
33
24
  try {
34
25
  fs.readFile(
35
- path.join(opscompassHome, 'tokens.json'),
26
+ path.join(opscompassHome, "tokens.json"),
36
27
  async (err, data) => {
37
28
  try {
38
29
  // if the read failed, reject
@@ -43,11 +34,13 @@ async function getCredentials() {
43
34
 
44
35
  const tokensData = JSON.parse(data.toString());
45
36
  const expires_at = new Date(tokensData.expires_at);
46
-
37
+
47
38
  // if the token has already expired,
48
39
  // redeem the refresh token and return that
49
40
  if (new Date() > expires_at && tokensData.refresh_token) {
50
- const refreshedTokenResponse = await redeemRefreshToken(tokensData.refresh_token);
41
+ const refreshedTokenResponse = await redeemRefreshToken(
42
+ tokensData.refresh_token,
43
+ );
51
44
  const refreshedTokenData = refreshedTokenResponse.data;
52
45
  await storeCredentials(refreshedTokenData);
53
46
  resolve(refreshedTokenData);
@@ -57,10 +50,12 @@ async function getCredentials() {
57
50
  } catch (innerError) {
58
51
  reject();
59
52
  console.log();
60
- console.warn(`You aren't logged in. Please run '${cliCommand} login' to log in.`)
53
+ console.warn(
54
+ `You aren't logged in. Please run '${cliCommand} login' to log in.`,
55
+ );
61
56
  console.log();
62
- }
63
- }
57
+ }
58
+ },
64
59
  );
65
60
  } catch (e) {
66
61
  // this should only happen if the path can't be built
@@ -69,8 +64,4 @@ async function getCredentials() {
69
64
  });
70
65
  }
71
66
 
72
- module.exports = {
73
- canReadStoredCredentials,
74
- getCredentials,
75
- storeCredentials,
76
- };
67
+ export { canReadStoredCredentials, getCredentials, storeCredentials };
@@ -1,14 +1,14 @@
1
1
  // production: OpsCompassClient is referenced from npm package
2
2
 
3
- const {
3
+ import {
4
4
  OpsCompassClient,
5
5
  ScriptType,
6
6
  OAuthHandler,
7
7
  licenseManagerConfigurationTypes,
8
- } = require("@opscompass/opscompass-api");
8
+ } from "@opscompass/opscompass-api";
9
9
 
10
- const path = require("path");
11
- const { homedir } = require("os");
10
+ import path from "path";
11
+ import { homedir } from "os";
12
12
  const opscompassHome = path.join(homedir(), ".opscompass");
13
13
  const cliCommand = "opscompass";
14
14
 
@@ -18,7 +18,7 @@ const clientId = "vOakDaOv4L26f3uuI4sp3KC1Sov3nsW2";
18
18
  const oAuthClient = new OAuthHandler(clientId);
19
19
  const isLocal = false;
20
20
 
21
- module.exports = {
21
+ export {
22
22
  OpsCompassClient,
23
23
  licenseManagerConfigurationTypes,
24
24
  ScriptType,
@@ -26,5 +26,5 @@ module.exports = {
26
26
  opscompassHome,
27
27
  isLocal,
28
28
  cliCommand,
29
- decoder: "TjFXOWhWdnppb2Zoa2ZFcmd1TWI",
30
29
  };
30
+ export const decoder = "TjFXOWhWdnppb2Zoa2ZFcmd1TWI";
@@ -1,14 +1,14 @@
1
1
  // demo: @opscompass/opscompass-api-demo
2
2
 
3
- const {
3
+ import {
4
4
  OpsCompassClient,
5
5
  ScriptType,
6
6
  OAuthHandler,
7
7
  licenseManagerConfigurationTypes,
8
- } = require("@opscompass/opscompass-api-demo");
8
+ } from "@opscompass/opscompass-api-demo";
9
9
 
10
- const path = require("path");
11
- const { homedir } = require("os");
10
+ import path from "path";
11
+ import { homedir } from "os";
12
12
  const opscompassHome = path.join(homedir(), ".opscompassdemo");
13
13
  const cliCommand = "opscompassdemo";
14
14
 
@@ -18,7 +18,7 @@ const audience = "https://opscompass-api-demo.azure-api.net";
18
18
  const oAuthClient = new OAuthHandler(clientId, authDomain, audience);
19
19
  const isLocal = false;
20
20
 
21
- module.exports = {
21
+ export {
22
22
  OpsCompassClient,
23
23
  licenseManagerConfigurationTypes,
24
24
  ScriptType,
@@ -26,5 +26,5 @@ module.exports = {
26
26
  opscompassHome,
27
27
  isLocal,
28
28
  cliCommand,
29
- decoder: "TjFXOWhWdnppb2Zoa2ZFcmd1TWI",
30
29
  };
30
+ export const decoder = "TjFXOWhWdnppb2Zoa2ZFcmd1TWI";
@@ -1,14 +1,14 @@
1
1
  // dev: @opscompass/opscompass-api-dev
2
2
 
3
- const {
3
+ import {
4
4
  OpsCompassClient,
5
5
  ScriptType,
6
6
  OAuthHandler,
7
7
  licenseManagerConfigurationTypes,
8
- } = require("@opscompass/opscompass-api-dev");
8
+ } from "@opscompass/opscompass-api-dev";
9
9
 
10
- const path = require("path");
11
- const { homedir } = require("os");
10
+ import path from "path";
11
+ import { homedir } from "os";
12
12
  const opscompassHome = path.join(homedir(), ".opscompassdev");
13
13
  const cliCommand = "opscompassdev";
14
14
 
@@ -18,7 +18,7 @@ const audience = "https://fa-sampleapi-cus-dev.azurewebsites.net";
18
18
  const oAuthClient = new OAuthHandler(clientId, authDomain, audience);
19
19
  const isLocal = false;
20
20
 
21
- module.exports = {
21
+ export {
22
22
  OpsCompassClient,
23
23
  licenseManagerConfigurationTypes,
24
24
  ScriptType,
@@ -26,5 +26,5 @@ module.exports = {
26
26
  opscompassHome,
27
27
  isLocal,
28
28
  cliCommand,
29
- decoder: "TjFXOWhWdnppb2Zoa2ZFcmd1TWI",
30
29
  };
30
+ export const decoder = "TjFXOWhWdnppb2Zoa2ZFcmd1TWI";
@@ -1,15 +1,15 @@
1
1
  // local: @opscompass/opscompass-api is pointing to the local file system.
2
2
  // set up your local functions to use dev's token settings.
3
3
 
4
- const {
4
+ import {
5
5
  OpsCompassClient,
6
6
  ScriptType,
7
7
  OAuthHandler,
8
8
  licenseManagerConfigurationTypes,
9
- } = require("@opscompass/opscompass-api");
9
+ } from "@opscompass/opscompass-api";
10
10
 
11
- const path = require("path");
12
- const { homedir } = require("os");
11
+ import path from "path";
12
+ import { homedir } from "os";
13
13
  const opscompassHome = path.join(homedir(), ".opscompassdev");
14
14
  const cliCommand = "opscompassdev";
15
15
 
@@ -19,7 +19,7 @@ const audience = "https://fa-sampleapi-cus-dev.azurewebsites.net";
19
19
  const oAuthClient = new OAuthHandler(clientId, authDomain, audience);
20
20
  const isLocal = true;
21
21
 
22
- module.exports = {
22
+ export {
23
23
  OpsCompassClient,
24
24
  licenseManagerConfigurationTypes,
25
25
  ScriptType,
@@ -27,5 +27,5 @@ module.exports = {
27
27
  opscompassHome,
28
28
  isLocal,
29
29
  cliCommand,
30
- decoder: "TjFXOWhWdnppb2Zoa2ZFcmd1TWI",
31
30
  };
31
+ export const decoder = "TjFXOWhWdnppb2Zoa2ZFcmd1TWI";
@@ -1,14 +1,14 @@
1
1
  // production: OpsCompassClient is referenced from npm package
2
2
 
3
- const {
3
+ import {
4
4
  OpsCompassClient,
5
5
  ScriptType,
6
6
  OAuthHandler,
7
7
  licenseManagerConfigurationTypes,
8
- } = require("@opscompass/opscompass-api");
8
+ } from "@opscompass/opscompass-api";
9
9
 
10
- const path = require("path");
11
- const { homedir } = require("os");
10
+ import path from "path";
11
+ import { homedir } from "os";
12
12
  const opscompassHome = path.join(homedir(), ".opscompass");
13
13
  const cliCommand = "opscompass";
14
14
 
@@ -18,7 +18,7 @@ const clientId = "vOakDaOv4L26f3uuI4sp3KC1Sov3nsW2";
18
18
  const oAuthClient = new OAuthHandler(clientId);
19
19
  const isLocal = false;
20
20
 
21
- module.exports = {
21
+ export {
22
22
  OpsCompassClient,
23
23
  licenseManagerConfigurationTypes,
24
24
  ScriptType,
@@ -26,5 +26,5 @@ module.exports = {
26
26
  opscompassHome,
27
27
  isLocal,
28
28
  cliCommand,
29
- decoder: "TjFXOWhWdnppb2Zoa2ZFcmd1TWI",
30
29
  };
30
+ export const decoder = "TjFXOWhWdnppb2Zoa2ZFcmd1TWI";
package/error.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = function handleError(e) {
1
+ export default function handleError(e) {
2
2
  // if there's no error, there's nothing to handle.
3
3
  if (!e) return;
4
4
 
package/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const modules = require("./modules.js");
4
- const handleError = require("./error.js");
5
- const { canReadStoredCredentials } = require("./credentials.js");
6
- const { isLocal, opscompassHome } = require("./environment/current.js");
3
+ import modules from "./modules.js";
4
+ import handleError from "./error.js";
5
+ import { canReadStoredCredentials } from "./credentials.js";
6
+ import { isLocal, opscompassHome } from "./environment/current.js";
7
+ import pkg from "./package.json" with { type: "json" };
7
8
 
8
- const fs = require("fs");
9
- const path = require("path");
9
+ import fs from "fs";
10
+ import path from "path";
11
+
12
+ import semver from "semver";
13
+ import { yellowText, redText } from "./colors.js";
10
14
 
11
15
  let defaultParams = JSON.parse("{}");
12
16
 
@@ -17,7 +21,7 @@ try {
17
21
  }
18
22
  } catch (error) {
19
23
  console.error(
20
- `Error: Unable to create Opscompass home directory at ${opscompassHome}: ${error.message}`
24
+ `Error: Unable to create Opscompass home directory at ${opscompassHome}: ${error.message}`,
21
25
  );
22
26
  process.exit(1);
23
27
  }
@@ -27,10 +31,9 @@ let isOffline = false;
27
31
  const offlinePath = path.join(opscompassHome, ".offline");
28
32
  if (fs.existsSync(offlinePath)) {
29
33
  isOffline = true;
30
- console.error(" NOTE: Using CLI in offline mode");
31
34
  }
32
35
  global.isOffline = isOffline;
33
- const { versionCheck } = require("./updates.js");
36
+ const { versionCheck } = await import("./updates.js");
34
37
 
35
38
  function checkDefaults() {
36
39
  const defaultsPath = path.join(opscompassHome, "defaults.json");
@@ -45,17 +48,17 @@ function checkDefaults() {
45
48
  * When an individual string is passed to the API, default param will be provided if it exists.
46
49
  * Default value is overwritten when explicitly included in CLI command.
47
50
  */
48
- companySlug = defaultParams.company;
49
- company = defaultParams.company;
50
- account = defaultParams.account;
51
- monitoringConfig = defaultParams.monitoringConfiguration;
52
- valuesMask = defaultParams.maskValues || [];
51
+ global.companySlug = defaultParams.company;
52
+ global.company = defaultParams.company;
53
+ global.account = defaultParams.account;
54
+ global.monitoringConfig = defaultParams.monitoringConfiguration;
55
+ global.valuesMask = defaultParams.maskValues || [];
53
56
 
54
57
  /**
55
58
  * When a callParams object is passed to the API rather than one of the above strings, default values will be used unless explicitly replaced.
56
59
  * Other properties can still be added to the callParams object. Unneeded default parameters may be included, but are ignored by the API.
57
60
  */
58
- callParams = defaultParams;
61
+ global.callParams = defaultParams;
59
62
  }
60
63
 
61
64
  function requiresLogin() {
@@ -71,7 +74,7 @@ function help() {
71
74
  console.log();
72
75
  console.log("Command format:");
73
76
  console.log(
74
- " opscompass module action --parameter1 value --parameter2 value"
77
+ " opscompass module action --parameter1 value --parameter2 value",
75
78
  );
76
79
  console.log();
77
80
  console.log("Available modules:");
@@ -84,18 +87,17 @@ function help() {
84
87
  }
85
88
 
86
89
  (async function () {
90
+ let versionCheckPromise;
87
91
  if (!isLocal) {
88
- versionCheck();
92
+ versionCheckPromise = versionCheck();
89
93
  }
90
-
91
94
  checkDefaults();
92
95
 
93
96
  const [proc, command, commandModule, ...args] = process.argv;
94
97
  const moduleName = commandModule?.toLowerCase() ?? "";
95
98
  if (moduleName === "" || moduleName === "help") {
96
- return help();
97
- }
98
- if (modules[moduleName]) {
99
+ help();
100
+ } else if (modules[moduleName]) {
99
101
  const module = modules[moduleName];
100
102
  if (!module.requiresLogin || loggedIn()) {
101
103
  try {
@@ -111,10 +113,27 @@ function help() {
111
113
  requiresLogin();
112
114
  }
113
115
  } else if (moduleName === "version") {
114
- const pkg = require("./package.json");
115
116
  console.log(`${pkg.name} ${pkg.version}`);
116
117
  } else {
117
118
  console.error(`Unknown module, "${moduleName}"`);
118
- return help();
119
+ help();
120
+ }
121
+
122
+ // Wait for version check to complete and show output at the end
123
+ if (versionCheckPromise) {
124
+ const versions = await versionCheckPromise;
125
+ /* Semver used to semantically compare version numbers */
126
+ if (versions && semver.gt(versions.latest, pkg.version)) {
127
+ console.error(
128
+ yellowText,
129
+ `Warning! You are using CLI version ${pkg.version}, but the latest version is ${versions.latest}. To upgrade to the latest version, please run:`,
130
+ );
131
+
132
+ /* Prompt user to upgrade to the correct package based on their current environment */
133
+ console.error(
134
+ greenText,
135
+ `\nnpm install -g ${versions.pkg}@${versions.latest}\n`,
136
+ );
137
+ }
119
138
  }
120
139
  })();
package/lib/cliHelpers.js CHANGED
@@ -1,14 +1,32 @@
1
- const fs = require("fs-extra");
2
- const https = require("https");
3
- const path = require("path");
4
- const AdmZip = require("adm-zip");
1
+ import fs from "fs-extra";
2
+ import https from "https";
3
+ import path from "path";
4
+ import AdmZip from "adm-zip";
5
5
 
6
6
  let httpsProxyAgent;
7
- if (process.env.https_proxy || process.env.HTTPS_PROXY) {
8
- const createHttpsProxyAgent = require("https-proxy-agent");
9
- httpsProxyAgent = createHttpsProxyAgent(
10
- process.env.https_proxy || process.env.HTTPS_PROXY
11
- );
7
+ let proxyAgentPromise;
8
+
9
+ // Lazy load the proxy agent when needed
10
+ function getHttpsProxyAgent() {
11
+ if (httpsProxyAgent) {
12
+ return httpsProxyAgent;
13
+ }
14
+
15
+ if (
16
+ !proxyAgentPromise &&
17
+ (process.env.https_proxy || process.env.HTTPS_PROXY)
18
+ ) {
19
+ proxyAgentPromise = import("https-proxy-agent").then(
20
+ ({ createHttpsProxyAgent }) => {
21
+ httpsProxyAgent = createHttpsProxyAgent(
22
+ process.env.https_proxy || process.env.HTTPS_PROXY,
23
+ );
24
+ return httpsProxyAgent;
25
+ },
26
+ );
27
+ }
28
+
29
+ return proxyAgentPromise || null;
12
30
  }
13
31
 
14
32
  /**
@@ -107,11 +125,12 @@ function deleteDirectory(directoryPath) {
107
125
  * @returns {Promise<void>} Returns once the download is complete
108
126
  */
109
127
  async function downloadFile(downloadUrl, downloadFilePath, downloadName) {
110
- return new Promise((resolve, reject) => {
128
+ return new Promise(async (resolve, reject) => {
111
129
  const getOptions = {};
112
130
 
113
- if (httpsProxyAgent) {
114
- getOptions.agent = httpsProxyAgent;
131
+ const proxyAgent = await getHttpsProxyAgent();
132
+ if (proxyAgent) {
133
+ getOptions.agent = proxyAgent;
115
134
  }
116
135
 
117
136
  // Download the file
@@ -119,7 +138,7 @@ async function downloadFile(downloadUrl, downloadFilePath, downloadName) {
119
138
  .get(downloadUrl, getOptions, (res) => {
120
139
  // Open file in local filesystem
121
140
  const file = fs.createWriteStream(
122
- path.join(downloadFilePath, downloadName)
141
+ path.join(downloadFilePath, downloadName),
123
142
  );
124
143
 
125
144
  // Write data into local file
@@ -162,7 +181,7 @@ async function unzipFile(unzipFileLocation, unzipFileName) {
162
181
  * @returns {string[]} all file paths recursively for the passed in directory path
163
182
  */
164
183
  function getAllFilesInFolder(dirPath) {
165
- files = fs.readdirSync(dirPath);
184
+ let files = fs.readdirSync(dirPath);
166
185
 
167
186
  var arrayOfFiles = arrayOfFiles || [];
168
187
 
@@ -232,7 +251,7 @@ const FilePermissions = {
232
251
  userReadWrite: 600,
233
252
  };
234
253
 
235
- module.exports = {
254
+ export {
236
255
  setArgumentArrays,
237
256
  writeFile,
238
257
  deleteFile,
package/lib/consts.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true,
5
- });
6
-
7
3
  // Resources to check for sensitive attributes
8
- const resourceTypes = {
4
+ export const resourceTypes = {
9
5
  oracle_dbs: "oracle_dbs",
10
6
  microsoft_dbs: "microsoft_dbs",
11
7
  vcenters: "vcenters",
@@ -13,14 +9,9 @@ const resourceTypes = {
13
9
  };
14
10
 
15
11
  // Sensitive attributes to be encrypted by default
16
- const encryptAttrs = {
12
+ export const encryptAttrs = {
17
13
  username: "username",
18
14
  user: "user",
19
15
  password: "password",
20
16
  connect: "connect",
21
17
  };
22
-
23
- module.exports = {
24
- encryptAttrs,
25
- resourceTypes,
26
- };
@@ -1,13 +1,13 @@
1
- const fs = require("fs-extra");
2
- const path = require("path");
3
- const pgp = require("./pgpTools.js");
1
+ import fs from "fs-extra";
2
+ import path from "path";
3
+ import { Verify } from "./pgpTools.js";
4
4
 
5
- const {
5
+ import {
6
6
  opscompassHome,
7
7
  ScriptType,
8
8
  OpsCompassClient,
9
- } = require("../environment/current.js");
10
- const {
9
+ } from "../environment/current.js";
10
+ import {
11
11
  findOrCreateFolder,
12
12
  deleteDirectory,
13
13
  downloadFile,
@@ -18,10 +18,10 @@ const {
18
18
  canReadFile,
19
19
  FilePermissions,
20
20
  getAllFilesInFolder,
21
- } = require("./cliHelpers.js");
22
- const { nextTick } = require("process");
21
+ } from "./cliHelpers.js";
22
+ import { nextTick } from "process";
23
23
 
24
- const semver = require("semver");
24
+ import semver from "semver";
25
25
 
26
26
  const SRC_FOLDER_NAME = "src";
27
27
  const METADATA_FILE_NAME = "metadata.json";
@@ -45,7 +45,7 @@ async function writeFileToHome(fileName, data, mode) {
45
45
  path.join(opscompassHome, fileName),
46
46
  JSON.stringify(data),
47
47
  { mode: mode },
48
- () => resolve()
48
+ () => resolve(),
49
49
  );
50
50
  } catch (ex) {
51
51
  reject(ex);
@@ -137,7 +137,7 @@ async function downloadScriptsToHome(
137
137
  scriptVersion,
138
138
  companySlug,
139
139
  client,
140
- scriptsRemote = undefined
140
+ scriptsRemote = undefined,
141
141
  ) {
142
142
  // If scriptsRemote is provided, use it instead of fetching from api
143
143
  if (!!scriptsRemote) {
@@ -147,15 +147,14 @@ async function downloadScriptsToHome(
147
147
  // Ensure base scripts are downloaded/updated for all modules
148
148
  if (scriptType !== ScriptType.baseScripts) {
149
149
  const localBaseVersion = await getInstalledScriptVersion(
150
- ScriptType.baseScripts
150
+ ScriptType.baseScripts,
151
151
  );
152
152
 
153
153
  // Determine what is available
154
154
  if (!scriptsAvailable) {
155
155
  console.log("Fetching remote versions...");
156
- scriptsAvailable = await client.dataGatheringScripts.getScriptVersions(
157
- companySlug
158
- );
156
+ scriptsAvailable =
157
+ await client.dataGatheringScripts.getScriptVersions(companySlug);
159
158
  }
160
159
 
161
160
  var availableBase = undefined;
@@ -164,7 +163,7 @@ async function downloadScriptsToHome(
164
163
  scriptsAvailable.versions?.length > 0
165
164
  ) {
166
165
  availableBase = scriptsAvailable.versions.find(
167
- (version) => version.scriptType === ScriptType.baseScripts
166
+ (version) => version.scriptType === ScriptType.baseScripts,
168
167
  );
169
168
  }
170
169
 
@@ -178,7 +177,7 @@ async function downloadScriptsToHome(
178
177
  ScriptType.baseScripts,
179
178
  undefined,
180
179
  companySlug,
181
- client
180
+ client,
182
181
  );
183
182
  console.log("Base scripts updated (v%s)", baseVersion);
184
183
  }
@@ -188,7 +187,7 @@ async function downloadScriptsToHome(
188
187
  const scriptDownloadInfo = await client.dataGatheringScripts.getScriptsUrl(
189
188
  companySlug,
190
189
  scriptType,
191
- scriptVersion
190
+ scriptVersion,
192
191
  );
193
192
  const scriptTypeFolderPath = findOrCreateScriptTypeFolder(scriptType);
194
193
  const fileName = scriptDownloadInfo.fileName;
@@ -198,14 +197,14 @@ async function downloadScriptsToHome(
198
197
  await downloadFile(
199
198
  scriptDownloadInfo.downloadUrl,
200
199
  scriptTypeFolderPath,
201
- fileName
200
+ fileName,
202
201
  );
203
202
 
204
203
  // Attempt to verify the download - returns true if signed and verified
205
204
  // outputs validation error(s) and returns false otherwise
206
205
  // - we continue regardless of validation for now...
207
206
  scriptDownloadInfo.filePath = path.join(scriptTypeFolderPath, fileName);
208
- const zipValidated = await pgp.Verify(scriptDownloadInfo);
207
+ const zipValidated = await Verify(scriptDownloadInfo);
209
208
 
210
209
  await unzipFile(scriptTypeFolderPath, fileName);
211
210
 
@@ -213,7 +212,7 @@ async function downloadScriptsToHome(
213
212
  const destinationPath = path.join(scriptTypeFolderPath, SRC_FOLDER_NAME);
214
213
  await moveFolder(
215
214
  path.join(scriptTypeFolderPath, scriptVersion),
216
- destinationPath
215
+ destinationPath,
217
216
  );
218
217
 
219
218
  // File permissions should be set by the pipeline that builds the distribution bundle
@@ -284,7 +283,7 @@ async function setScriptMetadata(scriptFolderPath, scriptVersion) {
284
283
  await writeFile(metadataFilePath, scriptMetadata);
285
284
  }
286
285
 
287
- module.exports = {
286
+ export {
288
287
  SRC_FOLDER_NAME,
289
288
  BASE_SCRIPTS_RUN_ALL_RELATIVE_PATH,
290
289
  writeFileToHome,