@jacebenson/jsn 5.5.5-dev.191.1 → 5.5.5-dev.193.1

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": "5.5.5-dev.191.1",
3
+ "version": "5.5.5-dev.193.1",
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": {
@@ -10,7 +10,7 @@ import { globalConfigDir } from '../config.js';
10
10
  *
11
11
  * Whitelist approach (issue #143 findings #2/#3): first map the `://`
12
12
  * protocol separator to `_` exactly as the Go version's encoding does
13
- * (so existing keyring keys like `https_dev437538.service-now.com` keep
13
+ * (so existing keyring keys like `https_example.service-now.com` keep
14
14
  * matching), then drop everything outside [a-zA-Z0-9._-]. Blacklist
15
15
  * stripping of just `/` and `:` left quotes, `$()`, backticks, `;`,
16
16
  * spaces, and backslashes — which broke out of double-quoted shell args
package/src/auth.js CHANGED
@@ -26,11 +26,11 @@ export { classifyCredentialState } from './auth/credential-state.js';
26
26
 
27
27
  // ─── Basic auth from environment variables ───
28
28
  // SN_USERNAME / SN_PASSWORD — global credentials
29
- // SN_<INSTANCE>_USERNAME / SN_<INSTANCE>_PASSWORD — instance-specific (e.g. SN_DEV328604_USERNAME)
29
+ // SN_<INSTANCE>_USERNAME / SN_<INSTANCE>_PASSWORD — instance-specific (e.g. SN_EXAMPLE_USERNAME)
30
30
 
31
31
  function envVarName(instance) {
32
32
  // Normalize instance URL to an env-var-safe name
33
- // e.g. https://dev328604.service-now.com → DEV328604
33
+ // e.g. https://example.service-now.com → EXAMPLE
34
34
  const host = instance.replace(/https?:\/\//, '').replace(/\/.*$/, '').replace(/\.service-now\.com.*/, '').replace(/[^a-zA-Z0-9]/g, '').toUpperCase();
35
35
  return host;
36
36
  }
@@ -44,7 +44,7 @@ function getBasicAuthFromEnv(instance) {
44
44
  return null;
45
45
  }
46
46
 
47
- // Try instance-specific env vars first (e.g. SN_DEV328604_USERNAME)
47
+ // Try instance-specific env vars first (e.g. SN_EXAMPLE_USERNAME)
48
48
  const host = envVarName(instance);
49
49
  const instanceUser = process.env[`SN_${host}_USERNAME`];
50
50
  const instancePass = process.env[`SN_${host}_PASSWORD`];
@@ -602,7 +602,7 @@ export async function loginProfile(argv, app, { concise = false } = {}) {
602
602
  Examples:
603
603
  jsn auth login https://dev12345.service-now.com
604
604
  jsn auth login dev373698
605
- jsn auth login --basic https://dev328604.service-now.com
605
+ jsn auth login --basic https://example.service-now.com
606
606
 
607
607
  Find your instance URL in your browser's address bar when logged into ServiceNow.`);
608
608
  }