data-cap
    Preparing search index...

    Interface SubscriptionDefinition<TFields, TParams, TEvent, TWrites>

    A subscription operation: continuously observes data. writes is required and explicit, same rationale as a getter's. onEvent/ onStatusChange map to writes-bounded fields commits and info.<field>.subscription commits respectively -- a status transition alone never touches fields (ADR 0029). subscribe's own shape matches coordinator.acquireSubscription's SubscribeFn exactly (params bound in by the runtime, handlers, a teardown function returned directly) -- no separate AbortSignal, since the returned teardown function is already the sanctioned way to stop a subscription.

    interface SubscriptionDefinition<
        TFields,
        TParams,
        TEvent,
        TWrites extends FieldOwnership<TFields>,
    > {
        params?: TParams;
        processor?: (
            event: TEvent,
            params: TParams,
        ) => OwnedPatch<TFields, TWrites>;
        subscribe: (
            params: TParams,
            handlers: SubscriptionEventHandlers<TEvent>,
        ) => () => void;
        writes: TWrites;
    }

    Type Parameters

    Index
    params?: TParams

    Default/example params, deep-merged with a caller's partial at call time.

    processor?: (event: TEvent, params: TParams) => OwnedPatch<TFields, TWrites>

    Defaults to identity when omitted -- the raw event is used directly as the patch.

    subscribe: (
        params: TParams,
        handlers: SubscriptionEventHandlers<TEvent>,
    ) => () => void

    Opens the connection and drives handlers; the returned function tears the subscription down.

    writes: TWrites

    Declares which fields this subscription is permitted to write -- see FieldOwnership.