@jacebenson/jsn 4.3.7-dev.29 → 4.3.7-dev.31
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) {
|
|
@@ -147,6 +147,17 @@ export function assertMidServerUp(record) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
export function assertMidServerReady(record) {
|
|
151
|
+
assertMidServerUp(record);
|
|
152
|
+
const name = getStringField(record, 'name') || getStringField(record, 'sys_id') || 'MID Server';
|
|
153
|
+
const validated = queueValue(record.validated).toLowerCase();
|
|
154
|
+
if (validated !== 'true') {
|
|
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
|
+
error.code = 'midserver_not_validated';
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
150
161
|
async function promptMidCredentials(app, argv) {
|
|
151
162
|
if (!canPrompt()) throw new Error('MID Server installation is interactive. Run it from a terminal.');
|
|
152
163
|
let username = argv.username || '';
|
|
@@ -175,9 +186,9 @@ async function promptMidCredentials(app, argv) {
|
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
|
|
178
|
-
async function waitForMidServerUp(app, name, timeoutMs, intervalMs) {
|
|
189
|
+
export async function waitForMidServerUp(app, name, timeoutMs, intervalMs) {
|
|
179
190
|
const started = Date.now();
|
|
180
|
-
const fullName =
|
|
191
|
+
const fullName = name;
|
|
181
192
|
while (Date.now() - started <= timeoutMs) {
|
|
182
193
|
const params = new URLSearchParams({
|
|
183
194
|
sysparm_query: `name=${fullName}`,
|
|
@@ -431,7 +442,7 @@ export function midserversCmd(wrap) {
|
|
|
431
442
|
message: 'Command to execute:',
|
|
432
443
|
validate: value => value.trim() ? true : 'Command is required',
|
|
433
444
|
});
|
|
434
|
-
|
|
445
|
+
assertMidServerReady(record);
|
|
435
446
|
const agent = agentName(record);
|
|
436
447
|
const output = await app.sdk.create(QUEUE_TABLE, {
|
|
437
448
|
agent,
|
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);
|