MCPcopy Index your code
hub / github.com/Effect-TS/effect / write

Function write

packages/experimental/src/EventJournal.ts:248–270  ·  view source on GitHub ↗
({ effect, event, payload, primaryKey })

Source from the content-addressed store, hash-verified

246 return EventJournal.of({
247 entries: Effect.sync(() => journal.slice()),
248 write({ effect, event, payload, primaryKey }) {
249 return Effect.acquireUseRelease(
250 Effect.sync(() =>
251 new Entry({
252 id: makeEntryId(),
253 event,
254 primaryKey,
255 payload
256 }, { disableValidation: true })
257 ),
258 effect,
259 (entry, exit) =>
260 Effect.suspend(() => {
261 if (exit._tag === "Failure" || byId.has(entry.idString)) return Effect.void
262 journal.push(entry)
263 byId.set(entry.idString, entry)
264 remotes.forEach((remote) => {
265 remote.missing.push(entry)
266 })
267 return pubsub.publish(entry)
268 })
269 )
270 },
271 writeFromRemote: (options) =>
272 Effect.gen(function*() {
273 const remote = ensureRemote(options.remoteId)

Callers

nothing calls this directly

Calls 4

makeEntryIdFunction · 0.85
syncMethod · 0.80
setMethod · 0.65
publishMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…