UNPKG

@kurrent/kurrentdb-client

Version:
11 lines (10 loc) 1.05 kB
import type { ReadResp as StreamsReadResp } from "../../generated/streams_pb"; import type { ReadResp as PersistentReadResp } from "../../generated/persistent_pb"; import type { EventType, EventTypeToRecordedEvent, PersistentSubscriptionToStreamResolvedEvent, ResolvedEvent } from "../types"; export type GRPCReadResp = StreamsReadResp | PersistentReadResp; export type GRPCReadEvent = StreamsReadResp.ReadEvent | PersistentReadResp.ReadEvent; export type GRPCRecordedEvent = StreamsReadResp.ReadEvent.RecordedEvent | PersistentReadResp.ReadEvent.RecordedEvent; export type ConvertGrpcEvent<GRPCEvent, E> = (grpcEvent: GRPCEvent) => E; export declare const convertGrpcEvent: <T extends ResolvedEvent>(grpcEvent: StreamsReadResp.ReadEvent) => T; export declare const convertPersistentSubscriptionGrpcEvent: <T extends PersistentSubscriptionToStreamResolvedEvent>(grpcEvent: PersistentReadResp.ReadEvent) => T; export declare const convertGrpcRecord: <E extends EventType = EventType>(grpcRecord: GRPCRecordedEvent) => EventTypeToRecordedEvent<E>;