@cfxlabsinc/b2b-services
    Preparing search index...

    Type Alias InternalEventEnvelope<N>

    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.

    type InternalEventEnvelope<N extends InternalEventName> = {
        actor?: EventActor;
        createdAt: string;
        data: Static<typeof internalEvents[N]["data"]>;
        event: N;
        id: string;
        owners: EventOwners;
        parentId?: string;
        subject: { id: string; kind: InternalEventSubjectKind<N> };
    }

    Type Parameters

    Index
    actor?: EventActor
    createdAt: string
    data: Static<typeof internalEvents[N]["data"]>
    event: N
    id: string
    owners: EventOwners
    parentId?: string
    subject: { id: string; kind: InternalEventSubjectKind<N> }