@adobe/aio-cli-plugin-api-mesh 1.3.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 +16 -16
- package/src/commands/api-mesh/__tests__/create.test.js +136 -133
- 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 +20 -5
- 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 +10 -9
- package/src/commands/api-mesh/source/__tests__/get.test.js +30 -24
- package/src/commands/api-mesh/source/__tests__/install.test.js +27 -11
- package/src/commands/api-mesh/source/discover.js +65 -6
- package/src/commands/api-mesh/source/get.js +28 -15
- package/src/commands/api-mesh/source/install.js +64 -34
- 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 +7 -2
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",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"format": "prettier --check \"./**/*.{ts,tsx,js,css,json,md}\"",
|
|
84
84
|
"format:fix": "prettier --write \"./**/*.{ts,tsx,js,css,json,md}\""
|
|
85
85
|
},
|
|
86
|
-
"description": "
|
|
86
|
+
"description": "Adobe I/O CLI plugin to develop and manage API mesh sources",
|
|
87
87
|
"directories": {
|
|
88
88
|
"test": "test"
|
|
89
89
|
},
|
|
@@ -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,9 +117,16 @@ describe('create command tests', () => {
|
|
|
117
117
|
"parse": [Function],
|
|
118
118
|
"type": "boolean",
|
|
119
119
|
},
|
|
120
|
+
"json": {
|
|
121
|
+
"allowNo": false,
|
|
122
|
+
"default": false,
|
|
123
|
+
"description": "Output JSON",
|
|
124
|
+
"parse": [Function],
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
},
|
|
120
127
|
}
|
|
121
128
|
`);
|
|
122
|
-
expect(CreateCommand.aliases).toMatchInlineSnapshot(`
|
|
129
|
+
expect(CreateCommand.aliases).toMatchInlineSnapshot(`[]`);
|
|
123
130
|
});
|
|
124
131
|
|
|
125
132
|
test('should fail if mesh config file arg is missing', async () => {
|
|
@@ -135,10 +142,10 @@ describe('create command tests', () => {
|
|
|
135
142
|
await expect(runResult).rejects.toEqual(
|
|
136
143
|
new Error('Missing file path. Run aio api-mesh create --help for more info.'),
|
|
137
144
|
);
|
|
138
|
-
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
145
|
+
expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
139
146
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
[
|
|
148
|
+
[
|
|
142
149
|
"Missing file path. Run aio api-mesh create --help for more info.",
|
|
143
150
|
],
|
|
144
151
|
]
|
|
@@ -161,15 +168,15 @@ describe('create command tests', () => {
|
|
|
161
168
|
),
|
|
162
169
|
);
|
|
163
170
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
[
|
|
172
|
+
[
|
|
166
173
|
"ENOENT: no such file or directory, open 'dummy_file_path'",
|
|
167
174
|
],
|
|
168
175
|
]
|
|
169
176
|
`);
|
|
170
177
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
[
|
|
179
|
+
[
|
|
173
180
|
"Unable to read the mesh configuration file provided. Please check the file and try again.",
|
|
174
181
|
],
|
|
175
182
|
]
|
|
@@ -187,15 +194,15 @@ describe('create command tests', () => {
|
|
|
187
194
|
),
|
|
188
195
|
);
|
|
189
196
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
[
|
|
198
|
+
[
|
|
192
199
|
"create mesh api failed",
|
|
193
200
|
],
|
|
194
201
|
]
|
|
195
202
|
`);
|
|
196
203
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
197
|
-
|
|
198
|
-
|
|
204
|
+
[
|
|
205
|
+
[
|
|
199
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",
|
|
200
207
|
],
|
|
201
208
|
]
|
|
@@ -213,36 +220,31 @@ describe('create command tests', () => {
|
|
|
213
220
|
),
|
|
214
221
|
);
|
|
215
222
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"
|
|
223
|
+
[
|
|
224
|
+
[
|
|
225
|
+
"******************************************************************************************************",
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
219
229
|
"dummy_mesh_id",
|
|
220
230
|
],
|
|
221
|
-
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
}",
|
|
237
|
-
],
|
|
238
|
-
Array [
|
|
231
|
+
[
|
|
232
|
+
"To check the status of your mesh, run:",
|
|
233
|
+
],
|
|
234
|
+
[
|
|
235
|
+
"aio api-mesh:status",
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
"******************************************************************************************************",
|
|
239
|
+
],
|
|
240
|
+
[
|
|
239
241
|
"create api credential api failed",
|
|
240
242
|
],
|
|
241
243
|
]
|
|
242
244
|
`);
|
|
243
245
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
[
|
|
247
|
+
[
|
|
246
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",
|
|
247
249
|
],
|
|
248
250
|
]
|
|
@@ -262,40 +264,35 @@ describe('create command tests', () => {
|
|
|
262
264
|
),
|
|
263
265
|
);
|
|
264
266
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
"
|
|
267
|
+
[
|
|
268
|
+
[
|
|
269
|
+
"******************************************************************************************************",
|
|
270
|
+
],
|
|
271
|
+
[
|
|
272
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
268
273
|
"dummy_mesh_id",
|
|
269
274
|
],
|
|
270
|
-
|
|
271
|
-
"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
]
|
|
284
|
-
}
|
|
285
|
-
}",
|
|
286
|
-
],
|
|
287
|
-
Array [
|
|
275
|
+
[
|
|
276
|
+
"To check the status of your mesh, run:",
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
"aio api-mesh:status",
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
"******************************************************************************************************",
|
|
283
|
+
],
|
|
284
|
+
[
|
|
288
285
|
"Successfully created API Key %s",
|
|
289
286
|
"dummy_api_key",
|
|
290
287
|
],
|
|
291
|
-
|
|
288
|
+
[
|
|
292
289
|
"subscribe credential to mesh service api failed",
|
|
293
290
|
],
|
|
294
291
|
]
|
|
295
292
|
`);
|
|
296
293
|
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
297
|
-
|
|
298
|
-
|
|
294
|
+
[
|
|
295
|
+
[
|
|
299
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",
|
|
300
297
|
],
|
|
301
298
|
]
|
|
@@ -307,16 +304,16 @@ describe('create command tests', () => {
|
|
|
307
304
|
|
|
308
305
|
expect(initRequestId).toHaveBeenCalled();
|
|
309
306
|
expect(createMesh.mock.calls[0]).toMatchInlineSnapshot(`
|
|
310
|
-
|
|
307
|
+
[
|
|
311
308
|
"1234",
|
|
312
309
|
"5678",
|
|
313
310
|
"123456789",
|
|
314
|
-
|
|
315
|
-
"meshConfig":
|
|
316
|
-
"sources":
|
|
317
|
-
|
|
318
|
-
"handler":
|
|
319
|
-
"graphql":
|
|
311
|
+
{
|
|
312
|
+
"meshConfig": {
|
|
313
|
+
"sources": [
|
|
314
|
+
{
|
|
315
|
+
"handler": {
|
|
316
|
+
"graphql": {
|
|
320
317
|
"endpoint": "<gql_endpoint>",
|
|
321
318
|
},
|
|
322
319
|
},
|
|
@@ -328,14 +325,14 @@ describe('create command tests', () => {
|
|
|
328
325
|
]
|
|
329
326
|
`);
|
|
330
327
|
expect(createAPIMeshCredentials.mock.calls[0]).toMatchInlineSnapshot(`
|
|
331
|
-
|
|
328
|
+
[
|
|
332
329
|
"1234",
|
|
333
330
|
"5678",
|
|
334
331
|
"123456789",
|
|
335
332
|
]
|
|
336
333
|
`);
|
|
337
334
|
expect(subscribeCredentialToMeshService.mock.calls[0]).toMatchInlineSnapshot(`
|
|
338
|
-
|
|
335
|
+
[
|
|
339
336
|
"1234",
|
|
340
337
|
"5678",
|
|
341
338
|
"123456789",
|
|
@@ -343,17 +340,17 @@ describe('create command tests', () => {
|
|
|
343
340
|
]
|
|
344
341
|
`);
|
|
345
342
|
expect(runResult).toMatchInlineSnapshot(`
|
|
346
|
-
|
|
347
|
-
"adobeIdIntegrationsForWorkspace":
|
|
343
|
+
{
|
|
344
|
+
"adobeIdIntegrationsForWorkspace": {
|
|
348
345
|
"apiKey": "dummy_api_key",
|
|
349
346
|
"id": "dummy_id",
|
|
350
347
|
},
|
|
351
|
-
"mesh":
|
|
352
|
-
"meshConfig":
|
|
353
|
-
"sources":
|
|
354
|
-
|
|
355
|
-
"handler":
|
|
356
|
-
"graphql":
|
|
348
|
+
"mesh": {
|
|
349
|
+
"meshConfig": {
|
|
350
|
+
"sources": [
|
|
351
|
+
{
|
|
352
|
+
"handler": {
|
|
353
|
+
"graphql": {
|
|
357
354
|
"endpoint": "<gql_endpoint>",
|
|
358
355
|
},
|
|
359
356
|
},
|
|
@@ -363,50 +360,45 @@ describe('create command tests', () => {
|
|
|
363
360
|
},
|
|
364
361
|
"meshId": "dummy_mesh_id",
|
|
365
362
|
},
|
|
366
|
-
"sdkList":
|
|
363
|
+
"sdkList": [
|
|
367
364
|
"dummy_service",
|
|
368
365
|
],
|
|
369
366
|
}
|
|
370
367
|
`);
|
|
371
368
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
"
|
|
369
|
+
[
|
|
370
|
+
[
|
|
371
|
+
"******************************************************************************************************",
|
|
372
|
+
],
|
|
373
|
+
[
|
|
374
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
375
375
|
"dummy_mesh_id",
|
|
376
376
|
],
|
|
377
|
-
|
|
378
|
-
"
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
}",
|
|
393
|
-
],
|
|
394
|
-
Array [
|
|
377
|
+
[
|
|
378
|
+
"To check the status of your mesh, run:",
|
|
379
|
+
],
|
|
380
|
+
[
|
|
381
|
+
"aio api-mesh:status",
|
|
382
|
+
],
|
|
383
|
+
[
|
|
384
|
+
"******************************************************************************************************",
|
|
385
|
+
],
|
|
386
|
+
[
|
|
395
387
|
"Successfully created API Key %s",
|
|
396
388
|
"dummy_api_key",
|
|
397
389
|
],
|
|
398
|
-
|
|
390
|
+
[
|
|
399
391
|
"Successfully subscribed API Key %s to API Mesh service",
|
|
400
392
|
"dummy_api_key",
|
|
401
393
|
],
|
|
402
|
-
|
|
394
|
+
[
|
|
403
395
|
"Mesh Endpoint: %s
|
|
404
396
|
",
|
|
405
397
|
"https://graph.adobe.io/api/dummy_mesh_id/graphql?api_key=dummy_api_key",
|
|
406
398
|
],
|
|
407
399
|
]
|
|
408
400
|
`);
|
|
409
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
401
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
410
402
|
});
|
|
411
403
|
|
|
412
404
|
test('should not ask for confirmation if autoConfirmAction is provided', async () => {
|
|
@@ -426,44 +418,39 @@ describe('create command tests', () => {
|
|
|
426
418
|
ignoreCache: true,
|
|
427
419
|
});
|
|
428
420
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
"
|
|
421
|
+
[
|
|
422
|
+
[
|
|
423
|
+
"******************************************************************************************************",
|
|
424
|
+
],
|
|
425
|
+
[
|
|
426
|
+
"Your mesh is being provisioned. Wait a few minutes before checking the status of your mesh %s",
|
|
432
427
|
"dummy_mesh_id",
|
|
433
428
|
],
|
|
434
|
-
|
|
435
|
-
"
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
]
|
|
448
|
-
}
|
|
449
|
-
}",
|
|
450
|
-
],
|
|
451
|
-
Array [
|
|
429
|
+
[
|
|
430
|
+
"To check the status of your mesh, run:",
|
|
431
|
+
],
|
|
432
|
+
[
|
|
433
|
+
"aio api-mesh:status",
|
|
434
|
+
],
|
|
435
|
+
[
|
|
436
|
+
"******************************************************************************************************",
|
|
437
|
+
],
|
|
438
|
+
[
|
|
452
439
|
"Successfully created API Key %s",
|
|
453
440
|
"dummy_api_key",
|
|
454
441
|
],
|
|
455
|
-
|
|
442
|
+
[
|
|
456
443
|
"Successfully subscribed API Key %s to API Mesh service",
|
|
457
444
|
"dummy_api_key",
|
|
458
445
|
],
|
|
459
|
-
|
|
446
|
+
[
|
|
460
447
|
"Mesh Endpoint: %s
|
|
461
448
|
",
|
|
462
449
|
"https://graph.adobe.io/api/dummy_mesh_id/graphql?api_key=dummy_api_key",
|
|
463
450
|
],
|
|
464
451
|
]
|
|
465
452
|
`);
|
|
466
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
453
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
467
454
|
});
|
|
468
455
|
|
|
469
456
|
test('should stop creation if user declines confirmation', async () => {
|
|
@@ -477,12 +464,28 @@ describe('create command tests', () => {
|
|
|
477
464
|
ignoreCache: true,
|
|
478
465
|
});
|
|
479
466
|
expect(logSpy.mock.calls).toMatchInlineSnapshot(`
|
|
480
|
-
|
|
481
|
-
|
|
467
|
+
[
|
|
468
|
+
[
|
|
482
469
|
"Create cancelled",
|
|
483
470
|
],
|
|
484
471
|
]
|
|
485
472
|
`);
|
|
486
|
-
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
|
|
473
|
+
expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`[]`);
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
test('must return proper object structure used by adobe/generator-app-api-mesh', async () => {
|
|
477
|
+
parseSpy.mockResolvedValueOnce({
|
|
478
|
+
args: { file: 'src/commands/__fixtures__/sample_mesh.json' },
|
|
479
|
+
flags: {
|
|
480
|
+
json: Promise.resolve(true),
|
|
481
|
+
},
|
|
482
|
+
});
|
|
483
|
+
const output = await CreateCommand.run();
|
|
484
|
+
expect(output).toHaveProperty('mesh');
|
|
485
|
+
expect(output).toHaveProperty('adobeIdIntegrationsForWorkspace');
|
|
486
|
+
expect(output.mesh).toEqual(expect.objectContaining({ meshId: 'dummy_mesh_id' }));
|
|
487
|
+
expect(output.adobeIdIntegrationsForWorkspace).toEqual(
|
|
488
|
+
expect.objectContaining({ apiKey: 'dummy_api_key' }),
|
|
489
|
+
);
|
|
487
490
|
});
|
|
488
491
|
});
|