@teamscale/coverage-collector 0.0.1-beta.46 → 0.0.1-beta.49

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/coverage-collector",
3
- "version": "0.0.1-beta.46",
3
+ "version": "0.0.1-beta.49",
4
4
  "description": "Collector for JavaScript code coverage information",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.uploadToArtifactory = void 0;
7
7
  const CommonUpload_1 = require("./CommonUpload");
8
8
  const axios_1 = __importDefault(require("axios"));
9
+ const ProxyUpload_1 = require("./ProxyUpload");
9
10
  /**
10
11
  * Uploads a coverage file to artifactory with the provided configuration.
11
12
  */
@@ -40,13 +41,15 @@ async function performArtifactoryUpload(config, form, logger) {
40
41
  }
41
42
  function prepareArtifactoryConfig(config, form) {
42
43
  var _a, _b;
44
+ const proxyConfig = (0, ProxyUpload_1.extractProxyOptions)(config);
43
45
  if (config.artifactory_access_token) {
44
46
  return {
45
47
  headers: {
46
48
  Accept: '*/*',
47
49
  'X-JFrog-Art-Api': config.artifactory_access_token,
48
50
  'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
49
- }
51
+ },
52
+ proxy: proxyConfig
50
53
  };
51
54
  }
52
55
  return {
@@ -57,6 +60,7 @@ function prepareArtifactoryConfig(config, form) {
57
60
  headers: {
58
61
  Accept: '*/*',
59
62
  'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
60
- }
63
+ },
64
+ proxy: proxyConfig
61
65
  };
62
66
  }
@@ -0,0 +1,6 @@
1
+ import { ConfigParameters } from "../utils/ConfigParameters";
2
+ import { AxiosProxyConfig } from "axios";
3
+ /**
4
+ * Creates an AxiosProxyConfig object if proxy variables are provided.
5
+ */
6
+ export declare function extractProxyOptions(config: ConfigParameters): AxiosProxyConfig | undefined;
@@ -0,0 +1,30 @@
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.extractProxyOptions = void 0;
7
+ const url_1 = __importDefault(require("url"));
8
+ /**
9
+ * Creates an AxiosProxyConfig object if proxy variables are provided.
10
+ */
11
+ function extractProxyOptions(config) {
12
+ if (config.http_proxy) {
13
+ // Expected format: http://username:password@host:port/
14
+ // See https://nodejs.org/api/url.html#url-strings-and-url-objects for URL parsing
15
+ const proxyAddress = new url_1.default.URL(config.http_proxy);
16
+ const proxyConfig = {
17
+ protocol: proxyAddress.protocol.replace(':', ''),
18
+ host: proxyAddress.hostname,
19
+ port: +proxyAddress.port,
20
+ };
21
+ if (proxyAddress.username && proxyAddress.password) {
22
+ proxyConfig.auth = {
23
+ username: proxyAddress.username,
24
+ password: proxyAddress.password
25
+ };
26
+ }
27
+ return proxyConfig;
28
+ }
29
+ }
30
+ exports.extractProxyOptions = extractProxyOptions;
@@ -7,6 +7,7 @@ exports.uploadToTeamscale = void 0;
7
7
  const QueryParameters_1 = __importDefault(require("../utils/QueryParameters"));
8
8
  const CommonUpload_1 = require("./CommonUpload");
9
9
  const axios_1 = __importDefault(require("axios"));
10
+ const ProxyUpload_1 = require("./ProxyUpload");
10
11
  /**
11
12
  * Uploads a coverage file to Teamscale with the provided configuration.
12
13
  */
@@ -47,6 +48,7 @@ function prepareTeamscaleConfig(config, form) {
47
48
  headers: {
48
49
  Accept: '*/*',
49
50
  'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
50
- }
51
+ },
52
+ proxy: (0, ProxyUpload_1.extractProxyOptions)(config)
51
53
  };
52
54
  }
@@ -28,6 +28,7 @@ export declare type ConfigParameters = {
28
28
  artifactory_access_token?: string;
29
29
  artifactory_path_suffix?: string;
30
30
  enable_control_port?: number;
31
+ http_proxy?: string;
31
32
  };
32
33
  /**
33
34
  * Construct the object for parsing the command line arguments.
@@ -98,6 +98,10 @@ function buildParameterParser() {
98
98
  help: '(optional): The path within the storage location between the default path and the uploaded artifact.',
99
99
  default: process.env.ARTIFACTORY_PATH_SUFFIX
100
100
  });
101
+ parser.add_argument('--http-proxy', {
102
+ help: '(optional): The HTTP/HTTPS proxy address that should be used in the format: http://host:port/ or http://username:password@host:port/.',
103
+ default: process.env.HTTP_PROXY
104
+ });
101
105
  return parser;
102
106
  }
103
107
  exports.buildParameterParser = buildParameterParser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamscale/coverage-collector",
3
- "version": "0.0.1-beta.46",
3
+ "version": "0.0.1-beta.49",
4
4
  "description": "Collector for JavaScript code coverage information",
5
5
  "main": "dist/src/main.js",
6
6
  "bin": "dist/src/main.js",