azure-pipelines-tasks-artifacts-common
Advanced tools
Comparing version 2.230.0 to 2.241.0
{ | ||
"name": "azure-pipelines-tasks-artifacts-common", | ||
"version": "2.230.0", | ||
"version": "2.241.0", | ||
"description": "Azure Artifacts common code (for new authentication tasks)", | ||
@@ -11,3 +11,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "https://github.com/Microsoft/azure-pipelines-tasks" | ||
"url": "https://github.com/microsoft/azure-pipelines-tasks-common-packages/tree/main/common-npm-packages/artifacts-common" | ||
}, | ||
@@ -20,3 +20,3 @@ "license": "MIT", | ||
"azure-devops-node-api": "12.0.0", | ||
"azure-pipelines-task-lib": "^4.2.0", | ||
"azure-pipelines-task-lib": "^4.13.0", | ||
"fs-extra": "8.1.0", | ||
@@ -23,0 +23,0 @@ "semver": "6.3.0" |
@@ -15,2 +15,3 @@ export interface IExternalPackageSource { | ||
constructor(packageSource: IExternalPackageSource, authType: ServiceConnectionAuthType, additionalData?: IAdditionalData); | ||
abstract maskSecret(): void; | ||
} | ||
@@ -22,2 +23,3 @@ export declare class TokenServiceConnection extends ServiceConnection { | ||
constructor(packageSource: IExternalPackageSource, token: string, additionalData?: IAdditionalData); | ||
maskSecret(): void; | ||
} | ||
@@ -30,2 +32,3 @@ export declare class UsernamePasswordServiceConnection extends ServiceConnection { | ||
constructor(packageSource: IExternalPackageSource, username: string, password: string, additionalData?: IAdditionalData); | ||
maskSecret(): void; | ||
} | ||
@@ -37,2 +40,3 @@ export declare class ApiKeyServiceConnection extends ServiceConnection { | ||
constructor(packageSource: IExternalPackageSource, apiKey: string, additionalData?: IAdditionalData); | ||
maskSecret(): void; | ||
} | ||
@@ -45,2 +49,3 @@ export declare class PrivateKeyServiceConnection extends ServiceConnection { | ||
constructor(packageSource: IExternalPackageSource, privateKey: string, passphrase: string, additionalData?: IAdditionalData); | ||
maskSecret(): void; | ||
} | ||
@@ -47,0 +52,0 @@ export declare enum ServiceConnectionAuthType { |
@@ -12,2 +12,3 @@ "use strict"; | ||
this.additionalData = additionalData; | ||
this.maskSecret(); | ||
} | ||
@@ -23,2 +24,5 @@ } | ||
} | ||
maskSecret() { | ||
tl.setSecret(this.token); | ||
} | ||
} | ||
@@ -34,2 +38,5 @@ exports.TokenServiceConnection = TokenServiceConnection; | ||
} | ||
maskSecret() { | ||
tl.setSecret(this.password); | ||
} | ||
} | ||
@@ -44,2 +51,5 @@ exports.UsernamePasswordServiceConnection = UsernamePasswordServiceConnection; | ||
} | ||
maskSecret() { | ||
tl.setSecret(this.apiKey); | ||
} | ||
} | ||
@@ -55,2 +65,5 @@ exports.ApiKeyServiceConnection = ApiKeyServiceConnection; | ||
} | ||
maskSecret() { | ||
tl.setSecret(this.privateKey); | ||
} | ||
} | ||
@@ -57,0 +70,0 @@ exports.PrivateKeyServiceConnection = PrivateKeyServiceConnection; |
@@ -90,2 +90,3 @@ "use strict"; | ||
authType: "unsupportedauthtype", | ||
maskSecret: () => void {} | ||
} | ||
@@ -92,0 +93,0 @@ ]); |
@@ -5,9 +5,9 @@ "use strict"; | ||
const assert = require("assert"); | ||
const mockery = require("mockery"); | ||
const serviceConnectionUtils_1 = require("../serviceConnectionUtils"); | ||
const mocker = require("azure-pipelines-task-lib/lib-mocker"); | ||
function serviceConnectionUtilsTests() { | ||
const serviceConnectionsKey = "someProtocolServiceConnections"; | ||
before(() => { | ||
mockery.disable(); // needed to ensure that we can mock vsts-task-lib/task | ||
mockery.enable({ | ||
mocker.disable(); // needed to ensure that we can mock vsts-task-lib/task | ||
mocker.enable({ | ||
useCleanCache: true, | ||
@@ -18,10 +18,10 @@ warnOnUnregistered: true | ||
after(() => { | ||
mockery.disable(); | ||
mocker.disable(); | ||
}); | ||
beforeEach(() => { | ||
mockery.resetCache(); | ||
mockery.registerAllowable("../serviceConnectionUtils"); | ||
mocker.resetCache(); | ||
mocker.registerAllowable("../serviceConnectionUtils"); | ||
}); | ||
afterEach(() => { | ||
mockery.deregisterAll(); | ||
mocker.deregisterAll(); | ||
}); | ||
@@ -35,3 +35,3 @@ it("getPackagingServiceConnections null returns empty", (done) => { | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -48,3 +48,3 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey), []); | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -65,5 +65,6 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey), []); | ||
setResourcePath: (path) => { }, | ||
getEndpointAuthorizationScheme: (key, optional) => "token" | ||
getEndpointAuthorizationScheme: (key, optional) => "token", | ||
setSecret: msg => null | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -93,3 +94,3 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey), [{ | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -110,5 +111,6 @@ assert.throws(() => serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey)); | ||
setResourcePath: (path) => { }, | ||
getEndpointAuthorizationScheme: (key, optional) => "usernamepassword" | ||
getEndpointAuthorizationScheme: (key, optional) => "usernamepassword", | ||
setSecret: msg => null | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -139,3 +141,3 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey), [{ | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -157,3 +159,3 @@ assert.throws(() => serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey)); | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -174,5 +176,6 @@ assert.throws(() => serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey)); | ||
setResourcePath: (path) => { }, | ||
getEndpointAuthorizationScheme: (key, optional) => "none" | ||
getEndpointAuthorizationScheme: (key, optional) => "none", | ||
setSecret: msg => null | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -202,3 +205,3 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey), [{ | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -225,5 +228,6 @@ assert.throws(() => serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey)); | ||
}, | ||
setResourcePath: (path) => { } | ||
setResourcePath: (path) => { }, | ||
setSecret: msg => null | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -259,5 +263,6 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey, ["key1", "key2"]), [{ | ||
return values[key]; | ||
} | ||
}, | ||
setSecret: msg => null | ||
}; | ||
mockery.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
mocker.registerMock('azure-pipelines-task-lib/task', mockTask); | ||
let serviceConnectionUtilsWithMocks = require("../serviceConnectionUtils"); | ||
@@ -264,0 +269,0 @@ assert.deepEqual(serviceConnectionUtilsWithMocks.getPackagingServiceConnections(serviceConnectionsKey, ["key1", "key2"]), [{ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111476
1528