UNPKG

@launchdarkly/js-sdk-common

Version:
56 lines 1.69 kB
export type EventType = 'server-intent' | 'put-object' | 'delete-object' | 'payload-transferred' | 'goodbye' | 'error' | 'heart-beat'; export type IntentCode = 'xfer-full' | 'xfer-changes' | 'none'; export interface FDv2Event { /** * The event type could be one we know, or it could be any string. * This is for forward compatibility and to make it clear the protocol may send us types we don't recognize. */ event: EventType | string; /** * Could be one of many known types, or an unknown type. * The unknown type is to handle forward compatibility. */ data: ServerIntentData | PutObject | DeleteObject | PayloadTransferred | GoodbyeObject | ErrorObject | unknown; } /** * The kinds of object are determined by the environment the protocol is operating in. * Client-side and server-side have different possible object kinds. In this common layer code * we treat the kind as opaque. */ export type ObjectKind = string; export interface FDv2EventsCollection { events: FDv2Event[]; } export interface ServerIntentData { payloads: PayloadIntent[]; } export interface PayloadIntent { id: string; target: number; intentCode: IntentCode; reason: string; } export interface PutObject { kind: ObjectKind; key: string; version: number; object: any; } export interface DeleteObject { kind: ObjectKind; key: string; version: number; } export interface GoodbyeObject { reason: string; } export interface ErrorObject { payload_id: string; reason: string; } export interface PayloadTransferred { state: string; version: number; id?: string; } //# sourceMappingURL=proto.d.ts.map