New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/aio-lib-cloudmanager

Package Overview
Dependencies
Maintainers
19
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/aio-lib-cloudmanager - npm Package Compare versions

Comparing version 1.13.0 to 1.14.0

7

CHANGELOG.md
# Changelog
# [1.14.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.13.0...1.14.0) (2021-11-23)
### Features
* **updatePipeline:** add support for changing environment id. fixes [#305](https://github.com/adobe/aio-lib-cloudmanager/issues/305) ([#306](https://github.com/adobe/aio-lib-cloudmanager/issues/306)) ([5871972](https://github.com/adobe/aio-lib-cloudmanager/commit/58719724d91a3ee8b98d3103df6c9b88669bea4a))
# [1.13.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.12.1...1.13.0) (2021-11-17)

@@ -4,0 +11,0 @@

6

package.json
{
"name": "@adobe/aio-lib-cloudmanager",
"version": "1.13.0",
"version": "1.14.0",
"description": "Adobe I/O Cloud Manager Library",

@@ -43,4 +43,4 @@ "repository": {

"@adobe/eslint-config-aio-lib-config": "1.3.0",
"@commitlint/cli": "14.1.0",
"@commitlint/config-conventional": "14.1.0",
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@semantic-release/changelog": "5.0.1",

@@ -47,0 +47,0 @@ "@semantic-release/git": "9.0.1",

@@ -972,2 +972,5 @@ <!--

| repositoryId | <code>string</code> | the new repository id |
| devEnvironmentId | <code>string</code> | the new dev environment id |
| stageEnvironmentId | <code>string</code> | the new stage environment id |
| prodEnvironmentId | <code>string</code> | the new prod environment id |

@@ -974,0 +977,0 @@ ### Debug Logs

@@ -958,2 +958,8 @@ /*

async updatePipeline (programId, pipelineId, changes) {
const environmentKeyTypeMapping = [
{ key: 'devEnvironmentId', type: 'dev' },
{ key: 'stageEnvironmentId', type: 'stage' },
{ key: 'prodEnvironmentId', type: 'prod' },
]
const pipeline = await this._findPipeline(programId, pipelineId)

@@ -965,15 +971,29 @@

if (changes && (changes.branch || changes.repositoryId)) {
const buildPhase = pipeline.phases && pipeline.phases.find(phase => phase.type === 'BUILD')
if (!buildPhase) {
throw new codes.ERROR_NO_BUILD_PHASE({ messageValues: pipelineId })
if (changes) {
if (changes.branch || changes.repositoryId) {
const buildPhase = pipeline.phases && pipeline.phases.find(phase => phase.type === 'BUILD')
if (!buildPhase) {
throw new codes.ERROR_NO_BUILD_PHASE({ messageValues: pipelineId })
}
const newBuildPhase = clone(buildPhase)
if (changes.branch) {
newBuildPhase.branch = changes.branch
}
if (changes.repositoryId) {
newBuildPhase.repositoryId = changes.repositoryId
}
patch.phases.push(newBuildPhase)
}
const newBuildPhase = clone(buildPhase)
if (changes.branch) {
newBuildPhase.branch = changes.branch
}
if (changes.repositoryId) {
newBuildPhase.repositoryId = changes.repositoryId
}
patch.phases.push(newBuildPhase)
environmentKeyTypeMapping.forEach(mapping => {
if (changes[mapping.key]) {
const deployPhase = pipeline.phases && pipeline.phases.find(phase => phase.type === 'DEPLOY' && phase.environmentType === mapping.type)
if (!deployPhase) {
throw new codes.ERROR_NO_DEPLOY_PHASE({ messageValues: [pipelineId, mapping.type] })
}
const newDeployPhase = clone(deployPhase)
newDeployPhase.environmentId = changes[mapping.key]
patch.phases.push(newDeployPhase)
}
})
}

@@ -980,0 +1000,0 @@

@@ -87,2 +87,3 @@ /*

E('ERROR_NO_BUILD_PHASE', 'Pipeline %s does not appear to have a build phase.')
E('ERROR_NO_DEPLOY_PHASE', 'Pipeline %s does not appear to have a deploy phase for environment type %s.')
E('ERROR_NO_DEVELOPER_CONSOLE', 'Environment %s does not appear to support Developer Console.')

@@ -89,0 +90,0 @@ E('ERROR_FIND_VARIABLES_LINK_ENVIRONMENT', 'Could not find variables link for environment %s for program %s.')

@@ -29,2 +29,5 @@ /*

* @property {string} repositoryId - the new repository id
* @property {string} devEnvironmentId - the new dev environment id
* @property {string} stageEnvironmentId - the new stage environment id
* @property {string} prodEnvironmentId - the new prod environment id
*/

@@ -247,2 +247,37 @@ /*

test('updatePipeline - no deploy phase', async () => {
expect.assertions(2)
const sdkClient = await createSdkClient()
const result = sdkClient.updatePipeline('5', '9', {
devEnvironmentId: '5',
})
await expect(result instanceof Promise).toBeTruthy()
await expect(result).rejects.toEqual(
new codes.ERROR_NO_DEPLOY_PHASE({ messageValues: ['9', 'dev'] }),
)
})
test('updatePipeline - stage environment success', async () => {
expect.assertions(3)
const sdkClient = await createSdkClient()
const result = sdkClient.updatePipeline('5', '9', {
stageEnvironmentId: '7',
})
await expect(result instanceof Promise).toBeTruthy()
await expect(result).resolves.toBeTruthy()
const patchCall = fetchMock.calls().find(call => call[0] === 'https://cloudmanager.adobe.io/api/program/5/pipeline/9' && call[1].method === 'PATCH')
await expect(JSON.parse(patchCall[1].body)).toMatchObject({
phases: expect.arrayContaining([{
type: 'DEPLOY',
environmentId: '7',
name: 'DEPLOY_1',
environmentType: 'stage',
}]),
})
})
test('getPipelineVariables - pipelines not found', async () => {

@@ -249,0 +284,0 @@ expect.assertions(2)

@@ -581,2 +581,5 @@ /**

* @property repositoryId - the new repository id
* @property devEnvironmentId - the new dev environment id
* @property stageEnvironmentId - the new stage environment id
* @property prodEnvironmentId - the new prod environment id
*/

@@ -586,3 +589,6 @@ declare type PipelineUpdate = {

repositoryId: string;
devEnvironmentId: string;
stageEnvironmentId: string;
prodEnvironmentId: string;
};

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

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