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 required here and optional there. The publisher mints one
unless a republish fixes it, and every internal consumer dedupes on it
(§8.20.6).
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.
subject carries its kind, stamped by the publisher.
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 required here and optional there. The publisher mints one unless a republish fixes it, and every internal consumer dedupes on it (§8.20.6).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.subjectcarries itskind, stamped by the publisher.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.