UNPKG

@voiceflow/base-types

Version:

Voiceflow base project types

42 lines 1.28 kB
import type { Nullable } from '@voiceflow/common'; import type { SlotMappings } from './mappings.js'; export declare enum EventType { INTENT = "intent", EVENT = "event", ALEXA = "alexa" } export interface BaseEvent { type: string; } /** * @deprecated use BaseEvent or IntentEvent instead */ export type Event<T extends string = string, D = unknown> = { type: T; } & D; export interface IntentEvent extends BaseEvent, SlotMappings { type: EventType.INTENT; intent: string; } export interface EventEvent extends BaseEvent { type: EventType.EVENT; event: string; } export interface AlexaEvent extends BaseEvent { type: EventType.ALEXA; intent: string; mappings: Array<{ var: Nullable<string>; path: string; }>; } export interface GeneralEvent extends BaseEvent { type: string; name: string; } export type AnyEvent = IntentEvent | GeneralEvent | EventEvent; export declare const isBaseEvent: (event: unknown) => event is BaseEvent; export declare const isIntentEvent: (event: BaseEvent) => event is IntentEvent; export declare const isEventEvent: (event: BaseEvent) => event is EventEvent; export declare const isGeneralEvent: (event: GeneralEvent) => event is GeneralEvent; //# sourceMappingURL=event.d.ts.map