@jacebenson/jsn 4.3.7-dev.30 → 4.3.7-dev.32
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/package.json
CHANGED
|
@@ -17,7 +17,7 @@ declareCapabilities('midservers', { mutationSubcommands: ['add', 'remove', 'exec
|
|
|
17
17
|
|
|
18
18
|
function agentName(record) {
|
|
19
19
|
const name = getStringField(record, 'name');
|
|
20
|
-
return
|
|
20
|
+
return `mid.server.${name}`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function queueValue(value) {
|
|
@@ -150,8 +150,8 @@ export function assertMidServerUp(record) {
|
|
|
150
150
|
export function assertMidServerReady(record) {
|
|
151
151
|
assertMidServerUp(record);
|
|
152
152
|
const name = getStringField(record, 'name') || getStringField(record, 'sys_id') || 'MID Server';
|
|
153
|
-
const validated =
|
|
154
|
-
if (validated !== '
|
|
153
|
+
const validated = queueValue(record.validated).toLowerCase();
|
|
154
|
+
if (validated !== 'true') {
|
|
155
155
|
const error = new Error(`MID Server '${name}' is not validated yet (validation: ${validated || 'unknown'}). Wait for ServiceNow validation to complete before executing a command.`);
|
|
156
156
|
error.code = 'midserver_not_validated';
|
|
157
157
|
throw error;
|
|
@@ -186,9 +186,9 @@ async function promptMidCredentials(app, argv) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
async function waitForMidServerUp(app, name, timeoutMs, intervalMs) {
|
|
189
|
+
export async function waitForMidServerUp(app, name, timeoutMs, intervalMs) {
|
|
190
190
|
const started = Date.now();
|
|
191
|
-
const fullName =
|
|
191
|
+
const fullName = name;
|
|
192
192
|
while (Date.now() - started <= timeoutMs) {
|
|
193
193
|
const params = new URLSearchParams({
|
|
194
194
|
sysparm_query: `name=${fullName}`,
|
|
@@ -457,12 +457,21 @@ export function midserversCmd(wrap) {
|
|
|
457
457
|
const responseError = getStringField(response, 'error');
|
|
458
458
|
if (responseError) throw new Error(`MID Server command failed: ${responseError}`);
|
|
459
459
|
const result = parseCommandResult(queueValue(response.payload));
|
|
460
|
+
const responseSysId = unwrapSysId(response);
|
|
461
|
+
const responseURL = responseSysId
|
|
462
|
+
? new URL(`/ecc_queue.do?sys_id=${encodeURIComponent(responseSysId)}`, app.getEffectiveInstance()).href
|
|
463
|
+
: '';
|
|
464
|
+
const summary = `Executed command on MID Server '${getStringField(record, 'name')}'`;
|
|
465
|
+
const lines = [summary, '', result.stdout || '(no stdout)'];
|
|
466
|
+
if (result.stderr) lines.push('', 'stderr:', result.stderr);
|
|
467
|
+
if (responseURL) lines.push('', `ECC input: ${responseURL}`);
|
|
460
468
|
app.ok({
|
|
461
469
|
mid_server: getStringField(record, 'name'),
|
|
462
470
|
command,
|
|
463
471
|
output: { sys_id: outputSysId, ...output },
|
|
464
|
-
response: { ...response, ...result },
|
|
465
|
-
|
|
472
|
+
response: { ...response, ...result, url: responseURL },
|
|
473
|
+
_formatted: `${lines.join('\n')}\n`,
|
|
474
|
+
}, { summary });
|
|
466
475
|
}),
|
|
467
476
|
}),
|
|
468
477
|
handler: () => {
|
package/src/midserver-install.js
CHANGED
|
@@ -108,7 +108,7 @@ export async function installDockerMidServer({
|
|
|
108
108
|
}) {
|
|
109
109
|
const dockerAvailable = detectDocker(run).available;
|
|
110
110
|
const shortName = normalizeMidName(name);
|
|
111
|
-
const displayName =
|
|
111
|
+
const displayName = shortName;
|
|
112
112
|
const releaseName = suppliedReleaseName || (await validateMidCredentials(instanceURL, username, password, fetchImpl)).releaseName;
|
|
113
113
|
const recipeURL = buildMidRecipeUrl(releaseName);
|
|
114
114
|
const installDir = directory || midInstallDirectory(instanceURL, name);
|