@voiceflow/base-types
Version:
Voiceflow base project types
47 lines (46 loc) • 2.72 kB
JavaScript
export * as Action from './action.js';
export var RequestType;
(function (RequestType) {
RequestType["TEXT"] = "text";
RequestType["ACTION"] = "action";
RequestType["INTENT"] = "intent";
RequestType["LAUNCH"] = "launch";
RequestType["NO_REPLY"] = "no-reply";
})(RequestType || (RequestType = {}));
/**
* @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 const isTextRequest = (request) => request.type === RequestType.TEXT;
/**
* @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 const isActionRequest = (request) => request.type === RequestType.ACTION;
/**
* @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 const isLaunchRequest = (request) => request.type === RequestType.LAUNCH;
/**
* @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 const isNoReplyRequest = (request) => request.type === RequestType.NO_REPLY;
/**
* @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 const isIntentRequest = (request) => request.type === RequestType.INTENT;
const ALL_REQUEST_TYPES = Object.values(RequestType);
/**
* @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 const isGeneralRequest = (request) => !ALL_REQUEST_TYPES.includes(request.type);