@adobe/aio-cli-plugin-api-mesh 4.1.0-alpha → 4.1.0-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.
- package/oclif.manifest.json +1 -1
- package/package.json +8 -4
- package/src/commands/api-mesh/__tests__/create.test.js +293 -217
- package/src/commands/api-mesh/__tests__/delete.test.js +6 -6
- package/src/commands/api-mesh/__tests__/describe.test.js +17 -2
- package/src/commands/api-mesh/__tests__/get.test.js +78 -9
- package/src/commands/api-mesh/__tests__/run.test.js +25 -22
- package/src/commands/api-mesh/__tests__/status.test.js +1 -1
- package/src/commands/api-mesh/__tests__/update.test.js +9 -8
- package/src/commands/api-mesh/create.js +9 -6
- package/src/commands/api-mesh/delete.js +5 -5
- package/src/commands/api-mesh/describe.js +3 -3
- package/src/commands/api-mesh/get.js +11 -8
- package/src/commands/api-mesh/run.js +35 -10
- package/src/commands/api-mesh/status.js +4 -4
- package/src/commands/api-mesh/update.js +9 -7
- package/src/constants.js +0 -2
- package/src/cors.js +28 -0
- package/src/fixPlugins.js +28 -0
- package/src/index.js +44 -0
- package/src/lib/devConsole.js +32 -38
- package/src/plugins/complianceHeaders/complianceHeaders.js +55 -0
- package/src/plugins/complianceHeaders/index.js +2 -0
- package/src/plugins/httpDetailsExtensions/LICENSE +21 -0
- package/src/plugins/httpDetailsExtensions/index.js +81 -0
- package/src/secrets.js +34 -0
- package/src/served.js +22 -0
- package/src/server.js +30 -198
- package/src/serverUtils.js +3 -3
- package/src/wranglerServer.js +75 -0
|
@@ -159,8 +159,28 @@ describe('create command tests', () => {
|
|
|
159
159
|
},
|
|
160
160
|
});
|
|
161
161
|
const output = await CreateCommand.run();
|
|
162
|
-
expect(output).
|
|
163
|
-
|
|
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
|
-
"
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
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
|
});
|
|
@@ -295,7 +318,7 @@ describe('create command tests', () => {
|
|
|
295
318
|
const runResult = CreateCommand.run();
|
|
296
319
|
await expect(runResult).rejects.toEqual(
|
|
297
320
|
new Error(
|
|
298
|
-
'Unable to create a mesh.
|
|
321
|
+
'Unable to create a mesh. Please check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id',
|
|
299
322
|
),
|
|
300
323
|
);
|
|
301
324
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -308,7 +331,7 @@ describe('create command tests', () => {
|
|
|
308
331
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
309
332
|
[
|
|
310
333
|
[
|
|
311
|
-
"Unable to create a mesh.
|
|
334
|
+
"Unable to create a mesh. Please check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id",
|
|
312
335
|
],
|
|
313
336
|
]
|
|
314
337
|
`);
|
|
@@ -320,7 +343,7 @@ describe('create command tests', () => {
|
|
|
320
343
|
expect(initRequestId).toHaveBeenCalled();
|
|
321
344
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
322
345
|
[
|
|
323
|
-
"
|
|
346
|
+
"1234",
|
|
324
347
|
"5678",
|
|
325
348
|
"123456789",
|
|
326
349
|
"Workspace01",
|
|
@@ -344,21 +367,24 @@ describe('create command tests', () => {
|
|
|
344
367
|
`);
|
|
345
368
|
expect(runResult).toMatchInlineSnapshot(`
|
|
346
369
|
{
|
|
347
|
-
"
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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
|
-
|
|
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(`
|
|
@@ -399,7 +425,7 @@ describe('create command tests', () => {
|
|
|
399
425
|
expect(initRequestId).toHaveBeenCalled();
|
|
400
426
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
401
427
|
[
|
|
402
|
-
"
|
|
428
|
+
"1234",
|
|
403
429
|
"5678",
|
|
404
430
|
"123456789",
|
|
405
431
|
"Workspace01",
|
|
@@ -424,21 +450,24 @@ describe('create command tests', () => {
|
|
|
424
450
|
|
|
425
451
|
expect(runResult).toMatchInlineSnapshot(`
|
|
426
452
|
{
|
|
427
|
-
"
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
-
|
|
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).
|
|
592
|
-
|
|
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
|
-
"
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
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
|
-
|
|
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
|
});
|
|
@@ -787,13 +839,13 @@ describe('create command tests', () => {
|
|
|
787
839
|
|
|
788
840
|
const runResult = CreateCommand.run();
|
|
789
841
|
await expect(runResult).rejects.toEqual(
|
|
790
|
-
new Error('Input mesh file is not a valid JSON.
|
|
842
|
+
new Error('Input mesh file is not a valid JSON. Please check the file provided.'),
|
|
791
843
|
);
|
|
792
844
|
|
|
793
845
|
await expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
794
846
|
[
|
|
795
847
|
[
|
|
796
|
-
"Input mesh file is not a valid JSON.
|
|
848
|
+
"Input mesh file is not a valid JSON. Please check the file provided.",
|
|
797
849
|
],
|
|
798
850
|
]
|
|
799
851
|
`);
|
|
@@ -851,7 +903,7 @@ describe('create command tests', () => {
|
|
|
851
903
|
expect(initRequestId).toHaveBeenCalled();
|
|
852
904
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
853
905
|
[
|
|
854
|
-
"
|
|
906
|
+
"1234",
|
|
855
907
|
"5678",
|
|
856
908
|
"123456789",
|
|
857
909
|
"Workspace01",
|
|
@@ -891,36 +943,39 @@ describe('create command tests', () => {
|
|
|
891
943
|
|
|
892
944
|
expect(output).toMatchInlineSnapshot(`
|
|
893
945
|
{
|
|
894
|
-
"
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
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
|
-
|
|
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
|
});
|
|
@@ -998,7 +1053,9 @@ describe('create command tests', () => {
|
|
|
998
1053
|
|
|
999
1054
|
const output = CreateCommand.run();
|
|
1000
1055
|
await expect(output).rejects.toEqual(
|
|
1001
|
-
new Error(
|
|
1056
|
+
new Error(
|
|
1057
|
+
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1058
|
+
),
|
|
1002
1059
|
);
|
|
1003
1060
|
|
|
1004
1061
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1012,7 +1069,7 @@ describe('create command tests', () => {
|
|
|
1012
1069
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1013
1070
|
[
|
|
1014
1071
|
[
|
|
1015
|
-
"Unable to import the files in the mesh config.
|
|
1072
|
+
"Unable to import the files in the mesh config. Please check the file and try again.",
|
|
1016
1073
|
],
|
|
1017
1074
|
]
|
|
1018
1075
|
`);
|
|
@@ -1033,7 +1090,9 @@ describe('create command tests', () => {
|
|
|
1033
1090
|
const output = CreateCommand.run();
|
|
1034
1091
|
|
|
1035
1092
|
await expect(output).rejects.toEqual(
|
|
1036
|
-
new Error(
|
|
1093
|
+
new Error(
|
|
1094
|
+
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1095
|
+
),
|
|
1037
1096
|
);
|
|
1038
1097
|
|
|
1039
1098
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1047,7 +1106,7 @@ describe('create command tests', () => {
|
|
|
1047
1106
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1048
1107
|
[
|
|
1049
1108
|
[
|
|
1050
|
-
"Unable to import the files in the mesh config.
|
|
1109
|
+
"Unable to import the files in the mesh config. Please check the file and try again.",
|
|
1051
1110
|
],
|
|
1052
1111
|
]
|
|
1053
1112
|
`);
|
|
@@ -1360,7 +1419,7 @@ describe('create command tests', () => {
|
|
|
1360
1419
|
expect(initRequestId).toHaveBeenCalled();
|
|
1361
1420
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
1362
1421
|
[
|
|
1363
|
-
"
|
|
1422
|
+
"1234",
|
|
1364
1423
|
"5678",
|
|
1365
1424
|
"123456789",
|
|
1366
1425
|
"Workspace01",
|
|
@@ -1399,36 +1458,39 @@ describe('create command tests', () => {
|
|
|
1399
1458
|
`);
|
|
1400
1459
|
expect(output).toMatchInlineSnapshot(`
|
|
1401
1460
|
{
|
|
1402
|
-
"
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
},
|
|
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
|
+
],
|
|
1425
1483
|
},
|
|
1426
|
-
"name": "<json_source_name>",
|
|
1427
1484
|
},
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1485
|
+
"name": "<json_source_name>",
|
|
1486
|
+
},
|
|
1487
|
+
],
|
|
1431
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",
|
|
1432
1494
|
}
|
|
1433
1495
|
`);
|
|
1434
1496
|
});
|
|
@@ -1485,7 +1547,7 @@ describe('create command tests', () => {
|
|
|
1485
1547
|
expect(initRequestId).toHaveBeenCalled();
|
|
1486
1548
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
1487
1549
|
[
|
|
1488
|
-
"
|
|
1550
|
+
"1234",
|
|
1489
1551
|
"5678",
|
|
1490
1552
|
"123456789",
|
|
1491
1553
|
"Workspace01",
|
|
@@ -1524,36 +1586,39 @@ describe('create command tests', () => {
|
|
|
1524
1586
|
`);
|
|
1525
1587
|
expect(output).toMatchInlineSnapshot(`
|
|
1526
1588
|
{
|
|
1527
|
-
"
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
},
|
|
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
|
+
],
|
|
1550
1611
|
},
|
|
1551
|
-
"name": "<json_source_name>",
|
|
1552
1612
|
},
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1613
|
+
"name": "<json_source_name>",
|
|
1614
|
+
},
|
|
1615
|
+
],
|
|
1556
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",
|
|
1557
1622
|
}
|
|
1558
1623
|
`);
|
|
1559
1624
|
});
|
|
@@ -1600,7 +1665,9 @@ describe('create command tests', () => {
|
|
|
1600
1665
|
const output = CreateCommand.run();
|
|
1601
1666
|
|
|
1602
1667
|
await expect(output).rejects.toEqual(
|
|
1603
|
-
new Error(
|
|
1668
|
+
new Error(
|
|
1669
|
+
'Unable to import the files in the mesh config. Please check the file and try again.',
|
|
1670
|
+
),
|
|
1604
1671
|
);
|
|
1605
1672
|
|
|
1606
1673
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1614,7 +1681,7 @@ describe('create command tests', () => {
|
|
|
1614
1681
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1615
1682
|
[
|
|
1616
1683
|
[
|
|
1617
|
-
"Unable to import the files in the mesh config.
|
|
1684
|
+
"Unable to import the files in the mesh config. Please check the file and try again.",
|
|
1618
1685
|
],
|
|
1619
1686
|
]
|
|
1620
1687
|
`);
|
|
@@ -1700,13 +1767,13 @@ describe('create command tests', () => {
|
|
|
1700
1767
|
const runResult = CreateCommand.run();
|
|
1701
1768
|
|
|
1702
1769
|
await expect(runResult).rejects.toEqual(
|
|
1703
|
-
new Error('Unable to import secrets.
|
|
1770
|
+
new Error('Unable to import secrets. Please check the file and try again.'),
|
|
1704
1771
|
);
|
|
1705
1772
|
|
|
1706
1773
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1707
1774
|
[
|
|
1708
1775
|
[
|
|
1709
|
-
"Unable to import secrets.
|
|
1776
|
+
"Unable to import secrets. Please check the file and try again.",
|
|
1710
1777
|
],
|
|
1711
1778
|
]
|
|
1712
1779
|
`);
|
|
@@ -1725,7 +1792,7 @@ describe('create command tests', () => {
|
|
|
1725
1792
|
const runResult = CreateCommand.run();
|
|
1726
1793
|
|
|
1727
1794
|
await expect(runResult).rejects.toEqual(
|
|
1728
|
-
new Error('Unable to import secrets.
|
|
1795
|
+
new Error('Unable to import secrets. Please check the file and try again.'),
|
|
1729
1796
|
);
|
|
1730
1797
|
|
|
1731
1798
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1739,7 +1806,7 @@ describe('create command tests', () => {
|
|
|
1739
1806
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1740
1807
|
[
|
|
1741
1808
|
[
|
|
1742
|
-
"Unable to import secrets.
|
|
1809
|
+
"Unable to import secrets. Please check the file and try again.",
|
|
1743
1810
|
],
|
|
1744
1811
|
]
|
|
1745
1812
|
`);
|
|
@@ -1762,21 +1829,24 @@ describe('create command tests', () => {
|
|
|
1762
1829
|
const runResult = await CreateCommand.run();
|
|
1763
1830
|
expect(runResult).toMatchInlineSnapshot(`
|
|
1764
1831
|
{
|
|
1765
|
-
"
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
},
|
|
1832
|
+
"imsOrgId": "1234",
|
|
1833
|
+
"meshConfig": {
|
|
1834
|
+
"sources": [
|
|
1835
|
+
{
|
|
1836
|
+
"handler": {
|
|
1837
|
+
"graphql": {
|
|
1838
|
+
"endpoint": "<gql_endpoint>",
|
|
1773
1839
|
},
|
|
1774
|
-
"name": "<api_name>",
|
|
1775
1840
|
},
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1841
|
+
"name": "<api_name>",
|
|
1842
|
+
},
|
|
1843
|
+
],
|
|
1779
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",
|
|
1780
1850
|
}
|
|
1781
1851
|
`);
|
|
1782
1852
|
});
|
|
@@ -1795,7 +1865,7 @@ describe('create command tests', () => {
|
|
|
1795
1865
|
const runResult = CreateCommand.run();
|
|
1796
1866
|
|
|
1797
1867
|
await expect(runResult).rejects.toEqual(
|
|
1798
|
-
new Error('Unable to import secrets.
|
|
1868
|
+
new Error('Unable to import secrets. Please check the file and try again.'),
|
|
1799
1869
|
);
|
|
1800
1870
|
|
|
1801
1871
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
@@ -1808,7 +1878,7 @@ describe('create command tests', () => {
|
|
|
1808
1878
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1809
1879
|
[
|
|
1810
1880
|
[
|
|
1811
|
-
"Unable to import secrets.
|
|
1881
|
+
"Unable to import secrets. Please check the file and try again.",
|
|
1812
1882
|
],
|
|
1813
1883
|
]
|
|
1814
1884
|
`);
|
|
@@ -1832,21 +1902,24 @@ describe('create command tests', () => {
|
|
|
1832
1902
|
const runResult = await CreateCommand.run();
|
|
1833
1903
|
expect(runResult).toMatchInlineSnapshot(`
|
|
1834
1904
|
{
|
|
1835
|
-
"
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
},
|
|
1905
|
+
"imsOrgId": "1234",
|
|
1906
|
+
"meshConfig": {
|
|
1907
|
+
"sources": [
|
|
1908
|
+
{
|
|
1909
|
+
"handler": {
|
|
1910
|
+
"graphql": {
|
|
1911
|
+
"endpoint": "<gql_endpoint>",
|
|
1843
1912
|
},
|
|
1844
|
-
"name": "<api_name>",
|
|
1845
1913
|
},
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1914
|
+
"name": "<api_name>",
|
|
1915
|
+
},
|
|
1916
|
+
],
|
|
1849
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",
|
|
1850
1923
|
}
|
|
1851
1924
|
`);
|
|
1852
1925
|
});
|
|
@@ -1869,21 +1942,24 @@ describe('create command tests', () => {
|
|
|
1869
1942
|
const runResult = await CreateCommand.run();
|
|
1870
1943
|
expect(runResult).toMatchInlineSnapshot(`
|
|
1871
1944
|
{
|
|
1872
|
-
"
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
},
|
|
1945
|
+
"imsOrgId": "1234",
|
|
1946
|
+
"meshConfig": {
|
|
1947
|
+
"sources": [
|
|
1948
|
+
{
|
|
1949
|
+
"handler": {
|
|
1950
|
+
"graphql": {
|
|
1951
|
+
"endpoint": "<gql_endpoint>",
|
|
1880
1952
|
},
|
|
1881
|
-
"name": "<api_name>",
|
|
1882
1953
|
},
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1954
|
+
"name": "<api_name>",
|
|
1955
|
+
},
|
|
1956
|
+
],
|
|
1886
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",
|
|
1887
1963
|
}
|
|
1888
1964
|
`);
|
|
1889
1965
|
});
|
|
@@ -1904,7 +1980,7 @@ describe('create command tests', () => {
|
|
|
1904
1980
|
|
|
1905
1981
|
const runResult = CreateCommand.run();
|
|
1906
1982
|
await expect(runResult).rejects.toEqual(
|
|
1907
|
-
new Error('Unable to import secrets.
|
|
1983
|
+
new Error('Unable to import secrets. Please check the file and try again.'),
|
|
1908
1984
|
);
|
|
1909
1985
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
1910
1986
|
[
|