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

Function transformSpan

apps/sim/lib/logs/execution/pii-redaction.ts:112–125  ·  view source on GitHub ↗

* Redact a trace span: only its content fields (SPAN_CONTENT_FIELDS) and * nested `children` are walked, leaving structural metadata (blockId, name, * status, timing) untouched so log correlation/display is preserved.

(span: unknown, handle: (s: string) => string)

Source from the content-addressed store, hash-verified

110 * status, timing) untouched so log correlation/display is preserved.
111 */
112function transformSpan(span: unknown, handle: (s: string) => string): unknown {
113 if (span === null || typeof span !== 'object' || Array.isArray(span)) {
114 return transformStrings(span, handle)
115 }
116 const source = span as Record<string, unknown>
117 const out: Record<string, unknown> = { ...source }
118 for (const field of SPAN_CONTENT_FIELDS) {
119 if (field in out) out[field] = transformStrings(out[field], handle)
120 }
121 if (Array.isArray(source.children)) {
122 out.children = source.children.map((child) => transformSpan(child, handle))
123 }
124 return out
125}
126
127function transformUnit(
128 key: keyof RedactablePayload,

Callers 1

transformUnitFunction · 0.85

Calls 1

transformStringsFunction · 0.85

Tested by

no test coverage detected