MCPcopy Create free account
hub / github.com/simstudioai/sim / extractEventMockPayload

Function extractEventMockPayload

apps/sim/lib/workflows/triggers/run-options.ts:178–195  ·  view source on GitHub ↗
(candidate: StartBlockCandidate<TriggerBlockLike>)

Source from the content-addressed store, hash-verified

176}
177
178function extractEventMockPayload(candidate: StartBlockCandidate<TriggerBlockLike>): unknown {
179 const triggerId = resolveEventTriggerId(candidate.block)
180 const sampleRaw =
181 readSubBlockValue(candidate.block, `samplePayload_${triggerId}`) ??
182 readSubBlockValue(candidate.block, 'samplePayload')
183
184 if (typeof sampleRaw === 'string' && sampleRaw.trim()) {
185 try {
186 return JSON.parse(sampleRaw)
187 } catch {
188 // fall through to generated mock
189 }
190 } else if (sampleRaw && typeof sampleRaw === 'object') {
191 return sampleRaw
192 }
193
194 return extractTriggerMockPayload(candidate)
195}
196
197function resolveInputKind(path: StartBlockPath, block: TriggerBlockLike): TriggerInputKind {
198 if (path === StartBlockPath.SPLIT_CHAT) return 'chat'

Callers 1

buildTriggerRunOptionFunction · 0.85

Calls 4

resolveEventTriggerIdFunction · 0.85
parseMethod · 0.80
readSubBlockValueFunction · 0.70

Tested by

no test coverage detected