diff --git a/CHANGELOG.md b/CHANGELOG.md index 869ed76..68cf924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.5.2 (August 26, 2022) +* Updated @elasticio/component-commons-library to v3.0.2 + ## 1.5.1 (August 12, 2022) * Updated @elasticio/component-commons-library to v3.0.1 diff --git a/component.json b/component.json index 5b0ffd5..e8e888e 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "title": "SFTP", "description": "Provides file access and transfer using SSH File Transfer Protocol", - "version": "1.5.1", + "version": "1.5.2", "credentials": { "fields": { "host": { diff --git a/lib/actions/upload.js b/lib/actions/upload.js index fca77c4..9949ae4 100644 --- a/lib/actions/upload.js +++ b/lib/actions/upload.js @@ -40,7 +40,8 @@ exports.process = async function processAction(msg, cfg) { this.logger.debug('Writing attachment to targetPath'); this.logger.debug('Getting attachment...'); - const file = await new AttachmentProcessor(getUserAgent()).getAttachment(attachment.url, 'stream'); + const attachmentProcessor = new AttachmentProcessor(getUserAgent(), msg.id); + const file = await attachmentProcessor.getAttachment(attachment.url, 'stream'); this.logger.debug('Uploading attachment to targetPath'); await sftp.put(file.data, targetPath, { encoding: null }); this.logger.info('Attachment uploaded successfully'); diff --git a/lib/attachments.js b/lib/attachments.js index ee83984..77b5b32 100644 --- a/lib/attachments.js +++ b/lib/attachments.js @@ -10,7 +10,7 @@ async function addAttachment(msg, name, getStream, contentLength) { if (contentLength > MAX_FILE_SIZE) { throw new Error(`File size is ${contentLength} bytes, it violates the variable MAX_FILE_SIZE, which is currently set to ${MAX_FILE_SIZE} bytes`); } - const attachmentProcessor = new AttachmentProcessor(getUserAgent()); + const attachmentProcessor = new AttachmentProcessor(getUserAgent(), msg.id); const attachmentId = await attachmentProcessor.uploadAttachment(getStream); const attachmentUrl = attachmentProcessor.getMaesterAttachmentUrlById(attachmentId); const curUsed = process.memoryUsage(); diff --git a/lib/utils/upsertUtil.js b/lib/utils/upsertUtil.js index 0e7bb45..2b3fca5 100644 --- a/lib/utils/upsertUtil.js +++ b/lib/utils/upsertUtil.js @@ -21,7 +21,8 @@ class SftpUpsertObject extends UpsertObjectById { // eslint-disable-next-line no-unused-vars,class-methods-use-this async getObjectFromMessage(msg, cfg) { - const fileStream = await new AttachmentProcessor(getUserAgent()).getAttachment(msg.body.attachmentUrl, 'stream'); + const attachmentProcessor = new AttachmentProcessor(getUserAgent(), msg.id); + const fileStream = await attachmentProcessor.getAttachment(msg.body.attachmentUrl, 'stream'); return { fileStream: fileStream.data }; } diff --git a/package-lock.json b/package-lock.json index 28637a1..d06d7d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -374,12 +374,12 @@ } }, "@elastic.io/component-commons-library": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@elastic.io/component-commons-library/-/component-commons-library-3.0.1.tgz", - "integrity": "sha512-+hf+b0UZ+rx2ROFNmx0CLOvy2Q2a4nO+dZ2W16E6d9dUVZfCGS/n08wwCpGfUakYum73VbupFiC03bsJKoG3MA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@elastic.io/component-commons-library/-/component-commons-library-3.0.2.tgz", + "integrity": "sha512-/ZnZHBKfrYtcwP1zSGTAOdgIYNTDak4ukCmvlt+EElTgkvWoI0qlA5R60THKx8lbumtJC7LjyAc1t5H/7n2Brg==", "requires": { "@elastic.io/jsonata-moment": "1.1.4", - "@elastic.io/maester-client": "4.0.2", + "@elastic.io/maester-client": "4.0.3", "@elastic.io/ntlm-client": "1.0.0", "async": "3.2.3", "axios": "0.27.2", @@ -453,9 +453,9 @@ } }, "@elastic.io/maester-client": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@elastic.io/maester-client/-/maester-client-4.0.2.tgz", - "integrity": "sha512-faW94GyfSuJ3a0+1+9w+BVlm53rcFAHUm3Q6ovqbDH3gs/RURHqm1ltfOnRGA9ZFqaHa4JlN6c1DZDrAYnNQOQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@elastic.io/maester-client/-/maester-client-4.0.3.tgz", + "integrity": "sha512-cHOMo4Cw4xDsvpsLRCQkWcMcZREXMUh63c/kdzJEj3PrNau5D4TLFkv21x/idxhBb2IiHgb5UAMl5y5LZhDJKw==", "requires": { "@elastic.io/bunyan-logger": "1.0.8", "@elastic.io/component-commons-library": "3.0.0", diff --git a/package.json b/package.json index 4b506d0..77d39c8 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "author": "elastic.io GmbH", "license": "Apache-2.0", "dependencies": { - "@elastic.io/component-commons-library": "3.0.1", + "@elastic.io/component-commons-library": "3.0.2", "@elastic.io/oih-standard-library": "2.0.3", "async": "3.2.3", "elasticio-node": "0.0.9",