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

Function enqueueOutboxEvent

apps/sim/lib/core/outbox/service.ts:98–114  ·  view source on GitHub ↗
(
  executor: Pick<typeof db, 'insert'>,
  eventType: string,
  payload: T,
  options: EnqueueOptions = {}
)

Source from the content-addressed store, hash-verified

96 * a transaction some other way (or none at all).
97 */
98export async function enqueueOutboxEvent<T>(
99 executor: Pick<typeof db, 'insert'>,
100 eventType: string,
101 payload: T,
102 options: EnqueueOptions = {}
103): Promise<string> {
104 const id = generateId()
105 await executor.insert(outboxEvent).values({
106 id,
107 eventType,
108 payload: payload as never,
109 maxAttempts: options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
110 availableAt: options.availableAt ?? new Date(),
111 })
112 logger.info('Enqueued outbox event', { id, eventType })
113 return id
114}
115
116/** Cap on how many dead-lettered rows a single reconciler scan materializes. */
117const DEAD_LETTER_SCAN_LIMIT = 100

Calls 2

generateIdFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected