azure-pipelines-task-lib 3.1.9 → 3.2.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/README.md CHANGED
@@ -20,7 +20,7 @@ Guidance: [Finding Files](docs/findingfiles.md), [Minimum agent version](docs/mi
20
20
  ## Node 10 Upgrade Notice
21
21
 
22
22
  Azure DevOps is currently working to establish Node 10 as the new preferred runtime for tasks, upgrading from Node 6.
23
- Relevant work is happening in the `master`` branch and the major version should be used with Node 10 is 3.
23
+ Relevant work is happening in the `master` branch and the major version should be used with Node 10 is 3.
24
24
  Previous major version is stored in the `releases/2.x`
25
25
 
26
26
  ### Upgrading to Node 10
package/internal.js CHANGED
@@ -185,10 +185,10 @@ function _loc(key) {
185
185
  }
186
186
  else {
187
187
  if (Object.keys(_resourceFiles).length <= 0) {
188
- _warning(_loc('LIB_ResourceFileNotSet', key));
188
+ _warning("Resource file haven't been set, can't find loc string for key: " + key);
189
189
  }
190
190
  else {
191
- _warning(_loc('LIB_LocStringNotFound', key));
191
+ _warning("Can't find loc string for key: " + key);
192
192
  }
193
193
  locString = key;
194
194
  }
package/mock-task.js CHANGED
@@ -57,6 +57,7 @@ module.exports.setSecret = task.setSecret;
57
57
  module.exports.getTaskVariable = task.getTaskVariable;
58
58
  module.exports.setTaskVariable = task.setTaskVariable;
59
59
  module.exports.getInput = task.getInput;
60
+ module.exports.getInputRequired = task.getInputRequired;
60
61
  module.exports.getBoolInput = task.getBoolInput;
61
62
  module.exports.getDelimitedInput = task.getDelimitedInput;
62
63
  module.exports.filePathSupplied = task.filePathSupplied;
@@ -70,13 +71,21 @@ function getPathInput(name, required, check) {
70
71
  return inval;
71
72
  }
72
73
  module.exports.getPathInput = getPathInput;
74
+ function getPathInputRequired(name, check) {
75
+ return getPathInput(name, true, check);
76
+ }
77
+ module.exports.getPathInputRequired = getPathInputRequired;
73
78
  //-----------------------------------------------------
74
79
  // Endpoint Helpers
75
80
  //-----------------------------------------------------
76
81
  module.exports.getEndpointUrl = task.getEndpointUrl;
82
+ module.exports.getEndpointUrlRequired = task.getEndpointUrlRequired;
77
83
  module.exports.getEndpointDataParameter = task.getEndpointDataParameter;
84
+ module.exports.getEndpointDataParameterRequired = task.getEndpointDataParameterRequired;
78
85
  module.exports.getEndpointAuthorizationScheme = task.getEndpointAuthorizationScheme;
86
+ module.exports.getEndpointAuthorizationSchemeRequired = task.getEndpointAuthorizationSchemeRequired;
79
87
  module.exports.getEndpointAuthorizationParameter = task.getEndpointAuthorizationParameter;
88
+ module.exports.getEndpointAuthorizationParameterRequired = task.getEndpointAuthorizationParameterRequired;
80
89
  module.exports.getEndpointAuthorization = task.getEndpointAuthorization;
81
90
  //-----------------------------------------------------
82
91
  // SecureFile Helpers
@@ -7,8 +7,6 @@ var __extends = (this && this.__extends) || (function () {
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-task-lib",
3
- "version": "3.1.9",
3
+ "version": "3.2.1",
4
4
  "description": "Azure Pipelines Task SDK",
5
5
  "main": "./task.js",
6
6
  "typings": "./task.d.ts",
@@ -31,7 +31,7 @@
31
31
  "mockery": "^1.7.0",
32
32
  "q": "^1.5.1",
33
33
  "semver": "^5.1.0",
34
- "shelljs": "^0.8.4",
34
+ "shelljs": "^0.8.5",
35
35
  "sync-request": "6.1.0",
36
36
  "uuid": "^3.0.1"
37
37
  },
package/task.d.ts CHANGED
@@ -108,6 +108,14 @@ export interface VariableInfo {
108
108
  * @returns string
109
109
  */
110
110
  export declare function getInput(name: string, required?: boolean): string | undefined;
111
+ /**
112
+ * Gets the value of an input.
113
+ * If the value is not set, it will throw.
114
+ *
115
+ * @param name name of the input to get
116
+ * @returns string
117
+ */
118
+ export declare function getInputRequired(name: string): string;
111
119
  /**
112
120
  * Gets the value of an input and converts to a bool. Convenience.
113
121
  * If required is true and the value is not set, it will throw.
@@ -153,6 +161,17 @@ export declare function filePathSupplied(name: string): boolean;
153
161
  * @returns string
154
162
  */
155
163
  export declare function getPathInput(name: string, required?: boolean, check?: boolean): string | undefined;
164
+ /**
165
+ * Gets the value of a path input
166
+ * It will be quoted for you if it isn't already and contains spaces
167
+ * If the value is not set, it will throw.
168
+ * If check is true and the path does not exist, it will throw.
169
+ *
170
+ * @param name name of the input to get
171
+ * @param check whether path is checked. optional, defaults to false
172
+ * @returns string
173
+ */
174
+ export declare function getPathInputRequired(name: string, check?: boolean): string;
156
175
  /**
157
176
  * Gets the url for a service endpoint
158
177
  * If the url was not set and is not optional, it will throw.
@@ -162,7 +181,16 @@ export declare function getPathInput(name: string, required?: boolean, check?: b
162
181
  * @returns string
163
182
  */
164
183
  export declare function getEndpointUrl(id: string, optional: boolean): string | undefined;
184
+ /**
185
+ * Gets the url for a service endpoint
186
+ * If the url was not set, it will throw.
187
+ *
188
+ * @param id name of the service endpoint
189
+ * @returns string
190
+ */
191
+ export declare function getEndpointUrlRequired(id: string): string;
165
192
  export declare function getEndpointDataParameter(id: string, key: string, optional: boolean): string | undefined;
193
+ export declare function getEndpointDataParameterRequired(id: string, key: string): string;
166
194
  /**
167
195
  * Gets the endpoint authorization scheme for a service endpoint
168
196
  * If the endpoint authorization scheme is not set and is not optional, it will throw.
@@ -172,6 +200,14 @@ export declare function getEndpointDataParameter(id: string, key: string, option
172
200
  * @returns {string} value of the endpoint authorization scheme
173
201
  */
174
202
  export declare function getEndpointAuthorizationScheme(id: string, optional: boolean): string | undefined;
203
+ /**
204
+ * Gets the endpoint authorization scheme for a service endpoint
205
+ * If the endpoint authorization scheme is not set, it will throw.
206
+ *
207
+ * @param id name of the service endpoint
208
+ * @returns {string} value of the endpoint authorization scheme
209
+ */
210
+ export declare function getEndpointAuthorizationSchemeRequired(id: string): string;
175
211
  /**
176
212
  * Gets the endpoint authorization parameter value for a service endpoint with specified key
177
213
  * If the endpoint authorization parameter is not set and is not optional, it will throw.
@@ -182,6 +218,15 @@ export declare function getEndpointAuthorizationScheme(id: string, optional: boo
182
218
  * @returns {string} value of the endpoint authorization parameter value
183
219
  */
184
220
  export declare function getEndpointAuthorizationParameter(id: string, key: string, optional: boolean): string | undefined;
221
+ /**
222
+ * Gets the endpoint authorization parameter value for a service endpoint with specified key
223
+ * If the endpoint authorization parameter is not set, it will throw.
224
+ *
225
+ * @param id name of the service endpoint
226
+ * @param key key to find the endpoint authorization parameter
227
+ * @returns {string} value of the endpoint authorization parameter value
228
+ */
229
+ export declare function getEndpointAuthorizationParameterRequired(id: string, key: string): string;
185
230
  /**
186
231
  * Interface for EndpointAuthorization
187
232
  * Contains a schema and a string/string dictionary of auth data
package/task.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mv = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.popd = exports.pushd = exports.cd = exports.checkPath = exports.cwd = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.debug = exports.error = exports.warning = exports.command = exports.setTaskVariable = exports.getTaskVariable = exports.getSecureFileTicket = exports.getSecureFileName = exports.getEndpointAuthorization = exports.getEndpointAuthorizationParameter = exports.getEndpointAuthorizationScheme = exports.getEndpointDataParameter = exports.getEndpointUrl = exports.getPathInput = exports.filePathSupplied = exports.getDelimitedInput = exports.getBoolInput = exports.getInput = exports.setSecret = exports.setVariable = exports.getVariables = exports.assertAgent = exports.getVariable = exports.loc = exports.setResourcePath = exports.setResult = exports.setErrStream = exports.setStdStream = exports.Platform = exports.FieldType = exports.ArtifactType = exports.IssueType = exports.TaskState = exports.TaskResult = void 0;
4
- exports.updateReleaseName = exports.addBuildTag = exports.updateBuildNumber = exports.uploadBuildLog = exports.associateArtifact = exports.uploadArtifact = exports.logIssue = exports.logDetail = exports.setProgress = exports.setEndpoint = exports.addAttachment = exports.uploadSummary = exports.prependPath = exports.uploadFile = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.findMatch = exports.filter = exports.match = exports.tool = exports.execSync = exports.exec = exports.rmRF = exports.legacyFindFiles = exports.find = exports.retry = void 0;
3
+ exports.updateReleaseName = exports.addBuildTag = exports.updateBuildNumber = exports.uploadBuildLog = exports.associateArtifact = exports.uploadArtifact = exports.logIssue = exports.logDetail = exports.setProgress = exports.setEndpoint = exports.addAttachment = exports.uploadSummary = exports.prependPath = exports.uploadFile = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.findMatch = exports.filter = exports.match = exports.tool = exports.execSync = exports.exec = exports.rmRF = exports.legacyFindFiles = exports.find = exports.retry = exports.mv = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.popd = exports.pushd = exports.cd = exports.checkPath = exports.cwd = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.debug = exports.error = exports.warning = exports.command = exports.setTaskVariable = exports.getTaskVariable = exports.getSecureFileTicket = exports.getSecureFileName = exports.getEndpointAuthorization = exports.getEndpointAuthorizationParameterRequired = exports.getEndpointAuthorizationParameter = exports.getEndpointAuthorizationSchemeRequired = exports.getEndpointAuthorizationScheme = exports.getEndpointDataParameterRequired = exports.getEndpointDataParameter = exports.getEndpointUrlRequired = exports.getEndpointUrl = exports.getPathInputRequired = exports.getPathInput = exports.filePathSupplied = exports.getDelimitedInput = exports.getBoolInput = exports.getInputRequired = exports.getInput = exports.setSecret = exports.setVariable = exports.getVariables = exports.assertAgent = exports.getVariable = exports.loc = exports.setResourcePath = exports.setResult = exports.setErrStream = exports.setStdStream = exports.Platform = exports.FieldType = exports.ArtifactType = exports.IssueType = exports.TaskState = exports.TaskResult = void 0;
5
4
  var shell = require("shelljs");
6
5
  var childProcess = require("child_process");
7
6
  var fs = require("fs");
@@ -209,6 +208,17 @@ function getInput(name, required) {
209
208
  return inval;
210
209
  }
211
210
  exports.getInput = getInput;
211
+ /**
212
+ * Gets the value of an input.
213
+ * If the value is not set, it will throw.
214
+ *
215
+ * @param name name of the input to get
216
+ * @returns string
217
+ */
218
+ function getInputRequired(name) {
219
+ return getInput(name, true);
220
+ }
221
+ exports.getInputRequired = getInputRequired;
212
222
  /**
213
223
  * Gets the value of an input and converts to a bool. Convenience.
214
224
  * If required is true and the value is not set, it will throw.
@@ -287,6 +297,20 @@ function getPathInput(name, required, check) {
287
297
  return inval;
288
298
  }
289
299
  exports.getPathInput = getPathInput;
300
+ /**
301
+ * Gets the value of a path input
302
+ * It will be quoted for you if it isn't already and contains spaces
303
+ * If the value is not set, it will throw.
304
+ * If check is true and the path does not exist, it will throw.
305
+ *
306
+ * @param name name of the input to get
307
+ * @param check whether path is checked. optional, defaults to false
308
+ * @returns string
309
+ */
310
+ function getPathInputRequired(name, check) {
311
+ return getPathInput(name, true, check);
312
+ }
313
+ exports.getPathInputRequired = getPathInputRequired;
290
314
  //-----------------------------------------------------
291
315
  // Endpoint Helpers
292
316
  //-----------------------------------------------------
@@ -307,6 +331,17 @@ function getEndpointUrl(id, optional) {
307
331
  return urlval;
308
332
  }
309
333
  exports.getEndpointUrl = getEndpointUrl;
334
+ /**
335
+ * Gets the url for a service endpoint
336
+ * If the url was not set, it will throw.
337
+ *
338
+ * @param id name of the service endpoint
339
+ * @returns string
340
+ */
341
+ function getEndpointUrlRequired(id) {
342
+ return getEndpointUrl(id, false);
343
+ }
344
+ exports.getEndpointUrlRequired = getEndpointUrlRequired;
310
345
  /*
311
346
  * Gets the endpoint data parameter value with specified key for a service endpoint
312
347
  * If the endpoint data parameter was not set and is not optional, it will throw.
@@ -325,6 +360,18 @@ function getEndpointDataParameter(id, key, optional) {
325
360
  return dataParamVal;
326
361
  }
327
362
  exports.getEndpointDataParameter = getEndpointDataParameter;
363
+ /*
364
+ * Gets the endpoint data parameter value with specified key for a service endpoint
365
+ * If the endpoint data parameter was not set, it will throw.
366
+ *
367
+ * @param id name of the service endpoint
368
+ * @param key of the parameter
369
+ * @returns {string} value of the endpoint data parameter
370
+ */
371
+ function getEndpointDataParameterRequired(id, key) {
372
+ return getEndpointDataParameter(id, key, false);
373
+ }
374
+ exports.getEndpointDataParameterRequired = getEndpointDataParameterRequired;
328
375
  /**
329
376
  * Gets the endpoint authorization scheme for a service endpoint
330
377
  * If the endpoint authorization scheme is not set and is not optional, it will throw.
@@ -342,6 +389,17 @@ function getEndpointAuthorizationScheme(id, optional) {
342
389
  return authScheme;
343
390
  }
344
391
  exports.getEndpointAuthorizationScheme = getEndpointAuthorizationScheme;
392
+ /**
393
+ * Gets the endpoint authorization scheme for a service endpoint
394
+ * If the endpoint authorization scheme is not set, it will throw.
395
+ *
396
+ * @param id name of the service endpoint
397
+ * @returns {string} value of the endpoint authorization scheme
398
+ */
399
+ function getEndpointAuthorizationSchemeRequired(id) {
400
+ return getEndpointAuthorizationScheme(id, false);
401
+ }
402
+ exports.getEndpointAuthorizationSchemeRequired = getEndpointAuthorizationSchemeRequired;
345
403
  /**
346
404
  * Gets the endpoint authorization parameter value for a service endpoint with specified key
347
405
  * If the endpoint authorization parameter is not set and is not optional, it will throw.
@@ -360,6 +418,18 @@ function getEndpointAuthorizationParameter(id, key, optional) {
360
418
  return authParam;
361
419
  }
362
420
  exports.getEndpointAuthorizationParameter = getEndpointAuthorizationParameter;
421
+ /**
422
+ * Gets the endpoint authorization parameter value for a service endpoint with specified key
423
+ * If the endpoint authorization parameter is not set, it will throw.
424
+ *
425
+ * @param id name of the service endpoint
426
+ * @param key key to find the endpoint authorization parameter
427
+ * @returns {string} value of the endpoint authorization parameter value
428
+ */
429
+ function getEndpointAuthorizationParameterRequired(id, key) {
430
+ return getEndpointAuthorizationParameter(id, key, false);
431
+ }
432
+ exports.getEndpointAuthorizationParameterRequired = getEndpointAuthorizationParameterRequired;
363
433
  /**
364
434
  * Gets the authorization details for a service endpoint
365
435
  * If the authorization was not set and is not optional, it will set the task result to Failed.
package/toolrunner.js CHANGED
@@ -7,8 +7,6 @@ var __extends = (this && this.__extends) || (function () {
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
10
  extendStatics(d, b);
13
11
  function __() { this.constructor = d; }
14
12
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());