Props for the useEventSource hook.

interface Props {
    withQuery: IWithQuery<QuerySchema<ZodObject<extendShape<{
        id: ZodOptional<ZodNullable<ZodString>>;
        idIn: ZodOptional<ZodNullable<ZodArray<ZodString, "many">>>;
        fulltext: ZodOptional<ZodNullable<ZodString>>;
    }, {
        userId: ZodOptional<ZodNullable<ZodString>>;
        group: ZodOptional<ZodNullable<ZodString>>;
        commit: ZodOptional<ZodNullable<ZodBoolean>>;
    }>, "strip", ZodTypeAny, {
        id?: null | string;
        idIn?: null | string[];
        fulltext?: null | string;
        userId?: null | string;
        group?: null | string;
        commit?: null | boolean;
    }, {
        id?: null | string;
        idIn?: null | string[];
        fulltext?: null | string;
        userId?: null | string;
        group?: null | string;
        commit?: null | boolean;
    }>, ZodObject<{
        timestamp: ZodOptional<ZodEnum<["asc", "desc"]>>;
    }, "strip", ZodTypeAny, {
        timestamp?: "asc" | "desc";
    }, {
        timestamp?: "asc" | "desc";
    }>>, ZodArray<ZodObject<extendShape<{
        id: ZodString;
    }, {
        event: ZodString;
        group: ZodOptional<ZodNullable<ZodString>>;
        payload: ZodOptional<ZodNullable<ZodAny>>;
        userId: ZodOptional<ZodNullable<ZodString>>;
        commit: ZodBoolean;
        timestamp: ZodOptional<ZodNullable<ZodAny>>;
    }>, "strip", ZodTypeAny, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }>, "many">>;
    withMutation: IWithMutation<MutationSchema<ZodObject<{
        event: ZodString;
        group: ZodOptional<ZodNullable<ZodString>>;
        payload: ZodOptional<ZodNullable<ZodAny>>;
        commit: ZodBoolean;
    }, "strip", ZodTypeAny, {
        commit: boolean;
        event: string;
        group?: null | string;
        payload?: any;
    }, {
        commit: boolean;
        event: string;
        group?: null | string;
        payload?: any;
    }>, QuerySchema<ZodObject<extendShape<{
        id: ZodOptional<ZodNullable<ZodString>>;
        idIn: ZodOptional<ZodNullable<ZodArray<ZodString, "many">>>;
        fulltext: ZodOptional<ZodNullable<ZodString>>;
    }, {
        userId: ZodOptional<ZodNullable<ZodString>>;
        group: ZodOptional<ZodNullable<ZodString>>;
        commit: ZodOptional<ZodNullable<ZodBoolean>>;
    }>, "strip", ZodTypeAny, {
        id?: null | string;
        idIn?: null | string[];
        fulltext?: null | string;
        userId?: null | string;
        group?: null | string;
        commit?: null | boolean;
    }, {
        id?: null | string;
        idIn?: null | string[];
        fulltext?: null | string;
        userId?: null | string;
        group?: null | string;
        commit?: null | boolean;
    }>, ZodObject<{
        timestamp: ZodOptional<ZodEnum<["asc", "desc"]>>;
    }, "strip", ZodTypeAny, {
        timestamp?: "asc" | "desc";
    }, {
        timestamp?: "asc" | "desc";
    }>>>, ZodObject<extendShape<{
        id: ZodString;
    }, {
        event: ZodString;
        group: ZodOptional<ZodNullable<ZodString>>;
        payload: ZodOptional<ZodNullable<ZodAny>>;
        userId: ZodOptional<ZodNullable<ZodString>>;
        commit: ZodBoolean;
        timestamp: ZodOptional<ZodNullable<ZodAny>>;
    }>, "strip", ZodTypeAny, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }>>;
    handlers: Handler<ZodType<any, ZodTypeDef, any>>[];
    filter?: {
        id?: null | string;
        idIn?: null | string[];
        fulltext?: null | string;
        userId?: null | string;
        group?: null | string;
        commit?: null | boolean;
    };
    options?: QueryOptions<ZodArray<ZodObject<extendShape<{
        id: ZodString;
    }, {
        event: ZodString;
        group: ZodOptional<ZodNullable<ZodString>>;
        payload: ZodOptional<ZodNullable<ZodAny>>;
        userId: ZodOptional<ZodNullable<ZodString>>;
        commit: ZodBoolean;
        timestamp: ZodOptional<ZodNullable<ZodAny>>;
    }>, "strip", ZodTypeAny, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }, {
        id: string;
        commit: boolean;
        event: string;
        userId?: null | string;
        group?: null | string;
        timestamp?: any;
        payload?: any;
    }>, "many">>;
    refetch?: number;
}

Properties

withQuery: IWithQuery<QuerySchema<ZodObject<extendShape<{
    id: ZodOptional<ZodNullable<ZodString>>;
    idIn: ZodOptional<ZodNullable<ZodArray<ZodString, "many">>>;
    fulltext: ZodOptional<ZodNullable<ZodString>>;
}, {
    userId: ZodOptional<ZodNullable<ZodString>>;
    group: ZodOptional<ZodNullable<ZodString>>;
    commit: ZodOptional<ZodNullable<ZodBoolean>>;
}>, "strip", ZodTypeAny, {
    id?: null | string;
    idIn?: null | string[];
    fulltext?: null | string;
    userId?: null | string;
    group?: null | string;
    commit?: null | boolean;
}, {
    id?: null | string;
    idIn?: null | string[];
    fulltext?: null | string;
    userId?: null | string;
    group?: null | string;
    commit?: null | boolean;
}>, ZodObject<{
    timestamp: ZodOptional<ZodEnum<["asc", "desc"]>>;
}, "strip", ZodTypeAny, {
    timestamp?: "asc" | "desc";
}, {
    timestamp?: "asc" | "desc";
}>>, ZodArray<ZodObject<extendShape<{
    id: ZodString;
}, {
    event: ZodString;
    group: ZodOptional<ZodNullable<ZodString>>;
    payload: ZodOptional<ZodNullable<ZodAny>>;
    userId: ZodOptional<ZodNullable<ZodString>>;
    commit: ZodBoolean;
    timestamp: ZodOptional<ZodNullable<ZodAny>>;
}>, "strip", ZodTypeAny, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}>, "many">>

Event Source query to get the events.

withMutation: IWithMutation<MutationSchema<ZodObject<{
    event: ZodString;
    group: ZodOptional<ZodNullable<ZodString>>;
    payload: ZodOptional<ZodNullable<ZodAny>>;
    commit: ZodBoolean;
}, "strip", ZodTypeAny, {
    commit: boolean;
    event: string;
    group?: null | string;
    payload?: any;
}, {
    commit: boolean;
    event: string;
    group?: null | string;
    payload?: any;
}>, QuerySchema<ZodObject<extendShape<{
    id: ZodOptional<ZodNullable<ZodString>>;
    idIn: ZodOptional<ZodNullable<ZodArray<ZodString, "many">>>;
    fulltext: ZodOptional<ZodNullable<ZodString>>;
}, {
    userId: ZodOptional<ZodNullable<ZodString>>;
    group: ZodOptional<ZodNullable<ZodString>>;
    commit: ZodOptional<ZodNullable<ZodBoolean>>;
}>, "strip", ZodTypeAny, {
    id?: null | string;
    idIn?: null | string[];
    fulltext?: null | string;
    userId?: null | string;
    group?: null | string;
    commit?: null | boolean;
}, {
    id?: null | string;
    idIn?: null | string[];
    fulltext?: null | string;
    userId?: null | string;
    group?: null | string;
    commit?: null | boolean;
}>, ZodObject<{
    timestamp: ZodOptional<ZodEnum<["asc", "desc"]>>;
}, "strip", ZodTypeAny, {
    timestamp?: "asc" | "desc";
}, {
    timestamp?: "asc" | "desc";
}>>>, ZodObject<extendShape<{
    id: ZodString;
}, {
    event: ZodString;
    group: ZodOptional<ZodNullable<ZodString>>;
    payload: ZodOptional<ZodNullable<ZodAny>>;
    userId: ZodOptional<ZodNullable<ZodString>>;
    commit: ZodBoolean;
    timestamp: ZodOptional<ZodNullable<ZodAny>>;
}>, "strip", ZodTypeAny, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}>>

Mutation used to commit received events.

handlers: Handler<ZodType<any, ZodTypeDef, any>>[]

Handlers to handle the events; when schema matches the event data, handler is called.

filter?: {
    id?: null | string;
    idIn?: null | string[];
    fulltext?: null | string;
    userId?: null | string;
    group?: null | string;
    commit?: null | boolean;
}

Optional filter used to filter out only some events.

Type declaration

  • Optional id?: null | string

    Basically any entity should have an ID, thus it's present in the default schema.

  • Optional idIn?: null | string[]

    Option to get entities by an array of IDs.

  • Optional fulltext?: null | string

    Usually it's somehow possible to search for the Entity by some text, thus it's present, but not necessarily required.

  • Optional userId?: null | string
  • Optional group?: null | string
  • Optional commit?: null | boolean
options?: QueryOptions<ZodArray<ZodObject<extendShape<{
    id: ZodString;
}, {
    event: ZodString;
    group: ZodOptional<ZodNullable<ZodString>>;
    payload: ZodOptional<ZodNullable<ZodAny>>;
    userId: ZodOptional<ZodNullable<ZodString>>;
    commit: ZodBoolean;
    timestamp: ZodOptional<ZodNullable<ZodAny>>;
}>, "strip", ZodTypeAny, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}, {
    id: string;
    commit: boolean;
    event: string;
    userId?: null | string;
    group?: null | string;
    timestamp?: any;
    payload?: any;
}>, "many">>

Low-level query options, of needed.

refetch?: number

Refetch interval in milliseconds.