MCPcopy Create free account
hub / github.com/EvoMap/evolver / writeInbound

Method writeInbound

src/proxy/mailbox/store.js:355–381  ·  view source on GitHub ↗
({ id, type, payload, channel, priority, refId, expiresAt })

Source from the content-addressed store, hash-verified

353 }
354
355 writeInbound({ id, type, payload, channel, priority, refId, expiresAt }) {
356 const msgId = id || generateUUIDv7();
357 // At-least-once delivery from the Hub / retry loops can send the same
358 // message id twice. Without idempotency, poll() and countPending() would
359 // double-count the retry. See community PR #515.
360 if (this._messages.has(msgId)) return msgId;
361
362 const now = Date.now();
363 const msg = {
364 id: msgId,
365 channel: channel || DEFAULT_CHANNEL,
366 direction: 'inbound',
367 type,
368 status: 'pending',
369 payload: safeParse(payload),
370 priority: priority || 'normal',
371 ref_id: refId || null,
372 created_at: now,
373 synced_at: null,
374 expires_at: expiresAt || null,
375 retry_count: 0,
376 next_retry_at: null,
377 error: null,
378 };
379 this._appendMessage(msg);
380 return msgId;
381 }
382
383 writeInboundBatch(messages) {
384 const ids = [];

Callers 8

writeInboundBatchMethod · 0.95
extensions.test.jsFile · 0.80
heartbeatMethod · 0.80
pullMethod · 0.80

Calls 3

_appendMessageMethod · 0.95
generateUUIDv7Function · 0.85
safeParseFunction · 0.85

Tested by

no test coverage detected