@jacebenson/jsn 4.3.7-dev.30 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "4.3.7-dev.30",
3
+ "version": "4.3.7-dev.31",
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": {
@@ -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 name.startsWith('mid.server.') ? name : `mid.server.${name}`;
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 = getStringField(record, 'validated').toLowerCase();
154
- if (validated !== '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 = `mid.server.${name.replace(/^mid\.server\./, '')}`;
191
+ const fullName = name;
192
192
  while (Date.now() - started <= timeoutMs) {
193
193
  const params = new URLSearchParams({
194
194
  sysparm_query: `name=${fullName}`,
@@ -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 = `mid.server.${shortName}`;
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);