artifact-engine 2.273.0 → 2.275.2
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/Engine/artifactEngine.js +1 -2
- package/Engine/artifactEngineOptions.js +1 -0
- package/Engine/cilogger.js +2 -2
- package/Engine/index.js +1 -0
- package/Engine/logger.js +1 -0
- package/Engine/worker.js +1 -0
- package/Models/artifactDownloadTicket.js +1 -0
- package/Models/artifactItem.js +1 -0
- package/Models/artifactprovider.d.ts +0 -1
- package/Models/artifactprovider.js +1 -0
- package/Models/constants.js +1 -0
- package/Models/index.js +1 -0
- package/Models/itemType.js +2 -1
- package/Models/ticketState.js +2 -1
- package/Providers/filesystemProvider.d.ts +0 -1
- package/Providers/filesystemProvider.js +1 -2
- package/Providers/index.js +1 -0
- package/Providers/stubProvider.d.ts +0 -1
- package/Providers/stubProvider.js +1 -0
- package/Providers/typed-rest-client/Handlers.js +1 -0
- package/Providers/typed-rest-client/HttpClient.d.ts +0 -11
- package/Providers/typed-rest-client/HttpClient.js +5 -30
- package/Providers/typed-rest-client/Index.js +1 -0
- package/Providers/typed-rest-client/Interfaces.js +1 -0
- package/Providers/typed-rest-client/RestClient.d.ts +0 -48
- package/Providers/typed-rest-client/RestClient.js +1 -55
- package/Providers/typed-rest-client/Util.d.ts +0 -6
- package/Providers/typed-rest-client/Util.js +2 -10
- package/Providers/typed-rest-client/handlers/basiccreds.js +1 -5
- package/Providers/typed-rest-client/handlers/bearertoken.js +1 -5
- package/Providers/typed-rest-client/handlers/ntlm.js +1 -21
- package/Providers/typed-rest-client/handlers/personalaccesstoken.js +1 -5
- package/Providers/webClient.js +1 -3
- package/Providers/webClientFactory.js +6 -12
- package/Providers/webProvider.d.ts +0 -1
- package/Providers/webProvider.js +6 -0
- package/Providers/zipProvider.d.ts +0 -1
- package/Providers/zipProvider.js +1 -0
- package/Store/artifactItemStore.js +1 -0
- package/Store/index.js +1 -0
- package/Strings/resources.resjson/de-DE/resources.resjson +2 -2
- package/Strings/resources.resjson/en-US/resources.resjson +2 -2
- package/Strings/resources.resjson/es-ES/resources.resjson +2 -2
- package/Strings/resources.resjson/fr-FR/resources.resjson +2 -2
- package/Strings/resources.resjson/it-IT/resources.resjson +2 -2
- package/Strings/resources.resjson/ja-JP/resources.resjson +2 -2
- package/Strings/resources.resjson/ko-KR/resources.resjson +2 -2
- package/Strings/resources.resjson/ru-RU/resources.resjson +2 -2
- package/Strings/resources.resjson/zh-CN/resources.resjson +2 -2
- package/Strings/resources.resjson/zh-TW/resources.resjson +2 -2
- package/package.json +1 -1
package/Engine/artifactEngine.js
CHANGED
|
@@ -64,8 +64,6 @@ class ArtifactEngine {
|
|
|
64
64
|
else {
|
|
65
65
|
this.artifactItemStore.increaseRetryCount(item);
|
|
66
66
|
logger_1.Logger.logMessage(tl.loc("RetryingDownload", item.path, (retryCount + 1)));
|
|
67
|
-
// retry interval sequence 5s 15s 45s 135s
|
|
68
|
-
// 2 min is the time limit for freeing of ports
|
|
69
67
|
setTimeout(() => this
|
|
70
68
|
.processArtifactItemImplementation(sourceProvider, item, destProvider, artifactEngineOptions, resolve, reject, retryCount + 1), this.getRetryIntervalInSeconds(artifactEngineOptions.retryIntervalInSeconds, retryCount) * 1000);
|
|
71
69
|
}
|
|
@@ -165,3 +163,4 @@ process.on('uncaughtException', (err) => {
|
|
|
165
163
|
logger_1.Logger.logError(tl.loc("UnhandledException", err));
|
|
166
164
|
throw err;
|
|
167
165
|
});
|
|
166
|
+
//# sourceMappingURL=artifactEngine.js.map
|
package/Engine/cilogger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publishEvent =
|
|
3
|
+
exports.publishEvent = publishEvent;
|
|
4
4
|
var tl = require('azure-pipelines-task-lib');
|
|
5
5
|
var packagejson = require('../package.json');
|
|
6
6
|
const area = 'artifact-engine-v2';
|
|
@@ -42,4 +42,4 @@ function publishEvent(feature, properties) {
|
|
|
42
42
|
tl.warning("Failed to log telemetry, error: " + err);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
//# sourceMappingURL=cilogger.js.map
|
package/Engine/index.js
CHANGED
|
@@ -5,3 +5,4 @@ var artifactEngineOptions_1 = require("./artifactEngineOptions");
|
|
|
5
5
|
Object.defineProperty(exports, "ArtifactEngineOptions", { enumerable: true, get: function () { return artifactEngineOptions_1.ArtifactEngineOptions; } });
|
|
6
6
|
var artifactEngine_1 = require("./artifactEngine");
|
|
7
7
|
Object.defineProperty(exports, "ArtifactEngine", { enumerable: true, get: function () { return artifactEngine_1.ArtifactEngine; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/Engine/logger.js
CHANGED
package/Engine/worker.js
CHANGED
package/Models/artifactItem.js
CHANGED
package/Models/constants.js
CHANGED
package/Models/index.js
CHANGED
|
@@ -11,3 +11,4 @@ var ticketState_1 = require("./ticketState");
|
|
|
11
11
|
Object.defineProperty(exports, "TicketState", { enumerable: true, get: function () { return ticketState_1.TicketState; } });
|
|
12
12
|
var constants_1 = require("./constants");
|
|
13
13
|
Object.defineProperty(exports, "Constants", { enumerable: true, get: function () { return constants_1.Constants; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/Models/itemType.js
CHANGED
|
@@ -6,4 +6,5 @@ var ItemType;
|
|
|
6
6
|
ItemType[ItemType["Any"] = "any"] = "Any";
|
|
7
7
|
ItemType[ItemType["Folder"] = "folder"] = "Folder";
|
|
8
8
|
ItemType[ItemType["File"] = "file"] = "File";
|
|
9
|
-
})(ItemType
|
|
9
|
+
})(ItemType || (exports.ItemType = ItemType = {}));
|
|
10
|
+
//# sourceMappingURL=itemType.js.map
|
package/Models/ticketState.js
CHANGED
|
@@ -8,4 +8,5 @@ var TicketState;
|
|
|
8
8
|
TicketState[TicketState["Processed"] = "processed"] = "Processed";
|
|
9
9
|
TicketState[TicketState["Skipped"] = "skipped"] = "Skipped";
|
|
10
10
|
TicketState[TicketState["Failed"] = "failed"] = "Failed";
|
|
11
|
-
})(TicketState
|
|
11
|
+
})(TicketState || (exports.TicketState = TicketState = {}));
|
|
12
|
+
//# sourceMappingURL=ticketState.js.map
|
|
@@ -47,7 +47,6 @@ class FilesystemProvider {
|
|
|
47
47
|
if (item.itemType === models.ItemType.File) {
|
|
48
48
|
const folder = path.dirname(outputItemPath);
|
|
49
49
|
try {
|
|
50
|
-
// create parent folder if it has not already been created
|
|
51
50
|
tl.mkdirP(folder);
|
|
52
51
|
logger_1.Logger.logMessage(tl.loc("DownloadingTo", item.path, outputItemPath));
|
|
53
52
|
const outputStream = fs.createWriteStream(outputItemPath);
|
|
@@ -96,7 +95,6 @@ class FilesystemProvider {
|
|
|
96
95
|
for (var index = 0; index < files.length; index++) {
|
|
97
96
|
var file = files[index];
|
|
98
97
|
var filePath = path.join(itemsPath, file);
|
|
99
|
-
// do not follow symbolic link
|
|
100
98
|
var itemStat;
|
|
101
99
|
try {
|
|
102
100
|
itemStat = fs.lstatSync(filePath);
|
|
@@ -122,3 +120,4 @@ class FilesystemProvider {
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
exports.FilesystemProvider = FilesystemProvider;
|
|
123
|
+
//# sourceMappingURL=filesystemProvider.js.map
|
package/Providers/index.js
CHANGED
|
@@ -9,3 +9,4 @@ var zipProvider_1 = require("./zipProvider");
|
|
|
9
9
|
Object.defineProperty(exports, "ZipProvider", { enumerable: true, get: function () { return zipProvider_1.ZipProvider; } });
|
|
10
10
|
var stubProvider_1 = require("./stubProvider");
|
|
11
11
|
Object.defineProperty(exports, "StubProvider", { enumerable: true, get: function () { return stubProvider_1.StubProvider; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -9,3 +9,4 @@ var ntlm_1 = require("./handlers/ntlm");
|
|
|
9
9
|
Object.defineProperty(exports, "NtlmCredentialHandler", { enumerable: true, get: function () { return ntlm_1.NtlmCredentialHandler; } });
|
|
10
10
|
var personalaccesstoken_1 = require("./handlers/personalaccesstoken");
|
|
11
11
|
Object.defineProperty(exports, "PersonalAccessTokenCredentialHandler", { enumerable: true, get: function () { return personalaccesstoken_1.PersonalAccessTokenCredentialHandler; } });
|
|
12
|
+
//# sourceMappingURL=Handlers.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
1
|
import url = require("url");
|
|
5
2
|
import http = require("http");
|
|
6
3
|
import ifm = require('./Interfaces');
|
|
@@ -69,15 +66,7 @@ export declare class HttpClient {
|
|
|
69
66
|
put(requestUrl: string, data: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse>;
|
|
70
67
|
head(requestUrl: string, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse>;
|
|
71
68
|
sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse>;
|
|
72
|
-
/**
|
|
73
|
-
* Makes a raw http request.
|
|
74
|
-
* All other methods such as get, post, patch, and request ultimately call this.
|
|
75
|
-
* Prefer get, del, post and patch
|
|
76
|
-
*/
|
|
77
69
|
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<HttpClientResponse>;
|
|
78
|
-
/**
|
|
79
|
-
* Needs to be called if keepAlive is set to true in request options.
|
|
80
|
-
*/
|
|
81
70
|
dispose(): void;
|
|
82
71
|
private _requestRaw;
|
|
83
72
|
private _prepareRequest;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
9
|
});
|
|
12
10
|
};
|
|
13
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.HttpClient = exports.
|
|
12
|
+
exports.HttpClient = exports.HttpClientResponse = exports.HttpCodes = void 0;
|
|
13
|
+
exports.isHttps = isHttps;
|
|
15
14
|
const url = require("url");
|
|
16
15
|
const http = require("http");
|
|
17
16
|
const https = require("https");
|
|
@@ -44,7 +43,7 @@ var HttpCodes;
|
|
|
44
43
|
HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway";
|
|
45
44
|
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
46
45
|
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
47
|
-
})(HttpCodes
|
|
46
|
+
})(HttpCodes || (exports.HttpCodes = HttpCodes = {}));
|
|
48
47
|
const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect];
|
|
49
48
|
class HttpClientResponse {
|
|
50
49
|
constructor(message) {
|
|
@@ -67,7 +66,6 @@ function isHttps(requestUrl) {
|
|
|
67
66
|
let parsedUrl = url.parse(requestUrl);
|
|
68
67
|
return parsedUrl.protocol === 'https:';
|
|
69
68
|
}
|
|
70
|
-
exports.isHttps = isHttps;
|
|
71
69
|
var EnvironmentVariables;
|
|
72
70
|
(function (EnvironmentVariables) {
|
|
73
71
|
EnvironmentVariables[EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"] = "HTTP_PROXY";
|
|
@@ -96,7 +94,6 @@ class HttpClient {
|
|
|
96
94
|
});
|
|
97
95
|
}
|
|
98
96
|
this._certConfig = requestOptions.cert;
|
|
99
|
-
// cache the cert content into memory, so we don't have to read it from disk every time
|
|
100
97
|
if (this._certConfig && this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) {
|
|
101
98
|
this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8');
|
|
102
99
|
}
|
|
@@ -141,11 +138,6 @@ class HttpClient {
|
|
|
141
138
|
sendStream(verb, requestUrl, stream, additionalHeaders) {
|
|
142
139
|
return this.request(verb, requestUrl, stream, additionalHeaders);
|
|
143
140
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Makes a raw http request.
|
|
146
|
-
* All other methods such as get, post, patch, and request ultimately call this.
|
|
147
|
-
* Prefer get, del, post and patch
|
|
148
|
-
*/
|
|
149
141
|
request(verb, requestUrl, data, headers) {
|
|
150
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
143
|
if (this._disposed) {
|
|
@@ -159,13 +151,9 @@ class HttpClient {
|
|
|
159
151
|
&& redirectsRemaining > 0) {
|
|
160
152
|
const redirectUrl = response.message.headers["location"];
|
|
161
153
|
if (!redirectUrl) {
|
|
162
|
-
// if there's no location to redirect to, we won't
|
|
163
154
|
break;
|
|
164
155
|
}
|
|
165
|
-
// we need to finish reading the response before reassigning response
|
|
166
|
-
// which will leak the open socket.
|
|
167
156
|
yield response.readBody();
|
|
168
|
-
// let's make the request with the new redirectUrl
|
|
169
157
|
info = this._prepareRequest(verb, redirectUrl, headers);
|
|
170
158
|
response = yield this._requestRaw(info, data);
|
|
171
159
|
redirectsRemaining--;
|
|
@@ -173,9 +161,6 @@ class HttpClient {
|
|
|
173
161
|
return response;
|
|
174
162
|
});
|
|
175
163
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Needs to be called if keepAlive is set to true in request options.
|
|
178
|
-
*/
|
|
179
164
|
dispose() {
|
|
180
165
|
if (this._agent) {
|
|
181
166
|
this._agent.destroy();
|
|
@@ -196,7 +181,6 @@ class HttpClient {
|
|
|
196
181
|
req.on('socket', (sock) => {
|
|
197
182
|
socket = sock;
|
|
198
183
|
});
|
|
199
|
-
// If we ever get disconnected, we want the socket to timeout eventually
|
|
200
184
|
req.setTimeout(this._socketTimeout || 3 * 60000, () => {
|
|
201
185
|
if (socket) {
|
|
202
186
|
socket.end();
|
|
@@ -204,8 +188,6 @@ class HttpClient {
|
|
|
204
188
|
reject(new Error('Request timeout: ' + info.options.path));
|
|
205
189
|
});
|
|
206
190
|
req.on('error', function (err) {
|
|
207
|
-
// err has statusCode property
|
|
208
|
-
// res should have headers
|
|
209
191
|
reject(err);
|
|
210
192
|
});
|
|
211
193
|
if (data && typeof (data) === 'string') {
|
|
@@ -236,7 +218,6 @@ class HttpClient {
|
|
|
236
218
|
info.options.headers = headers || {};
|
|
237
219
|
info.options.headers["User-Agent"] = this.userAgent;
|
|
238
220
|
info.options.agent = this._getAgent(requestUrl);
|
|
239
|
-
// gives handlers an opportunity to participate
|
|
240
221
|
if (this.handlers) {
|
|
241
222
|
this.handlers.forEach((handler) => {
|
|
242
223
|
handler.prepareRequest(info.options);
|
|
@@ -254,7 +235,6 @@ class HttpClient {
|
|
|
254
235
|
if (this._keepAlive && !useProxy) {
|
|
255
236
|
agent = this._agent;
|
|
256
237
|
}
|
|
257
|
-
// if agent is already assigned use that agent.
|
|
258
238
|
if (!!agent) {
|
|
259
239
|
return agent;
|
|
260
240
|
}
|
|
@@ -271,7 +251,7 @@ class HttpClient {
|
|
|
271
251
|
proxy: {
|
|
272
252
|
proxyAuth: proxy.proxyAuth,
|
|
273
253
|
host: proxy.proxyUrl.hostname,
|
|
274
|
-
port: proxy.proxyUrl.port
|
|
254
|
+
port: Number(proxy.proxyUrl.port) || (proxy.proxyUrl.protocol === 'https:' ? 443 : 80)
|
|
275
255
|
},
|
|
276
256
|
};
|
|
277
257
|
var tunnelAgent;
|
|
@@ -285,20 +265,15 @@ class HttpClient {
|
|
|
285
265
|
agent = tunnelAgent(agentOptions);
|
|
286
266
|
this._proxyAgent = agent;
|
|
287
267
|
}
|
|
288
|
-
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
|
289
268
|
if (this._keepAlive && !agent) {
|
|
290
269
|
var options = { keepAlive: this._keepAlive, maxSockets: maxSockets };
|
|
291
270
|
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
|
|
292
271
|
this._agent = agent;
|
|
293
272
|
}
|
|
294
|
-
// if not using private agent and tunnel agent isn't setup then use global agent
|
|
295
273
|
if (!agent) {
|
|
296
274
|
agent = usingSsl ? https.globalAgent : http.globalAgent;
|
|
297
275
|
}
|
|
298
276
|
if (usingSsl && this._ignoreSslError) {
|
|
299
|
-
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
|
300
|
-
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
|
301
|
-
// we have to cast it to any and change it directly
|
|
302
277
|
agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false });
|
|
303
278
|
}
|
|
304
279
|
if (usingSsl && this._certConfig) {
|
|
@@ -310,7 +285,6 @@ class HttpClient {
|
|
|
310
285
|
var parsedUrl = url.parse(requestUrl);
|
|
311
286
|
let usingSsl = parsedUrl.protocol === 'https:';
|
|
312
287
|
let proxyConfig = this._httpProxy;
|
|
313
|
-
// fallback to http_proxy and https_proxy env
|
|
314
288
|
let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY];
|
|
315
289
|
let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY];
|
|
316
290
|
if (!proxyConfig) {
|
|
@@ -351,3 +325,4 @@ class HttpClient {
|
|
|
351
325
|
}
|
|
352
326
|
}
|
|
353
327
|
exports.HttpClient = HttpClient;
|
|
328
|
+
//# sourceMappingURL=HttpClient.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import httpm = require('./HttpClient');
|
|
3
2
|
import ifm = require("./Interfaces");
|
|
4
3
|
export interface IRestResponse<T> {
|
|
@@ -13,60 +12,13 @@ export interface IRequestOptions {
|
|
|
13
12
|
export declare class RestClient {
|
|
14
13
|
client: httpm.HttpClient;
|
|
15
14
|
versionParam: string;
|
|
16
|
-
/**
|
|
17
|
-
* Creates an instance of the RestClient
|
|
18
|
-
* @constructor
|
|
19
|
-
* @param {string} userAgent - userAgent for requests
|
|
20
|
-
* @param {string} baseUrl - (Optional) If not specified, use full urls per request. If supplied and a function passes a relative url, it will be appended to this
|
|
21
|
-
* @param {ifm.IRequestHandler[]} handlers - handlers are typically auth handlers (basic, bearer, ntlm supplied)
|
|
22
|
-
* @param {ifm.IRequestOptions} requestOptions - options for each http requests (http proxy setting, socket timeout)
|
|
23
|
-
*/
|
|
24
15
|
constructor(userAgent: string, baseUrl?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
|
|
25
16
|
private _baseUrl;
|
|
26
|
-
/**
|
|
27
|
-
* Gets a resource from an endpoint
|
|
28
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
29
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
30
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
31
|
-
*/
|
|
32
17
|
options<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
33
|
-
/**
|
|
34
|
-
* Gets a resource from an endpoint
|
|
35
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
36
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
37
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
38
|
-
*/
|
|
39
18
|
get<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
40
|
-
/**
|
|
41
|
-
* Deletes a resource from an endpoint
|
|
42
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
43
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
44
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
45
|
-
*/
|
|
46
19
|
del<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
47
|
-
/**
|
|
48
|
-
* Creates resource(s) from an endpoint
|
|
49
|
-
* T type of object returned.
|
|
50
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
51
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
52
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
53
|
-
*/
|
|
54
20
|
create<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
55
|
-
/**
|
|
56
|
-
* Updates resource(s) from an endpoint
|
|
57
|
-
* T type of object returned.
|
|
58
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
59
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
60
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
61
|
-
*/
|
|
62
21
|
update<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
63
|
-
/**
|
|
64
|
-
* Replaces resource(s) from an endpoint
|
|
65
|
-
* T type of object returned.
|
|
66
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
67
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
68
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
69
|
-
*/
|
|
70
22
|
replace<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
71
23
|
uploadStream<T>(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, options?: IRequestOptions): Promise<IRestResponse<T>>;
|
|
72
24
|
private _headersFromOptions;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,26 +13,12 @@ exports.RestClient = void 0;
|
|
|
15
13
|
const httpm = require("./HttpClient");
|
|
16
14
|
const util = require("./Util");
|
|
17
15
|
class RestClient {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of the RestClient
|
|
20
|
-
* @constructor
|
|
21
|
-
* @param {string} userAgent - userAgent for requests
|
|
22
|
-
* @param {string} baseUrl - (Optional) If not specified, use full urls per request. If supplied and a function passes a relative url, it will be appended to this
|
|
23
|
-
* @param {ifm.IRequestHandler[]} handlers - handlers are typically auth handlers (basic, bearer, ntlm supplied)
|
|
24
|
-
* @param {ifm.IRequestOptions} requestOptions - options for each http requests (http proxy setting, socket timeout)
|
|
25
|
-
*/
|
|
26
16
|
constructor(userAgent, baseUrl, handlers, requestOptions) {
|
|
27
17
|
this.client = new httpm.HttpClient(userAgent, handlers, requestOptions);
|
|
28
18
|
if (baseUrl) {
|
|
29
19
|
this._baseUrl = baseUrl;
|
|
30
20
|
}
|
|
31
21
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Gets a resource from an endpoint
|
|
34
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
35
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
36
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
37
|
-
*/
|
|
38
22
|
options(requestUrl, options) {
|
|
39
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
24
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -42,12 +26,6 @@ class RestClient {
|
|
|
42
26
|
return this._processResponse(res, options);
|
|
43
27
|
});
|
|
44
28
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Gets a resource from an endpoint
|
|
47
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
48
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
49
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
50
|
-
*/
|
|
51
29
|
get(requestUrl, options) {
|
|
52
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
31
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -55,12 +33,6 @@ class RestClient {
|
|
|
55
33
|
return this._processResponse(res, options);
|
|
56
34
|
});
|
|
57
35
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Deletes a resource from an endpoint
|
|
60
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
61
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
62
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
63
|
-
*/
|
|
64
36
|
del(requestUrl, options) {
|
|
65
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
38
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -68,13 +40,6 @@ class RestClient {
|
|
|
68
40
|
return this._processResponse(res, options);
|
|
69
41
|
});
|
|
70
42
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates resource(s) from an endpoint
|
|
73
|
-
* T type of object returned.
|
|
74
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
75
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
76
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
77
|
-
*/
|
|
78
43
|
create(requestUrl, resources, options) {
|
|
79
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
45
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -84,13 +49,6 @@ class RestClient {
|
|
|
84
49
|
return this._processResponse(res, options);
|
|
85
50
|
});
|
|
86
51
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Updates resource(s) from an endpoint
|
|
89
|
-
* T type of object returned.
|
|
90
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
91
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
92
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
93
|
-
*/
|
|
94
52
|
update(requestUrl, resources, options) {
|
|
95
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
54
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -100,13 +58,6 @@ class RestClient {
|
|
|
100
58
|
return this._processResponse(res, options);
|
|
101
59
|
});
|
|
102
60
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Replaces resource(s) from an endpoint
|
|
105
|
-
* T type of object returned.
|
|
106
|
-
* Be aware that not found returns a null. Other error conditions reject the promise
|
|
107
|
-
* @param {string} requestUrl - fully qualified or relative url
|
|
108
|
-
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
|
|
109
|
-
*/
|
|
110
61
|
replace(requestUrl, resources, options) {
|
|
111
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
63
|
let url = util.getUrl(requestUrl, this._baseUrl);
|
|
@@ -139,12 +90,10 @@ class RestClient {
|
|
|
139
90
|
let rres = {};
|
|
140
91
|
let statusCode = res.message.statusCode;
|
|
141
92
|
rres.statusCode = statusCode;
|
|
142
|
-
// not found leads to null obj returned
|
|
143
93
|
if (statusCode == httpm.HttpCodes.NotFound) {
|
|
144
94
|
resolve(rres);
|
|
145
95
|
}
|
|
146
96
|
let obj;
|
|
147
|
-
// get the result from the body
|
|
148
97
|
try {
|
|
149
98
|
let contents = yield res.readBody();
|
|
150
99
|
if (contents && contents.length > 0) {
|
|
@@ -158,12 +107,9 @@ class RestClient {
|
|
|
158
107
|
}
|
|
159
108
|
}
|
|
160
109
|
catch (err) {
|
|
161
|
-
// Invalid resource (contents not json); leaving result obj null
|
|
162
110
|
}
|
|
163
|
-
// note that 3xx redirects are handled by the http layer.
|
|
164
111
|
if (statusCode > 299) {
|
|
165
112
|
let msg;
|
|
166
|
-
// if exception/error in body, attempt to get better error
|
|
167
113
|
if (obj && obj.message) {
|
|
168
114
|
msg = obj.message;
|
|
169
115
|
}
|
|
@@ -171,7 +117,6 @@ class RestClient {
|
|
|
171
117
|
msg = "Failed request: (" + statusCode + ")";
|
|
172
118
|
}
|
|
173
119
|
let err = new Error(msg);
|
|
174
|
-
// attach statusCode and body obj (if available) to the error object
|
|
175
120
|
err['statusCode'] = statusCode;
|
|
176
121
|
if (rres.result) {
|
|
177
122
|
err['result'] = rres.result;
|
|
@@ -186,3 +131,4 @@ class RestClient {
|
|
|
186
131
|
}
|
|
187
132
|
}
|
|
188
133
|
exports.RestClient = RestClient;
|
|
134
|
+
//# sourceMappingURL=RestClient.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* creates an url from a request url and optional base url (http://server:8080)
|
|
3
|
-
* @param {string} requestUrl - a fully qualified url or relative url
|
|
4
|
-
* @param {string} baseUrl - an optional baseUrl (http://server:8080)
|
|
5
|
-
* @return {string} - resultant url
|
|
6
|
-
*/
|
|
7
1
|
export declare function getUrl(requestUrl: string, baseUrl?: string): string;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUrl =
|
|
3
|
+
exports.getUrl = getUrl;
|
|
4
4
|
const url = require("url");
|
|
5
|
-
/**
|
|
6
|
-
* creates an url from a request url and optional base url (http://server:8080)
|
|
7
|
-
* @param {string} requestUrl - a fully qualified url or relative url
|
|
8
|
-
* @param {string} baseUrl - an optional baseUrl (http://server:8080)
|
|
9
|
-
* @return {string} - resultant url
|
|
10
|
-
*/
|
|
11
5
|
function getUrl(requestUrl, baseUrl) {
|
|
12
6
|
if (!baseUrl) {
|
|
13
7
|
return requestUrl;
|
|
14
8
|
}
|
|
15
9
|
let base = url.parse(baseUrl);
|
|
16
|
-
// requestUrl (specific per request) always wins
|
|
17
10
|
let combined = url.parse(requestUrl);
|
|
18
11
|
combined.protocol = combined.protocol || base.protocol;
|
|
19
12
|
combined.auth = combined.auth || base.auth;
|
|
20
13
|
combined.host = combined.host || base.host;
|
|
21
|
-
// path from requestUrl always wins
|
|
22
14
|
let res = url.format(combined);
|
|
23
15
|
return res;
|
|
24
16
|
}
|
|
25
|
-
|
|
17
|
+
//# sourceMappingURL=Util.js.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.BasicCredentialHandler = void 0;
|
|
6
4
|
class BasicCredentialHandler {
|
|
@@ -8,13 +6,10 @@ class BasicCredentialHandler {
|
|
|
8
6
|
this.username = username;
|
|
9
7
|
this.password = password;
|
|
10
8
|
}
|
|
11
|
-
// currently implements pre-authorization
|
|
12
|
-
// TODO: support preAuth = false where it hooks on 401
|
|
13
9
|
prepareRequest(options) {
|
|
14
10
|
options.headers['Authorization'] = 'Basic ' + Buffer.from(this.username + ':' + this.password, 'utf8').toString('base64');
|
|
15
11
|
options.headers['X-TFS-FedAuthRedirect'] = 'Suppress';
|
|
16
12
|
}
|
|
17
|
-
// This handler cannot handle 401
|
|
18
13
|
canHandleAuthentication(res) {
|
|
19
14
|
return false;
|
|
20
15
|
}
|
|
@@ -22,3 +17,4 @@ class BasicCredentialHandler {
|
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
exports.BasicCredentialHandler = BasicCredentialHandler;
|
|
20
|
+
//# sourceMappingURL=basiccreds.js.map
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.BearerCredentialHandler = void 0;
|
|
6
4
|
class BearerCredentialHandler {
|
|
7
5
|
constructor(token) {
|
|
8
6
|
this.token = token;
|
|
9
7
|
}
|
|
10
|
-
// currently implements pre-authorization
|
|
11
|
-
// TODO: support preAuth = false where it hooks on 401
|
|
12
8
|
prepareRequest(options) {
|
|
13
9
|
options.headers['Authorization'] = 'Bearer ' + this.token;
|
|
14
10
|
options.headers['X-TFS-FedAuthRedirect'] = 'Suppress';
|
|
15
11
|
}
|
|
16
|
-
// This handler cannot handle 401
|
|
17
12
|
canHandleAuthentication(res) {
|
|
18
13
|
return false;
|
|
19
14
|
}
|
|
@@ -21,3 +16,4 @@ class BearerCredentialHandler {
|
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
exports.BearerCredentialHandler = BearerCredentialHandler;
|
|
19
|
+
//# sourceMappingURL=bearertoken.js.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -28,23 +26,17 @@ class NtlmCredentialHandler {
|
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
prepareRequest(options) {
|
|
31
|
-
// No headers or options need to be set. We keep the credentials on the handler itself.
|
|
32
|
-
// If a (proxy) agent is set, remove it as we don't support proxy for NTLM at this time
|
|
33
29
|
if (options.agent) {
|
|
34
30
|
delete options.agent;
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
canHandleAuthentication(res) {
|
|
38
34
|
if (res && res.statusCode === 401) {
|
|
39
|
-
// Ensure that we're talking NTLM here
|
|
40
|
-
// Once we have the www-authenticate header, split it so we can ensure we can talk NTLM
|
|
41
35
|
var wwwAuthenticate = res.headers['www-authenticate'];
|
|
42
36
|
if (wwwAuthenticate !== undefined) {
|
|
43
37
|
var mechanisms = wwwAuthenticate.split(', ');
|
|
44
38
|
var idx = mechanisms.indexOf("NTLM");
|
|
45
39
|
if (idx >= 0) {
|
|
46
|
-
// Check specifically for 'NTLM' since www-authenticate header can also contain
|
|
47
|
-
// the Authorization value to use in the form of 'NTLM TlRMTVNT....AAAADw=='
|
|
48
40
|
if (mechanisms[idx].length == 4) {
|
|
49
41
|
return true;
|
|
50
42
|
}
|
|
@@ -53,9 +45,7 @@ class NtlmCredentialHandler {
|
|
|
53
45
|
}
|
|
54
46
|
return false;
|
|
55
47
|
}
|
|
56
|
-
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
|
|
57
48
|
handleAuthentication(httpClient, protocol, options, objs, finalCallback) {
|
|
58
|
-
// Set up the headers for NTLM authentication
|
|
59
49
|
var ntlmOptions = _.extend(options, {
|
|
60
50
|
username: this.username,
|
|
61
51
|
password: this.password,
|
|
@@ -70,9 +60,6 @@ class NtlmCredentialHandler {
|
|
|
70
60
|
keepaliveAgent = new http.Agent({ keepAlive: true });
|
|
71
61
|
}
|
|
72
62
|
let self = this;
|
|
73
|
-
// The following pattern of sending the type1 message following immediately (in a setImmediate) is
|
|
74
|
-
// critical for the NTLM exchange to happen. If we removed setImmediate (or call in a different manner)
|
|
75
|
-
// the NTLM exchange will always fail with a 401.
|
|
76
63
|
this.sendType1Message(httpClient, protocol, ntlmOptions, objs, keepaliveAgent, function (err, res) {
|
|
77
64
|
if (err) {
|
|
78
65
|
return finalCallback(err, null, null);
|
|
@@ -82,7 +69,6 @@ class NtlmCredentialHandler {
|
|
|
82
69
|
});
|
|
83
70
|
});
|
|
84
71
|
}
|
|
85
|
-
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
|
|
86
72
|
sendType1Message(httpClient, protocol, options, objs, keepaliveAgent, callback) {
|
|
87
73
|
var type1msg = ntlm.createType1Message(options);
|
|
88
74
|
var type1options = {
|
|
@@ -92,23 +78,18 @@ class NtlmCredentialHandler {
|
|
|
92
78
|
},
|
|
93
79
|
timeout: options.timeout || 0,
|
|
94
80
|
agent: keepaliveAgent,
|
|
95
|
-
// don't redirect because http could change to https which means we need to change the keepaliveAgent
|
|
96
81
|
allowRedirects: false
|
|
97
82
|
};
|
|
98
83
|
type1options = _.extend(type1options, _.omit(options, 'headers'));
|
|
99
84
|
httpClient.requestInternal(protocol, type1options, objs, callback);
|
|
100
85
|
}
|
|
101
|
-
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
|
|
102
86
|
sendType3Message(httpClient, protocol, options, objs, keepaliveAgent, res, callback) {
|
|
103
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
88
|
if (!res.headers['www-authenticate']) {
|
|
105
89
|
return callback(new Error('www-authenticate not found on response of second request'));
|
|
106
90
|
}
|
|
107
|
-
// parse type2 message from server:
|
|
108
91
|
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate']);
|
|
109
|
-
// create type3 message:
|
|
110
92
|
var type3msg = yield ntlm.createType3Message(type2msg, options);
|
|
111
|
-
// build type3 request:
|
|
112
93
|
var type3options = {
|
|
113
94
|
headers: {
|
|
114
95
|
'Authorization': type3msg
|
|
@@ -116,12 +97,11 @@ class NtlmCredentialHandler {
|
|
|
116
97
|
allowRedirects: false,
|
|
117
98
|
agent: keepaliveAgent
|
|
118
99
|
};
|
|
119
|
-
// pass along other options:
|
|
120
100
|
type3options.headers = _.extend(type3options.headers, options.headers);
|
|
121
101
|
type3options = _.extend(type3options, _.omit(options, 'headers'));
|
|
122
|
-
// send type3 message to server:
|
|
123
102
|
httpClient.requestInternal(protocol, type3options, objs, callback);
|
|
124
103
|
});
|
|
125
104
|
}
|
|
126
105
|
}
|
|
127
106
|
exports.NtlmCredentialHandler = NtlmCredentialHandler;
|
|
107
|
+
//# sourceMappingURL=ntlm.js.map
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft. All rights reserved.
|
|
3
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.PersonalAccessTokenCredentialHandler = void 0;
|
|
6
4
|
class PersonalAccessTokenCredentialHandler {
|
|
7
5
|
constructor(token) {
|
|
8
6
|
this.token = token;
|
|
9
7
|
}
|
|
10
|
-
// currently implements pre-authorization
|
|
11
|
-
// TODO: support preAuth = false where it hooks on 401
|
|
12
8
|
prepareRequest(options) {
|
|
13
9
|
options.headers['Authorization'] = 'Basic ' + Buffer.from('PAT:' + this.token, 'utf8').toString('base64');
|
|
14
10
|
options.headers['X-TFS-FedAuthRedirect'] = 'Suppress';
|
|
15
11
|
}
|
|
16
|
-
// This handler cannot handle 401
|
|
17
12
|
canHandleAuthentication(res) {
|
|
18
13
|
return false;
|
|
19
14
|
}
|
|
@@ -21,3 +16,4 @@ class PersonalAccessTokenCredentialHandler {
|
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
|
|
19
|
+
//# sourceMappingURL=personalaccesstoken.js.map
|
package/Providers/webClient.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.WebClient = void 0;
|
|
13
|
-
// restrict usage of typed-rest-client to this file
|
|
14
13
|
const httpm = require("./typed-rest-client/HttpClient");
|
|
15
14
|
var tl = require('azure-pipelines-task-lib/task');
|
|
16
15
|
var packagejson = require('../package.json');
|
|
@@ -44,13 +43,11 @@ class WebClient {
|
|
|
44
43
|
var msg = tl.loc("FailedRequest", statusCode);
|
|
45
44
|
err = new Error(msg);
|
|
46
45
|
err['statusCode'] = statusCode;
|
|
47
|
-
// get the result from the body
|
|
48
46
|
try {
|
|
49
47
|
let result = yield res.readBody();
|
|
50
48
|
err['result'] = result;
|
|
51
49
|
}
|
|
52
50
|
catch (error) {
|
|
53
|
-
// Invalid contents; leaving result obj null
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
if (!!err) {
|
|
@@ -60,3 +57,4 @@ class WebClient {
|
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
exports.WebClient = WebClient;
|
|
60
|
+
//# sourceMappingURL=webClient.js.map
|
|
@@ -12,7 +12,6 @@ class WebClientFactory {
|
|
|
12
12
|
return new webClient_1.WebClient(handlers, options);
|
|
13
13
|
}
|
|
14
14
|
static initializeProxy(options) {
|
|
15
|
-
// try get proxy setting from environment variable set by azure-pipelines-task-lib if there is no proxy setting in the options
|
|
16
15
|
if (!options.proxy || !options.proxy.proxyUrl) {
|
|
17
16
|
if (global['_vsts_task_lib_proxy']) {
|
|
18
17
|
let proxyFromEnv = {
|
|
@@ -24,7 +23,6 @@ class WebClientFactory {
|
|
|
24
23
|
options.proxy = proxyFromEnv;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
// try get cert setting from environment variable set by azure-pipelines-task-lib if there is no cert setting in the options
|
|
28
26
|
if (!options.cert) {
|
|
29
27
|
if (global['_vsts_task_lib_cert']) {
|
|
30
28
|
let certFromEnv = {
|
|
@@ -36,25 +34,20 @@ class WebClientFactory {
|
|
|
36
34
|
options.cert = certFromEnv;
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
// try get ignore SSL error setting from environment variable set by azure-pipelines-task-lib if there is no ignore SSL error setting in the options
|
|
40
37
|
if (!options.ignoreSslError) {
|
|
41
38
|
options.ignoreSslError = !!global['_vsts_task_lib_skip_cert_validation'];
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
static _readTaskLibSecrets(lookupKey) {
|
|
45
|
-
// the lookupKey should has following format
|
|
46
|
-
// base64encoded<keyFilePath>:base64encoded<encryptedContent>
|
|
47
42
|
if (lookupKey && lookupKey.indexOf(':') > 0) {
|
|
48
43
|
let lookupInfo = lookupKey.split(':', 2);
|
|
49
|
-
// file contains encryption key
|
|
50
44
|
let keyFile = Buffer.from(lookupInfo[0], 'base64').toString('utf8');
|
|
51
|
-
let
|
|
45
|
+
let keyAndIv = fs.readFileSync(keyFile, 'utf8');
|
|
46
|
+
let [keyBase64, ivBase64] = keyAndIv.split(':', 2);
|
|
47
|
+
let encryptKey = Buffer.from(keyBase64, 'base64');
|
|
48
|
+
let iv = ivBase64 ? Buffer.from(ivBase64, 'base64') : Buffer.alloc(16, 0);
|
|
52
49
|
let encryptedContent = Buffer.from(lookupInfo[1], 'base64').toString('utf8');
|
|
53
|
-
|
|
54
|
-
const key = encryptKey.length === 32 ? encryptKey : crypto.createHash('sha256').update(encryptKey).digest();
|
|
55
|
-
// Use zero IV for AES-256-CTR (must match encryption side)
|
|
56
|
-
const iv = Buffer.alloc(16, 0);
|
|
57
|
-
let decipher = crypto.createDecipheriv("aes-256-ctr", key, iv);
|
|
50
|
+
let decipher = crypto.createDecipheriv("aes-256-ctr", encryptKey, iv);
|
|
58
51
|
let decryptedContent = decipher.update(encryptedContent, 'hex', 'utf8');
|
|
59
52
|
decryptedContent += decipher.final('utf8');
|
|
60
53
|
return decryptedContent;
|
|
@@ -62,3 +55,4 @@ class WebClientFactory {
|
|
|
62
55
|
}
|
|
63
56
|
}
|
|
64
57
|
exports.WebClientFactory = WebClientFactory;
|
|
58
|
+
//# sourceMappingURL=webClientFactory.js.map
|
package/Providers/webProvider.js
CHANGED
|
@@ -93,6 +93,7 @@ class WebProvider {
|
|
|
93
93
|
if (err) {
|
|
94
94
|
logger_1.Logger.logMessage(err ? JSON.stringify(err) : "");
|
|
95
95
|
reject(err);
|
|
96
|
+
return;
|
|
96
97
|
}
|
|
97
98
|
try {
|
|
98
99
|
var template = handlebars.compile(templateFileContent);
|
|
@@ -100,6 +101,10 @@ class WebProvider {
|
|
|
100
101
|
var context = this.extend(response, this.variables);
|
|
101
102
|
var result = template(context);
|
|
102
103
|
var items = JSON.parse(result);
|
|
104
|
+
if (!Array.isArray(items)) {
|
|
105
|
+
reject(new Error(tl.loc("FailedToParseResponse", body, `Rendered template '${this.getTemplateFilePath()}' did not produce a JSON array (got ${typeof items}).`)));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
103
108
|
resolve(items);
|
|
104
109
|
}
|
|
105
110
|
catch (error) {
|
|
@@ -127,3 +132,4 @@ class WebProvider {
|
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
exports.WebProvider = WebProvider;
|
|
135
|
+
//# sourceMappingURL=webProvider.js.map
|
package/Providers/zipProvider.js
CHANGED
package/Store/index.js
CHANGED
|
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ArtifactItemStore = void 0;
|
|
4
4
|
var artifactItemStore_1 = require("./artifactItemStore");
|
|
5
5
|
Object.defineProperty(exports, "ArtifactItemStore", { enumerable: true, get: function () { return artifactItemStore_1.ArtifactItemStore; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "Das Verzeichnis \"%s\" kann nicht gelesen werden. Fehler: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Download von \"%s\" wird erneut versucht, Wiederholungsanzahl: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Die Verarbeitung des Elements \"%s\" wird übersprungen.",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: nicht verarbeitete Zurückweisung %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: Ausnahmefehler %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: nicht verarbeitete Zurückweisung %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: Ausnahmefehler %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Fehlerhafte Anforderung: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "Unable to read directory %s. Error: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Retrying download of %s, retry count: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Skipped processing item %s",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: unhandled rejection %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: unhandled exception %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: unhandled rejection %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: unhandled exception %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Failed request: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "No se puede leer el directorio %s. Error: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Reintentando la descarga de %s, número de reintentos: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Procesamiento de %s omitido",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: rechazo no controlado: %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: excepción no controlada: %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: rechazo no controlado: %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: excepción no controlada: %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Error en la solicitud: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "Impossible de lire le répertoire %s. Erreur : %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Nouvelle tentative de téléchargement de %s, nombre de tentatives : %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Traitement de l’élément ignoré %s",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2 : rejet non géré %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2 : exception non gérée %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Échec de la demande : (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "Non è possibile leggere la directory %s. Errore: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Nuovo tentativo di download di %s. Conteggio dei tentativi: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Elaborazione dell'elemento %s ignorata",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: rifiuto non gestito %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: eccezione non gestita %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: rifiuto non gestito %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: eccezione non gestita %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Richiesta non riuscita: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "ディレクトリ %s を読み取ることができません。エラー: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "%s のダウンロードを再試行しています。再試行回数: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "項目 %s の処理をスキップしました",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: ハンドルされない拒否 %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: ハンドルされない例外 %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: ハンドルされない拒否 %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: ハンドルされない例外 %s",
|
|
11
11
|
"loc.messages.FailedRequest": "失敗した要求: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "디렉터리 %s을(를) 읽을 수 없습니다. 오류: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "%s 다운로드를 다시 시도하는 중, 다시 시도 횟수: %s회",
|
|
8
8
|
"loc.messages.SkippingItem": "항목 %s의 처리를 건너뜀",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: 처리되지 않은 거부 %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: 처리되지 않은 예외 %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: 처리되지 않은 거부 %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: 처리되지 않은 예외 %s",
|
|
11
11
|
"loc.messages.FailedRequest": "실패한 요청: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "Не удается считать каталог %s. Ошибка: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "Повторная попытка скачать %s, всего попыток: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "Пропущена обработка элемента %s",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: необработанное отклонение %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: необработанное исключение %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: необработанное отклонение %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: необработанное исключение %s",
|
|
11
11
|
"loc.messages.FailedRequest": "Сбой запроса: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "未能读取目录 %s。错误: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "重新尝试下载 %s,重试计数: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "已跳过处理项目 %s",
|
|
9
|
-
"loc.messages.UnhandledRejection": "
|
|
10
|
-
"loc.messages.UnhandledException": "
|
|
9
|
+
"loc.messages.UnhandledRejection": "项目引擎-v2: 未处理的拒绝 %s",
|
|
10
|
+
"loc.messages.UnhandledException": "项目引擎-v2: 未处理的异常 %s",
|
|
11
11
|
"loc.messages.FailedRequest": "请求失败: (statusCode)"
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"loc.messages.UnableToReadDirectory": "無法讀取目錄 %s。錯誤: %s",
|
|
7
7
|
"loc.messages.RetryingDownload": "正在重試下載 %s,重試次數: %s",
|
|
8
8
|
"loc.messages.SkippingItem": "已跳過處理項目 %s",
|
|
9
|
-
"loc.messages.UnhandledRejection": "artifact-engine: 未處理的拒絕 %s",
|
|
10
|
-
"loc.messages.UnhandledException": "artifact-engine: 未處理的例外狀況 %s",
|
|
9
|
+
"loc.messages.UnhandledRejection": "artifact-engine-v2: 未處理的拒絕 %s",
|
|
10
|
+
"loc.messages.UnhandledException": "artifact-engine-v2: 未處理的例外狀況 %s",
|
|
11
11
|
"loc.messages.FailedRequest": "失敗的要求: (statusCode)"
|
|
12
12
|
}
|