@jacebenson/jsn 4.2.4 → 4.3.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.
- package/README.md +12 -0
- package/package.json +2 -2
- package/src/app.js +9 -0
- package/src/auth.js +386 -100
- package/src/cli.js +18 -11
- package/src/commands/auth.js +208 -70
- package/src/commands/decisiontables.js +178 -0
- package/src/commands/dev/_simple.js +1 -2
- package/src/commands/dev/flows.js +92 -838
- package/src/commands/docs/db.js +60 -2
- package/src/commands/perf.js +143 -0
- package/src/decision-table-crud.js +266 -0
- package/src/decision-table-inspection.js +260 -0
- package/src/errors.js +1 -1
- package/src/flow-inspection.js +844 -0
- package/src/flow-publish.js +357 -0
- package/src/helpers.js +7 -1
- package/src/perf-capture.js +112 -0
- package/src/perf.js +335 -0
- package/src/sdk.js +65 -18
- package/src/session.js +14 -0
- package/src/commands/instance.js +0 -362
package/README.md
CHANGED
|
@@ -159,6 +159,18 @@ export SERVICENOW_OAUTH_TOKEN="***"
|
|
|
159
159
|
jsn incidents list
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
## Local data
|
|
163
|
+
|
|
164
|
+
JSN stores durable local data under `~/.jsn/`. Documentation lives in
|
|
165
|
+
`~/.jsn/docs/`, including `docs.db`, the ServiceNowDocs source checkout, and
|
|
166
|
+
community markdown. Configuration stays under `~/.config/servicenow/` and
|
|
167
|
+
credentials stay under `~/.config/servicenow/credentials/`.
|
|
168
|
+
|
|
169
|
+
Existing installations migrate documentation from
|
|
170
|
+
`~/.cache/servicenow-cli/docs/` automatically the first time the docs data is
|
|
171
|
+
accessed. The old directory is removed only after the destination is verified.
|
|
172
|
+
|
|
173
|
+
|
|
162
174
|
## AI Agents
|
|
163
175
|
|
|
164
176
|
jsn ships with a skill file that tells AI agents how to use it. Installed automatically to `~/.agents/skills/servicenow/SKILL.md`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacebenson/jsn",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.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": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "src/cli.js",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "node --experimental-test-module-mocks --test $(find test -name '*.test.js')",
|
|
11
|
+
"test": "node --experimental-test-module-mocks --test --test-concurrency=1 $(find test -name '*.test.js')",
|
|
12
12
|
"lint": "npx eslint src/ bin/ test/",
|
|
13
13
|
"start": "node bin/jsn.js",
|
|
14
14
|
"docs": "npm --prefix docs run build",
|
package/src/app.js
CHANGED
|
@@ -39,6 +39,7 @@ export class App {
|
|
|
39
39
|
this.auth = new AuthManager({
|
|
40
40
|
getUsername: () => this.session?.username || null,
|
|
41
41
|
getEffectiveInstance: () => this.session?.instance || '',
|
|
42
|
+
getAuthMethod: () => this.session?.profile?.auth_method || null,
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
if (this.session.instance) {
|
|
@@ -56,6 +57,14 @@ export class App {
|
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
/** Build a profile-scoped SDK without leaking auth construction to commands. */
|
|
61
|
+
getSDKForProfile(instance, options = {}) {
|
|
62
|
+
const profile = options.profile || {};
|
|
63
|
+
return new SDKClient(instance, this.auth.createProfileProvider(instance, options), {
|
|
64
|
+
domain: options.domain ?? profile.domain ?? '',
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
loadContext() {
|
|
60
69
|
this.context = contextFromSession(this.session, this.config);
|
|
61
70
|
}
|