MCPcopy Index your code
hub / github.com/simstudioai/sim / redactValueRefs

Function redactValueRefs

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

Sync-collect every ref/manifest in `value`, then async-replace each, then sync-substitute.

(
  value: unknown,
  options: RedactLargeValueRefsOptions
)

Source from the content-addressed store, hash-verified

75
76/** Sync-collect every ref/manifest in `value`, then async-replace each, then sync-substitute. */
77async function redactValueRefs(
78 value: unknown,
79 options: RedactLargeValueRefsOptions
80): Promise<unknown> {
81 const refs: object[] = []
82 collectRefs(value, refs, new WeakSet())
83 if (refs.length === 0) return value
84
85 const replacements = new Map<object, unknown>()
86 for (const ref of refs) {
87 if (replacements.has(ref)) continue
88 replacements.set(ref, await replaceRef(ref, options))
89 }
90 return substituteRefs(value, replacements)
91}
92
93/** Depth-first sync walk collecting ref/manifest nodes (not recursing into them). */
94function collectRefs(value: unknown, out: object[], seen: WeakSet<object>): void {

Callers 3

redactLargeValueRefsFunction · 0.85
maskAndReStoreFunction · 0.85

Calls 4

collectRefsFunction · 0.85
replaceRefFunction · 0.85
substituteRefsFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected