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

Function compactEntries

apps/sim/lib/execution/payloads/serializer.ts:133–157  ·  view source on GitHub ↗
(
  value: object,
  options: CompactExecutionPayloadOptions,
  state: CompactState,
  depth: number
)

Source from the content-addressed store, hash-verified

131}
132
133async function compactEntries(
134 value: object,
135 options: CompactExecutionPayloadOptions,
136 state: CompactState,
137 depth: number
138): Promise<unknown> {
139 if (options.rejectLargeValues) {
140 return compactEntriesWithEarlyReject(value, options, state, depth)
141 }
142
143 if (Array.isArray(value)) {
144 return Promise.all(value.map((item) => compactValue(item, options, state, depth + 1)))
145 }
146
147 return Object.fromEntries(
148 await Promise.all(
149 Object.entries(value).map(async ([key, entryValue]) => [
150 key,
151 key === 'finalBlockLogs' && Array.isArray(entryValue)
152 ? await compactBlockLogs(entryValue as BlockLog[], options)
153 : await compactValue(entryValue, options, state, depth + 1),
154 ])
155 )
156 )
157}
158
159async function compactEntriesWithEarlyReject(
160 value: object,

Callers 1

compactValueFunction · 0.85

Calls 3

compactValueFunction · 0.85
compactBlockLogsFunction · 0.85

Tested by

no test coverage detected