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

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.
Files changed (39) hide show
  1. package/oclif.manifest.json +1 -1
  2. package/package.json +3 -7
  3. package/src/commands/api-mesh/__tests__/create.test.js +217 -293
  4. package/src/commands/api-mesh/__tests__/delete.test.js +6 -6
  5. package/src/commands/api-mesh/__tests__/describe.test.js +2 -17
  6. package/src/commands/api-mesh/__tests__/get.test.js +9 -78
  7. package/src/commands/api-mesh/__tests__/log-get-bulk.test.js +1 -1
  8. package/src/commands/api-mesh/__tests__/run.test.js +22 -25
  9. package/src/commands/api-mesh/__tests__/status.test.js +1 -1
  10. package/src/commands/api-mesh/__tests__/update.test.js +8 -9
  11. package/src/commands/api-mesh/create.js +6 -9
  12. package/src/commands/api-mesh/delete.js +5 -5
  13. package/src/commands/api-mesh/describe.js +3 -3
  14. package/src/commands/api-mesh/get.js +8 -11
  15. package/src/commands/api-mesh/init.js +0 -2
  16. package/src/commands/api-mesh/log-get-bulk.js +2 -2
  17. package/src/commands/api-mesh/log-get.js +2 -2
  18. package/src/commands/api-mesh/log-list.js +1 -1
  19. package/src/commands/api-mesh/run.js +9 -35
  20. package/src/commands/api-mesh/source/install.js +3 -2
  21. package/src/commands/api-mesh/status.js +4 -6
  22. package/src/commands/api-mesh/update.js +7 -9
  23. package/src/constants.js +2 -0
  24. package/src/lib/devConsole.js +38 -32
  25. package/src/server.js +198 -36
  26. package/src/serverUtils.js +3 -3
  27. package/src/cors.js +0 -28
  28. package/src/fixPlugins.js +0 -28
  29. package/src/index.js +0 -44
  30. package/src/plugins/complianceHeaders/complianceHeaders.js +0 -55
  31. package/src/plugins/complianceHeaders/index.js +0 -2
  32. package/src/plugins/httpDetailsExtensions/LICENSE +0 -21
  33. package/src/plugins/httpDetailsExtensions/index.js +0 -81
  34. package/src/secrets.js +0 -34
  35. package/src/served.js +0 -22
  36. package/src/templates/wrangler.toml +0 -14
  37. package/src/utils/logger.js +0 -42
  38. package/src/utils/requestId.js +0 -26
  39. package/src/wranglerServer.js +0 -80
@@ -53,7 +53,7 @@ const mockAutoApproveAction = Promise.resolve(false);
53
53
  describe('delete command tests', () => {
54
54
  beforeEach(() => {
55
55
  initSdk.mockResolvedValue({
56
- imsOrgId: selectedOrg.id,
56
+ imsOrgCode: selectedOrg.code,
57
57
  projectId: selectedProject.id,
58
58
  workspaceId: selectedWorkspace.id,
59
59
  });
@@ -117,13 +117,13 @@ describe('delete command tests', () => {
117
117
 
118
118
  return runResult.catch(err => {
119
119
  expect(err.message).toMatchInlineSnapshot(
120
- `"Unable to delete. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again."`,
120
+ `"Unable to delete mesh. No mesh found for Org(CODE1234@AdobeOrg) -> Project(5678) -> Workspace(123456789). Check the details and try again."`,
121
121
  );
122
122
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
123
123
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
124
124
  [
125
125
  [
126
- "Unable to delete. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again.",
126
+ "Unable to delete mesh. No mesh found for Org(CODE1234@AdobeOrg) -> Project(5678) -> Workspace(123456789). Check the details and try again.",
127
127
  ],
128
128
  ]
129
129
  `);
@@ -181,7 +181,7 @@ describe('delete command tests', () => {
181
181
 
182
182
  await expect(runResult).rejects.toEqual(
183
183
  new Error(
184
- 'Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
184
+ 'Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
185
185
  ),
186
186
  );
187
187
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -194,7 +194,7 @@ describe('delete command tests', () => {
194
194
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
195
195
  [
196
196
  [
197
- "Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
197
+ "Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
198
198
  ],
199
199
  ]
200
200
  `);
@@ -212,7 +212,7 @@ describe('delete command tests', () => {
212
212
  expect(deleteMesh.mock.calls).toMatchInlineSnapshot(`
213
213
  [
214
214
  [
215
- "1234",
215
+ "CODE1234@AdobeOrg",
216
216
  "5678",
217
217
  "123456789",
218
218
  "mesh_id",
@@ -160,12 +160,7 @@ describe('describe command tests', () => {
160
160
 
161
161
  expect(runResult).toMatchInlineSnapshot(`
162
162
  {
163
- "imsOrgId": "1234",
164
163
  "meshId": "dummy_meshId",
165
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
166
- "projectId": "5678",
167
- "workspaceId": "123456789",
168
- "workspaceName": "Workspace01",
169
164
  }
170
165
  `);
171
166
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -204,7 +199,7 @@ describe('describe command tests', () => {
204
199
 
205
200
  expect(initRequestId).toHaveBeenCalled();
206
201
  expect(describeMesh).toHaveBeenCalledWith(
207
- selectedOrg.id,
202
+ selectedOrg.code,
208
203
  selectedProject.id,
209
204
  selectedWorkspace.id,
210
205
  selectedWorkspace.title,
@@ -212,12 +207,7 @@ describe('describe command tests', () => {
212
207
  expect(runResult).toMatchInlineSnapshot(`
213
208
  {
214
209
  "apiKey": "dummy_apiKey",
215
- "imsOrgId": "1234",
216
210
  "meshId": "dummy_meshId",
217
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
218
- "projectId": "5678",
219
- "workspaceId": "123456789",
220
- "workspaceName": "Workspace01",
221
211
  }
222
212
  `);
223
213
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -260,7 +250,7 @@ describe('describe command tests', () => {
260
250
 
261
251
  expect(initRequestId).toHaveBeenCalled();
262
252
  expect(describeMesh).toHaveBeenCalledWith(
263
- selectedOrg.id,
253
+ selectedOrg.code,
264
254
  selectedProject.id,
265
255
  selectedWorkspace.id,
266
256
  selectedWorkspace.title,
@@ -268,12 +258,7 @@ describe('describe command tests', () => {
268
258
  expect(runResult).toMatchInlineSnapshot(`
269
259
  {
270
260
  "apiKey": "dummy_apiKey",
271
- "imsOrgId": "1234",
272
261
  "meshId": "dummy_meshId",
273
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
274
- "projectId": "5678",
275
- "workspaceId": "123456789",
276
- "workspaceName": "Workspace01",
277
262
  }
278
263
  `);
279
264
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -115,13 +115,13 @@ describe('get command tests', () => {
115
115
 
116
116
  return runResult.catch(err => {
117
117
  expect(err.message).toMatchInlineSnapshot(
118
- `"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again."`,
118
+ `"Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Check the details and try again."`,
119
119
  );
120
120
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
121
121
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
122
122
  [
123
123
  [
124
- "Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Please check the details and try again.",
124
+ "Unable to get mesh config. No mesh found for Org(1234) -> Project(5678) -> Workspace(123456789). Check the details and try again.",
125
125
  ],
126
126
  ]
127
127
  `);
@@ -134,13 +134,13 @@ describe('get command tests', () => {
134
134
 
135
135
  return runResult.catch(err => {
136
136
  expect(err.message).toMatchInlineSnapshot(
137
- `"Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id"`,
137
+ `"Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id"`,
138
138
  );
139
139
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
140
140
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
141
141
  [
142
142
  [
143
- "Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id",
143
+ "Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id",
144
144
  ],
145
145
  ]
146
146
  `);
@@ -164,7 +164,7 @@ describe('get command tests', () => {
164
164
 
165
165
  await expect(runResult).rejects.toEqual(
166
166
  new Error(
167
- 'Unable to get mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
167
+ 'Unable to get mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id',
168
168
  ),
169
169
  );
170
170
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -177,7 +177,7 @@ describe('get command tests', () => {
177
177
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
178
178
  [
179
179
  [
180
- "Unable to get mesh. Please check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
180
+ "Unable to get mesh. Check the details and try again. If the error persists please contact support. RequestId: dummy_request_id",
181
181
  ],
182
182
  ]
183
183
  `);
@@ -193,30 +193,7 @@ describe('get command tests', () => {
193
193
  verbose: true,
194
194
  });
195
195
  expect(initRequestId).toHaveBeenCalled();
196
- expect(runResult).toMatchInlineSnapshot(`
197
- {
198
- "imsOrgId": "1234",
199
- "mesh": {
200
- "meshConfig": {
201
- "sources": [
202
- {
203
- "handler": {
204
- "graphql": {
205
- "endpoint": "<gql_endpoint>",
206
- },
207
- },
208
- "name": "<api_name>",
209
- },
210
- ],
211
- },
212
- },
213
- "meshId": "dummy_meshId",
214
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
215
- "projectId": "5678",
216
- "workspaceId": "123456789",
217
- "workspaceName": "Workspace01",
218
- }
219
- `);
196
+ expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
220
197
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
221
198
  [
222
199
  [
@@ -263,30 +240,7 @@ describe('get command tests', () => {
263
240
 
264
241
  const runResult = await GetCommand.run();
265
242
 
266
- expect(runResult).toMatchInlineSnapshot(`
267
- {
268
- "imsOrgId": "1234",
269
- "mesh": {
270
- "meshConfig": {
271
- "sources": [
272
- {
273
- "handler": {
274
- "graphql": {
275
- "endpoint": "<gql_endpoint>",
276
- },
277
- },
278
- "name": "<api_name>",
279
- },
280
- ],
281
- },
282
- },
283
- "meshId": "dummy_meshId",
284
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
285
- "projectId": "5678",
286
- "workspaceId": "123456789",
287
- "workspaceName": "Workspace01",
288
- }
289
- `);
243
+ expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
290
244
  expect(writeFile.mock.calls).toMatchInlineSnapshot(`
291
245
  [
292
246
  [
@@ -340,30 +294,7 @@ describe('get command tests', () => {
340
294
  });
341
295
  const runResult = await GetCommand.run();
342
296
 
343
- expect(runResult).toMatchInlineSnapshot(`
344
- {
345
- "imsOrgId": "1234",
346
- "mesh": {
347
- "meshConfig": {
348
- "sources": [
349
- {
350
- "handler": {
351
- "graphql": {
352
- "endpoint": "<gql_endpoint>",
353
- },
354
- },
355
- "name": "<api_name>",
356
- },
357
- ],
358
- },
359
- },
360
- "meshId": "dummy_meshId",
361
- "meshUrl": "https://edge-sandbox-graph.adobe.io/api/dummy_meshId/graphql",
362
- "projectId": "5678",
363
- "workspaceId": "123456789",
364
- "workspaceName": "Workspace01",
365
- }
366
- `);
297
+ expect(runResult).toEqual({ meshId: 'dummy_meshId', mesh: mockGetMeshConfig });
367
298
  expect(writeFile.mock.calls).toMatchInlineSnapshot(`
368
299
  [
369
300
  [
@@ -249,7 +249,7 @@ describe('GetBulkLogCommand', () => {
249
249
 
250
250
  expect(initRequestId).toHaveBeenCalled();
251
251
  expect(initSdk).toHaveBeenCalled();
252
- expect(getMeshId).toHaveBeenCalledWith('orgId', 'projectId', 'workspaceId', 'workspaceName');
252
+ expect(getMeshId).toHaveBeenCalledWith('orgCode', 'projectId', 'workspaceId', 'workspaceName');
253
253
  expect(getPresignedUrls).toHaveBeenCalledWith(
254
254
  'orgCode',
255
255
  'projectId',
@@ -12,6 +12,7 @@ governing permissions and limitations under the License.
12
12
 
13
13
  const RunCommand = require('../run');
14
14
  const {
15
+ startGraphqlServer,
15
16
  interpolateMesh,
16
17
  importFiles,
17
18
  promptConfirm,
@@ -19,18 +20,18 @@ const {
19
20
  initSdk,
20
21
  writeSecretsFile,
21
22
  } = require('../../../helpers');
22
- const { runServer } = require('../../../server');
23
23
  const { getMeshId, getMeshArtifact } = require('../../../lib/devConsole');
24
24
  require('@adobe-apimesh/mesh-builder');
25
25
 
26
26
  jest.mock('../../../helpers', () => ({
27
27
  initSdk: jest.fn().mockResolvedValue({
28
- imsOrgId: 'mockOrgId',
28
+ imsOrgCode: 'mockOrgCode',
29
29
  projectId: 'mockProjectId',
30
30
  workspaceId: 'mockWorkspaceId',
31
31
  workspaceName: 'mockWorkspaceTitle',
32
32
  }),
33
33
  initRequestId: jest.fn().mockResolvedValue({}),
34
+ startGraphqlServer: jest.fn().mockResolvedValue({}),
34
35
  interpolateMesh: jest.fn().mockResolvedValue({}),
35
36
  importFiles: jest.fn().mockResolvedValue(),
36
37
  promptConfirm: jest.fn().mockResolvedValue(true),
@@ -38,10 +39,6 @@ jest.mock('../../../helpers', () => ({
38
39
  writeSecretsFile: jest.fn().mockResolvedValue(),
39
40
  }));
40
41
 
41
- jest.mock('../../../server', () => ({
42
- runServer: jest.fn().mockResolvedValue(),
43
- }));
44
-
45
42
  jest.mock('../../../lib/devConsole', () => ({
46
43
  getMeshId: jest.fn().mockResolvedValue('mockMeshId'),
47
44
  getMeshArtifact: jest.fn().mockResolvedValue(),
@@ -94,10 +91,6 @@ describe('run command tests', () => {
94
91
  platformSpy.mockRestore();
95
92
  });
96
93
 
97
- beforeAll(() => {
98
- jest.spyOn(RunCommand.prototype, 'copyMeshContent').mockImplementation(() => {});
99
- });
100
-
101
94
  test('snapshot run command description', () => {
102
95
  expect(RunCommand.description).toMatchInlineSnapshot(
103
96
  `"Run a local development server that builds and compiles a mesh locally"`,
@@ -196,7 +189,11 @@ describe('run command tests', () => {
196
189
  parseSpy.mockResolvedValue(parseOutput);
197
190
 
198
191
  await RunCommand.run();
199
- expect(runServer).toHaveBeenCalledWith(parseOutput.flags.port);
192
+ expect(startGraphqlServer).toHaveBeenCalledWith(
193
+ expect.anything(),
194
+ parseOutput.flags.port,
195
+ false,
196
+ );
200
197
  });
201
198
 
202
199
  test('should use the port number provided in the .env file if there is no port', async () => {
@@ -213,7 +210,7 @@ describe('run command tests', () => {
213
210
  parseSpy.mockResolvedValue(parseOutput);
214
211
 
215
212
  await RunCommand.run();
216
- expect(runServer).toHaveBeenCalledWith(process.env.PORT);
213
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), process.env.PORT, false);
217
214
  });
218
215
 
219
216
  test('should use the default port if port number is not provided explicitly', async () => {
@@ -229,7 +226,7 @@ describe('run command tests', () => {
229
226
  parseSpy.mockResolvedValue(parseOutput);
230
227
 
231
228
  await RunCommand.run();
232
- expect(runServer).toHaveBeenCalledWith(defaultPort);
229
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
233
230
  });
234
231
 
235
232
  test('should return error for run command if the mesh has placeholders and env file provided using --env flag is not found', async () => {
@@ -396,7 +393,7 @@ describe('run command tests', () => {
396
393
  });
397
394
 
398
395
  await RunCommand.run();
399
- expect(runServer).toHaveBeenCalledWith(defaultPort);
396
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
400
397
  });
401
398
 
402
399
  // file import tests
@@ -442,7 +439,7 @@ describe('run command tests', () => {
442
439
  });
443
440
 
444
441
  await RunCommand.run();
445
- expect(runServer).toHaveBeenCalledWith(defaultPort);
442
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
446
443
  });
447
444
 
448
445
  test('should fail if the file name is more than 25 characters', async () => {
@@ -618,7 +615,7 @@ describe('run command tests', () => {
618
615
  });
619
616
 
620
617
  await RunCommand.run();
621
- expect(runServer).toHaveBeenCalledWith(defaultPort);
618
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
622
619
  });
623
620
 
624
621
  test('should override if prompt returns Yes, if there is files array', async () => {
@@ -665,7 +662,7 @@ describe('run command tests', () => {
665
662
 
666
663
  await RunCommand.run();
667
664
 
668
- expect(runServer).toHaveBeenCalledWith(defaultPort);
665
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
669
666
  });
670
667
 
671
668
  test('should pass for a fully-qualified meshConfig even if the file does not exist in fileSystem', async () => {
@@ -712,7 +709,7 @@ describe('run command tests', () => {
712
709
  });
713
710
 
714
711
  await RunCommand.run();
715
- expect(runServer).toHaveBeenCalledWith(defaultPort);
712
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
716
713
  });
717
714
 
718
715
  test('should pass if the file is located in subdirectory of mesh directory', async () => {
@@ -758,7 +755,7 @@ describe('run command tests', () => {
758
755
 
759
756
  await RunCommand.run();
760
757
 
761
- expect(runServer).toHaveBeenCalledWith(defaultPort);
758
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
762
759
  });
763
760
 
764
761
  test('should fail if the file is outside the workspace directory', async () => {
@@ -865,13 +862,13 @@ describe('run command tests', () => {
865
862
 
866
863
  expect(initSdk).toHaveBeenCalled();
867
864
  expect(getMeshId).toHaveBeenCalledWith(
868
- 'mockOrgId',
865
+ 'mockOrgCode',
869
866
  'mockProjectId',
870
867
  'mockWorkspaceId',
871
868
  'mockWorkspaceTitle',
872
869
  );
873
870
  expect(getMeshArtifact).toHaveBeenCalledWith(
874
- 'mockOrgId',
871
+ 'mockOrgCode',
875
872
  'mockProjectId',
876
873
  'mockWorkspaceId',
877
874
  'mockWorkspaceTitle',
@@ -929,7 +926,7 @@ describe('run command tests', () => {
929
926
 
930
927
  await RunCommand.run();
931
928
  expect(writeSecretsFile).toHaveBeenCalled();
932
- expect(runServer).toHaveBeenCalledWith(defaultPort);
929
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
933
930
  });
934
931
 
935
932
  test('should return error if ran with secrets against windows platform with batch variables', async () => {
@@ -967,7 +964,7 @@ describe('run command tests', () => {
967
964
 
968
965
  await RunCommand.run();
969
966
  expect(writeSecretsFile).toHaveBeenCalled();
970
- expect(runServer).toHaveBeenCalledWith(defaultPort);
967
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
971
968
  });
972
969
 
973
970
  test('should pass if ran with secrets against darwin(macOS) platform with batch variables', async () => {
@@ -982,7 +979,7 @@ describe('run command tests', () => {
982
979
 
983
980
  await RunCommand.run();
984
981
  expect(writeSecretsFile).toHaveBeenCalled();
985
- expect(runServer).toHaveBeenCalledWith(defaultPort);
982
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
986
983
  });
987
984
 
988
985
  test('should escape variables that are preceded by backslash symbol', async () => {
@@ -999,6 +996,6 @@ describe('run command tests', () => {
999
996
  'Home: rootPath\nHomeString: $HOME\nHomeWithSlash: \\rootPath\nHomeStringWithSlash: \\$HOME\n',
1000
997
  expect.anything(),
1001
998
  );
1002
- expect(runServer).toHaveBeenCalledWith(defaultPort);
999
+ expect(startGraphqlServer).toHaveBeenCalledWith(expect.anything(), defaultPort, false);
1003
1000
  });
1004
1001
  });
@@ -88,7 +88,7 @@ describe('status command tests', () => {
88
88
  describe('unexpected error', () => {
89
89
  test('should output mesh not found error when mesh does not exist', async () => {
90
90
  getMeshId.mockResolvedValue(null);
91
- const expectedMessage = `Unable to get mesh status. No mesh found for Org(${mockOrg.id}) -> Project(${mockProject.id}) -> Workspace(${mockWorkspace.id}). Please check the details and try again.`;
91
+ const expectedMessage = `Unable to get mesh status. No mesh found for Org(${mockOrg.code}) -> Project(${mockProject.id}) -> Workspace(${mockWorkspace.id}). Check the details and try again.`;
92
92
  const runResult = StatusCommand.run();
93
93
  await expect(runResult).rejects.toEqual(new Error(expectedMessage));
94
94
  expect(errorLogSpy).toHaveBeenCalledWith(expectedMessage);
@@ -50,6 +50,7 @@ describe('update command tests', () => {
50
50
  beforeEach(() => {
51
51
  initSdk.mockResolvedValue({
52
52
  imsOrgId: selectedOrg.id,
53
+ imsOrgCode: selectedOrg.code,
53
54
  projectId: selectedProject.id,
54
55
  workspaceId: selectedWorkspace.id,
55
56
  workspaceName: selectedWorkspace.title,
@@ -325,13 +326,13 @@ describe('update command tests', () => {
325
326
  const runResult = UpdateCommand.run();
326
327
 
327
328
  await expect(runResult).rejects.toMatchInlineSnapshot(
328
- `[Error: Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id]`,
329
+ `[Error: Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id]`,
329
330
  );
330
331
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`[]`);
331
332
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
332
333
  [
333
334
  [
334
- "Unable to get mesh ID. Please check the details and try again. RequestId: dummy_request_id",
335
+ "Unable to get mesh ID. Check the details and try again. RequestId: dummy_request_id",
335
336
  ],
336
337
  ]
337
338
  `);
@@ -373,7 +374,7 @@ describe('update command tests', () => {
373
374
  // );
374
375
 
375
376
  await expect(runResult).rejects.toMatchInlineSnapshot(
376
- `[Error: Unable to update the mesh. Please check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id]`,
377
+ `[Error: Unable to update the mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id]`,
377
378
  );
378
379
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
379
380
  [
@@ -385,7 +386,7 @@ describe('update command tests', () => {
385
386
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
386
387
  [
387
388
  [
388
- "Unable to update the mesh. Please check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id",
389
+ "Unable to update the mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: dummy_request_id",
389
390
  ],
390
391
  ]
391
392
  `);
@@ -554,7 +555,7 @@ describe('update command tests', () => {
554
555
  expect(initRequestId).toHaveBeenCalled();
555
556
  expect(updateMesh.mock.calls[0]).toMatchInlineSnapshot(`
556
557
  [
557
- "1234",
558
+ "CODE1234@AdobeOrg",
558
559
  "5678",
559
560
  "123456789",
560
561
  "Workspace01",
@@ -722,9 +723,7 @@ describe('update command tests', () => {
722
723
 
723
724
  const output = UpdateCommand.run();
724
725
  await expect(output).rejects.toEqual(
725
- new Error(
726
- 'Unable to import the files in the mesh config. Please check the file and try again.',
727
- ),
726
+ new Error('Unable to import the files in the mesh config. Check the file and try again.'),
728
727
  );
729
728
 
730
729
  expect(logSpy.mock.calls).toMatchInlineSnapshot(`
@@ -738,7 +737,7 @@ describe('update command tests', () => {
738
737
  expect(errorLogSpy.mock.calls).toMatchInlineSnapshot(`
739
738
  [
740
739
  [
741
- "Unable to import the files in the mesh config. Please check the file and try again.",
740
+ "Unable to import the files in the mesh config. Check the file and try again.",
742
741
  ],
743
742
  ]
744
743
  `);
@@ -59,7 +59,6 @@ class CreateCommand extends Command {
59
59
  const envFilePath = await flags.env;
60
60
  const secretsFilePath = await flags.secrets;
61
61
  const {
62
- imsOrgId,
63
62
  imsOrgCode,
64
63
  projectId,
65
64
  workspaceId,
@@ -83,7 +82,7 @@ class CreateCommand extends Command {
83
82
  data = JSON.parse(inputMeshData);
84
83
  } catch (err) {
85
84
  this.log(err.message);
86
- this.error('Input mesh file is not a valid JSON. Please check the file provided.');
85
+ this.error('Input mesh file is not a valid JSON. Check the file provided.');
87
86
  }
88
87
  }
89
88
 
@@ -102,9 +101,7 @@ class CreateCommand extends Command {
102
101
  data = await importFiles(data, filesList, args.file, flags.autoConfirmAction);
103
102
  } catch (err) {
104
103
  this.log(err.message);
105
- this.error(
106
- 'Unable to import the files in the mesh config. Please check the file and try again.',
107
- );
104
+ this.error('Unable to import the files in the mesh config. Check the file and try again.');
108
105
  }
109
106
  }
110
107
 
@@ -118,7 +115,7 @@ class CreateCommand extends Command {
118
115
  data.secrets = encryptedSecrets;
119
116
  } catch (err) {
120
117
  this.log(err.message);
121
- this.error('Unable to import secrets. Please check the file and try again.');
118
+ this.error('Unable to import secrets. Check the file and try again.');
122
119
  }
123
120
  }
124
121
 
@@ -131,7 +128,7 @@ class CreateCommand extends Command {
131
128
  if (shouldContinue) {
132
129
  try {
133
130
  const { mesh } = await createMesh(
134
- imsOrgId,
131
+ imsOrgCode,
135
132
  projectId,
136
133
  workspaceId,
137
134
  workspaceName,
@@ -159,7 +156,7 @@ class CreateCommand extends Command {
159
156
 
160
157
  // When renaming the return values, make sure to make necessary changes to
161
158
  // template adobe/generator-app-api-mesh since it relies on "mesh"
162
- return { ...mesh, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
159
+ return { mesh };
163
160
  } else {
164
161
  this.error(`Unable to create a mesh. Please try again. RequestId: ${global.requestId}`, {
165
162
  exit: false,
@@ -169,7 +166,7 @@ class CreateCommand extends Command {
169
166
  this.log(error.message);
170
167
 
171
168
  this.error(
172
- `Unable to create a mesh. Please check the mesh configuration file and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
169
+ `Unable to create a mesh. Check the mesh configuration file and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
173
170
  );
174
171
  }
175
172
  } else {
@@ -34,14 +34,14 @@ class DeleteCommand extends Command {
34
34
  const ignoreCache = await flags.ignoreCache;
35
35
  const autoConfirmAction = await flags.autoConfirmAction;
36
36
 
37
- const { imsOrgId, projectId, workspaceId } = await initSdk({
37
+ const { imsOrgCode, projectId, workspaceId } = await initSdk({
38
38
  ignoreCache,
39
39
  });
40
40
 
41
41
  let meshId = null;
42
42
 
43
43
  try {
44
- meshId = await getMeshId(imsOrgId, projectId, workspaceId);
44
+ meshId = await getMeshId(imsOrgCode, projectId, workspaceId);
45
45
  } catch (err) {
46
46
  this.error(
47
47
  `Unable to get mesh ID. Please check the details and try again. RequestId: ${global.requestId}`,
@@ -59,7 +59,7 @@ class DeleteCommand extends Command {
59
59
 
60
60
  if (shouldContinue) {
61
61
  try {
62
- const deleteMeshResponse = await deleteMesh(imsOrgId, projectId, workspaceId, meshId);
62
+ const deleteMeshResponse = await deleteMesh(imsOrgCode, projectId, workspaceId, meshId);
63
63
 
64
64
  if (deleteMeshResponse) {
65
65
  this.log('Successfully deleted mesh %s', meshId);
@@ -72,7 +72,7 @@ class DeleteCommand extends Command {
72
72
  this.log(error.message);
73
73
 
74
74
  this.error(
75
- `Unable to delete mesh. Please check the details and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
75
+ `Unable to delete mesh. Check the details and try again. If the error persists please contact support. RequestId: ${global.requestId}`,
76
76
  );
77
77
  }
78
78
  } else {
@@ -82,7 +82,7 @@ class DeleteCommand extends Command {
82
82
  }
83
83
  } else {
84
84
  this.error(
85
- `Unable to delete. No mesh found for Org(${imsOrgId}) -> Project(${projectId}) -> Workspace(${workspaceId}). Please check the details and try again.`,
85
+ `Unable to delete mesh. No mesh found for Org(${imsOrgCode}) -> Project(${projectId}) -> Workspace(${workspaceId}). Check the details and try again.`,
86
86
  );
87
87
  }
88
88
  }
@@ -30,12 +30,12 @@ class DescribeCommand extends Command {
30
30
 
31
31
  const { flags } = await this.parse(DescribeCommand);
32
32
  const ignoreCache = await flags.ignoreCache;
33
- const { imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
33
+ const { imsOrgCode, imsOrgId, projectId, workspaceId, workspaceName } = await initSdk({
34
34
  ignoreCache,
35
35
  });
36
36
 
37
37
  try {
38
- const meshDetails = await describeMesh(imsOrgId, projectId, workspaceId, workspaceName);
38
+ const meshDetails = await describeMesh(imsOrgCode, projectId, workspaceId, workspaceName);
39
39
 
40
40
  if (meshDetails) {
41
41
  const { meshId } = meshDetails;
@@ -49,7 +49,7 @@ class DescribeCommand extends Command {
49
49
  this.log('Mesh ID: %s', meshId);
50
50
  this.log('Mesh Endpoint: %s', meshUrl);
51
51
 
52
- return { ...meshDetails, meshUrl, imsOrgId, projectId, workspaceId, workspaceName };
52
+ return meshDetails;
53
53
  } else {
54
54
  logger.error(
55
55
  `Unable to get mesh details. Please check the details and try again. RequestId: ${global.requestId}`,