@adobe/aio-lib-cloudmanager
Advanced tools
Comparing version 1.7.0 to 1.8.0
# Changelog | ||
# [1.8.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.7.0...1.8.0) (2021-09-13) | ||
### Features | ||
* **commerce:** improve log format for commerce command executions [#227](https://github.com/adobe/aio-lib-cloudmanager/issues/227) ([d91fd1a](https://github.com/adobe/aio-lib-cloudmanager/commit/d91fd1ae70cee8129491bda09cae221c21404b44)) | ||
# [1.7.0](https://github.com/adobe/aio-lib-cloudmanager/compare/1.6.0...1.7.0) (2021-09-07) | ||
@@ -4,0 +11,0 @@ |
@@ -21,3 +21,3 @@ <!-- | ||
JavaScript SDK wrapping the [Adobe Cloud Manager API](https://www.adobe.io/apis/experiencecloud/cloud-manager/docs.html). | ||
JavaScript SDK wrapping the [Adobe Cloud Manager API](https://www.adobe.io/experience-cloud/cloud-manager/). | ||
@@ -24,0 +24,0 @@ ### Installing |
{ | ||
"name": "@adobe/aio-lib-cloudmanager", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Adobe I/O Cloud Manager Library", | ||
@@ -12,3 +12,3 @@ "repository": { | ||
"scripts": { | ||
"generate-jsdoc-types": "curl https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml > api.yaml && node ./tools/generate-jsdoc-types.js > ./src/sdktypes.jsdoc.js", | ||
"generate-jsdoc-types": "curl https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/main/swagger-specs/api.yaml > api.yaml && node ./tools/generate-jsdoc-types.js > ./src/sdktypes.jsdoc.js", | ||
"test": "npm run lint && npm run unit-tests", | ||
@@ -53,3 +53,3 @@ "jscpd": "jscpd --pattern 'src/**/*.js'", | ||
"eslint-plugin-jest": "24.4.0", | ||
"eslint-plugin-jsdoc": "36.0.8", | ||
"eslint-plugin-jsdoc": "36.1.0", | ||
"eslint-plugin-node": "11.1.0", | ||
@@ -60,3 +60,3 @@ "eslint-plugin-promise": "5.1.0", | ||
"husky": "5.2.0", | ||
"jest": "27.1.0", | ||
"jest": "27.2.0", | ||
"jest-extended": "0.11.5", | ||
@@ -63,0 +63,0 @@ "jest-junit": "12.2.0", |
@@ -21,3 +21,3 @@ <!-- | ||
JavaScript SDK wrapping the [Adobe Cloud Manager API](https://www.adobe.io/apis/experiencecloud/cloud-manager/docs.html). | ||
JavaScript SDK wrapping the [Adobe Cloud Manager API](https://www.adobe.io/experience-cloud/cloud-manager/). | ||
@@ -24,0 +24,0 @@ ### Installing |
@@ -22,2 +22,3 @@ /* | ||
const streamPipeline = util.promisify(require('stream').pipeline) | ||
const { Transform } = require('stream') | ||
const _ = require('lodash') | ||
@@ -862,2 +863,9 @@ const { codes } = require('./SDKErrors') | ||
_pipeBodyWithTransform (body, writeStream, transform) { | ||
return new Promise((resolve) => { | ||
body.pipe(transform()).pipe(writeStream, { end: false }) | ||
body.on('end', () => resolve({})) | ||
}) | ||
} | ||
async _getLiveStream (programId, environment, service, name, tailingSasUrl, currentStartLimit, writeStream) { | ||
@@ -1336,2 +1344,22 @@ for (;;) { | ||
_commerceLogTransform () { | ||
const liner = new Transform({ objectMode: true }) | ||
liner._transform = function (data, _, done) { | ||
const lines = data.toString().split('\n') | ||
for (const line of lines) { | ||
if (line !== '') { | ||
try { | ||
const parsedLine = JSON.parse(line.replace('\n', '\\n')) | ||
this.push(parsedLine.log) | ||
} catch (e) { | ||
// Swallowing the error | ||
} | ||
} | ||
} | ||
done() | ||
} | ||
return liner | ||
} | ||
async tailCommerceCommandExecutionLog (programId, environmentId, commandExecutionId, outputStream) { | ||
@@ -1357,3 +1385,3 @@ let commandStatus = await this._getCommerceCommandStatus(programId, environmentId, commandExecutionId) | ||
const contentLength = res.headers.get('content-length') | ||
await this._pipeBody(res.body, outputStream) | ||
await this._pipeBodyWithTransform(res.body, outputStream, this._commerceLogTransform) | ||
currentStartLimit = parseInt(currentStartLimit) + parseInt(contentLength) | ||
@@ -1360,0 +1388,0 @@ } else if (res.status === 416 || res.status === 404) { |
@@ -60,3 +60,3 @@ /* | ||
flushWritable() | ||
expect(written).toEqual('first log message\nsecond log message\nthird log message\n') | ||
expect(written).toEqual('Cleaned cache types:\nconfig\ndetails\n') | ||
}) | ||
@@ -63,0 +63,0 @@ |
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 too big to display
1906876
11297