Skip to content

Commit

Permalink
fix: go to node (VF-2140) (#111)
Browse files Browse the repository at this point in the history
* wip: goto

* fix: add goto trace
  • Loading branch information
leartgjoni-voiceflow authored Oct 29, 2021
1 parent 8c38836 commit d110456
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/base-types/src/node/utils/event.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IntentRequest } from '@/request';

import { SlotMappings } from './mappings';

// BUILT IN EVENTS
Expand All @@ -17,6 +19,9 @@ export type Event<T extends string = string, D = unknown> = { type: T } & D;
export interface IntentEvent extends BaseEvent, SlotMappings {
type: EventType.INTENT;
intent: string;
goTo?: {
request: IntentRequest;
};
}

export interface GeneralEvent extends BaseEvent {
Expand Down
1 change: 1 addition & 0 deletions packages/base-types/src/node/utils/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum TraceType {
CHOICE = 'choice',
STREAM = 'stream',
VISUAL = 'visual',
GOTO = 'goto',
}

export interface BaseTraceFramePath<Event extends BaseEvent = BaseEvent> {
Expand Down
9 changes: 9 additions & 0 deletions packages/base-types/src/trace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TraceFrame as StreamTrace } from '@/node/stream';
import { TraceFrame as TextTrace } from '@/node/text';
import { BaseTraceFrame, TraceType } from '@/node/utils';
import { TraceFrame as VisualTrace } from '@/node/visual';
import { IntentRequest } from '@/request';

export { TraceFrame as ExitTrace } from '@/node/exit';
export { TraceFrame as FlowTrace } from '@/node/flow';
Expand All @@ -32,6 +33,14 @@ export interface PathTrace extends BaseTraceFrame<PathTracePayload> {
type: TraceType.PATH;
}

export interface GoToTracePayload {
request: IntentRequest;
}

export interface GoToTrace extends BaseTraceFrame<GoToTracePayload> {
type: TraceType.GOTO;
}

export interface BlockTracePayload {
blockID: string;
}
Expand Down

0 comments on commit d110456

Please sign in to comment.