@onlyflows/servicenow-mcp 2.2.0-dev.6 → 2.2.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 (269) hide show
  1. package/.env.example +6 -3
  2. package/CHANGELOG.md +404 -0
  3. package/README.md +580 -104
  4. package/dist/atf-form.d.ts +3 -15
  5. package/dist/atf-form.d.ts.map +1 -1
  6. package/dist/atf-policy.d.ts +1 -1
  7. package/dist/atf-policy.d.ts.map +1 -1
  8. package/dist/atf-policy.js +2 -0
  9. package/dist/atf-policy.js.map +1 -1
  10. package/dist/atf-result-cache.d.ts +23 -59
  11. package/dist/atf-result-cache.d.ts.map +1 -1
  12. package/dist/auth.d.ts +1 -0
  13. package/dist/auth.d.ts.map +1 -1
  14. package/dist/auth.js +17 -0
  15. package/dist/auth.js.map +1 -1
  16. package/dist/batch-limits.d.ts +18 -0
  17. package/dist/batch-limits.d.ts.map +1 -0
  18. package/dist/batch-limits.js +21 -0
  19. package/dist/batch-limits.js.map +1 -0
  20. package/dist/bounded-input.d.ts +49 -0
  21. package/dist/bounded-input.d.ts.map +1 -0
  22. package/dist/bounded-input.js +81 -0
  23. package/dist/bounded-input.js.map +1 -0
  24. package/dist/client.d.ts +25 -0
  25. package/dist/client.d.ts.map +1 -1
  26. package/dist/client.js +92 -18
  27. package/dist/client.js.map +1 -1
  28. package/dist/credential-tables.d.ts +32 -0
  29. package/dist/credential-tables.d.ts.map +1 -0
  30. package/dist/credential-tables.js +58 -0
  31. package/dist/credential-tables.js.map +1 -0
  32. package/dist/encoded-query-policy.d.ts +11 -0
  33. package/dist/encoded-query-policy.d.ts.map +1 -1
  34. package/dist/encoded-query-policy.js +18 -2
  35. package/dist/encoded-query-policy.js.map +1 -1
  36. package/dist/execution-context.d.ts +14 -0
  37. package/dist/execution-context.d.ts.map +1 -1
  38. package/dist/execution-context.js +8 -0
  39. package/dist/execution-context.js.map +1 -1
  40. package/dist/field-policy.d.ts +115 -3
  41. package/dist/field-policy.d.ts.map +1 -1
  42. package/dist/field-policy.js +909 -97
  43. package/dist/field-policy.js.map +1 -1
  44. package/dist/hidden-values.d.ts +225 -0
  45. package/dist/hidden-values.d.ts.map +1 -0
  46. package/dist/hidden-values.js +748 -0
  47. package/dist/hidden-values.js.map +1 -0
  48. package/dist/html-response.d.ts +34 -0
  49. package/dist/html-response.d.ts.map +1 -0
  50. package/dist/html-response.js +72 -0
  51. package/dist/html-response.js.map +1 -0
  52. package/dist/http-entrypoint.d.ts.map +1 -1
  53. package/dist/http-entrypoint.js +7 -0
  54. package/dist/http-entrypoint.js.map +1 -1
  55. package/dist/http-runtime.d.ts.map +1 -1
  56. package/dist/http-runtime.js +8 -0
  57. package/dist/http-runtime.js.map +1 -1
  58. package/dist/incident-journal-policy.d.ts +27 -5
  59. package/dist/incident-journal-policy.d.ts.map +1 -1
  60. package/dist/incident-journal-policy.js +34 -21
  61. package/dist/incident-journal-policy.js.map +1 -1
  62. package/dist/index.js +7 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/json-shape-limits.d.ts +71 -0
  65. package/dist/json-shape-limits.d.ts.map +1 -0
  66. package/dist/json-shape-limits.js +131 -0
  67. package/dist/json-shape-limits.js.map +1 -0
  68. package/dist/metadata-cache.d.ts +84 -21
  69. package/dist/metadata-cache.d.ts.map +1 -1
  70. package/dist/metadata-cache.js +316 -196
  71. package/dist/metadata-cache.js.map +1 -1
  72. package/dist/policy-card.d.ts +146 -0
  73. package/dist/policy-card.d.ts.map +1 -0
  74. package/dist/policy-card.js +420 -0
  75. package/dist/policy-card.js.map +1 -0
  76. package/dist/profile-manager.d.ts +19 -3
  77. package/dist/profile-manager.d.ts.map +1 -1
  78. package/dist/profile-manager.js +89 -4
  79. package/dist/profile-manager.js.map +1 -1
  80. package/dist/record-identifier-policy.d.ts +2 -8
  81. package/dist/record-identifier-policy.d.ts.map +1 -1
  82. package/dist/risky-grants.d.ts +25 -0
  83. package/dist/risky-grants.d.ts.map +1 -0
  84. package/dist/risky-grants.js +77 -0
  85. package/dist/risky-grants.js.map +1 -0
  86. package/dist/server.d.ts.map +1 -1
  87. package/dist/server.js +26 -5
  88. package/dist/server.js.map +1 -1
  89. package/dist/setup-prompts.js +1 -0
  90. package/dist/setup-prompts.js.map +1 -1
  91. package/dist/setup.d.ts +1 -1
  92. package/dist/setup.d.ts.map +1 -1
  93. package/dist/setup.js +305 -59
  94. package/dist/setup.js.map +1 -1
  95. package/dist/stdio-runtime.d.ts +15 -0
  96. package/dist/stdio-runtime.d.ts.map +1 -1
  97. package/dist/stdio-runtime.js +60 -0
  98. package/dist/stdio-runtime.js.map +1 -1
  99. package/dist/structured-query.d.ts +100 -115
  100. package/dist/structured-query.d.ts.map +1 -1
  101. package/dist/structured-query.js +138 -17
  102. package/dist/structured-query.js.map +1 -1
  103. package/dist/table-policy.d.ts +41 -4
  104. package/dist/table-policy.d.ts.map +1 -1
  105. package/dist/table-policy.js +82 -10
  106. package/dist/table-policy.js.map +1 -1
  107. package/dist/tool-error.d.ts +34 -0
  108. package/dist/tool-error.d.ts.map +1 -1
  109. package/dist/tool-error.js +109 -1
  110. package/dist/tool-error.js.map +1 -1
  111. package/dist/tool-table-access.d.ts.map +1 -1
  112. package/dist/tool-table-access.js +35 -5
  113. package/dist/tool-table-access.js.map +1 -1
  114. package/dist/tools/aggregate.d.ts +13 -19
  115. package/dist/tools/aggregate.d.ts.map +1 -1
  116. package/dist/tools/aggregate.js +4 -5
  117. package/dist/tools/aggregate.js.map +1 -1
  118. package/dist/tools/all-fields-cap.d.ts.map +1 -1
  119. package/dist/tools/all-fields-cap.js +32 -45
  120. package/dist/tools/all-fields-cap.js.map +1 -1
  121. package/dist/tools/atf-author-module.d.ts +29 -14
  122. package/dist/tools/atf-author-module.d.ts.map +1 -1
  123. package/dist/tools/atf-author-module.js +11 -5
  124. package/dist/tools/atf-author-module.js.map +1 -1
  125. package/dist/tools/atf-contracts.d.ts +135 -829
  126. package/dist/tools/atf-contracts.d.ts.map +1 -1
  127. package/dist/tools/atf-shared.js +2 -2
  128. package/dist/tools/atf-shared.js.map +1 -1
  129. package/dist/tools/atf-step-catalog.d.ts +16 -15
  130. package/dist/tools/atf-step-catalog.d.ts.map +1 -1
  131. package/dist/tools/atf-step-catalog.js +181 -10
  132. package/dist/tools/atf-step-catalog.js.map +1 -1
  133. package/dist/tools/atf.d.ts +8 -24
  134. package/dist/tools/atf.d.ts.map +1 -1
  135. package/dist/tools/atf.js +2 -2
  136. package/dist/tools/atf.js.map +1 -1
  137. package/dist/tools/attach.d.ts +6 -22
  138. package/dist/tools/attach.d.ts.map +1 -1
  139. package/dist/tools/batch.d.ts +18 -71
  140. package/dist/tools/batch.d.ts.map +1 -1
  141. package/dist/tools/batch.js +566 -100
  142. package/dist/tools/batch.js.map +1 -1
  143. package/dist/tools/catalog.d.ts +2 -2
  144. package/dist/tools/catalog.d.ts.map +1 -1
  145. package/dist/tools/catalog.js +7 -1
  146. package/dist/tools/catalog.js.map +1 -1
  147. package/dist/tools/codesearch.d.ts +1 -13
  148. package/dist/tools/codesearch.d.ts.map +1 -1
  149. package/dist/tools/create-module.d.ts +9 -14
  150. package/dist/tools/create-module.d.ts.map +1 -1
  151. package/dist/tools/create-module.js +4 -8
  152. package/dist/tools/create-module.js.map +1 -1
  153. package/dist/tools/delete.d.ts +1 -9
  154. package/dist/tools/delete.d.ts.map +1 -1
  155. package/dist/tools/delete.js +2 -3
  156. package/dist/tools/delete.js.map +1 -1
  157. package/dist/tools/discover.d.ts +6 -14
  158. package/dist/tools/discover.d.ts.map +1 -1
  159. package/dist/tools/flow-view-contracts.d.ts +1023 -0
  160. package/dist/tools/flow-view-contracts.d.ts.map +1 -0
  161. package/dist/tools/flow-view-contracts.js +570 -0
  162. package/dist/tools/flow-view-contracts.js.map +1 -0
  163. package/dist/tools/flow-view-graph.d.ts +86 -0
  164. package/dist/tools/flow-view-graph.d.ts.map +1 -0
  165. package/dist/tools/flow-view-graph.js +993 -0
  166. package/dist/tools/flow-view-graph.js.map +1 -0
  167. package/dist/tools/flow-view-gzip.d.ts +52 -0
  168. package/dist/tools/flow-view-gzip.d.ts.map +1 -0
  169. package/dist/tools/flow-view-gzip.js +179 -0
  170. package/dist/tools/flow-view-gzip.js.map +1 -0
  171. package/dist/tools/flow-view-mermaid.d.ts +37 -0
  172. package/dist/tools/flow-view-mermaid.d.ts.map +1 -0
  173. package/dist/tools/flow-view-mermaid.js +337 -0
  174. package/dist/tools/flow-view-mermaid.js.map +1 -0
  175. package/dist/tools/flow-view-module.d.ts +61 -0
  176. package/dist/tools/flow-view-module.d.ts.map +1 -0
  177. package/dist/tools/flow-view-module.js +378 -0
  178. package/dist/tools/flow-view-module.js.map +1 -0
  179. package/dist/tools/flow-view-policy.d.ts +106 -0
  180. package/dist/tools/flow-view-policy.d.ts.map +1 -0
  181. package/dist/tools/flow-view-policy.js +462 -0
  182. package/dist/tools/flow-view-policy.js.map +1 -0
  183. package/dist/tools/flow-view-renderers.d.ts +68 -0
  184. package/dist/tools/flow-view-renderers.d.ts.map +1 -0
  185. package/dist/tools/flow-view-renderers.js +513 -0
  186. package/dist/tools/flow-view-renderers.js.map +1 -0
  187. package/dist/tools/flow-view-table.d.ts +115 -0
  188. package/dist/tools/flow-view-table.d.ts.map +1 -0
  189. package/dist/tools/flow-view-table.js +1002 -0
  190. package/dist/tools/flow-view-table.js.map +1 -0
  191. package/dist/tools/get-module.d.ts +36 -42
  192. package/dist/tools/get-module.d.ts.map +1 -1
  193. package/dist/tools/health.d.ts +9 -6
  194. package/dist/tools/health.d.ts.map +1 -1
  195. package/dist/tools/incident-journal-module.d.ts +8 -7
  196. package/dist/tools/incident-journal-module.d.ts.map +1 -1
  197. package/dist/tools/index.d.ts +4 -4
  198. package/dist/tools/index.d.ts.map +1 -1
  199. package/dist/tools/index.js +118 -18
  200. package/dist/tools/index.js.map +1 -1
  201. package/dist/tools/markdown.d.ts +27 -0
  202. package/dist/tools/markdown.d.ts.map +1 -1
  203. package/dist/tools/markdown.js +104 -1
  204. package/dist/tools/markdown.js.map +1 -1
  205. package/dist/tools/nl.d.ts +1 -11
  206. package/dist/tools/nl.d.ts.map +1 -1
  207. package/dist/tools/profile.d.ts +1 -1
  208. package/dist/tools/profile.d.ts.map +1 -1
  209. package/dist/tools/profile.js +20 -1
  210. package/dist/tools/profile.js.map +1 -1
  211. package/dist/tools/query-module.d.ts +59 -71
  212. package/dist/tools/query-module.d.ts.map +1 -1
  213. package/dist/tools/query-module.js +28 -7
  214. package/dist/tools/query-module.js.map +1 -1
  215. package/dist/tools/record-write-shared.d.ts.map +1 -1
  216. package/dist/tools/record-write-shared.js +20 -2
  217. package/dist/tools/record-write-shared.js.map +1 -1
  218. package/dist/tools/relationships.d.ts +6 -22
  219. package/dist/tools/relationships.d.ts.map +1 -1
  220. package/dist/tools/result-envelope.d.ts +2255 -1357
  221. package/dist/tools/result-envelope.d.ts.map +1 -1
  222. package/dist/tools/result-envelope.js +24 -2
  223. package/dist/tools/result-envelope.js.map +1 -1
  224. package/dist/tools/schema-module.d.ts +36 -21
  225. package/dist/tools/schema-module.d.ts.map +1 -1
  226. package/dist/tools/schema-module.js +106 -65
  227. package/dist/tools/schema-module.js.map +1 -1
  228. package/dist/tools/script.d.ts +1 -11
  229. package/dist/tools/script.d.ts.map +1 -1
  230. package/dist/tools/syslog.d.ts +11 -18
  231. package/dist/tools/syslog.d.ts.map +1 -1
  232. package/dist/tools/syslog.js +2 -3
  233. package/dist/tools/syslog.js.map +1 -1
  234. package/dist/tools/table-hierarchy.d.ts +35 -0
  235. package/dist/tools/table-hierarchy.d.ts.map +1 -0
  236. package/dist/tools/table-hierarchy.js +74 -0
  237. package/dist/tools/table-hierarchy.js.map +1 -0
  238. package/dist/tools/tool-module.d.ts +40 -15
  239. package/dist/tools/tool-module.d.ts.map +1 -1
  240. package/dist/tools/tool-module.js +755 -205
  241. package/dist/tools/tool-module.js.map +1 -1
  242. package/dist/tools/update-module.d.ts +11 -17
  243. package/dist/tools/update-module.d.ts.map +1 -1
  244. package/dist/tools/update-module.js +10 -12
  245. package/dist/tools/update-module.js.map +1 -1
  246. package/dist/unknown-filter-fields.d.ts +52 -0
  247. package/dist/unknown-filter-fields.d.ts.map +1 -0
  248. package/dist/unknown-filter-fields.js +87 -0
  249. package/dist/unknown-filter-fields.js.map +1 -0
  250. package/dist/version.d.ts +1 -1
  251. package/dist/version.d.ts.map +1 -1
  252. package/dist/version.js +1 -1
  253. package/dist/version.js.map +1 -1
  254. package/dist/write-value-policy.d.ts +20 -12
  255. package/dist/write-value-policy.d.ts.map +1 -1
  256. package/dist/write-value-policy.js +179 -67
  257. package/dist/write-value-policy.js.map +1 -1
  258. package/docs/ADDING-TOOLS.md +22 -13
  259. package/docs/CLIENT-SETUP.md +110 -52
  260. package/docs/CROSS-CLIENT-RELEASE-MATRIX.md +2 -2
  261. package/docs/FLOW-VIEW.md +214 -0
  262. package/docs/PRODUCTION-SECURITY.md +218 -25
  263. package/docs/RELEASE-VALIDATION.md +2 -2
  264. package/docs/TESTING-OAUTH.md +1 -1
  265. package/docs/V2-MIGRATION.md +404 -30
  266. package/package.json +20 -6
  267. package/scripts/release-validate.mjs +56 -0
  268. package/server.json +22 -0
  269. package/tools/inspector/package-lock.json +163 -201
@@ -6,39 +6,53 @@
6
6
  * selector. The scope must discriminate credential identity as well as
7
7
  * instance: ServiceNow evaluates ACLs per user, and a cache hit skips the
8
8
  * upstream read entirely, so a scope shared between identities would serve
9
- * one caller's authorized rows to another. A cache hit performs a lightweight
10
- * sys_updated_on probe before reuse; changed rows force a refresh. Callers can
11
- * force refresh by passing the internal sysparm_force_recache=true parameter,
12
- * which is stripped before upstream I/O.
9
+ * one caller's authorized rows to another. Callers can force refresh by
10
+ * passing the internal sysparm_force_recache=true parameter, which is stripped
11
+ * before upstream I/O.
13
12
  *
14
- * The freshness probe compares sys_updated_on, which ServiceNow evaluates in
15
- * the session user's timezone, so the probe timestamp is formatted in that
16
- * timezone rather than UTC. The zone is resolved per identity from
17
- * sys_user.time_zone, falling back to the glide.sys.default.tz property; when
18
- * it cannot be resolved, caching is disabled for that identity rather than
19
- * assuming UTC and serving silently stale metadata.
13
+ * Freshness is a server watermark: the table's row count (X-Total-Count) and
14
+ * its newest row by sys_updated_on, read back as the stored UTC value. Each
15
+ * entry keeps the watermark read just before its rows were fetched, and a
16
+ * cache hit is served only while a new watermark read still matches it. Both
17
+ * sides of the comparison come from the instance, so the session timezone,
18
+ * date format, DST and clock skew between this host and the instance play no
19
+ * part, and no user lookup is needed: caching behaves the same in every auth
20
+ * mode.
20
21
  *
21
- * Deletions are not detected by the probe, which sees updates only. A row
22
- * deleted upstream stays visible for at most one TTL: a successful probe
23
- * refreshes recency for eviction but never extends expiresAt, so the entry
24
- * still expires on schedule and forces a genuine refetch.
22
+ * An insert or an update makes its row the newest, and an insert or a delete
23
+ * changes the count, so every write moves the watermark -- at one-second
24
+ * resolution. An update within the stored watermark's own second, to a row
25
+ * other than the newest, can still go unseen; so can a write that skips the
26
+ * system fields. Such a row stays stale for at most one TTL: a matching
27
+ * watermark refreshes recency for eviction but never extends expiresAt, so the
28
+ * entry still expires on schedule and forces a genuine refetch.
29
+ *
30
+ * Two memos keep the watermark from costing more than it saves. Within one
31
+ * tool call each table's watermark is read once, however many reads of the
32
+ * table the call makes. Across calls, a table whose watermark proved unusable
33
+ * is read straight through, without a watermark, for a while: long for causes
34
+ * that persist (an incomplete or future-dated watermark, a 4xx), short for
35
+ * transient ones (429, 5xx, timeouts, network).
25
36
  *
26
37
  * @module metadata-cache
27
38
  */
28
39
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.MAX_METADATA_CACHE_ENTRIES_PER_SCOPE = exports.MAX_METADATA_CACHE_SCOPES = exports.FORCE_RECACHE_PARAM = exports.DEFAULT_METADATA_CACHE_TABLES = exports.DEFAULT_METADATA_CACHE_TTL_MS = void 0;
40
+ exports.MAX_DERIVED_BYTES_PER_SCOPE = exports.MAX_DERIVED_ENTRIES_PER_SCOPE = exports.TRANSIENT_UNCACHEABLE_MS = exports.STRUCTURAL_UNCACHEABLE_MS = exports.MAX_METADATA_CACHE_ENTRIES_PER_SCOPE = exports.MAX_METADATA_CACHE_SCOPES = exports.FORCE_RECACHE_PARAM = exports.DEFAULT_METADATA_CACHE_TABLES = exports.DEFAULT_METADATA_CACHE_TTL_MS = void 0;
30
41
  exports.metadataCacheConfigFromEnvironment = metadataCacheConfigFromEnvironment;
31
42
  exports.createMetadataCacheConfig = createMetadataCacheConfig;
43
+ exports.derivedMetadataMemo = derivedMetadataMemo;
44
+ exports.uncachedOperations = uncachedOperations;
32
45
  exports.createCachedServiceNowOperations = createCachedServiceNowOperations;
46
+ const client_js_1 = require("./client.js");
33
47
  const config_js_1 = require("./config.js");
34
- const utils_js_1 = require("./utils.js");
48
+ const tool_error_js_1 = require("./tool-error.js");
35
49
  exports.DEFAULT_METADATA_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
36
50
  /**
37
51
  * Tables cached by default.
38
52
  *
39
- * The bar for inclusion is a large payload relative to the freshness probe,
53
+ * The bar for inclusion is a large payload relative to the watermark read,
40
54
  * not merely "this table changes rarely" -- a cache hit still costs one
41
- * upstream round trip (see hasChangedSince), so the saving is payload bytes,
55
+ * upstream round trip (see tableWatermark), so the saving is payload bytes,
42
56
  * never request count. sys_properties is deliberately absent: its rows are
43
57
  * ACL-restricted per user and routinely hold integration secrets in `value`,
44
58
  * and the only reads of it here are three single-value build-info lookups
@@ -56,6 +70,9 @@ exports.DEFAULT_METADATA_CACHE_TABLES = Object.freeze([
56
70
  ]);
57
71
  const SCOPED_CACHES = new Map();
58
72
  const TABLE_NAME = /^[a-z][a-z0-9_]{0,79}$/u;
73
+ /** sys_updated_on as returned with sysparm_display_value=false (UTC). */
74
+ const STORED_DATE_TIME = /^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})$/u;
75
+ const ROW_COUNT = /^(?:0|[1-9]\d{0,15})$/u;
59
76
  exports.FORCE_RECACHE_PARAM = "sysparm_force_recache";
60
77
  const MAX_CACHE_TABLE_PATTERNS = 128;
61
78
  const MAX_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
@@ -64,22 +81,15 @@ const MAX_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
64
81
  * so both are capped and evicted in least-recently-used order. */
65
82
  exports.MAX_METADATA_CACHE_SCOPES = 64;
66
83
  exports.MAX_METADATA_CACHE_ENTRIES_PER_SCOPE = 512;
67
- /**
68
- * Resolved ServiceNow session timezone per cache scope.
69
- *
70
- * A timezone NAME is cached, never a numeric offset: an offset is wrong for
71
- * half the year, and a cached one silently reintroduces the skew at every DST
72
- * transition -- the longer the TTL, the longer it stays wrong. The offset is
73
- * computed from the name for the specific instant being compared.
74
- *
75
- * Keyed by the same scope as the metadata cache, so it discriminates instance
76
- * AND credential identity: two profiles on one instance can authenticate as
77
- * accounts in different timezones, and sharing a resolution between them would
78
- * corrupt the freshness window for both.
79
- */
80
- const SCOPED_TIME_ZONES = new Map();
81
- const TIME_ZONE_WARNED_SCOPES = new Set();
82
- const DEFAULT_TIME_ZONE_PROPERTY = "glide.sys.default.tz";
84
+ /** How long a table goes uncached after its watermark proved unusable; never
85
+ * longer than the cache TTL. */
86
+ exports.STRUCTURAL_UNCACHEABLE_MS = 15 * 60 * 1000;
87
+ exports.TRANSIENT_UNCACHEABLE_MS = 30 * 1000;
88
+ /** Bounds on derived values per scope (see derivedMetadataMemo). */
89
+ exports.MAX_DERIVED_ENTRIES_PER_SCOPE = 512;
90
+ exports.MAX_DERIVED_BYTES_PER_SCOPE = 1024 * 1024;
91
+ /** Fixed allowance per derived value for its record and map slot. */
92
+ const ENTRY_OVERHEAD_BYTES = 512;
83
93
  function metadataCacheConfigFromEnvironment(environment = process.env) {
84
94
  const ttlMs = (0, config_js_1.parsePositiveIntegerEnv)(environment.SN_METADATA_CACHE_TTL_MS, "SN_METADATA_CACHE_TTL_MS", { max: MAX_CACHE_TTL_MS });
85
95
  const tables = parseTablePatterns(environment.SN_METADATA_CACHE_TABLES);
@@ -94,40 +104,130 @@ function createMetadataCacheConfig(input) {
94
104
  tables: normalizeTablePatterns(input?.tables ?? exports.DEFAULT_METADATA_CACHE_TABLES),
95
105
  });
96
106
  }
107
+ /** The operations each cached wrapper reads through. */
108
+ const UNCACHED_OPERATIONS = new WeakMap();
109
+ /** Each cached wrapper's scope and configuration, for derivedMetadataMemo. */
110
+ const WRAPPER_SCOPES = new WeakMap();
111
+ function derivedMetadataMemo(operations) {
112
+ const bound = WRAPPER_SCOPES.get(operations);
113
+ if (bound === undefined)
114
+ return undefined;
115
+ const { state, config } = bound;
116
+ return Object.freeze({
117
+ pending(key) {
118
+ return state.inflight.get(key);
119
+ },
120
+ track(key, promise) {
121
+ if (state.detached || state.inflight.size >= exports.MAX_DERIVED_ENTRIES_PER_SCOPE)
122
+ return promise;
123
+ state.inflight.set(key, promise);
124
+ // Registered before any waiter, so the entry is gone by the time a
125
+ // waiter sees the outcome.
126
+ const clear = () => {
127
+ if (state.inflight.get(key) === promise)
128
+ state.inflight.delete(key);
129
+ };
130
+ promise.then(clear, clear);
131
+ return promise;
132
+ },
133
+ get(key) {
134
+ const entry = state.derived.get(key);
135
+ if (entry === undefined)
136
+ return undefined;
137
+ if (entry.expiresAt <= Date.now()) {
138
+ removeDerived(state, key);
139
+ return undefined;
140
+ }
141
+ state.derived.delete(key);
142
+ state.derived.set(key, entry);
143
+ return entry.value;
144
+ },
145
+ set(key, value, bytes, ttlMs) {
146
+ if (state.detached)
147
+ return;
148
+ removeDerived(state, key);
149
+ const size = Math.max(0, Math.ceil(bytes)) + key.length + ENTRY_OVERHEAD_BYTES;
150
+ if (size > exports.MAX_DERIVED_BYTES_PER_SCOPE)
151
+ return;
152
+ state.derived.set(key, Object.freeze({ expiresAt: Date.now() + Math.min(ttlMs, config.ttlMs), value, bytes: size }));
153
+ state.derivedBytes += size;
154
+ while (state.derived.size > exports.MAX_DERIVED_ENTRIES_PER_SCOPE ||
155
+ state.derivedBytes > exports.MAX_DERIVED_BYTES_PER_SCOPE) {
156
+ const oldest = state.derived.keys().next();
157
+ if (oldest.done)
158
+ break;
159
+ removeDerived(state, oldest.value);
160
+ }
161
+ },
162
+ });
163
+ }
164
+ function removeDerived(state, key) {
165
+ const entry = state.derived.get(key);
166
+ if (entry === undefined)
167
+ return;
168
+ state.derived.delete(key);
169
+ state.derivedBytes -= entry.bytes;
170
+ }
171
+ /**
172
+ * The operations underneath a cached wrapper, or `operations` itself when it
173
+ * is not one.
174
+ *
175
+ * Use it for a read whose answer decides a write, such as the records a bulk
176
+ * update or delete targets. A cache hit can be stale within the watermark's
177
+ * documented gaps, which a read can tolerate but a write target cannot. The
178
+ * read costs one request, with no watermark, and leaves the cache untouched.
179
+ * The internal force-recache parameter is no substitute: it costs a watermark
180
+ * read as well, stores a single-use entry, and reaches ServiceNow unstripped
181
+ * when no wrapper is in place.
182
+ */
183
+ function uncachedOperations(operations) {
184
+ return UNCACHED_OPERATIONS.get(operations) ?? operations;
185
+ }
97
186
  /**
98
187
  * @param scope Cache partition key. Must identify the ServiceNow instance
99
188
  * *and* the credential identity reading from it -- see the module docstring.
100
- * @param sessionUserName ServiceNow user_name this scope authenticates as.
101
- * Required to resolve the session timezone; without it the freshness probe
102
- * cannot be made correct, so caching is disabled for the scope.
103
189
  */
104
- function createCachedServiceNowOperations(operations, scope, config, sessionUserName) {
190
+ function createCachedServiceNowOperations(operations, scope, config) {
105
191
  if (config === undefined && process.env.NODE_ENV === "test") {
106
192
  return operations;
107
193
  }
108
194
  const cacheConfig = createMetadataCacheConfig(config);
109
- const scopedCache = cacheForScope(scope);
195
+ const state = stateForScope(scope);
196
+ // One watermark per table for this wrapper's lifetime, which is one tool
197
+ // call: the dispatcher builds a wrapper per call. A hierarchy walk then
198
+ // reads sys_db_object's watermark once, not once per hop. Any write the call
199
+ // makes clears it, so the call's later reads see its own writes. No memo
200
+ // spans calls: that would add staleness across calls for almost no time.
201
+ const watermarks = new Map();
202
+ const clearingWatermarks = (write) => async (...args) => {
203
+ try {
204
+ return await write(...args);
205
+ }
206
+ finally {
207
+ watermarks.clear();
208
+ }
209
+ };
110
210
  const cached = Object.create(null);
111
211
  Object.defineProperties(cached, {
112
212
  get: {
113
- value: async (path, params) => (await cachedGetWithMeta(operations, scopedCache, cacheConfig, path, params, { scope, sessionUserName })).data,
213
+ value: async (path, params) => (await cachedGetWithMeta(operations, state, watermarks, cacheConfig, path, params)).data,
114
214
  },
115
215
  getWithMeta: {
116
- value: (path, params) => cachedGetWithMeta(operations, scopedCache, cacheConfig, path, params, {
117
- scope,
118
- sessionUserName,
119
- }),
216
+ value: (path, params) => cachedGetWithMeta(operations, state, watermarks, cacheConfig, path, params),
120
217
  },
121
- post: { value: operations.post.bind(operations) },
122
- patch: { value: operations.patch.bind(operations) },
123
- delete: { value: operations.delete.bind(operations) },
124
- postBinary: { value: operations.postBinary.bind(operations) },
218
+ post: { value: clearingWatermarks(operations.post.bind(operations)) },
219
+ patch: { value: clearingWatermarks(operations.patch.bind(operations)) },
220
+ delete: { value: clearingWatermarks(operations.delete.bind(operations)) },
221
+ postBinary: { value: clearingWatermarks(operations.postBinary.bind(operations)) },
125
222
  getRaw: { value: operations.getRaw.bind(operations) },
126
- ...(operations.saveAtfStepInputs ? { saveAtfStepInputs: { value: operations.saveAtfStepInputs.bind(operations) } } : {}),
223
+ ...(operations.saveAtfStepInputs ? { saveAtfStepInputs: { value: clearingWatermarks(operations.saveAtfStepInputs.bind(operations)) } } : {}),
127
224
  });
128
- return Object.freeze(cached);
225
+ Object.freeze(cached);
226
+ UNCACHED_OPERATIONS.set(cached, operations);
227
+ WRAPPER_SCOPES.set(cached, { state, config: cacheConfig });
228
+ return cached;
129
229
  }
130
- async function cachedGetWithMeta(operations, cache, config, path, params, identity) {
230
+ async function cachedGetWithMeta(operations, state, watermarks, config, path, params) {
131
231
  // Strip the internal flag before any upstream call, including the
132
232
  // passthrough: sysparm_force_recache is this module's own parameter and must
133
233
  // never reach ServiceNow, whether or not the table is cached.
@@ -136,37 +236,56 @@ async function cachedGetWithMeta(operations, cache, config, path, params, identi
136
236
  if (!match || !tableMatches(config.tables, match)) {
137
237
  return operations.getWithMeta(path, cleanParams);
138
238
  }
139
- // The freshness probe compares sys_updated_on in the session user's
140
- // timezone. Without knowing that timezone the probe is wrong by the offset,
141
- // so caching is disabled for this identity rather than assuming UTC.
142
- const timeZone = await sessionTimeZone(operations, identity);
143
- if (timeZone === undefined) {
144
- return operations.getWithMeta(path, cleanParams);
239
+ const now = Date.now();
240
+ const uncacheableUntil = state.uncacheable.get(match);
241
+ if (uncacheableUntil !== undefined) {
242
+ if (!forceRecache && uncacheableUntil > now) {
243
+ return operations.getWithMeta(path, cleanParams);
244
+ }
245
+ // Expired, or the caller asked for a refresh: try the watermark again.
246
+ state.uncacheable.delete(match);
247
+ watermarks.delete(match);
145
248
  }
249
+ const cache = state.entries;
146
250
  const key = cacheKey(path, cleanParams);
147
- const now = Date.now();
148
251
  const existing = cache.get(key);
149
- if (existing && existing.expiresAt <= now)
252
+ // Read on a miss too, and always before the rows. An update landing between
253
+ // the two reads is then in the rows but not the watermark, which costs one
254
+ // extra refresh; read the other way round it would be in the watermark but
255
+ // not the rows, and the next comparison would serve it stale until expiry.
256
+ // A watermark memoized earlier in the call was also read before these rows.
257
+ const read = await callWatermark(operations, watermarks, match);
258
+ if (!read.usable)
259
+ markUncacheable(state, match, read.reason, config.ttlMs);
260
+ const watermark = read.usable ? read.watermark : undefined;
261
+ if (!forceRecache &&
262
+ existing !== undefined &&
263
+ existing.expiresAt > now &&
264
+ watermark !== undefined &&
265
+ sameWatermark(existing.watermark, watermark)) {
266
+ // Re-insert to mark the entry most recently used for eviction order.
150
267
  cache.delete(key);
151
- if (!forceRecache && existing && existing.expiresAt > now) {
152
- const changed = await hasChangedSince(operations, match, existing.lastSyncedAt, timeZone);
153
- if (!changed) {
154
- // Re-insert to mark the entry most recently used for eviction order.
155
- cache.delete(key);
156
- cache.set(key, existing);
157
- return cloneCachedResult(existing);
158
- }
268
+ cache.set(key, existing);
269
+ return cloneCachedResult(existing);
159
270
  }
160
- const lastSyncedAt = Date.now();
271
+ // A forced refresh must never leave behind the rows it was asked to replace:
272
+ // it is how a caller surfaces a write the watermark missed. Any other
273
+ // refetch leaves the entry until it is replaced -- if these rows cannot be
274
+ // kept, the old ones are still correct against any later watermark read that
275
+ // matches theirs, so they serve again once the table is cacheable again.
276
+ if (forceRecache)
277
+ cache.delete(key);
161
278
  const fresh = await operations.getWithMeta(path, cleanParams);
162
279
  // Only a materialized 200 body is reusable. A 204 carries no rows, and a
163
280
  // failed read throws before reaching here, so nothing negative is cached.
164
- if (fresh.status !== 200 || fresh.data === null)
281
+ // Rows without a watermark could never be revalidated, so they are not kept.
282
+ if (fresh.status !== 200 || fresh.data === null || watermark === undefined) {
165
283
  return fresh;
284
+ }
166
285
  cache.delete(key);
167
286
  cache.set(key, Object.freeze({
168
- expiresAt: lastSyncedAt + config.ttlMs,
169
- lastSyncedAt,
287
+ expiresAt: now + config.ttlMs,
288
+ watermark,
170
289
  data: cloneJson(fresh.data),
171
290
  status: fresh.status,
172
291
  headers: Object.freeze([...fresh.headers.entries()]),
@@ -174,6 +293,22 @@ async function cachedGetWithMeta(operations, cache, config, path, params, identi
174
293
  evictOldest(cache, exports.MAX_METADATA_CACHE_ENTRIES_PER_SCOPE);
175
294
  return fresh;
176
295
  }
296
+ function callWatermark(operations, watermarks, table) {
297
+ let pending = watermarks.get(table);
298
+ if (pending === undefined) {
299
+ pending = tableWatermark(operations, table);
300
+ watermarks.set(table, pending);
301
+ }
302
+ return pending;
303
+ }
304
+ function markUncacheable(state, table, reason, ttlMs) {
305
+ if (reason === "cancelled")
306
+ return;
307
+ const period = reason === "structural" ? exports.STRUCTURAL_UNCACHEABLE_MS : exports.TRANSIENT_UNCACHEABLE_MS;
308
+ state.uncacheable.delete(table);
309
+ state.uncacheable.set(table, Date.now() + Math.min(period, ttlMs));
310
+ evictOldest(state.uncacheable, exports.MAX_METADATA_CACHE_ENTRIES_PER_SCOPE);
311
+ }
177
312
  /** Drop least-recently-used entries until the map is within `limit`. */
178
313
  function evictOldest(entries, limit) {
179
314
  while (entries.size > limit) {
@@ -183,23 +318,104 @@ function evictOldest(entries, limit) {
183
318
  entries.delete(oldest.value);
184
319
  }
185
320
  }
186
- async function hasChangedSince(operations, table, lastSyncedAt, timeZone) {
321
+ /**
322
+ * The table's row count and newest row by sys_updated_on, read back as stored.
323
+ *
324
+ * The order is evaluated on the instance and the values are compared as opaque
325
+ * strings, so no date literal is ever built on this side. The count is the
326
+ * X-Total-Count header of the same request, which carries the table's total
327
+ * only while sysparm_no_count is left unset (with it set, the header still
328
+ * comes back but holds the page size).
329
+ *
330
+ * A count of 0 with no rows is a valid watermark for an empty table: the
331
+ * header counts rows before row ACLs filter them (a table whose newest row is
332
+ * ACL-hidden reads back a positive count and no row), so any insert moves it.
333
+ *
334
+ * The watermark is unusable, structurally, when:
335
+ * - the response is not a 200, or the count or a row field is missing or
336
+ * malformed (an unreadable sys_updated_on would compare equal forever);
337
+ * - the count is positive but no row came back, which is what a row ACL that
338
+ * filters after the limit produces when it hides the newest row;
339
+ * - the newest row is dated after the instance's own clock (the response Date
340
+ * header). Such a row stays the newest however many others are updated, so
341
+ * only the count would move, and in-place updates would go unseen.
342
+ * A thrown read is classified by readFailureReason.
343
+ */
344
+ async function tableWatermark(operations, table) {
345
+ const structural = { usable: false, reason: "structural" };
187
346
  try {
188
- const response = await operations.get(`/api/now/table/${table}`, {
189
- sysparm_query: `sys_updated_on>${serviceNowDateTime(lastSyncedAt, timeZone)}`,
347
+ const response = await operations.getWithMeta(`/api/now/table/${table}`, {
348
+ sysparm_query: "ORDERBYDESCsys_updated_on",
190
349
  sysparm_fields: "sys_id,sys_updated_on",
191
350
  sysparm_limit: "1",
192
- sysparm_no_count: "true",
193
351
  sysparm_display_value: "false",
194
352
  sysparm_exclude_reference_link: "true",
195
353
  });
196
- return Array.isArray(response?.result) && response.result.length > 0;
354
+ const count = response.headers.get("x-total-count") ?? "";
355
+ if (response.status !== 200 || !ROW_COUNT.test(count))
356
+ return structural;
357
+ const rows = response.data?.result;
358
+ if (!Array.isArray(rows))
359
+ return structural;
360
+ if (rows.length === 0) {
361
+ return count === "0"
362
+ ? { usable: true, watermark: Object.freeze({ count: 0, sysId: "", updatedOn: "" }) }
363
+ : structural;
364
+ }
365
+ const row = rows[0];
366
+ if (typeof row !== "object" || row === null)
367
+ return structural;
368
+ const { sys_id: sysId, sys_updated_on: updatedOn } = row;
369
+ if (typeof sysId !== "string" || sysId === "")
370
+ return structural;
371
+ if (typeof updatedOn !== "string")
372
+ return structural;
373
+ const stored = STORED_DATE_TIME.exec(updatedOn);
374
+ const updatedAt = stored ? Date.parse(`${stored[1]}T${stored[2]}Z`) : Number.NaN;
375
+ const serverNow = Date.parse(response.headers.get("date") ?? "");
376
+ if (!Number.isFinite(updatedAt) || !Number.isFinite(serverNow))
377
+ return structural;
378
+ if (updatedAt > serverNow)
379
+ return structural;
380
+ return { usable: true, watermark: Object.freeze({ count: Number(count), sysId, updatedOn }) };
197
381
  }
198
- catch {
199
- // A failed probe must not serve stale metadata indefinitely.
200
- return true;
382
+ catch (error) {
383
+ // A failed read must not serve stale metadata.
384
+ return { usable: false, reason: readFailureReason(error) };
201
385
  }
202
386
  }
387
+ /**
388
+ * A 403, 404, 409 or other fixed rejection of this request shape will repeat,
389
+ * so it is structural. A 401 (a token refresh can fix it), 429, 5xx, timeout,
390
+ * network or unrecognized failure is transient.
391
+ */
392
+ function readFailureReason(error) {
393
+ if ((0, client_js_1.isServiceNowRequestCancellation)(error))
394
+ return "cancelled";
395
+ const descriptor = (0, tool_error_js_1.trustedToolErrorDescriptor)(error);
396
+ switch (descriptor?.category) {
397
+ case "authorization":
398
+ case "not_found":
399
+ case "conflict":
400
+ return "structural";
401
+ case "upstream":
402
+ // The client marks a 5xx GET retryable and any other status do_not_retry.
403
+ return descriptor.retry === "do_not_retry" ? "structural" : "transient";
404
+ default:
405
+ return "transient";
406
+ }
407
+ }
408
+ /**
409
+ * Every field counts. The count catches inserts and deletes; the sys_id also
410
+ * catches the newest row being replaced as newest within the same second. A
411
+ * tie at the top that the instance orders differently between reads only
412
+ * costs an extra refresh.
413
+ */
414
+ function sameWatermark(left, right) {
415
+ return (left.count === right.count &&
416
+ left.sysId === right.sysId &&
417
+ left.updatedOn === right.updatedOn);
418
+ }
203
419
  function metadataTableFromPath(path) {
204
420
  const match = /^\/api\/now\/table\/([a-z][a-z0-9_]{0,79})(?:\/|$)/u.exec(path);
205
421
  return match?.[1];
@@ -219,16 +435,34 @@ function stripForceRecache(params) {
219
435
  forceRecache: forceValue === "true" || forceValue === "1",
220
436
  };
221
437
  }
222
- function cacheForScope(scope) {
438
+ function stateForScope(scope) {
223
439
  const existing = SCOPED_CACHES.get(scope);
224
440
  if (existing) {
225
441
  SCOPED_CACHES.delete(scope);
226
442
  SCOPED_CACHES.set(scope, existing);
227
443
  return existing;
228
444
  }
229
- const next = new Map();
445
+ // Not frozen: the derived memo's byte total and the detached flag change.
446
+ const next = {
447
+ entries: new Map(),
448
+ uncacheable: new Map(),
449
+ derived: new Map(),
450
+ derivedBytes: 0,
451
+ inflight: new Map(),
452
+ detached: false,
453
+ };
230
454
  SCOPED_CACHES.set(scope, next);
231
- evictOldest(SCOPED_CACHES, exports.MAX_METADATA_CACHE_SCOPES);
455
+ while (SCOPED_CACHES.size > exports.MAX_METADATA_CACHE_SCOPES) {
456
+ const oldest = SCOPED_CACHES.entries().next();
457
+ if (oldest.done)
458
+ break;
459
+ const [oldScope, oldState] = oldest.value;
460
+ SCOPED_CACHES.delete(oldScope);
461
+ oldState.derived.clear();
462
+ oldState.derivedBytes = 0;
463
+ oldState.inflight.clear();
464
+ oldState.detached = true;
465
+ }
232
466
  return next;
233
467
  }
234
468
  function cacheKey(path, params) {
@@ -249,120 +483,6 @@ function cloneJson(value) {
249
483
  return value;
250
484
  return JSON.parse(JSON.stringify(value));
251
485
  }
252
- /**
253
- * Format an instant as ServiceNow's `YYYY-MM-DD HH:mm:ss` in the given zone.
254
- *
255
- * The offset is derived from the zone NAME for this specific instant, so a
256
- * timestamp on either side of a DST transition resolves to the offset actually
257
- * in force then. This is why the name is what gets cached.
258
- */
259
- function serviceNowDateTime(epochMs, timeZone) {
260
- const parts = new Intl.DateTimeFormat("en-US", {
261
- timeZone,
262
- hourCycle: "h23",
263
- year: "numeric",
264
- month: "2-digit",
265
- day: "2-digit",
266
- hour: "2-digit",
267
- minute: "2-digit",
268
- second: "2-digit",
269
- }).formatToParts(new Date(epochMs));
270
- const field = (type) => parts.find((part) => part.type === type)?.value ?? "00";
271
- return (`${field("year")}-${field("month")}-${field("day")} ` +
272
- `${field("hour")}:${field("minute")}:${field("second")}`);
273
- }
274
- /** True when Intl recognizes the name, so a bad value never silently formats. */
275
- function isUsableTimeZone(candidate) {
276
- if (typeof candidate !== "string" || candidate.trim() === "")
277
- return false;
278
- try {
279
- new Intl.DateTimeFormat("en-US", { timeZone: candidate.trim() });
280
- return true;
281
- }
282
- catch {
283
- return false;
284
- }
285
- }
286
- /**
287
- * Resolve, and memoize per scope, the timezone the session user's
288
- * `sys_updated_on` comparisons are evaluated in.
289
- *
290
- * Chain: the user's own `sys_user.time_zone`, then the instance default in
291
- * `glide.sys.default.tz`, then unresolved. `time_zone` is not a required field
292
- * and is frequently empty; an empty value means "inherit the system default"
293
- * and must never be read as UTC, which is the very error this fixes.
294
- */
295
- async function sessionTimeZone(operations, identity) {
296
- const existing = SCOPED_TIME_ZONES.get(identity.scope);
297
- if (existing) {
298
- SCOPED_TIME_ZONES.delete(identity.scope);
299
- SCOPED_TIME_ZONES.set(identity.scope, existing);
300
- return existing;
301
- }
302
- const pending = resolveSessionTimeZone(operations, identity);
303
- SCOPED_TIME_ZONES.set(identity.scope, pending);
304
- evictOldest(SCOPED_TIME_ZONES, exports.MAX_METADATA_CACHE_SCOPES);
305
- return pending;
306
- }
307
- async function resolveSessionTimeZone(operations, identity) {
308
- const resolved = (await userTimeZone(operations, identity.sessionUserName)) ??
309
- (await instanceDefaultTimeZone(operations));
310
- if (resolved === undefined)
311
- warnTimeZoneUnresolved(identity);
312
- return resolved;
313
- }
314
- async function userTimeZone(operations, sessionUserName) {
315
- if (typeof sessionUserName !== "string" || sessionUserName.trim() === "") {
316
- return undefined;
317
- }
318
- return firstUsableValue(operations, "/api/now/table/sys_user", {
319
- sysparm_query: `user_name=${(0, utils_js_1.escapeQueryValue)(sessionUserName.trim())}`,
320
- sysparm_fields: "time_zone",
321
- sysparm_limit: "1",
322
- }, "time_zone");
323
- }
324
- async function instanceDefaultTimeZone(operations) {
325
- return firstUsableValue(operations, "/api/now/table/sys_properties", {
326
- sysparm_query: `name=${DEFAULT_TIME_ZONE_PROPERTY}`,
327
- sysparm_fields: "value",
328
- sysparm_limit: "1",
329
- }, "value");
330
- }
331
- async function firstUsableValue(operations, path, params, field) {
332
- try {
333
- const response = await operations.get(path, {
334
- ...params,
335
- sysparm_display_value: "false",
336
- sysparm_exclude_reference_link: "true",
337
- });
338
- const row = Array.isArray(response?.result) ? response.result[0] : undefined;
339
- if (typeof row !== "object" || row === null)
340
- return undefined;
341
- const value = row[field];
342
- return isUsableTimeZone(value) ? value.trim() : undefined;
343
- }
344
- catch {
345
- // An unreadable lookup is indistinguishable from an empty one here, and
346
- // both mean the same thing: the probe cannot be made correct.
347
- return undefined;
348
- }
349
- }
350
- /**
351
- * Report the degradation once per scope. Names the account, never the scope
352
- * key -- that carries the credential fingerprint.
353
- */
354
- function warnTimeZoneUnresolved(identity) {
355
- if (TIME_ZONE_WARNED_SCOPES.has(identity.scope))
356
- return;
357
- TIME_ZONE_WARNED_SCOPES.add(identity.scope);
358
- const account = typeof identity.sessionUserName === "string" && identity.sessionUserName.trim() !== ""
359
- ? `account "${identity.sessionUserName.trim()}"`
360
- : "an account with no configured user name";
361
- process.stderr.write(`[servicenow-mcp] WARNING: metadata caching is disabled for ${account}: the ` +
362
- `ServiceNow session timezone could not be resolved. Grant read access to ` +
363
- `sys_user (time_zone) and sys_properties (${DEFAULT_TIME_ZONE_PROPERTY}), or ` +
364
- `set the account's timezone, to re-enable it.\n`);
365
- }
366
486
  function validateTtlMs(value) {
367
487
  if (typeof value !== "number" ||
368
488
  !Number.isSafeInteger(value) ||