Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

artifact-engine

Package Overview
Dependencies
Maintainers
8
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artifact-engine - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

Providers/typed-rest-client/opensource/node-http-ntlm/readme.txt

2

Engine/artifactEngine.d.ts

@@ -7,3 +7,3 @@ import * as models from '../Models';

processArtifactItemImplementation(sourceProvider: models.IArtifactProvider, item: models.ArtifactItem, destProvider: models.IArtifactProvider, artifactEngineOptions: ArtifactEngineOptions, resolve: any, reject: any, retryCount?: number): void;
private getRetryIntervalInSeconds;
private getRetryIntervalInSeconds(baseRetryInterval, retryCount);
createPatternList(artifactEngineOptions: ArtifactEngineOptions): void;

@@ -10,0 +10,0 @@ private artifactItemStore;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactEngine = void 0;
const path = require("path");

@@ -67,2 +66,4 @@ var tl = require('azure-pipelines-task-lib/task');

logger_1.Logger.logMessage(tl.loc("RetryingDownload", item.path, (retryCount + 1)));
// retry interval sequence 5s 15s 45s 135s
// 2 min is the time limit for freeing of ports
setTimeout(() => this

@@ -167,2 +168,1 @@ .processArtifactItemImplementation(sourceProvider, item, destProvider, artifactEngineOptions, resolve, reject, retryCount + 1), this.getRetryIntervalInSeconds(artifactEngineOptions.retryIntervalInSeconds, retryCount) * 1000);

});
//# sourceMappingURL=artifactEngine.js.map

@@ -0,0 +0,0 @@ export declare class ArtifactEngineOptions {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactEngineOptions = void 0;
class ArtifactEngineOptions {

@@ -15,2 +14,1 @@ constructor() {

exports.ArtifactEngineOptions = ArtifactEngineOptions;
//# sourceMappingURL=artifactEngineOptions.js.map

@@ -0,0 +0,0 @@ export declare function publishEvent(feature: any, properties: any | IReliabilityData): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.publishEvent = void 0;
var tl = require('azure-pipelines-task-lib');

@@ -46,2 +45,1 @@ var packagejson = require('../package.json');

exports.publishEvent = publishEvent;
//# sourceMappingURL=cilogger.js.map
export { ArtifactEngineOptions } from "./artifactEngineOptions";
export { ArtifactEngine } from "./artifactEngine";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactEngine = exports.ArtifactEngineOptions = void 0;
var artifactEngineOptions_1 = require("./artifactEngineOptions");
Object.defineProperty(exports, "ArtifactEngineOptions", { enumerable: true, get: function () { return artifactEngineOptions_1.ArtifactEngineOptions; } });
exports.ArtifactEngineOptions = artifactEngineOptions_1.ArtifactEngineOptions;
var artifactEngine_1 = require("./artifactEngine");
Object.defineProperty(exports, "ArtifactEngine", { enumerable: true, get: function () { return artifactEngine_1.ArtifactEngine; } });
//# sourceMappingURL=index.js.map
exports.ArtifactEngine = artifactEngine_1.ArtifactEngine;

@@ -9,3 +9,3 @@ import { ArtifactItemStore } from '../Store/artifactItemStore';

logSummary(): void;
private padText;
private padText(textToPad, maxTextLength, padChar?);
static verbose: boolean;

@@ -12,0 +12,0 @@ private store;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -12,3 +11,2 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const Models_1 = require("../Models");

@@ -113,2 +111,1 @@ const ticketState_1 = require("../Models/ticketState");

exports.Logger = Logger;
//# sourceMappingURL=logger.js.map

@@ -0,0 +0,0 @@ export declare class Worker<T> {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Worker = void 0;
const logger_1 = require("./logger");

@@ -51,2 +50,1 @@ class Worker {

exports.Worker = Worker;
//# sourceMappingURL=worker.js.map

@@ -0,0 +0,0 @@ import { ArtifactItem } from "./artifactItem";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactDownloadTicket = void 0;
class ArtifactDownloadTicket {
}
exports.ArtifactDownloadTicket = ArtifactDownloadTicket;
//# sourceMappingURL=artifactDownloadTicket.js.map

@@ -0,0 +0,0 @@ import { ItemType } from "./itemType";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactItem = void 0;
class ArtifactItem {

@@ -10,2 +9,1 @@ constructor() {

exports.ArtifactItem = ArtifactItem;
//# sourceMappingURL=artifactItem.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { ArtifactItem } from "./artifactItem";

@@ -3,0 +2,0 @@ import { ArtifactItemStore } from '../Store/artifactItemStore';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=artifactprovider.js.map
export declare class Constants {
static DestinationUrlKey: string;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Constants = void 0;
class Constants {
}
Constants.DestinationUrlKey = "destinationUrl";
exports.Constants = Constants;
Constants.DestinationUrlKey = "destinationUrl";
//# sourceMappingURL=constants.js.map

@@ -0,0 +0,0 @@ export { ArtifactDownloadTicket } from './artifactDownloadTicket';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Constants = exports.TicketState = exports.ItemType = exports.ArtifactItem = exports.ArtifactDownloadTicket = void 0;
var artifactDownloadTicket_1 = require("./artifactDownloadTicket");
Object.defineProperty(exports, "ArtifactDownloadTicket", { enumerable: true, get: function () { return artifactDownloadTicket_1.ArtifactDownloadTicket; } });
exports.ArtifactDownloadTicket = artifactDownloadTicket_1.ArtifactDownloadTicket;
var artifactItem_1 = require("./artifactItem");
Object.defineProperty(exports, "ArtifactItem", { enumerable: true, get: function () { return artifactItem_1.ArtifactItem; } });
exports.ArtifactItem = artifactItem_1.ArtifactItem;
var itemType_1 = require("./itemType");
Object.defineProperty(exports, "ItemType", { enumerable: true, get: function () { return itemType_1.ItemType; } });
exports.ItemType = itemType_1.ItemType;
var ticketState_1 = require("./ticketState");
Object.defineProperty(exports, "TicketState", { enumerable: true, get: function () { return ticketState_1.TicketState; } });
exports.TicketState = ticketState_1.TicketState;
var constants_1 = require("./constants");
Object.defineProperty(exports, "Constants", { enumerable: true, get: function () { return constants_1.Constants; } });
//# sourceMappingURL=index.js.map
exports.Constants = constants_1.Constants;
export declare enum ItemType {
Any,
Folder,
File
File,
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItemType = void 0;
var ItemType;

@@ -10,2 +9,1 @@ (function (ItemType) {

})(ItemType = exports.ItemType || (exports.ItemType = {}));
//# sourceMappingURL=itemType.js.map

@@ -6,3 +6,3 @@ export declare enum TicketState {

Skipped,
Failed
Failed,
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TicketState = void 0;
var TicketState;

@@ -12,2 +11,1 @@ (function (TicketState) {

})(TicketState = exports.TicketState || (exports.TicketState = {}));
//# sourceMappingURL=ticketState.js.map
{
"name": "artifact-engine",
"version": "1.2.0",
"version": "1.3.0",
"description": "Artifact Engine to download artifacts from jenkins, teamcity, vsts",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,2 +0,1 @@

/// <reference types="node" />
import * as models from '../Models';

@@ -12,5 +11,5 @@ import { ArtifactItemStore } from '../Store/artifactItemStore';

dispose(): void;
private getItems;
private getItems(itemsPath, parentRelativePath?);
private _rootLocation;
private _rootItemPath;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilesystemProvider = void 0;
const path = require("path");

@@ -50,2 +49,3 @@ const fs = require("fs");

try {
// create parent folder if it has not already been created
tl.mkdirP(folder);

@@ -99,2 +99,3 @@ logger_1.Logger.logMessage(tl.loc("DownloadingTo", item.path, outputItemPath));

var filePath = path.join(itemsPath, file);
// do not follow symbolic link
var itemStat;

@@ -125,2 +126,1 @@ try {

exports.FilesystemProvider = FilesystemProvider;
//# sourceMappingURL=filesystemProvider.js.map

@@ -0,0 +0,0 @@ export { WebProvider } from "./webProvider";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StubProvider = exports.ZipProvider = exports.FilesystemProvider = exports.WebProvider = void 0;
var webProvider_1 = require("./webProvider");
Object.defineProperty(exports, "WebProvider", { enumerable: true, get: function () { return webProvider_1.WebProvider; } });
exports.WebProvider = webProvider_1.WebProvider;
var filesystemProvider_1 = require("./filesystemProvider");
Object.defineProperty(exports, "FilesystemProvider", { enumerable: true, get: function () { return filesystemProvider_1.FilesystemProvider; } });
exports.FilesystemProvider = filesystemProvider_1.FilesystemProvider;
var zipProvider_1 = require("./zipProvider");
Object.defineProperty(exports, "ZipProvider", { enumerable: true, get: function () { return zipProvider_1.ZipProvider; } });
exports.ZipProvider = zipProvider_1.ZipProvider;
var stubProvider_1 = require("./stubProvider");
Object.defineProperty(exports, "StubProvider", { enumerable: true, get: function () { return stubProvider_1.StubProvider; } });
//# sourceMappingURL=index.js.map
exports.StubProvider = stubProvider_1.StubProvider;

@@ -1,2 +0,1 @@

/// <reference types="node" />
import * as models from '../Models';

@@ -3,0 +2,0 @@ import { ItemType } from '../Models';

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -12,3 +11,2 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.StubProvider = void 0;
const Stream = require("stream");

@@ -89,2 +87,1 @@ const models = require("../Models");

exports.StubProvider = StubProvider;
//# sourceMappingURL=stubProvider.js.map

@@ -0,0 +0,0 @@ export { BasicCredentialHandler } from "./handlers/basiccreds";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PersonalAccessTokenCredentialHandler = exports.NtlmCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;
var basiccreds_1 = require("./handlers/basiccreds");
Object.defineProperty(exports, "BasicCredentialHandler", { enumerable: true, get: function () { return basiccreds_1.BasicCredentialHandler; } });
exports.BasicCredentialHandler = basiccreds_1.BasicCredentialHandler;
var bearertoken_1 = require("./handlers/bearertoken");
Object.defineProperty(exports, "BearerCredentialHandler", { enumerable: true, get: function () { return bearertoken_1.BearerCredentialHandler; } });
exports.BearerCredentialHandler = bearertoken_1.BearerCredentialHandler;
var ntlm_1 = require("./handlers/ntlm");
Object.defineProperty(exports, "NtlmCredentialHandler", { enumerable: true, get: function () { return ntlm_1.NtlmCredentialHandler; } });
exports.NtlmCredentialHandler = ntlm_1.NtlmCredentialHandler;
var personalaccesstoken_1 = require("./handlers/personalaccesstoken");
Object.defineProperty(exports, "PersonalAccessTokenCredentialHandler", { enumerable: true, get: function () { return personalaccesstoken_1.PersonalAccessTokenCredentialHandler; } });
//# sourceMappingURL=Handlers.js.map
exports.PersonalAccessTokenCredentialHandler = personalaccesstoken_1.PersonalAccessTokenCredentialHandler;

@@ -0,0 +0,0 @@ import ifm = require('../Interfaces');

"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicCredentialHandler = void 0;
class BasicCredentialHandler {

@@ -9,2 +10,4 @@ constructor(username, password) {

}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options) {

@@ -14,2 +17,3 @@ options.headers['Authorization'] = 'Basic ' + new Buffer(this.username + ':' + this.password).toString('base64');

}
// This handler cannot handle 401
canHandleAuthentication(res) {

@@ -22,2 +26,1 @@ return false;

exports.BasicCredentialHandler = BasicCredentialHandler;
//# sourceMappingURL=basiccreds.js.map

@@ -0,0 +0,0 @@ import ifm = require('../Interfaces');

"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.BearerCredentialHandler = void 0;
class BearerCredentialHandler {

@@ -8,2 +9,4 @@ constructor(token) {

}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options) {

@@ -13,2 +16,3 @@ options.headers['Authorization'] = 'Bearer ' + this.token;

}
// This handler cannot handle 401
canHandleAuthentication(res) {

@@ -21,2 +25,1 @@ return false;

exports.BearerCredentialHandler = BearerCredentialHandler;
//# sourceMappingURL=bearertoken.js.map

@@ -11,4 +11,4 @@ import ifm = require('../Interfaces');

handleAuthentication(httpClient: any, protocol: any, options: any, objs: any, finalCallback: any): void;
private sendType1Message;
private sendType3Message;
private sendType1Message(httpClient, protocol, options, objs, keepaliveAgent, callback);
private sendType3Message(httpClient, protocol, options, objs, keepaliveAgent, res, callback);
}
"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.NtlmCredentialHandler = void 0;
const http = require("http");

@@ -20,2 +21,4 @@ const https = require("https");

prepareRequest(options) {
// No headers or options need to be set. We keep the credentials on the handler itself.
// If a (proxy) agent is set, remove it as we don't support proxy for NTLM at this time
if (options.agent) {

@@ -27,2 +30,4 @@ delete options.agent;

if (res && res.statusCode === 401) {
// Ensure that we're talking NTLM here
// Once we have the www-authenticate header, split it so we can ensure we can talk NTLM
var wwwAuthenticate = res.headers['www-authenticate'];

@@ -33,2 +38,4 @@ if (wwwAuthenticate !== undefined) {

if (idx >= 0) {
// Check specifically for 'NTLM' since www-authenticate header can also contain
// the Authorization value to use in the form of 'NTLM TlRMTVNT....AAAADw=='
if (mechanisms[idx].length == 4) {

@@ -42,3 +49,5 @@ return true;

}
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
handleAuthentication(httpClient, protocol, options, objs, finalCallback) {
// Set up the headers for NTLM authentication
var ntlmOptions = _.extend(options, {

@@ -58,2 +67,5 @@ username: this.username,

let self = this;
// The following pattern of sending the type1 message following immediately (in a setImmediate) is
// critical for the NTLM exchange to happen. If we removed setImmediate (or call in a different manner)
// the NTLM exchange will always fail with a 401.
this.sendType1Message(httpClient, protocol, ntlmOptions, objs, keepaliveAgent, function (err, res) {

@@ -68,2 +80,3 @@ if (err) {

}
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
sendType1Message(httpClient, protocol, options, objs, keepaliveAgent, callback) {

@@ -78,2 +91,3 @@ var type1msg = ntlm.createType1Message(options);

agent: keepaliveAgent,
// don't redirect because http could change to https which means we need to change the keepaliveAgent
allowRedirects: false

@@ -84,2 +98,3 @@ };

}
// The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js
sendType3Message(httpClient, protocol, options, objs, keepaliveAgent, res, callback) {

@@ -89,4 +104,7 @@ if (!res.headers['www-authenticate']) {

}
// parse type2 message from server:
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate']);
// create type3 message:
var type3msg = ntlm.createType3Message(type2msg, options);
// build type3 request:
var type3options = {

@@ -99,4 +117,6 @@ headers: {

};
// pass along other options:
type3options.headers = _.extend(type3options.headers, options.headers);
type3options = _.extend(type3options, _.omit(options, 'headers'));
// send type3 message to server:
httpClient.requestInternal(protocol, type3options, objs, callback);

@@ -106,2 +126,1 @@ }

exports.NtlmCredentialHandler = NtlmCredentialHandler;
//# sourceMappingURL=ntlm.js.map

@@ -0,0 +0,0 @@ import ifm = require('../Interfaces');

"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.PersonalAccessTokenCredentialHandler = void 0;
class PersonalAccessTokenCredentialHandler {

@@ -8,2 +9,4 @@ constructor(token) {

}
// currently implements pre-authorization
// TODO: support preAuth = false where it hooks on 401
prepareRequest(options) {

@@ -13,2 +16,3 @@ options.headers['Authorization'] = 'Basic ' + new Buffer('PAT:' + this.token).toString('base64');

}
// This handler cannot handle 401
canHandleAuthentication(res) {

@@ -21,2 +25,1 @@ return false;

exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;
//# sourceMappingURL=personalaccesstoken.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import url = require("url");

@@ -30,3 +29,3 @@ import http = require("http");

ServiceUnavailable = 503,
GatewayTimeout = 504
GatewayTimeout = 504,
}

@@ -71,9 +70,17 @@ export declare class HttpClientResponse {

sendStream(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, additionalHeaders?: ifm.IHeaders): Promise<HttpClientResponse>;
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
* Prefer get, del, post and patch
*/
request(verb: string, requestUrl: string, data: string | NodeJS.ReadableStream, headers: ifm.IHeaders): Promise<HttpClientResponse>;
/**
* Needs to be called if keepAlive is set to true in request options.
*/
dispose(): void;
private _requestRaw;
private _prepareRequest;
private _getAgent;
private _getProxy;
private _isBypassProxy;
private _requestRaw(info, data);
private _prepareRequest(method, requestUrl, headers);
private _getAgent(requestUrl);
private _getProxy(requestUrl);
private _isBypassProxy(requestUrl);
}
"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -12,3 +13,2 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpCodes = void 0;
const url = require("url");

@@ -98,2 +98,3 @@ const http = require("http");

this._certConfig = requestOptions.cert;
// cache the cert content into memory, so we don't have to read it from disk every time
if (this._certConfig && this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) {

@@ -143,2 +144,7 @@ this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8');

}
/**
* Makes a raw http request.
* All other methods such as get, post, patch, and request ultimately call this.
* Prefer get, del, post and patch
*/
request(verb, requestUrl, data, headers) {

@@ -157,5 +163,9 @@ return __awaiter(this, void 0, void 0, function* () {

if (!redirectUrl) {
// if there's no location to redirect to, we won't
break;
}
// we need to finish reading the response before reassigning response
// which will leak the open socket.
yield response.readBody();
// let's make the request with the new redirectUrl
info = this._prepareRequest(verb, redirectUrl, headers);

@@ -168,2 +178,5 @@ response = yield this._requestRaw(info, data);

}
/**
* Needs to be called if keepAlive is set to true in request options.
*/
dispose() {

@@ -189,2 +202,3 @@ if (this._agent) {

});
// If we ever get disconnected, we want the socket to timeout eventually
req.setTimeout(this._socketTimeout || 3 * 60000, () => {

@@ -197,2 +211,4 @@ if (socket) {

req.on('error', function (err) {
// err has statusCode property
// res should have headers
reject(err);

@@ -228,2 +244,3 @@ });

info.options.agent = this._getAgent(requestUrl);
// gives handlers an opportunity to participate
if (this.handlers) {

@@ -246,2 +263,3 @@ this.handlers.forEach((handler) => {

}
// if agent is already assigned use that agent.
if (!!agent) {

@@ -277,2 +295,3 @@ return agent;

}
// if reusing agent across request and tunneling agent isn't assigned create a new agent
if (this._keepAlive && !agent) {

@@ -283,2 +302,3 @@ var options = { keepAlive: this._keepAlive, maxSockets: maxSockets };

}
// if not using private agent and tunnel agent isn't setup then use global agent
if (!agent) {

@@ -288,2 +308,5 @@ agent = usingSsl ? https.globalAgent : http.globalAgent;

if (usingSsl && this._ignoreSslError) {
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
// we have to cast it to any and change it directly
agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false });

@@ -300,2 +323,3 @@ }

let proxyConfig = this._httpProxy;
// fallback to http_proxy and https_proxy env
let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY];

@@ -341,2 +365,1 @@ let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY];

exports.HttpClient = HttpClient;
//# sourceMappingURL=HttpClient.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Index.js.map

@@ -0,0 +0,0 @@ export interface IHeaders {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
//# sourceMappingURL=Interfaces.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import httpm = require('./HttpClient');

@@ -16,13 +15,60 @@ import ifm = require("./Interfaces");

versionParam: string;
/**
* Creates an instance of the RestClient
* @constructor
* @param {string} userAgent - userAgent for requests
* @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
* @param {ifm.IRequestHandler[]} handlers - handlers are typically auth handlers (basic, bearer, ntlm supplied)
* @param {ifm.IRequestOptions} requestOptions - options for each http requests (http proxy setting, socket timeout)
*/
constructor(userAgent: string, baseUrl?: string, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions);
private _baseUrl;
/**
* Gets a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
options<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
/**
* Gets a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
get<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
/**
* Deletes a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
del<T>(requestUrl: string, options?: IRequestOptions): Promise<IRestResponse<T>>;
/**
* Creates resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
create<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
/**
* Updates resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
update<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
/**
* Replaces resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
replace<T>(requestUrl: string, resources: any, options?: IRequestOptions): Promise<IRestResponse<T>>;
uploadStream<T>(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, options?: IRequestOptions): Promise<IRestResponse<T>>;
private _headersFromOptions;
private _processResponse;
private _headersFromOptions(options, contentType?);
private _processResponse<T>(res, options);
}
"use strict";
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -12,6 +13,13 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.RestClient = void 0;
const httpm = require("./HttpClient");
const util = require("./Util");
class RestClient {
/**
* Creates an instance of the RestClient
* @constructor
* @param {string} userAgent - userAgent for requests
* @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
* @param {ifm.IRequestHandler[]} handlers - handlers are typically auth handlers (basic, bearer, ntlm supplied)
* @param {ifm.IRequestOptions} requestOptions - options for each http requests (http proxy setting, socket timeout)
*/
constructor(userAgent, baseUrl, handlers, requestOptions) {

@@ -23,2 +31,8 @@ this.client = new httpm.HttpClient(userAgent, handlers, requestOptions);

}
/**
* Gets a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
options(requestUrl, options) {

@@ -31,2 +45,8 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* Gets a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
get(requestUrl, options) {

@@ -39,2 +59,8 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* Deletes a resource from an endpoint
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
del(requestUrl, options) {

@@ -47,2 +73,9 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* Creates resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
create(requestUrl, resources, options) {

@@ -57,2 +90,9 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* Updates resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
update(requestUrl, resources, options) {

@@ -67,2 +107,9 @@ return __awaiter(this, void 0, void 0, function* () {

}
/**
* Replaces resource(s) from an endpoint
* T type of object returned.
* Be aware that not found returns a null. Other error conditions reject the promise
* @param {string} requestUrl - fully qualified or relative url
* @param {IRequestOptions} requestOptions - (optional) requestOptions object
*/
replace(requestUrl, resources, options) {

@@ -100,2 +147,3 @@ return __awaiter(this, void 0, void 0, function* () {

rres.statusCode = statusCode;
// not found leads to null obj returned
if (statusCode == httpm.HttpCodes.NotFound) {

@@ -105,2 +153,3 @@ resolve(rres);

let obj;
// get the result from the body
try {

@@ -119,5 +168,8 @@ let contents = yield res.readBody();

catch (err) {
// Invalid resource (contents not json); leaving result obj null
}
// note that 3xx redirects are handled by the http layer.
if (statusCode > 299) {
let msg;
// if exception/error in body, attempt to get better error
if (obj && obj.message) {

@@ -130,2 +182,3 @@ msg = obj.message;

let err = new Error(msg);
// attach statusCode and body obj (if available) to the error object
err['statusCode'] = statusCode;

@@ -145,2 +198,1 @@ if (rres.result) {

exports.RestClient = RestClient;
//# sourceMappingURL=RestClient.js.map

@@ -0,1 +1,7 @@

/**
* creates an url from a request url and optional base url (http://server:8080)
* @param {string} requestUrl - a fully qualified url or relative url
* @param {string} baseUrl - an optional baseUrl (http://server:8080)
* @return {string} - resultant url
*/
export declare function getUrl(requestUrl: string, baseUrl?: string): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUrl = void 0;
const url = require("url");
/**
* creates an url from a request url and optional base url (http://server:8080)
* @param {string} requestUrl - a fully qualified url or relative url
* @param {string} baseUrl - an optional baseUrl (http://server:8080)
* @return {string} - resultant url
*/
function getUrl(requestUrl, baseUrl) {

@@ -10,2 +15,3 @@ if (!baseUrl) {

let base = url.parse(baseUrl);
// requestUrl (specific per request) always wins
let combined = url.parse(requestUrl);

@@ -15,2 +21,3 @@ combined.protocol = combined.protocol || base.protocol;

combined.host = combined.host || base.host;
// path from requestUrl always wins
let res = url.format(combined);

@@ -20,2 +27,1 @@ return res;

exports.getUrl = getUrl;
//# sourceMappingURL=Util.js.map

@@ -0,0 +0,0 @@ import * as httpm from './typed-rest-client/HttpClient';

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -12,3 +11,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.WebClient = void 0;
// restrict usage of typed-rest-client to this file
const httpm = require("./typed-rest-client/HttpClient");

@@ -47,2 +46,3 @@ var tl = require('azure-pipelines-task-lib/task');

err['statusCode'] = statusCode;
// get the result from the body
try {

@@ -53,2 +53,3 @@ let result = yield res.readBody();

catch (error) {
// Invalid contents; leaving result obj null
}

@@ -63,2 +64,1 @@ }

exports.WebClient = WebClient;
//# sourceMappingURL=webClient.js.map
export declare class WebClientFactory {
static getClient(handlers: any[], options: any): any;
private static initializeProxy;
private static _readTaskLibSecrets;
private static initializeProxy(options);
private static _readTaskLibSecrets(lookupKey);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebClientFactory = void 0;
const fs = require("fs");

@@ -15,2 +14,3 @@ const crypto = require("crypto");

static initializeProxy(options) {
// try get proxy setting from environment variable set by azure-pipelines-task-lib if there is no proxy setting in the options
if (!options.proxy || !options.proxy.proxyUrl) {

@@ -27,2 +27,3 @@ if (global['_vsts_task_lib_proxy']) {

}
// try get cert setting from environment variable set by azure-pipelines-task-lib if there is no cert setting in the options
if (!options.cert) {

@@ -39,2 +40,3 @@ if (global['_vsts_task_lib_cert']) {

}
// 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
if (!options.ignoreSslError) {

@@ -45,4 +47,7 @@ options.ignoreSslError = !!global['_vsts_task_lib_skip_cert_validation'];

static _readTaskLibSecrets(lookupKey) {
// the lookupKey should has following format
// base64encoded<keyFilePath>:base64encoded<encryptedContent>
if (lookupKey && lookupKey.indexOf(':') > 0) {
let lookupInfo = lookupKey.split(':', 2);
// file contains encryption key
let keyFile = new Buffer(lookupInfo[0], 'base64').toString('utf8');

@@ -59,2 +64,1 @@ let encryptKey = new Buffer(fs.readFileSync(keyFile, 'utf8'), 'base64');

exports.WebClientFactory = WebClientFactory;
//# sourceMappingURL=webClientFactory.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import * as stream from 'stream';

@@ -15,5 +14,5 @@ import { ArtifactItem, IArtifactProvider } from '../Models';

dispose(): void;
private getItems;
private getTemplateFilePath;
private extend;
private getItems(itemsUrl, contentType);
private getTemplateFilePath();
private extend(target, source);
private rootItemsLocation;

@@ -20,0 +19,0 @@ private templateFile;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebProvider = void 0;
const fs = require("fs");

@@ -39,2 +38,3 @@ const path = require("path");

var itemUrl = artifactItem.metadata['downloadUrl'];
var zipStream = null;
itemUrl = itemUrl.replace(/([^:]\/)\/+/g, "$1");

@@ -49,2 +49,6 @@ this.webClient.get(itemUrl, contentType ? { 'Accept': contentType } : undefined).then((res) => {

res.message.on('error', (error) => {
if (zipStream) {
zipStream.destroy(error);
logger_1.Logger.logMessage(error);
}
reject(error);

@@ -54,3 +58,4 @@ });

try {
resolve(res.message.pipe(zlib.createUnzip()));
zipStream = zlib.createUnzip();
resolve(res.message.pipe(zipStream));
}

@@ -119,2 +124,1 @@ catch (err) {

exports.WebProvider = WebProvider;
//# sourceMappingURL=webProvider.js.map

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { ArtifactItemStore } from '../Store/artifactItemStore';

@@ -3,0 +2,0 @@ import { ArtifactItem, IArtifactProvider } from '../Models';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZipProvider = void 0;
const Models_1 = require("../Models");

@@ -55,2 +54,1 @@ const factory = require("./webClientFactory");

exports.ZipProvider = ZipProvider;
//# sourceMappingURL=zipProvider.js.map

@@ -0,0 +0,0 @@ import * as models from "../Models";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactItemStore = void 0;
const models = require("../Models");

@@ -96,2 +95,1 @@ class ArtifactItemStore {

exports.ArtifactItemStore = ArtifactItemStore;
//# sourceMappingURL=artifactItemStore.js.map
export { ArtifactItemStore } from './artifactItemStore';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArtifactItemStore = void 0;
var artifactItemStore_1 = require("./artifactItemStore");
Object.defineProperty(exports, "ArtifactItemStore", { enumerable: true, get: function () { return artifactItemStore_1.ArtifactItemStore; } });
//# sourceMappingURL=index.js.map
exports.ArtifactItemStore = artifactItemStore_1.ArtifactItemStore;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc