diff --git a/packages/fdc3-schema/code-generation/generate-type-predicates.ts b/packages/fdc3-schema/code-generation/generate-type-predicates.ts index 9e55361a5..2c341bc5f 100644 --- a/packages/fdc3-schema/code-generation/generate-type-predicates.ts +++ b/packages/fdc3-schema/code-generation/generate-type-predicates.ts @@ -1,62 +1,84 @@ -import { InterfaceDeclaration, MethodDeclaration, Project, SyntaxKind } from "ts-morph" +import { InterfaceDeclaration, MethodDeclaration, Project, SyntaxKind, TypeAliasDeclaration } from 'ts-morph'; -// open a new project with just BrowserTypes as the only source file +// open a new project with just BrowserTypes as the only source file const project = new Project(); -const sourceFile = project.addSourceFileAtPath("./generated/api/BrowserTypes.ts"); +const sourceFile = project.addSourceFileAtPath('./generated/api/BrowserTypes.ts'); -const typeAliases = sourceFile.getChildrenOfKind(SyntaxKind.TypeAliasDeclaration); /** * We generate the union types and remove the existing interfaces first so that we are not left with a generated type predicate for the removed base interface */ +writeMessageUnionTypes(); +writeTypePredicates(); -// get the types listed in the types union type -// i.e. look for: export type RequestMessageType = "addContextListenerRequest" | "whatever" -const requestMessageUnion = findUnionType("RequestMessageType"); -if(requestMessageUnion != null){ - // Write a union type of all interfaces that have a type that extends RequestMessageType - writeUnionType("AppRequestMessage", requestMessageUnion); -} - -const responseMessageUnion = findUnionType("ResponseMessageType"); -if(responseMessageUnion != null){ - writeUnionType("AgentResponseMessage", responseMessageUnion); -} - -const eventMessageUnion = findUnionType("EventMessageType"); -if(eventMessageUnion != null){ - writeUnionType("AgentEventMessage", eventMessageUnion); -} - -// get a list of all conversion functions in the Convert class -const convert = sourceFile.getClass("Convert"); -const convertFunctions = (convert?.getChildrenOfKind(SyntaxKind.MethodDeclaration) ?? []).filter(func => func.getReturnType().getText() === "string"); - - -//get a list of all interfaces in the file -let messageInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); - -// generate a list of Interfaces that have an associated conversion function -const matchedInterfaces = convertFunctions.map(func => { - const valueParameter = func.getParameter("value"); +sourceFile.formatText(); +project.saveSync(); - const matchingInterface = messageInterfaces.find(interfaceNode => { - return valueParameter?.getType().getText(valueParameter) === interfaceNode.getName(); - }); +/** + * Replaces the existing interfaces AppRequestMessage, AgentResponseMessage and AgentEventMessage with unions of INterfaces instead of a base type + */ +function writeMessageUnionTypes() { + const typeAliases = sourceFile.getChildrenOfKind(SyntaxKind.TypeAliasDeclaration); + + // get the types listed in the types union type + // i.e. look for: export type RequestMessageType = "addContextListenerRequest" | "whatever" + const requestMessageTypeUnion = findUnionType(typeAliases, 'RequestMessageType'); + if (requestMessageTypeUnion != null) { + // Write a union type of all interfaces that have a type that extends RequestMessageType + // i.e. export type AppRequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest; + writeUnionType('AppRequestMessage', requestMessageTypeUnion); + } - if (matchingInterface != null) { - return { func, matchingInterface }; + const responseMessageTypeUnion = findUnionType(typeAliases, 'ResponseMessageType'); + if (responseMessageTypeUnion != null) { + writeUnionType('AgentResponseMessage', responseMessageTypeUnion); } - return undefined; -}).filter(((value => value != null) as (value: T | null | undefined) => value is T)); + const eventMessageTypeUnion = findUnionType(typeAliases, 'EventMessageType'); + if (eventMessageTypeUnion != null) { + writeUnionType('AgentEventMessage', eventMessageTypeUnion); + } +} -// write a type predicate for each matched interface -matchedInterfaces.forEach(matched => { - writePredicate(matched.matchingInterface, matched.func) - writeTypeConstant(matched.matchingInterface) -}); +/** + * Writes type predicates for all interfaces found that have a matching convert function + */ +function writeTypePredicates(){ + // get a list of all conversion functions in the Convert class that return a string + const convert = sourceFile.getClass('Convert'); + const convertFunctions = (convert?.getChildrenOfKind(SyntaxKind.MethodDeclaration) ?? []).filter( + func => func.getReturnType().getText() === 'string' + ); + + //get a list of all interfaces in the file + let messageInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); + + // generate a list of Interfaces that have an associated conversion function + const matchedInterfaces = convertFunctions + .map(func => { + const valueParameter = func.getParameter('value'); + + const matchingInterface = messageInterfaces.find(interfaceNode => { + /// Find an interface who's name matches the type passed into the value parameter of the convert function + return valueParameter?.getType().getText(valueParameter) === interfaceNode.getName(); + }); + + if (matchingInterface != null) { + return { func, matchingInterface }; + } + + return undefined; + }) + .filter(isDefined); + + // write a type predicate for each matched interface + matchedInterfaces.forEach(matched => { + writeFastPredicate(matched.matchingInterface); + writeValidPredicate(matched.matchingInterface, matched.func); + writeTypeConstant(matched.matchingInterface); + }); +} /** @@ -64,40 +86,51 @@ matchedInterfaces.forEach(matched => { * export type NAME = "stringOne" | "stringTwo" | "stringThree"; * and returns the string values * if the union type is not found returns undefined - * @param name - * @returns + * @param name + * @returns */ -function findUnionType(name: string): string[] | undefined { - const typeAlias = typeAliases.find(alias => { - const identifiers = alias.getChildrenOfKind(SyntaxKind.Identifier); - - return identifiers[0].getText() === name; - - }); - - return typeAlias?.getChildrenOfKind(SyntaxKind.UnionType)?.[0] - .getDescendantsOfKind(SyntaxKind.StringLiteral) - .map(literal => literal.getLiteralText()); -} - +function findUnionType(typeAliases: TypeAliasDeclaration[], name: string): string[] | undefined { + const typeAlias = typeAliases.find(alias => { + const identifiers = alias.getChildrenOfKind(SyntaxKind.Identifier); + return identifiers[0].getText() === name; + }); + return typeAlias + ?.getChildrenOfKind(SyntaxKind.UnionType)?.[0] + .getDescendantsOfKind(SyntaxKind.StringLiteral) + .map(literal => literal.getLiteralText()); +} +/** + * Finds an existing declaration with the given type and name + * @param name + * @param kind + * @returns + */ function findExisting(name: string, kind: T) { - return sourceFile.getChildrenOfKind(kind).filter(child => { - const identifier = child.getDescendantsOfKind(SyntaxKind.Identifier)[0]; + return sourceFile.getChildrenOfKind(kind).filter(child => { + const identifier = child.getDescendantsOfKind(SyntaxKind.Identifier)[0]; - return identifier?.getText() === name; - }) + return identifier?.getText() === name; + }); } -function writePredicate(matchingInterface: InterfaceDeclaration, func: MethodDeclaration): void { - const predicateName = `is${matchingInterface.getName()}`; +/** + * Writes a type predicate for the given interface using the Convert method declaration + * @param matchingInterface + * @param func + */ +function writeValidPredicate(matchingInterface: InterfaceDeclaration, func: MethodDeclaration): void { + const predicateName = `isValid${matchingInterface.getName()}`; - // remove existing instances - findExisting(predicateName, SyntaxKind.FunctionDeclaration).forEach(node => node.remove()); + // remove existing instances + findExisting(predicateName, SyntaxKind.FunctionDeclaration).forEach(node => node.remove()); - sourceFile.addStatements(` + sourceFile.addStatements(` +/** + * TODO: WIP + */ export function ${predicateName}(value: any): value is ${matchingInterface.getName()} { try{ Convert.${func.getName()}(value); @@ -108,54 +141,100 @@ export function ${predicateName}(value: any): value is ${matchingInterface.getNa }`); } +/** + * Writes a type predicate for the given interface checking just the value of the type property + * @param matchingInterface + * @param func + */ +function writeFastPredicate(matchingInterface: InterfaceDeclaration): void { + const predicateName = `is${matchingInterface.getName()}`; + + // remove existing instances + findExisting(predicateName, SyntaxKind.FunctionDeclaration).forEach(node => node.remove()); + + const typePropertyValue = extractTypePropertyValue(matchingInterface); -function writeTypeConstant(matchingInterface: InterfaceDeclaration): void { - - const constantName = `${matchingInterface.getName().replaceAll(/([A-Z])/g, '_$1').toUpperCase().substring(1)}_TYPE`; - - //remove existing - findExisting(constantName, SyntaxKind.VariableStatement).forEach(node => node.remove()); + if(typePropertyValue == null){ + return; + } sourceFile.addStatements(` - export const ${matchingInterface.getName().replaceAll(/([A-Z])/g, '_$1').toUpperCase().substring(1)}_TYPE = "${matchingInterface.getName()}";`); +/** + * Returns true if the value has the correct type. This is a fast check that does not check the format of the message + */ +export function ${predicateName}(value: any): value is ${matchingInterface.getName()} { + return value != null && value.type === '${typePropertyValue}'; +}`); + } +function writeTypeConstant(matchingInterface: InterfaceDeclaration): void { + const constantName = `${matchingInterface + .getName() + .replaceAll(/([A-Z])/g, '_$1') + .toUpperCase() + .substring(1)}_TYPE`; + + //remove existing + findExisting(constantName, SyntaxKind.VariableStatement).forEach(node => node.remove()); + + sourceFile.addStatements(` + export const ${matchingInterface + .getName() + .replaceAll(/([A-Z])/g, '_$1') + .toUpperCase() + .substring(1)}_TYPE = "${matchingInterface.getName()}";`); } /** * Writes a union type of all the interfaces that have a type property that extends the type values passed in. * For example: * export type RequestMessage = AddContextListenerRequest | AddEventListenerRequest ... - * @param unionName - * @param interfaces - * @param typeValues + * @param unionName + * @param interfaces + * @param typeValues */ function writeUnionType(unionName: string, typeValues: string[]): void { - // generate interfaces list again as we may have just removed some - const unionInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); - - // look for interfaces that have a type property that extends one of the values in typeValues - const matchingInterfaces = unionInterfaces.filter(currentInterface => { - const typeProperty = currentInterface.getChildrenOfKind(SyntaxKind.PropertySignature).filter(propertySignature => { - return propertySignature.getChildrenOfKind(SyntaxKind.Identifier).find(identifier => identifier.getText() === "type") != null; - })[0]; + // generate interfaces list again as we may have just removed some + const unionInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); - if(typeProperty == null){ - return false; - } + // look for interfaces that have a type property that extends one of the values in typeValues + const matchingInterfaces = unionInterfaces.filter(currentInterface => { + const typePropertyValue = extractTypePropertyValue(currentInterface); - const stringLiterals = typeProperty.getDescendantsOfKind(SyntaxKind.StringLiteral) - .map(literal => literal.getLiteralText()); + return typeValues.some(typeValue => typeValue === typePropertyValue); + }); - return stringLiterals.some(literal => typeValues.some(typeValue => typeValue === literal)); - }) - - //remove existing Type - findExisting(unionName, SyntaxKind.InterfaceDeclaration).forEach(node => node.remove()); + //remove existing Type + findExisting(unionName, SyntaxKind.InterfaceDeclaration).forEach(node => node.remove()); - sourceFile.addStatements(` - export type ${unionName} = ${matchingInterfaces.map(match => match.getName()).join(" | ")}; `); + sourceFile.addStatements(` + export type ${unionName} = ${matchingInterfaces.map(match => match.getName()).join(' | ')}; `); } -sourceFile.formatText(); +/** + * Extract the type string constant from an interface such as + * interface ExampleMessage{ + * type: "stringConstant"; + * } + * @param parentInterface + * @returns + */ +function extractTypePropertyValue(parentInterface: InterfaceDeclaration): string | undefined{ + const typeProperty = parentInterface.getChildrenOfKind(SyntaxKind.PropertySignature).filter(propertySignature => { + return ( + propertySignature + .getChildrenOfKind(SyntaxKind.Identifier) + .find(identifier => identifier.getText() === 'type') != null + ); + })[0]; + + return typeProperty?.getDescendantsOfKind(SyntaxKind.StringLiteral) + .map(literal => literal.getLiteralText())[0]; +} -project.saveSync(); +/** + * Type predicate to test that value is defined + */ +function isDefined(value: T | null | undefined): value is T{ + return value != null; +} \ No newline at end of file diff --git a/packages/fdc3-schema/generated/api/BrowserTypes.ts b/packages/fdc3-schema/generated/api/BrowserTypes.ts index a924b0bdf..6fb452d9c 100644 --- a/packages/fdc3-schema/generated/api/BrowserTypes.ts +++ b/packages/fdc3-schema/generated/api/BrowserTypes.ts @@ -957,30 +957,6 @@ export interface AddIntentListenerResponsePayload { */ export type FluffyError = "MalformedContext" | "DesktopAgentNotFound" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution"; -/** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - -/** - * A message from a Desktop Agent to an FDC3-enabled app representing an event. - */ -export interface AgentEventMessage { - /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. - */ - meta: AgentEventMessageMeta; - /** - * The message payload contains details of the event that the app is being notified about. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: EventMessageType; -} - /** * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ @@ -995,28 +971,6 @@ export interface AgentEventMessageMeta { */ export type EventMessageType = "addEventListenerEvent" | "broadcastEvent" | "channelChangedEvent" | "heartbeatEvent" | "intentEvent" | "privateChannelOnAddContextListenerEvent" | "privateChannelOnDisconnectEvent" | "privateChannelOnUnsubscribeEvent"; -/** - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. - */ -export interface AgentResponseMessage { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AgentResponseMessageMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: AgentResponseMessageResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: ResponseMessageType; -} - /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -1047,25 +1001,6 @@ export interface AgentResponseMessageResponsePayload { */ export type ResponseMessageType = "addContextListenerResponse" | "addEventListenerResponse" | "addIntentListenerResponse" | "broadcastResponse" | "contextListenerUnsubscribeResponse" | "createPrivateChannelResponse" | "eventListenerUnsubscribeResponse" | "findInstancesResponse" | "findIntentResponse" | "findIntentsByContextResponse" | "getAppMetadataResponse" | "getCurrentChannelResponse" | "getCurrentContextResponse" | "getInfoResponse" | "getOrCreateChannelResponse" | "getUserChannelsResponse" | "intentListenerUnsubscribeResponse" | "intentResultResponse" | "joinUserChannelResponse" | "leaveCurrentChannelResponse" | "openResponse" | "privateChannelAddEventListenerResponse" | "privateChannelDisconnectResponse" | "privateChannelUnsubscribeEventListenerResponse" | "raiseIntentForContextResponse" | "raiseIntentResponse" | "raiseIntentResultResponse"; -/** - * A request message from an FDC3-enabled app to a Desktop Agent. - */ -export interface AppRequestMessage { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AppRequestMessageMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: RequestMessageType; -} - /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -5858,7 +5793,17 @@ const typeMap: any = { ], }; +export type AppRequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest | BroadcastRequest | ContextListenerUnsubscribeRequest | CreatePrivateChannelRequest | EventListenerUnsubscribeRequest | FindInstancesRequest | FindIntentRequest | FindIntentsByContextRequest | GetAppMetadataRequest | GetCurrentChannelRequest | GetCurrentContextRequest | GetInfoRequest | GetOrCreateChannelRequest | GetUserChannelsRequest | HeartbeatAcknowledgementRequest | IntentListenerUnsubscribeRequest | IntentResultRequest | JoinUserChannelRequest | LeaveCurrentChannelRequest | OpenRequest | PrivateChannelAddEventListenerRequest | PrivateChannelDisconnectRequest | PrivateChannelUnsubscribeEventListenerRequest | RaiseIntentForContextRequest | RaiseIntentRequest; + +export type AgentResponseMessage = AddContextListenerResponse | AddEventListenerResponse | AddIntentListenerResponse | BroadcastResponse | ContextListenerUnsubscribeResponse | CreatePrivateChannelResponse | EventListenerUnsubscribeResponse | FindInstancesResponse | FindIntentResponse | FindIntentsByContextResponse | GetAppMetadataResponse | GetCurrentChannelResponse | GetCurrentContextResponse | GetInfoResponse | GetOrCreateChannelResponse | GetUserChannelsResponse | IntentListenerUnsubscribeResponse | IntentResultResponse | JoinUserChannelResponse | LeaveCurrentChannelResponse | OpenResponse | PrivateChannelAddEventListenerResponse | PrivateChannelDisconnectResponse | PrivateChannelUnsubscribeEventListenerResponse | RaiseIntentForContextResponse | RaiseIntentResponse | RaiseIntentResultResponse; + +export type AgentEventMessage = BroadcastEvent | ChannelChangedEvent | HeartbeatEvent | IntentEvent | PrivateChannelOnAddContextListenerEvent | PrivateChannelOnDisconnectEvent | PrivateChannelOnUnsubscribeEvent; + export function isWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { + return value != null && value.type === 'WCP1Hello'; +} + +export function isValidWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { try { Convert.webConnectionProtocol1HelloToJson(value); return true; @@ -5870,6 +5815,10 @@ export function isWebConnectionProtocol1Hello(value: any): value is WebConnectio export const WEB_CONNECTION_PROTOCOL1_HELLO_TYPE = "WebConnectionProtocol1Hello"; export function isWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { + return value != null && value.type === 'WCP2LoadUrl'; +} + +export function isValidWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { try { Convert.webConnectionProtocol2LoadURLToJson(value); return true; @@ -5881,6 +5830,10 @@ export function isWebConnectionProtocol2LoadURL(value: any): value is WebConnect export const WEB_CONNECTION_PROTOCOL2_LOAD_U_R_L_TYPE = "WebConnectionProtocol2LoadURL"; export function isWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { + return value != null && value.type === 'WCP3Handshake'; +} + +export function isValidWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { try { Convert.webConnectionProtocol3HandshakeToJson(value); return true; @@ -5892,6 +5845,10 @@ export function isWebConnectionProtocol3Handshake(value: any): value is WebConne export const WEB_CONNECTION_PROTOCOL3_HANDSHAKE_TYPE = "WebConnectionProtocol3Handshake"; export function isWebConnectionProtocol4ValidateAppIdentity(value: any): value is WebConnectionProtocol4ValidateAppIdentity { + return value != null && value.type === 'WCP4ValidateAppIdentity'; +} + +export function isValidWebConnectionProtocol4ValidateAppIdentity(value: any): value is WebConnectionProtocol4ValidateAppIdentity { try { Convert.webConnectionProtocol4ValidateAppIdentityToJson(value); return true; @@ -5903,6 +5860,10 @@ export function isWebConnectionProtocol4ValidateAppIdentity(value: any): value i export const WEB_CONNECTION_PROTOCOL4_VALIDATE_APP_IDENTITY_TYPE = "WebConnectionProtocol4ValidateAppIdentity"; export function isWebConnectionProtocol5ValidateAppIdentityFailedResponse(value: any): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { + return value != null && value.type === 'WCP5ValidateAppIdentityFailedResponse'; +} + +export function isValidWebConnectionProtocol5ValidateAppIdentityFailedResponse(value: any): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { try { Convert.webConnectionProtocol5ValidateAppIdentityFailedResponseToJson(value); return true; @@ -5914,6 +5875,10 @@ export function isWebConnectionProtocol5ValidateAppIdentityFailedResponse(value: export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_FAILED_RESPONSE_TYPE = "WebConnectionProtocol5ValidateAppIdentityFailedResponse"; export function isWebConnectionProtocol5ValidateAppIdentitySuccessResponse(value: any): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + return value != null && value.type === 'WCP5ValidateAppIdentityResponse'; +} + +export function isValidWebConnectionProtocol5ValidateAppIdentitySuccessResponse(value: any): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { try { Convert.webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson(value); return true; @@ -5925,6 +5890,10 @@ export function isWebConnectionProtocol5ValidateAppIdentitySuccessResponse(value export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_SUCCESS_RESPONSE_TYPE = "WebConnectionProtocol5ValidateAppIdentitySuccessResponse"; export function isWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { + return value != null && value.type === 'WCP6Goodbye'; +} + +export function isValidWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { try { Convert.webConnectionProtocol6GoodbyeToJson(value); return true; @@ -5935,7 +5904,7 @@ export function isWebConnectionProtocol6Goodbye(value: any): value is WebConnect export const WEB_CONNECTION_PROTOCOL6_GOODBYE_TYPE = "WebConnectionProtocol6Goodbye"; -export function isWebConnectionProtocolMessage(value: any): value is WebConnectionProtocolMessage { +export function isValidWebConnectionProtocolMessage(value: any): value is WebConnectionProtocolMessage { try { Convert.webConnectionProtocolMessageToJson(value); return true; @@ -5947,6 +5916,10 @@ export function isWebConnectionProtocolMessage(value: any): value is WebConnecti export const WEB_CONNECTION_PROTOCOL_MESSAGE_TYPE = "WebConnectionProtocolMessage"; export function isAddContextListenerRequest(value: any): value is AddContextListenerRequest { + return value != null && value.type === 'addContextListenerRequest'; +} + +export function isValidAddContextListenerRequest(value: any): value is AddContextListenerRequest { try { Convert.addContextListenerRequestToJson(value); return true; @@ -5958,6 +5931,10 @@ export function isAddContextListenerRequest(value: any): value is AddContextList export const ADD_CONTEXT_LISTENER_REQUEST_TYPE = "AddContextListenerRequest"; export function isAddContextListenerResponse(value: any): value is AddContextListenerResponse { + return value != null && value.type === 'addContextListenerResponse'; +} + +export function isValidAddContextListenerResponse(value: any): value is AddContextListenerResponse { try { Convert.addContextListenerResponseToJson(value); return true; @@ -5969,6 +5946,10 @@ export function isAddContextListenerResponse(value: any): value is AddContextLis export const ADD_CONTEXT_LISTENER_RESPONSE_TYPE = "AddContextListenerResponse"; export function isAddEventListenerRequest(value: any): value is AddEventListenerRequest { + return value != null && value.type === 'addEventListenerRequest'; +} + +export function isValidAddEventListenerRequest(value: any): value is AddEventListenerRequest { try { Convert.addEventListenerRequestToJson(value); return true; @@ -5980,6 +5961,10 @@ export function isAddEventListenerRequest(value: any): value is AddEventListener export const ADD_EVENT_LISTENER_REQUEST_TYPE = "AddEventListenerRequest"; export function isAddEventListenerResponse(value: any): value is AddEventListenerResponse { + return value != null && value.type === 'addEventListenerResponse'; +} + +export function isValidAddEventListenerResponse(value: any): value is AddEventListenerResponse { try { Convert.addEventListenerResponseToJson(value); return true; @@ -5991,6 +5976,10 @@ export function isAddEventListenerResponse(value: any): value is AddEventListene export const ADD_EVENT_LISTENER_RESPONSE_TYPE = "AddEventListenerResponse"; export function isAddIntentListenerRequest(value: any): value is AddIntentListenerRequest { + return value != null && value.type === 'addIntentListenerRequest'; +} + +export function isValidAddIntentListenerRequest(value: any): value is AddIntentListenerRequest { try { Convert.addIntentListenerRequestToJson(value); return true; @@ -6002,50 +5991,25 @@ export function isAddIntentListenerRequest(value: any): value is AddIntentListen export const ADD_INTENT_LISTENER_REQUEST_TYPE = "AddIntentListenerRequest"; export function isAddIntentListenerResponse(value: any): value is AddIntentListenerResponse { - try { - Convert.addIntentListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const ADD_INTENT_LISTENER_RESPONSE_TYPE = "AddIntentListenerResponse"; - -export function isAgentEventMessage(value: any): value is AgentEventMessage { - try { - Convert.agentEventMessageToJson(value); - return true; - } catch (_e: any) { - return false; - } + return value != null && value.type === 'addIntentListenerResponse'; } -export const AGENT_EVENT_MESSAGE_TYPE = "AgentEventMessage"; - -export function isAgentResponseMessage(value: any): value is AgentResponseMessage { +export function isValidAddIntentListenerResponse(value: any): value is AddIntentListenerResponse { try { - Convert.agentResponseMessageToJson(value); + Convert.addIntentListenerResponseToJson(value); return true; } catch (_e: any) { return false; } } -export const AGENT_RESPONSE_MESSAGE_TYPE = "AgentResponseMessage"; +export const ADD_INTENT_LISTENER_RESPONSE_TYPE = "AddIntentListenerResponse"; -export function isAppRequestMessage(value: any): value is AppRequestMessage { - try { - Convert.appRequestMessageToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isBroadcastEvent(value: any): value is BroadcastEvent { + return value != null && value.type === 'broadcastEvent'; } -export const APP_REQUEST_MESSAGE_TYPE = "AppRequestMessage"; - -export function isBroadcastEvent(value: any): value is BroadcastEvent { +export function isValidBroadcastEvent(value: any): value is BroadcastEvent { try { Convert.broadcastEventToJson(value); return true; @@ -6057,6 +6021,10 @@ export function isBroadcastEvent(value: any): value is BroadcastEvent { export const BROADCAST_EVENT_TYPE = "BroadcastEvent"; export function isBroadcastRequest(value: any): value is BroadcastRequest { + return value != null && value.type === 'broadcastRequest'; +} + +export function isValidBroadcastRequest(value: any): value is BroadcastRequest { try { Convert.broadcastRequestToJson(value); return true; @@ -6068,6 +6036,10 @@ export function isBroadcastRequest(value: any): value is BroadcastRequest { export const BROADCAST_REQUEST_TYPE = "BroadcastRequest"; export function isBroadcastResponse(value: any): value is BroadcastResponse { + return value != null && value.type === 'broadcastResponse'; +} + +export function isValidBroadcastResponse(value: any): value is BroadcastResponse { try { Convert.broadcastResponseToJson(value); return true; @@ -6079,6 +6051,10 @@ export function isBroadcastResponse(value: any): value is BroadcastResponse { export const BROADCAST_RESPONSE_TYPE = "BroadcastResponse"; export function isChannelChangedEvent(value: any): value is ChannelChangedEvent { + return value != null && value.type === 'channelChangedEvent'; +} + +export function isValidChannelChangedEvent(value: any): value is ChannelChangedEvent { try { Convert.channelChangedEventToJson(value); return true; @@ -6090,6 +6066,10 @@ export function isChannelChangedEvent(value: any): value is ChannelChangedEvent export const CHANNEL_CHANGED_EVENT_TYPE = "ChannelChangedEvent"; export function isContextListenerUnsubscribeRequest(value: any): value is ContextListenerUnsubscribeRequest { + return value != null && value.type === 'contextListenerUnsubscribeRequest'; +} + +export function isValidContextListenerUnsubscribeRequest(value: any): value is ContextListenerUnsubscribeRequest { try { Convert.contextListenerUnsubscribeRequestToJson(value); return true; @@ -6101,6 +6081,10 @@ export function isContextListenerUnsubscribeRequest(value: any): value is Contex export const CONTEXT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "ContextListenerUnsubscribeRequest"; export function isContextListenerUnsubscribeResponse(value: any): value is ContextListenerUnsubscribeResponse { + return value != null && value.type === 'contextListenerUnsubscribeResponse'; +} + +export function isValidContextListenerUnsubscribeResponse(value: any): value is ContextListenerUnsubscribeResponse { try { Convert.contextListenerUnsubscribeResponseToJson(value); return true; @@ -6112,6 +6096,10 @@ export function isContextListenerUnsubscribeResponse(value: any): value is Conte export const CONTEXT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "ContextListenerUnsubscribeResponse"; export function isCreatePrivateChannelRequest(value: any): value is CreatePrivateChannelRequest { + return value != null && value.type === 'createPrivateChannelRequest'; +} + +export function isValidCreatePrivateChannelRequest(value: any): value is CreatePrivateChannelRequest { try { Convert.createPrivateChannelRequestToJson(value); return true; @@ -6123,6 +6111,10 @@ export function isCreatePrivateChannelRequest(value: any): value is CreatePrivat export const CREATE_PRIVATE_CHANNEL_REQUEST_TYPE = "CreatePrivateChannelRequest"; export function isCreatePrivateChannelResponse(value: any): value is CreatePrivateChannelResponse { + return value != null && value.type === 'createPrivateChannelResponse'; +} + +export function isValidCreatePrivateChannelResponse(value: any): value is CreatePrivateChannelResponse { try { Convert.createPrivateChannelResponseToJson(value); return true; @@ -6134,6 +6126,10 @@ export function isCreatePrivateChannelResponse(value: any): value is CreatePriva export const CREATE_PRIVATE_CHANNEL_RESPONSE_TYPE = "CreatePrivateChannelResponse"; export function isEventListenerUnsubscribeRequest(value: any): value is EventListenerUnsubscribeRequest { + return value != null && value.type === 'eventListenerUnsubscribeRequest'; +} + +export function isValidEventListenerUnsubscribeRequest(value: any): value is EventListenerUnsubscribeRequest { try { Convert.eventListenerUnsubscribeRequestToJson(value); return true; @@ -6145,6 +6141,10 @@ export function isEventListenerUnsubscribeRequest(value: any): value is EventLis export const EVENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "EventListenerUnsubscribeRequest"; export function isEventListenerUnsubscribeResponse(value: any): value is EventListenerUnsubscribeResponse { + return value != null && value.type === 'eventListenerUnsubscribeResponse'; +} + +export function isValidEventListenerUnsubscribeResponse(value: any): value is EventListenerUnsubscribeResponse { try { Convert.eventListenerUnsubscribeResponseToJson(value); return true; @@ -6156,6 +6156,10 @@ export function isEventListenerUnsubscribeResponse(value: any): value is EventLi export const EVENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "EventListenerUnsubscribeResponse"; export function isFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { + return value != null && value.type === 'Fdc3UserInterfaceChannelSelected'; +} + +export function isValidFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { try { Convert.fdc3UserInterfaceChannelSelectedToJson(value); return true; @@ -6167,6 +6171,10 @@ export function isFdc3UserInterfaceChannelSelected(value: any): value is Fdc3Use export const FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE = "Fdc3UserInterfaceChannelSelected"; export function isFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { + return value != null && value.type === 'Fdc3UserInterfaceChannels'; +} + +export function isValidFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { try { Convert.fdc3UserInterfaceChannelsToJson(value); return true; @@ -6178,6 +6186,10 @@ export function isFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterf export const FDC3_USER_INTERFACE_CHANNELS_TYPE = "Fdc3UserInterfaceChannels"; export function isFdc3UserInterfaceDrag(value: any): value is Fdc3UserInterfaceDrag { + return value != null && value.type === 'Fdc3UserInterfaceDrag'; +} + +export function isValidFdc3UserInterfaceDrag(value: any): value is Fdc3UserInterfaceDrag { try { Convert.fdc3UserInterfaceDragToJson(value); return true; @@ -6189,6 +6201,10 @@ export function isFdc3UserInterfaceDrag(value: any): value is Fdc3UserInterfaceD export const FDC3_USER_INTERFACE_DRAG_TYPE = "Fdc3UserInterfaceDrag"; export function isFdc3UserInterfaceHandshake(value: any): value is Fdc3UserInterfaceHandshake { + return value != null && value.type === 'Fdc3UserInterfaceHandshake'; +} + +export function isValidFdc3UserInterfaceHandshake(value: any): value is Fdc3UserInterfaceHandshake { try { Convert.fdc3UserInterfaceHandshakeToJson(value); return true; @@ -6200,6 +6216,10 @@ export function isFdc3UserInterfaceHandshake(value: any): value is Fdc3UserInter export const FDC3_USER_INTERFACE_HANDSHAKE_TYPE = "Fdc3UserInterfaceHandshake"; export function isFdc3UserInterfaceHello(value: any): value is Fdc3UserInterfaceHello { + return value != null && value.type === 'Fdc3UserInterfaceHello'; +} + +export function isValidFdc3UserInterfaceHello(value: any): value is Fdc3UserInterfaceHello { try { Convert.fdc3UserInterfaceHelloToJson(value); return true; @@ -6210,7 +6230,7 @@ export function isFdc3UserInterfaceHello(value: any): value is Fdc3UserInterface export const FDC3_USER_INTERFACE_HELLO_TYPE = "Fdc3UserInterfaceHello"; -export function isFdc3UserInterfaceMessage(value: any): value is Fdc3UserInterfaceMessage { +export function isValidFdc3UserInterfaceMessage(value: any): value is Fdc3UserInterfaceMessage { try { Convert.fdc3UserInterfaceMessageToJson(value); return true; @@ -6222,6 +6242,10 @@ export function isFdc3UserInterfaceMessage(value: any): value is Fdc3UserInterfa export const FDC3_USER_INTERFACE_MESSAGE_TYPE = "Fdc3UserInterfaceMessage"; export function isFdc3UserInterfaceResolve(value: any): value is Fdc3UserInterfaceResolve { + return value != null && value.type === 'Fdc3UserInterfaceResolve'; +} + +export function isValidFdc3UserInterfaceResolve(value: any): value is Fdc3UserInterfaceResolve { try { Convert.fdc3UserInterfaceResolveToJson(value); return true; @@ -6233,6 +6257,10 @@ export function isFdc3UserInterfaceResolve(value: any): value is Fdc3UserInterfa export const FDC3_USER_INTERFACE_RESOLVE_TYPE = "Fdc3UserInterfaceResolve"; export function isFdc3UserInterfaceResolveAction(value: any): value is Fdc3UserInterfaceResolveAction { + return value != null && value.type === 'Fdc3UserInterfaceResolveAction'; +} + +export function isValidFdc3UserInterfaceResolveAction(value: any): value is Fdc3UserInterfaceResolveAction { try { Convert.fdc3UserInterfaceResolveActionToJson(value); return true; @@ -6244,6 +6272,10 @@ export function isFdc3UserInterfaceResolveAction(value: any): value is Fdc3UserI export const FDC3_USER_INTERFACE_RESOLVE_ACTION_TYPE = "Fdc3UserInterfaceResolveAction"; export function isFdc3UserInterfaceRestyle(value: any): value is Fdc3UserInterfaceRestyle { + return value != null && value.type === 'Fdc3UserInterfaceRestyle'; +} + +export function isValidFdc3UserInterfaceRestyle(value: any): value is Fdc3UserInterfaceRestyle { try { Convert.fdc3UserInterfaceRestyleToJson(value); return true; @@ -6255,6 +6287,10 @@ export function isFdc3UserInterfaceRestyle(value: any): value is Fdc3UserInterfa export const FDC3_USER_INTERFACE_RESTYLE_TYPE = "Fdc3UserInterfaceRestyle"; export function isFindInstancesRequest(value: any): value is FindInstancesRequest { + return value != null && value.type === 'findInstancesRequest'; +} + +export function isValidFindInstancesRequest(value: any): value is FindInstancesRequest { try { Convert.findInstancesRequestToJson(value); return true; @@ -6266,6 +6302,10 @@ export function isFindInstancesRequest(value: any): value is FindInstancesReques export const FIND_INSTANCES_REQUEST_TYPE = "FindInstancesRequest"; export function isFindInstancesResponse(value: any): value is FindInstancesResponse { + return value != null && value.type === 'findInstancesResponse'; +} + +export function isValidFindInstancesResponse(value: any): value is FindInstancesResponse { try { Convert.findInstancesResponseToJson(value); return true; @@ -6277,6 +6317,10 @@ export function isFindInstancesResponse(value: any): value is FindInstancesRespo export const FIND_INSTANCES_RESPONSE_TYPE = "FindInstancesResponse"; export function isFindIntentRequest(value: any): value is FindIntentRequest { + return value != null && value.type === 'findIntentRequest'; +} + +export function isValidFindIntentRequest(value: any): value is FindIntentRequest { try { Convert.findIntentRequestToJson(value); return true; @@ -6288,6 +6332,10 @@ export function isFindIntentRequest(value: any): value is FindIntentRequest { export const FIND_INTENT_REQUEST_TYPE = "FindIntentRequest"; export function isFindIntentResponse(value: any): value is FindIntentResponse { + return value != null && value.type === 'findIntentResponse'; +} + +export function isValidFindIntentResponse(value: any): value is FindIntentResponse { try { Convert.findIntentResponseToJson(value); return true; @@ -6299,6 +6347,10 @@ export function isFindIntentResponse(value: any): value is FindIntentResponse { export const FIND_INTENT_RESPONSE_TYPE = "FindIntentResponse"; export function isFindIntentsByContextRequest(value: any): value is FindIntentsByContextRequest { + return value != null && value.type === 'findIntentsByContextRequest'; +} + +export function isValidFindIntentsByContextRequest(value: any): value is FindIntentsByContextRequest { try { Convert.findIntentsByContextRequestToJson(value); return true; @@ -6310,6 +6362,10 @@ export function isFindIntentsByContextRequest(value: any): value is FindIntentsB export const FIND_INTENTS_BY_CONTEXT_REQUEST_TYPE = "FindIntentsByContextRequest"; export function isFindIntentsByContextResponse(value: any): value is FindIntentsByContextResponse { + return value != null && value.type === 'findIntentsByContextResponse'; +} + +export function isValidFindIntentsByContextResponse(value: any): value is FindIntentsByContextResponse { try { Convert.findIntentsByContextResponseToJson(value); return true; @@ -6321,6 +6377,10 @@ export function isFindIntentsByContextResponse(value: any): value is FindIntents export const FIND_INTENTS_BY_CONTEXT_RESPONSE_TYPE = "FindIntentsByContextResponse"; export function isGetAppMetadataRequest(value: any): value is GetAppMetadataRequest { + return value != null && value.type === 'getAppMetadataRequest'; +} + +export function isValidGetAppMetadataRequest(value: any): value is GetAppMetadataRequest { try { Convert.getAppMetadataRequestToJson(value); return true; @@ -6332,6 +6392,10 @@ export function isGetAppMetadataRequest(value: any): value is GetAppMetadataRequ export const GET_APP_METADATA_REQUEST_TYPE = "GetAppMetadataRequest"; export function isGetAppMetadataResponse(value: any): value is GetAppMetadataResponse { + return value != null && value.type === 'getAppMetadataResponse'; +} + +export function isValidGetAppMetadataResponse(value: any): value is GetAppMetadataResponse { try { Convert.getAppMetadataResponseToJson(value); return true; @@ -6343,6 +6407,10 @@ export function isGetAppMetadataResponse(value: any): value is GetAppMetadataRes export const GET_APP_METADATA_RESPONSE_TYPE = "GetAppMetadataResponse"; export function isGetCurrentChannelRequest(value: any): value is GetCurrentChannelRequest { + return value != null && value.type === 'getCurrentChannelRequest'; +} + +export function isValidGetCurrentChannelRequest(value: any): value is GetCurrentChannelRequest { try { Convert.getCurrentChannelRequestToJson(value); return true; @@ -6354,6 +6422,10 @@ export function isGetCurrentChannelRequest(value: any): value is GetCurrentChann export const GET_CURRENT_CHANNEL_REQUEST_TYPE = "GetCurrentChannelRequest"; export function isGetCurrentChannelResponse(value: any): value is GetCurrentChannelResponse { + return value != null && value.type === 'getCurrentChannelResponse'; +} + +export function isValidGetCurrentChannelResponse(value: any): value is GetCurrentChannelResponse { try { Convert.getCurrentChannelResponseToJson(value); return true; @@ -6365,6 +6437,10 @@ export function isGetCurrentChannelResponse(value: any): value is GetCurrentChan export const GET_CURRENT_CHANNEL_RESPONSE_TYPE = "GetCurrentChannelResponse"; export function isGetCurrentContextRequest(value: any): value is GetCurrentContextRequest { + return value != null && value.type === 'getCurrentContextRequest'; +} + +export function isValidGetCurrentContextRequest(value: any): value is GetCurrentContextRequest { try { Convert.getCurrentContextRequestToJson(value); return true; @@ -6376,6 +6452,10 @@ export function isGetCurrentContextRequest(value: any): value is GetCurrentConte export const GET_CURRENT_CONTEXT_REQUEST_TYPE = "GetCurrentContextRequest"; export function isGetCurrentContextResponse(value: any): value is GetCurrentContextResponse { + return value != null && value.type === 'getCurrentContextResponse'; +} + +export function isValidGetCurrentContextResponse(value: any): value is GetCurrentContextResponse { try { Convert.getCurrentContextResponseToJson(value); return true; @@ -6387,6 +6467,10 @@ export function isGetCurrentContextResponse(value: any): value is GetCurrentCont export const GET_CURRENT_CONTEXT_RESPONSE_TYPE = "GetCurrentContextResponse"; export function isGetInfoRequest(value: any): value is GetInfoRequest { + return value != null && value.type === 'getInfoRequest'; +} + +export function isValidGetInfoRequest(value: any): value is GetInfoRequest { try { Convert.getInfoRequestToJson(value); return true; @@ -6398,6 +6482,10 @@ export function isGetInfoRequest(value: any): value is GetInfoRequest { export const GET_INFO_REQUEST_TYPE = "GetInfoRequest"; export function isGetInfoResponse(value: any): value is GetInfoResponse { + return value != null && value.type === 'getInfoResponse'; +} + +export function isValidGetInfoResponse(value: any): value is GetInfoResponse { try { Convert.getInfoResponseToJson(value); return true; @@ -6409,6 +6497,10 @@ export function isGetInfoResponse(value: any): value is GetInfoResponse { export const GET_INFO_RESPONSE_TYPE = "GetInfoResponse"; export function isGetOrCreateChannelRequest(value: any): value is GetOrCreateChannelRequest { + return value != null && value.type === 'getOrCreateChannelRequest'; +} + +export function isValidGetOrCreateChannelRequest(value: any): value is GetOrCreateChannelRequest { try { Convert.getOrCreateChannelRequestToJson(value); return true; @@ -6420,6 +6512,10 @@ export function isGetOrCreateChannelRequest(value: any): value is GetOrCreateCha export const GET_OR_CREATE_CHANNEL_REQUEST_TYPE = "GetOrCreateChannelRequest"; export function isGetOrCreateChannelResponse(value: any): value is GetOrCreateChannelResponse { + return value != null && value.type === 'getOrCreateChannelResponse'; +} + +export function isValidGetOrCreateChannelResponse(value: any): value is GetOrCreateChannelResponse { try { Convert.getOrCreateChannelResponseToJson(value); return true; @@ -6431,6 +6527,10 @@ export function isGetOrCreateChannelResponse(value: any): value is GetOrCreateCh export const GET_OR_CREATE_CHANNEL_RESPONSE_TYPE = "GetOrCreateChannelResponse"; export function isGetUserChannelsRequest(value: any): value is GetUserChannelsRequest { + return value != null && value.type === 'getUserChannelsRequest'; +} + +export function isValidGetUserChannelsRequest(value: any): value is GetUserChannelsRequest { try { Convert.getUserChannelsRequestToJson(value); return true; @@ -6442,6 +6542,10 @@ export function isGetUserChannelsRequest(value: any): value is GetUserChannelsRe export const GET_USER_CHANNELS_REQUEST_TYPE = "GetUserChannelsRequest"; export function isGetUserChannelsResponse(value: any): value is GetUserChannelsResponse { + return value != null && value.type === 'getUserChannelsResponse'; +} + +export function isValidGetUserChannelsResponse(value: any): value is GetUserChannelsResponse { try { Convert.getUserChannelsResponseToJson(value); return true; @@ -6453,6 +6557,10 @@ export function isGetUserChannelsResponse(value: any): value is GetUserChannelsR export const GET_USER_CHANNELS_RESPONSE_TYPE = "GetUserChannelsResponse"; export function isHeartbeatAcknowledgementRequest(value: any): value is HeartbeatAcknowledgementRequest { + return value != null && value.type === 'heartbeatAcknowledgementRequest'; +} + +export function isValidHeartbeatAcknowledgementRequest(value: any): value is HeartbeatAcknowledgementRequest { try { Convert.heartbeatAcknowledgementRequestToJson(value); return true; @@ -6464,6 +6572,10 @@ export function isHeartbeatAcknowledgementRequest(value: any): value is Heartbea export const HEARTBEAT_ACKNOWLEDGEMENT_REQUEST_TYPE = "HeartbeatAcknowledgementRequest"; export function isHeartbeatEvent(value: any): value is HeartbeatEvent { + return value != null && value.type === 'heartbeatEvent'; +} + +export function isValidHeartbeatEvent(value: any): value is HeartbeatEvent { try { Convert.heartbeatEventToJson(value); return true; @@ -6475,6 +6587,10 @@ export function isHeartbeatEvent(value: any): value is HeartbeatEvent { export const HEARTBEAT_EVENT_TYPE = "HeartbeatEvent"; export function isIntentEvent(value: any): value is IntentEvent { + return value != null && value.type === 'intentEvent'; +} + +export function isValidIntentEvent(value: any): value is IntentEvent { try { Convert.intentEventToJson(value); return true; @@ -6486,6 +6602,10 @@ export function isIntentEvent(value: any): value is IntentEvent { export const INTENT_EVENT_TYPE = "IntentEvent"; export function isIntentListenerUnsubscribeRequest(value: any): value is IntentListenerUnsubscribeRequest { + return value != null && value.type === 'intentListenerUnsubscribeRequest'; +} + +export function isValidIntentListenerUnsubscribeRequest(value: any): value is IntentListenerUnsubscribeRequest { try { Convert.intentListenerUnsubscribeRequestToJson(value); return true; @@ -6497,6 +6617,10 @@ export function isIntentListenerUnsubscribeRequest(value: any): value is IntentL export const INTENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "IntentListenerUnsubscribeRequest"; export function isIntentListenerUnsubscribeResponse(value: any): value is IntentListenerUnsubscribeResponse { + return value != null && value.type === 'intentListenerUnsubscribeResponse'; +} + +export function isValidIntentListenerUnsubscribeResponse(value: any): value is IntentListenerUnsubscribeResponse { try { Convert.intentListenerUnsubscribeResponseToJson(value); return true; @@ -6508,6 +6632,10 @@ export function isIntentListenerUnsubscribeResponse(value: any): value is Intent export const INTENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "IntentListenerUnsubscribeResponse"; export function isIntentResultRequest(value: any): value is IntentResultRequest { + return value != null && value.type === 'intentResultRequest'; +} + +export function isValidIntentResultRequest(value: any): value is IntentResultRequest { try { Convert.intentResultRequestToJson(value); return true; @@ -6519,6 +6647,10 @@ export function isIntentResultRequest(value: any): value is IntentResultRequest export const INTENT_RESULT_REQUEST_TYPE = "IntentResultRequest"; export function isIntentResultResponse(value: any): value is IntentResultResponse { + return value != null && value.type === 'intentResultResponse'; +} + +export function isValidIntentResultResponse(value: any): value is IntentResultResponse { try { Convert.intentResultResponseToJson(value); return true; @@ -6530,6 +6662,10 @@ export function isIntentResultResponse(value: any): value is IntentResultRespons export const INTENT_RESULT_RESPONSE_TYPE = "IntentResultResponse"; export function isJoinUserChannelRequest(value: any): value is JoinUserChannelRequest { + return value != null && value.type === 'joinUserChannelRequest'; +} + +export function isValidJoinUserChannelRequest(value: any): value is JoinUserChannelRequest { try { Convert.joinUserChannelRequestToJson(value); return true; @@ -6541,6 +6677,10 @@ export function isJoinUserChannelRequest(value: any): value is JoinUserChannelRe export const JOIN_USER_CHANNEL_REQUEST_TYPE = "JoinUserChannelRequest"; export function isJoinUserChannelResponse(value: any): value is JoinUserChannelResponse { + return value != null && value.type === 'joinUserChannelResponse'; +} + +export function isValidJoinUserChannelResponse(value: any): value is JoinUserChannelResponse { try { Convert.joinUserChannelResponseToJson(value); return true; @@ -6552,6 +6692,10 @@ export function isJoinUserChannelResponse(value: any): value is JoinUserChannelR export const JOIN_USER_CHANNEL_RESPONSE_TYPE = "JoinUserChannelResponse"; export function isLeaveCurrentChannelRequest(value: any): value is LeaveCurrentChannelRequest { + return value != null && value.type === 'leaveCurrentChannelRequest'; +} + +export function isValidLeaveCurrentChannelRequest(value: any): value is LeaveCurrentChannelRequest { try { Convert.leaveCurrentChannelRequestToJson(value); return true; @@ -6563,6 +6707,10 @@ export function isLeaveCurrentChannelRequest(value: any): value is LeaveCurrentC export const LEAVE_CURRENT_CHANNEL_REQUEST_TYPE = "LeaveCurrentChannelRequest"; export function isLeaveCurrentChannelResponse(value: any): value is LeaveCurrentChannelResponse { + return value != null && value.type === 'leaveCurrentChannelResponse'; +} + +export function isValidLeaveCurrentChannelResponse(value: any): value is LeaveCurrentChannelResponse { try { Convert.leaveCurrentChannelResponseToJson(value); return true; @@ -6574,6 +6722,10 @@ export function isLeaveCurrentChannelResponse(value: any): value is LeaveCurrent export const LEAVE_CURRENT_CHANNEL_RESPONSE_TYPE = "LeaveCurrentChannelResponse"; export function isOpenRequest(value: any): value is OpenRequest { + return value != null && value.type === 'openRequest'; +} + +export function isValidOpenRequest(value: any): value is OpenRequest { try { Convert.openRequestToJson(value); return true; @@ -6585,6 +6737,10 @@ export function isOpenRequest(value: any): value is OpenRequest { export const OPEN_REQUEST_TYPE = "OpenRequest"; export function isOpenResponse(value: any): value is OpenResponse { + return value != null && value.type === 'openResponse'; +} + +export function isValidOpenResponse(value: any): value is OpenResponse { try { Convert.openResponseToJson(value); return true; @@ -6596,6 +6752,10 @@ export function isOpenResponse(value: any): value is OpenResponse { export const OPEN_RESPONSE_TYPE = "OpenResponse"; export function isPrivateChannelAddEventListenerRequest(value: any): value is PrivateChannelAddEventListenerRequest { + return value != null && value.type === 'privateChannelAddEventListenerRequest'; +} + +export function isValidPrivateChannelAddEventListenerRequest(value: any): value is PrivateChannelAddEventListenerRequest { try { Convert.privateChannelAddEventListenerRequestToJson(value); return true; @@ -6607,6 +6767,10 @@ export function isPrivateChannelAddEventListenerRequest(value: any): value is Pr export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_REQUEST_TYPE = "PrivateChannelAddEventListenerRequest"; export function isPrivateChannelAddEventListenerResponse(value: any): value is PrivateChannelAddEventListenerResponse { + return value != null && value.type === 'privateChannelAddEventListenerResponse'; +} + +export function isValidPrivateChannelAddEventListenerResponse(value: any): value is PrivateChannelAddEventListenerResponse { try { Convert.privateChannelAddEventListenerResponseToJson(value); return true; @@ -6618,6 +6782,10 @@ export function isPrivateChannelAddEventListenerResponse(value: any): value is P export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_RESPONSE_TYPE = "PrivateChannelAddEventListenerResponse"; export function isPrivateChannelDisconnectRequest(value: any): value is PrivateChannelDisconnectRequest { + return value != null && value.type === 'privateChannelDisconnectRequest'; +} + +export function isValidPrivateChannelDisconnectRequest(value: any): value is PrivateChannelDisconnectRequest { try { Convert.privateChannelDisconnectRequestToJson(value); return true; @@ -6629,6 +6797,10 @@ export function isPrivateChannelDisconnectRequest(value: any): value is PrivateC export const PRIVATE_CHANNEL_DISCONNECT_REQUEST_TYPE = "PrivateChannelDisconnectRequest"; export function isPrivateChannelDisconnectResponse(value: any): value is PrivateChannelDisconnectResponse { + return value != null && value.type === 'privateChannelDisconnectResponse'; +} + +export function isValidPrivateChannelDisconnectResponse(value: any): value is PrivateChannelDisconnectResponse { try { Convert.privateChannelDisconnectResponseToJson(value); return true; @@ -6640,6 +6812,10 @@ export function isPrivateChannelDisconnectResponse(value: any): value is Private export const PRIVATE_CHANNEL_DISCONNECT_RESPONSE_TYPE = "PrivateChannelDisconnectResponse"; export function isPrivateChannelOnAddContextListenerEvent(value: any): value is PrivateChannelOnAddContextListenerEvent { + return value != null && value.type === 'privateChannelOnAddContextListenerEvent'; +} + +export function isValidPrivateChannelOnAddContextListenerEvent(value: any): value is PrivateChannelOnAddContextListenerEvent { try { Convert.privateChannelOnAddContextListenerEventToJson(value); return true; @@ -6651,6 +6827,10 @@ export function isPrivateChannelOnAddContextListenerEvent(value: any): value is export const PRIVATE_CHANNEL_ON_ADD_CONTEXT_LISTENER_EVENT_TYPE = "PrivateChannelOnAddContextListenerEvent"; export function isPrivateChannelOnDisconnectEvent(value: any): value is PrivateChannelOnDisconnectEvent { + return value != null && value.type === 'privateChannelOnDisconnectEvent'; +} + +export function isValidPrivateChannelOnDisconnectEvent(value: any): value is PrivateChannelOnDisconnectEvent { try { Convert.privateChannelOnDisconnectEventToJson(value); return true; @@ -6662,6 +6842,10 @@ export function isPrivateChannelOnDisconnectEvent(value: any): value is PrivateC export const PRIVATE_CHANNEL_ON_DISCONNECT_EVENT_TYPE = "PrivateChannelOnDisconnectEvent"; export function isPrivateChannelOnUnsubscribeEvent(value: any): value is PrivateChannelOnUnsubscribeEvent { + return value != null && value.type === 'privateChannelOnUnsubscribeEvent'; +} + +export function isValidPrivateChannelOnUnsubscribeEvent(value: any): value is PrivateChannelOnUnsubscribeEvent { try { Convert.privateChannelOnUnsubscribeEventToJson(value); return true; @@ -6673,6 +6857,10 @@ export function isPrivateChannelOnUnsubscribeEvent(value: any): value is Private export const PRIVATE_CHANNEL_ON_UNSUBSCRIBE_EVENT_TYPE = "PrivateChannelOnUnsubscribeEvent"; export function isPrivateChannelUnsubscribeEventListenerRequest(value: any): value is PrivateChannelUnsubscribeEventListenerRequest { + return value != null && value.type === 'privateChannelUnsubscribeEventListenerRequest'; +} + +export function isValidPrivateChannelUnsubscribeEventListenerRequest(value: any): value is PrivateChannelUnsubscribeEventListenerRequest { try { Convert.privateChannelUnsubscribeEventListenerRequestToJson(value); return true; @@ -6684,6 +6872,10 @@ export function isPrivateChannelUnsubscribeEventListenerRequest(value: any): val export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_REQUEST_TYPE = "PrivateChannelUnsubscribeEventListenerRequest"; export function isPrivateChannelUnsubscribeEventListenerResponse(value: any): value is PrivateChannelUnsubscribeEventListenerResponse { + return value != null && value.type === 'privateChannelUnsubscribeEventListenerResponse'; +} + +export function isValidPrivateChannelUnsubscribeEventListenerResponse(value: any): value is PrivateChannelUnsubscribeEventListenerResponse { try { Convert.privateChannelUnsubscribeEventListenerResponseToJson(value); return true; @@ -6695,6 +6887,10 @@ export function isPrivateChannelUnsubscribeEventListenerResponse(value: any): va export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_RESPONSE_TYPE = "PrivateChannelUnsubscribeEventListenerResponse"; export function isRaiseIntentForContextRequest(value: any): value is RaiseIntentForContextRequest { + return value != null && value.type === 'raiseIntentForContextRequest'; +} + +export function isValidRaiseIntentForContextRequest(value: any): value is RaiseIntentForContextRequest { try { Convert.raiseIntentForContextRequestToJson(value); return true; @@ -6706,6 +6902,10 @@ export function isRaiseIntentForContextRequest(value: any): value is RaiseIntent export const RAISE_INTENT_FOR_CONTEXT_REQUEST_TYPE = "RaiseIntentForContextRequest"; export function isRaiseIntentForContextResponse(value: any): value is RaiseIntentForContextResponse { + return value != null && value.type === 'raiseIntentForContextResponse'; +} + +export function isValidRaiseIntentForContextResponse(value: any): value is RaiseIntentForContextResponse { try { Convert.raiseIntentForContextResponseToJson(value); return true; @@ -6717,6 +6917,10 @@ export function isRaiseIntentForContextResponse(value: any): value is RaiseInten export const RAISE_INTENT_FOR_CONTEXT_RESPONSE_TYPE = "RaiseIntentForContextResponse"; export function isRaiseIntentRequest(value: any): value is RaiseIntentRequest { + return value != null && value.type === 'raiseIntentRequest'; +} + +export function isValidRaiseIntentRequest(value: any): value is RaiseIntentRequest { try { Convert.raiseIntentRequestToJson(value); return true; @@ -6728,6 +6932,10 @@ export function isRaiseIntentRequest(value: any): value is RaiseIntentRequest { export const RAISE_INTENT_REQUEST_TYPE = "RaiseIntentRequest"; export function isRaiseIntentResponse(value: any): value is RaiseIntentResponse { + return value != null && value.type === 'raiseIntentResponse'; +} + +export function isValidRaiseIntentResponse(value: any): value is RaiseIntentResponse { try { Convert.raiseIntentResponseToJson(value); return true; @@ -6739,6 +6947,10 @@ export function isRaiseIntentResponse(value: any): value is RaiseIntentResponse export const RAISE_INTENT_RESPONSE_TYPE = "RaiseIntentResponse"; export function isRaiseIntentResultResponse(value: any): value is RaiseIntentResultResponse { + return value != null && value.type === 'raiseIntentResultResponse'; +} + +export function isValidRaiseIntentResultResponse(value: any): value is RaiseIntentResultResponse { try { Convert.raiseIntentResultResponseToJson(value); return true; @@ -6747,91 +6959,4 @@ export function isRaiseIntentResultResponse(value: any): value is RaiseIntentRes } } -export const RAISE_INTENT_RESULT_RESPONSE_TYPE = "RaiseIntentResultResponse"; - -export type RequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest | BroadcastRequest | ContextListenerUnsubscribeRequest | CreatePrivateChannelRequest | EventListenerUnsubscribeRequest | FindInstancesRequest | FindIntentRequest | FindIntentsByContextRequest | GetAppMetadataRequest | GetCurrentChannelRequest | GetCurrentContextRequest | GetInfoRequest | GetOrCreateChannelRequest | GetUserChannelsRequest | HeartbeatAcknowledgementRequest | IntentListenerUnsubscribeRequest | IntentResultRequest | JoinUserChannelRequest | LeaveCurrentChannelRequest | OpenRequest | PrivateChannelAddEventListenerRequest | PrivateChannelDisconnectRequest | PrivateChannelUnsubscribeEventListenerRequest | RaiseIntentForContextRequest | RaiseIntentRequest; - -export type ResponseMessage = WebConnectionProtocol5ValidateAppIdentityFailedResponse | WebConnectionProtocol5ValidateAppIdentitySuccessResponse | AddContextListenerResponse | AddEventListenerResponse | AddIntentListenerResponse | BroadcastResponse | ContextListenerUnsubscribeResponse | CreatePrivateChannelResponse | EventListenerUnsubscribeResponse | FindInstancesResponse | FindIntentResponse | FindIntentsByContextResponse | GetAppMetadataResponse | GetCurrentChannelResponse | GetCurrentContextResponse | GetInfoResponse | GetOrCreateChannelResponse | GetUserChannelsResponse | IntentListenerUnsubscribeResponse | IntentResultResponse | JoinUserChannelResponse | LeaveCurrentChannelResponse | OpenResponse | PrivateChannelAddEventListenerResponse | PrivateChannelDisconnectResponse | PrivateChannelUnsubscribeEventListenerResponse | RaiseIntentForContextResponse | RaiseIntentResponse | RaiseIntentResultResponse; - -export type EventMessage = BroadcastEvent | ChannelChangedEvent | HeartbeatEvent | IntentEvent | PrivateChannelOnAddContextListenerEvent | PrivateChannelOnDisconnectEvent | PrivateChannelOnUnsubscribeEvent; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +export const RAISE_INTENT_RESULT_RESPONSE_TYPE = "RaiseIntentResultResponse";