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

Function filterOutputForLog

apps/sim/executor/utils/output-filter.ts:33–74  ·  view source on GitHub ↗
(
  blockType: string,
  output: NormalizedBlockOutput,
  options?: {
    block?: SerializedBlock
    additionalHiddenKeys?: string[]
  }
)

Source from the content-addressed store, hash-verified

31 * @param options.additionalHiddenKeys - Extra keys to filter out (e.g., 'resume')
32 */
33export function filterOutputForLog(
34 blockType: string,
35 output: NormalizedBlockOutput,
36 options?: {
37 block?: SerializedBlock
38 additionalHiddenKeys?: string[]
39 }
40): NormalizedBlockOutput {
41 if (typeof output !== 'object' || output === null || Array.isArray(output)) {
42 return output as NormalizedBlockOutput
43 }
44 if (isLargeValueRef(output)) {
45 return output as NormalizedBlockOutput
46 }
47 const blockConfig = blockType ? getBlock(blockType) : undefined
48 const filtered: NormalizedBlockOutput = {}
49 const additionalHiddenKeys = options?.additionalHiddenKeys ?? []
50
51 for (const [key, value] of Object.entries(output)) {
52 // Skip internal keys (underscore prefix)
53 if (key.startsWith('_')) continue
54
55 if (blockConfig?.outputs && isHiddenFromDisplay(blockConfig.outputs[key])) {
56 continue
57 }
58
59 // Skip runtime-injected trigger keys not in block config
60 if (options?.block && isTriggerBehavior(options.block) && isTriggerInternalKey(key)) {
61 continue
62 }
63
64 // Skip additional hidden keys specified by caller
65 if (additionalHiddenKeys.includes(key)) {
66 continue
67 }
68
69 // Recursively filter globally hidden keys from nested objects
70 setFilteredOutputValue(filtered, key, filterHiddenOutputKeys(value))
71 }
72
73 return filtered
74}

Callers 4

runResumeExecutionMethod · 0.90
executeMethod · 0.90
handleBlockErrorMethod · 0.90

Calls 7

isLargeValueRefFunction · 0.90
getBlockFunction · 0.90
isHiddenFromDisplayFunction · 0.90
isTriggerBehaviorFunction · 0.90
isTriggerInternalKeyFunction · 0.90
filterHiddenOutputKeysFunction · 0.90
setFilteredOutputValueFunction · 0.85

Tested by

no test coverage detected