azure-devops-task-utils 5.0.1 → 6.0.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/lib/api.js CHANGED
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.setReleaseVariableFromApi = exports.createWebApi = exports.testConnection = void 0;
12
+ exports.testConnection = testConnection;
13
+ exports.createWebApi = createWebApi;
14
+ exports.setReleaseVariableFromApi = setReleaseVariableFromApi;
13
15
  const azure_devops_node_api_1 = require("azure-devops-node-api");
14
16
  function testConnection(webApi) {
15
17
  return __awaiter(this, void 0, void 0, function* () {
@@ -19,7 +21,6 @@ function testConnection(webApi) {
19
21
  return connData;
20
22
  });
21
23
  }
22
- exports.testConnection = testConnection;
23
24
  function createWebApi(serverUrl, token, apiOptions) {
24
25
  try {
25
26
  const authHandler = (0, azure_devops_node_api_1.getHandlerFromToken)(token);
@@ -27,10 +28,9 @@ function createWebApi(serverUrl, token, apiOptions) {
27
28
  return webApi;
28
29
  }
29
30
  catch (err) {
30
- throw new Error(err.message);
31
+ throw new Error(err.message, { cause: err });
31
32
  }
32
33
  }
33
- exports.createWebApi = createWebApi;
34
34
  function setReleaseVariableFromApi(webApi, project, releaseId, variableName, configurationVariable) {
35
35
  return __awaiter(this, void 0, void 0, function* () {
36
36
  try {
@@ -45,8 +45,7 @@ function setReleaseVariableFromApi(webApi, project, releaseId, variableName, con
45
45
  }
46
46
  }
47
47
  catch (error) {
48
- throw new Error(error.message);
48
+ throw new Error(error.message, { cause: error });
49
49
  }
50
50
  });
51
51
  }
52
- exports.setReleaseVariableFromApi = setReleaseVariableFromApi;
package/lib/task.js CHANGED
@@ -9,13 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.setReleaseVariable = exports.getWebApi = exports.getProject = exports.getVariableRequired = exports.isVariable = void 0;
12
+ exports.isVariable = isVariable;
13
+ exports.getVariableRequired = getVariableRequired;
14
+ exports.getProject = getProject;
15
+ exports.getWebApi = getWebApi;
16
+ exports.setReleaseVariable = setReleaseVariable;
13
17
  const api_1 = require("./api");
14
18
  const azure_pipelines_task_lib_1 = require("azure-pipelines-task-lib");
15
19
  function isVariable(name) {
16
20
  return !!(0, azure_pipelines_task_lib_1.getVariable)(name);
17
21
  }
18
- exports.isVariable = isVariable;
19
22
  function getVariableRequired(name, customMessage) {
20
23
  const value = (0, azure_pipelines_task_lib_1.getVariable)(name);
21
24
  if (!value) {
@@ -26,19 +29,16 @@ function getVariableRequired(name, customMessage) {
26
29
  (0, azure_pipelines_task_lib_1.debug)(`${name} = ${value}`);
27
30
  return value;
28
31
  }
29
- exports.getVariableRequired = getVariableRequired;
30
32
  function getProject() {
31
33
  return getVariableRequired('SYSTEM_TEAMPROJECTID');
32
34
  }
33
- exports.getProject = getProject;
34
35
  function getWebApi(apiOptions) {
35
36
  const serverUrl = getVariableRequired('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI');
36
37
  const token = getVariableRequired('SYSTEM_ACCESSTOKEN', 'Remember to enable in the agent "Allow scripts to access the OAuth token"');
37
38
  return (0, api_1.createWebApi)(serverUrl, token, apiOptions);
38
39
  }
39
- exports.getWebApi = getWebApi;
40
- function setReleaseVariable(releaseId, variableName, variableValue, allowOverride = true, isSecret = false) {
41
- return __awaiter(this, void 0, void 0, function* () {
40
+ function setReleaseVariable(releaseId_1, variableName_1, variableValue_1) {
41
+ return __awaiter(this, arguments, void 0, function* (releaseId, variableName, variableValue, allowOverride = true, isSecret = false) {
42
42
  try {
43
43
  const webApi = getWebApi();
44
44
  const project = getProject();
@@ -51,8 +51,7 @@ function setReleaseVariable(releaseId, variableName, variableValue, allowOverrid
51
51
  return yield (0, api_1.setReleaseVariableFromApi)(webApi, project, releaseId, variableName, variableConfiguration);
52
52
  }
53
53
  catch (error) {
54
- throw new Error(error.message);
54
+ throw new Error(error.message, { cause: error });
55
55
  }
56
56
  });
57
57
  }
58
- exports.setReleaseVariable = setReleaseVariable;
package/lib/utils.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.heading = exports.banner = exports.retryPromise = exports.retryFunction = void 0;
3
+ exports.retryPromise = exports.retryFunction = void 0;
4
+ exports.banner = banner;
5
+ exports.heading = heading;
4
6
  var polallel_1 = require("polallel");
5
7
  Object.defineProperty(exports, "retryFunction", { enumerable: true, get: function () { return polallel_1.retryFunction; } });
6
8
  Object.defineProperty(exports, "retryPromise", { enumerable: true, get: function () { return polallel_1.retryPromise; } });
@@ -11,9 +13,7 @@ function banner(title) {
11
13
  console.log('=======================================');
12
14
  console.log();
13
15
  }
14
- exports.banner = banner;
15
16
  function heading(title) {
16
17
  console.log();
17
18
  console.log('> ' + title);
18
19
  }
19
- exports.heading = heading;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-devops-task-utils",
3
- "version": "5.0.1",
3
+ "version": "6.0.0",
4
4
  "description": "Utility library for Azure DevOps tasks",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -31,22 +31,24 @@
31
31
  },
32
32
  "homepage": "https://github.com/davidpolaniaac/azure-devops-task-utils.git#readme",
33
33
  "dependencies": {
34
- "azure-devops-node-api": "^12.1.0",
35
- "azure-pipelines-task-lib": "^4.7.0",
34
+ "azure-devops-node-api": "^17.0.0",
35
+ "azure-pipelines-task-lib": "^5.279.0",
36
36
  "polallel": "^1.1.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/jest": "^29.5.11",
40
- "@types/node": "^20.10.5",
41
- "@typescript-eslint/eslint-plugin": "^6.15.0",
42
- "@typescript-eslint/parser": "^6.15.0",
43
- "eslint": "^8.56.0",
44
- "eslint-config-prettier": "^9.1.0",
45
- "eslint-plugin-prettier": "^5.1.1",
46
- "jest": "^29.7.0",
47
- "prettier": "^3.1.1",
48
- "rimraf": "^5.0.5",
49
- "ts-jest": "^29.1.1",
50
- "typescript": "^5.3.3"
39
+ "@eslint/eslintrc": "^3.3.7",
40
+ "@eslint/js": "^10.0.1",
41
+ "@types/jest": "^30.0.0",
42
+ "@types/node": "^22.20.2",
43
+ "@typescript-eslint/eslint-plugin": "^8.70.0",
44
+ "@typescript-eslint/parser": "^8.70.0",
45
+ "eslint": "^10.10.0",
46
+ "eslint-config-prettier": "^10.1.8",
47
+ "eslint-plugin-prettier": "^5.5.6",
48
+ "jest": "^30.5.1",
49
+ "prettier": "^3.9.6",
50
+ "rimraf": "^6.1.3",
51
+ "ts-jest": "^29.4.12",
52
+ "typescript": "^6.0.3"
51
53
  }
52
54
  }