@onlyflows/servicenow-mcp 2.3.0-rc.1 → 2.3.0-rc.3
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/CHANGELOG.md +788 -3
- package/README.md +446 -41
- package/dist/atf-policy.d.ts +1 -1
- package/dist/atf-policy.d.ts.map +1 -1
- package/dist/atf-policy.js +2 -0
- package/dist/atf-policy.js.map +1 -1
- package/dist/call-metrics.d.ts +42 -0
- package/dist/call-metrics.d.ts.map +1 -0
- package/dist/call-metrics.js +89 -0
- package/dist/call-metrics.js.map +1 -0
- package/dist/client.d.ts +18 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -36
- package/dist/client.js.map +1 -1
- package/dist/code-search-snippet.d.ts +25 -0
- package/dist/code-search-snippet.d.ts.map +1 -0
- package/dist/code-search-snippet.js +67 -0
- package/dist/code-search-snippet.js.map +1 -0
- package/dist/code-search-targets.d.ts +66 -0
- package/dist/code-search-targets.d.ts.map +1 -0
- package/dist/code-search-targets.js +82 -0
- package/dist/code-search-targets.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/credential-tables.d.ts +32 -0
- package/dist/credential-tables.d.ts.map +1 -0
- package/dist/credential-tables.js +58 -0
- package/dist/credential-tables.js.map +1 -0
- package/dist/encoded-query-policy.d.ts +9 -0
- package/dist/encoded-query-policy.d.ts.map +1 -1
- package/dist/encoded-query-policy.js +27 -2
- package/dist/encoded-query-policy.js.map +1 -1
- package/dist/execution-context.d.ts +14 -0
- package/dist/execution-context.d.ts.map +1 -1
- package/dist/execution-context.js +8 -0
- package/dist/execution-context.js.map +1 -1
- package/dist/field-policy.d.ts +44 -1
- package/dist/field-policy.d.ts.map +1 -1
- package/dist/field-policy.js +623 -35
- package/dist/field-policy.js.map +1 -1
- package/dist/hidden-values.d.ts +225 -0
- package/dist/hidden-values.d.ts.map +1 -0
- package/dist/hidden-values.js +748 -0
- package/dist/hidden-values.js.map +1 -0
- package/dist/http-entrypoint.d.ts.map +1 -1
- package/dist/http-entrypoint.js +7 -0
- package/dist/http-entrypoint.js.map +1 -1
- package/dist/http-observability.js +1 -0
- package/dist/http-observability.js.map +1 -1
- package/dist/http-runtime.js +16 -0
- package/dist/http-runtime.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata-cache.d.ts +135 -7
- package/dist/metadata-cache.d.ts.map +1 -1
- package/dist/metadata-cache.js +357 -21
- package/dist/metadata-cache.js.map +1 -1
- package/dist/policy-card.d.ts +16 -1
- package/dist/policy-card.d.ts.map +1 -1
- package/dist/policy-card.js +15 -2
- package/dist/policy-card.js.map +1 -1
- package/dist/profile-admin.d.ts +18 -0
- package/dist/profile-admin.d.ts.map +1 -1
- package/dist/profile-admin.js +26 -1
- package/dist/profile-admin.js.map +1 -1
- package/dist/profile-manager.d.ts +13 -1
- package/dist/profile-manager.d.ts.map +1 -1
- package/dist/profile-manager.js +23 -1
- package/dist/profile-manager.js.map +1 -1
- package/dist/response-too-large.d.ts +23 -0
- package/dist/response-too-large.d.ts.map +1 -0
- package/dist/response-too-large.js +42 -0
- package/dist/response-too-large.js.map +1 -0
- package/dist/risky-grants.d.ts +6 -2
- package/dist/risky-grants.d.ts.map +1 -1
- package/dist/risky-grants.js +58 -5
- package/dist/risky-grants.js.map +1 -1
- package/dist/setup-prompts.js +1 -1
- package/dist/setup-prompts.js.map +1 -1
- package/dist/setup.d.ts +4 -0
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +176 -68
- package/dist/setup.js.map +1 -1
- package/dist/structured-query.d.ts +61 -2
- package/dist/structured-query.d.ts.map +1 -1
- package/dist/structured-query.js +382 -36
- package/dist/structured-query.js.map +1 -1
- package/dist/table-policy.d.ts +75 -2
- package/dist/table-policy.d.ts.map +1 -1
- package/dist/table-policy.js +184 -15
- package/dist/table-policy.js.map +1 -1
- package/dist/tool-error.d.ts +47 -4
- package/dist/tool-error.d.ts.map +1 -1
- package/dist/tool-error.js +104 -4
- package/dist/tool-error.js.map +1 -1
- package/dist/tool-table-access.d.ts +9 -2
- package/dist/tool-table-access.d.ts.map +1 -1
- package/dist/tool-table-access.js +118 -36
- package/dist/tool-table-access.js.map +1 -1
- package/dist/tools/aggregate.js +2 -2
- package/dist/tools/aggregate.js.map +1 -1
- package/dist/tools/all-fields-cap.d.ts.map +1 -1
- package/dist/tools/all-fields-cap.js +29 -7
- package/dist/tools/all-fields-cap.js.map +1 -1
- package/dist/tools/atf-author-module.d.ts +1 -7
- package/dist/tools/atf-author-module.d.ts.map +1 -1
- package/dist/tools/atf-author-module.js +16 -7
- package/dist/tools/atf-author-module.js.map +1 -1
- package/dist/tools/atf-contracts.d.ts +69 -4
- package/dist/tools/atf-contracts.d.ts.map +1 -1
- package/dist/tools/atf-contracts.js +32 -2
- package/dist/tools/atf-contracts.js.map +1 -1
- package/dist/tools/atf-renderers.js +2 -1
- package/dist/tools/atf-renderers.js.map +1 -1
- package/dist/tools/atf-results-module.d.ts.map +1 -1
- package/dist/tools/atf-results-module.js +5 -3
- package/dist/tools/atf-results-module.js.map +1 -1
- package/dist/tools/atf-run-module.js +3 -2
- package/dist/tools/atf-run-module.js.map +1 -1
- package/dist/tools/atf-shared.d.ts +6 -0
- package/dist/tools/atf-shared.d.ts.map +1 -1
- package/dist/tools/atf-shared.js +49 -10
- package/dist/tools/atf-shared.js.map +1 -1
- package/dist/tools/atf-step-catalog.d.ts +13 -8
- package/dist/tools/atf-step-catalog.d.ts.map +1 -1
- package/dist/tools/atf-step-catalog.js +169 -5
- package/dist/tools/atf-step-catalog.js.map +1 -1
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +25 -7
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +2 -1
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/codesearch.d.ts +2 -2
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +536 -67
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/flow-view-contracts.d.ts +59 -3
- package/dist/tools/flow-view-contracts.d.ts.map +1 -1
- package/dist/tools/flow-view-contracts.js +34 -2
- package/dist/tools/flow-view-contracts.js.map +1 -1
- package/dist/tools/flow-view-graph.d.ts +14 -0
- package/dist/tools/flow-view-graph.d.ts.map +1 -1
- package/dist/tools/flow-view-graph.js +43 -1
- package/dist/tools/flow-view-graph.js.map +1 -1
- package/dist/tools/flow-view-module.js +2 -2
- package/dist/tools/flow-view-module.js.map +1 -1
- package/dist/tools/flow-view-policy.d.ts +3 -3
- package/dist/tools/flow-view-policy.d.ts.map +1 -1
- package/dist/tools/flow-view-policy.js +5 -4
- package/dist/tools/flow-view-policy.js.map +1 -1
- package/dist/tools/flow-view-renderers.d.ts.map +1 -1
- package/dist/tools/flow-view-renderers.js +9 -21
- package/dist/tools/flow-view-renderers.js.map +1 -1
- package/dist/tools/get-module.js +1 -1
- package/dist/tools/get-module.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +116 -25
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/platform-view-contracts.d.ts +189 -0
- package/dist/tools/platform-view-contracts.d.ts.map +1 -0
- package/dist/tools/platform-view-contracts.js +353 -0
- package/dist/tools/platform-view-contracts.js.map +1 -0
- package/dist/tools/platform-view-evaluate.d.ts +219 -0
- package/dist/tools/platform-view-evaluate.d.ts.map +1 -0
- package/dist/tools/platform-view-evaluate.js +1346 -0
- package/dist/tools/platform-view-evaluate.js.map +1 -0
- package/dist/tools/platform-view-module.d.ts +28 -0
- package/dist/tools/platform-view-module.d.ts.map +1 -0
- package/dist/tools/platform-view-module.js +111 -0
- package/dist/tools/platform-view-module.js.map +1 -0
- package/dist/tools/platform-view-scan.d.ts +57 -0
- package/dist/tools/platform-view-scan.d.ts.map +1 -0
- package/dist/tools/platform-view-scan.js +375 -0
- package/dist/tools/platform-view-scan.js.map +1 -0
- package/dist/tools/platform-view-upgrades.d.ts +152 -0
- package/dist/tools/platform-view-upgrades.d.ts.map +1 -0
- package/dist/tools/platform-view-upgrades.js +545 -0
- package/dist/tools/platform-view-upgrades.js.map +1 -0
- package/dist/tools/profile.d.ts.map +1 -1
- package/dist/tools/profile.js +1 -0
- package/dist/tools/profile.js.map +1 -1
- package/dist/tools/query-module.d.ts.map +1 -1
- package/dist/tools/query-module.js +231 -64
- package/dist/tools/query-module.js.map +1 -1
- package/dist/tools/record-write-shared.d.ts.map +1 -1
- package/dist/tools/record-write-shared.js +4 -3
- package/dist/tools/record-write-shared.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +429 -38
- package/dist/tools/result-envelope.d.ts.map +1 -1
- package/dist/tools/result-envelope.js +372 -36
- package/dist/tools/result-envelope.js.map +1 -1
- package/dist/tools/schema-module.d.ts.map +1 -1
- package/dist/tools/schema-module.js +1 -1
- package/dist/tools/schema-module.js.map +1 -1
- package/dist/tools/syslog-cursor.d.ts +61 -0
- package/dist/tools/syslog-cursor.d.ts.map +1 -0
- package/dist/tools/syslog-cursor.js +146 -0
- package/dist/tools/syslog-cursor.js.map +1 -0
- package/dist/tools/syslog.d.ts +2 -0
- package/dist/tools/syslog.d.ts.map +1 -1
- package/dist/tools/syslog.js +126 -2
- package/dist/tools/syslog.js.map +1 -1
- package/dist/tools/truncation-hint.d.ts +125 -0
- package/dist/tools/truncation-hint.d.ts.map +1 -0
- package/dist/tools/truncation-hint.js +298 -0
- package/dist/tools/truncation-hint.js.map +1 -0
- package/dist/unknown-filter-fields.d.ts +52 -0
- package/dist/unknown-filter-fields.d.ts.map +1 -0
- package/dist/unknown-filter-fields.js +87 -0
- package/dist/unknown-filter-fields.js.map +1 -0
- package/dist/update-set-eval/engine.d.ts +29 -0
- package/dist/update-set-eval/engine.d.ts.map +1 -0
- package/dist/update-set-eval/engine.js +405 -0
- package/dist/update-set-eval/engine.js.map +1 -0
- package/dist/update-set-eval/prepare.d.ts +72 -0
- package/dist/update-set-eval/prepare.d.ts.map +1 -0
- package/dist/update-set-eval/prepare.js +216 -0
- package/dist/update-set-eval/prepare.js.map +1 -0
- package/dist/update-set-eval/rules.d.ts +126 -0
- package/dist/update-set-eval/rules.d.ts.map +1 -0
- package/dist/update-set-eval/rules.js +927 -0
- package/dist/update-set-eval/rules.js.map +1 -0
- package/dist/update-set-eval/script-scan.d.ts +65 -0
- package/dist/update-set-eval/script-scan.d.ts.map +1 -0
- package/dist/update-set-eval/script-scan.js +378 -0
- package/dist/update-set-eval/script-scan.js.map +1 -0
- package/dist/update-set-eval/secret-patterns.d.ts +75 -0
- package/dist/update-set-eval/secret-patterns.d.ts.map +1 -0
- package/dist/update-set-eval/secret-patterns.js +570 -0
- package/dist/update-set-eval/secret-patterns.js.map +1 -0
- package/dist/update-set-eval/types.d.ts +181 -0
- package/dist/update-set-eval/types.d.ts.map +1 -0
- package/dist/update-set-eval/types.js +20 -0
- package/dist/update-set-eval/types.js.map +1 -0
- package/dist/update-set-eval/xml-reader.d.ts +117 -0
- package/dist/update-set-eval/xml-reader.d.ts.map +1 -0
- package/dist/update-set-eval/xml-reader.js +561 -0
- package/dist/update-set-eval/xml-reader.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/CLIENT-SETUP.md +30 -7
- package/docs/FLOW-VIEW.md +14 -5
- package/docs/PRODUCTION-SECURITY.md +84 -1
- package/docs/PROFILE-CREDENTIALS.md +10 -4
- package/docs/V2-MIGRATION.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/metadata-cache.d.ts
CHANGED
|
@@ -26,12 +26,16 @@
|
|
|
26
26
|
* watermark refreshes recency for eviction but never extends expiresAt, so the
|
|
27
27
|
* entry still expires on schedule and forces a genuine refetch.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* Three memos keep the watermark from costing more than it saves. Within one
|
|
30
30
|
* tool call each table's watermark is read once, however many reads of the
|
|
31
31
|
* table the call makes. Across calls, a table whose watermark proved unusable
|
|
32
32
|
* is read straight through, without a watermark, for a while: long for causes
|
|
33
33
|
* that persist (an incomplete or future-dated watermark, a 4xx), short for
|
|
34
|
-
* transient ones (429, 5xx, timeouts, network).
|
|
34
|
+
* transient ones (429, 5xx, timeouts, network). And a read whose response is
|
|
35
|
+
* small (see SMALL_READ_BYTES) is not kept at all: a hit costs a watermark
|
|
36
|
+
* round trip, about what the plain read costs, so keeping it saves nothing.
|
|
37
|
+
* The key is remembered as small for one TTL, and its later reads go straight
|
|
38
|
+
* upstream in a single request.
|
|
35
39
|
*
|
|
36
40
|
* @module metadata-cache
|
|
37
41
|
*/
|
|
@@ -43,20 +47,54 @@ export declare const DEFAULT_METADATA_CACHE_TTL_MS: number;
|
|
|
43
47
|
* The bar for inclusion is a large payload relative to the watermark read,
|
|
44
48
|
* not merely "this table changes rarely" -- a cache hit still costs one
|
|
45
49
|
* upstream round trip (see tableWatermark), so the saving is payload bytes,
|
|
46
|
-
* never request count.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
50
|
+
* never request count. Why each pattern is here:
|
|
51
|
+
*
|
|
52
|
+
* - sys_dictionary, sys_db_object: the field and table definitions behind
|
|
53
|
+
* sn_schema, the all-fields cap and sn_discover. A table's dictionary alone
|
|
54
|
+
* is hundreds of rows, and a hierarchy walk reads them repeatedly.
|
|
55
|
+
* - sys_app, sys_plugins, sys_glide_object, sys_metadata*, sys_flow*:
|
|
56
|
+
* application, plugin, field-type and application-file listings, and the
|
|
57
|
+
* Flow Designer tables. They are large and change rarely. The list is the
|
|
58
|
+
* original metadata set; not every table in it has a reader in this
|
|
59
|
+
* server today.
|
|
60
|
+
* - sys_script, sys_script_include, sys_ui_script, sys_script_client,
|
|
61
|
+
* sys_ws_operation, sys_module: the code tables sn_codesearch searches (the
|
|
62
|
+
* last holds ES modules), which sn_query also reads. Each row carries a full script body, so a repeated
|
|
63
|
+
* search or page is among the heaviest reads this server makes. Editing a
|
|
64
|
+
* script moves sys_updated_on, which the watermark sees, so a cached search
|
|
65
|
+
* never outlives a save. They are not covered by sys_metadata*: patterns
|
|
66
|
+
* match a table's name, not its place in the table hierarchy. Unlike
|
|
67
|
+
* sys_properties, these can be cached: the scope is the credential, so no
|
|
68
|
+
* cross-identity hit is possible, and the payloads are large enough to be
|
|
69
|
+
* worth keeping. The bodies may hold hard-coded secrets, though, and an
|
|
70
|
+
* entry keeps the whole response in memory; an operator who does not want
|
|
71
|
+
* that sets SN_METADATA_CACHE_TABLES (or `metadataCache.tables`) without
|
|
72
|
+
* them.
|
|
73
|
+
*
|
|
74
|
+
* sys_properties is deliberately absent: its rows are ACL-restricted per user
|
|
75
|
+
* and routinely hold integration secrets in `value`, and the only reads of it
|
|
76
|
+
* here are three single-value build-info lookups whose payloads are far too
|
|
77
|
+
* small to be worth retaining for a day. Operators who want it can add it
|
|
78
|
+
* through SN_METADATA_CACHE_TABLES.
|
|
79
|
+
*
|
|
80
|
+
* An explicit SN_METADATA_CACHE_TABLES or `metadataCache.tables` replaces this
|
|
81
|
+
* list; it does not extend it, so a profile that sets its own list must name
|
|
82
|
+
* the code tables itself to cache them.
|
|
51
83
|
*/
|
|
52
84
|
export declare const DEFAULT_METADATA_CACHE_TABLES: readonly string[];
|
|
53
85
|
export interface MetadataCacheConfigInput {
|
|
54
86
|
readonly ttlMs?: number;
|
|
55
87
|
readonly tables?: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* A response smaller than this many bytes is not cached; its key reads
|
|
90
|
+
* straight through. Defaults to SMALL_READ_BYTES; 0 caches every response.
|
|
91
|
+
*/
|
|
92
|
+
readonly smallReadBytes?: number;
|
|
56
93
|
}
|
|
57
94
|
export interface MetadataCacheConfig {
|
|
58
95
|
readonly ttlMs: number;
|
|
59
96
|
readonly tables: readonly string[];
|
|
97
|
+
readonly smallReadBytes: number;
|
|
60
98
|
}
|
|
61
99
|
export declare const FORCE_RECACHE_PARAM = "sysparm_force_recache";
|
|
62
100
|
/** Bounds on process-global cache state. Scopes multiply with credential
|
|
@@ -64,16 +102,101 @@ export declare const FORCE_RECACHE_PARAM = "sysparm_force_recache";
|
|
|
64
102
|
* so both are capped and evicted in least-recently-used order. */
|
|
65
103
|
export declare const MAX_METADATA_CACHE_SCOPES = 64;
|
|
66
104
|
export declare const MAX_METADATA_CACHE_ENTRIES_PER_SCOPE = 512;
|
|
105
|
+
/**
|
|
106
|
+
* Byte bounds. The entry count is not a memory bound: a code-table entry holds
|
|
107
|
+
* a whole response of script bodies, up to the client's 1 MiB ceiling, so 512
|
|
108
|
+
* of them would retain about half a GiB in one scope. A response larger than
|
|
109
|
+
* the entry cap is returned but never kept (and any older entry under its key
|
|
110
|
+
* is dropped); a scope over its budget evicts its least recently used entries;
|
|
111
|
+
* the whole cache over its budget evicts from the least recently used scope
|
|
112
|
+
* first. Sizes are estimates (serialized body plus key and header overhead),
|
|
113
|
+
* not heap measurements.
|
|
114
|
+
*/
|
|
115
|
+
export declare const MAX_METADATA_CACHE_ENTRY_BYTES: number;
|
|
116
|
+
export declare const MAX_METADATA_CACHE_SCOPE_BYTES: number;
|
|
117
|
+
export declare const MAX_METADATA_CACHE_TOTAL_BYTES: number;
|
|
67
118
|
/** How long a table goes uncached after its watermark proved unusable; never
|
|
68
119
|
* longer than the cache TTL. */
|
|
69
120
|
export declare const STRUCTURAL_UNCACHEABLE_MS: number;
|
|
70
121
|
export declare const TRANSIENT_UNCACHEABLE_MS: number;
|
|
122
|
+
/**
|
|
123
|
+
* A response smaller than this (serialized body bytes) is not worth caching.
|
|
124
|
+
*
|
|
125
|
+
* A hit still costs one watermark round trip, so the cache saves time only
|
|
126
|
+
* when the plain read of the rows costs more than that round trip, and the
|
|
127
|
+
* plain read grows with the payload while the watermark does not. Live
|
|
128
|
+
* measurement (a 2026-11 sweep on a dev instance, read-only, n = 1 per point,
|
|
129
|
+
* so indicative): the watermark of sys_script_include cost about 90 ms; its
|
|
130
|
+
* plain reads cost about 75 ms at 2 KB and 110 ms at 96 KB (hit: 96 ms). On
|
|
131
|
+
* sys_dictionary, whose watermark costs about 490 ms because the table is
|
|
132
|
+
* huge, plain reads cost 75, 86, 180 and 218 ms at 6, 17, 33 and 66 KB, so a
|
|
133
|
+
* hit lost at every size tried. The crossover is therefore somewhere between
|
|
134
|
+
* about 20 KB and 50 KB, depending on the table, and below it the cache only
|
|
135
|
+
* adds a request on a miss and holds memory for nothing.
|
|
136
|
+
*
|
|
137
|
+
* 32 KiB sits in that band. Putting it a little high or low costs a few
|
|
138
|
+
* milliseconds per read either way, because near the crossover a hit and a
|
|
139
|
+
* plain read cost about the same; what matters is that the many small reads
|
|
140
|
+
* (a few KB) go back to one request. The threshold is a size, not a time, so
|
|
141
|
+
* it cannot follow a table whose watermark is unusually expensive; a
|
|
142
|
+
* per-table rule would need the measured watermark and upstream times.
|
|
143
|
+
*/
|
|
144
|
+
export declare const SMALL_READ_BYTES: number;
|
|
145
|
+
/** Most keys one scope remembers as small; the least recently used go first. */
|
|
146
|
+
export declare const MAX_SMALL_READ_KEYS_PER_SCOPE = 512;
|
|
147
|
+
/**
|
|
148
|
+
* Longest cache key the small-read memo holds as it is; a longer one is held
|
|
149
|
+
* by its sha256 hex digest, so the memo stays at 512 short strings per scope
|
|
150
|
+
* however long a caller's query is, and a long selector is remembered like any
|
|
151
|
+
* other. Two keys that collide would only make one of them read through once
|
|
152
|
+
* more than needed (or, for a small mark on a large key, be re-measured), so a
|
|
153
|
+
* collision costs a request, never a wrong answer.
|
|
154
|
+
*/
|
|
155
|
+
export declare const SMALL_READ_KEY_RAW_LENGTH = 128;
|
|
156
|
+
/** Bounds on derived values per scope (see derivedMetadataMemo). */
|
|
157
|
+
export declare const MAX_DERIVED_ENTRIES_PER_SCOPE = 512;
|
|
158
|
+
export declare const MAX_DERIVED_BYTES_PER_SCOPE: number;
|
|
71
159
|
interface MetadataCacheEnvironment {
|
|
72
160
|
readonly SN_METADATA_CACHE_TTL_MS?: string;
|
|
73
161
|
readonly SN_METADATA_CACHE_TABLES?: string;
|
|
74
162
|
}
|
|
75
163
|
export declare function metadataCacheConfigFromEnvironment(environment?: MetadataCacheEnvironment): MetadataCacheConfigInput;
|
|
76
164
|
export declare function createMetadataCacheConfig(input: MetadataCacheConfigInput | undefined): MetadataCacheConfig;
|
|
165
|
+
/**
|
|
166
|
+
* A per-credential memo of values derived from metadata reads, kept with the
|
|
167
|
+
* cache scope of a cached wrapper.
|
|
168
|
+
*
|
|
169
|
+
* A metadata-cache hit still costs a watermark round trip. A value a call
|
|
170
|
+
* needs before every read (the hidden-field type map) would then add one
|
|
171
|
+
* request to every call, so the value derived from the rows is memoized here
|
|
172
|
+
* instead: a hit costs no request at all. Each value lives at most `ttlMs`
|
|
173
|
+
* and never longer than the profile's cache TTL; when it expires the deriving
|
|
174
|
+
* read goes back through the cache, whose watermark decides whether the rows
|
|
175
|
+
* changed. The memo sits in the same scope as the rows (instance and
|
|
176
|
+
* credential identity), is bounded in entries and bytes, and is evicted with
|
|
177
|
+
* the scope.
|
|
178
|
+
*
|
|
179
|
+
* It does not follow the profile's cache table list: what it holds is derived
|
|
180
|
+
* metadata (field names and types, table chains), never row values, and
|
|
181
|
+
* without it every call would repeat the deriving reads. An empty table list
|
|
182
|
+
* (rows cached for no table) leaves it on for the same reason; the profile's
|
|
183
|
+
* TTL still caps how long a value lives.
|
|
184
|
+
*
|
|
185
|
+
* Undefined when `operations` is not a cached wrapper.
|
|
186
|
+
*/
|
|
187
|
+
export interface DerivedMetadataMemo {
|
|
188
|
+
get(key: string): unknown;
|
|
189
|
+
/** `value` must be immutable; `bytes` is its estimated size. */
|
|
190
|
+
set(key: string, value: unknown, bytes: number, ttlMs: number): void;
|
|
191
|
+
/** The derivation of `key` another call has in flight, if any. */
|
|
192
|
+
pending(key: string): Promise<unknown> | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Record `promise` as the derivation of `key` in flight until it settles. A
|
|
195
|
+
* rejection is never kept: the entry is cleared, and the next call retries.
|
|
196
|
+
*/
|
|
197
|
+
track<T>(key: string, promise: Promise<T>): Promise<T>;
|
|
198
|
+
}
|
|
199
|
+
export declare function derivedMetadataMemo(operations: ServiceNowOperations): DerivedMetadataMemo | undefined;
|
|
77
200
|
/**
|
|
78
201
|
* The operations underneath a cached wrapper, or `operations` itself when it
|
|
79
202
|
* is not one.
|
|
@@ -92,5 +215,10 @@ export declare function uncachedOperations(operations: ServiceNowOperations): Se
|
|
|
92
215
|
* *and* the credential identity reading from it -- see the module docstring.
|
|
93
216
|
*/
|
|
94
217
|
export declare function createCachedServiceNowOperations(operations: ServiceNowOperations, scope: string, config: MetadataCacheConfigInput | undefined): ServiceNowOperations;
|
|
218
|
+
/**
|
|
219
|
+
* Estimated bytes retained for one scope, or for the whole cache when no scope
|
|
220
|
+
* is given. For tests and diagnostics; the cache never reads it.
|
|
221
|
+
*/
|
|
222
|
+
export declare function metadataCacheBytes(scope?: string): number;
|
|
95
223
|
export {};
|
|
96
224
|
//# sourceMappingURL=metadata-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-cache.d.ts","sourceRoot":"","sources":["../src/metadata-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"metadata-cache.d.ts","sourceRoot":"","sources":["../src/metadata-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAKL,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AAMrB,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AACjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,6BAA6B,mBAcxC,CAAC;AAEH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;OAG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