@adobe/aio-cli-plugin-api-mesh 4.1.1-beta.1 → 5.0.0-beta
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 +1 -1
- package/package.json +1 -1
- package/src/commands/api-mesh/__tests__/create.test.js +22 -28
- package/src/commands/api-mesh/__tests__/delete.test.js +6 -6
- package/src/commands/api-mesh/__tests__/describe.test.js +2 -2
- package/src/commands/api-mesh/__tests__/get.test.js +6 -6
- package/src/commands/api-mesh/__tests__/log-get-bulk.test.js +1 -1
- package/src/commands/api-mesh/__tests__/run.test.js +3 -3
- package/src/commands/api-mesh/__tests__/status.test.js +1 -1
- package/src/commands/api-mesh/__tests__/update.test.js +8 -9
- package/src/commands/api-mesh/create.js +5 -7
- package/src/commands/api-mesh/delete.js +5 -5
- package/src/commands/api-mesh/describe.js +2 -2
- package/src/commands/api-mesh/get.js +7 -7
- package/src/commands/api-mesh/log-get-bulk.js +2 -2
- package/src/commands/api-mesh/log-get.js +2 -2
- package/src/commands/api-mesh/log-list.js +1 -1
- package/src/commands/api-mesh/run.js +3 -3
- package/src/commands/api-mesh/source/install.js +3 -2
- package/src/commands/api-mesh/status.js +4 -4
- package/src/commands/api-mesh/update.js +7 -9
- package/src/constants.js +2 -0
- package/src/lib/devConsole.js +38 -32
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"5.0.0-beta","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
|
@@ -318,7 +318,7 @@ describe('create command tests', () => {
|
|
|
318
318
|
const runResult = CreateCommand.run();
|
|
319
319
|
await expect(runResult).rejects.toEqual(
|
|
320
320
|
new Error(
|
|
321
|
-
'Unable to create a mesh.
|
|
321
|
+
'Unable to create a mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
322
322
|
),
|
|
323
323
|
);
|
|
324
324
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -331,7 +331,7 @@ describe('create command tests', () => {
|
|
|
331
331
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
332
332
|
[
|
|
333
333
|
[
|
|
334
|
-
"Unable to create a mesh.
|
|
334
|
+
"Unable to create a mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
335
335
|
],
|
|
336
336
|
]
|
|
337
337
|
`);
|
|
@@ -343,7 +343,7 @@ describe('create command tests', () => {
|
|
|
343
343
|
expect(initRequestId).toHaveBeenCalled();
|
|
344
344
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
345
345
|
[
|
|
346
|
-
"
|
|
346
|
+
"CODE1234@AdobeOrg",
|
|
347
347
|
"5678",
|
|
348
348
|
"123456789",
|
|
349
349
|
"Workspace01",
|
|
@@ -425,7 +425,7 @@ describe('create command tests', () => {
|
|
|
425
425
|
expect(initRequestId).toHaveBeenCalled();
|
|
426
426
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
427
427
|
[
|
|
428
|
-
"
|
|
428
|
+
"CODE1234@AdobeOrg",
|
|
429
429
|
"5678",
|
|
430
430
|
"123456789",
|
|
431
431
|
"Workspace01",
|
|
@@ -839,13 +839,13 @@ describe('create command tests', () => {
|
|
|
839
839
|
|
|
840
840
|
const runResult = CreateCommand.run();
|
|
841
841
|
await expect(runResult).rejects.toEqual(
|
|
842
|
-
new Error('Input mesh file is not a valid JSON.
|
|
842
|
+
new Error('Input mesh file is not a valid JSON. Check the file provided.'),
|
|
843
843
|
);
|
|
844
844
|
|
|
845
845
|
await expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
846
846
|
[
|
|
847
847
|
[
|
|
848
|
-
"Input mesh file is not a valid JSON.
|
|
848
|
+
"Input mesh file is not a valid JSON. Check the file provided.",
|
|
849
849
|
],
|
|
850
850
|
]
|
|
851
851
|
`);
|
|
@@ -903,7 +903,7 @@ describe('create command tests', () => {
|
|
|
903
903
|
expect(initRequestId).toHaveBeenCalled();
|
|
904
904
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
905
905
|
[
|
|
906
|
-
"
|
|
906
|
+
"CODE1234@AdobeOrg",
|
|
907
907
|
"5678",
|
|
908
908
|
"123456789",
|
|
909
909
|
"Workspace01",
|
|
@@ -1053,9 +1053,7 @@ describe('create command tests', () => {
|
|
|
1053
1053
|
|
|
1054
1054
|
const output = CreateCommand.run();
|
|
1055
1055
|
await expect(output).rejects.toEqual(
|
|
1056
|
-
new Error(
|
|
1057
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1058
|
-
),
|
|
1056
|
+
new Error('Unable to import the files in the mesh config. Check the file and try again.'),
|
|
1059
1057
|
);
|
|
1060
1058
|
|
|
1061
1059
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1069,7 +1067,7 @@ describe('create command tests', () => {
|
|
|
1069
1067
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1070
1068
|
[
|
|
1071
1069
|
[
|
|
1072
|
-
"Unable to import the files in the mesh config.
|
|
1070
|
+
"Unable to import the files in the mesh config. Check the file and try again.",
|
|
1073
1071
|
],
|
|
1074
1072
|
]
|
|
1075
1073
|
`);
|
|
@@ -1090,9 +1088,7 @@ describe('create command tests', () => {
|
|
|
1090
1088
|
const output = CreateCommand.run();
|
|
1091
1089
|
|
|
1092
1090
|
await expect(output).rejects.toEqual(
|
|
1093
|
-
new Error(
|
|
1094
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1095
|
-
),
|
|
1091
|
+
new Error('Unable to import the files in the mesh config. Check the file and try again.'),
|
|
1096
1092
|
);
|
|
1097
1093
|
|
|
1098
1094
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1106,7 +1102,7 @@ describe('create command tests', () => {
|
|
|
1106
1102
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1107
1103
|
[
|
|
1108
1104
|
[
|
|
1109
|
-
"Unable to import the files in the mesh config.
|
|
1105
|
+
"Unable to import the files in the mesh config. Check the file and try again.",
|
|
1110
1106
|
],
|
|
1111
1107
|
]
|
|
1112
1108
|
`);
|
|
@@ -1419,7 +1415,7 @@ describe('create command tests', () => {
|
|
|
1419
1415
|
expect(initRequestId).toHaveBeenCalled();
|
|
1420
1416
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
1421
1417
|
[
|
|
1422
|
-
"
|
|
1418
|
+
"CODE1234@AdobeOrg",
|
|
1423
1419
|
"5678",
|
|
1424
1420
|
"123456789",
|
|
1425
1421
|
"Workspace01",
|
|
@@ -1547,7 +1543,7 @@ describe('create command tests', () => {
|
|
|
1547
1543
|
expect(initRequestId).toHaveBeenCalled();
|
|
1548
1544
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
1549
1545
|
[
|
|
1550
|
-
"
|
|
1546
|
+
"CODE1234@AdobeOrg",
|
|
1551
1547
|
"5678",
|
|
1552
1548
|
"123456789",
|
|
1553
1549
|
"Workspace01",
|
|
@@ -1665,9 +1661,7 @@ describe('create command tests', () => {
|
|
|
1665
1661
|
const output = CreateCommand.run();
|
|
1666
1662
|
|
|
1667
1663
|
await expect(output).rejects.toEqual(
|
|
1668
|
-
new Error(
|
|
1669
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1670
|
-
),
|
|
1664
|
+
new Error('Unable to import the files in the mesh config. Check the file and try again.'),
|
|
1671
1665
|
);
|
|
1672
1666
|
|
|
1673
1667
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1681,7 +1675,7 @@ describe('create command tests', () => {
|
|
|
1681
1675
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1682
1676
|
[
|
|
1683
1677
|
[
|
|
1684
|
-
"Unable to import the files in the mesh config.
|
|
1678
|
+
"Unable to import the files in the mesh config. Check the file and try again.",
|
|
1685
1679
|
],
|
|
1686
1680
|
]
|
|
1687
1681
|
`);
|
|
@@ -1767,13 +1761,13 @@ describe('create command tests', () => {
|
|
|
1767
1761
|
const runResult = CreateCommand.run();
|
|
1768
1762
|
|
|
1769
1763
|
await expect(runResult).rejects.toEqual(
|
|
1770
|
-
new Error('Unable to import secrets.
|
|
1764
|
+
new Error('Unable to import secrets. Check the file and try again.'),
|
|
1771
1765
|
);
|
|
1772
1766
|
|
|
1773
1767
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1774
1768
|
[
|
|
1775
1769
|
[
|
|
1776
|
-
"Unable to import secrets.
|
|
1770
|
+
"Unable to import secrets. Check the file and try again.",
|
|
1777
1771
|
],
|
|
1778
1772
|
]
|
|
1779
1773
|
`);
|
|
@@ -1792,7 +1786,7 @@ describe('create command tests', () => {
|
|
|
1792
1786
|
const runResult = CreateCommand.run();
|
|
1793
1787
|
|
|
1794
1788
|
await expect(runResult).rejects.toEqual(
|
|
1795
|
-
new Error('Unable to import secrets.
|
|
1789
|
+
new Error('Unable to import secrets. Check the file and try again.'),
|
|
1796
1790
|
);
|
|
1797
1791
|
|
|
1798
1792
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1806,7 +1800,7 @@ describe('create command tests', () => {
|
|
|
1806
1800
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1807
1801
|
[
|
|
1808
1802
|
[
|
|
1809
|
-
"Unable to import secrets.
|
|
1803
|
+
"Unable to import secrets. Check the file and try again.",
|
|
1810
1804
|
],
|
|
1811
1805
|
]
|
|
1812
1806
|
`);
|
|
@@ -1865,7 +1859,7 @@ describe('create command tests', () => {
|
|
|
1865
1859
|
const runResult = CreateCommand.run();
|
|
1866
1860
|
|
|
1867
1861
|
await expect(runResult).rejects.toEqual(
|
|
1868
|
-
new Error('Unable to import secrets.
|
|
1862
|
+
new Error('Unable to import secrets. Check the file and try again.'),
|
|
1869
1863
|
);
|
|
1870
1864
|
|
|
1871
1865
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1878,7 +1872,7 @@ describe('create command tests', () => {
|
|
|
1878
1872
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1879
1873
|
[
|
|
1880
1874
|
[
|
|
1881
|
-
"Unable to import secrets.
|
|
1875
|
+
"Unable to import secrets. Check the file and try again.",
|
|
1882
1876
|
],
|
|
1883
1877
|
]
|
|
1884
1878
|
`);
|
|
@@ -1980,7 +1974,7 @@ describe('create command tests', () => {
|
|
|
1980
1974
|
|
|
1981
1975
|
const runResult = CreateCommand.run();
|
|
1982
1976
|
await expect(runResult).rejects.toEqual(
|
|
1983
|
-
new Error('Unable to import secrets.
|
|
1977
|
+
new Error('Unable to import secrets. Check the file and try again.'),
|
|
1984
1978
|
);
|
|
1985
1979
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1986
1980
|
[
|
|
@@ -53,7 +53,7 @@ const mockAutoApproveAction = Promise.resolve(false);
|
|
|
53
53
|
describe('delete command tests', () => {
|
|
54
54
|
beforeEach(() => {
|
|
55
55
|
initSdk.mockResolvedValue({
|
|
56
|
-
|
|
56
|
+
imsOrgCode: selectedOrg.code,
|
|
57
57
|
projectId: selectedProject.id,
|
|
58
58
|
workspaceId: selectedWorkspace.id,
|
|
59
59
|
});
|
|
@@ -117,13 +117,13 @@ describe('delete command tests', () => {
|
|
|
117
117
|
|
|
118
118
|
return runResult.catch(err => {
|
|
119
119
|
expect(err.message).toMatchInlineSnapshot(
|
|
120
|
-
`"Unable to delete. No mesh found for Org(
|
|
120
|
+
`"Unable to delete mesh. No mesh found for Org(CODE1234@AdobeOrg) -> Project(5678) -> Workspace(123456789). Check the details and try again."`,
|
|
121
121
|
);
|
|
122
122
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
123
123
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
124
124
|
[
|
|
125
125
|
[
|
|
126
|
-
"Unable to delete. No mesh found for Org(
|
|
126
|
+
"Unable to delete mesh. No mesh found for Org(CODE1234@AdobeOrg) -> Project(5678) -> Workspace(123456789). Check the details and try again.",
|
|
127
127
|
],
|
|
128
128
|
]
|
|
129
129
|
`);
|
|
@@ -181,7 +181,7 @@ describe('delete command tests', () => {
|
|
|
181
181
|
|
|
182
182
|
await expect(runResult).rejects.toEqual(
|
|
183
183
|
new Error(
|
|
184
|
-
'Unable to delete mesh.
|
|
184
|
+
'Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
185
185
|
),
|
|
186
186
|
);
|
|
187
187
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -194,7 +194,7 @@ describe('delete command tests', () => {
|
|
|
194
194
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
195
195
|
[
|
|
196
196
|
[
|
|
197
|
-
"Unable to delete mesh.
|
|
197
|
+
"Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
198
198
|
],
|
|
199
199
|
]
|
|
200
200
|
`);
|
|
@@ -212,7 +212,7 @@ describe('delete command tests', () => {
|
|
|
212
212
|
expect(deleteMesh.mock.calls).toMatchInlineSnapshot(`
|
|
213
213
|
[
|
|
214
214
|
[
|
|
215
|
-
"
|
|
215
|
+
"CODE1234@AdobeOrg",
|
|
216
216
|
"5678",
|
|
217
217
|
"123456789",
|
|
218
218
|
"mesh_id",
|
|
@@ -204,7 +204,7 @@ describe('describe command tests', () => {
|
|
|
204
204
|
|
|
205
205
|
expect(initRequestId).toHaveBeenCalled();
|
|
206
206
|
expect(describeMesh).toHaveBeenCalledWith(
|
|
207
|
-
selectedOrg.
|
|
207
|
+
selectedOrg.code,
|
|
208
208
|
selectedProject.id,
|
|
209
209
|
selectedWorkspace.id,
|
|
210
210
|
selectedWorkspace.title,
|
|
@@ -260,7 +260,7 @@ describe('describe command tests', () => {
|
|
|
260
260
|
|
|
261
261
|
expect(initRequestId).toHaveBeenCalled();
|
|
262
262
|
expect(describeMesh).toHaveBeenCalledWith(
|
|
263
|
-
selectedOrg.
|
|
263
|
+
selectedOrg.code,
|
|
264
264
|
selectedProject.id,
|
|
265
265
|
selectedWorkspace.id,
|
|
266
266
|
selectedWorkspace.title,
|
|
@@ -115,13 +115,13 @@ describe('get command tests', () => {
|
|
|
115
115
|
|
|
116
116
|
return runResult.catch(err => {
|
|
117
117
|
expect(err.message).toMatchInlineSnapshot(
|
|
118
|
-
`"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789).
|
|
118
|
+
`"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Check the details and try again."`,
|
|
119
119
|
);
|
|
120
120
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
121
121
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
122
122
|
[
|
|
123
123
|
[
|
|
124
|
-
"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789).
|
|
124
|
+
"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Check the details and try again.",
|
|
125
125
|
],
|
|
126
126
|
]
|
|
127
127
|
`);
|
|
@@ -134,13 +134,13 @@ describe('get command tests', () => {
|
|
|
134
134
|
|
|
135
135
|
return runResult.catch(err => {
|
|
136
136
|
expect(err.message).toMatchInlineSnapshot(
|
|
137
|
-
`"Unable to get mesh ID.
|
|
137
|
+
`"Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id"`,
|
|
138
138
|
);
|
|
139
139
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
140
140
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
141
141
|
[
|
|
142
142
|
[
|
|
143
|
-
"Unable to get mesh ID.
|
|
143
|
+
"Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id",
|
|
144
144
|
],
|
|
145
145
|
]
|
|
146
146
|
`);
|
|
@@ -164,7 +164,7 @@ describe('get command tests', () => {
|
|
|
164
164
|
|
|
165
165
|
await expect(runResult).rejects.toEqual(
|
|
166
166
|
new Error(
|
|
167
|
-
'Unable to get mesh.
|
|
167
|
+
'Unable to get mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
168
168
|
),
|
|
169
169
|
);
|
|
170
170
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -177,7 +177,7 @@ describe('get command tests', () => {
|
|
|
177
177
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
178
178
|
[
|
|
179
179
|
[
|
|
180
|
-
"Unable to get mesh.
|
|
180
|
+
"Unable to get mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
181
181
|
],
|
|
182
182
|
]
|
|
183
183
|
`);
|
|
@@ -249,7 +249,7 @@ describe('GetBulkLogCommand', () => {
|
|
|
249
249
|
|
|
250
250
|
expect(initRequestId).toHaveBeenCalled();
|
|
251
251
|
expect(initSdk).toHaveBeenCalled();
|
|
252
|
-
expect(getMeshId).toHaveBeenCalledWith('
|
|
252
|
+
expect(getMeshId).toHaveBeenCalledWith('orgCode', 'projectId', 'workspaceId', 'workspaceName');
|
|
253
253
|
expect(getPresignedUrls).toHaveBeenCalledWith(
|
|
254
254
|
'orgCode',
|
|
255
255
|
'projectId',
|
|
@@ -25,7 +25,7 @@ require('@adobe-apimesh/mesh-builder');
|
|
|
25
25
|
|
|
26
26
|
jest.mock('../../../helpers', () => ({
|
|
27
27
|
initSdk: jest.fn().mockResolvedValue({
|
|
28
|
-
|
|
28
|
+
imsOrgCode: 'mockOrgCode',
|
|
29
29
|
projectId: 'mockProjectId',
|
|
30
30
|
workspaceId: 'mockWorkspaceId',
|
|
31
31
|
workspaceName: 'mockWorkspaceTitle',
|
|
@@ -865,13 +865,13 @@ describe('run command tests', () => {
|
|
|
865
865
|
|
|
866
866
|
expect(initSdk).toHaveBeenCalled();
|
|
867
867
|
expect(getMeshId).toHaveBeenCalledWith(
|
|
868
|
-
'
|
|
868
|
+
'mockOrgCode',
|
|
869
869
|
'mockProjectId',
|
|
870
870
|
'mockWorkspaceId',
|
|
871
871
|
'mockWorkspaceTitle',
|
|
872
872
|
);
|
|
873
873
|
expect(getMeshArtifact).toHaveBeenCalledWith(
|
|
874
|
-
'
|
|
874
|
+
'mockOrgCode',
|
|
875
875
|
'mockProjectId',
|
|
876
876
|
'mockWorkspaceId',
|
|
877
877
|
'mockWorkspaceTitle',
|
|
@@ -88,7 +88,7 @@ describe('status command tests', () => {
|
|
|
88
88
|
describe('unexpected error', () => {
|
|
89
89
|
test('should output mesh not found error when mesh does not exist', async () => {
|
|
90
90
|
getMeshId.mockResolvedValue(null);
|
|
91
|
-
const expectedMessage = `Unable to get mesh status. No mesh found for Org(${mockOrg.
|
|
91
|
+
const expectedMessage = `Unable to get mesh status. No mesh found for Org(${mockOrg.code}) -> Project(${mockProject.id}) -> Workspace(${mockWorkspace.id}). Check the details and try again.`;
|
|
92
92
|
const runResult = StatusCommand.run();
|
|
93
93
|
await expect(runResult).rejects.toEqual(new Error(expectedMessage));
|
|
94
94
|
expect(errorLogSpy).toHaveBeenCalledWith(expectedMessage);
|
|
@@ -50,6 +50,7 @@ describe('update command tests', () => {
|
|
|
50
50
|
beforeEach(() => {
|
|
51
51
|
initSdk.mockResolvedValue({
|
|
52
52
|
imsOrgId: selectedOrg.id,
|
|
53
|
+
imsOrgCode: selectedOrg.code,
|
|
53
54
|
projectId: selectedProject.id,
|
|
54
55
|
workspaceId: selectedWorkspace.id,
|
|
55
56
|
workspaceName: selectedWorkspace.title,
|
|
@@ -325,13 +326,13 @@ describe('update command tests', () => {
|
|
|
325
326
|
const runResult = UpdateCommand.run();
|
|
326
327
|
|
|
327
328
|
await expect(runResult).rejects.toMatchInlineSnapshot(
|
|
328
|
-
`[Error: Unable to get mesh ID.
|
|
329
|
+
`[Error: Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id]`,
|
|
329
330
|
);
|
|
330
331
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
331
332
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
332
333
|
[
|
|
333
334
|
[
|
|
334
|
-
"Unable to get mesh ID.
|
|
335
|
+
"Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id",
|
|
335
336
|
],
|
|
336
337
|
]
|
|
337
338
|
`);
|
|
@@ -373,7 +374,7 @@ describe('update command tests', () => {
|
|
|
373
374
|
// );
|
|
374
375
|
|
|
375
376
|
await expect(runResult).rejects.toMatchInlineSnapshot(
|
|
376
|
-
`[Error: Unable to update the mesh.
|
|
377
|
+
`[Error: Unable to update the mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id]`,
|
|
377
378
|
);
|
|
378
379
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
379
380
|
[
|
|
@@ -385,7 +386,7 @@ describe('update command tests', () => {
|
|
|
385
386
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
386
387
|
[
|
|
387
388
|
[
|
|
388
|
-
"Unable to update the mesh.
|
|
389
|
+
"Unable to update the mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
389
390
|
],
|
|
390
391
|
]
|
|
391
392
|
`);
|
|
@@ -554,7 +555,7 @@ describe('update command tests', () => {
|
|
|
554
555
|
expect(initRequestId).toHaveBeenCalled();
|
|
555
556
|
expect(updateMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
556
557
|
[
|
|
557
|
-
"
|
|
558
|
+
"CODE1234@AdobeOrg",
|
|
558
559
|
"5678",
|
|
559
560
|
"123456789",
|
|
560
561
|
"Workspace01",
|
|
@@ -722,9 +723,7 @@ describe('update command tests', () => {
|
|
|
722
723
|
|
|
723
724
|
const output = UpdateCommand.run();
|
|
724
725
|
await expect(output).rejects.toEqual(
|
|
725
|
-
new Error(
|
|
726
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
727
|
-
),
|
|
726
|
+
new Error('Unable to import the files in the mesh config. Check the file and try again.'),
|
|
728
727
|
);
|
|
729
728
|
|
|
730
729
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -738,7 +737,7 @@ describe('update command tests', () => {
|
|
|
738
737
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
739
738
|
[
|
|
740
739
|
[
|
|
741
|
-
"Unable to import the files in the mesh config.
|
|
740
|
+
"Unable to import the files in the mesh config. Check the file and try again.",
|
|
742
741
|
],
|
|
743
742
|
]
|
|
744
743
|
`);
|
|
@@ -83,7 +83,7 @@ class CreateCommand extends Command {
|
|
|
83
83
|
data = JSON.parse(inputMeshData);
|
|
84
84
|
} catch (err) {
|
|
85
85
|
this.log(err.message);
|
|
86
|
-
this.error('Input mesh file is not a valid JSON.
|
|
86
|
+
this.error('Input mesh file is not a valid JSON. Check the file provided.');
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -102,9 +102,7 @@ class CreateCommand extends Command {
|
|
|
102
102
|
data = await importFiles(data, filesList, args.file, flags.autoConfirmAction);
|
|
103
103
|
} catch (err) {
|
|
104
104
|
this.log(err.message);
|
|
105
|
-
this.error(
|
|
106
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
107
|
-
);
|
|
105
|
+
this.error('Unable to import the files in the mesh config. Check the file and try again.');
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
|
|
@@ -118,7 +116,7 @@ class CreateCommand extends Command {
|
|
|
118
116
|
data.secrets = encryptedSecrets;
|
|
119
117
|
} catch (err) {
|
|
120
118
|
this.log(err.message);
|
|
121
|
-
this.error('Unable to import secrets.
|
|
119
|
+
this.error('Unable to import secrets. Check the file and try again.');
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
@@ -131,7 +129,7 @@ class CreateCommand extends Command {
|
|
|
131
129
|
if (shouldContinue) {
|
|
132
130
|
try {
|
|
133
131
|
const { mesh } = await createMesh(
|
|
134
|
-
|
|
132
|
+
imsOrgCode,
|
|
135
133
|
projectId,
|
|
136
134
|
workspaceId,
|
|
137
135
|
workspaceName,
|
|
@@ -169,7 +167,7 @@ class CreateCommand extends Command {
|
|
|
169
167
|
this.log(error.message);
|
|
170
168
|
|
|
171
169
|
this.error(
|
|
172
|
-
`Unable to create a mesh.
|
|
170
|
+
`Unable to create a mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
|
|
173
171
|
);
|
|
174
172
|
}
|
|
175
173
|
} else {
|
|
@@ -34,14 +34,14 @@ class DeleteCommand extends Command {
|
|
|
34
34
|
const ignoreCache = await flags.ignoreCache;
|
|
35
35
|
const autoConfirmAction = await flags.autoConfirmAction;
|
|
36
36
|
|
|
37
|
-
const {
|
|
37
|
+
const { imsOrgCode, projectId, workspaceId } = await initSdk({
|
|
38
38
|
ignoreCache,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
let meshId = null;
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
|
-
meshId = await getMeshId(
|
|
44
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId);
|
|
45
45
|
} catch (err) {
|
|
46
46
|
this.error(
|
|
47
47
|
`Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -59,7 +59,7 @@ class DeleteCommand extends Command {
|
|
|
59
59
|
|
|
60
60
|
if (shouldContinue) {
|
|
61
61
|
try {
|
|
62
|
-
const deleteMeshResponse = await deleteMesh(
|
|
62
|
+
const deleteMeshResponse = await deleteMesh(imsOrgCode, projectId, workspaceId, meshId);
|
|
63
63
|
|
|
64
64
|
if (deleteMeshResponse) {
|
|
65
65
|
this.log('Successfully deleted mesh %s', meshId);
|
|
@@ -72,7 +72,7 @@ class DeleteCommand extends Command {
|
|
|
72
72
|
this.log(error.message);
|
|
73
73
|
|
|
74
74
|
this.error(
|
|
75
|
-
`Unable to delete mesh.
|
|
75
|
+
`Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
} else {
|
|
@@ -82,7 +82,7 @@ class DeleteCommand extends Command {
|
|
|
82
82
|
}
|
|
83
83
|
} else {
|
|
84
84
|
this.error(
|
|
85
|
-
`Unable to delete. No mesh found for Org(${
|
|
85
|
+
`Unable to delete mesh. No mesh found for Org(${imsOrgCode}) -> Project(${projectId}) -> Workspace(${workspaceId}). Check the details and try again.`,
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -30,12 +30,12 @@ class DescribeCommand extends Command {
|
|
|
30
30
|
|
|
31
31
|
const { flags } = await this.parse(DescribeCommand);
|
|
32
32
|
const ignoreCache = await flags.ignoreCache;
|
|
33
|
-
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
33
|
+
const { imsOrgCode, imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
34
34
|
ignoreCache,
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
|
-
const meshDetails = await describeMesh(
|
|
38
|
+
const meshDetails = await describeMesh(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
39
39
|
|
|
40
40
|
if (meshDetails) {
|
|
41
41
|
const { meshId } = meshDetails;
|
|
@@ -38,7 +38,7 @@ class GetCommand extends Command {
|
|
|
38
38
|
const ignoreCache = await flags.ignoreCache;
|
|
39
39
|
const json = await flags.json;
|
|
40
40
|
|
|
41
|
-
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
41
|
+
const { imsOrgId, imsOrgCode, projectId, workspaceId, workspaceName } = await initSdk({
|
|
42
42
|
ignoreCache,
|
|
43
43
|
verbose: !json,
|
|
44
44
|
});
|
|
@@ -46,16 +46,16 @@ class GetCommand extends Command {
|
|
|
46
46
|
let meshId = null;
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
|
-
meshId = await getMeshId(
|
|
49
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
50
50
|
} catch (err) {
|
|
51
51
|
this.error(
|
|
52
|
-
`Unable to get mesh ID.
|
|
52
|
+
`Unable to get mesh ID. Check the details and try again. RequestId: ${global.requestId}`,
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (meshId) {
|
|
57
57
|
try {
|
|
58
|
-
const mesh = await getMesh(
|
|
58
|
+
const mesh = await getMesh(imsOrgCode, projectId, workspaceId, workspaceName, meshId);
|
|
59
59
|
|
|
60
60
|
if (mesh) {
|
|
61
61
|
this.log('Successfully retrieved mesh %s', JSON.stringify(mesh, null, 2));
|
|
@@ -78,7 +78,7 @@ class GetCommand extends Command {
|
|
|
78
78
|
return { ...mesh, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
|
|
79
79
|
} else {
|
|
80
80
|
logger.error(
|
|
81
|
-
`Unable to get mesh with the ID ${meshId}.
|
|
81
|
+
`Unable to get mesh with the ID ${meshId}. Check the mesh ID and try again. RequestId: ${global.requestId}`,
|
|
82
82
|
{ exit: false },
|
|
83
83
|
);
|
|
84
84
|
}
|
|
@@ -86,12 +86,12 @@ class GetCommand extends Command {
|
|
|
86
86
|
this.log(error.message);
|
|
87
87
|
|
|
88
88
|
this.error(
|
|
89
|
-
`Unable to get mesh.
|
|
89
|
+
`Unable to get mesh. Check the details and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
} else {
|
|
93
93
|
this.error(
|
|
94
|
-
`Unable to get mesh config. No mesh found for Org(${
|
|
94
|
+
`Unable to get mesh config. No mesh found for Org(${imsOrgCode}) -> Project(${projectId}) -> Workspace(${workspaceId}). Please check the details and try again.`,
|
|
95
95
|
{ exit: false },
|
|
96
96
|
);
|
|
97
97
|
}
|
|
@@ -147,14 +147,14 @@ class GetBulkLogCommand extends Command {
|
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
logger.info('Calling initSdk...');
|
|
150
|
-
const {
|
|
150
|
+
const { imsOrgCode, projectId, workspaceId, workspaceName } = await initSdk({
|
|
151
151
|
ignoreCache,
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
// Retrieve meshId
|
|
155
155
|
let meshId = null;
|
|
156
156
|
try {
|
|
157
|
-
meshId = await getMeshId(
|
|
157
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
158
158
|
} catch (err) {
|
|
159
159
|
this.error(`Unable to get mesh ID: ${err.message}.`);
|
|
160
160
|
}
|
|
@@ -31,13 +31,13 @@ class FetchLogsCommand extends Command {
|
|
|
31
31
|
const ignoreCache = flags.ignoreCache;
|
|
32
32
|
const rayId = args.rayId;
|
|
33
33
|
|
|
34
|
-
const {
|
|
34
|
+
const { imsOrgCode, projectId, workspaceId } = await initSdk({
|
|
35
35
|
ignoreCache,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
let meshId = null;
|
|
39
39
|
try {
|
|
40
|
-
meshId = await getMeshId(
|
|
40
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, meshId);
|
|
41
41
|
if (!meshId) {
|
|
42
42
|
throw new Error('MeshIdNotFound');
|
|
43
43
|
}
|
|
@@ -43,7 +43,7 @@ class ListLogsCommand extends Command {
|
|
|
43
43
|
let meshId = null;
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
|
-
meshId = await getMeshId(
|
|
46
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
47
47
|
} catch (err) {
|
|
48
48
|
this.error(
|
|
49
49
|
`Unable to get mesh ID. Check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -82,10 +82,10 @@ class RunCommand extends Command {
|
|
|
82
82
|
if (fs.existsSync(path.join(process.cwd(), 'package.json'))) {
|
|
83
83
|
//If select flag is present then getMeshId for the specified org
|
|
84
84
|
if (flags.select) {
|
|
85
|
-
const {
|
|
85
|
+
const { imsOrgCode, projectId, workspaceId, workspaceName } = await initSdk({});
|
|
86
86
|
|
|
87
87
|
try {
|
|
88
|
-
meshId = await getMeshId(
|
|
88
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
89
89
|
} catch (err) {
|
|
90
90
|
throw new Error(
|
|
91
91
|
`Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -93,7 +93,7 @@ class RunCommand extends Command {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
try {
|
|
96
|
-
await getMeshArtifact(
|
|
96
|
+
await getMeshArtifact(imsOrgCode, projectId, workspaceId, workspaceName, meshId);
|
|
97
97
|
} catch (err) {
|
|
98
98
|
throw new Error(
|
|
99
99
|
`Unable to retrieve mesh. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -38,6 +38,7 @@ class InstallCommand extends Command {
|
|
|
38
38
|
const ignoreCache = await flags.ignoreCache;
|
|
39
39
|
const {
|
|
40
40
|
imsOrgId,
|
|
41
|
+
imsOrgCode,
|
|
41
42
|
projectId,
|
|
42
43
|
workspaceId,
|
|
43
44
|
organizationName,
|
|
@@ -126,7 +127,7 @@ class InstallCommand extends Command {
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
try {
|
|
129
|
-
meshId = await getMeshId(
|
|
130
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
130
131
|
} catch (err) {
|
|
131
132
|
this.error(
|
|
132
133
|
`Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -140,7 +141,7 @@ class InstallCommand extends Command {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
try {
|
|
143
|
-
const mesh = await getMesh(
|
|
144
|
+
const mesh = await getMesh(imsOrgCode, projectId, workspaceId, meshId, workspaceName);
|
|
144
145
|
|
|
145
146
|
if (!mesh) {
|
|
146
147
|
this.error(
|
|
@@ -18,14 +18,14 @@ class StatusCommand extends Command {
|
|
|
18
18
|
|
|
19
19
|
const { flags } = await this.parse(StatusCommand);
|
|
20
20
|
const ignoreCache = await flags.ignoreCache;
|
|
21
|
-
const {
|
|
21
|
+
const { imsOrgCode, projectId, workspaceId, workspaceName } = await initSdk({
|
|
22
22
|
ignoreCache,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
let meshId = null;
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
|
-
meshId = await getMeshId(
|
|
28
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId, workspaceName);
|
|
29
29
|
} catch (err) {
|
|
30
30
|
// API Request failed
|
|
31
31
|
this.log(err.message);
|
|
@@ -37,12 +37,12 @@ class StatusCommand extends Command {
|
|
|
37
37
|
// API Request succeeded, but mesh could not be found
|
|
38
38
|
if (!meshId) {
|
|
39
39
|
this.error(
|
|
40
|
-
`Unable to get mesh status. No mesh found for Org(${
|
|
40
|
+
`Unable to get mesh status. No mesh found for Org(${imsOrgCode}) -> Project(${projectId}) -> Workspace(${workspaceId}). Check the details and try again.`,
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
try {
|
|
45
|
-
const mesh = await getMesh(
|
|
45
|
+
const mesh = await getMesh(imsOrgCode, projectId, workspaceId, workspaceName, meshId);
|
|
46
46
|
this.log(''.padEnd(102, '*'));
|
|
47
47
|
await this.displayMeshStatus(mesh, imsOrgCode, projectId, workspaceId);
|
|
48
48
|
this.log(''.padEnd(102, '*'));
|
|
@@ -73,10 +73,10 @@ class UpdateCommand extends Command {
|
|
|
73
73
|
let meshId = null;
|
|
74
74
|
|
|
75
75
|
try {
|
|
76
|
-
meshId = await getMeshId(
|
|
76
|
+
meshId = await getMeshId(imsOrgCode, projectId, workspaceId);
|
|
77
77
|
} catch (err) {
|
|
78
78
|
this.error(
|
|
79
|
-
`Unable to get mesh ID.
|
|
79
|
+
`Unable to get mesh ID. Check the details and try again. RequestId: ${global.requestId}`,
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -90,7 +90,7 @@ class UpdateCommand extends Command {
|
|
|
90
90
|
data = JSON.parse(inputMeshData);
|
|
91
91
|
} catch (err) {
|
|
92
92
|
this.log(err.message);
|
|
93
|
-
this.error('Input mesh file is not a valid JSON.
|
|
93
|
+
this.error('Input mesh file is not a valid JSON. Check the file provided.');
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -109,9 +109,7 @@ class UpdateCommand extends Command {
|
|
|
109
109
|
data = await importFiles(data, filesList, args.file, flags.autoConfirmAction);
|
|
110
110
|
} catch (err) {
|
|
111
111
|
this.log(err.message);
|
|
112
|
-
this.error(
|
|
113
|
-
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
114
|
-
);
|
|
112
|
+
this.error('Unable to import the files in the mesh config. Check the file and try again.');
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
|
|
@@ -125,7 +123,7 @@ class UpdateCommand extends Command {
|
|
|
125
123
|
data.secrets = encryptedSecrets;
|
|
126
124
|
} catch (err) {
|
|
127
125
|
this.log(err.message);
|
|
128
|
-
this.error('Unable to import secrets.
|
|
126
|
+
this.error('Unable to import secrets. Check the file and try again.');
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
|
|
@@ -141,7 +139,7 @@ class UpdateCommand extends Command {
|
|
|
141
139
|
if (shouldContinue) {
|
|
142
140
|
try {
|
|
143
141
|
const response = await updateMesh(
|
|
144
|
-
|
|
142
|
+
imsOrgCode,
|
|
145
143
|
projectId,
|
|
146
144
|
workspaceId,
|
|
147
145
|
workspaceName,
|
|
@@ -169,7 +167,7 @@ class UpdateCommand extends Command {
|
|
|
169
167
|
this.log(error.message);
|
|
170
168
|
|
|
171
169
|
this.error(
|
|
172
|
-
`Unable to update the mesh.
|
|
170
|
+
`Unable to update the mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
|
|
173
171
|
);
|
|
174
172
|
}
|
|
175
173
|
} else {
|
package/src/constants.js
CHANGED
|
@@ -9,6 +9,7 @@ const StageConstants = {
|
|
|
9
9
|
AIO_CLI_API_KEY: 'aio-cli-console-auth-stage',
|
|
10
10
|
SMS_BASE_URL: 'https://graph-stage.adobe.io/api-admin',
|
|
11
11
|
MESH_BASE_URL: 'https://edge-stage-graph.adobe.io/api',
|
|
12
|
+
SMS_API_KEY: 'adobe-graph-stage-onboarding',
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const ProdConstants = {
|
|
@@ -19,6 +20,7 @@ const ProdConstants = {
|
|
|
19
20
|
SMS_BASE_URL: 'https://graph.adobe.io/api-admin',
|
|
20
21
|
MESH_BASE_URL: 'https://edge-graph.adobe.io/api',
|
|
21
22
|
MESH_SANDBOX_BASE_URL: 'https://edge-sandbox-graph.adobe.io/api',
|
|
23
|
+
SMS_API_KEY: 'adobe-graph-prod',
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
const envConstants = clientEnv === 'stage' ? StageConstants : ProdConstants;
|
package/src/lib/devConsole.js
CHANGED
|
@@ -12,7 +12,7 @@ const exec = util.promisify(require('child_process').exec);
|
|
|
12
12
|
const contentDisposition = require('content-disposition');
|
|
13
13
|
const chalk = require('chalk');
|
|
14
14
|
|
|
15
|
-
const { DEV_CONSOLE_TRANSPORTER_API_KEY, SMS_BASE_URL } = CONSTANTS;
|
|
15
|
+
const { DEV_CONSOLE_TRANSPORTER_API_KEY, SMS_BASE_URL, SMS_API_KEY } = CONSTANTS;
|
|
16
16
|
|
|
17
17
|
const { objToString, getDevConsoleConfig } = require('../helpers');
|
|
18
18
|
|
|
@@ -113,7 +113,7 @@ const describeMesh = async (organizationId, projectId, workspaceId, workspaceNam
|
|
|
113
113
|
* @returns
|
|
114
114
|
*/
|
|
115
115
|
const listLogs = async (organizationCode, projectId, workspaceId, meshId, fileName) => {
|
|
116
|
-
const { accessToken
|
|
116
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
117
117
|
const url = `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/logs/list`;
|
|
118
118
|
const config = {
|
|
119
119
|
method: 'get',
|
|
@@ -121,7 +121,7 @@ const listLogs = async (organizationCode, projectId, workspaceId, meshId, fileNa
|
|
|
121
121
|
headers: {
|
|
122
122
|
'Authorization': `Bearer ${accessToken}`,
|
|
123
123
|
'x-request-id': global.requestId,
|
|
124
|
-
'
|
|
124
|
+
'x-api-key': SMS_API_KEY,
|
|
125
125
|
},
|
|
126
126
|
};
|
|
127
127
|
|
|
@@ -142,20 +142,21 @@ const listLogs = async (organizationCode, projectId, workspaceId, meshId, fileNa
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
const getMesh = async (organizationId, projectId, workspaceId, workspaceName, meshId) => {
|
|
145
|
-
const {
|
|
145
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
146
146
|
const config = {
|
|
147
147
|
method: 'get',
|
|
148
|
-
url: `${
|
|
148
|
+
url: `${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
149
149
|
headers: {
|
|
150
150
|
'Authorization': `Bearer ${accessToken}`,
|
|
151
151
|
'x-request-id': global.requestId,
|
|
152
152
|
'workspaceName': workspaceName,
|
|
153
|
+
'x-api-key': SMS_API_KEY,
|
|
153
154
|
},
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
logger.info(
|
|
157
158
|
'Initiating GET %s',
|
|
158
|
-
`${
|
|
159
|
+
`${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
159
160
|
);
|
|
160
161
|
|
|
161
162
|
try {
|
|
@@ -232,10 +233,10 @@ const createMesh = async (
|
|
|
232
233
|
projectName,
|
|
233
234
|
data,
|
|
234
235
|
) => {
|
|
235
|
-
const {
|
|
236
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
236
237
|
const config = {
|
|
237
238
|
method: 'post',
|
|
238
|
-
url: `${
|
|
239
|
+
url: `${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes`,
|
|
239
240
|
headers: {
|
|
240
241
|
'Authorization': `Bearer ${accessToken}`,
|
|
241
242
|
'Content-Type': 'application/json',
|
|
@@ -243,13 +244,14 @@ const createMesh = async (
|
|
|
243
244
|
'workspaceName': workspaceName,
|
|
244
245
|
'orgName': orgName,
|
|
245
246
|
'projectName': projectName,
|
|
247
|
+
'x-api-key': SMS_API_KEY,
|
|
246
248
|
},
|
|
247
249
|
data: JSON.stringify(data),
|
|
248
250
|
};
|
|
249
251
|
|
|
250
252
|
logger.info(
|
|
251
253
|
'Initiating POST %s',
|
|
252
|
-
`${
|
|
254
|
+
`${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes`,
|
|
253
255
|
);
|
|
254
256
|
|
|
255
257
|
try {
|
|
@@ -343,10 +345,10 @@ const updateMesh = async (
|
|
|
343
345
|
meshId,
|
|
344
346
|
data,
|
|
345
347
|
) => {
|
|
346
|
-
const {
|
|
348
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
347
349
|
const config = {
|
|
348
350
|
method: 'put',
|
|
349
|
-
url: `${
|
|
351
|
+
url: `${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
350
352
|
headers: {
|
|
351
353
|
'Authorization': `Bearer ${accessToken}`,
|
|
352
354
|
'Content-Type': 'application/json',
|
|
@@ -354,13 +356,14 @@ const updateMesh = async (
|
|
|
354
356
|
'workspaceName': workspaceName,
|
|
355
357
|
'orgName': orgName,
|
|
356
358
|
'projectName': projectName,
|
|
359
|
+
'x-api-key': SMS_API_KEY,
|
|
357
360
|
},
|
|
358
361
|
data: JSON.stringify(data),
|
|
359
362
|
};
|
|
360
363
|
|
|
361
364
|
logger.info(
|
|
362
365
|
'Initiating PUT %s',
|
|
363
|
-
`${
|
|
366
|
+
`${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
364
367
|
);
|
|
365
368
|
|
|
366
369
|
try {
|
|
@@ -433,19 +436,20 @@ const updateMesh = async (
|
|
|
433
436
|
};
|
|
434
437
|
|
|
435
438
|
const deleteMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
436
|
-
const {
|
|
439
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
437
440
|
const config = {
|
|
438
441
|
method: 'delete',
|
|
439
|
-
url: `${
|
|
442
|
+
url: `${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
440
443
|
headers: {
|
|
441
444
|
'Authorization': `Bearer ${accessToken}`,
|
|
442
445
|
'x-request-id': global.requestId,
|
|
446
|
+
'x-api-key': SMS_API_KEY,
|
|
443
447
|
},
|
|
444
448
|
};
|
|
445
449
|
|
|
446
450
|
logger.info(
|
|
447
451
|
'Initiating DELETE %s',
|
|
448
|
-
`${
|
|
452
|
+
`${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}`,
|
|
449
453
|
);
|
|
450
454
|
|
|
451
455
|
try {
|
|
@@ -517,23 +521,24 @@ const deleteMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
|
517
521
|
}
|
|
518
522
|
};
|
|
519
523
|
|
|
520
|
-
const getMeshId = async (
|
|
521
|
-
const {
|
|
524
|
+
const getMeshId = async (organizationCode, projectId, workspaceId, workspaceName) => {
|
|
525
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
522
526
|
logger.info('Initiating Mesh ID request');
|
|
523
527
|
|
|
524
528
|
const config = {
|
|
525
529
|
method: 'get',
|
|
526
|
-
url: `${
|
|
530
|
+
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/mesh`,
|
|
527
531
|
headers: {
|
|
528
532
|
'Authorization': `Bearer ${accessToken}`,
|
|
529
533
|
'x-request-id': global.requestId,
|
|
530
534
|
'workspaceName': workspaceName,
|
|
535
|
+
'x-api-key': SMS_API_KEY,
|
|
531
536
|
},
|
|
532
537
|
};
|
|
533
538
|
|
|
534
539
|
logger.info(
|
|
535
540
|
'Initiating GET %s',
|
|
536
|
-
`${
|
|
541
|
+
`${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/mesh`,
|
|
537
542
|
);
|
|
538
543
|
|
|
539
544
|
try {
|
|
@@ -805,21 +810,22 @@ const unsubscribeCredentialFromMeshService = async (
|
|
|
805
810
|
};
|
|
806
811
|
|
|
807
812
|
const getMeshArtifact = async (organizationId, projectId, workspaceId, workspaceName, meshId) => {
|
|
808
|
-
const {
|
|
813
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
809
814
|
const config = {
|
|
810
815
|
method: 'get',
|
|
811
|
-
url: `${
|
|
816
|
+
url: `${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/artifact`,
|
|
812
817
|
headers: {
|
|
813
818
|
'Authorization': `Bearer ${accessToken}`,
|
|
814
819
|
'x-request-id': global.requestId,
|
|
815
820
|
'workspaceName': workspaceName,
|
|
821
|
+
'x-api-key': SMS_API_KEY,
|
|
816
822
|
},
|
|
817
823
|
responseType: 'arraybuffer',
|
|
818
824
|
};
|
|
819
825
|
|
|
820
826
|
logger.info(
|
|
821
827
|
'Initiating GET %s',
|
|
822
|
-
`${
|
|
828
|
+
`${SMS_BASE_URL}/organizations/${organizationId}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/artifact`,
|
|
823
829
|
);
|
|
824
830
|
|
|
825
831
|
try {
|
|
@@ -862,14 +868,14 @@ const getMeshArtifact = async (organizationId, projectId, workspaceId, workspace
|
|
|
862
868
|
* @returns {Promise<Object>}
|
|
863
869
|
*/
|
|
864
870
|
const getTenantFeatures = async organizationCode => {
|
|
865
|
-
const { accessToken
|
|
871
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
866
872
|
const config = {
|
|
867
873
|
method: 'get',
|
|
868
874
|
url: `${SMS_BASE_URL}/organizations/${organizationCode}/features`,
|
|
869
875
|
headers: {
|
|
870
876
|
'Authorization': `Bearer ${accessToken}`,
|
|
871
877
|
'x-request-id': global.requestId,
|
|
872
|
-
'
|
|
878
|
+
'x-api-key': SMS_API_KEY,
|
|
873
879
|
},
|
|
874
880
|
};
|
|
875
881
|
|
|
@@ -917,14 +923,14 @@ const getTenantFeatures = async organizationCode => {
|
|
|
917
923
|
* @returns {Promise<Object>}
|
|
918
924
|
*/
|
|
919
925
|
const getMeshDeployments = async (organizationCode, projectId, workspaceId, meshId) => {
|
|
920
|
-
const { accessToken
|
|
926
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
921
927
|
const config = {
|
|
922
928
|
method: 'get',
|
|
923
929
|
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/deployments/latest`,
|
|
924
930
|
headers: {
|
|
925
931
|
'Authorization': `Bearer ${accessToken}`,
|
|
926
932
|
'x-request-id': global.requestId,
|
|
927
|
-
'
|
|
933
|
+
'x-api-key': SMS_API_KEY,
|
|
928
934
|
},
|
|
929
935
|
};
|
|
930
936
|
|
|
@@ -973,14 +979,14 @@ const getMeshDeployments = async (organizationCode, projectId, workspaceId, mesh
|
|
|
973
979
|
* @returns string
|
|
974
980
|
*/
|
|
975
981
|
const getPublicEncryptionKey = async organizationCode => {
|
|
976
|
-
const { accessToken
|
|
982
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
977
983
|
const config = {
|
|
978
984
|
method: 'get',
|
|
979
985
|
url: `${SMS_BASE_URL}/organizations/${organizationCode}/getPublicKey`,
|
|
980
986
|
headers: {
|
|
981
987
|
'Authorization': `Bearer ${accessToken}`,
|
|
982
988
|
'x-request-id': global.requestId,
|
|
983
|
-
'
|
|
989
|
+
'x-api-key': SMS_API_KEY,
|
|
984
990
|
},
|
|
985
991
|
};
|
|
986
992
|
logger.info(
|
|
@@ -1018,14 +1024,14 @@ const getPresignedUrls = async (
|
|
|
1018
1024
|
startTime,
|
|
1019
1025
|
endTime,
|
|
1020
1026
|
) => {
|
|
1021
|
-
const { accessToken
|
|
1027
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
1022
1028
|
const config = {
|
|
1023
1029
|
method: 'get',
|
|
1024
1030
|
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/logs?startDateTime=${startTime}&endDateTime=${endTime}`,
|
|
1025
1031
|
headers: {
|
|
1026
1032
|
'Authorization': `Bearer ${accessToken}`,
|
|
1027
1033
|
'x-request-id': global.requestId,
|
|
1028
|
-
'
|
|
1034
|
+
'x-api-key': SMS_API_KEY,
|
|
1029
1035
|
},
|
|
1030
1036
|
};
|
|
1031
1037
|
|
|
@@ -1057,14 +1063,14 @@ const getPresignedUrls = async (
|
|
|
1057
1063
|
};
|
|
1058
1064
|
|
|
1059
1065
|
const getLogsByRayId = async (organizationCode, projectId, workspaceId, meshId, rayId) => {
|
|
1060
|
-
const { accessToken
|
|
1066
|
+
const { accessToken } = await getDevConsoleConfig();
|
|
1061
1067
|
const config = {
|
|
1062
1068
|
method: 'get',
|
|
1063
1069
|
url: `${SMS_BASE_URL}/organizations/${organizationCode}/projects/${projectId}/workspaces/${workspaceId}/meshes/${meshId}/logs/${rayId}`,
|
|
1064
1070
|
headers: {
|
|
1065
1071
|
'Authorization': `Bearer ${accessToken}`,
|
|
1066
1072
|
'x-request-id': global.requestId,
|
|
1067
|
-
'
|
|
1073
|
+
'x-api-key': SMS_API_KEY,
|
|
1068
1074
|
},
|
|
1069
1075
|
};
|
|
1070
1076
|
|