Skip to content

Commit 6fd7910

Browse files
committed
fix: add optional platform data to nodes (PL-000) (#353)
<!-- You can erase any parts of this template not applicable to your Pull Request. --> **Fixes or implements PL-000** ### Brief description. What is this change? I noticed in voiceflow/general-service#384 we were casting many nodes: `} as GoogleNode.Capture.Node;` `} as GoogleNode.Interaction.Node;` using `as` is usual not the best pattern and we should want to define the type so everything is expected. I looked everywhere where we write `platform: context.platform,` Co-authored-by: Tyler Han <tylerhan97@gmail.com>
1 parent be34a64 commit 6fd7910

12 files changed

Lines changed: 12 additions & 0 deletions

File tree

packages/base-types/src/node/buttons.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ export interface StepPorts extends NoMatchNoReplyStepPorts {}
4444

4545
export interface Step<Data = StepData> extends BaseStep<Data, StepPorts> {
4646
type: NodeType.BUTTONS;
47+
platform?: string;
4748
}

packages/base-types/src/node/capture.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ export interface Node extends BaseNode, NodeNextID, BaseNoReplyNodeData {
3535
intent?: string;
3636
slots?: string[];
3737
variable: string;
38+
platform?: string;
3839
}

packages/base-types/src/node/captureV2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ export interface Node extends BaseNode, NodeNextID, NodeIntentScope, BaseNoReply
5555
type: NodeType.CAPTURE_V2;
5656
intent?: NodeIntent;
5757
variable?: string;
58+
platform?: string;
5859
}

packages/base-types/src/node/carousel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface Node extends BaseNode, NodeNextID, BaseNoReplyNodeData, BaseNoM
5555
cards: NodeCarouselCard[];
5656
layout: CarouselLayout;
5757
isBlocking: boolean;
58+
platform?: string;
5859
}
5960

6061
export interface TraceCarouselCardDescription {

packages/base-types/src/node/channelAction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ export interface Node<Event = BaseEvent> extends BaseNode {
3434
stop: boolean;
3535
defaultPath?: number; // index starting from 0
3636
paths: Array<NodePath<Event>>;
37+
platform?: string;
3738
}

packages/base-types/src/node/goTo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export interface Step<Data = StepData> extends BaseStep<Data, EmptyObject, []> {
1616
export interface Node extends BaseNode, BaseNoMatchNodeData {
1717
type: NodeType.GOTO;
1818
request: IntentRequest;
19+
platform?: string;
1920
}

packages/base-types/src/node/interaction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export interface NodeInteraction<Event = BaseEvent> extends NodeNextID {
7373
export interface Node<Event = BaseEvent> extends BaseNode, DeprecatedBaseNodeNoMatch, BaseNoReplyNodeData, NodeIntentScope, BaseNoMatchNodeData {
7474
type: NodeType.INTERACTION;
7575
interactions: NodeInteraction<Event>[];
76+
platform?: string;
7677
}
7778

7879
export interface TraceFramePayload {

packages/base-types/src/node/jump.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ export interface Command extends BaseCommand, Required<SlotMappings> {
2727
next: NodeID;
2828
intent: string;
2929
diagramID?: string;
30+
platform?: string;
3031
}

packages/base-types/src/node/push.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ export interface Command extends BaseCommand, Required<SlotMappings> {
2323
next?: NodeID;
2424
intent: string;
2525
diagram_id?: string;
26+
platform?: string;
2627
}

packages/base-types/src/node/stream.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ export interface TraceFramePayload {
5858

5959
export interface TraceFrame extends BaseTraceFrame<TraceFramePayload> {
6060
type: TraceType.STREAM;
61+
platform?: string;
6162
}

0 commit comments

Comments
 (0)