@adobe/aio-cli-plugin-api-mesh 5.0.0-alpha → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  });
@@ -1399,36 +1454,39 @@ describe('create command tests', () => {
1399
1454
  `);
1400
1455
  expect(output).toMatchInlineSnapshot(`
1401
1456
  {
1402
- "mesh": {
1403
- "meshConfig": {
1404
- "files": [
1405
- {
1406
- "content": "{"type":"dummyContent"}",
1407
- "path": "./schemaBody.json",
1408
- },
1409
- ],
1410
- "sources": [
1411
- {
1412
- "handler": {
1413
- "JsonSchema": {
1414
- "baseUrl": "<json_source__baseurl>",
1415
- "operations": [
1416
- {
1417
- "field": "<query>",
1418
- "method": "POST",
1419
- "path": "<query_path>",
1420
- "requestSchema": "./schemaBody.json",
1421
- "type": "Query",
1422
- },
1423
- ],
1424
- },
1457
+ "imsOrgId": "1234",
1458
+ "meshConfig": {
1459
+ "files": [
1460
+ {
1461
+ "content": "{"type":"dummyContent"}",
1462
+ "path": "./schemaBody.json",
1463
+ },
1464
+ ],
1465
+ "sources": [
1466
+ {
1467
+ "handler": {
1468
+ "JsonSchema": {
1469
+ "baseUrl": "<json_source__baseurl>",
1470
+ "operations": [
1471
+ {
1472
+ "field": "<query>",
1473
+ "method": "POST",
1474
+ "path": "<query_path>",
1475
+ "requestSchema": "./schemaBody.json",
1476
+ "type": "Query",
1477
+ },
1478
+ ],
1425
1479
  },
1426
- "name": "<json_source_name>",
1427
1480
  },
1428
- ],
1429
- },
1430
- "meshId": "dummy_mesh_id",
1481
+ "name": "<json_source_name>",
1482
+ },
1483
+ ],
1431
1484
  },
1485
+ "meshId": "dummy_mesh_id",
1486
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1487
+ "projectId": "5678",
1488
+ "workspaceId": "123456789",
1489
+ "workspaceName": "Workspace01",
1432
1490
  }
1433
1491
  `);
1434
1492
  });
@@ -1524,36 +1582,39 @@ describe('create command tests', () => {
1524
1582
  `);
1525
1583
  expect(output).toMatchInlineSnapshot(`
1526
1584
  {
1527
- "mesh": {
1528
- "meshConfig": {
1529
- "files": [
1530
- {
1531
- "content": "{"type":"updatedContent"}",
1532
- "path": "./files/requestParams.json",
1533
- },
1534
- ],
1535
- "sources": [
1536
- {
1537
- "handler": {
1538
- "JsonSchema": {
1539
- "baseUrl": "<json_source__baseurl>",
1540
- "operations": [
1541
- {
1542
- "field": "<query>",
1543
- "method": "POST",
1544
- "path": "<query_path>",
1545
- "requestSchema": "./files/requestParams.json",
1546
- "type": "Query",
1547
- },
1548
- ],
1549
- },
1585
+ "imsOrgId": "1234",
1586
+ "meshConfig": {
1587
+ "files": [
1588
+ {
1589
+ "content": "{"type":"updatedContent"}",
1590
+ "path": "./files/requestParams.json",
1591
+ },
1592
+ ],
1593
+ "sources": [
1594
+ {
1595
+ "handler": {
1596
+ "JsonSchema": {
1597
+ "baseUrl": "<json_source__baseurl>",
1598
+ "operations": [
1599
+ {
1600
+ "field": "<query>",
1601
+ "method": "POST",
1602
+ "path": "<query_path>",
1603
+ "requestSchema": "./files/requestParams.json",
1604
+ "type": "Query",
1605
+ },
1606
+ ],
1550
1607
  },
1551
- "name": "<json_source_name>",
1552
1608
  },
1553
- ],
1554
- },
1555
- "meshId": "dummy_mesh_id",
1609
+ "name": "<json_source_name>",
1610
+ },
1611
+ ],
1556
1612
  },
1613
+ "meshId": "dummy_mesh_id",
1614
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1615
+ "projectId": "5678",
1616
+ "workspaceId": "123456789",
1617
+ "workspaceName": "Workspace01",
1557
1618
  }
1558
1619
  `);
1559
1620
  });
@@ -1762,21 +1823,24 @@ describe('create command tests', () => {
1762
1823
  const runResult = await CreateCommand.run();
1763
1824
  expect(runResult).toMatchInlineSnapshot(`
1764
1825
  {
1765
- "mesh": {
1766
- "meshConfig": {
1767
- "sources": [
1768
- {
1769
- "handler": {
1770
- "graphql": {
1771
- "endpoint": "<gql_endpoint>",
1772
- },
1826
+ "imsOrgId": "1234",
1827
+ "meshConfig": {
1828
+ "sources": [
1829
+ {
1830
+ "handler": {
1831
+ "graphql": {
1832
+ "endpoint": "<gql_endpoint>",
1773
1833
  },
1774
- "name": "<api_name>",
1775
1834
  },
1776
- ],
1777
- },
1778
- "meshId": "dummy_mesh_id",
1835
+ "name": "<api_name>",
1836
+ },
1837
+ ],
1779
1838
  },
1839
+ "meshId": "dummy_mesh_id",
1840
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1841
+ "projectId": "5678",
1842
+ "workspaceId": "123456789",
1843
+ "workspaceName": "Workspace01",
1780
1844
  }
1781
1845
  `);
1782
1846
  });
@@ -1832,21 +1896,24 @@ describe('create command tests', () => {
1832
1896
  const runResult = await CreateCommand.run();
1833
1897
  expect(runResult).toMatchInlineSnapshot(`
1834
1898
  {
1835
- "mesh": {
1836
- "meshConfig": {
1837
- "sources": [
1838
- {
1839
- "handler": {
1840
- "graphql": {
1841
- "endpoint": "<gql_endpoint>",
1842
- },
1899
+ "imsOrgId": "1234",
1900
+ "meshConfig": {
1901
+ "sources": [
1902
+ {
1903
+ "handler": {
1904
+ "graphql": {
1905
+ "endpoint": "<gql_endpoint>",
1843
1906
  },
1844
- "name": "<api_name>",
1845
1907
  },
1846
- ],
1847
- },
1848
- "meshId": "dummy_mesh_id",
1908
+ "name": "<api_name>",
1909
+ },
1910
+ ],
1849
1911
  },
1912
+ "meshId": "dummy_mesh_id",
1913
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1914
+ "projectId": "5678",
1915
+ "workspaceId": "123456789",
1916
+ "workspaceName": "Workspace01",
1850
1917
  }
1851
1918
  `);
1852
1919
  });
@@ -1869,21 +1936,24 @@ describe('create command tests', () => {
1869
1936
  const runResult = await CreateCommand.run();
1870
1937
  expect(runResult).toMatchInlineSnapshot(`
1871
1938
  {
1872
- "mesh": {
1873
- "meshConfig": {
1874
- "sources": [
1875
- {
1876
- "handler": {
1877
- "graphql": {
1878
- "endpoint": "<gql_endpoint>",
1879
- },
1939
+ "imsOrgId": "1234",
1940
+ "meshConfig": {
1941
+ "sources": [
1942
+ {
1943
+ "handler": {
1944
+ "graphql": {
1945
+ "endpoint": "<gql_endpoint>",
1880
1946
  },
1881
- "name": "<api_name>",
1882
1947
  },
1883
- ],
1884
- },
1885
- "meshId": "dummy_mesh_id",
1948
+ "name": "<api_name>",
1949
+ },
1950
+ ],
1886
1951
  },
1952
+ "meshId": "dummy_mesh_id",
1953
+ "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_mesh_id/graphql",
1954
+ "projectId": "5678",
1955
+ "workspaceId": "123456789",
1956
+ "workspaceName": "Workspace01",
1887
1957
  }
1888
1958
  `);
1889
1959
  });
@@ -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(`