@tenonhq/dovetail-servicenow 0.0.57 → 0.0.59

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 CHANGED
@@ -670,7 +670,9 @@ graph + the physical table + seeded ACLs. Before the save it switches the form
670
670
  session's **current application** to the target scope (the new table's scope is
671
671
  governed by the session app, not a form field), so the table, columns, ACLs, and
672
672
  module all land in `--scope`. Friendly column types are mapped to ServiceNow
673
- internal types (`string` → `string_full_utf8`, Studio's real String type).
673
+ internal types (`string` → `string_full_utf8`, Studio's real String type; `phone` →
674
+ `phone_number_e164`, the E.164 Phone Number type). Any ServiceNow internal type on the
675
+ allow-list in `buildTableSave.ts` also passes through as-is.
674
676
 
675
677
  `--dry-run` returns the plan + the column XML + the projected graph with no session
676
678
  and no writes. **Validated live 2026-06-13** (tenonworkstudio): a 6-column create
@@ -1171,9 +1173,10 @@ Produce the `<unload>` document the implementation team imports on a customer
1171
1173
  instance — with every secret value replaced by `__SET_DURING_INSTALL__`.
1172
1174
 
1173
1175
  ```bash
1174
- # An update set. assemble mode is READ-ONLY: nothing on the instance changes.
1176
+ # An update set, through the instance's own export servlet. A set still in
1177
+ # progress is marked complete first, which needs --confirm.
1175
1178
  npx dove-sn export-update-set --update-set 0123456789abcdef0123456789abcdef \
1176
- --out ./tenon-core.xml
1179
+ --out ./tenon-core.xml --confirm
1177
1180
 
1178
1181
  # A whole app: publish into a new set, then export it. Dry-run first (default).
1179
1182
  npx dove-sn export-app --app x_cadso_automate --out ./automate.xml
@@ -1220,15 +1223,22 @@ empty 200** from `export_update_set.do` (the servlet streams a document only for
1220
1223
  a *complete* set, and app-publish leaves the set in progress). After stripping,
1221
1224
  the output is re-read and verified; a secret that somehow survived fails the run.
1222
1225
 
1223
- `export-update-set --mode complete` marks the set complete on the instance
1224
- first — a real write, so it needs `--confirm`. `export-app` publishes ~1000+
1226
+ `export-update-set` always reads the document from `export_update_set.do`, the
1227
+ same export the UI's **Export Update Set to XML** runs, so the file imports
1228
+ exactly like a UI export. A set still in progress is marked complete first — a
1229
+ real write, so it needs `--confirm`; a complete set exports with no write. The
1230
+ servlet is a `.do` page, so the instance must accept your username and password
1231
+ for form login (API-key-only auth cannot export). The old read-only
1232
+ `--mode assemble` (and its `--page-size` / `--max-rows`) is gone: it built the
1233
+ document from `sys_update_xml` rows without linking them to the remote update
1234
+ set, so its files imported with 0 updates. `export-app` publishes ~1000+
1225
1235
  records into a new update set and is dry-run by default. Neither is the Store
1226
1236
  publish; that is `publish-app`, which is externally visible.
1227
1237
 
1228
1238
  Exit codes: `0` exported or dry-run, `1` bad args/unconfirmed, `2`
1229
- failed/timeout. Programmatic: `exportUpdateSet({ updateSet, mode })`,
1239
+ failed/timeout. Programmatic: `exportUpdateSet({ updateSet, confirm })`,
1230
1240
  `exportApp({ app, confirm })`, `stripSecrets(xml, rules)`. MCP:
1231
- `update_set_export` (read-only in assemble mode) and `app_export`.
1241
+ `update_set_export` (writes when the set is in progress) and `app_export`.
1232
1242
 
1233
1243
  `test-flow` defaults to **validate** — a safe pre-flight (published? inputs match
1234
1244
  declared variables?) that never runs the flow; `--execute --confirm` runs it via
package/dist/cli.js CHANGED
@@ -2575,15 +2575,14 @@ async function runPublishApp(flags) {
2575
2575
  /**
2576
2576
  * dove-sn export-update-set:
2577
2577
  * --update-set <sys_id|name> Required. The set to export.
2578
- * [--mode assemble|complete] assemble (default) is READ-ONLY; complete marks
2579
- * the set complete on the instance first, which is
2580
- * a real write and needs --confirm.
2581
2578
  * [--out <file>] Write the XML here (default: stdout is NOT used —
2582
2579
  * a document this size belongs in a file).
2583
2580
  * [--rules <file>] JSON overrides for the secret rules.
2584
- * [--page-size <n>] [--max-rows <n>]
2585
2581
  * [--dry-run] [--json] [--confirm]
2586
2582
  *
2583
+ * The document comes from the instance's own export servlet (the UI's "Export
2584
+ * Update Set to XML"). A set still in progress is marked complete first, which
2585
+ * is a real write and needs --confirm; a complete set exports with no write.
2587
2586
  * Secret values are ALWAYS replaced with __SET_DURING_INSTALL__; there is no
2588
2587
  * opt-out flag. A field that looks secret and is covered by no rule fails the
2589
2588
  * run, and nothing is written.
@@ -2595,9 +2594,18 @@ async function runExportUpdateSet(flags) {
2595
2594
  process.stderr.write("export-update-set: --update-set <sys_id|name> is required\n");
2596
2595
  return 1;
2597
2596
  }
2598
- var mode = flags.mode || "assemble";
2599
- if (mode !== "assemble" && mode !== "complete") {
2600
- process.stderr.write("export-update-set: --mode must be assemble or complete\n");
2597
+ // The read-only assemble mode was removed: its documents imported with 0
2598
+ // updates. Refuse its flags loudly rather than silently doing something else.
2599
+ if (flags.mode !== undefined && flags.mode !== "complete") {
2600
+ process.stderr.write("export-update-set: --mode " +
2601
+ flags.mode +
2602
+ " is no longer supported. The export always goes through the instance's " +
2603
+ "export servlet; drop --mode (a set still in progress needs --confirm).\n");
2604
+ return 1;
2605
+ }
2606
+ if (flags["page-size"] !== undefined || flags["max-rows"] !== undefined) {
2607
+ process.stderr.write("export-update-set: --page-size and --max-rows were removed with the assemble " +
2608
+ "mode; the export servlet returns the whole set. Drop them.\n");
2601
2609
  return 1;
2602
2610
  }
2603
2611
  var outPath = flags.out;
@@ -2605,30 +2613,11 @@ async function runExportUpdateSet(flags) {
2605
2613
  process.stderr.write("export-update-set: --out <file> is required for a real export\n");
2606
2614
  return 1;
2607
2615
  }
2608
- var pageSize = undefined;
2609
- if (flags["page-size"]) {
2610
- pageSize = Number(flags["page-size"]);
2611
- if (!Number.isInteger(pageSize) || pageSize < 1) {
2612
- process.stderr.write("export-update-set: --page-size must be a positive integer\n");
2613
- return 1;
2614
- }
2615
- }
2616
- var maxRows = undefined;
2617
- if (flags["max-rows"]) {
2618
- maxRows = Number(flags["max-rows"]);
2619
- if (!Number.isInteger(maxRows) || maxRows < 1) {
2620
- process.stderr.write("export-update-set: --max-rows must be a positive integer\n");
2621
- return 1;
2622
- }
2623
- }
2624
2616
  var result = await (0, exportUpdateSet_1.exportUpdateSet)({
2625
2617
  updateSet: selector,
2626
- mode: mode,
2627
2618
  confirm: flags.confirm === "true",
2628
2619
  dryRun: flags["dry-run"] === "true",
2629
2620
  rulesPath: flags.rules,
2630
- pageSize: pageSize,
2631
- maxRows: maxRows,
2632
2621
  });
2633
2622
  if (result.status === "exported" && result.xml && outPath) {
2634
2623
  fs.writeFileSync(path.resolve(outPath), result.xml, "utf8");
package/dist/cliUsage.js CHANGED
@@ -822,24 +822,19 @@ exports.VERB_USAGE = {
822
822
  { flag: "out", value: "<file>", note: "Required unless --dry-run; the XML is never written to stdout." },
823
823
  ],
824
824
  optional: [
825
- {
826
- flag: "mode",
827
- value: "<assemble|complete>",
828
- note: "assemble (default) is READ-ONLY; complete marks the set complete on the instance first.",
829
- },
830
825
  { flag: "rules", value: "<file>", note: "JSON overrides for the secret rules." },
831
- { flag: "page-size", value: "<n>", note: "Positive integer." },
832
- { flag: "max-rows", value: "<n>", note: "Positive integer." },
833
- { flag: "confirm", note: "Required for --mode complete." },
826
+ { flag: "confirm", note: "Required when the set is still in progress (it is marked complete first)." },
834
827
  DRY_RUN_FLAG,
835
828
  JSON_FLAG,
836
829
  ],
837
- gate: "read-only",
838
- gateNote: "That is assemble mode. --mode complete is a real write (marks the set complete) and needs --confirm.",
839
- example: "dove-sn export-update-set --update-set <sys_id> --out ./release.xml",
830
+ gate: "confirm",
831
+ gateNote: "The XML comes from the instance's own export servlet (the UI's Export Update Set to XML), which only streams a complete set. A set still in progress is marked complete first — a real write that needs --confirm. A complete set exports with no write.",
832
+ example: "dove-sn export-update-set --update-set <sys_id> --out ./release.xml --confirm",
840
833
  notes: [
841
834
  "Secret stripping has no opt-out; a secret-looking field covered by no rule fails the run and nothing is written.",
842
- "Exit 1 when complete mode runs unconfirmed; 2 on failure.",
835
+ "Needs a username + password the instance accepts for form login (the servlet is a .do page); API-key-only auth cannot export.",
836
+ "--mode, --page-size and --max-rows were removed with the read-only assemble mode, whose files imported with 0 updates.",
837
+ "Exit 1 when an in-progress set runs unconfirmed; 2 on failure.",
843
838
  ],
844
839
  },
845
840
  "export-app": {
package/dist/exportApp.js CHANGED
@@ -257,7 +257,6 @@ async function exportApp(params) {
257
257
  }
258
258
  var exported = await (0, exportUpdateSet_1.exportUpdateSet)({
259
259
  updateSet: result.updateSetSysId,
260
- mode: "complete",
261
260
  confirm: true,
262
261
  client: client,
263
262
  instance: params.instance,
@@ -2,23 +2,20 @@
2
2
  * Export a ServiceNow update set to an importable `<unload>` XML document, with
3
3
  * secret values replaced by a sentinel before the document is ever returned.
4
4
  *
5
- * Ground truth for the mechanism: `brainstorms/sn-export-app-flow.md` in the CTO
6
- * repo (HAR capture, tenonworkshop 2026-06-08) plus a live run of the same flow.
7
- * Two findings shape this verb:
5
+ * The document always comes from ServiceNow's own export servlet,
6
+ * `GET /export_update_set.do?sysparm_sys_id=<set>` — the same "Export Update Set
7
+ * to XML" the UI runs — so it imports exactly as a UI export does. Ground truth:
8
+ * `brainstorms/sn-export-app-flow.md` in the CTO repo (HAR capture, tenonworkshop
9
+ * 2026-06-08) plus a live run of the same flow.
8
10
  *
9
- * 1. `GET /export_update_set.do?sysparm_sys_id=<set>` streams the `<unload>`
10
- * only for a COMPLETE set. For a set still in progress the servlet answers
11
- * HTTP 200 with an EMPTY BODY — a silent no-op that looks like success.
12
- * 2. The same document can be assembled read-only from the set's
13
- * `sys_update_xml` rows, with no state write at all.
11
+ * The servlet streams the `<unload>` only for a COMPLETE set; for a set still in
12
+ * progress it answers HTTP 200 with an EMPTY BODY, a silent no-op that looks like
13
+ * success. So an in-progress set is marked complete first — a REAL WRITE, which
14
+ * needs confirm. A set that is already complete is exported without any write.
14
15
  *
15
- * Hence two modes:
16
- *
17
- * assemble (default) — read-only. Pages the set's `sys_update_xml` rows and
18
- * wraps them in an `<unload>`. Touches no instance state, so it is safe for
19
- * packaging work against a shared instance.
20
- * complete — marks the set complete (a REAL WRITE, hence confirm) and lets the
21
- * servlet produce the document, for byte-fidelity with the UI export.
16
+ * There used to be a read-only "assemble" mode that built the document from the
17
+ * set's sys_update_xml rows. It is gone: its documents carried no link from the
18
+ * rows to the remote update set, so they imported with 0 updates.
22
19
  *
23
20
  * SECRETS ARE ALWAYS STRIPPED. There is no opt-out flag: a field is exempted
24
21
  * only by a reviewed `notSecret` entry in the rules file, with a reason. If a
@@ -31,8 +28,6 @@ import type { ServiceNowClient } from "./client";
31
28
  import type { FormAuth, FormSession, PostResult } from "./table";
32
29
  import type { SecretRules } from "./secrets/secretRules";
33
30
  import type { SecretField, ReviewFinding } from "./secrets/stripSecrets";
34
- /** How the `<unload>` is produced. */
35
- export type ExportMode = "assemble" | "complete";
36
31
  /** Injectable transport, so tests never touch the network. */
37
32
  export interface ExportTransport {
38
33
  openSession?: (auth: FormAuth) => Promise<FormSession>;
@@ -42,37 +37,30 @@ export interface ExportTransport {
42
37
  export interface ExportUpdateSetParams {
43
38
  /** Update set sys_id, or its exact name. */
44
39
  updateSet: string;
45
- /** Default "assemble" (read-only). "complete" writes the set's state first. */
46
- mode?: ExportMode;
47
40
  /** Injectable for tests; defaults to createClient({}). */
48
41
  client?: ServiceNowClient;
49
- /** Instance host for the form session (complete mode only). */
42
+ /** Instance host for the form session. */
50
43
  instance?: string;
51
44
  user?: string;
52
45
  password?: string;
53
- /** Required for "complete", which writes to the instance. */
46
+ /** Required when the set is still in progress: marking it complete writes. */
54
47
  confirm?: boolean;
55
48
  /** Force a plan-only run. Wins over confirm. */
56
49
  dryRun?: boolean;
57
50
  /** Optional JSON rules file merged over the built-in secret rules. */
58
51
  rulesPath?: string;
59
- /** Rows per page when assembling. Default 500, max 1000 (the instance cap). */
60
- pageSize?: number;
61
- /** Safety stop for a runaway page loop. Default 200000 rows. */
62
- maxRows?: number;
63
52
  /** Test seam for the form session and servlet GET. */
64
53
  transport?: ExportTransport;
65
54
  }
66
55
  /** Outcome of an export. */
67
56
  export interface ExportUpdateSetResult {
68
57
  status: "dry-run" | "exported" | "failed";
69
- mode: ExportMode;
70
58
  updateSetSysId: string;
71
59
  updateSetName: string;
72
60
  scope: string;
73
61
  /** Rows the instance reports for the set. */
74
62
  expectedRecords: number;
75
- /** Rows actually written into the document. */
63
+ /** Rows in the servlet's document. */
76
64
  recordCount: number;
77
65
  /** The document. Absent on dry-run and failure. */
78
66
  xml?: string;
@@ -85,38 +73,12 @@ export interface ExportUpdateSetResult {
85
73
  /** Human-readable summary of what happened, always present. */
86
74
  note: string;
87
75
  }
88
- /** Rows per page when assembling. */
89
- export declare var DEFAULT_PAGE_SIZE: number;
90
- /** The instance caps a Table API page at 1000 rows. */
91
- export declare var MAX_PAGE_SIZE: number;
92
- /** Safety stop so a paging bug cannot spin forever. */
93
- export declare var DEFAULT_MAX_ROWS: number;
94
- /**
95
- * Field order of a `sys_update_xml` row inside an `<unload>`. Mirrors what the
96
- * export servlet emits, so an assembled document imports the same way.
97
- */
98
- export declare var UPDATE_XML_FIELDS: ReadonlyArray<string>;
99
76
  /** Escape a value for an XML element body. */
100
77
  export declare function xmlEscape(value: string): string;
101
- /** Render one `sys_update_xml` row as an `<unload>` child element. */
102
- export declare function renderUpdateXmlRow(row: Record<string, unknown>): string;
103
- /** The `sys_remote_update_set` header an importable document needs. */
104
- export declare function renderRemoteUpdateSet(set: {
105
- sys_id: string;
106
- name: string;
107
- scope: string;
108
- description: string;
109
- }, recordCount: number, unloadDate: string): string;
110
- /** Wrap rendered rows in the `<unload>` envelope. */
111
- export declare function renderUnload(header: string, rows: Array<string>, unloadDate: string): string;
112
- /** ServiceNow-style timestamp, e.g. "2026-09-15 18:40:02". */
113
- export declare function formatUnloadDate(now: Date): string;
114
78
  /** Rows the instance reports for a set, via the aggregate API. */
115
79
  export declare function countUpdateXml(client: ServiceNowClient, updateSetSysId: string): Promise<number>;
116
80
  /** Pull the count out of an /api/now/stats response. */
117
81
  export declare function parseStatsCount(body: unknown): number;
118
- /** Page every `sys_update_xml` row of a set, oldest first. */
119
- export declare function fetchUpdateXmlRows(client: ServiceNowClient, updateSetSysId: string, pageSize: number, maxRows: number): Promise<Array<Record<string, unknown>>>;
120
82
  /**
121
83
  * Refresh the L1 (password-typed field) map from the live dictionary, so tables
122
84
  * added by a plugin since the baseline are covered. Falls back to the baseline
@@ -3,23 +3,20 @@
3
3
  * Export a ServiceNow update set to an importable `<unload>` XML document, with
4
4
  * secret values replaced by a sentinel before the document is ever returned.
5
5
  *
6
- * Ground truth for the mechanism: `brainstorms/sn-export-app-flow.md` in the CTO
7
- * repo (HAR capture, tenonworkshop 2026-06-08) plus a live run of the same flow.
8
- * Two findings shape this verb:
6
+ * The document always comes from ServiceNow's own export servlet,
7
+ * `GET /export_update_set.do?sysparm_sys_id=<set>` — the same "Export Update Set
8
+ * to XML" the UI runs — so it imports exactly as a UI export does. Ground truth:
9
+ * `brainstorms/sn-export-app-flow.md` in the CTO repo (HAR capture, tenonworkshop
10
+ * 2026-06-08) plus a live run of the same flow.
9
11
  *
10
- * 1. `GET /export_update_set.do?sysparm_sys_id=<set>` streams the `<unload>`
11
- * only for a COMPLETE set. For a set still in progress the servlet answers
12
- * HTTP 200 with an EMPTY BODY — a silent no-op that looks like success.
13
- * 2. The same document can be assembled read-only from the set's
14
- * `sys_update_xml` rows, with no state write at all.
12
+ * The servlet streams the `<unload>` only for a COMPLETE set; for a set still in
13
+ * progress it answers HTTP 200 with an EMPTY BODY, a silent no-op that looks like
14
+ * success. So an in-progress set is marked complete first — a REAL WRITE, which
15
+ * needs confirm. A set that is already complete is exported without any write.
15
16
  *
16
- * Hence two modes:
17
- *
18
- * assemble (default) — read-only. Pages the set's `sys_update_xml` rows and
19
- * wraps them in an `<unload>`. Touches no instance state, so it is safe for
20
- * packaging work against a shared instance.
21
- * complete — marks the set complete (a REAL WRITE, hence confirm) and lets the
22
- * servlet produce the document, for byte-fidelity with the UI export.
17
+ * There used to be a read-only "assemble" mode that built the document from the
18
+ * set's sys_update_xml rows. It is gone: its documents carried no link from the
19
+ * rows to the remote update set, so they imported with 0 updates.
23
20
  *
24
21
  * SECRETS ARE ALWAYS STRIPPED. There is no opt-out flag: a field is exempted
25
22
  * only by a reviewed `notSecret` entry in the rules file, with a reason. If a
@@ -29,15 +26,9 @@
29
26
  * ES6 only, no optional chaining.
30
27
  */
31
28
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.UPDATE_XML_FIELDS = exports.DEFAULT_MAX_ROWS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = void 0;
33
29
  exports.xmlEscape = xmlEscape;
34
- exports.renderUpdateXmlRow = renderUpdateXmlRow;
35
- exports.renderRemoteUpdateSet = renderRemoteUpdateSet;
36
- exports.renderUnload = renderUnload;
37
- exports.formatUnloadDate = formatUnloadDate;
38
30
  exports.countUpdateXml = countUpdateXml;
39
31
  exports.parseStatsCount = parseStatsCount;
40
- exports.fetchUpdateXmlRows = fetchUpdateXmlRows;
41
32
  exports.refreshTypeFields = refreshTypeFields;
42
33
  exports.exportUpdateSet = exportUpdateSet;
43
34
  exports.countUnloadRecords = countUnloadRecords;
@@ -45,36 +36,9 @@ const client_1 = require("./client");
45
36
  const table_1 = require("./table");
46
37
  const secretRules_1 = require("./secrets/secretRules");
47
38
  const stripSecrets_1 = require("./secrets/stripSecrets");
48
- /** Rows per page when assembling. */
49
- exports.DEFAULT_PAGE_SIZE = 500;
50
39
  /** The instance caps a Table API page at 1000 rows. */
51
- exports.MAX_PAGE_SIZE = 1000;
52
- /** Safety stop so a paging bug cannot spin forever. */
53
- exports.DEFAULT_MAX_ROWS = 200000;
40
+ var DICTIONARY_LIMIT = 1000;
54
41
  var SYS_ID_RE = /^[0-9a-f]{32}$/;
55
- /**
56
- * Field order of a `sys_update_xml` row inside an `<unload>`. Mirrors what the
57
- * export servlet emits, so an assembled document imports the same way.
58
- */
59
- exports.UPDATE_XML_FIELDS = [
60
- "action",
61
- "application",
62
- "category",
63
- "comments",
64
- "name",
65
- "payload",
66
- "type",
67
- "target_name",
68
- "update_domain",
69
- "update_guid",
70
- "update_guid_history",
71
- "view",
72
- "replace_on_upgrade",
73
- "sys_id",
74
- "sys_recorded_at",
75
- "sys_created_on",
76
- "sys_updated_on",
77
- ];
78
42
  /** Escape a value for an XML element body. */
79
43
  function xmlEscape(value) {
80
44
  return value
@@ -103,67 +67,6 @@ function asText(value) {
103
67
  }
104
68
  return "";
105
69
  }
106
- /** Render one `sys_update_xml` row as an `<unload>` child element. */
107
- function renderUpdateXmlRow(row) {
108
- var parts = ['<sys_update_xml action="INSERT_OR_UPDATE">'];
109
- for (var i = 0; i < exports.UPDATE_XML_FIELDS.length; i += 1) {
110
- var field = exports.UPDATE_XML_FIELDS[i];
111
- if (!(field in row)) {
112
- continue;
113
- }
114
- var text = asText(row[field]);
115
- parts.push("<" + field + ">" + xmlEscape(text) + "</" + field + ">");
116
- }
117
- parts.push("</sys_update_xml>");
118
- return parts.join("");
119
- }
120
- /** The `sys_remote_update_set` header an importable document needs. */
121
- function renderRemoteUpdateSet(set, recordCount, unloadDate) {
122
- return ('<sys_remote_update_set action="INSERT_OR_UPDATE">' +
123
- "<application>" +
124
- xmlEscape(set.scope) +
125
- "</application>" +
126
- "<description>" +
127
- xmlEscape(set.description) +
128
- "</description>" +
129
- "<name>" +
130
- xmlEscape(set.name) +
131
- "</name>" +
132
- "<origin_sys_id>" +
133
- xmlEscape(set.sys_id) +
134
- "</origin_sys_id>" +
135
- "<remote_sys_id>" +
136
- xmlEscape(set.sys_id) +
137
- "</remote_sys_id>" +
138
- "<state>loaded</state>" +
139
- "<summary/>" +
140
- "<sys_created_on>" +
141
- xmlEscape(unloadDate) +
142
- "</sys_created_on>" +
143
- "<update_set>" +
144
- xmlEscape(set.sys_id) +
145
- "</update_set>" +
146
- "<update_source/>" +
147
- "<update_count>" +
148
- String(recordCount) +
149
- "</update_count>" +
150
- "</sys_remote_update_set>");
151
- }
152
- /** Wrap rendered rows in the `<unload>` envelope. */
153
- function renderUnload(header, rows, unloadDate) {
154
- return ('<?xml version="1.0" encoding="UTF-8"?>' +
155
- '<unload unload_date="' +
156
- xmlEscape(unloadDate) +
157
- '">' +
158
- header +
159
- rows.join("") +
160
- "</unload>");
161
- }
162
- /** ServiceNow-style timestamp, e.g. "2026-09-15 18:40:02". */
163
- function formatUnloadDate(now) {
164
- var iso = now.toISOString();
165
- return iso.slice(0, 10) + " " + iso.slice(11, 19);
166
- }
167
70
  async function resolveUpdateSet(client, selector) {
168
71
  var query = SYS_ID_RE.test(selector)
169
72
  ? "sys_id=" + selector
@@ -218,47 +121,6 @@ function parseStatsCount(body) {
218
121
  }
219
122
  return n;
220
123
  }
221
- /** Page every `sys_update_xml` row of a set, oldest first. */
222
- async function fetchUpdateXmlRows(client, updateSetSysId, pageSize, maxRows) {
223
- var out = [];
224
- var offset = 0;
225
- while (true) {
226
- var res = await client.now.invoke({
227
- method: "GET",
228
- path: "/api/now/table/sys_update_xml?sysparm_display_value=false" +
229
- "&sysparm_exclude_reference_link=true" +
230
- "&sysparm_fields=" +
231
- encodeURIComponent(exports.UPDATE_XML_FIELDS.join(",")) +
232
- "&sysparm_query=" +
233
- encodeURIComponent("update_set=" + updateSetSysId + "^ORDERBYsys_recorded_at") +
234
- "&sysparm_limit=" +
235
- String(pageSize) +
236
- "&sysparm_offset=" +
237
- String(offset),
238
- });
239
- if (res.status !== 200) {
240
- throw new Error("export-update-set: reading the set's records failed at offset " +
241
- offset +
242
- " (HTTP " +
243
- res.status +
244
- "). Nothing was written.");
245
- }
246
- var body = res.body;
247
- var page = body && Array.isArray(body.result) ? body.result : [];
248
- for (var i = 0; i < page.length; i += 1) {
249
- out.push(page[i]);
250
- }
251
- if (page.length < pageSize) {
252
- return out;
253
- }
254
- offset += page.length;
255
- if (out.length > maxRows) {
256
- throw new Error("export-update-set: the set exceeds maxRows (" +
257
- maxRows +
258
- ") — raise it deliberately rather than exporting a truncated document.");
259
- }
260
- }
261
- }
262
124
  /**
263
125
  * Refresh the L1 (password-typed field) map from the live dictionary, so tables
264
126
  * added by a plugin since the baseline are covered. Falls back to the baseline
@@ -266,7 +128,7 @@ async function fetchUpdateXmlRows(client, updateSetSysId, pageSize, maxRows) {
266
128
  * widen what ships, and the baseline is the conservative answer.
267
129
  */
268
130
  async function refreshTypeFields(client, rules) {
269
- var dictRows = await client.table.query("sys_dictionary", "internal_typeINpassword,password2", { limit: exports.MAX_PAGE_SIZE, fields: ["name", "element", "internal_type"] });
131
+ var dictRows = await client.table.query("sys_dictionary", "internal_typeINpassword,password2", { limit: DICTIONARY_LIMIT, fields: ["name", "element", "internal_type"] });
270
132
  if (!dictRows || dictRows.length === 0) {
271
133
  return rules;
272
134
  }
@@ -276,7 +138,7 @@ async function refreshTypeFields(client, rules) {
276
138
  names[dictRows[i].name] = true;
277
139
  }
278
140
  }
279
- var collectionRows = await client.table.query("sys_dictionary", "internal_type=collection^nameIN" + Object.keys(names).join(","), { limit: exports.MAX_PAGE_SIZE, fields: ["name", "attributes"] });
141
+ var collectionRows = await client.table.query("sys_dictionary", "internal_type=collection^nameIN" + Object.keys(names).join(","), { limit: DICTIONARY_LIMIT, fields: ["name", "attributes"] });
280
142
  var capturable = [];
281
143
  for (var c = 0; c < collectionRows.length; c += 1) {
282
144
  if ((0, secretRules_1.isCapturable)(collectionRows[c])) {
@@ -297,10 +159,9 @@ async function refreshTypeFields(client, rules) {
297
159
  }
298
160
  return rules;
299
161
  }
300
- function baseResult(set, mode) {
162
+ function baseResult(set) {
301
163
  return {
302
164
  status: "failed",
303
- mode: mode,
304
165
  updateSetSysId: set.sys_id,
305
166
  updateSetName: set.name,
306
167
  scope: set.scope,
@@ -321,46 +182,37 @@ async function exportUpdateSet(params) {
321
182
  params.updateSet.trim() === "") {
322
183
  throw new Error("export-update-set: updateSet is required (a sys_id or the set's exact name).");
323
184
  }
324
- var mode = params.mode === "complete" ? "complete" : "assemble";
325
- var pageSize = params.pageSize === undefined ? exports.DEFAULT_PAGE_SIZE : params.pageSize;
326
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > exports.MAX_PAGE_SIZE) {
327
- throw new Error("export-update-set: pageSize must be an integer between 1 and " +
328
- exports.MAX_PAGE_SIZE +
329
- ".");
330
- }
331
- var maxRows = params.maxRows === undefined ? exports.DEFAULT_MAX_ROWS : params.maxRows;
332
- if (!Number.isInteger(maxRows) || maxRows < 1) {
333
- throw new Error("export-update-set: maxRows must be a positive integer.");
334
- }
335
- var live = params.dryRun !== true && (mode === "assemble" || params.confirm === true);
336
185
  var client = params.client || (0, client_1.createClient)({});
337
- var set = await resolveUpdateSet(client, params.updateSet.trim());
338
- var result = baseResult(set, mode);
339
- if (mode === "complete" &&
340
- params.dryRun !== true &&
341
- params.confirm !== true) {
342
- result.status = "dry-run";
343
- result.note =
344
- "dry-run: mode=complete marks update set '" +
345
- set.name +
346
- "' complete on the instance before exporting — a real write. Re-run with confirm to proceed, " +
347
- "or use the read-only assemble mode.";
348
- return result;
349
- }
350
- if (!live) {
186
+ var target = await resolveUpdateSet(client, params.updateSet.trim());
187
+ var result = baseResult(target);
188
+ var isComplete = target.state === "complete";
189
+ if (params.dryRun === true) {
351
190
  result.status = "dry-run";
352
191
  result.note =
353
192
  "dry-run: would export update set '" +
354
- set.name +
193
+ target.name +
355
194
  "' (" +
356
- set.sys_id +
195
+ target.sys_id +
357
196
  ", scope " +
358
- (set.scope || "global") +
197
+ (target.scope || "global") +
359
198
  ", state " +
360
- (set.state || "unknown") +
361
- ") in " +
362
- mode +
363
- " mode, with secret values replaced by the sentinel. Nothing was read or written.";
199
+ (target.state || "unknown") +
200
+ ") through the instance's export servlet, with secret values replaced by the sentinel" +
201
+ (isComplete
202
+ ? "."
203
+ : ", after marking it complete (a real write; needs confirm).") +
204
+ " Nothing was read or written.";
205
+ return result;
206
+ }
207
+ if (!isComplete && params.confirm !== true) {
208
+ result.status = "dry-run";
209
+ result.note =
210
+ "dry-run: update set '" +
211
+ target.name +
212
+ "' is " +
213
+ (target.state || "not complete") +
214
+ ". The export servlet only streams a complete set, so exporting it marks it complete " +
215
+ "on the instance first — a real write. Re-run with confirm to proceed.";
364
216
  return result;
365
217
  }
366
218
  var rules = (0, secretRules_1.loadSecretRules)(params.rulesPath);
@@ -369,66 +221,41 @@ async function exportUpdateSet(params) {
369
221
  }
370
222
  catch (e) {
371
223
  // Keep the baseline rules: an unreadable dictionary is a reason to be more
372
- // careful, not to widen what ships. Recorded in the note below.
224
+ // careful, not to widen what ships.
373
225
  rules = (0, secretRules_1.loadSecretRules)(params.rulesPath);
374
226
  }
375
- var expected = await countUpdateXml(client, set.sys_id);
227
+ var expected = await countUpdateXml(client, target.sys_id);
376
228
  result.expectedRecords = expected;
377
229
  if (expected === 0) {
378
230
  result.status = "failed";
379
231
  result.message = "the update set has no records";
380
232
  result.note =
381
233
  "export-update-set: update set '" +
382
- set.name +
234
+ target.name +
383
235
  "' contains no records — nothing to export.";
384
236
  return result;
385
237
  }
386
- var raw = "";
387
- if (mode === "assemble") {
388
- var rows = await fetchUpdateXmlRows(client, set.sys_id, pageSize, maxRows);
389
- if (rows.length !== expected) {
390
- result.status = "failed";
391
- result.message = "record count mismatch";
392
- result.note =
393
- "export-update-set: the instance reports " +
394
- expected +
395
- " records but paging returned " +
396
- rows.length +
397
- ". Refusing to write a document that may be truncated.";
398
- return result;
399
- }
400
- var unloadDate = formatUnloadDate(new Date());
401
- var rendered = [];
402
- for (var r = 0; r < rows.length; r += 1) {
403
- rendered.push(renderUpdateXmlRow(rows[r]));
404
- }
405
- raw = renderUnload(renderRemoteUpdateSet(set, rows.length, unloadDate), rendered, unloadDate);
406
- result.recordCount = rows.length;
238
+ var servlet = await exportViaServlet(params, target);
239
+ if (servlet.error !== "") {
240
+ result.status = "failed";
241
+ result.message = servlet.error;
242
+ result.note =
243
+ "export-update-set: " + servlet.error + " Nothing was written.";
244
+ return result;
407
245
  }
408
- else {
409
- var servlet = await exportViaServlet(params, set);
410
- if (servlet.error !== "") {
411
- result.status = "failed";
412
- result.message = servlet.error;
413
- result.note =
414
- "export-update-set: " + servlet.error + " Nothing was written.";
415
- return result;
416
- }
417
- raw = servlet.xml;
418
- result.recordCount = countUnloadRecords(raw);
419
- if (result.recordCount !== expected) {
420
- result.status = "failed";
421
- result.message = "record count mismatch";
422
- result.note =
423
- "export-update-set: the servlet returned " +
424
- result.recordCount +
425
- " records but the set holds " +
426
- expected +
427
- ". Refusing to write a possibly truncated document.";
428
- return result;
429
- }
246
+ result.recordCount = countUnloadRecords(servlet.xml);
247
+ if (result.recordCount !== expected) {
248
+ result.status = "failed";
249
+ result.message = "record count mismatch";
250
+ result.note =
251
+ "export-update-set: the servlet returned " +
252
+ result.recordCount +
253
+ " records but the set holds " +
254
+ expected +
255
+ ". Refusing to write a possibly truncated document.";
256
+ return result;
430
257
  }
431
- var stripped = (0, stripSecrets_1.stripSecrets)(raw, rules);
258
+ var stripped = (0, stripSecrets_1.stripSecrets)(servlet.xml, rules);
432
259
  result.status = "exported";
433
260
  result.xml = stripped.xml;
434
261
  result.secretFields = stripped.secretFields;
@@ -436,10 +263,8 @@ async function exportUpdateSet(params) {
436
263
  "exported " +
437
264
  result.recordCount +
438
265
  " record(s) from '" +
439
- set.name +
440
- "' in " +
441
- mode +
442
- " mode; " +
266
+ target.name +
267
+ "' through the export servlet; " +
443
268
  stripped.secretFields.length +
444
269
  " secret value(s) replaced with " +
445
270
  rules.sentinel +
@@ -452,7 +277,7 @@ function countUnloadRecords(xml) {
452
277
  return m ? m.length : 0;
453
278
  }
454
279
  /**
455
- * Complete-mode export: mark the set complete, then read the servlet. The state
280
+ * Mark the set complete when it is not already, then read the servlet. The state
456
281
  * write goes through the REST table API deliberately — sys_update_set is a
457
282
  * platform record, not a scoped app record, so the scope-safe Dovetail write
458
283
  * path does not apply.
package/dist/index.d.ts CHANGED
@@ -39,8 +39,8 @@ export { invokeRest, INVOKE_REST_METHODS } from "./invokeRest";
39
39
  export type { InvokeRestParams, InvokeRestResult } from "./invokeRest";
40
40
  export { publishApp, buildStartFields, buildCreateUpdateSetFields, buildPublishToUpdateSetFields, resolveUpdateSetNaming, describeTarget, parsePublishTargets, PUBLISH_TARGETS, parseXmlAnswer, parseProgressTree, classifyProgress, flattenSteps, harvestProgressResults, parseCicdPublishResponse, parseCicdProgress, DEFAULT_PUBLISH_TIMEOUT_MS, PUBLISH_POLL_DELAYS_MS, } from "./publishApp";
41
41
  export type { PublishAppParams, PublishAppResult, PublishTarget, PublishStep, ProgressNode, CicdProgress, PublishTransport, } from "./publishApp";
42
- export { exportUpdateSet, renderUpdateXmlRow, renderRemoteUpdateSet, renderUnload, countUnloadRecords, countUpdateXml, fetchUpdateXmlRows, refreshTypeFields, parseStatsCount, formatUnloadDate, xmlEscape, UPDATE_XML_FIELDS, DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE, DEFAULT_MAX_ROWS, } from "./exportUpdateSet";
43
- export type { ExportUpdateSetParams, ExportUpdateSetResult, ExportMode, ExportTransport, } from "./exportUpdateSet";
42
+ export { exportUpdateSet, countUnloadRecords, countUpdateXml, refreshTypeFields, parseStatsCount, xmlEscape, } from "./exportUpdateSet";
43
+ export type { ExportUpdateSetParams, ExportUpdateSetResult, ExportTransport, } from "./exportUpdateSet";
44
44
  export { exportApp, buildCreateSetFields, buildPublishFields, DEFAULT_EXPORT_APP_TIMEOUT_MS, } from "./exportApp";
45
45
  export type { ExportAppParams, ExportAppResult, ExportAppTransport, } from "./exportApp";
46
46
  export { stripSecrets, verifyStripped, readField, readRecordTable, recordFieldNames, plannedStrips, stripField, stripJsonValue, encodeXmlEntities, encodeXmlText, escapeRegExp, } from "./secrets/stripSecrets";
package/dist/index.js CHANGED
@@ -8,8 +8,8 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.editFlow = exports.buildPublishModel = exports.createFlow = exports.copyFlow = exports.publishFlow = exports.readActionType = exports.readFlow = exports.formatStepPill = exports.summarizeSteps = exports.verifySteps = exports.applyStepOps = exports.validateDefineSpec = exports.planActionDefinition = exports.defineActionType = exports.editActionType = exports.publishActionType = exports.triggerPublication = exports.findStepInput = exports.fetchActionSteps = exports.slugInternalName = exports.resolveScope = exports.cloneActionType = exports.cloneSubflow = exports.verifyArtifact = exports.listTemplates = exports.sincPlugin = exports.formatCreateViewResult = exports.formatLayoutResult = exports.setRelatedLists = exports.setFormLayout = exports.setListLayout = exports.createView = exports.formatRemoveChoicesResult = exports.formatAddChoicesResult = exports.formatHostAssetsResult = exports.classifyChunks = exports.hostAssets = exports.ChoiceWriteError = exports.removeChoicesFromField = exports.addChoicesToField = exports.resolveConfigFromEnvFile = exports.createClientFromEnvFile = exports.assertWriteAllowed = exports.evaluateWriteGate = exports.isCiEnvironment = exports.resolveExecutionContext = exports.PROCESSFLOW_PATH_PREFIX = exports.isProcessflowPath = exports.resolveFlowAuth = exports.createClient = void 0;
10
10
  exports.DEFAULT_WRITE_DOMAIN = exports.createRecord = exports.setField = exports.resolveTableAttributes = exports.setTable = exports.toStoredValue = exports.resolveAttributes = exports.setColumn = exports.CAPTURE_NOTE = exports.DEFAULT_ACCESS_METHOD = exports.XMLHTTP_PATH = exports.buildCreateScheduleFields = exports.buildCanCreateFields = exports.parseCanCreate = exports.parseAjaxAnswer = exports.captureRowName = exports.validateCreateIndex = exports.createIndex = exports.listIndexes = exports.indexMatchesColumns = exports.parseIndexColumns = exports.addIndex = exports.DESIGN_ACCESS_TABLE = exports.findDesignAccess = exports.ensureDesignAccess = exports.deriveElement = exports.resolveColumnAttributes = exports.normalizeAttributeInput = exports.missingAttributes = exports.mergeAttributes = exports.parseAttributes = exports.referenceAttrAudit = exports.addColumn = exports.DEFAULT_SAVE_ACTION = exports.DEFAULT_SUPER_CLASS = exports.TYPE_MAP = exports.defaultAccessFlags = exports.applyTableSaveOverlay = exports.resolveType = exports.normalizeColumns = exports.buildColumnXml = exports.projectTableGraph = exports.createTable = exports.WriteOrderError = exports.executeWritePlan = exports.topoSort = exports.generateSysId = exports.LEGACY_RUN_FLOW_PATH = exports.DEFAULT_RUN_FLOW_PATH = exports.testFlow = void 0;
11
- exports.verifyStripped = exports.stripSecrets = exports.DEFAULT_EXPORT_APP_TIMEOUT_MS = exports.buildPublishFields = exports.buildCreateSetFields = exports.exportApp = exports.DEFAULT_MAX_ROWS = exports.MAX_PAGE_SIZE = exports.DEFAULT_PAGE_SIZE = exports.UPDATE_XML_FIELDS = exports.xmlEscape = exports.formatUnloadDate = exports.parseStatsCount = exports.refreshTypeFields = exports.fetchUpdateXmlRows = exports.countUpdateXml = exports.countUnloadRecords = exports.renderUnload = exports.renderRemoteUpdateSet = exports.renderUpdateXmlRow = exports.exportUpdateSet = exports.PUBLISH_POLL_DELAYS_MS = exports.DEFAULT_PUBLISH_TIMEOUT_MS = exports.parseCicdProgress = exports.parseCicdPublishResponse = exports.harvestProgressResults = exports.flattenSteps = exports.classifyProgress = exports.parseProgressTree = exports.parseXmlAnswer = exports.PUBLISH_TARGETS = exports.parsePublishTargets = exports.describeTarget = exports.resolveUpdateSetNaming = exports.buildPublishToUpdateSetFields = exports.buildCreateUpdateSetFields = exports.buildStartFields = exports.publishApp = exports.INVOKE_REST_METHODS = exports.invokeRest = exports.verifyReadBack = exports.readBackMatches = exports.hasHtmlEntity = exports.decodeHtmlEntities = exports.formatUxEventSync = exports.parseNowUiActions = exports.syncUxEvents = exports.deleteRecord = exports.findOverrides = exports.normalizeDomain = void 0;
12
- exports.SECRET_INTERNAL_TYPES = exports.SENTINEL = exports.isCapturable = exports.secretFieldsFromDictionary = exports.mergeSecretRules = exports.loadSecretRules = exports.defaultSecretRules = exports.escapeRegExp = exports.encodeXmlText = exports.encodeXmlEntities = exports.stripJsonValue = exports.stripField = exports.plannedStrips = exports.recordFieldNames = exports.readRecordTable = exports.readField = void 0;
11
+ exports.escapeRegExp = exports.encodeXmlText = exports.encodeXmlEntities = exports.stripJsonValue = exports.stripField = exports.plannedStrips = exports.recordFieldNames = exports.readRecordTable = exports.readField = exports.verifyStripped = exports.stripSecrets = exports.DEFAULT_EXPORT_APP_TIMEOUT_MS = exports.buildPublishFields = exports.buildCreateSetFields = exports.exportApp = exports.xmlEscape = exports.parseStatsCount = exports.refreshTypeFields = exports.countUpdateXml = exports.countUnloadRecords = exports.exportUpdateSet = exports.PUBLISH_POLL_DELAYS_MS = exports.DEFAULT_PUBLISH_TIMEOUT_MS = exports.parseCicdProgress = exports.parseCicdPublishResponse = exports.harvestProgressResults = exports.flattenSteps = exports.classifyProgress = exports.parseProgressTree = exports.parseXmlAnswer = exports.PUBLISH_TARGETS = exports.parsePublishTargets = exports.describeTarget = exports.resolveUpdateSetNaming = exports.buildPublishToUpdateSetFields = exports.buildCreateUpdateSetFields = exports.buildStartFields = exports.publishApp = exports.INVOKE_REST_METHODS = exports.invokeRest = exports.verifyReadBack = exports.readBackMatches = exports.hasHtmlEntity = exports.decodeHtmlEntities = exports.formatUxEventSync = exports.parseNowUiActions = exports.syncUxEvents = exports.deleteRecord = exports.findOverrides = exports.normalizeDomain = void 0;
12
+ exports.SECRET_INTERNAL_TYPES = exports.SENTINEL = exports.isCapturable = exports.secretFieldsFromDictionary = exports.mergeSecretRules = exports.loadSecretRules = exports.defaultSecretRules = void 0;
13
13
  var client_1 = require("./client");
14
14
  Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
15
15
  Object.defineProperty(exports, "resolveFlowAuth", { enumerable: true, get: function () { return client_1.resolveFlowAuth; } });
@@ -163,20 +163,11 @@ Object.defineProperty(exports, "DEFAULT_PUBLISH_TIMEOUT_MS", { enumerable: true,
163
163
  Object.defineProperty(exports, "PUBLISH_POLL_DELAYS_MS", { enumerable: true, get: function () { return publishApp_1.PUBLISH_POLL_DELAYS_MS; } });
164
164
  var exportUpdateSet_1 = require("./exportUpdateSet");
165
165
  Object.defineProperty(exports, "exportUpdateSet", { enumerable: true, get: function () { return exportUpdateSet_1.exportUpdateSet; } });
166
- Object.defineProperty(exports, "renderUpdateXmlRow", { enumerable: true, get: function () { return exportUpdateSet_1.renderUpdateXmlRow; } });
167
- Object.defineProperty(exports, "renderRemoteUpdateSet", { enumerable: true, get: function () { return exportUpdateSet_1.renderRemoteUpdateSet; } });
168
- Object.defineProperty(exports, "renderUnload", { enumerable: true, get: function () { return exportUpdateSet_1.renderUnload; } });
169
166
  Object.defineProperty(exports, "countUnloadRecords", { enumerable: true, get: function () { return exportUpdateSet_1.countUnloadRecords; } });
170
167
  Object.defineProperty(exports, "countUpdateXml", { enumerable: true, get: function () { return exportUpdateSet_1.countUpdateXml; } });
171
- Object.defineProperty(exports, "fetchUpdateXmlRows", { enumerable: true, get: function () { return exportUpdateSet_1.fetchUpdateXmlRows; } });
172
168
  Object.defineProperty(exports, "refreshTypeFields", { enumerable: true, get: function () { return exportUpdateSet_1.refreshTypeFields; } });
173
169
  Object.defineProperty(exports, "parseStatsCount", { enumerable: true, get: function () { return exportUpdateSet_1.parseStatsCount; } });
174
- Object.defineProperty(exports, "formatUnloadDate", { enumerable: true, get: function () { return exportUpdateSet_1.formatUnloadDate; } });
175
170
  Object.defineProperty(exports, "xmlEscape", { enumerable: true, get: function () { return exportUpdateSet_1.xmlEscape; } });
176
- Object.defineProperty(exports, "UPDATE_XML_FIELDS", { enumerable: true, get: function () { return exportUpdateSet_1.UPDATE_XML_FIELDS; } });
177
- Object.defineProperty(exports, "DEFAULT_PAGE_SIZE", { enumerable: true, get: function () { return exportUpdateSet_1.DEFAULT_PAGE_SIZE; } });
178
- Object.defineProperty(exports, "MAX_PAGE_SIZE", { enumerable: true, get: function () { return exportUpdateSet_1.MAX_PAGE_SIZE; } });
179
- Object.defineProperty(exports, "DEFAULT_MAX_ROWS", { enumerable: true, get: function () { return exportUpdateSet_1.DEFAULT_MAX_ROWS; } });
180
171
  var exportApp_1 = require("./exportApp");
181
172
  Object.defineProperty(exports, "exportApp", { enumerable: true, get: function () { return exportApp_1.exportApp; } });
182
173
  Object.defineProperty(exports, "buildCreateSetFields", { enumerable: true, get: function () { return exportApp_1.buildCreateSetFields; } });
@@ -449,7 +449,7 @@ function buildDescriptors(deps = {}) {
449
449
  "(POST /sys_db_object.do) so the real 36-record graph + the physical table + seeded ACLs " +
450
450
  "are created. name (x_scope_*), label, scope, and columns[] are required; extendsTable " +
451
451
  "defaults to sys_metadata; friendly column types are mapped to internal types " +
452
- "(string -> string_full_utf8). A reference column gets sys_dictionary.attributes " +
452
+ "(string -> string_full_utf8, phone -> phone_number_e164). A reference column gets sys_dictionary.attributes " +
453
453
  "readonly_clickthrough=true by default (team rule; column.readonly_clickthrough:false opts " +
454
454
  "out); column.attributes ('k=v,k2=v2' or a map) adds more. After a live save every column " +
455
455
  "with attributes is READ BACK and merge-patched once into updateSetSysId if they did not land " +
@@ -489,7 +489,7 @@ function buildDescriptors(deps = {}) {
489
489
  "failed, not created). table is the table name or its sys_db_object sys_id; column is " +
490
490
  "{ label, type, name?, max_length?, reference?, mandatory?, default?, dependent_on_field?, " +
491
491
  "attributes?, readonly_clickthrough? } with " +
492
- "friendly types mapped to internal types (string -> string_full_utf8) and reference = the target " +
492
+ "friendly types mapped to internal types (string -> string_full_utf8, phone -> phone_number_e164) and reference = the target " +
493
493
  "table NAME; element is derived from label unless column.name is given. dependent_on_field names " +
494
494
  "the sibling column a document_id column resolves against (its table_name column) — it must " +
495
495
  "already exist on the table, is verified on the read-back, and is refused when absent. " +
@@ -1028,14 +1028,14 @@ function buildDescriptors(deps = {}) {
1028
1028
  },
1029
1029
  {
1030
1030
  name: "update_set_export",
1031
- annotations: dovetail_mcp_kit_1.READ_ONLY,
1031
+ annotations: dovetail_mcp_kit_1.WRITE_OVERWRITE,
1032
1032
  description: "Export one update set to an importable <unload> XML document, with every secret value " +
1033
- "replaced by the __SET_DURING_INSTALL__ sentinel. Two modes. mode 'assemble' (the default) " +
1034
- "is READ-ONLY: it pages the set's sys_update_xml rows and builds the document, touching no " +
1035
- "instance state, which is what packaging work wants against a shared instance. mode " +
1036
- "'complete' marks the set complete on the instance (a REAL WRITE, so it needs confirm:true) " +
1037
- "and reads the export servlet instead — the servlet answers an in-progress set with an " +
1038
- "empty 200, which this handles rather than writing an empty file. The export REFUSES to " +
1033
+ "replaced by the __SET_DURING_INSTALL__ sentinel. The document comes from the instance's " +
1034
+ "own export servlet (the UI's Export Update Set to XML), so it imports exactly like a UI " +
1035
+ "export. The servlet only streams a COMPLETE set, so a set still in progress is marked " +
1036
+ "complete first — a REAL WRITE, so it needs confirm:true; without it the plan is returned " +
1037
+ "and nothing changes. A set that is already complete exports with no write. Needs a " +
1038
+ "username and password the instance accepts for form login. The export REFUSES to " +
1039
1039
  "produce a document when the row count does not match the set, or when a field looks " +
1040
1040
  "secret and no rule covers it: adjudicate it in the rules file as a strip rule or as " +
1041
1041
  "notSecret with a reason. Secret stripping cannot be disabled. The result carries the XML, " +
@@ -1046,10 +1046,7 @@ function buildDescriptors(deps = {}) {
1046
1046
  var p = schemas_1.exportUpdateSetSchema.parse(args);
1047
1047
  var params = {
1048
1048
  updateSet: p.updateSet,
1049
- mode: p.mode,
1050
1049
  rulesPath: p.rulesPath,
1051
- pageSize: p.pageSize,
1052
- maxRows: p.maxRows,
1053
1050
  confirm: p.confirm,
1054
1051
  dryRun: p.dryRun,
1055
1052
  };
@@ -2298,28 +2298,19 @@ export declare var syncUxEventsSchema: z.ZodObject<{
2298
2298
  }>;
2299
2299
  export declare var exportUpdateSetSchema: z.ZodObject<{
2300
2300
  updateSet: z.ZodString;
2301
- mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"assemble">, z.ZodLiteral<"complete">]>>;
2302
2301
  rulesPath: z.ZodOptional<z.ZodString>;
2303
- pageSize: z.ZodOptional<z.ZodNumber>;
2304
- maxRows: z.ZodOptional<z.ZodNumber>;
2305
2302
  confirm: z.ZodOptional<z.ZodBoolean>;
2306
2303
  dryRun: z.ZodOptional<z.ZodBoolean>;
2307
2304
  }, "strip", z.ZodTypeAny, {
2308
2305
  updateSet: string;
2309
2306
  confirm?: boolean | undefined;
2310
- mode?: "complete" | "assemble" | undefined;
2311
2307
  dryRun?: boolean | undefined;
2312
2308
  rulesPath?: string | undefined;
2313
- pageSize?: number | undefined;
2314
- maxRows?: number | undefined;
2315
2309
  }, {
2316
2310
  updateSet: string;
2317
2311
  confirm?: boolean | undefined;
2318
- mode?: "complete" | "assemble" | undefined;
2319
2312
  dryRun?: boolean | undefined;
2320
2313
  rulesPath?: string | undefined;
2321
- pageSize?: number | undefined;
2322
- maxRows?: number | undefined;
2323
2314
  }>;
2324
2315
  export declare var exportAppSchema: z.ZodObject<{
2325
2316
  app: z.ZodString;
@@ -578,10 +578,7 @@ exports.syncUxEventsSchema = zod_1.z.object({
578
578
  // that looks secret and no rule covers fails the call instead of shipping.
579
579
  exports.exportUpdateSetSchema = zod_1.z.object({
580
580
  updateSet: zod_1.z.string().min(1),
581
- mode: zod_1.z.union([zod_1.z.literal("assemble"), zod_1.z.literal("complete")]).optional(),
582
581
  rulesPath: zod_1.z.string().optional(),
583
- pageSize: zod_1.z.number().int().positive().optional(),
584
- maxRows: zod_1.z.number().int().positive().optional(),
585
582
  confirm: zod_1.z.boolean().optional(),
586
583
  dryRun: zod_1.z.boolean().optional(),
587
584
  });
@@ -37,7 +37,10 @@ exports.TYPE_MAP = {
37
37
  url: "url",
38
38
  email: "email",
39
39
  html: "html",
40
- journal: "journal"
40
+ journal: "journal",
41
+ // Phone Number (E.164): the platform type Studio offers as "Phone Number (E164)".
42
+ // Stores the E.164 string and formats it per territory in forms and lists.
43
+ phone: "phone_number_e164"
41
44
  };
42
45
  /** Internal types that are valid as-is (a caller may pass the SN type directly). */
43
46
  var KNOWN_INTERNAL = {
@@ -46,7 +49,7 @@ var KNOWN_INTERNAL = {
46
49
  reference: true, choice: true, translated_text: true, html: true, url: true,
47
50
  email: true, journal: true, journal_input: true, currency: true, price: true,
48
51
  percent_complete: true, sys_class_name: true, document_id: true, field_name: true,
49
- table_name: true, json: true, script: true,
52
+ table_name: true, json: true, script: true, phone_number_e164: true,
50
53
  // A condition-builder column (pair it with dependent_on_field = its table_name column),
51
54
  // and the two domain-separation columns a domain-aware table carries (sys_domain /
52
55
  // sys_domain_path).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/dovetail-servicenow",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },