@adobe/aio-cli-plugin-api-mesh 3.9.1 → 3.9.2-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.9.
|
|
1
|
+
{"version":"3.9.2-beta1","commands":{"PLUGINNAME":{"id":"PLUGINNAME","description":"Your description here","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio PLUGINNAME:some_command"],"flags":{"someflag":{"name":"someflag","type":"option","char":"f","description":"this is some flag"}},"args":[]},"api-mesh:create":{"id":"api-mesh:create","description":"Create a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:delete":{"id":"api-mesh:delete","description":"Delete the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false}},"args":[]},"api-mesh:describe":{"id":"api-mesh:describe","description":"Get details of a mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:get":{"id":"api-mesh:get","description":"Get the config of a given mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false}},"args":[{"name":"file"}]},"api-mesh:init":{"id":"api-mesh:init","description":"This command will create a workspace where you can organise your API mesh configuration and other files","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[{"description":"API mesh workspace init","command":"aio api-mesh init commerce-mesh"},{"description":"API mesh workspace init with flags","command":"aio api-mesh init commerce-mesh --path ./mesh_projects/test_mesh --git y --packageManager yarn"}],"flags":{"path":{"name":"path","type":"option","char":"p","default":"."},"packageManager":{"name":"packageManager","type":"option","char":"m","options":["npm","yarn"]},"git":{"name":"git","type":"option","char":"g","options":["y","n"]}},"args":[{"name":"projectName","description":"Project name","required":true}]},"api-mesh:log-get-bulk":{"id":"api-mesh:log-get-bulk","description":"Download all mesh logs for a selected time period.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"startTime":{"name":"startTime","type":"option","description":"Start time for the logs in UTC","required":true},"endTime":{"name":"endTime","type":"option","description":"End time for the logs in UTC","required":true},"filename":{"name":"filename","type":"option","description":"Path to the output file for logs","required":true}},"args":[]},"api-mesh:log-get":{"id":"api-mesh:log-get","description":"Get the Log of a given mesh by RayId","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"rayId","description":"Fetch a single log by rayID","required":true}]},"api-mesh:log-list":{"id":"api-mesh:log-list","description":"Get recent logs of requests made to the API Mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"filename":{"name":"filename","type":"option","description":"Name of CSV file to export the recent logs to"}},"args":[]},"api-mesh:run":{"id":"api-mesh:run","description":"Run a local development server that builds and compiles a mesh locally","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Port number for the local dev server"},"debug":{"name":"debug","type":"boolean","description":"Enable debugging mode","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"select":{"name":"select","type":"boolean","description":"Retrieve existing artifacts from the mesh","allowNo":false},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file","description":"Mesh File"}]},"api-mesh:status":{"id":"api-mesh:status","description":"Get a mesh status with a given meshid.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[]},"api-mesh:update":{"id":"api-mesh:update","description":"Update a mesh with the given config.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false},"autoConfirmAction":{"name":"autoConfirmAction","type":"boolean","char":"c","description":"Auto confirm action prompt. CLI will not check for user approval before executing the action.","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"secrets":{"name":"secrets","type":"option","char":"s","description":"Path to secrets file","default":false}},"args":[{"name":"file"}]},"api-mesh:source:discover":{"id":"api-mesh:source:discover","description":"Return the list of avaliable sources","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm install action prompt. CLI will not check ask user to install source.","allowNo":false}},"args":[]},"api-mesh:source:get":{"id":"api-mesh:source:get","description":"Command returns the content of a specific source.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:get -s=<version>@<source_name>","$ aio api-mesh:source:get -s<source_name>","$ aio api-mesh:source:get -m"],"flags":{"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm print action prompt. CLI will not check ask user to print source.","allowNo":false},"source":{"name":"source","type":"option","char":"s","description":"Source name"},"multiple":{"name":"multiple","type":"boolean","char":"m","description":"Select multiple sources","allowNo":false}},"args":[]},"api-mesh:source:install":{"id":"api-mesh:source:install","description":"Command to install the source to your API mesh.","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":["$ aio api-mesh:source:install <version>@<source_name>","$ aio api-mesh:source:install <source_name> -v <variable_name>=<variable_value>","$ aio api-mesh:source:install <source_name> -f <path_to_variables_file>"],"flags":{"source":{"name":"source","type":"option","char":"s","description":"Source name"},"confirm":{"name":"confirm","type":"boolean","char":"c","description":"Auto confirm override action prompt. CLI will not check ask user to override source.","allowNo":false},"variable":{"name":"variable","type":"option","char":"v","description":"Variables required for the source"},"variable-file":{"name":"variable-file","type":"option","char":"f","description":"Variables file path"},"ignoreCache":{"name":"ignoreCache","type":"boolean","char":"i","description":"Ignore cache and force manual org -> project -> workspace selection","allowNo":false}},"args":[{"name":"source"}]}}}
|
package/package.json
CHANGED
|
@@ -114,6 +114,8 @@ describe('List Logs Command', () => {
|
|
|
114
114
|
const command = new ListLogsCommand([], {});
|
|
115
115
|
await command.run();
|
|
116
116
|
expect(fs.appendFileSync).toHaveBeenCalled();
|
|
117
|
+
expect(logSpy).toHaveBeenCalledTimes(1);
|
|
118
|
+
expect(logSpy).toHaveBeenCalledWith(' Successfully downloaded the logs to test.csv');
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
test('Logs are listed successfully', async () => {
|
|
@@ -125,6 +127,22 @@ describe('List Logs Command', () => {
|
|
|
125
127
|
const command = new ListLogsCommand([], {});
|
|
126
128
|
await command.run();
|
|
127
129
|
expect(fs.appendFileSync).not.toHaveBeenCalled();
|
|
130
|
+
expect(logSpy).toHaveBeenCalledTimes(6);
|
|
131
|
+
expect(logSpy).toHaveBeenCalledWith(
|
|
132
|
+
` 8c171e8a9a47c16d 1726052061861 200 info `,
|
|
133
|
+
);
|
|
134
|
+
expect(logSpy).toHaveBeenCalledWith(
|
|
135
|
+
` 8c171dd35860c16d 1726052032540 200 info `,
|
|
136
|
+
);
|
|
137
|
+
expect(logSpy).toHaveBeenCalledWith(
|
|
138
|
+
` 8c171dd22f00c16d 1726052032348 200 info `,
|
|
139
|
+
);
|
|
140
|
+
expect(logSpy).toHaveBeenCalledWith(
|
|
141
|
+
` 8c171dd10df2c16d 1726052032167 200 info `,
|
|
142
|
+
);
|
|
143
|
+
expect(logSpy).not.toHaveBeenCalledWith(
|
|
144
|
+
expect.stringContaining('Successfully downloaded the logs'),
|
|
145
|
+
);
|
|
128
146
|
});
|
|
129
147
|
|
|
130
148
|
test('No logs found message displayed when sms returns empty array with file as output', async () => {
|
|
@@ -82,7 +82,9 @@ class ListLogsCommand extends Command {
|
|
|
82
82
|
...flags,
|
|
83
83
|
},
|
|
84
84
|
);
|
|
85
|
-
|
|
85
|
+
if (filename) {
|
|
86
|
+
this.log(` Successfully downloaded the logs to ${filename}`);
|
|
87
|
+
}
|
|
86
88
|
} else {
|
|
87
89
|
this.log(
|
|
88
90
|
'No recent logs found. Alternatively, you can use the following command to get all logs for a 30 minute time period: \naio api-mesh log-get-bulk --startTime YYYY-MM-DDTHH:MM:SSZ --endTime YYYY-MM-DDTHH:MM:SSZ --filename mesh_logs.csv',
|
package/src/lib/devConsole.js
CHANGED
|
@@ -131,7 +131,7 @@ const listLogs = async (organizationCode, projectId, workspaceId, meshId, fileNa
|
|
|
131
131
|
headers: {
|
|
132
132
|
'Authorization': `Bearer ${accessToken}`,
|
|
133
133
|
'x-request-id': global.requestId,
|
|
134
|
-
'
|
|
134
|
+
'X-Api-Key': apiKey,
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
|
|
@@ -909,17 +909,15 @@ const getTenantFeatures = async organizationCode => {
|
|
|
909
909
|
const { accessToken, apiKey } = await getDevConsoleConfig();
|
|
910
910
|
const config = {
|
|
911
911
|
method: 'get',
|
|
912
|
-
url: `${SMS_BASE_URL}/organizations/${organizationCode}/features
|
|
912
|
+
url: `${SMS_BASE_URL}/organizations/${organizationCode}/features`,
|
|
913
913
|
headers: {
|
|
914
914
|
'Authorization': `Bearer ${accessToken}`,
|
|
915
915
|
'x-request-id': global.requestId,
|
|
916
|
+
'X-Api-Key': apiKey,
|
|
916
917
|
},
|
|
917
918
|
};
|
|
918
919
|
|
|
919
|
-
logger.info(
|
|
920
|
-
'Initiating GET %s',
|
|
921
|
-
`${SMS_BASE_URL}/organizations/${organizationCode}/features?API_KEY=${apiKey}`,
|
|
922
|
-
);
|
|
920
|
+
logger.info('Initiating GET %s', `${SMS_BASE_URL}/organizations/${organizationCode}/features`);
|
|
923
921
|
|
|
924
922
|
try {
|
|
925
923
|
const response = await axios(config);
|
|
@@ -966,16 +964,17 @@ const getMeshDeployments = async (organizationCode, projectId, workspaceId, mesh
|
|
|
966
964
|
const { accessToken, apiKey } = await getDevConsoleConfig();
|
|
967
965
|
const config = {
|
|
968
966
|
method: 'get',
|
|
969
|
-
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/deployments/latest
|
|
967
|
+
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/deployments/latest`,
|
|
970
968
|
headers: {
|
|
971
969
|
'Authorization': `Bearer ${accessToken}`,
|
|
972
970
|
'x-request-id': global.requestId,
|
|
971
|
+
'X-Api-Key': apiKey,
|
|
973
972
|
},
|
|
974
973
|
};
|
|
975
974
|
|
|
976
975
|
logger.info(
|
|
977
976
|
'Initiating GET %s',
|
|
978
|
-
`${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/deployments/latest
|
|
977
|
+
`${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/deployments/latest`,
|
|
979
978
|
);
|
|
980
979
|
|
|
981
980
|
try {
|
|
@@ -1021,15 +1020,16 @@ const getPublicEncryptionKey = async organizationCode => {
|
|
|
1021
1020
|
const { accessToken, apiKey } = await getDevConsoleConfig();
|
|
1022
1021
|
const config = {
|
|
1023
1022
|
method: 'get',
|
|
1024
|
-
url: `${SMS_BASE_URL}/organizations/${organizationCode}/getPublicKey
|
|
1023
|
+
url: `${SMS_BASE_URL}/organizations/${organizationCode}/getPublicKey`,
|
|
1025
1024
|
headers: {
|
|
1026
1025
|
'Authorization': `Bearer ${accessToken}`,
|
|
1027
1026
|
'x-request-id': global.requestId,
|
|
1027
|
+
'X-Api-Key': apiKey,
|
|
1028
1028
|
},
|
|
1029
1029
|
};
|
|
1030
1030
|
logger.info(
|
|
1031
1031
|
'Initiating GET %s',
|
|
1032
|
-
`${SMS_BASE_URL}/organizations/${organizationCode}/getPublicKey
|
|
1032
|
+
`${SMS_BASE_URL}/organizations/${organizationCode}/getPublicKey`,
|
|
1033
1033
|
);
|
|
1034
1034
|
try {
|
|
1035
1035
|
const response = await axios(config);
|
|
@@ -1069,7 +1069,7 @@ const getPresignedUrls = async (
|
|
|
1069
1069
|
headers: {
|
|
1070
1070
|
'Authorization': `Bearer ${accessToken}`,
|
|
1071
1071
|
'x-request-id': global.requestId,
|
|
1072
|
-
'
|
|
1072
|
+
'X-Api-Key': apiKey,
|
|
1073
1073
|
},
|
|
1074
1074
|
};
|
|
1075
1075
|
|
|
@@ -1108,7 +1108,7 @@ const getLogsByRayId = async (organizationCode, projectId, workspaceId, meshId,
|
|
|
1108
1108
|
headers: {
|
|
1109
1109
|
'Authorization': `Bearer ${accessToken}`,
|
|
1110
1110
|
'x-request-id': global.requestId,
|
|
1111
|
-
'
|
|
1111
|
+
'X-Api-Key': apiKey,
|
|
1112
1112
|
},
|
|
1113
1113
|
};
|
|
1114
1114
|
|