@tenonhq/dovetail-servicenow 0.0.52 → 0.0.54
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 +46 -2
- package/dist/cli.js +89 -4
- package/dist/cliUsage.js +40 -6
- package/dist/client.d.ts +11 -0
- package/dist/client.js +17 -6
- package/dist/flowDesigner/index.d.ts +2 -2
- package/dist/flowDesigner/index.js +2 -1
- package/dist/flowDesigner/testFlow.d.ts +40 -16
- package/dist/flowDesigner/testFlow.js +175 -51
- package/dist/index.d.ts +4 -4
- package/dist/index.js +10 -3
- package/dist/mcp/registry.d.ts +1 -1
- package/dist/mcp/registry.js +43 -5
- package/dist/mcp/schemas.d.ts +48 -0
- package/dist/mcp/schemas.js +21 -1
- package/dist/table/addColumn.d.ts +5 -0
- package/dist/table/addColumn.js +58 -0
- package/dist/table/buildColumnXml.d.ts +6 -0
- package/dist/table/buildColumnXml.js +8 -1
- package/dist/table/buildTableSave.d.ts +11 -0
- package/dist/table/buildTableSave.js +12 -1
- package/dist/table/createTable.d.ts +32 -1
- package/dist/table/createTable.js +97 -2
- package/dist/table/dictionaryAttributes.d.ts +64 -0
- package/dist/table/dictionaryAttributes.js +197 -0
- package/dist/table/index.d.ts +6 -1
- package/dist/table/index.js +14 -2
- package/dist/table/referenceAttrAudit.d.ts +45 -0
- package/dist/table/referenceAttrAudit.js +98 -0
- package/dist/table/setColumn.d.ts +7 -0
- package/dist/table/setColumn.js +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -349,6 +349,7 @@ npx dove-sn publish-flow --sys-id <sys_id> # scope defaults to the f
|
|
|
349
349
|
# Test a flow: validate (default, read-only) or actually run it
|
|
350
350
|
npx dove-sn test-flow --sys-id <sys_id> --inputs '{"phone":"+1555..."}'
|
|
351
351
|
npx dove-sn test-flow --sys-id <sys_id> --execute --confirm --inputs '{...}' # runs it
|
|
352
|
+
npx dove-sn test-flow --sys-id <action_sys_id> --action --execute --confirm # runs an action
|
|
352
353
|
|
|
353
354
|
# Edit a flow in place (rename / description / step inputs)
|
|
354
355
|
echo '{"rename":{"name":"New Name"},"patchStepInputs":[{"step":"Calculate SMS Send At","input":"send_rate","value":"5"}]}' > ops.json
|
|
@@ -674,6 +675,40 @@ adds diagnostics (app-switch status, resolved column key, assigned sys_id) to th
|
|
|
674
675
|
result note. Ground truth (the HAR dissection) lives in the CTO repo's create-table
|
|
675
676
|
docs.
|
|
676
677
|
|
|
678
|
+
### Dictionary attributes (`sys_dictionary.attributes`) and the reference-column rule
|
|
679
|
+
|
|
680
|
+
**Team rule (2026-10-08): every reference column carries `readonly_clickthrough=true`.**
|
|
681
|
+
`add-column` and `create-table` apply it by default to every `reference` column; any
|
|
682
|
+
other attributes you need ride alongside it.
|
|
683
|
+
|
|
684
|
+
```bash
|
|
685
|
+
# default — the column is created with readonly_clickthrough=true, verified on read-back
|
|
686
|
+
npx dove-sn add-column --table x_cadso_journey --label Owner --type reference --reference sys_user --update-set <sys_id>
|
|
687
|
+
# more attributes (merged with the default) / opt out of the default
|
|
688
|
+
npx dove-sn add-column ... --attributes "ref_auto_completer=AJAXTableCompleter,ref_ac_columns=name;email"
|
|
689
|
+
npx dove-sn add-column ... --no-readonly-clickthrough
|
|
690
|
+
# fix an EXISTING column — MERGED into its current attributes, never overwriting them
|
|
691
|
+
npx dove-sn set-column --table x_cadso_automate_email_batch --column x_cadso_journey_instance_step \
|
|
692
|
+
--attributes readonly_clickthrough=true --update-set <sys_id>
|
|
693
|
+
# read-only audit: which reference columns lack it
|
|
694
|
+
npx dove-sn reference-attr-audit --scope-prefix x_cadso_ --json
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
- **Format.** `--attributes` (MCP `attributes`) is `"k=v,k2=v2"` or, in JSON/MCP, a
|
|
698
|
+
`{ key: value }` map. Keys are identifiers; a value may not contain `,` (the separator).
|
|
699
|
+
- **Merge, never clobber.** `set-column` sets the named keys and keeps every other
|
|
700
|
+
attribute the column carries. A column that already has them reports `unchanged`.
|
|
701
|
+
- **Verified.** add-column reads `attributes` back; if the insert dropped a key it patches
|
|
702
|
+
once (as a merge) and re-reads — still missing is `failed` (exit 2). create-table reads
|
|
703
|
+
every column with attributes back after the form save (`columnAttributes` on the
|
|
704
|
+
result) and merge-patches into `--update-set` the same way. set-column verifies each
|
|
705
|
+
requested key order-insensitively.
|
|
706
|
+
- **Opt-out / override.** `--no-readonly-clickthrough` (create-table: table-wide;
|
|
707
|
+
per column `readonly_clickthrough: false` in `--from-json`), or set
|
|
708
|
+
`readonly_clickthrough=false` in `attributes` — the caller's value wins.
|
|
709
|
+
- **Inherited columns** are refused by `set-column --attributes` for now (a per-child
|
|
710
|
+
`sys_dictionary_override` for attributes has not been verified live).
|
|
711
|
+
|
|
677
712
|
### Add a unique index
|
|
678
713
|
|
|
679
714
|
Create a **single-column UNIQUE index** on an existing table, then read it back.
|
|
@@ -1160,7 +1195,14 @@ failed/timeout. Programmatic: `exportUpdateSet({ updateSet, mode })`,
|
|
|
1160
1195
|
|
|
1161
1196
|
`test-flow` defaults to **validate** — a safe pre-flight (published? inputs match
|
|
1162
1197
|
declared variables?) that never runs the flow; `--execute --confirm` runs it via
|
|
1163
|
-
the
|
|
1198
|
+
the Dovetail Core `runFlow` op (`POST /api/cadso/dovetail_core/runFlow`), which
|
|
1199
|
+
ships with the Dovetail app — nothing to deploy. On a route-level 404 it falls
|
|
1200
|
+
back once to the legacy `/api/cadso/dovetail/runFlow`; `--runner <path>` is used
|
|
1201
|
+
as-is with no fallback. Add `--action` when `--sys-id` is a
|
|
1202
|
+
`sys_hub_action_type_definition` (sent as `actionSysId`). The caller needs the
|
|
1203
|
+
`admin` or `dovetail_user` role; a rejected run (400/403/404/422/500 with the
|
|
1204
|
+
op's `{ ok: false, error }`) reports `ok=false` and exits 2. Contract and source:
|
|
1205
|
+
[`resources/runFlow.md`](resources/runFlow.md).
|
|
1164
1206
|
|
|
1165
1207
|
`edit-flow` defaults to a **dry-run** diff. With `--apply`: rename/description are
|
|
1166
1208
|
written to `sys_hub_flow` through the update-set-aware API (so `--update-set` is
|
|
@@ -1253,7 +1295,9 @@ record — dry-run by default, `confirm:true` to apply, `updateSetSysId` require
|
|
|
1253
1295
|
record read back before AND after so success is only reported once it is confirmed
|
|
1254
1296
|
gone) — all read-back-verified; `set_field` / `create_record` are captured in the
|
|
1255
1297
|
update set you pass, while `delete_record` pins the set as current and reads the DELETE
|
|
1256
|
-
capture back (`captureState`) until [#297](https://github.com/TenonHQ/Dovetail/issues/297) ships — `
|
|
1298
|
+
capture back (`captureState`) until [#297](https://github.com/TenonHQ/Dovetail/issues/297) ships — `reference_attr_audit` (read-only: reference columns under a table-name prefix
|
|
1299
|
+
missing `readonly_clickthrough=true`; `add_column` / `create_table` columns and
|
|
1300
|
+
`set_column` also take `attributes` — see "Dictionary attributes"), `host_assets` (deploy a built
|
|
1257
1301
|
dist/), plus the Flow Designer
|
|
1258
1302
|
tools `flow_view` (read a flow/subflow's step graph), `action_view` (read an action
|
|
1259
1303
|
type's model), `action_edit` (structurally edit a published action type — per-step
|
package/dist/cli.js
CHANGED
|
@@ -664,15 +664,18 @@ async function runCreateFlow(flags) {
|
|
|
664
664
|
}
|
|
665
665
|
/**
|
|
666
666
|
* dove-sn test-flow:
|
|
667
|
-
* --sys-id <sys_id> Required. sys_hub_flow sys_id (flow or subflow)
|
|
667
|
+
* --sys-id <sys_id> Required. sys_hub_flow sys_id (flow or subflow), or a
|
|
668
|
+
* sys_hub_action_type_definition sys_id with --action.
|
|
669
|
+
* --action Optional. --sys-id is an action (sent as actionSysId).
|
|
668
670
|
* --execute Optional. Actually run it (default is validate-only).
|
|
669
671
|
* --confirm Required with --execute. A deliberate run-for-real gate.
|
|
670
672
|
* --inputs <json> Optional. JSON object of inputs (or --inputs-json <path>).
|
|
671
673
|
* --json Optional. Emit the structured TestFlowResult.
|
|
672
674
|
*
|
|
673
675
|
* Default (no --execute) is a safe pre-flight: published? readable? inputs match
|
|
674
|
-
* declared variables? --execute POSTs the
|
|
675
|
-
*
|
|
676
|
+
* declared variables? --execute POSTs the Dovetail Core runFlow op
|
|
677
|
+
* (/api/cadso/dovetail_core/runFlow, legacy fallback on 404; --runner overrides
|
|
678
|
+
* with no fallback — see resources/runFlow.md). Executing can cause real side effects.
|
|
676
679
|
*/
|
|
677
680
|
async function runTestFlow(flags) {
|
|
678
681
|
var sysId = flags["sys-id"] || flags.sysId;
|
|
@@ -690,6 +693,7 @@ async function runTestFlow(flags) {
|
|
|
690
693
|
var params = {
|
|
691
694
|
client: (0, client_1.createClient)({}),
|
|
692
695
|
sysId: sysId,
|
|
696
|
+
target: flags.action === "true" ? "action" : "flow",
|
|
693
697
|
mode: flags.execute === "true" ? "execute" : "validate",
|
|
694
698
|
inputs: inputs,
|
|
695
699
|
confirm: flags.confirm === "true",
|
|
@@ -1264,7 +1268,9 @@ function parseColumnsInline(input) {
|
|
|
1264
1268
|
* --columns "Key:string:255, Severity:choice:50, Occurence Count:integer:5"
|
|
1265
1269
|
* [--extends sys_metadata] [--number-prefix ERR] [--user-role x_cadso_core.user]
|
|
1266
1270
|
* [--no-acls] [--no-menu] [--update-set <sys_id>] [--save-action <sys_id>]
|
|
1267
|
-
* [--from-json <spec.json>] [--dry-run] [--json]
|
|
1271
|
+
* [--no-readonly-clickthrough] [--from-json <spec.json>] [--dry-run] [--json]
|
|
1272
|
+
* Reference columns carry readonly_clickthrough=true by default; per-column
|
|
1273
|
+
* `attributes` / `readonly_clickthrough` ride on the --from-json column specs.
|
|
1268
1274
|
*/
|
|
1269
1275
|
async function runCreateTable(flags) {
|
|
1270
1276
|
var spec = {};
|
|
@@ -1281,6 +1287,16 @@ async function runCreateTable(flags) {
|
|
|
1281
1287
|
process.stderr.write("create-table: --name, --label, --scope and --columns (or --from-json) are required\n");
|
|
1282
1288
|
return 1;
|
|
1283
1289
|
}
|
|
1290
|
+
// Table-wide opt-out of the reference default; a column that says otherwise wins.
|
|
1291
|
+
if (flags["no-readonly-clickthrough"] === "true") {
|
|
1292
|
+
columns = columns.map(function (c) {
|
|
1293
|
+
if (c.readonly_clickthrough !== undefined)
|
|
1294
|
+
return c;
|
|
1295
|
+
var copy = Object.assign({}, c);
|
|
1296
|
+
copy.readonly_clickthrough = false;
|
|
1297
|
+
return copy;
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1284
1300
|
var params = {
|
|
1285
1301
|
client: (0, client_1.createClient)({}),
|
|
1286
1302
|
name: name,
|
|
@@ -1390,6 +1406,7 @@ async function runDesignAccess(flags) {
|
|
|
1390
1406
|
* --table x_cadso_journey --label URL --type url
|
|
1391
1407
|
* [--name url] [--max-length 1024] [--reference <table>]
|
|
1392
1408
|
* [--mandatory] [--default <value>] [--dependent-on-field <element>]
|
|
1409
|
+
* [--attributes "k=v,k2=v2"] [--no-readonly-clickthrough]
|
|
1393
1410
|
* [--scope x_cadso_journey] [--cross-scope] [--ensure-design-access]
|
|
1394
1411
|
* [--update-set <sys_id>] [--from-json <spec.json>] [--dry-run] [--debug] [--json]
|
|
1395
1412
|
* --update-set is required unless --dry-run. --cross-scope opts in to a column
|
|
@@ -1419,6 +1436,17 @@ async function runAddColumn(flags) {
|
|
|
1419
1436
|
column.dependent_on_field = flags["dependent-on-field"];
|
|
1420
1437
|
}
|
|
1421
1438
|
}
|
|
1439
|
+
// Apply to a --from-json column too, so the flags never silently do nothing.
|
|
1440
|
+
if (column && flags.attributes !== undefined) {
|
|
1441
|
+
if (flags.attributes === "true" || !flags.attributes.trim()) {
|
|
1442
|
+
process.stderr.write('add-column: --attributes needs a value, e.g. --attributes "readonly_clickthrough=true"\n');
|
|
1443
|
+
return 1;
|
|
1444
|
+
}
|
|
1445
|
+
column.attributes = flags.attributes;
|
|
1446
|
+
}
|
|
1447
|
+
if (column && flags["no-readonly-clickthrough"] === "true") {
|
|
1448
|
+
column.readonly_clickthrough = false;
|
|
1449
|
+
}
|
|
1422
1450
|
if (!table || !column || !column.label) {
|
|
1423
1451
|
process.stderr.write("add-column: --table and --label (with --type) are required (or --from-json)\n");
|
|
1424
1452
|
return 1;
|
|
@@ -1550,6 +1578,56 @@ async function runAddIndex(flags) {
|
|
|
1550
1578
|
return 2;
|
|
1551
1579
|
return 0;
|
|
1552
1580
|
}
|
|
1581
|
+
/**
|
|
1582
|
+
* dove-sn reference-attr-audit:
|
|
1583
|
+
* --scope-prefix x_cadso_ [--attribute "readonly_clickthrough=true"] [--json]
|
|
1584
|
+
*
|
|
1585
|
+
* Read-only. Lists active reference columns under the prefix whose
|
|
1586
|
+
* sys_dictionary.attributes lack the attribute (team rule: readonly_clickthrough=true).
|
|
1587
|
+
* Backfilling is a separate decision — set-column --attributes per column.
|
|
1588
|
+
*
|
|
1589
|
+
* Exit codes: 0 read (findings are a report, not a failure), 1 bad args.
|
|
1590
|
+
*/
|
|
1591
|
+
async function runReferenceAttrAudit(flags) {
|
|
1592
|
+
var prefix = flags["scope-prefix"];
|
|
1593
|
+
if (!prefix || prefix === "true") {
|
|
1594
|
+
process.stderr.write("reference-attr-audit: --scope-prefix <prefix> is required (e.g. x_cadso_)\n");
|
|
1595
|
+
return 1;
|
|
1596
|
+
}
|
|
1597
|
+
if (flags.attribute === "true") {
|
|
1598
|
+
process.stderr.write('reference-attr-audit: --attribute needs a value, e.g. "readonly_clickthrough=true"\n');
|
|
1599
|
+
return 1;
|
|
1600
|
+
}
|
|
1601
|
+
var result;
|
|
1602
|
+
try {
|
|
1603
|
+
result = await (0, table_1.referenceAttrAudit)({
|
|
1604
|
+
client: (0, client_1.createClient)({}),
|
|
1605
|
+
scopePrefix: prefix,
|
|
1606
|
+
attribute: flags.attribute,
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
catch (e) {
|
|
1610
|
+
var msg = e instanceof Error ? e.message : String(e);
|
|
1611
|
+
if (/^reference-attr-audit:/.test(msg)) {
|
|
1612
|
+
process.stderr.write(msg + "\n");
|
|
1613
|
+
return 1;
|
|
1614
|
+
}
|
|
1615
|
+
throw e;
|
|
1616
|
+
}
|
|
1617
|
+
if (flags.json === "true") {
|
|
1618
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
1619
|
+
return 0;
|
|
1620
|
+
}
|
|
1621
|
+
process.stdout.write(result.scopePrefix + "* — " + result.total + " reference column(s), " +
|
|
1622
|
+
result.missing.length + " missing '" + result.attribute + "'" +
|
|
1623
|
+
(result.truncated ? " (SCAN TRUNCATED — results incomplete)" : "") + "\n");
|
|
1624
|
+
for (var i = 0; i < result.missing.length; i += 1) {
|
|
1625
|
+
var m = result.missing[i];
|
|
1626
|
+
process.stdout.write(" " + m.table + "." + m.element + " -> " + (m.reference || "(no target)") +
|
|
1627
|
+
" [" + (m.attributes || "no attributes") + "]\n");
|
|
1628
|
+
}
|
|
1629
|
+
return 0;
|
|
1630
|
+
}
|
|
1553
1631
|
/**
|
|
1554
1632
|
* dove-sn index-list:
|
|
1555
1633
|
* --table x_cadso_automate_message_batch_recipient [--json]
|
|
@@ -1710,6 +1788,7 @@ function parseBoolFlag(name, raw, verb = "set-column") {
|
|
|
1710
1788
|
* --table x_cadso_journey --column description --update-set <sys_id>
|
|
1711
1789
|
* [--label "Description"] [--mandatory true|false] [--default <v>]
|
|
1712
1790
|
* [--read-only true|false] [--max-length 4000] [--dependent-on-field <element>]
|
|
1791
|
+
* [--attributes "k=v,k2=v2"] (MERGED into the column's existing attributes)
|
|
1713
1792
|
* [--dry-run] [--json]
|
|
1714
1793
|
*
|
|
1715
1794
|
* Updates an EXISTING column's schema. `internal_type` and a rename are refused —
|
|
@@ -1751,6 +1830,9 @@ async function runSetColumn(flags, bare) {
|
|
|
1751
1830
|
if (flags["dependent-on-field"] !== undefined) {
|
|
1752
1831
|
attributes.dependentOnField = flags["dependent-on-field"].trim();
|
|
1753
1832
|
}
|
|
1833
|
+
// A bare --attributes is refused above (stringFlags); the value is validated in setColumn.
|
|
1834
|
+
if (flags.attributes !== undefined)
|
|
1835
|
+
attributes.attributes = flags.attributes;
|
|
1754
1836
|
if (flags["max-length"] !== undefined) {
|
|
1755
1837
|
var len = Number(flags["max-length"]);
|
|
1756
1838
|
// sys_dictionary.max_length is an integer; the MCP schema enforces int() too.
|
|
@@ -2766,6 +2848,9 @@ async function dispatch(parsed) {
|
|
|
2766
2848
|
if (parsed.command === "add-index") {
|
|
2767
2849
|
return await runAddIndex(parsed.flags);
|
|
2768
2850
|
}
|
|
2851
|
+
if (parsed.command === "reference-attr-audit") {
|
|
2852
|
+
return await runReferenceAttrAudit(parsed.flags);
|
|
2853
|
+
}
|
|
2769
2854
|
if (parsed.command === "index-list") {
|
|
2770
2855
|
return await runIndexList(parsed.flags);
|
|
2771
2856
|
}
|
package/dist/cliUsage.js
CHANGED
|
@@ -167,6 +167,10 @@ exports.VERB_USAGE = {
|
|
|
167
167
|
{ flag: "user-role", value: "<role>", note: "Role that may read the table." },
|
|
168
168
|
{ flag: "no-acls", note: "Skip the default access controls." },
|
|
169
169
|
{ flag: "no-menu", note: "Skip the application-menu module." },
|
|
170
|
+
{
|
|
171
|
+
flag: "no-readonly-clickthrough",
|
|
172
|
+
note: "Opt every reference column out of the readonly_clickthrough=true default (per column: readonly_clickthrough:false / attributes in --from-json).",
|
|
173
|
+
},
|
|
170
174
|
UPDATE_SET_FLAG,
|
|
171
175
|
{ flag: "save-action", value: "<sys_id>", note: "Advanced: override the Studio save UI action." },
|
|
172
176
|
{ flag: "columns-rel-id", value: "<sys_id>", note: "Advanced: override the Studio columns relationship id." },
|
|
@@ -176,7 +180,10 @@ exports.VERB_USAGE = {
|
|
|
176
180
|
],
|
|
177
181
|
gate: "dry-run-flag",
|
|
178
182
|
example: 'dove-sn create-table --name x_cadso_core_error --label Error --scope x_cadso_core --columns "Key:string:255, Severity:choice:50" --update-set <sys_id> --dry-run',
|
|
179
|
-
notes: [
|
|
183
|
+
notes: [
|
|
184
|
+
"Reference columns get sys_dictionary.attributes readonly_clickthrough=true by default; every column with attributes is read back after the save and merge-patched once into --update-set if they did not land.",
|
|
185
|
+
"Exit 2 when the platform reports the save failed, or a column's attributes could not be verified.",
|
|
186
|
+
],
|
|
180
187
|
},
|
|
181
188
|
"add-column": {
|
|
182
189
|
summary: "Add ONE column to an EXISTING table via a scope-aware sys_dictionary insert, then verify",
|
|
@@ -200,6 +207,15 @@ exports.VERB_USAGE = {
|
|
|
200
207
|
value: "<element>",
|
|
201
208
|
note: "Sibling column a document_id resolves against (its table_name column); must already exist.",
|
|
202
209
|
},
|
|
210
|
+
{
|
|
211
|
+
flag: "attributes",
|
|
212
|
+
value: '"k=v,k2=v2"',
|
|
213
|
+
note: "sys_dictionary.attributes to set; verified on read-back. Reference columns also get readonly_clickthrough=true unless you set it yourself.",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
flag: "no-readonly-clickthrough",
|
|
217
|
+
note: "Opt a reference column out of the readonly_clickthrough=true default.",
|
|
218
|
+
},
|
|
203
219
|
{
|
|
204
220
|
flag: "scope",
|
|
205
221
|
value: "<x_scope>",
|
|
@@ -222,7 +238,7 @@ exports.VERB_USAGE = {
|
|
|
222
238
|
gateNote: "--update-set is required unless --dry-run.",
|
|
223
239
|
example: "dove-sn add-column --table x_cadso_journey --label URL --type url --max-length 1024 --update-set <sys_id>",
|
|
224
240
|
notes: [
|
|
225
|
-
"Exit 2 when the write landed but the read-back does not show the column.",
|
|
241
|
+
"Exit 2 when the write landed but the read-back does not show the column (or its requested attributes).",
|
|
226
242
|
"Cross-scope: dove-sn add-column --table x_cadso_automate_email_batch --label 'Instance Step' --name instance_step --type reference --reference x_cadso_journey_instance_step --scope x_cadso_journey --cross-scope --update-set <journey set>",
|
|
227
243
|
],
|
|
228
244
|
},
|
|
@@ -247,7 +263,7 @@ exports.VERB_USAGE = {
|
|
|
247
263
|
],
|
|
248
264
|
},
|
|
249
265
|
"set-column": {
|
|
250
|
-
summary: "Update an EXISTING column's schema (label/mandatory/default/read-only/max-length/dependent-on-field), then verify",
|
|
266
|
+
summary: "Update an EXISTING column's schema (label/mandatory/default/read-only/max-length/dependent-on-field/attributes), then verify",
|
|
251
267
|
required: [
|
|
252
268
|
{ flag: "table", value: "<name>" },
|
|
253
269
|
{ flag: "column", value: "<element>" },
|
|
@@ -260,6 +276,11 @@ exports.VERB_USAGE = {
|
|
|
260
276
|
{ flag: "read-only", value: "<true|false>" },
|
|
261
277
|
{ flag: "max-length", value: "<n>", note: "Positive integer. A SHRINK is refused while rows hold longer values." },
|
|
262
278
|
{ flag: "dependent-on-field", value: "<element>", note: "Empty string clears the dependency." },
|
|
279
|
+
{
|
|
280
|
+
flag: "attributes",
|
|
281
|
+
value: '"k=v,k2=v2"',
|
|
282
|
+
note: "MERGED into the column's existing sys_dictionary.attributes — keys you don't name are kept. Refused on an inherited column.",
|
|
283
|
+
},
|
|
263
284
|
DRY_RUN_FLAG,
|
|
264
285
|
JSON_FLAG,
|
|
265
286
|
],
|
|
@@ -278,6 +299,7 @@ exports.VERB_USAGE = {
|
|
|
278
299
|
"update-set",
|
|
279
300
|
"updateSetSysId",
|
|
280
301
|
"dependent-on-field",
|
|
302
|
+
"attributes",
|
|
281
303
|
],
|
|
282
304
|
},
|
|
283
305
|
"set-table": {
|
|
@@ -321,6 +343,17 @@ exports.VERB_USAGE = {
|
|
|
321
343
|
"Exit 2 when the dictionary flag is set but no index was read back.",
|
|
322
344
|
],
|
|
323
345
|
},
|
|
346
|
+
"reference-attr-audit": {
|
|
347
|
+
summary: "List reference columns whose sys_dictionary.attributes lack readonly_clickthrough=true (or --attribute)",
|
|
348
|
+
required: [{ flag: "scope-prefix", value: "<prefix>", note: "Table-name prefix, e.g. x_cadso_." }],
|
|
349
|
+
optional: [
|
|
350
|
+
{ flag: "attribute", value: '"k=v"', note: "Attribute(s) to require. Default readonly_clickthrough=true." },
|
|
351
|
+
JSON_FLAG,
|
|
352
|
+
],
|
|
353
|
+
gate: "read-only",
|
|
354
|
+
example: "dove-sn reference-attr-audit --scope-prefix x_cadso_ --json",
|
|
355
|
+
notes: ["Report only — backfill with set-column --attributes per column, into an update set."],
|
|
356
|
+
},
|
|
324
357
|
"index-list": {
|
|
325
358
|
summary: "List a table's DATABASE indexes from the v_db_index view",
|
|
326
359
|
required: [{ flag: "table", value: "<name>" }],
|
|
@@ -594,14 +627,15 @@ exports.VERB_USAGE = {
|
|
|
594
627
|
notes: ["Exit 2 when the flow was created but the snapshot did not compile (not published)."],
|
|
595
628
|
},
|
|
596
629
|
"test-flow": {
|
|
597
|
-
summary: "Validate (default) or run a flow/subflow",
|
|
598
|
-
required: [{ flag: "sys-id", value: "<sys_id>", note: "sys_hub_flow sys_id (flow or subflow)." }],
|
|
630
|
+
summary: "Validate (default) or run a flow/subflow/action",
|
|
631
|
+
required: [{ flag: "sys-id", value: "<sys_id>", note: "sys_hub_flow sys_id (flow or subflow), or an action's with --action." }],
|
|
599
632
|
optional: [
|
|
633
|
+
{ flag: "action", note: "--sys-id is a sys_hub_action_type_definition (sent as actionSysId)." },
|
|
600
634
|
{ flag: "execute", note: "Actually run it (default is validate-only)." },
|
|
601
635
|
{ flag: "confirm", note: "Required with --execute — the deliberate run-for-real gate." },
|
|
602
636
|
{ flag: "inputs", value: "'<json>'", note: "JSON object of flow inputs." },
|
|
603
637
|
{ flag: "inputs-json", value: "<path>", note: "Same, from a file." },
|
|
604
|
-
{ flag: "runner", value: "<path>", note: "Override the
|
|
638
|
+
{ flag: "runner", value: "<path>", note: "Override the runner path (default /api/cadso/dovetail_core/runFlow; no legacy fallback when set)." },
|
|
605
639
|
JSON_FLAG,
|
|
606
640
|
],
|
|
607
641
|
gate: "execute-confirm",
|
package/dist/client.d.ts
CHANGED
|
@@ -231,4 +231,15 @@ export interface ServiceNowClient {
|
|
|
231
231
|
}) => Promise<void>;
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Dovetail core Scripted REST API base (ships in the Dovetail app). Every
|
|
236
|
+
* Dovetail server op is tried here first.
|
|
237
|
+
*/
|
|
238
|
+
export declare var DOVETAIL_CORE_API_BASE: string;
|
|
239
|
+
/**
|
|
240
|
+
* Legacy global-scope Dovetail Scripted REST API base. Clients fall back to it
|
|
241
|
+
* once, on a 404 from DOVETAIL_CORE_API_BASE, for instances that predate the
|
|
242
|
+
* Dovetail app.
|
|
243
|
+
*/
|
|
244
|
+
export declare var DOVETAIL_LEGACY_API_BASE: string;
|
|
234
245
|
export declare function createClient(config?: ServiceNowClientConfig): ServiceNowClient;
|
package/dist/client.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.PROCESSFLOW_PATH_PREFIX = void 0;
|
|
27
|
+
exports.DOVETAIL_LEGACY_API_BASE = exports.DOVETAIL_CORE_API_BASE = exports.PROCESSFLOW_PATH_PREFIX = void 0;
|
|
28
28
|
exports.resolveFlowAuth = resolveFlowAuth;
|
|
29
29
|
exports.isProcessflowPath = isProcessflowPath;
|
|
30
30
|
exports.createClient = createClient;
|
|
@@ -134,6 +134,17 @@ function sleep(ms) {
|
|
|
134
134
|
setTimeout(resolve, ms);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Dovetail core Scripted REST API base (ships in the Dovetail app). Every
|
|
139
|
+
* Dovetail server op is tried here first.
|
|
140
|
+
*/
|
|
141
|
+
exports.DOVETAIL_CORE_API_BASE = "/api/cadso/dovetail_core/";
|
|
142
|
+
/**
|
|
143
|
+
* Legacy global-scope Dovetail Scripted REST API base. Clients fall back to it
|
|
144
|
+
* once, on a 404 from DOVETAIL_CORE_API_BASE, for instances that predate the
|
|
145
|
+
* Dovetail app.
|
|
146
|
+
*/
|
|
147
|
+
exports.DOVETAIL_LEGACY_API_BASE = "/api/cadso/dovetail/";
|
|
137
148
|
/**
|
|
138
149
|
* Match a thrown error message against the 403/404 patterns produced by request().
|
|
139
150
|
* buildAgent.* uses this to decide when to fall back to the plain Table API.
|
|
@@ -303,8 +314,8 @@ function createClient(config = {}) {
|
|
|
303
314
|
// fall back to the legacy /api/cadso/dovetail/<op> on 404 (one-time warning).
|
|
304
315
|
async function dovetailRequest(method, op, body, params, ctx) {
|
|
305
316
|
var url = useDovetailLegacyPath
|
|
306
|
-
?
|
|
307
|
-
:
|
|
317
|
+
? exports.DOVETAIL_LEGACY_API_BASE + op
|
|
318
|
+
: exports.DOVETAIL_CORE_API_BASE + op;
|
|
308
319
|
try {
|
|
309
320
|
return await request({ method: method, url: url, data: body, params: params }, ctx);
|
|
310
321
|
}
|
|
@@ -312,11 +323,11 @@ function createClient(config = {}) {
|
|
|
312
323
|
var msg = e && e.message ? String(e.message) : "";
|
|
313
324
|
if (!useDovetailLegacyPath && msg.indexOf("SN 404 on") === 0) {
|
|
314
325
|
// eslint-disable-next-line no-console
|
|
315
|
-
console.warn("[deprecation]
|
|
316
|
-
" returned 404. Falling back to legacy
|
|
326
|
+
console.warn("[deprecation] " + exports.DOVETAIL_CORE_API_BASE + op +
|
|
327
|
+
" returned 404. Falling back to legacy " + exports.DOVETAIL_LEGACY_API_BASE + op +
|
|
317
328
|
". Install the Dovetail application's Scripted REST APIs to silence this warning.");
|
|
318
329
|
useDovetailLegacyPath = true;
|
|
319
|
-
var legacyUrl =
|
|
330
|
+
var legacyUrl = exports.DOVETAIL_LEGACY_API_BASE + op;
|
|
320
331
|
return await request({ method: method, url: legacyUrl, data: body, params: params }, ctx);
|
|
321
332
|
}
|
|
322
333
|
throw e;
|
|
@@ -33,8 +33,8 @@ export { createFlow, buildPublishModel } from "./createFlow";
|
|
|
33
33
|
export type { CreateFlowParams, CreateFlowResult } from "./createFlow";
|
|
34
34
|
export { editFlow } from "./editFlow";
|
|
35
35
|
export type { EditFlowParams, EditFlowResult, EditFlowOps, StepInputPatch } from "./editFlow";
|
|
36
|
-
export { testFlow, DEFAULT_RUN_FLOW_PATH } from "./testFlow";
|
|
37
|
-
export type { TestFlowParams, TestFlowResult } from "./testFlow";
|
|
36
|
+
export { testFlow, DEFAULT_RUN_FLOW_PATH, LEGACY_RUN_FLOW_PATH } from "./testFlow";
|
|
37
|
+
export type { TestFlowParams, TestFlowResult, TestFlowTarget } from "./testFlow";
|
|
38
38
|
export { generateSysId, stripSystemFields, applyScope, assertSysId, SYSTEM_FIELDS_TO_STRIP, } from "./shape";
|
|
39
39
|
export { topoSort, executeWritePlan, WriteOrderError } from "./writeOrder";
|
|
40
40
|
export type { WriteOp, WriteOpResult } from "./writeOrder";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* functions land in Phase 1.C/D.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.canonValue = exports.toDesignerStep = exports.diffViews = exports.viewAction = exports.validateDefineSpec = exports.planActionDefinition = exports.defineActionType = exports.WriteOrderError = exports.executeWritePlan = exports.topoSort = exports.SYSTEM_FIELDS_TO_STRIP = exports.assertSysId = exports.applyScope = exports.stripSystemFields = exports.generateSysId = exports.DEFAULT_RUN_FLOW_PATH = exports.testFlow = exports.editFlow = exports.buildPublishModel = exports.createFlow = exports.copyFlow = exports.publishFlow = exports.readActionType = exports.readFlow = exports.hasStepOps = exports.findStepInput = exports.findStep = exports.formatStepPill = exports.summarizeSteps = exports.verifySteps = exports.applyStepOps = exports.editActionType = exports.publishActionType = exports.triggerPublication = exports.actionTypePath = exports.fetchActionSteps = exports.remapClonedSteps = exports.slugInternalName = exports.resolveScope = exports.cloneActionType = exports.cloneSubflow = exports.verifyArtifact = exports.listTemplates = void 0;
|
|
9
|
+
exports.canonValue = exports.toDesignerStep = exports.diffViews = exports.viewAction = exports.validateDefineSpec = exports.planActionDefinition = exports.defineActionType = exports.WriteOrderError = exports.executeWritePlan = exports.topoSort = exports.SYSTEM_FIELDS_TO_STRIP = exports.assertSysId = exports.applyScope = exports.stripSystemFields = exports.generateSysId = exports.LEGACY_RUN_FLOW_PATH = exports.DEFAULT_RUN_FLOW_PATH = exports.testFlow = exports.editFlow = exports.buildPublishModel = exports.createFlow = exports.copyFlow = exports.publishFlow = exports.readActionType = exports.readFlow = exports.hasStepOps = exports.findStepInput = exports.findStep = exports.formatStepPill = exports.summarizeSteps = exports.verifySteps = exports.applyStepOps = exports.editActionType = exports.publishActionType = exports.triggerPublication = exports.actionTypePath = exports.fetchActionSteps = exports.remapClonedSteps = exports.slugInternalName = exports.resolveScope = exports.cloneActionType = exports.cloneSubflow = exports.verifyArtifact = exports.listTemplates = void 0;
|
|
10
10
|
var listTemplates_1 = require("./listTemplates");
|
|
11
11
|
Object.defineProperty(exports, "listTemplates", { enumerable: true, get: function () { return listTemplates_1.listTemplates; } });
|
|
12
12
|
var verifyArtifact_1 = require("./verifyArtifact");
|
|
@@ -51,6 +51,7 @@ Object.defineProperty(exports, "editFlow", { enumerable: true, get: function ()
|
|
|
51
51
|
var testFlow_1 = require("./testFlow");
|
|
52
52
|
Object.defineProperty(exports, "testFlow", { enumerable: true, get: function () { return testFlow_1.testFlow; } });
|
|
53
53
|
Object.defineProperty(exports, "DEFAULT_RUN_FLOW_PATH", { enumerable: true, get: function () { return testFlow_1.DEFAULT_RUN_FLOW_PATH; } });
|
|
54
|
+
Object.defineProperty(exports, "LEGACY_RUN_FLOW_PATH", { enumerable: true, get: function () { return testFlow_1.LEGACY_RUN_FLOW_PATH; } });
|
|
54
55
|
var shape_1 = require("./shape");
|
|
55
56
|
Object.defineProperty(exports, "generateSysId", { enumerable: true, get: function () { return shape_1.generateSysId; } });
|
|
56
57
|
Object.defineProperty(exports, "stripSystemFields", { enumerable: true, get: function () { return shape_1.stripSystemFields; } });
|
|
@@ -5,46 +5,70 @@
|
|
|
5
5
|
*
|
|
6
6
|
* mode="validate" (DEFAULT, no execution, zero risk):
|
|
7
7
|
* Reads the compiled model and checks the artifact is runnable — published,
|
|
8
|
-
* readable — and that the inputs you supplied match
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* readable — and that the inputs you supplied match its declared variables
|
|
9
|
+
* (flags unknown inputs). This is the safe pre-flight you can run anytime;
|
|
10
|
+
* it never triggers the flow.
|
|
11
11
|
*
|
|
12
12
|
* mode="execute" (actually runs it):
|
|
13
|
-
* POSTs to the
|
|
14
|
-
*
|
|
15
|
-
* .
|
|
16
|
-
* UI "Test" button
|
|
17
|
-
*
|
|
13
|
+
* POSTs to the Dovetail Core `runFlow` Scripted REST op
|
|
14
|
+
* (/api/cadso/dovetail_core/runFlow), which ships with the Dovetail app and
|
|
15
|
+
* calls sn_fd.FlowAPI.getRunner().flow|subflow|action(name).inForeground()
|
|
16
|
+
* .withInputs(inputs).run() — see resources/runFlow.md. The UI "Test" button
|
|
17
|
+
* has no guessable native REST route, so this server-side runner is the
|
|
18
|
+
* supported, uniform path across flow | subflow | action.
|
|
18
19
|
* Execution is GUARDED: you must pass mode="execute" AND confirm=true.
|
|
19
20
|
*
|
|
21
|
+
* Path resolution mirrors the client's Dovetail core → legacy fallback: the
|
|
22
|
+
* Dovetail Core path is tried first; a route-level 404 (the op itself is not
|
|
23
|
+
* installed) falls back ONCE to the legacy global path /api/cadso/dovetail/runFlow.
|
|
24
|
+
* An explicit `runnerPath` always wins and never falls back.
|
|
25
|
+
*
|
|
20
26
|
* Executing a flow can cause real side effects (the example subflow sends an
|
|
21
27
|
* SMS). Prefer mode="validate"; gate mode="execute" behind a sandbox flow.
|
|
22
28
|
*/
|
|
23
29
|
import type { ServiceNowClient } from "../client";
|
|
24
|
-
/** Default runner endpoint —
|
|
30
|
+
/** Default runner endpoint — the Dovetail Core runFlow op (ships with the Dovetail app). */
|
|
25
31
|
export declare var DEFAULT_RUN_FLOW_PATH: string;
|
|
32
|
+
/** Legacy global-scope runner path, tried once when the default path 404s. */
|
|
33
|
+
export declare var LEGACY_RUN_FLOW_PATH: string;
|
|
34
|
+
/** What `sysId` points at: a sys_hub_flow (flow or subflow) or a sys_hub_action_type_definition. */
|
|
35
|
+
export type TestFlowTarget = "flow" | "action";
|
|
26
36
|
export interface TestFlowParams {
|
|
27
37
|
client: ServiceNowClient;
|
|
28
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* sys_id of the artifact to test: a sys_hub_flow (flow or subflow) when
|
|
40
|
+
* target="flow" (default), or a sys_hub_action_type_definition when
|
|
41
|
+
* target="action".
|
|
42
|
+
*/
|
|
29
43
|
sysId: string;
|
|
44
|
+
/** "flow" (default — sys_hub_flow, sent as flowSysId) or "action" (sent as actionSysId). */
|
|
45
|
+
target?: TestFlowTarget;
|
|
30
46
|
/** "validate" (default — no execution) or "execute" (runs it; requires confirm). */
|
|
31
47
|
mode?: "validate" | "execute";
|
|
32
|
-
/** Inputs passed to the flow. Keys should match declared
|
|
33
|
-
inputs?: Record<string,
|
|
48
|
+
/** Inputs passed to the flow/action. Keys should match declared input names. */
|
|
49
|
+
inputs?: Record<string, unknown>;
|
|
34
50
|
/** Required to be true for mode="execute" — a deliberate run-this-for-real gate. */
|
|
35
51
|
confirm?: boolean;
|
|
36
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Override the runner endpoint path. When set it is used as-is with NO
|
|
54
|
+
* fallback; when omitted, DEFAULT_RUN_FLOW_PATH is tried, then
|
|
55
|
+
* LEGACY_RUN_FLOW_PATH once on a route-level 404.
|
|
56
|
+
*/
|
|
37
57
|
runnerPath?: string;
|
|
38
58
|
}
|
|
39
59
|
export interface TestFlowResult {
|
|
40
60
|
mode: "validate" | "execute";
|
|
41
|
-
/** Whether the artifact is runnable / the run
|
|
61
|
+
/** Whether the artifact is runnable / the run succeeded. */
|
|
42
62
|
ok: boolean;
|
|
43
63
|
/** Human-readable findings (validation notes, run status). */
|
|
44
64
|
notes: Array<string>;
|
|
45
65
|
/** For execute mode: the run context sys_id, when the runner returns one. */
|
|
46
66
|
contextSysId?: string;
|
|
47
|
-
/** For execute mode: the
|
|
48
|
-
|
|
67
|
+
/** For execute mode: the HTTP status the runner answered with. */
|
|
68
|
+
httpStatus?: number;
|
|
69
|
+
/** For execute mode: the runner path that answered. */
|
|
70
|
+
runnerPath?: string;
|
|
71
|
+
/** For execute mode: the raw (unwrapped) runner response. */
|
|
72
|
+
run?: unknown;
|
|
49
73
|
}
|
|
50
74
|
export declare function testFlow(params: TestFlowParams): Promise<TestFlowResult>;
|