MCPcopy Create free account
hub / github.com/anomalyco/opencode / decodeSerializedEvent

Function decodeSerializedEvent

packages/core/src/event.ts:50–61  ·  view source on GitHub ↗
(event: SerializedEvent)

Source from the content-addressed store, hash-verified

48) {}
49
50const decodeSerializedEvent = (event: SerializedEvent): Payload => {
51 const definition = Durable.get(event.type)
52 if (!definition?.durable) {
53 throw new InvalidDurableEventError({ type: event.type, message: `Unknown durable event type ${event.type}` })
54 }
55 return {
56 id: event.id,
57 type: definition.type,
58 durable: { aggregateID: event.aggregateID, seq: event.seq, version: definition.durable.version },
59 data: Schema.decodeUnknownSync(definition.data)(event.data),
60 }
61}
62
63export const readAggregate = Effect.fn("EventV2.readAggregate")(function* <A>(
64 db: Database.Interface["db"],

Callers 1

readAfterFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected