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

Function createAddEdgeEntry

packages/testing/src/factories/undo-redo.factory.ts:241–276  ·  view source on GitHub ↗
(
  edgeId: string,
  edgeSnapshot: any = null,
  options: OperationEntryOptions = {}
)

Source from the content-addressed store, hash-verified

239 * Creates a mock batch-add-edges operation entry for a single edge.
240 */
241export function createAddEdgeEntry(
242 edgeId: string,
243 edgeSnapshot: any = null,
244 options: OperationEntryOptions = {}
245): any {
246 const {
247 id = shortId(8),
248 workflowId = 'wf-1',
249 userId = 'user-1',
250 createdAt = Date.now(),
251 } = options
252 const timestamp = Date.now()
253
254 const snapshot = edgeSnapshot || { id: edgeId, source: 'block-1', target: 'block-2' }
255
256 return {
257 id,
258 createdAt,
259 operation: {
260 id: shortId(8),
261 type: 'batch-add-edges',
262 timestamp,
263 workflowId,
264 userId,
265 data: { edgeSnapshots: [snapshot] },
266 },
267 inverse: {
268 id: shortId(8),
269 type: 'batch-remove-edges',
270 timestamp,
271 workflowId,
272 userId,
273 data: { edgeSnapshots: [snapshot] },
274 },
275 }
276}
277
278/**
279 * Creates a mock batch-remove-edges operation entry.

Callers 1

store.test.tsFile · 0.90

Calls 1

shortIdFunction · 0.90

Tested by

no test coverage detected