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

Function mergePersistedConsoleData

apps/sim/stores/terminal/console/storage.ts:142–165  ·  view source on GitHub ↗
(
  existing: PersistedConsoleData | null,
  incoming: PersistedConsoleData
)

Source from the content-addressed store, hash-verified

140}
141
142function mergePersistedConsoleData(
143 existing: PersistedConsoleData | null,
144 incoming: PersistedConsoleData
145): PersistedConsoleData {
146 if (!existing) return incoming
147 const workflowIds = new Set([
148 ...Object.keys(existing.workflowEntries),
149 ...Object.keys(incoming.workflowEntries),
150 ])
151 const workflowEntries: Record<string, ConsoleEntry[]> = {}
152
153 for (const workflowId of workflowIds) {
154 const entries = mergeEntries(
155 existing.workflowEntries[workflowId],
156 incoming.workflowEntries[workflowId]
157 )
158 if (entries.length > 0) workflowEntries[workflowId] = entries
159 }
160
161 return {
162 workflowEntries,
163 isOpen: incoming.isOpen,
164 }
165}
166
167function writeToIndexedDB(
168 data: PersistedConsoleData,

Callers 1

doWriteFunction · 0.85

Calls 1

mergeEntriesFunction · 0.85

Tested by

no test coverage detected