Wire-side envelope — what a consumer receives, and the type counterpart of
internalEventSchemas.
Two things differ from the publish-side InternalEvent, and both are
deliberate:
id is present here and absent there. The publisher mints it
(SnsEventPublisher), so a call site never supplies one — but §8.20.6
requires every internal consumer to dedupe on it, so it is required on the
wire.
createdAt is a string, not a Date. The envelope is JSON: a
publisher hands in an optional Date, and a consumer reads back the ISO
string it serialised to.
Assert to this after isKnownInternalEvent. That guard narrows to the
publish union, which keeps parity with the customer bus — see the note on
that function.
Wire-side envelope — what a consumer receives, and the type counterpart of internalEventSchemas.
Two things differ from the publish-side InternalEvent, and both are deliberate:
idis present here and absent there. The publisher mints it (SnsEventPublisher), so a call site never supplies one — but §8.20.6 requires every internal consumer to dedupe on it, so it is required on the wire.createdAtis astring, not aDate. The envelope is JSON: a publisher hands in an optionalDate, and a consumer reads back the ISO string it serialised to.Assert to this after isKnownInternalEvent. That guard narrows to the publish union, which keeps parity with the customer bus — see the note on that function.