@tenonhq/dovetail-servicenow 0.0.25 → 0.0.27
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 +37 -2
- package/dist/cli.d.ts +3 -3
- package/dist/cli.js +311 -79
- package/dist/client.d.ts +29 -0
- package/dist/client.js +42 -8
- package/dist/index.d.ts +4 -2
- package/dist/index.js +5 -2
- package/dist/invokeRest.d.ts +50 -0
- package/dist/invokeRest.js +93 -0
- package/dist/mcp/registry.d.ts +2 -2
- package/dist/mcp/registry.js +183 -129
- package/dist/mcp/schemas.d.ts +45 -6
- package/dist/mcp/schemas.js +14 -4
- package/dist/table/addColumn.d.ts +46 -58
- package/dist/table/addColumn.js +311 -272
- package/dist/table/buildTableSave.d.ts +4 -0
- package/dist/table/index.d.ts +1 -1
- package/dist/table/index.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -319,6 +319,39 @@ var r = await setField({
|
|
|
319
319
|
console.log(r.status, r.verified); // "applied" true
|
|
320
320
|
```
|
|
321
321
|
|
|
322
|
+
### Invoke an arbitrary REST operation
|
|
323
|
+
|
|
324
|
+
Invoke any authenticated ServiceNow REST operation — an application's own
|
|
325
|
+
Scripted REST endpoints (`sys_ws_operation` at `/api/<scope>/<service>/<resource>`)
|
|
326
|
+
included — with GET, POST, PUT or DELETE. This is the transport primitive for
|
|
327
|
+
operations the fixed verbs can't express, and the only surface with PUT/DELETE
|
|
328
|
+
coverage (a verification harness that cleans up after itself needs the DELETE).
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Dry-run — the DEFAULT: echoes method + path + body, sends NOTHING
|
|
332
|
+
npx dove-sn invoke-rest --method DELETE \
|
|
333
|
+
--path /api/x_cadso_core/testkit/resource/<sys_id>
|
|
334
|
+
|
|
335
|
+
# Send for real
|
|
336
|
+
npx dove-sn invoke-rest --method PUT \
|
|
337
|
+
--path /api/x_cadso_core/testkit/resource/<sys_id> \
|
|
338
|
+
--body '{"name":"updated"}' --confirm --json
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`invoke-rest` is **dry-run by default** — nothing is sent without `--confirm`
|
|
342
|
+
(`--dry-run` forces a dry-run even with it). On send the response passes through
|
|
343
|
+
**verbatim** as `{ httpStatus, ok, body }`: non-2xx responses are returned, not
|
|
344
|
+
thrown, so the operation's own error contract survives (the transport still
|
|
345
|
+
retries 429/5xx first). The path must be instance-relative and start with
|
|
346
|
+
`/api/`. **Bodies are never printed in human output** — request or response,
|
|
347
|
+
dry-run or sent: method, path and status only. The structured `--json` result
|
|
348
|
+
is the one channel that carries them (a dry-run's `requestBody` echo lives
|
|
349
|
+
there). Exit codes: `0` dry-run or 2xx, `1` bad args, `2` sent but non-2xx.
|
|
350
|
+
|
|
351
|
+
Programmatic: `invokeRest({ method, path, body, confirm })` is exported, and the
|
|
352
|
+
client gained `now.put` / `now.delete` / `now.invoke` (the latter returns
|
|
353
|
+
`{ status, body }` verbatim) alongside the existing `now.get` / `now.post`.
|
|
354
|
+
|
|
322
355
|
`test-flow` defaults to **validate** — a safe pre-flight (published? inputs match
|
|
323
356
|
declared variables?) that never runs the flow; `--execute --confirm` runs it via
|
|
324
357
|
the server-side FlowAPI runner (deploy `resources/runFlow.md` first).
|
|
@@ -397,8 +430,10 @@ tools `flow_view` (read a flow/subflow's step graph), `action_view` (read an act
|
|
|
397
430
|
type's model), `flow_publish` (compile a flow/subflow snapshot), `flow_copy`
|
|
398
431
|
(copy a flow as an inactive draft), `flow_create` (create a NEW flow from scratch +
|
|
399
432
|
publish, grafting a template), `flow_test` (validate or run a flow), and
|
|
400
|
-
`flow_edit` (patch a flow)
|
|
401
|
-
|
|
433
|
+
`flow_edit` (patch a flow), plus `invoke_rest` (invoke an arbitrary authenticated
|
|
434
|
+
REST operation — Scripted REST included — with GET/POST/PUT/DELETE; dry-run by
|
|
435
|
+
default, response passed through verbatim, bodies never logged). It reads
|
|
436
|
+
ServiceNow credentials from the same env vars as the CLI.
|
|
402
437
|
|
|
403
438
|
```bash
|
|
404
439
|
npx dove-sn mcp --smoke # list the registered tools and exit
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* dove-sn — thin CLI adapter for @tenonhq/dovetail-servicenow.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
*
|
|
6
|
+
* dove-sn add-choices \
|
|
7
7
|
* --table x_cadso_core_event \
|
|
8
8
|
* --column state \
|
|
9
9
|
* --update-set <sys_id> \
|
|
10
10
|
* --choices 'delivered=Delivered,failed=Failed,...' \
|
|
11
11
|
* [--choice-type 3] [--json]
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* dove-sn add-choices --from-json path/to/choices.json
|
|
14
14
|
*
|
|
15
15
|
* JSON payload shape:
|
|
16
16
|
* {
|