azure-pipelines-task-lib 3.2.0 → 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/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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-task-lib",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Azure Pipelines Task SDK",
5
5
  "main": "./task.js",
6
6
  "typings": "./task.d.ts",
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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.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;
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;
4
4
  var shell = require("shelljs");
5
5
  var childProcess = require("child_process");
6
6
  var fs = require("fs");
@@ -208,6 +208,17 @@ function getInput(name, required) {
208
208
  return inval;
209
209
  }
210
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;
211
222
  /**
212
223
  * Gets the value of an input and converts to a bool. Convenience.
213
224
  * If required is true and the value is not set, it will throw.
@@ -286,6 +297,20 @@ function getPathInput(name, required, check) {
286
297
  return inval;
287
298
  }
288
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;
289
314
  //-----------------------------------------------------
290
315
  // Endpoint Helpers
291
316
  //-----------------------------------------------------
@@ -306,6 +331,17 @@ function getEndpointUrl(id, optional) {
306
331
  return urlval;
307
332
  }
308
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;
309
345
  /*
310
346
  * Gets the endpoint data parameter value with specified key for a service endpoint
311
347
  * If the endpoint data parameter was not set and is not optional, it will throw.
@@ -324,6 +360,18 @@ function getEndpointDataParameter(id, key, optional) {
324
360
  return dataParamVal;
325
361
  }
326
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;
327
375
  /**
328
376
  * Gets the endpoint authorization scheme for a service endpoint
329
377
  * If the endpoint authorization scheme is not set and is not optional, it will throw.
@@ -341,6 +389,17 @@ function getEndpointAuthorizationScheme(id, optional) {
341
389
  return authScheme;
342
390
  }
343
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;
344
403
  /**
345
404
  * Gets the endpoint authorization parameter value for a service endpoint with specified key
346
405
  * If the endpoint authorization parameter is not set and is not optional, it will throw.
@@ -359,6 +418,18 @@ function getEndpointAuthorizationParameter(id, key, optional) {
359
418
  return authParam;
360
419
  }
361
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;
362
433
  /**
363
434
  * Gets the authorization details for a service endpoint
364
435
  * If the authorization was not set and is not optional, it will set the task result to Failed.