@adobe/aio-cli-plugin-api-mesh 1.5.0 → 2.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.
- package/README.md +4 -3
- package/oclif.manifest.json +1 -1
- package/package.json +15 -15
- package/src/commands/api-mesh/__tests__/create.test.js +121 -139
- package/src/commands/api-mesh/__tests__/delete.test.js +40 -40
- package/src/commands/api-mesh/__tests__/describe.test.js +30 -40
- package/src/commands/api-mesh/__tests__/get.test.js +60 -69
- package/src/commands/api-mesh/__tests__/update.test.js +71 -35
- package/src/commands/api-mesh/create.js +17 -6
- package/src/commands/api-mesh/describe.js +1 -1
- package/src/commands/api-mesh/get.js +1 -1
- package/src/commands/api-mesh/source/__fixtures__/0.0.1-test-01.json +1 -1
- package/src/commands/api-mesh/source/__fixtures__/0.0.1-test-02.json +1 -1
- package/src/commands/api-mesh/source/__tests__/discover.test.js +2 -2
- package/src/commands/api-mesh/source/__tests__/get.test.js +19 -16
- package/src/commands/api-mesh/source/__tests__/install.test.js +14 -14
- package/src/commands/api-mesh/source/discover.js +24 -18
- package/src/commands/api-mesh/source/get.js +15 -11
- package/src/commands/api-mesh/source/install.js +49 -41
- package/src/commands/api-mesh/status.js +96 -0
- package/src/commands/api-mesh/update.js +12 -1
- package/src/constants.js +2 -0
- package/src/helpers.js +16 -10
- package/src/utils.js +2 -4
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ aio api-mesh:get PATH_OF_FILE_TO_DOWNLOAD_INTO
|
|
|
74
74
|
aio api-mesh:create PATH_OF_MESH_CONFIG_JSON_FILE
|
|
75
75
|
aio api-mesh:update PATH_OF_MESH_CONFIG_JSON_FILE
|
|
76
76
|
aio api-mesh:delete
|
|
77
|
+
aio api-mesh:status
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
All commands support `-i` or `--ignoreCache` flag that will force the CLI to ignore the cached Org, Project and Workspace details and prompt the user to select new options just for that action.
|
|
@@ -82,11 +83,10 @@ Create, Update and Delete support `-c` or `--autoConfirmAction` flag that will n
|
|
|
82
83
|
|
|
83
84
|
# Sources Registry
|
|
84
85
|
|
|
85
|
-
Source registry is a collection of predefined sources (API mesh source configurations) that are created to solve specific use cases. The source can be installed for customer-specific API mesh configuration.
|
|
86
|
+
Source registry is a collection of predefined sources (API mesh source configurations) that are created to solve specific use cases. The source can be installed for customer-specific API mesh configuration.
|
|
86
87
|
|
|
87
88
|
To submit a new source, please follow the instructions provided in the [Source Registry](https://github.com/adobe/api-mesh-sources/) repository.
|
|
88
89
|
|
|
89
|
-
|
|
90
90
|
## Commands
|
|
91
91
|
|
|
92
92
|
```
|
|
@@ -97,13 +97,14 @@ aio api-mesh:source:install SOURCE_NAME -f PATH_TO_FILE_WITH_VARIABLES
|
|
|
97
97
|
|
|
98
98
|
aio api-mesh:source:get SOURCE_NAME
|
|
99
99
|
aio api-mesh:source:get SOURCE_NAME@VERSION_OF_THE_SOURCE
|
|
100
|
-
aio api-mesh:source:get -m
|
|
100
|
+
aio api-mesh:source:get -m
|
|
101
101
|
aio api-mesh:source:discover
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
The "source:get" command accept multiple sources per one call.
|
|
105
105
|
|
|
106
106
|
Example:
|
|
107
|
+
|
|
107
108
|
```
|
|
108
109
|
aio api-mesh:source:get -m <NAME_OF_THE_SOURCE>@<VERSION_OF_THE_SOURC><NAME_OF_THE_SECOND_SOURCE>@<VERSION_OF_THE_SOURC>
|
|
109
110
|
<NAME_OF_THE_THIRD_SOURCE>@<VERSION_OF_THE_SOURC>
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"2.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}},"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}},"args":[{"name":"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}},"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,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-plugin-api-mesh",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@adobe/aio-cli-lib-console": "^
|
|
9
|
-
"@adobe/aio-lib-core-config": "^
|
|
10
|
-
"@adobe/aio-lib-core-logging": "^
|
|
11
|
-
"@adobe/aio-lib-env": "^
|
|
12
|
-
"@adobe/aio-lib-ims": "^
|
|
8
|
+
"@adobe/aio-cli-lib-console": "^4.0.0",
|
|
9
|
+
"@adobe/aio-lib-core-config": "^3.0.0",
|
|
10
|
+
"@adobe/aio-lib-core-logging": "^2.0.0",
|
|
11
|
+
"@adobe/aio-lib-env": "^2.0.0",
|
|
12
|
+
"@adobe/aio-lib-ims": "^6.0.1",
|
|
13
13
|
"@oclif/command": "^1.6.1",
|
|
14
14
|
"@oclif/config": "^1.15.1",
|
|
15
15
|
"@oclif/core": "^1.14.1",
|
|
16
16
|
"@oclif/errors": "^1.1.2",
|
|
17
|
-
"axios": "^
|
|
17
|
+
"axios": "^1.2.0",
|
|
18
18
|
"chalk": "^4.1.0",
|
|
19
19
|
"dotenv": "^16.0.1",
|
|
20
|
+
"fs-extra": "^11.1.0",
|
|
20
21
|
"inquirer": "^8.2.4",
|
|
21
22
|
"json-interpolate": "^1.0.3",
|
|
22
23
|
"node-clipboardy": "^1.0.3",
|
|
@@ -26,32 +27,31 @@
|
|
|
26
27
|
"uuid": "^8.3.2"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@adobe/eslint-config-aio-lib-config": "^1.4.0",
|
|
30
30
|
"@babel/eslint-parser": "^7.15.8",
|
|
31
31
|
"@oclif/dev-cli": "1.26.10",
|
|
32
32
|
"@oclif/plugin-help": "2.2.3",
|
|
33
33
|
"@trivago/prettier-plugin-sort-imports": "^3.1.1",
|
|
34
34
|
"acorn": "7.4.1",
|
|
35
|
-
"eslint": "
|
|
35
|
+
"eslint": "^8",
|
|
36
36
|
"eslint-config-oclif": "^3.1.0",
|
|
37
37
|
"eslint-config-prettier": "^8.3.0",
|
|
38
|
-
"eslint-config-standard": "^
|
|
38
|
+
"eslint-config-standard": "^17.0.0",
|
|
39
39
|
"eslint-plugin-import": "^2.21.2",
|
|
40
40
|
"eslint-plugin-jest": "^23.13.2",
|
|
41
|
-
"eslint-plugin-jsdoc": "^37.0.0",
|
|
42
41
|
"eslint-plugin-node": "^11.0.0",
|
|
43
42
|
"eslint-plugin-prettier": "^4.0.0",
|
|
44
|
-
"eslint-plugin-promise": "^
|
|
45
|
-
"eslint-plugin-standard": "^
|
|
43
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
44
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
46
45
|
"execa": "4.1.0",
|
|
47
46
|
"husky": "7.0.4",
|
|
48
|
-
"jest": "
|
|
47
|
+
"jest": "^29.2.2",
|
|
49
48
|
"jest-junit": "^6.0.0",
|
|
50
49
|
"prettier": "2.2.1",
|
|
51
50
|
"stdout-stderr": "^0.1.9"
|
|
52
51
|
},
|
|
53
52
|
"engines": {
|
|
54
|
-
"
|
|
53
|
+
"npm": ">=8.0.0",
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
57
|
"/oclif.manifest.json",
|
|
@@ -93,15 +93,15 @@ describe('create command tests', () => {
|
|
|
93
93
|
`"Create a mesh with the given config."`,
|
|
94
94
|
);
|
|
95
95
|
expect(CreateCommand.args).toMatchInlineSnapshot(`
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
[
|
|
97
|
+
{
|
|
98
98
|
"name": "file",
|
|
99
99
|
},
|
|
100
100
|
]
|
|
101
101
|
`);
|
|
102
102
|
expect(CreateCommand.flags).toMatchInlineSnapshot(`
|
|
103
|
-
|
|
104
|
-
"autoConfirmAction":
|
|
103
|
+
{
|
|
104
|
+
"autoConfirmAction": {
|
|
105
105
|
"allowNo": false,
|
|
106
106
|
"char": "c",
|
|
107
107
|
"default": false,
|
|
@@ -109,7 +109,7 @@ describe('create command tests', () => {
|
|
|
109
109
|
"parse": [Function],
|
|
110
110
|
"type": "boolean",
|
|
111
111
|
},
|
|
112
|
-
"ignoreCache":
|
|
112
|
+
"ignoreCache": {
|
|
113
113
|
"allowNo": false,
|
|
114
114
|
"char": "i",
|
|
115
115
|
"default": false,
|
|
@@ -117,7 +117,7 @@ describe('create command tests', () => {
|
|
|
117
117
|
"parse": [Function],
|
|
118
118
|
"type": "boolean",
|
|
119
119
|
},
|
|
120
|
-
"json":
|
|
120
|
+
"json": {
|
|
121
121
|
"allowNo": false,
|
|
122
122
|
"default": false,
|
|
123
123
|
"description": "Output JSON",
|
|
@@ -126,7 +126,7 @@ describe('create command tests', () => {
|
|
|
126
126
|
},
|
|
127
127
|
}
|
|
128
128
|
`);
|
|
129
|
-
expect(CreateCommand.aliases).toMatchInlineSnapshot(`
|
|
129
|
+
expect(CreateCommand.aliases).toMatchInlineSnapshot(`[]`);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
test('should fail if mesh config file arg is missing', async () => {
|
|
@@ -142,10 +142,10 @@ describe('create command tests', () => {
|
|
|
142
142
|
await expect(runResult).rejects.toEqual(
|
|
143
143
|
new Error('Missing file path. Run aio api-mesh create --help for more info.'),
|
|
144
144
|
);
|
|
145
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
145
|
+
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
146
146
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
[
|
|
148
|
+
[
|
|
149
149
|
"Missing file path. Run aio api-mesh create --help for more info.",
|
|
150
150
|
],
|
|
151
151
|
]
|
|
@@ -168,15 +168,15 @@ describe('create command tests', () => {
|
|
|
168
168
|
),
|
|
169
169
|
);
|
|
170
170
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
[
|
|
172
|
+
[
|
|
173
173
|
"ENOENT: no such file or directory, open 'dummy_file_path'",
|
|
174
174
|
],
|
|
175
175
|
]
|
|
176
176
|
`);
|
|
177
177
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
[
|
|
179
|
+
[
|
|
180
180
|
"Unable to read the mesh configuration file provided. Please check the file and try again.",
|
|
181
181
|
],
|
|
182
182
|
]
|
|
@@ -194,15 +194,15 @@ describe('create command tests', () => {
|
|
|
194
194
|
),
|
|
195
195
|
);
|
|
196
196
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
[
|
|
198
|
+
[
|
|
199
199
|
"create mesh api failed",
|
|
200
200
|
],
|
|
201
201
|
]
|
|
202
202
|
`);
|
|
203
203
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
[
|
|
205
|
+
[
|
|
206
206
|
"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",
|
|
207
207
|
],
|
|
208
208
|
]
|
|
@@ -220,36 +220,31 @@ describe('create command tests', () => {
|
|
|
220
220
|
),
|
|
221
221
|
);
|
|
222
222
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"
|
|
223
|
+
[
|
|
224
|
+
[
|
|
225
|
+
"******************************************************************************************************",
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
226
229
|
"dummy_mesh_id",
|
|
227
230
|
],
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
]
|
|
242
|
-
}
|
|
243
|
-
}",
|
|
244
|
-
],
|
|
245
|
-
Array [
|
|
231
|
+
[
|
|
232
|
+
"To check the status of your mesh, run:",
|
|
233
|
+
],
|
|
234
|
+
[
|
|
235
|
+
"aio api-mesh:status",
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
"******************************************************************************************************",
|
|
239
|
+
],
|
|
240
|
+
[
|
|
246
241
|
"create api credential api failed",
|
|
247
242
|
],
|
|
248
243
|
]
|
|
249
244
|
`);
|
|
250
245
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
[
|
|
247
|
+
[
|
|
253
248
|
"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",
|
|
254
249
|
],
|
|
255
250
|
]
|
|
@@ -269,40 +264,35 @@ describe('create command tests', () => {
|
|
|
269
264
|
),
|
|
270
265
|
);
|
|
271
266
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"
|
|
267
|
+
[
|
|
268
|
+
[
|
|
269
|
+
"******************************************************************************************************",
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
275
273
|
"dummy_mesh_id",
|
|
276
274
|
],
|
|
277
|
-
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
]
|
|
291
|
-
}
|
|
292
|
-
}",
|
|
293
|
-
],
|
|
294
|
-
Array [
|
|
275
|
+
[
|
|
276
|
+
"To check the status of your mesh, run:",
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
"aio api-mesh:status",
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
"******************************************************************************************************",
|
|
283
|
+
],
|
|
284
|
+
[
|
|
295
285
|
"Successfully created API Key %s",
|
|
296
286
|
"dummy_api_key",
|
|
297
287
|
],
|
|
298
|
-
|
|
288
|
+
[
|
|
299
289
|
"subscribe credential to mesh service api failed",
|
|
300
290
|
],
|
|
301
291
|
]
|
|
302
292
|
`);
|
|
303
293
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
304
|
-
|
|
305
|
-
|
|
294
|
+
[
|
|
295
|
+
[
|
|
306
296
|
"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",
|
|
307
297
|
],
|
|
308
298
|
]
|
|
@@ -314,16 +304,16 @@ describe('create command tests', () => {
|
|
|
314
304
|
|
|
315
305
|
expect(initRequestId).toHaveBeenCalled();
|
|
316
306
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
317
|
-
|
|
307
|
+
[
|
|
318
308
|
"1234",
|
|
319
309
|
"5678",
|
|
320
310
|
"123456789",
|
|
321
|
-
|
|
322
|
-
"meshConfig":
|
|
323
|
-
"sources":
|
|
324
|
-
|
|
325
|
-
"handler":
|
|
326
|
-
"graphql":
|
|
311
|
+
{
|
|
312
|
+
"meshConfig": {
|
|
313
|
+
"sources": [
|
|
314
|
+
{
|
|
315
|
+
"handler": {
|
|
316
|
+
"graphql": {
|
|
327
317
|
"endpoint": "<gql_endpoint>",
|
|
328
318
|
},
|
|
329
319
|
},
|
|
@@ -335,14 +325,14 @@ describe('create command tests', () => {
|
|
|
335
325
|
]
|
|
336
326
|
`);
|
|
337
327
|
expect(createAPIMeshCredentials.mock.calls[0]).toMatchInlineSnapshot(`
|
|
338
|
-
|
|
328
|
+
[
|
|
339
329
|
"1234",
|
|
340
330
|
"5678",
|
|
341
331
|
"123456789",
|
|
342
332
|
]
|
|
343
333
|
`);
|
|
344
334
|
expect(subscribeCredentialToMeshService.mock.calls[0]).toMatchInlineSnapshot(`
|
|
345
|
-
|
|
335
|
+
[
|
|
346
336
|
"1234",
|
|
347
337
|
"5678",
|
|
348
338
|
"123456789",
|
|
@@ -350,17 +340,17 @@ describe('create command tests', () => {
|
|
|
350
340
|
]
|
|
351
341
|
`);
|
|
352
342
|
expect(runResult).toMatchInlineSnapshot(`
|
|
353
|
-
|
|
354
|
-
"adobeIdIntegrationsForWorkspace":
|
|
343
|
+
{
|
|
344
|
+
"adobeIdIntegrationsForWorkspace": {
|
|
355
345
|
"apiKey": "dummy_api_key",
|
|
356
346
|
"id": "dummy_id",
|
|
357
347
|
},
|
|
358
|
-
"mesh":
|
|
359
|
-
"meshConfig":
|
|
360
|
-
"sources":
|
|
361
|
-
|
|
362
|
-
"handler":
|
|
363
|
-
"graphql":
|
|
348
|
+
"mesh": {
|
|
349
|
+
"meshConfig": {
|
|
350
|
+
"sources": [
|
|
351
|
+
{
|
|
352
|
+
"handler": {
|
|
353
|
+
"graphql": {
|
|
364
354
|
"endpoint": "<gql_endpoint>",
|
|
365
355
|
},
|
|
366
356
|
},
|
|
@@ -370,50 +360,45 @@ describe('create command tests', () => {
|
|
|
370
360
|
},
|
|
371
361
|
"meshId": "dummy_mesh_id",
|
|
372
362
|
},
|
|
373
|
-
"sdkList":
|
|
363
|
+
"sdkList": [
|
|
374
364
|
"dummy_service",
|
|
375
365
|
],
|
|
376
366
|
}
|
|
377
367
|
`);
|
|
378
368
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
"
|
|
369
|
+
[
|
|
370
|
+
[
|
|
371
|
+
"******************************************************************************************************",
|
|
372
|
+
],
|
|
373
|
+
[
|
|
374
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
382
375
|
"dummy_mesh_id",
|
|
383
376
|
],
|
|
384
|
-
|
|
385
|
-
"
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
]
|
|
398
|
-
}
|
|
399
|
-
}",
|
|
400
|
-
],
|
|
401
|
-
Array [
|
|
377
|
+
[
|
|
378
|
+
"To check the status of your mesh, run:",
|
|
379
|
+
],
|
|
380
|
+
[
|
|
381
|
+
"aio api-mesh:status",
|
|
382
|
+
],
|
|
383
|
+
[
|
|
384
|
+
"******************************************************************************************************",
|
|
385
|
+
],
|
|
386
|
+
[
|
|
402
387
|
"Successfully created API Key %s",
|
|
403
388
|
"dummy_api_key",
|
|
404
389
|
],
|
|
405
|
-
|
|
390
|
+
[
|
|
406
391
|
"Successfully subscribed API Key %s to API Mesh service",
|
|
407
392
|
"dummy_api_key",
|
|
408
393
|
],
|
|
409
|
-
|
|
394
|
+
[
|
|
410
395
|
"Mesh Endpoint: %s
|
|
411
396
|
",
|
|
412
397
|
"https://graph.adobe.io/api/dummy_mesh_id/graphql?api_key=dummy_api_key",
|
|
413
398
|
],
|
|
414
399
|
]
|
|
415
400
|
`);
|
|
416
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
401
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
417
402
|
});
|
|
418
403
|
|
|
419
404
|
test('should not ask for confirmation if autoConfirmAction is provided', async () => {
|
|
@@ -433,44 +418,39 @@ describe('create command tests', () => {
|
|
|
433
418
|
ignoreCache: true,
|
|
434
419
|
});
|
|
435
420
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
"
|
|
421
|
+
[
|
|
422
|
+
[
|
|
423
|
+
"******************************************************************************************************",
|
|
424
|
+
],
|
|
425
|
+
[
|
|
426
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
439
427
|
"dummy_mesh_id",
|
|
440
428
|
],
|
|
441
|
-
|
|
442
|
-
"
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
]
|
|
455
|
-
}
|
|
456
|
-
}",
|
|
457
|
-
],
|
|
458
|
-
Array [
|
|
429
|
+
[
|
|
430
|
+
"To check the status of your mesh, run:",
|
|
431
|
+
],
|
|
432
|
+
[
|
|
433
|
+
"aio api-mesh:status",
|
|
434
|
+
],
|
|
435
|
+
[
|
|
436
|
+
"******************************************************************************************************",
|
|
437
|
+
],
|
|
438
|
+
[
|
|
459
439
|
"Successfully created API Key %s",
|
|
460
440
|
"dummy_api_key",
|
|
461
441
|
],
|
|
462
|
-
|
|
442
|
+
[
|
|
463
443
|
"Successfully subscribed API Key %s to API Mesh service",
|
|
464
444
|
"dummy_api_key",
|
|
465
445
|
],
|
|
466
|
-
|
|
446
|
+
[
|
|
467
447
|
"Mesh Endpoint: %s
|
|
468
448
|
",
|
|
469
449
|
"https://graph.adobe.io/api/dummy_mesh_id/graphql?api_key=dummy_api_key",
|
|
470
450
|
],
|
|
471
451
|
]
|
|
472
452
|
`);
|
|
473
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
453
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
474
454
|
});
|
|
475
455
|
|
|
476
456
|
test('should stop creation if user declines confirmation', async () => {
|
|
@@ -484,26 +464,28 @@ describe('create command tests', () => {
|
|
|
484
464
|
ignoreCache: true,
|
|
485
465
|
});
|
|
486
466
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
487
|
-
|
|
488
|
-
|
|
467
|
+
[
|
|
468
|
+
[
|
|
489
469
|
"Create cancelled",
|
|
490
470
|
],
|
|
491
471
|
]
|
|
492
472
|
`);
|
|
493
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
473
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
494
474
|
});
|
|
495
475
|
|
|
496
476
|
test('must return proper object structure used by adobe/generator-app-api-mesh', async () => {
|
|
497
477
|
parseSpy.mockResolvedValueOnce({
|
|
498
478
|
args: { file: 'src/commands/__fixtures__/sample_mesh.json' },
|
|
499
479
|
flags: {
|
|
500
|
-
json: Promise.resolve(true)
|
|
480
|
+
json: Promise.resolve(true),
|
|
501
481
|
},
|
|
502
482
|
});
|
|
503
|
-
const output = await CreateCommand.run()
|
|
504
|
-
expect(output).toHaveProperty('mesh')
|
|
505
|
-
expect(output).toHaveProperty('adobeIdIntegrationsForWorkspace')
|
|
483
|
+
const output = await CreateCommand.run();
|
|
484
|
+
expect(output).toHaveProperty('mesh');
|
|
485
|
+
expect(output).toHaveProperty('adobeIdIntegrationsForWorkspace');
|
|
506
486
|
expect(output.mesh).toEqual(expect.objectContaining({ meshId: 'dummy_mesh_id' }));
|
|
507
|
-
expect(output.adobeIdIntegrationsForWorkspace).toEqual(
|
|
487
|
+
expect(output.adobeIdIntegrationsForWorkspace).toEqual(
|
|
488
|
+
expect.objectContaining({ apiKey: 'dummy_api_key' }),
|
|
489
|
+
);
|
|
508
490
|
});
|
|
509
491
|
});
|