MCPcopy
hub / github.com/simstudioai/sim / maskAndReStore

Function maskAndReStore

apps/sim/lib/logs/execution/pii-large-values.ts:136–147  ·  view source on GitHub ↗

* Mask a materialized large value and re-offload it: handle any nested refs * first, then mask inline strings, then re-store. `redactObjectStrings` skips * refs, so the nested re-stored refs are left intact while their siblings mask.

(
  value: unknown,
  options: RedactLargeValueRefsOptions
)

Source from the content-addressed store, hash-verified

134 * refs, so the nested re-stored refs are left intact while their siblings mask.
135 */
136async function maskAndReStore(
137 value: unknown,
138 options: RedactLargeValueRefsOptions
139): Promise<unknown> {
140 const nested = await redactValueRefs(value, options)
141 const masked = await redactObjectStrings(nested, {
142 entityTypes: options.entityTypes,
143 language: options.language,
144 onFailure: options.onFailure ?? 'scrub',
145 })
146 return compactExecutionPayload(masked, { ...options.store, requireDurable: true })
147}
148
149/** Rethrow (as {@link PiiRedactionError}) or scrub-to-marker, per `onFailure`. */
150function onRefFailure(

Callers 2

redactRefFunction · 0.85
redactManifestFunction · 0.85

Calls 3

redactObjectStringsFunction · 0.90
compactExecutionPayloadFunction · 0.90
redactValueRefsFunction · 0.85

Tested by

no test coverage detected