diff --git a/CHANGELOG.md b/CHANGELOG.md index bd61a8ee6..d44c65f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * Added utility functions `isStandardContextType(contextType: string)`, `isStandardIntent(intent: string)`,`getPossibleContextsForIntent(intent: StandardIntent)`. ([#1139](https://github.com/finos/FDC3/pull/1139)) * Added support for event listening outside of intent or context listnener. Added new function `addEventListener`, type `EventHandler`, enum `FDC3EventType` and interfaces `FDC3Event` and `FDC3ChannelChangedEvent`. ([#1207](https://github.com/finos/FDC3/pull/1207)) * Added new `CreateOrUpdateProfile` intent. ([#1359](https://github.com/finos/FDC3/pull/1359)) +* Added separate `fdc3-commonjs` module for compatibility with older projects that use CommonJS. ([#1452](https://github.com/finos/FDC3/pull/1452)) ### Changed diff --git a/README.md b/README.md index e517718de..cc44b950e 100755 --- a/README.md +++ b/README.md @@ -93,7 +93,9 @@ This project (the FDC3 Standard repo) is now a monorepo containing the following | `toolbox/fdc3-explained` | [Here](https://fdc3.finos.org/toolbox/fdc3-explained) | [Readme Here](toolbox/fdc3-explained/README.md) | | | `toolbox/fdc3-for-web/fdc3-web-impl` | `@finos/fdc3-web-impl` (npm) | Portable and reusable implementation of the FDC3 For-The-Web Desktop Agent-Side protocol, | Cucumber, NYC | | `toolbox/fdc3-for-web/demo` | -not released- | A reference implementation of an FDC3-For-The-Web Desktop Agent, using the above implementation and conforming to FDC3 2.0 from the [FDC3 Conformance Framework](https://github.com/finos/FDC3-conformance-framework) | | -| `packages/fdc3` | `@finos/fdc3` (npm) | A complete roll-up of the `fdc3-agent-proxy`, `fdc3-context`, `fdc3-schema` and `fdc3-get-agent` sub-modules. This is intended to be the main entry point for typescript / javascript applications using FDC3 | | +| `packages/fdc3` | `@finos/fdc3` (npm) | Imports `fdc3-standard`, `fdc3-context`, `fdc3-schema` and `fdc3-get-agent` sub-modules. This is intended to be the main entry point for typescript / javascript applications using FDC3 | | +| `packages/fdc3-commonjs` | `@finos/fdc3-commonjs` (npm) | A roll-up of the `fdc3` sub-module. This is for **backwards compatibility where CommonJS is required**. May not be provided in future versions of FDC3. | | + ### Building and Running The FDC3 Modules diff --git a/package-lock.json b/package-lock.json index c797f390b..1e84d3b4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "toolbox/fdc3-for-web/fdc3-web-impl", "packages/fdc3-get-agent", "packages/fdc3", + "packages/fdc3-commonjs", "toolbox/fdc3-for-web/reference-ui", "toolbox/fdc3-for-web/demo", "toolbox/fdc3-workbench" @@ -3246,6 +3247,10 @@ "@rollup/rollup-linux-x64-gnu": "4.14.1" } }, + "node_modules/@kite9/fdc3-commonjs": { + "resolved": "packages/fdc3-commonjs", + "link": true + }, "node_modules/@kite9/fdc3-context": { "resolved": "packages/fdc3-context", "link": true @@ -3616,6 +3621,154 @@ "version": "1.1.0", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, + "node_modules/@rollup/plugin-commonjs": { + "version": "28.0.1", + "integrity": "sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/fdir": { + "version": "6.4.2", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "dev": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/picomatch": { + "version": "4.0.2", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@rollup/plugin-json": { + "version": "6.1.0", + "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.1.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.3.0", + "integrity": "sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "12.1.1", + "integrity": "sha512-t7O653DpfB5MbFrqPe/VcKFFkvRuFNp9qId3xq4Eth5xlyymzxNpye2z8Hrl0RIMuXTSr5GGcFpkdlMeacUiFQ==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.3", + "integrity": "sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "4.0.2", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.28.0", "integrity": "sha512-wLJuPLT6grGZsy34g4N1yRfYeouklTgPhH1gWXCYspenKYD0s3cR99ZevOGw5BexMNywkbV3UkjADisozBmpPQ==", @@ -7505,6 +7658,11 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "node_modules/esutils": { "version": "2.0.3", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", @@ -8936,6 +9094,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-module": { + "version": "1.0.0", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "node_modules/is-negative-zero": { "version": "2.0.3", "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", @@ -8994,6 +9157,14 @@ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true }, + "node_modules/is-reference": { + "version": "1.2.1", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-regex": { "version": "1.2.0", "integrity": "sha512-B6ohK4ZmoftlUe+uvenXSbPJFo6U37BH7oO1B3nQH8f/7h27N56s85MhUtbFJAziz5dcmuR3i8ovUl35zp8pFA==", @@ -16624,7 +16795,8 @@ "@kite9/fdc3-get-agent": "2.2.0-beta.29", "@kite9/fdc3-schema": "2.2.0-beta.29", "@kite9/fdc3-standard": "2.2.0-beta.29" - } + }, + "devDependencies": {} }, "packages/fdc3-agent-proxy": { "name": "@kite9/fdc3-agent-proxy", @@ -16958,6 +17130,20 @@ "node": ">=6" } }, + "packages/fdc3-commonjs": { + "version": "2.2.0-beta.29", + "license": "Apache-2.0", + "dependencies": { + "@kite9/fdc3": "2.2.0-beta.29" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.1", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-typescript": "^12.1.1", + "rollup": "^4.27.4" + } + }, "packages/fdc3-context": { "name": "@kite9/fdc3-context", "version": "2.2.0-beta.29", diff --git a/package.json b/package.json index f7ced66b6..e96efe7bb 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "toolbox/fdc3-for-web/fdc3-web-impl", "packages/fdc3-get-agent", "packages/fdc3", + "packages/fdc3-commonjs", "toolbox/fdc3-for-web/reference-ui", "toolbox/fdc3-for-web/demo", "toolbox/fdc3-workbench" @@ -64,4 +65,4 @@ "lint-staged": { "**/*": "prettier --write --ignore-unknown" } -} +} \ No newline at end of file diff --git a/packages/fdc3-commonjs/README.md b/packages/fdc3-commonjs/README.md new file mode 100644 index 000000000..60c7e26a1 --- /dev/null +++ b/packages/fdc3-commonjs/README.md @@ -0,0 +1,57 @@ +# FDC3 CommonJS Module + +This is the CommonJS module version of the Financial Desktop Connectivity and Collaboration Consortium (FDC3) javascript API. + +## Warning + +CommonJS is no longer the recommended module system for JavaScript. We recommend using the FDC3 ES6 module at `@finos/fdc3` instead. The FDC3 CommonJS module is provided for compatibility with older projects that use CommonJS. + +## Installation + +To install the FDC3 CommonJS module, use npm: + +```bash +npm install @finos/fdc3-commonjs +``` + +## Usage + +To use the FDC3 CommonJS module in your project, require it as follows: + +```javascript +const fdc3CommonJs = require('@finos/fdc3-commonjs'); + +// getAgent() returns the FDC3 Desktop Agent +const fdc3 = fdc3CommonJs.getAgent(); + +// Example usage +const contact = { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane@mail.com' + } +}; + +fdc3.raiseIntent('ViewProfile', contact); +``` + +## Documentation + +For detailed documentation and API reference, please visit the [official FDC3 documentation](https://fdc3.finos.org/docs/api/overview). + +## Contributing + +We welcome contributions to the FDC3 project. Please see our [contributing guidelines](https://github.com/finos/FDC3/blob/main/CONTRIBUTING.md) for more information. + +## License + +This project is licensed under the [Apache 2.0 License](LICENSE). + +## Contact + +For any questions or support, please reach out to the FDC3 community on our [Slack channel](https://finos-lf.slack.com/archives/CJ8Q8H4Q1) or [mailing list](mailto:fdc3@finos.org). + +## Further Details + +Further details are avilable in the main [FDC3 Project README](https://github.com/finos/FDC3) diff --git a/packages/fdc3-commonjs/package.json b/packages/fdc3-commonjs/package.json new file mode 100644 index 000000000..cc819cc27 --- /dev/null +++ b/packages/fdc3-commonjs/package.json @@ -0,0 +1,34 @@ +{ + "name": "@kite9/fdc3-commonjs", + "version": "2.2.0-beta.29", + "author": "Fintech Open Source Foundation (FINOS)", + "homepage": "https://fdc3.finos.org", + "repository": { + "type": "git", + "url": "git+https://github.com/finos/FDC3.git" + }, + "publishConfig": { + "tag": "latest" + }, + "exports": { + "require": "./dist/index.cjs" + }, + "license": "Apache-2.0", + "files": [ + "dist" + ], + "scripts": { + "clean": "npx rimraf dist", + "build": "npx rollup -c rollup.config.mjs" + }, + "dependencies": { + "@kite9/fdc3": "2.2.0-beta.29" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^28.0.1", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-typescript": "^12.1.1", + "rollup": "^4.27.4" + } +} \ No newline at end of file diff --git a/packages/fdc3-commonjs/rollup.config.mjs b/packages/fdc3-commonjs/rollup.config.mjs new file mode 100644 index 000000000..88bcb5a93 --- /dev/null +++ b/packages/fdc3-commonjs/rollup.config.mjs @@ -0,0 +1,35 @@ +import typescript from '@rollup/plugin-typescript'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; + +export default [ + { + input: 'src/index.ts', + + // Property inherited from TSDX. To understand what this is doing, see comments: + // https://github.com/jaredpalmer/tsdx/blob/master/src/createRollupConfig.ts#L77 + treeshake: { + propertyReadSideEffects: false, + }, + + output: { + file: 'dist/index.cjs', + format: 'cjs', + freeze: false, + esModule: false, + sourcemap: true, + exports: 'named', + }, + + plugins: [ + nodeResolve(), + commonjs({ + // use a regex to make sure to include eventual hoisted packages (RM: what is this?) + include: /\/regenerator-runtime\//, + }), + json(), + typescript(), + ], + }, +]; diff --git a/packages/fdc3-commonjs/src/index.ts b/packages/fdc3-commonjs/src/index.ts new file mode 100644 index 000000000..48e59526d --- /dev/null +++ b/packages/fdc3-commonjs/src/index.ts @@ -0,0 +1 @@ +export * from '@kite9/fdc3'; diff --git a/packages/fdc3-schema/generated/api/BrowserTypes.ts b/packages/fdc3-schema/generated/api/BrowserTypes.ts index 270a98da2..081c749e1 100644 --- a/packages/fdc3-schema/generated/api/BrowserTypes.ts +++ b/packages/fdc3-schema/generated/api/BrowserTypes.ts @@ -1,7 +1,15 @@ // To parse this data: // -// import { Convert, AddContextListenerRequest, AddContextListenerResponse, AddEventListenerRequest, AddEventListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, AgentEventMessage, AgentResponseMessage, AppRequestMessage, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, 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"; +// import { Convert, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocol6Goodbye, WebConnectionProtocolMessage, AddContextListenerRequest, AddContextListenerResponse, AddEventListenerRequest, AddEventListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, AgentEventMessage, AgentResponseMessage, AppRequestMessage, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, 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"; // +// 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); @@ -21,8 +29,8 @@ // const createPrivateChannelResponse = Convert.toCreatePrivateChannelResponse(json); // const eventListenerUnsubscribeRequest = Convert.toEventListenerUnsubscribeRequest(json); // const eventListenerUnsubscribeResponse = Convert.toEventListenerUnsubscribeResponse(json); -// const fdc3UserInterfaceChannels = Convert.toFdc3UserInterfaceChannels(json); // const fdc3UserInterfaceChannelSelected = Convert.toFdc3UserInterfaceChannelSelected(json); +// const fdc3UserInterfaceChannels = Convert.toFdc3UserInterfaceChannels(json); // const fdc3UserInterfaceDrag = Convert.toFdc3UserInterfaceDrag(json); // const fdc3UserInterfaceHandshake = Convert.toFdc3UserInterfaceHandshake(json); // const fdc3UserInterfaceHello = Convert.toFdc3UserInterfaceHello(json); @@ -75,248 +83,772 @@ // 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. /** - * 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. + * Hello message sent by an application to a parent window or frame when attempting 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 AddContextListenerRequest { +export interface WebConnectionProtocol1Hello { /** - * 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: AddContextListenerRequestPayload; + 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 'Request' appended. + * Identifies the type of the connection step message. */ - type: 'addContextListenerRequest'; + type: 'WCP1Hello'; } /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + * Metadata for a Web Connection Protocol message. */ -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; +export interface WebConnectionProtocol1HelloMeta { + connectionAttemptUuid: string; 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. + * The message payload, containing data pertaining to this connection step. */ -export interface AppIdentifier { +export interface WebConnectionProtocol1HelloPayload { /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. + * The current URL of the page attempting to connect. This may differ from the identityUrl, + * but the origins MUST match. */ - appId: string; + actualUrl: string; /** - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. + * 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. */ - desktopAgent?: string; + channelSelector?: boolean; /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. + * The version of FDC3 API that the app supports. */ - instanceId?: string; - [property: string]: any; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface AddContextListenerRequestPayload { + fdc3Version: string; /** - * 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). + * 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. */ - channelId: null | string; + identityUrl: string; /** - * The type of context to listen for OR `null` indicating that it should listen to all - * context types. + * 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. */ - contextType: null | string; + intentResolver?: boolean; + [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 connection step message. */ /** - * 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. + * 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 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 AddContextListenerResponse { +export interface WebConnectionProtocol2LoadURL { /** - * 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. + * The message payload, containing data pertaining to this connection step. */ - payload: AddContextListenerResponsePayload; + 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 'Response' appended. + * Identifies the type of the connection step message. */ - type: 'addContextListenerResponse'; + type: 'WCP2LoadUrl'; } /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + * The message payload, containing data pertaining to this connection step. */ -export interface AddContextListenerResponseMeta { - requestUuid: string; - responseUuid: string; +export interface WebConnectionProtocol2LoadURLPayload { /** - * Field that represents the source application that the request being responded to was - * received from, for debugging purposes. + * 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. */ - 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; + iframeUrl: string; + [property: string]: any; } /** - * Constants representing the errors that can be encountered when calling the `open` method - * on the DesktopAgent object (`fdc3`). - * - * Constants representing the errors that can be encountered when calling the `findIntent`, - * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the - * DesktopAgent (`fdc3`). - */ -export type PurpleError = 'AccessDenied' | 'CreationFailed' | 'MalformedContext' | 'NoChannelFound'; - -/** - * 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 add an event listener for a specified event type to the Desktop Agent. + * 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 AddEventListenerRequest { +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: AddEventListenerRequestPayload; + 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: 'addEventListenerRequest'; + 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 AddEventListenerRequestPayload { +export interface WebConnectionProtocol3HandshakePayload { /** - * The type of the event to be listened to or `null` to listen to all event types. + * 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). */ - type: 'USER_CHANNEL_CHANGED' | null; + 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; } /** - * The type of a (non-context and non-intent) event that may be received via the FDC3 API's - * addEventListener function. - */ - -/** - * 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 an addEventListener 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 AddEventListenerResponse { +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. + * 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 `findIntent`, + * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the + * DesktopAgent (`fdc3`). + */ +export type PurpleError = 'AccessDenied' | 'CreationFailed' | 'MalformedContext' | 'NoChannelFound'; + +/** + * 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. + */ + +/** + * 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 addEventListener 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 AddEventListenerResponse { + /** + * 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: AddEventListenerResponsePayload; /** @@ -1086,37 +1618,33 @@ export interface EventListenerUnsubscribeResponse { */ /** - * 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. + * 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 Fdc3UserInterfaceChannels { +export interface Fdc3UserInterfaceChannelSelected { /** * The message payload. */ - payload: Fdc3UserInterfaceChannelsPayload; + payload: Fdc3UserInterfaceChannelSelectedPayload; /** * Identifies the type of the message to or from the user interface frame. */ - type: 'Fdc3UserInterfaceChannels'; + type: 'Fdc3UserInterfaceChannelSelected'; } /** * The message payload. */ -export interface Fdc3UserInterfaceChannelsPayload { +export interface Fdc3UserInterfaceChannelSelectedPayload { /** * 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[]; } /** @@ -1124,33 +1652,37 @@ export interface Fdc3UserInterfaceChannelsPayload { */ /** - * 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 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 Fdc3UserInterfaceChannelSelected { +export interface Fdc3UserInterfaceChannels { /** * The message payload. */ - payload: Fdc3UserInterfaceChannelSelectedPayload; + payload: Fdc3UserInterfaceChannelsPayload; /** * Identifies the type of the message to or from the user interface frame. */ - type: 'Fdc3UserInterfaceChannelSelected'; + type: 'Fdc3UserInterfaceChannels'; } /** * The message payload. */ -export interface Fdc3UserInterfaceChannelSelectedPayload { +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[]; } /** @@ -1397,125 +1929,6 @@ export interface AppIntent { intent: IntentMetadata; } -/** - * 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. - * - * The calling application instance's own metadata, according to the Desktop Agent (MUST - * include at least the `appId` and `instanceId`). - */ -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; -} - /** * Details of the intent whose relationship to resolving applications is being described. * @@ -1738,6 +2151,10 @@ export interface FindInstancesResponsePayload { * `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 @@ -1749,10 +2166,6 @@ export interface FindInstancesResponsePayload { * * 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 = @@ -2194,86 +2607,28 @@ export interface GetInfoResponse { /** * 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: 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: '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; -} - -/** - * 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; + meta: AddContextListenerResponseMeta; /** - * Used to indicate whether the exposure of 'originating app metadata' for - * context and intent messages is supported by the Desktop Agent. + * 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. */ - OriginatingAppMetadata: boolean; + payload: GetInfoResponsePayload; /** - * Used to indicate whether the optional `fdc3.joinUserChannel`, - * `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by - * the Desktop Agent. + * 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. */ - UserChannelMembershipAPIs: boolean; + 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; } /** @@ -2516,247 +2871,30 @@ export interface IntentEvent { * 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; -} - -/** - * 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 a context listener. - * - * A request message from an FDC3-enabled app to a Desktop Agent. - */ -export interface IntentListenerUnsubscribeRequest { - /** - * 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: 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: 'intentListenerUnsubscribeRequest'; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface IntentListenerUnsubscribeRequestPayload { - 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 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 IntentListenerUnsubscribeResponse { - /** - * 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: 'intentListenerUnsubscribeResponse'; -} - -/** - * 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 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 IntentResultRequest { - /** - * 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: 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: 'intentResultRequest'; -} - -/** - * 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; - /** - * 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 - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - -/** - * 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 IntentResultResponse { - /** - * 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: 'intentResultResponse'; -} - -/** - * 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. - */ - -/** - * 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 JoinUserChannelRequest { - /** - * 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: 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: 'joinUserChannelRequest'; -} - -/** - * The message payload typically contains the arguments to FDC3 API functions. - */ -export interface JoinUserChannelRequestPayload { - /** - * The id of the channel to join. - */ - channelId: 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 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 JoinUserChannelResponse { - /** - * 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: 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: 'joinUserChannelResponse'; + type: 'intentEvent'; } /** - * 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 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; } /** @@ -2765,11 +2903,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 IntentListenerUnsubscribeRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2777,18 +2915,20 @@ export interface LeaveCurrentChannelRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: LeaveCurrentChannelRequestPayload; + 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: 'leaveCurrentChannelRequest'; + type: 'intentListenerUnsubscribeRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface LeaveCurrentChannelRequestPayload {} +export interface IntentListenerUnsubscribeRequestPayload { + listenerUUID: string; +} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2796,12 +2936,12 @@ export interface LeaveCurrentChannelRequestPayload {} */ /** - * A response to a leaveCurrentChannel 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 LeaveCurrentChannelResponse { +export interface IntentListenerUnsubscribeResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2811,21 +2951,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: 'intentListenerUnsubscribeResponse'; } /** @@ -2834,11 +2965,13 @@ export interface LeaveCurrentChannelResponsePayload { */ /** - * A request to open an application. + * 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 OpenRequest { +export interface IntentResultRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2846,25 +2979,32 @@ export interface OpenRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: OpenRequestPayload; + 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: 'openRequest'; + type: 'intentResultRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface OpenRequestPayload { - app: AppIdentifier; +export interface IntentResultRequestPayload { /** - * 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. + * 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; } /** @@ -2873,12 +3013,12 @@ export interface OpenRequestPayload { */ /** - * A response to a open 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 OpenResponse { +export interface IntentResultResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2888,55 +3028,27 @@ export interface OpenResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: OpenResponsePayload; + 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: '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. - */ -export interface OpenResponsePayload { - error?: OpenErrorResponsePayload; - appIdentifier?: AppIdentifier; + type: 'intentResultResponse'; } -/** - * Constants representing the errors that can be encountered when calling the `open` method - * on the DesktopAgent object (`fdc3`). - * - * Constants representing the errors that can be encountered when calling the `findIntent`, - * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the - * DesktopAgent (`fdc3`). - */ -export type OpenErrorResponsePayload = - | 'MalformedContext' - | '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. + * 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 PrivateChannelAddEventListenerRequest { +export interface JoinUserChannelRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -2944,45 +3056,38 @@ export interface PrivateChannelAddEventListenerRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: TPayload; + 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: 'privateChannelAddEventListenerRequest'; + type: 'joinUserChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface TPayload { - /** - * The type of PrivateChannel event that the listener should be applied to. - */ - listenerType: PrivateChannelEventListenerTypes | null; +export interface JoinUserChannelRequestPayload { /** - * The Id of the PrivateChannel that the listener should be added to. + * The id of the channel to join. */ - privateChannelId: string; + channelId: string; } -/** - * Event listener type names for Private Channel events. - */ -export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; - /** * 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. + * 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 PrivateChannelAddEventListenerResponse { +export interface JoinUserChannelResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -2992,12 +3097,12 @@ export interface PrivateChannelAddEventListenerResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: PrivateChannelAddEventListenerResponsePayload; + 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: 'privateChannelAddEventListenerResponse'; + type: 'joinUserChannelResponse'; } /** @@ -3005,10 +3110,8 @@ export interface PrivateChannelAddEventListenerResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface PrivateChannelAddEventListenerResponsePayload { +export interface JoinUserChannelResponsePayload { error?: PurpleError; - listenerUUID?: string; - [property: string]: any; } /** @@ -3017,12 +3120,11 @@ export interface PrivateChannelAddEventListenerResponsePayload { */ /** - * Request that indicates that a participant will no longer interact with a specified - * `PrivateChannel`. + * Request to remove the app from any User channel membership. * * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface PrivateChannelDisconnectRequest { +export interface LeaveCurrentChannelRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3030,23 +3132,18 @@ export interface PrivateChannelDisconnectRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: PrivateChannelDisconnectRequestPayload; + 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: 'privateChannelDisconnectRequest'; + type: 'leaveCurrentChannelRequest'; } /** * 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 LeaveCurrentChannelRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3054,12 +3151,12 @@ export interface PrivateChannelDisconnectRequestPayload { */ /** - * A response to a privateChannelDisconnect 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 PrivateChannelDisconnectResponse { +export interface LeaveCurrentChannelResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3069,12 +3166,12 @@ export interface PrivateChannelDisconnectResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ - payload: PrivateChannelDisconnectResponsePayload; + 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: 'privateChannelDisconnectResponse'; + type: 'leaveCurrentChannelResponse'; } /** @@ -3082,7 +3179,7 @@ export interface PrivateChannelDisconnectResponse { * property containing a standardized error message indicating that the request was * unsuccessful. */ -export interface PrivateChannelDisconnectResponsePayload { +export interface LeaveCurrentChannelResponsePayload { error?: PurpleError; } @@ -3092,132 +3189,109 @@ 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 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: '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; -} - -/** - * 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 - * disconnected from a specific PrivateChannel and will no longer interact with it. + * A request to open an application. * - * A message from a Desktop Agent to an FDC3-enabled app representing an event. + * A request message from an FDC3-enabled app to a Desktop Agent. */ -export interface PrivateChannelOnDisconnectEvent { +export interface OpenRequest { /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ - meta: BroadcastEventMeta; + meta: AddContextListenerRequestMeta; /** - * The message payload contains details of the event that the app is being notified about. + * The message payload typically contains the arguments to FDC3 API functions. */ - payload: PrivateChannelOnDisconnectEventPayload; + 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 'Response' appended. + * the message relates to, e.g. 'findIntent', with 'Request' appended. */ - type: 'privateChannelOnDisconnectEvent'; + type: 'openRequest'; } /** - * The message payload contains details of the event that the app is being notified about. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface PrivateChannelOnDisconnectEventPayload { +export interface OpenRequestPayload { + app: AppIdentifier; /** - * The Id of the PrivateChannel that the app has disconnected from. + * 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. */ - privateChannelId: string; + context?: Context; } /** * 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 message relates to, e.g. 'findIntent', with 'Request' 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 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 PrivateChannelOnUnsubscribeEvent { +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: PrivateChannelOnUnsubscribeEventPayload; + 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: 'privateChannelOnUnsubscribeEvent'; + type: 'openResponse'; } /** - * 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 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; +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 `findIntent`, + * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the + * DesktopAgent (`fdc3`). + */ +export type OpenErrorResponsePayload = + | 'MalformedContext' + | '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 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 PrivateChannelUnsubscribeEventListenerRequest { +export interface PrivateChannelAddEventListenerRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3225,33 +3299,45 @@ export interface PrivateChannelUnsubscribeEventListenerRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: PrivateChannelUnsubscribeEventListenerRequestPayload; + payload: TPayload; /** * 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: 'privateChannelUnsubscribeEventListenerRequest'; + type: 'privateChannelAddEventListenerRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface PrivateChannelUnsubscribeEventListenerRequestPayload { - listenerUUID: string; +export interface TPayload { + /** + * The type of PrivateChannel event that the listener should be applied to. + */ + listenerType: PrivateChannelEventListenerTypes | null; + /** + * The Id of the PrivateChannel that the listener should be added to. + */ + privateChannelId: string; } +/** + * Event listener type names for Private Channel events. + */ +export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; + /** * 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 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 PrivateChannelUnsubscribeEventListenerResponse { +export interface PrivateChannelAddEventListenerResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3261,12 +3347,23 @@ export interface PrivateChannelUnsubscribeEventListenerResponse { * 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: 'privateChannelUnsubscribeEventListenerResponse'; + 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; + [property: string]: any; } /** @@ -3275,11 +3372,12 @@ export interface PrivateChannelUnsubscribeEventListenerResponse { */ /** - * A request to raise an unspecified intent for a specified context. + * 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 RaiseIntentForContextRequest { +export interface PrivateChannelDisconnectRequest { /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ @@ -3287,20 +3385,22 @@ export interface RaiseIntentForContextRequest { /** * The message payload typically contains the arguments to FDC3 API functions. */ - payload: RaiseIntentForContextRequestPayload; + 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: 'raiseIntentForContextRequest'; + type: 'privateChannelDisconnectRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface RaiseIntentForContextRequestPayload { - app?: AppIdentifier; - context: Context; +export interface PrivateChannelDisconnectRequestPayload { + /** + * The Id of the Channel that should be disconnected from + */ + channelId: string; } /** @@ -3309,12 +3409,12 @@ export interface RaiseIntentForContextRequestPayload { */ /** - * A response to a raiseIntentForContext request. + * 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 RaiseIntentForContextResponse { +export interface PrivateChannelDisconnectResponse { /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ @@ -3323,89 +3423,22 @@ export interface 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. - * - * 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: RaiseIntentForContextResponsePayload; + 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: 'raiseIntentForContextResponse'; + 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. - * - * 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. - */ -export interface RaiseIntentForContextResponsePayload { - /** - * 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 raiseIntentForContext request requires additional resolution (e.g. by showing - * an intent resolver) before it can be handled. - */ - 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 { - /** - * The intent that was raised. May be used to determine which intent the user - * chose in response to `fdc3.raiseIntentForContext()`. - */ - intent: 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. - */ - source: AppIdentifier; +export interface PrivateChannelDisconnectResponsePayload { + error?: PurpleError; } /** @@ -3414,96 +3447,77 @@ export interface IntentResolution { */ /** - * A request to raise an intent for a context. + * An event message from the Desktop Agent to an app indicating that another app has added a + * context listener to a specific PrivateChannel. * - * 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 RaiseIntentRequest { +export interface PrivateChannelOnAddContextListenerEvent { /** - * 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: RaiseIntentRequestPayload; + 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 'Request' appended. + * the message relates to, e.g. 'findIntent', with 'Response' appended. */ - type: 'raiseIntentRequest'; + type: 'privateChannelOnAddContextListenerEvent'; } /** - * 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 RaiseIntentRequestPayload { - app?: AppIdentifier; - context: Context; - intent: string; +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; } /** * 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 raiseIntent request. + * 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 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 RaiseIntentResponse { +export interface PrivateChannelOnDisconnectEvent { /** - * 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. - * - * 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 contains details of the event that the app is being notified about. */ - payload: RaiseIntentResponsePayload; + 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 'Response' appended. */ - type: 'raiseIntentResponse'; + type: 'privateChannelOnDisconnectEvent'; } /** - * 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. + * The message payload contains details of the event that the app is being notified about. */ -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; +export interface PrivateChannelOnDisconnectEventPayload { /** - * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent - * resolver) before it can be handled. + * The Id of the PrivateChannel that the app has disconnected from. */ - appIntent?: AppIntent; + privateChannelId: string; } /** @@ -3512,39 +3526,40 @@ export interface RaiseIntentResponsePayload { */ /** - * 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. + * 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 RaiseIntentResultResponse { +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: RaiseIntentResultResponsePayload; + 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: 'raiseIntentResultResponse'; + 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 RaiseIntentResultResponsePayload { - error?: ResponsePayloadError; - intentResult?: IntentResult; +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; } /** @@ -3553,363 +3568,422 @@ export interface RaiseIntentResultResponsePayload { */ /** - * Hello message sent by an application to a parent window or frame when attempting to - * establish connectivity to a Desktop Agent. + * A request to unsubscribe a context listener. * - * 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 PrivateChannelUnsubscribeEventListenerRequest { /** - * 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: PrivateChannelUnsubscribeEventListenerRequestPayload; /** - * 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: 'privateChannelUnsubscribeEventListenerRequest'; } /** - * Metadata for a Web Connection Protocol message. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface WebConnectionProtocol1HelloMeta { - connectionAttemptUuid: string; - timestamp: Date; +export interface PrivateChannelUnsubscribeEventListenerRequestPayload { + listenerUUID: string; } /** - * The message payload, containing data pertaining to this connection step. + * 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 WebConnectionProtocol1HelloPayload { - /** - * The current URL of the page attempting to connect. This may differ from the identityUrl, - * but the origins MUST match. - */ - actualUrl: 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. - */ - channelSelector?: boolean; + +/** + * 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 { /** - * The version of FDC3 API that the app supports. + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - fdc3Version: string; + meta: AddContextListenerResponseMeta; /** - * 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. + * 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. */ - identityUrl: string; + payload: BroadcastResponseResponsePayload; /** - * 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. + * 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. */ - intentResolver?: boolean; - [property: string]: any; + type: 'privateChannelUnsubscribeEventListenerResponse'; } /** - * 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. */ /** - * 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 to raise an unspecified intent for a specified context. * - * 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 WebConnectionProtocol2LoadURL { +export interface RaiseIntentForContextRequest { /** - * 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: WebConnectionProtocol2LoadURLPayload; + payload: RaiseIntentForContextRequestPayload; /** - * 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: 'WCP2LoadUrl'; + type: 'raiseIntentForContextRequest'; } /** - * The message payload, containing data pertaining to this connection step. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface WebConnectionProtocol2LoadURLPayload { - /** - * 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. - */ - iframeUrl: string; - [property: string]: any; +export interface RaiseIntentForContextRequestPayload { + app?: AppIdentifier; + context: Context; } /** - * 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. */ /** - * Handshake message sent by the Desktop Agent to the app (with a MessagePort appended) that - * should be used for subsequent communication steps. + * A response to a raiseIntentForContext request. * - * 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 WebConnectionProtocol3Handshake { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol3HandshakePayload; - /** - * Identifies the type of the connection step message. - */ - type: 'WCP3Handshake'; -} - -/** - * The message payload, containing data pertaining to this connection step. + * 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 WebConnectionProtocol3HandshakePayload { +export interface RaiseIntentForContextResponse { /** - * 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). + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ - channelSelectorUrl: boolean | string; + meta: AddContextListenerResponseMeta; /** - * The version of FDC3 API that the Desktop Agent will provide support for. + * 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`). */ - fdc3Version: string; + payload: RaiseIntentForContextResponsePayload; /** - * 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). + * 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. */ - intentResolverUrl: boolean | string; + type: 'raiseIntentForContextResponse'; } /** - * Identifies the type of the connection step message. - */ - -/** - * Identity Validation request from an app attempting to connect to a Desktop Agent. + * 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. * - * 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. + * 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. */ -export interface WebConnectionProtocol4ValidateAppIdentity { +export interface RaiseIntentForContextResponsePayload { /** - * Metadata for a Web Connection Protocol message. + * Should be set if the raiseIntent request returned an error. */ - meta: WebConnectionProtocol1HelloMeta; + error?: FindInstancesErrors; /** - * The message payload, containing data pertaining to this connection step. + * Used if the raiseIntent request was successfully resolved. */ - payload: WebConnectionProtocol4ValidateAppIdentityPayload; + intentResolution?: IntentResolution; /** - * Identifies the type of the connection step message. + * Used if a raiseIntentForContext request requires additional resolution (e.g. by showing + * an intent resolver) before it can be handled. */ - type: 'WCP4ValidateAppIdentity'; + appIntents?: AppIntent[]; } /** - * The message payload, containing data pertaining to this connection step. + * 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 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; +export interface IntentResolution { /** - * 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. + * The intent that was raised. May be used to determine which intent the user + * chose in response to `fdc3.raiseIntentForContext()`. */ - instanceId?: string; + intent: string; /** - * Instance UUID associated with the requested instanceId. + * 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. */ - instanceUuid?: string; + source: AppIdentifier; } /** - * 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. */ /** - * Message sent by the Desktop Agent to an app if their identity validation fails. + * A request to raise an intent for a context. * - * 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 WebConnectionProtocol5ValidateAppIdentityFailedResponse { +export interface RaiseIntentRequest { /** - * 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: WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload; + payload: RaiseIntentRequestPayload; /** - * 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: 'WCP5ValidateAppIdentityFailedResponse'; + type: 'raiseIntentRequest'; } /** - * The message payload, containing data pertaining to this connection step. + * The message payload typically contains the arguments to FDC3 API functions. */ -export interface WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload { - message?: string; +export interface RaiseIntentRequestPayload { + app?: AppIdentifier; + context: Context; + intent: 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. */ /** - * Message sent by the Desktop Agent to an app after successful identity validation. + * A response to a raiseIntent request. * - * 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 WebConnectionProtocol5ValidateAppIdentitySuccessResponse { +export interface RaiseIntentResponse { /** - * 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. + * + * 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: WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload; + payload: RaiseIntentResponsePayload; /** - * 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: 'WCP5ValidateAppIdentityResponse'; + type: 'raiseIntentResponse'; } /** - * 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. + * + * 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 WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload { - /** - * The appId that the app's identity was validated against. - */ - appId: string; +export interface RaiseIntentResponsePayload { /** - * Implementation metadata for the Desktop Agent, which includes an appMetadata element - * containing a copy of the app's own metadata. + * Should be set if the raiseIntent request returned an error. */ - implementationMetadata: ImplementationMetadata; + error?: FindInstancesErrors; /** - * The instance Id granted to the application by the Desktop Agent. + * Used if the raiseIntent request was successfully resolved. */ - instanceId: string; + intentResolution?: IntentResolution; /** - * Instance UUID associated with the instanceId granted, which may be used to retrieve the - * same instanceId if the app is reloaded or navigates. + * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent + * resolver) before it can be handled. */ - instanceUuid: string; + appIntent?: AppIntent; } /** - * 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. */ /** - * 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 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 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 WebConnectionProtocol6Goodbye { +export interface RaiseIntentResultResponse { /** - * 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: WebConnectionProtocol6GoodbyeMeta; + meta: AddContextListenerResponseMeta; /** - * 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. */ - type: 'WCP6Goodbye'; + 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: 'raiseIntentResultResponse'; } /** - * Metadata for a Web Connection Protocol 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 WebConnectionProtocol6GoodbyeMeta { - timestamp: Date; +export interface RaiseIntentResultResponsePayload { + error?: ResponsePayloadError; + intentResult?: IntentResult; } -/** - * 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. + */ + +// 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')); + } -/** - * 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; -} + public static webConnectionProtocol6GoodbyeToJson(value: WebConnectionProtocol6Goodbye): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol6Goodbye')), null, 2); + } -/** - * Metadata for a Web Connection Protocol message. - */ -export interface ConnectionStepMetadata { - timestamp: Date; - connectionAttemptUuid?: string; -} + public static toWebConnectionProtocolMessage(json: string): WebConnectionProtocolMessage { + return cast(JSON.parse(json), r('WebConnectionProtocolMessage')); + } -/** - * Identifies the type of the connection step message. - */ -export type ConnectionStepMessageType = - | 'WCP1Hello' - | 'WCP2LoadUrl' - | 'WCP3Handshake' - | 'WCP4ValidateAppIdentity' - | 'WCP5ValidateAppIdentityFailedResponse' - | 'WCP5ValidateAppIdentityResponse' - | 'WCP6Goodbye'; + public static webConnectionProtocolMessageToJson(value: WebConnectionProtocolMessage): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocolMessage')), null, 2); + } -// Converts JSON strings to/from your types -// and asserts the results of JSON.parse at runtime -export class Convert { public static toAddContextListenerRequest(json: string): AddContextListenerRequest { return cast(JSON.parse(json), r('AddContextListenerRequest')); } @@ -4062,14 +4136,6 @@ export class Convert { return JSON.stringify(uncast(value, r('EventListenerUnsubscribeResponse')), null, 2); } - public static toFdc3UserInterfaceChannels(json: string): Fdc3UserInterfaceChannels { - return cast(JSON.parse(json), r('Fdc3UserInterfaceChannels')); - } - - public static fdc3UserInterfaceChannelsToJson(value: Fdc3UserInterfaceChannels): string { - return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannels')), null, 2); - } - public static toFdc3UserInterfaceChannelSelected(json: string): Fdc3UserInterfaceChannelSelected { return cast(JSON.parse(json), r('Fdc3UserInterfaceChannelSelected')); } @@ -4078,6 +4144,14 @@ export class Convert { return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannelSelected')), null, 2); } + public static toFdc3UserInterfaceChannels(json: string): Fdc3UserInterfaceChannels { + return cast(JSON.parse(json), r('Fdc3UserInterfaceChannels')); + } + + public static fdc3UserInterfaceChannelsToJson(value: Fdc3UserInterfaceChannels): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannels')), null, 2); + } + public static toFdc3UserInterfaceDrag(json: string): Fdc3UserInterfaceDrag { return cast(JSON.parse(json), r('Fdc3UserInterfaceDrag')); } @@ -4501,80 +4575,6 @@ export class Convert { 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 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); - } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { @@ -4744,6 +4744,177 @@ function r(name: string) { } 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) }, + ], + 'any' + ), + 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: '' }], 'any'), + 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: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u(true, '') }, + { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, + { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u(true, '') }, + ], + 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 + ), AddContextListenerRequest: o( [ { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, @@ -5040,6 +5211,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), Fdc3UserInterfaceChannels: o( [ { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceChannelsPayload') }, @@ -5054,14 +5233,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), Fdc3UserInterfaceDrag: o( [ { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceDragPayload') }, @@ -5142,40 +5313,6 @@ 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, '') }, @@ -5408,24 +5545,6 @@ 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') }, @@ -5786,157 +5905,54 @@ const typeMap: any = { { json: 'intent', js: 'intent', typ: '' }, ], false - ), - RaiseIntentResponse: o( - [ - { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, - { json: 'payload', js: 'payload', typ: r('RaiseIntentResponsePayload') }, - { json: 'type', js: 'type', typ: r('RaiseIntentResponseType') }, - ], - false - ), - RaiseIntentResponsePayload: o( - [ - { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, - { json: 'intentResolution', js: 'intentResolution', typ: u(undefined, r('IntentResolution')) }, - { json: 'appIntent', js: 'appIntent', typ: u(undefined, r('AppIntent')) }, - ], - false - ), - 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) }, - ], - 'any' - ), - 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: '' }], 'any'), - 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: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u(true, '') }, - { json: 'fdc3Version', js: 'fdc3Version', typ: '' }, - { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u(true, '') }, - ], - 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: '' }, + ), + RaiseIntentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResponseType') }, ], false ), - WebConnectionProtocol6Goodbye: o( + RaiseIntentResponsePayload: o( [ - { json: 'meta', js: 'meta', typ: r('WebConnectionProtocol6GoodbyeMeta') }, - { json: 'type', js: 'type', typ: r('WebConnectionProtocol6GoodbyeType') }, + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'intentResolution', js: 'intentResolution', typ: u(undefined, r('IntentResolution')) }, + { json: 'appIntent', js: 'appIntent', typ: u(undefined, r('AppIntent')) }, ], false ), - WebConnectionProtocol6GoodbyeMeta: o([{ json: 'timestamp', js: 'timestamp', typ: Date }], false), - WebConnectionProtocolMessage: o( + RaiseIntentResultResponse: o( [ - { json: 'meta', js: 'meta', typ: r('ConnectionStepMetadata') }, - { json: 'payload', js: 'payload', typ: u(undefined, m('any')) }, - { json: 'type', js: 'type', typ: r('ConnectionStepMessageType') }, + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultResponseType') }, ], false ), - ConnectionStepMetadata: o( + RaiseIntentResultResponsePayload: o( [ - { json: 'timestamp', js: 'timestamp', typ: Date }, - { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: u(undefined, '') }, + { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, + { json: 'intentResult', js: 'intentResult', typ: u(undefined, r('IntentResult')) }, ], 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: ['AccessDenied', 'CreationFailed', 'MalformedContext', 'NoChannelFound'], AddContextListenerResponseType: ['addContextListenerResponse'], @@ -6058,8 +6074,8 @@ const typeMap: any = { CreatePrivateChannelResponseType: ['createPrivateChannelResponse'], EventListenerUnsubscribeRequestType: ['eventListenerUnsubscribeRequest'], EventListenerUnsubscribeResponseType: ['eventListenerUnsubscribeResponse'], - Fdc3UserInterfaceChannelsType: ['Fdc3UserInterfaceChannels'], Fdc3UserInterfaceChannelSelectedType: ['Fdc3UserInterfaceChannelSelected'], + Fdc3UserInterfaceChannelsType: ['Fdc3UserInterfaceChannels'], Fdc3UserInterfaceDragType: ['Fdc3UserInterfaceDrag'], Fdc3UserInterfaceHandshakeType: ['Fdc3UserInterfaceHandshake'], Fdc3UserInterfaceHelloType: ['Fdc3UserInterfaceHello'], @@ -6150,22 +6166,6 @@ 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 = @@ -6197,43 +6197,218 @@ export type AppRequestMessage = | RaiseIntentForContextRequest | RaiseIntentRequest; -export type AgentResponseMessage = - | AddContextListenerResponse - | AddEventListenerResponse - | AddIntentListenerResponse - | BroadcastResponse - | ContextListenerUnsubscribeResponse - | CreatePrivateChannelResponse - | EventListenerUnsubscribeResponse - | FindInstancesResponse - | FindIntentResponse - | FindIntentsByContextResponse - | GetAppMetadataResponse - | GetCurrentChannelResponse - | GetCurrentContextResponse - | GetInfoResponse - | GetOrCreateChannelResponse - | GetUserChannelsResponse - | IntentListenerUnsubscribeResponse - | IntentResultResponse - | JoinUserChannelResponse - | LeaveCurrentChannelResponse - | OpenResponse - | PrivateChannelAddEventListenerResponse - | PrivateChannelDisconnectResponse - | PrivateChannelUnsubscribeEventListenerResponse - | RaiseIntentForContextResponse - | RaiseIntentResponse - | RaiseIntentResultResponse; +export type AgentResponseMessage = + | AddContextListenerResponse + | AddEventListenerResponse + | AddIntentListenerResponse + | BroadcastResponse + | ContextListenerUnsubscribeResponse + | CreatePrivateChannelResponse + | EventListenerUnsubscribeResponse + | FindInstancesResponse + | FindIntentResponse + | FindIntentsByContextResponse + | GetAppMetadataResponse + | GetCurrentChannelResponse + | GetCurrentContextResponse + | GetInfoResponse + | GetOrCreateChannelResponse + | GetUserChannelsResponse + | IntentListenerUnsubscribeResponse + | IntentResultResponse + | JoinUserChannelResponse + | LeaveCurrentChannelResponse + | OpenResponse + | PrivateChannelAddEventListenerResponse + | PrivateChannelDisconnectResponse + | PrivateChannelUnsubscribeEventListenerResponse + | RaiseIntentForContextResponse + | RaiseIntentResponse + | RaiseIntentResultResponse; + +export type AgentEventMessage = + | BroadcastEvent + | ChannelChangedEvent + | HeartbeatEvent + | IntentEvent + | PrivateChannelOnAddContextListenerEvent + | PrivateChannelOnDisconnectEvent + | PrivateChannelOnUnsubscribeEvent; + +/** + * 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'; -export type AgentEventMessage = - | BroadcastEvent - | ChannelChangedEvent - | HeartbeatEvent - | IntentEvent - | PrivateChannelOnAddContextListenerEvent - | PrivateChannelOnDisconnectEvent - | PrivateChannelOnUnsubscribeEvent; +/** + * 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'; /** * 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 @@ -6572,46 +6747,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 '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 '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 'Fdc3UserInterfaceDrag'. This is a fast check that does not check the format of the message @@ -7714,178 +7889,3 @@ 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/packages/fdc3/README.md b/packages/fdc3/README.md new file mode 100644 index 000000000..67369a92a --- /dev/null +++ b/packages/fdc3/README.md @@ -0,0 +1,54 @@ +# FDC3 + +This npm module is the main entry point for the Financial Desktop Connectivity and Collaboration Consortium (FDC3) JavaScript API. + +Since version 2.2.0 this module only provides an ES6 module. Applications requiring a CommonJS module should either update to ES6 or switch to the [@finos/fdc3-commonjs module](https://npmjs.com/package/@finos/fdc3-commonjs) (provided for backwards compatibility). + +## Installation + +To install the FDC3 module, use npm: + +```bash +npm install @finos/fdc3 +``` + +## Usage + +To use the FDC3 module in your project, import it as follows: + +```javascript +import { getAgent } from '@finos/fdc3'; +// getAgent() returns the FDC3 Desktop Agent +const fdc3 = getAgent(); + +// Example usage +const contact = { + type: 'fdc3.contact', + name: 'Jane Doe', + id: { + email: 'jane@mail.com' + } +}; + +fdc3.raiseIntent('ViewProfile', contact); +``` + +## Documentation + +For detailed documentation and API reference, please visit the [official FDC3 documentation](https://fdc3.finos.org/docs/api/overview). + +## Contributing + +We welcome contributions to the FDC3 project. Please see our [contributing guidelines](https://github.com/finos/FDC3/blob/main/CONTRIBUTING.md) for more information. + +## License + +This project is licensed under the [Apache 2.0 License](LICENSE). + +## Contact + +For any questions or support, please reach out to the FDC3 community on our [Slack channel](https://finos-lf.slack.com/archives/CJ8Q8H4Q1) or [mailing list](mailto:fdc3@finos.org). + +## Further Details + +Further details are avilable in the main [FDC3 Project README](https://github.com/finos/FDC3) diff --git a/packages/fdc3/package.json b/packages/fdc3/package.json index 9bd33baaf..1706d4970 100644 --- a/packages/fdc3/package.json +++ b/packages/fdc3/package.json @@ -18,12 +18,13 @@ ], "scripts": { "clean": "npx rimraf dist", - "build": "npx tsc --module es2022" + "build": "tsc --module es2022" }, "dependencies": { - "@kite9/fdc3-standard": "2.2.0-beta.29", - "@kite9/fdc3-schema": "2.2.0-beta.29", + "@kite9/fdc3-context": "2.2.0-beta.29", "@kite9/fdc3-get-agent": "2.2.0-beta.29", - "@kite9/fdc3-context": "2.2.0-beta.29" - } + "@kite9/fdc3-schema": "2.2.0-beta.29", + "@kite9/fdc3-standard": "2.2.0-beta.29" + }, + "devDependencies": {} } \ No newline at end of file diff --git a/toolbox/fdc3-for-web/demo/package.json b/toolbox/fdc3-for-web/demo/package.json index d6846d5d7..c6a4a25ec 100644 --- a/toolbox/fdc3-for-web/demo/package.json +++ b/toolbox/fdc3-for-web/demo/package.json @@ -30,4 +30,4 @@ "uuid": "^9.0.1", "vite-express": "^0.15.0" } -} +} \ No newline at end of file diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts index 0a71f203d..85a154182 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/BroadcastHandler.ts @@ -201,7 +201,7 @@ export class BroadcastHandler implements MessageHandler { const type = arg0.payload.contextType; if (channel) { - const context = type ? (channel.context.find(c => c.type == type) ?? null) : (channel.context[0] ?? null); + const context = type ? channel.context.find(c => c.type == type) ?? null : channel.context[0] ?? null; successResponse(sc, arg0, from, { context: context }, 'getCurrentContextResponse'); } else { errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'getCurrentContextResponse');