@jacebenson/jsn 5.5.0-dev.155.1 → 5.5.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/auth.js +2 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "5.5.0-dev.155.1",
3
+ "version": "5.5.0",
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": {
package/src/auth.js CHANGED
@@ -14,10 +14,6 @@ import { savePKCEState, loadPKCEState, removePKCEState, getOAuthClientID, genera
14
14
  import { parseBrowserSessionInput } from './auth/browser-session.js';
15
15
  import { normalizeAuthMethod, normalizeAuthSource, sourceMethod, probeFailure, classifyProbeError, classifyCredentialState } from './auth/credential-state.js';
16
16
 
17
- // A profile in one of these credential states can make authenticated calls.
18
- // `refreshable` refreshes at point of use; see isAuthenticated().
19
- const AUTHENTICATED_STATES = new Set(['available', 'refreshable']);
20
-
21
17
  // Preserve the public auth module API while implementation stays separated.
22
18
  export { sanitizeKeyPart } from './auth/credential-store.js';
23
19
  export { parseBrowserSessionInput } from './auth/browser-session.js';
@@ -293,25 +289,15 @@ export class AuthManager {
293
289
  }
294
290
  }
295
291
 
296
- /**
297
- * Credential states that can produce a session count as authenticated.
298
- *
299
- * `refreshable` is an expired (or nearly expired) access token WITH a refresh
300
- * token, which getCredentialsFor() refreshes at point of use — the refresh is
301
- * already proved by the "expired OAuth refreshes at point of use" contract.
302
- * Reporting those profiles as unauthenticated made `jsn auth status` disagree
303
- * with every command that then ran fine, and made requireAuth() refuse a
304
- * profile the next request would have refreshed.
305
- */
306
292
  isAuthenticated() {
307
293
  const instance = this.identity.getEffectiveInstance();
308
294
  if (!instance) return false;
309
- return AUTHENTICATED_STATES.has(this.getAuthState(instance).state);
295
+ return this.getAuthState(instance).state === 'available';
310
296
  }
311
297
 
312
298
  isAuthenticatedFor(instance, options = {}) {
313
299
  if (!instance) return false;
314
- return AUTHENTICATED_STATES.has(this.getAuthState(instance, options).state);
300
+ return this.getAuthState(instance, options).state === 'available';
315
301
  }
316
302
 
317
303
  async getCredentials() {