@adobe/aio-cli-plugin-api-mesh 4.0.0 → 4.0.1-beta.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.
@@ -1 +1 @@
1
- {"version":"4.0.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","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"}]}}}
1
+ {"version":"4.0.1-beta.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"},"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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-api-mesh",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-beta.1",
4
4
  "description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
5
5
  "keywords": [
6
6
  "oclif-plugin"
@@ -159,8 +159,28 @@ describe('create command tests', () => {
159
159
  },
160
160
  });
161
161
  const output = await CreateCommand.run();
162
- expect(output).toHaveProperty('mesh');
163
- expect(output.mesh).toEqual(expect.objectContaining({ meshId: 'dummy_mesh_id' }));
162
+ expect(output).toMatchInlineSnapshot(`
163
+ {
164
+ "imsOrgId": "1234",
165
+ "meshConfig": {
166
+ "sources": [
167
+ {
168
+ "handler": {
169
+ "graphql": {
170
+ "endpoint": "<gql_endpoint>",
171
+ },
172
+ },
173
+ "name": "<api_name>",
174
+ },
175
+ ],
176
+ },
177
+ "meshId": "dummy_mesh_id",
178
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
179
+ "projectId": "5678",
180
+ "workspaceId": "123456789",
181
+ "workspaceName": "Workspace01",
182
+ }
183
+ `);
164
184
  });
165
185
 
166
186
  test('snapshot create command description', () => {
@@ -242,49 +262,52 @@ describe('create command tests', () => {
242
262
 
243
263
  expect(output).toMatchInlineSnapshot(`
244
264
  {
245
- "mesh": {
246
- "meshConfig": {
247
- "files": [
248
- {
249
- "content": "{"type":"dummyContent"}",
250
- "path": "./requestParams.json",
251
- },
252
- {
253
- "content": "module.exports.functionName = () => { console.log('beforeAll hook'); }",
254
- "path": "./hooks.js",
255
- },
256
- ],
257
- "plugins": [
258
- {
259
- "hooks": {
260
- "beforeAll": {
261
- "composer": "./hooks.js#functionName",
262
- },
265
+ "imsOrgId": "1234",
266
+ "meshConfig": {
267
+ "files": [
268
+ {
269
+ "content": "{"type":"dummyContent"}",
270
+ "path": "./requestParams.json",
271
+ },
272
+ {
273
+ "content": "module.exports.functionName = () => { console.log('beforeAll hook'); }",
274
+ "path": "./hooks.js",
275
+ },
276
+ ],
277
+ "plugins": [
278
+ {
279
+ "hooks": {
280
+ "beforeAll": {
281
+ "composer": "./hooks.js#functionName",
263
282
  },
264
283
  },
265
- ],
266
- "sources": [
267
- {
268
- "handler": {
269
- "JsonSchema": {
270
- "baseUrl": "<json_source__baseurl>",
271
- "operations": [
272
- {
273
- "field": "<query>",
274
- "method": "POST",
275
- "path": "<query_path>",
276
- "requestSchema": "./requestParams.json",
277
- "type": "Query",
278
- },
279
- ],
280
- },
284
+ },
285
+ ],
286
+ "sources": [
287
+ {
288
+ "handler": {
289
+ "JsonSchema": {
290
+ "baseUrl": "<json_source__baseurl>",
291
+ "operations": [
292
+ {
293
+ "field": "<query>",
294
+ "method": "POST",
295
+ "path": "<query_path>",
296
+ "requestSchema": "./requestParams.json",
297
+ "type": "Query",
298
+ },
299
+ ],
281
300
  },
282
- "name": "<json_source_name>",
283
301
  },
284
- ],
285
- },
286
- "meshId": "dummy_mesh_id",
302
+ "name": "<json_source_name>",
303
+ },
304
+ ],
287
305
  },
306
+ "meshId": "dummy_mesh_id",
307
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
308
+ "projectId": "5678",
309
+ "workspaceId": "123456789",
310
+ "workspaceName": "Workspace01",
288
311
  }
289
312
  `);
290
313
  });
@@ -344,21 +367,24 @@ describe('create command tests', () => {
344
367
  `);
345
368
  expect(runResult).toMatchInlineSnapshot(`
346
369
  {
347
- "mesh": {
348
- "meshConfig": {
349
- "sources": [
350
- {
351
- "handler": {
352
- "graphql": {
353
- "endpoint": "<gql_endpoint>",
354
- },
370
+ "imsOrgId": "1234",
371
+ "meshConfig": {
372
+ "sources": [
373
+ {
374
+ "handler": {
375
+ "graphql": {
376
+ "endpoint": "<gql_endpoint>",
355
377
  },
356
- "name": "<api_name>",
357
378
  },
358
- ],
359
- },
360
- "meshId": "dummy_mesh_id",
379
+ "name": "<api_name>",
380
+ },
381
+ ],
361
382
  },
383
+ "meshId": "dummy_mesh_id",
384
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
385
+ "projectId": "5678",
386
+ "workspaceId": "123456789",
387
+ "workspaceName": "Workspace01",
362
388
  }
363
389
  `);
364
390
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -424,21 +450,24 @@ describe('create command tests', () => {
424
450
 
425
451
  expect(runResult).toMatchInlineSnapshot(`
426
452
  {
427
- "mesh": {
428
- "meshConfig": {
429
- "sources": [
430
- {
431
- "handler": {
432
- "graphql": {
433
- "endpoint": "<gql_endpoint>",
434
- },
453
+ "imsOrgId": "1234",
454
+ "meshConfig": {
455
+ "sources": [
456
+ {
457
+ "handler": {
458
+ "graphql": {
459
+ "endpoint": "<gql_endpoint>",
435
460
  },
436
- "name": "<api_name>",
437
461
  },
438
- ],
439
- },
440
- "meshId": "dummy_mesh_id",
462
+ "name": "<api_name>",
463
+ },
464
+ ],
441
465
  },
466
+ "meshId": "dummy_mesh_id",
467
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
468
+ "projectId": "5678",
469
+ "workspaceId": "123456789",
470
+ "workspaceName": "Workspace01",
442
471
  }
443
472
  `);
444
473
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -588,8 +617,28 @@ describe('create command tests', () => {
588
617
  },
589
618
  });
590
619
  const output = await CreateCommand.run();
591
- expect(output).toHaveProperty('mesh');
592
- expect(output.mesh).toEqual(expect.objectContaining({ meshId: 'dummy_mesh_id' }));
620
+ expect(output).toMatchInlineSnapshot(`
621
+ {
622
+ "imsOrgId": "1234",
623
+ "meshConfig": {
624
+ "sources": [
625
+ {
626
+ "handler": {
627
+ "graphql": {
628
+ "endpoint": "<gql_endpoint>",
629
+ },
630
+ },
631
+ "name": "<api_name>",
632
+ },
633
+ ],
634
+ },
635
+ "meshId": "dummy_mesh_id",
636
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
637
+ "projectId": "5678",
638
+ "workspaceId": "123456789",
639
+ "workspaceName": "Workspace01",
640
+ }
641
+ `);
593
642
  });
594
643
 
595
644
  test('should return error if the mesh has placeholders and env file provided using --env flag is not found', async () => {
@@ -757,21 +806,24 @@ describe('create command tests', () => {
757
806
  expect(promptConfirm).toHaveBeenCalledWith('Are you sure you want to create a mesh?');
758
807
  expect(runResult).toMatchInlineSnapshot(`
759
808
  {
760
- "mesh": {
761
- "meshConfig": {
762
- "sources": [
763
- {
764
- "handler": {
765
- "graphql": {
766
- "endpoint": "<gql_endpoint>",
767
- },
809
+ "imsOrgId": "1234",
810
+ "meshConfig": {
811
+ "sources": [
812
+ {
813
+ "handler": {
814
+ "graphql": {
815
+ "endpoint": "<gql_endpoint>",
768
816
  },
769
- "name": "<api_name>",
770
817
  },
771
- ],
772
- },
773
- "meshId": "dummy_mesh_id",
818
+ "name": "<api_name>",
819
+ },
820
+ ],
774
821
  },
822
+ "meshId": "dummy_mesh_id",
823
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
824
+ "projectId": "5678",
825
+ "workspaceId": "123456789",
826
+ "workspaceName": "Workspace01",
775
827
  }
776
828
  `);
777
829
  });
@@ -891,36 +943,39 @@ describe('create command tests', () => {
891
943
 
892
944
  expect(output).toMatchInlineSnapshot(`
893
945
  {
894
- "mesh": {
895
- "meshConfig": {
896
- "files": [
897
- {
898
- "content": "{"type":"updatedContent"}",
899
- "path": "./requestParams.json",
900
- },
901
- ],
902
- "sources": [
903
- {
904
- "handler": {
905
- "JsonSchema": {
906
- "baseUrl": "<json_source__baseurl>",
907
- "operations": [
908
- {
909
- "field": "<query>",
910
- "method": "POST",
911
- "path": "<query_path>",
912
- "requestSchema": "./requestParams.json",
913
- "type": "Query",
914
- },
915
- ],
916
- },
946
+ "imsOrgId": "1234",
947
+ "meshConfig": {
948
+ "files": [
949
+ {
950
+ "content": "{"type":"updatedContent"}",
951
+ "path": "./requestParams.json",
952
+ },
953
+ ],
954
+ "sources": [
955
+ {
956
+ "handler": {
957
+ "JsonSchema": {
958
+ "baseUrl": "<json_source__baseurl>",
959
+ "operations": [
960
+ {
961
+ "field": "<query>",
962
+ "method": "POST",
963
+ "path": "<query_path>",
964
+ "requestSchema": "./requestParams.json",
965
+ "type": "Query",
966
+ },
967
+ ],
917
968
  },
918
- "name": "<json_source_name>",
919
969
  },
920
- ],
921
- },
922
- "meshId": "dummy_mesh_id",
970
+ "name": "<json_source_name>",
971
+ },
972
+ ],
923
973
  },
974
+ "meshId": "dummy_mesh_id",
975
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
976
+ "projectId": "5678",
977
+ "workspaceId": "123456789",
978
+ "workspaceName": "Workspace01",
924
979
  }
925
980
  `);
926
981
  });
@@ -1403,36 +1458,39 @@ describe('create command tests', () => {
1403
1458
  `);
1404
1459
  expect(output).toMatchInlineSnapshot(`
1405
1460
  {
1406
- "mesh": {
1407
- "meshConfig": {
1408
- "files": [
1409
- {
1410
- "content": "{"type":"dummyContent"}",
1411
- "path": "./schemaBody.json",
1412
- },
1413
- ],
1414
- "sources": [
1415
- {
1416
- "handler": {
1417
- "JsonSchema": {
1418
- "baseUrl": "<json_source__baseurl>",
1419
- "operations": [
1420
- {
1421
- "field": "<query>",
1422
- "method": "POST",
1423
- "path": "<query_path>",
1424
- "requestSchema": "./schemaBody.json",
1425
- "type": "Query",
1426
- },
1427
- ],
1428
- },
1461
+ "imsOrgId": "1234",
1462
+ "meshConfig": {
1463
+ "files": [
1464
+ {
1465
+ "content": "{"type":"dummyContent"}",
1466
+ "path": "./schemaBody.json",
1467
+ },
1468
+ ],
1469
+ "sources": [
1470
+ {
1471
+ "handler": {
1472
+ "JsonSchema": {
1473
+ "baseUrl": "<json_source__baseurl>",
1474
+ "operations": [
1475
+ {
1476
+ "field": "<query>",
1477
+ "method": "POST",
1478
+ "path": "<query_path>",
1479
+ "requestSchema": "./schemaBody.json",
1480
+ "type": "Query",
1481
+ },
1482
+ ],
1429
1483
  },
1430
- "name": "<json_source_name>",
1431
1484
  },
1432
- ],
1433
- },
1434
- "meshId": "dummy_mesh_id",
1485
+ "name": "<json_source_name>",
1486
+ },
1487
+ ],
1435
1488
  },
1489
+ "meshId": "dummy_mesh_id",
1490
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1491
+ "projectId": "5678",
1492
+ "workspaceId": "123456789",
1493
+ "workspaceName": "Workspace01",
1436
1494
  }
1437
1495
  `);
1438
1496
  });
@@ -1528,36 +1586,39 @@ describe('create command tests', () => {
1528
1586
  `);
1529
1587
  expect(output).toMatchInlineSnapshot(`
1530
1588
  {
1531
- "mesh": {
1532
- "meshConfig": {
1533
- "files": [
1534
- {
1535
- "content": "{"type":"updatedContent"}",
1536
- "path": "./files/requestParams.json",
1537
- },
1538
- ],
1539
- "sources": [
1540
- {
1541
- "handler": {
1542
- "JsonSchema": {
1543
- "baseUrl": "<json_source__baseurl>",
1544
- "operations": [
1545
- {
1546
- "field": "<query>",
1547
- "method": "POST",
1548
- "path": "<query_path>",
1549
- "requestSchema": "./files/requestParams.json",
1550
- "type": "Query",
1551
- },
1552
- ],
1553
- },
1589
+ "imsOrgId": "1234",
1590
+ "meshConfig": {
1591
+ "files": [
1592
+ {
1593
+ "content": "{"type":"updatedContent"}",
1594
+ "path": "./files/requestParams.json",
1595
+ },
1596
+ ],
1597
+ "sources": [
1598
+ {
1599
+ "handler": {
1600
+ "JsonSchema": {
1601
+ "baseUrl": "<json_source__baseurl>",
1602
+ "operations": [
1603
+ {
1604
+ "field": "<query>",
1605
+ "method": "POST",
1606
+ "path": "<query_path>",
1607
+ "requestSchema": "./files/requestParams.json",
1608
+ "type": "Query",
1609
+ },
1610
+ ],
1554
1611
  },
1555
- "name": "<json_source_name>",
1556
1612
  },
1557
- ],
1558
- },
1559
- "meshId": "dummy_mesh_id",
1613
+ "name": "<json_source_name>",
1614
+ },
1615
+ ],
1560
1616
  },
1617
+ "meshId": "dummy_mesh_id",
1618
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1619
+ "projectId": "5678",
1620
+ "workspaceId": "123456789",
1621
+ "workspaceName": "Workspace01",
1561
1622
  }
1562
1623
  `);
1563
1624
  });
@@ -1768,21 +1829,24 @@ describe('create command tests', () => {
1768
1829
  const runResult = await CreateCommand.run();
1769
1830
  expect(runResult).toMatchInlineSnapshot(`
1770
1831
  {
1771
- "mesh": {
1772
- "meshConfig": {
1773
- "sources": [
1774
- {
1775
- "handler": {
1776
- "graphql": {
1777
- "endpoint": "<gql_endpoint>",
1778
- },
1832
+ "imsOrgId": "1234",
1833
+ "meshConfig": {
1834
+ "sources": [
1835
+ {
1836
+ "handler": {
1837
+ "graphql": {
1838
+ "endpoint": "<gql_endpoint>",
1779
1839
  },
1780
- "name": "<api_name>",
1781
1840
  },
1782
- ],
1783
- },
1784
- "meshId": "dummy_mesh_id",
1841
+ "name": "<api_name>",
1842
+ },
1843
+ ],
1785
1844
  },
1845
+ "meshId": "dummy_mesh_id",
1846
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1847
+ "projectId": "5678",
1848
+ "workspaceId": "123456789",
1849
+ "workspaceName": "Workspace01",
1786
1850
  }
1787
1851
  `);
1788
1852
  });
@@ -1838,21 +1902,24 @@ describe('create command tests', () => {
1838
1902
  const runResult = await CreateCommand.run();
1839
1903
  expect(runResult).toMatchInlineSnapshot(`
1840
1904
  {
1841
- "mesh": {
1842
- "meshConfig": {
1843
- "sources": [
1844
- {
1845
- "handler": {
1846
- "graphql": {
1847
- "endpoint": "<gql_endpoint>",
1848
- },
1905
+ "imsOrgId": "1234",
1906
+ "meshConfig": {
1907
+ "sources": [
1908
+ {
1909
+ "handler": {
1910
+ "graphql": {
1911
+ "endpoint": "<gql_endpoint>",
1849
1912
  },
1850
- "name": "<api_name>",
1851
1913
  },
1852
- ],
1853
- },
1854
- "meshId": "dummy_mesh_id",
1914
+ "name": "<api_name>",
1915
+ },
1916
+ ],
1855
1917
  },
1918
+ "meshId": "dummy_mesh_id",
1919
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1920
+ "projectId": "5678",
1921
+ "workspaceId": "123456789",
1922
+ "workspaceName": "Workspace01",
1856
1923
  }
1857
1924
  `);
1858
1925
  });
@@ -1875,21 +1942,24 @@ describe('create command tests', () => {
1875
1942
  const runResult = await CreateCommand.run();
1876
1943
  expect(runResult).toMatchInlineSnapshot(`
1877
1944
  {
1878
- "mesh": {
1879
- "meshConfig": {
1880
- "sources": [
1881
- {
1882
- "handler": {
1883
- "graphql": {
1884
- "endpoint": "<gql_endpoint>",
1885
- },
1945
+ "imsOrgId": "1234",
1946
+ "meshConfig": {
1947
+ "sources": [
1948
+ {
1949
+ "handler": {
1950
+ "graphql": {
1951
+ "endpoint": "<gql_endpoint>",
1886
1952
  },
1887
- "name": "<api_name>",
1888
1953
  },
1889
- ],
1890
- },
1891
- "meshId": "dummy_mesh_id",
1954
+ "name": "<api_name>",
1955
+ },
1956
+ ],
1892
1957
  },
1958
+ "meshId": "dummy_mesh_id",
1959
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1960
+ "projectId": "5678",
1961
+ "workspaceId": "123456789",
1962
+ "workspaceName": "Workspace01",
1893
1963
  }
1894
1964
  `);
1895
1965
  });
@@ -160,7 +160,12 @@ describe('describe command tests', () => {
160
160
 
161
161
  expect(runResult).toMatchInlineSnapshot(`
162
162
  {
163
+ "imsOrgId": "1234",
163
164
  "meshId": "dummy_meshId",
165
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
166
+ "projectId": "5678",
167
+ "workspaceId": "123456789",
168
+ "workspaceName": "Workspace01",
164
169
  }
165
170
  `);
166
171
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -207,7 +212,12 @@ describe('describe command tests', () => {
207
212
  expect(runResult).toMatchInlineSnapshot(`
208
213
  {
209
214
  "apiKey": "dummy_apiKey",
215
+ "imsOrgId": "1234",
210
216
  "meshId": "dummy_meshId",
217
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
218
+ "projectId": "5678",
219
+ "workspaceId": "123456789",
220
+ "workspaceName": "Workspace01",
211
221
  }
212
222
  `);
213
223
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -258,7 +268,12 @@ describe('describe command tests', () => {
258
268
  expect(runResult).toMatchInlineSnapshot(`
259
269
  {
260
270
  "apiKey": "dummy_apiKey",
271
+ "imsOrgId": "1234",
261
272
  "meshId": "dummy_meshId",
273
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
274
+ "projectId": "5678",
275
+ "workspaceId": "123456789",
276
+ "workspaceName": "Workspace01",
262
277
  }
263
278
  `);
264
279
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -193,7 +193,30 @@ describe('get command tests', () => {
193
193
  verbose: true,
194
194
  });
195
195
  expect(initRequestId).toHaveBeenCalled();
196
- expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
196
+ expect(runResult).toMatchInlineSnapshot(`
197
+ {
198
+ "imsOrgId": "1234",
199
+ "mesh": {
200
+ "meshConfig": {
201
+ "sources": [
202
+ {
203
+ "handler": {
204
+ "graphql": {
205
+ "endpoint": "<gql_endpoint>",
206
+ },
207
+ },
208
+ "name": "<api_name>",
209
+ },
210
+ ],
211
+ },
212
+ },
213
+ "meshId": "dummy_meshId",
214
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
215
+ "projectId": "5678",
216
+ "workspaceId": "123456789",
217
+ "workspaceName": "Workspace01",
218
+ }
219
+ `);
197
220
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
198
221
  [
199
222
  [
@@ -240,7 +263,30 @@ describe('get command tests', () => {
240
263
 
241
264
  const runResult = await GetCommand.run();
242
265
 
243
- expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
266
+ expect(runResult).toMatchInlineSnapshot(`
267
+ {
268
+ "imsOrgId": "1234",
269
+ "mesh": {
270
+ "meshConfig": {
271
+ "sources": [
272
+ {
273
+ "handler": {
274
+ "graphql": {
275
+ "endpoint": "<gql_endpoint>",
276
+ },
277
+ },
278
+ "name": "<api_name>",
279
+ },
280
+ ],
281
+ },
282
+ },
283
+ "meshId": "dummy_meshId",
284
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
285
+ "projectId": "5678",
286
+ "workspaceId": "123456789",
287
+ "workspaceName": "Workspace01",
288
+ }
289
+ `);
244
290
  expect(writeFile.mock.calls).toMatchInlineSnapshot(`
245
291
  [
246
292
  [
@@ -294,7 +340,30 @@ describe('get command tests', () => {
294
340
  });
295
341
  const runResult = await GetCommand.run();
296
342
 
297
- expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
343
+ expect(runResult).toMatchInlineSnapshot(`
344
+ {
345
+ "imsOrgId": "1234",
346
+ "mesh": {
347
+ "meshConfig": {
348
+ "sources": [
349
+ {
350
+ "handler": {
351
+ "graphql": {
352
+ "endpoint": "<gql_endpoint>",
353
+ },
354
+ },
355
+ "name": "<api_name>",
356
+ },
357
+ ],
358
+ },
359
+ },
360
+ "meshId": "dummy_meshId",
361
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
362
+ "projectId": "5678",
363
+ "workspaceId": "123456789",
364
+ "workspaceName": "Workspace01",
365
+ }
366
+ `);
298
367
  expect(writeFile.mock.calls).toMatchInlineSnapshot(`
299
368
  [
300
369
  [
@@ -159,7 +159,7 @@ class CreateCommand extends Command {
159
159
 
160
160
  // When renaming the return values, make sure to make necessary changes to
161
161
  // template adobe/generator-app-api-mesh since it relies on "mesh"
162
- return { mesh };
162
+ return { ...mesh, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
163
163
  } else {
164
164
  this.error(`Unable to create a mesh. Please try again. RequestId: ${global.requestId}`, {
165
165
  exit: false,
@@ -49,7 +49,7 @@ class DescribeCommand extends Command {
49
49
  this.log('Mesh ID: %s', meshId);
50
50
  this.log('Mesh Endpoint: %s', meshUrl);
51
51
 
52
- return meshDetails;
52
+ return { ...meshDetails, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
53
53
  } else {
54
54
  logger.error(
55
55
  `Unable to get mesh details. Please check the details and try again. RequestId: ${global.requestId}`,
@@ -16,6 +16,7 @@ const logger = require('../../classes/logger');
16
16
  const { initSdk, initRequestId } = require('../../helpers');
17
17
  const { ignoreCacheFlag, jsonFlag } = require('../../utils');
18
18
  const { getMeshId, getMesh } = require('../../lib/devConsole');
19
+ const { buildMeshUrl } = require('../../urlBuilder');
19
20
 
20
21
  require('dotenv').config();
21
22
  class GetCommand extends Command {
@@ -59,6 +60,8 @@ class GetCommand extends Command {
59
60
  if (mesh) {
60
61
  this.log('Successfully retrieved mesh %s', JSON.stringify(mesh, null, 2));
61
62
 
63
+ const meshUrl = buildMeshUrl(meshId, workspaceName);
64
+
62
65
  if (args.file) {
63
66
  try {
64
67
  const { meshConfig } = mesh;
@@ -72,7 +75,7 @@ class GetCommand extends Command {
72
75
  }
73
76
  }
74
77
 
75
- return mesh;
78
+ return { ...mesh, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
76
79
  } else {
77
80
  logger.error(
78
81
  `Unable to get mesh with the ID ${meshId}. Please check the mesh ID and try again. RequestId: ${global.requestId}`,