Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
655e591
feat: added command to set log forwarding configs
AjazSumaiya Mar 19, 2025
94332ed
fix: function statements
AjazSumaiya Mar 19, 2025
8463468
fix: remove flags for configs
AjazSumaiya Mar 19, 2025
b0b6cc5
fix: logging statement
AjazSumaiya Mar 19, 2025
3d6eaee
chore: added command description
AjazSumaiya Mar 19, 2025
7536856
feat: updated code to support more destinations
AjazSumaiya Mar 21, 2025
440c798
chore: updated test name for newrelic destination
AjazSumaiya Mar 21, 2025
64770d5
Update error statement
AjazSumaiya Mar 21, 2025
b4cc15e
fix: review comments
AjazSumaiya Mar 26, 2025
f39d393
chore: removed local files
AjazSumaiya Mar 26, 2025
7953916
Update src/commands/api-mesh/set-log-forwarding.js
brasewel Mar 26, 2025
11377c6
Update src/commands/api-mesh/set-log-forwarding.js
brasewel Mar 26, 2025
7b6d0b0
Update src/commands/api-mesh/set-log-forwarding.js
brasewel Mar 26, 2025
68b1d66
Update src/commands/api-mesh/set-log-forwarding.js
brasewel Mar 26, 2025
ab02a99
Merge pull request #225 from adobe/cext-4231
dthampy Mar 28, 2025
e2ac7c0
Warn if includeHTTPDetails is used in a production workspace while cr…
revanth0212 Apr 2, 2025
41a6f4b
Initializing metadata and sending it in every sms request
revanth0212 Apr 2, 2025
bd96dc8
Removing unnecessary console.log
revanth0212 Apr 2, 2025
fe599e8
Minor
revanth0212 Apr 2, 2025
618f560
Tests fix
revanth0212 Apr 2, 2025
5e70c62
chore: updated command format
AjazSumaiya Apr 3, 2025
f01edd0
chore: update --past to have integer values
AjazSumaiya Apr 3, 2025
05fef18
updated past TimeWindow duration check
AjazSumaiya Apr 3, 2025
68397c2
Updated snapshots
revanth0212 Apr 3, 2025
0602212
feat: Added config get log-forwording command
nvyasadobe Apr 4, 2025
0ae9aa0
feat: bump package version, added alpha
nvyasadobe Apr 4, 2025
55bb5d5
feat: minor correction
nvyasadobe Apr 4, 2025
ad9f468
feat: lint fixes
nvyasadobe Apr 4, 2025
49386bb
Merge pull request #233 from adobe/fix/cext-4231
AjazSumaiya Apr 7, 2025
24662d7
fix: removed --from flag
AjazSumaiya Apr 7, 2025
1f71b44
feat: added 404 related tests
nvyasadobe Apr 7, 2025
d3ed209
feat: took pull from epic branch
nvyasadobe Apr 7, 2025
961f26b
feat: renamed devConsole.js to smsClient.js, also updated on all rele…
nvyasadobe Apr 7, 2025
f1b6790
feat: minor update
nvyasadobe Apr 7, 2025
c904a98
feat: updated error messageing text
nvyasadobe Apr 7, 2025
19152d7
feat: lint fixes
nvyasadobe Apr 7, 2025
f7cf836
Merge pull request #239 from adobe/main
kmaschi Apr 7, 2025
3e41b03
Merge pull request #238 from adobe/CEXT-4203-get-logforwarding
nvyasadobe Apr 8, 2025
a34237c
Update src/commands/api-mesh/update.js
revanth0212 Apr 8, 2025
ee76c90
Update src/commands/api-mesh/create.js
revanth0212 Apr 8, 2025
bd9e953
Update src/commands/api-mesh/create.js
revanth0212 Apr 8, 2025
561b303
Update src/commands/api-mesh/create.js
revanth0212 Apr 8, 2025
db5087d
Fix string lint errors
revanth0212 Apr 8, 2025
1f86cfb
Merge remote-tracking branch 'origin/develop' into feature/captureCLI…
revanth0212 Apr 8, 2025
34ac665
Fixed failing tests
revanth0212 Apr 8, 2025
7fa34b4
Utils fix
revanth0212 Apr 8, 2025
49b3cb3
Merge pull request #231 from adobe/feature/captureCLIVersionDetails
revanth0212 Apr 8, 2025
24fdea2
Merge remote-tracking branch 'origin/develop' into feature/warnOnHttp…
revanth0212 Apr 8, 2025
230cb1f
Merge pull request #230 from adobe/feature/warnOnHttpDetailsUsage
revanth0212 Apr 8, 2025
2f1f44b
Apply suggestions from code review
AjazSumaiya Apr 9, 2025
8746fe2
address code review
AjazSumaiya Apr 9, 2025
0002284
fix: lint and test
AjazSumaiya Apr 9, 2025
deb2714
merge develop
AjazSumaiya Apr 9, 2025
6644639
fix: linting
AjazSumaiya Apr 9, 2025
c8d9074
fix: resolve conflict
AjazSumaiya Apr 9, 2025
4864f62
feat(caching): - Updated dependency to support building mesh with cac…
Apr 10, 2025
bbfd32c
feat: added delete log forwarding command
AjazSumaiya Apr 11, 2025
7e1ac7e
chore: fix unit test file
AjazSumaiya Apr 11, 2025
fdb709f
chore:address review comments
AjazSumaiya Apr 14, 2025
9bfc5c3
Apply suggestions from code review
AjazSumaiya Apr 15, 2025
5f0f771
fix: linting
AjazSumaiya Apr 15, 2025
8fb85de
chore: bump up package version
AjazSumaiya Apr 15, 2025
a881153
Merge pull request #235 from adobe/fix/cext-4448
AjazSumaiya Apr 15, 2025
865cfbe
Merge pull request #240 from adobe/feature/CEXT-3999-ga-caching
kmaschi Apr 15, 2025
c28e4c2
Merge pull request #241 from adobe/cext-4214
AjazSumaiya Apr 15, 2025
72683a6
Merge remote-tracking branch 'origin/develop' into epic/log-forwarding
amolina-adobe Apr 16, 2025
1781f16
chore: bump version for 5.3.0-beta.1 release
amolina-adobe Apr 16, 2025
30dcd3f
Merge pull request #242 from adobe/epic/log-forwarding
amolina-adobe Apr 16, 2025
5692c66
feat: added description for topic config
AjazSumaiya Apr 17, 2025
be77860
bump up package version
AjazSumaiya Apr 17, 2025
7fe187a
Apply suggestions from code review
AjazSumaiya Apr 17, 2025
a7e6155
Merge pull request #243 from adobe/feat/log-forwarding-description
AjazSumaiya Apr 17, 2025
24528f1
Update package.json
brasewel Apr 17, 2025
ba1bad1
Update package.json
brasewel Apr 17, 2025
1f027a4
Merge pull request #244 from adobe/release/5.4.0
brasewel Apr 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adobe/aio-cli-plugin-api-mesh",
"version": "5.2.3",
"version": "5.3.0",
"description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
"keywords": [
"oclif-plugin"
Expand Down Expand Up @@ -38,7 +38,7 @@
"version": "oclif-dev readme && git add README.md"
},
"dependencies": {
"@adobe-apimesh/mesh-builder": "2.1.5",
"@adobe-apimesh/mesh-builder": "2.1.6",
"@adobe/aio-cli-lib-console": "^5.0.0",
"@adobe/aio-lib-core-config": "^5.0.0",
"@adobe/aio-lib-core-logging": "^3.0.0",
Expand Down Expand Up @@ -91,7 +91,6 @@
"jsmin": "1.0.1",
"json-interpolate": "^1.0.3",
"lru-cache": "^7.14.1",
"ms": "^2.1.3",
"node-clipboardy": "^1.0.3",
"node-fetch": "2.6.1",
"pino": "^9.5.0",
Expand Down Expand Up @@ -147,6 +146,9 @@
"@oclif/plugin-help"
],
"hooks": {
"init": [
"./src/hooks/initMetadata.js"
],
"prerun": [
"./src/hooks/versionCompare.js"
]
Expand Down
7 changes: 3 additions & 4 deletions src/commands/api-mesh/__tests__/cache-purge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ jest.mock('../../../helpers', () => ({
initRequestId: jest.fn().mockResolvedValue({}),
promptConfirm: jest.fn().mockResolvedValue(true),
}));
jest.mock('../../../lib/devConsole');
jest.mock('../../../lib/smsClient');
const mockConsoleCLIInstance = {};
const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
const selectedProject = { id: '5678', title: 'Project01' };
const selectedWorkspace = { id: '123456789', title: 'Workspace01' };
const CachePurgeCommand = require('../cache/purge');
const { initSdk, initRequestId, promptConfirm } = require('../../../helpers');
const { initSdk, promptConfirm } = require('../../../helpers');
const {
getMeshId,
deleteMesh,
getApiKeyCredential,
unsubscribeCredentialFromMeshService,
cachePurge,
} = require('../../../lib/devConsole');
} = require('../../../lib/smsClient');
let logSpy = null;
let errorLogSpy = null;
let parseSpy = null;
Expand Down Expand Up @@ -229,7 +229,6 @@ describe('cache purge command tests', () => {
cachePurge.mockResolvedValueOnce({ success: true });
const runResult = await CachePurgeCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(runResult).toMatchInlineSnapshot(`
{
"success": true,
Expand Down
23 changes: 4 additions & 19 deletions src/commands/api-mesh/__tests__/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,18 @@ jest.mock('../../../helpers', () => ({
interpolateMesh: jest.fn().mockResolvedValue({}),
importFiles: jest.fn().mockResolvedValue(),
}));
jest.mock('../../../lib/devConsole');
jest.mock('../../../lib/smsClient');

const CreateCommand = require('../create');
const sampleCreateMeshConfig = require('../../__fixtures__/sample_mesh.json');
const meshConfigWithComposerFiles = require('../../__fixtures__/sample_mesh_with_composer_files.json');
const {
initSdk,
initRequestId,
promptConfirm,
interpolateMesh,
importFiles,
} = require('../../../helpers');
const { initSdk, promptConfirm, interpolateMesh, importFiles } = require('../../../helpers');
const {
getMesh,
createMesh,
getTenantFeatures,
getPublicEncryptionKey,
} = require('../../../lib/devConsole');
} = require('../../../lib/smsClient');

const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };

Expand All @@ -69,7 +63,7 @@ jest.mock('../../../helpers', () => ({
interpolateMesh: jest.fn().mockResolvedValue({}),
importFiles: jest.fn().mockResolvedValue({}),
}));
jest.mock('../../../lib/devConsole');
jest.mock('../../../lib/smsClient');
jest.mock('chalk', () => ({
red: jest.fn(text => text), // Return the input text without any color formatting
bold: jest.fn(text => text),
Expand Down Expand Up @@ -340,7 +334,6 @@ describe('create command tests', () => {
test('should create if a valid mesh config file is provided', async () => {
const runResult = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"CODE1234@AdobeOrg",
Expand Down Expand Up @@ -422,7 +415,6 @@ describe('create command tests', () => {

const runResult = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"CODE1234@AdobeOrg",
Expand Down Expand Up @@ -557,7 +549,6 @@ describe('create command tests', () => {

await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(promptConfirm).not.toHaveBeenCalled();
expect(initSdk).toHaveBeenCalledWith({
ignoreCache: true,
Expand Down Expand Up @@ -594,7 +585,6 @@ describe('create command tests', () => {

await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(promptConfirm).toHaveBeenCalled();
expect(initSdk).toHaveBeenCalledWith({
ignoreCache: true,
Expand Down Expand Up @@ -902,7 +892,6 @@ describe('create command tests', () => {

const output = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"CODE1234@AdobeOrg",
Expand Down Expand Up @@ -1164,7 +1153,6 @@ describe('create command tests', () => {

const output = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"1234",
Expand Down Expand Up @@ -1292,7 +1280,6 @@ describe('create command tests', () => {

const output = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"1234",
Expand Down Expand Up @@ -1422,7 +1409,6 @@ describe('create command tests', () => {

const output = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"CODE1234@AdobeOrg",
Expand Down Expand Up @@ -1552,7 +1538,6 @@ describe('create command tests', () => {

const output = await CreateCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
[
"CODE1234@AdobeOrg",
Expand Down
106 changes: 106 additions & 0 deletions src/commands/api-mesh/__tests__/delete-log-forwarding.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const DeleteLogForwardingCommand = require('../config/delete/log-forwarding');
const { initSdk, promptConfirm } = require('../../../helpers');
const { getMeshId, deleteLogForwarding } = require('../../../lib/smsClient');

jest.mock('../../../helpers', () => ({
initSdk: jest.fn().mockResolvedValue({}),
initRequestId: jest.fn().mockResolvedValue({}),
promptConfirm: jest.fn().mockResolvedValue(true),
}));
jest.mock('../../../lib/smsClient');

let logSpy, errorLogSpy, parseSpy;

describe('delete log forwarding command tests', () => {
beforeEach(() => {
initSdk.mockResolvedValue({
imsOrgCode: 'mockOrgCode',
projectId: 'mockProjectId',
workspaceId: 'mockWorkspaceId',
workspaceName: 'mockWorkspaceName',
});

getMeshId.mockResolvedValue('mockMeshId');
deleteLogForwarding.mockResolvedValue();

global.requestId = 'dummy_request_id';

logSpy = jest.spyOn(DeleteLogForwardingCommand.prototype, 'log');
errorLogSpy = jest.spyOn(DeleteLogForwardingCommand.prototype, 'error');
parseSpy = jest.spyOn(DeleteLogForwardingCommand.prototype, 'parse');
});

afterEach(() => {
jest.clearAllMocks();
});

test('should fail if mesh ID is not found', async () => {
getMeshId.mockResolvedValueOnce(null);

await expect(DeleteLogForwardingCommand.run()).rejects.toThrow(
'Unable to delete log forwarding details. No mesh found for Org(mockOrgCode) -> Project(mockProjectId) -> Workspace(mockWorkspaceId). Check the details and try again.',
);

expect(logSpy).not.toHaveBeenCalled();
expect(errorLogSpy).toHaveBeenCalledWith(
'Unable to delete log forwarding details. No mesh found for Org(mockOrgCode) -> Project(mockProjectId) -> Workspace(mockWorkspaceId). Check the details and try again.',
);
});

test('should skip confirmation if autoConfirmAction is set', async () => {
parseSpy.mockResolvedValueOnce({
flags: {
ignoreCache: false,
autoConfirmAction: true,
},
});

await DeleteLogForwardingCommand.run();

expect(promptConfirm).not.toHaveBeenCalled();
expect(deleteLogForwarding).toHaveBeenCalledWith(
'mockOrgCode',
'mockProjectId',
'mockWorkspaceId',
'mockMeshId',
);
expect(logSpy).toHaveBeenCalledWith('Successfully deleted log forwarding details');
});

test('should fail if deleteLogForwarding throws an error', async () => {
deleteLogForwarding.mockRejectedValueOnce(new Error('Deletion failed'));

await expect(DeleteLogForwardingCommand.run()).rejects.toThrow(
'Unable to delete log forwarding details. Try again. RequestId: dummy_request_id',
);

expect(logSpy).not.toHaveBeenCalledWith('Successfully deleted log forwarding details');
expect(errorLogSpy).toHaveBeenCalledWith(
'Unable to delete log forwarding details. Try again. RequestId: dummy_request_id',
);
});

test('should delete log forwarding details successfully', async () => {
await DeleteLogForwardingCommand.run();

expect(deleteLogForwarding).toHaveBeenCalledWith(
'mockOrgCode',
'mockProjectId',
'mockWorkspaceId',
'mockMeshId',
);
expect(logSpy).toHaveBeenCalledWith('Successfully deleted log forwarding details');
});
});
7 changes: 3 additions & 4 deletions src/commands/api-mesh/__tests__/delete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jest.mock('../../../helpers', () => ({
initRequestId: jest.fn().mockResolvedValue({}),
promptConfirm: jest.fn().mockResolvedValue(true),
}));
jest.mock('../../../lib/devConsole');
jest.mock('../../../lib/smsClient');

const mockConsoleCLIInstance = {};

Expand All @@ -34,13 +34,13 @@ const selectedProject = { id: '5678', title: 'Project01' };
const selectedWorkspace = { id: '123456789', title: 'Workspace01' };

const DeleteCommand = require('../delete');
const { initSdk, initRequestId, promptConfirm } = require('../../../helpers');
const { initSdk, promptConfirm } = require('../../../helpers');
const {
getMeshId,
deleteMesh,
getApiKeyCredential,
unsubscribeCredentialFromMeshService,
} = require('../../../lib/devConsole');
} = require('../../../lib/smsClient');

let logSpy = null;
let errorLogSpy = null;
Expand Down Expand Up @@ -203,7 +203,6 @@ describe('delete command tests', () => {
test('should delete mesh if correct args are provided', async () => {
const runResult = await DeleteCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(runResult).toMatchInlineSnapshot(`
{
"status": "success",
Expand Down
8 changes: 3 additions & 5 deletions src/commands/api-mesh/__tests__/describe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jest.mock('@adobe/aio-cli-lib-console', () => ({
init: jest.fn().mockResolvedValue(mockConsoleCLIInstance),
cleanStdOut: jest.fn(),
}));
jest.mock('../../../lib/devConsole');
jest.mock('../../../lib/smsClient');
jest.mock('chalk', () => ({
bold: jest.fn(text => text), // Return the input text without any color formatting
underline: {
Expand All @@ -33,8 +33,8 @@ jest.mock('chalk', () => ({
}));

const DescribeCommand = require('../describe');
const { initSdk, initRequestId } = require('../../../helpers');
const { describeMesh, getMesh, getTenantFeatures } = require('../../../lib/devConsole');
const { initSdk } = require('../../../helpers');
const { describeMesh, getMesh, getTenantFeatures } = require('../../../lib/smsClient');
const sampleCreateMeshConfig = require('../../__fixtures__/sample_mesh.json');

const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
Expand Down Expand Up @@ -202,7 +202,6 @@ describe('describe command tests', () => {
test('should return Non TI url if request is Non Ti', async () => {
const runResult = await DescribeCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(describeMesh).toHaveBeenCalledWith(
selectedOrg.code,
selectedProject.id,
Expand Down Expand Up @@ -258,7 +257,6 @@ describe('describe command tests', () => {
getMesh.mockResolvedValue(fetchedMeshConfig);
const runResult = await DescribeCommand.run();

expect(initRequestId).toHaveBeenCalled();
expect(describeMesh).toHaveBeenCalledWith(
selectedOrg.code,
selectedProject.id,
Expand Down
Loading
Loading