@voiceflow/base-types
Version:
Voiceflow base project types
20 lines (19 loc) • 952 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isGeneralEvent = exports.isEventEvent = exports.isIntentEvent = exports.isBaseEvent = exports.EventType = void 0;
// BUILT IN EVENTS
var EventType;
(function (EventType) {
EventType["INTENT"] = "intent";
EventType["EVENT"] = "event";
EventType["ALEXA"] = "alexa";
})(EventType || (exports.EventType = EventType = {}));
const ALL_EVENTS_TYPES = Object.values(EventType);
const isBaseEvent = (event) => typeof event === 'object' && event !== null && 'type' in event && typeof event.type === 'string';
exports.isBaseEvent = isBaseEvent;
const isIntentEvent = (event) => event.type === EventType.INTENT;
exports.isIntentEvent = isIntentEvent;
const isEventEvent = (event) => event.type === EventType.EVENT;
exports.isEventEvent = isEventEvent;
const isGeneralEvent = (event) => !ALL_EVENTS_TYPES.includes(event.type);
exports.isGeneralEvent = isGeneralEvent;