@adobe/aio-cli-plugin-api-mesh 3.3.0-beta → 3.3.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 +1 -1
- package/src/commands/api-mesh/status.js +88 -71
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.3.0-beta","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},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"}},"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},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false}},"args":[{"name":"file"}]},"api-mesh:init":{"id":"api-mesh:init","description":"This command will create a workspace where you can organise your API mesh configuration and other files","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[{"description":"API mesh workspace init","command":"aio api-mesh init commerce-mesh"},{"description":"API mesh workspace init with flags","command":"aio api-mesh init commerce-mesh --path ./mesh_projects/test_mesh --git y --packageManager yarn"}],"flags":{"path":{"name":"path","type":"option","char":"p","default":"."},"packageManager":{"name":"packageManager","type":"option","char":"m","options":["npm","yarn"]},"git":{"name":"git","type":"option","char":"g","options":["y","n"]}},"args":[{"name":"projectName","description":"Project name","required":true}]},"api-mesh:run":{"id":"api-mesh:run","description":"Run a local development server that builds and compiles a mesh locally","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Port number for the local dev server"},"debug":{"name":"debug","type":"boolean","description":"Enable debugging mode","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"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},"select":{"name":"select","type":"boolean","description":"Retrieve existing artifacts from the mesh","allowNo":false}},"args":[{"name":"file","description":"Mesh 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},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"}},"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"}]}}}
|
|
1
|
+
{"version":"3.3.0-beta.1","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},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"}},"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},"json":{"name":"json","type":"boolean","description":"Output JSON","allowNo":false}},"args":[{"name":"file"}]},"api-mesh:init":{"id":"api-mesh:init","description":"This command will create a workspace where you can organise your API mesh configuration and other files","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[{"description":"API mesh workspace init","command":"aio api-mesh init commerce-mesh"},{"description":"API mesh workspace init with flags","command":"aio api-mesh init commerce-mesh --path ./mesh_projects/test_mesh --git y --packageManager yarn"}],"flags":{"path":{"name":"path","type":"option","char":"p","default":"."},"packageManager":{"name":"packageManager","type":"option","char":"m","options":["npm","yarn"]},"git":{"name":"git","type":"option","char":"g","options":["y","n"]}},"args":[{"name":"projectName","description":"Project name","required":true}]},"api-mesh:run":{"id":"api-mesh:run","description":"Run a local development server that builds and compiles a mesh locally","pluginName":"@adobe/aio-cli-plugin-api-mesh","pluginType":"core","aliases":[],"examples":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Port number for the local dev server"},"debug":{"name":"debug","type":"boolean","description":"Enable debugging mode","allowNo":false},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"},"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},"select":{"name":"select","type":"boolean","description":"Retrieve existing artifacts from the mesh","allowNo":false}},"args":[{"name":"file","description":"Mesh 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},"env":{"name":"env","type":"option","char":"e","description":"Path to env file","default":".env"}},"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
|
@@ -24,7 +24,6 @@ class StatusCommand extends Command {
|
|
|
24
24
|
|
|
25
25
|
const { flags } = await this.parse(StatusCommand);
|
|
26
26
|
const ignoreCache = await flags.ignoreCache;
|
|
27
|
-
|
|
28
27
|
const { imsOrgId, imsOrgCode, projectId, workspaceId, workspaceName } = await initSdk({
|
|
29
28
|
ignoreCache,
|
|
30
29
|
});
|
|
@@ -44,80 +43,16 @@ class StatusCommand extends Command {
|
|
|
44
43
|
try {
|
|
45
44
|
const { showCloudflareURL: showEdgeMeshUrl } = await getTenantFeatures(imsOrgCode);
|
|
46
45
|
const mesh = await getMesh(imsOrgId, projectId, workspaceId, workspaceName, meshId);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
case 'success':
|
|
52
|
-
this.log(`${chalk.bold(`Legacy Mesh:`)} has been successfully built.`);
|
|
53
|
-
break;
|
|
54
|
-
case 'pending':
|
|
55
|
-
this.log(`${chalk.bold(`Legacy Mesh:`)} is awaiting processing.`);
|
|
56
|
-
break;
|
|
57
|
-
case 'building':
|
|
58
|
-
this.log(
|
|
59
|
-
`${chalk.bold(
|
|
60
|
-
`Legacy Mesh:`,
|
|
61
|
-
)} is currently being provisioned. Please wait a few minutes before checking again.`,
|
|
62
|
-
);
|
|
63
|
-
break;
|
|
64
|
-
case 'error':
|
|
65
|
-
this.log(`${chalk.bold(`Legacy Mesh:`)} build has errors.`);
|
|
66
|
-
this.log(mesh.error);
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
46
|
+
const meshLabel = showEdgeMeshUrl ? chalk.bold(`Legacy Mesh:`) : 'Your mesh';
|
|
47
|
+
|
|
48
|
+
this.log(''.padEnd(102, '*'));
|
|
49
|
+
this.displayMeshStatus(mesh, meshLabel);
|
|
69
50
|
if (showEdgeMeshUrl) {
|
|
70
|
-
|
|
71
|
-
this.log(`${chalk.bold(`Edge Mesh:`)} build has errors.`);
|
|
72
|
-
this.log(mesh.error);
|
|
73
|
-
} else {
|
|
74
|
-
const meshDeployments = await getMeshDeployments(
|
|
75
|
-
imsOrgCode,
|
|
76
|
-
projectId,
|
|
77
|
-
workspaceId,
|
|
78
|
-
meshId,
|
|
79
|
-
);
|
|
80
|
-
switch (String(meshDeployments.status).toLowerCase()) {
|
|
81
|
-
case 'success':
|
|
82
|
-
this.log(`${chalk.bold(`Edge Mesh:`)} has been successfully built.`);
|
|
83
|
-
break;
|
|
84
|
-
case 'provisioning':
|
|
85
|
-
this.log(
|
|
86
|
-
`${chalk.bold(
|
|
87
|
-
`Edge Mesh:`,
|
|
88
|
-
)} is currently being provisioned. Please wait a few minutes before checking again.`,
|
|
89
|
-
);
|
|
90
|
-
break;
|
|
91
|
-
case 'de-provisioning':
|
|
92
|
-
this.log(
|
|
93
|
-
`${chalk.bold(
|
|
94
|
-
`Edge Mesh:`,
|
|
95
|
-
)} is currently being de-provisioned. Please wait a few minutes before checking again.`,
|
|
96
|
-
);
|
|
97
|
-
break;
|
|
98
|
-
case 'error':
|
|
99
|
-
if (meshDeployments.error.includes(`Mesh status is not available`))
|
|
100
|
-
this.log(`${chalk.bold(`Edge Mesh:`)} ${meshDeployments.error}`);
|
|
101
|
-
else {
|
|
102
|
-
this.log(`${chalk.bold(`Edge Mesh:`)} build has errors.`);
|
|
103
|
-
this.log(meshDeployments.error);
|
|
104
|
-
}
|
|
105
|
-
break;
|
|
106
|
-
default:
|
|
107
|
-
this.log(
|
|
108
|
-
`${chalk.bold(
|
|
109
|
-
`Edge Mesh:`,
|
|
110
|
-
)} Mesh status is not available. Please wait for a while and try again.`,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
51
|
+
await this.displayEdgeMeshStatus(mesh, imsOrgCode, projectId, workspaceId);
|
|
114
52
|
}
|
|
115
|
-
this.log(
|
|
116
|
-
'******************************************************************************************************',
|
|
117
|
-
);
|
|
53
|
+
this.log(''.padEnd(102, '*'));
|
|
118
54
|
} catch (err) {
|
|
119
55
|
this.log(err.message);
|
|
120
|
-
|
|
121
56
|
this.error(
|
|
122
57
|
`Unable to get the mesh status. If the error persists please contact support. RequestId: ${global.requestId}`,
|
|
123
58
|
);
|
|
@@ -128,6 +63,88 @@ class StatusCommand extends Command {
|
|
|
128
63
|
);
|
|
129
64
|
}
|
|
130
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Display the status of the mesh.
|
|
69
|
+
*
|
|
70
|
+
* @param mesh - Mesh data
|
|
71
|
+
* @param meshLabel - Label to display for the mesh based on the mesh type
|
|
72
|
+
*/
|
|
73
|
+
displayMeshStatus(mesh, meshLabel = 'Your mesh') {
|
|
74
|
+
switch (mesh.meshStatus) {
|
|
75
|
+
case 'success':
|
|
76
|
+
this.log(`${meshLabel} has been successfully built.`);
|
|
77
|
+
break;
|
|
78
|
+
case 'pending':
|
|
79
|
+
this.log(`${meshLabel} is awaiting processing.`);
|
|
80
|
+
break;
|
|
81
|
+
case 'building':
|
|
82
|
+
this.log(
|
|
83
|
+
`${meshLabel} is currently being provisioned. Please wait a few minutes before checking again.`,
|
|
84
|
+
);
|
|
85
|
+
break;
|
|
86
|
+
case 'error':
|
|
87
|
+
this.log(
|
|
88
|
+
meshLabel === 'Your mesh'
|
|
89
|
+
? `${meshLabel} errored out with the following error.`
|
|
90
|
+
: `${meshLabel} build has errors.`,
|
|
91
|
+
);
|
|
92
|
+
this.log(mesh.error);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Display the status of the edge mesh.
|
|
99
|
+
*
|
|
100
|
+
* While the mesh is not successfully built, the edge mesh status will match the legacy mesh status.
|
|
101
|
+
* Once the build is successful, the edge mesh status will reflect the deployment status
|
|
102
|
+
* @param mesh
|
|
103
|
+
* @param imsOrgCode
|
|
104
|
+
* @param projectId
|
|
105
|
+
* @param workspaceId
|
|
106
|
+
* @returns {Promise<void>}
|
|
107
|
+
*/
|
|
108
|
+
async displayEdgeMeshStatus(mesh, imsOrgCode, projectId, workspaceId) {
|
|
109
|
+
const edgeMeshLabel = chalk.bold(`Edge Mesh:`);
|
|
110
|
+
const buildStatus = mesh.meshStatus;
|
|
111
|
+
|
|
112
|
+
if (buildStatus !== 'success') {
|
|
113
|
+
this.displayMeshStatus(mesh, edgeMeshLabel);
|
|
114
|
+
} else {
|
|
115
|
+
const meshDeployments = await getMeshDeployments(
|
|
116
|
+
imsOrgCode,
|
|
117
|
+
projectId,
|
|
118
|
+
workspaceId,
|
|
119
|
+
mesh.meshId,
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const edgeDeploymentStatus = String(meshDeployments.status).toLowerCase();
|
|
123
|
+
|
|
124
|
+
switch (edgeDeploymentStatus) {
|
|
125
|
+
case 'success':
|
|
126
|
+
this.log(`${edgeMeshLabel} has been successfully built.`);
|
|
127
|
+
break;
|
|
128
|
+
case 'provisioning':
|
|
129
|
+
this.log(
|
|
130
|
+
`${edgeMeshLabel} is currently being provisioned. Please wait a few minutes before checking again.`,
|
|
131
|
+
);
|
|
132
|
+
break;
|
|
133
|
+
case 'de-provisioning':
|
|
134
|
+
this.log(
|
|
135
|
+
`${edgeMeshLabel} is currently being de-provisioned. Please wait a few minutes before checking again.`,
|
|
136
|
+
);
|
|
137
|
+
break;
|
|
138
|
+
case 'error':
|
|
139
|
+
this.log(`${edgeMeshLabel} ${meshDeployments.error}`);
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
this.log(
|
|
143
|
+
`${edgeMeshLabel} status is not available. Please wait for a while and try again.`,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
131
148
|
}
|
|
132
149
|
|
|
133
150
|
StatusCommand.description = 'Get a mesh status with a given meshid.';
|