@@ -5,7 +5,7 @@ export { Trace } from '@voiceflow/base-types';
55// Super broad type so that differing fetch types (ex. builtin, node-fetch, etc.) don't conflict with it
66type FetchFn = ( ...parameters : any [ ] ) => Promise < any > ;
77
8- export interface RuntimeOptions < V = AuthVerify | PublicVerify > {
8+ export interface RuntimeOptions < V = AuthVerify | PublicVerify | PrototypeVerify > {
99 url : string ;
1010 verify : V ;
1111
@@ -24,18 +24,32 @@ export interface PublicVerify {
2424 projectID : string ;
2525}
2626
27- export const isAuthRuntimeOptions = (
28- options : RuntimeOptions < Partial < AuthVerify & PublicVerify > >
29- ) : options is RuntimeOptions < AuthVerify > => {
27+ export interface PrototypeVerify {
28+ projectID : string ;
29+ versionID : string ;
30+ prototype : true ;
31+ }
32+
33+ export type AnyVerify = Partial < AuthVerify & PublicVerify & PrototypeVerify > ;
34+
35+ export const isAuthRuntimeOptions = ( options : RuntimeOptions < AnyVerify > ) : options is RuntimeOptions < AuthVerify > => {
3036 return ! ! options ?. verify ?. authorization ;
3137} ;
3238
33- export const isPublicRuntimeOptions = (
34- options : RuntimeOptions < Partial < AuthVerify & PublicVerify > >
35- ) : options is RuntimeOptions < PublicVerify > => {
39+ export const isPublicRuntimeOptions = ( options : RuntimeOptions < AnyVerify > ) : options is RuntimeOptions < PublicVerify > => {
3640 return typeof options ?. verify ?. projectID === 'string' ;
3741} ;
3842
43+ export const isPrototypeRuntimeOptions = (
44+ options : RuntimeOptions < AnyVerify >
45+ ) : options is RuntimeOptions < PrototypeVerify > => {
46+ return (
47+ options ?. verify ?. prototype === true &&
48+ typeof options ?. verify ?. versionID === 'string' &&
49+ typeof options ?. verify ?. projectID === 'string'
50+ ) ;
51+ } ;
52+
3953export interface RuntimeInteractRequest {
4054 action : RuntimeAction ;
4155 sessionID : string ;
@@ -85,6 +99,7 @@ export const createIntentAction = (payload: BaseRequest.IntentRequestPayload): B
8599} ) ;
86100
87101export interface RuntimeState {
102+ turn : Record < string , any > ;
88103 storage : Record < string , any > ;
89104 variables : Record < string , any > ;
90105}
0 commit comments