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
18
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.2.0 to 1.3.0

7

CHANGELOG.md
# Changelog
# [1.3.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.2.0...1.3.0) (2021-07-27)
### Features
* **commerce:** add getCommerceCLICommand. fixes [#178](https://github.com/adobe/aio-lib-cloudmanager/issues/178) ([#196](https://github.com/adobe/aio-lib-cloudmanager/issues/196)) ([a0c9b61](https://github.com/adobe/aio-lib-cloudmanager/commit/a0c9b61c58ab8302974f15e7177b40974ade50c3))
# [1.2.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.1.1...1.2.0) (2021-07-27)

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

2

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

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

@@ -177,2 +177,3 @@ <!--

* [.removeIpAllowlistBinding(programId, ipAllowlistId, environmentId, service)](#CloudManagerAPI+removeIpAllowlistBinding) ⇒ <code>Promise.&lt;object&gt;</code>
* [.getCommerceCommandExecution(programId, environmentId, executionId)](#CloudManagerAPI+getCommerceCommandExecution) ⇒ <code>Promise.&lt;object&gt;</code>
* [.postCommerceCommandExecution(programId, environmentId, options)](#CloudManagerAPI+postCommerceCommandExecution) ⇒ <code>Promise.&lt;object&gt;</code>

@@ -626,2 +627,16 @@

<a name="CloudManagerAPI+getCommerceCommandExecution"></a>
### cloudManagerAPI.getCommerceCommandExecution(programId, environmentId, executionId) ⇒ <code>Promise.&lt;object&gt;</code>
Get status for an existing Commerce execution
**Kind**: instance method of [<code>CloudManagerAPI</code>](#CloudManagerAPI)
**Returns**: <code>Promise.&lt;object&gt;</code> - a truthy value of the commerce execution
| Param | Type | Description |
| --- | --- | --- |
| programId | <code>string</code> | the program id |
| environmentId | <code>string</code> | the environment id |
| executionId | <code>string</code> | the execution id |
<a name="CloudManagerAPI+postCommerceCommandExecution"></a>

@@ -628,0 +643,0 @@

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

commerceCommandExecution: 'http://ns.adobe.com/adobecloud/rel/commerceCommandExecution',
commerceCommandExecutionId: 'http://ns.adobe.com/adobecloud/rel/commerceCommandExecution/id',
},

@@ -35,0 +36,0 @@ config: {

@@ -1230,2 +1230,28 @@ /*

/**
* Get status for an existing Commerce execution
*
* @param {string} programId - the program id
* @param {string} environmentId - the environment id
* @param {string} executionId - the execution id
* @returns {Promise<object>} a truthy value of the commerce execution
*/
async getCommerceCommandExecution (programId, environmentId, executionId) {
const environment = await this._findEnvironment(programId, environmentId)
const environmentLink = environment.link(rels.commerceCommandExecutionId)
if (!environmentLink) {
throw new codes.ERROR_COMMERCE_CLI({ messageValues: environmentId })
}
const executionTemplate = UriTemplate.parse(environmentLink.href)
const executionLink = executionTemplate.expand({ executionId: executionId })
return this._get(executionLink, codes.ERROR_GET_COMMERCE_CLI).then(async res => {
return halfred.parse(await res.json())
}, e => {
throw e
})
}
/**
* Make a Post to Commerce API

@@ -1232,0 +1258,0 @@ *

@@ -107,3 +107,4 @@ /*

E('ERROR_STEP_STATE_NOT_RUNNING', 'The %s step in execution %s is not currently running.')
E('ERROR_GET_COMMERCE_CLI', 'Could not get Commerce Command Execution: %s')
E('ERROR_POST_COMMERCE_CLI', 'Could not post to Commerce CLI endpoint: %s')
E('ERROR_COMMERCE_CLI', 'Environment %s does not appear to support Commerce CLI')

@@ -55,1 +55,71 @@ /*

})
test('getCommerceCommandExecution - error: failure to find correct environment', async () => {
expect.assertions(2)
const sdkClient = await createSdkClient()
const result = sdkClient.getCommerceCommandExecution('4', '3')
await expect(result instanceof Promise).toBeTruthy()
await expect(result).rejects.toEqual(
new codes.ERROR_GET_COMMERCE_CLI({ messageValues: 'https://cloudmanager.adobe.io/api/program/4/environment/3/runtime/commerce/command-execution/ (403 Forbidden)' }),
)
})
test('getCommerceCommandExecution - error: failure to retrieve environments', async () => {
expect.assertions(2)
const sdkClient = await createSdkClient()
const result = sdkClient.getCommerceCommandExecution('6', '7', '8')
await expect(result instanceof Promise).toBeTruthy()
await expect(result).rejects.toEqual(
new codes.ERROR_RETRIEVE_ENVIRONMENTS({ messageValues: 'https://cloudmanager.adobe.io/api/program/6/environments (404 Not Found)' }),
)
})
test('getCommerceCommandExecution - error: no link', async () => {
expect.assertions(2)
const sdkClient = await createSdkClient()
const result = sdkClient.getCommerceCommandExecution('4', '11')
await expect(result instanceof Promise).toBeTruthy()
await expect(result).rejects.toEqual(
new codes.ERROR_COMMERCE_CLI({ messageValues: '11' }),
)
})
test('getCommerceCommandExecution - success', async () => {
expect.assertions(2)
const sdkClient = await createSdkClient()
const result = sdkClient.getCommerceCommandExecution('4', '10', '1')
await expect(result instanceof Promise).toBeTruthy()
await expect(result).resolves.toMatchObject(halfred.parse({
id: 1,
status: 'RUNNNG', // PENDING, RUNNING, COMPLETED, FAILED
type: 'bin/magento', // bin/magento, bin/ece-tools
command: 'test command to be executed',
message: 'One line message on the progress of command',
options: ['Optional', 'inputs provided part of the command'],
startedAt: 'timestamp UTC',
completedAt: 'timestamp utc',
startedBy: 'test runner',
_links: {
self: {
href: '/api/program/4/environment/10/runtime/commerce/command-execution/1',
},
'http://ns.adobe.com/adobecloud/rel/program': {
href: '/api/program/4',
},
'http://ns.adobe.com/adobecloud/rel/environments': {
href: '/api/program/4/environments',
},
'http://ns.adobe.com/adobecloud/rel/commerceCommandExecutions': {
href: '/api/program/4/environment/10/runtime/commerce/command-executions',
},
},
}))
})

@@ -252,2 +252,6 @@ /*

},
'http://ns.adobe.com/adobecloud/rel/commerceCommandExecution/id': {
href: '/api/program/4/environment/3/runtime/commerce/command-execution/{executionId}',
templated: true,
},
},

@@ -272,2 +276,6 @@ id: '3',

},
'http://ns.adobe.com/adobecloud/rel/commerceCommandExecution/id': {
href: '/api/program/4/environment/10/runtime/commerce/command-execution/{executionId}',
templated: true,
},
},

@@ -1650,2 +1658,32 @@ id: '10',

// Commerce command execution mocks
fetchMock.mock('https://cloudmanager.adobe.io/api/program/4/environment/3/runtime/commerce/command-execution/', 403)
fetchMock.mock('https://cloudmanager.adobe.io/api/program/6/environment/7/runtime/commerce/command-execution/8', 404)
mockResponseWithMethod('https://cloudmanager.adobe.io/api/program/4/environment/10/runtime/commerce/command-execution/1', 'GET', {
id: 1,
status: 'RUNNNG', // PENDING, RUNNING, COMPLETED, FAILED
type: 'bin/magento', // bin/magento, bin/ece-tools
command: 'test command to be executed',
message: 'One line message on the progress of command',
options: ['Optional', 'inputs provided part of the command'],
startedAt: 'timestamp UTC',
completedAt: 'timestamp utc',
startedBy: 'test runner',
_links: {
self: {
href: '/api/program/4/environment/10/runtime/commerce/command-execution/1',
},
'http://ns.adobe.com/adobecloud/rel/program': {
href: '/api/program/4',
},
'http://ns.adobe.com/adobecloud/rel/environments': {
href: '/api/program/4/environments',
},
'http://ns.adobe.com/adobecloud/rel/commerceCommandExecutions': {
href: '/api/program/4/environment/10/runtime/commerce/command-executions',
},
},
})
mockResponseWithMethod('https://cloudmanager.adobe.io/api/program/4/environment/10/runtime/commerce/cli/', 'POST', {

@@ -1652,0 +1690,0 @@ status: 201,

@@ -286,2 +286,10 @@ /**

/**
* Get status for an existing Commerce execution
* @param programId - the program id
* @param environmentId - the environment id
* @param executionId - the execution id
* @returns a truthy value of the commerce execution
*/
getCommerceCommandExecution(programId: string, environmentId: string, executionId: string): Promise<object>;
/**
* Make a Post to Commerce API

@@ -288,0 +296,0 @@ * @param programId - the program id

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