@adobe/aio-cli-plugin-api-mesh 3.0.0 → 3.0.1
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 +9 -1
- package/src/commands/api-mesh/__tests__/describe.test.js +9 -9
- package/src/commands/api-mesh/__tests__/get.test.js +1 -0
- package/src/commands/api-mesh/create.js +19 -11
- package/src/commands/api-mesh/describe.js +15 -14
- package/src/commands/api-mesh/get.js +3 -3
- package/src/commands/api-mesh/source/__tests__/install.test.js +2 -0
- package/src/commands/api-mesh/source/install.js +4 -4
- package/src/commands/api-mesh/status.js +3 -3
- package/src/constants.js +2 -6
- package/src/helpers.js +1 -0
- package/src/lib/devConsole.js +7 -5
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.0.
|
|
1
|
+
{"version":"3.0.1","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"}},"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: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"}},"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
|
@@ -67,6 +67,7 @@ describe('create command tests', () => {
|
|
|
67
67
|
imsOrgId: selectedOrg.id,
|
|
68
68
|
projectId: selectedProject.id,
|
|
69
69
|
workspaceId: selectedWorkspace.id,
|
|
70
|
+
workspaceName: selectedWorkspace.title,
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
global.requestId = 'dummy_request_id';
|
|
@@ -278,6 +279,7 @@ describe('create command tests', () => {
|
|
|
278
279
|
"1234",
|
|
279
280
|
"5678",
|
|
280
281
|
"123456789",
|
|
282
|
+
"Workspace01",
|
|
281
283
|
{
|
|
282
284
|
"meshConfig": {
|
|
283
285
|
"sources": [
|
|
@@ -367,6 +369,7 @@ describe('create command tests', () => {
|
|
|
367
369
|
"1234",
|
|
368
370
|
"5678",
|
|
369
371
|
"123456789",
|
|
372
|
+
"Workspace01",
|
|
370
373
|
{
|
|
371
374
|
"meshConfig": {
|
|
372
375
|
"sources": [
|
|
@@ -436,7 +439,7 @@ describe('create command tests', () => {
|
|
|
436
439
|
[
|
|
437
440
|
"Mesh Endpoint: %s
|
|
438
441
|
",
|
|
439
|
-
"https://tigraph.adobe.io/dummy_mesh_id/graphql
|
|
442
|
+
"https://tigraph.adobe.io/dummy_mesh_id/graphql",
|
|
440
443
|
],
|
|
441
444
|
]
|
|
442
445
|
`);
|
|
@@ -925,6 +928,7 @@ describe('create command tests', () => {
|
|
|
925
928
|
"1234",
|
|
926
929
|
"5678",
|
|
927
930
|
"123456789",
|
|
931
|
+
"Workspace01",
|
|
928
932
|
{
|
|
929
933
|
"meshConfig": {
|
|
930
934
|
"files": [
|
|
@@ -1186,6 +1190,7 @@ describe('create command tests', () => {
|
|
|
1186
1190
|
"1234",
|
|
1187
1191
|
"5678",
|
|
1188
1192
|
"123456789",
|
|
1193
|
+
"Workspace01",
|
|
1189
1194
|
{
|
|
1190
1195
|
"files": [
|
|
1191
1196
|
{
|
|
@@ -1314,6 +1319,7 @@ describe('create command tests', () => {
|
|
|
1314
1319
|
"1234",
|
|
1315
1320
|
"5678",
|
|
1316
1321
|
"123456789",
|
|
1322
|
+
"Workspace01",
|
|
1317
1323
|
{
|
|
1318
1324
|
"meshConfig": {
|
|
1319
1325
|
"files": [
|
|
@@ -1445,6 +1451,7 @@ describe('create command tests', () => {
|
|
|
1445
1451
|
"1234",
|
|
1446
1452
|
"5678",
|
|
1447
1453
|
"123456789",
|
|
1454
|
+
"Workspace01",
|
|
1448
1455
|
{
|
|
1449
1456
|
"meshConfig": {
|
|
1450
1457
|
"files": [
|
|
@@ -1573,6 +1580,7 @@ describe('create command tests', () => {
|
|
|
1573
1580
|
"1234",
|
|
1574
1581
|
"5678",
|
|
1575
1582
|
"123456789",
|
|
1583
|
+
"Workspace01",
|
|
1576
1584
|
{
|
|
1577
1585
|
"meshConfig": {
|
|
1578
1586
|
"files": [
|
|
@@ -52,6 +52,7 @@ describe('describe command tests', () => {
|
|
|
52
52
|
imsOrgId: selectedOrg.id,
|
|
53
53
|
projectId: selectedProject.id,
|
|
54
54
|
workspaceId: selectedWorkspace.id,
|
|
55
|
+
workspaceName: selectedWorkspace.title,
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
global.requestId = 'dummy_request_id';
|
|
@@ -174,6 +175,11 @@ describe('describe command tests', () => {
|
|
|
174
175
|
"Mesh ID: %s",
|
|
175
176
|
"dummy_meshId",
|
|
176
177
|
],
|
|
178
|
+
[
|
|
179
|
+
"Mesh Endpoint: %s
|
|
180
|
+
",
|
|
181
|
+
"https://graph.adobe.io/api/dummy_meshId/graphql",
|
|
182
|
+
],
|
|
177
183
|
]
|
|
178
184
|
`);
|
|
179
185
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
@@ -187,6 +193,7 @@ describe('describe command tests', () => {
|
|
|
187
193
|
selectedOrg.id,
|
|
188
194
|
selectedProject.id,
|
|
189
195
|
selectedWorkspace.id,
|
|
196
|
+
selectedWorkspace.title,
|
|
190
197
|
);
|
|
191
198
|
expect(runResult).toMatchInlineSnapshot(`
|
|
192
199
|
{
|
|
@@ -216,10 +223,6 @@ describe('describe command tests', () => {
|
|
|
216
223
|
"Mesh ID: %s",
|
|
217
224
|
"dummy_meshId",
|
|
218
225
|
],
|
|
219
|
-
[
|
|
220
|
-
"API Key: %s",
|
|
221
|
-
"dummy_apiKey",
|
|
222
|
-
],
|
|
223
226
|
[
|
|
224
227
|
"Mesh Endpoint: %s
|
|
225
228
|
",
|
|
@@ -242,6 +245,7 @@ describe('describe command tests', () => {
|
|
|
242
245
|
selectedOrg.id,
|
|
243
246
|
selectedProject.id,
|
|
244
247
|
selectedWorkspace.id,
|
|
248
|
+
selectedWorkspace.title,
|
|
245
249
|
);
|
|
246
250
|
expect(runResult).toMatchInlineSnapshot(`
|
|
247
251
|
{
|
|
@@ -271,14 +275,10 @@ describe('describe command tests', () => {
|
|
|
271
275
|
"Mesh ID: %s",
|
|
272
276
|
"dummy_meshId",
|
|
273
277
|
],
|
|
274
|
-
[
|
|
275
|
-
"API Key: %s",
|
|
276
|
-
"dummy_apiKey",
|
|
277
|
-
],
|
|
278
278
|
[
|
|
279
279
|
"Mesh Endpoint: %s
|
|
280
280
|
",
|
|
281
|
-
"https://tigraph.adobe.io/dummy_meshId/graphql
|
|
281
|
+
"https://tigraph.adobe.io/dummy_meshId/graphql",
|
|
282
282
|
],
|
|
283
283
|
]
|
|
284
284
|
`);
|
|
@@ -25,7 +25,7 @@ const {
|
|
|
25
25
|
} = require('../../utils');
|
|
26
26
|
const { getMesh, createMesh } = require('../../lib/devConsole');
|
|
27
27
|
|
|
28
|
-
const { MULTITENANT_GRAPHQL_SERVER_BASE_URL
|
|
28
|
+
const { MULTITENANT_GRAPHQL_SERVER_BASE_URL } = CONSTANTS;
|
|
29
29
|
|
|
30
30
|
class CreateCommand extends Command {
|
|
31
31
|
static args = [{ name: 'file' }];
|
|
@@ -54,7 +54,7 @@ class CreateCommand extends Command {
|
|
|
54
54
|
const ignoreCache = await flags.ignoreCache;
|
|
55
55
|
const autoConfirmAction = await flags.autoConfirmAction;
|
|
56
56
|
const envFilePath = await flags.env;
|
|
57
|
-
const { imsOrgId, projectId, workspaceId } = await initSdk({
|
|
57
|
+
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
58
58
|
ignoreCache,
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -104,7 +104,13 @@ class CreateCommand extends Command {
|
|
|
104
104
|
|
|
105
105
|
if (shouldContinue) {
|
|
106
106
|
try {
|
|
107
|
-
const { mesh, apiKey, sdkList } = await createMesh(
|
|
107
|
+
const { mesh, apiKey, sdkList } = await createMesh(
|
|
108
|
+
imsOrgId,
|
|
109
|
+
projectId,
|
|
110
|
+
workspaceId,
|
|
111
|
+
workspaceName,
|
|
112
|
+
data,
|
|
113
|
+
);
|
|
108
114
|
|
|
109
115
|
if (mesh) {
|
|
110
116
|
this.log(
|
|
@@ -126,23 +132,25 @@ class CreateCommand extends Command {
|
|
|
126
132
|
if (sdkList) {
|
|
127
133
|
this.log('Successfully subscribed API Key %s to API Mesh service', apiKey);
|
|
128
134
|
|
|
129
|
-
const { meshURL } = await getMesh(
|
|
135
|
+
const { meshURL } = await getMesh(
|
|
136
|
+
imsOrgId,
|
|
137
|
+
projectId,
|
|
138
|
+
workspaceId,
|
|
139
|
+
workspaceName,
|
|
140
|
+
mesh.meshId,
|
|
141
|
+
);
|
|
130
142
|
const meshUrl =
|
|
131
143
|
meshURL === '' || meshURL === undefined
|
|
132
144
|
? MULTITENANT_GRAPHQL_SERVER_BASE_URL
|
|
133
145
|
: meshURL;
|
|
134
146
|
|
|
135
|
-
if (
|
|
136
|
-
meshUrl === TMOConstants.TMO_STAGE_URL ||
|
|
137
|
-
meshUrl === TMOConstants.TMO_SANDBOX_URL ||
|
|
138
|
-
meshUrl === TMOConstants.TMO_PROD_URL
|
|
139
|
-
) {
|
|
140
|
-
this.log('Mesh Endpoint: %s\n', `${meshUrl}/${mesh.meshId}/graphql`);
|
|
141
|
-
} else {
|
|
147
|
+
if (apiKey && MULTITENANT_GRAPHQL_SERVER_BASE_URL.includes(meshUrl)) {
|
|
142
148
|
this.log(
|
|
143
149
|
'Mesh Endpoint: %s\n',
|
|
144
150
|
`${meshUrl}/${mesh.meshId}/graphql?api_key=${apiKey}`,
|
|
145
151
|
);
|
|
152
|
+
} else {
|
|
153
|
+
this.log('Mesh Endpoint: %s\n', `${meshUrl}/${mesh.meshId}/graphql`);
|
|
146
154
|
}
|
|
147
155
|
} else {
|
|
148
156
|
this.log('Unable to subscribe API Key %s to API Mesh service', apiKey);
|
|
@@ -19,7 +19,7 @@ const { describeMesh, getMesh } = require('../../lib/devConsole');
|
|
|
19
19
|
|
|
20
20
|
require('dotenv').config();
|
|
21
21
|
|
|
22
|
-
const { MULTITENANT_GRAPHQL_SERVER_BASE_URL
|
|
22
|
+
const { MULTITENANT_GRAPHQL_SERVER_BASE_URL } = CONSTANTS;
|
|
23
23
|
|
|
24
24
|
class DescribeCommand extends Command {
|
|
25
25
|
static flags = {
|
|
@@ -35,12 +35,12 @@ class DescribeCommand extends Command {
|
|
|
35
35
|
|
|
36
36
|
const ignoreCache = await flags.ignoreCache;
|
|
37
37
|
|
|
38
|
-
const { imsOrgId, projectId, workspaceId } = await initSdk({
|
|
38
|
+
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
39
39
|
ignoreCache,
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
|
-
const meshDetails = await describeMesh(imsOrgId, projectId, workspaceId);
|
|
43
|
+
const meshDetails = await describeMesh(imsOrgId, projectId, workspaceId, workspaceName);
|
|
44
44
|
|
|
45
45
|
if (meshDetails) {
|
|
46
46
|
const { meshId, apiKey } = meshDetails;
|
|
@@ -52,19 +52,20 @@ class DescribeCommand extends Command {
|
|
|
52
52
|
this.log('Workspace ID: %s', workspaceId);
|
|
53
53
|
this.log('Mesh ID: %s', meshId);
|
|
54
54
|
|
|
55
|
-
const { meshURL } = await getMesh(
|
|
56
|
-
|
|
55
|
+
const { meshURL } = await getMesh(
|
|
56
|
+
imsOrgId,
|
|
57
|
+
projectId,
|
|
58
|
+
workspaceId,
|
|
59
|
+
workspaceName,
|
|
60
|
+
meshId,
|
|
61
|
+
);
|
|
62
|
+
const meshUrl =
|
|
63
|
+
meshURL === '' || meshURL === undefined ? MULTITENANT_GRAPHQL_SERVER_BASE_URL : meshURL;
|
|
57
64
|
|
|
58
|
-
if (
|
|
59
|
-
apiKey &&
|
|
60
|
-
(meshUrl === TMOConstants.TMO_STAGE_URL ||
|
|
61
|
-
meshUrl === TMOConstants.TMO_SANDBOX_URL ||
|
|
62
|
-
meshUrl === TMOConstants.TMO_PROD_URL)
|
|
63
|
-
) {
|
|
64
|
-
this.log('Mesh Endpoint: %s\n', `${meshUrl}/${meshId}/graphql`);
|
|
65
|
-
} else if (apiKey) {
|
|
66
|
-
this.log('API Key: %s', apiKey);
|
|
65
|
+
if (apiKey && MULTITENANT_GRAPHQL_SERVER_BASE_URL.includes(meshUrl)) {
|
|
67
66
|
this.log('Mesh Endpoint: %s\n', `${meshUrl}/${meshId}/graphql?api_key=${apiKey}`);
|
|
67
|
+
} else {
|
|
68
|
+
this.log('Mesh Endpoint: %s\n', `${meshUrl}/${meshId}/graphql`);
|
|
68
69
|
}
|
|
69
70
|
return meshDetails;
|
|
70
71
|
} else {
|
|
@@ -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 } = await initSdk({
|
|
41
|
+
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
|
|
42
42
|
ignoreCache,
|
|
43
43
|
verbose: !json,
|
|
44
44
|
});
|
|
@@ -46,7 +46,7 @@ class GetCommand extends Command {
|
|
|
46
46
|
let meshId = null;
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
|
-
meshId = await getMeshId(imsOrgId, projectId, workspaceId);
|
|
49
|
+
meshId = await getMeshId(imsOrgId, projectId, workspaceId, workspaceName);
|
|
50
50
|
} catch (err) {
|
|
51
51
|
this.error(
|
|
52
52
|
`Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -55,7 +55,7 @@ class GetCommand extends Command {
|
|
|
55
55
|
|
|
56
56
|
if (meshId) {
|
|
57
57
|
try {
|
|
58
|
-
const mesh = await getMesh(imsOrgId, projectId, workspaceId, meshId);
|
|
58
|
+
const mesh = await getMesh(imsOrgId, projectId, workspaceId, workspaceName, meshId);
|
|
59
59
|
|
|
60
60
|
if (mesh) {
|
|
61
61
|
this.log('Successfully retrieved mesh %s', JSON.stringify(mesh, null, 2));
|
|
@@ -39,6 +39,7 @@ initSdk.mockResolvedValue({
|
|
|
39
39
|
imsOrgId: selectedOrg.id,
|
|
40
40
|
projectId: selectedProject.id,
|
|
41
41
|
workspaceId: selectedWorkspace.id,
|
|
42
|
+
workspaceName: selectedWorkspace.title,
|
|
42
43
|
});
|
|
43
44
|
initRequestId.mockResolvedValue({});
|
|
44
45
|
promptInput.mockResolvedValueOnce('test-03');
|
|
@@ -146,6 +147,7 @@ describe('source:install command tests', () => {
|
|
|
146
147
|
selectedOrg.id,
|
|
147
148
|
selectedProject.id,
|
|
148
149
|
selectedWorkspace.id,
|
|
150
|
+
selectedWorkspace.title,
|
|
149
151
|
'dummy_meshId',
|
|
150
152
|
res,
|
|
151
153
|
);
|
|
@@ -36,7 +36,7 @@ class InstallCommand extends Command {
|
|
|
36
36
|
await initRequestId();
|
|
37
37
|
logger.info(`RequestId: ${global.requestId}`);
|
|
38
38
|
const ignoreCache = await flags.ignoreCache;
|
|
39
|
-
const { imsOrgId, projectId, workspaceId } = await initSdk({ ignoreCache });
|
|
39
|
+
const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({ ignoreCache });
|
|
40
40
|
const filepath = flags['variable-file'];
|
|
41
41
|
let variables = flags.variable
|
|
42
42
|
? flags.variable.reduce((obj, val) => {
|
|
@@ -119,7 +119,7 @@ class InstallCommand extends Command {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
try {
|
|
122
|
-
meshId = await getMeshId(imsOrgId, projectId, workspaceId);
|
|
122
|
+
meshId = await getMeshId(imsOrgId, projectId, workspaceId, workspaceName);
|
|
123
123
|
} catch (err) {
|
|
124
124
|
this.error(
|
|
125
125
|
`Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
|
|
@@ -133,7 +133,7 @@ class InstallCommand extends Command {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
try {
|
|
136
|
-
const mesh = await getMesh(imsOrgId, projectId, workspaceId, meshId);
|
|
136
|
+
const mesh = await getMesh(imsOrgId, projectId, workspaceId, meshId, workspaceName);
|
|
137
137
|
|
|
138
138
|
if (!mesh) {
|
|
139
139
|
this.error(
|
|
@@ -199,7 +199,7 @@ class InstallCommand extends Command {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
try {
|
|
202
|
-
const response = await updateMesh(imsOrgId, projectId, workspaceId, meshId, {
|
|
202
|
+
const response = await updateMesh(imsOrgId, projectId, workspaceId, workspaceName, meshId, {
|
|
203
203
|
meshConfig: mesh.meshConfig,
|
|
204
204
|
});
|
|
205
205
|
|
|
@@ -18,14 +18,14 @@ class StatusCommand extends Command {
|
|
|
18
18
|
const { flags } = await this.parse(StatusCommand);
|
|
19
19
|
const ignoreCache = await flags.ignoreCache;
|
|
20
20
|
|
|
21
|
-
const { imsOrgId, projectId, workspaceId } = await initSdk({
|
|
21
|
+
const { imsOrgId, 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(imsOrgId, projectId, workspaceId);
|
|
28
|
+
meshId = await getMeshId(imsOrgId, projectId, workspaceId, workspaceName);
|
|
29
29
|
} catch (err) {
|
|
30
30
|
this.log(err.message);
|
|
31
31
|
this.error(
|
|
@@ -35,7 +35,7 @@ class StatusCommand extends Command {
|
|
|
35
35
|
|
|
36
36
|
if (meshId) {
|
|
37
37
|
try {
|
|
38
|
-
const mesh = await getMesh(imsOrgId, projectId, workspaceId, meshId);
|
|
38
|
+
const mesh = await getMesh(imsOrgId, projectId, workspaceId, workspaceName, meshId);
|
|
39
39
|
switch (mesh.meshStatus) {
|
|
40
40
|
case 'success':
|
|
41
41
|
this.log(
|
package/src/constants.js
CHANGED
|
@@ -19,10 +19,6 @@ const ProdConstants = {
|
|
|
19
19
|
AIO_CLI_API_KEY: 'aio-cli-console-auth',
|
|
20
20
|
SMS_BASE_URL: 'https://graph.adobe.io/api-admin',
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
TMO_STAGE_URL: 'https://tigraph-dev.adobe.io/api',
|
|
24
|
-
TMO_SANDBOX_URL: 'https://tigraph-sandbox.adobe.io/api',
|
|
25
|
-
TMO_PROD_URL: 'https://tigraph.adobe.io/api',
|
|
26
|
-
};
|
|
22
|
+
|
|
27
23
|
const envConstants = clientEnv === 'stage' ? StageConstants : ProdConstants;
|
|
28
|
-
module.exports = { ...envConstants
|
|
24
|
+
module.exports = { ...envConstants };
|
package/src/helpers.js
CHANGED
package/src/lib/devConsole.js
CHANGED
|
@@ -76,11 +76,11 @@ const getApiKeyCredential = async (organizationId, projectId, workspaceId) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
const describeMesh = async (organizationId, projectId, workspaceId) => {
|
|
79
|
+
const describeMesh = async (organizationId, projectId, workspaceId, workspaceName) => {
|
|
80
80
|
logger.info('Initiating Describe Mesh');
|
|
81
81
|
|
|
82
82
|
try {
|
|
83
|
-
const meshId = await getMeshId(organizationId, projectId, workspaceId);
|
|
83
|
+
const meshId = await getMeshId(organizationId, projectId, workspaceId, workspaceName);
|
|
84
84
|
|
|
85
85
|
logger.info('Response from getMeshId %s', meshId);
|
|
86
86
|
|
|
@@ -106,7 +106,7 @@ const describeMesh = async (organizationId, projectId, workspaceId) => {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
const getMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
109
|
+
const getMesh = async (organizationId, projectId, workspaceId, workspaceName, meshId) => {
|
|
110
110
|
const { baseUrl: devConsoleUrl, accessToken, apiKey } = await getDevConsoleConfig();
|
|
111
111
|
const config = {
|
|
112
112
|
method: 'get',
|
|
@@ -114,6 +114,7 @@ const getMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
|
114
114
|
headers: {
|
|
115
115
|
'Authorization': `Bearer ${accessToken}`,
|
|
116
116
|
'x-request-id': global.requestId,
|
|
117
|
+
'workspaceName': workspaceName,
|
|
117
118
|
},
|
|
118
119
|
};
|
|
119
120
|
|
|
@@ -187,7 +188,7 @@ const getMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
|
187
188
|
}
|
|
188
189
|
};
|
|
189
190
|
|
|
190
|
-
const createMesh = async (organizationId, projectId, workspaceId, data) => {
|
|
191
|
+
const createMesh = async (organizationId, projectId, workspaceId, workspaceName, data) => {
|
|
191
192
|
const { baseUrl: devConsoleUrl, accessToken, apiKey } = await getDevConsoleConfig();
|
|
192
193
|
const config = {
|
|
193
194
|
method: 'post',
|
|
@@ -480,7 +481,7 @@ const deleteMesh = async (organizationId, projectId, workspaceId, meshId) => {
|
|
|
480
481
|
}
|
|
481
482
|
};
|
|
482
483
|
|
|
483
|
-
const getMeshId = async (organizationId, projectId, workspaceId) => {
|
|
484
|
+
const getMeshId = async (organizationId, projectId, workspaceId, workspaceName) => {
|
|
484
485
|
const { baseUrl: devConsoleUrl, accessToken, apiKey } = await getDevConsoleConfig();
|
|
485
486
|
logger.info('Initiating Mesh ID request');
|
|
486
487
|
|
|
@@ -490,6 +491,7 @@ const getMeshId = async (organizationId, projectId, workspaceId) => {
|
|
|
490
491
|
headers: {
|
|
491
492
|
'Authorization': `Bearer ${accessToken}`,
|
|
492
493
|
'x-request-id': global.requestId,
|
|
494
|
+
'workspaceName': workspaceName,
|
|
493
495
|
},
|
|
494
496
|
};
|
|
495
497
|
|