From ded8173881e6d2fbccbd1c0e15fd1cfdb346fa7d Mon Sep 17 00:00:00 2001 From: Narendra Vyas Date: Thu, 17 Apr 2025 14:27:56 +0530 Subject: [PATCH 01/15] feat: EOD commit, encyption of license key - WIP, need to fix tests --- .../__tests__/set-log-forwarding.test.js | 43 +++++++++++++++++-- .../api-mesh/config/set/log-forwarding.js | 15 ++++++- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js index 52973194..8e5af449 100644 --- a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js +++ b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js @@ -11,6 +11,7 @@ governing permissions and limitations under the License. */ const SetLogForwardingCommand = require('../config/set/log-forwarding'); +const crypto = require('crypto'); const { initSdk, promptConfirm, @@ -18,7 +19,7 @@ const { promptInput, promptInputSecret, } = require('../../../helpers'); -const { getMeshId, setLogForwarding } = require('../../../lib/smsClient'); +const { getMeshId, setLogForwarding, getPublicEncryptionKey } = require('../../../lib/smsClient'); jest.mock('../../../helpers', () => ({ initSdk: jest.fn().mockResolvedValue({}), @@ -31,6 +32,21 @@ jest.mock('../../../helpers', () => ({ jest.mock('../../../lib/smsClient'); jest.mock('../../../classes/logger'); +jest.mock('crypto'); +// Mock randomBytes for aesKey and iv +const mockAesKey = Buffer.from('mockAesKey'); +const mockIv = Buffer.from('mockIv'); +const mockEncryptedAesKey = Buffer.from('mockEncryptedAesKey'); +const mockCipher = { + update: jest.fn().mockReturnValueOnce('mockEncryptedData'), + final: jest.fn().mockReturnValueOnce(''), +}; +const mockEncryptedLicenseKey = { + iv: 'bW9ja0l2', + key: 'bW9ja0VuY3J5cHRlZEFlc0tleQ==', + data: 'mockEncryptedData', +}; + describe('SetLogForwardingCommand', () => { let parseSpy; let logSpy; @@ -60,6 +76,7 @@ describe('SetLogForwardingCommand', () => { workspaceName: 'workspaceName', }); getMeshId.mockResolvedValue('meshId'); + getPublicEncryptionKey.mockResolvedValue('dummy_public_key'); setLogForwarding.mockResolvedValue({ success: true, result: true }); global.requestId = 'dummy_request_id'; }); @@ -71,6 +88,10 @@ describe('SetLogForwardingCommand', () => { describe('Test New Relic destination', () => { /** Success Scenario */ test('sets log forwarding with valid parameters', async () => { + crypto.randomBytes.mockReturnValueOnce(mockAesKey).mockReturnValueOnce(mockIv); + crypto.createCipheriv.mockReturnValueOnce(mockCipher); + crypto.publicEncrypt.mockReturnValueOnce(mockEncryptedAesKey); + const command = new SetLogForwardingCommand([], {}); await command.run(); @@ -88,7 +109,7 @@ describe('SetLogForwardingCommand', () => { destination: 'newrelic', config: { baseUri: 'https://log-api.newrelic.com/log/v1', - licenseKey: 'abcdef0123456789abcdef0123456789abcdef01', + licenseKey: JSON.stringify(mockEncryptedLicenseKey), // Expect the encrypted value }, }, ); @@ -135,6 +156,10 @@ describe('SetLogForwardingCommand', () => { args: [], }); + crypto.randomBytes.mockReturnValueOnce(mockAesKey).mockReturnValueOnce(mockIv); + crypto.createCipheriv.mockReturnValueOnce(mockCipher); + crypto.publicEncrypt.mockReturnValueOnce(mockEncryptedAesKey); + const command = new SetLogForwardingCommand([], {}); await command.run(); @@ -195,6 +220,10 @@ describe('SetLogForwardingCommand', () => { args: [], }); + crypto.randomBytes.mockReturnValueOnce(mockAesKey).mockReturnValueOnce(mockIv); + crypto.createCipheriv.mockReturnValueOnce(mockCipher); + crypto.publicEncrypt.mockReturnValueOnce(mockEncryptedAesKey); + const command = new SetLogForwardingCommand([], {}); await command.run(); @@ -203,6 +232,10 @@ describe('SetLogForwardingCommand', () => { }); test('sets log forwarding with auto-confirmation', async () => { + crypto.randomBytes.mockReturnValueOnce(mockAesKey).mockReturnValueOnce(mockIv); + crypto.createCipheriv.mockReturnValueOnce(mockCipher); + crypto.publicEncrypt.mockReturnValueOnce(mockEncryptedAesKey); + parseSpy.mockResolvedValueOnce({ flags: { ignoreCache: false, @@ -225,7 +258,7 @@ describe('SetLogForwardingCommand', () => { destination: 'newrelic', config: { baseUri: 'https://log-api.newrelic.com/log/v1', - licenseKey: 'abcdef0123456789abcdef0123456789abcdef01', + licenseKey: JSON.stringify(mockEncryptedLicenseKey), // Expect the encrypted value }, }, ); @@ -236,6 +269,10 @@ describe('SetLogForwardingCommand', () => { const errorMessage = 'Unable to set log forwarding details'; setLogForwarding.mockRejectedValueOnce(new Error(errorMessage)); + crypto.randomBytes.mockReturnValueOnce(mockAesKey).mockReturnValueOnce(mockIv); + crypto.createCipheriv.mockReturnValueOnce(mockCipher); + crypto.publicEncrypt.mockReturnValueOnce(mockEncryptedAesKey); + const command = new SetLogForwardingCommand([], {}); await expect(command.run()).rejects.toThrow( 'Failed to set log forwarding details. Try again. RequestId: dummy_request_id', diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index 6c0db009..111237b8 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -24,8 +24,13 @@ const { autoConfirmActionFlag, jsonFlag, destinations, + encryptSecrets, } = require('../../../../utils'); -const { setLogForwarding, getMeshId } = require('../../../../lib/smsClient'); +const { + setLogForwarding, + getMeshId, + getPublicEncryptionKey, +} = require('../../../../lib/smsClient'); class SetLogForwardingCommand extends Command { static flags = { @@ -85,6 +90,14 @@ class SetLogForwardingCommand extends Command { if (shouldContinue) { try { + // Encrypt the secrets in the destination config + const publicKey = await getPublicEncryptionKey(imsOrgCode); + if (destinationConfig.config.licenseKey) { + destinationConfig.config.licenseKey = await encryptSecrets( + publicKey, + destinationConfig.config.licenseKey, + ); + } const response = await setLogForwarding( imsOrgCode, projectId, From c5700bcf1df9f3967d99ffef2494d9fddd8db121 Mon Sep 17 00:00:00 2001 From: Narendra Vyas Date: Mon, 21 Apr 2025 18:35:28 +0530 Subject: [PATCH 02/15] feat: fixing failing test --- src/commands/api-mesh/__tests__/set-log-forwarding.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js index 8e5af449..1bf71a7e 100644 --- a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js +++ b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js @@ -79,6 +79,10 @@ describe('SetLogForwardingCommand', () => { getPublicEncryptionKey.mockResolvedValue('dummy_public_key'); setLogForwarding.mockResolvedValue({ success: true, result: true }); global.requestId = 'dummy_request_id'; + + // Reset mockCipher methods + mockCipher.update.mockReset().mockReturnValueOnce('mockEncryptedData'); + mockCipher.final.mockReset().mockReturnValueOnce(''); }); afterEach(() => { From 4baa3302a204695abb745101376e9e11cfb87bbe Mon Sep 17 00:00:00 2001 From: Narendra Vyas Date: Tue, 22 Apr 2025 18:47:54 +0530 Subject: [PATCH 03/15] feat: bump alpha version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dab46346..8e0b0e9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.0-beta.1", + "version": "5.3.1-alpha.1", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From 3b871b5512cb83a39756d554d3f60965bba0260c Mon Sep 17 00:00:00 2001 From: Narendra Vyas Date: Fri, 25 Apr 2025 18:16:44 +0530 Subject: [PATCH 04/15] feat: modiefied code to address review comment and address for splunk key as well --- .../api-mesh/config/set/log-forwarding.js | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index 111237b8..f9e5dcd4 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -90,14 +90,30 @@ class SetLogForwardingCommand extends Command { if (shouldContinue) { try { - // Encrypt the secrets in the destination config + // Get publicKey for encryption const publicKey = await getPublicEncryptionKey(imsOrgCode); - if (destinationConfig.config.licenseKey) { - destinationConfig.config.licenseKey = await encryptSecrets( - publicKey, - destinationConfig.config.licenseKey, + if (!publicKey) { + this.error( + `Unable to set log forwarding details. Unable to get public key. Try again. RequestId: ${global.requestId}`, ); } + // Get the key to encrypt from config + const getEncryptableKey = config => { + if ('licenseKey' in config) return 'licenseKey'; + if ('hecToken' in config) return 'hecToken'; + return null; + }; + const keyToEncrypt = getEncryptableKey(destinationConfig.config); + if (!keyToEncrypt) { + this.error( + `Unable to set log forwarding details. No valid key to encrypt found in the configuration.Try again. RequestId: ${global.requestId}`, + ); + } + // Encrypt the key + destinationConfig.config[keyToEncrypt] = await encryptSecrets( + publicKey, + destinationConfig.config[keyToEncrypt], + ); const response = await setLogForwarding( imsOrgCode, projectId, From 6de9fd3d8456826018adee93f4df5bf31b07ec6e Mon Sep 17 00:00:00 2001 From: Narendra Vyas Date: Fri, 25 Apr 2025 18:40:19 +0530 Subject: [PATCH 05/15] feat: very minor correction --- src/commands/api-mesh/config/set/log-forwarding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index f9e5dcd4..26c8d031 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -106,7 +106,7 @@ class SetLogForwardingCommand extends Command { const keyToEncrypt = getEncryptableKey(destinationConfig.config); if (!keyToEncrypt) { this.error( - `Unable to set log forwarding details. No valid key to encrypt found in the configuration.Try again. RequestId: ${global.requestId}`, + `Unable to set log forwarding details. No valid key to encrypt found in the configuration. Try again. RequestId: ${global.requestId}`, ); } // Encrypt the key From d3f99b135f8fa8528ff03b1ac0caa41e28686275 Mon Sep 17 00:00:00 2001 From: Kris Maschi Date: Fri, 25 Apr 2025 14:54:26 -0400 Subject: [PATCH 06/15] feat(metadata): initialize dotenv and include API mesh environment variables (#247) * feat(metadata): initialize dotenv and include API mesh environment variables * fix(helpers): reformat API mesh environment variable headers * fix(helpers): improve header formatting for API mesh environment variables * fix(helpers): improve header formatting for API mesh environment variables * feat(constants): add dotenv support and export environment variables for API mesh --------- Co-authored-by: Kristopher Maschi --- src/constants.js | 16 +++++++++++++++- src/helpers.js | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/constants.js b/src/constants.js index adee4e23..09bf8dd6 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,5 +1,7 @@ const { getCliEnv } = require('@adobe/aio-lib-env'); +const dotenv = require('dotenv'); +dotenv.config(); const clientEnv = getCliEnv(); const StageConstants = { @@ -24,4 +26,16 @@ const ProdConstants = { }; const envConstants = clientEnv === 'stage' ? StageConstants : ProdConstants; -module.exports = { ...envConstants }; + +// Export environment variables/constants +module.exports = { + DEV_CONSOLE_BASE_URL: process.env.DEV_CONSOLE_BASE_URL || envConstants.DEV_CONSOLE_BASE_URL, + DEV_CONSOLE_API_KEY: process.env.DEV_CONSOLE_API_KEY || envConstants.DEV_CONSOLE_API_KEY, + DEV_CONSOLE_TRANSPORTER_API_KEY: + process.env.DEV_CONSOLE_TRANSPORTER_API_KEY || envConstants.DEV_CONSOLE_TRANSPORTER_API_KEY, + AIO_CLI_API_KEY: process.env.AIO_CLI_API_KEY || envConstants.AIO_CLI_API_KEY, + SMS_BASE_URL: process.env.SMS_BASE_URL || envConstants.SMS_BASE_URL, + MESH_BASE_URL: process.env.MESH_BASE_URL || envConstants.MESH_BASE_URL, + MESH_SANDBOX_BASE_URL: process.env.MESH_SANDBOX_BASE_URL || envConstants.MESH_SANDBOX_BASE_URL, + SMS_API_KEY: process.env.SMS_API_KEY || envConstants.SMS_API_KEY, +}; diff --git a/src/helpers.js b/src/helpers.js index 04be1d33..9979ff5c 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -452,15 +452,13 @@ function initMetadata(config) { const { version, plugins, userAgent, platform, arch } = config; const currentIntalledVersion = getCurrentInstalledPluginVersion(plugins); - const metadataHeaders = { + global.metadataHeaders = { 'x-aio-cli-version': version, 'x-aio-cli-user-agent': userAgent, 'x-aio-cli-platform': platform, 'x-aio-cli-arch': arch, 'x-aio-cli-plugin-api-mesh-version': currentIntalledVersion, }; - - global.metadataHeaders = metadataHeaders; } catch (error) { logger.error('Unable to initialize metadata headers'); logger.error(error.message); From 3dd8ea8cf8eb4c47a256119810a6546a632fbe1d Mon Sep 17 00:00:00 2001 From: Kris Maschi Date: Mon, 28 Apr 2025 13:51:27 -0400 Subject: [PATCH 07/15] Release/5.3.1 (#248) (#249) * feat(metadata): initialize dotenv and include API mesh environment variables (#247) * feat(metadata): initialize dotenv and include API mesh environment variables * fix(helpers): reformat API mesh environment variable headers * fix(helpers): improve header formatting for API mesh environment variables * fix(helpers): improve header formatting for API mesh environment variables * feat(constants): add dotenv support and export environment variables for API mesh --------- * Update package.json to 5.3.1 --------- Co-authored-by: Brasewel Noronha <100383619+brasewel@users.noreply.github.com> Co-authored-by: Kristopher Maschi --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 691bc6cd..67ab51f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.0", + "version": "5.3.1", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From 7d674daa9365881f663855e91942794076a66ac2 Mon Sep 17 00:00:00 2001 From: ajaz Date: Tue, 29 Apr 2025 14:59:52 +0530 Subject: [PATCH 08/15] refactor: removed Newrelic license 40 char restriction --- .../api-mesh/__tests__/set-log-forwarding.test.js | 9 --------- src/utils.js | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js index 52973194..e8ac0f61 100644 --- a/src/commands/api-mesh/__tests__/set-log-forwarding.test.js +++ b/src/commands/api-mesh/__tests__/set-log-forwarding.test.js @@ -115,15 +115,6 @@ describe('SetLogForwardingCommand', () => { ); }); - test('throws an error if license key has wrong format', async () => { - promptInputSecret.mockResolvedValueOnce('wrongformat'); // Too short - - const command = new SetLogForwardingCommand([], {}); - await expect(command.run()).rejects.toThrow( - `The license key is in the wrong format. Expected: 40 characters (received: ${11})`, - ); - }); - test('prompts for missing destination', async () => { parseSpy.mockResolvedValueOnce({ flags: { diff --git a/src/utils.js b/src/utils.js index 0946777f..92d462a9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -132,11 +132,6 @@ const destinations = { if (!value) { throw new Error('License key is required'); } - if (value.length !== 40) { - throw new Error( - `The license key is in the wrong format. Expected: 40 characters (received: ${value.length})`, - ); - } }, }, ], @@ -777,7 +772,7 @@ async function localToUTCTime(timeString) { try { //Get the local timezone // takes the timezone where the javascript runtime is running - // reference https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#browser_compatibility:~:text=The%20value%20provided%20for%20this%20property%20in%20the%20options%20argument%2C%20with%20default%20filled%20in%20as%20needed.%20It%20is%20an%20IANA%20time%20zone%20name.%20The%20default%20is%20the%20runtime%27s%20default%20time%20zone. + // reference https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#browser_compatibility:~:text=The%20value%20provided%20for%20this%20property%20in%20the%20options%20argument%2C%20with%20default%20filled%20in%20as%20needed.%20It%20is%20an%20IANA%20time%20zone.%20The%20default%20is%20the%20runtime%27s%20default%20time%20zone. const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; // Create a Date object from the formatted time string From d129e504d9b55cae2cde3dec7828f0a3dd228c2e Mon Sep 17 00:00:00 2001 From: ajaz Date: Tue, 29 Apr 2025 15:46:12 +0530 Subject: [PATCH 09/15] bump up package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67ab51f6..1d7ed5c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.1", + "version": "5.3.1-beta.1", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From bc2ef06cb9e829281c68e6fd0901a260f58433a7 Mon Sep 17 00:00:00 2001 From: ajaz Date: Tue, 29 Apr 2025 21:54:31 +0530 Subject: [PATCH 10/15] fix: updated keys to enum values --- src/commands/api-mesh/config/set/log-forwarding.js | 5 +++-- src/utils.js | 6 ++++++ yarn.lock | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index 26c8d031..eaab3851 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -24,6 +24,7 @@ const { autoConfirmActionFlag, jsonFlag, destinations, + LogForwardingKeys, encryptSecrets, } = require('../../../../utils'); const { @@ -99,8 +100,8 @@ class SetLogForwardingCommand extends Command { } // Get the key to encrypt from config const getEncryptableKey = config => { - if ('licenseKey' in config) return 'licenseKey'; - if ('hecToken' in config) return 'hecToken'; + if (LogForwardingKeys.licenseKey in config) return LogForwardingKeys.licenseKey; + if (LogForwardingKeys.hecToken in config) return LogForwardingKeys.hecToken; return null; }; const keyToEncrypt = getEncryptableKey(destinationConfig.config); diff --git a/src/utils.js b/src/utils.js index 0946777f..640949be 100644 --- a/src/utils.js +++ b/src/utils.js @@ -101,6 +101,11 @@ const logFilenameFlag = Flags.string({ required: true, }); +const LogForwardingKeys = { + licenseKey: 'licenseKey', + hecToken: 'hecToken', +}; + // The `destinations` object to hold the configuration for log forwarding destinations. // It prompts for the required inputs for the destination. // Each destination can have different key/value pairs of configuration credentials. @@ -824,4 +829,5 @@ module.exports = { localToUTCTime, cachePurgeAllActionFlag, destinations, + LogForwardingKeys, }; diff --git a/yarn.lock b/yarn.lock index 10b8c1b6..bc7133be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8208,7 +8208,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1, ms@^2.1.3: +ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== From 4fdc84828b3e596259260c836cca17ce515e233e Mon Sep 17 00:00:00 2001 From: Sumaiya <108254100+AjazSumaiya@users.noreply.github.com> Date: Wed, 30 Apr 2025 19:44:20 +0530 Subject: [PATCH 11/15] Update package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d7ed5c5..869868ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.1-beta.1", + "version": "5.3.2-beta.1", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From 6f8b062862c5b40148f9d05aeade4a308cd669cd Mon Sep 17 00:00:00 2001 From: Sumaiya <108254100+AjazSumaiya@users.noreply.github.com> Date: Wed, 30 Apr 2025 19:46:45 +0530 Subject: [PATCH 12/15] Update package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index da17ddfc..77640f23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.1-beta.2", + "version": "5.3.2-beta.2", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin" From e2c6cfea05d2b82a3bacb7f65eb336068c6fc966 Mon Sep 17 00:00:00 2001 From: Sumaiya <108254100+AjazSumaiya@users.noreply.github.com> Date: Wed, 30 Apr 2025 19:55:52 +0530 Subject: [PATCH 13/15] Apply suggestions from code review Co-authored-by: Brasewel Noronha <100383619+brasewel@users.noreply.github.com> --- src/commands/api-mesh/config/set/log-forwarding.js | 4 ++-- src/utils.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index eaab3851..f0acf0de 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -100,8 +100,8 @@ class SetLogForwardingCommand extends Command { } // Get the key to encrypt from config const getEncryptableKey = config => { - if (LogForwardingKeys.licenseKey in config) return LogForwardingKeys.licenseKey; - if (LogForwardingKeys.hecToken in config) return LogForwardingKeys.hecToken; + if (LogForwardingKeys.LICENSE_KEY in config) return LogForwardingKeys.LICENSE_KEY; + if (LogForwardingKeys.HEC_TOKEN in config) return LogForwardingKeys.HEC_TOKEN; return null; }; const keyToEncrypt = getEncryptableKey(destinationConfig.config); diff --git a/src/utils.js b/src/utils.js index 640949be..471f5922 100644 --- a/src/utils.js +++ b/src/utils.js @@ -102,8 +102,8 @@ const logFilenameFlag = Flags.string({ }); const LogForwardingKeys = { - licenseKey: 'licenseKey', - hecToken: 'hecToken', + LICENSE_KEY: 'licenseKey', + HEC_TOKEN: 'hecToken', }; // The `destinations` object to hold the configuration for log forwarding destinations. From 355ed709b9e64d889035f43d3ac534565dd32d7c Mon Sep 17 00:00:00 2001 From: ajaz Date: Wed, 30 Apr 2025 19:57:25 +0530 Subject: [PATCH 14/15] fix: linting --- src/commands/api-mesh/config/set/log-forwarding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/api-mesh/config/set/log-forwarding.js b/src/commands/api-mesh/config/set/log-forwarding.js index f0acf0de..d6d3b91f 100644 --- a/src/commands/api-mesh/config/set/log-forwarding.js +++ b/src/commands/api-mesh/config/set/log-forwarding.js @@ -101,7 +101,7 @@ class SetLogForwardingCommand extends Command { // Get the key to encrypt from config const getEncryptableKey = config => { if (LogForwardingKeys.LICENSE_KEY in config) return LogForwardingKeys.LICENSE_KEY; - if (LogForwardingKeys.HEC_TOKEN in config) return LogForwardingKeys.HEC_TOKEN; + if (LogForwardingKeys.HEC_TOKEN in config) return LogForwardingKeys.HEC_TOKEN; return null; }; const keyToEncrypt = getEncryptableKey(destinationConfig.config); From c83b1600c692ab528e8f34231e0b7a7557a7a85b Mon Sep 17 00:00:00 2001 From: ajaz Date: Thu, 8 May 2025 17:45:47 +0530 Subject: [PATCH 15/15] updated package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77640f23..d268e78d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/aio-cli-plugin-api-mesh", - "version": "5.3.2-beta.2", + "version": "5.3.2", "description": "Adobe I/O CLI plugin to develop and manage API mesh sources", "keywords": [ "oclif-plugin"