@adobe/aio-cli-plugin-api-mesh 5.2.3 → 5.2.4-alpha.0

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.
Files changed (42) hide show
  1. package/oclif.manifest.json +1 -1
  2. package/package.json +5 -10
  3. package/src/commands/{api-mesh.js → PLUGINNAME/__tests__/index.test.js} +15 -13
  4. package/src/commands/PLUGINNAME/index.js +32 -0
  5. package/src/commands/api-mesh/__tests__/cache-purge.test.js +2 -2
  6. package/src/commands/api-mesh/__tests__/create.test.js +9 -21
  7. package/src/commands/api-mesh/__tests__/delete.test.js +2 -2
  8. package/src/commands/api-mesh/__tests__/describe.test.js +2 -2
  9. package/src/commands/api-mesh/__tests__/get-log-forwarding.test.js +149 -0
  10. package/src/commands/api-mesh/__tests__/get.test.js +2 -2
  11. package/src/commands/api-mesh/__tests__/log-get-bulk.test.js +2 -2
  12. package/src/commands/api-mesh/__tests__/log-get.test.js +2 -2
  13. package/src/commands/api-mesh/__tests__/log-list.test.js +2 -2
  14. package/src/commands/api-mesh/__tests__/run.test.js +67 -193
  15. package/src/commands/api-mesh/__tests__/set-log-forwarding.test.js +246 -0
  16. package/src/commands/api-mesh/__tests__/status.test.js +2 -2
  17. package/src/commands/api-mesh/__tests__/update.test.js +4 -6
  18. package/src/commands/api-mesh/cache/purge.js +1 -1
  19. package/src/commands/api-mesh/config/get/log-forwarding.js +78 -0
  20. package/src/commands/api-mesh/config/set/log-forwarding.js +156 -0
  21. package/src/commands/api-mesh/create.js +4 -3
  22. package/src/commands/api-mesh/delete.js +1 -1
  23. package/src/commands/api-mesh/describe.js +1 -1
  24. package/src/commands/api-mesh/get.js +1 -1
  25. package/src/commands/api-mesh/log-get-bulk.js +1 -1
  26. package/src/commands/api-mesh/log-get.js +1 -1
  27. package/src/commands/api-mesh/log-list.js +1 -1
  28. package/src/commands/api-mesh/run.js +162 -208
  29. package/src/commands/api-mesh/source/__tests__/install.test.js +2 -2
  30. package/src/commands/api-mesh/source/install.js +1 -1
  31. package/src/commands/api-mesh/status.js +1 -1
  32. package/src/commands/api-mesh/update.js +4 -3
  33. package/src/helpers.js +29 -20
  34. package/src/{worker.js → index.js} +7 -9
  35. package/src/lib/{devConsole.js → smsClient.js} +186 -1
  36. package/src/server.js +32 -74
  37. package/src/utils.js +46 -10
  38. package/src/wranglerServer.js +80 -0
  39. package/src/meshArtifact.js +0 -231
  40. package/src/project.js +0 -56
  41. package/src/wranglerCli.js +0 -54
  42. package/wrangler.toml +0 -13
@@ -1 +1 @@
1
- {"version":"5.2.3","commands":{"api-mesh":{"id":"api-mesh","description":"Create, run, test, and deploy API Mesh","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"flags":{},"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"},"endTime":{"name":"endTime","type":"option","description":"End time for the logs in UTC"},"filename":{"name":"filename","type":"option","description":"Path to the output file for logs","required":true},"past":{"name":"past","type":"option","description":"Past time window in mins"},"from":{"name":"from","type":"option","description":"The from time in YYYY-MM-DD:HH:MM:SS format based on your system's time zone. It is used to fetch logs from the past and is the starting time for the past time duration."}},"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","default":5000},"inspectPort":{"name":"inspectPort","type":"option","char":"i","description":"Port number for the local dev server inspector","default":9229},"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:cache:purge":{"id":"api-mesh:cache:purge","description":"Cache purge for 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},"all":{"name":"all","type":"boolean","char":"a","description":"Purge all cache. CLI will purge all cache data.","required":true,"allowNo":false}},"args":[]},"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"}]}}}
1
+ {"version":"5.2.4-alpha.0","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"},"endTime":{"name":"endTime","type":"option","description":"End time for the logs in UTC"},"filename":{"name":"filename","type":"option","description":"Path to the output file for logs","required":true},"past":{"name":"past","type":"option","description":"Past time window in mins"},"from":{"name":"from","type":"option","description":"The from time in YYYY-MM-DD:HH:MM:SS format based on your system's time zone. It is used to fetch logs from the past and is the starting time for the past time duration."}},"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:cache:purge":{"id":"api-mesh:cache:purge","description":"Cache purge for 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},"all":{"name":"all","type":"boolean","char":"a","description":"Purge all cache. CLI will purge all cache data.","required":true,"allowNo":false}},"args":[]},"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"}]},"api-mesh:config:get:log-forwarding":{"id":"api-mesh:config:get:log-forwarding","description":"Get log forwarding details for 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":[]},"api-mesh:config:set:log-forwarding":{"id":"api-mesh:config:set:log-forwarding","description":"Sets the log forwarding destination for API mesh. \n- Select a log forwarding destination - Choose from available options (for example, New Relic).\n- Enter the base URI - Provide the URI for the log forwarding service. Ensure it includes the protocol (for example, if the hosted region of the New Relic account is the U.S, the base URI could be 'https://log-api.newrelic.com/log/v1').\n- Enter the license key - Provide the INGEST-LICENSE API key type.","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}},"args":[]}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-api-mesh",
3
- "version": "5.2.3",
3
+ "version": "5.2.4-alpha.0",
4
4
  "description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
5
5
  "keywords": [
6
6
  "oclif-plugin"
@@ -21,7 +21,6 @@
21
21
  },
22
22
  "files": [
23
23
  "/oclif.manifest.json",
24
- "wrangler.toml",
25
24
  "/src"
26
25
  ],
27
26
  "scripts": {
@@ -38,15 +37,15 @@
38
37
  "version": "oclif-dev readme && git add README.md"
39
38
  },
40
39
  "dependencies": {
41
- "@adobe-apimesh/mesh-builder": "2.1.5",
40
+ "@adobe-apimesh/mesh-builder": "2.1.4",
42
41
  "@adobe/aio-cli-lib-console": "^5.0.0",
43
42
  "@adobe/aio-lib-core-config": "^5.0.0",
44
43
  "@adobe/aio-lib-core-logging": "^3.0.0",
45
44
  "@adobe/aio-lib-env": "^3.0.0",
46
45
  "@adobe/aio-lib-ims": "^7.0.1",
47
- "@adobe/plugin-hooks": "0.3.4",
46
+ "@adobe/plugin-hooks": "0.3.3",
48
47
  "@adobe/plugin-on-fetch": "0.1.1",
49
- "@adobe/plugin-source-headers": "^0.0.2",
48
+ "@adobe/plugin-source-headers": "^0.0.1",
50
49
  "@envelop/disable-introspection": "^6.0.0",
51
50
  "@graphql-mesh/cli": "0.82.30",
52
51
  "@graphql-mesh/graphql": "0.34.13",
@@ -100,12 +99,11 @@
100
99
  "source-registry-storage-adapter": "github:devx-services/source-registry-storage-adapter#main",
101
100
  "util": "^0.12.5",
102
101
  "uuid": "^8.3.2",
103
- "wrangler": "4.3.0",
102
+ "wrangler": "3.80.4",
104
103
  "yaml": "^2.4.2"
105
104
  },
106
105
  "devDependencies": {
107
106
  "@babel/eslint-parser": "^7.15.8",
108
- "@cloudflare/workers-types": "^4.20250320.0",
109
107
  "@oclif/dev-cli": "1.26.10",
110
108
  "@oclif/plugin-help": "2.2.3",
111
109
  "@trivago/prettier-plugin-sort-imports": "^3.1.1",
@@ -138,9 +136,6 @@
138
136
  "access": "public"
139
137
  },
140
138
  "oclif": {
141
- "topics": {
142
- "api-mesh": { "description": "Create, run, test, and deploy API Mesh"}
143
- },
144
139
  "commands": "./src/commands",
145
140
  "bin": "aio",
146
141
  "devPlugins": [
@@ -10,19 +10,21 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- const { Help, Command } = require('@oclif/core');
13
+ const IndexCommand = require('..');
14
14
 
15
- /**
16
- * API Mesh command. Defers to topic for help text.
17
- */
18
- class ApiMeshCommand extends Command {
19
- async run() {
20
- const help = new Help(this.config);
21
- await help.showHelp(['api-mesh', '--help']);
22
- }
23
- }
15
+ test('exports', async () => {
16
+ expect(typeof IndexCommand).toEqual('function');
17
+ });
24
18
 
25
- ApiMeshCommand.description = 'Create, run, test, and deploy API Mesh';
26
- ApiMeshCommand.args = [];
19
+ describe('command tests', () => {
20
+ let command;
27
21
 
28
- module.exports = ApiMeshCommand;
22
+ beforeEach(() => {
23
+ command = new IndexCommand([]);
24
+ });
25
+
26
+ test('run', async () => {
27
+ command.argv = [];
28
+ await expect(command.run()).resolves.not.toThrowError();
29
+ });
30
+ });
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright 2020 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ const { Command, flags } = require('@oclif/command');
14
+ const aioLogger = require('@adobe/aio-lib-core-logging')('PLUGINNAME', { provider: 'debug' });
15
+
16
+ class IndexCommand extends Command {
17
+ async run() {
18
+ // const { args, flags } = this.parse(IndexCommand)
19
+ aioLogger.debug('this is the index command.');
20
+ }
21
+ }
22
+
23
+ IndexCommand.flags = {
24
+ someflag: flags.string({ char: 'f', description: 'this is some flag' }),
25
+ };
26
+
27
+ // this is set in package.json, see https://github.com/oclif/oclif/issues/120
28
+ // if not set it will get the first (alphabetical) topic's help description
29
+ IndexCommand.description = 'Your description here';
30
+ IndexCommand.examples = ['$ aio PLUGINNAME:some_command'];
31
+
32
+ module.exports = IndexCommand;
@@ -23,7 +23,7 @@ jest.mock('../../../helpers', () => ({
23
23
  initRequestId: jest.fn().mockResolvedValue({}),
24
24
  promptConfirm: jest.fn().mockResolvedValue(true),
25
25
  }));
26
- jest.mock('../../../lib/devConsole');
26
+ jest.mock('../../../lib/smsClient');
27
27
  const mockConsoleCLIInstance = {};
28
28
  const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
29
29
  const selectedProject = { id: '5678', title: 'Project01' };
@@ -36,7 +36,7 @@ const {
36
36
  getApiKeyCredential,
37
37
  unsubscribeCredentialFromMeshService,
38
38
  cachePurge,
39
- } = require('../../../lib/devConsole');
39
+ } = require('../../../lib/smsClient');
40
40
  let logSpy = null;
41
41
  let errorLogSpy = null;
42
42
  let parseSpy = null;
@@ -27,7 +27,7 @@ jest.mock('../../../helpers', () => ({
27
27
  interpolateMesh: jest.fn().mockResolvedValue({}),
28
28
  importFiles: jest.fn().mockResolvedValue(),
29
29
  }));
30
- jest.mock('../../../lib/devConsole');
30
+ jest.mock('../../../lib/smsClient');
31
31
 
32
32
  const CreateCommand = require('../create');
33
33
  const sampleCreateMeshConfig = require('../../__fixtures__/sample_mesh.json');
@@ -44,7 +44,7 @@ const {
44
44
  createMesh,
45
45
  getTenantFeatures,
46
46
  getPublicEncryptionKey,
47
- } = require('../../../lib/devConsole');
47
+ } = require('../../../lib/smsClient');
48
48
 
49
49
  const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
50
50
 
@@ -67,9 +67,9 @@ jest.mock('../../../helpers', () => ({
67
67
  initRequestId: jest.fn().mockResolvedValue({}),
68
68
  promptConfirm: jest.fn().mockResolvedValue(true),
69
69
  interpolateMesh: jest.fn().mockResolvedValue({}),
70
- importFiles: jest.fn().mockResolvedValue({}),
70
+ importFiles: jest.fn().mockResolvedValue(),
71
71
  }));
72
- jest.mock('../../../lib/devConsole');
72
+ jest.mock('../../../lib/smsClient');
73
73
  jest.mock('chalk', () => ({
74
74
  red: jest.fn(text => text), // Return the input text without any color formatting
75
75
  bold: jest.fn(text => text),
@@ -895,9 +895,7 @@ describe('create command tests', () => {
895
895
  });
896
896
 
897
897
  importFiles.mockResolvedValueOnce({
898
- data: {
899
- meshConfig,
900
- },
898
+ meshConfig,
901
899
  });
902
900
 
903
901
  const output = await CreateCommand.run();
@@ -1142,11 +1140,7 @@ describe('create command tests', () => {
1142
1140
 
1143
1141
  promptConfirm.mockResolvedValueOnce(false).mockResolvedValueOnce(true);
1144
1142
 
1145
- importFiles.mockResolvedValueOnce({
1146
- data: {
1147
- meshConfig,
1148
- },
1149
- });
1143
+ importFiles.mockResolvedValueOnce(meshConfig);
1150
1144
 
1151
1145
  createMesh.mockResolvedValueOnce({
1152
1146
  mesh: {
@@ -1278,9 +1272,7 @@ describe('create command tests', () => {
1278
1272
  });
1279
1273
 
1280
1274
  importFiles.mockResolvedValueOnce({
1281
- data: {
1282
- meshConfig,
1283
- },
1275
+ meshConfig,
1284
1276
  });
1285
1277
 
1286
1278
  createMesh.mockResolvedValueOnce({
@@ -1408,9 +1400,7 @@ describe('create command tests', () => {
1408
1400
  promptConfirm.mockResolvedValueOnce(true);
1409
1401
 
1410
1402
  importFiles.mockResolvedValueOnce({
1411
- data: {
1412
- meshConfig,
1413
- },
1403
+ meshConfig,
1414
1404
  });
1415
1405
 
1416
1406
  createMesh.mockResolvedValueOnce({
@@ -1545,9 +1535,7 @@ describe('create command tests', () => {
1545
1535
  });
1546
1536
 
1547
1537
  importFiles.mockResolvedValueOnce({
1548
- data: {
1549
- meshConfig,
1550
- },
1538
+ meshConfig,
1551
1539
  });
1552
1540
 
1553
1541
  const output = await CreateCommand.run();
@@ -23,7 +23,7 @@ jest.mock('../../../helpers', () => ({
23
23
  initRequestId: jest.fn().mockResolvedValue({}),
24
24
  promptConfirm: jest.fn().mockResolvedValue(true),
25
25
  }));
26
- jest.mock('../../../lib/devConsole');
26
+ jest.mock('../../../lib/smsClient');
27
27
 
28
28
  const mockConsoleCLIInstance = {};
29
29
 
@@ -40,7 +40,7 @@ const {
40
40
  deleteMesh,
41
41
  getApiKeyCredential,
42
42
  unsubscribeCredentialFromMeshService,
43
- } = require('../../../lib/devConsole');
43
+ } = require('../../../lib/smsClient');
44
44
 
45
45
  let logSpy = null;
46
46
  let errorLogSpy = null;
@@ -23,7 +23,7 @@ jest.mock('@adobe/aio-cli-lib-console', () => ({
23
23
  init: jest.fn().mockResolvedValue(mockConsoleCLIInstance),
24
24
  cleanStdOut: jest.fn(),
25
25
  }));
26
- jest.mock('../../../lib/devConsole');
26
+ jest.mock('../../../lib/smsClient');
27
27
  jest.mock('chalk', () => ({
28
28
  bold: jest.fn(text => text), // Return the input text without any color formatting
29
29
  underline: {
@@ -34,7 +34,7 @@ jest.mock('chalk', () => ({
34
34
 
35
35
  const DescribeCommand = require('../describe');
36
36
  const { initSdk, initRequestId } = require('../../../helpers');
37
- const { describeMesh, getMesh, getTenantFeatures } = require('../../../lib/devConsole');
37
+ const { describeMesh, getMesh, getTenantFeatures } = require('../../../lib/smsClient');
38
38
  const sampleCreateMeshConfig = require('../../__fixtures__/sample_mesh.json');
39
39
 
40
40
  const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
@@ -0,0 +1,149 @@
1
+ /*
2
+ Copyright 2021 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ const GetLogForwardingCommand = require('../config/get/log-forwarding');
14
+ const { initSdk, initRequestId } = require('../../../helpers');
15
+ const { getLogForwarding, getMeshId } = require('../../../lib/smsClient');
16
+
17
+ jest.mock('../../../helpers', () => ({
18
+ initSdk: jest.fn().mockResolvedValue({}),
19
+ initRequestId: jest.fn().mockResolvedValue({}),
20
+ }));
21
+ jest.mock('../../../lib/smsClient');
22
+ jest.mock('../../../classes/logger');
23
+
24
+ describe('GetLogForwardingCommand', () => {
25
+ let logSpy;
26
+ let errorSpy;
27
+
28
+ beforeEach(() => {
29
+ jest.spyOn(GetLogForwardingCommand.prototype, 'parse').mockResolvedValue({
30
+ flags: {
31
+ ignoreCache: false, // Set the default value for ignoreCache
32
+ json: false,
33
+ },
34
+ args: [],
35
+ });
36
+ logSpy = jest.spyOn(GetLogForwardingCommand.prototype, 'log');
37
+ errorSpy = jest.spyOn(GetLogForwardingCommand.prototype, 'error').mockImplementation(() => {
38
+ throw new Error(errorSpy.mock.calls[0][0]);
39
+ });
40
+
41
+ initRequestId.mockResolvedValue();
42
+ initSdk.mockResolvedValue({
43
+ imsOrgId: 'orgId',
44
+ imsOrgCode: 'orgCode',
45
+ projectId: 'projectId',
46
+ workspaceId: 'workspaceId',
47
+ workspaceName: 'workspaceName',
48
+ });
49
+ getMeshId.mockResolvedValue('meshId');
50
+ global.requestId = 'dummy_request_id';
51
+ });
52
+
53
+ afterEach(() => {
54
+ jest.clearAllMocks();
55
+ });
56
+
57
+ test('successfully retrieves log forwarding details', async () => {
58
+ const mockResponse = {
59
+ data: { destination: 'newrelic', config: { baseUri: 'https://example.com' } },
60
+ };
61
+ getLogForwarding.mockResolvedValue(mockResponse);
62
+
63
+ const command = new GetLogForwardingCommand([], {});
64
+ const result = await command.run();
65
+
66
+ expect(initRequestId).toHaveBeenCalled();
67
+ expect(getMeshId).toHaveBeenCalledWith('orgCode', 'projectId', 'workspaceId', 'workspaceName');
68
+ expect(getLogForwarding).toHaveBeenCalledWith('orgCode', 'projectId', 'workspaceId', 'meshId');
69
+ expect(logSpy).toHaveBeenCalledWith(
70
+ 'Successfully retrieved log forwarding details: \n',
71
+ JSON.stringify(mockResponse.data, null, 2),
72
+ );
73
+ expect(result).toEqual({
74
+ imsOrgCode: 'orgCode',
75
+ projectId: 'projectId',
76
+ workspaceId: 'workspaceId',
77
+ workspaceName: 'workspaceName',
78
+ });
79
+ });
80
+
81
+ test('throws an error when getMeshId fails', async () => {
82
+ const errorMessage = 'Failed to fetch mesh ID';
83
+ getMeshId.mockRejectedValue(new Error(errorMessage));
84
+
85
+ const command = new GetLogForwardingCommand([], {});
86
+ await expect(command.run()).rejects.toThrow(
87
+ `Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id`,
88
+ );
89
+
90
+ expect(logSpy).toHaveBeenCalledWith(errorMessage);
91
+ });
92
+
93
+ test('throws an error when meshId is null', async () => {
94
+ getMeshId.mockResolvedValue(null);
95
+
96
+ const command = new GetLogForwardingCommand([], {});
97
+ await expect(command.run()).rejects.toThrow(
98
+ `Unable to get meshId. No mesh found for Org(orgCode) -> Project(projectId) -> Workspace(workspaceId). Check the details and try again.`,
99
+ );
100
+ });
101
+
102
+ test('throws an error when getLogForwarding returns null', async () => {
103
+ getLogForwarding.mockResolvedValue(null);
104
+
105
+ const command = new GetLogForwardingCommand([], {});
106
+ await expect(command.run()).rejects.toThrow(
107
+ 'Unable to get log forwarding details. Try again. RequestId: dummy_request_id',
108
+ );
109
+ });
110
+
111
+ test('throws an error when getLogForwarding fails', async () => {
112
+ const errorMessage = 'Failed to fetch log forwarding details';
113
+ getLogForwarding.mockRejectedValue(new Error(errorMessage));
114
+
115
+ const command = new GetLogForwardingCommand([], {});
116
+ await expect(command.run()).rejects.toThrow(
117
+ `Failed to get log forwarding details. Try again. RequestId: dummy_request_id`,
118
+ );
119
+
120
+ expect(logSpy).toHaveBeenCalledWith(errorMessage);
121
+ });
122
+
123
+ test('handles 404 error when getLogForwarding returns null', async () => {
124
+ // Mock getLogForwarding to simulate a 404 error
125
+ getLogForwarding.mockImplementation(() => {
126
+ const error = new Error('Not Found');
127
+ error.response = { status: 404 };
128
+ throw error;
129
+ });
130
+
131
+ const command = new GetLogForwardingCommand([], {});
132
+
133
+ await expect(command.run()).rejects.toThrow(
134
+ 'Failed to get log forwarding details. Try again. RequestId: dummy_request_id',
135
+ );
136
+ expect(logSpy).toHaveBeenCalledWith('Not Found');
137
+ });
138
+
139
+ test('when getLogForwarding returns null', async () => {
140
+ // Mock getLogForwarding to return null
141
+ getLogForwarding.mockResolvedValue(null);
142
+
143
+ const command = new GetLogForwardingCommand([], {});
144
+
145
+ await expect(command.run()).rejects.toThrow(
146
+ 'Unable to get log forwarding details. Try again. RequestId: dummy_request_id',
147
+ );
148
+ });
149
+ });
@@ -23,7 +23,7 @@ jest.mock('../../../helpers', () => ({
23
23
  initSdk: jest.fn().mockResolvedValue({}),
24
24
  initRequestId: jest.fn().mockResolvedValue({}),
25
25
  }));
26
- jest.mock('../../../lib/devConsole');
26
+ jest.mock('../../../lib/smsClient');
27
27
 
28
28
  const mockConsoleCLIInstance = {};
29
29
  const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
@@ -34,7 +34,7 @@ const { writeFile } = require('fs/promises');
34
34
  const { initSdk, initRequestId } = require('../../../helpers');
35
35
  const GetCommand = require('../get');
36
36
  const mockGetMeshConfig = require('../../__fixtures__/sample_mesh.json');
37
- const { getMeshId, getMesh } = require('../../../lib/devConsole');
37
+ const { getMeshId, getMesh } = require('../../../lib/smsClient');
38
38
 
39
39
  let logSpy = null;
40
40
  let errorLogSpy = null;
@@ -2,7 +2,7 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
  const GetBulkLogCommand = require('../log-get-bulk');
4
4
  const { initRequestId, initSdk, promptConfirm } = require('../../../helpers');
5
- const { getMeshId, getPresignedUrls } = require('../../../lib/devConsole');
5
+ const { getMeshId, getPresignedUrls } = require('../../../lib/smsClient');
6
6
  const {
7
7
  suggestCorrectedDateFormat,
8
8
  validateDateTimeRange,
@@ -16,7 +16,7 @@ jest.mock('../../../helpers', () => ({
16
16
  initRequestId: jest.fn().mockResolvedValue({}),
17
17
  promptConfirm: jest.fn().mockResolvedValue(true),
18
18
  }));
19
- jest.mock('../../../lib/devConsole');
19
+ jest.mock('../../../lib/smsClient');
20
20
  jest.mock('../../../classes/logger');
21
21
 
22
22
  describe('GetBulkLogCommand', () => {
@@ -24,7 +24,7 @@ jest.mock('../../../helpers', () => ({
24
24
  initRequestId: jest.fn().mockResolvedValue({}),
25
25
  }));
26
26
 
27
- jest.mock('../../../lib/devConsole');
27
+ jest.mock('../../../lib/smsClient');
28
28
 
29
29
  const mockConsoleCLIInstance = {};
30
30
  const selectedOrg = { id: '1234', code: 'CODE1234@AdobeOrg', name: 'ORG01', type: 'entp' };
@@ -34,7 +34,7 @@ const selectedWorkspace = { id: '123456789', title: 'Workspace01' };
34
34
  const { writeFile } = require('fs/promises');
35
35
  const { initSdk } = require('../../../helpers');
36
36
  const FetchLogsCommand = require('../log-get');
37
- const { getLogsByRayId, getMeshId } = require('../../../lib/devConsole');
37
+ const { getLogsByRayId, getMeshId } = require('../../../lib/smsClient');
38
38
  const os = require('os');
39
39
  let logSpy = null;
40
40
  let errorLogSpy = null;
@@ -1,7 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const ListLogsCommand = require('../log-list');
3
3
  const { initSdk, promptConfirm } = require('../../../helpers');
4
- const { getMeshId, listLogs } = require('../../../lib/devConsole');
4
+ const { getMeshId, listLogs } = require('../../../lib/smsClient');
5
5
 
6
6
  jest.mock('fs');
7
7
  jest.mock('axios');
@@ -10,7 +10,7 @@ jest.mock('../../../helpers', () => ({
10
10
  initRequestId: jest.fn().mockResolvedValue({}),
11
11
  promptConfirm: jest.fn().mockResolvedValue(true),
12
12
  }));
13
- jest.mock('../../../lib/devConsole');
13
+ jest.mock('../../../lib/smsClient');
14
14
  jest.mock('../../../classes/logger');
15
15
 
16
16
  describe('List Logs Command', () => {