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

Function replaceWorkflowEntries

apps/sim/stores/terminal/console/store.ts:183–203  ·  view source on GitHub ↗
(
  state: ConsoleStore,
  workflowId: string,
  nextEntries: ConsoleEntry[]
)

Source from the content-addressed store, hash-verified

181}
182
183function replaceWorkflowEntries(
184 state: ConsoleStore,
185 workflowId: string,
186 nextEntries: ConsoleEntry[]
187): Pick<ConsoleStore, 'workflowEntries' | 'entryIdsByBlockExecution' | 'entryLocationById'> {
188 const workflowEntries = cloneWorkflowEntries(state.workflowEntries)
189 const entryIdsByBlockExecution = { ...state.entryIdsByBlockExecution }
190 const entryLocationById = { ...state.entryLocationById }
191 const previousEntries = workflowEntries[workflowId] ?? EMPTY_CONSOLE_ENTRIES
192
193 removeWorkflowIndexes(workflowId, previousEntries, entryIdsByBlockExecution, entryLocationById)
194
195 if (nextEntries.length === 0) {
196 delete workflowEntries[workflowId]
197 } else {
198 workflowEntries[workflowId] = nextEntries
199 indexWorkflowEntries(workflowId, nextEntries, entryIdsByBlockExecution, entryLocationById)
200 }
201
202 return { workflowEntries, entryIdsByBlockExecution, entryLocationById }
203}
204
205function appendWorkflowEntry(
206 state: ConsoleStore,

Callers 1

store.tsFile · 0.85

Calls 3

cloneWorkflowEntriesFunction · 0.85
removeWorkflowIndexesFunction · 0.85
indexWorkflowEntriesFunction · 0.85

Tested by

no test coverage detected