azure-pipelines-task-lib 5.280.1 → 5.280.3

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.
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  import stream = require('stream');
5
+ import im = require('./internal');
5
6
  /** Commands allowed by default once VSO commands are enabled for a path. */
6
7
  export declare const defaultAllowedVsoCommands: readonly string[];
7
8
  /**
@@ -56,17 +57,23 @@ export declare class ExternalOutputStream extends stream.Transform {
56
57
  * `jenkinsResponse.pipe(tl.createExternalOutputStream({ source: 'remote' }))`.
57
58
  */
58
59
  export declare function createExternalOutputStream(options: ExternalOutputOptions): ExternalOutputStream;
59
- /**
60
- * Filters a complete piece of external output and writes it to the destination
61
- * (default process.stdout). Each call is self-contained; for output that arrives in
62
- * chunks that may split a marker, use createExternalOutputStream instead.
63
- */
64
- export declare function writeExternalOutput(data: string | Buffer, options: ExternalOutputOptions): void;
65
- /** Filters one complete value and returns its bytes without writing them. */
60
+ /** Filters one complete value for internal task-lib consumers. */
66
61
  export declare function filterExternalOutput(data: string | Buffer, options: ExternalOutputOptions): Buffer;
67
62
  export interface FilteredWriter {
68
63
  write(data: string | Buffer): void;
69
64
  end(): void;
70
65
  }
71
- /** Creates a stateful writer that filters markers split across writes. */
66
+ /** Creates a stateful writer for internal consumers that receive output in chunks. */
72
67
  export declare function createFilteredWriter(options: ExternalOutputOptions, destination: NodeJS.WritableStream): FilteredWriter;
68
+ export type ExternalOutputIssueOptions = ExternalOutputOptions & {
69
+ issueSource?: im.IssueSource;
70
+ auditAction?: im.IssueAuditAction;
71
+ };
72
+ /** Filters external output and writes it directly to the configured destination. */
73
+ export declare function writeExternalOutput(message: string | Buffer, options: ExternalOutputOptions): void;
74
+ /** Filters external output and submits it through the task-lib debug logger. */
75
+ export declare function debugExternalOutput(message: string | Buffer, options: ExternalOutputOptions): void;
76
+ /** Filters external output and submits it through the task-lib warning logger. */
77
+ export declare function warningExternalOutput(message: string | Buffer, options: ExternalOutputIssueOptions): void;
78
+ /** Filters external output and submits it through the task-lib error logger. */
79
+ export declare function errorExternalOutput(message: string | Buffer, options: ExternalOutputIssueOptions): void;
package/externaloutput.js CHANGED
@@ -16,9 +16,21 @@ var __extends = (this && this.__extends) || (function () {
16
16
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
17
  };
18
18
  })();
19
+ var __assign = (this && this.__assign) || function () {
20
+ __assign = Object.assign || function(t) {
21
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
22
+ s = arguments[i];
23
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
24
+ t[p] = s[p];
25
+ }
26
+ return t;
27
+ };
28
+ return __assign.apply(this, arguments);
29
+ };
19
30
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.createFilteredWriter = exports.filterExternalOutput = exports.writeExternalOutput = exports.createExternalOutputStream = exports.ExternalOutputStream = exports.MarkerFilter = exports.defaultAllowedVsoCommands = void 0;
31
+ exports.errorExternalOutput = exports.warningExternalOutput = exports.debugExternalOutput = exports.writeExternalOutput = exports.createFilteredWriter = exports.filterExternalOutput = exports.createExternalOutputStream = exports.ExternalOutputStream = exports.MarkerFilter = exports.defaultAllowedVsoCommands = void 0;
21
32
  var stream = require("stream");
33
+ var im = require("./internal");
22
34
  //
23
35
  // External output filtering.
24
36
  //
@@ -248,17 +260,7 @@ function createExternalOutputStream(options) {
248
260
  return filterStream;
249
261
  }
250
262
  exports.createExternalOutputStream = createExternalOutputStream;
251
- /**
252
- * Filters a complete piece of external output and writes it to the destination
253
- * (default process.stdout). Each call is self-contained; for output that arrives in
254
- * chunks that may split a marker, use createExternalOutputStream instead.
255
- */
256
- function writeExternalOutput(data, options) {
257
- var destination = options.destination || process.stdout;
258
- destination.write(filterExternalOutput(data, options));
259
- }
260
- exports.writeExternalOutput = writeExternalOutput;
261
- /** Filters one complete value and returns its bytes without writing them. */
263
+ /** Filters one complete value for internal task-lib consumers. */
262
264
  function filterExternalOutput(data, options) {
263
265
  var filter = new MarkerFilter(!!options.enableVsoCommands, resolveAllowed(options));
264
266
  var buf = Buffer.isBuffer(data) ? data : Buffer.from(String(data), 'utf8');
@@ -267,7 +269,7 @@ function filterExternalOutput(data, options) {
267
269
  return pending.length ? Buffer.concat([filtered, pending]) : filtered;
268
270
  }
269
271
  exports.filterExternalOutput = filterExternalOutput;
270
- /** Creates a stateful writer that filters markers split across writes. */
272
+ /** Creates a stateful writer for internal consumers that receive output in chunks. */
271
273
  function createFilteredWriter(options, destination) {
272
274
  var filter = new MarkerFilter(!!options.enableVsoCommands, resolveAllowed(options));
273
275
  var ended = false;
@@ -295,3 +297,42 @@ function createFilteredWriter(options, destination) {
295
297
  };
296
298
  }
297
299
  exports.createFilteredWriter = createFilteredWriter;
300
+ /** Filters external output before writing it or submitting it through a task-lib logger. */
301
+ function logExternalOutput(message, options) {
302
+ var filtered = filterExternalOutput(message, options);
303
+ switch (options.type) {
304
+ case 'raw':
305
+ var destination = options.destination || process.stdout;
306
+ destination.write(filtered);
307
+ break;
308
+ case 'debug':
309
+ im._debug(filtered.toString('utf8'));
310
+ break;
311
+ case 'warning':
312
+ im._warning(filtered.toString('utf8'), options.issueSource, options.auditAction);
313
+ break;
314
+ case 'error':
315
+ im._error(filtered.toString('utf8'), options.issueSource, options.auditAction);
316
+ break;
317
+ }
318
+ }
319
+ /** Filters external output and writes it directly to the configured destination. */
320
+ function writeExternalOutput(message, options) {
321
+ logExternalOutput(message, __assign(__assign({}, options), { type: 'raw' }));
322
+ }
323
+ exports.writeExternalOutput = writeExternalOutput;
324
+ /** Filters external output and submits it through the task-lib debug logger. */
325
+ function debugExternalOutput(message, options) {
326
+ logExternalOutput(message, __assign(__assign({}, options), { type: 'debug' }));
327
+ }
328
+ exports.debugExternalOutput = debugExternalOutput;
329
+ /** Filters external output and submits it through the task-lib warning logger. */
330
+ function warningExternalOutput(message, options) {
331
+ logExternalOutput(message, __assign(__assign({}, options), { type: 'warning' }));
332
+ }
333
+ exports.warningExternalOutput = warningExternalOutput;
334
+ /** Filters external output and submits it through the task-lib error logger. */
335
+ function errorExternalOutput(message, options) {
336
+ logExternalOutput(message, __assign(__assign({}, options), { type: 'error' }));
337
+ }
338
+ exports.errorExternalOutput = errorExternalOutput;
package/mock-task.d.ts CHANGED
@@ -113,9 +113,12 @@ export declare class CodeCoverageEnabler {
113
113
  }): void;
114
114
  }
115
115
  export type ExternalOutputOptions = eom.ExternalOutputOptions;
116
+ export type ExternalOutputIssueOptions = task.ExternalOutputIssueOptions;
116
117
  export declare function createExternalOutputStream(options: eom.ExternalOutputOptions): eom.ExternalOutputStream;
117
- export declare function writeExternalOutput(data: string | Buffer, options: eom.ExternalOutputOptions): void;
118
- export declare function filterExternalOutput(data: string | Buffer, options: eom.ExternalOutputOptions): Buffer;
118
+ export declare function writeExternalOutput(message: string | Buffer, options: task.ExternalOutputOptions): void;
119
+ export declare function debugExternalOutput(message: string | Buffer, options: task.ExternalOutputOptions): void;
120
+ export declare function warningExternalOutput(message: string | Buffer, options: task.ExternalOutputIssueOptions): void;
121
+ export declare function errorExternalOutput(message: string | Buffer, options: task.ExternalOutputIssueOptions): void;
119
122
  export declare const defaultAllowedVsoCommands: readonly string[];
120
123
  export declare function getHttpProxyConfiguration(requestUrl?: string): task.ProxyConfiguration | null;
121
124
  export declare function getHttpCertConfiguration(): task.CertConfiguration | null;
package/mock-task.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.defaultAllowedVsoCommands = exports.filterExternalOutput = exports.writeExternalOutput = exports.createExternalOutputStream = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.legacyFindFiles = exports.findMatch = exports.tool = exports.execSync = exports.execAsync = exports.exec = exports.mv = exports.rmRF = exports.find = exports.retry = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.checkPath = exports.popd = exports.pushd = exports.cd = exports.cwd = exports.getAgentMode = exports.getNodeMajorVersion = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.FsStats = exports.loc = exports.setResourcePath = exports.setAnswers = void 0;
3
+ exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.defaultAllowedVsoCommands = exports.errorExternalOutput = exports.warningExternalOutput = exports.debugExternalOutput = exports.writeExternalOutput = exports.createExternalOutputStream = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.legacyFindFiles = exports.findMatch = exports.tool = exports.execSync = exports.execAsync = exports.exec = exports.mv = exports.rmRF = exports.find = exports.retry = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.checkPath = exports.popd = exports.pushd = exports.cd = exports.cwd = exports.getAgentMode = exports.getNodeMajorVersion = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.FsStats = exports.loc = exports.setResourcePath = exports.setAnswers = void 0;
4
4
  var path = require("path");
5
5
  var task = require("./task");
6
6
  var tcm = require("./taskcommand");
@@ -460,14 +460,22 @@ function createExternalOutputStream(options) {
460
460
  return eom.createExternalOutputStream(options);
461
461
  }
462
462
  exports.createExternalOutputStream = createExternalOutputStream;
463
- function writeExternalOutput(data, options) {
464
- eom.writeExternalOutput(data, options);
463
+ function writeExternalOutput(message, options) {
464
+ task.writeExternalOutput(message, options);
465
465
  }
466
466
  exports.writeExternalOutput = writeExternalOutput;
467
- function filterExternalOutput(data, options) {
468
- return eom.filterExternalOutput(data, options);
467
+ function debugExternalOutput(message, options) {
468
+ task.debugExternalOutput(message, options);
469
469
  }
470
- exports.filterExternalOutput = filterExternalOutput;
470
+ exports.debugExternalOutput = debugExternalOutput;
471
+ function warningExternalOutput(message, options) {
472
+ task.warningExternalOutput(message, options);
473
+ }
474
+ exports.warningExternalOutput = warningExternalOutput;
475
+ function errorExternalOutput(message, options) {
476
+ task.errorExternalOutput(message, options);
477
+ }
478
+ exports.errorExternalOutput = errorExternalOutput;
471
479
  exports.defaultAllowedVsoCommands = eom.defaultAllowedVsoCommands;
472
480
  //-----------------------------------------------------
473
481
  // Http Proxy Helper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-task-lib",
3
- "version": "5.280.1",
3
+ "version": "5.280.3",
4
4
  "description": "Azure Pipelines Task SDK",
5
5
  "main": "./task.js",
6
6
  "typings": "./task.d.ts",
@@ -27,7 +27,6 @@
27
27
  },
28
28
  "homepage": "https://github.com/Microsoft/azure-pipelines-task-lib",
29
29
  "dependencies": {
30
- "adm-zip": "^0.6.0",
31
30
  "minimatch": "^3.1.5",
32
31
  "nodejs-file-downloader": "^4.11.1",
33
32
  "q": "^1.5.1",
@@ -35,6 +34,7 @@
35
34
  "shelljs": "^0.10.0"
36
35
  },
37
36
  "devDependencies": {
37
+ "adm-zip": "^0.6.0",
38
38
  "@types/minimatch": "3.0.3",
39
39
  "@types/mocha": "^10.0.10",
40
40
  "@types/node": "^16.11.39",
package/task.d.ts CHANGED
@@ -839,6 +839,7 @@ export declare function updateReleaseName(name: string): void;
839
839
  * the log. See {@link eom.ExternalOutputOptions}.
840
840
  */
841
841
  export type ExternalOutputOptions = eom.ExternalOutputOptions;
842
+ export type ExternalOutputIssueOptions = eom.ExternalOutputIssueOptions;
842
843
  /**
843
844
  * Creates a filtering stream for external output and pipes it to the destination
844
845
  * (default process.stdout). Pipe untrusted output (a remote response, a child process's
@@ -853,24 +854,14 @@ export type ExternalOutputOptions = eom.ExternalOutputOptions;
853
854
  * @returns A writable/readable stream to pipe untrusted output into.
854
855
  */
855
856
  export declare function createExternalOutputStream(options: eom.ExternalOutputOptions): eom.ExternalOutputStream;
856
- /**
857
- * Filters a complete piece of external output and writes it to the destination
858
- * (default process.stdout). Use this for output already held in a string or Buffer; for
859
- * output that streams in chunks that may split a marker, use createExternalOutputStream.
860
- *
861
- * @param data The external output to write.
862
- * @param options External output options. See ExternalOutputOptions.
863
- * @returns void
864
- */
865
- export declare function writeExternalOutput(data: string | Buffer, options: eom.ExternalOutputOptions): void;
866
- /**
867
- * Filters a complete piece of external output and returns its bytes without writing them.
868
- *
869
- * @param data The external output to filter.
870
- * @param options External output options. See ExternalOutputOptions.
871
- * @returns The filtered output.
872
- */
873
- export declare function filterExternalOutput(data: string | Buffer, options: eom.ExternalOutputOptions): Buffer;
857
+ /** Filters external output and writes it directly to the configured destination. */
858
+ export declare function writeExternalOutput(message: string | Buffer, options: ExternalOutputOptions): void;
859
+ /** Filters external output and submits it through the existing task-lib debug logger. */
860
+ export declare function debugExternalOutput(message: string | Buffer, options: ExternalOutputOptions): void;
861
+ /** Filters external output and submits it through the existing task-lib warning logger. */
862
+ export declare function warningExternalOutput(message: string | Buffer, options: ExternalOutputIssueOptions): void;
863
+ /** Filters external output and submits it through the existing task-lib error logger. */
864
+ export declare function errorExternalOutput(message: string | Buffer, options: ExternalOutputIssueOptions): void;
874
865
  /** Commands allowed when VSO commands are enabled without an explicit allowlist. */
875
866
  export declare const defaultAllowedVsoCommands: readonly string[];
876
867
  export {};
package/task.js CHANGED
@@ -10,7 +10,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  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.getPipelineFeature = exports.getBoolFeatureFlag = exports.getBoolInput = exports.getInputRequired = exports.getInput = exports.setSecret = exports.setVariable = exports.getVariables = exports.assertAgent = exports.getVariable = exports.loc = exports.setResourcePath = exports.setSanitizedResult = exports.setResult = exports.setErrStream = exports.setStdStream = exports.AgentHostedMode = exports.Platform = exports.IssueSource = exports.FieldType = exports.ArtifactType = exports.IssueType = exports.TaskState = exports.TaskResult = void 0;
13
- exports.defaultAllowedVsoCommands = exports.filterExternalOutput = exports.writeExternalOutput = exports.createExternalOutputStream = 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.execAsync = 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.getSprint = exports.getAgentMode = exports.getNodeMajorVersion = void 0;
13
+ exports.defaultAllowedVsoCommands = exports.errorExternalOutput = exports.warningExternalOutput = exports.debugExternalOutput = exports.writeExternalOutput = exports.createExternalOutputStream = 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.execAsync = 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.getSprint = exports.getAgentMode = exports.getNodeMajorVersion = void 0;
14
14
  var childProcess = require("child_process");
15
15
  var fs = require("fs");
16
16
  var path = require("path");
@@ -2432,30 +2432,26 @@ function createExternalOutputStream(options) {
2432
2432
  return eom.createExternalOutputStream(options);
2433
2433
  }
2434
2434
  exports.createExternalOutputStream = createExternalOutputStream;
2435
- /**
2436
- * Filters a complete piece of external output and writes it to the destination
2437
- * (default process.stdout). Use this for output already held in a string or Buffer; for
2438
- * output that streams in chunks that may split a marker, use createExternalOutputStream.
2439
- *
2440
- * @param data The external output to write.
2441
- * @param options External output options. See ExternalOutputOptions.
2442
- * @returns void
2443
- */
2444
- function writeExternalOutput(data, options) {
2445
- eom.writeExternalOutput(data, options);
2435
+ /** Filters external output and writes it directly to the configured destination. */
2436
+ function writeExternalOutput(message, options) {
2437
+ eom.writeExternalOutput(message, options);
2446
2438
  }
2447
2439
  exports.writeExternalOutput = writeExternalOutput;
2448
- /**
2449
- * Filters a complete piece of external output and returns its bytes without writing them.
2450
- *
2451
- * @param data The external output to filter.
2452
- * @param options External output options. See ExternalOutputOptions.
2453
- * @returns The filtered output.
2454
- */
2455
- function filterExternalOutput(data, options) {
2456
- return eom.filterExternalOutput(data, options);
2440
+ /** Filters external output and submits it through the existing task-lib debug logger. */
2441
+ function debugExternalOutput(message, options) {
2442
+ eom.debugExternalOutput(message, options);
2443
+ }
2444
+ exports.debugExternalOutput = debugExternalOutput;
2445
+ /** Filters external output and submits it through the existing task-lib warning logger. */
2446
+ function warningExternalOutput(message, options) {
2447
+ eom.warningExternalOutput(message, options);
2448
+ }
2449
+ exports.warningExternalOutput = warningExternalOutput;
2450
+ /** Filters external output and submits it through the existing task-lib error logger. */
2451
+ function errorExternalOutput(message, options) {
2452
+ eom.errorExternalOutput(message, options);
2457
2453
  }
2458
- exports.filterExternalOutput = filterExternalOutput;
2454
+ exports.errorExternalOutput = errorExternalOutput;
2459
2455
  /** Commands allowed when VSO commands are enabled without an explicit allowlist. */
2460
2456
  exports.defaultAllowedVsoCommands = eom.defaultAllowedVsoCommands;
2461
2457
  //-----------------------------------------------------