@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 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.

    type InternalEventEnvelope<N extends InternalEventName> = {
        createdAt: string;
        data: Static<typeof internalEvents[N]["data"]>;
        event: N;
        id: string;
    }

    Type Parameters

    Index
    createdAt: string
    data: Static<typeof internalEvents[N]["data"]>
    event: N
    id: string