@onlyflows/servicenow-mcp 2.3.0-rc.3 → 2.4.0-rc.1

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/README.md +206 -22
  3. package/dist/atf-result-cache.d.ts +2 -2
  4. package/dist/call-metrics.d.ts +11 -1
  5. package/dist/call-metrics.d.ts.map +1 -1
  6. package/dist/call-metrics.js +2 -0
  7. package/dist/call-metrics.js.map +1 -1
  8. package/dist/client.d.ts +10 -0
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +31 -3
  11. package/dist/client.js.map +1 -1
  12. package/dist/execution-context.d.ts +3 -3
  13. package/dist/execution-context.d.ts.map +1 -1
  14. package/dist/execution-context.js +7 -2
  15. package/dist/execution-context.js.map +1 -1
  16. package/dist/field-policy.d.ts +8 -0
  17. package/dist/field-policy.d.ts.map +1 -1
  18. package/dist/field-policy.js +239 -46
  19. package/dist/field-policy.js.map +1 -1
  20. package/dist/hidden-values.d.ts +368 -21
  21. package/dist/hidden-values.d.ts.map +1 -1
  22. package/dist/hidden-values.js +1050 -101
  23. package/dist/hidden-values.js.map +1 -1
  24. package/dist/http-observability.js +3 -1
  25. package/dist/http-observability.js.map +1 -1
  26. package/dist/inert-text.d.ts +27 -0
  27. package/dist/inert-text.d.ts.map +1 -0
  28. package/dist/inert-text.js +57 -0
  29. package/dist/inert-text.js.map +1 -0
  30. package/dist/policy-card.d.ts +1 -1
  31. package/dist/policy-card.d.ts.map +1 -1
  32. package/dist/policy-card.js +3 -1
  33. package/dist/policy-card.js.map +1 -1
  34. package/dist/setup-prompts.js +1 -0
  35. package/dist/setup-prompts.js.map +1 -1
  36. package/dist/setup.js +6 -0
  37. package/dist/setup.js.map +1 -1
  38. package/dist/tool-error.d.ts +39 -3
  39. package/dist/tool-error.d.ts.map +1 -1
  40. package/dist/tool-error.js +101 -2
  41. package/dist/tool-error.js.map +1 -1
  42. package/dist/tool-table-access.d.ts.map +1 -1
  43. package/dist/tool-table-access.js +5 -0
  44. package/dist/tool-table-access.js.map +1 -1
  45. package/dist/tools/aggregate.d.ts +8 -0
  46. package/dist/tools/aggregate.d.ts.map +1 -1
  47. package/dist/tools/aggregate.js +70 -11
  48. package/dist/tools/aggregate.js.map +1 -1
  49. package/dist/tools/atf-contracts.d.ts +9 -9
  50. package/dist/tools/catalog.d.ts +2 -2
  51. package/dist/tools/catalog.d.ts.map +1 -1
  52. package/dist/tools/catalog.js +9 -0
  53. package/dist/tools/catalog.js.map +1 -1
  54. package/dist/tools/envelope-text-fit.d.ts +20 -0
  55. package/dist/tools/envelope-text-fit.d.ts.map +1 -0
  56. package/dist/tools/envelope-text-fit.js +33 -0
  57. package/dist/tools/envelope-text-fit.js.map +1 -0
  58. package/dist/tools/flow-view-mermaid.d.ts.map +1 -1
  59. package/dist/tools/flow-view-mermaid.js +6 -13
  60. package/dist/tools/flow-view-mermaid.js.map +1 -1
  61. package/dist/tools/flow-view-module.js +1 -1
  62. package/dist/tools/get-module.js +1 -1
  63. package/dist/tools/history-contracts.d.ts +198 -0
  64. package/dist/tools/history-contracts.d.ts.map +1 -0
  65. package/dist/tools/history-contracts.js +317 -0
  66. package/dist/tools/history-contracts.js.map +1 -0
  67. package/dist/tools/history-module.d.ts +158 -0
  68. package/dist/tools/history-module.d.ts.map +1 -0
  69. package/dist/tools/history-module.js +937 -0
  70. package/dist/tools/history-module.js.map +1 -0
  71. package/dist/tools/history-renderers.d.ts +32 -0
  72. package/dist/tools/history-renderers.d.ts.map +1 -0
  73. package/dist/tools/history-renderers.js +154 -0
  74. package/dist/tools/history-renderers.js.map +1 -0
  75. package/dist/tools/index.d.ts +3 -3
  76. package/dist/tools/index.d.ts.map +1 -1
  77. package/dist/tools/index.js +31 -14
  78. package/dist/tools/index.js.map +1 -1
  79. package/dist/tools/platform-view-contracts.d.ts +4 -4
  80. package/dist/tools/platform-view-contracts.d.ts.map +1 -1
  81. package/dist/tools/platform-view-contracts.js +3 -0
  82. package/dist/tools/platform-view-contracts.js.map +1 -1
  83. package/dist/tools/platform-view-evaluate.d.ts +7 -2
  84. package/dist/tools/platform-view-evaluate.d.ts.map +1 -1
  85. package/dist/tools/platform-view-evaluate.js +44 -130
  86. package/dist/tools/platform-view-evaluate.js.map +1 -1
  87. package/dist/tools/platform-view-module.d.ts +12 -3
  88. package/dist/tools/platform-view-module.d.ts.map +1 -1
  89. package/dist/tools/platform-view-module.js +61 -16
  90. package/dist/tools/platform-view-module.js.map +1 -1
  91. package/dist/tools/platform-view-payload.d.ts +101 -0
  92. package/dist/tools/platform-view-payload.d.ts.map +1 -0
  93. package/dist/tools/platform-view-payload.js +302 -0
  94. package/dist/tools/platform-view-payload.js.map +1 -0
  95. package/dist/tools/platform-view-update-sets.d.ts +129 -0
  96. package/dist/tools/platform-view-update-sets.d.ts.map +1 -0
  97. package/dist/tools/platform-view-update-sets.js +1060 -0
  98. package/dist/tools/platform-view-update-sets.js.map +1 -0
  99. package/dist/tools/query-module.js +1 -1
  100. package/dist/tools/relationships-map.d.ts +59 -0
  101. package/dist/tools/relationships-map.d.ts.map +1 -0
  102. package/dist/tools/relationships-map.js +162 -0
  103. package/dist/tools/relationships-map.js.map +1 -0
  104. package/dist/tools/relationships-renderer.d.ts +22 -0
  105. package/dist/tools/relationships-renderer.d.ts.map +1 -0
  106. package/dist/tools/relationships-renderer.js +90 -0
  107. package/dist/tools/relationships-renderer.js.map +1 -0
  108. package/dist/tools/relationships.d.ts +37 -2
  109. package/dist/tools/relationships.d.ts.map +1 -1
  110. package/dist/tools/relationships.js +602 -183
  111. package/dist/tools/relationships.js.map +1 -1
  112. package/dist/tools/result-envelope.d.ts +314 -15
  113. package/dist/tools/result-envelope.d.ts.map +1 -1
  114. package/dist/tools/result-envelope.js +120 -19
  115. package/dist/tools/result-envelope.js.map +1 -1
  116. package/dist/tools/syslog.d.ts +1 -1
  117. package/dist/tools/table-hierarchy.d.ts +17 -0
  118. package/dist/tools/table-hierarchy.d.ts.map +1 -1
  119. package/dist/tools/table-hierarchy.js +41 -0
  120. package/dist/tools/table-hierarchy.js.map +1 -1
  121. package/dist/version.d.ts +1 -1
  122. package/dist/version.js +1 -1
  123. package/docs/CLIENT-SETUP.md +2 -2
  124. package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +2 -2
  125. package/docs/PRODUCTION-SECURITY.md +145 -2
  126. package/docs/RELEASE-VALIDATION.md +2 -2
  127. package/docs/TESTING-OAUTH.md +1 -1
  128. package/package.json +2 -2
  129. package/server.json +2 -2
@@ -13,6 +13,9 @@
13
13
  * ONE instance-wide `sys_dictionary` read (fields of those types only),
14
14
  * projected over each table's extension chain, with database views
15
15
  * resolved to the tables they join;
16
+ * - {@link loadFieldTypesInPlan}, the same answer from reads a tool declares
17
+ * in its own plan (`sys_db_object` one level at a time, and
18
+ * `sys_dictionary`), for tools whose type lookup must stay inside it;
16
19
  * - {@link classifyField}, the per-field verdict (including dot-walks) with a
17
20
  * reason, for tools that show a value-hidden marker instead of dropping;
18
21
  * - {@link withoutFields}, whole-field removal for every response shape;
@@ -20,7 +23,10 @@
20
23
  *
21
24
  * The loader never returns an empty map for "could not read": an unreadable
22
25
  * dictionary is the explicit `unavailable` state, and a table it could not
23
- * resolve has no entry (so every field on it is `unknown_type`).
26
+ * resolve has no entry (so every field on it is `unknown_type`). A table
27
+ * resolves only when its whole extension chain is known ({@link TableChain}):
28
+ * a chain that may stop short could hide that the table inherits a
29
+ * hidden-typed field.
24
30
  *
25
31
  * The scope at the bottom carries one call's resolved sets to field policy,
26
32
  * which enforces them; see `field-policy.ts`.
@@ -53,15 +59,89 @@ export interface ResolvedTableTypes {
53
59
  * hidden types, so a field it does not list is not hidden.
54
60
  */
55
61
  readonly allTypes?: ReadonlyMap<string, string>;
62
+ /**
63
+ * For a database view: each joined table's column prefix and extension
64
+ * chain (the table first), as the loader read them. A view's column
65
+ * `<prefix>_<field>` is that table's `field`. Absent for a table.
66
+ */
67
+ readonly viewSources?: readonly ViewColumnSource[];
68
+ }
69
+ /** One table a database view joins: its column prefix and extension chain. */
70
+ export interface ViewColumnSource {
71
+ readonly prefix: string;
72
+ readonly hierarchy: readonly string[];
73
+ }
74
+ /**
75
+ * Why a metadata read gave no answer. Every field is bounded: an HTTP status
76
+ * is an integer from 100 to 599 that the client recorded from a response
77
+ * (never text from one), and everything else is a fixed literal. No upstream
78
+ * message, header or body is ever part of it.
79
+ */
80
+ export type FieldTypesReadFailure =
81
+ /** This server's profile or field policy kept the read from being made. */
82
+ {
83
+ readonly kind: "policy";
84
+ readonly table: "sys_dictionary" | "sys_db_object";
85
+ }
86
+ /** The instance refused the read (401, 403), or returned 200 with no readable rows (status 200). */
87
+ | {
88
+ readonly kind: "refused";
89
+ readonly status: number;
90
+ }
91
+ /** A 5xx or 429, a timeout, or a network failure (no status). `retried`: the read was tried again before it gave up, by the loader or by the client. */
92
+ | {
93
+ readonly kind: "transient";
94
+ readonly status?: number;
95
+ readonly timeout?: true;
96
+ readonly retried?: true;
97
+ }
98
+ /** The read filled its page, so it may be cut short. */
99
+ | {
100
+ readonly kind: "incomplete";
56
101
  }
102
+ /** Anything else: a 400, an invalid or HTML response, a redirect, an internal fault. */
103
+ | {
104
+ readonly kind: "failed";
105
+ readonly status?: number;
106
+ };
107
+ /** Why a table's extension chain is not known to be complete. */
108
+ export type ChainGap = "parent_unreadable" | "too_long" | "malformed" | "no_row";
109
+ /** The metadata read a failure or problem is about. */
110
+ export type FieldTypesReadName = "sys_dictionary" | "sys_db_object" | "sys_db_view_table";
111
+ /** Why one requested table is unresolved. */
112
+ export type FieldTypesTableProblem =
113
+ /** sys_db_object answered (its own row came back), has no row for the table, and the table is not a view. */
114
+ {
115
+ readonly kind: "not_found";
116
+ }
117
+ /** `at` is the last table resolved; the gap is at it (its parent, or its own row for `no_row`). */
118
+ | {
119
+ readonly kind: "chain";
120
+ readonly at: string;
121
+ readonly gap: ChainGap;
122
+ }
123
+ /** The read of the chain (or of the view's joined tables) itself failed. */
124
+ | {
125
+ readonly kind: "read";
126
+ readonly failure: FieldTypesReadFailure;
127
+ readonly read?: "sys_db_object" | "sys_db_view_table";
128
+ };
57
129
  export type FieldTypes = {
58
130
  readonly state: "available";
59
131
  /** Resolved tables. A requested table that is missing is unresolved. */
60
132
  readonly tables: ReadonlyMap<string, ResolvedTableTypes>;
133
+ /** Why each requested table that is not in `tables` is unresolved, where the loader knows. */
134
+ readonly problems?: ReadonlyMap<string, FieldTypesTableProblem>;
61
135
  } | {
62
136
  readonly state: "unavailable";
137
+ /** Why the dictionary was not read; absent for a loader that does not say. */
138
+ readonly cause?: FieldTypesReadFailure;
139
+ readonly problems?: ReadonlyMap<string, FieldTypesTableProblem>;
63
140
  };
141
+ /** The cause-less unavailable state: a loader (or a test double) that does not say why. */
64
142
  export declare const FIELD_TYPES_UNAVAILABLE: FieldTypes;
143
+ /** The unavailable state with its cause. */
144
+ export declare function fieldTypesUnavailable(cause: FieldTypesReadFailure | undefined, problems?: ReadonlyMap<string, FieldTypesTableProblem>): FieldTypes;
65
145
  /**
66
146
  * The hidden-typed fields of `table`, or undefined when `table` could not be
67
147
  * resolved (or the types are unavailable). Undefined means unknown: a caller
@@ -76,7 +156,9 @@ export type ReferenceResolver = (table: string, field: string) => string | undef
76
156
  * A dot-walked path (`caller_id.user_password`) is decided on the table it
77
157
  * ends at, for both the type and the credential-table check; each hop's
78
158
  * target comes from `referenceTarget`, and a hop it cannot resolve makes the
79
- * path `unknown_type`. Field policy rejects dot-walked names outright today;
159
+ * path `unknown_type`, as does a table that is not in `types` (a loader or
160
+ * {@link fieldTypesFromRows} leaves out every table whose chain is not
161
+ * complete). Field policy rejects dot-walked names outright today;
80
162
  * this is for tools that read paths from the instance (history, payloads).
81
163
  */
82
164
  export declare function classifyField(types: FieldTypes, table: string, path: string, options?: {
@@ -92,11 +174,13 @@ export interface DictionaryRow {
92
174
  /**
93
175
  * Field types from dictionary rows the caller has already read, so the read
94
176
  * stays inside that caller's own declared plan. `hierarchies` maps each table
95
- * the caller will ask about to its chain (the table first). With
96
- * `complete: true` the rows are every field of those chains, so a field with
97
- * no row is `unknown_type`; otherwise only hidden-typed rows matter.
177
+ * the caller will ask about to its chain (the table first) and whether that
178
+ * chain is complete; a table whose chain is not complete is left unresolved,
179
+ * so every field on it is `unknown_type`. With `complete: true` the rows are
180
+ * every field of those chains, so a field with no row is `unknown_type`;
181
+ * otherwise only hidden-typed rows matter.
98
182
  */
99
- export declare function fieldTypesFromRows(rows: Iterable<DictionaryRow>, hierarchies: Readonly<Record<string, readonly string[]>>, options?: {
183
+ export declare function fieldTypesFromRows(rows: Iterable<DictionaryRow>, hierarchies: Readonly<Record<string, TableChain>>, options?: {
100
184
  readonly complete?: boolean;
101
185
  }): FieldTypes;
102
186
  /**
@@ -128,6 +212,43 @@ export declare function rowValueRule(table: unknown): RowValueRule | undefined;
128
212
  * value of `sysparm_display_value=all`) or else its `display_value`.
129
213
  */
130
214
  export declare function rowValueHidden(rule: RowValueRule, row: Readonly<Record<string, unknown>>): boolean;
215
+ /**
216
+ * A table's extension chain as `sys_db_object` gave it, and whether it is
217
+ * known to end there.
218
+ */
219
+ export interface TableChain {
220
+ /** The table first, then its ancestors, nearest first. */
221
+ readonly tables: readonly string[];
222
+ /**
223
+ * True only when the last table's parent link came back empty, both the
224
+ * stored reference and the parent's name: that table extends nothing.
225
+ * False when the row is missing, a link or name is absent from the row, a
226
+ * link has no name (the parent's row could not be read), a parent is not a
227
+ * table name, the chain loops, or it is longer than the read covers. An
228
+ * incomplete chain is unknown: the table may extend one that defines a
229
+ * hidden-typed field, or a credential table.
230
+ */
231
+ readonly complete: boolean;
232
+ /**
233
+ * Why the chain is not complete, when it is not: the last table of `tables`
234
+ * is the one the gap is at (its parent, or its own row for `no_row`).
235
+ */
236
+ readonly gap?: ChainGap;
237
+ }
238
+ /**
239
+ * The `sys_db_object` fields that give a chain of up to `maxTables` tables in
240
+ * one read of the table's own row: its name, then, for each table of the
241
+ * chain, its stored parent reference and that parent's name (dot-walked).
242
+ * The last table's reference is read without a name, to tell a chain that
243
+ * ends there from one that goes on past the read.
244
+ */
245
+ export declare function tableChainFields(maxTables: number): string[];
246
+ /**
247
+ * The chain of `table` from its `sys_db_object` row, read with
248
+ * {@link tableChainFields}`(maxTables)`. Only an empty reference with an
249
+ * empty name ends a chain; see {@link TableChain.complete}.
250
+ */
251
+ export declare function tableChainFromRow(row: Readonly<Record<string, unknown>>, table: string, maxTables: number): TableChain;
131
252
  /**
132
253
  * How long a loaded map serves without any request. A field that becomes
133
254
  * hidden-typed within this window is still hidden by name if its name is
@@ -135,36 +256,187 @@ export declare function rowValueHidden(rule: RowValueRule, row: Readonly<Record<
135
256
  * profile's metadata-cache TTL.
136
257
  */
137
258
  export declare const FIELD_TYPES_TTL_MS: number;
138
- /** How long an unreadable dictionary is remembered before it is retried. */
259
+ /**
260
+ * How long a refused or cut-short dictionary, or a chain that does not show
261
+ * where it ends, is remembered before it is read again. A transient failure
262
+ * (a timeout, a 5xx, a network error) is never remembered.
263
+ */
139
264
  export declare const FIELD_TYPES_UNAVAILABLE_TTL_MS: number;
140
265
  /** A read that returns this many rows may be cut short, so it is unavailable. */
141
266
  export declare const MAX_HIDDEN_DICTIONARY_ROWS = 10000;
267
+ /**
268
+ * The pause before the one retry of a read that timed out or returned a 5xx
269
+ * the client does not retry itself. Short: the retry is for a blip, not an outage.
270
+ */
271
+ export declare const FIELD_TYPES_RETRY_PAUSE_MS = 300;
142
272
  export interface LoadFieldTypesOptions {
143
273
  /** Refresh the memo and the metadata cache behind it. */
144
274
  readonly forceRecache?: boolean;
145
275
  }
146
276
  /** The shape of {@link loadFieldTypes}, for an injected test double. */
147
277
  export type FieldTypeLoader = (client: ServiceNowOperations, tables: Iterable<string>, options?: LoadFieldTypesOptions) => Promise<FieldTypes>;
278
+ /**
279
+ * Say why a metadata read threw, from what only this server issued: the
280
+ * trusted error category and reason, and the HTTP status the client recorded.
281
+ * No message or text of the error is read. A cancellation is not a failure to
282
+ * classify: callers rethrow it before they get here.
283
+ */
284
+ export declare function classifyReadFailure(error: unknown): FieldTypesReadFailure;
285
+ /** One retry shared by several reads of a kind in one lookup. */
286
+ export interface FieldTypesRetryBudget {
287
+ spent: boolean;
288
+ }
289
+ export interface RetryTransientOptions {
290
+ /** The call's signal; default the running call's. An aborted signal skips the retry. */
291
+ readonly signal?: AbortSignal | undefined;
292
+ /** Pause before the retry; default {@link FIELD_TYPES_RETRY_PAUSE_MS}. */
293
+ readonly pauseMs?: number;
294
+ /** When given, the retry is made only once for every read sharing it. */
295
+ readonly budget?: FieldTypesRetryBudget;
296
+ }
297
+ /**
298
+ * Run `read`; if it fails the way a blip fails (a timeout, or a 5xx the client
299
+ * does not retry itself: see {@link isRetryableFailure}), wait a short pause
300
+ * and run it once more. A cancellation, an aborted signal, a 429, a 502, 503
301
+ * or 504, a network failure and any 4xx are never retried here, and a
302
+ * cancellation during the pause rethrows.
303
+ *
304
+ * The retry sits inside a single-flight read, so concurrent waiters share one
305
+ * retry. Worst case for one read is two attempts of the client's timeout plus
306
+ * the pause, inside the call's signal: the call's own deadline aborts it, so a
307
+ * retry never outlives the call.
308
+ */
309
+ export declare function retryTransientOnce<T>(read: () => Promise<T>, options?: RetryTransientOptions): Promise<T>;
148
310
  /**
149
311
  * Resolve the hidden-typed fields of every table in `tables`.
150
312
  *
151
313
  * Requests, made with the call's own credentials and no table grant (the
152
314
  * implicit metadata path the all-fields projection uses): one instance-wide
153
315
  * `sys_dictionary` read of the hidden types, one `sys_db_object` read for the
154
- * chains of all the tables not yet known, and, only for a name with no
155
- * `sys_db_object` row, one `sys_db_view_table` read (plus the joined tables'
156
- * chains). Each result is kept in the metadata cache's per-credential memo
157
- * (`derivedMetadataMemo`), so a later call that finds everything there makes
158
- * no request at all; the reads skip the cache's watermark, since the memo is
159
- * their cache. The dictionary and chain reads run in parallel, and concurrent
160
- * calls in one scope share each read in flight (one per key). `forceRecache`
161
- * skips the memo.
316
+ * chains of all the tables not yet known (it also asks for `sys_db_object`'s
317
+ * own row, to tell a table that does not exist from a read that showed
318
+ * nothing), and, only for a name with no `sys_db_object` row, one
319
+ * `sys_db_view_table` read (plus the joined tables' chains). Each result is
320
+ * kept in the metadata cache's per-credential memo (`derivedMetadataMemo`), so
321
+ * a later call that finds everything there makes no request at all; the reads
322
+ * skip the cache's watermark, since the memo is their cache. The dictionary
323
+ * and chain reads run in parallel, and concurrent calls in one scope share
324
+ * each read in flight (one per key). `forceRecache` skips the memo.
162
325
  *
163
- * The dictionary read failing, returning no rows, or returning a full page
164
- * gives `unavailable`. A table whose chain or view cannot be resolved is left
165
- * out of `tables`, so its fields are `unknown_type`. A cancelled read rethrows.
326
+ * A dictionary read that fails, returns no rows, or returns a full page gives
327
+ * `unavailable`, with the cause ({@link FieldTypesReadFailure}). A timeout or
328
+ * a 5xx the client does not retry itself (the client tries a 502, 503, 504 and
329
+ * a network failure three times) is read once more after a short pause
330
+ * ({@link retryTransientOnce}); no such failure is ever remembered; a refusal or a full
331
+ * page is remembered for {@link FIELD_TYPES_UNAVAILABLE_TTL_MS}, with its
332
+ * cause. A table whose chain or view cannot be resolved is left out of
333
+ * `tables`, so its fields are `unknown_type`, and `problems` says why: it does
334
+ * not exist, its chain is not complete ({@link TableChain}, such as a parent
335
+ * reference whose name did not come back, or a chain longer than 12 tables),
336
+ * or the read failed. A complete chain is kept in the memo for the hour; an
337
+ * incomplete one for {@link FIELD_TYPES_UNAVAILABLE_TTL_MS}, so a table whose
338
+ * parent cannot be read is not read again on every call. A cancelled read
339
+ * rethrows.
166
340
  */
167
341
  export declare function loadFieldTypes(client: ServiceNowOperations, tablesCandidate: Iterable<string>, options?: LoadFieldTypesOptions): Promise<FieldTypes>;
342
+ /**
343
+ * The fields {@link loadFieldTypesInPlan} reads, by table. A tool that calls
344
+ * it declares both tables in its access plan with at least these fields.
345
+ */
346
+ export declare const PLAN_FIELD_TYPE_FIELDS: Readonly<Record<"sys_db_object" | "sys_dictionary", readonly string[]>>;
347
+ /** The one dot-walk {@link loadFieldTypesInPlan} makes: a table's parent's name, one hop, into the same table. */
348
+ export declare const PLAN_FIELD_TYPE_DOT_WALKS: readonly Readonly<{
349
+ from: "sys_db_object";
350
+ field: "super_class";
351
+ target: "sys_db_object";
352
+ }>[];
353
+ /** `sys_db_object` levels read per call, at most: the dispatcher's 12-table chain. */
354
+ export declare const PLAN_CHAIN_LEVELS = 12;
355
+ /** A table's chain as the plan-bounded loader read it. */
356
+ export type PlanTableChain = TableChain;
357
+ /** What {@link loadFieldTypesInPlan} returns. */
358
+ export interface PlanFieldTypes {
359
+ /**
360
+ * The hidden-typed fields of every requested table whose chain is complete.
361
+ * `unavailable` when the dictionary was not read, failed, returned no
362
+ * hidden-typed row or a full page; a requested table with an incomplete or
363
+ * unknown chain has no entry (every field on it is `unknown_type`).
364
+ */
365
+ readonly types: FieldTypes;
366
+ /**
367
+ * Each requested table that `sys_db_object` returned a row for, with its
368
+ * chain. A table missing here has no row, or was not read.
369
+ */
370
+ readonly chains: ReadonlyMap<string, PlanTableChain>;
371
+ /** False when a chain read was skipped, failed, or ran out of levels. */
372
+ readonly hierarchyRead: boolean;
373
+ /** Why `types` is unavailable, when the loader knows. */
374
+ readonly typesFailure?: FieldTypesReadFailure;
375
+ /**
376
+ * Why a chain read gave no answer: skipped by field policy, failed, or (for
377
+ * a read that came back without any `sys_db_object` row, its own included)
378
+ * showed this user nothing. Not set for a chain that only ran out of levels,
379
+ * which {@link PlanTableChain.gap} says.
380
+ */
381
+ readonly chainsFailure?: FieldTypesReadFailure;
382
+ /**
383
+ * Requested tables `sys_db_object` has no row for. Set only when the same
384
+ * read returned `sys_db_object`'s own row, so the read could see rows: the
385
+ * table does not exist (or is a database view, which this loader leaves
386
+ * unresolved).
387
+ */
388
+ readonly missing?: ReadonlySet<string>;
389
+ }
390
+ export interface LoadFieldTypesInPlanOptions {
391
+ /** Read `sys_db_object` (default true). False when field policy hides its fields. */
392
+ readonly readChains?: boolean;
393
+ /** Read `sys_dictionary` (default true). False when field policy hides its fields. */
394
+ readonly readTypes?: boolean;
395
+ /** `sys_db_object` levels to read, at most {@link PLAN_CHAIN_LEVELS}. */
396
+ readonly maxLevels?: number;
397
+ /**
398
+ * Each dictionary row before it is read, for the caller's field policy (a
399
+ * field it drops reads as missing). Not applied to `sys_db_object` rows,
400
+ * whose parent column is a dot-walk.
401
+ */
402
+ readonly filterDictionaryRow?: (row: Readonly<Record<string, unknown>>) => Record<string, unknown>;
403
+ /** The call's signal: an error after it aborted is a cancellation, and rethrows. */
404
+ readonly signal?: AbortSignal;
405
+ }
406
+ /** A table's parent as the plan-bounded loader read it: its name, `null` for none, or why it is unknown. */
407
+ export type PlanParent = string | null | {
408
+ readonly gap: ChainGap;
409
+ };
410
+ /**
411
+ * Field types for `tables`, read only from tables a tool can declare in its
412
+ * own plan: `sys_db_object` one level per read (the stored `super_class`
413
+ * reference, and the parent's name as a one-hop dot-walk,
414
+ * {@link PLAN_FIELD_TYPE_DOT_WALKS}) and one instance-wide `sys_dictionary`
415
+ * read of the hidden types. The two run in parallel. A chain ends only at a
416
+ * row whose reference and parent name are both empty; a reference whose name
417
+ * did not come back leaves the chain incomplete ({@link TableChain}).
418
+ *
419
+ * Unlike {@link loadFieldTypes} it never reads `sys_db_view_table` and keeps
420
+ * nothing in the memo: a database view (no `sys_db_object` row) stays
421
+ * unresolved, so every field on it is `unknown_type`. Otherwise the answer
422
+ * has the same semantics:
423
+ * - only rows of a hidden type ({@link isHiddenFieldType}) count, so a child's
424
+ * row of another type never un-hides an inherited hidden field;
425
+ * - a dictionary read that fails, is not 200, returns no hidden-typed row or
426
+ * returns a full page gives `unavailable`;
427
+ * - a table whose chain is unknown or incomplete is left out of `types`.
428
+ *
429
+ * A read that times out or returns a 5xx the client does not retry itself is
430
+ * read once more after a short pause ({@link retryTransientOnce}): once for the
431
+ * dictionary, and once shared by all the levels of the chain read. The first
432
+ * level also asks for `sys_db_object`'s own row, to tell a table that does not
433
+ * exist from a read that showed nothing. A chain read that fails keeps the
434
+ * levels read before it, and sets `hierarchyRead` false. A cancelled read
435
+ * rethrows.
436
+ */
437
+ export declare function loadFieldTypesInPlan(client: ServiceNowOperations, tablesCandidate: Iterable<string>, options?: LoadFieldTypesInPlanOptions): Promise<PlanFieldTypes>;
438
+ /** A requested table's chain from the parents read, or undefined when its row was not read. Exported for tests. */
439
+ export declare function planChainOf(table: string, parents: ReadonlyMap<string, PlanParent>, unread: ReadonlySet<string>): PlanTableChain | undefined;
168
440
  /**
169
441
  * One call's resolved hidden-typed fields, for field policy to enforce.
170
442
  *
@@ -176,6 +448,18 @@ export declare function loadFieldTypes(client: ServiceNowOperations, tablesCandi
176
448
  export interface HiddenFieldScope {
177
449
  readonly tables: ReadonlyMap<string, ReadonlySet<string>>;
178
450
  readonly unresolved: "deny" | "names_only";
451
+ /**
452
+ * Each resolved table's extension chain, the table first. A table that did
453
+ * not resolve (or a scope built without chains) has none, and field policy
454
+ * then knows no ancestor for it.
455
+ */
456
+ readonly hierarchies?: ReadonlyMap<string, readonly string[]>;
457
+ /**
458
+ * Each resolved database view's joined tables, with their column prefixes
459
+ * and chains. A view has no entry in `hierarchies`: its columns are its
460
+ * sources' columns under a prefix, not its own.
461
+ */
462
+ readonly views?: ReadonlyMap<string, readonly ViewColumnSource[]>;
179
463
  }
180
464
  /** Run `callback` with `scope` as the call's hidden-typed fields. */
181
465
  export declare function runWithHiddenFieldScope<T>(scope: HiddenFieldScope, callback: () => T): T;
@@ -191,11 +475,74 @@ export declare function hiddenFieldScope(types: FieldTypes, tables: Iterable<str
191
475
  readonly scope?: HiddenFieldScope;
192
476
  readonly degraded: boolean;
193
477
  };
478
+ /** Where a field-types problem is reported; each surface words it for its reader. */
479
+ export type FieldTypesSurface = "dispatcher" | "history" | "payload" | "evaluate";
480
+ export interface FieldTypesProblemInput {
481
+ readonly surface: FieldTypesSurface;
482
+ /**
483
+ * The table a table-level problem is about. It is echoed only when it
484
+ * passes the table-name pattern; leave it out where the table came from
485
+ * untrusted input (a payload).
486
+ */
487
+ readonly table?: string;
488
+ /** One table's problem. */
489
+ readonly problem?: FieldTypesTableProblem;
490
+ /** Or the failure of a whole read (`read` names it; default sys_dictionary). */
491
+ readonly failure?: FieldTypesReadFailure;
492
+ readonly read?: FieldTypesReadName;
493
+ /**
494
+ * What the reader of a plan-bounded read lost: the field types (default) or
495
+ * the table hierarchies. Only the payload and evaluate surfaces say which.
496
+ */
497
+ readonly about?: "types" | "hierarchy";
498
+ /**
499
+ * The profile may opt out of requiring field types (`fieldTypes.dictionary:
500
+ * "not_required"`): name it as a remedy. Only the dispatcher's refusal does.
501
+ */
502
+ readonly optIn?: boolean;
503
+ }
504
+ /**
505
+ * The cause-less refusal: a loader that does not say why. It never begins with
506
+ * "Access denied by policy", which is for a refusal this server's own policy
507
+ * makes.
508
+ */
509
+ export declare const FIELD_TYPES_UNAVAILABLE_MESSAGE = "Field types could not be read from the instance, so no values are returned.";
510
+ /** The refusal for a table outside the call's resolved plan, a decision of this server's own plan. */
511
+ export declare function fieldTypesPlanDenialText(table?: unknown): string;
512
+ /**
513
+ * The one source of the sentences that say why field types could not be read.
514
+ * Only a validated table name (on the dispatcher and history, never where the
515
+ * table came from a payload), an integer status and fixed words are
516
+ * interpolated; no upstream text is ever part of one. "Access denied by
517
+ * policy" is only for a cause of this server's own policy ({@link
518
+ * FieldTypesReadFailure} `policy`) and for {@link fieldTypesPlanDenialText}.
519
+ */
520
+ export declare function fieldTypesProblemText(input: FieldTypesProblemInput): string;
521
+ /**
522
+ * The cause to report for a plan-bounded read of the tables `tables`: a table
523
+ * `sys_db_object` has no row for, then why the chain read gave no answer, then
524
+ * the first incomplete chain. Undefined when the loader knows none.
525
+ */
526
+ export declare function planHierarchyProblem(loaded: PlanFieldTypes, tables: Iterable<string>): Pick<FieldTypesProblemInput, "problem" | "failure" | "read"> | undefined;
527
+ /** The cause to report when a plan-bounded read's field types are unavailable. */
528
+ export declare function planTypesProblem(loaded: PlanFieldTypes): Pick<FieldTypesProblemInput, "failure" | "read"> | undefined;
529
+ /** What to tell the caller when the call's field types are not known, and how to audit it. */
530
+ export interface FieldTypesRefusal {
531
+ readonly message: string;
532
+ /** True when the cause is this server's own policy (audited as a policy rejection). */
533
+ readonly policy: boolean;
534
+ /** An error carrying only a bounded category and retry decision, for the audit record. */
535
+ readonly auditError: Error;
536
+ }
194
537
  /**
195
- * The fixed refusal when field types cannot be read and the profile has not
196
- * opted out. It names what to grant; it carries no table or field name.
538
+ * Pick the one cause to report for a call over `tables` whose field types are
539
+ * not usable, from what the loader found. A table that does not exist comes
540
+ * first (the caller's to fix, and a retry cannot help), then the dictionary's
541
+ * cause, then the first table's failed chain read, then its chain gap. The
542
+ * result is a refusal; whether the call is refused at all is
543
+ * {@link hiddenFieldScope}'s answer.
197
544
  */
198
- export declare const FIELD_TYPES_UNAVAILABLE_MESSAGE: string;
545
+ export declare function fieldTypesRefusal(types: FieldTypes, tables: Iterable<string>): FieldTypesRefusal;
199
546
  /**
200
547
  * Whether a profile's read tools require the field types. `"required"` (the
201
548
  * default) refuses every field-policy tool call while the types cannot be
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-values.d.ts","sourceRoot":"","sources":["../src/hidden-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAmC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIzF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAK9C,CAAC;AAIH,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAExD;AAED,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAEpF,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,w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