@sonisoft/now-sdk-ext-cli 5.0.0 → 5.1.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.
@@ -0,0 +1,25 @@
1
+ /* eslint-disable n/no-process-exit, unicorn/no-process-exit -- this runs before
2
+ oclif exists, so there is no error handler to throw into; an uncaught rejection
3
+ here would print a stack trace instead of the remediation. */
4
+
5
+ /**
6
+ * Side-effecting half of the argv secret check.
7
+ *
8
+ * Split from bin/argv-secrets.js so the detection logic can be imported and
9
+ * tested without the import itself terminating the test process.
10
+ *
11
+ * Imported for its side effect by bin/run.js and bin/dev.js, before
12
+ * credstore-boot.js — a secret in argv should be refused before anything reads,
13
+ * stores, or logs a credential.
14
+ */
15
+
16
+ import {findSecretArgument, secretArgumentMessage} from './argv-secrets.js'
17
+
18
+ // slice(2): skip the node binary and the script path, so a secret-shaped
19
+ // filename in the invocation cannot trip the check.
20
+ const found = findSecretArgument(process.argv.slice(2))
21
+
22
+ if (found) {
23
+ process.stderr.write(secretArgumentMessage(found))
24
+ process.exit(2)
25
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Refuse to run when a secret was passed as a command-line argument.
3
+ *
4
+ * Anything in argv is already exposed by the time this runs: the shell has
5
+ * written it to history, and it is visible to every process on the host via
6
+ * `ps auxww` for as long as this one lives. Neither can be undone from here.
7
+ *
8
+ * So this is not really prevention — it is detection plus an honest message. The
9
+ * user needs to know the value leaked and should be rotated, which is strictly
10
+ * more useful than oclif's "Nonexistent flag: --password". Refusing to run also
11
+ * makes the habit fail fast rather than working quietly until someone greps a
12
+ * shell history.
13
+ *
14
+ * None of these flags exist on any `nex` command today, so nothing legitimate is
15
+ * blocked. The check is deliberately conservative about that: it matches on flag
16
+ * NAME only, never on the shape of a value, because `nex exec` takes arbitrary
17
+ * scripts and `--query`, `--filter`, `--data`, `--payload` and `--spec` all take
18
+ * arbitrary text that can look like anything.
19
+ *
20
+ * Kept as plain JS in bin/ for the same reason as credstore-boot.js: it runs
21
+ * before oclif and before any build output is required.
22
+ */
23
+
24
+ /**
25
+ * Long flags whose value would be a credential.
26
+ *
27
+ * Short flags are deliberately excluded — `-p` and `-t` are too easily something
28
+ * else, and a false positive here blocks legitimate work.
29
+ */
30
+ const SECRET_FLAGS = new Set([
31
+ '--password',
32
+ '--passwd',
33
+ '--pass',
34
+ '--secret',
35
+ '--client-secret',
36
+ '--clientsecret',
37
+ '--token',
38
+ '--access-token',
39
+ '--refresh-token',
40
+ '--id-token',
41
+ '--auth-token',
42
+ '--user-token',
43
+ '--session-token',
44
+ '--api-key',
45
+ '--apikey',
46
+ '--credential',
47
+ '--credentials',
48
+ ])
49
+
50
+ /**
51
+ * Returns details of the first secret-bearing argument, or null.
52
+ *
53
+ * Only reports when a value is actually present. `--password` with nothing after
54
+ * it, or followed by another flag, carries no secret — oclif will reject it as a
55
+ * missing value, which is not this file's problem.
56
+ *
57
+ * @param {string[]} argv
58
+ * @returns {{flag: string, form: 'inline' | 'separate'} | null}
59
+ */
60
+ export function findSecretArgument(argv) {
61
+ if (!Array.isArray(argv)) return null
62
+
63
+ for (const [index, arg] of argv.entries()) {
64
+ if (typeof arg !== 'string' || !arg.startsWith('--')) continue
65
+
66
+ const equals = arg.indexOf('=')
67
+ const name = (equals === -1 ? arg : arg.slice(0, equals)).toLowerCase()
68
+ if (!SECRET_FLAGS.has(name)) continue
69
+
70
+ if (equals !== -1) {
71
+ // `--password=` with nothing after it carries no value.
72
+ if (arg.length > equals + 1) return {flag: name, form: 'inline'}
73
+ continue
74
+ }
75
+
76
+ const next = argv[index + 1]
77
+ if (next !== undefined && !next.startsWith('-')) return {flag: name, form: 'separate'}
78
+ }
79
+
80
+ return null
81
+ }
82
+
83
+ /**
84
+ * Human-facing message for a detected secret argument.
85
+ *
86
+ * Leads with the exposure rather than the refusal, because the exposure is the
87
+ * part the user has to act on and cannot undo.
88
+ *
89
+ * @param {{flag: string}} found
90
+ * @returns {string}
91
+ */
92
+ export function secretArgumentMessage(found) {
93
+ return (
94
+ `nex: refusing to run — a secret was passed on the command line (${found.flag}).\n` +
95
+ `\nThat value is already in your shell history and was visible in the process\n` +
96
+ `list while this command started. Treat it as compromised and rotate it.\n` +
97
+ `\nRemediation: store credentials once instead of passing them per command.\n` +
98
+ ` now-sdk auth --add <instance> # add a credential\n` +
99
+ ` nex auth list # see what is stored\n` +
100
+ ` nex --auth <alias> ... # select one per command\n` +
101
+ `\nFor non-interactive use, set the value in the environment rather than argv.\n`
102
+ )
103
+ }
package/bin/dev.js CHANGED
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
2
 
3
- // FIRST, deliberately: redirect SDK credential storage off the OS keyring
4
- // before anything can read credentials. See bin/credstore-boot.js.
3
+ // FIRST, deliberately: refuse to run if a secret was passed in argv, before
4
+ // anything can read, store, or log it. See bin/argv-guard.js.
5
5
  // eslint-disable-next-line n/shebang
6
+ import './argv-guard.js'
7
+
8
+ // THEN: redirect SDK credential storage off the OS keyring before anything can
9
+ // read credentials. See bin/credstore-boot.js.
6
10
  import './credstore-boot.js'
7
11
 
8
12
  import {execute} from '@oclif/core'
package/bin/run.js CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // FIRST, deliberately: redirect SDK credential storage off the OS keyring
4
- // before anything can read credentials. See bin/credstore-boot.js.
3
+ // FIRST, deliberately: refuse to run if a secret was passed in argv, before
4
+ // anything can read, store, or log it. See bin/argv-guard.js.
5
+ import './argv-guard.js'
6
+
7
+ // THEN: redirect SDK credential storage off the OS keyring before anything can
8
+ // read credentials. See bin/credstore-boot.js.
5
9
  import './credstore-boot.js'
6
10
 
7
11
  import {execute} from '@oclif/core'
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAKnC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,IAAI,KAAK;IAChB,MAAM,CAAC,WAAW,SAC2F;IAC7G,MAAM,CAAC,cAAc,UAAO;IAC5B,MAAM,CAAC,QAAQ;;;QAGd;IACH,MAAM,CAAC,KAAK;;MAAqB;IAGzB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CA0D9B"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAKnC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,IAAI,KAAK;IAChB,MAAM,CAAC,WAAW,SAC2F;IAC7G,MAAM,CAAC,cAAc,UAAO;IAC5B,MAAM,CAAC,QAAQ;;;QAGd;IACH,MAAM,CAAC,KAAK;;MAAqB;IAGzB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAsE9B"}
@@ -44,11 +44,23 @@ export class AuthDoctor extends Command {
44
44
  };
45
45
  if (this.jsonEnabled())
46
46
  return report;
47
- this.log(`shim active : ${shimActive ? 'yes' : 'NO'}`);
47
+ this.log(`shim active : ${shimActive ? 'yes' : 'no'}`);
48
48
  if (!shimActive) {
49
+ // "no" is the DEFAULT, not a fault — the shim is opt-in. The previous
50
+ // wording ("NO", plus a hint to check SN_CRED_STORE_DISABLE) read as though
51
+ // something were broken, and pointed at the one variable that is almost
52
+ // never the reason. Say what to do instead.
49
53
  this.log('');
50
- this.log(' The SDK is reading the OS keyring, which non-interactive sessions cannot unlock.');
51
- this.log(' If this is unexpected, check that SN_CRED_STORE_DISABLE is unset.');
54
+ this.log(' The SDK is reading the OS keyring. That is the default and works fine with an');
55
+ this.log(' interactive desktop session.');
56
+ this.log('');
57
+ this.log(' In a headless session — SSH, systemd, CI, an agent — the keyring cannot be');
58
+ this.log(' unlocked and will report no credentials whatever is stored. To use the store');
59
+ this.log(' listed below instead, pass --cred-store or set SN_CRED_STORE_ENABLE=1.');
60
+ if (process.env.SN_CRED_STORE_DISABLE) {
61
+ this.log('');
62
+ this.log(' NOTE: SN_CRED_STORE_DISABLE is set, which overrides both of those.');
63
+ }
52
64
  }
53
65
  this.log(`store : ${config.store}`);
54
66
  this.log(`path : ${config.blobPath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../src/commands/auth/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAEzF,OAAO,EAAC,aAAa,EAAC,MAAM,iCAAiC,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACrC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,MAAM,CAAC,WAAW,GAChB,2GAA2G,CAAA;IAC7G,MAAM,CAAC,cAAc,GAAG,IAAI,CAAA;IAC5B,MAAM,CAAC,QAAQ,GAAG;QAChB,EAAC,OAAO,EAAE,qCAAqC,EAAE,WAAW,EAAE,iCAAiC,EAAC;QAChG,EAAC,OAAO,EAAE,4CAA4C,EAAE,WAAW,EAAE,gCAAgC,EAAC;KACvG,CAAA;IACH,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,aAAa,EAAC,CAAA;IAG/B,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAE5B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;QAC3B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,GAAG,CAAA;QACvD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;QAEvC,wEAAwE;QACxE,4EAA4E;QA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SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAA;YAC7D,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YAC5F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;QACvD,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACZ,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAA;QAC3D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,OAAO,CAAC,MAAM,SAAS,CAAC,CAAA;YAC3D,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YAChG,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -6,6 +6,8 @@ export declare abstract class AuthenticatedCommand<T extends typeof Command> ext
6
6
  static baseFlags: {
7
7
  auth: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
8
8
  'cred-store': Interfaces.BooleanFlag<boolean>;
9
+ 'log-dir': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
10
+ 'log-file': Interfaces.BooleanFlag<boolean>;
9
11
  'log-level': Interfaces.OptionFlag<"info" | "debug" | "warn" | "error" | "trace", Interfaces.CustomOptions>;
10
12
  };
11
13
  static enableJsonFlag: boolean;
@@ -21,6 +23,13 @@ export declare abstract class AuthenticatedCommand<T extends typeof Command> ext
21
23
  }): Promise<any>;
22
24
  protected finally(_: Error | undefined): Promise<any>;
23
25
  init(): Promise<void>;
26
+ /**
27
+ * Whether --log-level was given on the command line rather than defaulted.
28
+ *
29
+ * oclif reports its own default as a parsed value, so `flags['log-level']` cannot
30
+ * distinguish "the user asked for info" from "nobody said anything".
31
+ */
32
+ private argvHasLogLevel;
24
33
  /**
25
34
  * Fail with remediation the user can act on.
26
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"authenticated-command.d.ts","sourceRoot":"","sources":["../../src/common/authenticated-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAS,UAAU,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAA8B,MAAM,4BAA4B,CAAC;AAMpG,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAA;AAC7H,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE/E,8BAAsB,oBAAoB,CAAC,CAAC,SAAS,OAAO,OAAO,CAAE,SAAQ,OAAO;IAElF,MAAM,CAAC,SAAS;;;;MAmBf;IAEC,MAAM,CAAC,cAAc,UAAO;IAChC,SAAS,CAAC,OAAO,EAAG,MAAM,CAAC;IACvB,SAAS,CAAC,IAAI,EAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,KAAK,EAAG,KAAK,CAAC,CAA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AAC,KAAK,EAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/B,SAAS,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAEnC,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,MAAM,CAAC,MAAM,EAAE,MAAM,EAE/B;cAEa,KAAK,CAAC,GAAG,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,GAAG,CAAC;cAgBrD,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAO9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwElC;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAIvB;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CA0BjB"}
@@ -1,6 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
2
  import { getCredentials } from "@servicenow/sdk-cli/dist/auth/index.js";
3
- import { ServiceNowInstance } from '@sonisoft/now-sdk-ext-core';
3
+ import { configureLogging, flushLogs, ServiceNowInstance } from '@sonisoft/now-sdk-ext-core';
4
4
  import { LogFactory } from '../util/log-factory.js';
5
5
  export class AuthenticatedCommand extends Command {
6
6
  // // define flags that can be inherited by any command that extends BaseCommand
@@ -16,6 +16,21 @@ export class AuthenticatedCommand extends Command {
16
16
  helpGroup: 'GLOBAL',
17
17
  required: false,
18
18
  }),
19
+ 'log-dir': Flags.string({
20
+ description: 'Directory to write log files to. Implies --log-file.',
21
+ helpGroup: 'GLOBAL',
22
+ required: false,
23
+ }),
24
+ // Logging to a file is opt-in. It used to be unconditional, writing
25
+ // ./logs/*.log into whatever directory nex happened to be run from — including
26
+ // CI checkouts — with no way to turn it off. See NEX-3.
27
+ 'log-file': Flags.boolean({
28
+ description: 'Write logs to a file. Defaults to $XDG_STATE_HOME/now-sdk-ext/logs ' +
29
+ '(~/.local/state/now-sdk-ext/logs). Off by default; without this, nex logs ' +
30
+ 'warnings and errors to stderr only.',
31
+ helpGroup: 'GLOBAL',
32
+ required: false,
33
+ }),
19
34
  'log-level': Flags.option({
20
35
  default: 'info',
21
36
  helpGroup: 'GLOBAL',
@@ -42,10 +57,17 @@ export class AuthenticatedCommand extends Command {
42
57
  // with it still undefined and produced "Cannot read properties of undefined
43
58
  // (reading 'error')", hiding the actual usage error behind a TypeError.
44
59
  this.authLogger?.error("Globally caught exception occurred.", err);
60
+ // Flush HERE, not only in finally(). super.catch() routes into oclif's error
61
+ // handler, which can terminate the process — so finally() is not guaranteed to
62
+ // run, and the record that just got logged is precisely the one worth keeping.
63
+ // Winston buffers, so without this the failure line is lost intermittently.
64
+ await flushLogs();
45
65
  return super.catch(err);
46
66
  }
47
67
  async finally(_) {
48
- // called after run and catch regardless of whether or not the command errored
68
+ // called after run and catch regardless of whether or not the command errored.
69
+ // Covers the success path; the failure path already flushed in catch().
70
+ await flushLogs();
49
71
  return super.finally(_);
50
72
  }
51
73
  async init() {
@@ -63,8 +85,23 @@ export class AuthenticatedCommand extends Command {
63
85
  // value under that exact name. Reading `flags.logLevel` always yielded
64
86
  // undefined, silently pinning every command to 'info'.
65
87
  const logLevel = this.flags['log-level'] || 'info';
66
- this.logger = LogFactory.createLogger(this.ctor.name, logLevel);
67
- this.authLogger = LogFactory.createLogger("AuthenticatedCommand", logLevel);
88
+ const logDir = this.flags['log-dir'];
89
+ // Configure BEFORE creating any logger. Core's loggers are field initializers on
90
+ // ~43 manager classes and take no arguments, so this process-wide call is the only
91
+ // thing that reaches them — a per-logger level never did.
92
+ configureLogging({
93
+ // --log-dir implies --log-file; requiring both would make `--log-dir ./x` alone
94
+ // silently produce nothing, which reads as a broken flag.
95
+ dir: logDir,
96
+ file: Boolean(this.flags['log-file']) || Boolean(logDir),
97
+ level: logLevel,
98
+ // --json puts machine-readable output on stdout. Warnings on stderr do not
99
+ // corrupt it, but they do land in a terminal the caller is likely piping, so
100
+ // stay quiet unless the level was asked for explicitly.
101
+ ...(this.jsonEnabled() && !this.argvHasLogLevel() ? { consoleLevel: 'error' } : {}),
102
+ });
103
+ this.logger = LogFactory.createLogger(this.ctor.name);
104
+ this.authLogger = LogFactory.createLogger("AuthenticatedCommand");
68
105
  // const wrapper:CredentialWrapper = new CredentialWrapper();
69
106
  // const credential:Creds = await (flags.auth ? wrapper.getStoredCredentialsByAlias(flags.auth) : wrapper.getStoredCredentialsByAlias( 'fluent-default'));
70
107
  // const credentialArgs = {"_": "get-credentials", auth: flags.auth || "fluent-default"};
@@ -96,6 +133,15 @@ export class AuthenticatedCommand extends Command {
96
133
  };
97
134
  this.instance = new ServiceNowInstance(snSettings);
98
135
  }
136
+ /**
137
+ * Whether --log-level was given on the command line rather than defaulted.
138
+ *
139
+ * oclif reports its own default as a parsed value, so `flags['log-level']` cannot
140
+ * distinguish "the user asked for info" from "nobody said anything".
141
+ */
142
+ argvHasLogLevel() {
143
+ return this.argv.some((a) => a === '--log-level' || a.startsWith('--log-level='));
144
+ }
99
145
  /**
100
146
  * Fail with remediation the user can act on.
101
147
  *
@@ -1 +1 @@
1
- {"version":3,"file":"authenticated-command.js","sourceRoot":"","sources":["../../src/common/authenticated-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAU,kBAAkB,EAA8B,MAAM,4BAA4B,CAAC;AAEpG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOpD,MAAM,OAAgB,oBAA+C,SAAQ,OAAO;IACpF,kFAAkF;IAChF,MAAM,CAAC,SAAS,GAAG;QACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC;QACrF,yEAAyE;QACzE,6EAA6E;QAC7E,2EAA2E;QAC3E,6BAA6B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,wEAAwE;YACxE,kBAAkB;YAClB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,UAAU,GAA+B;YAC7C,KAAK,EAAE,KAAK,CAAC,IAAI;YACjB,UAAU;SACX,CAAA;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;;OAOG;IACK,QAAQ,CAAC,KAAa,EAAE,KAAe;QAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,KAAK,GAAG,CAAC;QAChE,MAAM,WAAW,GAAG;YAClB,gDAAgD;YAChD,oDAAoD;SACrD,CAAC;QAEF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,yEAAyE;YACzE,4EAA4E;YAC5E,4EAA4E;YAC5E,0CAA0C;YAC1C,WAAW,CAAC,OAAO,CACjB,uFAAuF;gBACvF,0FAA0F;gBAC1F,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QAED,6EAA6E;QAC7E,MAAM,WAAW,GAAI,KAA4C,EAAE,WAAW,CAAC;QAC/E,IAAI,WAAW;YAAE,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mCAAmC,KAAK,IAAI,CAAC;QACrG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAC,WAAW,EAAC,CAAC,CAAC;IACpC,CAAC"}
1
+ {"version":3,"file":"authenticated-command.js","sourceRoot":"","sources":["../../src/common/authenticated-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAU,kBAAkB,EAA8B,MAAM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CAAC,CAAC;IACpC,CAAC"}
@@ -1,5 +1,11 @@
1
1
  import { Logger } from "@sonisoft/now-sdk-ext-core";
2
2
  export declare class LogFactory {
3
- static createLogger(name: string, level?: string): Logger;
3
+ /**
4
+ * The level is NOT a parameter any more. Core builds one logger for the process,
5
+ * so a per-logger level would only ever have applied to the two loggers created
6
+ * here and never to the ~43 inside core. Set it with `configureLogging({level})`,
7
+ * which AuthenticatedCommand.init does before calling this.
8
+ */
9
+ static createLogger(name: string): Logger;
4
10
  }
5
11
  //# sourceMappingURL=log-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-factory.d.ts","sourceRoot":"","sources":["../../src/util/log-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,qBAAa,UAAU;WACL,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAe,GAAG,MAAM;CAI3E"}
1
+ {"version":3,"file":"log-factory.d.ts","sourceRoot":"","sources":["../../src/util/log-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,qBAAa,UAAU;IACnB;;;;;OAKG;WACW,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGnD"}
@@ -1,8 +1,13 @@
1
1
  import { Logger } from "@sonisoft/now-sdk-ext-core";
2
2
  export class LogFactory {
3
- static createLogger(name, level = 'info') {
4
- const logger = new Logger(name, level);
5
- return logger;
3
+ /**
4
+ * The level is NOT a parameter any more. Core builds one logger for the process,
5
+ * so a per-logger level would only ever have applied to the two loggers created
6
+ * here and never to the ~43 inside core. Set it with `configureLogging({level})`,
7
+ * which AuthenticatedCommand.init does before calling this.
8
+ */
9
+ static createLogger(name) {
10
+ return new Logger(name);
6
11
  }
7
12
  }
8
13
  //# sourceMappingURL=log-factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log-factory.js","sourceRoot":"","sources":["../../src/util/log-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,MAAM,OAAO,UAAU;IACZ,MAAM,CAAC,YAAY,CAAC,IAAY,EAAE,QAAgB,MAAM;QAC3D,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
1
+ {"version":3,"file":"log-factory.js","sourceRoot":"","sources":["../../src/util/log-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,MAAM,OAAO,UAAU;IACnB;;;;;OAKG;IACI,MAAM,CAAC,YAAY,CAAC,IAAY;QACnC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACJ"}