@jacebenson/jsn 4.3.7-dev.29 → 4.3.7-dev.30

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "4.3.7-dev.29",
3
+ "version": "4.3.7-dev.30",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 = getStringField(record, 'validated').toLowerCase();
154
+ if (validated !== 'validated') {
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 || '';
@@ -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
- assertMidServerUp(record);
445
+ assertMidServerReady(record);
435
446
  const agent = agentName(record);
436
447
  const output = await app.sdk.create(QUEUE_TABLE, {
437
448
  agent,