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

Function write

packages/sql/src/SqlEventJournal.ts:162–183  ·  view source on GitHub ↗
({ effect, event, payload, primaryKey })

Source from the content-addressed store, hash-verified

160 Effect.mapError((cause) => new EventJournal.EventJournalError({ cause, method: "entries" }))
161 ),
162 write({ effect, event, payload, primaryKey }) {
163 return Effect.gen(function*() {
164 const entry = new EventJournal.Entry({
165 id: EventJournal.makeEntryId(),
166 event,
167 primaryKey,
168 payload
169 }, { disableValidation: true })
170 yield* insertEntry(entry)
171 const value = yield* effect(entry)
172 yield* pubsub.publish(entry)
173 return value
174 }).pipe(
175 sql.withTransaction,
176 Effect.mapError((cause) =>
177 new EventJournal.EventJournalError({
178 cause,
179 method: "write"
180 })
181 )
182 )
183 },
184 writeFromRemote: (options) =>
185 Effect.gen(function*() {
186 const entries: Array<EventJournal.Entry> = []

Callers

nothing calls this directly

Calls 3

pipeMethod · 0.65
publishMethod · 0.65
effectFunction · 0.50

Tested by

no test coverage detected