({ effect, event, payload, primaryKey })
| 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) |
nothing calls this directly
no test coverage detected