| 239 | * Creates a mock batch-add-edges operation entry for a single edge. |
| 240 | */ |
| 241 | export 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. |