diff --git a/CHANGELOG.md b/CHANGELOG.md index 17296a667..2e72df5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] -* Enhanced method binding for FDC3 API objects to support destructuring. All public methods of `Channel`, `PrivateChannel`, and `IntentResolution` objects are now properly bound to their instances using `.bind(this)` in their constructors. ([#1645](https://github.com/finos/FDC3/issues/1645)) ### Added +* Added a classification field to Instrument context type ([#1665](https://github.com/finos/FDC3/pull/1665)) +* Enhanced method binding for FDC3 API objects to support destructuring. All public methods of `Channel`, `PrivateChannel`, and `IntentResolution` objects are now properly bound to their instances using `.bind(this)` in their constructors. ([#1645](https://github.com/finos/FDC3/issues/1645)) * Add a notes field to Trade type ([#1563](https://github.com/finos/FDC3/pull/1563)) * Add a notes field to Order and Product types ([#1597](https://github.com/finos/FDC3/pull/1597)) * Added Go language binding. ([#1483](https://github.com/finos/FDC3/pull/1483)) @@ -59,11 +60,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Setup package publishing for mono-repo packages. ([#1520](https://github.com/finos/FDC3/pull/1520)) * Implementation PR for FDC3 for the Web ([#896](https://github.com/finos/FDC3/pull/896)) - resolves ([#1209](https://github.com/finos/FDC3/issues/1209)) - - resolves ([#1297](https://github.com/finos/FDC3/issues/1297)) - - resolves ([#1429](https://github.com/finos/FDC3/issues/1429)) + - resolves ([#1297](https://github.com/finos/FDC3/issues/1297)) + - resolves ([#1429](https://github.com/finos/FDC3/issues/1429)) - resolves ([#1430](https://github.com/finos/FDC3/issues/1430)) - resolves ([#1431](https://github.com/finos/FDC3/issues/1431)) - - resolves ([#1432](https://github.com/finos/FDC3/issues/1432)) + - resolves ([#1432](https://github.com/finos/FDC3/issues/1432)) - resolves ([#1433](https://github.com/finos/FDC3/issues/1433)) - resolves ([#1468](https://github.com/finos/FDC3/issues/1468)) - resolves ([#810](https://github.com/finos/FDC3/issues/810)) @@ -96,7 +97,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Removed the `version` field from `IntentResolution` as there are no version fields for intents in the FDC3 API definitions and hence the field has no purpose. ([#1170](https://github.com/finos/FDC3/pull/1170)) * Fixed error in the Client-side example from `PrivateChannel` and `addIntentListener` by correcting `id.symbol` to `id.ticker` to align with the `fdc3.instrument` context. ([#1314](https://github.com/finos/FDC3/pull/1314)) * Added missing `resultType` argument to `findIntent` agent request in the Bridging Schema. ([#1154](https://github.com/finos/FDC3/pull/1154)) -* Added missing `resultType` argument to `findIntentByContext` agent request in the Bridging Schema. ([#1212](https://github.com/finos/FDC3/pull/1212)) +* Added missing `resultType` argument to `findIntentByContext` agent request in the Bridging Schema. ([#1212](https://github.com/finos/FDC3/pull/1212)) * Added missing id and name fields from the context base schema to respective context schemas (`Contact`, `ContactList`, `Country`, `InstrumentList`, `OrderList`, `Organization`, `Portfolio`, `Position`, `TradeList`). ([#1360](https://github.com/finos/FDC3/pull/1360)) * Revised FDC3 charter to include well-known language from the FDC3 introduction, better describe FDC3's scope, focus on financial applications, update application types, etc. ([#1079](https://github.com/finos/FDC3/pull/1079)) * Ensured that `PrivateChannelEvent` extends `ApiEvent` in both sourcecode and documentation. ([#1474](https://github.com/finos/FDC3/pull/1474)) diff --git a/packages/fdc3-context/generated/context/ContextTypes.ts b/packages/fdc3-context/generated/context/ContextTypes.ts index a6ff5bdd0..524bff53e 100644 --- a/packages/fdc3-context/generated/context/ContextTypes.ts +++ b/packages/fdc3-context/generated/context/ContextTypes.ts @@ -193,13 +193,6 @@ export interface ContextElement { [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. - */ - /** * A context type representing details of a Chart, which may be used to request plotting of * a particular chart or to otherwise share details of its composition, such as: @@ -247,6 +240,11 @@ export interface Chart { * A financial instrument from any asset class. */ export interface InstrumentElement { + /** + * @experimental The `classification` map can be used to specify the categorization of the + * instrument and help achieve interoperability between disparate data sources. + */ + classification?: OrganizationClassification; /** * 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 @@ -277,6 +275,55 @@ export interface InstrumentElement { [property: string]: any; } +/** + * @experimental The `classification` map can be used to specify the categorization of the + * instrument and help achieve interoperability between disparate data sources. + */ +export interface OrganizationClassification { + /** + * FactSet classification for the instrument. + */ + FDS_TYPE?: FactSetType; + /** + * Optional human-readable classification, to be used if no specific data classification is + * available. + */ + name?: string; + [property: string]: any; +} + +/** + * FactSet classification for the instrument. + */ +export type FactSetType = + | 'commodity' + | 'commodityIndex' + | 'corporateDebt' + | 'creditDefaultSwapIndex' + | 'deal' + | 'debt' + | 'debtIndex' + | 'etf' + | 'fixedIncome' + | 'future' + | 'governmentBenchmarkDebt' + | 'loan' + | 'mortgageBackedSecurity' + | 'municipalDebt' + | 'mutualFund' + | 'mutualFundIndex' + | 'option' + | 'otherDebt' + | 'ownershipPrivateCompany' + | 'pevcFirm' + | 'pevcFund' + | 'privateCompany' + | 'publicCompany' + | 'publicCompanyIndex' + | 'sovereignDebt' + | 'structuredProduct' + | 'unknown'; + /** * 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 @@ -357,13 +404,6 @@ export interface OrganizationMarket { [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. - */ - /** * The time range that should be plotted * @@ -417,13 +457,6 @@ export interface TimeRangeObject { [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. - */ - /** * The type of chart that should be plotted */ @@ -439,13 +472,6 @@ export type ChartStyle = | 'heatmap' | 'custom'; -/** - * 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. - */ - /** * A collection of settings to start a new chat conversation */ @@ -534,20 +560,6 @@ export interface PurpleContactIdentifiers { [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. - */ - -/** - * 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. - */ - /** * 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 @@ -641,12 +653,6 @@ export interface EntityData { [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. - */ export type EntityType = 'fdc3.action' | 'fdc3.fileAttachment'; /** @@ -664,13 +670,6 @@ export interface PurpleMessageText { [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. - */ - /** * Option settings that affect the creation of the chat */ @@ -698,13 +697,6 @@ export interface ChatOptions { [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. - */ - /** * A context representing a chat message. Typically used to send the message or to * pre-populate a message for sending. @@ -743,20 +735,6 @@ export interface ChatRoomObject { [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. - */ - -/** - * 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. - */ - /** * Reference to the chat room which could be used to send a message to the room */ @@ -821,6 +799,11 @@ export interface ChatSearchCriteria { * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ export interface OrganizationObject { + /** + * @experimental The `classification` map can be used to specify the categorization of the + * instrument and help achieve interoperability between disparate data sources. + */ + classification?: OrganizationClassification; /** * 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 @@ -855,7 +838,7 @@ export interface OrganizationObject { * An optional human-readable name for the contact */ name?: string; - type: TentacledInteractionType; + type: TentacledAppID; [property: string]: any; } @@ -935,20 +918,7 @@ export interface Identifiers { [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. - */ -export type TentacledInteractionType = 'fdc3.instrument' | 'fdc3.organization' | 'fdc3.contact'; - -/** - * 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. - */ +export type TentacledAppID = 'fdc3.instrument' | 'fdc3.organization' | 'fdc3.contact'; /** * A person contact that can be engaged with through email, calling, messaging, CMS, etc. @@ -1109,13 +1079,6 @@ export interface CountryID { [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. - */ - /** * A context representing an individual Currency. */ @@ -1138,13 +1101,6 @@ export interface CurrencyID { [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. - */ - /** * A collection of information to be used to initiate an email with a Contact or ContactList. */ @@ -1224,21 +1180,8 @@ export interface ContactTIdentifiers { [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. - */ export type EmailRecipientsType = 'fdc3.contact' | 'fdc3.contactList'; -/** - * 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. - */ - /** * A File attachment encoded in the form of a data URI. Can be added to a Message. */ @@ -1262,17 +1205,15 @@ export interface FileAttachmentData { [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. - */ - /** * A financial instrument from any asset class. */ export interface Instrument { + /** + * @experimental The `classification` map can be used to specify the categorization of the + * instrument and help achieve interoperability between disparate data sources. + */ + classification?: PurpleInstrumentClassification; /** * 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 @@ -1303,6 +1244,23 @@ export interface Instrument { [property: string]: any; } +/** + * @experimental The `classification` map can be used to specify the categorization of the + * instrument and help achieve interoperability between disparate data sources. + */ +export interface PurpleInstrumentClassification { + /** + * FactSet classification for the instrument. + */ + FDS_TYPE?: FactSetType; + /** + * Optional human-readable classification, to be used if no specific data classification is + * available. + */ + 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 @@ -1411,13 +1369,6 @@ export interface InstrumentList { [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. - */ - /** * An `Interaction` is a significant direct exchange of ideas or information between a * number of participants, e.g. a Sell Side party and one or more Buy Side parties. An @@ -1489,13 +1440,6 @@ export interface InteractionID { [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. - */ - /** * 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 @@ -1554,13 +1498,6 @@ export interface Nothing { [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. * @@ -1639,20 +1576,6 @@ export interface ProductObject { [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. - */ - -/** - * 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 A list of orders. Use this type for use cases that require not just a * single order, but multiple. @@ -1722,13 +1645,6 @@ export interface FluffyOrderDetails { [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. - */ - /** * An entity that can be used when referencing private companies and other organizations * where a specific instrument is not available or desired e.g. CRM and News workflows. @@ -1771,13 +1687,6 @@ export interface OrganizationIdentifiers { [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. - */ - /** * A financial portfolio made up of multiple positions (holdings) in several instruments. * Contrast this with e.g. the [InstrumentList](InstrumentList) type, which is just a list @@ -1844,20 +1753,6 @@ export interface PositionElement { [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. - */ - -/** - * 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. - */ - /** * 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. @@ -2008,13 +1903,6 @@ export interface Trade { [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 A list of trades. Use this type for use cases that require not just a * single trade, but multiple. @@ -2076,13 +1964,6 @@ export interface TradeElement { [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. - */ - /** * A context type representing the result of a transaction initiated via FDC3, which SHOULD * be returned as an `IntentResult` by intents that create, retrieve, update or delete @@ -2113,13 +1994,6 @@ export interface TransactionResult { */ export type TransactionStatus = 'Created' | 'Deleted' | 'Updated' | 'Failed'; -/** - * 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. - */ - /** * A context type representing the price and value of a holding. */ @@ -2153,13 +2027,6 @@ export interface Valuation { [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. - */ - // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { @@ -2607,10 +2474,18 @@ const typeMap: any = { ), InstrumentElement: o( [ + { json: 'classification', js: 'classification', typ: u(undefined, r('OrganizationClassification')) }, { json: 'id', js: 'id', typ: r('PurpleInstrumentIdentifiers') }, { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, + { json: 'type', js: 'type', typ: r('PurpleAppID') }, + ], + 'any' + ), + OrganizationClassification: o( + [ + { json: 'FDS_TYPE', js: 'FDS_TYPE', typ: u(undefined, r('FactSetType')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), @@ -2672,7 +2547,7 @@ const typeMap: any = { [ { json: 'id', js: 'id', typ: r('PurpleContactIdentifiers') }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, + { json: 'type', js: 'type', typ: r('FluffyAppID') }, ], 'any' ), @@ -2773,10 +2648,11 @@ const typeMap: any = { ), OrganizationObject: o( [ + { json: 'classification', js: 'classification', typ: u(undefined, r('OrganizationClassification')) }, { json: 'id', js: 'id', typ: r('Identifiers') }, { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('TentacledInteractionType') }, + { json: 'type', js: 'type', typ: r('TentacledAppID') }, ], 'any' ), @@ -2800,7 +2676,7 @@ const typeMap: any = { [ { json: 'id', js: 'id', typ: r('FluffyContactIdentifiers') }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, + { json: 'type', js: 'type', typ: r('FluffyAppID') }, ], 'any' ), @@ -2899,10 +2775,18 @@ const typeMap: any = { ), Instrument: o( [ + { json: 'classification', js: 'classification', typ: u(undefined, r('PurpleInstrumentClassification')) }, { json: 'id', js: 'id', typ: r('FluffyInstrumentIdentifiers') }, { json: 'market', js: 'market', typ: u(undefined, r('PurpleMarket')) }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, + { json: 'type', js: 'type', typ: r('PurpleAppID') }, + ], + 'any' + ), + PurpleInstrumentClassification: o( + [ + { json: 'FDS_TYPE', js: 'FDS_TYPE', typ: u(undefined, r('FactSetType')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], 'any' ), @@ -3030,7 +2914,7 @@ const typeMap: any = { [ { json: 'id', js: 'id', typ: r('OrganizationIdentifiers') }, { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'type', js: 'type', typ: r('StickyInteractionType') }, + { json: 'type', js: 'type', typ: r('StickyAppID') }, ], 'any' ), @@ -3146,18 +3030,47 @@ const typeMap: any = { ), ActionType: ['broadcast', 'raiseIntent'], ActionTypeEnum: ['fdc3.action'], - PurpleInteractionType: ['fdc3.instrument'], + FactSetType: [ + 'commodity', + 'commodityIndex', + 'corporateDebt', + 'creditDefaultSwapIndex', + 'deal', + 'debt', + 'debtIndex', + 'etf', + 'fixedIncome', + 'future', + 'governmentBenchmarkDebt', + 'loan', + 'mortgageBackedSecurity', + 'municipalDebt', + 'mutualFund', + 'mutualFundIndex', + 'option', + 'otherDebt', + 'ownershipPrivateCompany', + 'pevcFirm', + 'pevcFund', + 'privateCompany', + 'publicCompany', + 'publicCompanyIndex', + 'sovereignDebt', + 'structuredProduct', + 'unknown', + ], + PurpleAppID: ['fdc3.instrument'], TimeRangeType: ['fdc3.timeRange'], ChartStyle: ['bar', 'candle', 'custom', 'heatmap', 'histogram', 'line', 'mountain', 'pie', 'scatter', 'stacked-bar'], ChartType: ['fdc3.chart'], - FluffyInteractionType: ['fdc3.contact'], + FluffyAppID: ['fdc3.contact'], ContactListType: ['fdc3.contactList'], EntityType: ['fdc3.action', 'fdc3.fileAttachment'], MessageType: ['fdc3.message'], ChatInitSettingsType: ['fdc3.chat.initSettings'], ChatRoomType: ['fdc3.chat.room'], ChatMessageType: ['fdc3.chat.message'], - TentacledInteractionType: ['fdc3.contact', 'fdc3.instrument', 'fdc3.organization'], + TentacledAppID: ['fdc3.contact', 'fdc3.instrument', 'fdc3.organization'], ChatSearchCriteriaType: ['fdc3.chat.searchCriteria'], CountryType: ['fdc3.country'], CurrencyType: ['fdc3.currency'], @@ -3170,7 +3083,7 @@ const typeMap: any = { ProductType: ['fdc3.product'], OrderType: ['fdc3.order'], OrderListType: ['fdc3.orderList'], - StickyInteractionType: ['fdc3.organization'], + StickyAppID: ['fdc3.organization'], PositionType: ['fdc3.position'], PortfolioType: ['fdc3.portfolio'], TradeType: ['fdc3.trade'], diff --git a/packages/fdc3-context/schemas/context/chatSearchCriteria.schema.json b/packages/fdc3-context/schemas/context/chatSearchCriteria.schema.json index 1318ee4c4..4b6c3cb9e 100644 --- a/packages/fdc3-context/schemas/context/chatSearchCriteria.schema.json +++ b/packages/fdc3-context/schemas/context/chatSearchCriteria.schema.json @@ -41,9 +41,7 @@ "$ref": "contact.schema.json#" }, { - "type": "string", - "title": "Free text", - "description": "Free text to be used for a keyword search" + "type": "string" } ] } diff --git a/packages/fdc3-context/schemas/context/instrument.schema.json b/packages/fdc3-context/schemas/context/instrument.schema.json index cffd9c4b2..81fa02ab5 100644 --- a/packages/fdc3-context/schemas/context/instrument.schema.json +++ b/packages/fdc3-context/schemas/context/instrument.schema.json @@ -96,6 +96,52 @@ "unevaluatedProperties": { "type": "string" } + }, + "classification": { + "title": "Instrument Classification", + "description": "@experimental The `classification` map can be used to specify the categorization of the instrument and help achieve interoperability between disparate data sources.", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "FDC3 Instrument Classification Name", + "description": "Optional human-readable classification, to be used if no specific data classification is available." + }, + "FDS_TYPE": { + "title": "FactSet Type", + "description": "FactSet classification for the instrument.", + "type": "string", + "enum": [ + "commodity", + "commodityIndex", + "corporateDebt", + "creditDefaultSwapIndex", + "deal", + "debt", + "debtIndex", + "etf", + "fixedIncome", + "future", + "governmentBenchmarkDebt", + "loan", + "mortgageBackedSecurity", + "municipalDebt", + "mutualFund", + "mutualFundIndex", + "option", + "otherDebt", + "ownershipPrivateCompany", + "pevcFirm", + "pevcFund", + "privateCompany", + "publicCompany", + "publicCompanyIndex", + "sovereignDebt", + "structuredProduct", + "unknown" + ] + } + } } }, "required": [ @@ -115,6 +161,9 @@ }, "market": { "MIC": "XNAS" + }, + "classification": { + "name": "publicCompany" } } ] diff --git a/packages/fdc3-context/schemas/context/interaction.schema.json b/packages/fdc3-context/schemas/context/interaction.schema.json index 19127bc30..a07616f20 100644 --- a/packages/fdc3-context/schemas/context/interaction.schema.json +++ b/packages/fdc3-context/schemas/context/interaction.schema.json @@ -46,20 +46,7 @@ "interactionType": { "title": "Interaction Type", "description": "`interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or `'Meeting'` although other string values are permitted.", - "anyOf": [ - { - "type": "string", - "enum": [ - "Instant Message", - "Email", - "Call", - "Meeting" - ] - }, - { - "type": "string" - } - ] + "type": "string" }, "description": { "title": "Interaction Description", diff --git a/packages/fdc3-schema/generated/api/BrowserTypes.ts b/packages/fdc3-schema/generated/api/BrowserTypes.ts index 2e73252f7..8eea4e867 100644 --- a/packages/fdc3-schema/generated/api/BrowserTypes.ts +++ b/packages/fdc3-schema/generated/api/BrowserTypes.ts @@ -1,15 +1,7 @@ // To parse this data: // -// import { Convert, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocol6Goodbye, WebConnectionProtocolMessage, AddContextListenerRequest, AddContextListenerResponse, AddEventListenerRequest, AddEventListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, AgentEventMessage, AgentResponseMessage, AppRequestMessage, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ClearContextRequest, ClearContextResponse, ContextClearedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, EventListenerUnsubscribeRequest, EventListenerUnsubscribeResponse, Fdc3UserInterfaceChannelSelected, Fdc3UserInterfaceChannels, Fdc3UserInterfaceDrag, Fdc3UserInterfaceHandshake, Fdc3UserInterfaceHello, Fdc3UserInterfaceMessage, Fdc3UserInterfaceResolve, Fdc3UserInterfaceResolveAction, Fdc3UserInterfaceRestyle, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, HeartbeatAcknowledgementRequest, HeartbeatEvent, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, IntentResultRequest, IntentResultResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse } from "./file"; +// import { Convert, AddContextListenerRequest, AddContextListenerResponse, AddEventListenerRequest, AddEventListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, AgentEventMessage, AgentResponseMessage, AppRequestMessage, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ClearContextRequest, ClearContextResponse, ContextClearedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, EventListenerUnsubscribeRequest, EventListenerUnsubscribeResponse, Fdc3UserInterfaceChannels, Fdc3UserInterfaceChannelSelected, Fdc3UserInterfaceDrag, Fdc3UserInterfaceHandshake, Fdc3UserInterfaceHello, Fdc3UserInterfaceMessage, Fdc3UserInterfaceResolve, Fdc3UserInterfaceResolveAction, Fdc3UserInterfaceRestyle, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, HeartbeatAcknowledgementRequest, HeartbeatEvent, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, IntentResultRequest, IntentResultResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocol6Goodbye, WebConnectionProtocolMessage } from "./file"; // -// const webConnectionProtocol1Hello = Convert.toWebConnectionProtocol1Hello(json); -// const webConnectionProtocol2LoadURL = Convert.toWebConnectionProtocol2LoadURL(json); -// const webConnectionProtocol3Handshake = Convert.toWebConnectionProtocol3Handshake(json); -// const webConnectionProtocol4ValidateAppIdentity = Convert.toWebConnectionProtocol4ValidateAppIdentity(json); -// const webConnectionProtocol5ValidateAppIdentityFailedResponse = Convert.toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json); -// const webConnectionProtocol5ValidateAppIdentitySuccessResponse = Convert.toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json); -// const webConnectionProtocol6Goodbye = Convert.toWebConnectionProtocol6Goodbye(json); -// const webConnectionProtocolMessage = Convert.toWebConnectionProtocolMessage(json); // const addContextListenerRequest = Convert.toAddContextListenerRequest(json); // const addContextListenerResponse = Convert.toAddContextListenerResponse(json); // const addEventListenerRequest = Convert.toAddEventListenerRequest(json); @@ -32,8 +24,8 @@ // const createPrivateChannelResponse = Convert.toCreatePrivateChannelResponse(json); // const eventListenerUnsubscribeRequest = Convert.toEventListenerUnsubscribeRequest(json); // const eventListenerUnsubscribeResponse = Convert.toEventListenerUnsubscribeResponse(json); -// const fdc3UserInterfaceChannelSelected = Convert.toFdc3UserInterfaceChannelSelected(json); // const fdc3UserInterfaceChannels = Convert.toFdc3UserInterfaceChannels(json); +// const fdc3UserInterfaceChannelSelected = Convert.toFdc3UserInterfaceChannelSelected(json); // const fdc3UserInterfaceDrag = Convert.toFdc3UserInterfaceDrag(json); // const fdc3UserInterfaceHandshake = Convert.toFdc3UserInterfaceHandshake(json); // const fdc3UserInterfaceHello = Convert.toFdc3UserInterfaceHello(json); @@ -86,765 +78,232 @@ // const raiseIntentRequest = Convert.toRaiseIntentRequest(json); // const raiseIntentResponse = Convert.toRaiseIntentResponse(json); // const raiseIntentResultResponse = Convert.toRaiseIntentResultResponse(json); +// const webConnectionProtocol1Hello = Convert.toWebConnectionProtocol1Hello(json); +// const webConnectionProtocol2LoadURL = Convert.toWebConnectionProtocol2LoadURL(json); +// const webConnectionProtocol3Handshake = Convert.toWebConnectionProtocol3Handshake(json); +// const webConnectionProtocol4ValidateAppIdentity = Convert.toWebConnectionProtocol4ValidateAppIdentity(json); +// const webConnectionProtocol5ValidateAppIdentityFailedResponse = Convert.toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json); +// const webConnectionProtocol5ValidateAppIdentitySuccessResponse = Convert.toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json); +// const webConnectionProtocol6Goodbye = Convert.toWebConnectionProtocol6Goodbye(json); +// const webConnectionProtocolMessage = Convert.toWebConnectionProtocolMessage(json); // // These functions will throw an error if the JSON doesn't // match the expected interface, even if the JSON is valid. /** - * Hello message sent by an application to a parent window or frame when attempting to - * establish connectivity to a Desktop Agent. + * A request to add a context listener to a specified Channel OR to the current user + * channel. Where the listener is added to the current user channel (channelId == null), and + * this app has already been added to a user channel, client code should make a subsequent + * request to get the current context of that channel for this listener and then call its + * handler with it. * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. + * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface WebConnectionProtocol1Hello { +export interface AddContextListenerRequest { /** - * Metadata for a Web Connection Protocol message. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - meta: WebConnectionProtocol1HelloMeta; + meta: AddContextListenerRequestMeta; /** - * The message payload, containing data pertaining to this connection step. + * The message payload typically contains the arguments to FDC3 API functions. */ - payload: WebConnectionProtocol1HelloPayload; + payload: AddContextListenerRequestPayload; /** - * Identifies the type of the connection step message. + * 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: 'WCP1Hello'; + type: 'addContextListenerRequest'; } /** - * Metadata for a Web Connection Protocol message. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ -export interface WebConnectionProtocol1HelloMeta { - connectionAttemptUuid: string; +export interface AddContextListenerRequestMeta { + requestUuid: string; + /** + * Field that represents the source application that a request or response was received + * from. Please note that this may be set by an app or Desktop Agent proxy for debugging + * purposes but a Desktop Agent should make its own determination of the source of a message + * to avoid spoofing. + */ + source?: AppIdentifier; timestamp: Date; } /** - * The message payload, containing data pertaining to this connection step. + * Field that represents the source application that a request or response was received + * from. Please note that this may be set by an app or Desktop Agent proxy for debugging + * purposes but a Desktop Agent should make its own determination of the source of a message + * to avoid spoofing. + * + * Identifies an application, or instance of an application, and is used to target FDC3 API + * calls, such as `fdc3.open` or `fdc3.raiseIntent` at specific applications or application + * instances. + * + * Will always include at least an `appId` field, which uniquely identifies a specific app. + * + * If the `instanceId` field is set then the `AppMetadata` object represents a specific + * instance of the application that may be addressed using that Id. + * + * Field that represents the source application that the request being responded to was + * received from, for debugging purposes. + * + * Details of the application instance that broadcast the context. + * + * The App resolution option chosen. + * + * Details of the application instance that raised the intent. + * + * Identifier for the app instance that was selected (or started) to resolve the intent. + * `source.instanceId` MUST be set, indicating the specific app instance that + * received the intent. */ -export interface WebConnectionProtocol1HelloPayload { +export interface AppIdentifier { /** - * The current URL of the page attempting to connect. This may differ from the identityUrl, - * but the origins MUST match. + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. */ - actualUrl: string; + appId: string; /** - * A flag that may be used to indicate that a channel selector user interface is or is not - * required. Set to `false` if the app includes its own interface for selecting channels or - * does not work with user channels. + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. */ - channelSelector?: boolean; + desktopAgent?: string; /** - * The version of FDC3 API that the app supports. + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. */ - fdc3Version: string; + instanceId?: string; + [property: string]: any; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface AddContextListenerRequestPayload { /** - * URL to use for the identity of the application. Desktop Agents MUST validate that the - * origin of the message matches the URL, but MAY implement custom comparison logic. + * The id of the channel to add the listener to or `null` indicating that it should listen + * to the current user channel (at the time of broadcast). */ - identityUrl: string; + channelId: null | string; /** - * A flag that may be used to indicate that an intent resolver is or is not required. Set to - * `false` if no intents, or only targeted intents, are raised. + * The type of context to listen for OR `null` indicating that it should listen to all + * context types. */ - intentResolver?: boolean; + contextType: null | string; } /** - * Identifies the type of the connection step message. + * 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. */ /** - * Response from a Desktop Agent to an application requesting access to it indicating that - * it should load a specified URL into a hidden iframe in order to establish connectivity to - * a Desktop Agent. + * A response to a addContextListener request. Where the listener was added to the current + * user channel (channelId == null), and this app has already been added to a user channel, + * client code should make a subsequent request to get the current context of that channel + * for this listener and then call its handler with it. * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. */ -export interface WebConnectionProtocol2LoadURL { +export interface AddContextListenerResponse { /** - * Metadata for a Web Connection Protocol message. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - meta: WebConnectionProtocol1HelloMeta; + meta: AddContextListenerResponseMeta; /** - * The message payload, containing data pertaining to this connection step. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - payload: WebConnectionProtocol2LoadURLPayload; + payload: AddContextListenerResponsePayload; /** - * Identifies the type of the connection step message. + * 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: 'WCP2LoadUrl'; + type: 'addContextListenerResponse'; } /** - * The message payload, containing data pertaining to this connection step. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ -export interface WebConnectionProtocol2LoadURLPayload { +export interface AddContextListenerResponseMeta { + requestUuid: string; + responseUuid: string; /** - * A URL which can be used to establish communication with the Desktop Agent, via loading - * the URL into an iframe and restarting the Web Connection protocol with the iframe as the - * target. + * Field that represents the source application that the request being responded to was + * received from, for debugging purposes. */ - iframeUrl: string; + source?: AppIdentifier; + timestamp: Date; } /** - * Identifies the type of the connection step message. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ +export interface AddContextListenerResponsePayload { + error?: PurpleError; + listenerUUID?: string; +} /** - * Handshake message sent by the Desktop Agent to the app (with a MessagePort appended) that - * should be used for subsequent communication steps. + * Constants representing the errors that can be encountered when calling the `open` method + * on the DesktopAgent object (`fdc3`). * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. + * Constants representing the errors that can be encountered when calling the + * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or + * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */ -export interface WebConnectionProtocol3Handshake { +export type PurpleError = + | 'AccessDenied' + | 'CreationFailed' + | 'MalformedContext' + | 'NoChannelFound' + | 'ApiTimeout' + | 'InvalidArguments'; + +/** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + +/** + * A request to add an event listener for a specified event type to the Desktop Agent. + * + * A request message from an FDC3-enabled app to a Desktop Agent. + */ +export interface AddEventListenerRequest { /** - * Metadata for a Web Connection Protocol message. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - meta: WebConnectionProtocol1HelloMeta; + meta: AddContextListenerRequestMeta; /** - * The message payload, containing data pertaining to this connection step. + * The message payload typically contains the arguments to FDC3 API functions. */ - payload: WebConnectionProtocol3HandshakePayload; + payload: AddEventListenerRequestPayload; /** - * Identifies the type of the connection step message. + * 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: 'WCP3Handshake'; + type: 'addEventListenerRequest'; } /** - * The message payload, containing data pertaining to this connection step. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface WebConnectionProtocol3HandshakePayload { - /** - * Indicates a custom timeout (in milliseconds) that should be used for API message - * exchanges that may involve launching an application, instead of the default 100,000 - * millisecond timeout. - */ - appLaunchTimeout?: number; - /** - * Indicates whether a channel selector user interface is required and the URL to use to do - * so. Set to `true` to use the default or `false` to disable the channel selector (as the - * Desktop Agent will handle it another way). - */ - channelSelectorUrl: boolean | string; - /** - * The version of FDC3 API that the Desktop Agent will provide support for. - */ - fdc3Version: string; - /** - * Indicates whether an intent resolver user interface is required and the URL to use to do - * so. Set to `true` to use the default or `false` to disable the intent resolver (as the - * Desktop Agent will handle it another way). - */ - intentResolverUrl: boolean | string; +export interface AddEventListenerRequestPayload { /** - * Indicates a custom timeout (in milliseconds) that should be used for the majority of API - * message exchanges instead of the default 10,000 millisecond timeout. + * The type of the event to be listened to or `null` to listen to all event types. */ - messageExchangeTimeout?: number; + type: 'USER_CHANNEL_CHANGED' | null; } /** - * Identifies the type of the connection step message. - */ - -/** - * Identity Validation request from an app attempting to connect to a Desktop Agent. - * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. - */ -export interface WebConnectionProtocol4ValidateAppIdentity { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol4ValidateAppIdentityPayload; - /** - * Identifies the type of the connection step message. - */ - type: 'WCP4ValidateAppIdentity'; -} - -/** - * The message payload, containing data pertaining to this connection step. - */ -export interface WebConnectionProtocol4ValidateAppIdentityPayload { - /** - * The current URL of the page attempting to connect. This may differ from the identityUrl, - * but the origins MUST match. - */ - actualUrl: string; - /** - * URL to use for the identity of the application. Desktop Agents MUST validate that the - * origin of the message matches the URL, but MAY implement custom comparison logic. - */ - identityUrl: string; - /** - * If an application has previously connected to the Desktop Agent, it may specify its prior - * instance id and associated instance UUID to request the same same instance Id be assigned. - */ - instanceId?: string; - /** - * Instance UUID associated with the requested instanceId. - */ - instanceUuid?: string; -} - -/** - * Identifies the type of the connection step message. - */ - -/** - * Message sent by the Desktop Agent to an app if their identity validation fails. - * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. - */ -export interface WebConnectionProtocol5ValidateAppIdentityFailedResponse { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload; - /** - * Identifies the type of the connection step message. - */ - type: 'WCP5ValidateAppIdentityFailedResponse'; -} - -/** - * The message payload, containing data pertaining to this connection step. - */ -export interface WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload { - message?: string; -} - -/** - * Identifies the type of the connection step message. - */ - -/** - * Message sent by the Desktop Agent to an app after successful identity validation. - * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. - */ -export interface WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload; - /** - * Identifies the type of the connection step message. - */ - type: 'WCP5ValidateAppIdentityResponse'; -} - -/** - * The message payload, containing data pertaining to this connection step. - */ -export interface WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload { - /** - * The appId that the app's identity was validated against. - */ - appId: string; - /** - * Implementation metadata for the Desktop Agent, which includes an appMetadata element - * containing a copy of the app's own metadata. - */ - implementationMetadata: ImplementationMetadata; - /** - * The instance Id granted to the application by the Desktop Agent. - */ - instanceId: string; - /** - * Instance UUID associated with the instanceId granted, which may be used to retrieve the - * same instanceId if the app is reloaded or navigates. - */ - instanceUuid: string; -} - -/** - * Implementation metadata for the Desktop Agent, which includes an appMetadata element - * containing a copy of the app's own metadata. - * - * Includes Metadata for the current application. - * - * Metadata relating to the FDC3 Desktop Agent implementation and its provider. - */ -export interface ImplementationMetadata { - /** - * The calling application instance's own metadata, according to the Desktop Agent (MUST - * include at least the `appId` and `instanceId`). - */ - appMetadata: AppMetadata; - /** - * 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: OptionalFeatures; - /** - * 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; -} - -/** - * The calling application instance's own metadata, according to the Desktop Agent (MUST - * include at least the `appId` and `instanceId`). - * - * Extends an `AppIdentifier`, describing an application or instance of an application, with - * additional descriptive metadata that is usually provided by an FDC3 App Directory that - * the Desktop Agent connects to. - * - * The additional information from an app directory can aid in rendering UI elements, such - * as a launcher menu or resolver UI. This includes a title, description, tooltip and icon - * and screenshot URLs. - * - * Note that as `AppMetadata` instances are also `AppIdentifiers` they may be passed to the - * `app` argument of `fdc3.open`, `fdc3.raiseIntent` etc. - */ -export interface AppMetadata { - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * A longer, multi-paragraph description for the application that could include markup. - */ - description?: string; - /** - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent?: string; - /** - * A list of icon URLs for the application that can be used to render UI elements. - */ - icons?: Icon[]; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - /** - * An optional set of, implementation specific, metadata fields that can be used to - * disambiguate instances, such as a window title or screen position. Must only be set if - * `instanceId` is set. - */ - instanceMetadata?: { [key: string]: any }; - /** - * The 'friendly' app name. - * This field was used with the `open` and `raiseIntent` calls in FDC3 <2.0, which now - * require an `AppIdentifier` wth `appId` set. - * Note that for display purposes the `title` field should be used, if set, in preference to - * this field. - */ - name?: string; - /** - * The type of output returned for any intent specified during resolution. May express a - * particular context type (e.g. "fdc3.instrument"), channel (e.g. "channel") or a channel - * that will receive a specified type (e.g. "channel"). - */ - resultType?: null | string; - /** - * Images representing the app in common usage scenarios that can be used to render UI - * elements. - */ - screenshots?: Image[]; - /** - * A more user-friendly application title that can be used to render UI elements. - */ - title?: string; - /** - * A tooltip for the application that can be used to render UI elements. - */ - tooltip?: string; - /** - * The Version of the application. - */ - version?: string; -} - -/** - * Describes an Icon image that may be used to represent the application. - */ -export interface Icon { - /** - * The icon dimension, formatted as `x`. - */ - size?: string; - /** - * The icon url. - */ - src: string; - /** - * Icon media type. If not present the Desktop Agent may use the src file extension. - */ - type?: string; -} - -/** - * Describes an image file, typically a screenshot, that often represents the application in - * a common usage scenario. - */ -export interface Image { - /** - * Caption for the image. - */ - label?: string; - /** - * The image dimension, formatted as `x`. - */ - size?: string; - /** - * The image url. - */ - src: string; - /** - * Image media type. If not present the Desktop Agent may use the src file extension. - */ - type?: string; -} - -/** - * Metadata indicating whether the Desktop Agent implements optional features of - * the Desktop Agent API. - */ -export interface OptionalFeatures { - /** - * 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; -} - -/** - * Identifies the type of the connection step message. - */ - -/** - * Goodbye message to be sent to the Desktop Agent when disconnecting (e.g. when closing the - * window or navigating). Desktop Agents should close the MessagePort after receiving this - * message, but retain instance details in case the application reconnects (e.g. after a - * navigation event). - * - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. - */ -export interface WebConnectionProtocol6Goodbye { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol6GoodbyeMeta; - /** - * Identifies the type of the connection step message. - */ - type: 'WCP6Goodbye'; -} - -/** - * Metadata for a Web Connection Protocol message. - */ -export interface WebConnectionProtocol6GoodbyeMeta { - timestamp: Date; -} - -/** - * Identifies the type of the connection step message. - */ - -/** - * A message used during the connection flow for an application to a Desktop Agent in a - * browser window. Used for messages sent in either direction. - */ -export interface WebConnectionProtocolMessage { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: ConnectionStepMetadata; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload?: { [key: string]: any }; - /** - * Identifies the type of the connection step message. - */ - type: ConnectionStepMessageType; -} - -/** - * Metadata for a Web Connection Protocol message. - */ -export interface ConnectionStepMetadata { - timestamp: Date; - connectionAttemptUuid?: string; -} - -/** - * Identifies the type of the connection step message. - */ -export type ConnectionStepMessageType = - | 'WCP1Hello' - | 'WCP2LoadUrl' - | 'WCP3Handshake' - | 'WCP4ValidateAppIdentity' - | 'WCP5ValidateAppIdentityFailedResponse' - | 'WCP5ValidateAppIdentityResponse' - | 'WCP6Goodbye'; - -/** - * A request to add a context listener to a specified Channel OR to the current user - * channel. Where the listener is added to the current user channel (channelId == null), and - * this app has already been added to a user channel, client code should make a subsequent - * request to get the current context of that channel for this listener and then call its - * handler with it. - * - * A request message from an FDC3-enabled app to a Desktop Agent. - */ -export interface AddContextListenerRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: AddContextListenerRequestPayload; - /** - * 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: 'addContextListenerRequest'; -} - -/** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ -export interface AddContextListenerRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that a request or response was received - * from. Please note that this may be set by an app or Desktop Agent proxy for debugging - * purposes but a Desktop Agent should make its own determination of the source of a message - * to avoid spoofing. - */ - source?: AppIdentifier; - timestamp: Date; -} - -/** - * Field that represents the source application that a request or response was received - * from. Please note that this may be set by an app or Desktop Agent proxy for debugging - * purposes but a Desktop Agent should make its own determination of the source of a message - * to avoid spoofing. - * - * Identifies an application, or instance of an application, and is used to target FDC3 API - * calls, such as `fdc3.open` or `fdc3.raiseIntent` at specific applications or application - * instances. - * - * Will always include at least an `appId` field, which uniquely identifies a specific app. - * - * If the `instanceId` field is set then the `AppMetadata` object represents a specific - * instance of the application that may be addressed using that Id. - * - * Field that represents the source application that the request being responded to was - * received from, for debugging purposes. - * - * Details of the application instance that broadcast the context. - * - * The App resolution option chosen. - * - * Details of the application instance that raised the intent. - * - * Identifier for the app instance that was selected (or started) to resolve the intent. - * `source.instanceId` MUST be set, indicating the specific app instance that - * received the intent. - */ -export interface AppIdentifier { - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface AddContextListenerRequestPayload { - /** - * The id of the channel to add the listener to or `null` indicating that it should listen - * to the current user channel (at the time of broadcast). - */ - channelId: null | string; - /** - * The type of context to listen for OR `null` indicating that it should listen to all - * context types. - */ - contextType: null | string; -} - -/** - * 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. - */ - -/** - * A response to a addContextListener request. Where the listener was added to the current - * user channel (channelId == null), and this app has already been added to a user channel, - * client code should make a subsequent request to get the current context of that channel - * for this listener and then call its handler with it. - * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. - */ -export interface AddContextListenerResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: AddContextListenerResponsePayload; - /** - * 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: 'addContextListenerResponse'; -} - -/** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ -export interface AddContextListenerResponseMeta { - requestUuid: string; - responseUuid: string; - /** - * Field that represents the source application that the request being responded to was - * received from, for debugging purposes. - */ - source?: AppIdentifier; - timestamp: Date; -} - -/** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ -export interface AddContextListenerResponsePayload { - error?: PurpleError; - listenerUUID?: string; -} - -/** - * 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 - * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or - * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). - */ -export type PurpleError = - | 'AccessDenied' - | 'CreationFailed' - | 'MalformedContext' - | 'NoChannelFound' - | 'ApiTimeout' - | 'InvalidArguments'; - -/** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - -/** - * A request to add an event listener for a specified event type to the Desktop Agent. - * - * A request message from an FDC3-enabled app to a Desktop Agent. - */ -export interface AddEventListenerRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: AddEventListenerRequestPayload; - /** - * 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: 'addEventListenerRequest'; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface AddEventListenerRequestPayload { - /** - * The type of the event to be listened to or `null` to listen to all event types. - */ - type: 'USER_CHANNEL_CHANGED' | null; -} - -/** - * The type of a (non-context and non-intent) event that may be received via the FDC3 API's - * addEventListener function. + * The type of a (non-context and non-intent) event that may be received via the FDC3 API's + * addEventListener function. */ /** @@ -1666,204 +1125,540 @@ export interface Channel { * it has these, * this is their meaning. */ -export interface DisplayMetadata { - /** - * The color that should be associated within this channel when displaying this channel in a - * UI, e.g: `0xFF0000`. - */ - color?: string; +export interface DisplayMetadata { + /** + * The color that should be associated within this channel when displaying this channel in a + * UI, e.g: `0xFF0000`. + */ + color?: string; + /** + * A URL of an image that can be used to display this channel. + */ + glyph?: string; + /** + * A user-readable name for this channel, e.g: `"Red"`. + */ + name?: string; +} + +/** + * Uniquely defines each channel type. + * Can be "user", "app" or "private". + */ +export type Type = 'app' | 'private' | 'user'; + +/** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + +/** + * A request to unsubscribe an event listener. + * + * A request message from an FDC3-enabled app to a Desktop Agent. + */ +export interface EventListenerUnsubscribeRequest { + /** + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + */ + meta: AddContextListenerRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: EventListenerUnsubscribeRequestPayload; + /** + * 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: 'eventListenerUnsubscribeRequest'; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface EventListenerUnsubscribeRequestPayload { + listenerUUID: string; +} + +/** + * 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. + */ + +/** + * A response to an eventListenerUnsubscribe request. + * + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. + */ +export interface EventListenerUnsubscribeResponse { + /** + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + */ + meta: AddContextListenerResponseMeta; + /** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ + payload: BroadcastResponseResponsePayload; + /** + * 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: 'eventListenerUnsubscribeResponse'; +} + +/** + * 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. + */ + +/** + * Setup message sent by the DA proxy code in getAgent() to a channel selector UI in an + * iframe with the channel definitions and current channel selection. + * + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. + */ +export interface Fdc3UserInterfaceChannels { + /** + * The message payload. + */ + payload: Fdc3UserInterfaceChannelsPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceChannels'; +} + +/** + * The message payload. + */ +export interface Fdc3UserInterfaceChannelsPayload { + /** + * The id of the channel that should be currently selected, or `null` if none should be + * selected. + */ + selected: null | string; + /** + * User Channel definitions.```````s + */ + userChannels: Channel[]; +} + +/** + * Identifies the type of the message to or from the user interface frame. + */ + +/** + * Message from a channel selector UI to the DA proxy sent when the channel selection + * changes. + * + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. + */ +export interface Fdc3UserInterfaceChannelSelected { + /** + * The message payload. + */ + payload: Fdc3UserInterfaceChannelSelectedPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceChannelSelected'; +} + +/** + * The message payload. + */ +export interface Fdc3UserInterfaceChannelSelectedPayload { + /** + * The id of the channel that should be currently selected, or `null` if none should be + * selected. + */ + selected: null | string; +} + +/** + * Identifies the type of the message to or from the user interface frame. + */ + +/** + * Message from a UI iframe to the DA proxy (setup by `getAgent()`) indicating that the user + * is dragging the UI to a new location and providing the offset to apply to the location. + * The DA proxy implementation should limit the location to the current bounds of the + * window's viewport. + * + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. + */ +export interface Fdc3UserInterfaceDrag { + /** + * The message payload. + */ + payload: Fdc3UserInterfaceDragPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceDrag'; +} + +/** + * The message payload. + */ +export interface Fdc3UserInterfaceDragPayload { + /** + * The offset to move the frame by. + */ + mouseOffsets: MouseOffsets; +} + +/** + * The offset to move the frame by. + */ +export interface MouseOffsets { + x: number; + y: number; +} + +/** + * Identifies the type of the message to or from the user interface frame. + */ + +/** + * Handshake message sent back to a user interface from the DA proxy code (setup by + * `getAgent()`) over the `MessagePort` provided in the preceding Fdc3UserInterfaceHello + * message, confirming that it is listening to the `MessagePort` for further communication. + * + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. + */ +export interface Fdc3UserInterfaceHandshake { /** - * A URL of an image that can be used to display this channel. + * The message payload. */ - glyph?: string; + payload: Fdc3UserInterfaceHandshakePayload; /** - * A user-readable name for this channel, e.g: `"Red"`. + * Identifies the type of the message to or from the user interface frame. */ - name?: string; + type: 'Fdc3UserInterfaceHandshake'; } /** - * Uniquely defines each channel type. - * Can be "user", "app" or "private". + * The message payload. */ -export type Type = 'app' | 'private' | 'user'; +export interface Fdc3UserInterfaceHandshakePayload { + /** + * The version of FDC3 API that the Desktop Agent will provide support for. + */ + fdc3Version: string; +} /** - * 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. + * Identifies the type of the message to or from the user interface frame. */ /** - * A request to unsubscribe an event listener. + * Hello message sent by a UI to the Desktop Agent proxy setup by `getAgent()` to indicate + * it is ready to communicate, containing initial CSS to set on the iframe, and including an + * appended `MessagePort` to be used for further communication. * - * A request message from an FDC3-enabled app to a Desktop Agent. + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. */ -export interface EventListenerUnsubscribeRequest { +export interface Fdc3UserInterfaceHello { /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * The message payload. */ - meta: AddContextListenerRequestMeta; + payload: Fdc3UserInterfaceHelloPayload; /** - * The message payload typically contains the arguments to FDC3 API functions. + * Identifies the type of the message to or from the user interface frame. */ - payload: EventListenerUnsubscribeRequestPayload; + type: 'Fdc3UserInterfaceHello'; +} + +/** + * The message payload. + */ +export interface Fdc3UserInterfaceHelloPayload { /** - * 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. + * Details about the UI implementation, such as vendor and version, for logging purposes. */ - type: 'eventListenerUnsubscribeRequest'; + implementationDetails: string; + /** + * A constrained set of styling properties that should be set on the user interface before + * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. + */ + initialCSS: InitialCSS; } /** - * The message payload typically contains the arguments to FDC3 API functions. + * A constrained set of styling properties that should be set on the user interface before + * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. */ -export interface EventListenerUnsubscribeRequestPayload { - listenerUUID: string; +export interface InitialCSS { + /** + * The initial bottom property to apply to the iframe. + */ + bottom?: string; + /** + * The initial height of the iframe. + */ + height?: string; + /** + * The initial left property to apply to the iframe. + */ + left?: string; + /** + * The maximum height to apply to the iframe. + */ + maxHeight?: string; + /** + * The maximum with to apply to the iframe. + */ + maxWidth?: string; + /** + * The initial right property to apply to the iframe. + */ + right?: string; + /** + * The initial top property to apply to the iframe. + */ + top?: string; + /** + * The transition property to apply to the iframe. + */ + transition?: string; + /** + * The initial width of the iframe. + */ + width?: string; + /** + * The initial zindex to apply to the iframe. + */ + zIndex?: string; + [property: string]: any; } /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. + * Identifies the type of the message to or from the user interface frame. */ /** - * A response to an eventListenerUnsubscribe request. - * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * A message used to communicate with user interface frames injected by `getAgent()` for + * displaying UI elements such as the intent resolver or channel selector. Used for messages + * sent in either direction. */ -export interface EventListenerUnsubscribeResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; +export interface Fdc3UserInterfaceMessage { /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload. */ - payload: BroadcastResponseResponsePayload; + payload?: { [key: string]: any }; /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. + * Identifies the type of the message to or from the user interface frame. */ - type: 'eventListenerUnsubscribeResponse'; + type: Fdc3UserInterfaceMessageType; } /** - * 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. + * Identifies the type of the message to or from the user interface frame. */ +export type Fdc3UserInterfaceMessageType = + | 'Fdc3UserInterfaceHello' + | 'Fdc3UserInterfaceHandshake' + | 'Fdc3UserInterfaceRestyle' + | 'Fdc3UserInterfaceDrag' + | 'Fdc3UserInterfaceResolve' + | 'Fdc3UserInterfaceResolveAction' + | 'Fdc3UserInterfaceChannels' + | 'Fdc3UserInterfaceChannelSelected'; /** - * Message from a channel selector UI to the DA proxy sent when the channel selection - * changes. + * Setup message sent by the DA proxy code in getAgent() to an intent resolver UI with the + * resolver data to setup the UI. * * A message used to communicate with user interface frames injected by `getAgent()` for * displaying UI elements such as the intent resolver or channel selector. Used for messages * sent in either direction. */ -export interface Fdc3UserInterfaceChannelSelected { +export interface Fdc3UserInterfaceResolve { /** * The message payload. */ - payload: Fdc3UserInterfaceChannelSelectedPayload; + payload: Fdc3UserInterfaceResolvePayload; /** * Identifies the type of the message to or from the user interface frame. */ - type: 'Fdc3UserInterfaceChannelSelected'; + type: 'Fdc3UserInterfaceResolve'; } /** * The message payload. */ -export interface Fdc3UserInterfaceChannelSelectedPayload { +export interface Fdc3UserInterfaceResolvePayload { /** - * The id of the channel that should be currently selected, or `null` if none should be - * selected. + * An array of AppIntent objects defining the resolution options. */ - selected: null | string; + appIntents: AppIntent[]; + context: Context; } /** - * Identifies the type of the message to or from the user interface frame. + * An interface that relates an intent to apps. + * + * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent + * resolver) before it can be handled. */ +export interface AppIntent { + /** + * Details of applications that can resolve the intent. + */ + apps: AppMetadata[]; + /** + * Details of the intent whose relationship to resolving applications is being described. + */ + intent: IntentMetadata; +} /** - * Setup message sent by the DA proxy code in getAgent() to a channel selector UI in an - * iframe with the channel definitions and current channel selection. + * Extends an `AppIdentifier`, describing an application or instance of an application, with + * additional descriptive metadata that is usually provided by an FDC3 App Directory that + * the Desktop Agent connects to. * - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * The additional information from an app directory can aid in rendering UI elements, such + * as a launcher menu or resolver UI. This includes a title, description, tooltip and icon + * and screenshot URLs. + * + * Note that as `AppMetadata` instances are also `AppIdentifiers` they may be passed to the + * `app` argument of `fdc3.open`, `fdc3.raiseIntent` etc. + * + * The calling application instance's own metadata, according to the Desktop Agent (MUST + * include at least the `appId` and `instanceId`). */ -export interface Fdc3UserInterfaceChannels { +export interface AppMetadata { + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * A longer, multi-paragraph description for the application that could include markup. + */ + description?: string; + /** + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent?: string; + /** + * A list of icon URLs for the application that can be used to render UI elements. + */ + icons?: Icon[]; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + /** + * An optional set of, implementation specific, metadata fields that can be used to + * disambiguate instances, such as a window title or screen position. Must only be set if + * `instanceId` is set. + */ + instanceMetadata?: { [key: string]: any }; + /** + * The 'friendly' app name. + * This field was used with the `open` and `raiseIntent` calls in FDC3 <2.0, which now + * require an `AppIdentifier` wth `appId` set. + * Note that for display purposes the `title` field should be used, if set, in preference to + * this field. + */ + name?: string; + /** + * The type of output returned for any intent specified during resolution. May express a + * particular context type (e.g. "fdc3.instrument"), channel (e.g. "channel") or a channel + * that will receive a specified type (e.g. "channel"). + */ + resultType?: null | string; + /** + * Images representing the app in common usage scenarios that can be used to render UI + * elements. + */ + screenshots?: Image[]; + /** + * A more user-friendly application title that can be used to render UI elements. + */ + title?: string; /** - * The message payload. + * A tooltip for the application that can be used to render UI elements. */ - payload: Fdc3UserInterfaceChannelsPayload; + tooltip?: string; /** - * Identifies the type of the message to or from the user interface frame. + * The Version of the application. */ - type: 'Fdc3UserInterfaceChannels'; + version?: string; } /** - * The message payload. + * Describes an Icon image that may be used to represent the application. */ -export interface Fdc3UserInterfaceChannelsPayload { +export interface Icon { /** - * The id of the channel that should be currently selected, or `null` if none should be - * selected. + * The icon dimension, formatted as `x`. */ - selected: null | string; + size?: string; /** - * User Channel definitions.```````s + * The icon url. */ - userChannels: Channel[]; + src: string; + /** + * Icon media type. If not present the Desktop Agent may use the src file extension. + */ + type?: string; } /** - * Identifies the type of the message to or from the user interface frame. - */ - -/** - * Message from a UI iframe to the DA proxy (setup by `getAgent()`) indicating that the user - * is dragging the UI to a new location and providing the offset to apply to the location. - * The DA proxy implementation should limit the location to the current bounds of the - * window's viewport. - * - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * Describes an image file, typically a screenshot, that often represents the application in + * a common usage scenario. */ -export interface Fdc3UserInterfaceDrag { +export interface Image { /** - * The message payload. + * Caption for the image. */ - payload: Fdc3UserInterfaceDragPayload; + label?: string; /** - * Identifies the type of the message to or from the user interface frame. + * The image dimension, formatted as `x`. */ - type: 'Fdc3UserInterfaceDrag'; -} - -/** - * The message payload. - */ -export interface Fdc3UserInterfaceDragPayload { + size?: string; /** - * The offset to move the frame by. + * The image url. */ - mouseOffsets: MouseOffsets; + src: string; + /** + * Image media type. If not present the Desktop Agent may use the src file extension. + */ + type?: string; } /** - * The offset to move the frame by. + * Details of the intent whose relationship to resolving applications is being described. + * + * Metadata describing an Intent. */ -export interface MouseOffsets { - x: number; - y: number; +export interface IntentMetadata { + /** + * Display name for the intent. + */ + displayName?: string; + /** + * The unique name of the intent that can be invoked by the raiseIntent call. + */ + name: string; } /** @@ -1871,85 +1666,87 @@ export interface MouseOffsets { */ /** - * Handshake message sent back to a user interface from the DA proxy code (setup by - * `getAgent()`) over the `MessagePort` provided in the preceding Fdc3UserInterfaceHello - * message, confirming that it is listening to the `MessagePort` for further communication. + * Message from an intent resolver UI to DA proxy code in getAgent() reporting a user + * action. * * A message used to communicate with user interface frames injected by `getAgent()` for * displaying UI elements such as the intent resolver or channel selector. Used for messages * sent in either direction. */ -export interface Fdc3UserInterfaceHandshake { +export interface Fdc3UserInterfaceResolveAction { /** * The message payload. */ - payload: Fdc3UserInterfaceHandshakePayload; + payload: Fdc3UserInterfaceResolveActionPayload; /** * Identifies the type of the message to or from the user interface frame. */ - type: 'Fdc3UserInterfaceHandshake'; + type: 'Fdc3UserInterfaceResolveAction'; } /** * The message payload. */ -export interface Fdc3UserInterfaceHandshakePayload { +export interface Fdc3UserInterfaceResolveActionPayload { + action: Action; /** - * The version of FDC3 API that the Desktop Agent will provide support for. + * The App resolution option chosen. */ - fdc3Version: string; + appIdentifier?: AppIdentifier; + /** + * The intent resolved. + */ + intent?: string; } +export type Action = 'hover' | 'click' | 'cancel'; + /** * Identifies the type of the message to or from the user interface frame. */ /** - * Hello message sent by a UI to the Desktop Agent proxy setup by `getAgent()` to indicate - * it is ready to communicate, containing initial CSS to set on the iframe, and including an - * appended `MessagePort` to be used for further communication. + * Message from a UI frame to the DA proxy code (setup by `getAgent()`) with updated styling + * information to apply to it. Can be used to implement a pop-open or close interaction or + * other transition needed by a UI implementation. * * A message used to communicate with user interface frames injected by `getAgent()` for * displaying UI elements such as the intent resolver or channel selector. Used for messages * sent in either direction. */ -export interface Fdc3UserInterfaceHello { +export interface Fdc3UserInterfaceRestyle { /** * The message payload. */ - payload: Fdc3UserInterfaceHelloPayload; + payload: Fdc3UserInterfaceRestylePayload; /** * Identifies the type of the message to or from the user interface frame. */ - type: 'Fdc3UserInterfaceHello'; + type: 'Fdc3UserInterfaceRestyle'; } /** * The message payload. */ -export interface Fdc3UserInterfaceHelloPayload { - /** - * Details about the UI implementation, such as vendor and version, for logging purposes. - */ - implementationDetails: string; +export interface Fdc3UserInterfaceRestylePayload { /** - * A constrained set of styling properties that should be set on the user interface before - * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. + * A constrained set of styling properties that should be applied to the frame. Note + * `position` cannot be set, and should always be `fixed`. */ - initialCSS: InitialCSS; + updatedCSS: UpdatedCSS; } /** - * A constrained set of styling properties that should be set on the user interface before - * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. + * A constrained set of styling properties that should be applied to the frame. Note + * `position` cannot be set, and should always be `fixed`. */ -export interface InitialCSS { +export interface UpdatedCSS { /** * The initial bottom property to apply to the iframe. */ bottom?: string; /** - * The initial height of the iframe. + * The updated height of the iframe. */ height?: string; /** @@ -1957,11 +1754,11 @@ export interface InitialCSS { */ left?: string; /** - * The maximum height to apply to the iframe. + * The updated maximum height to apply to the iframe. */ maxHeight?: string; /** - * The maximum with to apply to the iframe. + * The updated maximum with to apply to the iframe. */ maxWidth?: string; /** @@ -1973,249 +1770,442 @@ export interface InitialCSS { */ top?: string; /** - * The transition property to apply to the iframe. + * The updated transition property to apply to the iframe. */ transition?: string; /** - * The initial width of the iframe. + * The updated width of the iframe. */ width?: string; /** - * The initial zindex to apply to the iframe. + * The updated zIndex to apply to the iframe. */ zIndex?: string; [property: string]: any; } /** - * Identifies the type of the message to or from the user interface frame. + * Identifies the type of the message to or from the user interface frame. + */ + +/** + * A request for details of instances of a particular app. + * + * A request message from an FDC3-enabled app to a Desktop Agent. + */ +export interface FindInstancesRequest { + /** + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + */ + meta: AddContextListenerRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesRequestPayload; + /** + * 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: 'findInstancesRequest'; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface FindInstancesRequestPayload { + app: AppIdentifier; +} + +/** + * 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. + */ + +/** + * A response to a findInstances request. + * + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. + */ +export interface FindInstancesResponse { + /** + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + */ + meta: AddContextListenerResponseMeta; + /** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ + payload: FindInstancesResponsePayload; + /** + * 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: 'findInstancesResponse'; +} + +/** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + * + * The message payload contains a flag indicating whether the API call was successful, plus + * any return values for the FDC3 API function called, or indicating that the request + * resulted in an error and including a standardized error message. + */ +export interface FindInstancesResponsePayload { + error?: FindInstancesErrors; + appIdentifiers?: AppMetadata[]; +} + +/** + * 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 + * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or + * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). + * + * Unique identifier for a request or event message. Required in all message types. + * + * Unique identifier for a response to a specific message and must always be accompanied by + * a RequestUuid. + * + * Unique identifier for a `listener` object returned by a Desktop Agent to an app in + * response to addContextListener, addIntentListener or one of the PrivateChannel event + * listeners and used to identify it in messages (e.g. when unsubscribing). + * + * Unique identifier for an event message sent from a Desktop Agent to an app. + * + * Unique identifier for a for an attempt to connect to a Desktop Agent. A Unique UUID + * should be used in the first (WCP1Hello) message and should be quoted in all subsequent + * messages to link them to the same connection attempt. + * + * Should be set if the raiseIntent request returned an error. + */ +export type FindInstancesErrors = + | 'MalformedContext' + | 'ApiTimeout' + | 'InvalidArguments' + | 'DesktopAgentNotFound' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'IntentListenerConflict' + | '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. */ /** - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * A request for details of apps available to resolve a particular intent and context pair. + * + * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface Fdc3UserInterfaceMessage { +export interface FindIntentRequest { /** - * The message payload. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - payload?: { [key: string]: any }; + meta: AddContextListenerRequestMeta; /** - * Identifies the type of the message to or from the user interface frame. + * The message payload typically contains the arguments to FDC3 API functions. */ - type: Fdc3UserInterfaceMessageType; + payload: FindIntentRequestPayload; + /** + * 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: 'findIntentRequest'; } /** - * Identifies the type of the message to or from the user interface frame. + * The message payload typically contains the arguments to FDC3 API functions. */ -export type Fdc3UserInterfaceMessageType = - | 'Fdc3UserInterfaceHello' - | 'Fdc3UserInterfaceHandshake' - | 'Fdc3UserInterfaceRestyle' - | 'Fdc3UserInterfaceDrag' - | 'Fdc3UserInterfaceResolve' - | 'Fdc3UserInterfaceResolveAction' - | 'Fdc3UserInterfaceChannels' - | 'Fdc3UserInterfaceChannelSelected'; +export interface FindIntentRequestPayload { + context?: Context; + intent: string; + resultType?: string; +} /** - * Setup message sent by the DA proxy code in getAgent() to an intent resolver UI with the - * resolver data to setup the UI. + * 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. + */ + +/** + * A response to a findIntent request. * - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. */ -export interface Fdc3UserInterfaceResolve { +export interface FindIntentResponse { /** - * The message payload. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - payload: Fdc3UserInterfaceResolvePayload; + meta: AddContextListenerResponseMeta; /** - * Identifies the type of the message to or from the user interface frame. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - type: 'Fdc3UserInterfaceResolve'; + payload: FindIntentResponsePayload; + /** + * 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: 'findIntentResponse'; } /** - * The message payload. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ -export interface Fdc3UserInterfaceResolvePayload { - /** - * An array of AppIntent objects defining the resolution options. - */ - appIntents: AppIntent[]; - context: Context; +export interface FindIntentResponsePayload { + error?: FindInstancesErrors; + appIntent?: AppIntent; } /** - * An interface that relates an intent to apps. + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + +/** + * A request for details of intents and apps available to resolve them for a particular + * context. * - * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent - * resolver) before it can be handled. + * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface AppIntent { +export interface FindIntentsByContextRequest { /** - * Details of applications that can resolve the intent. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - apps: AppMetadata[]; + meta: AddContextListenerRequestMeta; /** - * Details of the intent whose relationship to resolving applications is being described. + * The message payload typically contains the arguments to FDC3 API functions. */ - intent: IntentMetadata; + payload: FindIntentsByContextRequestPayload; + /** + * 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: 'findIntentsByContextRequest'; } /** - * Details of the intent whose relationship to resolving applications is being described. - * - * Metadata describing an Intent. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface IntentMetadata { - /** - * Display name for the intent. - */ - displayName?: string; - /** - * The unique name of the intent that can be invoked by the raiseIntent call. - */ - name: string; +export interface FindIntentsByContextRequestPayload { + context: Context; + resultType?: string; } /** - * Identifies the type of the message to or from the user interface frame. + * 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. */ /** - * Message from an intent resolver UI to DA proxy code in getAgent() reporting a user - * action. + * A response to a findIntentsByContext request. * - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. */ -export interface Fdc3UserInterfaceResolveAction { +export interface FindIntentsByContextResponse { /** - * The message payload. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - payload: Fdc3UserInterfaceResolveActionPayload; + meta: AddContextListenerResponseMeta; /** - * Identifies the type of the message to or from the user interface frame. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - type: 'Fdc3UserInterfaceResolveAction'; + payload: FindIntentsByContextResponsePayload; + /** + * 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: 'findIntentsByContextResponse'; } /** - * The message payload. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ -export interface Fdc3UserInterfaceResolveActionPayload { - action: Action; - /** - * The App resolution option chosen. - */ - appIdentifier?: AppIdentifier; - /** - * The intent resolved. - */ - intent?: string; +export interface FindIntentsByContextResponsePayload { + error?: FindInstancesErrors; + appIntents?: AppIntent[]; } -export type Action = 'hover' | 'click' | 'cancel'; - /** - * Identifies the type of the message to or from the user interface frame. + * 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. */ /** - * Message from a UI frame to the DA proxy code (setup by `getAgent()`) with updated styling - * information to apply to it. Can be used to implement a pop-open or close interaction or - * other transition needed by a UI implementation. + * A request for metadata about an app. * - * A message used to communicate with user interface frames injected by `getAgent()` for - * displaying UI elements such as the intent resolver or channel selector. Used for messages - * sent in either direction. + * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface Fdc3UserInterfaceRestyle { +export interface GetAppMetadataRequest { /** - * The message payload. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - payload: Fdc3UserInterfaceRestylePayload; + meta: AddContextListenerRequestMeta; /** - * Identifies the type of the message to or from the user interface frame. + * The message payload typically contains the arguments to FDC3 API functions. */ - type: 'Fdc3UserInterfaceRestyle'; + payload: GetAppMetadataRequestPayload; + /** + * 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: 'getAppMetadataRequest'; } /** - * The message payload. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface Fdc3UserInterfaceRestylePayload { - /** - * A constrained set of styling properties that should be applied to the frame. Note - * `position` cannot be set, and should always be `fixed`. - */ - updatedCSS: UpdatedCSS; +export interface GetAppMetadataRequestPayload { + app: AppIdentifier; } /** - * A constrained set of styling properties that should be applied to the frame. Note - * `position` cannot be set, and should always be `fixed`. + * 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 interface UpdatedCSS { - /** - * The initial bottom property to apply to the iframe. - */ - bottom?: string; + +/** + * A response to a getAppMetadata request. + * + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. + */ +export interface GetAppMetadataResponse { /** - * The updated height of the iframe. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - height?: string; + meta: AddContextListenerResponseMeta; /** - * The initial left property to apply to the iframe. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - left?: string; + payload: GetAppMetadataResponsePayload; /** - * The updated maximum height to apply to the iframe. + * 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. */ - maxHeight?: string; + type: 'getAppMetadataResponse'; +} + +/** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ +export interface GetAppMetadataResponsePayload { + error?: FindInstancesErrors; + appMetadata?: AppMetadata; +} + +/** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + +/** + * A request to return the Channel object for the current User channel membership. Returns + * `null` if the app is not joined to a channel. + * + * A request message from an FDC3-enabled app to a Desktop Agent. + */ +export interface GetCurrentChannelRequest { /** - * The updated maximum with to apply to the iframe. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - maxWidth?: string; + meta: AddContextListenerRequestMeta; /** - * The initial right property to apply to the iframe. + * The message payload typically contains the arguments to FDC3 API functions. */ - right?: string; + payload: GetCurrentChannelRequestPayload; /** - * The initial top property to apply to the iframe. + * 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. */ - top?: string; + type: 'getCurrentChannelRequest'; +} + +/** + * The message payload typically contains the arguments to FDC3 API functions. + */ +export interface GetCurrentChannelRequestPayload {} + +/** + * 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. + */ + +/** + * A response to a getCurrentChannel request. + * + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. + */ +export interface GetCurrentChannelResponse { /** - * The updated transition property to apply to the iframe. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - transition?: string; + meta: AddContextListenerResponseMeta; /** - * The updated width of the iframe. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - width?: string; + payload: GetCurrentChannelResponsePayload; /** - * The updated zIndex to apply to the iframe. + * 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. */ - zIndex?: string; - [property: string]: any; + type: 'getCurrentChannelResponse'; } /** - * Identifies the type of the message to or from the user interface frame. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ +export interface GetCurrentChannelResponsePayload { + error?: ResponsePayloadError; + channel?: Channel | null; +} + +/** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. */ /** - * A request for details of instances of a particular app. + * A request to return the current context (either of a specified type or most recent + * broadcast) of a specified Channel. Returns `null` if no context (of the requested type if + * one was specified) is available in the channel. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface FindInstancesRequest { +export interface GetCurrentContextRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2223,19 +2213,27 @@ export interface FindInstancesRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: FindInstancesRequestPayload; + payload: GetCurrentContextRequestPayload; /** * 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: 'findInstancesRequest'; + type: 'getCurrentContextRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface FindInstancesRequestPayload { - app: AppIdentifier; +export interface GetCurrentContextRequestPayload { + /** + * The id of the channel to return the current context of. + */ + channelId: string; + /** + * The type of context to return for OR `null` indicating that the most recently broadcast + * context on the channel should be returned. + */ + contextType: null | string; } /** @@ -2244,12 +2242,12 @@ export interface FindInstancesRequestPayload { */ /** - * A response to a findInstances request. + * A response to a getCurrentContext request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface FindInstancesResponse { +export interface GetCurrentContextResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2259,82 +2257,40 @@ export interface FindInstancesResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: FindInstancesResponsePayload; + payload: GetCurrentContextResponsePayload; /** * 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: 'findInstancesResponse'; + type: 'getCurrentContextResponse'; } /** * A payload for a response to an API call that will contain any return values or an `error` * property containing a standardized error message indicating that the request was * unsuccessful. - * - * The message payload contains a flag indicating whether the API call was successful, plus - * any return values for the FDC3 API function called, or indicating that the request - * resulted in an error and including a standardized error message. */ -export interface FindInstancesResponsePayload { - error?: FindInstancesErrors; - appIdentifiers?: AppMetadata[]; +export interface GetCurrentContextResponsePayload { + error?: PurpleError; + /** + * The most recently broadcast context object (of the specified type, if one was specified), + * or `null` if none was available in the channel. + */ + context?: null | Context; } -/** - * 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 - * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or - * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). - * - * Unique identifier for a for an attempt to connect to a Desktop Agent. A Unique UUID - * should be used in the first (WCP1Hello) message and should be quoted in all subsequent - * messages to link them to the same connection attempt. - * - * Unique identifier for a request or event message. Required in all message types. - * - * Unique identifier for a response to a specific message and must always be accompanied by - * a RequestUuid. - * - * Unique identifier for a `listener` object returned by a Desktop Agent to an app in - * response to addContextListener, addIntentListener or one of the PrivateChannel event - * listeners and used to identify it in messages (e.g. when unsubscribing). - * - * Unique identifier for an event message sent from a Desktop Agent to an app. - * - * Should be set if the raiseIntent request returned an error. - */ -export type FindInstancesErrors = - | 'MalformedContext' - | 'ApiTimeout' - | 'InvalidArguments' - | 'DesktopAgentNotFound' - | 'ResolverUnavailable' - | 'IntentDeliveryFailed' - | 'NoAppsFound' - | 'ResolverTimeout' - | 'TargetAppUnavailable' - | 'TargetInstanceUnavailable' - | 'UserCancelledResolution' - | 'IntentListenerConflict' - | '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. */ /** - * A request for details of apps available to resolve a particular intent and context pair. + * Request to retrieve information about the FDC3 Desktop Agent implementation and the + * metadata of the calling application according to the Desktop Agent. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface FindIntentRequest { +export interface GetInfoRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2342,22 +2298,18 @@ export interface FindIntentRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: FindIntentRequestPayload; + payload: GetInfoRequestPayload; /** * 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: 'findIntentRequest'; + type: 'getInfoRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface FindIntentRequestPayload { - context?: Context; - intent: string; - resultType?: string; -} +export interface GetInfoRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2365,12 +2317,12 @@ export interface FindIntentRequestPayload { */ /** - * A response to a findIntent request. + * A response to a getInfo request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface FindIntentResponse { +export interface GetInfoResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2380,12 +2332,12 @@ export interface FindIntentResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: FindIntentResponsePayload; + payload: GetInfoResponsePayload; /** * 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: 'findIntentResponse'; + type: 'getInfoResponse'; } /** @@ -2393,9 +2345,67 @@ export interface FindIntentResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface FindIntentResponsePayload { - error?: FindInstancesErrors; - appIntent?: AppIntent; +export interface GetInfoResponsePayload { + error?: ResponsePayloadError; + implementationMetadata?: ImplementationMetadata; +} + +/** + * Implementation metadata for the Desktop Agent, which includes an appMetadata element + * containing a copy of the app's own metadata. + * + * Includes Metadata for the current application. + * + * Metadata relating to the FDC3 Desktop Agent implementation and its provider. + */ +export interface ImplementationMetadata { + /** + * The calling application instance's own metadata, according to the Desktop Agent (MUST + * include at least the `appId` and `instanceId`). + */ + appMetadata: AppMetadata; + /** + * 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: OptionalFeatures; + /** + * 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 OptionalFeatures { + /** + * 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; } /** @@ -2404,12 +2414,12 @@ export interface FindIntentResponsePayload { */ /** - * A request for details of intents and apps available to resolve them for a particular - * context. + * Request to return a Channel with an auto-generated identity that is intended for private + * communication between applications. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface FindIntentsByContextRequest { +export interface GetOrCreateChannelRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2417,20 +2427,22 @@ export interface FindIntentsByContextRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: FindIntentsByContextRequestPayload; + payload: GetOrCreateChannelRequestPayload; /** * 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: 'findIntentsByContextRequest'; + type: 'getOrCreateChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface FindIntentsByContextRequestPayload { - context: Context; - resultType?: string; +export interface GetOrCreateChannelRequestPayload { + /** + * The id of the channel to return + */ + channelId: string; } /** @@ -2439,12 +2451,12 @@ export interface FindIntentsByContextRequestPayload { */ /** - * A response to a findIntentsByContext request. + * A response to a getOrCreateChannel request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface FindIntentsByContextResponse { +export interface GetOrCreateChannelResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2454,12 +2466,12 @@ export interface FindIntentsByContextResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: FindIntentsByContextResponsePayload; + payload: GetOrCreateChannelResponsePayload; /** * 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: 'findIntentsByContextResponse'; + type: 'getOrCreateChannelResponse'; } /** @@ -2467,9 +2479,9 @@ export interface FindIntentsByContextResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface FindIntentsByContextResponsePayload { - error?: FindInstancesErrors; - appIntents?: AppIntent[]; +export interface GetOrCreateChannelResponsePayload { + error?: PurpleError; + channel?: Channel; } /** @@ -2478,11 +2490,11 @@ export interface FindIntentsByContextResponsePayload { */ /** - * A request for metadata about an app. + * Request to retrieve a list of the User Channels available for the app to join. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetAppMetadataRequest { +export interface GetUserChannelsRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2490,20 +2502,18 @@ export interface GetAppMetadataRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetAppMetadataRequestPayload; + payload: GetUserChannelsRequestPayload; /** * 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: 'getAppMetadataRequest'; + type: 'getUserChannelsRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetAppMetadataRequestPayload { - app: AppIdentifier; -} +export interface GetUserChannelsRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2511,12 +2521,12 @@ export interface GetAppMetadataRequestPayload { */ /** - * A response to a getAppMetadata request. + * A response to a getUserChannels request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface GetAppMetadataResponse { +export interface GetUserChannelsResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2526,12 +2536,12 @@ export interface GetAppMetadataResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: GetAppMetadataResponsePayload; + payload: GetUserChannelsResponsePayload; /** * 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: 'getAppMetadataResponse'; + type: 'getUserChannelsResponse'; } /** @@ -2539,9 +2549,9 @@ export interface GetAppMetadataResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface GetAppMetadataResponsePayload { - error?: FindInstancesErrors; - appMetadata?: AppMetadata; +export interface GetUserChannelsResponsePayload { + error?: PurpleError; + userChannels?: Channel[]; } /** @@ -2550,12 +2560,12 @@ export interface GetAppMetadataResponsePayload { */ /** - * A request to return the Channel object for the current User channel membership. Returns - * `null` if the app is not joined to a channel. + * A request that serves as an acknowledgement of a heartbeat event from the Desktop Agent + * and indicates that an application window or frame is still alive. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetCurrentChannelRequest { +export interface HeartbeatAcknowledgementRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2563,18 +2573,23 @@ export interface GetCurrentChannelRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetCurrentChannelRequestPayload; + payload: HeartbeatAcknowledgementRequestPayload; /** * 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: 'getCurrentChannelRequest'; + type: 'heartbeatAcknowledgementRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetCurrentChannelRequestPayload {} +export interface HeartbeatAcknowledgementRequestPayload { + /** + * The eventUuid value of the HeartbeatEvent that the acknowledgement being sent relates to. + */ + heartbeatEventUuid: string; +} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2582,37 +2597,81 @@ export interface GetCurrentChannelRequestPayload {} */ /** - * A response to a getCurrentChannel request. + * A heartbeat message from the Desktop Agent to an app indicating that the Desktop Agent is + * alive and that the application should send a heartbeatResponseRequest to the agent in + * response. * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ -export interface GetCurrentChannelResponse { +export interface HeartbeatEvent { /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ - meta: AddContextListenerResponseMeta; + meta: BroadcastEventMeta; /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload contains details of the event that the app is being notified about. */ - payload: GetCurrentChannelResponsePayload; + payload: HeartbeatEventPayload; /** * 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: 'getCurrentChannelResponse'; + type: 'heartbeatEvent'; } /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload contains details of the event that the app is being notified about. */ -export interface GetCurrentChannelResponsePayload { - error?: ResponsePayloadError; - channel?: Channel | null; +export interface HeartbeatEventPayload {} + +/** + * 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. + */ + +/** + * An event message from the Desktop Agent to an app indicating that it has been selected to + * resolve a raised intent and context. + * + * A message from a Desktop Agent to an FDC3-enabled app representing an event. + */ +export interface IntentEvent { + /** + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + */ + meta: BroadcastEventMeta; + /** + * The message payload contains details of the event that the app is being notified about. + */ + payload: IntentEventPayload; + /** + * 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: 'intentEvent'; +} + +/** + * The message payload contains details of the event that the app is being notified about. + */ +export interface IntentEventPayload { + /** + * The context object passed with the raised intent. + */ + context: Context; + /** + * The intent that was raised. + */ + intent: string; + /** + * Details of the application instance that raised the intent. + */ + originatingApp?: AppIdentifier; + /** + * The requestUuid value of the raiseIntentRequest that the intentEvent being sent relates + * to. + */ + raiseIntentRequestUuid: string; } /** @@ -2621,13 +2680,11 @@ export interface GetCurrentChannelResponsePayload { */ /** - * A request to return the current context (either of a specified type or most recent - * broadcast) of a specified Channel. Returns `null` if no context (of the requested type if - * one was specified) is available in the channel. + * A request to unsubscribe a context listener. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetCurrentContextRequest { +export interface IntentListenerUnsubscribeRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2635,27 +2692,19 @@ export interface GetCurrentContextRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetCurrentContextRequestPayload; + payload: IntentListenerUnsubscribeRequestPayload; /** * 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: 'getCurrentContextRequest'; + type: 'intentListenerUnsubscribeRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetCurrentContextRequestPayload { - /** - * The id of the channel to return the current context of. - */ - channelId: string; - /** - * The type of context to return for OR `null` indicating that the most recently broadcast - * context on the channel should be returned. - */ - contextType: null | string; +export interface IntentListenerUnsubscribeRequestPayload { + listenerUUID: string; } /** @@ -2664,12 +2713,12 @@ export interface GetCurrentContextRequestPayload { */ /** - * A response to a getCurrentContext request. + * A response to a intentListenerUnsubscribe request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface GetCurrentContextResponse { +export interface IntentListenerUnsubscribeResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2679,26 +2728,12 @@ export interface GetCurrentContextResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: GetCurrentContextResponsePayload; + payload: BroadcastResponseResponsePayload; /** * 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: 'getCurrentContextResponse'; -} - -/** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ -export interface GetCurrentContextResponsePayload { - error?: PurpleError; - /** - * The most recently broadcast context object (of the specified type, if one was specified), - * or `null` if none was available in the channel. - */ - context?: null | Context; + type: 'intentListenerUnsubscribeResponse'; } /** @@ -2707,12 +2742,13 @@ export interface GetCurrentContextResponsePayload { */ /** - * Request to retrieve information about the FDC3 Desktop Agent implementation and the - * metadata of the calling application according to the Desktop Agent. + * A request to deliver a result for an intent (which may include a `void` result that just + * indicates that the handler has run, returning no result). The result is tied to the + * intentEvent it relates to by quoting the `eventUuid` of the intentEvent in its payload. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetInfoRequest { +export interface IntentResultRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2720,18 +2756,33 @@ export interface GetInfoRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetInfoRequestPayload; + payload: IntentResultRequestPayload; /** * 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: 'getInfoRequest'; + type: 'intentResultRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetInfoRequestPayload {} +export interface IntentResultRequestPayload { + /** + * The eventUuid value of the intentEvent that the result being sent relates to. + */ + intentEventUuid: string; + intentResult: IntentResult; + /** + * The requestUuid value of the raiseIntentRequest that the result being sent relates to. + */ + raiseIntentRequestUuid: string; +} + +export interface IntentResult { + context?: Context; + channel?: Channel; +} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2739,12 +2790,12 @@ export interface GetInfoRequestPayload {} */ /** - * A response to a getInfo request. + * A response to a request to deliver an intent result. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface GetInfoResponse { +export interface IntentResultResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2754,22 +2805,12 @@ export interface GetInfoResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: GetInfoResponsePayload; + payload: BroadcastResponseResponsePayload; /** * 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: 'getInfoResponse'; -} - -/** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ -export interface GetInfoResponsePayload { - error?: ResponsePayloadError; - implementationMetadata?: ImplementationMetadata; + type: 'intentResultResponse'; } /** @@ -2778,12 +2819,13 @@ export interface GetInfoResponsePayload { */ /** - * Request to return a Channel with an auto-generated identity that is intended for private - * communication between applications. + * Request to join the app to the specified User channel. On successfully joining a channel, + * client code should make subsequent requests to get the current context of that channel + * for all registered context listeners and then call their handlers with it. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetOrCreateChannelRequest { +export interface JoinUserChannelRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2791,20 +2833,20 @@ export interface GetOrCreateChannelRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetOrCreateChannelRequestPayload; + payload: JoinUserChannelRequestPayload; /** * 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: 'getOrCreateChannelRequest'; + type: 'joinUserChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetOrCreateChannelRequestPayload { +export interface JoinUserChannelRequestPayload { /** - * The id of the channel to return + * The id of the channel to join. */ channelId: string; } @@ -2815,12 +2857,14 @@ export interface GetOrCreateChannelRequestPayload { */ /** - * A response to a getOrCreateChannel request. + * A response to a joinUserChannel request. On receipt of this response, client code should + * make subsequent requests to get the current context of that channel for all registered + * context listeners and then call their handlers with it. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface GetOrCreateChannelResponse { +export interface JoinUserChannelResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2830,12 +2874,12 @@ export interface GetOrCreateChannelResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: GetOrCreateChannelResponsePayload; + payload: JoinUserChannelResponsePayload; /** * 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: 'getOrCreateChannelResponse'; + type: 'joinUserChannelResponse'; } /** @@ -2843,9 +2887,8 @@ export interface GetOrCreateChannelResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface GetOrCreateChannelResponsePayload { +export interface JoinUserChannelResponsePayload { error?: PurpleError; - channel?: Channel; } /** @@ -2854,11 +2897,11 @@ export interface GetOrCreateChannelResponsePayload { */ /** - * Request to retrieve a list of the User Channels available for the app to join. + * Request to remove the app from any User channel membership. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface GetUserChannelsRequest { +export interface LeaveCurrentChannelRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2866,18 +2909,18 @@ export interface GetUserChannelsRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: GetUserChannelsRequestPayload; + payload: LeaveCurrentChannelRequestPayload; /** * 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: 'getUserChannelsRequest'; + type: 'leaveCurrentChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetUserChannelsRequestPayload {} +export interface LeaveCurrentChannelRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2885,12 +2928,12 @@ export interface GetUserChannelsRequestPayload {} */ /** - * A response to a getUserChannels request. + * A response to a leaveCurrentChannel request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface GetUserChannelsResponse { +export interface LeaveCurrentChannelResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2900,12 +2943,12 @@ export interface GetUserChannelsResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: GetUserChannelsResponsePayload; + payload: LeaveCurrentChannelResponsePayload; /** * 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: 'getUserChannelsResponse'; + type: 'leaveCurrentChannelResponse'; } /** @@ -2913,9 +2956,8 @@ export interface GetUserChannelsResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface GetUserChannelsResponsePayload { +export interface LeaveCurrentChannelResponsePayload { error?: PurpleError; - userChannels?: Channel[]; } /** @@ -2924,12 +2966,11 @@ export interface GetUserChannelsResponsePayload { */ /** - * A request that serves as an acknowledgement of a heartbeat event from the Desktop Agent - * and indicates that an application window or frame is still alive. + * A request to open an application. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface HeartbeatAcknowledgementRequest { +export interface OpenRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2937,22 +2978,25 @@ export interface HeartbeatAcknowledgementRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: HeartbeatAcknowledgementRequestPayload; + payload: OpenRequestPayload; /** * 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: 'heartbeatAcknowledgementRequest'; + type: 'openRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface HeartbeatAcknowledgementRequestPayload { +export interface OpenRequestPayload { + app: AppIdentifier; /** - * The eventUuid value of the HeartbeatEvent that the acknowledgement being sent relates to. + * If a Context object is passed in, this object will be provided to the opened application + * via a contextListener. The Context argument is functionally equivalent to opening the + * target app with no context and broadcasting the context directly to it. */ - heartbeatEventUuid: string; + context?: Context; } /** @@ -2961,82 +3005,60 @@ export interface HeartbeatAcknowledgementRequestPayload { */ /** - * A heartbeat message from the Desktop Agent to an app indicating that the Desktop Agent is - * alive and that the application should send a heartbeatResponseRequest to the agent in - * response. + * A response to a open request. * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. */ -export interface HeartbeatEvent { +export interface OpenResponse { /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - meta: BroadcastEventMeta; + meta: AddContextListenerResponseMeta; /** - * The message payload contains details of the event that the app is being notified about. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - payload: HeartbeatEventPayload; + payload: OpenResponsePayload; /** * 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: 'heartbeatEvent'; + type: 'openResponse'; } /** - * The message payload contains details of the event that the app is being notified about. - */ -export interface HeartbeatEventPayload {} - -/** - * 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. - */ - -/** - * An event message from the Desktop Agent to an app indicating that it has been selected to - * resolve a raised intent and context. - * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ -export interface IntentEvent { - /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. - */ - meta: BroadcastEventMeta; - /** - * The message payload contains details of the event that the app is being notified about. - */ - payload: IntentEventPayload; - /** - * 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: 'intentEvent'; +export interface OpenResponsePayload { + error?: OpenErrorResponsePayload; + appIdentifier?: AppIdentifier; } /** - * The message payload contains details of the event that the app is being notified about. + * 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 + * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or + * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */ -export interface IntentEventPayload { - /** - * The context object passed with the raised intent. - */ - context: Context; - /** - * The intent that was raised. - */ - intent: string; - /** - * Details of the application instance that raised the intent. - */ - originatingApp?: AppIdentifier; - /** - * The requestUuid value of the raiseIntentRequest that the intentEvent being sent relates - * to. - */ - raiseIntentRequestUuid: string; -} +export type OpenErrorResponsePayload = + | 'MalformedContext' + | 'ApiTimeout' + | 'InvalidArguments' + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'ResolverUnavailable' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3044,11 +3066,11 @@ export interface IntentEventPayload { */ /** - * A request to unsubscribe a context listener. + * A request to add an event listener to a specific PrivateChannel. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface IntentListenerUnsubscribeRequest { +export interface PrivateChannelAddEventListenerRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3056,33 +3078,46 @@ export interface IntentListenerUnsubscribeRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: IntentListenerUnsubscribeRequestPayload; + payload: PrivateChannelAddEventListenerRequestPayload; /** * 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: 'intentListenerUnsubscribeRequest'; + type: 'privateChannelAddEventListenerRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface IntentListenerUnsubscribeRequestPayload { - listenerUUID: string; +export interface PrivateChannelAddEventListenerRequestPayload { + /** + * The type of PrivateChannel event that the listener should be applied to, or null for all + * event types. + */ + listenerType: PrivateChannelEventType | null; + /** + * The Id of the PrivateChannel that the listener should be added to. + */ + privateChannelId: string; } +/** + * Type defining valid type strings for Private Channel events. + */ +export type PrivateChannelEventType = 'addContextListener' | 'unsubscribe' | 'disconnect'; + /** * 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. */ /** - * A response to a intentListenerUnsubscribe request. + * A response to a privateChannelAddEventListener request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface IntentListenerUnsubscribeResponse { +export interface PrivateChannelAddEventListenerResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3092,12 +3127,22 @@ export interface IntentListenerUnsubscribeResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: BroadcastResponseResponsePayload; + payload: PrivateChannelAddEventListenerResponsePayload; /** * 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: 'intentListenerUnsubscribeResponse'; + type: 'privateChannelAddEventListenerResponse'; +} + +/** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ +export interface PrivateChannelAddEventListenerResponsePayload { + error?: PurpleError; + listenerUUID?: string; } /** @@ -3106,13 +3151,12 @@ export interface IntentListenerUnsubscribeResponse { */ /** - * A request to deliver a result for an intent (which may include a `void` result that just - * indicates that the handler has run, returning no result). The result is tied to the - * intentEvent it relates to by quoting the `eventUuid` of the intentEvent in its payload. + * Request that indicates that a participant will no longer interact with a specified + * `PrivateChannel`. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface IntentResultRequest { +export interface PrivateChannelDisconnectRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3120,32 +3164,22 @@ export interface IntentResultRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: IntentResultRequestPayload; + payload: PrivateChannelDisconnectRequestPayload; /** * 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: 'intentResultRequest'; + type: 'privateChannelDisconnectRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface IntentResultRequestPayload { - /** - * The eventUuid value of the intentEvent that the result being sent relates to. - */ - intentEventUuid: string; - intentResult: IntentResult; +export interface PrivateChannelDisconnectRequestPayload { /** - * The requestUuid value of the raiseIntentRequest that the result being sent relates to. + * The Id of the Channel that should be disconnected from */ - raiseIntentRequestUuid: string; -} - -export interface IntentResult { - context?: Context; - channel?: Channel; + channelId: string; } /** @@ -3154,12 +3188,12 @@ export interface IntentResult { */ /** - * A response to a request to deliver an intent result. + * A response to a privateChannelDisconnect request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface IntentResultResponse { +export interface PrivateChannelDisconnectResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3169,12 +3203,63 @@ export interface IntentResultResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: BroadcastResponseResponsePayload; + payload: PrivateChannelDisconnectResponsePayload; + /** + * 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: 'privateChannelDisconnectResponse'; +} + +/** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ +export interface PrivateChannelDisconnectResponsePayload { + error?: PurpleError; +} + +/** + * 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. + */ + +/** + * An event message from the Desktop Agent to an app indicating that another app has added a + * context listener to a specific PrivateChannel. + * + * A message from a Desktop Agent to an FDC3-enabled app representing an event. + */ +export interface PrivateChannelOnAddContextListenerEvent { + /** + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + */ + meta: BroadcastEventMeta; + /** + * The message payload contains details of the event that the app is being notified about. + */ + payload: PrivateChannelOnAddContextListenerEventPayload; /** * 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: 'intentResultResponse'; + type: 'privateChannelOnAddContextListenerEvent'; +} + +/** + * The message payload contains details of the event that the app is being notified about. + */ +export interface PrivateChannelOnAddContextListenerEventPayload { + /** + * The type of the context listener added to the channel by another app, or null if it will + * listen to all types. + */ + contextType: null | string; + /** + * The Id of the PrivateChannel that the listener was added to. + */ + privateChannelId: string; } /** @@ -3183,76 +3268,77 @@ export interface IntentResultResponse { */ /** - * Request to join the app to the specified User channel. On successfully joining a channel, - * client code should make subsequent requests to get the current context of that channel - * for all registered context listeners and then call their handlers with it. + * An event message from the Desktop Agent to an app indicating that another app has + * disconnected from a specific PrivateChannel and will no longer interact with it. * - * A request message from an FDC3-enabled app to a Desktop Agent. + * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ -export interface JoinUserChannelRequest { +export interface PrivateChannelOnDisconnectEvent { /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ - meta: AddContextListenerRequestMeta; + meta: BroadcastEventMeta; /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload contains details of the event that the app is being notified about. */ - payload: JoinUserChannelRequestPayload; + payload: PrivateChannelOnDisconnectEventPayload; /** * 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. + * the message relates to, e.g. 'findIntent', with 'Response' appended. */ - type: 'joinUserChannelRequest'; + type: 'privateChannelOnDisconnectEvent'; } /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload contains details of the event that the app is being notified about. */ -export interface JoinUserChannelRequestPayload { +export interface PrivateChannelOnDisconnectEventPayload { /** - * The id of the channel to join. + * The Id of the PrivateChannel that the app has disconnected from. */ - channelId: string; + privateChannelId: string; } /** * 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. + * the message relates to, e.g. 'findIntent', with 'Response' appended. */ /** - * A response to a joinUserChannel request. On receipt of this response, client code should - * make subsequent requests to get the current context of that channel for all registered - * context listeners and then call their handlers with it. + * An event message from the Desktop Agent to an app indicating that another app has + * unsubscribed a context listener from a specific PrivateChannel. * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ -export interface JoinUserChannelResponse { +export interface PrivateChannelOnUnsubscribeEvent { /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ - meta: AddContextListenerResponseMeta; + meta: BroadcastEventMeta; /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload contains details of the event that the app is being notified about. */ - payload: JoinUserChannelResponsePayload; + payload: PrivateChannelOnUnsubscribeEventPayload; /** * 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: 'joinUserChannelResponse'; + type: 'privateChannelOnUnsubscribeEvent'; } /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload contains details of the event that the app is being notified about. */ -export interface JoinUserChannelResponsePayload { - error?: PurpleError; +export interface PrivateChannelOnUnsubscribeEventPayload { + /** + * The type of the context listener unsubscribed from the channel by another app, or null if + * it was listening to all types. + */ + contextType: null | string; + /** + * The Id of the PrivateChannel that the listener was unsubscribed from. + */ + privateChannelId: string; } /** @@ -3261,11 +3347,11 @@ export interface JoinUserChannelResponsePayload { */ /** - * Request to remove the app from any User channel membership. + * A request to unsubscribe a context listener. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface LeaveCurrentChannelRequest { +export interface PrivateChannelUnsubscribeEventListenerRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3273,18 +3359,20 @@ export interface LeaveCurrentChannelRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: LeaveCurrentChannelRequestPayload; + payload: PrivateChannelUnsubscribeEventListenerRequestPayload; /** * 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: 'leaveCurrentChannelRequest'; + type: 'privateChannelUnsubscribeEventListenerRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface LeaveCurrentChannelRequestPayload {} +export interface PrivateChannelUnsubscribeEventListenerRequestPayload { + listenerUUID: string; +} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3292,12 +3380,12 @@ export interface LeaveCurrentChannelRequestPayload {} */ /** - * A response to a leaveCurrentChannel request. + * A response to a privateChannelUnsubscribeEventListener request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface LeaveCurrentChannelResponse { +export interface PrivateChannelUnsubscribeEventListenerResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3307,21 +3395,12 @@ export interface LeaveCurrentChannelResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: LeaveCurrentChannelResponsePayload; + payload: BroadcastResponseResponsePayload; /** * 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: 'leaveCurrentChannelResponse'; -} - -/** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ -export interface LeaveCurrentChannelResponsePayload { - error?: PurpleError; + type: 'privateChannelUnsubscribeEventListenerResponse'; } /** @@ -3330,11 +3409,11 @@ export interface LeaveCurrentChannelResponsePayload { */ /** - * A request to open an application. + * A request to raise an unspecified intent for a specified context. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface OpenRequest { +export interface RaiseIntentForContextRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3342,25 +3421,20 @@ export interface OpenRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: OpenRequestPayload; + payload: RaiseIntentForContextRequestPayload; /** * 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: 'openRequest'; + type: 'raiseIntentForContextRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface OpenRequestPayload { - app: AppIdentifier; - /** - * If a Context object is passed in, this object will be provided to the opened application - * via a contextListener. The Context argument is functionally equivalent to opening the - * target app with no context and broadcasting the context directly to it. - */ - context?: Context; +export interface RaiseIntentForContextRequestPayload { + app?: AppIdentifier; + context: Context; } /** @@ -3369,12 +3443,12 @@ export interface OpenRequestPayload { */ /** - * A response to a open request. + * A response to a raiseIntentForContext request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface OpenResponse { +export interface RaiseIntentForContextResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3383,130 +3457,89 @@ export interface OpenResponse { * A payload for a response to an API call that will contain any return values or an `error` * property containing a standardized error message indicating that the request was * unsuccessful. + * + * There are 3 possible responses to a raiseIntentForContext request, each of which sets a + * single property in the payload: Success (`intentResolution`), Needs further resolution + * (`appIntents`) or Error (`error`). */ - payload: OpenResponsePayload; + payload: RaiseIntentForContextResponsePayload; /** * 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: 'openResponse'; + type: 'raiseIntentForContextResponse'; } /** * A payload for a response to an API call that will contain any return values or an `error` * property containing a standardized error message indicating that the request was * unsuccessful. - */ -export interface OpenResponsePayload { - error?: OpenErrorResponsePayload; - appIdentifier?: AppIdentifier; -} - -/** - * 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 - * `addIntentListener`, `findIntent`, `findIntentsByContext`, `raiseIntent` or - * `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). - */ -export type OpenErrorResponsePayload = - | 'MalformedContext' - | 'ApiTimeout' - | 'InvalidArguments' - | 'AppNotFound' - | 'AppTimeout' - | 'DesktopAgentNotFound' - | 'ErrorOnLaunch' - | 'ResolverUnavailable' - | '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. - */ - -/** - * A request to add an event listener to a specific PrivateChannel. + * There are 3 possible responses to a raiseIntentForContext request, each of which sets a + * single property in the payload: Success (`intentResolution`), Needs further resolution + * (`appIntents`) or Error (`error`). * - * A request message from an FDC3-enabled app to a Desktop Agent. + * Response to a raiseIntentForContext request that needs additional resolution (i.e. show + * an intent resolver UI). + * + * Used if a raiseIntent request resulted in an error. */ -export interface PrivateChannelAddEventListenerRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelAddEventListenerRequestPayload; +export interface RaiseIntentForContextResponsePayload { /** - * 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. + * Should be set if the raiseIntent request returned an error. */ - type: 'privateChannelAddEventListenerRequest'; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface PrivateChannelAddEventListenerRequestPayload { + error?: FindInstancesErrors; /** - * The type of PrivateChannel event that the listener should be applied to, or null for all - * event types. + * Used if the raiseIntent request was successfully resolved. */ - listenerType: PrivateChannelEventType | null; + intentResolution?: IntentResolution; /** - * The Id of the PrivateChannel that the listener should be added to. + * Used if a raiseIntentForContext request requires additional resolution (e.g. by showing + * an intent resolver) before it can be handled. */ - privateChannelId: string; + appIntents?: AppIntent[]; } /** - * Type defining valid type strings for Private Channel events. - */ -export type PrivateChannelEventType = 'addContextListener' | 'unsubscribe' | 'disconnect'; - -/** - * 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. - */ - -/** - * A response to a privateChannelAddEventListener request. + * Used if the raiseIntent request was successfully resolved. * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * IntentResolution provides a standard format for data returned upon resolving an intent. + * + * ```javascript + * //resolve a "Chain" type intent + * let resolution = await agent.raiseIntent("intentName", context); + * + * //resolve a "Client-Service" type intent with a data response or a Channel + * let resolution = await agent.raiseIntent("intentName", context); + * try { + * const result = await resolution.getResult(); + * if (result && result.broadcast) { + * console.log(`${resolution.source} returned a channel with id ${result.id}`); + * } else if (result){ + * console.log(`${resolution.source} returned data: ${JSON.stringify(result)}`); + * } else { + * console.error(`${resolution.source} didn't return data` + * } + * } catch(error) { + * console.error(`${resolution.source} returned an error: ${error}`); + * } + * + * // Use metadata about the resolving app instance to target a further intent + * await agent.raiseIntent("intentName", context, resolution.source); + * ``` */ -export interface PrivateChannelAddEventListenerResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; +export interface IntentResolution { /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The intent that was raised. May be used to determine which intent the user + * chose in response to `fdc3.raiseIntentForContext()`. */ - payload: PrivateChannelAddEventListenerResponsePayload; + intent: string; /** - * 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. + * Identifier for the app instance that was selected (or started) to resolve the intent. + * `source.instanceId` MUST be set, indicating the specific app instance that + * received the intent. */ - type: 'privateChannelAddEventListenerResponse'; -} - -/** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ -export interface PrivateChannelAddEventListenerResponsePayload { - error?: PurpleError; - listenerUUID?: string; + source: AppIdentifier; } /** @@ -3515,12 +3548,11 @@ export interface PrivateChannelAddEventListenerResponsePayload { */ /** - * Request that indicates that a participant will no longer interact with a specified - * `PrivateChannel`. + * A request to raise an intent for a context. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface PrivateChannelDisconnectRequest { +export interface RaiseIntentRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3528,22 +3560,21 @@ export interface PrivateChannelDisconnectRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: PrivateChannelDisconnectRequestPayload; + payload: RaiseIntentRequestPayload; /** * 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: 'privateChannelDisconnectRequest'; + type: 'raiseIntentRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface PrivateChannelDisconnectRequestPayload { - /** - * The Id of the Channel that should be disconnected from - */ - channelId: string; +export interface RaiseIntentRequestPayload { + app?: AppIdentifier; + context: Context; + intent: string; } /** @@ -3552,12 +3583,12 @@ export interface PrivateChannelDisconnectRequestPayload { */ /** - * A response to a privateChannelDisconnect request. + * A response to a raiseIntent request. * * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the * payload contains an `error` property, the request was unsuccessful. */ -export interface PrivateChannelDisconnectResponse { +export interface RaiseIntentResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3566,22 +3597,47 @@ export interface PrivateChannelDisconnectResponse { * A payload for a response to an API call that will contain any return values or an `error` * property containing a standardized error message indicating that the request was * unsuccessful. + * + * There are 3 possible responses to a raiseIntent request, each of which sets a single + * property in the payload: Success (`intentResolution`), Needs further resolution + * (`appIntent`) or Error (`error`). */ - payload: PrivateChannelDisconnectResponsePayload; + payload: RaiseIntentResponsePayload; /** * 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: 'privateChannelDisconnectResponse'; + type: 'raiseIntentResponse'; } /** * A payload for a response to an API call that will contain any return values or an `error` * property containing a standardized error message indicating that the request was * unsuccessful. + * + * There are 3 possible responses to a raiseIntent request, each of which sets a single + * property in the payload: Success (`intentResolution`), Needs further resolution + * (`appIntent`) or Error (`error`). + * + * Response to a raiseIntent request that needs additional resolution (i.e. show an intent + * resolver UI). + * + * Used if a raiseIntent request resulted in an error. */ -export interface PrivateChannelDisconnectResponsePayload { - error?: PurpleError; +export interface RaiseIntentResponsePayload { + /** + * Should be set if the raiseIntent request returned an error. + */ + error?: FindInstancesErrors; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution?: IntentResolution; + /** + * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent + * resolver) before it can be handled. + */ + appIntent?: AppIntent; } /** @@ -3590,40 +3646,39 @@ export interface PrivateChannelDisconnectResponsePayload { */ /** - * An event message from the Desktop Agent to an app indicating that another app has added a - * context listener to a specific PrivateChannel. + * A secondary response to a request to raise an intent used to deliver the intent result. + * This message should quote the original requestUuid of the raiseIntentRequest message in + * its `meta.requestUuid` field. * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the + * payload contains an `error` property, the request was unsuccessful. */ -export interface PrivateChannelOnAddContextListenerEvent { +export interface RaiseIntentResultResponse { /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - meta: BroadcastEventMeta; + meta: AddContextListenerResponseMeta; /** - * The message payload contains details of the event that the app is being notified about. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ - payload: PrivateChannelOnAddContextListenerEventPayload; + payload: RaiseIntentResultResponsePayload; /** * 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: 'privateChannelOnAddContextListenerEvent'; + type: 'raiseIntentResultResponse'; } /** - * The message payload contains details of the event that the app is being notified about. + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. */ -export interface PrivateChannelOnAddContextListenerEventPayload { - /** - * The type of the context listener added to the channel by another app, or null if it will - * listen to all types. - */ - contextType: null | string; - /** - * The Id of the PrivateChannel that the listener was added to. - */ - privateChannelId: string; +export interface RaiseIntentResultResponsePayload { + error?: ResponsePayloadError; + intentResult?: IntentResult; } /** @@ -3632,501 +3687,372 @@ export interface PrivateChannelOnAddContextListenerEventPayload { */ /** - * An event message from the Desktop Agent to an app indicating that another app has - * disconnected from a specific PrivateChannel and will no longer interact with it. + * Hello message sent by an application to a parent window or frame when attempting to + * establish connectivity to a Desktop Agent. * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface PrivateChannelOnDisconnectEvent { +export interface WebConnectionProtocol1Hello { /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + * Metadata for a Web Connection Protocol message. */ - meta: BroadcastEventMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * The message payload contains details of the event that the app is being notified about. + * The message payload, containing data pertaining to this connection step. */ - payload: PrivateChannelOnDisconnectEventPayload; + payload: WebConnectionProtocol1HelloPayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'privateChannelOnDisconnectEvent'; + type: 'WCP1Hello'; } /** - * The message payload contains details of the event that the app is being notified about. + * Metadata for a Web Connection Protocol message. */ -export interface PrivateChannelOnDisconnectEventPayload { - /** - * The Id of the PrivateChannel that the app has disconnected from. - */ - privateChannelId: string; +export interface WebConnectionProtocol1HelloMeta { + connectionAttemptUuid: string; + timestamp: Date; } /** - * 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. - */ - -/** - * An event message from the Desktop Agent to an app indicating that another app has - * unsubscribed a context listener from a specific PrivateChannel. - * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * The message payload, containing data pertaining to this connection step. */ -export interface PrivateChannelOnUnsubscribeEvent { +export interface WebConnectionProtocol1HelloPayload { /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + * The current URL of the page attempting to connect. This may differ from the identityUrl, + * but the origins MUST match. */ - meta: BroadcastEventMeta; + actualUrl: string; /** - * The message payload contains details of the event that the app is being notified about. + * A flag that may be used to indicate that a channel selector user interface is or is not + * required. Set to `false` if the app includes its own interface for selecting channels or + * does not work with user channels. */ - payload: PrivateChannelOnUnsubscribeEventPayload; + channelSelector?: boolean; /** - * 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. + * The version of FDC3 API that the app supports. */ - type: 'privateChannelOnUnsubscribeEvent'; -} - -/** - * The message payload contains details of the event that the app is being notified about. - */ -export interface PrivateChannelOnUnsubscribeEventPayload { + fdc3Version: string; /** - * The type of the context listener unsubscribed from the channel by another app, or null if - * it was listening to all types. + * URL to use for the identity of the application. Desktop Agents MUST validate that the + * origin of the message matches the URL, but MAY implement custom comparison logic. */ - contextType: null | string; + identityUrl: string; /** - * The Id of the PrivateChannel that the listener was unsubscribed from. + * A flag that may be used to indicate that an intent resolver is or is not required. Set to + * `false` if no intents, or only targeted intents, are raised. */ - privateChannelId: string; + intentResolver?: boolean; } /** - * 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. + * Identifies the type of the connection step message. */ /** - * A request to unsubscribe a context listener. + * Response from a Desktop Agent to an application requesting access to it indicating that + * it should load a specified URL into a hidden iframe in order to establish connectivity to + * a Desktop Agent. * - * A request message from an FDC3-enabled app to a Desktop Agent. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface PrivateChannelUnsubscribeEventListenerRequest { +export interface WebConnectionProtocol2LoadURL { /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerRequestMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload, containing data pertaining to this connection step. */ - payload: PrivateChannelUnsubscribeEventListenerRequestPayload; + payload: WebConnectionProtocol2LoadURLPayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'privateChannelUnsubscribeEventListenerRequest'; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface PrivateChannelUnsubscribeEventListenerRequestPayload { - listenerUUID: string; + type: 'WCP2LoadUrl'; } -/** - * 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. - */ - -/** - * A response to a privateChannelUnsubscribeEventListener request. - * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. - */ -export interface PrivateChannelUnsubscribeEventListenerResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: BroadcastResponseResponsePayload; +/** + * The message payload, containing data pertaining to this connection step. + */ +export interface WebConnectionProtocol2LoadURLPayload { /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. + * A URL which can be used to establish communication with the Desktop Agent, via loading + * the URL into an iframe and restarting the Web Connection protocol with the iframe as the + * target. */ - type: 'privateChannelUnsubscribeEventListenerResponse'; + iframeUrl: string; } /** - * 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. + * Identifies the type of the connection step message. */ /** - * A request to raise an unspecified intent for a specified context. + * Handshake message sent by the Desktop Agent to the app (with a MessagePort appended) that + * should be used for subsequent communication steps. * - * A request message from an FDC3-enabled app to a Desktop Agent. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface RaiseIntentForContextRequest { +export interface WebConnectionProtocol3Handshake { /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerRequestMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload, containing data pertaining to this connection step. */ - payload: RaiseIntentForContextRequestPayload; + payload: WebConnectionProtocol3HandshakePayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'raiseIntentForContextRequest'; + type: 'WCP3Handshake'; } /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload, containing data pertaining to this connection step. */ -export interface RaiseIntentForContextRequestPayload { - app?: AppIdentifier; - context: Context; +export interface WebConnectionProtocol3HandshakePayload { + /** + * Indicates a custom timeout (in milliseconds) that should be used for API message + * exchanges that may involve launching an application, instead of the default 100,000 + * millisecond timeout. + */ + appLaunchTimeout?: number; + /** + * Indicates whether a channel selector user interface is required and the URL to use to do + * so. Set to `true` to use the default or `false` to disable the channel selector (as the + * Desktop Agent will handle it another way). + */ + channelSelectorUrl: boolean | string; + /** + * The version of FDC3 API that the Desktop Agent will provide support for. + */ + fdc3Version: string; + /** + * Indicates whether an intent resolver user interface is required and the URL to use to do + * so. Set to `true` to use the default or `false` to disable the intent resolver (as the + * Desktop Agent will handle it another way). + */ + intentResolverUrl: boolean | string; + /** + * Indicates a custom timeout (in milliseconds) that should be used for the majority of API + * message exchanges instead of the default 10,000 millisecond timeout. + */ + messageExchangeTimeout?: number; } /** - * 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. + * Identifies the type of the connection step message. */ /** - * A response to a raiseIntentForContext request. + * Identity Validation request from an app attempting to connect to a Desktop Agent. * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface RaiseIntentForContextResponse { +export interface WebConnectionProtocol4ValidateAppIdentity { /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerResponseMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - * - * There are 3 possible responses to a raiseIntentForContext request, each of which sets a - * single property in the payload: Success (`intentResolution`), Needs further resolution - * (`appIntents`) or Error (`error`). + * The message payload, containing data pertaining to this connection step. */ - payload: RaiseIntentForContextResponsePayload; + payload: WebConnectionProtocol4ValidateAppIdentityPayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'raiseIntentForContextResponse'; + type: 'WCP4ValidateAppIdentity'; } /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - * - * There are 3 possible responses to a raiseIntentForContext request, each of which sets a - * single property in the payload: Success (`intentResolution`), Needs further resolution - * (`appIntents`) or Error (`error`). - * - * Response to a raiseIntentForContext request that needs additional resolution (i.e. show - * an intent resolver UI). - * - * Used if a raiseIntent request resulted in an error. + * The message payload, containing data pertaining to this connection step. */ -export interface RaiseIntentForContextResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error?: FindInstancesErrors; +export interface WebConnectionProtocol4ValidateAppIdentityPayload { /** - * Used if the raiseIntent request was successfully resolved. + * The current URL of the page attempting to connect. This may differ from the identityUrl, + * but the origins MUST match. */ - intentResolution?: IntentResolution; + actualUrl: string; /** - * Used if a raiseIntentForContext request requires additional resolution (e.g. by showing - * an intent resolver) before it can be handled. + * URL to use for the identity of the application. Desktop Agents MUST validate that the + * origin of the message matches the URL, but MAY implement custom comparison logic. */ - appIntents?: AppIntent[]; -} - -/** - * Used if the raiseIntent request was successfully resolved. - * - * IntentResolution provides a standard format for data returned upon resolving an intent. - * - * ```javascript - * //resolve a "Chain" type intent - * let resolution = await agent.raiseIntent("intentName", context); - * - * //resolve a "Client-Service" type intent with a data response or a Channel - * let resolution = await agent.raiseIntent("intentName", context); - * try { - * const result = await resolution.getResult(); - * if (result && result.broadcast) { - * console.log(`${resolution.source} returned a channel with id ${result.id}`); - * } else if (result){ - * console.log(`${resolution.source} returned data: ${JSON.stringify(result)}`); - * } else { - * console.error(`${resolution.source} didn't return data` - * } - * } catch(error) { - * console.error(`${resolution.source} returned an error: ${error}`); - * } - * - * // Use metadata about the resolving app instance to target a further intent - * await agent.raiseIntent("intentName", context, resolution.source); - * ``` - */ -export interface IntentResolution { + identityUrl: string; /** - * The intent that was raised. May be used to determine which intent the user - * chose in response to `fdc3.raiseIntentForContext()`. + * If an application has previously connected to the Desktop Agent, it may specify its prior + * instance id and associated instance UUID to request the same same instance Id be assigned. */ - intent: string; + instanceId?: string; /** - * Identifier for the app instance that was selected (or started) to resolve the intent. - * `source.instanceId` MUST be set, indicating the specific app instance that - * received the intent. + * Instance UUID associated with the requested instanceId. */ - source: AppIdentifier; + instanceUuid?: string; } /** - * 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. + * Identifies the type of the connection step message. */ /** - * A request to raise an intent for a context. + * Message sent by the Desktop Agent to an app if their identity validation fails. * - * A request message from an FDC3-enabled app to a Desktop Agent. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface RaiseIntentRequest { +export interface WebConnectionProtocol5ValidateAppIdentityFailedResponse { /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerRequestMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload, containing data pertaining to this connection step. */ - payload: RaiseIntentRequestPayload; + payload: WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'raiseIntentRequest'; + type: 'WCP5ValidateAppIdentityFailedResponse'; } /** - * The message payload typically contains the arguments to FDC3 API functions. + * The message payload, containing data pertaining to this connection step. */ -export interface RaiseIntentRequestPayload { - app?: AppIdentifier; - context: Context; - intent: string; +export interface WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload { + message?: string; } /** - * 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. + * Identifies the type of the connection step message. */ /** - * A response to a raiseIntent request. + * Message sent by the Desktop Agent to an app after successful identity validation. * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface RaiseIntentResponse { +export interface WebConnectionProtocol5ValidateAppIdentitySuccessResponse { /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerResponseMeta; + meta: WebConnectionProtocol1HelloMeta; /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - * - * There are 3 possible responses to a raiseIntent request, each of which sets a single - * property in the payload: Success (`intentResolution`), Needs further resolution - * (`appIntent`) or Error (`error`). + * The message payload, containing data pertaining to this connection step. */ - payload: RaiseIntentResponsePayload; + payload: WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload; /** - * 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. + * Identifies the type of the connection step message. */ - type: 'raiseIntentResponse'; + type: 'WCP5ValidateAppIdentityResponse'; +} + +/** + * The message payload, containing data pertaining to this connection step. + */ +export interface WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload { + /** + * The appId that the app's identity was validated against. + */ + appId: string; + /** + * Implementation metadata for the Desktop Agent, which includes an appMetadata element + * containing a copy of the app's own metadata. + */ + implementationMetadata: ImplementationMetadata; + /** + * The instance Id granted to the application by the Desktop Agent. + */ + instanceId: string; + /** + * Instance UUID associated with the instanceId granted, which may be used to retrieve the + * same instanceId if the app is reloaded or navigates. + */ + instanceUuid: string; } /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - * - * There are 3 possible responses to a raiseIntent request, each of which sets a single - * property in the payload: Success (`intentResolution`), Needs further resolution - * (`appIntent`) or Error (`error`). - * - * Response to a raiseIntent request that needs additional resolution (i.e. show an intent - * resolver UI). + * Identifies the type of the connection step message. + */ + +/** + * Goodbye message to be sent to the Desktop Agent when disconnecting (e.g. when closing the + * window or navigating). Desktop Agents should close the MessagePort after receiving this + * message, but retain instance details in case the application reconnects (e.g. after a + * navigation event). * - * Used if a raiseIntent request resulted in an error. + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. */ -export interface RaiseIntentResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error?: FindInstancesErrors; +export interface WebConnectionProtocol6Goodbye { /** - * Used if the raiseIntent request was successfully resolved. + * Metadata for a Web Connection Protocol message. */ - intentResolution?: IntentResolution; + meta: WebConnectionProtocol6GoodbyeMeta; /** - * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent - * resolver) before it can be handled. + * Identifies the type of the connection step message. */ - appIntent?: AppIntent; + type: 'WCP6Goodbye'; } /** - * 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. + * Metadata for a Web Connection Protocol message. */ +export interface WebConnectionProtocol6GoodbyeMeta { + timestamp: Date; +} /** - * A secondary response to a request to raise an intent used to deliver the intent result. - * This message should quote the original requestUuid of the raiseIntentRequest message in - * its `meta.requestUuid` field. - * - * A message from a Desktop Agent to an FDC3-enabled app responding to an API call. If the - * payload contains an `error` property, the request was unsuccessful. + * Identifies the type of the connection step message. */ -export interface RaiseIntentResultResponse { + +/** + * A message used during the connection flow for an application to a Desktop Agent in a + * browser window. Used for messages sent in either direction. + */ +export interface WebConnectionProtocolMessage { /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * Metadata for a Web Connection Protocol message. */ - meta: AddContextListenerResponseMeta; + meta: ConnectionStepMetadata; /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * The message payload, containing data pertaining to this connection step. */ - payload: RaiseIntentResultResponsePayload; + payload?: { [key: string]: any }; /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. + * Identifies the type of the connection step message. */ - type: 'raiseIntentResultResponse'; + type: ConnectionStepMessageType; } /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. + * Metadata for a Web Connection Protocol message. */ -export interface RaiseIntentResultResponsePayload { - error?: ResponsePayloadError; - intentResult?: IntentResult; +export interface ConnectionStepMetadata { + timestamp: Date; + connectionAttemptUuid?: string; } /** - * 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. + * Identifies the type of the connection step message. */ +export type ConnectionStepMessageType = + | 'WCP1Hello' + | 'WCP2LoadUrl' + | 'WCP3Handshake' + | 'WCP4ValidateAppIdentity' + | 'WCP5ValidateAppIdentityFailedResponse' + | 'WCP5ValidateAppIdentityResponse' + | 'WCP6Goodbye'; // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toWebConnectionProtocol1Hello(json: string): WebConnectionProtocol1Hello { - return cast(JSON.parse(json), r('WebConnectionProtocol1Hello')); - } - - public static webConnectionProtocol1HelloToJson(value: WebConnectionProtocol1Hello): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol1Hello')), null, 2); - } - - public static toWebConnectionProtocol2LoadURL(json: string): WebConnectionProtocol2LoadURL { - return cast(JSON.parse(json), r('WebConnectionProtocol2LoadURL')); - } - - public static webConnectionProtocol2LoadURLToJson(value: WebConnectionProtocol2LoadURL): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol2LoadURL')), null, 2); - } - - public static toWebConnectionProtocol3Handshake(json: string): WebConnectionProtocol3Handshake { - return cast(JSON.parse(json), r('WebConnectionProtocol3Handshake')); - } - - public static webConnectionProtocol3HandshakeToJson(value: WebConnectionProtocol3Handshake): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol3Handshake')), null, 2); - } - - public static toWebConnectionProtocol4ValidateAppIdentity(json: string): WebConnectionProtocol4ValidateAppIdentity { - return cast(JSON.parse(json), r('WebConnectionProtocol4ValidateAppIdentity')); - } - - public static webConnectionProtocol4ValidateAppIdentityToJson( - value: WebConnectionProtocol4ValidateAppIdentity - ): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol4ValidateAppIdentity')), null, 2); - } - - public static toWebConnectionProtocol5ValidateAppIdentityFailedResponse( - json: string - ): WebConnectionProtocol5ValidateAppIdentityFailedResponse { - return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')); - } - - public static webConnectionProtocol5ValidateAppIdentityFailedResponseToJson( - value: WebConnectionProtocol5ValidateAppIdentityFailedResponse - ): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')), null, 2); - } - - public static toWebConnectionProtocol5ValidateAppIdentitySuccessResponse( - json: string - ): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')); - } - - public static webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson( - value: WebConnectionProtocol5ValidateAppIdentitySuccessResponse - ): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')), null, 2); - } - - public static toWebConnectionProtocol6Goodbye(json: string): WebConnectionProtocol6Goodbye { - return cast(JSON.parse(json), r('WebConnectionProtocol6Goodbye')); - } - - public static webConnectionProtocol6GoodbyeToJson(value: WebConnectionProtocol6Goodbye): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocol6Goodbye')), null, 2); - } - - public static toWebConnectionProtocolMessage(json: string): WebConnectionProtocolMessage { - return cast(JSON.parse(json), r('WebConnectionProtocolMessage')); - } - - public static webConnectionProtocolMessageToJson(value: WebConnectionProtocolMessage): string { - return JSON.stringify(uncast(value, r('WebConnectionProtocolMessage')), null, 2); - } - public static toAddContextListenerRequest(json: string): AddContextListenerRequest { return cast(JSON.parse(json), r('AddContextListenerRequest')); } @@ -4303,14 +4229,6 @@ export class Convert { return JSON.stringify(uncast(value, r('EventListenerUnsubscribeResponse')), null, 2); } - public static toFdc3UserInterfaceChannelSelected(json: string): Fdc3UserInterfaceChannelSelected { - return cast(JSON.parse(json), r('Fdc3UserInterfaceChannelSelected')); - } - - public static fdc3UserInterfaceChannelSelectedToJson(value: Fdc3UserInterfaceChannelSelected): string { - return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannelSelected')), null, 2); - } - public static toFdc3UserInterfaceChannels(json: string): Fdc3UserInterfaceChannels { return cast(JSON.parse(json), r('Fdc3UserInterfaceChannels')); } @@ -4319,6 +4237,14 @@ export class Convert { return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannels')), null, 2); } + public static toFdc3UserInterfaceChannelSelected(json: string): Fdc3UserInterfaceChannelSelected { + return cast(JSON.parse(json), r('Fdc3UserInterfaceChannelSelected')); + } + + public static fdc3UserInterfaceChannelSelectedToJson(value: Fdc3UserInterfaceChannelSelected): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannelSelected')), null, 2); + } + public static toFdc3UserInterfaceDrag(json: string): Fdc3UserInterfaceDrag { return cast(JSON.parse(json), r('Fdc3UserInterfaceDrag')); } @@ -4731,16 +4657,90 @@ export class Convert { return cast(JSON.parse(json), r('RaiseIntentResponse')); } - public static raiseIntentResponseToJson(value: RaiseIntentResponse): string { - return JSON.stringify(uncast(value, r('RaiseIntentResponse')), null, 2); + public static raiseIntentResponseToJson(value: RaiseIntentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResponse')), null, 2); + } + + public static toRaiseIntentResultResponse(json: string): RaiseIntentResultResponse { + return cast(JSON.parse(json), r('RaiseIntentResultResponse')); + } + + public static raiseIntentResultResponseToJson(value: RaiseIntentResultResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultResponse')), null, 2); + } + + public static toWebConnectionProtocol1Hello(json: string): WebConnectionProtocol1Hello { + return cast(JSON.parse(json), r('WebConnectionProtocol1Hello')); + } + + public static webConnectionProtocol1HelloToJson(value: WebConnectionProtocol1Hello): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol1Hello')), null, 2); + } + + public static toWebConnectionProtocol2LoadURL(json: string): WebConnectionProtocol2LoadURL { + return cast(JSON.parse(json), r('WebConnectionProtocol2LoadURL')); + } + + public static webConnectionProtocol2LoadURLToJson(value: WebConnectionProtocol2LoadURL): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol2LoadURL')), null, 2); + } + + public static toWebConnectionProtocol3Handshake(json: string): WebConnectionProtocol3Handshake { + return cast(JSON.parse(json), r('WebConnectionProtocol3Handshake')); + } + + public static webConnectionProtocol3HandshakeToJson(value: WebConnectionProtocol3Handshake): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol3Handshake')), null, 2); + } + + public static toWebConnectionProtocol4ValidateAppIdentity(json: string): WebConnectionProtocol4ValidateAppIdentity { + return cast(JSON.parse(json), r('WebConnectionProtocol4ValidateAppIdentity')); + } + + public static webConnectionProtocol4ValidateAppIdentityToJson( + value: WebConnectionProtocol4ValidateAppIdentity + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol4ValidateAppIdentity')), null, 2); + } + + public static toWebConnectionProtocol5ValidateAppIdentityFailedResponse( + json: string + ): WebConnectionProtocol5ValidateAppIdentityFailedResponse { + return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')); + } + + public static webConnectionProtocol5ValidateAppIdentityFailedResponseToJson( + value: WebConnectionProtocol5ValidateAppIdentityFailedResponse + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')), null, 2); + } + + public static toWebConnectionProtocol5ValidateAppIdentitySuccessResponse( + json: string + ): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')); + } + + public static webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson( + value: WebConnectionProtocol5ValidateAppIdentitySuccessResponse + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')), null, 2); + } + + public static toWebConnectionProtocol6Goodbye(json: string): WebConnectionProtocol6Goodbye { + return cast(JSON.parse(json), r('WebConnectionProtocol6Goodbye')); + } + + public static webConnectionProtocol6GoodbyeToJson(value: WebConnectionProtocol6Goodbye): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol6Goodbye')), null, 2); } - public static toRaiseIntentResultResponse(json: string): RaiseIntentResultResponse { - return cast(JSON.parse(json), r('RaiseIntentResultResponse')); + public static toWebConnectionProtocolMessage(json: string): WebConnectionProtocolMessage { + return cast(JSON.parse(json), r('WebConnectionProtocolMessage')); } - public static raiseIntentResultResponseToJson(value: RaiseIntentResultResponse): string { - return JSON.stringify(uncast(value, r('RaiseIntentResultResponse')), null, 2); + public static webConnectionProtocolMessageToJson(value: WebConnectionProtocolMessage): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocolMessage')), null, 2); } } @@ -4840,250 +4840,77 @@ function transform(val: any, typ: any, getProps: any, key: any = '', parent: any } const result: any = {}; Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === 'any') return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === 'object' && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === 'object') { - return typ.hasOwnProperty('unionMembers') - ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty('arrayItems') - ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty('props') - ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== 'number') return transformDate(val); - return transformPrimitive(typ, val); -} - -function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); -} - -function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); -} - -function l(typ: any) { - return { literal: typ }; -} - -function a(typ: any) { - return { arrayItems: typ }; -} - -function u(...typs: any[]) { - return { unionMembers: typs }; -} - -function o(props: any[], additional: any) { - return { props, additional }; -} - -function m(additional: any) { - return { props: [], additional }; -} - -function r(name: string) { - return { ref: name }; -} - -const typeMap: any = { - WebConnectionProtocol1Hello: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol1HelloPayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol1HelloType') }, - ], - false - ), - WebConnectionProtocol1HelloMeta: o( - [ - { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: '' }, - { json: 'timestamp', js: 'timestamp', typ: Date }, - ], - false - ), - WebConnectionProtocol1HelloPayload: o( - [ - { json: 'actualUrl', js: 'actualUrl', typ: '' }, - { json: 'channelSelector', js: 'channelSelector', typ: u(undefined, true) }, - { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, - { json: 'identityUrl', js: 'identityUrl', typ: '' }, - { json: 'intentResolver', js: 'intentResolver', typ: u(undefined, true) }, - ], - false - ), - WebConnectionProtocol2LoadURL: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol2LoadURLPayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol2LoadURLType') }, - ], - false - ), - WebConnectionProtocol2LoadURLPayload: o([{ json: 'iframeUrl', js: 'iframeUrl', typ: '' }], false), - WebConnectionProtocol3Handshake: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol3HandshakePayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol3HandshakeType') }, - ], - false - ), - WebConnectionProtocol3HandshakePayload: o( - [ - { json: 'appLaunchTimeout', js: 'appLaunchTimeout', typ: u(undefined, 3.14) }, - { json: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u(true, '') }, - { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, - { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u(true, '') }, - { json: 'messageExchangeTimeout', js: 'messageExchangeTimeout', typ: u(undefined, 3.14) }, - ], - false - ), - WebConnectionProtocol4ValidateAppIdentity: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol4ValidateAppIdentityPayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol4ValidateAppIdentityType') }, - ], - false - ), - WebConnectionProtocol4ValidateAppIdentityPayload: o( - [ - { json: 'actualUrl', js: 'actualUrl', typ: '' }, - { json: 'identityUrl', js: 'identityUrl', typ: '' }, - { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, - { json: 'instanceUuid', js: 'instanceUuid', typ: u(undefined, '') }, - ], - false - ), - WebConnectionProtocol5ValidateAppIdentityFailedResponse: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol5ValidateAppIdentityFailedResponseType') }, - ], - false - ), - WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload: o( - [{ json: 'message', js: 'message', typ: u(undefined, '') }], - false - ), - WebConnectionProtocol5ValidateAppIdentitySuccessResponse: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, - { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol5ValidateAppIdentitySuccessResponseType') }, - ], - false - ), - WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload: o( - [ - { json: 'appId', js: 'appId', typ: '' }, - { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ImplementationMetadata') }, - { json: 'instanceId', js: 'instanceId', typ: '' }, - { json: 'instanceUuid', js: 'instanceUuid', typ: '' }, - ], - false - ), - ImplementationMetadata: o( - [ - { json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }, - { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, - { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') }, - { json: 'provider', js: 'provider', typ: '' }, - { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') }, - ], - false - ), - AppMetadata: o( - [ - { json: 'appId', js: 'appId', typ: '' }, - { json: 'description', js: 'description', typ: u(undefined, '') }, - { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, - { json: 'icons', js: 'icons', typ: u(undefined, a(r('Icon'))) }, - { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, - { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) }, - { json: 'name', js: 'name', typ: u(undefined, '') }, - { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) }, - { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('Image'))) }, - { json: 'title', js: 'title', typ: u(undefined, '') }, - { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') }, - { json: 'version', js: 'version', typ: u(undefined, '') }, - ], - false - ), - Icon: o( - [ - { json: 'size', js: 'size', typ: u(undefined, '') }, - { json: 'src', js: 'src', typ: '' }, - { json: 'type', js: 'type', typ: u(undefined, '') }, - ], - false - ), - Image: o( - [ - { json: 'label', js: 'label', typ: u(undefined, '') }, - { json: 'size', js: 'size', typ: u(undefined, '') }, - { json: 'src', js: 'src', typ: '' }, - { json: 'type', js: 'type', typ: u(undefined, '') }, - ], - false - ), - OptionalFeatures: o( - [ - { json: 'DesktopAgentBridging', js: 'DesktopAgentBridging', typ: true }, - { json: 'OriginatingAppMetadata', js: 'OriginatingAppMetadata', typ: true }, - { json: 'UserChannelMembershipAPIs', js: 'UserChannelMembershipAPIs', typ: true }, - ], - false - ), - WebConnectionProtocol6Goodbye: o( - [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol6GoodbyeMeta') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol6GoodbyeType') }, - ], - false - ), - WebConnectionProtocol6GoodbyeMeta: o([{ json: 'timestamp', js: 'timestamp', typ: Date }], false), - WebConnectionProtocolMessage: o( - [ - { json: 'meta', js: 'meta', typ: r('ConnectionStepMetadata') }, - { json: 'payload', js: 'payload', typ: u(undefined, m('any')) }, - { json: 'type', js: 'type', typ: r('ConnectionStepMessageType') }, - ], - false - ), - ConnectionStepMetadata: o( - [ - { json: 'timestamp', js: 'timestamp', typ: Date }, - { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: u(undefined, '') }, - ], - false - ), + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); +} + +function cast(val: any, typ: any): T { + return transform(val, typ, jsonToJSProps); +} + +function uncast(val: T, typ: any): any { + return transform(val, typ, jsToJSONProps); +} + +function l(typ: any) { + return { literal: typ }; +} + +function a(typ: any) { + return { arrayItems: typ }; +} + +function u(...typs: any[]) { + return { unionMembers: typs }; +} + +function o(props: any[], additional: any) { + return { props, additional }; +} + +function m(additional: any) { + return { props: [], additional }; +} + +function r(name: string) { + return { ref: name }; +} + +const typeMap: any = { AddContextListenerRequest: o( [ { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, @@ -5418,14 +5245,6 @@ const typeMap: any = { ], false ), - Fdc3UserInterfaceChannelSelected: o( - [ - { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceChannelSelectedPayload') }, - { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceChannelSelectedType') }, - ], - false - ), - Fdc3UserInterfaceChannelSelectedPayload: o([{ json: 'selected', js: 'selected', typ: u(null, '') }], false), Fdc3UserInterfaceChannels: o( [ { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceChannelsPayload') }, @@ -5440,6 +5259,14 @@ const typeMap: any = { ], false ), + Fdc3UserInterfaceChannelSelected: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceChannelSelectedPayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceChannelSelectedType') }, + ], + false + ), + Fdc3UserInterfaceChannelSelectedPayload: o([{ json: 'selected', js: 'selected', typ: u(null, '') }], false), Fdc3UserInterfaceDrag: o( [ { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceDragPayload') }, @@ -5520,6 +5347,40 @@ const typeMap: any = { ], false ), + AppMetadata: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'description', js: 'description', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'icons', js: 'icons', typ: u(undefined, a(r('Icon'))) }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) }, + { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('Image'))) }, + { json: 'title', js: 'title', typ: u(undefined, '') }, + { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') }, + { json: 'version', js: 'version', typ: u(undefined, '') }, + ], + false + ), + Icon: o( + [ + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), + Image: o( + [ + { json: 'label', js: 'label', typ: u(undefined, '') }, + { json: 'size', js: 'size', typ: u(undefined, '') }, + { json: 'src', js: 'src', typ: '' }, + { json: 'type', js: 'type', typ: u(undefined, '') }, + ], + false + ), IntentMetadata: o( [ { json: 'displayName', js: 'displayName', typ: u(undefined, '') }, @@ -5752,6 +5613,24 @@ const typeMap: any = { ], false ), + ImplementationMetadata: o( + [ + { json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }, + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') }, + { json: 'provider', js: 'provider', typ: '' }, + { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') }, + ], + false + ), + OptionalFeatures: o( + [ + { json: 'DesktopAgentBridging', js: 'DesktopAgentBridging', typ: true }, + { json: 'OriginatingAppMetadata', js: 'OriginatingAppMetadata', typ: true }, + { json: 'UserChannelMembershipAPIs', js: 'UserChannelMembershipAPIs', typ: true }, + ], + false + ), GetOrCreateChannelRequest: o( [ { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, @@ -6129,37 +6008,142 @@ const typeMap: any = { ], false ), - RaiseIntentResultResponse: o( + RaiseIntentResultResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultResponseType') }, + ], + false + ), + RaiseIntentResultResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, + { json: 'intentResult', js: 'intentResult', typ: u(undefined, r('IntentResult')) }, + ], + false + ), + WebConnectionProtocol1Hello: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol1HelloPayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol1HelloType') }, + ], + false + ), + WebConnectionProtocol1HelloMeta: o( + [ + { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + WebConnectionProtocol1HelloPayload: o( + [ + { json: 'actualUrl', js: 'actualUrl', typ: '' }, + { json: 'channelSelector', js: 'channelSelector', typ: u(undefined, true) }, + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'identityUrl', js: 'identityUrl', typ: '' }, + { json: 'intentResolver', js: 'intentResolver', typ: u(undefined, true) }, + ], + false + ), + WebConnectionProtocol2LoadURL: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol2LoadURLPayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol2LoadURLType') }, + ], + false + ), + WebConnectionProtocol2LoadURLPayload: o([{ json: 'iframeUrl', js: 'iframeUrl', typ: '' }], false), + WebConnectionProtocol3Handshake: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol3HandshakePayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol3HandshakeType') }, + ], + false + ), + WebConnectionProtocol3HandshakePayload: o( + [ + { json: 'appLaunchTimeout', js: 'appLaunchTimeout', typ: u(undefined, 3.14) }, + { json: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u(true, '') }, + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u(true, '') }, + { json: 'messageExchangeTimeout', js: 'messageExchangeTimeout', typ: u(undefined, 3.14) }, + ], + false + ), + WebConnectionProtocol4ValidateAppIdentity: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol4ValidateAppIdentityPayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol4ValidateAppIdentityType') }, + ], + false + ), + WebConnectionProtocol4ValidateAppIdentityPayload: o( + [ + { json: 'actualUrl', js: 'actualUrl', typ: '' }, + { json: 'identityUrl', js: 'identityUrl', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + { json: 'instanceUuid', js: 'instanceUuid', typ: u(undefined, '') }, + ], + false + ), + WebConnectionProtocol5ValidateAppIdentityFailedResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol5ValidateAppIdentityFailedResponseType') }, + ], + false + ), + WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload: o( + [{ json: 'message', js: 'message', typ: u(undefined, '') }], + false + ), + WebConnectionProtocol5ValidateAppIdentitySuccessResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol1HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol5ValidateAppIdentitySuccessResponseType') }, + ], + false + ), + WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ImplementationMetadata') }, + { json: 'instanceId', js: 'instanceId', typ: '' }, + { json: 'instanceUuid', js: 'instanceUuid', typ: '' }, + ], + false + ), + WebConnectionProtocol6Goodbye: o( + [ + { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol6GoodbyeMeta') }, + { json: 'type', js: 'type', typ: r('WebConnectionProtocol6GoodbyeType') }, + ], + false + ), + WebConnectionProtocol6GoodbyeMeta: o([{ json: 'timestamp', js: 'timestamp', typ: Date }], false), + WebConnectionProtocolMessage: o( [ - { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, - { json: 'payload', js: 'payload', typ: r('RaiseIntentResultResponsePayload') }, - { json: 'type', js: 'type', typ: r('RaiseIntentResultResponseType') }, + { json: 'meta', js: 'meta', typ: r('ConnectionStepMetadata') }, + { json: 'payload', js: 'payload', typ: u(undefined, m('any')) }, + { json: 'type', js: 'type', typ: r('ConnectionStepMessageType') }, ], false ), - RaiseIntentResultResponsePayload: o( + ConnectionStepMetadata: o( [ - { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, - { json: 'intentResult', js: 'intentResult', typ: u(undefined, r('IntentResult')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: u(undefined, '') }, ], false ), - WebConnectionProtocol1HelloType: ['WCP1Hello'], - WebConnectionProtocol2LoadURLType: ['WCP2LoadUrl'], - WebConnectionProtocol3HandshakeType: ['WCP3Handshake'], - WebConnectionProtocol4ValidateAppIdentityType: ['WCP4ValidateAppIdentity'], - WebConnectionProtocol5ValidateAppIdentityFailedResponseType: ['WCP5ValidateAppIdentityFailedResponse'], - WebConnectionProtocol5ValidateAppIdentitySuccessResponseType: ['WCP5ValidateAppIdentityResponse'], - WebConnectionProtocol6GoodbyeType: ['WCP6Goodbye'], - ConnectionStepMessageType: [ - 'WCP1Hello', - 'WCP2LoadUrl', - 'WCP3Handshake', - 'WCP4ValidateAppIdentity', - 'WCP5ValidateAppIdentityFailedResponse', - 'WCP5ValidateAppIdentityResponse', - 'WCP6Goodbye', - ], AddContextListenerRequestType: ['addContextListenerRequest'], PurpleError: [ 'ApiTimeout', @@ -6300,8 +6284,8 @@ const typeMap: any = { CreatePrivateChannelResponseType: ['createPrivateChannelResponse'], EventListenerUnsubscribeRequestType: ['eventListenerUnsubscribeRequest'], EventListenerUnsubscribeResponseType: ['eventListenerUnsubscribeResponse'], - Fdc3UserInterfaceChannelSelectedType: ['Fdc3UserInterfaceChannelSelected'], Fdc3UserInterfaceChannelsType: ['Fdc3UserInterfaceChannels'], + Fdc3UserInterfaceChannelSelectedType: ['Fdc3UserInterfaceChannelSelected'], Fdc3UserInterfaceDragType: ['Fdc3UserInterfaceDrag'], Fdc3UserInterfaceHandshakeType: ['Fdc3UserInterfaceHandshake'], Fdc3UserInterfaceHelloType: ['Fdc3UserInterfaceHello'], @@ -6397,6 +6381,22 @@ const typeMap: any = { RaiseIntentRequestType: ['raiseIntentRequest'], RaiseIntentResponseType: ['raiseIntentResponse'], RaiseIntentResultResponseType: ['raiseIntentResultResponse'], + WebConnectionProtocol1HelloType: ['WCP1Hello'], + WebConnectionProtocol2LoadURLType: ['WCP2LoadUrl'], + WebConnectionProtocol3HandshakeType: ['WCP3Handshake'], + WebConnectionProtocol4ValidateAppIdentityType: ['WCP4ValidateAppIdentity'], + WebConnectionProtocol5ValidateAppIdentityFailedResponseType: ['WCP5ValidateAppIdentityFailedResponse'], + WebConnectionProtocol5ValidateAppIdentitySuccessResponseType: ['WCP5ValidateAppIdentityResponse'], + WebConnectionProtocol6GoodbyeType: ['WCP6Goodbye'], + ConnectionStepMessageType: [ + 'WCP1Hello', + 'WCP2LoadUrl', + 'WCP3Handshake', + 'WCP4ValidateAppIdentity', + 'WCP5ValidateAppIdentityFailedResponse', + 'WCP5ValidateAppIdentityResponse', + 'WCP6Goodbye', + ], }; export type AppRequestMessage = @@ -6425,224 +6425,49 @@ export type AppRequestMessage = | OpenRequest | PrivateChannelAddEventListenerRequest | PrivateChannelDisconnectRequest - | PrivateChannelUnsubscribeEventListenerRequest - | RaiseIntentForContextRequest - | RaiseIntentRequest; - -export type AgentResponseMessage = - | AddContextListenerResponse - | AddEventListenerResponse - | AddIntentListenerResponse - | BroadcastResponse - | ClearContextResponse - | ContextListenerUnsubscribeResponse - | CreatePrivateChannelResponse - | EventListenerUnsubscribeResponse - | FindInstancesResponse - | FindIntentResponse - | FindIntentsByContextResponse - | GetAppMetadataResponse - | GetCurrentChannelResponse - | GetCurrentContextResponse - | GetInfoResponse - | GetOrCreateChannelResponse - | GetUserChannelsResponse - | IntentListenerUnsubscribeResponse - | IntentResultResponse - | JoinUserChannelResponse - | LeaveCurrentChannelResponse - | OpenResponse - | PrivateChannelAddEventListenerResponse - | PrivateChannelDisconnectResponse - | PrivateChannelUnsubscribeEventListenerResponse - | RaiseIntentForContextResponse - | RaiseIntentResponse - | RaiseIntentResultResponse; - -export type AgentEventMessage = - | BroadcastEvent - | ChannelChangedEvent - | ContextClearedEvent - | HeartbeatEvent - | IntentEvent - | PrivateChannelOnAddContextListenerEvent - | PrivateChannelOnDisconnectEvent - | PrivateChannelOnUnsubscribeEvent; - -/** - * Returns true if the value has a type property with value 'WCP1Hello'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { - return value != null && value.type === 'WCP1Hello'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol1Hello. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { - try { - Convert.webConnectionProtocol1HelloToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL1_HELLO_TYPE = 'WebConnectionProtocol1Hello'; - -/** - * Returns true if the value has a type property with value 'WCP2LoadUrl'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { - return value != null && value.type === 'WCP2LoadUrl'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol2LoadURL. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { - try { - Convert.webConnectionProtocol2LoadURLToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL2_LOAD_U_R_L_TYPE = 'WebConnectionProtocol2LoadURL'; - -/** - * Returns true if the value has a type property with value 'WCP3Handshake'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { - return value != null && value.type === 'WCP3Handshake'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol3Handshake. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { - try { - Convert.webConnectionProtocol3HandshakeToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL3_HANDSHAKE_TYPE = 'WebConnectionProtocol3Handshake'; - -/** - * Returns true if the value has a type property with value 'WCP4ValidateAppIdentity'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol4ValidateAppIdentity( - value: any -): value is WebConnectionProtocol4ValidateAppIdentity { - return value != null && value.type === 'WCP4ValidateAppIdentity'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol4ValidateAppIdentity. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol4ValidateAppIdentity( - value: any -): value is WebConnectionProtocol4ValidateAppIdentity { - try { - Convert.webConnectionProtocol4ValidateAppIdentityToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL4_VALIDATE_APP_IDENTITY_TYPE = 'WebConnectionProtocol4ValidateAppIdentity'; - -/** - * Returns true if the value has a type property with value 'WCP5ValidateAppIdentityFailedResponse'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol5ValidateAppIdentityFailedResponse( - value: any -): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { - return value != null && value.type === 'WCP5ValidateAppIdentityFailedResponse'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol5ValidateAppIdentityFailedResponse. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol5ValidateAppIdentityFailedResponse( - value: any -): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { - try { - Convert.webConnectionProtocol5ValidateAppIdentityFailedResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_FAILED_RESPONSE_TYPE = - 'WebConnectionProtocol5ValidateAppIdentityFailedResponse'; - -/** - * Returns true if the value has a type property with value 'WCP5ValidateAppIdentityResponse'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol5ValidateAppIdentitySuccessResponse( - value: any -): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - return value != null && value.type === 'WCP5ValidateAppIdentityResponse'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol5ValidateAppIdentitySuccessResponse. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol5ValidateAppIdentitySuccessResponse( - value: any -): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - try { - Convert.webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_SUCCESS_RESPONSE_TYPE = - 'WebConnectionProtocol5ValidateAppIdentitySuccessResponse'; - -/** - * Returns true if the value has a type property with value 'WCP6Goodbye'. This is a fast check that does not check the format of the message - */ -export function isWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { - return value != null && value.type === 'WCP6Goodbye'; -} - -/** - * Returns true if value is a valid WebConnectionProtocol6Goodbye. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { - try { - Convert.webConnectionProtocol6GoodbyeToJson(value); - return true; - } catch (_e: any) { - return false; - } -} - -export const WEB_CONNECTION_PROTOCOL6_GOODBYE_TYPE = 'WebConnectionProtocol6Goodbye'; + | PrivateChannelUnsubscribeEventListenerRequest + | RaiseIntentForContextRequest + | RaiseIntentRequest; -/** - * Returns true if value is a valid WebConnectionProtocolMessage. This checks the type against the json schema for the message and will be slower - */ -export function isValidWebConnectionProtocolMessage(value: any): value is WebConnectionProtocolMessage { - try { - Convert.webConnectionProtocolMessageToJson(value); - return true; - } catch (_e: any) { - return false; - } -} +export type AgentResponseMessage = + | AddContextListenerResponse + | AddEventListenerResponse + | AddIntentListenerResponse + | BroadcastResponse + | ClearContextResponse + | ContextListenerUnsubscribeResponse + | CreatePrivateChannelResponse + | EventListenerUnsubscribeResponse + | FindInstancesResponse + | FindIntentResponse + | FindIntentsByContextResponse + | GetAppMetadataResponse + | GetCurrentChannelResponse + | GetCurrentContextResponse + | GetInfoResponse + | GetOrCreateChannelResponse + | GetUserChannelsResponse + | IntentListenerUnsubscribeResponse + | IntentResultResponse + | JoinUserChannelResponse + | LeaveCurrentChannelResponse + | OpenResponse + | PrivateChannelAddEventListenerResponse + | PrivateChannelDisconnectResponse + | PrivateChannelUnsubscribeEventListenerResponse + | RaiseIntentForContextResponse + | RaiseIntentResponse + | RaiseIntentResultResponse; -export const WEB_CONNECTION_PROTOCOL_MESSAGE_TYPE = 'WebConnectionProtocolMessage'; +export type AgentEventMessage = + | BroadcastEvent + | ChannelChangedEvent + | ContextClearedEvent + | HeartbeatEvent + | IntentEvent + | PrivateChannelOnAddContextListenerEvent + | PrivateChannelOnDisconnectEvent + | PrivateChannelOnUnsubscribeEvent; /** * Returns true if the value has a type property with value 'addContextListenerRequest'. This is a fast check that does not check the format of the message @@ -7044,46 +6869,46 @@ export function isValidEventListenerUnsubscribeResponse(value: any): value is Ev export const EVENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = 'EventListenerUnsubscribeResponse'; /** - * Returns true if the value has a type property with value 'Fdc3UserInterfaceChannelSelected'. This is a fast check that does not check the format of the message + * Returns true if the value has a type property with value 'Fdc3UserInterfaceChannels'. This is a fast check that does not check the format of the message */ -export function isFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { - return value != null && value.type === 'Fdc3UserInterfaceChannelSelected'; +export function isFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { + return value != null && value.type === 'Fdc3UserInterfaceChannels'; } /** - * Returns true if value is a valid Fdc3UserInterfaceChannelSelected. This checks the type against the json schema for the message and will be slower + * Returns true if value is a valid Fdc3UserInterfaceChannels. This checks the type against the json schema for the message and will be slower */ -export function isValidFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { +export function isValidFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { try { - Convert.fdc3UserInterfaceChannelSelectedToJson(value); + Convert.fdc3UserInterfaceChannelsToJson(value); return true; } catch (_e: any) { return false; } } -export const FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE = 'Fdc3UserInterfaceChannelSelected'; +export const FDC3_USER_INTERFACE_CHANNELS_TYPE = 'Fdc3UserInterfaceChannels'; /** - * Returns true if the value has a type property with value 'Fdc3UserInterfaceChannels'. This is a fast check that does not check the format of the message + * Returns true if the value has a type property with value 'Fdc3UserInterfaceChannelSelected'. This is a fast check that does not check the format of the message */ -export function isFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { - return value != null && value.type === 'Fdc3UserInterfaceChannels'; +export function isFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { + return value != null && value.type === 'Fdc3UserInterfaceChannelSelected'; } /** - * Returns true if value is a valid Fdc3UserInterfaceChannels. This checks the type against the json schema for the message and will be slower + * Returns true if value is a valid Fdc3UserInterfaceChannelSelected. This checks the type against the json schema for the message and will be slower */ -export function isValidFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { +export function isValidFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { try { - Convert.fdc3UserInterfaceChannelsToJson(value); + Convert.fdc3UserInterfaceChannelSelectedToJson(value); return true; } catch (_e: any) { return false; } } -export const FDC3_USER_INTERFACE_CHANNELS_TYPE = 'Fdc3UserInterfaceChannels'; +export const FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE = 'Fdc3UserInterfaceChannelSelected'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceDrag'. This is a fast check that does not check the format of the message @@ -8186,3 +8011,178 @@ export function isValidRaiseIntentResultResponse(value: any): value is RaiseInte } export const RAISE_INTENT_RESULT_RESPONSE_TYPE = 'RaiseIntentResultResponse'; + +/** + * Returns true if the value has a type property with value 'WCP1Hello'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { + return value != null && value.type === 'WCP1Hello'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol1Hello. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol1Hello(value: any): value is WebConnectionProtocol1Hello { + try { + Convert.webConnectionProtocol1HelloToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL1_HELLO_TYPE = 'WebConnectionProtocol1Hello'; + +/** + * Returns true if the value has a type property with value 'WCP2LoadUrl'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { + return value != null && value.type === 'WCP2LoadUrl'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol2LoadURL. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol2LoadURL(value: any): value is WebConnectionProtocol2LoadURL { + try { + Convert.webConnectionProtocol2LoadURLToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL2_LOAD_U_R_L_TYPE = 'WebConnectionProtocol2LoadURL'; + +/** + * Returns true if the value has a type property with value 'WCP3Handshake'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { + return value != null && value.type === 'WCP3Handshake'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol3Handshake. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol3Handshake(value: any): value is WebConnectionProtocol3Handshake { + try { + Convert.webConnectionProtocol3HandshakeToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL3_HANDSHAKE_TYPE = 'WebConnectionProtocol3Handshake'; + +/** + * Returns true if the value has a type property with value 'WCP4ValidateAppIdentity'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol4ValidateAppIdentity( + value: any +): value is WebConnectionProtocol4ValidateAppIdentity { + return value != null && value.type === 'WCP4ValidateAppIdentity'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol4ValidateAppIdentity. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol4ValidateAppIdentity( + value: any +): value is WebConnectionProtocol4ValidateAppIdentity { + try { + Convert.webConnectionProtocol4ValidateAppIdentityToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL4_VALIDATE_APP_IDENTITY_TYPE = 'WebConnectionProtocol4ValidateAppIdentity'; + +/** + * Returns true if the value has a type property with value 'WCP5ValidateAppIdentityFailedResponse'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol5ValidateAppIdentityFailedResponse( + value: any +): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { + return value != null && value.type === 'WCP5ValidateAppIdentityFailedResponse'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol5ValidateAppIdentityFailedResponse. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol5ValidateAppIdentityFailedResponse( + value: any +): value is WebConnectionProtocol5ValidateAppIdentityFailedResponse { + try { + Convert.webConnectionProtocol5ValidateAppIdentityFailedResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_FAILED_RESPONSE_TYPE = + 'WebConnectionProtocol5ValidateAppIdentityFailedResponse'; + +/** + * Returns true if the value has a type property with value 'WCP5ValidateAppIdentityResponse'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol5ValidateAppIdentitySuccessResponse( + value: any +): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + return value != null && value.type === 'WCP5ValidateAppIdentityResponse'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol5ValidateAppIdentitySuccessResponse. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol5ValidateAppIdentitySuccessResponse( + value: any +): value is WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + try { + Convert.webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL5_VALIDATE_APP_IDENTITY_SUCCESS_RESPONSE_TYPE = + 'WebConnectionProtocol5ValidateAppIdentitySuccessResponse'; + +/** + * Returns true if the value has a type property with value 'WCP6Goodbye'. This is a fast check that does not check the format of the message + */ +export function isWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { + return value != null && value.type === 'WCP6Goodbye'; +} + +/** + * Returns true if value is a valid WebConnectionProtocol6Goodbye. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocol6Goodbye(value: any): value is WebConnectionProtocol6Goodbye { + try { + Convert.webConnectionProtocol6GoodbyeToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL6_GOODBYE_TYPE = 'WebConnectionProtocol6Goodbye'; + +/** + * Returns true if value is a valid WebConnectionProtocolMessage. This checks the type against the json schema for the message and will be slower + */ +export function isValidWebConnectionProtocolMessage(value: any): value is WebConnectionProtocolMessage { + try { + Convert.webConnectionProtocolMessageToJson(value); + return true; + } catch (_e: any) { + return false; + } +} + +export const WEB_CONNECTION_PROTOCOL_MESSAGE_TYPE = 'WebConnectionProtocolMessage'; diff --git a/website/docs/context/ref/Instrument.md b/website/docs/context/ref/Instrument.md index e182c396c..97f7cb884 100644 --- a/website/docs/context/ref/Instrument.md +++ b/website/docs/context/ref/Instrument.md @@ -171,6 +171,35 @@ The `market` map can be used to further specify the instrument and help achieve +
+ classification + +**type**: `object` + +**Subproperties:** + +
+ name + +**type**: `string` + +Optional human-readable classification, to be used if no specific data classification is available. + +
+ +
+ FDS_TYPE + +**type**: `string` + +FactSet classification for the instrument. + +
+ +[@experimental](/docs/fdc3-compliance#experimental-features) The `classification` map can be used to specify the categorization of the instrument and help achieve interoperability between disparate data sources. + +
+ ## Example ```json @@ -184,6 +213,9 @@ The `market` map can be used to further specify the instrument and help achieve }, "market": { "MIC": "XNAS" + }, + "classification": { + "name": "publicCompany" } } ``` diff --git a/website/docs/context/ref/Interaction.md b/website/docs/context/ref/Interaction.md index 4d0d98447..c0d9d72a6 100644 --- a/website/docs/context/ref/Interaction.md +++ b/website/docs/context/ref/Interaction.md @@ -77,14 +77,7 @@ The time range over which the interaction occurred
interactionType (required) -**Any of:** - -- **type**: `string` with values: -- `Instant Message`, -- `Email`, -- `Call`, -- `Meeting` -- **type**: `string` +**type**: `string` `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or `'Meeting'` although other string values are permitted.