@voiceflow/base-types
Version:
Voiceflow base project types
79 lines (78 loc) • 4.28 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isGeneralRequest = exports.isIntentRequest = exports.isNoReplyRequest = exports.isLaunchRequest = exports.isActionRequest = exports.isTextRequest = exports.RequestType = exports.Action = void 0;
exports.Action = __importStar(require("./action"));
var RequestType;
(function (RequestType) {
RequestType["TEXT"] = "text";
RequestType["ACTION"] = "action";
RequestType["INTENT"] = "intent";
RequestType["LAUNCH"] = "launch";
RequestType["NO_REPLY"] = "no-reply";
})(RequestType || (exports.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.
*/
const isTextRequest = (request) => request.type === RequestType.TEXT;
exports.isTextRequest = isTextRequest;
/**
* @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.
*/
const isActionRequest = (request) => request.type === RequestType.ACTION;
exports.isActionRequest = isActionRequest;
/**
* @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.
*/
const isLaunchRequest = (request) => request.type === RequestType.LAUNCH;
exports.isLaunchRequest = isLaunchRequest;
/**
* @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.
*/
const isNoReplyRequest = (request) => request.type === RequestType.NO_REPLY;
exports.isNoReplyRequest = isNoReplyRequest;
/**
* @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.
*/
const isIntentRequest = (request) => request.type === RequestType.INTENT;
exports.isIntentRequest = isIntentRequest;
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.
*/
const isGeneralRequest = (request) => !ALL_REQUEST_TYPES.includes(request.type);
exports.isGeneralRequest = isGeneralRequest;