@voiceflow/base-types
Version:
Voiceflow base project types
135 lines • 5.2 kB
TypeScript
import type { Chip } from '../button/index.js';
import type { ActionPayload } from './action.js';
export * as Action from './action.js';
export declare enum RequestType {
TEXT = "text",
ACTION = "action",
INTENT = "intent",
LAUNCH = "launch",
NO_REPLY = "no-reply"
}
export interface RequestConfig {
tts?: boolean;
stopAll?: boolean;
stripSSML?: boolean;
stopTypes?: string[];
selfDelegate?: boolean;
excludeTypes?: string[];
}
export interface VerboseValue {
rawText: string;
canonicalText: string;
startIndex: number;
}
export interface Entity {
name: string;
value: string;
query?: string;
/**
* @deprecated This value is no longer generated. Please remove all code relying on
* LUIS NLU to produce `verboseValue`
*/
verboseValue?: VerboseValue[];
}
export interface LabelRequestPayload {
label?: string;
}
export interface BaseRequest {
type: string;
payload?: unknown;
diagramID?: string;
}
export interface LaunchRequestPayload {
persona?: string;
}
export interface LaunchRequest extends BaseRequest {
type: RequestType.LAUNCH;
payload?: LaunchRequestPayload;
}
export interface NoReplyRequest extends Omit<BaseRequest, 'payload'> {
type: RequestType.NO_REPLY;
}
export interface TextRequest extends BaseRequest {
type: RequestType.TEXT;
payload: string;
}
interface ActionAndLabelRequestPayload extends ActionPayload, LabelRequestPayload {
}
export interface IntentRequestPayload extends ActionAndLabelRequestPayload {
intent: {
name: string;
};
entities: Entity[];
query: string;
confidence?: number;
data?: Record<string, unknown>;
}
export interface IntentRequest extends BaseRequest {
type: RequestType.INTENT;
payload: IntentRequestPayload;
}
export interface GeneralRequest extends BaseRequest {
type: string;
payload?: ActionAndLabelRequestPayload;
}
export interface ActionRequest extends BaseRequest {
type: RequestType.ACTION;
payload?: ActionAndLabelRequestPayload;
}
export interface BaseRequestButton<T extends BaseRequest = BaseRequest> {
name: string;
request: T;
}
export interface TextRequestButton extends BaseRequestButton<TextRequest> {
}
export interface ActionRequestButton extends BaseRequestButton<ActionRequest> {
}
export interface IntentRequestButton extends BaseRequestButton<IntentRequest> {
}
export interface GeneralRequestButton extends BaseRequestButton<GeneralRequest> {
}
export type AnyRequestButton = TextRequestButton | IntentRequestButton | GeneralRequestButton | ActionRequestButton;
export interface NodeButton {
/**
* @deprecated Use buttons
*/
chips?: Chip[];
buttons?: AnyRequestButton[];
}
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isTextRequest: (request: BaseRequest) => request is TextRequest;
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isActionRequest: (request: BaseRequest) => request is ActionRequest;
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isLaunchRequest: (request: BaseRequest) => request is LaunchRequest;
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isNoReplyRequest: (request: BaseRequest) => request is NoReplyRequest;
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isIntentRequest: (request: BaseRequest) => request is IntentRequest;
/**
* @deprecated This type guard is no longer an effective check if `request` is the specified type. The actual
* data being sent does not match the original type definition. This type guard will not be updated with a fix.
* Please use the type guards and equivalent DTOs in `@voiceflow/dtos` instead.
*/
export declare const isGeneralRequest: (request: BaseRequest) => request is GeneralRequest;
//# sourceMappingURL=index.d.ts.map