From 113742e0b5a56d286b2988e8eb5153d34135c153 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 3 Oct 2023 11:20:15 +0100 Subject: [PATCH 1/7] Generate zod schemas for bridging with quicktype --- package.json | 3 +- s2zodQuicktypeUtil.js | 57 + src/bridging/BridgingZodSchemas.ts | 1926 ++++++++++++++++++++++++++++ 3 files changed, 1985 insertions(+), 1 deletion(-) create mode 100644 s2zodQuicktypeUtil.js create mode 100644 src/bridging/BridgingZodSchemas.ts diff --git a/package.json b/package.json index 0d0cc4d12..4f25cd37c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "preprepare": "npm run typegen && npm run typegen-bridging", "prepare": "tsdx build", "typegen": "node s2tQuicktypeUtil.js schemas/context src/context/ContextTypes.ts && tsdx lint src/context/ --fix", - "typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix" + "typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix", + "typegen-bridging-zod": "node s2zodQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingZodSchemas.ts" }, "peerDependencies": {}, "husky": { diff --git a/s2zodQuicktypeUtil.js b/s2zodQuicktypeUtil.js new file mode 100644 index 000000000..51557db59 --- /dev/null +++ b/s2zodQuicktypeUtil.js @@ -0,0 +1,57 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * Copyright FINOS FDC3 contributors - see NOTICE file + */ + +/** Utility for preparing arguments to quicktype, which workaround a specific + * quicktype bug in command line argument handling (where a directory is used + * as input the source language argument is ignored which causes our schemas + * to be interpreted as JSON input, rather than JSONSchema). + * Bug issue: + * */ + +const path = require('path'); +const fs = require('fs'); +const exec = require('child_process').exec; + +const args = process.argv.slice(2); +const outputFile = args.pop(); +const inputs = args; + +console.log('Inputs: ' + inputs.join(' | ')); +console.log('Output file argument: ' + outputFile); + +let sources = ''; + +let dirIndex = 0; + +while (dirIndex < inputs.length) { + if (inputs[dirIndex].endsWith('.schema.json')) { + sources += `--src ${path.join(inputs[dirIndex])} `; + } else { + fs.readdirSync(inputs[dirIndex], { withFileTypes: true }).forEach(file => { + if (file.isDirectory()) { + inputs.push(path.join(inputs[dirIndex], file.name)); + } else if (file.name.endsWith('.schema.json')) { + sources += `--src ${path.join(inputs[dirIndex], file.name)} `; + } + }); + } + dirIndex++; +} + +// Normalise path to local quicktype executable. +//const quicktypeExec = ['.', 'node_modules', '.bin', 'quicktype'].join(path.sep); +const quicktypeExec = "node --stack_trace_limit=100 --max-old-space-size=4096 \"../quicktype/dist/index.js\"" + +const command = `${quicktypeExec} --no-combine-classes -s schema -l typescript-zod -o ${outputFile} ${sources}`; +console.log('command to run: ' + command); + +exec(command, function(error, stdout, stderr) { + if (stdout) { + console.log(stdout); + } + if (stderr) { + console.log(stderr); + } +}); diff --git a/src/bridging/BridgingZodSchemas.ts b/src/bridging/BridgingZodSchemas.ts new file mode 100644 index 000000000..05ed2e131 --- /dev/null +++ b/src/bridging/BridgingZodSchemas.ts @@ -0,0 +1,1926 @@ +import * as z from "zod"; + +// Array of error message strings for responses that were not returned to the bridge before +// the timeout or because an error occurred. Should be the same length as the `errorSources` +// array and ordered the same. May be omitted if all sources responded without errors. +// +// Constants representing the errors that can be encountered when calling the `open` method +// on the DesktopAgent object (`fdc3`). +// +// Constants representing the errors that can be encountered when calling the `findIntent`, +// `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the +// DesktopAgent (`fdc3`). + +export const ResponseErrorDetailSchema = z.enum([ + "AccessDenied", + "AgentDisconnected", + "AppNotFound", + "AppTimeout", + "CreationFailed", + "DesktopAgentNotFound", + "ErrorOnLaunch", + "IntentDeliveryFailed", + "IntentHandlerRejected", + "MalformedContext", + "MalformedMessage", + "NoAppsFound", + "NoChannelFound", + "NoResultReturned", + "NotConnectedToBridge", + "ResolverTimeout", + "ResolverUnavailable", + "ResponseToBridgeTimedOut", + "TargetAppUnavailable", + "TargetInstanceUnavailable", + "UserCancelledResolution", +]); +export type ResponseErrorDetail = z.infer; + +// 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. + +export const ResponseMessageTypeSchema = z.enum([ + "findInstancesResponse", + "findIntentResponse", + "findIntentsByContextResponse", + "getAppMetadataResponse", + "openResponse", + "raiseIntentResponse", + "raiseIntentResultResponse", +]); +export type ResponseMessageType = z.infer; + +// 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. + +export const RequestMessageTypeSchema = z.enum([ + "broadcastRequest", + "findInstancesRequest", + "findIntentRequest", + "findIntentsByContextRequest", + "getAppMetadataRequest", + "openRequest", + "PrivateChannel.broadcast", + "PrivateChannel.eventListenerAdded", + "PrivateChannel.eventListenerRemoved", + "PrivateChannel.onAddContextListener", + "PrivateChannel.onDisconnect", + "PrivateChannel.onUnsubscribe", + "raiseIntentRequest", +]); +export type RequestMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const BroadcastRequestMessageTypeSchema = z.enum([ + "broadcastRequest", +]); +export type BroadcastRequestMessageType = z.infer; + +// Identifies the type of the connection step message. + +export const ConnectionStepMessageTypeSchema = z.enum([ + "authenticationFailed", + "connectedAgentsUpdate", + "handshake", + "hello", +]); +export type ConnectionStepMessageType = z.infer; + +// Identifies the type of the connection step message. + +export const ConnectionStep2HelloTypeSchema = z.enum([ + "hello", +]); +export type ConnectionStep2HelloType = z.infer; + +// Identifies the type of the connection step message. + +export const ConnectionStep3HandshakeTypeSchema = z.enum([ + "handshake", +]); +export type ConnectionStep3HandshakeType = z.infer; + +// Identifies the type of the connection step message. + +export const ConnectionStep4AuthenticationFailedTypeSchema = z.enum([ + "authenticationFailed", +]); +export type ConnectionStep4AuthenticationFailedType = z.infer; + +// Identifies the type of the connection step message. + +export const ConnectionStep6ConnectedAgentsUpdateTypeSchema = z.enum([ + "connectedAgentsUpdate", +]); +export type ConnectionStep6ConnectedAgentsUpdateType = z.infer; + +// Constants representing the errors that can be encountered when calling the `findIntent`, +// `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the +// DesktopAgent (`fdc3`). +// +// Array of error message strings for responses that were not returned to the bridge before +// the timeout or because an error occurred. Should be the same length as the `errorSources` +// array and ordered the same. May be omitted if all sources responded without errors. +// +// Constants representing the errors that can be encountered when calling the `open` method +// on the DesktopAgent object (`fdc3`). + +export const ErrorMessageSchema = z.enum([ + "AgentDisconnected", + "DesktopAgentNotFound", + "IntentDeliveryFailed", + "MalformedContext", + "MalformedMessage", + "NoAppsFound", + "NotConnectedToBridge", + "ResolverTimeout", + "ResolverUnavailable", + "ResponseToBridgeTimedOut", + "TargetAppUnavailable", + "TargetInstanceUnavailable", + "UserCancelledResolution", +]); +export type ErrorMessage = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindInstancesResponseMessageTypeSchema = z.enum([ + "findInstancesResponse", +]); +export type FindInstancesResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindInstancesRequestMessageTypeSchema = z.enum([ + "findInstancesRequest", +]); +export type FindInstancesRequestMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindIntentResponseMessageTypeSchema = z.enum([ + "findIntentResponse", +]); +export type FindIntentResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindIntentRequestMessageTypeSchema = z.enum([ + "findIntentRequest", +]); +export type FindIntentRequestMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindIntentsByContextResponseMessageTypeSchema = z.enum([ + "findIntentsByContextResponse", +]); +export type FindIntentsByContextResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const FindIntentsByContextRequestMessageTypeSchema = z.enum([ + "findIntentsByContextRequest", +]); +export type FindIntentsByContextRequestMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const GetAppMetadataResponseMessageTypeSchema = z.enum([ + "getAppMetadataResponse", +]); +export type GetAppMetadataResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const GetAppMetadataRequestMessageTypeSchema = z.enum([ + "getAppMetadataRequest", +]); +export type GetAppMetadataRequestMessageType = z.infer; + +// Constants representing the errors that can be encountered when calling the `open` method +// on the DesktopAgent object (`fdc3`). +// +// Array of error message strings for responses that were not returned to the bridge before +// the timeout or because an error occurred. Should be the same length as the `errorSources` +// array and ordered the same. May be omitted if all sources responded without errors. +// +// Constants representing the errors that can be encountered when calling the `findIntent`, +// `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the +// DesktopAgent (`fdc3`). + +export const OpenErrorMessageSchema = z.enum([ + "AgentDisconnected", + "AppNotFound", + "AppTimeout", + "DesktopAgentNotFound", + "ErrorOnLaunch", + "MalformedContext", + "MalformedMessage", + "NotConnectedToBridge", + "ResolverUnavailable", + "ResponseToBridgeTimedOut", +]); +export type OpenErrorMessage = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const OpenResponseMessageTypeSchema = z.enum([ + "openResponse", +]); +export type OpenResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const OpenRequestMessageTypeSchema = z.enum([ + "openRequest", +]); +export type OpenRequestMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelBroadcastMessageTypeSchema = z.enum([ + "PrivateChannel.broadcast", +]); +export type PrivateChannelBroadcastMessageType = z.infer; + +// Event listener type names for Private Channel events + +export const PrivateChannelEventListenerTypesSchema = z.enum([ + "onAddContextListener", + "onDisconnect", + "onUnsubscribe", +]); +export type PrivateChannelEventListenerTypes = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelEventListenerAddedMessageTypeSchema = z.enum([ + "PrivateChannel.eventListenerAdded", +]); +export type PrivateChannelEventListenerAddedMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelEventListenerRemovedMessageTypeSchema = z.enum([ + "PrivateChannel.eventListenerRemoved", +]); +export type PrivateChannelEventListenerRemovedMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelOnAddContextListenerMessageTypeSchema = z.enum([ + "PrivateChannel.onAddContextListener", +]); +export type PrivateChannelOnAddContextListenerMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelOnDisconnectMessageTypeSchema = z.enum([ + "PrivateChannel.onDisconnect", +]); +export type PrivateChannelOnDisconnectMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const PrivateChannelOnUnsubscribeMessageTypeSchema = z.enum([ + "PrivateChannel.onUnsubscribe", +]); +export type PrivateChannelOnUnsubscribeMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const RaiseIntentResponseMessageTypeSchema = z.enum([ + "raiseIntentResponse", +]); +export type RaiseIntentResponseMessageType = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const RaiseIntentRequestMessageTypeSchema = z.enum([ + "raiseIntentRequest", +]); +export type RaiseIntentRequestMessageType = z.infer; + +// Array of error message strings for responses that were not returned to the bridge before +// the timeout or because an error occurred. Should be the same length as the `errorSources` +// array and ordered the same. May be omitted if all sources responded without errors. +// +// Constants representing the errors that can be encountered when calling the `open` method +// on the DesktopAgent object (`fdc3`). +// +// Constants representing the errors that can be encountered when calling the `findIntent`, +// `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the +// DesktopAgent (`fdc3`). + +export const RaiseIntentResultErrorMessageSchema = z.enum([ + "AgentDisconnected", + "IntentHandlerRejected", + "MalformedMessage", + "NoResultReturned", + "NotConnectedToBridge", + "ResponseToBridgeTimedOut", +]); +export type RaiseIntentResultErrorMessage = z.infer; + +// 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. +// +// UUID for the request +// +// UUID for this specific response message. + +export const RaiseIntentResultResponseMessageTypeSchema = z.enum([ + "raiseIntentResultResponse", +]); +export type RaiseIntentResultResponseMessageType = z.infer; + +// Uniquely defines each channel type. +// Can be "user", "app" or "private". + +export const TypeSchema = z.enum([ + "app", + "private", + "user", +]); +export type Type = z.infer; + +export const BaseImplementationMetadataOptionalFeaturesSchema = z.object({ + "DesktopAgentBridging": z.boolean(), + "OriginatingAppMetadata": z.boolean(), + "UserChannelMembershipAPIs": z.boolean(), +}); +export type BaseImplementationMetadataOptionalFeatures = z.infer; + +export const AgentResponseMetadataSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type AgentResponseMetadata = z.infer; + +export const ErrorResponseMessagePayloadSchema = z.object({ + "error": ResponseErrorDetailSchema, +}); +export type ErrorResponseMessagePayload = z.infer; + +export const BridgeParticipantIdentifierSchema = z.object({ + "desktopAgent": z.string(), + "appId": z.union([z.null(), z.string()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type BridgeParticipantIdentifier = z.infer; + +export const SourceIdentifierSchema = z.object({ + "appId": z.union([z.null(), z.string()]).optional(), + "desktopAgent": z.union([z.null(), z.string()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type SourceIdentifier = z.infer; + +export const AgentResponseMessageSchema = z.object({ + "meta": AgentResponseMetadataSchema, + "payload": z.record(z.string(), z.any()), + "type": ResponseMessageTypeSchema, +}); +export type AgentResponseMessage = z.infer; + +export const DesktopAgentIdentifierSchema = z.object({ + "desktopAgent": z.string(), +}); +export type DesktopAgentIdentifier = z.infer; + +export const ResponseErrorMessagePayloadSchema = z.object({ + "error": z.union([ResponseErrorDetailSchema, z.null()]).optional(), +}); +export type ResponseErrorMessagePayload = z.infer; + +export const BridgeRequestMetadataSchema = z.object({ + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": BridgeParticipantIdentifierSchema, + "timestamp": z.coerce.date(), +}); +export type BridgeRequestMetadata = z.infer; + +export const BridgeResponseMessageMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type BridgeResponseMessageMeta = z.infer; + +export const SourceClassSchema = z.object({ + "appId": z.string(), + "desktopAgent": z.union([z.null(), z.string()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type SourceClass = z.infer; + +export const ContextElementSchema = z.object({ + "id": z.union([z.record(z.string(), z.any()), z.null()]).optional(), + "name": z.union([z.null(), z.string()]).optional(), + "type": z.string(), +}); +export type ContextElement = z.infer; + +export const MetaSourceSchema = z.object({ + "appId": z.string(), + "desktopAgent": z.string(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type MetaSource = z.infer; + +export const BroadcastBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "context": ContextElementSchema, +}); +export type BroadcastBridgeRequestPayload = z.infer; + +export const ConnectionStepMetadataSchema = z.object({ + "requestUuid": z.union([z.null(), z.string()]).optional(), + "responseUuid": z.union([z.null(), z.string()]).optional(), + "timestamp": z.coerce.date(), +}); +export type ConnectionStepMetadata = z.infer; + +export const ConnectionStep2HelloMetaSchema = z.object({ + "timestamp": z.coerce.date(), +}); +export type ConnectionStep2HelloMeta = z.infer; + +export const ConnectionStep2HelloPayloadSchema = z.object({ + "authRequired": z.boolean(), + "authToken": z.union([z.null(), z.string()]).optional(), + "desktopAgentBridgeVersion": z.string(), + "supportedFDC3Versions": z.array(z.string()), +}); +export type ConnectionStep2HelloPayload = z.infer; + +export const ConnectionStep3HandshakeMetaSchema = z.object({ + "requestUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type ConnectionStep3HandshakeMeta = z.infer; + +export const ImplementationMetadataOptionalFeaturesSchema = z.object({ + "DesktopAgentBridging": z.boolean(), + "OriginatingAppMetadata": z.boolean(), + "UserChannelMembershipAPIs": z.boolean(), +}); +export type ImplementationMetadataOptionalFeatures = z.infer; + +export const ConnectionStep4AuthenticationFailedMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type ConnectionStep4AuthenticationFailedMeta = z.infer; + +export const ConnectionStep4AuthenticationFailedPayloadSchema = z.object({ + "message": z.union([z.null(), z.string()]).optional(), +}); +export type ConnectionStep4AuthenticationFailedPayload = z.infer; + +export const ConnectionStep6ConnectedAgentsUpdateMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type ConnectionStep6ConnectedAgentsUpdateMeta = z.infer; + +export const FindInstancesAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindInstancesAgentErrorResponseMeta = z.infer; + +export const FindInstancesAgentErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindInstancesAgentErrorResponsePayload = z.infer; + +export const DestinationClassSchema = z.object({ + "desktopAgent": z.string(), + "appId": z.union([z.null(), z.string()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type DestinationClass = z.infer; + +export const AppIdentifierSchema = z.object({ + "appId": z.string(), + "desktopAgent": z.union([z.null(), z.string()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type AppIdentifier = z.infer; + +export const FindInstancesAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindInstancesAgentResponseMeta = z.infer; + +export const IconSchema = z.object({ + "size": z.union([z.null(), z.string()]).optional(), + "src": z.string(), + "type": z.union([z.null(), z.string()]).optional(), +}); +export type Icon = z.infer; + +export const ImageSchema = z.object({ + "label": z.union([z.null(), z.string()]).optional(), + "size": z.union([z.null(), z.string()]).optional(), + "src": z.string(), + "type": z.union([z.null(), z.string()]).optional(), +}); +export type Image = z.infer; + +export const FindInstancesBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindInstancesBridgeErrorResponseMeta = z.infer; + +export const FindInstancesBridgeErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindInstancesBridgeErrorResponsePayload = z.infer; + +export const MetaSourceClassSchema = z.object({ + "appId": z.union([z.null(), z.string()]).optional(), + "desktopAgent": z.string(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type MetaSourceClass = z.infer; + +export const FindInstancesBridgeRequestPayloadSchema = z.object({ + "app": AppIdentifierSchema, +}); +export type FindInstancesBridgeRequestPayload = z.infer; + +export const FindInstancesBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type FindInstancesBridgeResponseMeta = z.infer; + +export const FindIntentAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentAgentErrorResponseMeta = z.infer; + +export const FindIntentAgentErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindIntentAgentErrorResponsePayload = z.infer; + +export const FindIntentAgentRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": z.union([SourceIdentifierSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), +}); +export type FindIntentAgentRequestMeta = z.infer; + +export const FindIntentAgentRequestPayloadSchema = z.object({ + "context": z.union([ContextElementSchema, z.null()]).optional(), + "intent": z.string(), +}); +export type FindIntentAgentRequestPayload = z.infer; + +export const FindIntentAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentAgentResponseMeta = z.infer; + +export const IntentMetadataSchema = z.object({ + "displayName": z.string(), + "name": z.string(), +}); +export type IntentMetadata = z.infer; + +export const FindIntentBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentBridgeErrorResponseMeta = z.infer; + +export const FindIntentBridgeErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindIntentBridgeErrorResponsePayload = z.infer; + +export const FindIntentBridgeRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": BridgeParticipantIdentifierSchema, + "timestamp": z.coerce.date(), + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), +}); +export type FindIntentBridgeRequestMeta = z.infer; + +export const FindIntentBridgeRequestPayloadSchema = z.object({ + "context": z.union([ContextElementSchema, z.null()]).optional(), + "intent": z.string(), +}); +export type FindIntentBridgeRequestPayload = z.infer; + +export const FindIntentBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type FindIntentBridgeResponseMeta = z.infer; + +export const FindIntentsByContextAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentsByContextAgentErrorResponseMeta = z.infer; + +export const FindIntentsByContextAgentErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindIntentsByContextAgentErrorResponsePayload = z.infer; + +export const FindIntentsByContextAgentRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), +}); +export type FindIntentsByContextAgentRequestMeta = z.infer; + +export const FindIntentsByContextAgentRequestPayloadSchema = z.object({ + "context": ContextElementSchema, +}); +export type FindIntentsByContextAgentRequestPayload = z.infer; + +export const FindIntentsByContextAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentsByContextAgentResponseMeta = z.infer; + +export const FindIntentsByContextBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type FindIntentsByContextBridgeErrorResponseMeta = z.infer; + +export const FindIntentsByContextBridgeErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type FindIntentsByContextBridgeErrorResponsePayload = z.infer; + +export const FindIntentsByContextBridgeRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), +}); +export type FindIntentsByContextBridgeRequestMeta = z.infer; + +export const FindIntentsByContextBridgeRequestPayloadSchema = z.object({ + "context": ContextElementSchema, +}); +export type FindIntentsByContextBridgeRequestPayload = z.infer; + +export const FindIntentsByContextBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type FindIntentsByContextBridgeResponseMeta = z.infer; + +export const GetAppMetadataAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataAgentErrorResponseMeta = z.infer; + +export const GetAppMetadataAgentErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type GetAppMetadataAgentErrorResponsePayload = z.infer; + +export const GetAppMetadataAgentRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceIdentifierSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataAgentRequestMeta = z.infer; + +export const AppDestinationIdentifierSchema = z.object({ + "desktopAgent": z.string(), + "appId": z.string(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type AppDestinationIdentifier = z.infer; + +export const GetAppMetadataAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataAgentResponseMeta = z.infer; + +export const GetAppMetadataBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataBridgeErrorResponseMeta = z.infer; + +export const GetAppMetadataBridgeErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type GetAppMetadataBridgeErrorResponsePayload = z.infer; + +export const GetAppMetadataBridgeRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceClassSchema, + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataBridgeRequestMeta = z.infer; + +export const GetAppMetadataBridgeRequestPayloadSchema = z.object({ + "app": AppDestinationIdentifierSchema, +}); +export type GetAppMetadataBridgeRequestPayload = z.infer; + +export const GetAppMetadataBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type GetAppMetadataBridgeResponseMeta = z.infer; + +export const OpenAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type OpenAgentErrorResponseMeta = z.infer; + +export const OpenAgentErrorResponsePayloadSchema = z.object({ + "error": OpenErrorMessageSchema, +}); +export type OpenAgentErrorResponsePayload = z.infer; + +export const OpenAgentRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": SourceClassSchema, + "timestamp": z.coerce.date(), +}); +export type OpenAgentRequestMeta = z.infer; + +export const AppToOpenSchema = z.object({ + "desktopAgent": z.string(), + "appId": z.string(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type AppToOpen = z.infer; + +export const OpenAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type OpenAgentResponseMeta = z.infer; + +export const OpenAgentResponsePayloadSchema = z.object({ + "appIdentifier": AppIdentifierSchema, +}); +export type OpenAgentResponsePayload = z.infer; + +export const OpenBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type OpenBridgeErrorResponseMeta = z.infer; + +export const OpenBridgeErrorResponsePayloadSchema = z.object({ + "error": OpenErrorMessageSchema, +}); +export type OpenBridgeErrorResponsePayload = z.infer; + +export const OpenBridgeRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type OpenBridgeRequestMeta = z.infer; + +export const OpenBridgeRequestPayloadSchema = z.object({ + "app": AppToOpenSchema, + "context": z.union([ContextElementSchema, z.null()]).optional(), +}); +export type OpenBridgeRequestPayload = z.infer; + +export const OpenBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type OpenBridgeResponseMeta = z.infer; + +export const OpenBridgeResponsePayloadSchema = z.object({ + "appIdentifier": AppIdentifierSchema, +}); +export type OpenBridgeResponsePayload = z.infer; + +export const MetaDestinationSchema = z.object({ + "desktopAgent": z.string(), + "appId": z.string(), + "instanceId": z.union([z.null(), z.string()]).optional(), +}); +export type MetaDestination = z.infer; + +export const PrivateChannelBroadcastAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "context": ContextElementSchema, +}); +export type PrivateChannelBroadcastAgentRequestPayload = z.infer; + +export const PrivateChannelBroadcastBridgeRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type PrivateChannelBroadcastBridgeRequestMeta = z.infer; + +export const PrivateChannelBroadcastBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "context": ContextElementSchema, +}); +export type PrivateChannelBroadcastBridgeRequestPayload = z.infer; + +export const PrivateChannelEventListenerAddedAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelEventListenerAddedAgentRequestMeta = z.infer; + +export const PrivateChannelEventListenerAddedAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "listenerType": PrivateChannelEventListenerTypesSchema, +}); +export type PrivateChannelEventListenerAddedAgentRequestPayload = z.infer; + +export const PrivateChannelEventListenerAddedBridgeRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type PrivateChannelEventListenerAddedBridgeRequestMeta = z.infer; + +export const PrivateChannelEventListenerAddedBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "listenerType": PrivateChannelEventListenerTypesSchema, +}); +export type PrivateChannelEventListenerAddedBridgeRequestPayload = z.infer; + +export const PrivateChannelEventListenerRemovedAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelEventListenerRemovedAgentRequestMeta = z.infer; + +export const PrivateChannelEventListenerRemovedAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "listenerType": PrivateChannelEventListenerTypesSchema, +}); +export type PrivateChannelEventListenerRemovedAgentRequestPayload = z.infer; + +export const PrivateChannelEventListenerRemovedBridgeRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type PrivateChannelEventListenerRemovedBridgeRequestMeta = z.infer; + +export const PrivateChannelEventListenerRemovedBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "listenerType": PrivateChannelEventListenerTypesSchema, +}); +export type PrivateChannelEventListenerRemovedBridgeRequestPayload = z.infer; + +export const PrivateChannelOnAddContextListenerAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelOnAddContextListenerAgentRequestMeta = z.infer; + +export const PrivateChannelOnAddContextListenerAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "contextType": z.string(), +}); +export type PrivateChannelOnAddContextListenerAgentRequestPayload = z.infer; + +export const PrivateChannelOnAddContextListenerBridgeRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type PrivateChannelOnAddContextListenerBridgeRequestMeta = z.infer; + +export const PrivateChannelOnAddContextListenerBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "contextType": z.string(), +}); +export type PrivateChannelOnAddContextListenerBridgeRequestPayload = z.infer; + +export const PrivateChannelOnDisconnectAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelOnDisconnectAgentRequestMeta = z.infer; + +export const PrivateChannelOnDisconnectAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), +}); +export type PrivateChannelOnDisconnectAgentRequestPayload = z.infer; + +export const PrivateChannelOnDisconnectBridgeRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type PrivateChannelOnDisconnectBridgeRequestMeta = z.infer; + +export const PrivateChannelOnDisconnectBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), +}); +export type PrivateChannelOnDisconnectBridgeRequestPayload = z.infer; + +export const PrivateChannelOnUnsubscribeAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelOnUnsubscribeAgentRequestMeta = z.infer; + +export const PrivateChannelOnUnsubscribeAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "contextType": z.string(), +}); +export type PrivateChannelOnUnsubscribeAgentRequestPayload = z.infer; + +export const ERequestMetadataSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type ERequestMetadata = z.infer; + +export const PrivateChannelOnUnsubscribeBridgeRequestPayloadSchema = z.object({ + "channelId": z.string(), + "contextType": z.string(), +}); +export type PrivateChannelOnUnsubscribeBridgeRequestPayload = z.infer; + +export const RaiseIntentAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentAgentErrorResponseMeta = z.infer; + +export const RaiseIntentAgentErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type RaiseIntentAgentErrorResponsePayload = z.infer; + +export const RaiseIntentAgentRequestMetaSchema = z.object({ + "destination": MetaDestinationSchema, + "requestUuid": z.string(), + "source": SourceClassSchema, + "timestamp": z.coerce.date(), +}); +export type RaiseIntentAgentRequestMeta = z.infer; + +export const RaiseIntentAgentRequestPayloadSchema = z.object({ + "app": AppDestinationIdentifierSchema, + "context": ContextElementSchema, + "intent": z.string(), +}); +export type RaiseIntentAgentRequestPayload = z.infer; + +export const RaiseIntentAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentAgentResponseMeta = z.infer; + +export const IntentResolutionSchema = z.object({ + "intent": z.string(), + "source": AppIdentifierSchema, + "version": z.union([z.null(), z.string()]).optional(), +}); +export type IntentResolution = z.infer; + +export const RaiseIntentBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentBridgeErrorResponseMeta = z.infer; + +export const RaiseIntentBridgeErrorResponsePayloadSchema = z.object({ + "error": ErrorMessageSchema, +}); +export type RaiseIntentBridgeErrorResponsePayload = z.infer; + +export const RaiseIntentBridgeRequestMetaSchema = z.object({ + "destination": MetaDestinationSchema, + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type RaiseIntentBridgeRequestMeta = z.infer; + +export const RaiseIntentBridgeRequestPayloadSchema = z.object({ + "app": AppDestinationIdentifierSchema, + "context": ContextElementSchema, + "intent": z.string(), +}); +export type RaiseIntentBridgeRequestPayload = z.infer; + +export const RaiseIntentBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentBridgeResponseMeta = z.infer; + +export const RaiseIntentBridgeResponsePayloadSchema = z.object({ + "intentResolution": IntentResolutionSchema, +}); +export type RaiseIntentBridgeResponsePayload = z.infer; + +export const RaiseIntentResultAgentErrorResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentResultAgentErrorResponseMeta = z.infer; + +export const RaiseIntentResultAgentErrorResponsePayloadSchema = z.object({ + "error": RaiseIntentResultErrorMessageSchema, +}); +export type RaiseIntentResultAgentErrorResponsePayload = z.infer; + +export const RaiseIntentResultAgentResponseMetaSchema = z.object({ + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentResultAgentResponseMeta = z.infer; + +export const DisplayMetadataSchema = z.object({ + "color": z.union([z.null(), z.string()]).optional(), + "glyph": z.union([z.null(), z.string()]).optional(), + "name": z.union([z.null(), z.string()]).optional(), +}); +export type DisplayMetadata = z.infer; + +export const RaiseIntentResultBridgeErrorResponseMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentResultBridgeErrorResponseMeta = z.infer; + +export const RaiseIntentResultBridgeErrorResponsePayloadSchema = z.object({ + "error": RaiseIntentResultErrorMessageSchema, +}); +export type RaiseIntentResultBridgeErrorResponsePayload = z.infer; + +export const RaiseIntentResultBridgeResponseMetaSchema = z.object({ + "errorDetails": z.union([z.array(ResponseErrorDetailSchema), z.null()]).optional(), + "errorSources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "requestUuid": z.string(), + "responseUuid": z.string(), + "sources": z.union([z.array(DesktopAgentIdentifierSchema), z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type RaiseIntentResultBridgeResponseMeta = z.infer; + +export const ContextSchema = z.object({ + "id": z.union([z.record(z.string(), z.any()), z.null()]).optional(), + "name": z.union([z.null(), z.string()]).optional(), + "type": z.string(), +}); +export type Context = z.infer; + +export const BaseImplementationMetadataSchema = z.object({ + "fdc3Version": z.string(), + "optionalFeatures": BaseImplementationMetadataOptionalFeaturesSchema, + "provider": z.string(), + "providerVersion": z.union([z.null(), z.string()]).optional(), +}); +export type BaseImplementationMetadata = z.infer; + +export const AgentErrorResponseMessageSchema = z.object({ + "meta": AgentResponseMetadataSchema, + "payload": ErrorResponseMessagePayloadSchema, + "type": ResponseMessageTypeSchema, +}); +export type AgentErrorResponseMessage = z.infer; + +export const AgentRequestMetadataSchema = z.object({ + "destination": z.union([BridgeParticipantIdentifierSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceIdentifierSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type AgentRequestMetadata = z.infer; + +export const BridgeErrorResponseMessageMetaSchema = z.object({ + "errorDetails": z.array(ResponseErrorDetailSchema), + "errorSources": z.array(DesktopAgentIdentifierSchema), + "requestUuid": z.string(), + "responseUuid": z.string(), + "timestamp": z.coerce.date(), +}); +export type BridgeErrorResponseMessageMeta = z.infer; + +export const BridgeRequestMessageSchema = z.object({ + "meta": BridgeRequestMetadataSchema, + "payload": z.record(z.string(), z.any()), + "type": z.string(), +}); +export type BridgeRequestMessage = z.infer; + +export const BridgeResponseMessageSchema = z.object({ + "meta": BridgeResponseMessageMetaSchema, + "payload": z.record(z.string(), z.any()), + "type": z.string(), +}); +export type BridgeResponseMessage = z.infer; + +export const BroadcastAgentRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": SourceClassSchema, + "timestamp": z.coerce.date(), +}); +export type BroadcastAgentRequestMeta = z.infer; + +export const BroadcastAgentRequestPayloadSchema = z.object({ + "channelId": z.string(), + "context": ContextElementSchema, +}); +export type BroadcastAgentRequestPayload = z.infer; + +export const BroadcastBridgeRequestMetaSchema = z.object({ + "requestUuid": z.string(), + "source": MetaSourceSchema, + "timestamp": z.coerce.date(), +}); +export type BroadcastBridgeRequestMeta = z.infer; + +export const ConnectionStepMessageSchema = z.object({ + "meta": ConnectionStepMetadataSchema, + "payload": z.record(z.string(), z.any()), + "type": ConnectionStepMessageTypeSchema, +}); +export type ConnectionStepMessage = z.infer; + +export const ConnectionStep2HelloSchema = z.object({ + "meta": ConnectionStep2HelloMetaSchema, + "payload": ConnectionStep2HelloPayloadSchema, + "type": ConnectionStep2HelloTypeSchema, +}); +export type ConnectionStep2Hello = z.infer; + +export const ImplementationMetadataElementSchema = z.object({ + "fdc3Version": z.string(), + "optionalFeatures": ImplementationMetadataOptionalFeaturesSchema, + "provider": z.string(), + "providerVersion": z.union([z.null(), z.string()]).optional(), +}); +export type ImplementationMetadataElement = z.infer; + +export const ConnectionStep4AuthenticationFailedSchema = z.object({ + "meta": ConnectionStep4AuthenticationFailedMetaSchema, + "payload": ConnectionStep4AuthenticationFailedPayloadSchema, + "type": ConnectionStep4AuthenticationFailedTypeSchema, +}); +export type ConnectionStep4AuthenticationFailed = z.infer; + +export const ConnectionStep6ConnectedAgentsUpdatePayloadSchema = z.object({ + "addAgent": z.union([z.null(), z.string()]).optional(), + "allAgents": z.array(ImplementationMetadataElementSchema), + "channelsState": z.union([z.record(z.string(), z.array(ContextElementSchema)), z.null()]).optional(), + "removeAgent": z.union([z.null(), z.string()]).optional(), +}); +export type ConnectionStep6ConnectedAgentsUpdatePayload = z.infer; + +export const FindInstancesAgentErrorResponseSchema = z.object({ + "meta": FindInstancesAgentErrorResponseMetaSchema, + "payload": FindInstancesAgentErrorResponsePayloadSchema, + "type": FindInstancesResponseMessageTypeSchema, +}); +export type FindInstancesAgentErrorResponse = z.infer; + +export const FindInstancesAgentRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceIdentifierSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type FindInstancesAgentRequestMeta = z.infer; + +export const FindInstancesAgentRequestPayloadSchema = z.object({ + "app": AppIdentifierSchema, +}); +export type FindInstancesAgentRequestPayload = z.infer; + +export const AppMetadataSchema = z.object({ + "appId": z.string(), + "description": z.union([z.null(), z.string()]).optional(), + "desktopAgent": z.union([z.null(), z.string()]).optional(), + "icons": z.union([z.array(IconSchema), z.null()]).optional(), + "instanceId": z.union([z.null(), z.string()]).optional(), + "instanceMetadata": z.union([z.record(z.string(), z.any()), z.null()]).optional(), + "name": z.union([z.null(), z.string()]).optional(), + "resultType": z.union([z.null(), z.string()]).optional(), + "screenshots": z.union([z.array(ImageSchema), z.null()]).optional(), + "title": z.union([z.null(), z.string()]).optional(), + "tooltip": z.union([z.null(), z.string()]).optional(), + "version": z.union([z.null(), z.string()]).optional(), +}); +export type AppMetadata = z.infer; + +export const FindInstancesBridgeErrorResponseSchema = z.object({ + "meta": FindInstancesBridgeErrorResponseMetaSchema, + "payload": FindInstancesBridgeErrorResponsePayloadSchema, + "type": FindInstancesResponseMessageTypeSchema, +}); +export type FindInstancesBridgeErrorResponse = z.infer; + +export const FindInstancesBridgeRequestMetaSchema = z.object({ + "destination": z.union([DestinationClassSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": MetaSourceClassSchema, + "timestamp": z.coerce.date(), +}); +export type FindInstancesBridgeRequestMeta = z.infer; + +export const FindInstancesBridgeResponsePayloadSchema = z.object({ + "appIdentifiers": z.array(AppMetadataSchema), +}); +export type FindInstancesBridgeResponsePayload = z.infer; + +export const FindIntentAgentErrorResponseSchema = z.object({ + "meta": FindIntentAgentErrorResponseMetaSchema, + "payload": FindIntentAgentErrorResponsePayloadSchema, + "type": FindIntentResponseMessageTypeSchema, +}); +export type FindIntentAgentErrorResponse = z.infer; + +export const FindIntentAgentRequestSchema = z.object({ + "meta": FindIntentAgentRequestMetaSchema, + "payload": FindIntentAgentRequestPayloadSchema, + "type": FindIntentRequestMessageTypeSchema, +}); +export type FindIntentAgentRequest = z.infer; + +export const AppIntentSchema = z.object({ + "apps": z.array(AppMetadataSchema), + "intent": IntentMetadataSchema, +}); +export type AppIntent = z.infer; + +export const FindIntentBridgeErrorResponseSchema = z.object({ + "meta": FindIntentBridgeErrorResponseMetaSchema, + "payload": FindIntentBridgeErrorResponsePayloadSchema, + "type": FindIntentResponseMessageTypeSchema, +}); +export type FindIntentBridgeErrorResponse = z.infer; + +export const FindIntentBridgeRequestSchema = z.object({ + "meta": FindIntentBridgeRequestMetaSchema, + "payload": FindIntentBridgeRequestPayloadSchema, + "type": FindIntentRequestMessageTypeSchema, +}); +export type FindIntentBridgeRequest = z.infer; + +export const FindIntentBridgeResponsePayloadSchema = z.object({ + "appIntent": AppIntentSchema, +}); +export type FindIntentBridgeResponsePayload = z.infer; + +export const FindIntentsByContextAgentErrorResponseSchema = z.object({ + "meta": FindIntentsByContextAgentErrorResponseMetaSchema, + "payload": FindIntentsByContextAgentErrorResponsePayloadSchema, + "type": FindIntentsByContextResponseMessageTypeSchema, +}); +export type FindIntentsByContextAgentErrorResponse = z.infer; + +export const FindIntentsByContextAgentRequestSchema = z.object({ + "meta": FindIntentsByContextAgentRequestMetaSchema, + "payload": FindIntentsByContextAgentRequestPayloadSchema, + "type": FindIntentsByContextRequestMessageTypeSchema, +}); +export type FindIntentsByContextAgentRequest = z.infer; + +export const FindIntentsByContextAgentResponsePayloadSchema = z.object({ + "appIntents": z.array(AppIntentSchema), +}); +export type FindIntentsByContextAgentResponsePayload = z.infer; + +export const FindIntentsByContextBridgeErrorResponseSchema = z.object({ + "meta": FindIntentsByContextBridgeErrorResponseMetaSchema, + "payload": FindIntentsByContextBridgeErrorResponsePayloadSchema, + "type": FindIntentsByContextResponseMessageTypeSchema, +}); +export type FindIntentsByContextBridgeErrorResponse = z.infer; + +export const FindIntentsByContextBridgeRequestSchema = z.object({ + "meta": FindIntentsByContextBridgeRequestMetaSchema, + "payload": FindIntentsByContextBridgeRequestPayloadSchema, + "type": FindIntentsByContextRequestMessageTypeSchema, +}); +export type FindIntentsByContextBridgeRequest = z.infer; + +export const FindIntentsByContextBridgeResponsePayloadSchema = z.object({ + "appIntents": z.array(AppIntentSchema), +}); +export type FindIntentsByContextBridgeResponsePayload = z.infer; + +export const GetAppMetadataAgentErrorResponseSchema = z.object({ + "meta": GetAppMetadataAgentErrorResponseMetaSchema, + "payload": GetAppMetadataAgentErrorResponsePayloadSchema, + "type": GetAppMetadataResponseMessageTypeSchema, +}); +export type GetAppMetadataAgentErrorResponse = z.infer; + +export const GetAppMetadataAgentRequestPayloadSchema = z.object({ + "app": AppDestinationIdentifierSchema, +}); +export type GetAppMetadataAgentRequestPayload = z.infer; + +export const GetAppMetadataAgentResponsePayloadSchema = z.object({ + "appMetadata": AppMetadataSchema, +}); +export type GetAppMetadataAgentResponsePayload = z.infer; + +export const GetAppMetadataBridgeErrorResponseSchema = z.object({ + "meta": GetAppMetadataBridgeErrorResponseMetaSchema, + "payload": GetAppMetadataBridgeErrorResponsePayloadSchema, + "type": GetAppMetadataResponseMessageTypeSchema, +}); +export type GetAppMetadataBridgeErrorResponse = z.infer; + +export const GetAppMetadataBridgeRequestSchema = z.object({ + "meta": GetAppMetadataBridgeRequestMetaSchema, + "payload": GetAppMetadataBridgeRequestPayloadSchema, + "type": GetAppMetadataRequestMessageTypeSchema, +}); +export type GetAppMetadataBridgeRequest = z.infer; + +export const GetAppMetadataBridgeResponsePayloadSchema = z.object({ + "appMetadata": AppMetadataSchema, +}); +export type GetAppMetadataBridgeResponsePayload = z.infer; + +export const OpenAgentErrorResponseSchema = z.object({ + "meta": OpenAgentErrorResponseMetaSchema, + "payload": OpenAgentErrorResponsePayloadSchema, + "type": OpenResponseMessageTypeSchema, +}); +export type OpenAgentErrorResponse = z.infer; + +export const OpenAgentRequestPayloadSchema = z.object({ + "app": AppToOpenSchema, + "context": z.union([ContextElementSchema, z.null()]).optional(), +}); +export type OpenAgentRequestPayload = z.infer; + +export const OpenAgentResponseSchema = z.object({ + "meta": OpenAgentResponseMetaSchema, + "payload": OpenAgentResponsePayloadSchema, + "type": OpenResponseMessageTypeSchema, +}); +export type OpenAgentResponse = z.infer; + +export const OpenBridgeErrorResponseSchema = z.object({ + "meta": OpenBridgeErrorResponseMetaSchema, + "payload": OpenBridgeErrorResponsePayloadSchema, + "type": OpenResponseMessageTypeSchema, +}); +export type OpenBridgeErrorResponse = z.infer; + +export const OpenBridgeRequestSchema = z.object({ + "meta": OpenBridgeRequestMetaSchema, + "payload": OpenBridgeRequestPayloadSchema, + "type": OpenRequestMessageTypeSchema, +}); +export type OpenBridgeRequest = z.infer; + +export const OpenBridgeResponseSchema = z.object({ + "meta": OpenBridgeResponseMetaSchema, + "payload": OpenBridgeResponsePayloadSchema, + "type": OpenResponseMessageTypeSchema, +}); +export type OpenBridgeResponse = z.infer; + +export const PrivateChannelBroadcastAgentRequestMetaSchema = z.object({ + "destination": z.union([MetaDestinationSchema, z.null()]).optional(), + "requestUuid": z.string(), + "source": z.union([SourceClassSchema, z.null()]).optional(), + "timestamp": z.coerce.date(), +}); +export type PrivateChannelBroadcastAgentRequestMeta = z.infer; + +export const PrivateChannelBroadcastBridgeRequestSchema = z.object({ + "meta": PrivateChannelBroadcastBridgeRequestMetaSchema, + "payload": PrivateChannelBroadcastBridgeRequestPayloadSchema, + "type": PrivateChannelBroadcastMessageTypeSchema, +}); +export type PrivateChannelBroadcastBridgeRequest = z.infer; + +export const PrivateChannelEventListenerAddedAgentRequestSchema = z.object({ + "meta": PrivateChannelEventListenerAddedAgentRequestMetaSchema, + "payload": PrivateChannelEventListenerAddedAgentRequestPayloadSchema, + "type": PrivateChannelEventListenerAddedMessageTypeSchema, +}); +export type PrivateChannelEventListenerAddedAgentRequest = z.infer; + +export const PrivateChannelEventListenerAddedBridgeRequestSchema = z.object({ + "meta": PrivateChannelEventListenerAddedBridgeRequestMetaSchema, + "payload": PrivateChannelEventListenerAddedBridgeRequestPayloadSchema, + "type": PrivateChannelEventListenerAddedMessageTypeSchema, +}); +export type PrivateChannelEventListenerAddedBridgeRequest = z.infer; + +export const PrivateChannelEventListenerRemovedAgentRequestSchema = z.object({ + "meta": PrivateChannelEventListenerRemovedAgentRequestMetaSchema, + "payload": PrivateChannelEventListenerRemovedAgentRequestPayloadSchema, + "type": PrivateChannelEventListenerRemovedMessageTypeSchema, +}); +export type PrivateChannelEventListenerRemovedAgentRequest = z.infer; + +export const PrivateChannelEventListenerRemovedBridgeRequestSchema = z.object({ + "meta": PrivateChannelEventListenerRemovedBridgeRequestMetaSchema, + "payload": PrivateChannelEventListenerRemovedBridgeRequestPayloadSchema, + "type": PrivateChannelEventListenerRemovedMessageTypeSchema, +}); +export type PrivateChannelEventListenerRemovedBridgeRequest = z.infer; + +export const PrivateChannelOnAddContextListenerAgentRequestSchema = z.object({ + "meta": PrivateChannelOnAddContextListenerAgentRequestMetaSchema, + "payload": PrivateChannelOnAddContextListenerAgentRequestPayloadSchema, + "type": PrivateChannelOnAddContextListenerMessageTypeSchema, +}); +export type PrivateChannelOnAddContextListenerAgentRequest = z.infer; + +export const PrivateChannelOnAddContextListenerBridgeRequestSchema = z.object({ + "meta": PrivateChannelOnAddContextListenerBridgeRequestMetaSchema, + "payload": PrivateChannelOnAddContextListenerBridgeRequestPayloadSchema, + "type": PrivateChannelOnAddContextListenerMessageTypeSchema, +}); +export type PrivateChannelOnAddContextListenerBridgeRequest = z.infer; + +export const PrivateChannelOnDisconnectAgentRequestSchema = z.object({ + "meta": PrivateChannelOnDisconnectAgentRequestMetaSchema, + "payload": PrivateChannelOnDisconnectAgentRequestPayloadSchema, + "type": PrivateChannelOnDisconnectMessageTypeSchema, +}); +export type PrivateChannelOnDisconnectAgentRequest = z.infer; + +export const PrivateChannelOnDisconnectBridgeRequestSchema = z.object({ + "meta": PrivateChannelOnDisconnectBridgeRequestMetaSchema, + "payload": PrivateChannelOnDisconnectBridgeRequestPayloadSchema, + "type": PrivateChannelOnDisconnectMessageTypeSchema, +}); +export type PrivateChannelOnDisconnectBridgeRequest = z.infer; + +export const PrivateChannelOnUnsubscribeAgentRequestSchema = z.object({ + "meta": PrivateChannelOnUnsubscribeAgentRequestMetaSchema, + "payload": PrivateChannelOnUnsubscribeAgentRequestPayloadSchema, + "type": PrivateChannelOnUnsubscribeMessageTypeSchema, +}); +export type PrivateChannelOnUnsubscribeAgentRequest = z.infer; + +export const PrivateChannelOnUnsubscribeBridgeRequestSchema = z.object({ + "meta": ERequestMetadataSchema, + "payload": PrivateChannelOnUnsubscribeBridgeRequestPayloadSchema, + "type": PrivateChannelOnUnsubscribeMessageTypeSchema, +}); +export type PrivateChannelOnUnsubscribeBridgeRequest = z.infer; + +export const RaiseIntentAgentErrorResponseSchema = z.object({ + "meta": RaiseIntentAgentErrorResponseMetaSchema, + "payload": RaiseIntentAgentErrorResponsePayloadSchema, + "type": RaiseIntentResponseMessageTypeSchema, +}); +export type RaiseIntentAgentErrorResponse = z.infer; + +export const RaiseIntentAgentRequestSchema = z.object({ + "meta": RaiseIntentAgentRequestMetaSchema, + "payload": RaiseIntentAgentRequestPayloadSchema, + "type": RaiseIntentRequestMessageTypeSchema, +}); +export type RaiseIntentAgentRequest = z.infer; + +export const RaiseIntentAgentResponsePayloadSchema = z.object({ + "intentResolution": IntentResolutionSchema, +}); +export type RaiseIntentAgentResponsePayload = z.infer; + +export const RaiseIntentBridgeErrorResponseSchema = z.object({ + "meta": RaiseIntentBridgeErrorResponseMetaSchema, + "payload": RaiseIntentBridgeErrorResponsePayloadSchema, + "type": RaiseIntentResponseMessageTypeSchema, +}); +export type RaiseIntentBridgeErrorResponse = z.infer; + +export const RaiseIntentBridgeRequestSchema = z.object({ + "meta": RaiseIntentBridgeRequestMetaSchema, + "payload": RaiseIntentBridgeRequestPayloadSchema, + "type": RaiseIntentRequestMessageTypeSchema, +}); +export type RaiseIntentBridgeRequest = z.infer; + +export const RaiseIntentBridgeResponseSchema = z.object({ + "meta": RaiseIntentBridgeResponseMetaSchema, + "payload": RaiseIntentBridgeResponsePayloadSchema, + "type": RaiseIntentResponseMessageTypeSchema, +}); +export type RaiseIntentBridgeResponse = z.infer; + +export const RaiseIntentResultAgentErrorResponseSchema = z.object({ + "meta": RaiseIntentResultAgentErrorResponseMetaSchema, + "payload": RaiseIntentResultAgentErrorResponsePayloadSchema, + "type": RaiseIntentResultResponseMessageTypeSchema, +}); +export type RaiseIntentResultAgentErrorResponse = z.infer; + +export const ChannelSchema = z.object({ + "displayMetadata": z.union([DisplayMetadataSchema, z.null()]).optional(), + "id": z.string(), + "type": TypeSchema, +}); +export type Channel = z.infer; + +export const RaiseIntentResultBridgeErrorResponseSchema = z.object({ + "meta": RaiseIntentResultBridgeErrorResponseMetaSchema, + "payload": RaiseIntentResultBridgeErrorResponsePayloadSchema, + "type": RaiseIntentResultResponseMessageTypeSchema, +}); +export type RaiseIntentResultBridgeErrorResponse = z.infer; + +export const AgentRequestMessageSchema = z.object({ + "meta": AgentRequestMetadataSchema, + "payload": z.record(z.string(), z.any()), + "type": RequestMessageTypeSchema, +}); +export type AgentRequestMessage = z.infer; + +export const BridgeErrorResponseMessageSchema = z.object({ + "meta": BridgeErrorResponseMessageMetaSchema, + "payload": ResponseErrorMessagePayloadSchema, + "type": z.string(), +}); +export type BridgeErrorResponseMessage = z.infer; + +export const BroadcastAgentRequestSchema = z.object({ + "meta": BroadcastAgentRequestMetaSchema, + "payload": BroadcastAgentRequestPayloadSchema, + "type": BroadcastRequestMessageTypeSchema, +}); +export type BroadcastAgentRequest = z.infer; + +export const BroadcastBridgeRequestSchema = z.object({ + "meta": BroadcastBridgeRequestMetaSchema, + "payload": BroadcastBridgeRequestPayloadSchema, + "type": BroadcastRequestMessageTypeSchema, +}); +export type BroadcastBridgeRequest = z.infer; + +export const ConnectionStep3HandshakePayloadSchema = z.object({ + "authToken": z.union([z.null(), z.string()]).optional(), + "channelsState": z.record(z.string(), z.array(ContextElementSchema)), + "implementationMetadata": ImplementationMetadataElementSchema, + "requestedName": z.string(), +}); +export type ConnectionStep3HandshakePayload = z.infer; + +export const ConnectionStep6ConnectedAgentsUpdateSchema = z.object({ + "meta": ConnectionStep6ConnectedAgentsUpdateMetaSchema, + "payload": ConnectionStep6ConnectedAgentsUpdatePayloadSchema, + "type": ConnectionStep6ConnectedAgentsUpdateTypeSchema, +}); +export type ConnectionStep6ConnectedAgentsUpdate = z.infer; + +export const FindInstancesAgentRequestSchema = z.object({ + "meta": FindInstancesAgentRequestMetaSchema, + "payload": FindInstancesAgentRequestPayloadSchema, + "type": FindInstancesRequestMessageTypeSchema, +}); +export type FindInstancesAgentRequest = z.infer; + +export const FindInstancesAgentResponsePayloadSchema = z.object({ + "appIdentifiers": z.array(AppMetadataSchema), +}); +export type FindInstancesAgentResponsePayload = z.infer; + +export const FindInstancesBridgeRequestSchema = z.object({ + "meta": FindInstancesBridgeRequestMetaSchema, + "payload": FindInstancesBridgeRequestPayloadSchema, + "type": FindInstancesRequestMessageTypeSchema, +}); +export type FindInstancesBridgeRequest = z.infer; + +export const FindInstancesBridgeResponseSchema = z.object({ + "meta": FindInstancesBridgeResponseMetaSchema, + "payload": FindInstancesBridgeResponsePayloadSchema, + "type": FindInstancesResponseMessageTypeSchema, +}); +export type FindInstancesBridgeResponse = z.infer; + +export const FindIntentAgentResponsePayloadSchema = z.object({ + "appIntent": AppIntentSchema, +}); +export type FindIntentAgentResponsePayload = z.infer; + +export const FindIntentBridgeResponseSchema = z.object({ + "meta": FindIntentBridgeResponseMetaSchema, + "payload": FindIntentBridgeResponsePayloadSchema, + "type": FindIntentResponseMessageTypeSchema, +}); +export type FindIntentBridgeResponse = z.infer; + +export const FindIntentsByContextAgentResponseSchema = z.object({ + "meta": FindIntentsByContextAgentResponseMetaSchema, + "payload": FindIntentsByContextAgentResponsePayloadSchema, + "type": FindIntentsByContextResponseMessageTypeSchema, +}); +export type FindIntentsByContextAgentResponse = z.infer; + +export const FindIntentsByContextBridgeResponseSchema = z.object({ + "meta": FindIntentsByContextBridgeResponseMetaSchema, + "payload": FindIntentsByContextBridgeResponsePayloadSchema, + "type": FindIntentsByContextResponseMessageTypeSchema, +}); +export type FindIntentsByContextBridgeResponse = z.infer; + +export const GetAppMetadataAgentRequestSchema = z.object({ + "meta": GetAppMetadataAgentRequestMetaSchema, + "payload": GetAppMetadataAgentRequestPayloadSchema, + "type": GetAppMetadataRequestMessageTypeSchema, +}); +export type GetAppMetadataAgentRequest = z.infer; + +export const GetAppMetadataAgentResponseSchema = z.object({ + "meta": GetAppMetadataAgentResponseMetaSchema, + "payload": GetAppMetadataAgentResponsePayloadSchema, + "type": GetAppMetadataResponseMessageTypeSchema, +}); +export type GetAppMetadataAgentResponse = z.infer; + +export const GetAppMetadataBridgeResponseSchema = z.object({ + "meta": GetAppMetadataBridgeResponseMetaSchema, + "payload": GetAppMetadataBridgeResponsePayloadSchema, + "type": GetAppMetadataResponseMessageTypeSchema, +}); +export type GetAppMetadataBridgeResponse = z.infer; + +export const OpenAgentRequestSchema = z.object({ + "meta": OpenAgentRequestMetaSchema, + "payload": OpenAgentRequestPayloadSchema, + "type": OpenRequestMessageTypeSchema, +}); +export type OpenAgentRequest = z.infer; + +export const PrivateChannelBroadcastAgentRequestSchema = z.object({ + "meta": PrivateChannelBroadcastAgentRequestMetaSchema, + "payload": PrivateChannelBroadcastAgentRequestPayloadSchema, + "type": PrivateChannelBroadcastMessageTypeSchema, +}); +export type PrivateChannelBroadcastAgentRequest = z.infer; + +export const RaiseIntentAgentResponseSchema = z.object({ + "meta": RaiseIntentAgentResponseMetaSchema, + "payload": RaiseIntentAgentResponsePayloadSchema, + "type": RaiseIntentResponseMessageTypeSchema, +}); +export type RaiseIntentAgentResponse = z.infer; + +export const IntentResultSchema = z.object({ + "context": z.union([ContextElementSchema, z.null()]).optional(), + "channel": z.union([ChannelSchema, z.null()]).optional(), +}); +export type IntentResult = z.infer; + +export const RaiseIntentResultBridgeResponsePayloadSchema = z.object({ + "intentResult": IntentResultSchema, +}); +export type RaiseIntentResultBridgeResponsePayload = z.infer; + +export const ConnectionStep3HandshakeSchema = z.object({ + "meta": ConnectionStep3HandshakeMetaSchema, + "payload": ConnectionStep3HandshakePayloadSchema, + "type": ConnectionStep3HandshakeTypeSchema, +}); +export type ConnectionStep3Handshake = z.infer; + +export const FindInstancesAgentResponseSchema = z.object({ + "meta": FindInstancesAgentResponseMetaSchema, + "payload": FindInstancesAgentResponsePayloadSchema, + "type": FindInstancesResponseMessageTypeSchema, +}); +export type FindInstancesAgentResponse = z.infer; + +export const FindIntentAgentResponseSchema = z.object({ + "meta": FindIntentAgentResponseMetaSchema, + "payload": FindIntentAgentResponsePayloadSchema, + "type": FindIntentResponseMessageTypeSchema, +}); +export type FindIntentAgentResponse = z.infer; + +export const RaiseIntentResultAgentResponsePayloadSchema = z.object({ + "intentResult": IntentResultSchema, +}); +export type RaiseIntentResultAgentResponsePayload = z.infer; + +export const RaiseIntentResultBridgeResponseSchema = z.object({ + "meta": RaiseIntentResultBridgeResponseMetaSchema, + "payload": RaiseIntentResultBridgeResponsePayloadSchema, + "type": RaiseIntentResultResponseMessageTypeSchema, +}); +export type RaiseIntentResultBridgeResponse = z.infer; + +export const RaiseIntentResultAgentResponseSchema = z.object({ + "meta": RaiseIntentResultAgentResponseMetaSchema, + "payload": RaiseIntentResultAgentResponsePayloadSchema, + "type": RaiseIntentResultResponseMessageTypeSchema, +}); +export type RaiseIntentResultAgentResponse = z.infer; From 4db056c40edc98d9ee5dbcfb77c45959a9259961 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 3 Oct 2023 11:23:11 +0100 Subject: [PATCH 2/7] updating .semgrepignore --- .semgrepignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.semgrepignore b/.semgrepignore index b7682dfb6..713117642 100644 --- a/.semgrepignore +++ b/.semgrepignore @@ -1,6 +1,7 @@ website/** # Just used for build so ignoring +s2zodQuicktypeUtil.js s2tQuicktypeUtil.js schemas/api/t2sQuicktypeUtil.js From 821e83d9c85c9b2fbd4b39c0b87204eed2ec2474 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 17 Oct 2023 13:13:13 +0100 Subject: [PATCH 3/7] disabling preprepare script so that types are not auto-generated --- package-lock.json | 200 +++++++++++++++++++++++++++++++--------------- package.json | 2 +- 2 files changed, 137 insertions(+), 65 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1e1411c6..f1dc2a152 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@finos/fdc3", - "version": "2.1.0-beta.2", + "version": "2.1.0-beta.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@finos/fdc3", - "version": "2.1.0-beta.2", + "version": "2.1.0-beta.3", "license": "Apache-2.0", "devDependencies": { "husky": "^4.3.0", @@ -53,17 +53,89 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", - "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/compat-data": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.4.tgz", @@ -104,12 +176,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.4.tgz", - "integrity": "sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", "dev": true, "dependencies": { - "@babel/types": "^7.21.4", + "@babel/types": "^7.23.0", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -218,9 +290,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" @@ -239,25 +311,25 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -387,30 +459,30 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -455,13 +527,13 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -540,9 +612,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.4.tgz", - "integrity": "sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1691,33 +1763,33 @@ } }, "node_modules/@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.4.tgz", - "integrity": "sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.21.4", - "@babel/generator": "^7.21.4", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.4", - "@babel/types": "^7.21.4", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1726,13 +1798,13 @@ } }, "node_modules/@babel/types": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.4.tgz", - "integrity": "sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { diff --git a/package.json b/package.json index 4f25cd37c..f2fd13eca 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "build": "tsdx build", "test": "tsdx test --verbose", "lint": "tsdx lint src/api test", - "preprepare": "npm run typegen && npm run typegen-bridging", + "disabled-preprepare": "npm run typegen && npm run typegen-bridging", "prepare": "tsdx build", "typegen": "node s2tQuicktypeUtil.js schemas/context src/context/ContextTypes.ts && tsdx lint src/context/ --fix", "typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix", From 1b6e9f74ceab65f5e985dd7b9db7a951ea9479c5 Mon Sep 17 00:00:00 2001 From: Kris West Date: Fri, 20 Oct 2023 16:53:02 +0100 Subject: [PATCH 4/7] Updating to use unions rather than enums for constrained string values --- s2tQuicktypeUtil.js | 5 +- s2zodQuicktypeUtil.js | 2 +- src/bridging/BridgingTypes.ts | 579 +++++++++--------- src/context/ContextTypes.ts | 1084 +++++++++++++++++++++++++-------- 4 files changed, 1133 insertions(+), 537 deletions(-) diff --git a/s2tQuicktypeUtil.js b/s2tQuicktypeUtil.js index 91b66ec52..d254ff36b 100644 --- a/s2tQuicktypeUtil.js +++ b/s2tQuicktypeUtil.js @@ -41,9 +41,10 @@ while (dirIndex < inputs.length) { } // Normalise path to local quicktype executable. -const quicktypeExec = ['.', 'node_modules', '.bin', 'quicktype'].join(path.sep); +const quicktypeExec = "node " + ["..","quicktype","dist","index.js"].join(path.sep); +//const quicktypeExec = ['.', 'node_modules', '.bin', 'quicktype'].join(path.sep); -const command = `${quicktypeExec} --no-combine-classes -s schema -o ${outputFile} ${sources}`; +const command = `${quicktypeExec} --prefer-const-values --prefer-unions -s schema -o ${outputFile} ${sources}`; console.log('command to run: ' + command); exec(command, function(error, stdout, stderr) { diff --git a/s2zodQuicktypeUtil.js b/s2zodQuicktypeUtil.js index 51557db59..b594c65c5 100644 --- a/s2zodQuicktypeUtil.js +++ b/s2zodQuicktypeUtil.js @@ -44,7 +44,7 @@ while (dirIndex < inputs.length) { //const quicktypeExec = ['.', 'node_modules', '.bin', 'quicktype'].join(path.sep); const quicktypeExec = "node --stack_trace_limit=100 --max-old-space-size=4096 \"../quicktype/dist/index.js\"" -const command = `${quicktypeExec} --no-combine-classes -s schema -l typescript-zod -o ${outputFile} ${sources}`; +const command = `${quicktypeExec} -s schema -l typescript-zod -o ${outputFile} ${sources}`; console.log('command to run: ' + command); exec(command, function(error, stdout, stderr) { diff --git a/src/bridging/BridgingTypes.ts b/src/bridging/BridgingTypes.ts index 266d064c5..adb2f2215 100644 --- a/src/bridging/BridgingTypes.ts +++ b/src/bridging/BridgingTypes.ts @@ -75,6 +75,54 @@ // These functions will throw an error if the JSON doesn't // match the expected interface, even if the JSON is valid. +/** + * Metadata relating to the FDC3 Desktop Agent implementation and its provider. + */ +export interface BaseImplementationMetadata { + /** + * The version number of the FDC3 specification that the implementation provides. + * The string must be a numeric semver version, e.g. 1.2 or 1.2.1. + */ + fdc3Version: string; + /** + * Metadata indicating whether the Desktop Agent implements optional features of + * the Desktop Agent API. + */ + optionalFeatures: BaseImplementationMetadataOptionalFeatures; + /** + * The name of the provider of the Desktop Agent implementation (e.g. Finsemble, Glue42, + * OpenFin etc.). + */ + provider: string; + /** + * The version of the provider of the Desktop Agent implementation (e.g. 5.3.0). + */ + providerVersion?: string; +} + +/** + * Metadata indicating whether the Desktop Agent implements optional features of + * the Desktop Agent API. + */ +export interface BaseImplementationMetadataOptionalFeatures { + /** + * Used to indicate whether the experimental Desktop Agent Bridging + * feature is implemented by the Desktop Agent. + */ + DesktopAgentBridging: boolean; + /** + * Used to indicate whether the exposure of 'originating app metadata' for + * context and intent messages is supported by the Desktop Agent. + */ + OriginatingAppMetadata: boolean; + /** + * Used to indicate whether the optional `fdc3.joinUserChannel`, + * `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by + * the Desktop Agent. + */ + UserChannelMembershipAPIs: boolean; +} + /** * A response message from a Desktop Agent to the Bridge containing an error, to be used in * preference to the standard response when an error needs to be returned. @@ -121,43 +169,41 @@ export interface ErrorResponseMessagePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export enum ResponseErrorDetail { - AccessDenied = 'AccessDenied', - AgentDisconnected = 'AgentDisconnected', - AppNotFound = 'AppNotFound', - AppTimeout = 'AppTimeout', - CreationFailed = 'CreationFailed', - DesktopAgentNotFound = 'DesktopAgentNotFound', - ErrorOnLaunch = 'ErrorOnLaunch', - IntentDeliveryFailed = 'IntentDeliveryFailed', - IntentHandlerRejected = 'IntentHandlerRejected', - MalformedContext = 'MalformedContext', - MalformedMessage = 'MalformedMessage', - NoAppsFound = 'NoAppsFound', - NoChannelFound = 'NoChannelFound', - NoResultReturned = 'NoResultReturned', - NotConnectedToBridge = 'NotConnectedToBridge', - ResolverTimeout = 'ResolverTimeout', - ResolverUnavailable = 'ResolverUnavailable', - ResponseToBridgeTimedOut = 'ResponseToBridgeTimedOut', - TargetAppUnavailable = 'TargetAppUnavailable', - TargetInstanceUnavailable = 'TargetInstanceUnavailable', - UserCancelledResolution = 'UserCancelledResolution', -} +export type ResponseErrorDetail = + | 'AccessDenied' + | 'CreationFailed' + | 'MalformedContext' + | 'NoChannelFound' + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * 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. */ -export enum ResponseMessageType { - FindInstancesResponse = 'findInstancesResponse', - FindIntentResponse = 'findIntentResponse', - FindIntentsByContextResponse = 'findIntentsByContextResponse', - GetAppMetadataResponse = 'getAppMetadataResponse', - OpenResponse = 'openResponse', - RaiseIntentResponse = 'raiseIntentResponse', - RaiseIntentResultResponse = 'raiseIntentResultResponse', -} +export type ResponseMessageType = + | 'findInstancesResponse' + | 'findIntentResponse' + | 'findIntentsByContextResponse' + | 'getAppMetadataResponse' + | 'openResponse' + | 'raiseIntentResponse' + | 'raiseIntentResultResponse'; /** * A request message from a Desktop Agent to the Bridge. @@ -330,21 +376,20 @@ export interface SourceIdentifier { * 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. */ -export enum RequestMessageType { - BroadcastRequest = 'broadcastRequest', - FindInstancesRequest = 'findInstancesRequest', - FindIntentRequest = 'findIntentRequest', - FindIntentsByContextRequest = 'findIntentsByContextRequest', - GetAppMetadataRequest = 'getAppMetadataRequest', - OpenRequest = 'openRequest', - PrivateChannelBroadcast = 'PrivateChannel.broadcast', - PrivateChannelEventListenerAdded = 'PrivateChannel.eventListenerAdded', - PrivateChannelEventListenerRemoved = 'PrivateChannel.eventListenerRemoved', - PrivateChannelOnAddContextListener = 'PrivateChannel.onAddContextListener', - PrivateChannelOnDisconnect = 'PrivateChannel.onDisconnect', - PrivateChannelOnUnsubscribe = 'PrivateChannel.onUnsubscribe', - RaiseIntentRequest = 'raiseIntentRequest', -} +export type RequestMessageType = + | 'broadcastRequest' + | 'findInstancesRequest' + | 'findIntentRequest' + | 'findIntentsByContextRequest' + | 'getAppMetadataRequest' + | 'openRequest' + | 'PrivateChannel.broadcast' + | 'PrivateChannel.eventListenerAdded' + | 'PrivateChannel.eventListenerRemoved' + | 'PrivateChannel.onAddContextListener' + | 'PrivateChannel.onDisconnect' + | 'PrivateChannel.onUnsubscribe' + | 'raiseIntentRequest'; /** * A response message from a Desktop Agent to the Bridge. @@ -507,7 +552,7 @@ export interface BroadcastAgentRequest { * 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: BroadcastRequestMessageType; + type: 'broadcastRequest'; } /** @@ -596,7 +641,7 @@ export interface BroadcastAgentRequestPayload { /** * The context object that was the payload of a broadcast message. */ - context: Context; + context: ContextElement; } /** @@ -614,7 +659,7 @@ export interface BroadcastAgentRequestPayload { * data object of a particular type can be expected to have, but this can always be extended * with custom fields as appropriate. */ -export interface Context { +export interface ContextElement { /** * Context data objects may include a set of equivalent key-value pairs that can be used to * help applications identify and look up the context type they receive in their own domain. @@ -662,9 +707,6 @@ export interface Context { * * UUID for this specific response message. */ -export enum BroadcastRequestMessageType { - BroadcastRequest = 'broadcastRequest', -} /** * A request to broadcast context on a channel. @@ -681,7 +723,7 @@ export interface BroadcastBridgeRequest { * 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: BroadcastRequestMessageType; + type: 'broadcastRequest'; } /** @@ -779,7 +821,7 @@ export interface BroadcastBridgeRequestPayload { /** * The context object that was the payload of a broadcast message. */ - context: Context; + context: ContextElement; } /** @@ -810,12 +852,7 @@ export interface ConnectionStepMetadata { /** * Identifies the type of the connection step message. */ -export enum ConnectionStepMessageType { - AuthenticationFailed = 'authenticationFailed', - ConnectedAgentsUpdate = 'connectedAgentsUpdate', - Handshake = 'handshake', - Hello = 'hello', -} +export type ConnectionStepMessageType = 'hello' | 'handshake' | 'authenticationFailed' | 'connectedAgentsUpdate'; /** * Hello message sent by the Bridge to anyone connecting to the Bridge (enables @@ -833,7 +870,7 @@ export interface ConnectionStep2Hello { /** * Identifies the type of the connection step message. */ - type: ConnectionStep2HelloType; + type: 'hello'; } /** @@ -869,9 +906,6 @@ export interface ConnectionStep2HelloPayload { /** * Identifies the type of the connection step message. */ -export enum ConnectionStep2HelloType { - Hello = 'hello', -} /** * Handshake message sent by the Desktop Agent to the Bridge (including requested name, @@ -889,7 +923,7 @@ export interface ConnectionStep3Handshake { /** * Identifies the type of the connection step message. */ - type: ConnectionStep3HandshakeType; + type: 'handshake'; } /** @@ -909,11 +943,11 @@ export interface ConnectionStep3HandshakePayload { * The current state of the Desktop Agent's channels, excluding any private channels, as a * mapping of channel id to an array of Context objects, most recent first. */ - channelsState: { [key: string]: Context[] }; + channelsState: { [key: string]: ContextElement[] }; /** * Desktop Agent ImplementationMetadata trying to connect to the bridge. */ - implementationMetadata: BaseImplementationMetadata; + implementationMetadata: ImplementationMetadataElement; /** * The requested Desktop Agent name */ @@ -921,11 +955,11 @@ export interface ConnectionStep3HandshakePayload { } /** - * Metadata relating to the FDC3 Desktop Agent implementation and its provider. - * * Desktop Agent ImplementationMetadata trying to connect to the bridge. + * + * Metadata relating to the FDC3 Desktop Agent implementation and its provider. */ -export interface BaseImplementationMetadata { +export interface ImplementationMetadataElement { /** * The version number of the FDC3 specification that the implementation provides. * The string must be a numeric semver version, e.g. 1.2 or 1.2.1. @@ -935,7 +969,7 @@ export interface BaseImplementationMetadata { * Metadata indicating whether the Desktop Agent implements optional features of * the Desktop Agent API. */ - optionalFeatures: OptionalFeatures; + optionalFeatures: ImplementationMetadataOptionalFeatures; /** * The name of the provider of the Desktop Agent implementation (e.g. Finsemble, Glue42, * OpenFin etc.). @@ -951,7 +985,7 @@ export interface BaseImplementationMetadata { * Metadata indicating whether the Desktop Agent implements optional features of * the Desktop Agent API. */ -export interface OptionalFeatures { +export interface ImplementationMetadataOptionalFeatures { /** * Used to indicate whether the experimental Desktop Agent Bridging * feature is implemented by the Desktop Agent. @@ -973,9 +1007,6 @@ export interface OptionalFeatures { /** * Identifies the type of the connection step message. */ -export enum ConnectionStep3HandshakeType { - Handshake = 'handshake', -} /** * Message sent by Bridge to Desktop Agent if their authentication fails. @@ -992,7 +1023,7 @@ export interface ConnectionStep4AuthenticationFailed { /** * Identifies the type of the connection step message. */ - type: ConnectionStep4AuthenticationFailedType; + type: 'authenticationFailed'; } /** @@ -1014,9 +1045,6 @@ export interface ConnectionStep4AuthenticationFailedPayload { /** * Identifies the type of the connection step message. */ -export enum ConnectionStep4AuthenticationFailedType { - AuthenticationFailed = 'authenticationFailed', -} /** * Message sent by Bridge to all Desktop Agent when an agent joins or leaves the bridge, @@ -1035,7 +1063,7 @@ export interface ConnectionStep6ConnectedAgentsUpdate { /** * Identifies the type of the connection step message. */ - type: ConnectionStep6ConnectedAgentsUpdateType; + type: 'connectedAgentsUpdate'; } /** @@ -1058,12 +1086,12 @@ export interface ConnectionStep6ConnectedAgentsUpdatePayload { /** * Desktop Agent Bridge implementation metadata of all connected agents. */ - allAgents: BaseImplementationMetadata[]; + allAgents: ImplementationMetadataElement[]; /** * The updated state of channels that should be adopted by the agents. Should only be set * when an agent is connecting to the bridge. */ - channelsState?: { [key: string]: Context[] }; + channelsState?: { [key: string]: ContextElement[] }; /** * Should be set when an agent disconnects from the bridge and provide the name that no * longer is assigned. @@ -1074,9 +1102,6 @@ export interface ConnectionStep6ConnectedAgentsUpdatePayload { /** * Identifies the type of the connection step message. */ -export enum ConnectionStep6ConnectedAgentsUpdateType { - ConnectedAgentsUpdate = 'connectedAgentsUpdate', -} /** * A response to a findInstances request that contains an error. @@ -1094,7 +1119,7 @@ export interface FindInstancesAgentErrorResponse { * 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: FindInstancesResponseMessageType; + type: 'findInstancesResponse'; } /** @@ -1125,21 +1150,20 @@ export interface FindInstancesAgentErrorResponsePayload { * Constants representing the errors that can be encountered when calling the `open` method * on the DesktopAgent object (`fdc3`). */ -export enum ErrorMessage { - AgentDisconnected = 'AgentDisconnected', - DesktopAgentNotFound = 'DesktopAgentNotFound', - IntentDeliveryFailed = 'IntentDeliveryFailed', - MalformedContext = 'MalformedContext', - MalformedMessage = 'MalformedMessage', - NoAppsFound = 'NoAppsFound', - NotConnectedToBridge = 'NotConnectedToBridge', - ResolverTimeout = 'ResolverTimeout', - ResolverUnavailable = 'ResolverUnavailable', - ResponseToBridgeTimedOut = 'ResponseToBridgeTimedOut', - TargetAppUnavailable = 'TargetAppUnavailable', - TargetInstanceUnavailable = 'TargetInstanceUnavailable', - UserCancelledResolution = 'UserCancelledResolution', -} +export type ErrorMessage = + | 'DesktopAgentNotFound' + | 'IntentDeliveryFailed' + | 'MalformedContext' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'ResolverUnavailable' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -1149,9 +1173,6 @@ export enum ErrorMessage { * * UUID for this specific response message. */ -export enum FindInstancesResponseMessageType { - FindInstancesResponse = 'findInstancesResponse', -} /** * A request for details of instances of a particular app @@ -1168,7 +1189,7 @@ export interface FindInstancesAgentRequest { * 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: FindInstancesRequestMessageType; + type: 'findInstancesRequest'; } /** @@ -1311,9 +1332,6 @@ export interface AppIdentifier { * * UUID for this specific response message. */ -export enum FindInstancesRequestMessageType { - FindInstancesRequest = 'findInstancesRequest', -} /** * A response to a findInstances request. @@ -1330,7 +1348,7 @@ export interface FindInstancesAgentResponse { * 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: FindInstancesResponseMessageType; + type: 'findInstancesResponse'; } /** @@ -1483,7 +1501,7 @@ export interface FindInstancesBridgeErrorResponse { * 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: FindInstancesResponseMessageType; + type: 'findInstancesResponse'; } /** @@ -1520,7 +1538,7 @@ export interface FindInstancesBridgeRequest { * 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: FindInstancesRequestMessageType; + type: 'findInstancesRequest'; } /** @@ -1642,7 +1660,7 @@ export interface FindInstancesBridgeResponse { * 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: FindInstancesResponseMessageType; + type: 'findInstancesResponse'; } /** @@ -1680,7 +1698,7 @@ export interface FindIntentAgentErrorResponse { * 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: FindIntentResponseMessageType; + type: 'findIntentResponse'; } /** @@ -1707,9 +1725,6 @@ export interface FindIntentAgentErrorResponsePayload { * * UUID for this specific response message. */ -export enum FindIntentResponseMessageType { - FindIntentResponse = 'findIntentResponse', -} /** * A request for details of apps available to resolve a particular intent and context pair. @@ -1726,7 +1741,7 @@ export interface FindIntentAgentRequest { * 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: FindIntentRequestMessageType; + type: 'findIntentRequest'; } /** @@ -1752,7 +1767,7 @@ export interface FindIntentAgentRequestMeta { * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentAgentRequestPayload { - context?: Context; + context?: ContextElement; intent: string; } @@ -1764,9 +1779,6 @@ export interface FindIntentAgentRequestPayload { * * UUID for this specific response message. */ -export enum FindIntentRequestMessageType { - FindIntentRequest = 'findIntentRequest', -} /** * A response to a findIntent request. @@ -1783,7 +1795,7 @@ export interface FindIntentAgentResponse { * 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: FindIntentResponseMessageType; + type: 'findIntentResponse'; } /** @@ -1849,7 +1861,7 @@ export interface FindIntentBridgeErrorResponse { * 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: FindIntentResponseMessageType; + type: 'findIntentResponse'; } /** @@ -1886,7 +1898,7 @@ export interface FindIntentBridgeRequest { * 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: FindIntentRequestMessageType; + type: 'findIntentRequest'; } /** @@ -1913,7 +1925,7 @@ export interface FindIntentBridgeRequestMeta { * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentBridgeRequestPayload { - context?: Context; + context?: ContextElement; intent: string; } @@ -1933,7 +1945,7 @@ export interface FindIntentBridgeResponse { * 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: FindIntentResponseMessageType; + type: 'findIntentResponse'; } /** @@ -1971,7 +1983,7 @@ export interface FindIntentsByContextAgentErrorResponse { * 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: FindIntentsByContextResponseMessageType; + type: 'findIntentsByContextResponse'; } /** @@ -1998,9 +2010,6 @@ export interface FindIntentsByContextAgentErrorResponsePayload { * * UUID for this specific response message. */ -export enum FindIntentsByContextResponseMessageType { - FindIntentsByContextResponse = 'findIntentsByContextResponse', -} /** * A request for details of intents and apps available to resolve them for a particular @@ -2018,7 +2027,7 @@ export interface FindIntentsByContextAgentRequest { * 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: FindIntentsByContextRequestMessageType; + type: 'findIntentsByContextRequest'; } /** @@ -2044,7 +2053,7 @@ export interface FindIntentsByContextAgentRequestMeta { * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextAgentRequestPayload { - context: Context; + context: ContextElement; } /** @@ -2055,9 +2064,6 @@ export interface FindIntentsByContextAgentRequestPayload { * * UUID for this specific response message. */ -export enum FindIntentsByContextRequestMessageType { - FindIntentsByContextRequest = 'findIntentsByContextRequest', -} /** * A response to a findIntentsByContext request. @@ -2074,7 +2080,7 @@ export interface FindIntentsByContextAgentResponse { * 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: FindIntentsByContextResponseMessageType; + type: 'findIntentsByContextResponse'; } /** @@ -2110,7 +2116,7 @@ export interface FindIntentsByContextBridgeErrorResponse { * 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: FindIntentsByContextResponseMessageType; + type: 'findIntentsByContextResponse'; } /** @@ -2148,7 +2154,7 @@ export interface FindIntentsByContextBridgeRequest { * 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: FindIntentsByContextRequestMessageType; + type: 'findIntentsByContextRequest'; } /** @@ -2175,7 +2181,7 @@ export interface FindIntentsByContextBridgeRequestMeta { * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextBridgeRequestPayload { - context: Context; + context: ContextElement; } /** @@ -2194,7 +2200,7 @@ export interface FindIntentsByContextBridgeResponse { * 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: FindIntentsByContextResponseMessageType; + type: 'findIntentsByContextResponse'; } /** @@ -2232,7 +2238,7 @@ export interface GetAppMetadataAgentErrorResponse { * 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: GetAppMetadataResponseMessageType; + type: 'getAppMetadataResponse'; } /** @@ -2259,9 +2265,6 @@ export interface GetAppMetadataAgentErrorResponsePayload { * * UUID for this specific response message. */ -export enum GetAppMetadataResponseMessageType { - GetAppMetadataResponse = 'getAppMetadataResponse', -} /** * A request for metadata about an app @@ -2278,7 +2281,7 @@ export interface GetAppMetadataAgentRequest { * 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: GetAppMetadataRequestMessageType; + type: 'getAppMetadataRequest'; } /** @@ -2374,9 +2377,6 @@ export interface AppDestinationIdentifier { * * UUID for this specific response message. */ -export enum GetAppMetadataRequestMessageType { - GetAppMetadataRequest = 'getAppMetadataRequest', -} /** * A response to a getAppMetadata request. @@ -2393,7 +2393,7 @@ export interface GetAppMetadataAgentResponse { * 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: GetAppMetadataResponseMessageType; + type: 'getAppMetadataResponse'; } /** @@ -2429,7 +2429,7 @@ export interface GetAppMetadataBridgeErrorResponse { * 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: GetAppMetadataResponseMessageType; + type: 'getAppMetadataResponse'; } /** @@ -2466,7 +2466,7 @@ export interface GetAppMetadataBridgeRequest { * 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: GetAppMetadataRequestMessageType; + type: 'getAppMetadataRequest'; } /** @@ -2512,7 +2512,7 @@ export interface GetAppMetadataBridgeResponse { * 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: GetAppMetadataResponseMessageType; + type: 'getAppMetadataResponse'; } /** @@ -2550,7 +2550,7 @@ export interface OpenAgentErrorResponse { * 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: OpenResponseMessageType; + type: 'openResponse'; } /** @@ -2581,18 +2581,17 @@ export interface OpenAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export enum OpenErrorMessage { - AgentDisconnected = 'AgentDisconnected', - AppNotFound = 'AppNotFound', - AppTimeout = 'AppTimeout', - DesktopAgentNotFound = 'DesktopAgentNotFound', - ErrorOnLaunch = 'ErrorOnLaunch', - MalformedContext = 'MalformedContext', - MalformedMessage = 'MalformedMessage', - NotConnectedToBridge = 'NotConnectedToBridge', - ResolverUnavailable = 'ResolverUnavailable', - ResponseToBridgeTimedOut = 'ResponseToBridgeTimedOut', -} +export type OpenErrorMessage = + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'MalformedContext' + | 'ResolverUnavailable' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2602,9 +2601,6 @@ export enum OpenErrorMessage { * * UUID for this specific response message. */ -export enum OpenResponseMessageType { - OpenResponse = 'openResponse', -} /** * A request to open an application @@ -2621,7 +2617,7 @@ export interface OpenAgentRequest { * 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: OpenRequestMessageType; + type: 'openRequest'; } /** @@ -2651,7 +2647,7 @@ export interface OpenAgentRequestPayload { * The application to open on the specified Desktop Agent */ app: AppToOpen; - context?: Context; + context?: ContextElement; } /** @@ -2720,9 +2716,6 @@ export interface AppToOpen { * * UUID for this specific response message. */ -export enum OpenRequestMessageType { - OpenRequest = 'openRequest', -} /** * A response to an open request @@ -2739,7 +2732,7 @@ export interface OpenAgentResponse { * 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: OpenResponseMessageType; + type: 'openResponse'; } /** @@ -2775,7 +2768,7 @@ export interface OpenBridgeErrorResponse { * 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: OpenResponseMessageType; + type: 'openResponse'; } /** @@ -2812,7 +2805,7 @@ export interface OpenBridgeRequest { * 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: OpenRequestMessageType; + type: 'openRequest'; } /** @@ -2843,7 +2836,7 @@ export interface OpenBridgeRequestPayload { * The application to open on the specified Desktop Agent */ app: AppToOpen; - context?: Context; + context?: ContextElement; } /** @@ -2862,7 +2855,7 @@ export interface OpenBridgeResponse { * 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: OpenResponseMessageType; + type: 'openResponse'; } /** @@ -2899,7 +2892,7 @@ export interface PrivateChannelBroadcastAgentRequest { * 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: PrivateChannelBroadcastMessageType; + type: 'PrivateChannel.broadcast'; } /** @@ -3002,7 +2995,7 @@ export interface PrivateChannelBroadcastAgentRequestPayload { /** * The context object that was the payload of a broadcast message. */ - context: Context; + context: ContextElement; } /** @@ -3013,9 +3006,6 @@ export interface PrivateChannelBroadcastAgentRequestPayload { * * UUID for this specific response message. */ -export enum PrivateChannelBroadcastMessageType { - PrivateChannelBroadcast = 'PrivateChannel.broadcast', -} /** * A request to broadcast on a PrivateChannel. @@ -3032,7 +3022,7 @@ export interface PrivateChannelBroadcastBridgeRequest { * 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: PrivateChannelBroadcastMessageType; + type: 'PrivateChannel.broadcast'; } /** @@ -3066,7 +3056,7 @@ export interface PrivateChannelBroadcastBridgeRequestPayload { /** * The context object that was the payload of a broadcast message. */ - context: Context; + context: ContextElement; } /** @@ -3084,7 +3074,7 @@ export interface PrivateChannelEventListenerAddedAgentRequest { * 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: PrivateChannelEventListenerAddedMessageType; + type: 'PrivateChannel.eventListenerAdded'; } /** @@ -3117,11 +3107,7 @@ export interface PrivateChannelEventListenerAddedAgentRequestPayload { /** * Event listener type names for Private Channel events */ -export enum PrivateChannelEventListenerTypes { - OnAddContextListener = 'onAddContextListener', - OnDisconnect = 'onDisconnect', - OnUnsubscribe = 'onUnsubscribe', -} +export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3131,9 +3117,6 @@ export enum PrivateChannelEventListenerTypes { * * UUID for this specific response message. */ -export enum PrivateChannelEventListenerAddedMessageType { - PrivateChannelEventListenerAdded = 'PrivateChannel.eventListenerAdded', -} /** * A request to forward on an EventListenerAdded event, relating to a PrivateChannel @@ -3150,7 +3133,7 @@ export interface PrivateChannelEventListenerAddedBridgeRequest { * 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: PrivateChannelEventListenerAddedMessageType; + type: 'PrivateChannel.eventListenerAdded'; } /** @@ -3196,7 +3179,7 @@ export interface PrivateChannelEventListenerRemovedAgentRequest { * 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: PrivateChannelEventListenerRemovedMessageType; + type: 'PrivateChannel.eventListenerRemoved'; } /** @@ -3234,9 +3217,6 @@ export interface PrivateChannelEventListenerRemovedAgentRequestPayload { * * UUID for this specific response message. */ -export enum PrivateChannelEventListenerRemovedMessageType { - PrivateChannelEventListenerRemoved = 'PrivateChannel.eventListenerRemoved', -} /** * A request to forward on an EventListenerRemoved event, relating to a PrivateChannel @@ -3253,7 +3233,7 @@ export interface PrivateChannelEventListenerRemovedBridgeRequest { * 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: PrivateChannelEventListenerRemovedMessageType; + type: 'PrivateChannel.eventListenerRemoved'; } /** @@ -3299,7 +3279,7 @@ export interface PrivateChannelOnAddContextListenerAgentRequest { * 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: PrivateChannelOnAddContextListenerMessageType; + type: 'PrivateChannel.onAddContextListener'; } /** @@ -3337,9 +3317,6 @@ export interface PrivateChannelOnAddContextListenerAgentRequestPayload { * * UUID for this specific response message. */ -export enum PrivateChannelOnAddContextListenerMessageType { - PrivateChannelOnAddContextListener = 'PrivateChannel.onAddContextListener', -} /** * A request to forward on an AddContextListener event, relating to a PrivateChannel @@ -3356,7 +3333,7 @@ export interface PrivateChannelOnAddContextListenerBridgeRequest { * 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: PrivateChannelOnAddContextListenerMessageType; + type: 'PrivateChannel.onAddContextListener'; } /** @@ -3402,7 +3379,7 @@ export interface PrivateChannelOnDisconnectAgentRequest { * 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: PrivateChannelOnDisconnectMessageType; + type: 'PrivateChannel.onDisconnect'; } /** @@ -3439,9 +3416,6 @@ export interface PrivateChannelOnDisconnectAgentRequestPayload { * * UUID for this specific response message. */ -export enum PrivateChannelOnDisconnectMessageType { - PrivateChannelOnDisconnect = 'PrivateChannel.onDisconnect', -} /** * A request to forward on a Disconnect event, relating to a PrivateChannel @@ -3458,7 +3432,7 @@ export interface PrivateChannelOnDisconnectBridgeRequest { * 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: PrivateChannelOnDisconnectMessageType; + type: 'PrivateChannel.onDisconnect'; } /** @@ -3503,7 +3477,7 @@ export interface PrivateChannelOnUnsubscribeAgentRequest { * 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: PrivateChannelOnUnsubscribeMessageType; + type: 'PrivateChannel.onUnsubscribe'; } /** @@ -3541,9 +3515,6 @@ export interface PrivateChannelOnUnsubscribeAgentRequestPayload { * * UUID for this specific response message. */ -export enum PrivateChannelOnUnsubscribeMessageType { - PrivateChannelOnUnsubscribe = 'PrivateChannel.onUnsubscribe', -} /** * A request to forward on an Unsubscribe event, relating to a PrivateChannel @@ -3560,7 +3531,7 @@ export interface PrivateChannelOnUnsubscribeBridgeRequest { * 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: PrivateChannelOnUnsubscribeMessageType; + type: 'PrivateChannel.onUnsubscribe'; } /** @@ -3607,7 +3578,7 @@ export interface RaiseIntentAgentErrorResponse { * 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: RaiseIntentResponseMessageType; + type: 'raiseIntentResponse'; } /** @@ -3634,9 +3605,6 @@ export interface RaiseIntentAgentErrorResponsePayload { * * UUID for this specific response message. */ -export enum RaiseIntentResponseMessageType { - RaiseIntentResponse = 'raiseIntentResponse', -} /** * A request to raise an intent. @@ -3653,7 +3621,7 @@ export interface RaiseIntentAgentRequest { * 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: RaiseIntentRequestMessageType; + type: 'raiseIntentRequest'; } /** @@ -3680,7 +3648,7 @@ export interface RaiseIntentAgentRequestMeta { */ export interface RaiseIntentAgentRequestPayload { app: AppDestinationIdentifier; - context: Context; + context: ContextElement; intent: string; } @@ -3692,9 +3660,6 @@ export interface RaiseIntentAgentRequestPayload { * * UUID for this specific response message. */ -export enum RaiseIntentRequestMessageType { - RaiseIntentRequest = 'raiseIntentRequest', -} /** * A response to a request to raise an intent. @@ -3711,7 +3676,7 @@ export interface RaiseIntentAgentResponse { * 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: RaiseIntentResponseMessageType; + type: 'raiseIntentResponse'; } /** @@ -3791,7 +3756,7 @@ export interface RaiseIntentBridgeErrorResponse { * 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: RaiseIntentResponseMessageType; + type: 'raiseIntentResponse'; } /** @@ -3828,7 +3793,7 @@ export interface RaiseIntentBridgeRequest { * 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: RaiseIntentRequestMessageType; + type: 'raiseIntentRequest'; } /** @@ -3856,7 +3821,7 @@ export interface RaiseIntentBridgeRequestMeta { */ export interface RaiseIntentBridgeRequestPayload { app: AppDestinationIdentifier; - context: Context; + context: ContextElement; intent: string; } @@ -3876,7 +3841,7 @@ export interface RaiseIntentBridgeResponse { * 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: RaiseIntentResponseMessageType; + type: 'raiseIntentResponse'; } /** @@ -3915,7 +3880,7 @@ export interface RaiseIntentResultAgentErrorResponse { * 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: RaiseIntentResultResponseMessageType; + type: 'raiseIntentResultResponse'; } /** @@ -3946,14 +3911,13 @@ export interface RaiseIntentResultAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export enum RaiseIntentResultErrorMessage { - AgentDisconnected = 'AgentDisconnected', - IntentHandlerRejected = 'IntentHandlerRejected', - MalformedMessage = 'MalformedMessage', - NoResultReturned = 'NoResultReturned', - NotConnectedToBridge = 'NotConnectedToBridge', - ResponseToBridgeTimedOut = 'ResponseToBridgeTimedOut', -} +export type RaiseIntentResultErrorMessage = + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3963,9 +3927,6 @@ export enum RaiseIntentResultErrorMessage { * * UUID for this specific response message. */ -export enum RaiseIntentResultResponseMessageType { - RaiseIntentResultResponse = 'raiseIntentResultResponse', -} /** * A secondary response to a request to raise an intent used to deliver the intent result @@ -3982,7 +3943,7 @@ export interface RaiseIntentResultAgentResponse { * 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: RaiseIntentResultResponseMessageType; + type: 'raiseIntentResultResponse'; } /** @@ -4002,7 +3963,7 @@ export interface RaiseIntentResultAgentResponsePayload { } export interface IntentResult { - context?: Context; + context?: ContextElement; channel?: Channel; } @@ -4069,11 +4030,7 @@ export interface DisplayMetadata { * Uniquely defines each channel type. * Can be "user", "app" or "private". */ -export enum Type { - App = 'app', - Private = 'private', - User = 'user', -} +export type Type = 'app' | 'private' | 'user'; /** * A secondary response to a request to raise an intent used to deliver the intent result, @@ -4093,7 +4050,7 @@ export interface RaiseIntentResultBridgeErrorResponse { * 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: RaiseIntentResultResponseMessageType; + type: 'raiseIntentResultResponse'; } /** @@ -4131,7 +4088,7 @@ export interface RaiseIntentResultBridgeResponse { * 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: RaiseIntentResultResponseMessageType; + type: 'raiseIntentResultResponse'; } /** @@ -4153,6 +4110,59 @@ export interface RaiseIntentResultBridgeResponsePayload { intentResult: IntentResult; } +/** + * The `fdc3.context` type defines the basic contract or "shape" for all data exchanged by + * FDC3 operations. As such, it is not really meant to be used on its own, but is imported + * by more specific type definitions (standardized or custom) to provide the structure and + * properties shared by all FDC3 context data types. + * + * The key element of FDC3 context types is their mandatory `type` property, which is used + * to identify what type of data the object represents, and what shape it has. + * + * The FDC3 context type, and all derived types, define the minimum set of fields a context + * data object of a particular type can be expected to have, but this can always be extended + * with custom fields as appropriate. + */ +export interface Context { + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; +} + // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { @@ -4902,6 +4912,23 @@ function r(name: string) { } const typeMap: any = { + BaseImplementationMetadata: o( + [ + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('BaseImplementationMetadataOptionalFeatures') }, + { json: 'provider', js: 'provider', typ: '' }, + { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') }, + ], + false + ), + BaseImplementationMetadataOptionalFeatures: o( + [ + { json: 'DesktopAgentBridging', js: 'DesktopAgentBridging', typ: true }, + { json: 'OriginatingAppMetadata', js: 'OriginatingAppMetadata', typ: true }, + { json: 'UserChannelMembershipAPIs', js: 'UserChannelMembershipAPIs', typ: true }, + ], + false + ), AgentErrorResponseMessage: o( [ { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, @@ -5043,11 +5070,11 @@ const typeMap: any = { BroadcastAgentRequestPayload: o( [ { json: 'channelId', js: 'channelId', typ: '' }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, ], false ), - Context: o( + ContextElement: o( [ { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, @@ -5082,7 +5109,7 @@ const typeMap: any = { BroadcastBridgeRequestPayload: o( [ { json: 'channelId', js: 'channelId', typ: '' }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, ], false ), @@ -5138,22 +5165,22 @@ const typeMap: any = { ConnectionStep3HandshakePayload: o( [ { json: 'authToken', js: 'authToken', typ: u(undefined, '') }, - { json: 'channelsState', js: 'channelsState', typ: m(a(r('Context'))) }, - { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('BaseImplementationMetadata') }, + { json: 'channelsState', js: 'channelsState', typ: m(a(r('ContextElement'))) }, + { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ImplementationMetadataElement') }, { json: 'requestedName', js: 'requestedName', typ: '' }, ], false ), - BaseImplementationMetadata: o( + ImplementationMetadataElement: o( [ { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, - { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') }, + { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('ImplementationMetadataOptionalFeatures') }, { json: 'provider', js: 'provider', typ: '' }, { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') }, ], false ), - OptionalFeatures: o( + ImplementationMetadataOptionalFeatures: o( [ { json: 'DesktopAgentBridging', js: 'DesktopAgentBridging', typ: true }, { json: 'OriginatingAppMetadata', js: 'OriginatingAppMetadata', typ: true }, @@ -5197,8 +5224,8 @@ const typeMap: any = { ConnectionStep6ConnectedAgentsUpdatePayload: o( [ { json: 'addAgent', js: 'addAgent', typ: u(undefined, '') }, - { json: 'allAgents', js: 'allAgents', typ: a(r('BaseImplementationMetadata')) }, - { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('Context')))) }, + { json: 'allAgents', js: 'allAgents', typ: a(r('ImplementationMetadataElement')) }, + { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('ContextElement')))) }, { json: 'removeAgent', js: 'removeAgent', typ: u(undefined, '') }, ], false @@ -5412,7 +5439,7 @@ const typeMap: any = { ), FindIntentAgentRequestPayload: o( [ - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, { json: 'intent', js: 'intent', typ: '' }, ], false @@ -5486,7 +5513,7 @@ const typeMap: any = { ), FindIntentBridgeRequestPayload: o( [ - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, { json: 'intent', js: 'intent', typ: '' }, ], false @@ -5545,7 +5572,7 @@ const typeMap: any = { ], false ), - FindIntentsByContextAgentRequestPayload: o([{ json: 'context', js: 'context', typ: r('Context') }], false), + FindIntentsByContextAgentRequestPayload: o([{ json: 'context', js: 'context', typ: r('ContextElement') }], false), FindIntentsByContextAgentResponse: o( [ { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentResponseMeta') }, @@ -5602,7 +5629,7 @@ const typeMap: any = { ], false ), - FindIntentsByContextBridgeRequestPayload: o([{ json: 'context', js: 'context', typ: r('Context') }], false), + FindIntentsByContextBridgeRequestPayload: o([{ json: 'context', js: 'context', typ: r('ContextElement') }], false), FindIntentsByContextBridgeResponse: o( [ { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeResponseMeta') }, @@ -5780,7 +5807,7 @@ const typeMap: any = { OpenAgentRequestPayload: o( [ { json: 'app', js: 'app', typ: r('AppToOpen') }, - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, ], false ), @@ -5848,7 +5875,7 @@ const typeMap: any = { OpenBridgeRequestPayload: o( [ { json: 'app', js: 'app', typ: r('AppToOpen') }, - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, ], false ), @@ -5900,7 +5927,7 @@ const typeMap: any = { PrivateChannelBroadcastAgentRequestPayload: o( [ { json: 'channelId', js: 'channelId', typ: '' }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, ], false ), @@ -5924,7 +5951,7 @@ const typeMap: any = { PrivateChannelBroadcastBridgeRequestPayload: o( [ { json: 'channelId', js: 'channelId', typ: '' }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, ], false ), @@ -6193,7 +6220,7 @@ const typeMap: any = { RaiseIntentAgentRequestPayload: o( [ { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, { json: 'intent', js: 'intent', typ: '' }, ], false @@ -6265,7 +6292,7 @@ const typeMap: any = { RaiseIntentBridgeRequestPayload: o( [ { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, { json: 'intent', js: 'intent', typ: '' }, ], false @@ -6335,7 +6362,7 @@ const typeMap: any = { ), IntentResult: o( [ - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) }, ], false @@ -6401,6 +6428,14 @@ const typeMap: any = { [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }], false ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), ResponseErrorDetail: [ 'AccessDenied', 'AgentDisconnected', diff --git a/src/context/ContextTypes.ts b/src/context/ContextTypes.ts index 12c5607a3..5f0afedf2 100644 --- a/src/context/ContextTypes.ts +++ b/src/context/ContextTypes.ts @@ -53,7 +53,7 @@ export interface Action { /** * A context object with which the action will be performed */ - context: Context; + context: ContextElement; /** * Optional Intent to raise to perform the actions. Should reference an intent type name, * such as those defined in the FDC3 Standard. If intent is not set then @@ -65,7 +65,7 @@ export interface Action { * A human readable display name for the action */ title: string; - type: ActionType; + type: 'fdc3.action'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -119,7 +119,7 @@ export interface ActionTargetApp { * data object of a particular type can be expected to have, but this can always be extended * with custom fields as appropriate. */ -export interface Context { +export interface ContextElement { /** * Context data objects may include a set of equivalent key-value pairs that can be used to * help applications identify and look up the context type they receive in their own domain. @@ -165,9 +165,6 @@ export interface Context { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ActionType { - Fdc3Action = 'fdc3.action', -} /** * A context type representing details of a Chart, which may be used to request plotting of @@ -187,22 +184,22 @@ export interface Chart { /** * An array of instrument contexts whose data should be plotted. */ - instruments: Instrument[]; + instruments: InstrumentElement[]; /** * It is common for charts to support other configuration, such as indicators, annotations * etc., which do not have standardized formats, but may be included in the `otherConfig` * array as context objects. */ - otherConfig?: Context[]; + otherConfig?: ContextElement[]; /** * The time range that should be plotted */ - range?: TimeRange; + range?: TimeRangeObject; /** * The type of chart that should be plotted */ style?: ChartStyle; - type: ChartType; + type: 'fdc3.chart'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -215,7 +212,7 @@ export interface Chart { * * A financial instrument from any asset class. */ -export interface Instrument { +export interface InstrumentElement { /** * Any combination of instrument identifiers can be used together to resolve ambiguity, or * for a better match. Not all applications will use the same instrument identifiers, which @@ -231,14 +228,14 @@ export interface Instrument { * fields, define a property that makes it clear what the value represents. Doing so will * make interpretation easier for the developers of target applications. */ - id: InstrumentIdentifiers; + id: PurpleInstrumentIdentifiers; /** * The `market` map can be used to further specify the instrument and help achieve * interoperability between disparate data sources. This is especially useful when using an * `id` field that is not globally unique. */ - market?: Market; - type: PurpleInteractionType; + market?: OrganizationMarket; + type: 'fdc3.instrument'; name?: string; [property: string]: any; } @@ -258,7 +255,7 @@ export interface Instrument { * fields, define a property that makes it clear what the value represents. Doing so will * make interpretation easier for the developers of target applications. */ -export interface InstrumentIdentifiers { +export interface PurpleInstrumentIdentifiers { /** * */ @@ -303,7 +300,7 @@ export interface InstrumentIdentifiers { * interoperability between disparate data sources. This is especially useful when using an * `id` field that is not globally unique. */ -export interface Market { +export interface OrganizationMarket { /** * */ @@ -329,9 +326,6 @@ export interface Market { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum PurpleInteractionType { - Fdc3Instrument = 'fdc3.instrument', -} /** * The time range that should be plotted @@ -369,7 +363,7 @@ export enum PurpleInteractionType { * `"2022-05-12T16:18:03+01:00"` * - Times MAY be specified with millisecond precision, e.g. `"2022-05-12T15:18:03.349Z"` */ -export interface TimeRange { +export interface TimeRangeObject { /** * The end time of the range, encoded according to [ISO * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. @@ -380,7 +374,7 @@ export interface TimeRange { * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. */ startTime?: Date; - type: TimeRangeType; + type: 'fdc3.timerange'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -392,25 +386,21 @@ export interface TimeRange { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum TimeRangeType { - Fdc3Timerange = 'fdc3.timerange', -} /** * The type of chart that should be plotted */ -export enum ChartStyle { - Bar = 'bar', - Candle = 'candle', - Custom = 'custom', - Heatmap = 'heatmap', - Histogram = 'histogram', - Line = 'line', - Mountain = 'mountain', - Pie = 'pie', - Scatter = 'scatter', - StackedBar = 'stacked-bar', -} +export type ChartStyle = + | 'line' + | 'bar' + | 'stacked-bar' + | 'mountain' + | 'candle' + | 'pie' + | 'scatter' + | 'histogram' + | 'heatmap' + | 'custom'; /** * Free text to be used for a keyword search @@ -418,9 +408,6 @@ export enum ChartStyle { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ChartType { - Fdc3Chart = 'fdc3.chart', -} /** * A collection of settings to start a new chat conversation @@ -433,16 +420,16 @@ export interface ChatInitSettings { /** * Contacts to add to the chat */ - members?: ContactList; + members?: ContactListObject; /** * An initial message to post in the chat when created. */ - message?: Message | string; + message?: MessageObject | string; /** * Option settings that affect the creation of the chat */ options?: ChatOptions; - type: ChatInitSettingsType; + type: 'fdc3.chat.initSettings'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -459,12 +446,12 @@ export interface ChatInitSettings { * there is not a common standard for such identifiers. Applications can, however, populate * this part of the contract with custom identifiers if so desired. */ -export interface ContactList { +export interface ContactListObject { /** * An array of contact contexts that forms the list. */ - contacts: Contact[]; - type: ContactListType; + contacts: ContactElement[]; + type: 'fdc3.contactList'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -475,12 +462,12 @@ export interface ContactList { * * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ -export interface Contact { +export interface ContactElement { /** * Identifiers that relate to the Contact represented by this context */ - id: ContactID; - type: FluffyInteractionType; + id: PurpleContactIdentifiers; + type: 'fdc3.contact'; name?: string; [property: string]: any; } @@ -488,7 +475,7 @@ export interface Contact { /** * Identifiers that relate to the Contact represented by this context */ -export interface ContactID { +export interface PurpleContactIdentifiers { /** * The email address for the contact */ @@ -506,9 +493,6 @@ export interface ContactID { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum FluffyInteractionType { - Fdc3Contact = 'fdc3.contact', -} /** * Free text to be used for a keyword search @@ -516,9 +500,6 @@ export enum FluffyInteractionType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ContactListType { - Fdc3ContactList = 'fdc3.contactList', -} /** * A chat message to be sent through an instant messaging application. Can contain one or @@ -526,17 +507,17 @@ export enum ContactListType { * entities (either arbitrary file attachments or FDC3 actions to be embedded in the * message). To be put inside a ChatInitSettings object. */ -export interface Message { +export interface MessageObject { /** * A map of string IDs to entities that should be attached to the message, such as an action * to perform, a file attachment, or other FDC3 context object. */ - entities?: { [key: string]: EntityValue }; + entities?: { [key: string]: PurpleAction }; /** * A map of string mime-type to string content */ - text?: MessageText; - type: MessageType; + text?: PurpleMessageText; + type: 'fdc3.message'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -555,7 +536,7 @@ export interface Message { * * A File attachment encoded in the form of a data URI */ -export interface EntityValue { +export interface PurpleAction { /** * An optional target application identifier that should perform the action */ @@ -563,7 +544,7 @@ export interface EntityValue { /** * A context object with which the action will be performed */ - context?: Context; + context?: ContextElement; /** * Optional Intent to raise to perform the actions. Should reference an intent type name, * such as those defined in the FDC3 Standard. If intent is not set then @@ -578,11 +559,11 @@ export interface EntityValue { type: EntityType; id?: { [key: string]: any }; name?: string; - data?: Data; + data?: PurpleData; [property: string]: any; } -export interface Data { +export interface PurpleData { /** * A data URI encoding the content of the file to be attached */ @@ -600,15 +581,12 @@ export interface Data { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum EntityType { - Fdc3Action = 'fdc3.action', - Fdc3EntityFileAttachment = 'fdc3.entity.fileAttachment', -} +export type EntityType = 'fdc3.action' | 'fdc3.entity.fileAttachment'; /** * A map of string mime-type to string content */ -export interface MessageText { +export interface PurpleMessageText { /** * Markdown encoded content */ @@ -626,9 +604,6 @@ export interface MessageText { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum MessageType { - Fdc3Message = 'fdc3.message', -} /** * Option settings that affect the creation of the chat @@ -663,21 +638,18 @@ export interface ChatOptions { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ChatInitSettingsType { - Fdc3ChatInitSettings = 'fdc3.chat.initSettings', -} /** * A context representing a chat message. Typically used to send the message or to * pre-populate a message for sending. */ export interface ChatMessage { - chatRoom: ChatRoom; + chatRoom: ChatRoomObject; /** * The content of the message to post in the chat when created. */ - message: Message | string; - type: ChatMessageType; + message: MessageObject | string; + type: 'fdc3.chat.message'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -686,7 +658,7 @@ export interface ChatMessage { /** * Reference to the chat room which could be used to send a message to the room */ -export interface ChatRoom { +export interface ChatRoomObject { /** * Identifier(s) for the chat - currently unstandardized */ @@ -699,7 +671,7 @@ export interface ChatRoom { * The name of the service that hosts the chat */ providerName: string; - type: ChatRoomType; + type: 'fdc3.chat.room'; /** * Universal url to access to the room. It could be opened from a browser, a mobile app, * etc... @@ -714,9 +686,6 @@ export interface ChatRoom { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ChatRoomType { - Fdc3ChatRoom = 'fdc3.chat.room', -} /** * Free text to be used for a keyword search @@ -724,8 +693,30 @@ export enum ChatRoomType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ChatMessageType { - Fdc3ChatMessage = 'fdc3.chat.message', + +/** + * Reference to the chat room which could be used to send a message to the room + */ +export interface ChatRoom { + /** + * Identifier(s) for the chat - currently unstandardized + */ + id: { [key: string]: any }; + /** + * Display name for the chat room + */ + name?: string; + /** + * The name of the service that hosts the chat + */ + providerName: string; + type: 'fdc3.chat.room'; + /** + * Universal url to access to the room. It could be opened from a browser, a mobile app, + * etc... + */ + url?: string; + [property: string]: any; } /** @@ -742,8 +733,8 @@ export interface ChatSearchCriteria { * * Empty search criteria can be supported to allow resetting of filters. */ - criteria: Array; - type: ChatSearchCriteriaType; + criteria: Array; + type: 'fdc3.chat.searchCriteria'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -766,7 +757,7 @@ export interface ChatSearchCriteria { * * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ -export interface InstrumentObject { +export interface OrganizationObject { /** * Any combination of instrument identifiers can be used together to resolve ambiguity, or * for a better match. Not all applications will use the same instrument identifiers, which @@ -792,7 +783,7 @@ export interface InstrumentObject { * interoperability between disparate data sources. This is especially useful when using an * `id` field that is not globally unique. */ - market?: Market; + market?: OrganizationMarket; type: TentacledInteractionType; name?: string; [property: string]: any; @@ -880,11 +871,7 @@ export interface Identifiers { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum TentacledInteractionType { - Fdc3Contact = 'fdc3.contact', - Fdc3Instrument = 'fdc3.instrument', - Fdc3Organization = 'fdc3.organization', -} +export type TentacledInteractionType = 'fdc3.instrument' | 'fdc3.organization' | 'fdc3.contact'; /** * Free text to be used for a keyword search @@ -892,8 +879,104 @@ export enum TentacledInteractionType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ChatSearchCriteriaType { - Fdc3ChatSearchCriteria = 'fdc3.chat.searchCriteria', + +/** + * A person contact that can be engaged with through email, calling, messaging, CMS, etc. + */ +export interface Contact { + /** + * Identifiers that relate to the Contact represented by this context + */ + id: FluffyContactIdentifiers; + type: 'fdc3.contact'; + name?: string; + [property: string]: any; +} + +/** + * Identifiers that relate to the Contact represented by this context + */ +export interface FluffyContactIdentifiers { + /** + * The email address for the contact + */ + email?: string; + /** + * FactSet Permanent Identifier representing the contact + */ + FDS_ID?: string; + [property: string]: any; +} + +/** + * A collection of contacts, e.g. for chatting to or calling multiple contacts. + * + * The contact list schema does not explicitly include identifiers in the `id` section, as + * there is not a common standard for such identifiers. Applications can, however, populate + * this part of the contract with custom identifiers if so desired. + */ +export interface ContactList { + /** + * An array of contact contexts that forms the list. + */ + contacts: ContactElement[]; + type: 'fdc3.contactList'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; +} + +/** + * The `fdc3.context` type defines the basic contract or "shape" for all data exchanged by + * FDC3 operations. As such, it is not really meant to be used on its own, but is imported + * by more specific type definitions (standardized or custom) to provide the structure and + * properties shared by all FDC3 context data types. + * + * The key element of FDC3 context types is their mandatory `type` property, which is used + * to identify what type of data the object represents, and what shape it has. + * + * The FDC3 context type, and all derived types, define the minimum set of fields a context + * data object of a particular type can be expected to have, but this can always be extended + * with custom fields as appropriate. + */ +export interface Context { + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -915,7 +998,7 @@ export enum ChatSearchCriteriaType { */ export interface Country { id: CountryID; - type: CountryType; + type: 'fdc3.country'; name?: string; [property: string]: any; } @@ -948,9 +1031,6 @@ export interface CountryID { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum CountryType { - Fdc3Country = 'fdc3.country', -} /** * A context representing an individual Currency. @@ -961,7 +1041,7 @@ export interface Currency { * The name of the currency for display purposes */ name?: string; - type: CurrencyType; + type: 'fdc3.currency'; [property: string]: any; } @@ -980,9 +1060,6 @@ export interface CurrencyID { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum CurrencyType { - Fdc3Currency = 'fdc3.currency', -} /** * A collection of information to be used to initiate an email with a Contact or ContactList. @@ -1000,7 +1077,7 @@ export interface Email { * Body content for the email. */ textBody?: string; - type: EmailType; + type: 'fdc3.email'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1033,7 +1110,7 @@ export interface EmailRecipients { /** * An array of contact contexts that forms the list. */ - contacts?: Contact[]; + contacts?: ContactElement[]; [property: string]: any; } @@ -1058,10 +1135,7 @@ export interface EmailRecipientsID { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum EmailRecipientsType { - Fdc3Contact = 'fdc3.contact', - Fdc3ContactList = 'fdc3.contactList', -} +export type EmailRecipientsType = 'fdc3.contact' | 'fdc3.contactList'; /** * Free text to be used for a keyword search @@ -1069,8 +1143,116 @@ export enum EmailRecipientsType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum EmailType { - Fdc3Email = 'fdc3.email', + +/** + * A financial instrument from any asset class. + */ +export interface Instrument { + /** + * Any combination of instrument identifiers can be used together to resolve ambiguity, or + * for a better match. Not all applications will use the same instrument identifiers, which + * is why FDC3 allows for multiple to be specified. In general, the more identifiers an + * application can provide, the easier it will be to achieve interoperability. + * + * It is valid to include extra properties and metadata as part of the instrument payload, + * but the minimum requirement is for at least one instrument identifier to be provided. + * + * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant + * for tickers as used by an exchange. + * If the identifier you want to share is not a ticker or one of the other standardized + * fields, define a property that makes it clear what the value represents. Doing so will + * make interpretation easier for the developers of target applications. + */ + id: FluffyInstrumentIdentifiers; + /** + * The `market` map can be used to further specify the instrument and help achieve + * interoperability between disparate data sources. This is especially useful when using an + * `id` field that is not globally unique. + */ + market?: PurpleMarket; + type: 'fdc3.instrument'; + name?: string; + [property: string]: any; +} + +/** + * Any combination of instrument identifiers can be used together to resolve ambiguity, or + * for a better match. Not all applications will use the same instrument identifiers, which + * is why FDC3 allows for multiple to be specified. In general, the more identifiers an + * application can provide, the easier it will be to achieve interoperability. + * + * It is valid to include extra properties and metadata as part of the instrument payload, + * but the minimum requirement is for at least one instrument identifier to be provided. + * + * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant + * for tickers as used by an exchange. + * If the identifier you want to share is not a ticker or one of the other standardized + * fields, define a property that makes it clear what the value represents. Doing so will + * make interpretation easier for the developers of target applications. + */ +export interface FluffyInstrumentIdentifiers { + /** + * + */ + BBG?: string; + /** + * + */ + CUSIP?: string; + /** + * + */ + FDS_ID?: string; + /** + * + */ + FIGI?: string; + /** + * + */ + ISIN?: string; + /** + * + */ + PERMID?: string; + /** + * + */ + RIC?: string; + /** + * + */ + SEDOL?: string; + /** + * Unstandardized stock tickers + */ + ticker?: string; + [property: string]: any; +} + +/** + * The `market` map can be used to further specify the instrument and help achieve + * interoperability between disparate data sources. This is especially useful when using an + * `id` field that is not globally unique. + */ +export interface PurpleMarket { + /** + * + */ + BBG?: string; + /** + * + */ + COUNTRY_ISOALPHA2?: string; + /** + * + */ + MIC?: string; + /** + * Human readable market name + */ + name?: string; + [property: string]: any; } /** @@ -1087,8 +1269,8 @@ export interface InstrumentList { /** * An array of instrument contexts that forms the list. */ - instruments: Instrument[]; - type: InstrumentListType; + instruments: InstrumentElement[]; + type: 'fdc3.instrumentList'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1100,9 +1282,6 @@ export interface InstrumentList { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum InstrumentListType { - Fdc3InstrumentList = 'fdc3.instrumentList', -} /** * An `Interaction` is a significant direct exchange of ideas or information between a @@ -1126,7 +1305,7 @@ export interface Interaction { /** * The contact that initiated the interaction */ - initiator?: Contact; + initiator?: ContactElement; /** * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. @@ -1140,12 +1319,12 @@ export interface Interaction { /** * A list of contacts involved in the interaction */ - participants: ContactList; + participants: ContactListObject; /** * The time range over which the interaction occurred */ - timeRange: TimeRange; - type: InteractionType; + timeRange: TimeRangeObject; + type: 'fdc3.interaction'; name?: string; [property: string]: any; } @@ -1181,60 +1360,124 @@ export interface InteractionID { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum InteractionType { - Fdc3Interaction = 'fdc3.interaction', -} /** - * A type that explicitly represents a lack of context. - * - * Notes: - * - * - Intended to be used in situations where no context is desired. - * - For example: - * - Raising an intent without context (e.g. opening a blank order form, or chat interface - * without a contact selected). - * - Resetting context on a channel (e.g. when context is used to set a filter in other - * applications a null context might release the filter). - * - An explicit representation of a Null or empty context allows apps to declare support - * for a lack of context, for example in their intent metadata in an app directory. + * A chat message to be sent through an instant messaging application. Can contain one or + * several text bodies (organized by mime-type, plaintext or markdown), as well as attached + * entities (either arbitrary file attachments or FDC3 actions to be embedded in the + * message). To be put inside a ChatInitSettings object. */ -export interface Nothing { - type: NothingType; +export interface Message { + /** + * A map of string IDs to entities that should be attached to the message, such as an action + * to perform, a file attachment, or other FDC3 context object. + */ + entities?: { [key: string]: FluffyAction }; + /** + * A map of string mime-type to string content + */ + text?: FluffyMessageText; + type: 'fdc3.message'; id?: { [key: string]: any }; name?: string; [property: string]: any; } /** - * Free text to be used for a keyword search + * A representation of an FDC3 Action (specified via a Context or Context & Intent) that can + * be inserted inside another object, for example a chat message. * - * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or - * `'Meeting'` although other string values are permitted. + * The action may be completed by calling `fdc3.raiseIntent()` with the specified Intent and + * Context, or, if only a context is specified, by calling `fdc3.raiseIntentForContext()` + * (which the Desktop Agent will resolve by presenting the user with a list of available + * Intents for the Context). + * + * Accepts an optional `app` parameter in order to specify a specific app. + * + * A File attachment encoded in the form of a data URI */ -export enum NothingType { - Fdc3Nothing = 'fdc3.nothing', +export interface FluffyAction { + /** + * An optional target application identifier that should perform the action + */ + app?: ActionTargetApp; + /** + * A context object with which the action will be performed + */ + context?: ContextElement; + /** + * Optional Intent to raise to perform the actions. Should reference an intent type name, + * such as those defined in the FDC3 Standard. If intent is not set then + * `fdc3.raiseIntentForContext` should be used to perform the action as this will usually + * allow the user to choose the intent to raise. + */ + intent?: string; + /** + * A human readable display name for the action + */ + title?: string; + type: EntityType; + id?: { [key: string]: any }; + name?: string; + data?: FluffyData; + [property: string]: any; +} + +export interface FluffyData { + /** + * A data URI encoding the content of the file to be attached + */ + dataUri: string; + /** + * The name of the attached file + */ + name: string; + [property: string]: any; } /** - * @experimental A list of orders. Use this type for use cases that require not just a - * single order, but multiple. - * - * The OrderList schema does not explicitly include identifiers in the id section, as there - * is not a common standard for such identifiers. Applications can, however, populate this - * part of the contract with custom identifiers if so desired. + * A map of string mime-type to string content */ -export interface OrderList { +export interface FluffyMessageText { /** - * An array of order contexts that forms the list. + * Markdown encoded content + */ + 'text/markdown'?: string; + /** + * Plain text encoded content. */ - orders: Order[]; - type: OrderListType; + 'text/plain'?: string; + [property: string]: any; +} + +/** + * A type that explicitly represents a lack of context. + * + * Notes: + * + * - Intended to be used in situations where no context is desired. + * - For example: + * - Raising an intent without context (e.g. opening a blank order form, or chat interface + * without a contact selected). + * - Resetting context on a channel (e.g. when context is used to set a filter in other + * applications a null context might release the filter). + * - An explicit representation of a Null or empty context allows apps to declare support + * for a lack of context, for example in their intent metadata in an app directory. + */ +export interface Nothing { + type: 'fdc3.nothing'; id?: { [key: string]: any }; name?: string; [property: string]: any; } +/** + * Free text to be used for a keyword search + * + * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or + * `'Meeting'` although other string values are permitted. + */ + /** * @experimental context type representing an order. To be used with OMS and EMS systems. * @@ -1251,7 +1494,7 @@ export interface Order { * Optional additional details about the order, which may include a product element that is * an, as yet undefined but extensible, Context */ - details?: OrderDetails; + details?: PurpleOrderDetails; /** * One or more identifiers that refer to the order in an OMS, EMS or related system. * Specific key names for systems are expected to be standardized in future. @@ -1261,7 +1504,7 @@ export interface Order { * An optional human-readable summary of the order. */ name?: string; - type: OrderType; + type: 'fdc3.order'; [property: string]: any; } @@ -1269,8 +1512,8 @@ export interface Order { * Optional additional details about the order, which may include a product element that is * an, as yet undefined but extensible, Context */ -export interface OrderDetails { - product?: Product; +export interface PurpleOrderDetails { + product?: ProductObject; [property: string]: any; } @@ -1287,7 +1530,7 @@ export interface OrderDetails { * not a common standard for such identifiers. Applications can, however, populate this part * of the contract with custom identifiers if so desired. */ -export interface Product { +export interface ProductObject { /** * One or more identifiers that refer to the product. Specific key names for systems are * expected to be standardized in future. @@ -1296,12 +1539,12 @@ export interface Product { /** * financial instrument that relates to the definition of this product */ - instrument?: Instrument; + instrument?: InstrumentElement; /** * A human-readable summary of the product. */ name?: string; - type: ProductType; + type: 'fdc3.product'; [property: string]: any; } @@ -1311,9 +1554,6 @@ export interface Product { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ProductType { - Fdc3Product = 'fdc3.product', -} /** * Free text to be used for a keyword search @@ -1321,8 +1561,63 @@ export enum ProductType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum OrderType { - Fdc3Order = 'fdc3.order', + +/** + * @experimental A list of orders. Use this type for use cases that require not just a + * single order, but multiple. + * + * The OrderList schema does not explicitly include identifiers in the id section, as there + * is not a common standard for such identifiers. Applications can, however, populate this + * part of the contract with custom identifiers if so desired. + */ +export interface OrderList { + /** + * An array of order contexts that forms the list. + */ + orders: OrderElement[]; + type: 'fdc3.orderList'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; +} + +/** + * @experimental context type representing an order. To be used with OMS and EMS systems. + * + * This type currently only defines a required `id` field, which should provide a reference + * to the order in one or more systems, an optional human readable `name` field to be used + * to summarize the order and an optional `details` field that may be used to provide + * additional detail about the order, including a context representing a `product`, which + * may be extended with arbitrary properties. The `details.product` field is currently typed + * as a unspecified Context type, but both `details` and `details.product` are expected to + * be standardized in future. + */ +export interface OrderElement { + /** + * Optional additional details about the order, which may include a product element that is + * an, as yet undefined but extensible, Context + */ + details?: FluffyOrderDetails; + /** + * One or more identifiers that refer to the order in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * An optional human-readable summary of the order. + */ + name?: string; + type: 'fdc3.order'; + [property: string]: any; +} + +/** + * Optional additional details about the order, which may include a product element that is + * an, as yet undefined but extensible, Context + */ +export interface FluffyOrderDetails { + product?: ProductObject; + [property: string]: any; } /** @@ -1331,9 +1626,6 @@ export enum OrderType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum OrderListType { - Fdc3OrderList = 'fdc3.orderList', -} /** * An entity that can be used when referencing private companies and other organizations @@ -1347,7 +1639,7 @@ export interface Organization { * Identifiers for the organization, at least one must be provided. */ id: OrganizationIdentifiers; - type: StickyInteractionType; + type: 'fdc3.organization'; name?: string; [property: string]: any; } @@ -1380,9 +1672,6 @@ export interface OrganizationIdentifiers { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum StickyInteractionType { - Fdc3Organization = 'fdc3.organization', -} /** * A financial portfolio made up of multiple positions (holdings) in several instruments. @@ -1403,8 +1692,8 @@ export interface Portfolio { /** * The List of Positions which make up the Portfolio */ - positions: Position[]; - type: PortfolioType; + positions: PositionElement[]; + type: 'fdc3.portfolio'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1424,13 +1713,13 @@ export interface Portfolio { * is not a common standard for such identifiers. Applications can, however, populate this * part of the contract with custom identifiers if so desired. */ -export interface Position { +export interface PositionElement { /** * The amount of the holding, e.g. a number of shares */ holding: number; - instrument: Instrument; - type: PositionType; + instrument: InstrumentElement; + type: 'fdc3.position'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1442,9 +1731,6 @@ export interface Position { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum PositionType { - Fdc3Position = 'fdc3.position', -} /** * Free text to be used for a keyword search @@ -1452,24 +1738,106 @@ export enum PositionType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum PortfolioType { - Fdc3Portfolio = 'fdc3.portfolio', -} /** - * @experimental A list of trades. Use this type for use cases that require not just a - * single trade, but multiple. + * A financial position made up of an instrument and a holding in that instrument. This type + * is a good example of how new context types can be composed from existing types. * - * The TradeList schema does not explicitly include identifiers in the id section, as there + * In this case, the instrument and the holding amount for that instrument are required + * values. + * + * The [Position](Position) type goes hand-in-hand with the [Portfolio](Portfolio) type, + * which represents multiple holdings in a combination of instruments. + * + * The position schema does not explicitly include identifiers in the `id` section, as there * is not a common standard for such identifiers. Applications can, however, populate this * part of the contract with custom identifiers if so desired. */ -export interface TradeList { +export interface Position { /** - * An array of trade contexts that forms the list. + * The amount of the holding, e.g. a number of shares + */ + holding: number; + instrument: InstrumentElement; + type: 'fdc3.position'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; +} + +/** + * @experimental context type representing a tradable product. To be used with OMS and EMS + * systems. + * + * This type is currently only loosely defined as an extensible context object, with an + * optional instrument field. + * + * The Product schema does not explicitly include identifiers in the id section, as there is + * not a common standard for such identifiers. Applications can, however, populate this part + * of the contract with custom identifiers if so desired. + */ +export interface Product { + /** + * One or more identifiers that refer to the product. Specific key names for systems are + * expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * financial instrument that relates to the definition of this product + */ + instrument?: InstrumentElement; + /** + * A human-readable summary of the product. + */ + name?: string; + type: 'fdc3.product'; + [property: string]: any; +} + +/** + * A context representing a period of time. Any user interfaces that represent or visualize + * events or activity over time can be filtered or focused on a particular time period, + * e.g.: + * + * - A pricing chart + * - A trade blotter + * - A record of client contact/activity in a CRM + * + * Example use cases: + * + * - User may want to view pricing/trades/customer activity for a security over a particular + * time period, the time range might be specified as the context for the `ViewChart` intent + * OR it might be embedded in another context (e.g. a context representing a chart to plot). + * - User filters a visualization (e.g. a pricing chart) to show a particular period, the + * `TimeRange` is broadcast and other visualizations (e.g. a heatmap of activity by + * instrument, or industry sector etc.) receive it and filter themselves to show data over + * the same range. + * + * Notes: + * + * - A `TimeRange` may be closed (i.e. `startTime` and `endTime` are both known) or open + * (i.e. only one of `startTime` or `endTime` is known). + * - Ranges corresponding to dates (e.g. `2022-05-12` to `2022-05-19`) should be specified + * using times as this prevents issues with timezone conversions and inclusive/exclusive + * date ranges. + * - String fields representing times are encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html). + * - A timezone indicator should be specified, e.g. `"2022-05-12T15:18:03Z"` or + * `"2022-05-12T16:18:03+01:00"` + * - Times MAY be specified with millisecond precision, e.g. `"2022-05-12T15:18:03.349Z"` + */ +export interface TimeRange { + /** + * The end time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. + */ + endTime?: Date; + /** + * The start time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. */ - trades: Trade[]; - type: TradeListType; + startTime?: Date; + type: 'fdc3.timerange'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1501,8 +1869,8 @@ export interface Trade { /** * A product that is the subject of th trade. */ - product: Product; - type: TradeType; + product: ProductObject; + type: 'fdc3.trade'; [property: string]: any; } @@ -1512,8 +1880,55 @@ export interface Trade { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum TradeType { - Fdc3Trade = 'fdc3.trade', + +/** + * @experimental A list of trades. Use this type for use cases that require not just a + * single trade, but multiple. + * + * The TradeList schema does not explicitly include identifiers in the id section, as there + * is not a common standard for such identifiers. Applications can, however, populate this + * part of the contract with custom identifiers if so desired. + */ +export interface TradeList { + /** + * An array of trade contexts that forms the list. + */ + trades: TradeElement[]; + type: 'fdc3.tradeList'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; +} + +/** + * @experimental context type representing a trade. To be used with execution systems. + * + * This type currently only defines a required `id` field, which should provide a reference + * to the trade in one or more systems, an optional human readable `name` field to be used + * to summarize the trade and a required `product` field that may be used to provide + * additional detail about the trade, which is currently typed as a unspecified Context + * type, but `product` is expected to be standardized in future. + * + * The Trade schema does not explicitly include identifiers in the id section, as there is + * not a common standard for such identifiers. Applications can, however, populate this part + * of the contract with custom identifiers if so desired. + */ +export interface TradeElement { + /** + * One or more identifiers that refer to the trade in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * A human-readable summary of the trade. + */ + name?: string; + /** + * A product that is the subject of th trade. + */ + product: ProductObject; + type: 'fdc3.trade'; + [property: string]: any; } /** @@ -1522,9 +1937,6 @@ export enum TradeType { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum TradeListType { - Fdc3TradeList = 'fdc3.tradeList', -} /** * A context type representing the result of a transaction initiated via FDC3, which SHOULD @@ -1536,12 +1948,12 @@ export interface TransactionResult { /** * A context object returned by the transaction, possibly with updated data. */ - context?: Context; + context?: ContextElement; /** * The status of the transaction being reported. */ status: TransactionStatus; - type: TransactionResultType; + type: 'fdc3.transactionResult'; id?: { [key: string]: any }; name?: string; [property: string]: any; @@ -1550,12 +1962,7 @@ export interface TransactionResult { /** * The status of the transaction being reported. */ -export enum TransactionStatus { - Created = 'Created', - Deleted = 'Deleted', - Failed = 'Failed', - Updated = 'Updated', -} +export type TransactionStatus = 'Created' | 'Deleted' | 'Updated' | 'Failed'; /** * Free text to be used for a keyword search @@ -1563,9 +1970,6 @@ export enum TransactionStatus { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum TransactionResultType { - Fdc3TransactionResult = 'fdc3.transactionResult', -} /** * A context type representing the price and value of a holding. @@ -1585,7 +1989,7 @@ export interface Valuation { * The price per unit the the valuation is based on. */ price?: number; - type: ValuationType; + type: 'fdc3.valuation'; /** * The time at which the valuation was performed, encoded according to [ISO * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator included. @@ -1606,9 +2010,6 @@ export interface Valuation { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export enum ValuationType { - Fdc3Valuation = 'fdc3.valuation', -} // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime @@ -2008,7 +2409,7 @@ const typeMap: any = { Action: o( [ { json: 'app', js: 'app', typ: u(undefined, r('ActionTargetApp')) }, - { json: 'context', js: 'context', typ: r('Context') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, { json: 'intent', js: 'intent', typ: u(undefined, '') }, { json: 'title', js: 'title', typ: '' }, { json: 'type', js: 'type', typ: r('ActionType') }, @@ -2025,7 +2426,7 @@ const typeMap: any = { ], 'any' ), - Context: o( + ContextElement: o( [ { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, @@ -2035,9 +2436,9 @@ const typeMap: any = { ), Chart: o( [ - { json: 'instruments', js: 'instruments', typ: a(r('Instrument')) }, - { json: 'otherConfig', js: 'otherConfig', typ: u(undefined, a(r('Context'))) }, - { json: 'range', js: 'range', typ: u(undefined, r('TimeRange')) }, + { json: 'instruments', js: 'instruments', typ: a(r('InstrumentElement')) }, + { json: 'otherConfig', js: 'otherConfig', typ: u(undefined, a(r('ContextElement'))) }, + { json: 'range', js: 'range', typ: u(undefined, r('TimeRangeObject')) }, { json: 'style', js: 'style', typ: u(undefined, r('ChartStyle')) }, { json: 'type', js: 'type', typ: r('ChartType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, @@ -2045,16 +2446,16 @@ const typeMap: any = { ], 'any' ), - Instrument: o( + InstrumentElement: o( [ - { json: 'id', js: 'id', typ: r('InstrumentIdentifiers') }, - { json: 'market', js: 'market', typ: u(undefined, r('Market')) }, + { json: 'id', js: 'id', typ: r('PurpleInstrumentIdentifiers') }, + { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - InstrumentIdentifiers: o( + PurpleInstrumentIdentifiers: o( [ { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, { json: 'CUSIP', js: 'CUSIP', typ: u(undefined, '') }, @@ -2068,7 +2469,7 @@ const typeMap: any = { ], 'any' ), - Market: o( + OrganizationMarket: o( [ { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u(undefined, '') }, @@ -2077,7 +2478,7 @@ const typeMap: any = { ], 'any' ), - TimeRange: o( + TimeRangeObject: o( [ { json: 'endTime', js: 'endTime', typ: u(undefined, Date) }, { json: 'startTime', js: 'startTime', typ: u(undefined, Date) }, @@ -2090,8 +2491,8 @@ const typeMap: any = { ChatInitSettings: o( [ { json: 'chatName', js: 'chatName', typ: u(undefined, '') }, - { json: 'members', js: 'members', typ: u(undefined, r('ContactList')) }, - { json: 'message', js: 'message', typ: u(undefined, u(r('Message'), '')) }, + { json: 'members', js: 'members', typ: u(undefined, r('ContactListObject')) }, + { json: 'message', js: 'message', typ: u(undefined, u(r('MessageObject'), '')) }, { json: 'options', js: 'options', typ: u(undefined, r('ChatOptions')) }, { json: 'type', js: 'type', typ: r('ChatInitSettingsType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, @@ -2099,61 +2500,61 @@ const typeMap: any = { ], 'any' ), - ContactList: o( + ContactListObject: o( [ - { json: 'contacts', js: 'contacts', typ: a(r('Contact')) }, + { json: 'contacts', js: 'contacts', typ: a(r('ContactElement')) }, { json: 'type', js: 'type', typ: r('ContactListType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - Contact: o( + ContactElement: o( [ - { json: 'id', js: 'id', typ: r('ContactID') }, + { json: 'id', js: 'id', typ: r('PurpleContactIdentifiers') }, { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - ContactID: o( + PurpleContactIdentifiers: o( [ { json: 'email', js: 'email', typ: u(undefined, '') }, { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, ], 'any' ), - Message: o( + MessageObject: o( [ - { json: 'entities', js: 'entities', typ: u(undefined, m(r('EntityValue'))) }, - { json: 'text', js: 'text', typ: u(undefined, r('MessageText')) }, + { json: 'entities', js: 'entities', typ: u(undefined, m(r('PurpleAction'))) }, + { json: 'text', js: 'text', typ: u(undefined, r('PurpleMessageText')) }, { json: 'type', js: 'type', typ: r('MessageType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - EntityValue: o( + PurpleAction: o( [ { json: 'app', js: 'app', typ: u(undefined, r('ActionTargetApp')) }, - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, { json: 'intent', js: 'intent', typ: u(undefined, '') }, { json: 'title', js: 'title', typ: u(undefined, '') }, { json: 'type', js: 'type', typ: r('EntityType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'data', js: 'data', typ: u(undefined, r('Data')) }, + { json: 'data', js: 'data', typ: u(undefined, r('PurpleData')) }, ], 'any' ), - Data: o( + PurpleData: o( [ { json: 'dataUri', js: 'dataUri', typ: '' }, { json: 'name', js: 'name', typ: '' }, ], 'any' ), - MessageText: o( + PurpleMessageText: o( [ { json: 'text/markdown', js: 'text/markdown', typ: u(undefined, '') }, { json: 'text/plain', js: 'text/plain', typ: u(undefined, '') }, @@ -2172,14 +2573,24 @@ const typeMap: any = { ), ChatMessage: o( [ - { json: 'chatRoom', js: 'chatRoom', typ: r('ChatRoom') }, - { json: 'message', js: 'message', typ: u(r('Message'), '') }, + { json: 'chatRoom', js: 'chatRoom', typ: r('ChatRoomObject') }, + { json: 'message', js: 'message', typ: u(r('MessageObject'), '') }, { json: 'type', js: 'type', typ: r('ChatMessageType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), + ChatRoomObject: o( + [ + { json: 'id', js: 'id', typ: m('any') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'providerName', js: 'providerName', typ: '' }, + { json: 'type', js: 'type', typ: r('ChatRoomType') }, + { json: 'url', js: 'url', typ: u(undefined, '') }, + ], + 'any' + ), ChatRoom: o( [ { json: 'id', js: 'id', typ: m('any') }, @@ -2192,17 +2603,17 @@ const typeMap: any = { ), ChatSearchCriteria: o( [ - { json: 'criteria', js: 'criteria', typ: a(u(r('InstrumentObject'), '')) }, + { json: 'criteria', js: 'criteria', typ: a(u(r('OrganizationObject'), '')) }, { json: 'type', js: 'type', typ: r('ChatSearchCriteriaType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - InstrumentObject: o( + OrganizationObject: o( [ { json: 'id', js: 'id', typ: r('Identifiers') }, - { json: 'market', js: 'market', typ: u(undefined, r('Market')) }, + { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, { json: 'type', js: 'type', typ: r('TentacledInteractionType') }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], @@ -2224,6 +2635,38 @@ const typeMap: any = { ], 'any' ), + Contact: o( + [ + { json: 'id', js: 'id', typ: r('FluffyContactIdentifiers') }, + { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + FluffyContactIdentifiers: o( + [ + { json: 'email', js: 'email', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + ], + 'any' + ), + ContactList: o( + [ + { json: 'contacts', js: 'contacts', typ: a(r('ContactElement')) }, + { json: 'type', js: 'type', typ: r('ContactListType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), Country: o( [ { json: 'id', js: 'id', typ: r('CountryID') }, @@ -2266,7 +2709,7 @@ const typeMap: any = { { json: 'id', js: 'id', typ: u(undefined, r('EmailRecipientsID')) }, { json: 'type', js: 'type', typ: r('EmailRecipientsType') }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'contacts', js: 'contacts', typ: u(undefined, a(r('Contact'))) }, + { json: 'contacts', js: 'contacts', typ: u(undefined, a(r('ContactElement'))) }, ], 'any' ), @@ -2277,9 +2720,41 @@ const typeMap: any = { ], 'any' ), + Instrument: o( + [ + { json: 'id', js: 'id', typ: r('FluffyInstrumentIdentifiers') }, + { json: 'market', js: 'market', typ: u(undefined, r('PurpleMarket')) }, + { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + FluffyInstrumentIdentifiers: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'CUSIP', js: 'CUSIP', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + { json: 'FIGI', js: 'FIGI', typ: u(undefined, '') }, + { json: 'ISIN', js: 'ISIN', typ: u(undefined, '') }, + { json: 'PERMID', js: 'PERMID', typ: u(undefined, '') }, + { json: 'RIC', js: 'RIC', typ: u(undefined, '') }, + { json: 'SEDOL', js: 'SEDOL', typ: u(undefined, '') }, + { json: 'ticker', js: 'ticker', typ: u(undefined, '') }, + ], + 'any' + ), + PurpleMarket: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u(undefined, '') }, + { json: 'MIC', js: 'MIC', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), InstrumentList: o( [ - { json: 'instruments', js: 'instruments', typ: a(r('Instrument')) }, + { json: 'instruments', js: 'instruments', typ: a(r('InstrumentElement')) }, { json: 'type', js: 'type', typ: r('InstrumentListType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, @@ -2290,11 +2765,11 @@ const typeMap: any = { [ { json: 'description', js: 'description', typ: '' }, { json: 'id', js: 'id', typ: u(undefined, r('InteractionID')) }, - { json: 'initiator', js: 'initiator', typ: u(undefined, r('Contact')) }, + { json: 'initiator', js: 'initiator', typ: u(undefined, r('ContactElement')) }, { json: 'interactionType', js: 'interactionType', typ: '' }, { json: 'origin', js: 'origin', typ: u(undefined, '') }, - { json: 'participants', js: 'participants', typ: r('ContactList') }, - { json: 'timeRange', js: 'timeRange', typ: r('TimeRange') }, + { json: 'participants', js: 'participants', typ: r('ContactListObject') }, + { json: 'timeRange', js: 'timeRange', typ: r('TimeRangeObject') }, { json: 'type', js: 'type', typ: r('InteractionType') }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], @@ -2308,18 +2783,46 @@ const typeMap: any = { ], 'any' ), - Nothing: o( + Message: o( [ - { json: 'type', js: 'type', typ: r('NothingType') }, + { json: 'entities', js: 'entities', typ: u(undefined, m(r('FluffyAction'))) }, + { json: 'text', js: 'text', typ: u(undefined, r('FluffyMessageText')) }, + { json: 'type', js: 'type', typ: r('MessageType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - OrderList: o( + FluffyAction: o( [ - { json: 'orders', js: 'orders', typ: a(r('Order')) }, - { json: 'type', js: 'type', typ: r('OrderListType') }, + { json: 'app', js: 'app', typ: u(undefined, r('ActionTargetApp')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, + { json: 'intent', js: 'intent', typ: u(undefined, '') }, + { json: 'title', js: 'title', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('EntityType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'data', js: 'data', typ: u(undefined, r('FluffyData')) }, + ], + 'any' + ), + FluffyData: o( + [ + { json: 'dataUri', js: 'dataUri', typ: '' }, + { json: 'name', js: 'name', typ: '' }, + ], + 'any' + ), + FluffyMessageText: o( + [ + { json: 'text/markdown', js: 'text/markdown', typ: u(undefined, '') }, + { json: 'text/plain', js: 'text/plain', typ: u(undefined, '') }, + ], + 'any' + ), + Nothing: o( + [ + { json: 'type', js: 'type', typ: r('NothingType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], @@ -2327,23 +2830,42 @@ const typeMap: any = { ), Order: o( [ - { json: 'details', js: 'details', typ: u(undefined, r('OrderDetails')) }, + { json: 'details', js: 'details', typ: u(undefined, r('PurpleOrderDetails')) }, { json: 'id', js: 'id', typ: m('') }, { json: 'name', js: 'name', typ: u(undefined, '') }, { json: 'type', js: 'type', typ: r('OrderType') }, ], 'any' ), - OrderDetails: o([{ json: 'product', js: 'product', typ: u(undefined, r('Product')) }], 'any'), - Product: o( + PurpleOrderDetails: o([{ json: 'product', js: 'product', typ: u(undefined, r('ProductObject')) }], 'any'), + ProductObject: o( [ { json: 'id', js: 'id', typ: m('') }, - { json: 'instrument', js: 'instrument', typ: u(undefined, r('Instrument')) }, + { json: 'instrument', js: 'instrument', typ: u(undefined, r('InstrumentElement')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, { json: 'type', js: 'type', typ: r('ProductType') }, ], 'any' ), + OrderList: o( + [ + { json: 'orders', js: 'orders', typ: a(r('OrderElement')) }, + { json: 'type', js: 'type', typ: r('OrderListType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + OrderElement: o( + [ + { json: 'details', js: 'details', typ: u(undefined, r('FluffyOrderDetails')) }, + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('OrderType') }, + ], + 'any' + ), + FluffyOrderDetails: o([{ json: 'product', js: 'product', typ: u(undefined, r('ProductObject')) }], 'any'), Organization: o( [ { json: 'id', js: 'id', typ: r('OrganizationIdentifiers') }, @@ -2362,44 +2884,82 @@ const typeMap: any = { ), Portfolio: o( [ - { json: 'positions', js: 'positions', typ: a(r('Position')) }, + { json: 'positions', js: 'positions', typ: a(r('PositionElement')) }, { json: 'type', js: 'type', typ: r('PortfolioType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), + PositionElement: o( + [ + { json: 'holding', js: 'holding', typ: 3.14 }, + { json: 'instrument', js: 'instrument', typ: r('InstrumentElement') }, + { json: 'type', js: 'type', typ: r('PositionType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), Position: o( [ { json: 'holding', js: 'holding', typ: 3.14 }, - { json: 'instrument', js: 'instrument', typ: r('Instrument') }, + { json: 'instrument', js: 'instrument', typ: r('InstrumentElement') }, { json: 'type', js: 'type', typ: r('PositionType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), + Product: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'instrument', js: 'instrument', typ: u(undefined, r('InstrumentElement')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('ProductType') }, + ], + 'any' + ), + TimeRange: o( + [ + { json: 'endTime', js: 'endTime', typ: u(undefined, Date) }, + { json: 'startTime', js: 'startTime', typ: u(undefined, Date) }, + { json: 'type', js: 'type', typ: r('TimeRangeType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + Trade: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'product', js: 'product', typ: r('ProductObject') }, + { json: 'type', js: 'type', typ: r('TradeType') }, + ], + 'any' + ), TradeList: o( [ - { json: 'trades', js: 'trades', typ: a(r('Trade')) }, + { json: 'trades', js: 'trades', typ: a(r('TradeElement')) }, { json: 'type', js: 'type', typ: r('TradeListType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), - Trade: o( + TradeElement: o( [ { json: 'id', js: 'id', typ: m('') }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'product', js: 'product', typ: r('Product') }, + { json: 'product', js: 'product', typ: r('ProductObject') }, { json: 'type', js: 'type', typ: r('TradeType') }, ], 'any' ), TransactionResult: o( [ - { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, { json: 'status', js: 'status', typ: r('TransactionStatus') }, { json: 'type', js: 'type', typ: r('TransactionResultType') }, { json: 'id', js: 'id', typ: u(undefined, m('any')) }, From e4653fbc591c7511faeedc4fbddfa6a9d5496704 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 20 Feb 2024 16:20:36 +0000 Subject: [PATCH 5/7] updating to latest quicktype (with working zod schema generation, yay!) and adding to build scripts and exports --- package-lock.json | 92 ++++++++------ package.json | 6 +- src/bridging/BridgingZodSchemas.ts | 198 +++++++++++++++-------------- src/index.ts | 2 + 4 files changed, 159 insertions(+), 139 deletions(-) diff --git a/package-lock.json b/package-lock.json index 02aa9843a..d0a1436f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "@finos/fdc3", - "version": "2.1.0-beta.4", + "version": "2.1.0-beta.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@finos/fdc3", - "version": "2.1.0-beta.4", + "version": "2.1.0-beta.6", "license": "Apache-2.0", "devDependencies": { "husky": "^4.3.0", "jest-mock-extended": "^1.0.13", - "quicktype": "23.0.78", + "quicktype": "23.0.104", "tsdx": "^0.14.1", "tslib": "^2.0.1", "typescript": "^4.0.3" @@ -2258,9 +2258,9 @@ } }, "node_modules/@mark.probst/typescript-json-schema/node_modules/@types/node": { - "version": "16.18.61", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.61.tgz", - "integrity": "sha512-k0N7BqGhJoJzdh6MuQg1V1ragJiXTh8VUBAZTWjJ9cUq23SG0F0xavOwZbhiP4J3y20xd6jxKx+xNUhkMAi76Q==", + "version": "16.18.82", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.82.tgz", + "integrity": "sha512-pcDZtkx9z8XYV+ius2P3Ot2VVrcYOfXffBQUBuiszrlUzKSmoDYqo+mV+IoL8iIiIjjtOMvNSmH1hwJ+Q+f96Q==", "dev": true }, "node_modules/@mark.probst/typescript-json-schema/node_modules/cliui": { @@ -2622,9 +2622,9 @@ "dev": true }, "node_modules/@types/urijs": { - "version": "1.19.23", - "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.23.tgz", - "integrity": "sha512-3Zbk6RzmIpvKTNEHO2RcPOGHM++BQEITMqBRR1Ju32WbruhV/pygYgxiP3xA0b1B88zjzs0Izzjxsbj768+IjA==", + "version": "1.19.25", + "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.25.tgz", + "integrity": "sha512-XOfUup9r3Y06nFAZh3WvO0rBU4OtlfPB/vgxpjg+NRdGU6CN6djdc6OEiH+PcqHCY6eFLo9Ista73uarf4gnBg==", "dev": true }, "node_modules/@types/yargs": { @@ -7835,9 +7835,9 @@ "dev": true }, "node_modules/js-base64": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", - "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==", + "version": "3.7.6", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.6.tgz", + "integrity": "sha512-NPrWuHFxFUknr1KqJRDgUQPexQF0uIJWjeT+2KjEePhitQxQEx5EJBG1lVn5/hc8aLycTpXrDOgPQ6Zq+EDiTA==", "dev": true }, "node_modules/js-tokens": { @@ -9545,9 +9545,9 @@ } }, "node_modules/quicktype": { - "version": "23.0.78", - "resolved": "https://registry.npmjs.org/quicktype/-/quicktype-23.0.78.tgz", - "integrity": "sha512-KeF1KNwfcnoi349hmbvJpxGccNKF6xvyUnPZ4uOQ8NA1Ipb/2f2HPvx6UIUtGYUY2AM9PJSIMjwMAg1dfB5MtA==", + "version": "23.0.104", + "resolved": "https://registry.npmjs.org/quicktype/-/quicktype-23.0.104.tgz", + "integrity": "sha512-c2rnnSIDlBqrdY210gHwnm+viHAtyJUEx0Oi6pGpqzD1SPJuquYrpwPuA7KVxfTXL+5yHvbn87Z4DNBn6NZKMQ==", "dev": true, "dependencies": { "@glideapps/ts-necessities": "^2.1.3", @@ -9559,9 +9559,9 @@ "graphql": "^0.11.7", "lodash": "^4.17.21", "moment": "^2.29.4", - "quicktype-core": "23.0.78", - "quicktype-graphql-input": "23.0.78", - "quicktype-typescript-input": "23.0.78", + "quicktype-core": "23.0.104", + "quicktype-graphql-input": "23.0.104", + "quicktype-typescript-input": "23.0.104", "readable-stream": "^4.4.2", "stream-json": "1.8.0", "string-to-stream": "^3.0.1", @@ -9575,9 +9575,9 @@ } }, "node_modules/quicktype-core": { - "version": "23.0.78", - "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-23.0.78.tgz", - "integrity": "sha512-df+wJfOudbKWV7u82qRvJLCPR86T9ObpRWjs+2DKQoNm/b9ku5PH74GRgaTkaQ942CwISH1hbXiFxAGoeNEaFg==", + "version": "23.0.104", + "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-23.0.104.tgz", + "integrity": "sha512-Y/9/hO0w4lYbacxxWdSyBhfZgs2kXELR21tawGFz7MICgxKX9KaPGLH3YQEd3NsX7KNZKdWPZdxkImgZL0RnQw==", "dev": true, "dependencies": { "@glideapps/ts-necessities": "2.1.3", @@ -9597,6 +9597,22 @@ "yaml": "^2.3.1" } }, + "node_modules/quicktype-core/node_modules/readable-stream": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", + "integrity": "sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==", + "dev": true, + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/quicktype-core/node_modules/yaml": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", @@ -9607,24 +9623,24 @@ } }, "node_modules/quicktype-graphql-input": { - "version": "23.0.78", - "resolved": "https://registry.npmjs.org/quicktype-graphql-input/-/quicktype-graphql-input-23.0.78.tgz", - "integrity": "sha512-KyGSdzC8HwCWAJpw1UnmWDhNJTm2Nx+rlySopeFX9tndJIhv69Jg+Drk6XIUEq/YrenjB/+bmgpz/41ugtncTA==", + "version": "23.0.104", + "resolved": "https://registry.npmjs.org/quicktype-graphql-input/-/quicktype-graphql-input-23.0.104.tgz", + "integrity": "sha512-thJVSo0VhHCBG5DtsKw3IE1MJhEYJkd7hwLjCszypS3jt6GON4SuWgeis1LxNpqqZAlRWTuAxYwr7I1EsFNYmA==", "dev": true, "dependencies": { "collection-utils": "^1.0.1", "graphql": "^0.11.7", - "quicktype-core": "23.0.78" + "quicktype-core": "23.0.104" } }, "node_modules/quicktype-typescript-input": { - "version": "23.0.78", - "resolved": "https://registry.npmjs.org/quicktype-typescript-input/-/quicktype-typescript-input-23.0.78.tgz", - "integrity": "sha512-OaEfS4n4OjgAUe5IpuZiBPe675GnvSGyP1/3WUrX5T558SoorjA1RcqiPmitUh0MikhYQLBR9j/L2AaM4OkLWQ==", + "version": "23.0.104", + "resolved": "https://registry.npmjs.org/quicktype-typescript-input/-/quicktype-typescript-input-23.0.104.tgz", + "integrity": "sha512-MGiD/5TrChThYd7qcw9z1THi2ugTnf8qey+o5gMBdR1yc60HwXxZuTJIMVQt04rR6Nc8XHC0R6y90EL0JhPNzQ==", "dev": true, "dependencies": { "@mark.probst/typescript-json-schema": "0.55.0", - "quicktype-core": "23.0.78", + "quicktype-core": "23.0.104", "typescript": "4.9.5" } }, @@ -9694,9 +9710,9 @@ } }, "node_modules/readable-stream": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", - "integrity": "sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "dev": true, "dependencies": { "abort-controller": "^3.0.0", @@ -11897,9 +11913,9 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -11940,9 +11956,9 @@ } }, "node_modules/ts-node/node_modules/acorn-walk": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", - "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", "dev": true, "engines": { "node": ">=0.4.0" diff --git a/package.json b/package.json index de001436b..efeca88c4 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,11 @@ ], "scripts": { "start": "tsdx watch", - "prebuild": "npm run typegen && npm run typegen-bridging", + "prebuild": "npm run typegen && npm run typegen-bridging && npm run typegen-bridging-zod", "build": "tsdx build", "test": "tsdx test --verbose", "lint": "tsdx lint src/api test", - "disabled-preprepare": "npm run typegen && npm run typegen-bridging", + "disabled-preprepare": "npm run typegen && npm run typegen-bridging && npm run typegen-bridging-zod", "prepare": "tsdx build", "typegen": "node s2tQuicktypeUtil.js schemas/context src/context/ContextTypes.ts && tsdx lint src/context/ --fix", "typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix", @@ -49,7 +49,7 @@ "devDependencies": { "husky": "^4.3.0", "jest-mock-extended": "^1.0.13", - "quicktype": "23.0.78", + "quicktype": "23.0.104", "tsdx": "^0.14.1", "tslib": "^2.0.1", "typescript": "^4.0.3" diff --git a/src/bridging/BridgingZodSchemas.ts b/src/bridging/BridgingZodSchemas.ts index 05ed2e131..1d6098120 100644 --- a/src/bridging/BridgingZodSchemas.ts +++ b/src/bridging/BridgingZodSchemas.ts @@ -77,10 +77,10 @@ export type RequestMessageType = z.infer; // // UUID for this specific response message. -export const BroadcastRequestMessageTypeSchema = z.enum([ +export const BroadcastAgentRequestTypeSchema = z.enum([ "broadcastRequest", ]); -export type BroadcastRequestMessageType = z.infer; +export type BroadcastAgentRequestType = z.infer; // Identifies the type of the connection step message. @@ -155,10 +155,10 @@ export type ErrorMessage = z.infer; // // UUID for this specific response message. -export const FindInstancesResponseMessageTypeSchema = z.enum([ +export const FindInstancesAgentErrorResponseTypeSchema = z.enum([ "findInstancesResponse", ]); -export type FindInstancesResponseMessageType = z.infer; +export type FindInstancesAgentErrorResponseType = z.infer; // 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. @@ -167,10 +167,10 @@ export type FindInstancesResponseMessageType = z.infer; +export type FindInstancesAgentRequestType = z.infer; // 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. @@ -179,10 +179,10 @@ export type FindInstancesRequestMessageType = z.infer; +export type FindIntentAgentErrorResponseType = z.infer; // 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. @@ -191,10 +191,10 @@ export type FindIntentResponseMessageType = z.infer; +export type FindIntentAgentRequestType = z.infer; // 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. @@ -203,10 +203,10 @@ export type FindIntentRequestMessageType = z.infer; +export type FindIntentsByContextAgentErrorResponseType = z.infer; // 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. @@ -215,10 +215,10 @@ export type FindIntentsByContextResponseMessageType = z.infer; +export type FindIntentsByContextAgentRequestType = z.infer; // 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. @@ -227,10 +227,10 @@ export type FindIntentsByContextRequestMessageType = z.infer; +export type GetAppMetadataAgentErrorResponseType = z.infer; // 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. @@ -239,10 +239,10 @@ export type GetAppMetadataResponseMessageType = z.infer; +export type GetAppMetadataAgentRequestType = z.infer; // Constants representing the errors that can be encountered when calling the `open` method // on the DesktopAgent object (`fdc3`). @@ -276,10 +276,10 @@ export type OpenErrorMessage = z.infer; // // UUID for this specific response message. -export const OpenResponseMessageTypeSchema = z.enum([ +export const OpenAgentErrorResponseTypeSchema = z.enum([ "openResponse", ]); -export type OpenResponseMessageType = z.infer; +export type OpenAgentErrorResponseType = z.infer; // 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. @@ -288,10 +288,10 @@ export type OpenResponseMessageType = z.infer; +export type OpenAgentRequestType = z.infer; // 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. @@ -300,10 +300,10 @@ export type OpenRequestMessageType = z.infer; +export type PrivateChannelBroadcastAgentRequestType = z.infer; // Event listener type names for Private Channel events @@ -321,10 +321,10 @@ export type PrivateChannelEventListenerTypes = z.infer; +export type PrivateChannelEventListenerAddedAgentRequestType = z.infer; // 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. @@ -333,10 +333,10 @@ export type PrivateChannelEventListenerAddedMessageType = z.infer; +export type PrivateChannelEventListenerRemovedAgentRequestType = z.infer; // 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. @@ -345,10 +345,10 @@ export type PrivateChannelEventListenerRemovedMessageType = z.infer; +export type PrivateChannelOnAddContextListenerAgentRequestType = z.infer; // 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. @@ -357,10 +357,10 @@ export type PrivateChannelOnAddContextListenerMessageType = z.infer; +export type PrivateChannelOnDisconnectAgentRequestType = z.infer; // 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. @@ -369,10 +369,10 @@ export type PrivateChannelOnDisconnectMessageType = z.infer; +export type PrivateChannelOnUnsubscribeAgentRequestType = z.infer; // 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. @@ -381,10 +381,10 @@ export type PrivateChannelOnUnsubscribeMessageType = z.infer; +export type RaiseIntentAgentErrorResponseType = z.infer; // 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. @@ -393,10 +393,10 @@ export type RaiseIntentResponseMessageType = z.infer; +export type RaiseIntentAgentRequestType = z.infer; // Array of error message strings for responses that were not returned to the bridge before // the timeout or because an error occurred. Should be the same length as the `errorSources` @@ -426,10 +426,10 @@ export type RaiseIntentResultErrorMessage = z.infer; +export type RaiseIntentResultAgentErrorResponseType = z.infer; // Uniquely defines each channel type. // Can be "user", "app" or "private". @@ -695,6 +695,7 @@ export type FindIntentAgentRequestMeta = z.infer; @@ -736,6 +737,7 @@ export type FindIntentBridgeRequestMeta = z.infer; @@ -1064,7 +1066,7 @@ export type PrivateChannelOnAddContextListenerAgentRequestMeta = z.infer; @@ -1078,7 +1080,7 @@ export type PrivateChannelOnAddContextListenerBridgeRequestMeta = z.infer; @@ -1118,7 +1120,7 @@ export type PrivateChannelOnUnsubscribeAgentRequestMeta = z.infer; @@ -1132,7 +1134,7 @@ export type ERequestMetadata = z.infer; export const PrivateChannelOnUnsubscribeBridgeRequestPayloadSchema = z.object({ "channelId": z.string(), - "contextType": z.string(), + "contextType": z.union([z.null(), z.string()]), }); export type PrivateChannelOnUnsubscribeBridgeRequestPayload = z.infer; @@ -1384,7 +1386,7 @@ export type ConnectionStep6ConnectedAgentsUpdatePayload = z.infer; @@ -1420,7 +1422,7 @@ export type AppMetadata = z.infer; export const FindInstancesBridgeErrorResponseSchema = z.object({ "meta": FindInstancesBridgeErrorResponseMetaSchema, "payload": FindInstancesBridgeErrorResponsePayloadSchema, - "type": FindInstancesResponseMessageTypeSchema, + "type": FindInstancesAgentErrorResponseTypeSchema, }); export type FindInstancesBridgeErrorResponse = z.infer; @@ -1440,14 +1442,14 @@ export type FindInstancesBridgeResponsePayload = z.infer; export const FindIntentAgentRequestSchema = z.object({ "meta": FindIntentAgentRequestMetaSchema, "payload": FindIntentAgentRequestPayloadSchema, - "type": FindIntentRequestMessageTypeSchema, + "type": FindIntentAgentRequestTypeSchema, }); export type FindIntentAgentRequest = z.infer; @@ -1460,14 +1462,14 @@ export type AppIntent = z.infer; export const FindIntentBridgeErrorResponseSchema = z.object({ "meta": FindIntentBridgeErrorResponseMetaSchema, "payload": FindIntentBridgeErrorResponsePayloadSchema, - "type": FindIntentResponseMessageTypeSchema, + "type": FindIntentAgentErrorResponseTypeSchema, }); export type FindIntentBridgeErrorResponse = z.infer; export const FindIntentBridgeRequestSchema = z.object({ "meta": FindIntentBridgeRequestMetaSchema, "payload": FindIntentBridgeRequestPayloadSchema, - "type": FindIntentRequestMessageTypeSchema, + "type": FindIntentAgentRequestTypeSchema, }); export type FindIntentBridgeRequest = z.infer; @@ -1479,14 +1481,14 @@ export type FindIntentBridgeResponsePayload = z.infer; export const FindIntentsByContextAgentRequestSchema = z.object({ "meta": FindIntentsByContextAgentRequestMetaSchema, "payload": FindIntentsByContextAgentRequestPayloadSchema, - "type": FindIntentsByContextRequestMessageTypeSchema, + "type": FindIntentsByContextAgentRequestTypeSchema, }); export type FindIntentsByContextAgentRequest = z.infer; @@ -1498,14 +1500,14 @@ export type FindIntentsByContextAgentResponsePayload = z.infer; export const FindIntentsByContextBridgeRequestSchema = z.object({ "meta": FindIntentsByContextBridgeRequestMetaSchema, "payload": FindIntentsByContextBridgeRequestPayloadSchema, - "type": FindIntentsByContextRequestMessageTypeSchema, + "type": FindIntentsByContextAgentRequestTypeSchema, }); export type FindIntentsByContextBridgeRequest = z.infer; @@ -1517,7 +1519,7 @@ export type FindIntentsByContextBridgeResponsePayload = z.infer; @@ -1534,14 +1536,14 @@ export type GetAppMetadataAgentResponsePayload = z.infer; export const GetAppMetadataBridgeRequestSchema = z.object({ "meta": GetAppMetadataBridgeRequestMetaSchema, "payload": GetAppMetadataBridgeRequestPayloadSchema, - "type": GetAppMetadataRequestMessageTypeSchema, + "type": GetAppMetadataAgentRequestTypeSchema, }); export type GetAppMetadataBridgeRequest = z.infer; @@ -1553,7 +1555,7 @@ export type GetAppMetadataBridgeResponsePayload = z.infer; @@ -1566,28 +1568,28 @@ export type OpenAgentRequestPayload = z.infer; export const OpenBridgeErrorResponseSchema = z.object({ "meta": OpenBridgeErrorResponseMetaSchema, "payload": OpenBridgeErrorResponsePayloadSchema, - "type": OpenResponseMessageTypeSchema, + "type": OpenAgentErrorResponseTypeSchema, }); export type OpenBridgeErrorResponse = z.infer; export const OpenBridgeRequestSchema = z.object({ "meta": OpenBridgeRequestMetaSchema, "payload": OpenBridgeRequestPayloadSchema, - "type": OpenRequestMessageTypeSchema, + "type": OpenAgentRequestTypeSchema, }); export type OpenBridgeRequest = z.infer; export const OpenBridgeResponseSchema = z.object({ "meta": OpenBridgeResponseMetaSchema, "payload": OpenBridgeResponsePayloadSchema, - "type": OpenResponseMessageTypeSchema, + "type": OpenAgentErrorResponseTypeSchema, }); export type OpenBridgeResponse = z.infer; @@ -1602,91 +1604,91 @@ export type PrivateChannelBroadcastAgentRequestMeta = z.infer; export const PrivateChannelEventListenerAddedAgentRequestSchema = z.object({ "meta": PrivateChannelEventListenerAddedAgentRequestMetaSchema, "payload": PrivateChannelEventListenerAddedAgentRequestPayloadSchema, - "type": PrivateChannelEventListenerAddedMessageTypeSchema, + "type": PrivateChannelEventListenerAddedAgentRequestTypeSchema, }); export type PrivateChannelEventListenerAddedAgentRequest = z.infer; export const PrivateChannelEventListenerAddedBridgeRequestSchema = z.object({ "meta": PrivateChannelEventListenerAddedBridgeRequestMetaSchema, "payload": PrivateChannelEventListenerAddedBridgeRequestPayloadSchema, - "type": PrivateChannelEventListenerAddedMessageTypeSchema, + "type": PrivateChannelEventListenerAddedAgentRequestTypeSchema, }); export type PrivateChannelEventListenerAddedBridgeRequest = z.infer; export const PrivateChannelEventListenerRemovedAgentRequestSchema = z.object({ "meta": PrivateChannelEventListenerRemovedAgentRequestMetaSchema, "payload": PrivateChannelEventListenerRemovedAgentRequestPayloadSchema, - "type": PrivateChannelEventListenerRemovedMessageTypeSchema, + "type": PrivateChannelEventListenerRemovedAgentRequestTypeSchema, }); export type PrivateChannelEventListenerRemovedAgentRequest = z.infer; export const PrivateChannelEventListenerRemovedBridgeRequestSchema = z.object({ "meta": PrivateChannelEventListenerRemovedBridgeRequestMetaSchema, "payload": PrivateChannelEventListenerRemovedBridgeRequestPayloadSchema, - "type": PrivateChannelEventListenerRemovedMessageTypeSchema, + "type": PrivateChannelEventListenerRemovedAgentRequestTypeSchema, }); export type PrivateChannelEventListenerRemovedBridgeRequest = z.infer; export const PrivateChannelOnAddContextListenerAgentRequestSchema = z.object({ "meta": PrivateChannelOnAddContextListenerAgentRequestMetaSchema, "payload": PrivateChannelOnAddContextListenerAgentRequestPayloadSchema, - "type": PrivateChannelOnAddContextListenerMessageTypeSchema, + "type": PrivateChannelOnAddContextListenerAgentRequestTypeSchema, }); export type PrivateChannelOnAddContextListenerAgentRequest = z.infer; export const PrivateChannelOnAddContextListenerBridgeRequestSchema = z.object({ "meta": PrivateChannelOnAddContextListenerBridgeRequestMetaSchema, "payload": PrivateChannelOnAddContextListenerBridgeRequestPayloadSchema, - "type": PrivateChannelOnAddContextListenerMessageTypeSchema, + "type": PrivateChannelOnAddContextListenerAgentRequestTypeSchema, }); export type PrivateChannelOnAddContextListenerBridgeRequest = z.infer; export const PrivateChannelOnDisconnectAgentRequestSchema = z.object({ "meta": PrivateChannelOnDisconnectAgentRequestMetaSchema, "payload": PrivateChannelOnDisconnectAgentRequestPayloadSchema, - "type": PrivateChannelOnDisconnectMessageTypeSchema, + "type": PrivateChannelOnDisconnectAgentRequestTypeSchema, }); export type PrivateChannelOnDisconnectAgentRequest = z.infer; export const PrivateChannelOnDisconnectBridgeRequestSchema = z.object({ "meta": PrivateChannelOnDisconnectBridgeRequestMetaSchema, "payload": PrivateChannelOnDisconnectBridgeRequestPayloadSchema, - "type": PrivateChannelOnDisconnectMessageTypeSchema, + "type": PrivateChannelOnDisconnectAgentRequestTypeSchema, }); export type PrivateChannelOnDisconnectBridgeRequest = z.infer; export const PrivateChannelOnUnsubscribeAgentRequestSchema = z.object({ "meta": PrivateChannelOnUnsubscribeAgentRequestMetaSchema, "payload": PrivateChannelOnUnsubscribeAgentRequestPayloadSchema, - "type": PrivateChannelOnUnsubscribeMessageTypeSchema, + "type": PrivateChannelOnUnsubscribeAgentRequestTypeSchema, }); export type PrivateChannelOnUnsubscribeAgentRequest = z.infer; export const PrivateChannelOnUnsubscribeBridgeRequestSchema = z.object({ "meta": ERequestMetadataSchema, "payload": PrivateChannelOnUnsubscribeBridgeRequestPayloadSchema, - "type": PrivateChannelOnUnsubscribeMessageTypeSchema, + "type": PrivateChannelOnUnsubscribeAgentRequestTypeSchema, }); export type PrivateChannelOnUnsubscribeBridgeRequest = z.infer; export const RaiseIntentAgentErrorResponseSchema = z.object({ "meta": RaiseIntentAgentErrorResponseMetaSchema, "payload": RaiseIntentAgentErrorResponsePayloadSchema, - "type": RaiseIntentResponseMessageTypeSchema, + "type": RaiseIntentAgentErrorResponseTypeSchema, }); export type RaiseIntentAgentErrorResponse = z.infer; export const RaiseIntentAgentRequestSchema = z.object({ "meta": RaiseIntentAgentRequestMetaSchema, "payload": RaiseIntentAgentRequestPayloadSchema, - "type": RaiseIntentRequestMessageTypeSchema, + "type": RaiseIntentAgentRequestTypeSchema, }); export type RaiseIntentAgentRequest = z.infer; @@ -1698,28 +1700,28 @@ export type RaiseIntentAgentResponsePayload = z.infer; export const RaiseIntentBridgeRequestSchema = z.object({ "meta": RaiseIntentBridgeRequestMetaSchema, "payload": RaiseIntentBridgeRequestPayloadSchema, - "type": RaiseIntentRequestMessageTypeSchema, + "type": RaiseIntentAgentRequestTypeSchema, }); export type RaiseIntentBridgeRequest = z.infer; export const RaiseIntentBridgeResponseSchema = z.object({ "meta": RaiseIntentBridgeResponseMetaSchema, "payload": RaiseIntentBridgeResponsePayloadSchema, - "type": RaiseIntentResponseMessageTypeSchema, + "type": RaiseIntentAgentErrorResponseTypeSchema, }); export type RaiseIntentBridgeResponse = z.infer; export const RaiseIntentResultAgentErrorResponseSchema = z.object({ "meta": RaiseIntentResultAgentErrorResponseMetaSchema, "payload": RaiseIntentResultAgentErrorResponsePayloadSchema, - "type": RaiseIntentResultResponseMessageTypeSchema, + "type": RaiseIntentResultAgentErrorResponseTypeSchema, }); export type RaiseIntentResultAgentErrorResponse = z.infer; @@ -1733,7 +1735,7 @@ export type Channel = z.infer; export const RaiseIntentResultBridgeErrorResponseSchema = z.object({ "meta": RaiseIntentResultBridgeErrorResponseMetaSchema, "payload": RaiseIntentResultBridgeErrorResponsePayloadSchema, - "type": RaiseIntentResultResponseMessageTypeSchema, + "type": RaiseIntentResultAgentErrorResponseTypeSchema, }); export type RaiseIntentResultBridgeErrorResponse = z.infer; @@ -1754,14 +1756,14 @@ export type BridgeErrorResponseMessage = z.infer; export const BroadcastBridgeRequestSchema = z.object({ "meta": BroadcastBridgeRequestMetaSchema, "payload": BroadcastBridgeRequestPayloadSchema, - "type": BroadcastRequestMessageTypeSchema, + "type": BroadcastAgentRequestTypeSchema, }); export type BroadcastBridgeRequest = z.infer; @@ -1783,7 +1785,7 @@ export type ConnectionStep6ConnectedAgentsUpdate = z.infer; @@ -1795,14 +1797,14 @@ export type FindInstancesAgentResponsePayload = z.infer; export const FindInstancesBridgeResponseSchema = z.object({ "meta": FindInstancesBridgeResponseMetaSchema, "payload": FindInstancesBridgeResponsePayloadSchema, - "type": FindInstancesResponseMessageTypeSchema, + "type": FindInstancesAgentErrorResponseTypeSchema, }); export type FindInstancesBridgeResponse = z.infer; @@ -1814,63 +1816,63 @@ export type FindIntentAgentResponsePayload = z.infer; export const FindIntentsByContextAgentResponseSchema = z.object({ "meta": FindIntentsByContextAgentResponseMetaSchema, "payload": FindIntentsByContextAgentResponsePayloadSchema, - "type": FindIntentsByContextResponseMessageTypeSchema, + "type": FindIntentsByContextAgentErrorResponseTypeSchema, }); export type FindIntentsByContextAgentResponse = z.infer; export const FindIntentsByContextBridgeResponseSchema = z.object({ "meta": FindIntentsByContextBridgeResponseMetaSchema, "payload": FindIntentsByContextBridgeResponsePayloadSchema, - "type": FindIntentsByContextResponseMessageTypeSchema, + "type": FindIntentsByContextAgentErrorResponseTypeSchema, }); export type FindIntentsByContextBridgeResponse = z.infer; export const GetAppMetadataAgentRequestSchema = z.object({ "meta": GetAppMetadataAgentRequestMetaSchema, "payload": GetAppMetadataAgentRequestPayloadSchema, - "type": GetAppMetadataRequestMessageTypeSchema, + "type": GetAppMetadataAgentRequestTypeSchema, }); export type GetAppMetadataAgentRequest = z.infer; export const GetAppMetadataAgentResponseSchema = z.object({ "meta": GetAppMetadataAgentResponseMetaSchema, "payload": GetAppMetadataAgentResponsePayloadSchema, - "type": GetAppMetadataResponseMessageTypeSchema, + "type": GetAppMetadataAgentErrorResponseTypeSchema, }); export type GetAppMetadataAgentResponse = z.infer; export const GetAppMetadataBridgeResponseSchema = z.object({ "meta": GetAppMetadataBridgeResponseMetaSchema, "payload": GetAppMetadataBridgeResponsePayloadSchema, - "type": GetAppMetadataResponseMessageTypeSchema, + "type": GetAppMetadataAgentErrorResponseTypeSchema, }); export type GetAppMetadataBridgeResponse = z.infer; export const OpenAgentRequestSchema = z.object({ "meta": OpenAgentRequestMetaSchema, "payload": OpenAgentRequestPayloadSchema, - "type": OpenRequestMessageTypeSchema, + "type": OpenAgentRequestTypeSchema, }); export type OpenAgentRequest = z.infer; export const PrivateChannelBroadcastAgentRequestSchema = z.object({ "meta": PrivateChannelBroadcastAgentRequestMetaSchema, "payload": PrivateChannelBroadcastAgentRequestPayloadSchema, - "type": PrivateChannelBroadcastMessageTypeSchema, + "type": PrivateChannelBroadcastAgentRequestTypeSchema, }); export type PrivateChannelBroadcastAgentRequest = z.infer; export const RaiseIntentAgentResponseSchema = z.object({ "meta": RaiseIntentAgentResponseMetaSchema, "payload": RaiseIntentAgentResponsePayloadSchema, - "type": RaiseIntentResponseMessageTypeSchema, + "type": RaiseIntentAgentErrorResponseTypeSchema, }); export type RaiseIntentAgentResponse = z.infer; @@ -1895,14 +1897,14 @@ export type ConnectionStep3Handshake = z.infer; export const FindIntentAgentResponseSchema = z.object({ "meta": FindIntentAgentResponseMetaSchema, "payload": FindIntentAgentResponsePayloadSchema, - "type": FindIntentResponseMessageTypeSchema, + "type": FindIntentAgentErrorResponseTypeSchema, }); export type FindIntentAgentResponse = z.infer; @@ -1914,13 +1916,13 @@ export type RaiseIntentResultAgentResponsePayload = z.infer; export const RaiseIntentResultAgentResponseSchema = z.object({ "meta": RaiseIntentResultAgentResponseMetaSchema, "payload": RaiseIntentResultAgentResponsePayloadSchema, - "type": RaiseIntentResultResponseMessageTypeSchema, + "type": RaiseIntentResultAgentErrorResponseTypeSchema, }); export type RaiseIntentResultAgentResponse = z.infer; diff --git a/src/index.ts b/src/index.ts index 98662a640..c21efc981 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { DesktopAgent } from './api/DesktopAgent'; import * as BridgingTypes from './bridging/BridgingTypes'; +import * as BridgingZodSchemas from './bridging/BridgingZodSchemas'; export * from './api/AppIdentifier'; export * from './api/AppIntent'; @@ -31,6 +32,7 @@ export * from './intents/Intents'; /* Workaround for conflicts between bridging types and API types and prettier issue with `export * as`. */ export { BridgingTypes }; +export { BridgingZodSchemas }; declare global { interface Window { From 8365865e51ce3a638c97a33ee64016de5b824006 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 20 Feb 2024 16:27:58 +0000 Subject: [PATCH 6/7] adding zod depenedency --- package-lock.json | 15 +++++++++++++-- package.json | 6 ++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d0a1436f3..00446f46b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,16 @@ { "name": "@finos/fdc3", - "version": "2.1.0-beta.6", + "version": "2.1.0-beta.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@finos/fdc3", - "version": "2.1.0-beta.6", + "version": "2.1.0-beta.7", "license": "Apache-2.0", + "dependencies": { + "zod": "^3.22.4" + }, "devDependencies": { "husky": "^4.3.0", "jest-mock-extended": "^1.0.13", @@ -12989,6 +12992,14 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zod": { + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/package.json b/package.json index efeca88c4..0f412d480 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@finos/fdc3", - "version": "2.1.0-beta.6", + "version": "2.1.0-beta.7", "author": "Fintech Open Source Foundation (FINOS)", "homepage": "https://fdc3.finos.org", "repository": { @@ -29,7 +29,6 @@ "typegen-bridging": "node s2tQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingTypes.ts && tsdx lint src/bridging/ --fix", "typegen-bridging-zod": "node s2zodQuicktypeUtil.js schemas/api schemas/bridging schemas/context/context.schema.json src/bridging/BridgingZodSchemas.ts" }, - "peerDependencies": {}, "husky": { "hooks": { "pre-commit": "tsdx lint src test" @@ -53,5 +52,8 @@ "tsdx": "^0.14.1", "tslib": "^2.0.1", "typescript": "^4.0.3" + }, + "dependencies": { + "zod": "^3.22.4" } } From 698872dd24a68ca7211d6ee18ad4ac0b5f864104 Mon Sep 17 00:00:00 2001 From: Kris West Date: Wed, 10 Apr 2024 15:45:04 +0100 Subject: [PATCH 7/7] Regenerating schemas after merging 'Refine the varying schemas for ImplementationMetadata #1177' --- src/bridging/BridgingTypes.ts | 4 +-- src/bridging/BridgingZodSchemas.ts | 39 ++++++++++++------------------ 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/bridging/BridgingTypes.ts b/src/bridging/BridgingTypes.ts index a5419b322..eca5d93fb 100644 --- a/src/bridging/BridgingTypes.ts +++ b/src/bridging/BridgingTypes.ts @@ -1059,8 +1059,8 @@ export interface ConnectionStep6ConnectedAgentsUpdatePayload { */ export interface DesktopAgentImplementationMetadata { /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. + * Used in Desktop Agent Bridging to attribute or target a message to a particular Desktop + * Agent. */ desktopAgent: string; /** diff --git a/src/bridging/BridgingZodSchemas.ts b/src/bridging/BridgingZodSchemas.ts index 1d6098120..a0f5600e6 100644 --- a/src/bridging/BridgingZodSchemas.ts +++ b/src/bridging/BridgingZodSchemas.ts @@ -441,13 +441,6 @@ export const TypeSchema = z.enum([ ]); export type Type = z.infer; -export const BaseImplementationMetadataOptionalFeaturesSchema = z.object({ - "DesktopAgentBridging": z.boolean(), - "OriginatingAppMetadata": z.boolean(), - "UserChannelMembershipAPIs": z.boolean(), -}); -export type BaseImplementationMetadataOptionalFeatures = z.infer; - export const AgentResponseMetadataSchema = z.object({ "requestUuid": z.string(), "responseUuid": z.string(), @@ -562,12 +555,12 @@ export const ConnectionStep3HandshakeMetaSchema = z.object({ }); export type ConnectionStep3HandshakeMeta = z.infer; -export const ImplementationMetadataOptionalFeaturesSchema = z.object({ +export const OptionalFeaturesSchema = z.object({ "DesktopAgentBridging": z.boolean(), "OriginatingAppMetadata": z.boolean(), "UserChannelMembershipAPIs": z.boolean(), }); -export type ImplementationMetadataOptionalFeatures = z.infer; +export type OptionalFeatures = z.infer; export const ConnectionStep4AuthenticationFailedMetaSchema = z.object({ "requestUuid": z.string(), @@ -588,6 +581,15 @@ export const ConnectionStep6ConnectedAgentsUpdateMetaSchema = z.object({ }); export type ConnectionStep6ConnectedAgentsUpdateMeta = z.infer; +export const DesktopAgentImplementationMetadataSchema = z.object({ + "desktopAgent": z.string(), + "fdc3Version": z.string(), + "optionalFeatures": OptionalFeaturesSchema, + "provider": z.string(), + "providerVersion": z.union([z.null(), z.string()]).optional(), +}); +export type DesktopAgentImplementationMetadata = z.infer; + export const FindInstancesAgentErrorResponseMetaSchema = z.object({ "requestUuid": z.string(), "responseUuid": z.string(), @@ -1175,7 +1177,6 @@ export type RaiseIntentAgentResponseMeta = z.infer; @@ -1280,14 +1281,6 @@ export const ContextSchema = z.object({ }); export type Context = z.infer; -export const BaseImplementationMetadataSchema = z.object({ - "fdc3Version": z.string(), - "optionalFeatures": BaseImplementationMetadataOptionalFeaturesSchema, - "provider": z.string(), - "providerVersion": z.union([z.null(), z.string()]).optional(), -}); -export type BaseImplementationMetadata = z.infer; - export const AgentErrorResponseMessageSchema = z.object({ "meta": AgentResponseMetadataSchema, "payload": ErrorResponseMessagePayloadSchema, @@ -1360,13 +1353,13 @@ export const ConnectionStep2HelloSchema = z.object({ }); export type ConnectionStep2Hello = z.infer; -export const ImplementationMetadataElementSchema = z.object({ +export const ConnectingAgentImplementationMetadataSchema = z.object({ "fdc3Version": z.string(), - "optionalFeatures": ImplementationMetadataOptionalFeaturesSchema, + "optionalFeatures": OptionalFeaturesSchema, "provider": z.string(), "providerVersion": z.union([z.null(), z.string()]).optional(), }); -export type ImplementationMetadataElement = z.infer; +export type ConnectingAgentImplementationMetadata = z.infer; export const ConnectionStep4AuthenticationFailedSchema = z.object({ "meta": ConnectionStep4AuthenticationFailedMetaSchema, @@ -1377,7 +1370,7 @@ export type ConnectionStep4AuthenticationFailed = z.infer;