From fbc3a7b37076c7cf44624fa477220ecaca193a01 Mon Sep 17 00:00:00 2001 From: Kris West Date: Tue, 3 Dec 2024 17:51:02 +0000 Subject: [PATCH] Applying prettier to all code, setting up commit hook and eslint configs --- .husky/pre-commit | 2 + .prettierignore | 3 +- package-lock.json | 1550 ++- package.json | 9 +- packages/fdc3-agent-proxy/eslint.config.mjs | 13 + packages/fdc3-agent-proxy/package.json | 9 +- .../fdc3-agent-proxy/src/BasicDesktopAgent.ts | 285 +- packages/fdc3-agent-proxy/src/Messaging.ts | 97 +- .../fdc3-agent-proxy/src/apps/AppSupport.ts | 15 +- .../src/apps/DefaultAppSupport.ts | 110 +- .../src/channels/ChannelSupport.ts | 21 +- .../src/channels/DefaultChannel.ts | 130 +- .../src/channels/DefaultChannelSupport.ts | 294 +- .../src/channels/DefaultPrivateChannel.ts | 179 +- .../src/handshake/DefaultHandshakeSupport.ts | 62 +- .../src/handshake/HandshakeSupport.ts | 7 +- packages/fdc3-agent-proxy/src/index.ts | 58 +- .../src/intents/DefaultIntentResolution.ts | 33 +- .../src/intents/DefaultIntentSupport.ts | 336 +- .../src/intents/IntentSupport.ts | 18 +- .../src/listeners/AbstractListener.ts | 86 +- .../src/listeners/DefaultContextListener.ts | 87 +- .../src/listeners/DefaultIntentListener.ts | 193 +- .../src/listeners/EventListener.ts | 68 +- .../src/listeners/FollowingContextListener.ts | 16 +- .../src/listeners/HeartbeatListener.ts | 74 +- .../listeners/PrivateChannelEventListener.ts | 97 +- .../src/listeners/RegisterableListener.ts | 20 +- .../src/messaging/AbstractMessaging.ts | 313 +- .../test/step-definitions/generic.steps.ts | 58 +- .../test/step-definitions/intents.steps.ts | 355 +- .../test/support/TestMessaging.ts | 405 +- .../test/support/responses/ChannelState.ts | 370 +- .../support/responses/CreatePrivateChannel.ts | 69 +- .../responses/DisconnectPrivateChannel.ts | 47 +- .../test/support/responses/FindInstances.ts | 63 +- .../test/support/responses/FindIntent.ts | 91 +- .../support/responses/FindIntentByContext.ts | 88 +- .../test/support/responses/GetAppMetadata.ts | 56 +- .../support/responses/GetOrCreateChannel.ts | 113 +- .../test/support/responses/GetUserChannels.ts | 82 +- .../test/support/responses/Handshake.ts | 88 +- .../test/support/responses/IntentResult.ts | 70 +- .../test/support/responses/Open.ts | 73 +- .../test/support/responses/RaiseIntent.ts | 308 +- .../responses/RaiseIntentForContext.ts | 297 +- .../support/responses/RegisterListeners.ts | 53 +- .../support/responses/UnsubscribeListeners.ts | 38 +- .../test/support/responses/support.ts | 22 +- packages/fdc3-agent-proxy/test/world/index.ts | 12 +- packages/fdc3-context/eslint.config.mjs | 86 +- .../generated/context/ContextTypes.ts | 3881 +++---- packages/fdc3-context/s2tQuicktypeUtil.js | 24 +- packages/fdc3-get-agent/eslint.config.mjs | 13 + packages/fdc3-get-agent/package.json | 7 +- packages/fdc3-get-agent/src/Fdc3Version.ts | 2 +- .../fdc3-get-agent/src/apps/NoopAppSupport.ts | 29 +- packages/fdc3-get-agent/src/index.ts | 25 +- .../src/messaging/AbstractWebMessaging.ts | 99 +- .../src/messaging/MessagePortMessaging.ts | 108 +- .../src/messaging/message-port.ts | 80 +- .../src/strategies/ElectronEventLoader.ts | 46 +- .../fdc3-get-agent/src/strategies/Loader.ts | 18 +- .../src/strategies/PostMessageLoader.ts | 239 +- .../src/strategies/TimeoutLoader.ts | 49 +- .../src/ui/AbstractUIComponent.ts | 247 +- .../ui/DefaultDesktopAgentChannelSelector.ts | 91 +- .../ui/DefaultDesktopAgentIntentResolver.ts | 104 +- .../src/ui/NullChannelSelector.ts | 21 +- .../src/ui/NullIntentResolver.ts | 19 +- .../channel-selector.steps.ts | 52 +- .../step-definitions/desktop-agent.steps.ts | 228 +- .../step-definitions/intent-resolver.steps.ts | 165 +- .../step-definitions/port-creation.steps.ts | 93 +- .../test/support/EventHandler.ts | 5 +- .../fdc3-get-agent/test/support/FrameTypes.ts | 219 +- .../test/support/MockCSSStyleDeclaration.ts | 13 +- .../test/support/MockDocument.ts | 55 +- .../test/support/MockElement.ts | 45 +- .../test/support/MockFDC3Server.ts | 199 +- .../fdc3-get-agent/test/support/MockIFrame.ts | 67 +- .../test/support/MockStorage.ts | 41 +- .../fdc3-get-agent/test/support/MockWindow.ts | 101 +- .../test/support/TestServerContext.ts | 300 +- .../support/responses/AutomaticResponses.ts | 11 +- .../test/support/responses/CurrentChannel.ts | 55 +- .../test/support/responses/FindIntent.ts | 77 +- .../test/support/responses/Handshake.ts | 125 +- .../test/support/responses/RaiseIntent.ts | 68 +- .../test/support/responses/UserChannels.ts | 83 +- packages/fdc3-get-agent/test/world/index.ts | 16 +- .../generate-type-predicates.ts | 193 +- packages/fdc3-schema/eslint.config.mjs | 93 +- .../fdc3-schema/generated/api/BrowserTypes.ts | 8873 +++++++++-------- .../generated/bridging/BridgingTypes.ts | 7728 +++++++------- packages/fdc3-schema/s2tQuicktypeUtil.js | 22 +- packages/fdc3-schema/src/index.ts | 4 +- packages/fdc3-standard/eslint.config.mjs | 84 +- packages/fdc3-standard/jest.config.js | 24 +- .../fdc3-standard/src/api/DesktopAgent.ts | 18 +- packages/fdc3-standard/src/api/Errors.ts | 86 +- packages/fdc3-standard/src/api/Events.ts | 45 +- packages/fdc3-standard/src/api/Methods.ts | 96 +- .../fdc3-standard/src/api/PrivateChannel.ts | 33 +- packages/fdc3-standard/src/api/Types.ts | 2 +- .../app-directory/specification/test/index.js | 6 +- packages/fdc3-standard/src/index.ts | 5 +- .../fdc3-standard/src/internal/typeHelpers.ts | 17 +- .../fdc3-standard/src/ui/ChannelSelector.ts | 24 +- packages/fdc3-standard/src/ui/Connectable.ts | 7 +- .../fdc3-standard/src/ui/IntentResolver.ts | 27 +- packages/fdc3-standard/test/Methods.test.ts | 11 +- packages/fdc3/src/index.ts | 17 +- packages/testing/src/agent/index.ts | 87 +- packages/testing/src/index.ts | 32 +- packages/testing/src/steps/generic.steps.ts | 350 +- packages/testing/src/support/matching.ts | 155 +- packages/testing/src/world/index.ts | 7 +- src/bridging/BridgingTypes.ts | 7728 +++++++------- toolbox/fdc3-explained/1.0/main.js | 13 +- toolbox/fdc3-explained/1.1/main.js | 7 +- toolbox/fdc3-explained/1.1/styles.css | 16 +- toolbox/fdc3-explained/1.2/main.js | 23 +- toolbox/fdc3-explained/1.2/styles.css | 14 +- .../fdc3-for-web/demo/src/client/apps/app1.ts | 44 +- .../fdc3-for-web/demo/src/client/apps/app2.ts | 34 +- .../fdc3-for-web/demo/src/client/apps/app3.ts | 6 +- .../fdc3-for-web/demo/src/client/apps/app4.ts | 30 +- .../fdc3-for-web/demo/src/client/apps/app5.ts | 56 +- .../fdc3-for-web/demo/src/client/apps/app6.ts | 24 +- .../fdc3-for-web/demo/src/client/apps/app7.ts | 24 +- .../demo/src/client/apps/chartiq.ts | 60 +- .../demo/src/client/da/DemoServerContext.ts | 332 +- .../src/client/da/FDC3_2_1_JSONDirectory.ts | 39 +- .../demo/src/client/da/dummy-desktop-agent.ts | 345 +- .../fdc3-for-web/demo/src/client/da/embed.ts | 95 +- .../fdc3-for-web/demo/src/client/da/util.ts | 43 +- .../demo/src/client/ui/channel-selector.ts | 250 +- .../fdc3-for-web/demo/src/client/ui/drag.ts | 104 +- .../demo/src/client/ui/intent-resolver.ts | 193 +- .../fdc3-for-web/demo/src/message-types.ts | 11 +- toolbox/fdc3-for-web/demo/src/server/main.ts | 113 +- .../fdc3-web-impl/src/BasicFDC3Server.ts | 90 +- .../fdc3-web-impl/src/FDC3Server.ts | 12 +- .../fdc3-web-impl/src/ServerContext.ts | 185 +- .../src/directory/BasicDirectory.ts | 130 +- .../src/directory/DirectoryInterface.ts | 30 +- .../src/handlers/BroadcastHandler.ts | 776 +- .../src/handlers/HeartbeatHandler.ts | 221 +- .../src/handlers/IntentHandler.ts | 1020 +- .../fdc3-web-impl/src/handlers/OpenHandler.ts | 555 +- .../fdc3-web-impl/src/handlers/support.ts | 96 +- .../fdc3-for-web/fdc3-web-impl/src/index.ts | 52 +- .../step-definitions/app-channel.steps.ts | 31 +- .../test/step-definitions/broadcast.steps.ts | 117 +- .../test/step-definitions/generic.steps.ts | 163 +- .../test/step-definitions/heartbeat.steps.ts | 51 +- .../test/step-definitions/intents.steps.ts | 534 +- .../test/step-definitions/messaging.steps.ts | 21 +- .../step-definitions/private-channel.steps.ts | 105 +- .../test/step-definitions/start-app.steps.ts | 132 +- .../step-definitions/user-channel.steps.ts | 118 +- .../test/support/TestServerContext.ts | 249 +- .../fdc3-web-impl/test/world/index.ts | 17 +- .../reference-ui/src/channel_selector.ts | 109 +- .../reference-ui/src/intent_resolver.ts | 216 +- toolbox/fdc3-for-web/reference-ui/src/main.ts | 346 +- .../fdc3-for-web/reference-ui/src/style.css | 16 +- .../fdc3-for-web/reference-ui/vite.config.ts | 10 +- toolbox/fdc3-workbench/.prettierrc | 12 +- 170 files changed, 25243 insertions(+), 21970 deletions(-) create mode 100644 .husky/pre-commit create mode 100644 packages/fdc3-agent-proxy/eslint.config.mjs create mode 100644 packages/fdc3-get-agent/eslint.config.mjs diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..a926c364e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +#!/bin/sh +npx lint-staged diff --git a/.prettierignore b/.prettierignore index 293dfa695..b79091e38 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,4 +11,5 @@ dist src/app-directory/*/target node_modules coverage -.nyc_output \ No newline at end of file +.nyc_output +build \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 68e042788..65ffc9a06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,10 @@ }, "devDependencies": { "concurrently": "^8.2.2", + "eslint-config-prettier": "^9.1.0", + "husky": "^9.1.7", "istanbul-merge": "^2.0.0", + "lint-staged": "^15.2.10", "nyc": "17.1.0", "prettier": "3.4.1" } @@ -2553,6 +2556,14 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/@eslint/js": { + "version": "9.16.0", + "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/object-schema": { "version": "2.1.4", "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", @@ -5838,20 +5849,66 @@ } }, "node_modules/cli-truncate": { - "version": "2.1.0", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "version": "4.0.0", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", "dev": true, "dependencies": { - "slice-ansi": "^3.0.0", - "string-width": "^4.2.0" + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/ansi-regex": { + "version": "6.1.0", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "10.4.0", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "7.2.0", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-truncate/node_modules/strip-ansi": { + "version": "7.1.0", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/cliui": { "version": "8.0.1", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", @@ -5971,8 +6028,8 @@ } }, "node_modules/colorette": { - "version": "1.4.0", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "version": "2.0.20", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, "node_modules/combined-stream": { @@ -6730,6 +6787,17 @@ "node": ">=6" } }, + "node_modules/environment": { + "version": "1.1.0", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/error-ex": { "version": "1.3.2", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", @@ -7459,6 +7527,11 @@ "node": ">=6" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, "node_modules/events": { "version": "3.3.0", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", @@ -8431,6 +8504,20 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "9.1.7", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/hyphenate-style-name": { "version": "1.1.0", "integrity": "sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw==", @@ -10447,227 +10534,292 @@ "node": ">= 0.8.0" } }, + "node_modules/lilconfig": { + "version": "3.1.3", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/lint-staged": { - "version": "11.2.6", - "integrity": "sha512-Vti55pUnpvPE0J9936lKl0ngVeTdSZpEdTNhASbkaWX7J5R9OEifo1INBGQuGW4zmy6OG+TcWPJ3m5yuy5Q8Tg==", + "version": "15.2.10", + "integrity": "sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==", "dev": true, "dependencies": { - "cli-truncate": "2.1.0", - "colorette": "^1.4.0", - "commander": "^8.2.0", - "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", - "enquirer": "^2.3.6", - "execa": "^5.1.1", - "listr2": "^3.12.2", - "micromatch": "^4.0.4", - "normalize-path": "^3.0.0", - "please-upgrade-node": "^3.2.0", - "string-argv": "0.3.1", - "stringify-object": "3.3.0", - "supports-color": "8.1.1" + "chalk": "~5.3.0", + "commander": "~12.1.0", + "debug": "~4.3.6", + "execa": "~8.0.1", + "lilconfig": "~3.1.2", + "listr2": "~8.2.4", + "micromatch": "~4.0.8", + "pidtree": "~0.6.0", + "string-argv": "~0.3.2", + "yaml": "~2.5.0" }, "bin": { "lint-staged": "bin/lint-staged.js" }, + "engines": { + "node": ">=18.12.0" + }, "funding": { "url": "https://opencollective.com/lint-staged" } }, - "node_modules/lint-staged/node_modules/commander": { - "version": "8.3.0", - "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.3.0", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "dev": true, "engines": { - "node": ">= 12" - } - }, - "node_modules/lint-staged/node_modules/cosmiconfig": { - "version": "7.1.0", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "dev": true, - "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, - "engines": { - "node": ">=10" + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/lint-staged/node_modules/yaml": { - "version": "1.10.2", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "node_modules/lint-staged/node_modules/commander": { + "version": "12.1.0", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "dev": true, "engines": { - "node": ">= 6" + "node": ">=18" } }, - "node_modules/listr2": { - "version": "3.14.0", - "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", + "node_modules/lint-staged/node_modules/execa": { + "version": "8.0.1", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", "dev": true, "dependencies": { - "cli-truncate": "^2.1.0", - "colorette": "^2.0.16", - "log-update": "^4.0.0", - "p-map": "^4.0.0", - "rfdc": "^1.3.0", - "rxjs": "^7.5.1", - "through": "^2.3.8", - "wrap-ansi": "^7.0.0" + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" }, "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "enquirer": ">= 2.3.0 < 3" + "node": ">=16.17" }, - "peerDependenciesMeta": { - "enquirer": { - "optional": true - } + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/listr2/node_modules/ansi-styles": { - "version": "4.3.0", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/lint-staged/node_modules/get-stream": { + "version": "8.0.1", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=16" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/listr2/node_modules/color-convert": { - "version": "2.0.1", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/lint-staged/node_modules/human-signals": { + "version": "5.0.0", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, "engines": { - "node": ">=7.0.0" + "node": ">=16.17.0" } }, - "node_modules/listr2/node_modules/color-name": { - "version": "1.1.4", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/listr2/node_modules/colorette": { - "version": "2.0.20", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true + "node_modules/lint-staged/node_modules/is-stream": { + "version": "3.0.0", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/listr2/node_modules/p-map": { + "node_modules/lint-staged/node_modules/mimic-fn": { "version": "4.0.0", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", "dev": true, - "dependencies": { - "aggregate-error": "^3.0.0" - }, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/listr2/node_modules/wrap-ansi": { - "version": "7.0.0", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/lint-staged/node_modules/npm-run-path": { + "version": "5.3.0", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "path-key": "^4.0.0" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/locate-path": { + "node_modules/lint-staged/node_modules/onetime": { "version": "6.0.0", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, "dependencies": { - "p-locate": "^5.0.0" + "mimic-fn": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", - "dev": true - }, - "node_modules/lodash.flattendeep": { - "version": "4.4.0", - "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==" - }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" - }, - "node_modules/lodash.mergewith": { - "version": "4.6.2", - "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "node_modules/lint-staged/node_modules/path-key": { + "version": "4.0.0", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-update": { - "version": "4.0.0", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "node_modules/lint-staged/node_modules/string-argv": { + "version": "0.3.2", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/lint-staged/node_modules/strip-final-newline": { + "version": "3.0.0", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lint-staged/node_modules/yaml": { + "version": "2.5.1", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/listr2": { + "version": "8.2.5", + "integrity": "sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==", "dev": true, "dependencies": { - "ansi-escapes": "^4.3.0", - "cli-cursor": "^3.1.0", - "slice-ansi": "^4.0.0", - "wrap-ansi": "^6.2.0" + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.1.0", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/listr2/node_modules/emoji-regex": { + "version": "10.4.0", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "dev": true + }, + "node_modules/listr2/node_modules/string-width": { + "version": "7.2.0", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "9.0.0", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": { + "p-locate": "^5.0.0" }, "engines": { "node": ">=10" @@ -10676,63 +10828,227 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-update/node_modules/ansi-styles": { + "node_modules/lodash": { + "version": "4.17.21", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.camelcase": { "version": "4.3.0", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true + }, + "node_modules/lodash.flattendeep": { + "version": "4.4.0", + "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==" + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update": { + "version": "6.1.0", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-escapes": { + "version": "7.0.0", + "integrity": "sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==", + "dev": true, + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.1.0", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/log-update/node_modules/color-convert": { - "version": "2.0.1", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/log-update/node_modules/cli-cursor": { + "version": "5.0.0", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "restore-cursor": "^5.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-update/node_modules/color-name": { - "version": "1.1.4", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "node_modules/log-update/node_modules/emoji-regex": { + "version": "10.4.0", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", "dev": true }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/onetime": { + "version": "7.0.0", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/restore-cursor": { + "version": "5.1.0", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/log-update/node_modules/slice-ansi": { - "version": "4.0.0", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "version": "7.1.0", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/log-update/node_modules/wrap-ansi": { - "version": "6.2.0", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "node_modules/log-update/node_modules/string-width": { + "version": "7.2.0", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "9.0.0", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/long": { @@ -10949,6 +11265,17 @@ "node": ">=6" } }, + "node_modules/mimic-function": { + "version": "5.0.1", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "3.1.2", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", @@ -12076,6 +12403,17 @@ "integrity": "sha512-FoR3TDfuLlqUvcEeK5ifpKSVVns6B4BQvc8SDF6THVMuadya6LLtji0QgUDSStw0ZR2J7I6UGi5V2V23rnPWTw==", "dev": true }, + "node_modules/pidtree": { + "version": "0.6.0", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pirates": { "version": "4.0.6", "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", @@ -13522,48 +13860,42 @@ } }, "node_modules/slice-ansi": { - "version": "3.0.0", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "version": "5.0.0", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "version": "6.2.1", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12" }, "funding": { "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, "engines": { - "node": ">=7.0.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/socket.io": { "version": "4.8.1", "integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==", @@ -14719,65 +15051,316 @@ "is-typed-array": "^1.1.13" }, "engines": { - "node": ">= 0.4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.3", + "integrity": "sha512-GsvTyUHTriq6o/bHcTd0vM7OQ9JEdlvluu9YISaA7+KzDzPaIzEeDFNkTfhdE3MYcNhNi0vq/LlegYgIs5yPAw==", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "5.7.2", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.17.0", + "integrity": "sha512-409VXvFd/f1br1DCbuKNFqQpXICoTB+V51afcwG1pn1a3Cp92MqAUges3YjwEdQ0cMUoCIodjVDAYzyD8h3SYA==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.17.0", + "@typescript-eslint/parser": "8.17.0", + "@typescript-eslint/utils": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.17.0", + "integrity": "sha512-HU1KAdW3Tt8zQkdvNoIijfWDMvdSweFYm4hWh+KwhPstv+sCmWb89hCIP8msFm9N1R/ooh9honpSuvqKWlYy3w==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/type-utils": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/parser": { + "version": "8.17.0", + "integrity": "sha512-Drp39TXuUlD49F7ilHHCG7TTg8IkA+hxCuULdmzWYICxGXvDXmDmWEjJYZQYgf6l/TFfYNE167m7isnc3xlIEg==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/scope-manager": { + "version": "8.17.0", + "integrity": "sha512-/ewp4XjvnxaREtqsZjF4Mfn078RD/9GmiEAtTeLQ7yFdKnqwTOgRMSvFz4et9U5RiJQ15WTGXPLj89zGusvxBg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/type-utils": { + "version": "8.17.0", + "integrity": "sha512-q38llWJYPd63rRnJ6wY/ZQqIzPrBCkPdpIsaCfkR3Q4t3p6sb422zougfad4TFW9+ElIFLVDzWGiGAfbb/v2qw==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "8.17.0", + "@typescript-eslint/utils": "8.17.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/types": { + "version": "8.17.0", + "integrity": "sha512-gY2TVzeve3z6crqh2Ic7Cr+CAv6pfb0Egee7J5UAVWCpVvDI/F71wNfolIim4FE6hT15EbpZFVUj9j5i38jYXA==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/typescript-estree": { + "version": "8.17.0", + "integrity": "sha512-JqkOopc1nRKZpX+opvKqnM3XUlM7LpFMD0lYxTqOTKQfCWAmxw45e3qlOCsEqEB2yuacujivudOFpCnqkBDNMw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/visitor-keys": "8.17.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/typescript-eslint/node_modules/@typescript-eslint/utils": { + "version": "8.17.0", + "integrity": "sha512-bQC8BnEkxqG8HBGKwG9wXlZqg37RKSMY7v/X8VEWD8JG2JuTHuNK0VFvMPMUKQcbk6B+tf05k+4AShAEtCtJ/w==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.17.0", + "@typescript-eslint/types": "8.17.0", + "@typescript-eslint/typescript-estree": "8.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/typed-array-byte-offset": { - "version": "1.0.3", - "integrity": "sha512-GsvTyUHTriq6o/bHcTd0vM7OQ9JEdlvluu9YISaA7+KzDzPaIzEeDFNkTfhdE3MYcNhNi0vq/LlegYgIs5yPAw==", + "node_modules/typescript-eslint/node_modules/@typescript-eslint/visitor-keys": { + "version": "8.17.0", + "integrity": "sha512-1Hm7THLpO6ww5QU6H/Qp+AusUUl+z/CAm3cNZZ0jQvon9yicgO7Rwd+/WWRpMKLYV6p2UvdbR27c86rzCPpreg==", + "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13", - "reflect.getprototypeof": "^1.0.6" + "@typescript-eslint/types": "8.17.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/typed-array-length": { - "version": "1.0.7", - "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "node_modules/typescript-eslint/node_modules/brace-expansion": { + "version": "2.0.1", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "is-typed-array": "^1.1.13", - "possible-typed-array-names": "^1.0.0", - "reflect.getprototypeof": "^1.0.6" - }, + "balanced-match": "^1.0.0" + } + }, + "node_modules/typescript-eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/eslint" } }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "node_modules/typescript-eslint/node_modules/minimatch": { + "version": "9.0.5", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, "dependencies": { - "is-typedarray": "^1.0.0" + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/typescript": { - "version": "5.7.2", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "node_modules/typescript-eslint/node_modules/semver": { + "version": "7.6.3", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "semver": "bin/semver.js" }, "engines": { - "node": ">=14.17" + "node": ">=10" } }, "node_modules/typical": { @@ -16050,6 +16633,7 @@ "@cucumber/cucumber": "10.3.1", "@cucumber/html-formatter": "11.0.4", "@cucumber/pretty-formatter": "1.0.1", + "@eslint/js": "^9.16.0", "@kite9/testing": "2.2.0-beta.29", "@types/expect": "24.3.0", "@types/lodash": "4.14.167", @@ -16058,11 +16642,12 @@ "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.0", "cucumber-console-formatter": "1.0.0", - "eslint": "8.57.0", - "eslint-config-prettier": "9.1.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "3.3.1", "expect": "^29.7.0", + "globals": "^15.13.0", "is-ci": "2.0.0", "jsonpath-plus": "^10.1.0", "nyc": "15.1.0", @@ -16071,6 +16656,7 @@ "ts-node": "^10.9.2", "tsx": "^4.19.1", "typescript": "^5.6.3", + "typescript-eslint": "^8.17.0", "uuid": "^9.0.1" } }, @@ -16760,19 +17346,72 @@ }, "devDependencies": { "@cucumber/cucumber": "10.3.1", + "@eslint/js": "^9.16.0", "@kite9/fdc3-web-impl": "2.2.0-beta.29", "@kite9/testing": "2.2.0-beta.29", "@types/node": "^20.14.11", "@types/wtfnode": "^0.7.3", + "eslint": "^9.16.0", + "eslint-config-prettier": "^9.1.0", "expect": "^29.7.0", + "globals": "^15.13.0", "jsonpath-plus": "^10.1.0", "nyc": "15.1.0", "rimraf": "^6.0.1", "tsx": "^4.19.1", "typescript": "^5.6.3", + "typescript-eslint": "^8.17.0", "wtfnode": "^0.9.3" } }, + "packages/fdc3-get-agent/node_modules/@eslint/config-array": { + "version": "0.19.0", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "packages/fdc3-get-agent/node_modules/@eslint/core": { + "version": "0.9.0", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "packages/fdc3-get-agent/node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "packages/fdc3-get-agent/node_modules/ajv": { + "version": "6.12.6", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "packages/fdc3-get-agent/node_modules/ansi-styles": { "version": "4.3.0", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", @@ -16792,32 +17431,184 @@ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "packages/fdc3-get-agent/node_modules/color-convert": { + "version": "2.0.1", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "packages/fdc3-get-agent/node_modules/color-name": { + "version": "1.1.4", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "packages/fdc3-get-agent/node_modules/convert-source-map": { + "version": "1.9.0", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "packages/fdc3-get-agent/node_modules/eslint": { + "version": "9.16.0", + "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.16.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.5", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "packages/fdc3-get-agent/node_modules/eslint-scope": { + "version": "8.2.0", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/fdc3-get-agent/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "packages/fdc3-get-agent/node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/fdc3-get-agent/node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/fdc3-get-agent/node_modules/eslint/node_modules/p-limit": { + "version": "3.1.0", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/fdc3-get-agent/node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "packages/fdc3-get-agent/node_modules/color-convert": { - "version": "2.0.1", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "packages/fdc3-get-agent/node_modules/file-entry-cache": { + "version": "8.0.0", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "dependencies": { - "color-name": "~1.1.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=16.0.0" } }, - "packages/fdc3-get-agent/node_modules/color-name": { - "version": "1.1.4", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "packages/fdc3-get-agent/node_modules/convert-source-map": { - "version": "1.9.0", - "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true - }, "packages/fdc3-get-agent/node_modules/find-up": { "version": "4.1.0", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", @@ -16830,6 +17621,18 @@ "node": ">=8" } }, + "packages/fdc3-get-agent/node_modules/flat-cache": { + "version": "4.0.1", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, "packages/fdc3-get-agent/node_modules/foreground-child": { "version": "2.0.0", "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", @@ -16876,6 +17679,11 @@ "node": ">=8" } }, + "packages/fdc3-get-agent/node_modules/json-schema-traverse": { + "version": "0.4.1", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, "packages/fdc3-get-agent/node_modules/locate-path": { "version": "5.0.0", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", @@ -18541,6 +19349,234 @@ "vite": "^5.4.9", "web-vitals": "^1.1.2" } + }, + "toolbox/fdc3-workbench/node_modules/ansi-styles": { + "version": "4.3.0", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "toolbox/fdc3-workbench/node_modules/cli-truncate": { + "version": "2.1.0", + "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "dependencies": { + "slice-ansi": "^3.0.0", + "string-width": "^4.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "toolbox/fdc3-workbench/node_modules/color-convert": { + "version": "2.0.1", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "toolbox/fdc3-workbench/node_modules/color-name": { + "version": "1.1.4", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "toolbox/fdc3-workbench/node_modules/colorette": { + "version": "1.4.0", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, + "toolbox/fdc3-workbench/node_modules/commander": { + "version": "8.3.0", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "toolbox/fdc3-workbench/node_modules/cosmiconfig": { + "version": "7.1.0", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "toolbox/fdc3-workbench/node_modules/lint-staged": { + "version": "11.2.6", + "integrity": "sha512-Vti55pUnpvPE0J9936lKl0ngVeTdSZpEdTNhASbkaWX7J5R9OEifo1INBGQuGW4zmy6OG+TcWPJ3m5yuy5Q8Tg==", + "dev": true, + "dependencies": { + "cli-truncate": "2.1.0", + "colorette": "^1.4.0", + "commander": "^8.2.0", + "cosmiconfig": "^7.0.1", + "debug": "^4.3.2", + "enquirer": "^2.3.6", + "execa": "^5.1.1", + "listr2": "^3.12.2", + "micromatch": "^4.0.4", + "normalize-path": "^3.0.0", + "please-upgrade-node": "^3.2.0", + "string-argv": "0.3.1", + "stringify-object": "3.3.0", + "supports-color": "8.1.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "toolbox/fdc3-workbench/node_modules/listr2": { + "version": "3.14.0", + "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", + "dev": true, + "dependencies": { + "cli-truncate": "^2.1.0", + "colorette": "^2.0.16", + "log-update": "^4.0.0", + "p-map": "^4.0.0", + "rfdc": "^1.3.0", + "rxjs": "^7.5.1", + "through": "^2.3.8", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "enquirer": ">= 2.3.0 < 3" + }, + "peerDependenciesMeta": { + "enquirer": { + "optional": true + } + } + }, + "toolbox/fdc3-workbench/node_modules/listr2/node_modules/colorette": { + "version": "2.0.20", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "toolbox/fdc3-workbench/node_modules/log-update": { + "version": "4.0.0", + "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.0", + "cli-cursor": "^3.1.0", + "slice-ansi": "^4.0.0", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "toolbox/fdc3-workbench/node_modules/log-update/node_modules/slice-ansi": { + "version": "4.0.0", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "toolbox/fdc3-workbench/node_modules/log-update/node_modules/wrap-ansi": { + "version": "6.2.0", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "toolbox/fdc3-workbench/node_modules/p-map": { + "version": "4.0.0", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "toolbox/fdc3-workbench/node_modules/slice-ansi": { + "version": "3.0.0", + "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "toolbox/fdc3-workbench/node_modules/wrap-ansi": { + "version": "7.0.0", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "toolbox/fdc3-workbench/node_modules/yaml": { + "version": "1.10.2", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } } } } diff --git a/package.json b/package.json index 2952cca57..f7ced66b6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "report": "nyc report --reporter json-summary --report-dir nyc-coverage-report --exclude-after-remap false --temp-dir coverage", "lint": "npm run lint --workspaces --if-present", "syncpack": "npm exec syncpack fix-mismatches --types 'local'", - "dev": "concurrently \"cd toolbox/fdc3-workbench && npm run dev\" \"cd toolbox/fdc3-for-web/reference-ui && npm run dev\" \"cd toolbox/fdc3-for-web/demo && npm run dev\"" + "dev": "concurrently \"cd toolbox/fdc3-workbench && npm run dev\" \"cd toolbox/fdc3-for-web/reference-ui && npm run dev\" \"cd toolbox/fdc3-for-web/demo && npm run dev\"", + "prepare": "husky" }, "prettier": { "semi": true, @@ -53,8 +54,14 @@ }, "devDependencies": { "concurrently": "^8.2.2", + "eslint-config-prettier": "^9.1.0", + "husky": "^9.1.7", "istanbul-merge": "^2.0.0", + "lint-staged": "^15.2.10", "nyc": "17.1.0", "prettier": "3.4.1" + }, + "lint-staged": { + "**/*": "prettier --write --ignore-unknown" } } diff --git a/packages/fdc3-agent-proxy/eslint.config.mjs b/packages/fdc3-agent-proxy/eslint.config.mjs new file mode 100644 index 000000000..c7018a2c8 --- /dev/null +++ b/packages/fdc3-agent-proxy/eslint.config.mjs @@ -0,0 +1,13 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import eslintConfigPrettier from 'eslint-config-prettier'; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + { files: ['**/*.{js,mjs,cjs,ts}'] }, + { languageOptions: { globals: globals.browser } }, + pluginJs.configs.recommended, + ...tseslint.configs.recommended, + eslintConfigPrettier, +]; diff --git a/packages/fdc3-agent-proxy/package.json b/packages/fdc3-agent-proxy/package.json index 39a13b5db..4ca44b3a4 100644 --- a/packages/fdc3-agent-proxy/package.json +++ b/packages/fdc3-agent-proxy/package.json @@ -28,6 +28,7 @@ "@cucumber/cucumber": "10.3.1", "@cucumber/html-formatter": "11.0.4", "@cucumber/pretty-formatter": "1.0.1", + "@eslint/js": "^9.16.0", "@kite9/testing": "2.2.0-beta.29", "@types/expect": "24.3.0", "@types/lodash": "4.14.167", @@ -36,11 +37,12 @@ "@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/parser": "7.1.0", "cucumber-console-formatter": "1.0.0", - "eslint": "8.57.0", - "eslint-config-prettier": "9.1.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-prettier": "3.3.1", "expect": "^29.7.0", + "globals": "^15.13.0", "is-ci": "2.0.0", "jsonpath-plus": "^10.1.0", "nyc": "15.1.0", @@ -49,6 +51,7 @@ "ts-node": "^10.9.2", "tsx": "^4.19.1", "typescript": "^5.6.3", + "typescript-eslint": "^8.17.0", "uuid": "^9.0.1" } -} \ No newline at end of file +} diff --git a/packages/fdc3-agent-proxy/src/BasicDesktopAgent.ts b/packages/fdc3-agent-proxy/src/BasicDesktopAgent.ts index 9fd77be3f..322cc8b1f 100644 --- a/packages/fdc3-agent-proxy/src/BasicDesktopAgent.ts +++ b/packages/fdc3-agent-proxy/src/BasicDesktopAgent.ts @@ -1,139 +1,156 @@ -import { AppIdentifier, AppMetadata, ContextHandler, DesktopAgent, EventHandler, FDC3EventTypes, ImplementationMetadata, IntentHandler, IntentResolution, Listener } from "@kite9/fdc3-standard"; -import { ChannelSupport } from "./channels/ChannelSupport"; -import { AppSupport } from "./apps/AppSupport"; -import { IntentSupport } from "./intents/IntentSupport"; -import { HandshakeSupport } from "./handshake/HandshakeSupport"; -import { Connectable } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; +import { + AppIdentifier, + AppMetadata, + ContextHandler, + DesktopAgent, + EventHandler, + FDC3EventTypes, + ImplementationMetadata, + IntentHandler, + IntentResolution, + Listener, +} from '@kite9/fdc3-standard'; +import { ChannelSupport } from './channels/ChannelSupport'; +import { AppSupport } from './apps/AppSupport'; +import { IntentSupport } from './intents/IntentSupport'; +import { HandshakeSupport } from './handshake/HandshakeSupport'; +import { Connectable } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; /** - * This splits out the functionality of the desktop agent into + * This splits out the functionality of the desktop agent into * app, channels and intents concerns. */ export class BasicDesktopAgent implements DesktopAgent, Connectable { - - readonly handshake: HandshakeSupport - readonly channels: ChannelSupport - readonly intents: IntentSupport - readonly apps: AppSupport - readonly connectables: Connectable[] - - constructor(handshake: HandshakeSupport, channels: ChannelSupport, intents: IntentSupport, apps: AppSupport, connectables: Connectable[]) { - this.handshake = handshake - this.intents = intents - this.channels = channels - this.apps = apps - this.connectables = connectables - } - - async addEventListener(type: FDC3EventTypes | null, handler: EventHandler): Promise { - switch (type) { - case "userChannelChanged": return this.channels.addChannelChangedEventHandler(handler); - default: - throw new Error("UnknownEventType") - } - } - - async getInfo(): Promise { - return this.handshake.getImplementationMetadata() - } - - async broadcast(context: Context): Promise { - const channel = await this.channels.getUserChannel() - if (channel) { - return channel.broadcast(context) - } else { - return Promise.resolve(); - } - } - - async addContextListener(context: ContextHandler | string | null, handler?: ContextHandler): Promise { - const theHandler: ContextHandler = handler ? handler : (context as ContextHandler) - const theContextType: string | null = context && handler ? (context as string) : null - return this.channels.addContextListener(theHandler, theContextType) - } - - getUserChannels() { - return this.channels.getUserChannels() - } - - getSystemChannels() { - return this.channels.getUserChannels() - } - - getOrCreateChannel(channelId: string) { - return this.channels.getOrCreate(channelId) - } - - createPrivateChannel() { - return this.channels.createPrivateChannel() - } - - leaveCurrentChannel() { - return this.channels.leaveUserChannel() - } - - joinUserChannel(channelId: string) { - return this.channels.joinUserChannel(channelId) - } - - joinChannel(channelId: string) { - return this.channels.joinUserChannel(channelId) - } - - getCurrentChannel() { - return this.channels.getUserChannel(); - } - - findIntent(intent: string, context: Context, resultType: string | undefined) { - return this.intents.findIntent(intent, context, resultType) - } - - findIntentsByContext(context: Context) { - return this.intents.findIntentsByContext(context) - } - - private ensureAppId(app?: any): AppIdentifier | undefined { - if (typeof app === "string") { - return { - appId: app - } - } else if (app?.appId) { - return app as AppIdentifier - } else { - return undefined; - } - } - - raiseIntent(intent: string, context: Context, app?: any) { - return this.intents.raiseIntent(intent, context, this.ensureAppId(app)) - } - - addIntentListener(intent: string, handler: IntentHandler) { - return this.intents.addIntentListener(intent, handler) - } - - raiseIntentForContext(context: Context, app?: any): Promise { - return this.intents.raiseIntentForContext(context, this.ensureAppId(app)) - } - - open(app: any, context?: Context | undefined) { - return this.apps.open(this.ensureAppId(app)!, context) - } - - findInstances(app: AppIdentifier) { - return this.apps.findInstances(app) - } - - getAppMetadata(app: AppIdentifier): Promise { - return this.apps.getAppMetadata(app); - } - - async disconnect(): Promise { - await Promise.all(this.connectables.map(c => c.disconnect())) - } - - async connect(): Promise { - await Promise.all(this.connectables.map(c => c.connect())) - } -} \ No newline at end of file + readonly handshake: HandshakeSupport; + readonly channels: ChannelSupport; + readonly intents: IntentSupport; + readonly apps: AppSupport; + readonly connectables: Connectable[]; + + constructor( + handshake: HandshakeSupport, + channels: ChannelSupport, + intents: IntentSupport, + apps: AppSupport, + connectables: Connectable[] + ) { + this.handshake = handshake; + this.intents = intents; + this.channels = channels; + this.apps = apps; + this.connectables = connectables; + } + + async addEventListener(type: FDC3EventTypes | null, handler: EventHandler): Promise { + switch (type) { + case 'userChannelChanged': + return this.channels.addChannelChangedEventHandler(handler); + default: + throw new Error('UnknownEventType'); + } + } + + async getInfo(): Promise { + return this.handshake.getImplementationMetadata(); + } + + async broadcast(context: Context): Promise { + const channel = await this.channels.getUserChannel(); + if (channel) { + return channel.broadcast(context); + } else { + return Promise.resolve(); + } + } + + async addContextListener(context: ContextHandler | string | null, handler?: ContextHandler): Promise { + const theHandler: ContextHandler = handler ? handler : (context as ContextHandler); + const theContextType: string | null = context && handler ? (context as string) : null; + return this.channels.addContextListener(theHandler, theContextType); + } + + getUserChannels() { + return this.channels.getUserChannels(); + } + + getSystemChannels() { + return this.channels.getUserChannels(); + } + + getOrCreateChannel(channelId: string) { + return this.channels.getOrCreate(channelId); + } + + createPrivateChannel() { + return this.channels.createPrivateChannel(); + } + + leaveCurrentChannel() { + return this.channels.leaveUserChannel(); + } + + joinUserChannel(channelId: string) { + return this.channels.joinUserChannel(channelId); + } + + joinChannel(channelId: string) { + return this.channels.joinUserChannel(channelId); + } + + getCurrentChannel() { + return this.channels.getUserChannel(); + } + + findIntent(intent: string, context: Context, resultType: string | undefined) { + return this.intents.findIntent(intent, context, resultType); + } + + findIntentsByContext(context: Context) { + return this.intents.findIntentsByContext(context); + } + + private ensureAppId(app?: any): AppIdentifier | undefined { + if (typeof app === 'string') { + return { + appId: app, + }; + } else if (app?.appId) { + return app as AppIdentifier; + } else { + return undefined; + } + } + + raiseIntent(intent: string, context: Context, app?: any) { + return this.intents.raiseIntent(intent, context, this.ensureAppId(app)); + } + + addIntentListener(intent: string, handler: IntentHandler) { + return this.intents.addIntentListener(intent, handler); + } + + raiseIntentForContext(context: Context, app?: any): Promise { + return this.intents.raiseIntentForContext(context, this.ensureAppId(app)); + } + + open(app: any, context?: Context | undefined) { + return this.apps.open(this.ensureAppId(app)!, context); + } + + findInstances(app: AppIdentifier) { + return this.apps.findInstances(app); + } + + getAppMetadata(app: AppIdentifier): Promise { + return this.apps.getAppMetadata(app); + } + + async disconnect(): Promise { + await Promise.all(this.connectables.map(c => c.disconnect())); + } + + async connect(): Promise { + await Promise.all(this.connectables.map(c => c.connect())); + } +} diff --git a/packages/fdc3-agent-proxy/src/Messaging.ts b/packages/fdc3-agent-proxy/src/Messaging.ts index 912183ea9..25f5e552e 100644 --- a/packages/fdc3-agent-proxy/src/Messaging.ts +++ b/packages/fdc3-agent-proxy/src/Messaging.ts @@ -1,52 +1,51 @@ -import { Connectable, AppIdentifier, ImplementationMetadata } from "@kite9/fdc3-standard"; -import { RegisterableListener } from "./listeners/RegisterableListener"; -import { AppRequestMessage } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; +import { Connectable, AppIdentifier, ImplementationMetadata } from '@kite9/fdc3-standard'; +import { RegisterableListener } from './listeners/RegisterableListener'; +import { AppRequestMessage } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; -type RequestMetadata = AppRequestMessage["meta"]; +type RequestMetadata = AppRequestMessage['meta']; export interface Messaging extends Connectable { - - /** - * Source for outgoing message - */ - getSource(): AppIdentifier - - /** - * UUID for outgoing message - */ - createUUID(): string; - - /** - * Post an outgoing message - */ - post(message: object): Promise - - /** - * Registers a listener for incoming messages. - */ - register(l: RegisterableListener): void - - /** - * Unregisters a listener with the id given above - * @param id - */ - unregister(id: string): void - - createMeta(): RequestMetadata - - /** - * Waits for a specific matching message - */ - waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise - - /** - * - * @param message Performs a request / response message pass - */ - exchange(message: object, expectedTypeName: string, timeoutErrorMessage?: string): Promise - - /** - * Implementation metadata retrieved through the validation process - */ - getImplementationMetadata(): Promise -} \ No newline at end of file + /** + * Source for outgoing message + */ + getSource(): AppIdentifier; + + /** + * UUID for outgoing message + */ + createUUID(): string; + + /** + * Post an outgoing message + */ + post(message: object): Promise; + + /** + * Registers a listener for incoming messages. + */ + register(l: RegisterableListener): void; + + /** + * Unregisters a listener with the id given above + * @param id + */ + unregister(id: string): void; + + createMeta(): RequestMetadata; + + /** + * Waits for a specific matching message + */ + waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise; + + /** + * + * @param message Performs a request / response message pass + */ + exchange(message: object, expectedTypeName: string, timeoutErrorMessage?: string): Promise; + + /** + * Implementation metadata retrieved through the validation process + */ + getImplementationMetadata(): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/apps/AppSupport.ts b/packages/fdc3-agent-proxy/src/apps/AppSupport.ts index faa61e9c8..62f0ff180 100644 --- a/packages/fdc3-agent-proxy/src/apps/AppSupport.ts +++ b/packages/fdc3-agent-proxy/src/apps/AppSupport.ts @@ -1,13 +1,10 @@ -import { AppIdentifier, AppMetadata } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; - +import { AppIdentifier, AppMetadata } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; export interface AppSupport { + findInstances(app: AppIdentifier): Promise>; - findInstances(app: AppIdentifier): Promise> - - getAppMetadata(app: AppIdentifier): Promise - - open(app: AppIdentifier, context?: Context): Promise + getAppMetadata(app: AppIdentifier): Promise; -} \ No newline at end of file + open(app: AppIdentifier, context?: Context): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts b/packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts index 074d7dcd7..bdfb2d922 100644 --- a/packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts +++ b/packages/fdc3-agent-proxy/src/apps/DefaultAppSupport.ts @@ -1,66 +1,64 @@ -import { AppIdentifier, AppMetadata, OpenError } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; -import { AppSupport } from "./AppSupport"; -import { Messaging } from "../Messaging"; -import { BrowserTypes } from "@kite9/fdc3-schema" +import { AppIdentifier, AppMetadata, OpenError } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; +import { AppSupport } from './AppSupport'; +import { Messaging } from '../Messaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type FindInstancesRequest = BrowserTypes.FindInstancesRequest -type GetAppMetadataResponse = BrowserTypes.GetAppMetadataResponse -type FindInstancesResponse = BrowserTypes.FindInstancesResponse -type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest -type OpenRequest = BrowserTypes.OpenRequest +type FindInstancesRequest = BrowserTypes.FindInstancesRequest; +type GetAppMetadataResponse = BrowserTypes.GetAppMetadataResponse; +type FindInstancesResponse = BrowserTypes.FindInstancesResponse; +type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest; +type OpenRequest = BrowserTypes.OpenRequest; export class DefaultAppSupport implements AppSupport { + readonly messaging: Messaging; - readonly messaging: Messaging + constructor(messaging: Messaging) { + this.messaging = messaging; + } - constructor(messaging: Messaging) { - this.messaging = messaging - } + findInstances(app: AppIdentifier): Promise { + const request: FindInstancesRequest = { + type: 'findInstancesRequest', + payload: { + app, + }, + meta: this.messaging.createMeta() as any, + }; - findInstances(app: AppIdentifier): Promise { - const request: FindInstancesRequest = { - type: "findInstancesRequest", - payload: { - app - }, - meta: this.messaging.createMeta() as any - } + return this.messaging.exchange(request, 'findInstancesResponse').then(d => { + return d.payload.appIdentifiers!!; + }); + } - return this.messaging.exchange(request, "findInstancesResponse").then(d => { - return d.payload.appIdentifiers!! - }); - } + getAppMetadata(app: AppIdentifier): Promise { + const request: GetAppMetadataRequest = { + type: 'getAppMetadataRequest', + payload: { + app: app as AppIdentifier, + }, + meta: this.messaging.createMeta() as any, + }; - getAppMetadata(app: AppIdentifier): Promise { - const request: GetAppMetadataRequest = { - type: "getAppMetadataRequest", - payload: { - app: app as AppIdentifier - }, - meta: this.messaging.createMeta() as any - } + return this.messaging.exchange(request, 'getAppMetadataResponse').then(d => { + return d.payload.appMetadata!!; + }); + } - return this.messaging.exchange(request, "getAppMetadataResponse").then(d => { - return d.payload.appMetadata!! - }); - } + async open(app: AppIdentifier, context?: Context | undefined): Promise { + const request = { + type: 'openRequest', + payload: { + app: { + appId: app.appId, + instanceId: app.instanceId, + }, + context, + }, + meta: this.messaging.createMeta() as any, + } as OpenRequest; - async open(app: AppIdentifier, context?: Context | undefined): Promise { - const request = { - type: "openRequest", - payload: { - app: { - appId: app.appId, - instanceId: app.instanceId, - }, - context - }, - meta: this.messaging.createMeta() as any - } as OpenRequest - - const out = await this.messaging.exchange(request, "openResponse", OpenError.AppTimeout) - return out.payload.appIdentifier - } - -} \ No newline at end of file + const out = await this.messaging.exchange(request, 'openResponse', OpenError.AppTimeout); + return out.payload.appIdentifier; + } +} diff --git a/packages/fdc3-agent-proxy/src/channels/ChannelSupport.ts b/packages/fdc3-agent-proxy/src/channels/ChannelSupport.ts index 840d5baec..d1edbd448 100644 --- a/packages/fdc3-agent-proxy/src/channels/ChannelSupport.ts +++ b/packages/fdc3-agent-proxy/src/channels/ChannelSupport.ts @@ -1,20 +1,19 @@ -import { Channel, ContextHandler, EventHandler, Listener, PrivateChannel } from "@kite9/fdc3-standard" +import { Channel, ContextHandler, EventHandler, Listener, PrivateChannel } from '@kite9/fdc3-standard'; export interface ChannelSupport { + getUserChannel(): Promise; - getUserChannel(): Promise + getUserChannels(): Promise; - getUserChannels(): Promise + getOrCreate(id: string): Promise; - getOrCreate(id: string): Promise + createPrivateChannel(): Promise; - createPrivateChannel(): Promise + leaveUserChannel(): Promise; - leaveUserChannel(): Promise + joinUserChannel(id: string): Promise; - joinUserChannel(id: string): Promise + addContextListener(handler: ContextHandler, type: string | null): Promise; - addContextListener(handler: ContextHandler, type: string | null): Promise - - addChannelChangedEventHandler(handler: EventHandler): Promise -} \ No newline at end of file + addChannelChangedEventHandler(handler: EventHandler): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts b/packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts index 21902c111..c4b4f4cdd 100644 --- a/packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts +++ b/packages/fdc3-agent-proxy/src/channels/DefaultChannel.ts @@ -1,80 +1,78 @@ -import { ContextHandler, DisplayMetadata, Listener, Channel } from "@kite9/fdc3-standard" -import { Context } from "@kite9/fdc3-context"; +import { ContextHandler, DisplayMetadata, Listener, Channel } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; -import { Messaging } from "../Messaging" -import { DefaultContextListener } from "../listeners/DefaultContextListener" -import { BrowserTypes } from "@kite9/fdc3-schema" +import { Messaging } from '../Messaging'; +import { DefaultContextListener } from '../listeners/DefaultContextListener'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type BroadcastRequest = BrowserTypes.BroadcastRequest -type BroadcastResponse = BrowserTypes.BroadcastResponse -type GetCurrentContextResponse = BrowserTypes.GetCurrentContextResponse -type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest +type BroadcastRequest = BrowserTypes.BroadcastRequest; +type BroadcastResponse = BrowserTypes.BroadcastResponse; +type GetCurrentContextResponse = BrowserTypes.GetCurrentContextResponse; +type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest; export class DefaultChannel implements Channel { + readonly messaging: Messaging; + readonly id: string; + readonly type: 'user' | 'app' | 'private'; + readonly displayMetadata?: DisplayMetadata | undefined; - readonly messaging: Messaging - readonly id: string - readonly type: "user" | "app" | "private" - readonly displayMetadata?: DisplayMetadata | undefined; + constructor(messaging: Messaging, id: string, type: 'user' | 'app' | 'private', displayMetadata?: DisplayMetadata) { + this.messaging = messaging; + this.id = id; + this.type = type; + this.displayMetadata = displayMetadata; + } - constructor(messaging: Messaging, id: string, type: "user" | "app" | "private", displayMetadata?: DisplayMetadata) { - this.messaging = messaging - this.id = id - this.type = type - this.displayMetadata = displayMetadata - } - - async broadcast(context: Context): Promise { - const request: BroadcastRequest = { - meta: this.messaging.createMeta(), - payload: { - channelId: this.id, - context - }, - type: "broadcastRequest" - }; - await this.messaging.exchange(request, 'broadcastResponse') - } - - async getCurrentContext(contextType?: string | undefined): Promise { - const request: GetCurrentContextRequest = { - meta: this.messaging.createMeta(), - payload: { - channelId: this.id, - contextType: contextType ?? null - }, - type: "getCurrentContextRequest" - }; + async broadcast(context: Context): Promise { + const request: BroadcastRequest = { + meta: this.messaging.createMeta(), + payload: { + channelId: this.id, + context, + }, + type: 'broadcastRequest', + }; + await this.messaging.exchange(request, 'broadcastResponse'); + } - // first, ensure channel state is up-to-date - const response = await this.messaging.exchange(request, 'getCurrentContextResponse') + async getCurrentContext(contextType?: string | undefined): Promise { + const request: GetCurrentContextRequest = { + meta: this.messaging.createMeta(), + payload: { + channelId: this.id, + contextType: contextType ?? null, + }, + type: 'getCurrentContextRequest', + }; - return response.payload.context ?? null - } + // first, ensure channel state is up-to-date + const response = await this.messaging.exchange(request, 'getCurrentContextResponse'); - async addContextListener(contextType: any, handler?: ContextHandler): Promise { - let theContextType: string | null - let theHandler: ContextHandler + return response.payload.context ?? null; + } - if (contextType == null) { - theContextType = null; - theHandler = handler as ContextHandler; - } else if (typeof contextType === 'string') { - theContextType = contextType - theHandler = handler as ContextHandler; - } else { - // deprecated one-arg version - theContextType = null; - theHandler = contextType as ContextHandler; - } + async addContextListener(contextType: any, handler?: ContextHandler): Promise { + let theContextType: string | null; + let theHandler: ContextHandler; - return await this.addContextListenerInner(theContextType, theHandler); + if (contextType == null) { + theContextType = null; + theHandler = handler as ContextHandler; + } else if (typeof contextType === 'string') { + theContextType = contextType; + theHandler = handler as ContextHandler; + } else { + // deprecated one-arg version + theContextType = null; + theHandler = contextType as ContextHandler; } - async addContextListenerInner(contextType: string | null, theHandler: ContextHandler): Promise { - const listener = new DefaultContextListener(this.messaging, this.id, contextType, theHandler); - await listener.register() - return listener - } -} + return await this.addContextListenerInner(theContextType, theHandler); + } + async addContextListenerInner(contextType: string | null, theHandler: ContextHandler): Promise { + const listener = new DefaultContextListener(this.messaging, this.id, contextType, theHandler); + await listener.register(); + return listener; + } +} diff --git a/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts b/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts index 9636ee8d0..71aff9578 100644 --- a/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts +++ b/packages/fdc3-agent-proxy/src/channels/DefaultChannelSupport.ts @@ -1,152 +1,160 @@ -import { Channel, ContextHandler, Listener, PrivateChannel, ChannelSelector, EventHandler } from "@kite9/fdc3-standard"; -import { Messaging } from "../Messaging"; -import { ChannelSupport } from "./ChannelSupport"; -import { DefaultPrivateChannel } from "./DefaultPrivateChannel"; -import { DefaultChannel } from "./DefaultChannel"; -import { DefaultContextListener } from "../listeners/DefaultContextListener"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { FollowingContextListener } from "../listeners/FollowingContextListener"; -import { EventListener } from "../listeners/EventListener"; - -type ChannelDetail = BrowserTypes.Channel -type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest -type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse -type GetOrCreateChannelResponse = BrowserTypes.GetOrCreateChannelResponse -type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest -type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest -type CreatePrivateChannelResponse = BrowserTypes.CreatePrivateChannelResponse -type JoinUserChannelResponse = BrowserTypes.JoinUserChannelResponse -type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest -type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse -type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest -type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest -type LeaveCurrentChannelResponse = BrowserTypes.LeaveCurrentChannelResponse +import { Channel, ContextHandler, Listener, PrivateChannel, ChannelSelector, EventHandler } from '@kite9/fdc3-standard'; +import { Messaging } from '../Messaging'; +import { ChannelSupport } from './ChannelSupport'; +import { DefaultPrivateChannel } from './DefaultPrivateChannel'; +import { DefaultChannel } from './DefaultChannel'; +import { DefaultContextListener } from '../listeners/DefaultContextListener'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { FollowingContextListener } from '../listeners/FollowingContextListener'; +import { EventListener } from '../listeners/EventListener'; + +type ChannelDetail = BrowserTypes.Channel; +type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest; +type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse; +type GetOrCreateChannelResponse = BrowserTypes.GetOrCreateChannelResponse; +type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest; +type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest; +type CreatePrivateChannelResponse = BrowserTypes.CreatePrivateChannelResponse; +type JoinUserChannelResponse = BrowserTypes.JoinUserChannelResponse; +type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest; +type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse; +type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest; +type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest; +type LeaveCurrentChannelResponse = BrowserTypes.LeaveCurrentChannelResponse; export class DefaultChannelSupport implements ChannelSupport { - - protected userChannels: Channel[] | null = null - private followingListeners: FollowingContextListener[] = [] - - constructor(private readonly messaging: Messaging, private readonly channelSelector: ChannelSelector) { - this.channelSelector.setChannelChangeCallback((channelId: string | null) => { - if (channelId == null) { - this.leaveUserChannel() - } else { - this.joinUserChannel(channelId) - } - }) - - this.addChannelChangedEventHandler((e) => { - this.channelSelector.updateChannel(e.details.newChannelId, this.userChannels ?? []) - }) - } - - async addChannelChangedEventHandler(handler: EventHandler): Promise { - const listener = new EventListener(this.messaging, "channelChangedEvent", handler) - await listener.register() - return listener - } - - async getUserChannel(): Promise { - const request: GetCurrentChannelRequest = { - meta: this.messaging.createMeta(), - type: 'getCurrentChannelRequest', - payload: {} - }; - const response = await this.messaging.exchange(request, 'getCurrentChannelResponse') - - if (response.payload?.channel?.id) { - return new DefaultChannel(this.messaging, response.payload.channel.id, "user", response.payload.channel.displayMetadata) - } else { - return null - } + protected userChannels: Channel[] | null = null; + private followingListeners: FollowingContextListener[] = []; + + constructor( + private readonly messaging: Messaging, + private readonly channelSelector: ChannelSelector + ) { + this.channelSelector.setChannelChangeCallback((channelId: string | null) => { + if (channelId == null) { + this.leaveUserChannel(); + } else { + this.joinUserChannel(channelId); + } + }); + + this.addChannelChangedEventHandler(e => { + this.channelSelector.updateChannel(e.details.newChannelId, this.userChannels ?? []); + }); + } + + async addChannelChangedEventHandler(handler: EventHandler): Promise { + const listener = new EventListener(this.messaging, 'channelChangedEvent', handler); + await listener.register(); + return listener; + } + + async getUserChannel(): Promise { + const request: GetCurrentChannelRequest = { + meta: this.messaging.createMeta(), + type: 'getCurrentChannelRequest', + payload: {}, + }; + const response = await this.messaging.exchange(request, 'getCurrentChannelResponse'); + + if (response.payload?.channel?.id) { + return new DefaultChannel( + this.messaging, + response.payload.channel.id, + 'user', + response.payload.channel.displayMetadata + ); + } else { + return null; } - - async getUserChannels(): Promise { - if (!this.userChannels) { - const request: GetUserChannelsRequest = { - meta: this.messaging.createMeta(), - type: 'getUserChannelsRequest', - payload: {} - }; - const response = await this.messaging.exchange(request, 'getUserChannelsResponse') - - const channels: ChannelDetail[] = response.payload.userChannels ?? [] - this.userChannels = channels.map(c => new DefaultChannel(this.messaging, c.id, "user", c.displayMetadata)); - } - return this.userChannels + } + + async getUserChannels(): Promise { + if (!this.userChannels) { + const request: GetUserChannelsRequest = { + meta: this.messaging.createMeta(), + type: 'getUserChannelsRequest', + payload: {}, + }; + const response = await this.messaging.exchange(request, 'getUserChannelsResponse'); + + const channels: ChannelDetail[] = response.payload.userChannels ?? []; + this.userChannels = channels.map(c => new DefaultChannel(this.messaging, c.id, 'user', c.displayMetadata)); } - - async getOrCreate(id: string): Promise { - const request: GetOrCreateChannelRequest = { - meta: this.messaging.createMeta(), - type: 'getOrCreateChannelRequest', - payload: { - channelId: id - } - }; - const response = await this.messaging.exchange(request, 'getOrCreateChannelResponse') - - return new DefaultChannel(this.messaging, id, "app", response.payload.channel?.displayMetadata!!) + return this.userChannels; + } + + async getOrCreate(id: string): Promise { + const request: GetOrCreateChannelRequest = { + meta: this.messaging.createMeta(), + type: 'getOrCreateChannelRequest', + payload: { + channelId: id, + }, + }; + const response = await this.messaging.exchange(request, 'getOrCreateChannelResponse'); + + return new DefaultChannel(this.messaging, id, 'app', response.payload.channel?.displayMetadata!!); + } + + async createPrivateChannel(): Promise { + const request: CreatePrivateChannelRequest = { + meta: this.messaging.createMeta(), + type: 'createPrivateChannelRequest', + payload: {}, + }; + const response = await this.messaging.exchange( + request, + 'createPrivateChannelResponse' + ); + + return new DefaultPrivateChannel(this.messaging, response.payload?.privateChannel?.id!!); + } + + async leaveUserChannel(): Promise { + const request: LeaveCurrentChannelRequest = { + meta: this.messaging.createMeta(), + type: 'leaveCurrentChannelRequest', + payload: {}, + }; + await this.messaging.exchange(request, 'leaveCurrentChannelResponse'); + + this.channelSelector.updateChannel(null, this.userChannels ?? []); + this.followingListeners.forEach(l => l.changeChannel(null)); + } + + async joinUserChannel(id: string) { + const request: JoinUserChannelRequest = { + meta: this.messaging.createMeta(), + type: 'joinUserChannelRequest', + payload: { + channelId: id, + }, + }; + await this.messaging.exchange(request, 'joinUserChannelResponse'); + + this.channelSelector.updateChannel(id, this.userChannels ?? []); + + for (const l of this.followingListeners) { + await l.changeChannel(new DefaultChannel(this.messaging, id, 'user')); } + } - async createPrivateChannel(): Promise { - const request: CreatePrivateChannelRequest = { - meta: this.messaging.createMeta(), - type: 'createPrivateChannelRequest', - payload: {} - }; - const response = await this.messaging.exchange(request, 'createPrivateChannelResponse') + async addContextListener(handler: ContextHandler, type: string | null): Promise { + const _container = this; - return new DefaultPrivateChannel(this.messaging, response.payload?.privateChannel?.id!!) + class UnsubscribingDefaultContextListener extends DefaultContextListener { + async unsubscribe(): Promise { + super.unsubscribe(); + _container.followingListeners = _container.followingListeners.filter(l => l != this); + } } - async leaveUserChannel(): Promise { - const request: LeaveCurrentChannelRequest = { - meta: this.messaging.createMeta(), - type: 'leaveCurrentChannelRequest', - payload: {} - }; - await this.messaging.exchange(request, 'leaveCurrentChannelResponse') - - this.channelSelector.updateChannel(null, this.userChannels ?? []) - this.followingListeners.forEach(l => l.changeChannel(null)) - } - - async joinUserChannel(id: string) { - const request: JoinUserChannelRequest = { - meta: this.messaging.createMeta(), - type: 'joinUserChannelRequest', - payload: { - channelId: id - } - }; - await this.messaging.exchange(request, 'joinUserChannelResponse') - - this.channelSelector.updateChannel(id, this.userChannels ?? []) - - for (const l of this.followingListeners) { - await l.changeChannel(new DefaultChannel(this.messaging, id, "user")) - } - } - - async addContextListener(handler: ContextHandler, type: string | null): Promise { - const _container = this - - class UnsubscribingDefaultContextListener extends DefaultContextListener { - async unsubscribe(): Promise { - super.unsubscribe() - _container.followingListeners = _container.followingListeners.filter(l => l != this) - } - } - - const currentChannel = await this.getUserChannel(); - const currentChannelId = currentChannel?.id ?? null - const listener = new UnsubscribingDefaultContextListener(this.messaging, currentChannelId, type, handler) - this.followingListeners.push(listener) - await listener.register() - return listener - } - - -} \ No newline at end of file + const currentChannel = await this.getUserChannel(); + const currentChannelId = currentChannel?.id ?? null; + const listener = new UnsubscribingDefaultContextListener(this.messaging, currentChannelId, type, handler); + this.followingListeners.push(listener); + await listener.register(); + return listener; + } +} diff --git a/packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts b/packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts index 2eea647bf..00635c921 100644 --- a/packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts +++ b/packages/fdc3-agent-proxy/src/channels/DefaultPrivateChannel.ts @@ -1,95 +1,110 @@ -import { ApiEvent, ContextHandler, EventHandler, Listener, PrivateChannel, PrivateChannelEventTypes } from "@kite9/fdc3-standard"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { DefaultChannel } from "./DefaultChannel"; -import { Messaging } from "../Messaging"; -import { PrivateChannelEventListenerType, PrivateChannelEventListenerVoid } from "../listeners/PrivateChannelEventListener"; -import { DefaultContextListener } from "../listeners/DefaultContextListener"; - -type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest -type PrivateChannelDisconnectResponse = BrowserTypes.PrivateChannelDisconnectResponse - +import { + ApiEvent, + ContextHandler, + EventHandler, + Listener, + PrivateChannel, + PrivateChannelEventTypes, +} from '@kite9/fdc3-standard'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { DefaultChannel } from './DefaultChannel'; +import { Messaging } from '../Messaging'; +import { + PrivateChannelEventListenerType, + PrivateChannelEventListenerVoid, +} from '../listeners/PrivateChannelEventListener'; +import { DefaultContextListener } from '../listeners/DefaultContextListener'; +type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest; +type PrivateChannelDisconnectResponse = BrowserTypes.PrivateChannelDisconnectResponse; export class DefaultPrivateChannel extends DefaultChannel implements PrivateChannel { + constructor(messaging: Messaging, id: string) { + super(messaging, id, 'private'); + } - constructor(messaging: Messaging, id: string) { - super(messaging, id, "private") + async addEventListener(type: PrivateChannelEventTypes | null, handler: EventHandler): Promise { + function wrapEventHandlerString(): (m: string) => void { + return (m: string) => { + handler({ + type, + details: m, + } as ApiEvent); + }; } - async addEventListener(type: PrivateChannelEventTypes | null, handler: EventHandler): Promise { - - function wrapEventHandlerString(): (m: string) => void { - return (m: string) => { - handler({ - type, - details: m - } as ApiEvent) - } - } - - function wrapEventHandlerVoid(): () => void { - return () => { - handler({ - type - } as ApiEvent) - } - } - - switch (type) { - case "addContextListener": { - const a = new PrivateChannelEventListenerType(this.messaging, this.id, "onAddContextListener", wrapEventHandlerString()); - await a.register() - return a; - } - case "unsubscribe": { - const u = new PrivateChannelEventListenerType(this.messaging, this.id, "onUnsubscribe", wrapEventHandlerString()); - await u.register() - return u; - } - case "disconnect": { - const d = new PrivateChannelEventListenerVoid(this.messaging, this.id, wrapEventHandlerVoid()); - await d.register() - return d; - } - default: { - throw new Error(`Unsupported event type: ${type}`) - } - } - + function wrapEventHandlerVoid(): () => void { + return () => { + handler({ + type, + } as ApiEvent); + }; } - onAddContextListener(handler: (contextType?: string | undefined) => void): Listener { - const l = new PrivateChannelEventListenerType(this.messaging, this.id, "onAddContextListener", handler); - l.register() - return l; + switch (type) { + case 'addContextListener': { + const a = new PrivateChannelEventListenerType( + this.messaging, + this.id, + 'onAddContextListener', + wrapEventHandlerString() + ); + await a.register(); + return a; + } + case 'unsubscribe': { + const u = new PrivateChannelEventListenerType( + this.messaging, + this.id, + 'onUnsubscribe', + wrapEventHandlerString() + ); + await u.register(); + return u; + } + case 'disconnect': { + const d = new PrivateChannelEventListenerVoid(this.messaging, this.id, wrapEventHandlerVoid()); + await d.register(); + return d; + } + default: { + throw new Error(`Unsupported event type: ${type}`); + } } + } - onUnsubscribe(handler: (contextType?: string | undefined) => void): Listener { - const l = new PrivateChannelEventListenerType(this.messaging, this.id, "onUnsubscribe", handler); - l.register() - return l; - } + onAddContextListener(handler: (contextType?: string | undefined) => void): Listener { + const l = new PrivateChannelEventListenerType(this.messaging, this.id, 'onAddContextListener', handler); + l.register(); + return l; + } - onDisconnect(handler: () => void): Listener { - const l = new PrivateChannelEventListenerVoid(this.messaging, this.id, handler); - l.register() - return l; - } + onUnsubscribe(handler: (contextType?: string | undefined) => void): Listener { + const l = new PrivateChannelEventListenerType(this.messaging, this.id, 'onUnsubscribe', handler); + l.register(); + return l; + } - async disconnect(): Promise { - const request: PrivateChannelDisconnectRequest = { - meta: this.messaging.createMeta(), - payload: { - channelId: this.id, - }, - type: "privateChannelDisconnectRequest" - }; - await this.messaging.exchange(request, 'privateChannelDisconnectResponse') - } + onDisconnect(handler: () => void): Listener { + const l = new PrivateChannelEventListenerVoid(this.messaging, this.id, handler); + l.register(); + return l; + } - async addContextListenerInner(contextType: string | null, theHandler: ContextHandler): Promise { - const listener = new DefaultContextListener(this.messaging, this.id, contextType, theHandler); - await listener.register() - return listener - } -} \ No newline at end of file + async disconnect(): Promise { + const request: PrivateChannelDisconnectRequest = { + meta: this.messaging.createMeta(), + payload: { + channelId: this.id, + }, + type: 'privateChannelDisconnectRequest', + }; + await this.messaging.exchange(request, 'privateChannelDisconnectResponse'); + } + + async addContextListenerInner(contextType: string | null, theHandler: ContextHandler): Promise { + const listener = new DefaultContextListener(this.messaging, this.id, contextType, theHandler); + await listener.register(); + return listener; + } +} diff --git a/packages/fdc3-agent-proxy/src/handshake/DefaultHandshakeSupport.ts b/packages/fdc3-agent-proxy/src/handshake/DefaultHandshakeSupport.ts index 15ecd6d66..fe304d7c6 100644 --- a/packages/fdc3-agent-proxy/src/handshake/DefaultHandshakeSupport.ts +++ b/packages/fdc3-agent-proxy/src/handshake/DefaultHandshakeSupport.ts @@ -1,42 +1,40 @@ -import { WebConnectionProtocol6Goodbye } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; -import { HeartbeatListener } from "../listeners/HeartbeatListener"; -import { Messaging } from "../Messaging"; -import { HandshakeSupport } from "./HandshakeSupport"; -import { ImplementationMetadata } from "@kite9/fdc3-standard"; +import { WebConnectionProtocol6Goodbye } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +import { HeartbeatListener } from '../listeners/HeartbeatListener'; +import { Messaging } from '../Messaging'; +import { HandshakeSupport } from './HandshakeSupport'; +import { ImplementationMetadata } from '@kite9/fdc3-standard'; /** * Handles connection, disconnection and heartbeats for the proxy. * This will possibly eventually need extending to allow for auth handshaking. */ export class DefaultHandshakeSupport implements HandshakeSupport { + readonly messaging: Messaging; + private heartbeatListener: HeartbeatListener | null = null; - readonly messaging: Messaging - private heartbeatListener: HeartbeatListener | null = null + constructor(messaging: Messaging) { + this.messaging = messaging; + } - constructor(messaging: Messaging) { - this.messaging = messaging - } + async connect(): Promise { + await this.messaging.connect(); + this.heartbeatListener = new HeartbeatListener(this.messaging); + this.heartbeatListener.register(); + } - async connect(): Promise { - await this.messaging.connect() - this.heartbeatListener = new HeartbeatListener(this.messaging) - this.heartbeatListener.register() - } + async disconnect(): Promise { + await this.heartbeatListener?.unsubscribe(); + const message: WebConnectionProtocol6Goodbye = { + type: 'WCP6Goodbye', + meta: { + timestamp: new Date(), + }, + }; + await this.messaging.post(message); + return this.messaging.disconnect(); + } - async disconnect(): Promise { - await this.heartbeatListener?.unsubscribe() - const message: WebConnectionProtocol6Goodbye = { - type: 'WCP6Goodbye', - meta: { - timestamp: new Date(), - } - } - await this.messaging.post(message) - return this.messaging.disconnect() - } - - async getImplementationMetadata(): Promise { - return this.messaging.getImplementationMetadata() - } - -} \ No newline at end of file + async getImplementationMetadata(): Promise { + return this.messaging.getImplementationMetadata(); + } +} diff --git a/packages/fdc3-agent-proxy/src/handshake/HandshakeSupport.ts b/packages/fdc3-agent-proxy/src/handshake/HandshakeSupport.ts index 913f08273..af088bf27 100644 --- a/packages/fdc3-agent-proxy/src/handshake/HandshakeSupport.ts +++ b/packages/fdc3-agent-proxy/src/handshake/HandshakeSupport.ts @@ -1,10 +1,9 @@ -import { ImplementationMetadata, Connectable } from "@kite9/fdc3-standard" +import { ImplementationMetadata, Connectable } from '@kite9/fdc3-standard'; /** * Handles messaging around connection and disconnection of the proxy * to the server. */ export interface HandshakeSupport extends Connectable { - - getImplementationMetadata(): Promise -} \ No newline at end of file + getImplementationMetadata(): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/index.ts b/packages/fdc3-agent-proxy/src/index.ts index 052dae607..06ed857ae 100644 --- a/packages/fdc3-agent-proxy/src/index.ts +++ b/packages/fdc3-agent-proxy/src/index.ts @@ -1,36 +1,36 @@ -import { BasicDesktopAgent } from "./BasicDesktopAgent"; -import { Messaging } from "./Messaging"; -import { AbstractMessaging } from "./messaging/AbstractMessaging"; +import { BasicDesktopAgent } from './BasicDesktopAgent'; +import { Messaging } from './Messaging'; +import { AbstractMessaging } from './messaging/AbstractMessaging'; -import { DefaultChannel } from "./channels/DefaultChannel"; -import { ChannelSupport } from "./channels/ChannelSupport"; +import { DefaultChannel } from './channels/DefaultChannel'; +import { ChannelSupport } from './channels/ChannelSupport'; -import { DefaultIntentSupport } from "./intents/DefaultIntentSupport"; -import { DefaultChannelSupport } from "./channels/DefaultChannelSupport"; -import { IntentSupport } from "./intents/IntentSupport"; -import { RegisterableListener } from "./listeners/RegisterableListener"; +import { DefaultIntentSupport } from './intents/DefaultIntentSupport'; +import { DefaultChannelSupport } from './channels/DefaultChannelSupport'; +import { IntentSupport } from './intents/IntentSupport'; +import { RegisterableListener } from './listeners/RegisterableListener'; -import { DefaultAppSupport } from "./apps/DefaultAppSupport"; -import { AppSupport } from "./apps/AppSupport"; +import { DefaultAppSupport } from './apps/DefaultAppSupport'; +import { AppSupport } from './apps/AppSupport'; -import { HandshakeSupport } from "./handshake/HandshakeSupport"; -import { DefaultHandshakeSupport } from "./handshake/DefaultHandshakeSupport"; +import { HandshakeSupport } from './handshake/HandshakeSupport'; +import { DefaultHandshakeSupport } from './handshake/DefaultHandshakeSupport'; -import { Connectable } from "@kite9/fdc3-standard"; +import { Connectable } from '@kite9/fdc3-standard'; export { - type Messaging, - AbstractMessaging, - BasicDesktopAgent, - DefaultChannel, - type AppSupport, - type IntentSupport, - type ChannelSupport, - DefaultAppSupport, - DefaultChannelSupport, - DefaultIntentSupport, - type HandshakeSupport, - DefaultHandshakeSupport, - RegisterableListener, - Connectable, -} \ No newline at end of file + type Messaging, + AbstractMessaging, + BasicDesktopAgent, + DefaultChannel, + type AppSupport, + type IntentSupport, + type ChannelSupport, + DefaultAppSupport, + DefaultChannelSupport, + DefaultIntentSupport, + type HandshakeSupport, + DefaultHandshakeSupport, + RegisterableListener, + Connectable, +}; diff --git a/packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts b/packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts index 29036616a..6217b975c 100644 --- a/packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts +++ b/packages/fdc3-agent-proxy/src/intents/DefaultIntentResolution.ts @@ -1,21 +1,20 @@ -import { AppIdentifier, IntentResolution, IntentResult } from "@kite9/fdc3-standard"; -import { Messaging } from "../Messaging"; +import { AppIdentifier, IntentResolution, IntentResult } from '@kite9/fdc3-standard'; +import { Messaging } from '../Messaging'; export class DefaultIntentResolution implements IntentResolution { + readonly messaging: Messaging; + readonly source: AppIdentifier; + readonly intent: string; + readonly result: Promise; - readonly messaging: Messaging - readonly source: AppIdentifier; - readonly intent: string; - readonly result: Promise + constructor(messaging: Messaging, result: Promise, source: AppIdentifier, intent: string) { + this.messaging = messaging; + this.result = result; + this.source = source; + this.intent = intent; + } - constructor(messaging: Messaging, result: Promise, source: AppIdentifier, intent: string) { - this.messaging = messaging - this.result = result - this.source = source - this.intent = intent - } - - getResult(): Promise { - return this.result - } -} \ No newline at end of file + getResult(): Promise { + return this.result; + } +} diff --git a/packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts b/packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts index 8a4c2eaeb..f87771cc4 100644 --- a/packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts +++ b/packages/fdc3-agent-proxy/src/intents/DefaultIntentSupport.ts @@ -1,176 +1,194 @@ -import { AppIntent, AppIdentifier, IntentResolution, IntentHandler, Listener, ResolveError, IntentResult, IntentResolver, IntentResolutionChoice } from "@kite9/fdc3-standard"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { IntentSupport } from "./IntentSupport"; -import { Messaging } from "../Messaging"; -import { DefaultIntentResolution } from "./DefaultIntentResolution"; -import { DefaultIntentListener } from "../listeners/DefaultIntentListener"; -import { DefaultChannel } from "../channels/DefaultChannel"; -import { DefaultPrivateChannel } from "../channels/DefaultPrivateChannel"; -import { Context } from "@kite9/fdc3-context"; - -type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest -type RaiseIntentForContextResponse = BrowserTypes.RaiseIntentForContextResponse -type FindIntentResponse = BrowserTypes.FindIntentResponse -type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest -type FindIntentsByContextResponse = BrowserTypes.FindIntentsByContextResponse -type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest -type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse -type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse -type FindIntentRequest = BrowserTypes.FindIntentRequest - -const convertIntentResult = async ({payload}: RaiseIntentResultResponse, messaging: Messaging): Promise => { - const result = payload.intentResult; - if(result?.channel){ - const {channel} = result; - switch(channel.type){ - case "private": { - return new DefaultPrivateChannel(messaging, channel.id); - } - case "app": - case "user": - default: { - return new DefaultChannel(messaging, channel.id, channel.type, channel.displayMetadata); - } +import { + AppIntent, + AppIdentifier, + IntentResolution, + IntentHandler, + Listener, + ResolveError, + IntentResult, + IntentResolver, + IntentResolutionChoice, +} from '@kite9/fdc3-standard'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { IntentSupport } from './IntentSupport'; +import { Messaging } from '../Messaging'; +import { DefaultIntentResolution } from './DefaultIntentResolution'; +import { DefaultIntentListener } from '../listeners/DefaultIntentListener'; +import { DefaultChannel } from '../channels/DefaultChannel'; +import { DefaultPrivateChannel } from '../channels/DefaultPrivateChannel'; +import { Context } from '@kite9/fdc3-context'; + +type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest; +type RaiseIntentForContextResponse = BrowserTypes.RaiseIntentForContextResponse; +type FindIntentResponse = BrowserTypes.FindIntentResponse; +type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest; +type FindIntentsByContextResponse = BrowserTypes.FindIntentsByContextResponse; +type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest; +type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse; +type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse; +type FindIntentRequest = BrowserTypes.FindIntentRequest; + +const convertIntentResult = async ( + { payload }: RaiseIntentResultResponse, + messaging: Messaging +): Promise => { + const result = payload.intentResult; + if (result?.channel) { + const { channel } = result; + switch (channel.type) { + case 'private': { + return new DefaultPrivateChannel(messaging, channel.id); + } + case 'app': + case 'user': + default: { + return new DefaultChannel(messaging, channel.id, channel.type, channel.displayMetadata); } - } else if(result?.context){ - return result.context; - } else { - return; } + } else if (result?.context) { + return result.context; + } else { + return; } +}; export class DefaultIntentSupport implements IntentSupport { + readonly messaging: Messaging; + readonly intentResolver: IntentResolver; - readonly messaging: Messaging - readonly intentResolver: IntentResolver - - constructor(messaging: Messaging, intentResolver: IntentResolver) { - this.messaging = messaging - this.intentResolver = intentResolver - } + constructor(messaging: Messaging, intentResolver: IntentResolver) { + this.messaging = messaging; + this.intentResolver = intentResolver; + } - async findIntent(intent: string, context: Context, resultType: string | undefined): Promise { - const messageOut: FindIntentRequest = { - type: "findIntentRequest", - payload: { - intent, - context, - resultType - }, - meta: this.messaging.createMeta() - } - - const result = await this.messaging.exchange(messageOut, "findIntentResponse") as FindIntentResponse - const appIntent = result.payload.appIntent!! - if (appIntent.apps.length == 0) { - throw new Error(ResolveError.NoAppsFound) - } else { - return { - intent: appIntent.intent, - apps: appIntent.apps - } - } + async findIntent(intent: string, context: Context, resultType: string | undefined): Promise { + const messageOut: FindIntentRequest = { + type: 'findIntentRequest', + payload: { + intent, + context, + resultType, + }, + meta: this.messaging.createMeta(), + }; + + const result = (await this.messaging.exchange(messageOut, 'findIntentResponse')) as FindIntentResponse; + const appIntent = result.payload.appIntent!!; + if (appIntent.apps.length == 0) { + throw new Error(ResolveError.NoAppsFound); + } else { + return { + intent: appIntent.intent, + apps: appIntent.apps, + }; } + } - async findIntentsByContext(context: Context): Promise { - const messageOut: FindIntentsByContextRequest = { - type: "findIntentsByContextRequest", - payload: { - context - }, - meta: this.messaging.createMeta() - } - - const result: FindIntentsByContextResponse = await this.messaging.exchange(messageOut, "findIntentsByContextResponse") - const appIntents = result.payload.appIntents - if (!appIntents || appIntents.length == 0) { - throw new Error(ResolveError.NoAppsFound) - } else { - return appIntents - } - + async findIntentsByContext(context: Context): Promise { + const messageOut: FindIntentsByContextRequest = { + type: 'findIntentsByContextRequest', + payload: { + context, + }, + meta: this.messaging.createMeta(), + }; + + const result: FindIntentsByContextResponse = await this.messaging.exchange( + messageOut, + 'findIntentsByContextResponse' + ); + const appIntents = result.payload.appIntents; + if (!appIntents || appIntents.length == 0) { + throw new Error(ResolveError.NoAppsFound); + } else { + return appIntents; } + } - private async createResultPromise(messageOut: RaiseIntentRequest | RaiseIntentForContextRequest): Promise { - const rp = await this.messaging.waitFor(m => ( - (m.type == 'raiseIntentResultResponse') && - (m.meta.requestUuid == messageOut.meta.requestUuid))) - - - const ir = await convertIntentResult(rp, this.messaging) - return ir - } + private async createResultPromise( + messageOut: RaiseIntentRequest | RaiseIntentForContextRequest + ): Promise { + const rp = await this.messaging.waitFor( + m => m.type == 'raiseIntentResultResponse' && m.meta.requestUuid == messageOut.meta.requestUuid + ); - async raiseIntent(intent: string, context: Context, app: AppIdentifier): Promise { - const meta = this.messaging.createMeta() - const messageOut: RaiseIntentRequest = { - type: "raiseIntentRequest", - payload: { - intent, - context, - app: app - }, - meta: meta - } - - var resultPromise = this.createResultPromise(messageOut) - var response: RaiseIntentResponse = await this.messaging.exchange(messageOut, "raiseIntentResponse", ResolveError.IntentDeliveryFailed) - - if (response.payload.appIntent) { - // we need to invoke the resolver - const result: IntentResolutionChoice | void = await this.intentResolver.chooseIntent([response.payload.appIntent as any], context) - if (result) { - return this.raiseIntent(intent, context, result.appId) - } else { - throw new Error(ResolveError.UserCancelled) - } - } else { - // single intent - const details = response.payload.intentResolution!! - return new DefaultIntentResolution( - this.messaging, - resultPromise, - details.source, - details.intent - ) - } - } + const ir = await convertIntentResult(rp, this.messaging); + return ir; + } - async raiseIntentForContext(context: Context, app?: AppIdentifier | undefined): Promise { - const messageOut: RaiseIntentForContextRequest = { - type: "raiseIntentForContextRequest", - payload: { - context, - app: app - }, - meta: this.messaging.createMeta() - } - - const resultPromise = this.createResultPromise(messageOut) - const response: RaiseIntentForContextResponse = await this.messaging.exchange(messageOut, "raiseIntentForContextResponse", ResolveError.IntentDeliveryFailed) - if (response.payload.appIntents) { - // we need to invoke the resolver - const result: IntentResolutionChoice | void = await this.intentResolver.chooseIntent(response.payload.appIntents as any[], context) - if (result) { - return this.raiseIntent(result.intent, context, result.appId) - } else { - throw new Error(ResolveError.UserCancelled) - } - } else { - const details = response.payload.intentResolution! - return new DefaultIntentResolution( - this.messaging, - resultPromise, - details.source, - details.intent - ) - } + async raiseIntent(intent: string, context: Context, app: AppIdentifier): Promise { + const meta = this.messaging.createMeta(); + const messageOut: RaiseIntentRequest = { + type: 'raiseIntentRequest', + payload: { + intent, + context, + app: app, + }, + meta: meta, + }; + + var resultPromise = this.createResultPromise(messageOut); + var response: RaiseIntentResponse = await this.messaging.exchange( + messageOut, + 'raiseIntentResponse', + ResolveError.IntentDeliveryFailed + ); + + if (response.payload.appIntent) { + // we need to invoke the resolver + const result: IntentResolutionChoice | void = await this.intentResolver.chooseIntent( + [response.payload.appIntent as any], + context + ); + if (result) { + return this.raiseIntent(intent, context, result.appId); + } else { + throw new Error(ResolveError.UserCancelled); + } + } else { + // single intent + const details = response.payload.intentResolution!!; + return new DefaultIntentResolution(this.messaging, resultPromise, details.source, details.intent); } + } - async addIntentListener(intent: string, handler: IntentHandler): Promise { - const out = new DefaultIntentListener(this.messaging, intent, handler); - await out.register() - return out + async raiseIntentForContext(context: Context, app?: AppIdentifier | undefined): Promise { + const messageOut: RaiseIntentForContextRequest = { + type: 'raiseIntentForContextRequest', + payload: { + context, + app: app, + }, + meta: this.messaging.createMeta(), + }; + + const resultPromise = this.createResultPromise(messageOut); + const response: RaiseIntentForContextResponse = await this.messaging.exchange( + messageOut, + 'raiseIntentForContextResponse', + ResolveError.IntentDeliveryFailed + ); + if (response.payload.appIntents) { + // we need to invoke the resolver + const result: IntentResolutionChoice | void = await this.intentResolver.chooseIntent( + response.payload.appIntents as any[], + context + ); + if (result) { + return this.raiseIntent(result.intent, context, result.appId); + } else { + throw new Error(ResolveError.UserCancelled); + } + } else { + const details = response.payload.intentResolution!; + return new DefaultIntentResolution(this.messaging, resultPromise, details.source, details.intent); } + } -} \ No newline at end of file + async addIntentListener(intent: string, handler: IntentHandler): Promise { + const out = new DefaultIntentListener(this.messaging, intent, handler); + await out.register(); + return out; + } +} diff --git a/packages/fdc3-agent-proxy/src/intents/IntentSupport.ts b/packages/fdc3-agent-proxy/src/intents/IntentSupport.ts index 952acfb06..a9ab46a11 100644 --- a/packages/fdc3-agent-proxy/src/intents/IntentSupport.ts +++ b/packages/fdc3-agent-proxy/src/intents/IntentSupport.ts @@ -1,16 +1,14 @@ -import { AppIdentifier, AppIntent, IntentHandler, IntentResolution, Listener } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; +import { AppIdentifier, AppIntent, IntentHandler, IntentResolution, Listener } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; export interface IntentSupport { + findIntent(intent: string, context: Context, resultType: string | undefined): Promise; - findIntent(intent: string, context: Context, resultType: string | undefined): Promise + findIntentsByContext(context: Context): Promise; - findIntentsByContext(context: Context): Promise + raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise; - raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise + raiseIntentForContext(context: Context, app?: AppIdentifier): Promise; - raiseIntentForContext(context: Context, app?: AppIdentifier): Promise - - addIntentListener(intent: string, handler: IntentHandler): Promise - -} \ No newline at end of file + addIntentListener(intent: string, handler: IntentHandler): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts b/packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts index 92f79d50d..24bead467 100644 --- a/packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/AbstractListener.ts @@ -1,50 +1,54 @@ -import { Messaging } from "../Messaging" -import { RegisterableListener } from "./RegisterableListener" +import { Messaging } from '../Messaging'; +import { RegisterableListener } from './RegisterableListener'; /** * Common to all listeners - they need to be registered and unregistered with messaging and also * send notification messsages when connected and disconnected */ export abstract class AbstractListener implements RegisterableListener { - - readonly messaging: Messaging - readonly handler: X - id: string | null = null - - constructor(messaging: Messaging, private readonly payloadDetails: Record, handler: X, private readonly subscribeType: string, private readonly unsubscribeType: string) { - this.messaging = messaging - this.handler = handler + readonly messaging: Messaging; + readonly handler: X; + id: string | null = null; + + constructor( + messaging: Messaging, + private readonly payloadDetails: Record, + handler: X, + private readonly subscribeType: string, + private readonly unsubscribeType: string + ) { + this.messaging = messaging; + this.handler = handler; + } + + abstract filter(m: any): boolean; + + abstract action(m: any): void; + + async listenerNotification(type: string): Promise { + const requestType = `${type}Request`; + const responseType = `${type}Response`; + const notificationMessage = { + meta: this.messaging.createMeta(), + payload: this.id ? { listenerUUID: this.id } : { ...this.payloadDetails }, + type: requestType, + }; + + const response = await this.messaging.exchange(notificationMessage, responseType); + return response?.payload?.listenerUUID ?? null; + } + + async unsubscribe(): Promise { + if (!this.id) { + throw new Error("Can't unsubscribe from a listener that has not been registered."); } - abstract filter(m: any): boolean - - abstract action(m: any): void + this.messaging.unregister(this.id); + await this.listenerNotification(this.unsubscribeType); + } - async listenerNotification(type: string): Promise { - const requestType = `${type}Request`; - const responseType = `${type}Response`; - const notificationMessage = { - meta: this.messaging.createMeta(), - payload: (this.id ? {listenerUUID: this.id} : {...this.payloadDetails}), - type: requestType - } - - const response = await this.messaging.exchange(notificationMessage, responseType) - return response?.payload?.listenerUUID ?? null - - } - - async unsubscribe(): Promise { - if(!this.id){ - throw new Error("Can't unsubscribe from a listener that has not been registered.") - } - - this.messaging.unregister(this.id) - await this.listenerNotification(this.unsubscribeType) - } - - async register() { - this.id = await this.listenerNotification(this.subscribeType) - this.messaging.register(this) - } -} \ No newline at end of file + async register() { + this.id = await this.listenerNotification(this.subscribeType); + this.messaging.register(this); + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts b/packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts index b522b0296..d39d87e99 100644 --- a/packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/DefaultContextListener.ts @@ -1,50 +1,53 @@ -import { ContextHandler, Channel } from "@kite9/fdc3-standard"; -import { Messaging } from "../Messaging"; -import { AbstractListener } from "./AbstractListener"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { FollowingContextListener } from "./FollowingContextListener"; +import { ContextHandler, Channel } from '@kite9/fdc3-standard'; +import { Messaging } from '../Messaging'; +import { AbstractListener } from './AbstractListener'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { FollowingContextListener } from './FollowingContextListener'; -type BroadcastEvent = BrowserTypes.BroadcastEvent +type BroadcastEvent = BrowserTypes.BroadcastEvent; export class DefaultContextListener extends AbstractListener implements FollowingContextListener { + private channelId: string | null; + private readonly messageType: string; + private readonly contextType: string | null; - private channelId: string | null - private readonly messageType: string - private readonly contextType: string | null + constructor( + messaging: Messaging, + channelId: string | null, + contextType: string | null, + handler: ContextHandler, + messageType: string = 'broadcastEvent', + subscribeType: string = 'addContextListener', + unsubscribeType: string = 'contextListenerUnsubscribe' + ) { + super(messaging, { channelId, contextType }, handler, subscribeType, unsubscribeType); + this.channelId = channelId; + this.messageType = messageType; + this.contextType = contextType; + } - constructor(messaging: Messaging, - channelId: string | null, - contextType: string | null, - handler: ContextHandler, - messageType: string = "broadcastEvent", - subscribeType: string = "addContextListener", - unsubscribeType: string = "contextListenerUnsubscribe") { - super(messaging, { channelId, contextType }, handler, subscribeType, unsubscribeType) - this.channelId = channelId - this.messageType = messageType - this.contextType = contextType + async changeChannel(channel: Channel | null): Promise { + if (channel == null) { + this.channelId = null; + return; + } else { + this.channelId = channel.id; + const context = await channel.getCurrentContext(this.contextType ?? undefined); + if (context) { + this.handler(context); + } } + } - async changeChannel(channel: Channel | null): Promise { - if (channel == null) { - this.channelId = null - return - } else { - this.channelId = channel.id - const context = await channel.getCurrentContext(this.contextType ?? undefined) - if (context) { - this.handler(context) - } - } - } - - filter(m: BroadcastEvent): boolean { - return (m.type == this.messageType) - && (m.payload.channelId == this.channelId) - && ((m.payload.context?.type == this.contextType) || (this.contextType == null)); - } + filter(m: BroadcastEvent): boolean { + return ( + m.type == this.messageType && + m.payload.channelId == this.channelId && + (m.payload.context?.type == this.contextType || this.contextType == null) + ); + } - action(m: any): void { - this.handler(m.payload.context) - } -} \ No newline at end of file + action(m: any): void { + this.handler(m.payload.context); + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts b/packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts index fe9799ec9..7ac575efc 100644 --- a/packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/DefaultIntentListener.ts @@ -1,113 +1,114 @@ -import { IntentHandler, IntentResult, AppIdentifier } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; -import { Messaging } from "../Messaging"; -import { AbstractListener } from "./AbstractListener"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { IntentHandler, IntentResult, AppIdentifier } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; +import { Messaging } from '../Messaging'; +import { AbstractListener } from './AbstractListener'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse -type IntentResultResponse = BrowserTypes.IntentResultResponse -type BridgeIntentResult = BrowserTypes.IntentResult -type IntentEvent = BrowserTypes.IntentEvent -type IntentResultRequest = BrowserTypes.IntentResultRequest +type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse; +type IntentResultResponse = BrowserTypes.IntentResultResponse; +type BridgeIntentResult = BrowserTypes.IntentResult; +type IntentEvent = BrowserTypes.IntentEvent; +type IntentResultRequest = BrowserTypes.IntentResultRequest; export class DefaultIntentListener extends AbstractListener { + readonly intent: string; - readonly intent: string + constructor(messaging: Messaging, intent: string, action: IntentHandler) { + super(messaging, { intent }, action, 'addIntentListener', 'intentListenerUnsubscribe'); - constructor(messaging: Messaging, intent: string, action: IntentHandler) { - super(messaging, - { intent }, - action, - "addIntentListener", - "intentListenerUnsubscribe") + this.intent = intent; + } - this.intent = intent - } + filter(m: IntentEvent): boolean { + return m.type == 'intentEvent' && m.payload.intent == this.intent; + } - filter(m: IntentEvent): boolean { - return (m.type == 'intentEvent') && (m.payload.intent == this.intent) - } + action(m: IntentEvent): void { + this.handleIntentResponse(m); - action(m: IntentEvent): void { - this.handleIntentResponse(m) + const done = this.handler(m.payload.context, { + source: m.payload.originatingApp as AppIdentifier, + }); - const done = this.handler(m.payload.context, { - source: m.payload.originatingApp as AppIdentifier - }) + this.handleIntentResult(done, m); + } - this.handleIntentResult(done, m); - } + private handleIntentResponse(m: IntentEvent) { + const out: RaiseIntentResponse = { + type: 'raiseIntentResponse', + meta: { + responseUuid: this.messaging.createUUID(), + requestUuid: m.meta.eventUuid, + timestamp: new Date(), + }, + payload: { + intentResolution: { + intent: m.payload.intent, + source: this.messaging.getSource(), + }, + }, + }; + this.messaging.post(out); + } - private handleIntentResponse(m: IntentEvent) { - const out: RaiseIntentResponse = { - type: "raiseIntentResponse", - meta: { - responseUuid: this.messaging.createUUID(), - requestUuid: m.meta.eventUuid, - timestamp: new Date() - }, - payload: { - intentResolution: { - intent: m.payload.intent, - source: this.messaging.getSource() - } - } - }; - this.messaging.post(out); - } + private intentResultRequestMessage(ir: IntentResult, m: IntentEvent): IntentResultRequest { + const out: IntentResultRequest = { + type: 'intentResultRequest', + meta: { + requestUuid: m.meta.eventUuid, + timestamp: new Date(), + }, + payload: { + intentResult: convertIntentResult(ir), + intentEventUuid: m.meta.eventUuid, + raiseIntentRequestUuid: m.payload.raiseIntentRequestUuid, + }, + }; - private intentResultRequestMessage(ir: IntentResult, m: IntentEvent): IntentResultRequest { - const out: IntentResultRequest = { - type: "intentResultRequest", - meta: { - requestUuid: m.meta.eventUuid, - timestamp: new Date() - }, - payload: { - intentResult: convertIntentResult(ir), - intentEventUuid: m.meta.eventUuid, - raiseIntentRequestUuid: m.payload.raiseIntentRequestUuid - } - }; + return out; + } - return out - } - - private handleIntentResult(done: Promise | void, m: IntentEvent) { - if (done == null) { - // send an empty intent result response - return this.messaging.exchange(this.intentResultRequestMessage(undefined, m), "intentResultResponse"); - } else { - // respond after promise completes - return done.then(ir => { - return this.messaging.exchange(this.intentResultRequestMessage(ir, m), "intentResultResponse"); - }); - } + private handleIntentResult(done: Promise | void, m: IntentEvent) { + if (done == null) { + // send an empty intent result response + return this.messaging.exchange( + this.intentResultRequestMessage(undefined, m), + 'intentResultResponse' + ); + } else { + // respond after promise completes + return done.then(ir => { + return this.messaging.exchange( + this.intentResultRequestMessage(ir, m), + 'intentResultResponse' + ); + }); } + } } function convertIntentResult(intentResult: IntentResult): BridgeIntentResult { - if (intentResult == null) { - return { - // empty result - } - } - switch (intentResult.type) { - case 'user': - case 'app': - case 'private': - // it's a channel - return { - channel: { - type: intentResult.type, - id: intentResult.id as string, - displayMetadata: intentResult.displayMetadata - } - } - default: - // it's a context - return { - context: intentResult as Context - } - } -} \ No newline at end of file + if (intentResult == null) { + return { + // empty result + }; + } + switch (intentResult.type) { + case 'user': + case 'app': + case 'private': + // it's a channel + return { + channel: { + type: intentResult.type, + id: intentResult.id as string, + displayMetadata: intentResult.displayMetadata, + }, + }; + default: + // it's a context + return { + context: intentResult as Context, + }; + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/EventListener.ts b/packages/fdc3-agent-proxy/src/listeners/EventListener.ts index 0da47437c..3cf5b311f 100644 --- a/packages/fdc3-agent-proxy/src/listeners/EventListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/EventListener.ts @@ -1,40 +1,38 @@ -import { ApiEvent, EventHandler } from "@kite9/fdc3-standard"; -import { Messaging } from "../Messaging"; -import { RegisterableListener } from "./RegisterableListener"; +import { ApiEvent, EventHandler } from '@kite9/fdc3-standard'; +import { Messaging } from '../Messaging'; +import { RegisterableListener } from './RegisterableListener'; export class EventListener implements RegisterableListener { - - readonly id: string - readonly messaging: Messaging - readonly type: string - readonly handler: EventHandler - - constructor(messaging: Messaging, type: string, handler: EventHandler) { - this.id = type + "-" + messaging.createUUID() - this.messaging = messaging - this.type = type - this.handler = handler + readonly id: string; + readonly messaging: Messaging; + readonly type: string; + readonly handler: EventHandler; + + constructor(messaging: Messaging, type: string, handler: EventHandler) { + this.id = type + '-' + messaging.createUUID(); + this.messaging = messaging; + this.type = type; + this.handler = handler; + } + + filter(m: any): boolean { + return m.type === this.type; + } + + action(m: any): void { + if (m.type === this.type) { + this.handler({ + type: this.type, + details: m.payload, + } as ApiEvent); } + } - filter(m: any): boolean { - return m.type === this.type - } - - action(m: any): void { - if (m.type === this.type) { - this.handler({ - type: this.type, - details: m.payload - } as ApiEvent) - } - } - - async register(): Promise { - this.messaging.register(this) - } - - async unsubscribe(): Promise { - this.messaging.unregister(this.id) - } + async register(): Promise { + this.messaging.register(this); + } -} \ No newline at end of file + async unsubscribe(): Promise { + this.messaging.unregister(this.id); + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/FollowingContextListener.ts b/packages/fdc3-agent-proxy/src/listeners/FollowingContextListener.ts index 1d46b8c00..6cdc5d9e9 100644 --- a/packages/fdc3-agent-proxy/src/listeners/FollowingContextListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/FollowingContextListener.ts @@ -2,17 +2,15 @@ import { Channel, Listener } from '@kite9/fdc3-standard'; import { RegisterableListener } from './RegisterableListener'; /** - * This is a spercial version of a ContextListener created when the user calls the + * This is a spercial version of a ContextListener created when the user calls the * fdc3.addContextListener method. In this scenario, the listener will respond to broadcasts * on whatever is the current user channel. */ export interface FollowingContextListener extends Listener, RegisterableListener { - - /** - * This method is called when the user channel changes. The listener should then - * call it's handler with the latest piece of relevant channel state and start responding to - * events on the new channelId. - */ - changeChannel(ch: Channel | null): Promise - + /** + * This method is called when the user channel changes. The listener should then + * call it's handler with the latest piece of relevant channel state and start responding to + * events on the new channelId. + */ + changeChannel(ch: Channel | null): Promise; } diff --git a/packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts b/packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts index 20965295b..226d2cb46 100644 --- a/packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/HeartbeatListener.ts @@ -1,40 +1,38 @@ -import { HeartbeatAcknowledgementRequest, HeartbeatEvent } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; -import { Messaging } from "../Messaging"; -import { RegisterableListener } from "./RegisterableListener"; +import { HeartbeatAcknowledgementRequest, HeartbeatEvent } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +import { Messaging } from '../Messaging'; +import { RegisterableListener } from './RegisterableListener'; export class HeartbeatListener implements RegisterableListener { - - readonly id: string - readonly messaging: Messaging - - constructor(messaging: Messaging) { - this.id = "heartbeat-" + messaging.createUUID() - this.messaging = messaging - } - - filter(m: any): boolean { - return m.type === "heartbeatEvent" - } - - action(_m: any): void { - this.messaging.post({ - type: "heartbeatAcknowledgementRequest", - meta: { - requestUuid: this.messaging.createUUID(), - timestamp: new Date() - }, - payload: { - heartbeatEventUuid: (_m as HeartbeatEvent).meta.eventUuid - } - } as HeartbeatAcknowledgementRequest) - } - - async register(): Promise { - this.messaging.register(this) - } - - async unsubscribe(): Promise { - this.messaging.unregister(this.id) - } - -} \ No newline at end of file + readonly id: string; + readonly messaging: Messaging; + + constructor(messaging: Messaging) { + this.id = 'heartbeat-' + messaging.createUUID(); + this.messaging = messaging; + } + + filter(m: any): boolean { + return m.type === 'heartbeatEvent'; + } + + action(_m: any): void { + this.messaging.post({ + type: 'heartbeatAcknowledgementRequest', + meta: { + requestUuid: this.messaging.createUUID(), + timestamp: new Date(), + }, + payload: { + heartbeatEventUuid: (_m as HeartbeatEvent).meta.eventUuid, + }, + } as HeartbeatAcknowledgementRequest); + } + + async register(): Promise { + this.messaging.register(this); + } + + async unsubscribe(): Promise { + this.messaging.unregister(this.id); + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts b/packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts index fd991166d..95b5df1ff 100644 --- a/packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/PrivateChannelEventListener.ts @@ -1,59 +1,62 @@ -import { BroadcastEvent } from "@kite9/fdc3-schema/generated/api/BrowserTypes" -import { Messaging } from "../Messaging" -import { AbstractListener } from "./AbstractListener" +import { BroadcastEvent } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +import { Messaging } from '../Messaging'; +import { AbstractListener } from './AbstractListener'; -type EVENT_TYPES_WITH_TYPE_HANDLER = "onAddContextListener" | "onUnsubscribe" -export type EVENT_TYPES = EVENT_TYPES_WITH_TYPE_HANDLER | "onDisconnect" +type EVENT_TYPES_WITH_TYPE_HANDLER = 'onAddContextListener' | 'onUnsubscribe'; +export type EVENT_TYPES = EVENT_TYPES_WITH_TYPE_HANDLER | 'onDisconnect'; const EVENT_NAMES: { [k: string]: string } = { - onAddContextListener: "privateChannelOnAddContextListenerEvent", - onDisconnect: "privateChannelOnDisconnectEvent", - onUnsubscribe: "privateChannelOnUnsubscribeEvent" -} + onAddContextListener: 'privateChannelOnAddContextListenerEvent', + onDisconnect: 'privateChannelOnDisconnectEvent', + onUnsubscribe: 'privateChannelOnUnsubscribeEvent', +}; abstract class AbstractPrivateChannelEventListener extends AbstractListener { - - readonly privateChannelId: string - readonly listenerType: string - - constructor(messaging: Messaging, privateChannelId: string, listenerType: string, handler: X) { - super(messaging, { privateChannelId, listenerType }, handler, "privateChannelAddEventListener", "privateChannelUnsubscribeEventListener") - this.privateChannelId = privateChannelId; - this.listenerType = listenerType - } - - filter(m: BroadcastEvent) { - // If you see a TS error thrown for this line, that means the bug has been fixed! Feel free to remove these comments. - // @ts-expect-error: The property `privateChannelId` should be on the BroadcastEventPayload, but that hasn't come in yet. - return (m.type == EVENT_NAMES[this.listenerType]) && (this.privateChannelId == m.payload?.privateChannelId); - } - - abstract action(m: any): void + readonly privateChannelId: string; + readonly listenerType: string; + + constructor(messaging: Messaging, privateChannelId: string, listenerType: string, handler: X) { + super( + messaging, + { privateChannelId, listenerType }, + handler, + 'privateChannelAddEventListener', + 'privateChannelUnsubscribeEventListener' + ); + this.privateChannelId = privateChannelId; + this.listenerType = listenerType; + } + + filter(m: BroadcastEvent) { + // If you see a TS error thrown for this line, that means the bug has been fixed! Feel free to remove these comments. + // @ts-expect-error: The property `privateChannelId` should be on the BroadcastEventPayload, but that hasn't come in yet. + return m.type == EVENT_NAMES[this.listenerType] && this.privateChannelId == m.payload?.privateChannelId; + } + + abstract action(m: any): void; } export class PrivateChannelEventListenerVoid extends AbstractPrivateChannelEventListener<() => void> { + constructor(messaging: Messaging, channelId: string, handler: () => void) { + super(messaging, channelId, 'onDisconnect', handler); + } - constructor( - messaging: Messaging, - channelId: string, - handler: () => void) { - super(messaging, channelId, "onDisconnect", handler) - } - - action(_m: any): void { - this.handler() - } - + action(_m: any): void { + this.handler(); + } } export class PrivateChannelEventListenerType extends AbstractPrivateChannelEventListener<(m: string) => void> { - - constructor(messaging: Messaging, channelId: string, listenerType: EVENT_TYPES_WITH_TYPE_HANDLER, handler: (s: string) => void) { - super(messaging, channelId, listenerType, handler) - } - - action(m: any): void { - this.handler(m.payload.contextType) - } - -} \ No newline at end of file + constructor( + messaging: Messaging, + channelId: string, + listenerType: EVENT_TYPES_WITH_TYPE_HANDLER, + handler: (s: string) => void + ) { + super(messaging, channelId, listenerType, handler); + } + + action(m: any): void { + this.handler(m.payload.contextType); + } +} diff --git a/packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts b/packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts index d379b305e..573b645e0 100644 --- a/packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts +++ b/packages/fdc3-agent-proxy/src/listeners/RegisterableListener.ts @@ -1,4 +1,4 @@ -import { Listener } from "@kite9/fdc3-standard"; +import { Listener } from '@kite9/fdc3-standard'; /** * Extends the basic concept of FDC3 listeners to include lifecycle methods. @@ -6,16 +6,14 @@ import { Listener } from "@kite9/fdc3-standard"; * initialized with the register() method before use. */ export interface RegisterableListener extends Listener { + id: string | null; - id: string | null + filter(m: any): boolean; - filter(m: any): boolean + action(m: any): void; - action(m: any): void - - /** - * Listeners need to be registered in order to set their IDs. - */ - register(): Promise - -} \ No newline at end of file + /** + * Listeners need to be registered in order to set their IDs. + */ + register(): Promise; +} diff --git a/packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts b/packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts index 632f8b5c9..2c7f3aa51 100644 --- a/packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts +++ b/packages/fdc3-agent-proxy/src/messaging/AbstractMessaging.ts @@ -1,162 +1,165 @@ -import { AppIdentifier, ImplementationMetadata, GetAgentParams } from "@kite9/fdc3-standard"; -import { Messaging } from "../Messaging"; -import { RegisterableListener } from "../listeners/RegisterableListener"; -import { AppRequestMessage, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentitySuccessResponse } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; -type RequestMetadata = AppRequestMessage["meta"]; +import { AppIdentifier, ImplementationMetadata, GetAgentParams } from '@kite9/fdc3-standard'; +import { Messaging } from '../Messaging'; +import { RegisterableListener } from '../listeners/RegisterableListener'; +import { + AppRequestMessage, + WebConnectionProtocol4ValidateAppIdentity, + WebConnectionProtocol5ValidateAppIdentitySuccessResponse, +} from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +type RequestMetadata = AppRequestMessage['meta']; export abstract class AbstractMessaging implements Messaging { - - private readonly options: GetAgentParams - private readonly connectionAttemptUuid: string - private readonly timeout: number - private readonly actualUrl: string - private appId: AppIdentifier | null = null - private implementationMetadata: ImplementationMetadata | null = null - - abstract createUUID(): string - abstract post(message: object): Promise - - abstract register(l: RegisterableListener): void - abstract unregister(id: string): void - - abstract createMeta(): RequestMetadata - - constructor(options: GetAgentParams, connectionAttemptUuid: string, actualUrl: string, timeout: number = 10016) { - this.options = options - this.connectionAttemptUuid = connectionAttemptUuid - this.timeout = timeout - this.actualUrl = actualUrl + private readonly options: GetAgentParams; + private readonly connectionAttemptUuid: string; + private readonly timeout: number; + private readonly actualUrl: string; + private appId: AppIdentifier | null = null; + private implementationMetadata: ImplementationMetadata | null = null; + + abstract createUUID(): string; + abstract post(message: object): Promise; + + abstract register(l: RegisterableListener): void; + abstract unregister(id: string): void; + + abstract createMeta(): RequestMetadata; + + constructor(options: GetAgentParams, connectionAttemptUuid: string, actualUrl: string, timeout: number = 10016) { + this.options = options; + this.connectionAttemptUuid = connectionAttemptUuid; + this.timeout = timeout; + this.actualUrl = actualUrl; + } + + getSource(): AppIdentifier { + if (this.appId === null) { + throw new Error('Unconnected. No source available.'); } - - getSource(): AppIdentifier { - if(this.appId === null){ - throw new Error("Unconnected. No source available.") + return this.appId; + } + + waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise { + const id = this.createUUID(); + return new Promise((resolve, reject) => { + let done = false; + const listener: RegisterableListener = { + id, + filter: filter, + action: m => { + done = true; + this.unregister(id); + resolve(m); + }, + register: async () => { + this.register(listener); + }, + unsubscribe: async () => { + this.unregister(id); + }, + }; + + listener.register(); + + if (!timeoutErrorMessage) { + return; + } + + setTimeout(() => { + this.unregister(id); + if (!done) { + console.error(`Timed out after ${this.timeout}ms with ${timeoutErrorMessage}`); + reject(new Error(timeoutErrorMessage)); } - return this.appId + }, this.timeout); + }); + } + + async exchange(message: any, expectedTypeName: string, timeoutErrorMessage?: string): Promise { + const errorMessage = + timeoutErrorMessage ?? `Timeout waiting for ${expectedTypeName} with requestUuid ${message.meta.requestUuid}`; + const messageResponseWaiter = this.waitFor( + m => m.type == expectedTypeName && m.meta.requestUuid == message.meta.requestUuid, + errorMessage + ); + this.post(message); + const out = await messageResponseWaiter; + // @ts-expect-error: TODO: We should make a list of all of the possible messages that can be called through this, and make that list the generic. This will ensure better type safety. + if (out?.payload?.error) { + // @ts-expect-error: TODO: We should make a list of all of the possible messages that can be called through this, and make that list the generic. This will ensure better type safety. + throw new Error(out.payload.error); + } else { + return out; } - - waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise { - const id = this.createUUID() - return new Promise((resolve, reject) => { - let done = false; - const listener: RegisterableListener = { - id, - filter: filter, - action: (m) => { - done = true - this.unregister(id) - resolve(m) - }, - register: async () => { - this.register(listener) - }, - unsubscribe: async () => { - this.unregister(id); - } - } - - listener.register(); - - if (!timeoutErrorMessage) { - return; - } - - setTimeout(() => { - this.unregister(id) - if (!done) { - console.error(`Timed out after ${this.timeout}ms with ${timeoutErrorMessage}`) - reject(new Error(timeoutErrorMessage)) - } - }, this.timeout); - }) + } + + /** + * This handles the verify exchange with the da-server, + */ + async connect(): Promise { + const validationResponse = + await this.exchangeValidationWithId( + this.createValidationMessage(), + this.connectionAttemptUuid + ); + + this.appId = { + appId: validationResponse.payload.appId, + instanceId: validationResponse.payload.instanceId, + }; + + this.implementationMetadata = validationResponse.payload.implementationMetadata; + + this.storeInstanceUuid(validationResponse); + } + + async disconnect(): Promise { + this.appId = null; + this.implementationMetadata = null; + } + + async getImplementationMetadata(): Promise { + if (this.implementationMetadata === null) { + throw new Error('Unconnected. No metadata available.'); } - - - async exchange(message: any, expectedTypeName: string, timeoutErrorMessage?: string): Promise { - const errorMessage = timeoutErrorMessage ?? `Timeout waiting for ${expectedTypeName} with requestUuid ${message.meta.requestUuid}` - const messageResponseWaiter = this.waitFor(m => - (m.type == expectedTypeName) - && (m.meta.requestUuid == message.meta.requestUuid), errorMessage) - this.post(message) - const out = await messageResponseWaiter - // @ts-expect-error: TODO: We should make a list of all of the possible messages that can be called through this, and make that list the generic. This will ensure better type safety. - if (out?.payload?.error) { - // @ts-expect-error: TODO: We should make a list of all of the possible messages that can be called through this, and make that list the generic. This will ensure better type safety. - throw new Error(out.payload.error) - } else { - return out - } - } - - /** - * This handles the verify exchange with the da-server, - */ - async connect(): Promise { - const validationResponse = await this.exchangeValidationWithId( - this.createValidationMessage(), - this.connectionAttemptUuid - ) - - this.appId = { - appId: validationResponse.payload.appId, - instanceId: validationResponse.payload.instanceId - } - - this.implementationMetadata = validationResponse.payload.implementationMetadata - - this.storeInstanceUuid(validationResponse) + return this.implementationMetadata; + } + + private async exchangeValidationWithId(message: any, connectionAttemptUuid: string): Promise { + const messageResponseWaiter = this.waitFor(m => m.meta.connectionAttemptUuid == connectionAttemptUuid); + this.post(message); + const out: any = await messageResponseWaiter; + if (out?.payload?.message) { + throw new Error(out.payload.message); + } else { + return out; } - - async disconnect(): Promise { - this.appId = null; - this.implementationMetadata = null; - } - - async getImplementationMetadata(): Promise { - if(this.implementationMetadata === null){ - throw new Error("Unconnected. No metadata available.") - } - return this.implementationMetadata - } - - private async exchangeValidationWithId(message: any, connectionAttemptUuid: string): Promise { - const messageResponseWaiter = this.waitFor(m => - (m.meta.connectionAttemptUuid == connectionAttemptUuid)) - this.post(message) - const out: any = await messageResponseWaiter - if (out?.payload?.message) { - throw new Error(out.payload.message) - } else { - return out - } - } - - /** - * Sends the validate message through the nmessage port - */ - private createValidationMessage(): WebConnectionProtocol4ValidateAppIdentity { - return { - type: 'WCP4ValidateAppIdentity', - meta: { - connectionAttemptUuid: this.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - identityUrl: this.options.identityUrl ?? this.actualUrl, - actualUrl: this.actualUrl, - instanceUuid: this.retrieveInstanceUuid() - } - } - } - - /** - * Used for restoring session details in case of reload - */ - abstract retrieveInstanceUuid(): string | undefined - - /** - * Used for caching session details in case of reload - */ - abstract storeInstanceUuid(validationResponse: WebConnectionProtocol5ValidateAppIdentitySuccessResponse): void - -} \ No newline at end of file + } + + /** + * Sends the validate message through the nmessage port + */ + private createValidationMessage(): WebConnectionProtocol4ValidateAppIdentity { + return { + type: 'WCP4ValidateAppIdentity', + meta: { + connectionAttemptUuid: this.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + identityUrl: this.options.identityUrl ?? this.actualUrl, + actualUrl: this.actualUrl, + instanceUuid: this.retrieveInstanceUuid(), + }, + }; + } + + /** + * Used for restoring session details in case of reload + */ + abstract retrieveInstanceUuid(): string | undefined; + + /** + * Used for caching session details in case of reload + */ + abstract storeInstanceUuid(validationResponse: WebConnectionProtocol5ValidateAppIdentitySuccessResponse): void; +} diff --git a/packages/fdc3-agent-proxy/test/step-definitions/generic.steps.ts b/packages/fdc3-agent-proxy/test/step-definitions/generic.steps.ts index d6a81f28a..71e14e489 100644 --- a/packages/fdc3-agent-proxy/test/step-definitions/generic.steps.ts +++ b/packages/fdc3-agent-proxy/test/step-definitions/generic.steps.ts @@ -1,40 +1,42 @@ import { TestMessaging } from '../support/TestMessaging'; -import { Given, When } from '@cucumber/cucumber' +import { Given, When } from '@cucumber/cucumber'; import { CustomWorld } from '../world/index'; -import { BasicDesktopAgent, DefaultAppSupport, DefaultChannelSupport, DefaultIntentSupport, DefaultHandshakeSupport } from '../../src'; +import { + BasicDesktopAgent, + DefaultAppSupport, + DefaultChannelSupport, + DefaultIntentSupport, + DefaultHandshakeSupport, +} from '../../src'; import { SimpleIntentResolver, setupGenericSteps } from '@kite9/testing'; import { CHANNEL_STATE, SimpleChannelSelector } from '@kite9/testing/dist/src/agent'; import { BrowserTypes } from '@kite9/fdc3-schema'; - Given('A Desktop Agent in {string}', async function (this: CustomWorld, field: string) { + if (!this.messaging) { + this.messaging = new TestMessaging(this.props[CHANNEL_STATE]); + } - if (!this.messaging) { - this.messaging = new TestMessaging(this.props[CHANNEL_STATE]); - } - - const cs = new DefaultChannelSupport(this.messaging, new SimpleChannelSelector(this)) - const hs = new DefaultHandshakeSupport(this.messaging) - const is = new DefaultIntentSupport(this.messaging, new SimpleIntentResolver(this)) - const as = new DefaultAppSupport(this.messaging) + const cs = new DefaultChannelSupport(this.messaging, new SimpleChannelSelector(this)); + const hs = new DefaultHandshakeSupport(this.messaging); + const is = new DefaultIntentSupport(this.messaging, new SimpleIntentResolver(this)); + const as = new DefaultAppSupport(this.messaging); - const da = new BasicDesktopAgent(hs, cs, is, as, [hs]) - await da.connect() + const da = new BasicDesktopAgent(hs, cs, is, as, [hs]); + await da.connect(); - this.props[field] = da - this.props['result'] = null -}) + this.props[field] = da; + this.props['result'] = null; +}); When('messaging receives a heartbeat event', function (this: CustomWorld) { - - this.messaging?.receive({ - type: 'heartbeatEvent', - meta: this.messaging.createEventMeta(), - payload: { - timestamp: new Date() - } - } as BrowserTypes.HeartbeatEvent) - -}) - -setupGenericSteps() \ No newline at end of file + this.messaging?.receive({ + type: 'heartbeatEvent', + meta: this.messaging.createEventMeta(), + payload: { + timestamp: new Date(), + }, + } as BrowserTypes.HeartbeatEvent); +}); + +setupGenericSteps(); diff --git a/packages/fdc3-agent-proxy/test/step-definitions/intents.steps.ts b/packages/fdc3-agent-proxy/test/step-definitions/intents.steps.ts index dc1cb12d9..f876396fe 100644 --- a/packages/fdc3-agent-proxy/test/step-definitions/intents.steps.ts +++ b/packages/fdc3-agent-proxy/test/step-definitions/intents.steps.ts @@ -1,195 +1,204 @@ -import { Given } from '@cucumber/cucumber' +import { Given } from '@cucumber/cucumber'; import { CustomWorld } from '../world/index'; import { handleResolve } from '@kite9/testing'; import { BrowserTypes } from '@kite9/fdc3-schema'; import { Context } from '@kite9/fdc3-context'; import { ContextMetadata } from '@kite9/fdc3-standard'; -type IntentEvent = BrowserTypes.IntentEvent - -Given("app {string}", function (this: CustomWorld, appStr: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } - this.messaging?.addAppIntentDetail({ - app - }) - this.props[instanceId] = app -}) - -Given("app {string} resolves intent {string}", function (this: CustomWorld, appStr: string, intent: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } +type IntentEvent = BrowserTypes.IntentEvent; + +Given('app {string}', function (this: CustomWorld, appStr: string) { + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; + this.messaging?.addAppIntentDetail({ + app, + }); + this.props[instanceId] = app; +}); + +Given('app {string} resolves intent {string}', function (this: CustomWorld, appStr: string, intent: string) { + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; + this.messaging?.addAppIntentDetail({ + app, + intent, + }); + this.props[instanceId] = app; + this.props[appId] = { + appId, + }; +}); + +Given( + 'app {string} resolves intent {string} with result type {string}', + function (this: CustomWorld, appStr: string, intent: string, resultType: string) { + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; this.messaging?.addAppIntentDetail({ - app, - intent, - }) - this.props[instanceId] = app - this.props[appId] = { - appId - } -}) - -Given("app {string} resolves intent {string} with result type {string}", function (this: CustomWorld, appStr: string, intent: string, resultType: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } - this.messaging?.addAppIntentDetail({ - app, - intent, - resultType - }) - this.props[instanceId] = app + app, + intent, + resultType, + }); + this.props[instanceId] = app; this.props[appId] = { - appId - } -}) - -Given("app {string} resolves intent {string} with context {string}", function (this: CustomWorld, appStr: string, intent: string, context: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } + appId, + }; + } +); + +Given( + 'app {string} resolves intent {string} with context {string}', + function (this: CustomWorld, appStr: string, intent: string, context: string) { + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; this.messaging?.addAppIntentDetail({ - app, - intent, - context - }) - this.props[instanceId] = app + app, + intent, + context, + }); + this.props[instanceId] = app; this.props[appId] = { - appId - } -}) - -Given("app {string} resolves intent {string} with context {string} and result type {string}", function (this: CustomWorld, appStr: string, intent: string, context: string, resultType: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } + appId, + }; + } +); + +Given( + 'app {string} resolves intent {string} with context {string} and result type {string}', + function (this: CustomWorld, appStr: string, intent: string, context: string, resultType: string) { + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; this.messaging?.addAppIntentDetail({ - app, - intent, - context, - resultType - }) - this.props[instanceId] = app -}) - -Given("Raise Intent returns a context of {string}", function (this: CustomWorld, result: string) { - this.messaging?.setIntentResult({ - context: handleResolve(result, this) - }) -}) - - -Given("Raise Intent will throw a {string} error", function (this: CustomWorld, error: string) { - this.messaging?.setIntentResult({ - error - }) -}) - -Given("Raise Intent returns no result", function (this: CustomWorld) { - this.messaging?.setIntentResult({}) -}) - - -Given("Raise Intent times out", function (this: CustomWorld) { - this.messaging?.setIntentResult({ - timeout: true - }) -}) - -Given("Raise Intent returns an app channel", function (this: CustomWorld) { - this.messaging?.setIntentResult({ - channel: { - type: 'app', - id: 'result-channel', - displayMetadata: { - color: "purple", - name: "Result Channel" - } - } - }) -}) + app, + intent, + context, + resultType, + }); + this.props[instanceId] = app; + } +); + +Given('Raise Intent returns a context of {string}', function (this: CustomWorld, result: string) { + this.messaging?.setIntentResult({ + context: handleResolve(result, this), + }); +}); + +Given('Raise Intent will throw a {string} error', function (this: CustomWorld, error: string) { + this.messaging?.setIntentResult({ + error, + }); +}); + +Given('Raise Intent returns no result', function (this: CustomWorld) { + this.messaging?.setIntentResult({}); +}); + +Given('Raise Intent times out', function (this: CustomWorld) { + this.messaging?.setIntentResult({ + timeout: true, + }); +}); + +Given('Raise Intent returns an app channel', function (this: CustomWorld) { + this.messaging?.setIntentResult({ + channel: { + type: 'app', + id: 'result-channel', + displayMetadata: { + color: 'purple', + name: 'Result Channel', + }, + }, + }); +}); Given('Raise Intent returns a user channel', function (this: CustomWorld) { - this.messaging?.setIntentResult({ - channel: { - type: 'user', - id: 'result-channel', - displayMetadata: { - color: "purple", - name: "Result Channel" - } - } - }) -}) - -Given("Raise Intent returns a private channel", function (this: CustomWorld) { - this.messaging?.setIntentResult({ - channel: { - type: 'private', - id: 'result-channel', - displayMetadata: { - color: "purple", - name: "Result Channel" - } - } - }) -}) - -Given('{string} is a intentEvent message with intent {string} and context {string}', function (this: CustomWorld, field: string, intent: string, context: string) { + this.messaging?.setIntentResult({ + channel: { + type: 'user', + id: 'result-channel', + displayMetadata: { + color: 'purple', + name: 'Result Channel', + }, + }, + }); +}); + +Given('Raise Intent returns a private channel', function (this: CustomWorld) { + this.messaging?.setIntentResult({ + channel: { + type: 'private', + id: 'result-channel', + displayMetadata: { + color: 'purple', + name: 'Result Channel', + }, + }, + }); +}); + +Given( + '{string} is a intentEvent message with intent {string} and context {string}', + function (this: CustomWorld, field: string, intent: string, context: string) { const msg: IntentEvent = { - type: 'intentEvent', - meta: { - eventUuid: this.messaging?.createUUID()!!, - timestamp: new Date(), + type: 'intentEvent', + meta: { + eventUuid: this.messaging?.createUUID()!!, + timestamp: new Date(), + }, + payload: { + originatingApp: { + appId: 'some-app-id', + desktopAgent: 'some-desktop-agent', }, - payload: { - originatingApp: { - appId: 'some-app-id', - desktopAgent: "some-desktop-agent" - }, - context: handleResolve(context, this), - intent, - raiseIntentRequestUuid: 'request-id' - } - } - - this.props[field] = msg -}) + context: handleResolve(context, this), + intent, + raiseIntentRequestUuid: 'request-id', + }, + }; + + this.props[field] = msg; + } +); Given('{string} pipes intent to {string}', function (this: CustomWorld, intentHandlerName: string, field: string) { - this.props[field] = [] - this.props[intentHandlerName] = (context: Context, metadata: ContextMetadata) => { - this.props[field].push({ - context, - metadata - }) - } -}) + this.props[field] = []; + this.props[intentHandlerName] = (context: Context, metadata: ContextMetadata) => { + this.props[field].push({ + context, + metadata, + }); + }; +}); Given('{string} returns a context item', function (this: CustomWorld, intentHandlerName: string) { - this.props[intentHandlerName] = async () => { - return { - type: "fdc3.returned-intent", - id: { - in: "one", - out: "two" - } - } - } -}) + this.props[intentHandlerName] = async () => { + return { + type: 'fdc3.returned-intent', + id: { + in: 'one', + out: 'two', + }, + }; + }; +}); Given('{string} returns a channel', function (this: CustomWorld, intentHandlerName: string) { - this.props[intentHandlerName] = async () => { - return { - type: 'private', - id: 'some-channel-id', - displayMetadata: { - color: "ochre", - name: "Some Channel" - } - } - } -}) - + this.props[intentHandlerName] = async () => { + return { + type: 'private', + id: 'some-channel-id', + displayMetadata: { + color: 'ochre', + name: 'Some Channel', + }, + }; + }; +}); Given('{string} returns a void promise', function (this: CustomWorld, intentHandlerName: string) { - this.props[intentHandlerName] = async () => { - return null - } -}) \ No newline at end of file + this.props[intentHandlerName] = async () => { + return null; + }; +}); diff --git a/packages/fdc3-agent-proxy/test/support/TestMessaging.ts b/packages/fdc3-agent-proxy/test/support/TestMessaging.ts index 576aaccf1..642e20680 100644 --- a/packages/fdc3-agent-proxy/test/support/TestMessaging.ts +++ b/packages/fdc3-agent-proxy/test/support/TestMessaging.ts @@ -1,225 +1,234 @@ -import { AppIdentifier, Channel } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; -import { v4 as uuidv4 } from 'uuid' -import { AbstractMessaging } from "../../src/messaging/AbstractMessaging"; -import { RegisterableListener } from "../../src/listeners/RegisterableListener"; -import { FindIntent } from "./responses/FindIntent"; -import { FindIntentByContext } from "./responses/FindIntentByContext"; -import { RaiseIntent } from "./responses/RaiseIntent"; -import { GetAppMetadata } from "./responses/GetAppMetadata"; -import { FindInstances } from "./responses/FindInstances"; -import { Open } from "./responses/Open"; -import { Handshake } from "./responses/Handshake"; -import { GetOrCreateChannel } from "./responses/GetOrCreateChannel"; -import { ChannelState } from "./responses/ChannelState"; -import { GetUserChannels } from "./responses/GetUserChannels"; -import { RegisterListeners } from "./responses/RegisterListeners"; -import { UnsubscribeListeners } from "./responses/UnsubscribeListeners"; -import { CreatePrivateChannel } from "./responses/CreatePrivateChannel"; -import { DisconnectPrivateChannel } from "./responses/DisconnectPrivateChannel"; -import { IntentResult } from "./responses/IntentResult"; -import { RaiseIntentForContext } from "./responses/RaiseIntentForContext"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type AppRequestMessage = BrowserTypes.AppRequestMessage -type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse +import { AppIdentifier, Channel } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; +import { v4 as uuidv4 } from 'uuid'; +import { AbstractMessaging } from '../../src/messaging/AbstractMessaging'; +import { RegisterableListener } from '../../src/listeners/RegisterableListener'; +import { FindIntent } from './responses/FindIntent'; +import { FindIntentByContext } from './responses/FindIntentByContext'; +import { RaiseIntent } from './responses/RaiseIntent'; +import { GetAppMetadata } from './responses/GetAppMetadata'; +import { FindInstances } from './responses/FindInstances'; +import { Open } from './responses/Open'; +import { Handshake } from './responses/Handshake'; +import { GetOrCreateChannel } from './responses/GetOrCreateChannel'; +import { ChannelState } from './responses/ChannelState'; +import { GetUserChannels } from './responses/GetUserChannels'; +import { RegisterListeners } from './responses/RegisterListeners'; +import { UnsubscribeListeners } from './responses/UnsubscribeListeners'; +import { CreatePrivateChannel } from './responses/CreatePrivateChannel'; +import { DisconnectPrivateChannel } from './responses/DisconnectPrivateChannel'; +import { IntentResult } from './responses/IntentResult'; +import { RaiseIntentForContext } from './responses/RaiseIntentForContext'; +import { BrowserTypes } from '@kite9/fdc3-schema'; + +type AppRequestMessage = BrowserTypes.AppRequestMessage; +type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse; export interface IntentDetail { - app?: AppIdentifier, - intent?: string, - context?: string, - resultType?: string, + app?: AppIdentifier; + intent?: string; + context?: string; + resultType?: string; } export interface AutomaticResponse { - - filter: (t: string) => boolean, - action: (input: object, m: TestMessaging) => Promise - + filter: (t: string) => boolean; + action: (input: object, m: TestMessaging) => Promise; } - export interface PossibleIntentResult { - context?: Context; - channel?: any; - error?: string; - timeout?: boolean + context?: Context; + channel?: any; + error?: string; + timeout?: boolean; } function matchStringOrUndefined(expected: string | undefined, actual: string | undefined) { - if ((expected) && (actual)) { - return expected == actual - } else { - return true - } + if (expected && actual) { + return expected == actual; + } else { + return true; + } } function matchString(expected: string | undefined, actual: string | undefined) { - return expected == actual + return expected == actual; } function removeGenericType(t: string) { - const startOfGeneric = t.indexOf("<") - if (startOfGeneric > -1) { - return t.substring(0, startOfGeneric - 1) - } else { - return t - } + const startOfGeneric = t.indexOf('<'); + if (startOfGeneric > -1) { + return t.substring(0, startOfGeneric - 1); + } else { + return t; + } } function matchResultTypes(expected: string | undefined, actual: string | undefined) { - if (expected) { - if (expected.indexOf("<") > -1) { - // looking for a complete match involving generics - return expected == actual - } else if (actual == undefined) { - // no actual, only expected - return false; - } else { - // expected doesn't have generics, match without - const actualType = removeGenericType(actual) - return expected == actualType - } + if (expected) { + if (expected.indexOf('<') > -1) { + // looking for a complete match involving generics + return expected == actual; + } else if (actual == undefined) { + // no actual, only expected + return false; } else { - return true; + // expected doesn't have generics, match without + const actualType = removeGenericType(actual); + return expected == actualType; } + } else { + return true; + } } -export function intentDetailMatches(instance: IntentDetail, template: IntentDetail, contextMustMatch: boolean): boolean { - return matchStringOrUndefined(template.app?.appId, instance.app?.appId) && - matchStringOrUndefined(template.app?.instanceId, instance.app?.instanceId) && - matchStringOrUndefined(template.intent, instance.intent) && - (contextMustMatch ? matchString(template.context, instance.context) : matchStringOrUndefined(template.context, instance.context)) && - matchResultTypes(template.resultType, instance.resultType) +export function intentDetailMatches( + instance: IntentDetail, + template: IntentDetail, + contextMustMatch: boolean +): boolean { + return ( + matchStringOrUndefined(template.app?.appId, instance.app?.appId) && + matchStringOrUndefined(template.app?.instanceId, instance.app?.instanceId) && + matchStringOrUndefined(template.intent, instance.intent) && + (contextMustMatch + ? matchString(template.context, instance.context) + : matchStringOrUndefined(template.context, instance.context)) && + matchResultTypes(template.resultType, instance.resultType) + ); } export class TestMessaging extends AbstractMessaging { - - readonly allPosts: AppRequestMessage[] = [] - readonly listeners: Map = new Map() - readonly intentDetails: IntentDetail[] = [] - readonly channelState: { [key: string]: Context[] } - currentChannel: Channel | null = null - - readonly automaticResponses: AutomaticResponse[] - - constructor(channelState: { [key: string]: Context[] }) { - super({ - timeoutMs: 0, - channelSelector: false, - intentResolver: false, - dontSetWindowFdc3: false - }, "test", "myActualUrl", 200) - - this.channelState = channelState - this.automaticResponses = [ - new FindIntent(), - new FindIntentByContext(), - new RaiseIntent(), - new RaiseIntentForContext(), - new IntentResult(), - new GetAppMetadata(), - new FindInstances(), - new Open(), - new Handshake(), - new GetOrCreateChannel(), - new ChannelState(this.channelState), - new GetUserChannels(), - new RegisterListeners(), - new UnsubscribeListeners(), - new CreatePrivateChannel(), - new DisconnectPrivateChannel() - ] - } - - createUUID(): string { - return uuidv4() - } - - - post(message: AppRequestMessage): Promise { - this.allPosts.push(message) - - for (let i = 0; i < this.automaticResponses.length; i++) { - const ar = this.automaticResponses[i] - if (ar.filter(message.type)) { - return ar.action(message, this) - } - } - - return Promise.resolve(); - } - - addAppIntentDetail(id: IntentDetail) { - this.intentDetails.push(id) - } - - register(l: RegisterableListener) { - if (l.id == null) { - throw new Error("Listener must have ID set") - } else { - this.listeners.set(l.id, l) - } - } - - unregister(id: string) { - this.listeners.delete(id) - } - - createMeta() { - return { - "requestUuid": this.createUUID(), - "timestamp": new Date(), - "source": this.getSource() - } - } - - /** - * Used in testing steps - */ - createResponseMeta() { - return { - ...this.createMeta(), - responseUuid: this.createUUID() - } - } - - /** - * Used in testing steps - */ - createEventMeta() { - return { - ...this.createMeta(), - eventUuid: this.createUUID() - } - } - - receive(m: any, log?: (s: string) => void) { - this.listeners.forEach((v, k) => { - if (v.filter(m)) { - log ? log("Processing in " + k) : "" - v.action(m) - } else { - log ? log("Ignoring in " + k) : "" - } - }) - } - - private ir: PossibleIntentResult | null = null - - getIntentResult() { - return this.ir - } - - setIntentResult(o: PossibleIntentResult) { - this.ir = o - } - - retrieveInstanceUuid(): string | undefined { - return (globalThis as any).instanceUuid as string | undefined - } - - storeInstanceUuid(validationResponse: WebConnectionProtocol5ValidateAppIdentitySuccessResponse): void { - (globalThis as any).instanceUuid = validationResponse.payload.instanceUuid - } -} \ No newline at end of file + readonly allPosts: AppRequestMessage[] = []; + readonly listeners: Map = new Map(); + readonly intentDetails: IntentDetail[] = []; + readonly channelState: { [key: string]: Context[] }; + currentChannel: Channel | null = null; + + readonly automaticResponses: AutomaticResponse[]; + + constructor(channelState: { [key: string]: Context[] }) { + super( + { + timeoutMs: 0, + channelSelector: false, + intentResolver: false, + dontSetWindowFdc3: false, + }, + 'test', + 'myActualUrl', + 200 + ); + + this.channelState = channelState; + this.automaticResponses = [ + new FindIntent(), + new FindIntentByContext(), + new RaiseIntent(), + new RaiseIntentForContext(), + new IntentResult(), + new GetAppMetadata(), + new FindInstances(), + new Open(), + new Handshake(), + new GetOrCreateChannel(), + new ChannelState(this.channelState), + new GetUserChannels(), + new RegisterListeners(), + new UnsubscribeListeners(), + new CreatePrivateChannel(), + new DisconnectPrivateChannel(), + ]; + } + + createUUID(): string { + return uuidv4(); + } + + post(message: AppRequestMessage): Promise { + this.allPosts.push(message); + + for (let i = 0; i < this.automaticResponses.length; i++) { + const ar = this.automaticResponses[i]; + if (ar.filter(message.type)) { + return ar.action(message, this); + } + } + + return Promise.resolve(); + } + + addAppIntentDetail(id: IntentDetail) { + this.intentDetails.push(id); + } + + register(l: RegisterableListener) { + if (l.id == null) { + throw new Error('Listener must have ID set'); + } else { + this.listeners.set(l.id, l); + } + } + + unregister(id: string) { + this.listeners.delete(id); + } + + createMeta() { + return { + requestUuid: this.createUUID(), + timestamp: new Date(), + source: this.getSource(), + }; + } + + /** + * Used in testing steps + */ + createResponseMeta() { + return { + ...this.createMeta(), + responseUuid: this.createUUID(), + }; + } + + /** + * Used in testing steps + */ + createEventMeta() { + return { + ...this.createMeta(), + eventUuid: this.createUUID(), + }; + } + + receive(m: any, log?: (s: string) => void) { + this.listeners.forEach((v, k) => { + if (v.filter(m)) { + log ? log('Processing in ' + k) : ''; + v.action(m); + } else { + log ? log('Ignoring in ' + k) : ''; + } + }); + } + + private ir: PossibleIntentResult | null = null; + + getIntentResult() { + return this.ir; + } + + setIntentResult(o: PossibleIntentResult) { + this.ir = o; + } + + retrieveInstanceUuid(): string | undefined { + return (globalThis as any).instanceUuid as string | undefined; + } + + storeInstanceUuid(validationResponse: WebConnectionProtocol5ValidateAppIdentitySuccessResponse): void { + (globalThis as any).instanceUuid = validationResponse.payload.instanceUuid; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/ChannelState.ts b/packages/fdc3-agent-proxy/test/support/responses/ChannelState.ts index 032e5e602..00be871ac 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/ChannelState.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/ChannelState.ts @@ -1,196 +1,194 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { Context } from "@kite9/fdc3-context"; - -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest -type JoinUserChannelResponse = BrowserTypes.JoinUserChannelResponse -type LeaveCurrentChannelResponse = BrowserTypes.LeaveCurrentChannelResponse -type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest -type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest -type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse -type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest -type AddContextListenerResponse = BrowserTypes.AddContextListenerResponse -type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest -type ContextListenerUnsubscribeResponse = BrowserTypes.ContextListenerUnsubscribeResponse -type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest -type GetCurrentContextResponse = BrowserTypes.GetCurrentContextResponse -type BroadcastRequest = BrowserTypes.BroadcastRequest -type BroadcastResponse = BrowserTypes.BroadcastResponse -type AgentResponseMessage = BrowserTypes.AgentResponseMessage - -import { createResponseMeta } from "./support"; -import { v4 as uuidv4 } from 'uuid' +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { Context } from '@kite9/fdc3-context'; + +import { BrowserTypes } from '@kite9/fdc3-schema'; + +type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest; +type JoinUserChannelResponse = BrowserTypes.JoinUserChannelResponse; +type LeaveCurrentChannelResponse = BrowserTypes.LeaveCurrentChannelResponse; +type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest; +type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest; +type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse; +type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest; +type AddContextListenerResponse = BrowserTypes.AddContextListenerResponse; +type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest; +type ContextListenerUnsubscribeResponse = BrowserTypes.ContextListenerUnsubscribeResponse; +type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest; +type GetCurrentContextResponse = BrowserTypes.GetCurrentContextResponse; +type BroadcastRequest = BrowserTypes.BroadcastRequest; +type BroadcastResponse = BrowserTypes.BroadcastResponse; +type AgentResponseMessage = BrowserTypes.AgentResponseMessage; + +import { createResponseMeta } from './support'; +import { v4 as uuidv4 } from 'uuid'; export class ChannelState implements AutomaticResponse { - - private channelId: string | null = null - private listeners: { [channel: string]: string[] } = {} - private contextHistory: { [channel: string]: Context[] } = {} - - - constructor(contextHistory: { [channel: string]: Context[] }) { - this.contextHistory = contextHistory - } - - filter(t: string) { - return (t == 'broadcastRequest') - || (t == 'joinUserChannelRequest') - || (t == 'leaveCurrentChannelRequest') - || (t == 'getCurrentChannelRequest') - || (t == 'addContextListenerRequest') - || (t == 'contextListenerUnsubscribeRequest') - || (t == 'getCurrentContextRequest') - } - - action(input: any, m: TestMessaging) { - var out: AgentResponseMessage | null = null - switch (input.type) { - case 'joinUserChannelRequest': - out = this.createJoinResponse(input as JoinUserChannelRequest) - break - case 'leaveCurrentChannelRequest': - out = this.createLeaveResponse(input as LeaveCurrentChannelRequest) - break - - case 'getCurrentChannelRequest': - out = this.createGetChannelResponse(input as GetCurrentChannelRequest) - break - - case 'addContextListenerRequest': - out = this.createAddListenerResponse(input as AddContextListenerRequest) - break - - case 'contextListenerUnsubscribeRequest': - out = this.createUnsubscribeResponse(input as ContextListenerUnsubscribeRequest) - break - - case 'getCurrentContextRequest': - out = this.createGetContextResponse(input as GetCurrentContextRequest) - break - - case 'broadcastRequest': - out = this.createBroadcastResponse(input as BroadcastRequest) - break - } - - if (out) { - setTimeout(() => { m.receive(out!!) }, 100) - } - return Promise.resolve() - } - - private createBroadcastResponse(i: BroadcastRequest): BroadcastResponse { - const channel = i.payload.channelId - const context = i.payload.context - this.contextHistory[channel] = this.contextHistory[channel] ?? [] - this.contextHistory[channel].unshift(context) - - return { - meta: createResponseMeta(i.meta), - type: "broadcastResponse", - payload: { - } - } - } - - private createJoinResponse(i: JoinUserChannelRequest): JoinUserChannelResponse { - if (i.payload.channelId == 'nonexistent') { - return { - meta: createResponseMeta(i.meta), - type: "joinUserChannelResponse", - payload: { - error: 'NoChannelFound' - } - } - } else { - this.channelId = i.payload.channelId - return { - meta: createResponseMeta(i.meta), - type: "joinUserChannelResponse", - payload: { - } - } - } - + private channelId: string | null = null; + private listeners: { [channel: string]: string[] } = {}; + private contextHistory: { [channel: string]: Context[] } = {}; + + constructor(contextHistory: { [channel: string]: Context[] }) { + this.contextHistory = contextHistory; + } + + filter(t: string) { + return ( + t == 'broadcastRequest' || + t == 'joinUserChannelRequest' || + t == 'leaveCurrentChannelRequest' || + t == 'getCurrentChannelRequest' || + t == 'addContextListenerRequest' || + t == 'contextListenerUnsubscribeRequest' || + t == 'getCurrentContextRequest' + ); + } + + action(input: any, m: TestMessaging) { + var out: AgentResponseMessage | null = null; + switch (input.type) { + case 'joinUserChannelRequest': + out = this.createJoinResponse(input as JoinUserChannelRequest); + break; + case 'leaveCurrentChannelRequest': + out = this.createLeaveResponse(input as LeaveCurrentChannelRequest); + break; + + case 'getCurrentChannelRequest': + out = this.createGetChannelResponse(input as GetCurrentChannelRequest); + break; + + case 'addContextListenerRequest': + out = this.createAddListenerResponse(input as AddContextListenerRequest); + break; + + case 'contextListenerUnsubscribeRequest': + out = this.createUnsubscribeResponse(input as ContextListenerUnsubscribeRequest); + break; + + case 'getCurrentContextRequest': + out = this.createGetContextResponse(input as GetCurrentContextRequest); + break; + + case 'broadcastRequest': + out = this.createBroadcastResponse(input as BroadcastRequest); + break; } - private createGetContextResponse(input: GetCurrentContextRequest): GetCurrentContextResponse { - const ch = input.payload.channelId - var last: Context | undefined = undefined - const contexts = this.contextHistory[ch] ?? [] - if (input.payload.contextType) { - last = contexts.find((c) => c.type == input.payload.contextType) - } else { - last = contexts.length > 0 ? contexts[0] : undefined - } - return { - meta: createResponseMeta(input.meta), - type: "getCurrentContextResponse", - payload: { - context: last ?? null - } - } + if (out) { + setTimeout(() => { + m.receive(out!!); + }, 100); } - - private createLeaveResponse(i: LeaveCurrentChannelRequest): LeaveCurrentChannelResponse { - this.channelId = null - return { - meta: createResponseMeta(i.meta), - type: "leaveCurrentChannelResponse", - payload: { - } - } + return Promise.resolve(); + } + + private createBroadcastResponse(i: BroadcastRequest): BroadcastResponse { + const channel = i.payload.channelId; + const context = i.payload.context; + this.contextHistory[channel] = this.contextHistory[channel] ?? []; + this.contextHistory[channel].unshift(context); + + return { + meta: createResponseMeta(i.meta), + type: 'broadcastResponse', + payload: {}, + }; + } + + private createJoinResponse(i: JoinUserChannelRequest): JoinUserChannelResponse { + if (i.payload.channelId == 'nonexistent') { + return { + meta: createResponseMeta(i.meta), + type: 'joinUserChannelResponse', + payload: { + error: 'NoChannelFound', + }, + }; + } else { + this.channelId = i.payload.channelId; + return { + meta: createResponseMeta(i.meta), + type: 'joinUserChannelResponse', + payload: {}, + }; } - - private createAddListenerResponse(i: AddContextListenerRequest): AddContextListenerResponse { - const id = uuidv4() - - if (this.channelId) { - const list = this.listeners[this.channelId] ?? [] - list.push(id) - this.listeners[this.channelId] = list - } - - return { - meta: createResponseMeta(i.meta), - type: "addContextListenerResponse", - payload: { - listenerUUID: id - } - } + } + + private createGetContextResponse(input: GetCurrentContextRequest): GetCurrentContextResponse { + const ch = input.payload.channelId; + var last: Context | undefined = undefined; + const contexts = this.contextHistory[ch] ?? []; + if (input.payload.contextType) { + last = contexts.find(c => c.type == input.payload.contextType); + } else { + last = contexts.length > 0 ? contexts[0] : undefined; } - - private createUnsubscribeResponse(i: ContextListenerUnsubscribeRequest): ContextListenerUnsubscribeResponse { - const id = i.payload.listenerUUID - Object.keys(this.listeners).forEach((k) => { - this.listeners[k] = this.listeners[k].filter((v) => v != id) - }) - - return { - meta: createResponseMeta(i.meta), - type: "contextListenerUnsubscribeResponse", - payload: { - } - } + return { + meta: createResponseMeta(input.meta), + type: 'getCurrentContextResponse', + payload: { + context: last ?? null, + }, + }; + } + + private createLeaveResponse(i: LeaveCurrentChannelRequest): LeaveCurrentChannelResponse { + this.channelId = null; + return { + meta: createResponseMeta(i.meta), + type: 'leaveCurrentChannelResponse', + payload: {}, + }; + } + + private createAddListenerResponse(i: AddContextListenerRequest): AddContextListenerResponse { + const id = uuidv4(); + + if (this.channelId) { + const list = this.listeners[this.channelId] ?? []; + list.push(id); + this.listeners[this.channelId] = list; } - - private createGetChannelResponse(i: GetCurrentChannelRequest): GetCurrentChannelResponse { - return { - meta: createResponseMeta(i.meta), - type: "getCurrentChannelResponse", - payload: { - channel: this.channelId ? { - id: this.channelId, - type: 'user', - displayMetadata: { - name: "The " + this.channelId + " channel", - color: "red", - glyph: "triangle", - } - } : null + return { + meta: createResponseMeta(i.meta), + type: 'addContextListenerResponse', + payload: { + listenerUUID: id, + }, + }; + } + + private createUnsubscribeResponse(i: ContextListenerUnsubscribeRequest): ContextListenerUnsubscribeResponse { + const id = i.payload.listenerUUID; + Object.keys(this.listeners).forEach(k => { + this.listeners[k] = this.listeners[k].filter(v => v != id); + }); + + return { + meta: createResponseMeta(i.meta), + type: 'contextListenerUnsubscribeResponse', + payload: {}, + }; + } + + private createGetChannelResponse(i: GetCurrentChannelRequest): GetCurrentChannelResponse { + return { + meta: createResponseMeta(i.meta), + type: 'getCurrentChannelResponse', + payload: { + channel: this.channelId + ? { + id: this.channelId, + type: 'user', + displayMetadata: { + name: 'The ' + this.channelId + ' channel', + color: 'red', + glyph: 'triangle', + }, } - } as GetCurrentChannelResponse - } -} \ No newline at end of file + : null, + }, + } as GetCurrentChannelResponse; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/CreatePrivateChannel.ts b/packages/fdc3-agent-proxy/test/support/responses/CreatePrivateChannel.ts index e815a69a0..0ca94fb70 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/CreatePrivateChannel.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/CreatePrivateChannel.ts @@ -1,41 +1,42 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { createResponseMeta } from "./support"; -import { v4 as uuidv4 } from 'uuid' +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { createResponseMeta } from './support'; +import { v4 as uuidv4 } from 'uuid'; -type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest -type CreatePrivateChannelResponse = BrowserTypes.CreatePrivateChannelResponse +type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest; +type CreatePrivateChannelResponse = BrowserTypes.CreatePrivateChannelResponse; export class CreatePrivateChannel implements AutomaticResponse { + count: number = 0; - count: number = 0 + filter(t: string) { + return t == 'createPrivateChannelRequest'; + } - filter(t: string) { - return t == 'createPrivateChannelRequest' - } + action(input: object, m: TestMessaging) { + const out = this.createResponse(input as CreatePrivateChannelRequest); - action(input: object, m: TestMessaging) { - const out = this.createResponse(input as CreatePrivateChannelRequest) + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: CreatePrivateChannelRequest): CreatePrivateChannelResponse { - return { - meta: createResponseMeta(i.meta), - type: "createPrivateChannelResponse", - payload: { - privateChannel: { - id: uuidv4(), - type: 'private', - displayMetadata: { - name: 'Private Channel' + this.count++, - color: 'blue', - glyph: 'circle' - } - } - } - } - } -} \ No newline at end of file + private createResponse(i: CreatePrivateChannelRequest): CreatePrivateChannelResponse { + return { + meta: createResponseMeta(i.meta), + type: 'createPrivateChannelResponse', + payload: { + privateChannel: { + id: uuidv4(), + type: 'private', + displayMetadata: { + name: 'Private Channel' + this.count++, + color: 'blue', + glyph: 'circle', + }, + }, + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/DisconnectPrivateChannel.ts b/packages/fdc3-agent-proxy/test/support/responses/DisconnectPrivateChannel.ts index 677ad7723..d0a2716fc 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/DisconnectPrivateChannel.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/DisconnectPrivateChannel.ts @@ -1,30 +1,31 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { createResponseMeta } from "./support"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { createResponseMeta } from './support'; -type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest -type PrivateChannelDisconnectResponse = BrowserTypes.PrivateChannelDisconnectResponse +type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest; +type PrivateChannelDisconnectResponse = BrowserTypes.PrivateChannelDisconnectResponse; export class DisconnectPrivateChannel implements AutomaticResponse { + count: number = 0; - count: number = 0 + filter(t: string) { + return t == 'privateChannelDisconnectRequest'; + } - filter(t: string) { - return t == 'privateChannelDisconnectRequest' - } + action(input: object, m: TestMessaging) { + const out = this.createResponse(input as PrivateChannelDisconnectRequest); - action(input: object, m: TestMessaging) { - const out = this.createResponse(input as PrivateChannelDisconnectRequest) + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: PrivateChannelDisconnectRequest): PrivateChannelDisconnectResponse { - return { - meta: createResponseMeta(i.meta), - type: "privateChannelDisconnectResponse", - payload: {} - } - } -} \ No newline at end of file + private createResponse(i: PrivateChannelDisconnectRequest): PrivateChannelDisconnectResponse { + return { + meta: createResponseMeta(i.meta), + type: 'privateChannelDisconnectResponse', + payload: {}, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/FindInstances.ts b/packages/fdc3-agent-proxy/test/support/responses/FindInstances.ts index 9e3212610..8a4bd170d 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/FindInstances.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/FindInstances.ts @@ -1,35 +1,34 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type FindInstancesRequest = BrowserTypes.FindInstancesRequest -type FindInstancesResponse = BrowserTypes.FindInstancesResponse +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +type FindInstancesRequest = BrowserTypes.FindInstancesRequest; +type FindInstancesResponse = BrowserTypes.FindInstancesResponse; export class FindInstances implements AutomaticResponse { - - filter(t: string) { - return t == 'findInstancesRequest' - } - - action(input: object, m: TestMessaging) { - const out = this.createFindInstancesResponse(input as FindInstancesRequest) - - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createFindInstancesResponse(m: FindInstancesRequest): FindInstancesResponse { - return { - meta: m.meta as any, - type: "findInstancesResponse", - payload: { - appIdentifiers: [ - { appId: "One", instanceId: "1" }, - { appId: "Two", instanceId: "2" }, - { appId: "Three", instanceId: "3" }, - - ] - } - } - } -} \ No newline at end of file + filter(t: string) { + return t == 'findInstancesRequest'; + } + + action(input: object, m: TestMessaging) { + const out = this.createFindInstancesResponse(input as FindInstancesRequest); + + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } + + private createFindInstancesResponse(m: FindInstancesRequest): FindInstancesResponse { + return { + meta: m.meta as any, + type: 'findInstancesResponse', + payload: { + appIdentifiers: [ + { appId: 'One', instanceId: '1' }, + { appId: 'Two', instanceId: '2' }, + { appId: 'Three', instanceId: '3' }, + ], + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/FindIntent.ts b/packages/fdc3-agent-proxy/test/support/responses/FindIntent.ts index 847e9393f..ed7420cf8 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/FindIntent.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/FindIntent.ts @@ -1,51 +1,52 @@ -import { AutomaticResponse, IntentDetail, TestMessaging, intentDetailMatches } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, IntentDetail, TestMessaging, intentDetailMatches } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type FindIntentRequest = BrowserTypes.FindIntentRequest -type FindIntentResponse = BrowserTypes.FindIntentResponse +type FindIntentRequest = BrowserTypes.FindIntentRequest; +type FindIntentResponse = BrowserTypes.FindIntentResponse; export class FindIntent implements AutomaticResponse { + filter(t: string) { + return t == 'findIntentRequest'; + } - filter(t: string) { - return t == 'findIntentRequest' - } + action(input: object, m: TestMessaging) { + const intentRequest = input as FindIntentRequest; + const payload = intentRequest.payload; + const intent = payload.intent; + const context = payload?.context?.type; + const resultType = payload?.resultType; + const template: IntentDetail = { + intent, + context, + resultType, + }; - action(input: object, m: TestMessaging) { - const intentRequest = input as FindIntentRequest - const payload = intentRequest.payload - const intent = payload.intent - const context = payload?.context?.type - const resultType = payload?.resultType; - const template: IntentDetail = { - intent, - context, - resultType - } + const relevant = m.intentDetails.filter(id => intentDetailMatches(id, template, false)); + const request = this.createFindIntentResponseMessage(intentRequest, relevant); + setTimeout(() => { + m.receive(request); + }, 100); + return Promise.resolve(); + } - const relevant = m.intentDetails.filter(id => intentDetailMatches(id, template, false)) - const request = this.createFindIntentResponseMessage(intentRequest, relevant) - setTimeout(() => { m.receive(request) }, 100) - return Promise.resolve() - } - - private createFindIntentResponseMessage(m: FindIntentRequest, relevant: IntentDetail[]): FindIntentResponse { - return { - meta: m.meta as any, - type: "findIntentResponse", - payload: { - appIntent: { - apps: relevant.map(r => { - return { - appId: r?.app?.appId!!, - instanceId: r?.app?.instanceId - } - }), - intent: { - displayName: m.payload.intent, - name: m.payload.intent - } - } - } - } - } -} \ No newline at end of file + private createFindIntentResponseMessage(m: FindIntentRequest, relevant: IntentDetail[]): FindIntentResponse { + return { + meta: m.meta as any, + type: 'findIntentResponse', + payload: { + appIntent: { + apps: relevant.map(r => { + return { + appId: r?.app?.appId!!, + instanceId: r?.app?.instanceId, + }; + }), + intent: { + displayName: m.payload.intent, + name: m.payload.intent, + }, + }, + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/FindIntentByContext.ts b/packages/fdc3-agent-proxy/test/support/responses/FindIntentByContext.ts index d1381d26d..9f5a15155 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/FindIntentByContext.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/FindIntentByContext.ts @@ -1,47 +1,47 @@ -import { AutomaticResponse, IntentDetail, TestMessaging, intentDetailMatches } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, IntentDetail, TestMessaging, intentDetailMatches } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest -type FindIntentsByContextResponse = BrowserTypes.FindIntentsByContextResponse +type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest; +type FindIntentsByContextResponse = BrowserTypes.FindIntentsByContextResponse; export class FindIntentByContext implements AutomaticResponse { - - filter(t: string) { - return t == 'findIntentsByContextRequest' - } - - action(input: object, m: TestMessaging) { - const intentRequest = input as FindIntentsByContextRequest - const payload = intentRequest.payload - const context = payload?.context?.type - const template: IntentDetail = { - context - } - - const relevant = m.intentDetails.filter(id => intentDetailMatches(id, template, true)) - const request = this.createFindIntentsByContextResponseMessage(intentRequest, relevant) - setTimeout(() => { m.receive(request) }, 100) - return Promise.resolve() - } - - - private createFindIntentsByContextResponseMessage(m: FindIntentsByContextRequest, relevant: IntentDetail[]): FindIntentsByContextResponse { - const relevantIntents = [...new Set(relevant.map(r => r.intent!!))] - - return { - meta: m.meta as any, - type: "findIntentsByContextResponse", - payload: { - appIntents: - relevantIntents.map(i => { - return { - intent: { name: i, displayName: i }, - apps: relevant - .filter(r => r.intent == i) - .map(r => r.app!!)!! - } - }) - } - } - } -} \ No newline at end of file + filter(t: string) { + return t == 'findIntentsByContextRequest'; + } + + action(input: object, m: TestMessaging) { + const intentRequest = input as FindIntentsByContextRequest; + const payload = intentRequest.payload; + const context = payload?.context?.type; + const template: IntentDetail = { + context, + }; + + const relevant = m.intentDetails.filter(id => intentDetailMatches(id, template, true)); + const request = this.createFindIntentsByContextResponseMessage(intentRequest, relevant); + setTimeout(() => { + m.receive(request); + }, 100); + return Promise.resolve(); + } + + private createFindIntentsByContextResponseMessage( + m: FindIntentsByContextRequest, + relevant: IntentDetail[] + ): FindIntentsByContextResponse { + const relevantIntents = [...new Set(relevant.map(r => r.intent!!))]; + + return { + meta: m.meta as any, + type: 'findIntentsByContextResponse', + payload: { + appIntents: relevantIntents.map(i => { + return { + intent: { name: i, displayName: i }, + apps: relevant.filter(r => r.intent == i).map(r => r.app!!)!!, + }; + }), + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/GetAppMetadata.ts b/packages/fdc3-agent-proxy/test/support/responses/GetAppMetadata.ts index 5aa6cb72a..c01075e52 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/GetAppMetadata.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/GetAppMetadata.ts @@ -1,34 +1,34 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest -type GetAppMetadataResponse = BrowserTypes.GetAppMetadataResponse +type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest; +type GetAppMetadataResponse = BrowserTypes.GetAppMetadataResponse; export class GetAppMetadata implements AutomaticResponse { + filter(t: string) { + return t == 'getAppMetadataRequest'; + } + action(input: object, m: TestMessaging) { + const out = this.createMetadataResponseMessage(input as GetAppMetadataRequest); - filter(t: string) { - return t == 'getAppMetadataRequest' - } + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - action(input: object, m: TestMessaging) { - const out = this.createMetadataResponseMessage(input as GetAppMetadataRequest) - - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createMetadataResponseMessage(m: GetAppMetadataRequest): GetAppMetadataResponse { - return { - meta: m.meta as any, - type: "getAppMetadataResponse", - payload: { - appMetadata: { - appId: m.payload.app.appId, - name: "Metadata Name", - description: "Metadata Description" - } - } - } - } -} \ No newline at end of file + private createMetadataResponseMessage(m: GetAppMetadataRequest): GetAppMetadataResponse { + return { + meta: m.meta as any, + type: 'getAppMetadataResponse', + payload: { + appMetadata: { + appId: m.payload.app.appId, + name: 'Metadata Name', + description: 'Metadata Description', + }, + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/GetOrCreateChannel.ts b/packages/fdc3-agent-proxy/test/support/responses/GetOrCreateChannel.ts index d5a757494..1d0521666 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/GetOrCreateChannel.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/GetOrCreateChannel.ts @@ -1,61 +1,60 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { ChannelError } from "@kite9/fdc3-standard"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { createResponseMeta } from "./support"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { ChannelError } from '@kite9/fdc3-standard'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { createResponseMeta } from './support'; -type ChannelType = { [channelId: string]: 'user' | 'app' | 'private' } -type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest -type GetOrCreateChannelResponse = BrowserTypes.GetOrCreateChannelResponse +type ChannelType = { [channelId: string]: 'user' | 'app' | 'private' }; +type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest; +type GetOrCreateChannelResponse = BrowserTypes.GetOrCreateChannelResponse; export class GetOrCreateChannel implements AutomaticResponse { - - private type: ChannelType = {} - - - filter(t: string) { - return t == 'getOrCreateChannelRequest' - } - - action(input: object, m: TestMessaging) { - const out = this.registerChannel(input as GetOrCreateChannelRequest) - - setTimeout(() => { m.receive(out as any) }, 100) - return Promise.resolve() - } - - registerChannel(r: GetOrCreateChannelRequest): GetOrCreateChannelResponse { - const id = r.payload.channelId - const type = 'app' - - const existingType = this.type[id] - - if ((existingType) && (existingType != type)) { - // channel already exists - return { - type: "getOrCreateChannelResponse", - meta: createResponseMeta(r.meta), - payload: { - error: ChannelError.AccessDenied - } - } - - } else { - this.type[id] = type - return { - type: "getOrCreateChannelResponse", - meta: createResponseMeta(r.meta), - payload: { - channel: { - id, - type, - displayMetadata: { - name: "The " + id + " Channel", - color: "cerulean blue", - glyph: "triangle" - } - } - } - } - } + private type: ChannelType = {}; + + filter(t: string) { + return t == 'getOrCreateChannelRequest'; + } + + action(input: object, m: TestMessaging) { + const out = this.registerChannel(input as GetOrCreateChannelRequest); + + setTimeout(() => { + m.receive(out as any); + }, 100); + return Promise.resolve(); + } + + registerChannel(r: GetOrCreateChannelRequest): GetOrCreateChannelResponse { + const id = r.payload.channelId; + const type = 'app'; + + const existingType = this.type[id]; + + if (existingType && existingType != type) { + // channel already exists + return { + type: 'getOrCreateChannelResponse', + meta: createResponseMeta(r.meta), + payload: { + error: ChannelError.AccessDenied, + }, + }; + } else { + this.type[id] = type; + return { + type: 'getOrCreateChannelResponse', + meta: createResponseMeta(r.meta), + payload: { + channel: { + id, + type, + displayMetadata: { + name: 'The ' + id + ' Channel', + color: 'cerulean blue', + glyph: 'triangle', + }, + }, + }, + }; } -} \ No newline at end of file + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/GetUserChannels.ts b/packages/fdc3-agent-proxy/test/support/responses/GetUserChannels.ts index 6f68a8c3e..d46aad405 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/GetUserChannels.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/GetUserChannels.ts @@ -1,44 +1,44 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { createResponseMeta } from "./support"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { createResponseMeta } from './support'; -type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest -type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse -type Channel = BrowserTypes.Channel +type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest; +type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse; +type Channel = BrowserTypes.Channel; export class GetUserChannels implements AutomaticResponse { - - filter(t: string) { - return t == 'getUserChannelsRequest' - } - - action(input: object, m: TestMessaging) { - const out = this.createResponse(input as GetUserChannelsRequest, m) - - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: GetUserChannelsRequest, m: TestMessaging): GetUserChannelsResponse { - - const userChannels: Channel[] = Object.keys(m.channelState).map((c) => { - return { - id: c, - type: 'user', - displayMetadata: { - name: "The " + c + " channel", - color: "red", - glyph: "triangle", - } - } as any - }) - - return { - meta: createResponseMeta(i.meta), - type: "getUserChannelsResponse", - payload: { - userChannels - } - } - } -} \ No newline at end of file + filter(t: string) { + return t == 'getUserChannelsRequest'; + } + + action(input: object, m: TestMessaging) { + const out = this.createResponse(input as GetUserChannelsRequest, m); + + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } + + private createResponse(i: GetUserChannelsRequest, m: TestMessaging): GetUserChannelsResponse { + const userChannels: Channel[] = Object.keys(m.channelState).map(c => { + return { + id: c, + type: 'user', + displayMetadata: { + name: 'The ' + c + ' channel', + color: 'red', + glyph: 'triangle', + }, + } as any; + }); + + return { + meta: createResponseMeta(i.meta), + type: 'getUserChannelsResponse', + payload: { + userChannels, + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/Handshake.ts b/packages/fdc3-agent-proxy/test/support/responses/Handshake.ts index f327f222f..8f52e5d82 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/Handshake.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/Handshake.ts @@ -1,48 +1,52 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity -type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse +type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity; +type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse; export class Handshake implements AutomaticResponse { + filter(t: string) { + return t == 'WCP4ValidateAppIdentity'; + } - filter(t: string) { - return t == 'WCP4ValidateAppIdentity' - } + action(input: object, m: TestMessaging) { + const out = this.createResponse(input as WebConnectionProtocol4ValidateAppIdentity); - action(input: object, m: TestMessaging) { - const out = this.createResponse(input as WebConnectionProtocol4ValidateAppIdentity) + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: WebConnectionProtocol4ValidateAppIdentity): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - return { - meta: { - connectionAttemptUuid: i.meta.connectionAttemptUuid, - timestamp: new Date(), - }, - type: "WCP5ValidateAppIdentityResponse", - payload: { - implementationMetadata: { - appMetadata: { - appId: "cucumber-app", - instanceId: "cucumber-instance", - }, - fdc3Version: "2.0", - optionalFeatures: { - DesktopAgentBridging: false, - OriginatingAppMetadata: true, - UserChannelMembershipAPIs: true - }, - provider: "cucumber-provider", - providerVersion: "test" - }, - appId: 'cucumber-app', - instanceId: 'cucumber-instance', - instanceUuid: 'some-instance-uuid', - } - } - } -} \ No newline at end of file + private createResponse( + i: WebConnectionProtocol4ValidateAppIdentity + ): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + return { + meta: { + connectionAttemptUuid: i.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + type: 'WCP5ValidateAppIdentityResponse', + payload: { + implementationMetadata: { + appMetadata: { + appId: 'cucumber-app', + instanceId: 'cucumber-instance', + }, + fdc3Version: '2.0', + optionalFeatures: { + DesktopAgentBridging: false, + OriginatingAppMetadata: true, + UserChannelMembershipAPIs: true, + }, + provider: 'cucumber-provider', + providerVersion: 'test', + }, + appId: 'cucumber-app', + instanceId: 'cucumber-instance', + instanceUuid: 'some-instance-uuid', + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/IntentResult.ts b/packages/fdc3-agent-proxy/test/support/responses/IntentResult.ts index eab1f1d9e..f4f1e0b9f 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/IntentResult.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/IntentResult.ts @@ -1,40 +1,38 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type IntentResultRequest = BrowserTypes.IntentResultRequest -type IntentResultResponse = BrowserTypes.IntentResultResponse +type IntentResultRequest = BrowserTypes.IntentResultRequest; +type IntentResultResponse = BrowserTypes.IntentResultResponse; export class IntentResult implements AutomaticResponse { - - filter(t: string) { - return t == 'intentResultRequest' - } - - - - createIntentResultResponseMessage(intentRequest: IntentResultRequest, m: TestMessaging): IntentResultResponse { - const out: IntentResultResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - }, - type: "intentResultResponse" - } - - return out - } - - action(input: object, m: TestMessaging) { - const intentRequest = input as IntentResultRequest - const payload = intentRequest.payload - - m.setIntentResult(payload.intentResult as any) - - // next, send the result response - const out2 = this.createIntentResultResponseMessage(intentRequest, m) - setTimeout(() => { m.receive(out2) }, 100) - return Promise.resolve() - } + filter(t: string) { + return t == 'intentResultRequest'; + } + + createIntentResultResponseMessage(intentRequest: IntentResultRequest, m: TestMessaging): IntentResultResponse { + const out: IntentResultResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: {}, + type: 'intentResultResponse', + }; + + return out; + } + + action(input: object, m: TestMessaging) { + const intentRequest = input as IntentResultRequest; + const payload = intentRequest.payload; + + m.setIntentResult(payload.intentResult as any); + + // next, send the result response + const out2 = this.createIntentResultResponseMessage(intentRequest, m); + setTimeout(() => { + m.receive(out2); + }, 100); + return Promise.resolve(); + } } diff --git a/packages/fdc3-agent-proxy/test/support/responses/Open.ts b/packages/fdc3-agent-proxy/test/support/responses/Open.ts index fdd3e11d9..55581a798 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/Open.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/Open.ts @@ -1,44 +1,45 @@ -import { AutomaticResponse, IntentDetail, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AutomaticResponse, IntentDetail, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type OpenRequest = BrowserTypes.OpenRequest -type OpenResponse = BrowserTypes.OpenResponse +type OpenRequest = BrowserTypes.OpenRequest; +type OpenResponse = BrowserTypes.OpenResponse; export class Open implements AutomaticResponse { + filter(t: string) { + return t == 'openRequest'; + } - filter(t: string) { - return t == 'openRequest' - } - - action(input: object, m: TestMessaging) { - const out = this.createOpenResponse(input as OpenRequest, m.intentDetails[0], m) + action(input: object, m: TestMessaging) { + const out = this.createOpenResponse(input as OpenRequest, m.intentDetails[0], m); - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - private createOpenResponse(m: OpenRequest, id: IntentDetail, tm: TestMessaging): OpenResponse { - const found = tm.intentDetails.find(id => id.app?.appId == m.payload.app.appId) + private createOpenResponse(m: OpenRequest, id: IntentDetail, tm: TestMessaging): OpenResponse { + const found = tm.intentDetails.find(id => id.app?.appId == m.payload.app.appId); - if (found) { - return { - meta: m.meta as any, - type: "openResponse", - payload: { - appIdentifier: { - appId: id.app?.appId!!, - instanceId: "abc123" - } - } - } as OpenResponse - } else { - return { - meta: m.meta as any, - type: "openResponse", - payload: { - error: "AppNotFound" - } - } as OpenResponse - } + if (found) { + return { + meta: m.meta as any, + type: 'openResponse', + payload: { + appIdentifier: { + appId: id.app?.appId!!, + instanceId: 'abc123', + }, + }, + } as OpenResponse; + } else { + return { + meta: m.meta as any, + type: 'openResponse', + payload: { + error: 'AppNotFound', + }, + } as OpenResponse; } -} \ No newline at end of file + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/RaiseIntent.ts b/packages/fdc3-agent-proxy/test/support/responses/RaiseIntent.ts index efb426301..509c4ec69 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/RaiseIntent.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/RaiseIntent.ts @@ -1,158 +1,166 @@ -import { AutomaticResponse, IntentDetail, intentDetailMatches, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { ResolveError } from "@kite9/fdc3-standard" - -type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest -type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse -type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse - +import { AutomaticResponse, IntentDetail, intentDetailMatches, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { ResolveError } from '@kite9/fdc3-standard'; +type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest; +type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse; +type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse; export class RaiseIntent implements AutomaticResponse { - - filter(t: string) { - return t == 'raiseIntentRequest' - } - - createCannedRaiseIntentResponseMessage(intentRequest: RaiseIntentRequest, m: TestMessaging): RaiseIntentResponse { - const result = m.getIntentResult()!! - if (result.error) { - const out: RaiseIntentResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - error: result.error as any - }, - type: "raiseIntentResponse" - } - - return out - } else { - const out: RaiseIntentResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - intentResolution: { - intent: intentRequest.payload.intent, - source: { - appId: "some-app", - instanceId: "abc123" - } - } - }, - type: "raiseIntentResponse" - } - - return out - } + filter(t: string) { + return t == 'raiseIntentRequest'; + } + + createCannedRaiseIntentResponseMessage(intentRequest: RaiseIntentRequest, m: TestMessaging): RaiseIntentResponse { + const result = m.getIntentResult()!!; + if (result.error) { + const out: RaiseIntentResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + error: result.error as any, + }, + type: 'raiseIntentResponse', + }; + + return out; + } else { + const out: RaiseIntentResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + intentResolution: { + intent: intentRequest.payload.intent, + source: { + appId: 'some-app', + instanceId: 'abc123', + }, + }, + }, + type: 'raiseIntentResponse', + }; + + return out; } - - private createRaiseIntentResponseMessage(intentRequest: RaiseIntentRequest, relevant: IntentDetail[], m: TestMessaging): RaiseIntentResponse { - if (relevant.length == 0) { - return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentResponse", - payload: { - error: ResolveError.NoAppsFound - } - } - } else if (relevant.length == 1) { - return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentResponse", - payload: { - intentResolution: { - intent: relevant[0].intent!!, - source: relevant[0].app!! - } - } - } - } else { - return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentResponse", - payload: { - appIntent: { - apps: relevant.map(r => { - return { - appId: r?.app?.appId!!, - instanceId: r?.app?.instanceId - } - }), - intent: { - displayName: intentRequest.payload.intent, - name: intentRequest.payload.intent - } - } - } - } - } + } + + private createRaiseIntentResponseMessage( + intentRequest: RaiseIntentRequest, + relevant: IntentDetail[], + m: TestMessaging + ): RaiseIntentResponse { + if (relevant.length == 0) { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentResponse', + payload: { + error: ResolveError.NoAppsFound, + }, + }; + } else if (relevant.length == 1) { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentResponse', + payload: { + intentResolution: { + intent: relevant[0].intent!!, + source: relevant[0].app!!, + }, + }, + }; + } else { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentResponse', + payload: { + appIntent: { + apps: relevant.map(r => { + return { + appId: r?.app?.appId!!, + instanceId: r?.app?.instanceId, + }; + }), + intent: { + displayName: intentRequest.payload.intent, + name: intentRequest.payload.intent, + }, + }, + }, + }; } - - createRaiseIntentResultResponseMesssage(intentRequest: RaiseIntentRequest, m: TestMessaging): RaiseIntentResultResponse | undefined { - const result = m.getIntentResult()!! - if (result.error) { - return undefined - } else { - const out: RaiseIntentResultResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - intentResult: m.getIntentResult()!! - }, - type: "raiseIntentResultResponse" - } - - return out - } - + } + + createRaiseIntentResultResponseMesssage( + intentRequest: RaiseIntentRequest, + m: TestMessaging + ): RaiseIntentResultResponse | undefined { + const result = m.getIntentResult()!!; + if (result.error) { + return undefined; + } else { + const out: RaiseIntentResultResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + intentResult: m.getIntentResult()!!, + }, + type: 'raiseIntentResultResponse', + }; + + return out; } - - action(input: object, m: TestMessaging) { - const intentRequest = input as RaiseIntentRequest - const payload = intentRequest.payload - const intent = payload.intent - const context = payload?.context?.type - - - if (m.getIntentResult() == undefined) { - // we're going to figure out the right response based on the app details (a la FindIntent) - const app = payload?.app - const using: IntentDetail = { - intent, - context, - app - } - - const relevant = m.intentDetails.filter(id => intentDetailMatches(id, using, false)) - const request = this.createRaiseIntentResponseMessage(intentRequest, relevant, m) - setTimeout(() => { m.receive(request) }, 100) - } else if (!m.getIntentResult()?.timeout) { - // this sends out the pre-set intent resolution - const out1 = this.createCannedRaiseIntentResponseMessage(intentRequest, m) - setTimeout(() => { m.receive(out1) }, 100) - - // next, send the result response - const out2 = this.createRaiseIntentResultResponseMesssage(intentRequest, m) - if (out2) { - setTimeout(() => { m.receive(out2) }, 300) - } - } - return Promise.resolve() + } + + action(input: object, m: TestMessaging) { + const intentRequest = input as RaiseIntentRequest; + const payload = intentRequest.payload; + const intent = payload.intent; + const context = payload?.context?.type; + + if (m.getIntentResult() == undefined) { + // we're going to figure out the right response based on the app details (a la FindIntent) + const app = payload?.app; + const using: IntentDetail = { + intent, + context, + app, + }; + + const relevant = m.intentDetails.filter(id => intentDetailMatches(id, using, false)); + const request = this.createRaiseIntentResponseMessage(intentRequest, relevant, m); + setTimeout(() => { + m.receive(request); + }, 100); + } else if (!m.getIntentResult()?.timeout) { + // this sends out the pre-set intent resolution + const out1 = this.createCannedRaiseIntentResponseMessage(intentRequest, m); + setTimeout(() => { + m.receive(out1); + }, 100); + + // next, send the result response + const out2 = this.createRaiseIntentResultResponseMesssage(intentRequest, m); + if (out2) { + setTimeout(() => { + m.receive(out2); + }, 300); + } } + return Promise.resolve(); + } } diff --git a/packages/fdc3-agent-proxy/test/support/responses/RaiseIntentForContext.ts b/packages/fdc3-agent-proxy/test/support/responses/RaiseIntentForContext.ts index 44a130700..8cb27934a 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/RaiseIntentForContext.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/RaiseIntentForContext.ts @@ -1,151 +1,164 @@ -import { AutomaticResponse, IntentDetail, intentDetailMatches, TestMessaging } from "../TestMessaging"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { ResolveError } from "@kite9/fdc3-standard" +import { AutomaticResponse, IntentDetail, intentDetailMatches, TestMessaging } from '../TestMessaging'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { ResolveError } from '@kite9/fdc3-standard'; -type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest -type RaiseIntentForContextResponse = BrowserTypes.RaiseIntentForContextResponse -type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse +type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest; +type RaiseIntentForContextResponse = BrowserTypes.RaiseIntentForContextResponse; +type RaiseIntentResultResponse = BrowserTypes.RaiseIntentResultResponse; export class RaiseIntentForContext implements AutomaticResponse { - - filter(t: string) { - return t == 'raiseIntentForContextRequest' - } - - createCannedRaiseIntentForContextResponseMessage(intentRequest: RaiseIntentForContextRequest, m: TestMessaging): RaiseIntentForContextResponse { - const result = m.getIntentResult()!! - if (result.error) { - const out: RaiseIntentForContextResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - error: result.error as any - }, - type: "raiseIntentForContextResponse" - } - - return out - } else { - const out: RaiseIntentForContextResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - intentResolution: { - intent: "some-canned-intent", - source: { - appId: "some-app", - instanceId: "abc123" - } - } - }, - type: "raiseIntentForContextResponse" - } - - return out - } + filter(t: string) { + return t == 'raiseIntentForContextRequest'; + } + + createCannedRaiseIntentForContextResponseMessage( + intentRequest: RaiseIntentForContextRequest, + m: TestMessaging + ): RaiseIntentForContextResponse { + const result = m.getIntentResult()!!; + if (result.error) { + const out: RaiseIntentForContextResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + error: result.error as any, + }, + type: 'raiseIntentForContextResponse', + }; + + return out; + } else { + const out: RaiseIntentForContextResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + intentResolution: { + intent: 'some-canned-intent', + source: { + appId: 'some-app', + instanceId: 'abc123', + }, + }, + }, + type: 'raiseIntentForContextResponse', + }; + + return out; } - - private createRaiseIntentForContextResponseMessage(intentRequest: RaiseIntentForContextRequest, relevant: IntentDetail[], m: TestMessaging): RaiseIntentForContextResponse { - if (relevant.length == 0) { - return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentForContextResponse", - payload: { - error: ResolveError.NoAppsFound - } - } - } else if (relevant.length == 1) { + } + + private createRaiseIntentForContextResponseMessage( + intentRequest: RaiseIntentForContextRequest, + relevant: IntentDetail[], + m: TestMessaging + ): RaiseIntentForContextResponse { + if (relevant.length == 0) { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentForContextResponse', + payload: { + error: ResolveError.NoAppsFound, + }, + }; + } else if (relevant.length == 1) { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentForContextResponse', + payload: { + intentResolution: { + intent: relevant[0].intent!!, + source: relevant[0].app!!, + }, + }, + }; + } else { + return { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + type: 'raiseIntentForContextResponse', + payload: { + appIntents: relevant.map(r => { return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentForContextResponse", - payload: { - intentResolution: { - intent: relevant[0].intent!!, - source: relevant[0].app!! - } - } - } - } else { - return { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - type: "raiseIntentForContextResponse", - payload: { - appIntents: relevant.map(r => { - return { - apps: [r.app!!], - intent: { - name: r.intent!! - } - } - }) - } - } - } + apps: [r.app!!], + intent: { + name: r.intent!!, + }, + }; + }), + }, + }; } - - createRaiseIntentResultResponseMesssage(intentRequest: RaiseIntentForContextRequest, m: TestMessaging): RaiseIntentResultResponse | undefined { - const result = m.getIntentResult()!! - if (result.error) { - return undefined - } else { - const out: RaiseIntentResultResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - intentResult: m.getIntentResult()!! - }, - type: "raiseIntentResultResponse" - } - - return out - } - + } + + createRaiseIntentResultResponseMesssage( + intentRequest: RaiseIntentForContextRequest, + m: TestMessaging + ): RaiseIntentResultResponse | undefined { + const result = m.getIntentResult()!!; + if (result.error) { + return undefined; + } else { + const out: RaiseIntentResultResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + intentResult: m.getIntentResult()!!, + }, + type: 'raiseIntentResultResponse', + }; + + return out; } - - - action(input: object, m: TestMessaging) { - const intentRequest = input as RaiseIntentForContextRequest - const payload = intentRequest.payload - const context = payload?.context?.type - - if (m.getIntentResult() == undefined) { - // we're going to figure out the right response based on the app details (a la FindIntent) - const app = payload?.app - const using: IntentDetail = { - context, - app - } - - const relevant = m.intentDetails.filter(id => intentDetailMatches(id, using, false)) - const request = this.createRaiseIntentForContextResponseMessage(intentRequest, relevant, m) - setTimeout(() => { m.receive(request) }, 100) - } else if (!m.getIntentResult()?.timeout) { - // this sends out the pre-set intent resolution - const out1 = this.createCannedRaiseIntentForContextResponseMessage(intentRequest, m) - setTimeout(() => { m.receive(out1) }, 100) - - // next, send the result response - const out2 = this.createRaiseIntentResultResponseMesssage(intentRequest, m) - if (out2) { - setTimeout(() => { m.receive(out2) }, 300) - } - } - - return Promise.resolve() + } + + action(input: object, m: TestMessaging) { + const intentRequest = input as RaiseIntentForContextRequest; + const payload = intentRequest.payload; + const context = payload?.context?.type; + + if (m.getIntentResult() == undefined) { + // we're going to figure out the right response based on the app details (a la FindIntent) + const app = payload?.app; + const using: IntentDetail = { + context, + app, + }; + + const relevant = m.intentDetails.filter(id => intentDetailMatches(id, using, false)); + const request = this.createRaiseIntentForContextResponseMessage(intentRequest, relevant, m); + setTimeout(() => { + m.receive(request); + }, 100); + } else if (!m.getIntentResult()?.timeout) { + // this sends out the pre-set intent resolution + const out1 = this.createCannedRaiseIntentForContextResponseMessage(intentRequest, m); + setTimeout(() => { + m.receive(out1); + }, 100); + + // next, send the result response + const out2 = this.createRaiseIntentResultResponseMesssage(intentRequest, m); + if (out2) { + setTimeout(() => { + m.receive(out2); + }, 300); + } } + + return Promise.resolve(); + } } diff --git a/packages/fdc3-agent-proxy/test/support/responses/RegisterListeners.ts b/packages/fdc3-agent-proxy/test/support/responses/RegisterListeners.ts index 9a1136e8e..62af51e76 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/RegisterListeners.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/RegisterListeners.ts @@ -1,30 +1,33 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { createResponseMeta } from "./support"; -import { v4 as uuidv4 } from 'uuid' +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { createResponseMeta } from './support'; +import { v4 as uuidv4 } from 'uuid'; export class RegisterListeners implements AutomaticResponse { + filter(t: string) { + return ( + t == 'addContextListenerRequest' || + t == 'addIntentListenerRequest' || + t == 'privateChannelAddContextListenerRequest' || + t == 'privateChannelAddEventListenerRequest' + ); + } - filter(t: string) { - return (t == 'addContextListenerRequest') || - (t == 'addIntentListenerRequest') || - (t == 'privateChannelAddContextListenerRequest') || - (t == 'privateChannelAddEventListenerRequest') - } + action(input: object, m: TestMessaging) { + const out = this.createResponse(input); - action(input: object, m: TestMessaging) { - const out = this.createResponse(input) + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: any): any { - return { - meta: createResponseMeta(i.meta), - type: i.type.replace('Request', 'Response'), - payload: { - listenerUUID: uuidv4() - } - } - } -} \ No newline at end of file + private createResponse(i: any): any { + return { + meta: createResponseMeta(i.meta), + type: i.type.replace('Request', 'Response'), + payload: { + listenerUUID: uuidv4(), + }, + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/UnsubscribeListeners.ts b/packages/fdc3-agent-proxy/test/support/responses/UnsubscribeListeners.ts index ef12678cc..769902829 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/UnsubscribeListeners.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/UnsubscribeListeners.ts @@ -1,24 +1,24 @@ -import { AutomaticResponse, TestMessaging } from "../TestMessaging"; -import { createResponseMeta } from "./support"; +import { AutomaticResponse, TestMessaging } from '../TestMessaging'; +import { createResponseMeta } from './support'; export class UnsubscribeListeners implements AutomaticResponse { + filter(t: string) { + return t == 'intentListenerUnsubscribeRequest' || t == 'privateChannelUnsubscribeEventListenerRequest'; + } - filter(t: string) { - return (t == 'intentListenerUnsubscribeRequest') || - (t == 'privateChannelUnsubscribeEventListenerRequest') - } + action(input: object, m: TestMessaging) { + const out = this.createResponse(input); - action(input: object, m: TestMessaging) { - const out = this.createResponse(input) + setTimeout(() => { + m.receive(out); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.receive(out) }, 100) - return Promise.resolve() - } - - private createResponse(i: any): any { - return { - meta: createResponseMeta(i.meta), - type: i.type.replace('Request', 'Response'), - } - } -} \ No newline at end of file + private createResponse(i: any): any { + return { + meta: createResponseMeta(i.meta), + type: i.type.replace('Request', 'Response'), + }; + } +} diff --git a/packages/fdc3-agent-proxy/test/support/responses/support.ts b/packages/fdc3-agent-proxy/test/support/responses/support.ts index c5b91f08b..26fdc3e60 100644 --- a/packages/fdc3-agent-proxy/test/support/responses/support.ts +++ b/packages/fdc3-agent-proxy/test/support/responses/support.ts @@ -1,14 +1,14 @@ -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { v4 as uuidv4 } from 'uuid' +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { v4 as uuidv4 } from 'uuid'; -type AppRequestMessageMeta = BrowserTypes.AppRequestMessageMeta -type AgentResponseMessageMeta = BrowserTypes.AgentResponseMessageMeta +type AppRequestMessageMeta = BrowserTypes.AppRequestMessageMeta; +type AgentResponseMessageMeta = BrowserTypes.AgentResponseMessageMeta; export function createResponseMeta(m: AppRequestMessageMeta): AgentResponseMessageMeta { - return { - requestUuid: m.requestUuid, - responseUuid: uuidv4(), - source: m.source, - timestamp: new Date() - } -} \ No newline at end of file + return { + requestUuid: m.requestUuid, + responseUuid: uuidv4(), + source: m.source, + timestamp: new Date(), + }; +} diff --git a/packages/fdc3-agent-proxy/test/world/index.ts b/packages/fdc3-agent-proxy/test/world/index.ts index 031e43d60..868a6ec18 100644 --- a/packages/fdc3-agent-proxy/test/world/index.ts +++ b/packages/fdc3-agent-proxy/test/world/index.ts @@ -1,11 +1,9 @@ -import { setWorldConstructor } from "@cucumber/cucumber"; -import { TestMessaging } from "../support/TestMessaging"; -import { PropsWorld } from "@kite9/testing"; +import { setWorldConstructor } from '@cucumber/cucumber'; +import { TestMessaging } from '../support/TestMessaging'; +import { PropsWorld } from '@kite9/testing'; export class CustomWorld extends PropsWorld { - - messaging: TestMessaging | null = null - + messaging: TestMessaging | null = null; } -setWorldConstructor(CustomWorld) \ No newline at end of file +setWorldConstructor(CustomWorld); diff --git a/packages/fdc3-context/eslint.config.mjs b/packages/fdc3-context/eslint.config.mjs index 0e50cc5de..3bf4cdcbc 100644 --- a/packages/fdc3-context/eslint.config.mjs +++ b/packages/fdc3-context/eslint.config.mjs @@ -1,56 +1,62 @@ -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -import jsxA11Y from "eslint-plugin-jsx-a11y"; -import globals from "globals"; -import tsParser from "@typescript-eslint/parser"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import jsxA11Y from 'eslint-plugin-jsx-a11y'; +import globals from 'globals'; +import tsParser from '@typescript-eslint/parser'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, }); -export default [...compat.extends( - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier", -), { - files: ["**/*.ts", "**/*.tsx"], - +export default [ + ...compat.extends( + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier' + ), + { + files: ['**/*.ts', '**/*.tsx'], + plugins: { - "@typescript-eslint": typescriptEslint, - "jsx-a11y": jsxA11Y, + '@typescript-eslint': typescriptEslint, + 'jsx-a11y': jsxA11Y, }, languageOptions: { - globals: { - ...globals.browser, - ...globals.jest, - }, + globals: { + ...globals.browser, + ...globals.jest, + }, - parser: tsParser, - ecmaVersion: 5, - sourceType: "script", + parser: tsParser, + ecmaVersion: 5, + sourceType: 'script', - parserOptions: { - project: ["./tsconfig.json"], - }, + parserOptions: { + project: ['./tsconfig.json'], + }, }, rules: { - "@typescript-eslint/adjacent-overload-signatures": "warn", - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/no-empty-function": "warn", - "@typescript-eslint/no-explicit-any": "off", - - "@typescript-eslint/no-unused-vars": ["error", { - argsIgnorePattern: "^_", - caughtErrorsIgnorePattern: "^_", - }], + '@typescript-eslint/adjacent-overload-signatures': 'warn', + '@typescript-eslint/no-empty-interface': 'warn', + '@typescript-eslint/no-empty-function': 'warn', + '@typescript-eslint/no-explicit-any': 'off', + + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], }, -}]; \ No newline at end of file + }, +]; diff --git a/packages/fdc3-context/generated/context/ContextTypes.ts b/packages/fdc3-context/generated/context/ContextTypes.ts index 794687e52..99bf6e8e9 100644 --- a/packages/fdc3-context/generated/context/ContextTypes.ts +++ b/packages/fdc3-context/generated/context/ContextTypes.ts @@ -49,46 +49,46 @@ * Accepts an optional `app` parameter in order to specify a specific app. */ export interface Action { - /** - * The **action** field indicates the type of action: - * - **raiseIntent** : If no action or `raiseIntent` is specified, then `fdc3.raiseIntent` - * or `fdc3.raiseIntentForContext` will be called with the specified context (and intent if - * given). - * - **broadcast** : If `broadcast` and a `channelId` are specified then - * `fdc3.getOrCreateChannel(channelId)` is called to retrieve the channel and broadcast the - * context to it with `channel.broadcast(context)`. If no `channelId` has been specified, - * the context should be broadcast to the current channel (`fdc3.broadcast()`) - */ - action?: ActionType; - /** - * An optional target application identifier that should perform the action. The `app` - * property is ignored unless the action is raiseIntent. - */ - app?: AppIdentifier; - /** - * Optional channel on which to broadcast the context. The `channelId` property is ignored - * unless the `action` is broadcast. - */ - channelId?: string; - /** - * A context object with which the action will be performed - */ - context: ContextElement; - /** - * Optional Intent to raise to perform the actions. Should reference an intent type name, - * such as those defined in the FDC3 Standard. If intent is not set then - * `fdc3.raiseIntentForContext` should be used to perform the action as this will usually - * allow the user to choose the intent to raise. - */ - intent?: string; - /** - * A human readable display name for the action - */ - title: string; - type: "fdc3.action"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * The **action** field indicates the type of action: + * - **raiseIntent** : If no action or `raiseIntent` is specified, then `fdc3.raiseIntent` + * or `fdc3.raiseIntentForContext` will be called with the specified context (and intent if + * given). + * - **broadcast** : If `broadcast` and a `channelId` are specified then + * `fdc3.getOrCreateChannel(channelId)` is called to retrieve the channel and broadcast the + * context to it with `channel.broadcast(context)`. If no `channelId` has been specified, + * the context should be broadcast to the current channel (`fdc3.broadcast()`) + */ + action?: ActionType; + /** + * An optional target application identifier that should perform the action. The `app` + * property is ignored unless the action is raiseIntent. + */ + app?: AppIdentifier; + /** + * Optional channel on which to broadcast the context. The `channelId` property is ignored + * unless the `action` is broadcast. + */ + channelId?: string; + /** + * A context object with which the action will be performed + */ + context: ContextElement; + /** + * Optional Intent to raise to perform the actions. Should reference an intent type name, + * such as those defined in the FDC3 Standard. If intent is not set then + * `fdc3.raiseIntentForContext` should be used to perform the action as this will usually + * allow the user to choose the intent to raise. + */ + intent?: string; + /** + * A human readable display name for the action + */ + title: string; + type: 'fdc3.action'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -101,7 +101,7 @@ export interface Action { * context to it with `channel.broadcast(context)`. If no `channelId` has been specified, * the context should be broadcast to the current channel (`fdc3.broadcast()`) */ -export type ActionType = "broadcast" | "raiseIntent"; +export type ActionType = 'broadcast' | 'raiseIntent'; /** * An optional target application identifier that should perform the action. The `app` @@ -117,22 +117,22 @@ export type ActionType = "broadcast" | "raiseIntent"; * instance of the application that may be addressed using that Id. */ 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 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; } /** @@ -153,44 +153,44 @@ export interface AppIdentifier { * with custom fields as appropriate. */ export interface ContextElement { - /** - * Context data objects may include a set of equivalent key-value pairs that can be used to - * help applications identify and look up the context type they receive in their own domain. - * The idea behind this design is that applications can provide as many equivalent - * identifiers to a target application as possible, e.g. an instrument may be represented by - * an ISIN, CUSIP or Bloomberg identifier. - * - * Identifiers do not make sense for all types of data, so the `id` property is therefore - * optional, but some derived types may choose to require at least one identifier. - * Identifier values SHOULD always be of type string. - */ - id?: { [key: string]: any }; - /** - * Context data objects may include a name property that can be used for more information, - * or display purposes. Some derived types may require the name object as mandatory, - * depending on use case. - */ - name?: string; - /** - * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 - * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present - * to route shared context data appropriately. - * - * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data - * types they support in an FDC3 [App - * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery - * and routing. - * - * Standardized FDC3 context types have well-known `type` properties prefixed with the - * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and - * used by a particular organization, the convention is to prefix them with an - * organization-specific namespace, e.g. `blackrock.fund`. - * - * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more - * information about context data types. - */ - type: string; - [property: string]: any; + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + * Identifier values SHOULD always be of type string. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -215,28 +215,28 @@ export interface ContextElement { * by another application. */ export interface Chart { - /** - * An array of instrument contexts whose data should be plotted. - */ - instruments: InstrumentElement[]; - /** - * It is common for charts to support other configuration, such as indicators, annotations - * etc., which do not have standardized formats, but may be included in the `otherConfig` - * array as context objects. - */ - otherConfig?: ContextElement[]; - /** - * The time range that should be plotted - */ - range?: TimeRangeObject; - /** - * The type of chart that should be plotted - */ - style?: ChartStyle; - type: "fdc3.chart"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * An array of instrument contexts whose data should be plotted. + */ + instruments: InstrumentElement[]; + /** + * It is common for charts to support other configuration, such as indicators, annotations + * etc., which do not have standardized formats, but may be included in the `otherConfig` + * array as context objects. + */ + otherConfig?: ContextElement[]; + /** + * The time range that should be plotted + */ + range?: TimeRangeObject; + /** + * The type of chart that should be plotted + */ + style?: ChartStyle; + type: 'fdc3.chart'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -247,34 +247,34 @@ export interface Chart { * A financial instrument from any asset class. */ export interface InstrumentElement { - /** - * Any combination of instrument identifiers can be used together to resolve ambiguity, or - * for a better match. Not all applications will use the same instrument identifiers, which - * is why FDC3 allows for multiple to be specified. In general, the more identifiers an - * application can provide, the easier it will be to achieve interoperability. - * - * It is valid to include extra properties and metadata as part of the instrument payload, - * but the minimum requirement is for at least one instrument identifier to be provided. - * - * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant - * for tickers as used by an exchange. - * If the identifier you want to share is not a ticker or one of the other standardized - * fields, define a property that makes it clear what the value represents. Doing so will - * make interpretation easier for the developers of target applications. - */ - id: PurpleInstrumentIdentifiers; - /** - * The `market` map can be used to further specify the instrument and help achieve - * interoperability between disparate data sources. This is especially useful when using an - * `id` field that is not globally unique. - */ - market?: OrganizationMarket; - /** - * An optional human-readable name for the instrument - */ - name?: string; - type: "fdc3.instrument"; - [property: string]: any; + /** + * Any combination of instrument identifiers can be used together to resolve ambiguity, or + * for a better match. Not all applications will use the same instrument identifiers, which + * is why FDC3 allows for multiple to be specified. In general, the more identifiers an + * application can provide, the easier it will be to achieve interoperability. + * + * It is valid to include extra properties and metadata as part of the instrument payload, + * but the minimum requirement is for at least one instrument identifier to be provided. + * + * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant + * for tickers as used by an exchange. + * If the identifier you want to share is not a ticker or one of the other standardized + * fields, define a property that makes it clear what the value represents. Doing so will + * make interpretation easier for the developers of target applications. + */ + id: PurpleInstrumentIdentifiers; + /** + * The `market` map can be used to further specify the instrument and help achieve + * interoperability between disparate data sources. This is especially useful when using an + * `id` field that is not globally unique. + */ + market?: OrganizationMarket; + /** + * An optional human-readable name for the instrument + */ + name?: string; + type: 'fdc3.instrument'; + [property: string]: any; } /** @@ -293,43 +293,43 @@ export interface InstrumentElement { * make interpretation easier for the developers of target applications. */ export interface PurpleInstrumentIdentifiers { - /** - * https://www.bloomberg.com/ - */ - BBG?: string; - /** - * https://www.cusip.com/ - */ - CUSIP?: string; - /** - * https://www.factset.com/ - */ - FDS_ID?: string; - /** - * https://www.openfigi.com/ - */ - FIGI?: string; - /** - * https://www.isin.org/ - */ - ISIN?: string; - /** - * https://permid.org/ - */ - PERMID?: string; - /** - * https://www.refinitiv.com/ - */ - RIC?: string; - /** - * https://www.lseg.com/sedol - */ - SEDOL?: string; - /** - * Unstandardized stock tickers - */ - ticker?: string; - [property: string]: any; + /** + * https://www.bloomberg.com/ + */ + BBG?: string; + /** + * https://www.cusip.com/ + */ + CUSIP?: string; + /** + * https://www.factset.com/ + */ + FDS_ID?: string; + /** + * https://www.openfigi.com/ + */ + FIGI?: string; + /** + * https://www.isin.org/ + */ + ISIN?: string; + /** + * https://permid.org/ + */ + PERMID?: string; + /** + * https://www.refinitiv.com/ + */ + RIC?: string; + /** + * https://www.lseg.com/sedol + */ + SEDOL?: string; + /** + * Unstandardized stock tickers + */ + ticker?: string; + [property: string]: any; } /** @@ -338,23 +338,23 @@ export interface PurpleInstrumentIdentifiers { * `id` field that is not globally unique. */ export interface OrganizationMarket { - /** - * https://www.bloomberg.com/ - */ - BBG?: string; - /** - * https://www.iso.org/iso-3166-country-codes.html - */ - COUNTRY_ISOALPHA2?: string; - /** - * https://en.wikipedia.org/wiki/Market_Identifier_Code - */ - MIC?: string; - /** - * Human readable market name - */ - name?: string; - [property: string]: any; + /** + * https://www.bloomberg.com/ + */ + BBG?: string; + /** + * https://www.iso.org/iso-3166-country-codes.html + */ + COUNTRY_ISOALPHA2?: string; + /** + * https://en.wikipedia.org/wiki/Market_Identifier_Code + */ + MIC?: string; + /** + * Human readable market name + */ + name?: string; + [property: string]: any; } /** @@ -401,20 +401,20 @@ export interface OrganizationMarket { * - Times MAY be specified with millisecond precision, e.g. `"2022-05-12T15:18:03.349Z"` */ export interface TimeRangeObject { - /** - * The end time of the range, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. - */ - endTime?: Date; - /** - * The start time of the range, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. - */ - startTime?: Date; - type: "fdc3.timeRange"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * The end time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. + */ + endTime?: Date; + /** + * The start time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. + */ + startTime?: Date; + type: 'fdc3.timeRange'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -427,7 +427,17 @@ export interface TimeRangeObject { /** * The type of chart that should be plotted */ -export type ChartStyle = "line" | "bar" | "stacked-bar" | "mountain" | "candle" | "pie" | "scatter" | "histogram" | "heatmap" | "custom"; +export type ChartStyle = + | 'line' + | 'bar' + | 'stacked-bar' + | 'mountain' + | 'candle' + | 'pie' + | 'scatter' + | 'histogram' + | 'heatmap' + | 'custom'; /** * Free text to be used for a keyword search @@ -440,26 +450,26 @@ export type ChartStyle = "line" | "bar" | "stacked-bar" | "mountain" | "candle" * A collection of settings to start a new chat conversation */ export interface ChatInitSettings { - /** - * Name to apply to the chat created - */ - chatName?: string; - /** - * Contacts to add to the chat - */ - members?: ContactListObject; - /** - * An initial message to post in the chat when created. - */ - message?: MessageObject | string; - /** - * Option settings that affect the creation of the chat - */ - options?: ChatOptions; - type: "fdc3.chat.initSettings"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * Name to apply to the chat created + */ + chatName?: string; + /** + * Contacts to add to the chat + */ + members?: ContactListObject; + /** + * An initial message to post in the chat when created. + */ + message?: MessageObject | string; + /** + * Option settings that affect the creation of the chat + */ + options?: ChatOptions; + type: 'fdc3.chat.initSettings'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -474,21 +484,21 @@ export interface ChatInitSettings { * this part of the contract with custom identifiers if so desired. */ export interface ContactListObject { - /** - * An array of contact contexts that forms the list. - */ - contacts: ContactElement[]; - /** - * One or more identifiers that refer to the contact list in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An optional human-readable summary of the contact list - */ - name?: string; - type: "fdc3.contactList"; - [property: string]: any; + /** + * An array of contact contexts that forms the list. + */ + contacts: ContactElement[]; + /** + * One or more identifiers that refer to the contact list in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An optional human-readable summary of the contact list + */ + name?: string; + type: 'fdc3.contactList'; + [property: string]: any; } /** @@ -497,31 +507,31 @@ export interface ContactListObject { * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ export interface ContactElement { - /** - * Identifiers that relate to the Contact represented by this context - */ - id: PurpleContactIdentifiers; - /** - * An optional human-readable name for the contact - */ - name?: string; - type: "fdc3.contact"; - [property: string]: any; + /** + * Identifiers that relate to the Contact represented by this context + */ + id: PurpleContactIdentifiers; + /** + * An optional human-readable name for the contact + */ + name?: string; + type: 'fdc3.contact'; + [property: string]: any; } /** * Identifiers that relate to the Contact represented by this context */ export interface PurpleContactIdentifiers { - /** - * The email address for the contact - */ - email?: string; - /** - * FactSet Permanent Identifier representing the contact - */ - FDS_ID?: string; - [property: string]: any; + /** + * The email address for the contact + */ + email?: string; + /** + * FactSet Permanent Identifier representing the contact + */ + FDS_ID?: string; + [property: string]: any; } /** @@ -545,19 +555,19 @@ export interface PurpleContactIdentifiers { * message). To be put inside a ChatInitSettings object. */ export interface MessageObject { - /** - * A map of string IDs to entities that should be attached to the message, such as an action - * to perform, a file attachment, or other FDC3 context object. - */ - entities?: { [key: string]: EntityValue }; - /** - * A map of string mime-type to string content - */ - text?: PurpleMessageText; - type: "fdc3.message"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * A map of string IDs to entities that should be attached to the message, such as an action + * to perform, a file attachment, or other FDC3 context object. + */ + entities?: { [key: string]: EntityValue }; + /** + * A map of string mime-type to string content + */ + text?: PurpleMessageText; + type: 'fdc3.message'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -576,59 +586,59 @@ export interface MessageObject { * A File attachment encoded in the form of a data URI. Can be added to a Message. */ export interface EntityValue { - /** - * The **action** field indicates the type of action: - * - **raiseIntent** : If no action or `raiseIntent` is specified, then `fdc3.raiseIntent` - * or `fdc3.raiseIntentForContext` will be called with the specified context (and intent if - * given). - * - **broadcast** : If `broadcast` and a `channelId` are specified then - * `fdc3.getOrCreateChannel(channelId)` is called to retrieve the channel and broadcast the - * context to it with `channel.broadcast(context)`. If no `channelId` has been specified, - * the context should be broadcast to the current channel (`fdc3.broadcast()`) - */ - action?: ActionType; - /** - * An optional target application identifier that should perform the action. The `app` - * property is ignored unless the action is raiseIntent. - */ - app?: AppIdentifier; - /** - * Optional channel on which to broadcast the context. The `channelId` property is ignored - * unless the `action` is broadcast. - */ - channelId?: string; - /** - * A context object with which the action will be performed - */ - context?: ContextElement; - /** - * Optional Intent to raise to perform the actions. Should reference an intent type name, - * such as those defined in the FDC3 Standard. If intent is not set then - * `fdc3.raiseIntentForContext` should be used to perform the action as this will usually - * allow the user to choose the intent to raise. - */ - intent?: string; - /** - * A human readable display name for the action - */ - title?: string; - type: EntityType; - id?: { [key: string]: any }; - name?: string; - data?: EntityData; - [property: string]: any; + /** + * The **action** field indicates the type of action: + * - **raiseIntent** : If no action or `raiseIntent` is specified, then `fdc3.raiseIntent` + * or `fdc3.raiseIntentForContext` will be called with the specified context (and intent if + * given). + * - **broadcast** : If `broadcast` and a `channelId` are specified then + * `fdc3.getOrCreateChannel(channelId)` is called to retrieve the channel and broadcast the + * context to it with `channel.broadcast(context)`. If no `channelId` has been specified, + * the context should be broadcast to the current channel (`fdc3.broadcast()`) + */ + action?: ActionType; + /** + * An optional target application identifier that should perform the action. The `app` + * property is ignored unless the action is raiseIntent. + */ + app?: AppIdentifier; + /** + * Optional channel on which to broadcast the context. The `channelId` property is ignored + * unless the `action` is broadcast. + */ + channelId?: string; + /** + * A context object with which the action will be performed + */ + context?: ContextElement; + /** + * Optional Intent to raise to perform the actions. Should reference an intent type name, + * such as those defined in the FDC3 Standard. If intent is not set then + * `fdc3.raiseIntentForContext` should be used to perform the action as this will usually + * allow the user to choose the intent to raise. + */ + intent?: string; + /** + * A human readable display name for the action + */ + title?: string; + type: EntityType; + id?: { [key: string]: any }; + name?: string; + data?: EntityData; + [property: string]: any; } export interface EntityData { - /** - * A data URI encoding the content of the file to be attached - */ - dataUri: string; - /** - * The name of the attached file - */ - name: string; - [property: string]: any; + /** + * A data URI encoding the content of the file to be attached + */ + dataUri: string; + /** + * The name of the attached file + */ + name: string; + [property: string]: any; } /** @@ -637,21 +647,21 @@ export interface EntityData { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export type EntityType = "fdc3.action" | "fdc3.fileAttachment"; +export type EntityType = 'fdc3.action' | 'fdc3.fileAttachment'; /** * A map of string mime-type to string content */ export interface PurpleMessageText { - /** - * Markdown encoded content - */ - "text/markdown"?: string; - /** - * Plain text encoded content. - */ - "text/plain"?: string; - [property: string]: any; + /** + * Markdown encoded content + */ + 'text/markdown'?: string; + /** + * Plain text encoded content. + */ + 'text/plain'?: string; + [property: string]: any; } /** @@ -665,27 +675,27 @@ export interface PurpleMessageText { * Option settings that affect the creation of the chat */ export interface ChatOptions { - /** - * if true members will be allowed to add other members to the chat - */ - allowAddUser?: boolean; - /** - * if true members will be allowed to browse past messages - */ - allowHistoryBrowsing?: boolean; - /** - * if true members will be allowed to copy/paste messages - */ - allowMessageCopy?: boolean; - /** - * if false a separate chat will be created for each member - */ - groupRecipients?: boolean; - /** - * if true the room will be visible to everyone in the chat application - */ - isPublic?: boolean; - [property: string]: any; + /** + * if true members will be allowed to add other members to the chat + */ + allowAddUser?: boolean; + /** + * if true members will be allowed to browse past messages + */ + allowHistoryBrowsing?: boolean; + /** + * if true members will be allowed to copy/paste messages + */ + allowMessageCopy?: boolean; + /** + * if false a separate chat will be created for each member + */ + groupRecipients?: boolean; + /** + * if true the room will be visible to everyone in the chat application + */ + isPublic?: boolean; + [property: string]: any; } /** @@ -700,37 +710,37 @@ export interface ChatOptions { * pre-populate a message for sending. */ export interface ChatMessage { - chatRoom: ChatRoomObject; - message: MessageObject; - type: "fdc3.chat.message"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + chatRoom: ChatRoomObject; + message: MessageObject; + type: 'fdc3.chat.message'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** * Reference to the chat room which could be used to send a message to the room */ export interface ChatRoomObject { - /** - * Identifier(s) for the chat - currently unstandardized - */ - id: { [key: string]: string }; - /** - * Display name for the chat room - */ - name?: string; - /** - * The name of the service that hosts the chat - */ - providerName: string; - type: "fdc3.chat.room"; - /** - * Universal url to access to the room. It could be opened from a browser, a mobile app, - * etc... - */ - url?: string; - [property: string]: any; + /** + * Identifier(s) for the chat - currently unstandardized + */ + id: { [key: string]: string }; + /** + * Display name for the chat room + */ + name?: string; + /** + * The name of the service that hosts the chat + */ + providerName: string; + type: 'fdc3.chat.room'; + /** + * Universal url to access to the room. It could be opened from a browser, a mobile app, + * etc... + */ + url?: string; + [property: string]: any; } /** @@ -751,25 +761,25 @@ export interface ChatRoomObject { * Reference to the chat room which could be used to send a message to the room */ export interface ChatRoom { - /** - * Identifier(s) for the chat - currently unstandardized - */ - id: { [key: string]: string }; - /** - * Display name for the chat room - */ - name?: string; - /** - * The name of the service that hosts the chat - */ - providerName: string; - type: "fdc3.chat.room"; - /** - * Universal url to access to the room. It could be opened from a browser, a mobile app, - * etc... - */ - url?: string; - [property: string]: any; + /** + * Identifier(s) for the chat - currently unstandardized + */ + id: { [key: string]: string }; + /** + * Display name for the chat room + */ + name?: string; + /** + * The name of the service that hosts the chat + */ + providerName: string; + type: 'fdc3.chat.room'; + /** + * Universal url to access to the room. It could be opened from a browser, a mobile app, + * etc... + */ + url?: string; + [property: string]: any; } /** @@ -777,20 +787,20 @@ export interface ChatRoom { * context objects, that can be used to search or filter messages in a chat application. */ export interface ChatSearchCriteria { - /** - * An array of criteria that should match chats returned from by a search. - * - * ⚠️ Operators (and/or/not) are not defined in `fdc3.chat.searchCriteria`. It is up to the - * application that processes the FDC3 Intent to choose and apply the operators between the - * criteria. - * - * Empty search criteria can be supported to allow resetting of filters. - */ - criteria: Array; - type: "fdc3.chat.searchCriteria"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * An array of criteria that should match chats returned from by a search. + * + * ⚠️ Operators (and/or/not) are not defined in `fdc3.chat.searchCriteria`. It is up to the + * application that processes the FDC3 Intent to choose and apply the operators between the + * criteria. + * + * Empty search criteria can be supported to allow resetting of filters. + */ + criteria: Array; + type: 'fdc3.chat.searchCriteria'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -811,42 +821,42 @@ export interface ChatSearchCriteria { * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ export interface OrganizationObject { - /** - * Any combination of instrument identifiers can be used together to resolve ambiguity, or - * for a better match. Not all applications will use the same instrument identifiers, which - * is why FDC3 allows for multiple to be specified. In general, the more identifiers an - * application can provide, the easier it will be to achieve interoperability. - * - * It is valid to include extra properties and metadata as part of the instrument payload, - * but the minimum requirement is for at least one instrument identifier to be provided. - * - * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant - * for tickers as used by an exchange. - * If the identifier you want to share is not a ticker or one of the other standardized - * fields, define a property that makes it clear what the value represents. Doing so will - * make interpretation easier for the developers of target applications. - * - * Identifiers for the organization, at least one must be provided. - * - * Identifiers that relate to the Contact represented by this context - */ - id: Identifiers; - /** - * The `market` map can be used to further specify the instrument and help achieve - * interoperability between disparate data sources. This is especially useful when using an - * `id` field that is not globally unique. - */ - market?: OrganizationMarket; - /** - * An optional human-readable name for the instrument - * - * An optional human-readable name of the organization - * - * An optional human-readable name for the contact - */ - name?: string; - type: TentacledInteractionType; - [property: string]: any; + /** + * Any combination of instrument identifiers can be used together to resolve ambiguity, or + * for a better match. Not all applications will use the same instrument identifiers, which + * is why FDC3 allows for multiple to be specified. In general, the more identifiers an + * application can provide, the easier it will be to achieve interoperability. + * + * It is valid to include extra properties and metadata as part of the instrument payload, + * but the minimum requirement is for at least one instrument identifier to be provided. + * + * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant + * for tickers as used by an exchange. + * If the identifier you want to share is not a ticker or one of the other standardized + * fields, define a property that makes it clear what the value represents. Doing so will + * make interpretation easier for the developers of target applications. + * + * Identifiers for the organization, at least one must be provided. + * + * Identifiers that relate to the Contact represented by this context + */ + id: Identifiers; + /** + * The `market` map can be used to further specify the instrument and help achieve + * interoperability between disparate data sources. This is especially useful when using an + * `id` field that is not globally unique. + */ + market?: OrganizationMarket; + /** + * An optional human-readable name for the instrument + * + * An optional human-readable name of the organization + * + * An optional human-readable name for the contact + */ + name?: string; + type: TentacledInteractionType; + [property: string]: any; } /** @@ -869,60 +879,60 @@ export interface OrganizationObject { * Identifiers that relate to the Contact represented by this context */ export interface Identifiers { - /** - * https://www.bloomberg.com/ - */ - BBG?: string; - /** - * https://www.cusip.com/ - */ - CUSIP?: string; - /** - * https://www.factset.com/ - * - * FactSet Permanent Identifier representing the organization - * - * FactSet Permanent Identifier representing the contact - */ - FDS_ID?: string; - /** - * https://www.openfigi.com/ - */ - FIGI?: string; - /** - * https://www.isin.org/ - */ - ISIN?: string; - /** - * https://permid.org/ - * - * Refinitiv Permanent Identifiers, or PermID for the organization - */ - PERMID?: string; - /** - * https://www.refinitiv.com/ - */ - RIC?: string; - /** - * https://www.lseg.com/sedol - */ - SEDOL?: string; - /** - * Unstandardized stock tickers - */ - ticker?: string; - /** - * The Legal Entity Identifier (LEI) is a 20-character, alpha-numeric code based on the ISO - * 17442 standard developed by the International Organization for Standardization (ISO). It - * connects to key reference information that enables clear and unique identification of - * legal entities participating in financial transactions. - */ - LEI?: string; - /** - * The email address for the contact - */ - email?: string; - [property: string]: any; + /** + * https://www.bloomberg.com/ + */ + BBG?: string; + /** + * https://www.cusip.com/ + */ + CUSIP?: string; + /** + * https://www.factset.com/ + * + * FactSet Permanent Identifier representing the organization + * + * FactSet Permanent Identifier representing the contact + */ + FDS_ID?: string; + /** + * https://www.openfigi.com/ + */ + FIGI?: string; + /** + * https://www.isin.org/ + */ + ISIN?: string; + /** + * https://permid.org/ + * + * Refinitiv Permanent Identifiers, or PermID for the organization + */ + PERMID?: string; + /** + * https://www.refinitiv.com/ + */ + RIC?: string; + /** + * https://www.lseg.com/sedol + */ + SEDOL?: string; + /** + * Unstandardized stock tickers + */ + ticker?: string; + /** + * The Legal Entity Identifier (LEI) is a 20-character, alpha-numeric code based on the ISO + * 17442 standard developed by the International Organization for Standardization (ISO). It + * connects to key reference information that enables clear and unique identification of + * legal entities participating in financial transactions. + */ + LEI?: string; + /** + * The email address for the contact + */ + email?: string; + [property: string]: any; } /** @@ -931,7 +941,7 @@ export interface Identifiers { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export type TentacledInteractionType = "fdc3.instrument" | "fdc3.organization" | "fdc3.contact"; +export type TentacledInteractionType = 'fdc3.instrument' | 'fdc3.organization' | 'fdc3.contact'; /** * Free text to be used for a keyword search @@ -944,31 +954,31 @@ export type TentacledInteractionType = "fdc3.instrument" | "fdc3.organization" | * A person contact that can be engaged with through email, calling, messaging, CMS, etc. */ export interface Contact { - /** - * Identifiers that relate to the Contact represented by this context - */ - id: FluffyContactIdentifiers; - /** - * An optional human-readable name for the contact - */ - name?: string; - type: "fdc3.contact"; - [property: string]: any; + /** + * Identifiers that relate to the Contact represented by this context + */ + id: FluffyContactIdentifiers; + /** + * An optional human-readable name for the contact + */ + name?: string; + type: 'fdc3.contact'; + [property: string]: any; } /** * Identifiers that relate to the Contact represented by this context */ export interface FluffyContactIdentifiers { - /** - * The email address for the contact - */ - email?: string; - /** - * FactSet Permanent Identifier representing the contact - */ - FDS_ID?: string; - [property: string]: any; + /** + * The email address for the contact + */ + email?: string; + /** + * FactSet Permanent Identifier representing the contact + */ + FDS_ID?: string; + [property: string]: any; } /** @@ -979,21 +989,21 @@ export interface FluffyContactIdentifiers { * this part of the contract with custom identifiers if so desired. */ export interface ContactList { - /** - * An array of contact contexts that forms the list. - */ - contacts: ContactElement[]; - /** - * One or more identifiers that refer to the contact list in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An optional human-readable summary of the contact list - */ - name?: string; - type: "fdc3.contactList"; - [property: string]: any; + /** + * An array of contact contexts that forms the list. + */ + contacts: ContactElement[]; + /** + * One or more identifiers that refer to the contact list in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An optional human-readable summary of the contact list + */ + name?: string; + type: 'fdc3.contactList'; + [property: string]: any; } /** @@ -1010,44 +1020,44 @@ export interface ContactList { * with custom fields as appropriate. */ export interface Context { - /** - * Context data objects may include a set of equivalent key-value pairs that can be used to - * help applications identify and look up the context type they receive in their own domain. - * The idea behind this design is that applications can provide as many equivalent - * identifiers to a target application as possible, e.g. an instrument may be represented by - * an ISIN, CUSIP or Bloomberg identifier. - * - * Identifiers do not make sense for all types of data, so the `id` property is therefore - * optional, but some derived types may choose to require at least one identifier. - * Identifier values SHOULD always be of type string. - */ - id?: { [key: string]: any }; - /** - * Context data objects may include a name property that can be used for more information, - * or display purposes. Some derived types may require the name object as mandatory, - * depending on use case. - */ - name?: string; - /** - * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 - * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present - * to route shared context data appropriately. - * - * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data - * types they support in an FDC3 [App - * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery - * and routing. - * - * Standardized FDC3 context types have well-known `type` properties prefixed with the - * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and - * used by a particular organization, the convention is to prefix them with an - * organization-specific namespace, e.g. `blackrock.fund`. - * - * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more - * information about context data types. - */ - type: string; - [property: string]: any; + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + * Identifier values SHOULD always be of type string. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -1068,35 +1078,35 @@ export interface Context { * applications. */ export interface Country { - id: CountryID; - /** - * An optional human-readable name for the country - */ - name?: string; - type: "fdc3.country"; - [property: string]: any; + id: CountryID; + /** + * An optional human-readable name for the country + */ + name?: string; + type: 'fdc3.country'; + [property: string]: any; } export interface CountryID { - /** - * Two-letter ISO country code - */ - COUNTRY_ISOALPHA2?: string; - /** - * Three-letter ISO country code - */ - COUNTRY_ISOALPHA3?: string; - /** - * Two-letter ISO country code. Deprecated in FDC3 2.0 in favour of the version prefixed - * with `COUNTRY_`. - */ - ISOALPHA2?: string; - /** - * Three-letter ISO country code. Deprecated in FDC3 2.0 in favour of the version prefixed - * with `COUNTRY_`. - */ - ISOALPHA3?: string; - [property: string]: any; + /** + * Two-letter ISO country code + */ + COUNTRY_ISOALPHA2?: string; + /** + * Three-letter ISO country code + */ + COUNTRY_ISOALPHA3?: string; + /** + * Two-letter ISO country code. Deprecated in FDC3 2.0 in favour of the version prefixed + * with `COUNTRY_`. + */ + ISOALPHA2?: string; + /** + * Three-letter ISO country code. Deprecated in FDC3 2.0 in favour of the version prefixed + * with `COUNTRY_`. + */ + ISOALPHA3?: string; + [property: string]: any; } /** @@ -1110,22 +1120,22 @@ export interface CountryID { * A context representing an individual Currency. */ export interface Currency { - id: CurrencyID; - /** - * The name of the currency for display purposes - */ - name?: string; - type: "fdc3.currency"; - [property: string]: any; + id: CurrencyID; + /** + * The name of the currency for display purposes + */ + name?: string; + type: 'fdc3.currency'; + [property: string]: any; } export interface CurrencyID { - /** - * The `CURRENCY_ISOCODE` should conform to 3 character alphabetic codes defined in [ISO - * 4217](https://www.iso.org/iso-4217-currency-codes.html) - */ - CURRENCY_ISOCODE?: string; - [property: string]: any; + /** + * The `CURRENCY_ISOCODE` should conform to 3 character alphabetic codes defined in [ISO + * 4217](https://www.iso.org/iso-4217-currency-codes.html) + */ + CURRENCY_ISOCODE?: string; + [property: string]: any; } /** @@ -1139,22 +1149,22 @@ export interface CurrencyID { * A collection of information to be used to initiate an email with a Contact or ContactList. */ export interface Email { - /** - * One or more recipients for the email. - */ - recipients: EmailRecipients; - /** - * Subject line for the email. - */ - subject?: string; - /** - * Body content for the email. - */ - textBody?: string; - type: "fdc3.email"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * One or more recipients for the email. + */ + recipients: EmailRecipients; + /** + * Subject line for the email. + */ + subject?: string; + /** + * Body content for the email. + */ + textBody?: string; + type: 'fdc3.email'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -1175,25 +1185,25 @@ export interface Email { * this part of the contract with custom identifiers if so desired. */ export interface EmailRecipients { - /** - * Identifiers that relate to the Contact represented by this context - * - * One or more identifiers that refer to the contact list in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: ContactTIdentifiers; - /** - * An optional human-readable name for the contact - * - * An optional human-readable summary of the contact list - */ - name?: string; - type: EmailRecipientsType; - /** - * An array of contact contexts that forms the list. - */ - contacts?: ContactElement[]; - [property: string]: any; + /** + * Identifiers that relate to the Contact represented by this context + * + * One or more identifiers that refer to the contact list in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: ContactTIdentifiers; + /** + * An optional human-readable name for the contact + * + * An optional human-readable summary of the contact list + */ + name?: string; + type: EmailRecipientsType; + /** + * An array of contact contexts that forms the list. + */ + contacts?: ContactElement[]; + [property: string]: any; } /** @@ -1203,15 +1213,15 @@ export interface EmailRecipients { * Specific key names for systems are expected to be standardized in future. */ export interface ContactTIdentifiers { - /** - * The email address for the contact - */ - email?: string; - /** - * FactSet Permanent Identifier representing the contact - */ - FDS_ID?: string; - [property: string]: any; + /** + * The email address for the contact + */ + email?: string; + /** + * FactSet Permanent Identifier representing the contact + */ + FDS_ID?: string; + [property: string]: any; } /** @@ -1220,7 +1230,7 @@ export interface ContactTIdentifiers { * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or * `'Meeting'` although other string values are permitted. */ -export type EmailRecipientsType = "fdc3.contact" | "fdc3.contactList"; +export type EmailRecipientsType = 'fdc3.contact' | 'fdc3.contactList'; /** * Free text to be used for a keyword search @@ -1233,23 +1243,23 @@ export type EmailRecipientsType = "fdc3.contact" | "fdc3.contactList"; * A File attachment encoded in the form of a data URI. Can be added to a Message. */ export interface FileAttachment { - data: FileAttachmentData; - type: "fdc3.fileAttachment"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + data: FileAttachmentData; + type: 'fdc3.fileAttachment'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } export interface FileAttachmentData { - /** - * A data URI encoding the content of the file to be attached - */ - dataUri: string; - /** - * The name of the attached file - */ - name: string; - [property: string]: any; + /** + * A data URI encoding the content of the file to be attached + */ + dataUri: string; + /** + * The name of the attached file + */ + name: string; + [property: string]: any; } /** @@ -1263,34 +1273,34 @@ export interface FileAttachmentData { * A financial instrument from any asset class. */ export interface Instrument { - /** - * Any combination of instrument identifiers can be used together to resolve ambiguity, or - * for a better match. Not all applications will use the same instrument identifiers, which - * is why FDC3 allows for multiple to be specified. In general, the more identifiers an - * application can provide, the easier it will be to achieve interoperability. - * - * It is valid to include extra properties and metadata as part of the instrument payload, - * but the minimum requirement is for at least one instrument identifier to be provided. - * - * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant - * for tickers as used by an exchange. - * If the identifier you want to share is not a ticker or one of the other standardized - * fields, define a property that makes it clear what the value represents. Doing so will - * make interpretation easier for the developers of target applications. - */ - id: FluffyInstrumentIdentifiers; - /** - * The `market` map can be used to further specify the instrument and help achieve - * interoperability between disparate data sources. This is especially useful when using an - * `id` field that is not globally unique. - */ - market?: PurpleMarket; - /** - * An optional human-readable name for the instrument - */ - name?: string; - type: "fdc3.instrument"; - [property: string]: any; + /** + * Any combination of instrument identifiers can be used together to resolve ambiguity, or + * for a better match. Not all applications will use the same instrument identifiers, which + * is why FDC3 allows for multiple to be specified. In general, the more identifiers an + * application can provide, the easier it will be to achieve interoperability. + * + * It is valid to include extra properties and metadata as part of the instrument payload, + * but the minimum requirement is for at least one instrument identifier to be provided. + * + * Try to only use instrument identifiers as intended. E.g. the `ticker` property is meant + * for tickers as used by an exchange. + * If the identifier you want to share is not a ticker or one of the other standardized + * fields, define a property that makes it clear what the value represents. Doing so will + * make interpretation easier for the developers of target applications. + */ + id: FluffyInstrumentIdentifiers; + /** + * The `market` map can be used to further specify the instrument and help achieve + * interoperability between disparate data sources. This is especially useful when using an + * `id` field that is not globally unique. + */ + market?: PurpleMarket; + /** + * An optional human-readable name for the instrument + */ + name?: string; + type: 'fdc3.instrument'; + [property: string]: any; } /** @@ -1309,43 +1319,43 @@ export interface Instrument { * make interpretation easier for the developers of target applications. */ export interface FluffyInstrumentIdentifiers { - /** - * https://www.bloomberg.com/ - */ - BBG?: string; - /** - * https://www.cusip.com/ - */ - CUSIP?: string; - /** - * https://www.factset.com/ - */ - FDS_ID?: string; - /** - * https://www.openfigi.com/ - */ - FIGI?: string; - /** - * https://www.isin.org/ - */ - ISIN?: string; - /** - * https://permid.org/ - */ - PERMID?: string; - /** - * https://www.refinitiv.com/ - */ - RIC?: string; - /** - * https://www.lseg.com/sedol - */ - SEDOL?: string; - /** - * Unstandardized stock tickers - */ - ticker?: string; - [property: string]: any; + /** + * https://www.bloomberg.com/ + */ + BBG?: string; + /** + * https://www.cusip.com/ + */ + CUSIP?: string; + /** + * https://www.factset.com/ + */ + FDS_ID?: string; + /** + * https://www.openfigi.com/ + */ + FIGI?: string; + /** + * https://www.isin.org/ + */ + ISIN?: string; + /** + * https://permid.org/ + */ + PERMID?: string; + /** + * https://www.refinitiv.com/ + */ + RIC?: string; + /** + * https://www.lseg.com/sedol + */ + SEDOL?: string; + /** + * Unstandardized stock tickers + */ + ticker?: string; + [property: string]: any; } /** @@ -1354,23 +1364,23 @@ export interface FluffyInstrumentIdentifiers { * `id` field that is not globally unique. */ export interface PurpleMarket { - /** - * https://www.bloomberg.com/ - */ - BBG?: string; - /** - * https://www.iso.org/iso-3166-country-codes.html - */ - COUNTRY_ISOALPHA2?: string; - /** - * https://en.wikipedia.org/wiki/Market_Identifier_Code - */ - MIC?: string; - /** - * Human readable market name - */ - name?: string; - [property: string]: any; + /** + * https://www.bloomberg.com/ + */ + BBG?: string; + /** + * https://www.iso.org/iso-3166-country-codes.html + */ + COUNTRY_ISOALPHA2?: string; + /** + * https://en.wikipedia.org/wiki/Market_Identifier_Code + */ + MIC?: string; + /** + * Human readable market name + */ + name?: string; + [property: string]: any; } /** @@ -1384,21 +1394,21 @@ export interface PurpleMarket { * populate this part of the contract with custom identifiers if so desired. */ export interface InstrumentList { - /** - * One or more identifiers that refer to the instrument list in an OMS, EMS or related - * system. Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An array of instrument contexts that forms the list. - */ - instruments: InstrumentElement[]; - /** - * An optional human-readable summary of the instrument list - */ - name?: string; - type: "fdc3.instrumentList"; - [property: string]: any; + /** + * One or more identifiers that refer to the instrument list in an OMS, EMS or related + * system. Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An array of instrument contexts that forms the list. + */ + instruments: InstrumentElement[]; + /** + * An optional human-readable summary of the instrument list + */ + name?: string; + type: 'fdc3.instrumentList'; + [property: string]: any; } /** @@ -1415,43 +1425,43 @@ export interface InstrumentList { * of some specialist data, such as financial data for a given company or sector. */ export interface Interaction { - /** - * A human-readable description of the interaction - */ - description: string; - /** - * Can be used by a target application to pass an identifier back to the originating - * application after an interaction record has been created, updated or deleted. An - * interaction ID does not need to be populated by the originating application, however the - * target application could store it for future reference and SHOULD return it in a - * `TransactionResult`. - */ - id?: InteractionID; - /** - * The contact that initiated the interaction - */ - initiator?: ContactElement; - /** - * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or - * `'Meeting'` although other string values are permitted. - */ - interactionType: string; - /** - * Used to represent the application or service that the interaction was created from to aid - * in tracing the source of an interaction. - */ - origin?: string; - /** - * A list of contacts involved in the interaction - */ - participants: ContactListObject; - /** - * The time range over which the interaction occurred - */ - timeRange: TimeRangeObject; - type: "fdc3.interaction"; - name?: string; - [property: string]: any; + /** + * A human-readable description of the interaction + */ + description: string; + /** + * Can be used by a target application to pass an identifier back to the originating + * application after an interaction record has been created, updated or deleted. An + * interaction ID does not need to be populated by the originating application, however the + * target application could store it for future reference and SHOULD return it in a + * `TransactionResult`. + */ + id?: InteractionID; + /** + * The contact that initiated the interaction + */ + initiator?: ContactElement; + /** + * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or + * `'Meeting'` although other string values are permitted. + */ + interactionType: string; + /** + * Used to represent the application or service that the interaction was created from to aid + * in tracing the source of an interaction. + */ + origin?: string; + /** + * A list of contacts involved in the interaction + */ + participants: ContactListObject; + /** + * The time range over which the interaction occurred + */ + timeRange: TimeRangeObject; + type: 'fdc3.interaction'; + name?: string; + [property: string]: any; } /** @@ -1462,21 +1472,21 @@ export interface Interaction { * `TransactionResult`. */ export interface InteractionID { - /** - * Interactions ID in Salesforce - */ - SALESFORCE?: string; - /** - * Interaction ID in SingleTrack - */ - SINGLETRACK?: string; - /** - * Can be used by a target application to pass a record's link back to the originating - * application. This offers the originating application a way to open the record for a user - * to view. - */ - URI?: string; - [property: string]: any; + /** + * Interactions ID in Salesforce + */ + SALESFORCE?: string; + /** + * Interaction ID in SingleTrack + */ + SINGLETRACK?: string; + /** + * Can be used by a target application to pass a record's link back to the originating + * application. This offers the originating application a way to open the record for a user + * to view. + */ + URI?: string; + [property: string]: any; } /** @@ -1493,34 +1503,34 @@ export interface InteractionID { * message). To be put inside a ChatInitSettings object. */ export interface Message { - /** - * A map of string IDs to entities that should be attached to the message, such as an action - * to perform, a file attachment, or other FDC3 context object. - */ - entities?: { [key: string]: EntityValue }; - /** - * A map of string mime-type to string content - */ - text?: FluffyMessageText; - type: "fdc3.message"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * A map of string IDs to entities that should be attached to the message, such as an action + * to perform, a file attachment, or other FDC3 context object. + */ + entities?: { [key: string]: EntityValue }; + /** + * A map of string mime-type to string content + */ + text?: FluffyMessageText; + type: 'fdc3.message'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** * A map of string mime-type to string content */ export interface FluffyMessageText { - /** - * Markdown encoded content - */ - "text/markdown"?: string; - /** - * Plain text encoded content. - */ - "text/plain"?: string; - [property: string]: any; + /** + * Markdown encoded content + */ + 'text/markdown'?: string; + /** + * Plain text encoded content. + */ + 'text/plain'?: string; + [property: string]: any; } /** @@ -1538,10 +1548,10 @@ export interface FluffyMessageText { * for a lack of context, for example in their intent metadata in an app directory. */ export interface Nothing { - type: "fdc3.nothing"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + type: 'fdc3.nothing'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -1563,22 +1573,22 @@ export interface Nothing { * be standardized in future. */ export interface Order { - /** - * Optional additional details about the order, which may include a product element that is - * an, as yet undefined but extensible, Context - */ - details?: PurpleOrderDetails; - /** - * One or more identifiers that refer to the order in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * An optional human-readable summary of the order. - */ - name?: string; - type: "fdc3.order"; - [property: string]: any; + /** + * Optional additional details about the order, which may include a product element that is + * an, as yet undefined but extensible, Context + */ + details?: PurpleOrderDetails; + /** + * One or more identifiers that refer to the order in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * An optional human-readable summary of the order. + */ + name?: string; + type: 'fdc3.order'; + [property: string]: any; } /** @@ -1586,8 +1596,8 @@ export interface Order { * an, as yet undefined but extensible, Context */ export interface PurpleOrderDetails { - product?: ProductObject; - [property: string]: any; + product?: ProductObject; + [property: string]: any; } /** @@ -1604,21 +1614,21 @@ export interface PurpleOrderDetails { * of the contract with custom identifiers if so desired. */ export interface ProductObject { - /** - * One or more identifiers that refer to the product. Specific key names for systems are - * expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * A financial instrument that relates to the definition of this product - */ - instrument?: InstrumentElement; - /** - * A human-readable summary of the product. - */ - name?: string; - type: "fdc3.product"; - [property: string]: any; + /** + * One or more identifiers that refer to the product. Specific key names for systems are + * expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * A financial instrument that relates to the definition of this product + */ + instrument?: InstrumentElement; + /** + * A human-readable summary of the product. + */ + name?: string; + type: 'fdc3.product'; + [property: string]: any; } /** @@ -1644,21 +1654,21 @@ export interface ProductObject { * part of the contract with custom identifiers if so desired. */ export interface OrderList { - /** - * One or more identifiers that refer to the order list in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An optional human-readable summary of the order list - */ - name?: string; - /** - * An array of order contexts that forms the list. - */ - orders: OrderElement[]; - type: "fdc3.orderList"; - [property: string]: any; + /** + * One or more identifiers that refer to the order list in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An optional human-readable summary of the order list + */ + name?: string; + /** + * An array of order contexts that forms the list. + */ + orders: OrderElement[]; + type: 'fdc3.orderList'; + [property: string]: any; } /** @@ -1673,22 +1683,22 @@ export interface OrderList { * be standardized in future. */ export interface OrderElement { - /** - * Optional additional details about the order, which may include a product element that is - * an, as yet undefined but extensible, Context - */ - details?: FluffyOrderDetails; - /** - * One or more identifiers that refer to the order in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * An optional human-readable summary of the order. - */ - name?: string; - type: "fdc3.order"; - [property: string]: any; + /** + * Optional additional details about the order, which may include a product element that is + * an, as yet undefined but extensible, Context + */ + details?: FluffyOrderDetails; + /** + * One or more identifiers that refer to the order in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * An optional human-readable summary of the order. + */ + name?: string; + type: 'fdc3.order'; + [property: string]: any; } /** @@ -1696,8 +1706,8 @@ export interface OrderElement { * an, as yet undefined but extensible, Context */ export interface FluffyOrderDetails { - product?: ProductObject; - [property: string]: any; + product?: ProductObject; + [property: string]: any; } /** @@ -1715,38 +1725,38 @@ export interface FluffyOrderDetails { * but the minimum requirement is for at least one specified identifier to be provided. */ export interface Organization { - /** - * Identifiers for the organization, at least one must be provided. - */ - id: OrganizationIdentifiers; - /** - * An optional human-readable name of the organization - */ - name?: string; - type: "fdc3.organization"; - [property: string]: any; + /** + * Identifiers for the organization, at least one must be provided. + */ + id: OrganizationIdentifiers; + /** + * An optional human-readable name of the organization + */ + name?: string; + type: 'fdc3.organization'; + [property: string]: any; } /** * Identifiers for the organization, at least one must be provided. */ export interface OrganizationIdentifiers { - /** - * FactSet Permanent Identifier representing the organization - */ - FDS_ID?: string; - /** - * The Legal Entity Identifier (LEI) is a 20-character, alpha-numeric code based on the ISO - * 17442 standard developed by the International Organization for Standardization (ISO). It - * connects to key reference information that enables clear and unique identification of - * legal entities participating in financial transactions. - */ - LEI?: string; - /** - * Refinitiv Permanent Identifiers, or PermID for the organization - */ - PERMID?: string; - [property: string]: any; + /** + * FactSet Permanent Identifier representing the organization + */ + FDS_ID?: string; + /** + * The Legal Entity Identifier (LEI) is a 20-character, alpha-numeric code based on the ISO + * 17442 standard developed by the International Organization for Standardization (ISO). It + * connects to key reference information that enables clear and unique identification of + * legal entities participating in financial transactions. + */ + LEI?: string; + /** + * Refinitiv Permanent Identifiers, or PermID for the organization + */ + PERMID?: string; + [property: string]: any; } /** @@ -1772,21 +1782,21 @@ export interface OrganizationIdentifiers { * this part of the contract with custom identifiers if so desired. */ export interface Portfolio { - /** - * One or more identifiers that refer to the portfolio in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An optional human-readable name for the portfolio - */ - name?: string; - /** - * The List of Positions which make up the Portfolio - */ - positions: PositionElement[]; - type: "fdc3.portfolio"; - [property: string]: any; + /** + * One or more identifiers that refer to the portfolio in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An optional human-readable name for the portfolio + */ + name?: string; + /** + * The List of Positions which make up the Portfolio + */ + positions: PositionElement[]; + type: 'fdc3.portfolio'; + [property: string]: any; } /** @@ -1804,22 +1814,22 @@ export interface Portfolio { * part of the contract with custom identifiers if so desired. */ export interface PositionElement { - /** - * The amount of the holding, e.g. a number of shares - */ - holding: number; - /** - * One or more identifiers that refer to the position in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - instrument: InstrumentElement; - /** - * An optional human-readable name for the position - */ - name?: string; - type: "fdc3.position"; - [property: string]: any; + /** + * The amount of the holding, e.g. a number of shares + */ + holding: number; + /** + * One or more identifiers that refer to the position in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + instrument: InstrumentElement; + /** + * An optional human-readable name for the position + */ + name?: string; + type: 'fdc3.position'; + [property: string]: any; } /** @@ -1851,22 +1861,22 @@ export interface PositionElement { * part of the contract with custom identifiers if so desired. */ export interface Position { - /** - * The amount of the holding, e.g. a number of shares - */ - holding: number; - /** - * One or more identifiers that refer to the position in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - instrument: InstrumentElement; - /** - * An optional human-readable name for the position - */ - name?: string; - type: "fdc3.position"; - [property: string]: any; + /** + * The amount of the holding, e.g. a number of shares + */ + holding: number; + /** + * One or more identifiers that refer to the position in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + instrument: InstrumentElement; + /** + * An optional human-readable name for the position + */ + name?: string; + type: 'fdc3.position'; + [property: string]: any; } /** @@ -1881,21 +1891,21 @@ export interface Position { * of the contract with custom identifiers if so desired. */ export interface Product { - /** - * One or more identifiers that refer to the product. Specific key names for systems are - * expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * A financial instrument that relates to the definition of this product - */ - instrument?: InstrumentElement; - /** - * A human-readable summary of the product. - */ - name?: string; - type: "fdc3.product"; - [property: string]: any; + /** + * One or more identifiers that refer to the product. Specific key names for systems are + * expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * A financial instrument that relates to the definition of this product + */ + instrument?: InstrumentElement; + /** + * A human-readable summary of the product. + */ + name?: string; + type: 'fdc3.product'; + [property: string]: any; } /** @@ -1931,20 +1941,20 @@ export interface Product { * - Times MAY be specified with millisecond precision, e.g. `"2022-05-12T15:18:03.349Z"` */ export interface TimeRange { - /** - * The end time of the range, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. - */ - endTime?: Date; - /** - * The start time of the range, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. - */ - startTime?: Date; - type: "fdc3.timeRange"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * The end time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. + */ + endTime?: Date; + /** + * The start time of the range, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator. + */ + startTime?: Date; + type: 'fdc3.timeRange'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -1961,21 +1971,21 @@ export interface TimeRange { * of the contract with custom identifiers if so desired. */ export interface Trade { - /** - * One or more identifiers that refer to the trade in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * A human-readable summary of the trade. - */ - name?: string; - /** - * A product that is the subject of the trade. - */ - product: ProductObject; - type: "fdc3.trade"; - [property: string]: any; + /** + * One or more identifiers that refer to the trade in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * A human-readable summary of the trade. + */ + name?: string; + /** + * A product that is the subject of the trade. + */ + product: ProductObject; + type: 'fdc3.trade'; + [property: string]: any; } /** @@ -1994,21 +2004,21 @@ export interface Trade { * part of the contract with custom identifiers if so desired. */ export interface TradeList { - /** - * One or more identifiers that refer to the trade list in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id?: { [key: string]: string }; - /** - * An optional human-readable name for the trade list - */ - name?: string; - /** - * An array of trade contexts that forms the list. - */ - trades: TradeElement[]; - type: "fdc3.tradeList"; - [property: string]: any; + /** + * One or more identifiers that refer to the trade list in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id?: { [key: string]: string }; + /** + * An optional human-readable name for the trade list + */ + name?: string; + /** + * An array of trade contexts that forms the list. + */ + trades: TradeElement[]; + type: 'fdc3.tradeList'; + [property: string]: any; } /** @@ -2025,21 +2035,21 @@ export interface TradeList { * of the contract with custom identifiers if so desired. */ export interface TradeElement { - /** - * One or more identifiers that refer to the trade in an OMS, EMS or related system. - * Specific key names for systems are expected to be standardized in future. - */ - id: { [key: string]: string }; - /** - * A human-readable summary of the trade. - */ - name?: string; - /** - * A product that is the subject of the trade. - */ - product: ProductObject; - type: "fdc3.trade"; - [property: string]: any; + /** + * One or more identifiers that refer to the trade in an OMS, EMS or related system. + * Specific key names for systems are expected to be standardized in future. + */ + id: { [key: string]: string }; + /** + * A human-readable summary of the trade. + */ + name?: string; + /** + * A product that is the subject of the trade. + */ + product: ProductObject; + type: 'fdc3.trade'; + [property: string]: any; } /** @@ -2056,28 +2066,28 @@ export interface TradeElement { * (where needed) for the transaction and MAY wrap a returned context object. */ export interface TransactionResult { - /** - * A context object returned by the transaction, possibly with updated data. - */ - context?: ContextElement; - /** - * A human readable message describing the outcome of the transaction. - */ - message?: string; - /** - * The status of the transaction being reported. - */ - status: TransactionStatus; - type: "fdc3.transactionResult"; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * A context object returned by the transaction, possibly with updated data. + */ + context?: ContextElement; + /** + * A human readable message describing the outcome of the transaction. + */ + message?: string; + /** + * The status of the transaction being reported. + */ + status: TransactionStatus; + type: 'fdc3.transactionResult'; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** * The status of the transaction being reported. */ -export type TransactionStatus = "Created" | "Deleted" | "Updated" | "Failed"; +export type TransactionStatus = 'Created' | 'Deleted' | 'Updated' | 'Failed'; /** * Free text to be used for a keyword search @@ -2090,33 +2100,33 @@ export type TransactionStatus = "Created" | "Deleted" | "Updated" | "Failed"; * A context type representing the price and value of a holding. */ export interface Valuation { - /** - * The valuation currency, which should conform to 3 character alphabetic codes defined in - * [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) - */ - CURRENCY_ISOCODE: string; - /** - * The time at which this valuation expires, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator included. - */ - expiryTime?: Date; - /** - * The price per unit the the valuation is based on. - */ - price?: number; - type: "fdc3.valuation"; - /** - * The time at which the valuation was performed, encoded according to [ISO - * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator included. - */ - valuationTime?: Date; - /** - * The value of the holding, expresses in the nominated currency. - */ - value: number; - id?: { [key: string]: any }; - name?: string; - [property: string]: any; + /** + * The valuation currency, which should conform to 3 character alphabetic codes defined in + * [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) + */ + CURRENCY_ISOCODE: string; + /** + * The time at which this valuation expires, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator included. + */ + expiryTime?: Date; + /** + * The price per unit the the valuation is based on. + */ + price?: number; + type: 'fdc3.valuation'; + /** + * The time at which the valuation was performed, encoded according to [ISO + * 8601-1:2019](https://www.iso.org/standard/70907.html) with a timezone indicator included. + */ + valuationTime?: Date; + /** + * The value of the holding, expresses in the nominated currency. + */ + value: number; + id?: { [key: string]: any }; + name?: string; + [property: string]: any; } /** @@ -2129,910 +2139,1013 @@ export interface Valuation { // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toAction(json: string): Action { - return cast(JSON.parse(json), r("Action")); - } + public static toAction(json: string): Action { + return cast(JSON.parse(json), r('Action')); + } - public static actionToJson(value: Action): string { - return JSON.stringify(uncast(value, r("Action")), null, 2); - } + public static actionToJson(value: Action): string { + return JSON.stringify(uncast(value, r('Action')), null, 2); + } - public static toChart(json: string): Chart { - return cast(JSON.parse(json), r("Chart")); - } + public static toChart(json: string): Chart { + return cast(JSON.parse(json), r('Chart')); + } - public static chartToJson(value: Chart): string { - return JSON.stringify(uncast(value, r("Chart")), null, 2); - } + public static chartToJson(value: Chart): string { + return JSON.stringify(uncast(value, r('Chart')), null, 2); + } - public static toChatInitSettings(json: string): ChatInitSettings { - return cast(JSON.parse(json), r("ChatInitSettings")); - } + public static toChatInitSettings(json: string): ChatInitSettings { + return cast(JSON.parse(json), r('ChatInitSettings')); + } - public static chatInitSettingsToJson(value: ChatInitSettings): string { - return JSON.stringify(uncast(value, r("ChatInitSettings")), null, 2); - } + public static chatInitSettingsToJson(value: ChatInitSettings): string { + return JSON.stringify(uncast(value, r('ChatInitSettings')), null, 2); + } - public static toChatMessage(json: string): ChatMessage { - return cast(JSON.parse(json), r("ChatMessage")); - } + public static toChatMessage(json: string): ChatMessage { + return cast(JSON.parse(json), r('ChatMessage')); + } - public static chatMessageToJson(value: ChatMessage): string { - return JSON.stringify(uncast(value, r("ChatMessage")), null, 2); - } + public static chatMessageToJson(value: ChatMessage): string { + return JSON.stringify(uncast(value, r('ChatMessage')), null, 2); + } - public static toChatRoom(json: string): ChatRoom { - return cast(JSON.parse(json), r("ChatRoom")); - } + public static toChatRoom(json: string): ChatRoom { + return cast(JSON.parse(json), r('ChatRoom')); + } - public static chatRoomToJson(value: ChatRoom): string { - return JSON.stringify(uncast(value, r("ChatRoom")), null, 2); - } + public static chatRoomToJson(value: ChatRoom): string { + return JSON.stringify(uncast(value, r('ChatRoom')), null, 2); + } - public static toChatSearchCriteria(json: string): ChatSearchCriteria { - return cast(JSON.parse(json), r("ChatSearchCriteria")); - } + public static toChatSearchCriteria(json: string): ChatSearchCriteria { + return cast(JSON.parse(json), r('ChatSearchCriteria')); + } - public static chatSearchCriteriaToJson(value: ChatSearchCriteria): string { - return JSON.stringify(uncast(value, r("ChatSearchCriteria")), null, 2); - } + public static chatSearchCriteriaToJson(value: ChatSearchCriteria): string { + return JSON.stringify(uncast(value, r('ChatSearchCriteria')), null, 2); + } - public static toContact(json: string): Contact { - return cast(JSON.parse(json), r("Contact")); - } + public static toContact(json: string): Contact { + return cast(JSON.parse(json), r('Contact')); + } - public static contactToJson(value: Contact): string { - return JSON.stringify(uncast(value, r("Contact")), null, 2); - } + public static contactToJson(value: Contact): string { + return JSON.stringify(uncast(value, r('Contact')), null, 2); + } - public static toContactList(json: string): ContactList { - return cast(JSON.parse(json), r("ContactList")); - } + public static toContactList(json: string): ContactList { + return cast(JSON.parse(json), r('ContactList')); + } - public static contactListToJson(value: ContactList): string { - return JSON.stringify(uncast(value, r("ContactList")), null, 2); - } + public static contactListToJson(value: ContactList): string { + return JSON.stringify(uncast(value, r('ContactList')), null, 2); + } - public static toContext(json: string): Context { - return cast(JSON.parse(json), r("Context")); - } + public static toContext(json: string): Context { + return cast(JSON.parse(json), r('Context')); + } - public static contextToJson(value: Context): string { - return JSON.stringify(uncast(value, r("Context")), null, 2); - } + public static contextToJson(value: Context): string { + return JSON.stringify(uncast(value, r('Context')), null, 2); + } - public static toCountry(json: string): Country { - return cast(JSON.parse(json), r("Country")); - } + public static toCountry(json: string): Country { + return cast(JSON.parse(json), r('Country')); + } - public static countryToJson(value: Country): string { - return JSON.stringify(uncast(value, r("Country")), null, 2); - } + public static countryToJson(value: Country): string { + return JSON.stringify(uncast(value, r('Country')), null, 2); + } - public static toCurrency(json: string): Currency { - return cast(JSON.parse(json), r("Currency")); - } + public static toCurrency(json: string): Currency { + return cast(JSON.parse(json), r('Currency')); + } - public static currencyToJson(value: Currency): string { - return JSON.stringify(uncast(value, r("Currency")), null, 2); - } + public static currencyToJson(value: Currency): string { + return JSON.stringify(uncast(value, r('Currency')), null, 2); + } - public static toEmail(json: string): Email { - return cast(JSON.parse(json), r("Email")); - } + public static toEmail(json: string): Email { + return cast(JSON.parse(json), r('Email')); + } - public static emailToJson(value: Email): string { - return JSON.stringify(uncast(value, r("Email")), null, 2); - } + public static emailToJson(value: Email): string { + return JSON.stringify(uncast(value, r('Email')), null, 2); + } - public static toFileAttachment(json: string): FileAttachment { - return cast(JSON.parse(json), r("FileAttachment")); - } + public static toFileAttachment(json: string): FileAttachment { + return cast(JSON.parse(json), r('FileAttachment')); + } - public static fileAttachmentToJson(value: FileAttachment): string { - return JSON.stringify(uncast(value, r("FileAttachment")), null, 2); - } + public static fileAttachmentToJson(value: FileAttachment): string { + return JSON.stringify(uncast(value, r('FileAttachment')), null, 2); + } - public static toInstrument(json: string): Instrument { - return cast(JSON.parse(json), r("Instrument")); - } + public static toInstrument(json: string): Instrument { + return cast(JSON.parse(json), r('Instrument')); + } - public static instrumentToJson(value: Instrument): string { - return JSON.stringify(uncast(value, r("Instrument")), null, 2); - } + public static instrumentToJson(value: Instrument): string { + return JSON.stringify(uncast(value, r('Instrument')), null, 2); + } - public static toInstrumentList(json: string): InstrumentList { - return cast(JSON.parse(json), r("InstrumentList")); - } + public static toInstrumentList(json: string): InstrumentList { + return cast(JSON.parse(json), r('InstrumentList')); + } - public static instrumentListToJson(value: InstrumentList): string { - return JSON.stringify(uncast(value, r("InstrumentList")), null, 2); - } + public static instrumentListToJson(value: InstrumentList): string { + return JSON.stringify(uncast(value, r('InstrumentList')), null, 2); + } - public static toInteraction(json: string): Interaction { - return cast(JSON.parse(json), r("Interaction")); - } + public static toInteraction(json: string): Interaction { + return cast(JSON.parse(json), r('Interaction')); + } - public static interactionToJson(value: Interaction): string { - return JSON.stringify(uncast(value, r("Interaction")), null, 2); - } + public static interactionToJson(value: Interaction): string { + return JSON.stringify(uncast(value, r('Interaction')), null, 2); + } - public static toMessage(json: string): Message { - return cast(JSON.parse(json), r("Message")); - } + public static toMessage(json: string): Message { + return cast(JSON.parse(json), r('Message')); + } - public static messageToJson(value: Message): string { - return JSON.stringify(uncast(value, r("Message")), null, 2); - } + public static messageToJson(value: Message): string { + return JSON.stringify(uncast(value, r('Message')), null, 2); + } - public static toNothing(json: string): Nothing { - return cast(JSON.parse(json), r("Nothing")); - } + public static toNothing(json: string): Nothing { + return cast(JSON.parse(json), r('Nothing')); + } - public static nothingToJson(value: Nothing): string { - return JSON.stringify(uncast(value, r("Nothing")), null, 2); - } + public static nothingToJson(value: Nothing): string { + return JSON.stringify(uncast(value, r('Nothing')), null, 2); + } - public static toOrder(json: string): Order { - return cast(JSON.parse(json), r("Order")); - } + public static toOrder(json: string): Order { + return cast(JSON.parse(json), r('Order')); + } - public static orderToJson(value: Order): string { - return JSON.stringify(uncast(value, r("Order")), null, 2); - } + public static orderToJson(value: Order): string { + return JSON.stringify(uncast(value, r('Order')), null, 2); + } - public static toOrderList(json: string): OrderList { - return cast(JSON.parse(json), r("OrderList")); - } + public static toOrderList(json: string): OrderList { + return cast(JSON.parse(json), r('OrderList')); + } - public static orderListToJson(value: OrderList): string { - return JSON.stringify(uncast(value, r("OrderList")), null, 2); - } + public static orderListToJson(value: OrderList): string { + return JSON.stringify(uncast(value, r('OrderList')), null, 2); + } - public static toOrganization(json: string): Organization { - return cast(JSON.parse(json), r("Organization")); - } + public static toOrganization(json: string): Organization { + return cast(JSON.parse(json), r('Organization')); + } - public static organizationToJson(value: Organization): string { - return JSON.stringify(uncast(value, r("Organization")), null, 2); - } + public static organizationToJson(value: Organization): string { + return JSON.stringify(uncast(value, r('Organization')), null, 2); + } - public static toPortfolio(json: string): Portfolio { - return cast(JSON.parse(json), r("Portfolio")); - } + public static toPortfolio(json: string): Portfolio { + return cast(JSON.parse(json), r('Portfolio')); + } - public static portfolioToJson(value: Portfolio): string { - return JSON.stringify(uncast(value, r("Portfolio")), null, 2); - } + public static portfolioToJson(value: Portfolio): string { + return JSON.stringify(uncast(value, r('Portfolio')), null, 2); + } - public static toPosition(json: string): Position { - return cast(JSON.parse(json), r("Position")); - } + public static toPosition(json: string): Position { + return cast(JSON.parse(json), r('Position')); + } - public static positionToJson(value: Position): string { - return JSON.stringify(uncast(value, r("Position")), null, 2); - } + public static positionToJson(value: Position): string { + return JSON.stringify(uncast(value, r('Position')), null, 2); + } - public static toProduct(json: string): Product { - return cast(JSON.parse(json), r("Product")); - } + public static toProduct(json: string): Product { + return cast(JSON.parse(json), r('Product')); + } - public static productToJson(value: Product): string { - return JSON.stringify(uncast(value, r("Product")), null, 2); - } + public static productToJson(value: Product): string { + return JSON.stringify(uncast(value, r('Product')), null, 2); + } - public static toTimeRange(json: string): TimeRange { - return cast(JSON.parse(json), r("TimeRange")); - } + public static toTimeRange(json: string): TimeRange { + return cast(JSON.parse(json), r('TimeRange')); + } - public static timeRangeToJson(value: TimeRange): string { - return JSON.stringify(uncast(value, r("TimeRange")), null, 2); - } + public static timeRangeToJson(value: TimeRange): string { + return JSON.stringify(uncast(value, r('TimeRange')), null, 2); + } - public static toTrade(json: string): Trade { - return cast(JSON.parse(json), r("Trade")); - } + public static toTrade(json: string): Trade { + return cast(JSON.parse(json), r('Trade')); + } - public static tradeToJson(value: Trade): string { - return JSON.stringify(uncast(value, r("Trade")), null, 2); - } + public static tradeToJson(value: Trade): string { + return JSON.stringify(uncast(value, r('Trade')), null, 2); + } - public static toTradeList(json: string): TradeList { - return cast(JSON.parse(json), r("TradeList")); - } + public static toTradeList(json: string): TradeList { + return cast(JSON.parse(json), r('TradeList')); + } - public static tradeListToJson(value: TradeList): string { - return JSON.stringify(uncast(value, r("TradeList")), null, 2); - } + public static tradeListToJson(value: TradeList): string { + return JSON.stringify(uncast(value, r('TradeList')), null, 2); + } - public static toTransactionResult(json: string): TransactionResult { - return cast(JSON.parse(json), r("TransactionResult")); - } + public static toTransactionResult(json: string): TransactionResult { + return cast(JSON.parse(json), r('TransactionResult')); + } - public static transactionResultToJson(value: TransactionResult): string { - return JSON.stringify(uncast(value, r("TransactionResult")), null, 2); - } + public static transactionResultToJson(value: TransactionResult): string { + return JSON.stringify(uncast(value, r('TransactionResult')), null, 2); + } - public static toValuation(json: string): Valuation { - return cast(JSON.parse(json), r("Valuation")); - } + public static toValuation(json: string): Valuation { + return cast(JSON.parse(json), r('Valuation')); + } - public static valuationToJson(value: Valuation): string { - return JSON.stringify(uncast(value, r("Valuation")), null, 2); - } + public static valuationToJson(value: Valuation): string { + return JSON.stringify(uncast(value, r('Valuation')), null, 2); + } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); } function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; } else { - return typeof typ; + return `one of [${typ + .map(a => { + return prettyTypeName(a); + }) + .join(', ')}]`; } + } else if (typeof typ === 'object' && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } } function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; + if (typ.jsonToJS === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.json] = { key: p.js, typ: p.typ })); + typ.jsonToJS = map; + } + return typ.jsonToJS; } function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; + if (typ.jsToJSON === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.js] = { key: p.json, typ: p.typ })); + typ.jsToJSON = map; + } + return typ.jsToJSON; } function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) {} - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); + function transformPrimitive(typ: string, val: any): any { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs: any[], val: any): any { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases: string[], val: any): any { + if (cases.indexOf(val) !== -1) return val; + return invalidValue( + cases.map(a => { + return l(a); + }), + val, + key, + parent + ); + } + + function transformArray(typ: any, val: any): any { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l('array'), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val: any): any { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l('Date'), val, key, parent); + } + return d; + } + + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { + if (val === null || typeof val !== 'object' || Array.isArray(val)) { + return invalidValue(l(ref || 'object'), val, key, parent); + } + const result: any = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); } function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); + return transform(val, typ, jsonToJSProps); } function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); + return transform(val, typ, jsToJSONProps); } function l(typ: any) { - return { literal: typ }; + return { literal: typ }; } function a(typ: any) { - return { arrayItems: typ }; + return { arrayItems: typ }; } function u(...typs: any[]) { - return { unionMembers: typs }; + return { unionMembers: typs }; } function o(props: any[], additional: any) { - return { props, additional }; + return { props, additional }; } function m(additional: any) { - return { props: [], additional }; + return { props: [], additional }; } function r(name: string) { - return { ref: name }; + return { ref: name }; } const typeMap: any = { - "Action": o([ - { json: "action", js: "action", typ: u(undefined, r("ActionType")) }, - { json: "app", js: "app", typ: u(undefined, r("AppIdentifier")) }, - { json: "channelId", js: "channelId", typ: u(undefined, "") }, - { json: "context", js: "context", typ: r("ContextElement") }, - { json: "intent", js: "intent", typ: u(undefined, "") }, - { json: "title", js: "title", typ: "" }, - { json: "type", js: "type", typ: r("ActionTypeEnum") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "AppIdentifier": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "ContextElement": o([ - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: "" }, - ], "any"), - "Chart": o([ - { json: "instruments", js: "instruments", typ: a(r("InstrumentElement")) }, - { json: "otherConfig", js: "otherConfig", typ: u(undefined, a(r("ContextElement"))) }, - { json: "range", js: "range", typ: u(undefined, r("TimeRangeObject")) }, - { json: "style", js: "style", typ: u(undefined, r("ChartStyle")) }, - { json: "type", js: "type", typ: r("ChartType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "InstrumentElement": o([ - { json: "id", js: "id", typ: r("PurpleInstrumentIdentifiers") }, - { json: "market", js: "market", typ: u(undefined, r("OrganizationMarket")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("PurpleInteractionType") }, - ], "any"), - "PurpleInstrumentIdentifiers": o([ - { json: "BBG", js: "BBG", typ: u(undefined, "") }, - { json: "CUSIP", js: "CUSIP", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - { json: "FIGI", js: "FIGI", typ: u(undefined, "") }, - { json: "ISIN", js: "ISIN", typ: u(undefined, "") }, - { json: "PERMID", js: "PERMID", typ: u(undefined, "") }, - { json: "RIC", js: "RIC", typ: u(undefined, "") }, - { json: "SEDOL", js: "SEDOL", typ: u(undefined, "") }, - { json: "ticker", js: "ticker", typ: u(undefined, "") }, - ], "any"), - "OrganizationMarket": o([ - { json: "BBG", js: "BBG", typ: u(undefined, "") }, - { json: "COUNTRY_ISOALPHA2", js: "COUNTRY_ISOALPHA2", typ: u(undefined, "") }, - { json: "MIC", js: "MIC", typ: u(undefined, "") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "TimeRangeObject": o([ - { json: "endTime", js: "endTime", typ: u(undefined, Date) }, - { json: "startTime", js: "startTime", typ: u(undefined, Date) }, - { json: "type", js: "type", typ: r("TimeRangeType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "ChatInitSettings": o([ - { json: "chatName", js: "chatName", typ: u(undefined, "") }, - { json: "members", js: "members", typ: u(undefined, r("ContactListObject")) }, - { json: "message", js: "message", typ: u(undefined, u(r("MessageObject"), "")) }, - { json: "options", js: "options", typ: u(undefined, r("ChatOptions")) }, - { json: "type", js: "type", typ: r("ChatInitSettingsType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "ContactListObject": o([ - { json: "contacts", js: "contacts", typ: a(r("ContactElement")) }, - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("ContactListType") }, - ], "any"), - "ContactElement": o([ - { json: "id", js: "id", typ: r("PurpleContactIdentifiers") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("FluffyInteractionType") }, - ], "any"), - "PurpleContactIdentifiers": o([ - { json: "email", js: "email", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - ], "any"), - "MessageObject": o([ - { json: "entities", js: "entities", typ: u(undefined, m(r("EntityValue"))) }, - { json: "text", js: "text", typ: u(undefined, r("PurpleMessageText")) }, - { json: "type", js: "type", typ: r("MessageType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "EntityValue": o([ - { json: "action", js: "action", typ: u(undefined, r("ActionType")) }, - { json: "app", js: "app", typ: u(undefined, r("AppIdentifier")) }, - { json: "channelId", js: "channelId", typ: u(undefined, "") }, - { json: "context", js: "context", typ: u(undefined, r("ContextElement")) }, - { json: "intent", js: "intent", typ: u(undefined, "") }, - { json: "title", js: "title", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("EntityType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "data", js: "data", typ: u(undefined, r("EntityData")) }, - ], "any"), - "EntityData": o([ - { json: "dataUri", js: "dataUri", typ: "" }, - { json: "name", js: "name", typ: "" }, - ], "any"), - "PurpleMessageText": o([ - { json: "text/markdown", js: "text/markdown", typ: u(undefined, "") }, - { json: "text/plain", js: "text/plain", typ: u(undefined, "") }, - ], "any"), - "ChatOptions": o([ - { json: "allowAddUser", js: "allowAddUser", typ: u(undefined, true) }, - { json: "allowHistoryBrowsing", js: "allowHistoryBrowsing", typ: u(undefined, true) }, - { json: "allowMessageCopy", js: "allowMessageCopy", typ: u(undefined, true) }, - { json: "groupRecipients", js: "groupRecipients", typ: u(undefined, true) }, - { json: "isPublic", js: "isPublic", typ: u(undefined, true) }, - ], "any"), - "ChatMessage": o([ - { json: "chatRoom", js: "chatRoom", typ: r("ChatRoomObject") }, - { json: "message", js: "message", typ: r("MessageObject") }, - { json: "type", js: "type", typ: r("ChatMessageType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "ChatRoomObject": o([ - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "providerName", js: "providerName", typ: "" }, - { json: "type", js: "type", typ: r("ChatRoomType") }, - { json: "url", js: "url", typ: u(undefined, "") }, - ], "any"), - "ChatRoom": o([ - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "providerName", js: "providerName", typ: "" }, - { json: "type", js: "type", typ: r("ChatRoomType") }, - { json: "url", js: "url", typ: u(undefined, "") }, - ], "any"), - "ChatSearchCriteria": o([ - { json: "criteria", js: "criteria", typ: a(u(r("OrganizationObject"), "")) }, - { json: "type", js: "type", typ: r("ChatSearchCriteriaType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "OrganizationObject": o([ - { json: "id", js: "id", typ: r("Identifiers") }, - { json: "market", js: "market", typ: u(undefined, r("OrganizationMarket")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("TentacledInteractionType") }, - ], "any"), - "Identifiers": o([ - { json: "BBG", js: "BBG", typ: u(undefined, "") }, - { json: "CUSIP", js: "CUSIP", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - { json: "FIGI", js: "FIGI", typ: u(undefined, "") }, - { json: "ISIN", js: "ISIN", typ: u(undefined, "") }, - { json: "PERMID", js: "PERMID", typ: u(undefined, "") }, - { json: "RIC", js: "RIC", typ: u(undefined, "") }, - { json: "SEDOL", js: "SEDOL", typ: u(undefined, "") }, - { json: "ticker", js: "ticker", typ: u(undefined, "") }, - { json: "LEI", js: "LEI", typ: u(undefined, "") }, - { json: "email", js: "email", typ: u(undefined, "") }, - ], "any"), - "Contact": o([ - { json: "id", js: "id", typ: r("FluffyContactIdentifiers") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("FluffyInteractionType") }, - ], "any"), - "FluffyContactIdentifiers": o([ - { json: "email", js: "email", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - ], "any"), - "ContactList": o([ - { json: "contacts", js: "contacts", typ: a(r("ContactElement")) }, - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("ContactListType") }, - ], "any"), - "Context": o([ - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: "" }, - ], "any"), - "Country": o([ - { json: "id", js: "id", typ: r("CountryID") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("CountryType") }, - ], "any"), - "CountryID": o([ - { json: "COUNTRY_ISOALPHA2", js: "COUNTRY_ISOALPHA2", typ: u(undefined, "") }, - { json: "COUNTRY_ISOALPHA3", js: "COUNTRY_ISOALPHA3", typ: u(undefined, "") }, - { json: "ISOALPHA2", js: "ISOALPHA2", typ: u(undefined, "") }, - { json: "ISOALPHA3", js: "ISOALPHA3", typ: u(undefined, "") }, - ], "any"), - "Currency": o([ - { json: "id", js: "id", typ: r("CurrencyID") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("CurrencyType") }, - ], "any"), - "CurrencyID": o([ - { json: "CURRENCY_ISOCODE", js: "CURRENCY_ISOCODE", typ: u(undefined, "") }, - ], "any"), - "Email": o([ - { json: "recipients", js: "recipients", typ: r("EmailRecipients") }, - { json: "subject", js: "subject", typ: u(undefined, "") }, - { json: "textBody", js: "textBody", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("EmailType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "EmailRecipients": o([ - { json: "id", js: "id", typ: u(undefined, r("ContactTIdentifiers")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("EmailRecipientsType") }, - { json: "contacts", js: "contacts", typ: u(undefined, a(r("ContactElement"))) }, - ], "any"), - "ContactTIdentifiers": o([ - { json: "email", js: "email", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - ], "any"), - "FileAttachment": o([ - { json: "data", js: "data", typ: r("FileAttachmentData") }, - { json: "type", js: "type", typ: r("FileAttachmentType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "FileAttachmentData": o([ - { json: "dataUri", js: "dataUri", typ: "" }, - { json: "name", js: "name", typ: "" }, - ], "any"), - "Instrument": o([ - { json: "id", js: "id", typ: r("FluffyInstrumentIdentifiers") }, - { json: "market", js: "market", typ: u(undefined, r("PurpleMarket")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("PurpleInteractionType") }, - ], "any"), - "FluffyInstrumentIdentifiers": o([ - { json: "BBG", js: "BBG", typ: u(undefined, "") }, - { json: "CUSIP", js: "CUSIP", typ: u(undefined, "") }, - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - { json: "FIGI", js: "FIGI", typ: u(undefined, "") }, - { json: "ISIN", js: "ISIN", typ: u(undefined, "") }, - { json: "PERMID", js: "PERMID", typ: u(undefined, "") }, - { json: "RIC", js: "RIC", typ: u(undefined, "") }, - { json: "SEDOL", js: "SEDOL", typ: u(undefined, "") }, - { json: "ticker", js: "ticker", typ: u(undefined, "") }, - ], "any"), - "PurpleMarket": o([ - { json: "BBG", js: "BBG", typ: u(undefined, "") }, - { json: "COUNTRY_ISOALPHA2", js: "COUNTRY_ISOALPHA2", typ: u(undefined, "") }, - { json: "MIC", js: "MIC", typ: u(undefined, "") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "InstrumentList": o([ - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "instruments", js: "instruments", typ: a(r("InstrumentElement")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("InstrumentListType") }, - ], "any"), - "Interaction": o([ - { json: "description", js: "description", typ: "" }, - { json: "id", js: "id", typ: u(undefined, r("InteractionID")) }, - { json: "initiator", js: "initiator", typ: u(undefined, r("ContactElement")) }, - { json: "interactionType", js: "interactionType", typ: "" }, - { json: "origin", js: "origin", typ: u(undefined, "") }, - { json: "participants", js: "participants", typ: r("ContactListObject") }, - { json: "timeRange", js: "timeRange", typ: r("TimeRangeObject") }, - { json: "type", js: "type", typ: r("InteractionType") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "InteractionID": o([ - { json: "SALESFORCE", js: "SALESFORCE", typ: u(undefined, "") }, - { json: "SINGLETRACK", js: "SINGLETRACK", typ: u(undefined, "") }, - { json: "URI", js: "URI", typ: u(undefined, "") }, - ], "any"), - "Message": o([ - { json: "entities", js: "entities", typ: u(undefined, m(r("EntityValue"))) }, - { json: "text", js: "text", typ: u(undefined, r("FluffyMessageText")) }, - { json: "type", js: "type", typ: r("MessageType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "FluffyMessageText": o([ - { json: "text/markdown", js: "text/markdown", typ: u(undefined, "") }, - { json: "text/plain", js: "text/plain", typ: u(undefined, "") }, - ], "any"), - "Nothing": o([ - { json: "type", js: "type", typ: r("NothingType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "Order": o([ - { json: "details", js: "details", typ: u(undefined, r("PurpleOrderDetails")) }, - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("OrderType") }, - ], "any"), - "PurpleOrderDetails": o([ - { json: "product", js: "product", typ: u(undefined, r("ProductObject")) }, - ], "any"), - "ProductObject": o([ - { json: "id", js: "id", typ: m("") }, - { json: "instrument", js: "instrument", typ: u(undefined, r("InstrumentElement")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("ProductType") }, - ], "any"), - "OrderList": o([ - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "orders", js: "orders", typ: a(r("OrderElement")) }, - { json: "type", js: "type", typ: r("OrderListType") }, - ], "any"), - "OrderElement": o([ - { json: "details", js: "details", typ: u(undefined, r("FluffyOrderDetails")) }, - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("OrderType") }, - ], "any"), - "FluffyOrderDetails": o([ - { json: "product", js: "product", typ: u(undefined, r("ProductObject")) }, - ], "any"), - "Organization": o([ - { json: "id", js: "id", typ: r("OrganizationIdentifiers") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("StickyInteractionType") }, - ], "any"), - "OrganizationIdentifiers": o([ - { json: "FDS_ID", js: "FDS_ID", typ: u(undefined, "") }, - { json: "LEI", js: "LEI", typ: u(undefined, "") }, - { json: "PERMID", js: "PERMID", typ: u(undefined, "") }, - ], "any"), - "Portfolio": o([ - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "positions", js: "positions", typ: a(r("PositionElement")) }, - { json: "type", js: "type", typ: r("PortfolioType") }, - ], "any"), - "PositionElement": o([ - { json: "holding", js: "holding", typ: 3.14 }, - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "instrument", js: "instrument", typ: r("InstrumentElement") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("PositionType") }, - ], "any"), - "Position": o([ - { json: "holding", js: "holding", typ: 3.14 }, - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "instrument", js: "instrument", typ: r("InstrumentElement") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("PositionType") }, - ], "any"), - "Product": o([ - { json: "id", js: "id", typ: m("") }, - { json: "instrument", js: "instrument", typ: u(undefined, r("InstrumentElement")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: r("ProductType") }, - ], "any"), - "TimeRange": o([ - { json: "endTime", js: "endTime", typ: u(undefined, Date) }, - { json: "startTime", js: "startTime", typ: u(undefined, Date) }, - { json: "type", js: "type", typ: r("TimeRangeType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "Trade": o([ - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "product", js: "product", typ: r("ProductObject") }, - { json: "type", js: "type", typ: r("TradeType") }, - ], "any"), - "TradeList": o([ - { json: "id", js: "id", typ: u(undefined, m("")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "trades", js: "trades", typ: a(r("TradeElement")) }, - { json: "type", js: "type", typ: r("TradeListType") }, - ], "any"), - "TradeElement": o([ - { json: "id", js: "id", typ: m("") }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "product", js: "product", typ: r("ProductObject") }, - { json: "type", js: "type", typ: r("TradeType") }, - ], "any"), - "TransactionResult": o([ - { json: "context", js: "context", typ: u(undefined, r("ContextElement")) }, - { json: "message", js: "message", typ: u(undefined, "") }, - { json: "status", js: "status", typ: r("TransactionStatus") }, - { json: "type", js: "type", typ: r("TransactionResultType") }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "Valuation": o([ - { json: "CURRENCY_ISOCODE", js: "CURRENCY_ISOCODE", typ: "" }, - { json: "expiryTime", js: "expiryTime", typ: u(undefined, Date) }, - { json: "price", js: "price", typ: u(undefined, 3.14) }, - { json: "type", js: "type", typ: r("ValuationType") }, - { json: "valuationTime", js: "valuationTime", typ: u(undefined, Date) }, - { json: "value", js: "value", typ: 3.14 }, - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], "any"), - "ActionType": [ - "broadcast", - "raiseIntent", + Action: o( + [ + { json: 'action', js: 'action', typ: u(undefined, r('ActionType')) }, + { json: 'app', js: 'app', typ: u(undefined, r('AppIdentifier')) }, + { json: 'channelId', js: 'channelId', typ: u(undefined, '') }, + { json: 'context', js: 'context', typ: r('ContextElement') }, + { json: 'intent', js: 'intent', typ: u(undefined, '') }, + { json: 'title', js: 'title', typ: '' }, + { json: 'type', js: 'type', typ: r('ActionTypeEnum') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + AppIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + ContextElement: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + Chart: o( + [ + { json: 'instruments', js: 'instruments', typ: a(r('InstrumentElement')) }, + { json: 'otherConfig', js: 'otherConfig', typ: u(undefined, a(r('ContextElement'))) }, + { json: 'range', js: 'range', typ: u(undefined, r('TimeRangeObject')) }, + { json: 'style', js: 'style', typ: u(undefined, r('ChartStyle')) }, + { json: 'type', js: 'type', typ: r('ChartType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + InstrumentElement: o( + [ + { json: 'id', js: 'id', typ: r('PurpleInstrumentIdentifiers') }, + { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, + ], + 'any' + ), + PurpleInstrumentIdentifiers: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'CUSIP', js: 'CUSIP', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + { json: 'FIGI', js: 'FIGI', typ: u(undefined, '') }, + { json: 'ISIN', js: 'ISIN', typ: u(undefined, '') }, + { json: 'PERMID', js: 'PERMID', typ: u(undefined, '') }, + { json: 'RIC', js: 'RIC', typ: u(undefined, '') }, + { json: 'SEDOL', js: 'SEDOL', typ: u(undefined, '') }, + { json: 'ticker', js: 'ticker', typ: u(undefined, '') }, + ], + 'any' + ), + OrganizationMarket: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u(undefined, '') }, + { json: 'MIC', js: 'MIC', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + TimeRangeObject: o( + [ + { json: 'endTime', js: 'endTime', typ: u(undefined, Date) }, + { json: 'startTime', js: 'startTime', typ: u(undefined, Date) }, + { json: 'type', js: 'type', typ: r('TimeRangeType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + ChatInitSettings: o( + [ + { json: 'chatName', js: 'chatName', typ: u(undefined, '') }, + { json: 'members', js: 'members', typ: u(undefined, r('ContactListObject')) }, + { json: 'message', js: 'message', typ: u(undefined, u(r('MessageObject'), '')) }, + { json: 'options', js: 'options', typ: u(undefined, r('ChatOptions')) }, + { json: 'type', js: 'type', typ: r('ChatInitSettingsType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + ContactListObject: o( + [ + { json: 'contacts', js: 'contacts', typ: a(r('ContactElement')) }, + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('ContactListType') }, + ], + 'any' + ), + ContactElement: o( + [ + { json: 'id', js: 'id', typ: r('PurpleContactIdentifiers') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, + ], + 'any' + ), + PurpleContactIdentifiers: o( + [ + { json: 'email', js: 'email', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + ], + 'any' + ), + MessageObject: o( + [ + { json: 'entities', js: 'entities', typ: u(undefined, m(r('EntityValue'))) }, + { json: 'text', js: 'text', typ: u(undefined, r('PurpleMessageText')) }, + { json: 'type', js: 'type', typ: r('MessageType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + EntityValue: o( + [ + { json: 'action', js: 'action', typ: u(undefined, r('ActionType')) }, + { json: 'app', js: 'app', typ: u(undefined, r('AppIdentifier')) }, + { json: 'channelId', js: 'channelId', typ: u(undefined, '') }, + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, + { json: 'intent', js: 'intent', typ: u(undefined, '') }, + { json: 'title', js: 'title', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('EntityType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'data', js: 'data', typ: u(undefined, r('EntityData')) }, + ], + 'any' + ), + EntityData: o( + [ + { json: 'dataUri', js: 'dataUri', typ: '' }, + { json: 'name', js: 'name', typ: '' }, + ], + 'any' + ), + PurpleMessageText: o( + [ + { json: 'text/markdown', js: 'text/markdown', typ: u(undefined, '') }, + { json: 'text/plain', js: 'text/plain', typ: u(undefined, '') }, + ], + 'any' + ), + ChatOptions: o( + [ + { json: 'allowAddUser', js: 'allowAddUser', typ: u(undefined, true) }, + { json: 'allowHistoryBrowsing', js: 'allowHistoryBrowsing', typ: u(undefined, true) }, + { json: 'allowMessageCopy', js: 'allowMessageCopy', typ: u(undefined, true) }, + { json: 'groupRecipients', js: 'groupRecipients', typ: u(undefined, true) }, + { json: 'isPublic', js: 'isPublic', typ: u(undefined, true) }, + ], + 'any' + ), + ChatMessage: o( + [ + { json: 'chatRoom', js: 'chatRoom', typ: r('ChatRoomObject') }, + { json: 'message', js: 'message', typ: r('MessageObject') }, + { json: 'type', js: 'type', typ: r('ChatMessageType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + ChatRoomObject: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'providerName', js: 'providerName', typ: '' }, + { json: 'type', js: 'type', typ: r('ChatRoomType') }, + { json: 'url', js: 'url', typ: u(undefined, '') }, + ], + 'any' + ), + ChatRoom: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'providerName', js: 'providerName', typ: '' }, + { json: 'type', js: 'type', typ: r('ChatRoomType') }, + { json: 'url', js: 'url', typ: u(undefined, '') }, + ], + 'any' + ), + ChatSearchCriteria: o( + [ + { json: 'criteria', js: 'criteria', typ: a(u(r('OrganizationObject'), '')) }, + { json: 'type', js: 'type', typ: r('ChatSearchCriteriaType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + 'any' + ), + OrganizationObject: o( + [ + { json: 'id', js: 'id', typ: r('Identifiers') }, + { json: 'market', js: 'market', typ: u(undefined, r('OrganizationMarket')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('TentacledInteractionType') }, + ], + 'any' + ), + Identifiers: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'CUSIP', js: 'CUSIP', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + { json: 'FIGI', js: 'FIGI', typ: u(undefined, '') }, + { json: 'ISIN', js: 'ISIN', typ: u(undefined, '') }, + { json: 'PERMID', js: 'PERMID', typ: u(undefined, '') }, + { json: 'RIC', js: 'RIC', typ: u(undefined, '') }, + { json: 'SEDOL', js: 'SEDOL', typ: u(undefined, '') }, + { json: 'ticker', js: 'ticker', typ: u(undefined, '') }, + { json: 'LEI', js: 'LEI', typ: u(undefined, '') }, + { json: 'email', js: 'email', typ: u(undefined, '') }, + ], + 'any' + ), + Contact: o( + [ + { json: 'id', js: 'id', typ: r('FluffyContactIdentifiers') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('FluffyInteractionType') }, + ], + 'any' + ), + FluffyContactIdentifiers: o( + [ + { json: 'email', js: 'email', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + ], + 'any' + ), + ContactList: o( + [ + { json: 'contacts', js: 'contacts', typ: a(r('ContactElement')) }, + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('ContactListType') }, + ], + 'any' + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, ], - "ActionTypeEnum": [ - "fdc3.action", + 'any' + ), + Country: o( + [ + { json: 'id', js: 'id', typ: r('CountryID') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('CountryType') }, ], - "PurpleInteractionType": [ - "fdc3.instrument", + 'any' + ), + CountryID: o( + [ + { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u(undefined, '') }, + { json: 'COUNTRY_ISOALPHA3', js: 'COUNTRY_ISOALPHA3', typ: u(undefined, '') }, + { json: 'ISOALPHA2', js: 'ISOALPHA2', typ: u(undefined, '') }, + { json: 'ISOALPHA3', js: 'ISOALPHA3', typ: u(undefined, '') }, ], - "TimeRangeType": [ - "fdc3.timeRange", + 'any' + ), + Currency: o( + [ + { json: 'id', js: 'id', typ: r('CurrencyID') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('CurrencyType') }, ], - "ChartStyle": [ - "bar", - "candle", - "custom", - "heatmap", - "histogram", - "line", - "mountain", - "pie", - "scatter", - "stacked-bar", + 'any' + ), + CurrencyID: o([{ json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: u(undefined, '') }], 'any'), + Email: o( + [ + { json: 'recipients', js: 'recipients', typ: r('EmailRecipients') }, + { json: 'subject', js: 'subject', typ: u(undefined, '') }, + { json: 'textBody', js: 'textBody', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('EmailType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "ChartType": [ - "fdc3.chart", + 'any' + ), + EmailRecipients: o( + [ + { json: 'id', js: 'id', typ: u(undefined, r('ContactTIdentifiers')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('EmailRecipientsType') }, + { json: 'contacts', js: 'contacts', typ: u(undefined, a(r('ContactElement'))) }, ], - "FluffyInteractionType": [ - "fdc3.contact", + 'any' + ), + ContactTIdentifiers: o( + [ + { json: 'email', js: 'email', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, ], - "ContactListType": [ - "fdc3.contactList", + 'any' + ), + FileAttachment: o( + [ + { json: 'data', js: 'data', typ: r('FileAttachmentData') }, + { json: 'type', js: 'type', typ: r('FileAttachmentType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "EntityType": [ - "fdc3.action", - "fdc3.fileAttachment", + 'any' + ), + FileAttachmentData: o( + [ + { json: 'dataUri', js: 'dataUri', typ: '' }, + { json: 'name', js: 'name', typ: '' }, ], - "MessageType": [ - "fdc3.message", + 'any' + ), + Instrument: o( + [ + { json: 'id', js: 'id', typ: r('FluffyInstrumentIdentifiers') }, + { json: 'market', js: 'market', typ: u(undefined, r('PurpleMarket')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('PurpleInteractionType') }, ], - "ChatInitSettingsType": [ - "fdc3.chat.initSettings", + 'any' + ), + FluffyInstrumentIdentifiers: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'CUSIP', js: 'CUSIP', typ: u(undefined, '') }, + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + { json: 'FIGI', js: 'FIGI', typ: u(undefined, '') }, + { json: 'ISIN', js: 'ISIN', typ: u(undefined, '') }, + { json: 'PERMID', js: 'PERMID', typ: u(undefined, '') }, + { json: 'RIC', js: 'RIC', typ: u(undefined, '') }, + { json: 'SEDOL', js: 'SEDOL', typ: u(undefined, '') }, + { json: 'ticker', js: 'ticker', typ: u(undefined, '') }, ], - "ChatRoomType": [ - "fdc3.chat.room", + 'any' + ), + PurpleMarket: o( + [ + { json: 'BBG', js: 'BBG', typ: u(undefined, '') }, + { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u(undefined, '') }, + { json: 'MIC', js: 'MIC', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "ChatMessageType": [ - "fdc3.chat.message", + 'any' + ), + InstrumentList: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'instruments', js: 'instruments', typ: a(r('InstrumentElement')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('InstrumentListType') }, ], - "TentacledInteractionType": [ - "fdc3.contact", - "fdc3.instrument", - "fdc3.organization", + 'any' + ), + Interaction: o( + [ + { json: 'description', js: 'description', typ: '' }, + { json: 'id', js: 'id', typ: u(undefined, r('InteractionID')) }, + { json: 'initiator', js: 'initiator', typ: u(undefined, r('ContactElement')) }, + { json: 'interactionType', js: 'interactionType', typ: '' }, + { json: 'origin', js: 'origin', typ: u(undefined, '') }, + { json: 'participants', js: 'participants', typ: r('ContactListObject') }, + { json: 'timeRange', js: 'timeRange', typ: r('TimeRangeObject') }, + { json: 'type', js: 'type', typ: r('InteractionType') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "ChatSearchCriteriaType": [ - "fdc3.chat.searchCriteria", + 'any' + ), + InteractionID: o( + [ + { json: 'SALESFORCE', js: 'SALESFORCE', typ: u(undefined, '') }, + { json: 'SINGLETRACK', js: 'SINGLETRACK', typ: u(undefined, '') }, + { json: 'URI', js: 'URI', typ: u(undefined, '') }, ], - "CountryType": [ - "fdc3.country", + 'any' + ), + Message: o( + [ + { json: 'entities', js: 'entities', typ: u(undefined, m(r('EntityValue'))) }, + { json: 'text', js: 'text', typ: u(undefined, r('FluffyMessageText')) }, + { json: 'type', js: 'type', typ: r('MessageType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "CurrencyType": [ - "fdc3.currency", + 'any' + ), + FluffyMessageText: o( + [ + { json: 'text/markdown', js: 'text/markdown', typ: u(undefined, '') }, + { json: 'text/plain', js: 'text/plain', typ: u(undefined, '') }, ], - "EmailRecipientsType": [ - "fdc3.contact", - "fdc3.contactList", + 'any' + ), + Nothing: o( + [ + { json: 'type', js: 'type', typ: r('NothingType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "EmailType": [ - "fdc3.email", + 'any' + ), + Order: o( + [ + { json: 'details', js: 'details', typ: u(undefined, r('PurpleOrderDetails')) }, + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('OrderType') }, ], - "FileAttachmentType": [ - "fdc3.fileAttachment", + 'any' + ), + PurpleOrderDetails: o([{ json: 'product', js: 'product', typ: u(undefined, r('ProductObject')) }], 'any'), + ProductObject: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'instrument', js: 'instrument', typ: u(undefined, r('InstrumentElement')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('ProductType') }, ], - "InstrumentListType": [ - "fdc3.instrumentList", + 'any' + ), + OrderList: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'orders', js: 'orders', typ: a(r('OrderElement')) }, + { json: 'type', js: 'type', typ: r('OrderListType') }, ], - "InteractionType": [ - "fdc3.interaction", + 'any' + ), + OrderElement: o( + [ + { json: 'details', js: 'details', typ: u(undefined, r('FluffyOrderDetails')) }, + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('OrderType') }, ], - "NothingType": [ - "fdc3.nothing", + 'any' + ), + FluffyOrderDetails: o([{ json: 'product', js: 'product', typ: u(undefined, r('ProductObject')) }], 'any'), + Organization: o( + [ + { json: 'id', js: 'id', typ: r('OrganizationIdentifiers') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('StickyInteractionType') }, ], - "ProductType": [ - "fdc3.product", + 'any' + ), + OrganizationIdentifiers: o( + [ + { json: 'FDS_ID', js: 'FDS_ID', typ: u(undefined, '') }, + { json: 'LEI', js: 'LEI', typ: u(undefined, '') }, + { json: 'PERMID', js: 'PERMID', typ: u(undefined, '') }, ], - "OrderType": [ - "fdc3.order", + 'any' + ), + Portfolio: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'positions', js: 'positions', typ: a(r('PositionElement')) }, + { json: 'type', js: 'type', typ: r('PortfolioType') }, ], - "OrderListType": [ - "fdc3.orderList", + 'any' + ), + PositionElement: o( + [ + { json: 'holding', js: 'holding', typ: 3.14 }, + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'instrument', js: 'instrument', typ: r('InstrumentElement') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('PositionType') }, ], - "StickyInteractionType": [ - "fdc3.organization", + 'any' + ), + Position: o( + [ + { json: 'holding', js: 'holding', typ: 3.14 }, + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'instrument', js: 'instrument', typ: r('InstrumentElement') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('PositionType') }, ], - "PositionType": [ - "fdc3.position", + 'any' + ), + Product: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'instrument', js: 'instrument', typ: u(undefined, r('InstrumentElement')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: r('ProductType') }, ], - "PortfolioType": [ - "fdc3.portfolio", + 'any' + ), + TimeRange: o( + [ + { json: 'endTime', js: 'endTime', typ: u(undefined, Date) }, + { json: 'startTime', js: 'startTime', typ: u(undefined, Date) }, + { json: 'type', js: 'type', typ: r('TimeRangeType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "TradeType": [ - "fdc3.trade", + 'any' + ), + Trade: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'product', js: 'product', typ: r('ProductObject') }, + { json: 'type', js: 'type', typ: r('TradeType') }, ], - "TradeListType": [ - "fdc3.tradeList", + 'any' + ), + TradeList: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'trades', js: 'trades', typ: a(r('TradeElement')) }, + { json: 'type', js: 'type', typ: r('TradeListType') }, ], - "TransactionStatus": [ - "Created", - "Deleted", - "Failed", - "Updated", + 'any' + ), + TradeElement: o( + [ + { json: 'id', js: 'id', typ: m('') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'product', js: 'product', typ: r('ProductObject') }, + { json: 'type', js: 'type', typ: r('TradeType') }, ], - "TransactionResultType": [ - "fdc3.transactionResult", + 'any' + ), + TransactionResult: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('ContextElement')) }, + { json: 'message', js: 'message', typ: u(undefined, '') }, + { json: 'status', js: 'status', typ: r('TransactionStatus') }, + { json: 'type', js: 'type', typ: r('TransactionResultType') }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "ValuationType": [ - "fdc3.valuation", + 'any' + ), + Valuation: o( + [ + { json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: '' }, + { json: 'expiryTime', js: 'expiryTime', typ: u(undefined, Date) }, + { json: 'price', js: 'price', typ: u(undefined, 3.14) }, + { json: 'type', js: 'type', typ: r('ValuationType') }, + { json: 'valuationTime', js: 'valuationTime', typ: u(undefined, Date) }, + { json: 'value', js: 'value', typ: 3.14 }, + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], + 'any' + ), + ActionType: ['broadcast', 'raiseIntent'], + ActionTypeEnum: ['fdc3.action'], + PurpleInteractionType: ['fdc3.instrument'], + TimeRangeType: ['fdc3.timeRange'], + ChartStyle: ['bar', 'candle', 'custom', 'heatmap', 'histogram', 'line', 'mountain', 'pie', 'scatter', 'stacked-bar'], + ChartType: ['fdc3.chart'], + FluffyInteractionType: ['fdc3.contact'], + ContactListType: ['fdc3.contactList'], + EntityType: ['fdc3.action', 'fdc3.fileAttachment'], + MessageType: ['fdc3.message'], + ChatInitSettingsType: ['fdc3.chat.initSettings'], + ChatRoomType: ['fdc3.chat.room'], + ChatMessageType: ['fdc3.chat.message'], + TentacledInteractionType: ['fdc3.contact', 'fdc3.instrument', 'fdc3.organization'], + ChatSearchCriteriaType: ['fdc3.chat.searchCriteria'], + CountryType: ['fdc3.country'], + CurrencyType: ['fdc3.currency'], + EmailRecipientsType: ['fdc3.contact', 'fdc3.contactList'], + EmailType: ['fdc3.email'], + FileAttachmentType: ['fdc3.fileAttachment'], + InstrumentListType: ['fdc3.instrumentList'], + InteractionType: ['fdc3.interaction'], + NothingType: ['fdc3.nothing'], + ProductType: ['fdc3.product'], + OrderType: ['fdc3.order'], + OrderListType: ['fdc3.orderList'], + StickyInteractionType: ['fdc3.organization'], + PositionType: ['fdc3.position'], + PortfolioType: ['fdc3.portfolio'], + TradeType: ['fdc3.trade'], + TradeListType: ['fdc3.tradeList'], + TransactionStatus: ['Created', 'Deleted', 'Failed', 'Updated'], + TransactionResultType: ['fdc3.transactionResult'], + ValuationType: ['fdc3.valuation'], }; diff --git a/packages/fdc3-context/s2tQuicktypeUtil.js b/packages/fdc3-context/s2tQuicktypeUtil.js index 56eadff90..fd27e242e 100644 --- a/packages/fdc3-context/s2tQuicktypeUtil.js +++ b/packages/fdc3-context/s2tQuicktypeUtil.js @@ -1,18 +1,18 @@ /** * SPDX-License-Identifier: Apache-2.0 * Copyright FINOS FDC3 contributors - see NOTICE file - */ + */ /** Utility for preparing arguments to quicktype, which workaround a specific * quicktype bug in command line argument handling (where a directory is used * as input the source language argument is ignored which causes our schemas * to be interpreted as JSON input, rather than JSONSchema). - * + * * Individual file arguments will be interpreted as 'additional' schema files - * that will be referenced from the other schemas and will not have top-level output + * that will be referenced from the other schemas and will not have top-level output * schemas generated, while folders will be listed and the schema files they contain - * added as inputs and will have top-level types generated. - * + * added as inputs and will have top-level types generated. + * * */ const path = require('path'); @@ -29,33 +29,33 @@ console.log('Inputs schema files: ' + inputs.join(' | ')); console.log('Output file argument: ' + outputFile); let sources = ''; -let additionalSchemaFiles = '' +let additionalSchemaFiles = ''; //skip duplicate paths (we might want to specify some files to go first, and might duplicate them) const allPaths = new Set(); -const addAPath = (aPath,paths,sources,type) => { +const addAPath = (aPath, paths, sources, type) => { if (!paths.has(aPath)) { - paths.add(aPath) + paths.add(aPath); return sources + ` ${type} ${aPath}`; } else { console.log(`skipping duplicate path ${aPath}`); return sources; } -} +}; //process the content of folders to produce code for top-level types let inputIndex = 0; while (inputIndex < inputs.length) { if (inputs[inputIndex].endsWith('.schema.json')) { //add individual files with -S as additional schema files used in references (rather than ones that need a top-level output) - additionalSchemaFiles = addAPath(path.join(inputs[inputIndex]),allPaths,additionalSchemaFiles, "-S"); + additionalSchemaFiles = addAPath(path.join(inputs[inputIndex]), allPaths, additionalSchemaFiles, '-S'); } else { fs.readdirSync(inputs[inputIndex], { withFileTypes: true }).forEach(file => { if (file.isDirectory()) { inputs.push(path.join(inputs[inputIndex], file.name)); } else if (file.name.endsWith('.schema.json')) { - sources = addAPath(path.join(inputs[inputIndex], file.name),allPaths,sources, "--src"); + sources = addAPath(path.join(inputs[inputIndex], file.name), allPaths, sources, '--src'); } }); } @@ -69,7 +69,7 @@ const quicktypeExec = ['..', '..', '..', 'node_modules', '.bin', 'quicktype'].jo const command = `${quicktypeExec} --prefer-const-values --prefer-unions -s schema -o ${outputFile} ${additionalSchemaFiles} ${sources}`; console.log('command to run: ' + command); -exec(command, function(error, stdout, stderr) { +exec(command, function (error, stdout, stderr) { if (stdout) { console.log(stdout); } diff --git a/packages/fdc3-get-agent/eslint.config.mjs b/packages/fdc3-get-agent/eslint.config.mjs new file mode 100644 index 000000000..c7018a2c8 --- /dev/null +++ b/packages/fdc3-get-agent/eslint.config.mjs @@ -0,0 +1,13 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import eslintConfigPrettier from 'eslint-config-prettier'; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + { files: ['**/*.{js,mjs,cjs,ts}'] }, + { languageOptions: { globals: globals.browser } }, + pluginJs.configs.recommended, + ...tseslint.configs.recommended, + eslintConfigPrettier, +]; diff --git a/packages/fdc3-get-agent/package.json b/packages/fdc3-get-agent/package.json index f5242bfb0..4007e5f2b 100644 --- a/packages/fdc3-get-agent/package.json +++ b/packages/fdc3-get-agent/package.json @@ -31,16 +31,21 @@ }, "devDependencies": { "@cucumber/cucumber": "10.3.1", + "@eslint/js": "^9.16.0", "@kite9/fdc3-web-impl": "2.2.0-beta.29", "@kite9/testing": "2.2.0-beta.29", "@types/node": "^20.14.11", "@types/wtfnode": "^0.7.3", + "eslint": "^9.16.0", + "eslint-config-prettier": "^9.1.0", "expect": "^29.7.0", + "globals": "^15.13.0", "jsonpath-plus": "^10.1.0", "nyc": "15.1.0", "rimraf": "^6.0.1", "tsx": "^4.19.1", "typescript": "^5.6.3", + "typescript-eslint": "^8.17.0", "wtfnode": "^0.9.3" } -} \ No newline at end of file +} diff --git a/packages/fdc3-get-agent/src/Fdc3Version.ts b/packages/fdc3-get-agent/src/Fdc3Version.ts index 6a9919d02..dd4efaadd 100644 --- a/packages/fdc3-get-agent/src/Fdc3Version.ts +++ b/packages/fdc3-get-agent/src/Fdc3Version.ts @@ -1 +1 @@ -export const FDC3_VERSION = "2.2" \ No newline at end of file +export const FDC3_VERSION = '2.2'; diff --git a/packages/fdc3-get-agent/src/apps/NoopAppSupport.ts b/packages/fdc3-get-agent/src/apps/NoopAppSupport.ts index 30251b556..2933fe280 100644 --- a/packages/fdc3-get-agent/src/apps/NoopAppSupport.ts +++ b/packages/fdc3-get-agent/src/apps/NoopAppSupport.ts @@ -1,18 +1,15 @@ -import { AppIdentifier, AppMetadata } from "@kite9/fdc3-standard"; -import { Messaging } from "@kite9/fdc3-agent-proxy"; -import { DefaultAppSupport } from "@kite9/fdc3-agent-proxy"; +import { AppIdentifier, AppMetadata } from '@kite9/fdc3-standard'; +import { Messaging } from '@kite9/fdc3-agent-proxy'; +import { DefaultAppSupport } from '@kite9/fdc3-agent-proxy'; export class NoopAppSupport extends DefaultAppSupport { - - constructor(messaging: Messaging) { - super(messaging); - } - - async getAppMetadata(app: AppIdentifier): Promise { - return { - appId: app.appId - } - } - - -} \ No newline at end of file + constructor(messaging: Messaging) { + super(messaging); + } + + async getAppMetadata(app: AppIdentifier): Promise { + return { + appId: app.appId, + }; + } +} diff --git a/packages/fdc3-get-agent/src/index.ts b/packages/fdc3-get-agent/src/index.ts index 78a7831b9..d76ed790e 100644 --- a/packages/fdc3-get-agent/src/index.ts +++ b/packages/fdc3-get-agent/src/index.ts @@ -1,24 +1,23 @@ -import { DesktopAgent } from '@kite9/fdc3-standard' +import { DesktopAgent } from '@kite9/fdc3-standard'; import { getAgent } from './strategies/getAgent'; const DEFAULT_WAIT_FOR_MS = 20000; - -export { getAgent } +export { getAgent }; /** * Replaces the original fdc3Ready function from FDC3 2.0 with a new one that uses the new getAgent function. - * + * * @param waitForMs Amount of time to wait before failing the promise (20 seconds is the default). * @returns A DesktopAgent promise. - * - * @deprecated This function is provided for backwards compatibility. Use `const fdc3 = getAgent()` to retrieve (and + * + * @deprecated This function is provided for backwards compatibility. Use `const fdc3 = getAgent()` to retrieve (and * wait for) a reference to the FDC3 API instead. */ export function fdc3Ready(waitForMs = DEFAULT_WAIT_FOR_MS): Promise { - return getAgent({ - timeoutMs: waitForMs, - dontSetWindowFdc3: false, - channelSelector: true, - intentResolver: true - }) -} \ No newline at end of file + return getAgent({ + timeoutMs: waitForMs, + dontSetWindowFdc3: false, + channelSelector: true, + intentResolver: true, + }); +} diff --git a/packages/fdc3-get-agent/src/messaging/AbstractWebMessaging.ts b/packages/fdc3-get-agent/src/messaging/AbstractWebMessaging.ts index 3782bc134..bbd2587e1 100644 --- a/packages/fdc3-get-agent/src/messaging/AbstractWebMessaging.ts +++ b/packages/fdc3-get-agent/src/messaging/AbstractWebMessaging.ts @@ -1,65 +1,68 @@ -import { DesktopAgentDetails, WebDesktopAgentType, GetAgentParams, } from "@kite9/fdc3-standard"; -import { RegisterableListener, AbstractMessaging } from "@kite9/fdc3-agent-proxy"; -import { AppRequestMessage, WebConnectionProtocol5ValidateAppIdentitySuccessResponse } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; +import { DesktopAgentDetails, WebDesktopAgentType, GetAgentParams } from '@kite9/fdc3-standard'; +import { RegisterableListener, AbstractMessaging } from '@kite9/fdc3-agent-proxy'; +import { + AppRequestMessage, + WebConnectionProtocol5ValidateAppIdentitySuccessResponse, +} from '@kite9/fdc3-schema/generated/api/BrowserTypes'; -type RequestMetadata = AppRequestMessage["meta"]; +type RequestMetadata = AppRequestMessage['meta']; -export const DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY = "fdc3-desktop-agent-details" +export const DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY = 'fdc3-desktop-agent-details'; /** * Version of Messaging which is able to store details in the SessionState (i.e. works on the web) */ export abstract class AbstractWebMessaging extends AbstractMessaging { + constructor(options: GetAgentParams, connectionAttemptUuid: string, actualUrl: string, timeout?: number) { + super(options, connectionAttemptUuid, actualUrl, timeout); + } - constructor(options: GetAgentParams, connectionAttemptUuid: string, actualUrl: string, timeout?: number) { - super(options, connectionAttemptUuid, actualUrl, timeout) - } - - abstract createUUID(): string - abstract post(message: object): Promise + abstract createUUID(): string; + abstract post(message: object): Promise; - abstract register(l: RegisterableListener): void - abstract unregister(id: string): void + abstract register(l: RegisterableListener): void; + abstract unregister(id: string): void; - abstract createMeta(): RequestMetadata + abstract createMeta(): RequestMetadata; - /** - * Note that we also key by the window name as well, in case multiple iframes are using the same session storage. - */ - private sessionKey(): string { - const windowName = globalThis.window.name - const keyName = windowName ? DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY + "-" + windowName : DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY - return keyName - } + /** + * Note that we also key by the window name as well, in case multiple iframes are using the same session storage. + */ + private sessionKey(): string { + const windowName = globalThis.window.name; + const keyName = windowName + ? DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY + '-' + windowName + : DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY; + return keyName; + } - /** - * Used to allow session-reconnection - */ - storeInstanceUuid(vr: WebConnectionProtocol5ValidateAppIdentitySuccessResponse) { - const details: DesktopAgentDetails = { - agentType: WebDesktopAgentType.ProxyParent, - instanceUuid: vr.payload.instanceUuid, - appId: vr.payload.appId, - instanceId: vr.payload.instanceId, - } - - globalThis.sessionStorage.setItem(this.sessionKey(), JSON.stringify(details)) - } + /** + * Used to allow session-reconnection + */ + storeInstanceUuid(vr: WebConnectionProtocol5ValidateAppIdentitySuccessResponse) { + const details: DesktopAgentDetails = { + agentType: WebDesktopAgentType.ProxyParent, + instanceUuid: vr.payload.instanceUuid, + appId: vr.payload.appId, + instanceId: vr.payload.instanceId, + }; - /** - * Stores the instanceUuid in session storage in case session needs reconnecting. - */ - retrieveInstanceUuid(): string | undefined { - const detailsStr = globalThis.sessionStorage.getItem(this.sessionKey()) + globalThis.sessionStorage.setItem(this.sessionKey(), JSON.stringify(details)); + } - if (detailsStr) { - const details = JSON.parse(detailsStr) as DesktopAgentDetails - if (details.agentType == WebDesktopAgentType.ProxyParent) { - return details.instanceUuid - } - } + /** + * Stores the instanceUuid in session storage in case session needs reconnecting. + */ + retrieveInstanceUuid(): string | undefined { + const detailsStr = globalThis.sessionStorage.getItem(this.sessionKey()); - return undefined; + if (detailsStr) { + const details = JSON.parse(detailsStr) as DesktopAgentDetails; + if (details.agentType == WebDesktopAgentType.ProxyParent) { + return details.instanceUuid; + } } -} \ No newline at end of file + return undefined; + } +} diff --git a/packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts b/packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts index e3059c95a..0cd90912c 100644 --- a/packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts +++ b/packages/fdc3-get-agent/src/messaging/MessagePortMessaging.ts @@ -1,75 +1,73 @@ -import { AbstractWebMessaging } from './AbstractWebMessaging' -import { RegisterableListener } from "@kite9/fdc3-agent-proxy" -import { GetAgentParams } from "@kite9/fdc3-standard" -import { v4 as uuidv4 } from "uuid" -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AbstractWebMessaging } from './AbstractWebMessaging'; +import { RegisterableListener } from '@kite9/fdc3-agent-proxy'; +import { GetAgentParams } from '@kite9/fdc3-standard'; +import { v4 as uuidv4 } from 'uuid'; +import { BrowserTypes } from '@kite9/fdc3-schema'; import { AddContextListenerRequestMeta } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; -type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake +type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake; /** * Details needed to set up the Messaging instance */ export type ConnectionDetails = { - connectionAttemptUuid: string - handshake: WebConnectionProtocol3Handshake, - messagePort: MessagePort, - actualUrl: string, - options: GetAgentParams -} + connectionAttemptUuid: string; + handshake: WebConnectionProtocol3Handshake; + messagePort: MessagePort; + actualUrl: string; + options: GetAgentParams; +}; export class MessagePortMessaging extends AbstractWebMessaging { + private readonly cd: ConnectionDetails; + private readonly listeners: Map = new Map(); - private readonly cd: ConnectionDetails - private readonly listeners: Map = new Map() - - constructor(cd: ConnectionDetails, deliveryTimeoutMs?: number) { - super(cd.options, cd.connectionAttemptUuid, cd.actualUrl, deliveryTimeoutMs) - this.cd = cd; + constructor(cd: ConnectionDetails, deliveryTimeoutMs?: number) { + super(cd.options, cd.connectionAttemptUuid, cd.actualUrl, deliveryTimeoutMs); + this.cd = cd; - this.cd.messagePort.onmessage = (m) => { - this.listeners.forEach((v, _k) => { - if (v.filter(m.data)) { - v.action(m.data) - } - }) + this.cd.messagePort.onmessage = m => { + this.listeners.forEach((v, _k) => { + if (v.filter(m.data)) { + v.action(m.data); } - } + }); + }; + } - createUUID(): string { - return uuidv4(); - } + createUUID(): string { + return uuidv4(); + } - async post(message: object): Promise { - this.cd.messagePort.postMessage(message); - } - - register(listener: RegisterableListener): void { - if(!listener.id){ - throw new Error("Provided listener must have an id") - } + async post(message: object): Promise { + this.cd.messagePort.postMessage(message); + } - this.listeners.set(listener.id, listener) + register(listener: RegisterableListener): void { + if (!listener.id) { + throw new Error('Provided listener must have an id'); } - unregister(id: string): void { - this.listeners.delete(id) - } + this.listeners.set(listener.id, listener); + } - createMeta(): AddContextListenerRequestMeta { - return { - "requestUuid": this.createUUID(), - "timestamp": new Date(), - "source": this.getSource() - } - } + unregister(id: string): void { + this.listeners.delete(id); + } - async waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise { - return await super.waitFor(filter, timeoutErrorMessage); - } + createMeta(): AddContextListenerRequestMeta { + return { + requestUuid: this.createUUID(), + timestamp: new Date(), + source: this.getSource(), + }; + } - async disconnect(): Promise { - await super.disconnect() - this.cd.messagePort.close() - } -} + async waitFor(filter: (m: any) => boolean, timeoutErrorMessage?: string): Promise { + return await super.waitFor(filter, timeoutErrorMessage); + } + async disconnect(): Promise { + await super.disconnect(); + this.cd.messagePort.close(); + } +} diff --git a/packages/fdc3-get-agent/src/messaging/message-port.ts b/packages/fdc3-get-agent/src/messaging/message-port.ts index 778912740..5df7d1444 100644 --- a/packages/fdc3-get-agent/src/messaging/message-port.ts +++ b/packages/fdc3-get-agent/src/messaging/message-port.ts @@ -1,56 +1,60 @@ -import { DesktopAgent } from "@kite9/fdc3-standard"; -import { BasicDesktopAgent, DefaultChannelSupport, DefaultAppSupport, DefaultIntentSupport, DefaultHandshakeSupport, ChannelSupport } from "@kite9/fdc3-agent-proxy"; -import { ConnectionDetails, MessagePortMessaging } from "./MessagePortMessaging"; -import { DefaultDesktopAgentIntentResolver } from "../ui/DefaultDesktopAgentIntentResolver"; -import { DefaultDesktopAgentChannelSelector } from "../ui/DefaultDesktopAgentChannelSelector"; -import { NullIntentResolver } from "../ui/NullIntentResolver"; -import { NullChannelSelector } from "../ui/NullChannelSelector"; -import { ChannelSelector } from "@kite9/fdc3-standard"; +import { DesktopAgent } from '@kite9/fdc3-standard'; +import { + BasicDesktopAgent, + DefaultChannelSupport, + DefaultAppSupport, + DefaultIntentSupport, + DefaultHandshakeSupport, + ChannelSupport, +} from '@kite9/fdc3-agent-proxy'; +import { ConnectionDetails, MessagePortMessaging } from './MessagePortMessaging'; +import { DefaultDesktopAgentIntentResolver } from '../ui/DefaultDesktopAgentIntentResolver'; +import { DefaultDesktopAgentChannelSelector } from '../ui/DefaultDesktopAgentChannelSelector'; +import { NullIntentResolver } from '../ui/NullIntentResolver'; +import { NullChannelSelector } from '../ui/NullChannelSelector'; +import { ChannelSelector } from '@kite9/fdc3-standard'; /** * Given a message port, constructs a desktop agent to communicate via that. */ export async function createDesktopAgentAPI(cd: ConnectionDetails): Promise { + cd.messagePort.start(); - cd.messagePort.start() - - function string(o: string | boolean): string | null { - if ((o == true) || (o == false)) { - return null - } else { - return o - } + function string(o: string | boolean): string | null { + if (o == true || o == false) { + return null; + } else { + return o; } + } - const messaging = new MessagePortMessaging(cd) + const messaging = new MessagePortMessaging(cd); - const useResolver = cd.handshake.payload.intentResolverUrl && cd.options.intentResolver - const useSelector = cd.handshake.payload.channelSelectorUrl && cd.options.channelSelector + const useResolver = cd.handshake.payload.intentResolverUrl && cd.options.intentResolver; + const useSelector = cd.handshake.payload.channelSelectorUrl && cd.options.channelSelector; - const intentResolver = useResolver ? - new DefaultDesktopAgentIntentResolver(string(cd.handshake.payload.intentResolverUrl)) : - new NullIntentResolver() + const intentResolver = useResolver + ? new DefaultDesktopAgentIntentResolver(string(cd.handshake.payload.intentResolverUrl)) + : new NullIntentResolver(); - const channelSelector = useSelector ? - new DefaultDesktopAgentChannelSelector(string(cd.handshake.payload.channelSelectorUrl)) - : new NullChannelSelector() + const channelSelector = useSelector + ? new DefaultDesktopAgentChannelSelector(string(cd.handshake.payload.channelSelectorUrl)) + : new NullChannelSelector(); - const cs = new DefaultChannelSupport(messaging, channelSelector) - const hs = new DefaultHandshakeSupport(messaging) - const is = new DefaultIntentSupport(messaging, intentResolver) - const as = new DefaultAppSupport(messaging) - const da = new BasicDesktopAgent(hs, cs, is, as, [hs, intentResolver, channelSelector]) - await da.connect() + const cs = new DefaultChannelSupport(messaging, channelSelector); + const hs = new DefaultHandshakeSupport(messaging); + const is = new DefaultIntentSupport(messaging, intentResolver); + const as = new DefaultAppSupport(messaging); + const da = new BasicDesktopAgent(hs, cs, is, as, [hs, intentResolver, channelSelector]); + await da.connect(); - await populateChannelSelector(cs, channelSelector) + await populateChannelSelector(cs, channelSelector); - return da + return da; } - - async function populateChannelSelector(cs: ChannelSupport, channelSelector: ChannelSelector): Promise { - const channel = await cs.getUserChannel() - const userChannels = await cs.getUserChannels() - channelSelector.updateChannel(channel?.id ?? null, userChannels) + const channel = await cs.getUserChannel(); + const userChannels = await cs.getUserChannels(); + channelSelector.updateChannel(channel?.id ?? null, userChannels); } diff --git a/packages/fdc3-get-agent/src/strategies/ElectronEventLoader.ts b/packages/fdc3-get-agent/src/strategies/ElectronEventLoader.ts index 0f51ab984..0d04b7992 100644 --- a/packages/fdc3-get-agent/src/strategies/ElectronEventLoader.ts +++ b/packages/fdc3-get-agent/src/strategies/ElectronEventLoader.ts @@ -1,35 +1,33 @@ -import { DesktopAgent } from "@kite9/fdc3-standard"; -import { GetAgentParams } from "@kite9/fdc3-standard"; -import { Loader } from "./Loader"; +import { DesktopAgent } from '@kite9/fdc3-standard'; +import { GetAgentParams } from '@kite9/fdc3-standard'; +import { Loader } from './Loader'; /** * This approach will resolve the loader promise if the fdc3Ready event occurs. * This is done by electron implementations setting window.fdc3. */ export class ElectronEventLoader implements Loader { + done = false; - done = false - - poll(endTime: number, resolve: (value: DesktopAgent | void) => void, reject: (reason?: any) => void) { - const timeRemaining = endTime - Date.now() - if (globalThis.window.fdc3 != null) { - resolve(globalThis.window.fdc3) - } else if ((timeRemaining > 0) && (this.done == false)) { - setTimeout(() => this.poll(endTime, resolve, reject), 100); - } else { - resolve(); - } + poll(endTime: number, resolve: (value: DesktopAgent | void) => void, reject: (reason?: any) => void) { + const timeRemaining = endTime - Date.now(); + if (globalThis.window.fdc3 != null) { + resolve(globalThis.window.fdc3); + } else if (timeRemaining > 0 && this.done == false) { + setTimeout(() => this.poll(endTime, resolve, reject), 100); + } else { + resolve(); } + } - cancel(): void { - this.done = true; - } + cancel(): void { + this.done = true; + } - get(params: GetAgentParams): Promise { - return new Promise((resolve, reject) => { - const endPollTime = Date.now() + (params.timeoutMs!! + 500) - this.poll(endPollTime, resolve, reject) - }); - } + get(params: GetAgentParams): Promise { + return new Promise((resolve, reject) => { + const endPollTime = Date.now() + (params.timeoutMs!! + 500); + this.poll(endPollTime, resolve, reject); + }); + } } - diff --git a/packages/fdc3-get-agent/src/strategies/Loader.ts b/packages/fdc3-get-agent/src/strategies/Loader.ts index 8c105a7d9..52cb9f08d 100644 --- a/packages/fdc3-get-agent/src/strategies/Loader.ts +++ b/packages/fdc3-get-agent/src/strategies/Loader.ts @@ -1,16 +1,14 @@ -import { DesktopAgent } from "@kite9/fdc3-standard" -import { GetAgentParams } from "@kite9/fdc3-standard" +import { DesktopAgent } from '@kite9/fdc3-standard'; +import { GetAgentParams } from '@kite9/fdc3-standard'; /** * Represents the common interface for a loading strategy */ export interface Loader { + /** + * Promise will either resolve to a DesktopAgent or _resolve_ to an error (not reject) + */ + get(options: GetAgentParams): Promise; - /** - * Promise will either resolve to a DesktopAgent or _resolve_ to an error (not reject) - */ - get(options: GetAgentParams): Promise - - cancel(): void - -} \ No newline at end of file + cancel(): void; +} diff --git a/packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts b/packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts index 9e89cf949..6f6b17555 100644 --- a/packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts +++ b/packages/fdc3-get-agent/src/strategies/PostMessageLoader.ts @@ -1,163 +1,158 @@ -import { DesktopAgent, GetAgentParams } from '@kite9/fdc3-standard' +import { DesktopAgent, GetAgentParams } from '@kite9/fdc3-standard'; import { createDesktopAgentAPI } from '../messaging/message-port'; -import { v4 as uuidv4 } from "uuid" +import { v4 as uuidv4 } from 'uuid'; import { ConnectionDetails } from '../messaging/MessagePortMessaging'; import { Loader } from './Loader'; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { BrowserTypes } from '@kite9/fdc3-schema'; import { FDC3_VERSION } from '../Fdc3Version'; - -type WebConnectionProtocol1Hello = BrowserTypes.WebConnectionProtocol1Hello -type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL -type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake +type WebConnectionProtocol1Hello = BrowserTypes.WebConnectionProtocol1Hello; +type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL; +type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake; function collectPossibleTargets(w: Window, found: Window[]) { - if (w) { - if (found.indexOf(w) == -1) { - found.push(w); - } + if (w) { + if (found.indexOf(w) == -1) { + found.push(w); + } - if (found.indexOf(w.opener) == -1) { - collectPossibleTargets(w.opener, found); - } + if (found.indexOf(w.opener) == -1) { + collectPossibleTargets(w.opener, found); + } - if (found.indexOf(w.parent) == -1) { - collectPossibleTargets(w.parent, found); - } + if (found.indexOf(w.parent) == -1) { + collectPossibleTargets(w.parent, found); } + } } - /** * Starts the connection process off by sending a hello message */ function sendWCP1Hello(w: MessageEventSource, options: GetAgentParams, connectionAttemptUuid: string, origin: string) { - const requestMessage: WebConnectionProtocol1Hello = { - type: 'WCP1Hello', - meta: { - connectionAttemptUuid: connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - channelSelector: options.channelSelector, - fdc3Version: FDC3_VERSION, - resolver: options.intentResolver, - identityUrl: options.identityUrl!!, - actualUrl: globalThis.window.location.href - } - } - - w.postMessage(requestMessage, { targetOrigin: origin }); + const requestMessage: WebConnectionProtocol1Hello = { + type: 'WCP1Hello', + meta: { + connectionAttemptUuid: connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + channelSelector: options.channelSelector, + fdc3Version: FDC3_VERSION, + resolver: options.intentResolver, + identityUrl: options.identityUrl!!, + actualUrl: globalThis.window.location.href, + }, + }; + + w.postMessage(requestMessage, { targetOrigin: origin }); } /** * The desktop agent requests that the client opens a URL in order to provide a message port. */ function openFrame(url: string): Window { - const IFRAME_ID = "fdc3-communications-embedded-iframe" - - // remove an old one if it's there - const existing = document.getElementById(IFRAME_ID) - if (existing) { - existing.remove() - } - - // create a new one - var ifrm = document.createElement("iframe") - ifrm.setAttribute("src", url) - ifrm.setAttribute("id", IFRAME_ID) - ifrm.setAttribute("name", "FDC3 Communications") - ifrm.style.width = "0px" - ifrm.style.height = "0px" - ifrm.style.border = "0" - ifrm.style.position = "fixed" - document.body.appendChild(ifrm) - return ifrm.contentWindow!! + const IFRAME_ID = 'fdc3-communications-embedded-iframe'; + + // remove an old one if it's there + const existing = document.getElementById(IFRAME_ID); + if (existing) { + existing.remove(); + } + + // create a new one + var ifrm = document.createElement('iframe'); + ifrm.setAttribute('src', url); + ifrm.setAttribute('id', IFRAME_ID); + ifrm.setAttribute('name', 'FDC3 Communications'); + ifrm.style.width = '0px'; + ifrm.style.height = '0px'; + ifrm.style.border = '0'; + ifrm.style.position = 'fixed'; + document.body.appendChild(ifrm); + return ifrm.contentWindow!!; } export function helloExchange(options: GetAgentParams, connectionAttemptUuid: string): Promise { - - return new Promise((resolve, _reject) => { - // setup listener for message and retrieve JS URL from it - const el = (event: MessageEvent) => { - const data = event.data; - if (data?.meta?.connectionAttemptUuid == connectionAttemptUuid) { - if (data.type == 'WCP2LoadUrl') { - // in this case, we need to load the URL with the embedded Iframe - openFrame((data as WebConnectionProtocol2LoadURL).payload.iframeUrl); - } else if (data.type == 'WCP3Handshake') { - resolve({ - connectionAttemptUuid: connectionAttemptUuid, - handshake: data, - messagePort: event.ports[0], - options: options, - actualUrl: globalThis.window.location.href - }) - } - } + return new Promise((resolve, _reject) => { + // setup listener for message and retrieve JS URL from it + const el = (event: MessageEvent) => { + const data = event.data; + if (data?.meta?.connectionAttemptUuid == connectionAttemptUuid) { + if (data.type == 'WCP2LoadUrl') { + // in this case, we need to load the URL with the embedded Iframe + openFrame((data as WebConnectionProtocol2LoadURL).payload.iframeUrl); + } else if (data.type == 'WCP3Handshake') { + resolve({ + connectionAttemptUuid: connectionAttemptUuid, + handshake: data, + messagePort: event.ports[0], + options: options, + actualUrl: globalThis.window.location.href, + }); } + } + }; - globalThis.window.addEventListener("message", el) - }); - + globalThis.window.addEventListener('message', el); + }); } /** - * This is a variation of the PostMessageLoader used for handling failover. If the failover returns the WindowProxy this is used + * This is a variation of the PostMessageLoader used for handling failover. If the failover returns the WindowProxy this is used * to properly load the desktop agent. */ -export function handleWindowProxy(options: GetAgentParams, provider: () => Promise): Promise { - return new Promise((resolve, _reject) => { - const el = (event: MessageEvent) => { - const data = event.data; - if (data.type == 'WCP3Handshake') { - const handshake = data as WebConnectionProtocol3Handshake; - globalThis.window.removeEventListener("message", el) - - resolve(createDesktopAgentAPI({ - connectionAttemptUuid: handshake.meta.connectionAttemptUuid, - handshake: data, - messagePort: event.ports[0], - options: options, - actualUrl: globalThis.window.location.href - })) - } - } - - globalThis.window.addEventListener("message", el) - - provider().then((providerResult) => { - if ((providerResult as any).getInfo) { - globalThis.window.removeEventListener("message", el) - resolve(providerResult as DesktopAgent) - } - }) - }) +export function handleWindowProxy( + options: GetAgentParams, + provider: () => Promise +): Promise { + return new Promise((resolve, _reject) => { + const el = (event: MessageEvent) => { + const data = event.data; + if (data.type == 'WCP3Handshake') { + const handshake = data as WebConnectionProtocol3Handshake; + globalThis.window.removeEventListener('message', el); + + resolve( + createDesktopAgentAPI({ + connectionAttemptUuid: handshake.meta.connectionAttemptUuid, + handshake: data, + messagePort: event.ports[0], + options: options, + actualUrl: globalThis.window.location.href, + }) + ); + } + }; + + globalThis.window.addEventListener('message', el); + + provider().then(providerResult => { + if ((providerResult as any).getInfo) { + globalThis.window.removeEventListener('message', el); + resolve(providerResult as DesktopAgent); + } + }); + }); } - export class PostMessageLoader implements Loader { + connectionAttemptUuid = uuidv4(); - connectionAttemptUuid = uuidv4(); - - async get(options: GetAgentParams): Promise { - const targets: Window[] = [] - collectPossibleTargets(globalThis.window, targets); + async get(options: GetAgentParams): Promise { + const targets: Window[] = []; + collectPossibleTargets(globalThis.window, targets); - // ok, begin the process - const promise = helloExchange(options, this.connectionAttemptUuid) + // ok, begin the process + const promise = helloExchange(options, this.connectionAttemptUuid); - // use of '*': See https://github.com/finos/FDC3/issues/1316 - targets.forEach((t) => sendWCP1Hello(t, options, this.connectionAttemptUuid, "*")) - - // wait for one of the windows to return the data we need - const data = await promise - return createDesktopAgentAPI(data); - } - - cancel(): void { - - } + // use of '*': See https://github.com/finos/FDC3/issues/1316 + targets.forEach(t => sendWCP1Hello(t, options, this.connectionAttemptUuid, '*')); + // wait for one of the windows to return the data we need + const data = await promise; + return createDesktopAgentAPI(data); + } + cancel(): void {} } diff --git a/packages/fdc3-get-agent/src/strategies/TimeoutLoader.ts b/packages/fdc3-get-agent/src/strategies/TimeoutLoader.ts index 369e25f1c..3e46ee9f1 100644 --- a/packages/fdc3-get-agent/src/strategies/TimeoutLoader.ts +++ b/packages/fdc3-get-agent/src/strategies/TimeoutLoader.ts @@ -1,35 +1,32 @@ -import { AgentError, DesktopAgent, GetAgentParams } from "@kite9/fdc3-standard"; -import { Loader } from "./Loader"; - - +import { AgentError, DesktopAgent, GetAgentParams } from '@kite9/fdc3-standard'; +import { Loader } from './Loader'; /** * This loader handles timing out. */ export class TimeoutLoader implements Loader { + done = false; - done = false - - poll(endTime: number, resolve: (value: DesktopAgent | void) => void, reject: (reason?: any) => void) { - const timeRemaining = endTime - Date.now() - - if ((timeRemaining > 0) && (this.done == false)) { - setTimeout(() => this.poll(endTime, resolve, reject), 100); - } else if (this.done == false) { - reject(new Error(AgentError.AgentNotFound)); - } else { - resolve(); - } - } - - cancel(): void { - this.done = true; - } + poll(endTime: number, resolve: (value: DesktopAgent | void) => void, reject: (reason?: any) => void) { + const timeRemaining = endTime - Date.now(); - get({timeoutMs = 0}: GetAgentParams): Promise { - return new Promise((resolve, reject) => { - const endPollTime = Date.now() + timeoutMs - this.poll(endPollTime, resolve, reject) - }); + if (timeRemaining > 0 && this.done == false) { + setTimeout(() => this.poll(endTime, resolve, reject), 100); + } else if (this.done == false) { + reject(new Error(AgentError.AgentNotFound)); + } else { + resolve(); } + } + + cancel(): void { + this.done = true; + } + + get({ timeoutMs = 0 }: GetAgentParams): Promise { + return new Promise((resolve, reject) => { + const endPollTime = Date.now() + timeoutMs; + this.poll(endPollTime, resolve, reject); + }); + } } diff --git a/packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts b/packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts index b7a7cd633..35a3d7f1c 100644 --- a/packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts +++ b/packages/fdc3-get-agent/src/ui/AbstractUIComponent.ts @@ -1,134 +1,133 @@ -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { Connectable } from "@kite9/fdc3-standard"; -import { FDC3_VERSION } from "../Fdc3Version"; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { Connectable } from '@kite9/fdc3-standard'; +import { FDC3_VERSION } from '../Fdc3Version'; -export interface CSSPositioning { [key: string]: string } +export interface CSSPositioning { + [key: string]: string; +} export const INITIAL_CONTAINER_CSS = { - width: "0", - height: "0", - position: "fixed" -} + width: '0', + height: '0', + position: 'fixed', +}; export const ALLOWED_CSS_ELEMENTS = [ - "width", - "height", - "position", - "zIndex", - "left", - "right", - "top", - "bottom", - "transition", - "maxHeight", - "maxWidth", - "display" -] + 'width', + 'height', + 'position', + 'zIndex', + 'left', + 'right', + 'top', + 'bottom', + 'transition', + 'maxHeight', + 'maxWidth', + 'display', +]; export abstract class AbstractUIComponent implements Connectable { - - private container: HTMLDivElement | undefined = undefined - private iframe: HTMLIFrameElement | undefined = undefined - private url: string - private name: string - port: MessagePort | null = null - - constructor(url: string, name: string) { - this.url = url - this.name = name - } - - async connect() { - const portPromise = this.awaitHello() - this.openFrame() - this.port = await portPromise - await this.setupMessagePort(this.port) - await this.messagePortReady(this.port) - - } - - async disconnect() { - this.port?.close() - } - - /** - * Override and extend this method to provide functionality specific to the UI in question - */ - async setupMessagePort(port: MessagePort): Promise { - port.addEventListener("message", (e) => { - const data = e.data - if (data.type == BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE) { - const css = data.payload.updatedCSS - this.themeContainer(css) - } - }) - } - - async messagePortReady(port: MessagePort) { - // tells the iframe it can start posting - const handshake: BrowserTypes.Fdc3UserInterfaceHandshake = { - type: "Fdc3UserInterfaceHandshake", - payload: { - fdc3Version: FDC3_VERSION - } - }; - port.postMessage(handshake); - } - - private awaitHello(): Promise { - return new Promise((resolve, _reject) => { - const ml = (e: MessageEvent) => { - if ((e.source == this.iframe?.contentWindow) && (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_HELLO_TYPE)) { - const helloData = e.data as BrowserTypes.Fdc3UserInterfaceHello - if (helloData.payload.initialCSS) { - this.themeContainer(helloData.payload.initialCSS) - } - const port = e.ports[0] - port.start() - globalThis.window.removeEventListener("message", ml) - resolve(port) - } - } - - globalThis.window.addEventListener("message", ml) - }); - - } - - private openFrame(): void { - this.container = globalThis.document.createElement("div") - this.iframe = globalThis.document.createElement("iframe") - - this.themeContainer(INITIAL_CONTAINER_CSS) - this.themeFrame(this.iframe) - - this.iframe.setAttribute("src", this.url) - this.container.appendChild(this.iframe) - document.body.appendChild(this.container) - } - - private toKebabCase(str: String) { - return str.replace(/[A-Z]/g, (match) => "-" + match.toLowerCase()); - } - - themeContainer(css: BrowserTypes.UpdatedCSS | BrowserTypes.InitialCSS) { - if (css) { - for (let i = 0; i < ALLOWED_CSS_ELEMENTS.length; i++) { - const k = ALLOWED_CSS_ELEMENTS[i] - const value: string | undefined = css[(k as string)] - if (value != null) { - this.container!.style.setProperty(this.toKebabCase(k), value) - } else { - this.container!.style.removeProperty(this.toKebabCase(k)) - } - } + private container: HTMLDivElement | undefined = undefined; + private iframe: HTMLIFrameElement | undefined = undefined; + private url: string; + private name: string; + port: MessagePort | null = null; + + constructor(url: string, name: string) { + this.url = url; + this.name = name; + } + + async connect() { + const portPromise = this.awaitHello(); + this.openFrame(); + this.port = await portPromise; + await this.setupMessagePort(this.port); + await this.messagePortReady(this.port); + } + + async disconnect() { + this.port?.close(); + } + + /** + * Override and extend this method to provide functionality specific to the UI in question + */ + async setupMessagePort(port: MessagePort): Promise { + port.addEventListener('message', e => { + const data = e.data; + if (data.type == BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE) { + const css = data.payload.updatedCSS; + this.themeContainer(css); + } + }); + } + + async messagePortReady(port: MessagePort) { + // tells the iframe it can start posting + const handshake: BrowserTypes.Fdc3UserInterfaceHandshake = { + type: 'Fdc3UserInterfaceHandshake', + payload: { + fdc3Version: FDC3_VERSION, + }, + }; + port.postMessage(handshake); + } + + private awaitHello(): Promise { + return new Promise((resolve, _reject) => { + const ml = (e: MessageEvent) => { + if (e.source == this.iframe?.contentWindow && e.data.type == BrowserTypes.FDC3_USER_INTERFACE_HELLO_TYPE) { + const helloData = e.data as BrowserTypes.Fdc3UserInterfaceHello; + if (helloData.payload.initialCSS) { + this.themeContainer(helloData.payload.initialCSS); + } + const port = e.ports[0]; + port.start(); + globalThis.window.removeEventListener('message', ml); + resolve(port); } + }; + + globalThis.window.addEventListener('message', ml); + }); + } + + private openFrame(): void { + this.container = globalThis.document.createElement('div'); + this.iframe = globalThis.document.createElement('iframe'); + + this.themeContainer(INITIAL_CONTAINER_CSS); + this.themeFrame(this.iframe); + + this.iframe.setAttribute('src', this.url); + this.container.appendChild(this.iframe); + document.body.appendChild(this.container); + } + + private toKebabCase(str: String) { + return str.replace(/[A-Z]/g, match => '-' + match.toLowerCase()); + } + + themeContainer(css: BrowserTypes.UpdatedCSS | BrowserTypes.InitialCSS) { + if (css) { + for (let i = 0; i < ALLOWED_CSS_ELEMENTS.length; i++) { + const k = ALLOWED_CSS_ELEMENTS[i]; + const value: string | undefined = css[k as string]; + if (value != null) { + this.container!.style.setProperty(this.toKebabCase(k), value); + } else { + this.container!.style.removeProperty(this.toKebabCase(k)); + } + } } - - themeFrame(ifrm: HTMLIFrameElement) { - ifrm.setAttribute("name", this.name) - ifrm.style.width = "100%" - ifrm.style.height = "100%" - ifrm.style.border = "0" - } + } + + themeFrame(ifrm: HTMLIFrameElement) { + ifrm.setAttribute('name', this.name); + ifrm.style.width = '100%'; + ifrm.style.height = '100%'; + ifrm.style.border = '0'; + } } diff --git a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts index bb68145ef..01fdf9b2a 100644 --- a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts +++ b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentChannelSelector.ts @@ -1,57 +1,54 @@ -import { Channel } from "@kite9/fdc3-standard"; -import { ChannelSelector } from "@kite9/fdc3-standard" -import { AbstractUIComponent } from "./AbstractUIComponent"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - +import { Channel } from '@kite9/fdc3-standard'; +import { ChannelSelector } from '@kite9/fdc3-standard'; +import { AbstractUIComponent } from './AbstractUIComponent'; +import { BrowserTypes } from '@kite9/fdc3-schema'; /** * Works with the desktop agent to provide a simple channel selector. - * - * This is the default implementation, but can be overridden by app implementers calling + * + * This is the default implementation, but can be overridden by app implementers calling * the getAgent() method */ export class DefaultDesktopAgentChannelSelector extends AbstractUIComponent implements ChannelSelector { + private callback: ((channelId: string | null) => void) | null = null; - private callback: ((channelId: string | null) => void) | null = null - - constructor(url: string | null) { - super(url ?? "https://fdc3.finos.org/webui/channel_selector.html", "FDC3 Channel Selector") - } - - async setupMessagePort(port: MessagePort): Promise { - await super.setupMessagePort(port) - this.port = port + constructor(url: string | null) { + super(url ?? 'https://fdc3.finos.org/webui/channel_selector.html', 'FDC3 Channel Selector'); + } - port.addEventListener("message", (e) => { - if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE) { - const choice = e.data - if (this.callback) { - this.callback(choice.payload.selected) - } - } - }) - } + async setupMessagePort(port: MessagePort): Promise { + await super.setupMessagePort(port); + this.port = port; - updateChannel(channelId: string | null, availableChannels: Channel[]): void { - const message: BrowserTypes.Fdc3UserInterfaceChannels = { - type: 'Fdc3UserInterfaceChannels', - payload: { - selected: channelId, - userChannels: availableChannels.map(ch => { - return { - type: "user", - id: ch.id, - displayMetadata: ch.displayMetadata - } - }) - } + port.addEventListener('message', e => { + if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE) { + const choice = e.data; + if (this.callback) { + this.callback(choice.payload.selected); } - // also send to the iframe - this.port?.postMessage(message) - } - - setChannelChangeCallback(callback: (channelId: string | null) => void): void { - this.callback = callback - } - -} \ No newline at end of file + } + }); + } + + updateChannel(channelId: string | null, availableChannels: Channel[]): void { + const message: BrowserTypes.Fdc3UserInterfaceChannels = { + type: 'Fdc3UserInterfaceChannels', + payload: { + selected: channelId, + userChannels: availableChannels.map(ch => { + return { + type: 'user', + id: ch.id, + displayMetadata: ch.displayMetadata, + }; + }), + }, + }; + // also send to the iframe + this.port?.postMessage(message); + } + + setChannelChangeCallback(callback: (channelId: string | null) => void): void { + this.callback = callback; + } +} diff --git a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts index 291676d80..0a3ab642f 100644 --- a/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts +++ b/packages/fdc3-get-agent/src/ui/DefaultDesktopAgentIntentResolver.ts @@ -1,59 +1,57 @@ -import { AppIntent } from "@kite9/fdc3-standard"; -import { IntentResolver, IntentResolutionChoice } from '@kite9/fdc3-standard' -import { AbstractUIComponent } from "./AbstractUIComponent"; -import { Context } from "@kite9/fdc3-context"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - +import { AppIntent } from '@kite9/fdc3-standard'; +import { IntentResolver, IntentResolutionChoice } from '@kite9/fdc3-standard'; +import { AbstractUIComponent } from './AbstractUIComponent'; +import { Context } from '@kite9/fdc3-context'; +import { BrowserTypes } from '@kite9/fdc3-schema'; /** * Works with the desktop agent to provide a resolution to the intent choices. - * This is the default implementation, but can be overridden by app implementers calling + * This is the default implementation, but can be overridden by app implementers calling * the getAgent() method */ export class DefaultDesktopAgentIntentResolver extends AbstractUIComponent implements IntentResolver { - - private pendingResolve: ((x: IntentResolutionChoice | void) => void) | null = null - - constructor(url: string | null) { - super(url ?? "https://fdc3.finos.org/webui/intent_resolver.html", "FDC3 Intent Resolver") - } - - async setupMessagePort(port: MessagePort): Promise { - await super.setupMessagePort(port) - this.port = port - - this.port.addEventListener("message", (e) => { - console.log("Got resolve action") - if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_RESOLVE_ACTION_TYPE) { - const choice = e.data - if ((choice.payload.action == 'click') && (this.pendingResolve)) { - this.pendingResolve({ - appId: choice.payload.appIdentifier!!, - intent: choice.payload.intent!! - }) - } else if ((choice.payload.action == 'cancel') && (this.pendingResolve)) { - this.pendingResolve() - } - - this.pendingResolve = null - } - }) - } - - async chooseIntent(appIntents: AppIntent[], context: Context): Promise { - const out = new Promise((resolve, _reject) => { - this.pendingResolve = resolve; - }); - - const message: BrowserTypes.Fdc3UserInterfaceResolve = { - type: "Fdc3UserInterfaceResolve", - payload: { - appIntents, - context - } - }; - this.port?.postMessage(message); - - return out - } -} \ No newline at end of file + private pendingResolve: ((x: IntentResolutionChoice | void) => void) | null = null; + + constructor(url: string | null) { + super(url ?? 'https://fdc3.finos.org/webui/intent_resolver.html', 'FDC3 Intent Resolver'); + } + + async setupMessagePort(port: MessagePort): Promise { + await super.setupMessagePort(port); + this.port = port; + + this.port.addEventListener('message', e => { + console.log('Got resolve action'); + if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_RESOLVE_ACTION_TYPE) { + const choice = e.data; + if (choice.payload.action == 'click' && this.pendingResolve) { + this.pendingResolve({ + appId: choice.payload.appIdentifier!!, + intent: choice.payload.intent!!, + }); + } else if (choice.payload.action == 'cancel' && this.pendingResolve) { + this.pendingResolve(); + } + + this.pendingResolve = null; + } + }); + } + + async chooseIntent(appIntents: AppIntent[], context: Context): Promise { + const out = new Promise((resolve, _reject) => { + this.pendingResolve = resolve; + }); + + const message: BrowserTypes.Fdc3UserInterfaceResolve = { + type: 'Fdc3UserInterfaceResolve', + payload: { + appIntents, + context, + }, + }; + this.port?.postMessage(message); + + return out; + } +} diff --git a/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts b/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts index 33e61cd72..2caefa4b9 100644 --- a/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts +++ b/packages/fdc3-get-agent/src/ui/NullChannelSelector.ts @@ -1,20 +1,13 @@ -import { Channel, } from "@kite9/fdc3-standard"; -import { Connectable } from "@kite9/fdc3-standard"; -import { ChannelSelector } from "@kite9/fdc3-standard"; +import { Channel } from '@kite9/fdc3-standard'; +import { Connectable } from '@kite9/fdc3-standard'; +import { ChannelSelector } from '@kite9/fdc3-standard'; export class NullChannelSelector implements ChannelSelector, Connectable { + async disconnect(): Promise {} - async disconnect(): Promise { - } - - async connect(): Promise { - } - - updateChannel(_channelId: string | null, _availableChannels: Channel[]): void { - } - - setChannelChangeCallback(_callback: (channelId: string | null) => void): void { - } + async connect(): Promise {} + updateChannel(_channelId: string | null, _availableChannels: Channel[]): void {} + setChannelChangeCallback(_callback: (channelId: string | null) => void): void {} } diff --git a/packages/fdc3-get-agent/src/ui/NullIntentResolver.ts b/packages/fdc3-get-agent/src/ui/NullIntentResolver.ts index 4a8229986..b2d52af16 100644 --- a/packages/fdc3-get-agent/src/ui/NullIntentResolver.ts +++ b/packages/fdc3-get-agent/src/ui/NullIntentResolver.ts @@ -1,16 +1,11 @@ -import { AppIntent } from "@kite9/fdc3-standard"; -import { IntentResolver, IntentResolutionChoice } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; - +import { AppIntent } from '@kite9/fdc3-standard'; +import { IntentResolver, IntentResolutionChoice } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; export class NullIntentResolver implements IntentResolver { + async disconnect(): Promise {} - async disconnect(): Promise { - } - - async connect(): Promise { - } + async connect(): Promise {} - async chooseIntent(_appIntents: AppIntent[], _ctx: Context): Promise { - } -} \ No newline at end of file + async chooseIntent(_appIntents: AppIntent[], _ctx: Context): Promise {} +} diff --git a/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts b/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts index f364e8667..25eece2eb 100644 --- a/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts +++ b/packages/fdc3-get-agent/test/step-definitions/channel-selector.steps.ts @@ -1,33 +1,39 @@ -import { Given } from "@cucumber/cucumber"; -import { handleResolve } from "@kite9/testing"; -import { DefaultDesktopAgentChannelSelector } from "../../src/ui/DefaultDesktopAgentChannelSelector"; -import { CHANNEL_SELECTOR_URL } from "../support/MockFDC3Server"; -import { USER_CHANNELS } from "../support/responses/UserChannels"; -import { CustomWorld } from "../world"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { Given } from '@cucumber/cucumber'; +import { handleResolve } from '@kite9/testing'; +import { DefaultDesktopAgentChannelSelector } from '../../src/ui/DefaultDesktopAgentChannelSelector'; +import { CHANNEL_SELECTOR_URL } from '../support/MockFDC3Server'; +import { USER_CHANNELS } from '../support/responses/UserChannels'; +import { CustomWorld } from '../world'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -Given('A Channel Selector in {string} with callback piping to {string}', async function (this: CustomWorld, field: string, cb: string) { +Given( + 'A Channel Selector in {string} with callback piping to {string}', + async function (this: CustomWorld, field: string, cb: string) { const cs = new DefaultDesktopAgentChannelSelector(CHANNEL_SELECTOR_URL); cs.setChannelChangeCallback((channelId: string | null) => { - this.props[cb] = channelId - }) + this.props[cb] = channelId; + }); - this.props[field] = cs - await cs.connect() -}) + this.props[field] = cs; + await cs.connect(); + } +); Given('User Channels one, two and three in {string}', function (this: CustomWorld, field: string) { - this.props[field] = USER_CHANNELS -}) + this.props[field] = USER_CHANNELS; +}); -Given('The channel selector sends a channel change message for channel {string}', async function (this: CustomWorld, channel: string) { - const port = handleResolve("{document.iframes[0].messageChannels[0].port2}", this) +Given( + 'The channel selector sends a channel change message for channel {string}', + async function (this: CustomWorld, channel: string) { + const port = handleResolve('{document.iframes[0].messageChannels[0].port2}', this); port.postMessage({ - type: BrowserTypes.FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE, - payload: { - selected: channel - } - }) -}) \ No newline at end of file + type: BrowserTypes.FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE, + payload: { + selected: channel, + }, + }); + } +); diff --git a/packages/fdc3-get-agent/test/step-definitions/desktop-agent.steps.ts b/packages/fdc3-get-agent/test/step-definitions/desktop-agent.steps.ts index 9f975e352..31c102efd 100644 --- a/packages/fdc3-get-agent/test/step-definitions/desktop-agent.steps.ts +++ b/packages/fdc3-get-agent/test/step-definitions/desktop-agent.steps.ts @@ -1,8 +1,8 @@ -import { After, DataTable, Given, When } from '@cucumber/cucumber' +import { After, DataTable, Given, When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { handleResolve, setupGenericSteps } from '@kite9/testing'; import { MockDocument } from '../support/MockDocument'; -import { MockWindow } from "../support/MockWindow"; +import { MockWindow } from '../support/MockWindow'; import { fdc3Ready, getAgent } from '../../src'; import { DesktopAgentDetails, GetAgentParams, WebDesktopAgentType } from '@kite9/fdc3-standard'; import { dummyInstanceId, EMBED_URL, MockFDC3Server } from '../support/MockFDC3Server'; @@ -12,135 +12,147 @@ import { DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY } from '../../src/messaging/A import { clearAgentPromise, getAgentPromise } from '../../src/strategies/getAgent'; import expect from 'expect'; -setupGenericSteps() -Given('Parent Window desktop {string} listens for postMessage events in {string}, returns direct message response', async function (this: CustomWorld, field: string, w: string) { - const mockWindow = handleResolve(w, this) - this.mockFDC3Server = new MockFDC3Server(mockWindow as any, false, this.mockContext) - this.props[field] = this.mockFDC3Server - this.mockContext.open(dummyInstanceId.appId) -}) - -Given('Parent Window desktop {string} listens for postMessage events in {string}, returns iframe response', async function (this: CustomWorld, field: string, w: string) { - const mockWindow = handleResolve(w, this) - this.mockFDC3Server = new MockFDC3Server(mockWindow as any, true, this.mockContext) - this.props[field] = this.mockFDC3Server - this.mockContext.open(dummyInstanceId.appId) -}) - -Given('{string} is a function which opens an iframe for communications on {string}', function (this: CustomWorld, fn: string, doc: string) { +setupGenericSteps(); +Given( + 'Parent Window desktop {string} listens for postMessage events in {string}, returns direct message response', + async function (this: CustomWorld, field: string, w: string) { + const mockWindow = handleResolve(w, this); + this.mockFDC3Server = new MockFDC3Server(mockWindow as any, false, this.mockContext); + this.props[field] = this.mockFDC3Server; + this.mockContext.open(dummyInstanceId.appId); + } +); + +Given( + 'Parent Window desktop {string} listens for postMessage events in {string}, returns iframe response', + async function (this: CustomWorld, field: string, w: string) { + const mockWindow = handleResolve(w, this); + this.mockFDC3Server = new MockFDC3Server(mockWindow as any, true, this.mockContext); + this.props[field] = this.mockFDC3Server; + this.mockContext.open(dummyInstanceId.appId); + } +); + +Given( + '{string} is a function which opens an iframe for communications on {string}', + function (this: CustomWorld, fn: string, doc: string) { this.props[fn] = () => { - this.mockContext.open(dummyInstanceId.appId) - const document = handleResolve(doc, this) as MockDocument - var ifrm = document.createElement("iframe") - this.mockFDC3Server = new MockFDC3Server(ifrm as any, false, this.mockContext) - ifrm.setAttribute("src", EMBED_URL + "?connectionAttemptUuid=123") - document.body.appendChild(ifrm) - return ifrm - } -}); + this.mockContext.open(dummyInstanceId.appId); + const document = handleResolve(doc, this) as MockDocument; + var ifrm = document.createElement('iframe'); + this.mockFDC3Server = new MockFDC3Server(ifrm as any, false, this.mockContext); + ifrm.setAttribute('src', EMBED_URL + '?connectionAttemptUuid=123'); + document.body.appendChild(ifrm); + return ifrm; + }; + } +); Given('an existing app instance in {string}', async function (this: CustomWorld, field: string) { - const uuid = this.mockContext.open(dummyInstanceId.appId) - this.props[field] = uuid -}) - + const uuid = this.mockContext.open(dummyInstanceId.appId); + this.props[field] = uuid; +}); Given('A Dummy Desktop Agent in {string}', async function (this: CustomWorld, field: string) { - - const da: DesktopAgent = { - async getInfo(): Promise { - return { - fdc3Version: "2.0", - appMetadata: { - appId: "cucumber-app" - }, - provider: "cucumber-provider" - } as any - } - } as any - - this.props[field] = da - this.props['result'] = null -}) - -Given('`window.fdc3` is injected into the runtime with the value in {string}', async function (this: CustomWorld, field: string) { - const object = handleResolve(field, this) - window.fdc3 = object - window.dispatchEvent(new Event('fdc3.ready')) + const da: DesktopAgent = { + async getInfo(): Promise { + return { + fdc3Version: '2.0', + appMetadata: { + appId: 'cucumber-app', + }, + provider: 'cucumber-provider', + } as any; + }, + } as any; + + this.props[field] = da; + this.props['result'] = null; }); +Given( + '`window.fdc3` is injected into the runtime with the value in {string}', + async function (this: CustomWorld, field: string) { + const object = handleResolve(field, this); + window.fdc3 = object; + window.dispatchEvent(new Event('fdc3.ready')); + } +); + When('I call getAgent for a promise result', function (this: CustomWorld) { - try { - this.props['result'] = getAgent() - } catch (error) { - this.props['result'] = error - } -}) + try { + this.props['result'] = getAgent(); + } catch (error) { + this.props['result'] = error; + } +}); When('I call fdc3Ready for a promise result', function (this: CustomWorld) { - try { - this.props['result'] = fdc3Ready() - } catch (error) { - this.props['result'] = error - } -}) + try { + this.props['result'] = fdc3Ready(); + } catch (error) { + this.props['result'] = error; + } +}); After(function (this: CustomWorld) { - // Clean up - clearAgentPromise() -}) + // Clean up + clearAgentPromise(); +}); When('I call getAgent for a promise result with the following options', function (this: CustomWorld, dt: DataTable) { - try { - const first = dt.hashes()[0] - const toArgs = Object.fromEntries(Object.entries(first) - .map(([k, v]) => { - const val = handleResolve(v, this) - const val2 = isNaN(val) ? val : Number(val) - const val3 = val2 === "true" ? true : val2 === "false" ? false : val2 - return [k, val3] - }) - ) - this.props['result'] = getAgent(toArgs as GetAgentParams) - } catch (error) { - this.props['result'] = error - } -}) - -Given('a browser document in {string} and window in {string}', async function (this: CustomWorld, d: string, w: string) { + try { + const first = dt.hashes()[0]; + const toArgs = Object.fromEntries( + Object.entries(first).map(([k, v]) => { + const val = handleResolve(v, this); + const val2 = isNaN(val) ? val : Number(val); + const val3 = val2 === 'true' ? true : val2 === 'false' ? false : val2; + return [k, val3]; + }) + ); + this.props['result'] = getAgent(toArgs as GetAgentParams); + } catch (error) { + this.props['result'] = error; + } +}); + +Given( + 'a browser document in {string} and window in {string}', + async function (this: CustomWorld, d: string, w: string) { // creates the mock app window - const mw = new MockWindow("mockWindow", this, "mocky") - globalThis.window = mw as any + const mw = new MockWindow('mockWindow', this, 'mocky'); + globalThis.window = mw as any; this.props[w] = globalThis.window; // to keep it simple, mock app window parent is set to itself, to avoid excess routing mw.parent = mw; // mock document exists in the window - globalThis.document = new MockDocument("mockDocument", mw) as any + globalThis.document = new MockDocument('mockDocument', mw) as any; this.props[d] = globalThis.document as any; // browser storage - globalThis.sessionStorage = new MockStorage() as any - -}) - -Given("the session identity is set to {string}", async function (this: CustomWorld, id: string) { - const details: DesktopAgentDetails = { - agentType: WebDesktopAgentType.ProxyParent, - instanceUuid: handleResolve(id, this), - appId: 'cucumber-app', - instanceId: 'uuid-0' - } - - globalThis.sessionStorage.setItem(DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY + "-mocky", JSON.stringify(details)) -}) + globalThis.sessionStorage = new MockStorage() as any; + } +); + +Given('the session identity is set to {string}', async function (this: CustomWorld, id: string) { + const details: DesktopAgentDetails = { + agentType: WebDesktopAgentType.ProxyParent, + instanceUuid: handleResolve(id, this), + appId: 'cucumber-app', + instanceId: 'uuid-0', + }; + + globalThis.sessionStorage.setItem(DESKTOP_AGENT_SESSION_STORAGE_DETAILS_KEY + '-mocky', JSON.stringify(details)); +}); -When("{string} pagehide occurs", async function (this: CustomWorld, field: string) { - const window: MockWindow = handleResolve(field, this) - window.dispatchEvent(new Event('pagehide')) -}) +When('{string} pagehide occurs', async function (this: CustomWorld, field: string) { + const window: MockWindow = handleResolve(field, this); + window.dispatchEvent(new Event('pagehide')); +}); -When("theAgentPromise is cleared", async function (this: CustomWorld) { - expect(getAgentPromise()).toBeNull() -}) \ No newline at end of file +When('theAgentPromise is cleared', async function (this: CustomWorld) { + expect(getAgentPromise()).toBeNull(); +}); diff --git a/packages/fdc3-get-agent/test/step-definitions/intent-resolver.steps.ts b/packages/fdc3-get-agent/test/step-definitions/intent-resolver.steps.ts index 6569947db..59ead6891 100644 --- a/packages/fdc3-get-agent/test/step-definitions/intent-resolver.steps.ts +++ b/packages/fdc3-get-agent/test/step-definitions/intent-resolver.steps.ts @@ -1,101 +1,104 @@ -import { Given, When } from "@cucumber/cucumber"; -import { CustomWorld } from "../world"; -import { handleResolve } from "@kite9/testing"; -import { DefaultDesktopAgentIntentResolver } from "../../src/ui/DefaultDesktopAgentIntentResolver"; -import { INTENT_RESOLVER_URL } from "../support/MockFDC3Server"; -import { Context } from "@kite9/fdc3-context"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { Given, When } from '@cucumber/cucumber'; +import { CustomWorld } from '../world'; +import { handleResolve } from '@kite9/testing'; +import { DefaultDesktopAgentIntentResolver } from '../../src/ui/DefaultDesktopAgentIntentResolver'; +import { INTENT_RESOLVER_URL } from '../support/MockFDC3Server'; +import { Context } from '@kite9/fdc3-context'; +import { BrowserTypes } from '@kite9/fdc3-schema'; // TODO: Replace 'any' with useful typings const contextMap: Record = { - "fdc3.instrument": { - "type": "fdc3.instrument", - "name": "Apple", - "id": { - "ticker": "AAPL" - } + 'fdc3.instrument': { + type: 'fdc3.instrument', + name: 'Apple', + id: { + ticker: 'AAPL', }, - "fdc3.country": { - "type": "fdc3.country", - "name": "Sweden", - "id": { - "COUNTRY_ISOALPHA2": "SE", - "COUNTRY_ISOALPHA3": "SWE", - } + }, + 'fdc3.country': { + type: 'fdc3.country', + name: 'Sweden', + id: { + COUNTRY_ISOALPHA2: 'SE', + COUNTRY_ISOALPHA3: 'SWE', }, - "fdc3.unsupported": { - "type": "fdc3.unsupported", - "bogus": true - } -} + }, + 'fdc3.unsupported': { + type: 'fdc3.unsupported', + bogus: true, + }, +}; Given('{string} is a {string} context', function (this: CustomWorld, field: string, type: string) { - this.props[field] = contextMap[type]; -}) - + this.props[field] = contextMap[type]; +}); Given('An Intent Resolver in {string}', async function (this: CustomWorld, field: string) { - const cs = new DefaultDesktopAgentIntentResolver(INTENT_RESOLVER_URL); - this.props[field] = cs - await cs.connect() -}) + const cs = new DefaultDesktopAgentIntentResolver(INTENT_RESOLVER_URL); + this.props[field] = cs; + await cs.connect(); +}); -Given('{string} is an AppIntents array with a ViewNews intent and two apps', function (this: CustomWorld, field: string) { +Given( + '{string} is an AppIntents array with a ViewNews intent and two apps', + function (this: CustomWorld, field: string) { this.props[field] = [ - { - intent: { - name: 'ViewNews' - }, - apps: [ - { - appId: 'app1' - }, - { - appId: 'app2' - } - ] - } - ] -}) + { + intent: { + name: 'ViewNews', + }, + apps: [ + { + appId: 'app1', + }, + { + appId: 'app2', + }, + ], + }, + ]; + } +); - -When('I call {string} with {string} with parameters {string} and {string} for a promise', function (this: CustomWorld, field: string, fnName: string, param1: string, param2: string) { +When( + 'I call {string} with {string} with parameters {string} and {string} for a promise', + function (this: CustomWorld, field: string, fnName: string, param1: string, param2: string) { try { - const object = handleResolve(field, this) - const fn = object[fnName]; - const arg0 = handleResolve(param1, this) - const arg1 = handleResolve(param2, this) - const result = fn.call(object, arg0, arg1) - this.props['result'] = result; + const object = handleResolve(field, this); + const fn = object[fnName]; + const arg0 = handleResolve(param1, this); + const arg1 = handleResolve(param2, this); + const result = fn.call(object, arg0, arg1); + this.props['result'] = result; } catch (error) { - this.props['result'] = error + this.props['result'] = error; } -}); + } +); Given('The intent resolver sends an intent selection message', async function (this: CustomWorld) { - const port = handleResolve("{document.iframes[0].messageChannels[0].port2}", this) - const message: BrowserTypes.Fdc3UserInterfaceResolveAction = { - type: "Fdc3UserInterfaceResolveAction", - payload: { - action: 'click', - appIdentifier: { - appId: 'app1' - }, - intent: 'ViewNews' - } - } - port.postMessage(message); -}) + const port = handleResolve('{document.iframes[0].messageChannels[0].port2}', this); + const message: BrowserTypes.Fdc3UserInterfaceResolveAction = { + type: 'Fdc3UserInterfaceResolveAction', + payload: { + action: 'click', + appIdentifier: { + appId: 'app1', + }, + intent: 'ViewNews', + }, + }; + port.postMessage(message); +}); Given('The intent resolver cancels the intent selection message', async function (this: CustomWorld) { - const port = handleResolve("{document.iframes[0].messageChannels[0].port2}", this) - - const message: BrowserTypes.Fdc3UserInterfaceResolveAction = { - type: "Fdc3UserInterfaceResolveAction", - payload: { - action: 'cancel' - } - } - port.postMessage(message) -}) + const port = handleResolve('{document.iframes[0].messageChannels[0].port2}', this); + const message: BrowserTypes.Fdc3UserInterfaceResolveAction = { + type: 'Fdc3UserInterfaceResolveAction', + payload: { + action: 'cancel', + }, + }; + port.postMessage(message); +}); diff --git a/packages/fdc3-get-agent/test/step-definitions/port-creation.steps.ts b/packages/fdc3-get-agent/test/step-definitions/port-creation.steps.ts index 190361f0c..48881f0a2 100644 --- a/packages/fdc3-get-agent/test/step-definitions/port-creation.steps.ts +++ b/packages/fdc3-get-agent/test/step-definitions/port-creation.steps.ts @@ -1,56 +1,57 @@ -import { Given, Then } from "@cucumber/cucumber"; -import { CustomWorld } from "../world"; -import { handleResolve } from "@kite9/testing"; - - -Given('{string} receives a {string} message for the {string} and creates port {string}', async function (this: CustomWorld, frame: string, type: string, _item: string, port: string) { - const channelSelectorIframe = handleResolve(frame, this) +import { Given, Then } from '@cucumber/cucumber'; +import { CustomWorld } from '../world'; +import { handleResolve } from '@kite9/testing'; + +Given( + '{string} receives a {string} message for the {string} and creates port {string}', + async function (this: CustomWorld, frame: string, type: string, _item: string, port: string) { + const channelSelectorIframe = handleResolve(frame, this); const mc = new MessageChannel(); const internalPort = mc.port1; const externalPort = mc.port2; - if (type == "SelectorMessageInitialize") { - // TODO: Update typings - const eventDetails: any = { - type: 'message', - data: { - type: 'SelectorMessageInitialize' - }, - origin: globalThis.window.location.origin, - ports: [externalPort], - source: channelSelectorIframe - } - globalThis.window.dispatchEvent(eventDetails) + if (type == 'SelectorMessageInitialize') { + // TODO: Update typings + const eventDetails: any = { + type: 'message', + data: { + type: 'SelectorMessageInitialize', + }, + origin: globalThis.window.location.origin, + ports: [externalPort], + source: channelSelectorIframe, + }; + globalThis.window.dispatchEvent(eventDetails); } + internalPort.start(); + this.props[port] = internalPort; + } +); - internalPort.start() - this.props[port] = internalPort -}); +Given('{string} pipes messages to {string}', async function (this: CustomWorld, port: string, output: string) { + // TODO: Update typings + const out: any[] = []; + this.props[output] = out; -Given("{string} pipes messages to {string}", async function (this: CustomWorld, port: string, output: string) { - // TODO: Update typings - const out: any[] = [] - this.props[output] = out - - const internalPort = handleResolve(port, this) - internalPort.onmessage = (e: any) => { - out.push({ type: e.type, data: e.data }) - } -}) + const internalPort = handleResolve(port, this); + internalPort.onmessage = (e: any) => { + out.push({ type: e.type, data: e.data }); + }; +}); Then('{string} receives a {string} message', function (this: CustomWorld, port: string, type: string) { - const internalPort: MessagePort = handleResolve(port, this) - - if (type == 'ResolverMessageChoice') { - internalPort.postMessage({ - type, - payload: { - intent: "viewNews", - target: { - appId: "test-app-1" - } - } - }) - } -}) \ No newline at end of file + const internalPort: MessagePort = handleResolve(port, this); + + if (type == 'ResolverMessageChoice') { + internalPort.postMessage({ + type, + payload: { + intent: 'viewNews', + target: { + appId: 'test-app-1', + }, + }, + }); + } +}); diff --git a/packages/fdc3-get-agent/test/support/EventHandler.ts b/packages/fdc3-get-agent/test/support/EventHandler.ts index f9c84015c..adbfdd7f2 100644 --- a/packages/fdc3-get-agent/test/support/EventHandler.ts +++ b/packages/fdc3-get-agent/test/support/EventHandler.ts @@ -1,5 +1,4 @@ - export type EventHandler = { - type: string; - callback: (e: Event) => void; + type: string; + callback: (e: Event) => void; }; diff --git a/packages/fdc3-get-agent/test/support/FrameTypes.ts b/packages/fdc3-get-agent/test/support/FrameTypes.ts index 708dd4dce..cfea0b03d 100644 --- a/packages/fdc3-get-agent/test/support/FrameTypes.ts +++ b/packages/fdc3-get-agent/test/support/FrameTypes.ts @@ -1,116 +1,133 @@ -import { CustomWorld } from "../world" -import { MockWindow } from "./MockWindow" -import { CHANNEL_SELECTOR_URL, EMBED_URL, INTENT_RESOLVER_URL } from "./MockFDC3Server" -import { BrowserTypes } from "@kite9/fdc3-schema" -import { FDC3_USER_INTERFACE_HANDSHAKE_TYPE, FDC3_USER_INTERFACE_HELLO_TYPE, FDC3_USER_INTERFACE_RESTYLE_TYPE } from "@kite9/fdc3-schema/dist/generated/api/BrowserTypes" +import { CustomWorld } from '../world'; +import { MockWindow } from './MockWindow'; +import { CHANNEL_SELECTOR_URL, EMBED_URL, INTENT_RESOLVER_URL } from './MockFDC3Server'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { + FDC3_USER_INTERFACE_HANDSHAKE_TYPE, + FDC3_USER_INTERFACE_HELLO_TYPE, + FDC3_USER_INTERFACE_RESTYLE_TYPE, +} from '@kite9/fdc3-schema/dist/generated/api/BrowserTypes'; -type Fdc3UserInterfaceHello = BrowserTypes.Fdc3UserInterfaceHello -type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake +type Fdc3UserInterfaceHello = BrowserTypes.Fdc3UserInterfaceHello; +type WebConnectionProtocol3Handshake = BrowserTypes.WebConnectionProtocol3Handshake; /** * This handles the frame communications when we're using the embedded iframe approach */ export function handleEmbeddedIframeComms(value: string, parent: MockWindow, cw: CustomWorld) { - const paramStr = value.substring(EMBED_URL.length + 1) - const params = new URLSearchParams(paramStr) - const connectionAttemptUuid = params.get("connectionAttemptUuid")!! - const connection = cw.mockContext.getFirstInstance() - try { - parent.postMessage({ - type: "WCP3Handshake", - meta: { - connectionAttemptUuid: connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - fdc3Version: "2.2", - intentResolverUrl: INTENT_RESOLVER_URL, - channelSelectorUrl: CHANNEL_SELECTOR_URL, - } - } as WebConnectionProtocol3Handshake, EMBED_URL, [connection!!.externalPort]) - } catch (e) { - console.error(e) - } + const paramStr = value.substring(EMBED_URL.length + 1); + const params = new URLSearchParams(paramStr); + const connectionAttemptUuid = params.get('connectionAttemptUuid')!!; + const connection = cw.mockContext.getFirstInstance(); + try { + parent.postMessage( + { + type: 'WCP3Handshake', + meta: { + connectionAttemptUuid: connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + fdc3Version: '2.2', + intentResolverUrl: INTENT_RESOLVER_URL, + channelSelectorUrl: CHANNEL_SELECTOR_URL, + }, + } as WebConnectionProtocol3Handshake, + EMBED_URL, + [connection!!.externalPort] + ); + } catch (e) { + console.error(e); + } } -export function handleChannelSelectorComms(_value: string, parent: MockWindow, source: Window, cw: CustomWorld): MessageChannel { - const connection = new MessageChannel(); - try { - parent.dispatchEvent({ - type: "message", - data: { - type: FDC3_USER_INTERFACE_HELLO_TYPE, - payload: { - initialCSS: { - "width": "100px" - } - } - } as Fdc3UserInterfaceHello, - origin: CHANNEL_SELECTOR_URL, - source, - ports: [connection.port1] - } as any as Event) +export function handleChannelSelectorComms( + _value: string, + parent: MockWindow, + source: Window, + cw: CustomWorld +): MessageChannel { + const connection = new MessageChannel(); + try { + parent.dispatchEvent({ + type: 'message', + data: { + type: FDC3_USER_INTERFACE_HELLO_TYPE, + payload: { + initialCSS: { + width: '100px', + }, + }, + } as Fdc3UserInterfaceHello, + origin: CHANNEL_SELECTOR_URL, + source, + ports: [connection.port1], + } as any as Event); + connection.port2.onmessage = e => { + if (e.data.type == FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { + setTimeout(() => { + connection.port2.postMessage({ + type: FDC3_USER_INTERFACE_RESTYLE_TYPE, + payload: { + css: { + width: '100px', + }, + }, + }); + }, 100); + } + cw.props['lastChannelSelectorMessage'] = e.data; + }; + } catch (e) { + console.error(e); + } - connection.port2.onmessage = (e) => { - if (e.data.type == FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { - setTimeout(() => { - connection.port2.postMessage({ - type: FDC3_USER_INTERFACE_RESTYLE_TYPE, - payload: { - css: { - "width": "100px" - } - } - }) - }, 100) - } - cw.props['lastChannelSelectorMessage'] = e.data - } - } catch (e) { - console.error(e) - } - - return connection + return connection; } -export function handleIntentResolverComms(_value: string, parent: MockWindow, source: Window, cw: CustomWorld): MessageChannel { - const connection = new MessageChannel(); - try { - parent.dispatchEvent({ - type: "message", - data: { - type: FDC3_USER_INTERFACE_HELLO_TYPE, - payload: { - initialCSS: { - "width": "100px" - } - } - } as Fdc3UserInterfaceHello, - origin: INTENT_RESOLVER_URL, - source, - ports: [connection.port1] - } as any as Event) +export function handleIntentResolverComms( + _value: string, + parent: MockWindow, + source: Window, + cw: CustomWorld +): MessageChannel { + const connection = new MessageChannel(); + try { + parent.dispatchEvent({ + type: 'message', + data: { + type: FDC3_USER_INTERFACE_HELLO_TYPE, + payload: { + initialCSS: { + width: '100px', + }, + }, + } as Fdc3UserInterfaceHello, + origin: INTENT_RESOLVER_URL, + source, + ports: [connection.port1], + } as any as Event); - connection.port2.onmessage = (e) => { - if (e.type == FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { - setTimeout(() => { - connection.port2.postMessage({ - type: FDC3_USER_INTERFACE_RESTYLE_TYPE, - payload: { - css: { - "width": "100px" - } - } - }) - }, 100) - } + connection.port2.onmessage = e => { + if (e.type == FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { + setTimeout(() => { + connection.port2.postMessage({ + type: FDC3_USER_INTERFACE_RESTYLE_TYPE, + payload: { + css: { + width: '100px', + }, + }, + }); + }, 100); + } - cw.props['lastIntentResolverMessage'] = e - } - } catch (e) { - console.error(e) - } + cw.props['lastIntentResolverMessage'] = e; + }; + } catch (e) { + console.error(e); + } - return connection -} \ No newline at end of file + return connection; +} diff --git a/packages/fdc3-get-agent/test/support/MockCSSStyleDeclaration.ts b/packages/fdc3-get-agent/test/support/MockCSSStyleDeclaration.ts index 0a241c3f7..1b82eef10 100644 --- a/packages/fdc3-get-agent/test/support/MockCSSStyleDeclaration.ts +++ b/packages/fdc3-get-agent/test/support/MockCSSStyleDeclaration.ts @@ -1,10 +1,9 @@ export class MockCSSStyleDeclaration { + setProperty(name: string, value: string) { + (this as any)[name] = value; + } - setProperty(name: string, value: string) { - (this as any)[name] = value; - } - - removeProperty(name: string) { - delete (this as any)[name]; - } + removeProperty(name: string) { + delete (this as any)[name]; + } } diff --git a/packages/fdc3-get-agent/test/support/MockDocument.ts b/packages/fdc3-get-agent/test/support/MockDocument.ts index 94cff4fde..2e69e69c7 100644 --- a/packages/fdc3-get-agent/test/support/MockDocument.ts +++ b/packages/fdc3-get-agent/test/support/MockDocument.ts @@ -1,36 +1,35 @@ -import { MockWindow } from "./MockWindow" -import { MockIFrame } from "./MockIFrame" -import { MockElement } from "./MockElement" +import { MockWindow } from './MockWindow'; +import { MockIFrame } from './MockIFrame'; +import { MockElement } from './MockElement'; export class MockDocument { + name: string; + window: MockWindow; + iframes: MockIFrame[] = []; - name: string - window: MockWindow - iframes: MockIFrame[] = [] + constructor(name: string, window: MockWindow) { + this.name = name; + this.window = window; + } - constructor(name: string, window: MockWindow) { - this.name = name - this.window = window + createElement(tag: string): HTMLElement { + if (tag == 'iframe') { + const mw = new MockIFrame('iframe', this.window.cw, this.window, 'embedded-iframe'); + this.iframes.push(mw); + return mw as any; + } else { + return new MockElement(tag) as any; } + } - createElement(tag: string): HTMLElement { - if (tag == 'iframe') { - const mw = new MockIFrame("iframe", this.window.cw, this.window, "embedded-iframe") - this.iframes.push(mw) - return mw as any - } else { - return new MockElement(tag) as any - } - } - - getElementById(_id: string): HTMLElement | null { - return new MockElement("div") as any - } + getElementById(_id: string): HTMLElement | null { + return new MockElement('div') as any; + } - body = new MockElement("body") + body = new MockElement('body'); - shutdown() { - this.window.shutdown() - this.iframes.forEach(i => i.shutdown()) - } -} \ No newline at end of file + shutdown() { + this.window.shutdown(); + this.iframes.forEach(i => i.shutdown()); + } +} diff --git a/packages/fdc3-get-agent/test/support/MockElement.ts b/packages/fdc3-get-agent/test/support/MockElement.ts index c8a81b276..00c313f73 100644 --- a/packages/fdc3-get-agent/test/support/MockElement.ts +++ b/packages/fdc3-get-agent/test/support/MockElement.ts @@ -1,34 +1,31 @@ -import { MockCSSStyleDeclaration } from "./MockCSSStyleDeclaration"; - +import { MockCSSStyleDeclaration } from './MockCSSStyleDeclaration'; export class MockElement { + tag: string; + atts: { [name: string]: any } = {}; + children: HTMLElement[] = []; - tag: string; - atts: { [name: string]: any; } = {}; - children: HTMLElement[] = []; - - constructor(tag: string) { - this.tag = tag; - } + constructor(tag: string) { + this.tag = tag; + } - style = new MockCSSStyleDeclaration(); + style = new MockCSSStyleDeclaration(); - setAttribute(name: string, value: string) { - this.atts[name] = value; - } + setAttribute(name: string, value: string) { + this.atts[name] = value; + } - removeAttribute(name: string) { - delete this.atts[name]; - } + removeAttribute(name: string) { + delete this.atts[name]; + } - appendChild(child: HTMLElement) { - this.children.push(child); - } + appendChild(child: HTMLElement) { + this.children.push(child); + } - removeChild(child: HTMLElement) { - this.children.splice(this.children.indexOf(child), 1); - } + removeChild(child: HTMLElement) { + this.children.splice(this.children.indexOf(child), 1); + } - remove() { - } + remove() {} } diff --git a/packages/fdc3-get-agent/test/support/MockFDC3Server.ts b/packages/fdc3-get-agent/test/support/MockFDC3Server.ts index ab7c93c3d..04f724ebd 100644 --- a/packages/fdc3-get-agent/test/support/MockFDC3Server.ts +++ b/packages/fdc3-get-agent/test/support/MockFDC3Server.ts @@ -1,111 +1,104 @@ -import { FDC3Server } from "@kite9/fdc3-web-impl" -import { TestServerContext } from "./TestServerContext" -import { MockWindow } from "./MockWindow" -import { AutomaticResponse } from "./responses/AutomaticResponses" -import { FindIntent } from "./responses/FindIntent" -import { RaiseIntent } from "./responses/RaiseIntent" -import { Handshake } from "./responses/Handshake" -import { UserChannels } from "./responses/UserChannels" -import { CurrentChannel } from "./responses/CurrentChannel" -import { BrowserTypes } from "@kite9/fdc3-schema" +import { FDC3Server } from '@kite9/fdc3-web-impl'; +import { TestServerContext } from './TestServerContext'; +import { MockWindow } from './MockWindow'; +import { AutomaticResponse } from './responses/AutomaticResponses'; +import { FindIntent } from './responses/FindIntent'; +import { RaiseIntent } from './responses/RaiseIntent'; +import { Handshake } from './responses/Handshake'; +import { UserChannels } from './responses/UserChannels'; +import { CurrentChannel } from './responses/CurrentChannel'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type AppRequestMessage = BrowserTypes.AppRequestMessage -type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL +type AppRequestMessage = BrowserTypes.AppRequestMessage; +type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL; -export const dummyInstanceId = { appId: "Test App Id", instanceId: "1" } +export const dummyInstanceId = { appId: 'Test App Id', instanceId: '1' }; -export const EMBED_URL = "http://localhost:8080/static/da/embed.html" +export const EMBED_URL = 'http://localhost:8080/static/da/embed.html'; -export const CHANNEL_SELECTOR_URL = "https://mock.fdc3.com/channelSelector" +export const CHANNEL_SELECTOR_URL = 'https://mock.fdc3.com/channelSelector'; -export const INTENT_RESOLVER_URL = "https://mock.fdc3.com/resolver" +export const INTENT_RESOLVER_URL = 'https://mock.fdc3.com/resolver'; export class MockFDC3Server implements FDC3Server { - - private useIframe: boolean - private window: MockWindow - private tsc: TestServerContext - - readonly automaticResponses: AutomaticResponse[] = [ - new FindIntent(), - new RaiseIntent(), - new Handshake(), - new UserChannels(), - new CurrentChannel() - ] - - constructor(window: MockWindow, useIframe: boolean, ctx: TestServerContext) { - this.useIframe = useIframe - this.window = window - this.tsc = ctx - this.init() - } - - receive(message: AppRequestMessage, from: string): void { - this.automaticResponses.forEach((r) => { - if (r.filter(message.type)) { - r.action(message, this.tsc, from) - } - }) - } - - shutdown() { - this.tsc.shutdown() - } - - init() { - this.window.addEventListener( - "message", - (e) => { - const event = e as MessageEvent - const data = event.data; - const source = event.source as Window - const origin = event.origin; - - if (data.type !== "WCP1Hello") { - return - } - - // Using an iframe - if (this.useIframe) { - const message: WebConnectionProtocol2LoadURL = { - type: "WCP2LoadUrl", - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - iframeUrl: EMBED_URL + "?connectionAttemptUuid=" + data.meta.connectionAttemptUuid - } - } - source.postMessage(message, origin) - return - } - - // Not using an iframe - const details = this.tsc.getMatchingInstance(data.payload.identityUrl) - - if(!details){ - throw new Error("Unable to find the matching instance. Handshake can not complete without other hand.") - } - - const message = { - type: "WCP3Handshake", - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - fdc3Version: "2.2", - intentResolverUrl: INTENT_RESOLVER_URL, - channelSelectorUrl: CHANNEL_SELECTOR_URL, - } - } - source.postMessage(message, origin, [details.externalPort]) - } - ); - } + private useIframe: boolean; + private window: MockWindow; + private tsc: TestServerContext; + + readonly automaticResponses: AutomaticResponse[] = [ + new FindIntent(), + new RaiseIntent(), + new Handshake(), + new UserChannels(), + new CurrentChannel(), + ]; + + constructor(window: MockWindow, useIframe: boolean, ctx: TestServerContext) { + this.useIframe = useIframe; + this.window = window; + this.tsc = ctx; + this.init(); + } + + receive(message: AppRequestMessage, from: string): void { + this.automaticResponses.forEach(r => { + if (r.filter(message.type)) { + r.action(message, this.tsc, from); + } + }); + } + + shutdown() { + this.tsc.shutdown(); + } + + init() { + this.window.addEventListener('message', e => { + const event = e as MessageEvent; + const data = event.data; + const source = event.source as Window; + const origin = event.origin; + + if (data.type !== 'WCP1Hello') { + return; + } + + // Using an iframe + if (this.useIframe) { + const message: WebConnectionProtocol2LoadURL = { + type: 'WCP2LoadUrl', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + iframeUrl: EMBED_URL + '?connectionAttemptUuid=' + data.meta.connectionAttemptUuid, + }, + }; + source.postMessage(message, origin); + return; + } + + // Not using an iframe + const details = this.tsc.getMatchingInstance(data.payload.identityUrl); + + if (!details) { + throw new Error('Unable to find the matching instance. Handshake can not complete without other hand.'); + } + + const message = { + type: 'WCP3Handshake', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + fdc3Version: '2.2', + intentResolverUrl: INTENT_RESOLVER_URL, + channelSelectorUrl: CHANNEL_SELECTOR_URL, + }, + }; + source.postMessage(message, origin, [details.externalPort]); + }); + } } - - - diff --git a/packages/fdc3-get-agent/test/support/MockIFrame.ts b/packages/fdc3-get-agent/test/support/MockIFrame.ts index 7b852e74b..db9f7db29 100644 --- a/packages/fdc3-get-agent/test/support/MockIFrame.ts +++ b/packages/fdc3-get-agent/test/support/MockIFrame.ts @@ -1,42 +1,41 @@ -import { CustomWorld } from "../world"; -import { handleEmbeddedIframeComms, handleChannelSelectorComms, handleIntentResolverComms } from "./FrameTypes"; -import { EMBED_URL, CHANNEL_SELECTOR_URL, INTENT_RESOLVER_URL } from "./MockFDC3Server"; -import { MockWindow } from "./MockWindow"; +import { CustomWorld } from '../world'; +import { handleEmbeddedIframeComms, handleChannelSelectorComms, handleIntentResolverComms } from './FrameTypes'; +import { EMBED_URL, CHANNEL_SELECTOR_URL, INTENT_RESOLVER_URL } from './MockFDC3Server'; +import { MockWindow } from './MockWindow'; export class MockIFrame extends MockWindow { + contentWindow: Window; + messageChannels: MessageChannel[] = []; - contentWindow: Window; - messageChannels: MessageChannel[] = []; + constructor(tag: string, cw: CustomWorld, parent: MockWindow, name: string) { + super(tag, cw, name); + this.parent = parent; + this.contentWindow = this as any; + } - constructor(tag: string, cw: CustomWorld, parent: MockWindow, name: string) { - super(tag, cw, name); - this.parent = parent; - this.contentWindow = this as any; - } - - setAttribute(name: string, value: string): void { - this.atts[name] = value; - const parent = this.parent as MockWindow; + setAttribute(name: string, value: string): void { + this.atts[name] = value; + const parent = this.parent as MockWindow; - if (name == 'src') { - if (value.startsWith(EMBED_URL)) { - this.name = "embedded-iframe"; - handleEmbeddedIframeComms(value, parent, this.cw); - } else if (value.startsWith(CHANNEL_SELECTOR_URL)) { - this.name = "channel-selector"; - this.messageChannels.push(handleChannelSelectorComms(value, parent, this.contentWindow, this.cw)); - } else if (value.startsWith(INTENT_RESOLVER_URL)) { - this.name = "intent-resolver"; - this.messageChannels.push(handleIntentResolverComms(value, parent, this.contentWindow, this.cw)); - } - } + if (name == 'src') { + if (value.startsWith(EMBED_URL)) { + this.name = 'embedded-iframe'; + handleEmbeddedIframeComms(value, parent, this.cw); + } else if (value.startsWith(CHANNEL_SELECTOR_URL)) { + this.name = 'channel-selector'; + this.messageChannels.push(handleChannelSelectorComms(value, parent, this.contentWindow, this.cw)); + } else if (value.startsWith(INTENT_RESOLVER_URL)) { + this.name = 'intent-resolver'; + this.messageChannels.push(handleIntentResolverComms(value, parent, this.contentWindow, this.cw)); + } } + } - shutdown() { - super.shutdown(); - this.messageChannels.forEach(mc => { - mc.port1.close(); - mc.port2.close(); - }); - } + shutdown() { + super.shutdown(); + this.messageChannels.forEach(mc => { + mc.port1.close(); + mc.port2.close(); + }); + } } diff --git a/packages/fdc3-get-agent/test/support/MockStorage.ts b/packages/fdc3-get-agent/test/support/MockStorage.ts index 419293fb9..c9acd27f2 100644 --- a/packages/fdc3-get-agent/test/support/MockStorage.ts +++ b/packages/fdc3-get-agent/test/support/MockStorage.ts @@ -1,28 +1,27 @@ export class MockStorage implements Storage { + private store: { [key: string]: string } = {}; - private store: { [key: string]: string } = {} + get length(): number { + return Object.keys(this.store).length; + } - get length(): number { - return Object.keys(this.store).length - } + clear(): void { + this.store = {}; + } - clear(): void { - this.store = {} - } + getItem(key: string): string | null { + return this.store[key] || null; + } - getItem(key: string): string | null { - return this.store[key] || null - } + key(index: number): string | null { + return Object.keys(this.store)[index] || null; + } - key(index: number): string | null { - return Object.keys(this.store)[index] || null - } + removeItem(key: string): void { + delete this.store[key]; + } - removeItem(key: string): void { - delete this.store[key] - } - - setItem(key: string, value: string): void { - this.store[key] = value - } -} \ No newline at end of file + setItem(key: string, value: string): void { + this.store[key] = value; + } +} diff --git a/packages/fdc3-get-agent/test/support/MockWindow.ts b/packages/fdc3-get-agent/test/support/MockWindow.ts index e8c48b308..feb5dd4cd 100644 --- a/packages/fdc3-get-agent/test/support/MockWindow.ts +++ b/packages/fdc3-get-agent/test/support/MockWindow.ts @@ -1,69 +1,68 @@ -import { DesktopAgent } from "@kite9/fdc3-standard"; -import { CustomWorld } from "../world"; -import { EventHandler } from "./EventHandler"; -import { MockElement } from "./MockElement"; +import { DesktopAgent } from '@kite9/fdc3-standard'; +import { CustomWorld } from '../world'; +import { EventHandler } from './EventHandler'; +import { MockElement } from './MockElement'; /** * Used for routing of post-message events while running tests */ export class MockWindow extends MockElement { + fdc3: DesktopAgent | undefined; + cw: CustomWorld; + name: string; - fdc3: DesktopAgent | undefined; - cw: CustomWorld; - name: string; + constructor(tag: string, cw: CustomWorld, name: string) { + super(tag); + this.cw = cw; + this.name = name; + } - constructor(tag: string, cw: CustomWorld, name: string) { - super(tag); - this.cw = cw; - this.name = name; - } + eventHandlers: EventHandler[] = []; + events: any[] = []; - eventHandlers: EventHandler[] = []; - events: any[] = []; + parent: MockWindow | null = null; - parent: MockWindow | null = null; + location = { + origin: 'https://dummyOrigin.test', + href: 'https://dummyOrigin.test/path', + }; - location = { - origin: "https://dummyOrigin.test", - href: "https://dummyOrigin.test/path" - }; + addEventListener(type: string, callback: (e: Event) => void): void { + this.eventHandlers.push({ type, callback }); + } - addEventListener(type: string, callback: (e: Event) => void): void { - this.eventHandlers.push({ type, callback }); + removeEventListener(type: string, el: EventListener): void { + const removeIndex = this.eventHandlers.findIndex(e => e.type === type && e.callback === el); + if (removeIndex !== -1) { + this.eventHandlers.splice(removeIndex, 1); } + } - removeEventListener(type: string, el: EventListener): void { - const removeIndex = this.eventHandlers.findIndex(e => e.type === type && e.callback === el); - if (removeIndex !== -1) { - this.eventHandlers.splice(removeIndex, 1); - } - } + dispatchEvent(event: Event): void { + this.events.push({ type: event.type, data: (event as any).data }); + this.eventHandlers.forEach(e => { + if (e.type === event.type) { + e.callback(event); + } + }); + } - dispatchEvent(event: Event): void { - this.events.push({ type: event.type, data: (event as any).data }); - this.eventHandlers.forEach((e) => { - if (e.type === event.type) { - e.callback(event); - } - }); - } - - postMessage(msg: object, targetOrigin: string, transfer: MessagePort[] | undefined): void { - this.dispatchEvent({ - type: 'message', - data: msg, - origin: targetOrigin, - ports: transfer, - source: this.parent ?? this // when posting from client, set source to self - } as any); - } + postMessage(msg: object, targetOrigin: string, transfer: MessagePort[] | undefined): void { + this.dispatchEvent({ + type: 'message', + data: msg, + origin: targetOrigin, + ports: transfer, + source: this.parent ?? this, // when posting from client, set source to self + } as any); + } - shutdown() { - this.eventHandlers = []; - this.fdc3 = undefined; - if (this.cw.mockFDC3Server) { - this.cw.mockFDC3Server.shutdown(); - } + shutdown() { + this.eventHandlers = []; + this.fdc3 = undefined; + if (this.cw.mockFDC3Server) { + this.cw.mockFDC3Server.shutdown(); } + } } diff --git a/packages/fdc3-get-agent/test/support/TestServerContext.ts b/packages/fdc3-get-agent/test/support/TestServerContext.ts index bd97f59fe..634722d0f 100644 --- a/packages/fdc3-get-agent/test/support/TestServerContext.ts +++ b/packages/fdc3-get-agent/test/support/TestServerContext.ts @@ -1,156 +1,156 @@ -import { ServerContext, InstanceID } from '@kite9/fdc3-web-impl' -import { CustomWorld } from '../world' -import { Context } from '@kite9/fdc3-context' -import { OpenError, AppIdentifier, AppIntent } from '@kite9/fdc3-standard' -import { AppRegistration, State } from '@kite9/fdc3-web-impl' +import { ServerContext, InstanceID } from '@kite9/fdc3-web-impl'; +import { CustomWorld } from '../world'; +import { Context } from '@kite9/fdc3-context'; +import { OpenError, AppIdentifier, AppIntent } from '@kite9/fdc3-standard'; +import { AppRegistration, State } from '@kite9/fdc3-web-impl'; type ConnectionDetails = AppRegistration & { - msg?: object - connectionId: string, - externalPort: MessagePort, - internalPort: MessagePort, - url: string -} + msg?: object; + connectionId: string; + externalPort: MessagePort; + internalPort: MessagePort; + url: string; +}; type MessageRecord = { - to?: AppIdentifier, - uuid?: InstanceID, - msg: object -} + to?: AppIdentifier; + uuid?: InstanceID; + msg: object; +}; export class TestServerContext implements ServerContext { - - public postedMessages: MessageRecord[] = [] - private readonly cw: CustomWorld - private instances: ConnectionDetails[] = [] - private nextInstanceId: number = 0 - private nextUUID: number = 0 - - constructor(cw: CustomWorld) { - this.cw = cw - } - - async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { - return appIntents - } - - getInstanceDetails(uuid: string) { - return this.instances.find(ca => ca.instanceId === uuid) - } - - setInstanceDetails(uuid: InstanceID, appId: ConnectionDetails) { - this.instances = this.instances.filter(ca => ca.connectionId !== uuid) - this.instances.push({ - ...appId, - connectionId: uuid - }) - } - - getMatchingInstance(url: string): ConnectionDetails | undefined { - return this.instances.find(ca => ca.url === url) - } - - async shutdown(): Promise { - await Promise.all(this.instances.map(i => i.internalPort.close())) - await Promise.all(this.instances.map(i => i.externalPort.close())) - } - - async open(appId: string): Promise { - const ni = this.nextInstanceId++ - if (appId.includes("missing")) { - throw new Error(OpenError.AppNotFound) - } else { - const mc = new MessageChannel() - const internalPort = mc.port1 - const externalPort = mc.port2; - - (internalPort as any).name = "internalPort-" + ni; - (externalPort as any).name = "externalPort-" + ni; - - internalPort.start() - - const connectionDetails = { - appId, - instanceId: "uuid-" + ni, - connected: false, - connectionId: "uuid-" + ni, - externalPort, - internalPort, - url: "https://dummyOrigin.test/path", - state: State.Pending - } - - this.instances.push(connectionDetails) - internalPort.onmessage = (msg) => { - console.debug(`Received message on internalPort`, appId, msg.data) - this.cw.mockFDC3Server?.receive(msg.data, connectionDetails.instanceId) - } - - return connectionDetails.connectionId - } - } - - async getConnectedApps(): Promise { - return (await this.getAllApps()).filter(ca => ca.state == State.Connected) - } - - async isAppConnected(app: InstanceID): Promise { - const found = this.instances.find(a => (a.instanceId == app) && (a.state == State.Connected)) - return found != null - } - - async setAppState(app: InstanceID, state: State): Promise { - const found = this.instances.find(a => (a.instanceId == app)) - if (found) { - found.state = state - } - } - async getAllApps(): Promise { - return this.instances.map(x => { - return { - appId: x.appId, - instanceId: x.instanceId, - state: x.state - } - }) - } - - provider(): string { - return "cucumber-provider" - } - providerVersion(): string { - return "1.2.3.TEST" - } - fdc3Version(): string { - return "2.0" - } - - createUUID(): string { - return "uuid" + this.nextUUID++ - } - - /** - * USED FOR TESTING - */ - getInstanceUUID(appId: AppIdentifier): InstanceID | undefined { - return this.instances.find(ca => (ca.appId == appId.appId) && (ca.instanceId == appId.instanceId) && (ca.state == State.Connected))?.instanceId - } - - /** - * USED FOR TESTING - */ - getFirstInstance() { - return this.instances[0] - } - - post(msg: object, to: InstanceID): Promise { - const details = this.getInstanceDetails(to) - details?.internalPort.postMessage(msg) - return Promise.resolve(); - } - - log(message: string): void { - this.cw.log(message) - } - -} \ No newline at end of file + public postedMessages: MessageRecord[] = []; + private readonly cw: CustomWorld; + private instances: ConnectionDetails[] = []; + private nextInstanceId: number = 0; + private nextUUID: number = 0; + + constructor(cw: CustomWorld) { + this.cw = cw; + } + + async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { + return appIntents; + } + + getInstanceDetails(uuid: string) { + return this.instances.find(ca => ca.instanceId === uuid); + } + + setInstanceDetails(uuid: InstanceID, appId: ConnectionDetails) { + this.instances = this.instances.filter(ca => ca.connectionId !== uuid); + this.instances.push({ + ...appId, + connectionId: uuid, + }); + } + + getMatchingInstance(url: string): ConnectionDetails | undefined { + return this.instances.find(ca => ca.url === url); + } + + async shutdown(): Promise { + await Promise.all(this.instances.map(i => i.internalPort.close())); + await Promise.all(this.instances.map(i => i.externalPort.close())); + } + + async open(appId: string): Promise { + const ni = this.nextInstanceId++; + if (appId.includes('missing')) { + throw new Error(OpenError.AppNotFound); + } else { + const mc = new MessageChannel(); + const internalPort = mc.port1; + const externalPort = mc.port2; + + (internalPort as any).name = 'internalPort-' + ni; + (externalPort as any).name = 'externalPort-' + ni; + + internalPort.start(); + + const connectionDetails = { + appId, + instanceId: 'uuid-' + ni, + connected: false, + connectionId: 'uuid-' + ni, + externalPort, + internalPort, + url: 'https://dummyOrigin.test/path', + state: State.Pending, + }; + + this.instances.push(connectionDetails); + internalPort.onmessage = msg => { + console.debug(`Received message on internalPort`, appId, msg.data); + this.cw.mockFDC3Server?.receive(msg.data, connectionDetails.instanceId); + }; + + return connectionDetails.connectionId; + } + } + + async getConnectedApps(): Promise { + return (await this.getAllApps()).filter(ca => ca.state == State.Connected); + } + + async isAppConnected(app: InstanceID): Promise { + const found = this.instances.find(a => a.instanceId == app && a.state == State.Connected); + return found != null; + } + + async setAppState(app: InstanceID, state: State): Promise { + const found = this.instances.find(a => a.instanceId == app); + if (found) { + found.state = state; + } + } + async getAllApps(): Promise { + return this.instances.map(x => { + return { + appId: x.appId, + instanceId: x.instanceId, + state: x.state, + }; + }); + } + + provider(): string { + return 'cucumber-provider'; + } + providerVersion(): string { + return '1.2.3.TEST'; + } + fdc3Version(): string { + return '2.0'; + } + + createUUID(): string { + return 'uuid' + this.nextUUID++; + } + + /** + * USED FOR TESTING + */ + getInstanceUUID(appId: AppIdentifier): InstanceID | undefined { + return this.instances.find( + ca => ca.appId == appId.appId && ca.instanceId == appId.instanceId && ca.state == State.Connected + )?.instanceId; + } + + /** + * USED FOR TESTING + */ + getFirstInstance() { + return this.instances[0]; + } + + post(msg: object, to: InstanceID): Promise { + const details = this.getInstanceDetails(to); + details?.internalPort.postMessage(msg); + return Promise.resolve(); + } + + log(message: string): void { + this.cw.log(message); + } +} diff --git a/packages/fdc3-get-agent/test/support/responses/AutomaticResponses.ts b/packages/fdc3-get-agent/test/support/responses/AutomaticResponses.ts index 1b218ad15..377189edf 100644 --- a/packages/fdc3-get-agent/test/support/responses/AutomaticResponses.ts +++ b/packages/fdc3-get-agent/test/support/responses/AutomaticResponses.ts @@ -1,10 +1,7 @@ -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { TestServerContext } from "../TestServerContext"; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { TestServerContext } from '../TestServerContext'; export interface AutomaticResponse { - - filter: (t: string) => boolean, - action: (input: object, m: TestServerContext, from: InstanceID) => Promise - + filter: (t: string) => boolean; + action: (input: object, m: TestServerContext, from: InstanceID) => Promise; } - diff --git a/packages/fdc3-get-agent/test/support/responses/CurrentChannel.ts b/packages/fdc3-get-agent/test/support/responses/CurrentChannel.ts index 7b75c361a..bcca01df8 100644 --- a/packages/fdc3-get-agent/test/support/responses/CurrentChannel.ts +++ b/packages/fdc3-get-agent/test/support/responses/CurrentChannel.ts @@ -1,31 +1,30 @@ -import { TestServerContext } from "../TestServerContext"; -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { AutomaticResponse } from "./AutomaticResponses"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest -type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse +import { TestServerContext } from '../TestServerContext'; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { AutomaticResponse } from './AutomaticResponses'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest; +type GetCurrentChannelResponse = BrowserTypes.GetCurrentChannelResponse; export class CurrentChannel implements AutomaticResponse { + filter(t: string) { + return t == 'getCurrentChannelRequest'; + } - filter(t: string) { - return t == 'getCurrentChannelRequest' - } + action(input: object, m: TestServerContext, from: InstanceID) { + const out = this.createResponse(input as GetCurrentChannelRequest, m); + setTimeout(() => { + m.post(out, from); + }, 100); + return Promise.resolve(); + } - action(input: object, m: TestServerContext, from: InstanceID) { - const out = this.createResponse(input as GetCurrentChannelRequest, m) - setTimeout(() => { m.post(out, from) }, 100) - return Promise.resolve() - } - - private createResponse(i: GetCurrentChannelRequest, m: TestServerContext): GetCurrentChannelResponse { - return { - meta: { - ...i.meta, - responseUuid: m.createUUID(), - }, - type: "getCurrentChannelResponse", - payload: { - - } - } - } -} \ No newline at end of file + private createResponse(i: GetCurrentChannelRequest, m: TestServerContext): GetCurrentChannelResponse { + return { + meta: { + ...i.meta, + responseUuid: m.createUUID(), + }, + type: 'getCurrentChannelResponse', + payload: {}, + }; + } +} diff --git a/packages/fdc3-get-agent/test/support/responses/FindIntent.ts b/packages/fdc3-get-agent/test/support/responses/FindIntent.ts index add45bc04..3af48e888 100644 --- a/packages/fdc3-get-agent/test/support/responses/FindIntent.ts +++ b/packages/fdc3-get-agent/test/support/responses/FindIntent.ts @@ -1,43 +1,44 @@ -import { TestServerContext } from "../TestServerContext"; -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { AutomaticResponse } from "./AutomaticResponses"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { TestServerContext } from '../TestServerContext'; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { AutomaticResponse } from './AutomaticResponses'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type FindIntentRequest = BrowserTypes.FindIntentRequest -type FindIntentResponse = BrowserTypes.FindIntentResponse +type FindIntentRequest = BrowserTypes.FindIntentRequest; +type FindIntentResponse = BrowserTypes.FindIntentResponse; export class FindIntent implements AutomaticResponse { + filter(t: string) { + return t == 'findIntentRequest'; + } - filter(t: string) { - return t == 'findIntentRequest' - } + action(input: object, m: TestServerContext, from: InstanceID) { + const intentRequest = input as FindIntentRequest; + const request = this.createFindIntentResponseMessage(intentRequest); + setTimeout(() => { + m.post(request, from); + }, 100); + return Promise.resolve(); + } - action(input: object, m: TestServerContext, from: InstanceID) { - const intentRequest = input as FindIntentRequest - const request = this.createFindIntentResponseMessage(intentRequest) - setTimeout(() => { m.post(request, from) }, 100) - return Promise.resolve() - } - - private createFindIntentResponseMessage(m: FindIntentRequest): FindIntentResponse { - return { - meta: m.meta as any, - type: "findIntentResponse", - payload: { - appIntent: { - intent: m.payload.intent, - apps: [ - { - appId: 'test-app-1', - name: 'Test App 1', - }, - { - appId: 'test-app-2', - name: 'Test App 2', - } - ] - } - } - } as any - } -} \ No newline at end of file + private createFindIntentResponseMessage(m: FindIntentRequest): FindIntentResponse { + return { + meta: m.meta as any, + type: 'findIntentResponse', + payload: { + appIntent: { + intent: m.payload.intent, + apps: [ + { + appId: 'test-app-1', + name: 'Test App 1', + }, + { + appId: 'test-app-2', + name: 'Test App 2', + }, + ], + }, + }, + } as any; + } +} diff --git a/packages/fdc3-get-agent/test/support/responses/Handshake.ts b/packages/fdc3-get-agent/test/support/responses/Handshake.ts index c65517839..e012afd84 100644 --- a/packages/fdc3-get-agent/test/support/responses/Handshake.ts +++ b/packages/fdc3-get-agent/test/support/responses/Handshake.ts @@ -1,68 +1,73 @@ -import { TestServerContext } from "../TestServerContext"; -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { AutomaticResponse } from "./AutomaticResponses"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { TestServerContext } from '../TestServerContext'; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { AutomaticResponse } from './AutomaticResponses'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity -type WebConnectionProtocol5ValidateAppIdentityFailedResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentityFailedResponse -type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse +type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity; +type WebConnectionProtocol5ValidateAppIdentityFailedResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentityFailedResponse; +type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse; -export const BAD_INSTANCE_ID = "BAD_INSTANCE" +export const BAD_INSTANCE_ID = 'BAD_INSTANCE'; export class Handshake implements AutomaticResponse { + filter(t: string) { + return t == 'WCP4ValidateAppIdentity'; + } - filter(t: string) { - return t == 'WCP4ValidateAppIdentity' - } - - action(input: object, m: TestServerContext, from: InstanceID) { - const out = this.createResponse(input as WebConnectionProtocol4ValidateAppIdentity) + action(input: object, m: TestServerContext, from: InstanceID) { + const out = this.createResponse(input as WebConnectionProtocol4ValidateAppIdentity); - setTimeout(() => { m.post(out, from) }, 100) - return Promise.resolve() - } + setTimeout(() => { + m.post(out, from); + }, 100); + return Promise.resolve(); + } - private createResponse(i: WebConnectionProtocol4ValidateAppIdentity): - WebConnectionProtocol5ValidateAppIdentitySuccessResponse | - WebConnectionProtocol5ValidateAppIdentityFailedResponse { - if (i.payload.instanceUuid == BAD_INSTANCE_ID) { - return { - meta: { - connectionAttemptUuid: i.meta.connectionAttemptUuid, - timestamp: new Date(), - }, - type: "WCP5ValidateAppIdentityFailedResponse", - payload: { - message: "Invalid instance" - } - } - } else { - return { - meta: { - connectionAttemptUuid: i.meta.connectionAttemptUuid, - timestamp: new Date(), - }, - type: "WCP5ValidateAppIdentityResponse", - payload: { - implementationMetadata: { - appMetadata: { - appId: "cucumber-app", - instanceId: "cucumber-instance", - }, - fdc3Version: "2.0", - optionalFeatures: { - DesktopAgentBridging: false, - OriginatingAppMetadata: true, - UserChannelMembershipAPIs: true - }, - provider: "cucumber-provider", - providerVersion: "test" - }, - appId: 'cucumber-app', - instanceId: 'cucumber-instance', - instanceUuid: 'some-instance-uuid', - } - } - } + private createResponse( + i: WebConnectionProtocol4ValidateAppIdentity + ): + | WebConnectionProtocol5ValidateAppIdentitySuccessResponse + | WebConnectionProtocol5ValidateAppIdentityFailedResponse { + if (i.payload.instanceUuid == BAD_INSTANCE_ID) { + return { + meta: { + connectionAttemptUuid: i.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + type: 'WCP5ValidateAppIdentityFailedResponse', + payload: { + message: 'Invalid instance', + }, + }; + } else { + return { + meta: { + connectionAttemptUuid: i.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + type: 'WCP5ValidateAppIdentityResponse', + payload: { + implementationMetadata: { + appMetadata: { + appId: 'cucumber-app', + instanceId: 'cucumber-instance', + }, + fdc3Version: '2.0', + optionalFeatures: { + DesktopAgentBridging: false, + OriginatingAppMetadata: true, + UserChannelMembershipAPIs: true, + }, + provider: 'cucumber-provider', + providerVersion: 'test', + }, + appId: 'cucumber-app', + instanceId: 'cucumber-instance', + instanceUuid: 'some-instance-uuid', + }, + }; } -} \ No newline at end of file + } +} diff --git a/packages/fdc3-get-agent/test/support/responses/RaiseIntent.ts b/packages/fdc3-get-agent/test/support/responses/RaiseIntent.ts index 30e4a09f4..080bc140e 100644 --- a/packages/fdc3-get-agent/test/support/responses/RaiseIntent.ts +++ b/packages/fdc3-get-agent/test/support/responses/RaiseIntent.ts @@ -1,41 +1,41 @@ -import { TestServerContext } from "../TestServerContext"; -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { AutomaticResponse } from "./AutomaticResponses"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest -type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse +import { TestServerContext } from '../TestServerContext'; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { AutomaticResponse } from './AutomaticResponses'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest; +type RaiseIntentResponse = BrowserTypes.RaiseIntentResponse; export class RaiseIntent implements AutomaticResponse { + filter(t: string) { + return t == 'raiseIntentRequest'; + } - filter(t: string) { - return t == 'raiseIntentRequest' - } - - createRaiseIntentAgentResponseMessage(intentRequest: RaiseIntentRequest, m: TestServerContext): RaiseIntentResponse { - const out: RaiseIntentResponse = { - meta: { - ...intentRequest.meta, - responseUuid: m.createUUID() - }, - payload: { - intentResolution: { - intent: intentRequest.payload.intent, - source: intentRequest.payload.app!! - } - }, - type: "raiseIntentResponse" - } + createRaiseIntentAgentResponseMessage(intentRequest: RaiseIntentRequest, m: TestServerContext): RaiseIntentResponse { + const out: RaiseIntentResponse = { + meta: { + ...intentRequest.meta, + responseUuid: m.createUUID(), + }, + payload: { + intentResolution: { + intent: intentRequest.payload.intent, + source: intentRequest.payload.app!!, + }, + }, + type: 'raiseIntentResponse', + }; - return out - } + return out; + } - action(input: object, m: TestServerContext, from: InstanceID) { - const intentRequest = input as RaiseIntentRequest - // this sends out the intent resolution - const out1 = this.createRaiseIntentAgentResponseMessage(intentRequest, m) - setTimeout(() => { m.post(out1, from) }, 100) - return Promise.resolve() - } + action(input: object, m: TestServerContext, from: InstanceID) { + const intentRequest = input as RaiseIntentRequest; + // this sends out the intent resolution + const out1 = this.createRaiseIntentAgentResponseMessage(intentRequest, m); + setTimeout(() => { + m.post(out1, from); + }, 100); + return Promise.resolve(); + } } diff --git a/packages/fdc3-get-agent/test/support/responses/UserChannels.ts b/packages/fdc3-get-agent/test/support/responses/UserChannels.ts index 0d4c0fffa..d6d54a805 100644 --- a/packages/fdc3-get-agent/test/support/responses/UserChannels.ts +++ b/packages/fdc3-get-agent/test/support/responses/UserChannels.ts @@ -1,49 +1,50 @@ -import { TestServerContext } from "../TestServerContext"; -import { InstanceID } from "@kite9/fdc3-web-impl"; -import { AutomaticResponse } from "./AutomaticResponses"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { TestServerContext } from '../TestServerContext'; +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { AutomaticResponse } from './AutomaticResponses'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest -type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse +type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest; +type GetUserChannelsResponse = BrowserTypes.GetUserChannelsResponse; export const USER_CHANNELS = [ - { - id: "one", - type: "user" - }, - { - id: "two", - type: "user" - }, - { - id: "three", - type: "user" - } -] as any + { + id: 'one', + type: 'user', + }, + { + id: 'two', + type: 'user', + }, + { + id: 'three', + type: 'user', + }, +] as any; export class UserChannels implements AutomaticResponse { + filter(t: string) { + return t == 'getUserChannelsRequest'; + } - filter(t: string) { - return t == 'getUserChannelsRequest' - } + action(input: object, m: TestServerContext, from: InstanceID) { + const out = this.createResponse(input as GetUserChannelsRequest, m); - action(input: object, m: TestServerContext, from: InstanceID) { - const out = this.createResponse(input as GetUserChannelsRequest, m) + setTimeout(() => { + m.post(out, from); + }, 100); + return Promise.resolve(); + } - setTimeout(() => { m.post(out, from) }, 100) - return Promise.resolve() - } - - private createResponse(i: GetUserChannelsRequest, m: TestServerContext): GetUserChannelsResponse { - return { - meta: { - ...i.meta, - responseUuid: m.createUUID(), - }, - type: "getUserChannelsResponse", - payload: { - userChannels: USER_CHANNELS - } - } - } -} \ No newline at end of file + private createResponse(i: GetUserChannelsRequest, m: TestServerContext): GetUserChannelsResponse { + return { + meta: { + ...i.meta, + responseUuid: m.createUUID(), + }, + type: 'getUserChannelsResponse', + payload: { + userChannels: USER_CHANNELS, + }, + }; + } +} diff --git a/packages/fdc3-get-agent/test/world/index.ts b/packages/fdc3-get-agent/test/world/index.ts index e9daf8dfb..11c7df080 100644 --- a/packages/fdc3-get-agent/test/world/index.ts +++ b/packages/fdc3-get-agent/test/world/index.ts @@ -1,14 +1,12 @@ -import { setWorldConstructor } from "@cucumber/cucumber"; -import { PropsWorld } from "@kite9/testing"; -import { MockFDC3Server } from "../support/MockFDC3Server"; -import { TestServerContext } from "../support/TestServerContext"; +import { setWorldConstructor } from '@cucumber/cucumber'; +import { PropsWorld } from '@kite9/testing'; +import { MockFDC3Server } from '../support/MockFDC3Server'; +import { TestServerContext } from '../support/TestServerContext'; export class CustomWorld extends PropsWorld { + mockFDC3Server: MockFDC3Server | null = null; - mockFDC3Server: MockFDC3Server | null = null - - mockContext: TestServerContext = new TestServerContext(this) - + mockContext: TestServerContext = new TestServerContext(this); } -setWorldConstructor(CustomWorld) \ No newline at end of file +setWorldConstructor(CustomWorld); diff --git a/packages/fdc3-schema/code-generation/generate-type-predicates.ts b/packages/fdc3-schema/code-generation/generate-type-predicates.ts index 77e8d41b1..88f3beb49 100644 --- a/packages/fdc3-schema/code-generation/generate-type-predicates.ts +++ b/packages/fdc3-schema/code-generation/generate-type-predicates.ts @@ -1,14 +1,20 @@ -import { InterfaceDeclaration, KindToNodeMappings, MethodDeclaration, Project, SyntaxKind, TypeAliasDeclaration } from 'ts-morph'; -import print from "message-await" +import { + InterfaceDeclaration, + KindToNodeMappings, + MethodDeclaration, + Project, + SyntaxKind, + TypeAliasDeclaration, +} from 'ts-morph'; +import print from 'message-await'; // open a new project with just BrowserTypes as the only source file const project = new Project(); const sourceFile = project.addSourceFileAtPath('./generated/api/BrowserTypes.ts'); - -const APP_REQUEST_MESSAGE = "AppRequestMessage" -const AGENT_RESPONSE_MESSAGE = "AgentResponseMessage" -const AGENT_EVENT_MESSAGE = "AgentEventMessage" +const APP_REQUEST_MESSAGE = 'AppRequestMessage'; +const AGENT_RESPONSE_MESSAGE = 'AgentResponseMessage'; +const AGENT_EVENT_MESSAGE = 'AgentEventMessage'; /** * We generate the union types and remove the existing interfaces first so that we are not left with a generated type predicate for the removed base interface @@ -30,77 +36,75 @@ function writeMessageUnionTypes() { writeMessageUnion(AGENT_EVENT_MESSAGE, 'EventMessageType', typeAliases); } -function writeMessageUnion(unionName: string, typeUnionName: string, typeAliases: TypeAliasDeclaration[]){ - let awaitMessage = print(`Writing ${unionName} (finding types)`, {spinner: true}); +function writeMessageUnion(unionName: string, typeUnionName: string, typeAliases: TypeAliasDeclaration[]) { + let awaitMessage = print(`Writing ${unionName} (finding types)`, { spinner: true }); - // get the types listed in the types union type - // i.e. look for: export type RequestMessageType = "addContextListenerRequest" | "whatever" - const requestMessageTypeUnion = findUnionType(typeAliases, typeUnionName); - if (requestMessageTypeUnion != null) { - //remove existing type alias - findExisting(unionName, SyntaxKind.TypeAliasDeclaration).forEach(node => node.remove()); + // get the types listed in the types union type + // i.e. look for: export type RequestMessageType = "addContextListenerRequest" | "whatever" + const requestMessageTypeUnion = findUnionType(typeAliases, typeUnionName); + if (requestMessageTypeUnion != null) { + //remove existing type alias + findExisting(unionName, SyntaxKind.TypeAliasDeclaration).forEach(node => node.remove()); - awaitMessage.updateMessage(`Writing ${unionName} (writing union)`, true); + awaitMessage.updateMessage(`Writing ${unionName} (writing union)`, true); - // Write a union type of all interfaces that have a type that extends RequestMessageType - // i.e. export type AppRequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest; - writeUnionType(unionName, requestMessageTypeUnion); - } + // Write a union type of all interfaces that have a type that extends RequestMessageType + // i.e. export type AppRequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest; + writeUnionType(unionName, requestMessageTypeUnion); + } - awaitMessage.complete(true, `Writing ${unionName}`); + awaitMessage.complete(true, `Writing ${unionName}`); } /** * Writes type predicates for all interfaces found that have a matching convert function */ -function writeTypePredicates(){ - let awaitMessage = print(`Writing Type Predicates (finding convert functions)`, {spinner: true}); +function writeTypePredicates() { + let awaitMessage = print(`Writing Type Predicates (finding convert functions)`, { spinner: true }); - // get a list of all conversion functions in the Convert class that return a string - const convert = sourceFile.getClass('Convert'); - const convertFunctions = (convert?.getChildrenOfKind(SyntaxKind.MethodDeclaration) ?? []).filter( - func => func.getReturnType().getText() === 'string' - ); - - awaitMessage.updateMessage(`Writing Type Predicates (finding message interfaces)`, true); + // get a list of all conversion functions in the Convert class that return a string + const convert = sourceFile.getClass('Convert'); + const convertFunctions = (convert?.getChildrenOfKind(SyntaxKind.MethodDeclaration) ?? []).filter( + func => func.getReturnType().getText() === 'string' + ); - //get a list of all interfaces in the file - let messageInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); + awaitMessage.updateMessage(`Writing Type Predicates (finding message interfaces)`, true); - // generate a list of Interfaces that have an associated conversion function - const matchedInterfaces = convertFunctions - .map(func => { - const valueParameter = func.getParameter('value'); + //get a list of all interfaces in the file + let messageInterfaces = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); - const matchingInterface = messageInterfaces.find(interfaceNode => { - /// Find an interface who's name matches the type passed into the value parameter of the convert function - return valueParameter?.getType().getText(valueParameter) === interfaceNode.getName(); - }); + // generate a list of Interfaces that have an associated conversion function + const matchedInterfaces = convertFunctions + .map(func => { + const valueParameter = func.getParameter('value'); - if (matchingInterface != null) { - return { func, matchingInterface }; - } + const matchingInterface = messageInterfaces.find(interfaceNode => { + /// Find an interface who's name matches the type passed into the value parameter of the convert function + return valueParameter?.getType().getText(valueParameter) === interfaceNode.getName(); + }); - return undefined; - }) - .filter(isDefined); + if (matchingInterface != null) { + return { func, matchingInterface }; + } - const allFunctionDeclarations = sourceFile.getChildrenOfKind(SyntaxKind.FunctionDeclaration); + return undefined; + }) + .filter(isDefined); - // write a type predicate for each matched interface - matchedInterfaces.forEach((matched, index) => { + const allFunctionDeclarations = sourceFile.getChildrenOfKind(SyntaxKind.FunctionDeclaration); - awaitMessage.updateMessage(`Writing Type Predicates (${index}/${matchedInterfaces.length})`, true); + // write a type predicate for each matched interface + matchedInterfaces.forEach((matched, index) => { + awaitMessage.updateMessage(`Writing Type Predicates (${index}/${matchedInterfaces.length})`, true); - writeFastPredicate(matched.matchingInterface, allFunctionDeclarations); - writeValidPredicate(matched.matchingInterface, matched.func, allFunctionDeclarations); - writeTypeConstant(matched.matchingInterface); - }); + writeFastPredicate(matched.matchingInterface, allFunctionDeclarations); + writeValidPredicate(matched.matchingInterface, matched.func, allFunctionDeclarations); + writeTypeConstant(matched.matchingInterface); + }); - awaitMessage.complete(true, `Writing Type Predicates`); + awaitMessage.complete(true, `Writing Type Predicates`); } - /** * Looks for a string union type in the form: * export type NAME = "stringOne" | "stringTwo" | "stringThree"; @@ -124,9 +128,9 @@ function findUnionType(typeAliases: TypeAliasDeclaration[], name: string): strin /** * Finds an existing declaration with the given type and name - * @param name - * @param kind - * @returns + * @param name + * @param kind + * @returns */ function findExisting(name: string, kind: T, allDeclarationsOfType?: KindToNodeMappings[T][]) { allDeclarationsOfType = allDeclarationsOfType ?? sourceFile.getChildrenOfKind(kind); @@ -140,10 +144,14 @@ function findExisting(name: string, kind: T, allDeclaratio /** * Writes a type predicate for the given interface using the Convert method declaration - * @param matchingInterface - * @param func + * @param matchingInterface + * @param func */ -function writeValidPredicate(matchingInterface: InterfaceDeclaration, func: MethodDeclaration, allFunctionDeclarations: KindToNodeMappings[SyntaxKind.FunctionDeclaration][]): void { +function writeValidPredicate( + matchingInterface: InterfaceDeclaration, + func: MethodDeclaration, + allFunctionDeclarations: KindToNodeMappings[SyntaxKind.FunctionDeclaration][] +): void { const predicateName = `isValid${matchingInterface.getName()}`; // remove existing instances @@ -165,29 +173,32 @@ export function ${predicateName}(value: any): value is ${matchingInterface.getNa /** * Writes a type predicate for the given interface checking just the value of the type property - * @param matchingInterface - * @param func + * @param matchingInterface + * @param func */ -function writeFastPredicate(matchingInterface: InterfaceDeclaration, allFunctionDeclarations: KindToNodeMappings[SyntaxKind.FunctionDeclaration][]): void { - const predicateName = `is${matchingInterface.getName()}`; - - // remove existing instances - findExisting(predicateName, SyntaxKind.FunctionDeclaration, allFunctionDeclarations).forEach(node => node.remove()); - - const typePropertyValue = extractTypePropertyValue(matchingInterface); - - if(typePropertyValue == null){ - return; - } +function writeFastPredicate( + matchingInterface: InterfaceDeclaration, + allFunctionDeclarations: KindToNodeMappings[SyntaxKind.FunctionDeclaration][] +): void { + const predicateName = `is${matchingInterface.getName()}`; - sourceFile.addStatements(` + // remove existing instances + findExisting(predicateName, SyntaxKind.FunctionDeclaration, allFunctionDeclarations).forEach(node => node.remove()); + + const typePropertyValue = extractTypePropertyValue(matchingInterface); + + if (typePropertyValue == null) { + return; + } + + sourceFile.addStatements(` /** * Returns true if the value has a type property with value '${typePropertyValue}'. This is a fast check that does not check the format of the message */ export function ${predicateName}(value: any): value is ${matchingInterface.getName()} { return value != null && value.type === '${typePropertyValue}'; }`); - } +} function writeTypeConstant(matchingInterface: InterfaceDeclaration): void { const constantName = `${matchingInterface @@ -238,25 +249,23 @@ function writeUnionType(unionName: string, typeValues: string[]): void { * interface ExampleMessage{ * type: "stringConstant"; * } - * @param parentInterface - * @returns + * @param parentInterface + * @returns */ -function extractTypePropertyValue(parentInterface: InterfaceDeclaration): string | undefined{ - const typeProperty = parentInterface.getChildrenOfKind(SyntaxKind.PropertySignature).filter(propertySignature => { - return ( - propertySignature - .getChildrenOfKind(SyntaxKind.Identifier) - .find(identifier => identifier.getText() === 'type') != null - ); - })[0]; - - return typeProperty?.getDescendantsOfKind(SyntaxKind.StringLiteral) - .map(literal => literal.getLiteralText())[0]; +function extractTypePropertyValue(parentInterface: InterfaceDeclaration): string | undefined { + const typeProperty = parentInterface.getChildrenOfKind(SyntaxKind.PropertySignature).filter(propertySignature => { + return ( + propertySignature.getChildrenOfKind(SyntaxKind.Identifier).find(identifier => identifier.getText() === 'type') != + null + ); + })[0]; + + return typeProperty?.getDescendantsOfKind(SyntaxKind.StringLiteral).map(literal => literal.getLiteralText())[0]; } /** * Type predicate to test that value is defined */ -function isDefined(value: T | null | undefined): value is T{ - return value != null; -} \ No newline at end of file +function isDefined(value: T | null | undefined): value is T { + return value != null; +} diff --git a/packages/fdc3-schema/eslint.config.mjs b/packages/fdc3-schema/eslint.config.mjs index dbe460b63..2547c0fed 100644 --- a/packages/fdc3-schema/eslint.config.mjs +++ b/packages/fdc3-schema/eslint.config.mjs @@ -1,58 +1,67 @@ -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -import jsxA11Y from "eslint-plugin-jsx-a11y"; -import globals from "globals"; -import tsParser from "@typescript-eslint/parser"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import jsxA11Y from 'eslint-plugin-jsx-a11y'; +import globals from 'globals'; +import tsParser from '@typescript-eslint/parser'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, }); -export default [...compat.extends( - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier", -), { - files: ["**/*.ts", "**/*.tsx"], - +export default [ + ...compat.extends( + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier' + ), + { + files: ['**/*.ts', '**/*.tsx'], + plugins: { - "@typescript-eslint": typescriptEslint, - "jsx-a11y": jsxA11Y, + '@typescript-eslint': typescriptEslint, + 'jsx-a11y': jsxA11Y, }, languageOptions: { - globals: { - ...globals.browser, - ...globals.jest, - }, + globals: { + ...globals.browser, + ...globals.jest, + }, - parser: tsParser, - ecmaVersion: 5, - sourceType: "script", + parser: tsParser, + ecmaVersion: 5, + sourceType: 'script', - parserOptions: { - project: ["./tsconfig.json"], - }, + parserOptions: { + project: ['./tsconfig.json'], + }, }, rules: { - "@typescript-eslint/adjacent-overload-signatures": "warn", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-empty-function": "warn", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-empty-object-type": ["error", { - allowInterfaces: 'always' - }], - "@typescript-eslint/no-unused-vars": ["error", { - argsIgnorePattern: "^_", - caughtErrorsIgnorePattern: "^_", - }], + '@typescript-eslint/adjacent-overload-signatures': 'warn', + '@typescript-eslint/no-empty-interface': 'off', + '@typescript-eslint/no-empty-function': 'warn', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-empty-object-type': [ + 'error', + { + allowInterfaces: 'always', + }, + ], + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], }, -}]; \ No newline at end of file + }, +]; diff --git a/packages/fdc3-schema/generated/api/BrowserTypes.ts b/packages/fdc3-schema/generated/api/BrowserTypes.ts index 3479573e7..953714e8b 100644 --- a/packages/fdc3-schema/generated/api/BrowserTypes.ts +++ b/packages/fdc3-schema/generated/api/BrowserTypes.ts @@ -95,58 +95,58 @@ * browser window. Used for messages sent in either direction. */ export interface WebConnectionProtocol1Hello { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol1HelloPayload; - /** - * Identifies the type of the connection step message. - */ - type: "WCP1Hello"; + /** + * Metadata for a Web Connection Protocol message. + */ + meta: WebConnectionProtocol1HelloMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: WebConnectionProtocol1HelloPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'WCP1Hello'; } /** * Metadata for a Web Connection Protocol message. */ export interface WebConnectionProtocol1HelloMeta { - connectionAttemptUuid: string; - timestamp: Date; + connectionAttemptUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ 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; - /** - * The version of FDC3 API that the app supports. - */ - fdc3Version: 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; - /** - * 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. - */ - intentResolver?: boolean; - [property: string]: any; + /** + * 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; + /** + * The version of FDC3 API that the app supports. + */ + fdc3Version: 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; + /** + * 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. + */ + intentResolver?: boolean; + [property: string]: any; } /** @@ -162,31 +162,31 @@ export interface WebConnectionProtocol1HelloPayload { * browser window. Used for messages sent in either direction. */ export interface WebConnectionProtocol2LoadURL { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol2LoadURLPayload; - /** - * Identifies the type of the connection step message. - */ - type: "WCP2LoadUrl"; + /** + * Metadata for a Web Connection Protocol message. + */ + meta: WebConnectionProtocol1HelloMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: WebConnectionProtocol2LoadURLPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'WCP2LoadUrl'; } /** * The message payload, containing data pertaining to this connection step. */ 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; + /** + * 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; } /** @@ -201,40 +201,40 @@ export interface WebConnectionProtocol2LoadURLPayload { * 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"; + /** + * 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. */ export interface WebConnectionProtocol3HandshakePayload { - /** - * Indicates whether a channel selector user interface is required and the URL to use to do - * so. Set to `true` to use the default or `false` to disable the channel selector (as the - * Desktop Agent will handle it another way). - */ - channelSelectorUrl: boolean | string; - /** - * The version of FDC3 API that the Desktop Agent will provide support for. - */ - fdc3Version: string; - /** - * Indicates whether an intent resolver user interface is required and the URL to use to do - * so. Set to `true` to use the default or `false` to disable the intent resolver (as the - * Desktop Agent will handle it another way). - */ - intentResolverUrl: boolean | string; + /** + * Indicates whether a channel selector user interface is required and the URL to use to do + * so. Set to `true` to use the default or `false` to disable the channel selector (as the + * Desktop Agent will handle it another way). + */ + channelSelectorUrl: boolean | string; + /** + * The version of FDC3 API that the Desktop Agent will provide support for. + */ + fdc3Version: string; + /** + * Indicates whether an intent resolver user interface is required and the URL to use to do + * so. Set to `true` to use the default or `false` to disable the intent resolver (as the + * Desktop Agent will handle it another way). + */ + intentResolverUrl: boolean | string; } /** @@ -248,43 +248,43 @@ export interface WebConnectionProtocol3HandshakePayload { * browser window. Used for messages sent in either direction. */ export interface WebConnectionProtocol4ValidateAppIdentity { - /** - * Metadata for a Web Connection Protocol message. - */ - meta: WebConnectionProtocol1HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: WebConnectionProtocol4ValidateAppIdentityPayload; - /** - * Identifies the type of the connection step message. - */ - type: "WCP4ValidateAppIdentity"; + /** + * Metadata for a Web Connection Protocol message. + */ + meta: WebConnectionProtocol1HelloMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: WebConnectionProtocol4ValidateAppIdentityPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'WCP4ValidateAppIdentity'; } /** * The message payload, containing data pertaining to this connection step. */ export interface WebConnectionProtocol4ValidateAppIdentityPayload { - /** - * The current URL of the page attempting to connect. This may differ from the identityUrl, - * but the origins MUST match. - */ - actualUrl: string; - /** - * URL to use for the identity of the application. Desktop Agents MUST validate that the - * origin of the message matches the URL, but MAY implement custom comparison logic. - */ - identityUrl: string; - /** - * If an application has previously connected to the Desktop Agent, it may specify its prior - * instance id and associated instance UUID to request the same same instance Id be assigned. - */ - instanceId?: string; - /** - * Instance UUID associated with the requested instanceId. - */ - instanceUuid?: string; + /** + * 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; } /** @@ -298,25 +298,25 @@ export interface WebConnectionProtocol4ValidateAppIdentityPayload { * 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"; + /** + * 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; + message?: string; } /** @@ -330,42 +330,42 @@ export interface WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload * 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"; + /** + * 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; + /** + * 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; } /** @@ -377,30 +377,30 @@ export interface WebConnectionProtocol5ValidateAppIdentitySuccessResponsePayload * 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`). + */ + 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; } /** @@ -419,84 +419,84 @@ export interface ImplementationMetadata { * `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; + /** + * 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; + /** + * 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; } /** @@ -504,22 +504,22 @@ export interface Icon { * 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; + /** + * 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; } /** @@ -527,22 +527,22 @@ export interface Image { * 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; + /** + * 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; } /** @@ -559,21 +559,21 @@ export interface OptionalFeatures { * 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. + */ + meta: WebConnectionProtocol6GoodbyeMeta; + /** + * Identifies the type of the connection step message. + */ + type: 'WCP6Goodbye'; } /** * Metadata for a Web Connection Protocol message. */ export interface WebConnectionProtocol6GoodbyeMeta { - timestamp: Date; + timestamp: Date; } /** @@ -585,32 +585,39 @@ export interface WebConnectionProtocol6GoodbyeMeta { * 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. + */ + 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; + timestamp: Date; + connectionAttemptUuid?: string; } /** * Identifies the type of the connection step message. */ -export type ConnectionStepMessageType = "WCP1Hello" | "WCP2LoadUrl" | "WCP3Handshake" | "WCP4ValidateAppIdentity" | "WCP5ValidateAppIdentityFailedResponse" | "WCP5ValidateAppIdentityResponse" | "WCP6Goodbye"; +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 @@ -622,34 +629,34 @@ export type ConnectionStepMessageType = "WCP1Hello" | "WCP2LoadUrl" | "WCP3Hands * 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. + */ + 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; + 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; } /** @@ -681,38 +688,38 @@ export interface AddContextListenerRequestMeta { * 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 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; + /** + * 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; } /** @@ -730,35 +737,35 @@ export interface AddContextListenerRequestPayload { * 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. + */ + 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; + 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; } /** @@ -767,8 +774,8 @@ export interface AddContextListenerResponseMeta { * unsuccessful. */ export interface AddContextListenerResponsePayload { - error?: PurpleError; - listenerUUID?: string; + error?: PurpleError; + listenerUUID?: string; } /** @@ -779,7 +786,7 @@ export interface AddContextListenerResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type PurpleError = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound"; +export type PurpleError = 'AccessDenied' | 'CreationFailed' | 'MalformedContext' | 'NoChannelFound'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -792,29 +799,29 @@ export type PurpleError = "AccessDenied" | "CreationFailed" | "MalformedContext" * 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"; + /** + * 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 the event to be listened to or `null` to listen to all event types. + */ + type: 'USER_CHANNEL_CHANGED' | null; } /** @@ -834,21 +841,21 @@ export interface AddEventListenerRequestPayload { * 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; - /** - * Identifies 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: "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; + /** + * Identifies 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: 'addEventListenerResponse'; } /** @@ -857,8 +864,8 @@ export interface AddEventListenerResponse { * unsuccessful. */ export interface AddEventListenerResponsePayload { - error?: ResponsePayloadError; - listenerUUID?: string; + error?: ResponsePayloadError; + listenerUUID?: string; } /** @@ -869,7 +876,28 @@ export interface AddEventListenerResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type ResponsePayloadError = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound" | "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type ResponsePayloadError = + | 'AccessDenied' + | 'CreationFailed' + | 'MalformedContext' + | 'NoChannelFound' + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -882,29 +910,29 @@ export type ResponsePayloadError = "AccessDenied" | "CreationFailed" | "Malforme * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface AddIntentListenerRequest { - /** - * 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: AddIntentListenerRequestPayload; - /** - * Identifies 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: "addIntentListenerRequest"; + /** + * 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: AddIntentListenerRequestPayload; + /** + * Identifies 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: 'addIntentListenerRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface AddIntentListenerRequestPayload { - /** - * The name of the intent to listen for. - */ - intent: string; + /** + * The name of the intent to listen for. + */ + intent: string; } /** @@ -919,21 +947,21 @@ export interface AddIntentListenerRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface AddIntentListenerResponse { - /** - * 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: AddIntentListenerResponsePayload; - /** - * Identifies 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: "addIntentListenerResponse"; + /** + * 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: AddIntentListenerResponsePayload; + /** + * Identifies 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: 'addIntentListenerResponse'; } /** @@ -942,9 +970,9 @@ export interface AddIntentListenerResponse { * unsuccessful. */ export interface AddIntentListenerResponsePayload { - error?: FluffyError; - listenerUUID?: string; - [property: string]: any; + error?: FluffyError; + listenerUUID?: string; + [property: string]: any; } /** @@ -955,34 +983,51 @@ export interface AddIntentListenerResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type FluffyError = "MalformedContext" | "DesktopAgentNotFound" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution"; +export type FluffyError = + | 'MalformedContext' + | 'DesktopAgentNotFound' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution'; /** * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ export interface AgentEventMessageMeta { - eventUuid: string; - timestamp: Date; + eventUuid: string; + timestamp: Date; } /** * Identifies the type of the message and it is typically set to the FDC3 function name that * the message relates to, e.g. 'findIntent', with 'Response' appended. */ -export type EventMessageType = "addEventListenerEvent" | "broadcastEvent" | "channelChangedEvent" | "heartbeatEvent" | "intentEvent" | "privateChannelOnAddContextListenerEvent" | "privateChannelOnDisconnectEvent" | "privateChannelOnUnsubscribeEvent"; +export type EventMessageType = + | 'addEventListenerEvent' + | 'broadcastEvent' + | 'channelChangedEvent' + | 'heartbeatEvent' + | 'intentEvent' + | 'privateChannelOnAddContextListenerEvent' + | 'privateChannelOnDisconnectEvent' + | 'privateChannelOnUnsubscribeEvent'; /** * Metadata for messages sent by a Desktop Agent to an app in response to an API call. */ export interface AgentResponseMessageMeta { - 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; + 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; } /** @@ -991,36 +1036,90 @@ export interface AgentResponseMessageMeta { * unsuccessful. */ export interface AgentResponseMessageResponsePayload { - error?: ResponsePayloadError; - [property: string]: any; + error?: ResponsePayloadError; + [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 'Response' appended. */ -export type ResponseMessageType = "addContextListenerResponse" | "addEventListenerResponse" | "addIntentListenerResponse" | "broadcastResponse" | "contextListenerUnsubscribeResponse" | "createPrivateChannelResponse" | "eventListenerUnsubscribeResponse" | "findInstancesResponse" | "findIntentResponse" | "findIntentsByContextResponse" | "getAppMetadataResponse" | "getCurrentChannelResponse" | "getCurrentContextResponse" | "getInfoResponse" | "getOrCreateChannelResponse" | "getUserChannelsResponse" | "intentListenerUnsubscribeResponse" | "intentResultResponse" | "joinUserChannelResponse" | "leaveCurrentChannelResponse" | "openResponse" | "privateChannelAddEventListenerResponse" | "privateChannelDisconnectResponse" | "privateChannelUnsubscribeEventListenerResponse" | "raiseIntentForContextResponse" | "raiseIntentResponse" | "raiseIntentResultResponse"; +export type ResponseMessageType = + | 'addContextListenerResponse' + | 'addEventListenerResponse' + | 'addIntentListenerResponse' + | 'broadcastResponse' + | 'contextListenerUnsubscribeResponse' + | 'createPrivateChannelResponse' + | 'eventListenerUnsubscribeResponse' + | 'findInstancesResponse' + | 'findIntentResponse' + | 'findIntentsByContextResponse' + | 'getAppMetadataResponse' + | 'getCurrentChannelResponse' + | 'getCurrentContextResponse' + | 'getInfoResponse' + | 'getOrCreateChannelResponse' + | 'getUserChannelsResponse' + | 'intentListenerUnsubscribeResponse' + | 'intentResultResponse' + | 'joinUserChannelResponse' + | 'leaveCurrentChannelResponse' + | 'openResponse' + | 'privateChannelAddEventListenerResponse' + | 'privateChannelDisconnectResponse' + | 'privateChannelUnsubscribeEventListenerResponse' + | 'raiseIntentForContextResponse' + | 'raiseIntentResponse' + | 'raiseIntentResultResponse'; /** * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. */ export interface AppRequestMessageMeta { - 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; + 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; } /** * Identifies 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 type RequestMessageType = "addContextListenerRequest" | "addEventListenerRequest" | "addIntentListenerRequest" | "broadcastRequest" | "contextListenerUnsubscribeRequest" | "createPrivateChannelRequest" | "eventListenerUnsubscribeRequest" | "findInstancesRequest" | "findIntentRequest" | "findIntentsByContextRequest" | "getAppMetadataRequest" | "getCurrentChannelRequest" | "getCurrentContextRequest" | "getInfoRequest" | "getOrCreateChannelRequest" | "getUserChannelsRequest" | "heartbeatAcknowledgementRequest" | "intentListenerUnsubscribeRequest" | "intentResultRequest" | "joinUserChannelRequest" | "leaveCurrentChannelRequest" | "openRequest" | "privateChannelAddEventListenerRequest" | "privateChannelDisconnectRequest" | "privateChannelUnsubscribeEventListenerRequest" | "raiseIntentForContextRequest" | "raiseIntentRequest"; +export type RequestMessageType = + | 'addContextListenerRequest' + | 'addEventListenerRequest' + | 'addIntentListenerRequest' + | 'broadcastRequest' + | 'contextListenerUnsubscribeRequest' + | 'createPrivateChannelRequest' + | 'eventListenerUnsubscribeRequest' + | 'findInstancesRequest' + | 'findIntentRequest' + | 'findIntentsByContextRequest' + | 'getAppMetadataRequest' + | 'getCurrentChannelRequest' + | 'getCurrentContextRequest' + | 'getInfoRequest' + | 'getOrCreateChannelRequest' + | 'getUserChannelsRequest' + | 'heartbeatAcknowledgementRequest' + | 'intentListenerUnsubscribeRequest' + | 'intentResultRequest' + | 'joinUserChannelRequest' + | 'leaveCurrentChannelRequest' + | 'openRequest' + | 'privateChannelAddEventListenerRequest' + | 'privateChannelDisconnectRequest' + | 'privateChannelUnsubscribeEventListenerRequest' + | 'raiseIntentForContextRequest' + | 'raiseIntentRequest'; /** * An event message from the Desktop Agent to an app indicating that context has been @@ -1030,46 +1129,46 @@ export type RequestMessageType = "addContextListenerRequest" | "addEventListener * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface BroadcastEvent { - /** - * 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: BroadcastEventPayload; - /** - * Identifies 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: "broadcastEvent"; + /** + * 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: BroadcastEventPayload; + /** + * Identifies 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: 'broadcastEvent'; } /** * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. */ export interface BroadcastEventMeta { - eventUuid: string; - timestamp: Date; + eventUuid: string; + timestamp: Date; } /** * The message payload contains details of the event that the app is being notified about. */ export interface BroadcastEventPayload { - /** - * The Id of the channel that the broadcast was sent on. May be `null` if the context is - * being broadcast due to a call `fdc3.open` that passed context. - */ - channelId: null | string; - /** - * The context object that was broadcast. - */ - context: Context; - /** - * Details of the application instance that broadcast the context. - */ - originatingApp?: AppIdentifier; + /** + * The Id of the channel that the broadcast was sent on. May be `null` if the context is + * being broadcast due to a call `fdc3.open` that passed context. + */ + channelId: null | string; + /** + * The context object that was broadcast. + */ + context: Context; + /** + * Details of the application instance that broadcast the context. + */ + originatingApp?: AppIdentifier; } /** @@ -1096,44 +1195,44 @@ export interface BroadcastEventPayload { * with custom fields as appropriate. */ export interface Context { - /** - * Context data objects may include a set of equivalent key-value pairs that can be used to - * help applications identify and look up the context type they receive in their own domain. - * The idea behind this design is that applications can provide as many equivalent - * identifiers to a target application as possible, e.g. an instrument may be represented by - * an ISIN, CUSIP or Bloomberg identifier. - * - * Identifiers do not make sense for all types of data, so the `id` property is therefore - * optional, but some derived types may choose to require at least one identifier. - * Identifier values SHOULD always be of type string. - */ - id?: { [key: string]: any }; - /** - * Context data objects may include a name property that can be used for more information, - * or display purposes. Some derived types may require the name object as mandatory, - * depending on use case. - */ - name?: string; - /** - * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 - * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present - * to route shared context data appropriately. - * - * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data - * types they support in an FDC3 [App - * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery - * and routing. - * - * Standardized FDC3 context types have well-known `type` properties prefixed with the - * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and - * used by a particular organization, the convention is to prefix them with an - * organization-specific namespace, e.g. `blackrock.fund`. - * - * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more - * information about context data types. - */ - type: string; - [property: string]: any; + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + * Identifier values SHOULD always be of type string. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -1147,33 +1246,33 @@ export interface Context { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface BroadcastRequest { - /** - * 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: BroadcastRequestPayload; - /** - * Identifies 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: "broadcastRequest"; + /** + * 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: BroadcastRequestPayload; + /** + * Identifies 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: 'broadcastRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface BroadcastRequestPayload { - /** - * The Id of the Channel that the broadcast was sent on. - */ - channelId: string; - /** - * The context object that is to be broadcast. - */ - context: Context; + /** + * The Id of the Channel that the broadcast was sent on. + */ + channelId: string; + /** + * The context object that is to be broadcast. + */ + context: Context; } /** @@ -1188,21 +1287,21 @@ export interface BroadcastRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface BroadcastResponse { - /** - * 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: "broadcastResponse"; + /** + * 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: 'broadcastResponse'; } /** @@ -1211,8 +1310,8 @@ export interface BroadcastResponse { * unsuccessful. */ export interface BroadcastResponseResponsePayload { - error?: ResponsePayloadError; - [property: string]: any; + error?: ResponsePayloadError; + [property: string]: any; } /** @@ -1227,30 +1326,30 @@ export interface BroadcastResponseResponsePayload { * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface ChannelChangedEvent { - /** - * 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: ChannelChangedEventPayload; - /** - * Identifies 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: "channelChangedEvent"; + /** + * 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: ChannelChangedEventPayload; + /** + * Identifies 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: 'channelChangedEvent'; } /** * The message payload contains details of the event that the app is being notified about. */ export interface ChannelChangedEventPayload { - /** - * The Id of the channel that the app was added to or `null` if it was removed from a - * channel. - */ - newChannelId: null | string; + /** + * The Id of the channel that the app was added to or `null` if it was removed from a + * channel. + */ + newChannelId: null | string; } /** @@ -1264,26 +1363,26 @@ export interface ChannelChangedEventPayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface ContextListenerUnsubscribeRequest { - /** - * 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: ContextListenerUnsubscribeRequestPayload; - /** - * Identifies 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: "contextListenerUnsubscribeRequest"; + /** + * 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: ContextListenerUnsubscribeRequestPayload; + /** + * Identifies 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: 'contextListenerUnsubscribeRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface ContextListenerUnsubscribeRequestPayload { - listenerUUID: string; + listenerUUID: string; } /** @@ -1298,21 +1397,21 @@ export interface ContextListenerUnsubscribeRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface ContextListenerUnsubscribeResponse { - /** - * 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: "contextListenerUnsubscribeResponse"; + /** + * 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: 'contextListenerUnsubscribeResponse'; } /** @@ -1327,26 +1426,25 @@ export interface ContextListenerUnsubscribeResponse { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface CreatePrivateChannelRequest { - /** - * 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: CreatePrivateChannelRequestPayload; - /** - * Identifies 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: "createPrivateChannelRequest"; + /** + * 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: CreatePrivateChannelRequestPayload; + /** + * Identifies 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: 'createPrivateChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface CreatePrivateChannelRequestPayload { -} +export interface CreatePrivateChannelRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -1360,21 +1458,21 @@ export interface CreatePrivateChannelRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface CreatePrivateChannelResponse { - /** - * 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: CreatePrivateChannelResponsePayload; - /** - * Identifies 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: "createPrivateChannelResponse"; + /** + * 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: CreatePrivateChannelResponsePayload; + /** + * Identifies 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: 'createPrivateChannelResponse'; } /** @@ -1383,8 +1481,8 @@ export interface CreatePrivateChannelResponse { * unsuccessful. */ export interface CreatePrivateChannelResponsePayload { - error?: PurpleError; - privateChannel?: Channel; + error?: PurpleError; + privateChannel?: Channel; } /** @@ -1402,21 +1500,21 @@ export interface CreatePrivateChannelResponsePayload { * function. */ export interface Channel { - /** - * Channels may be visualized and selectable by users. DisplayMetadata may be used to - * provide hints on how to see them. - * For App channels, displayMetadata would typically not be present. - */ - displayMetadata?: DisplayMetadata; - /** - * Constant that uniquely identifies this channel. - */ - id: string; - /** - * Uniquely defines each channel type. - * Can be "user", "app" or "private". - */ - type: Type; + /** + * Channels may be visualized and selectable by users. DisplayMetadata may be used to + * provide hints on how to see them. + * For App channels, displayMetadata would typically not be present. + */ + displayMetadata?: DisplayMetadata; + /** + * Constant that uniquely identifies this channel. + */ + id: string; + /** + * Uniquely defines each channel type. + * Can be "user", "app" or "private". + */ + type: Type; } /** @@ -1431,26 +1529,26 @@ export interface Channel { * this is their meaning. */ export interface DisplayMetadata { - /** - * The color that should be associated within this channel when displaying this channel in a - * UI, e.g: `0xFF0000`. - */ - color?: string; - /** - * A URL of an image that can be used to display this channel. - */ - glyph?: string; - /** - * A user-readable name for this channel, e.g: `"Red"`. - */ - name?: string; + /** + * The color that should be associated within this channel when displaying this channel in a + * UI, e.g: `0xFF0000`. + */ + color?: string; + /** + * A URL of an image that can be used to display this channel. + */ + glyph?: string; + /** + * A user-readable name for this channel, e.g: `"Red"`. + */ + name?: string; } /** * Uniquely defines each channel type. * Can be "user", "app" or "private". */ -export type Type = "app" | "private" | "user"; +export type Type = 'app' | 'private' | 'user'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -1463,26 +1561,26 @@ export type Type = "app" | "private" | "user"; * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface EventListenerUnsubscribeRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: EventListenerUnsubscribeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "eventListenerUnsubscribeRequest"; + /** + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + */ + meta: AddContextListenerRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: EventListenerUnsubscribeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'eventListenerUnsubscribeRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface EventListenerUnsubscribeRequestPayload { - listenerUUID: string; + listenerUUID: string; } /** @@ -1497,21 +1595,21 @@ export interface EventListenerUnsubscribeRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface EventListenerUnsubscribeResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: BroadcastResponseResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "eventListenerUnsubscribeResponse"; + /** + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + */ + meta: AddContextListenerResponseMeta; + /** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ + payload: BroadcastResponseResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'eventListenerUnsubscribeResponse'; } /** @@ -1528,25 +1626,25 @@ export interface EventListenerUnsubscribeResponse { * sent in either direction. */ export interface Fdc3UserInterfaceChannelSelected { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceChannelSelectedPayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceChannelSelected"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceChannelSelectedPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceChannelSelected'; } /** * The message payload. */ export interface Fdc3UserInterfaceChannelSelectedPayload { - /** - * The id of the channel that should be currently selected, or `null` if none should be - * selected. - */ - selected: null | string; + /** + * The id of the channel that should be currently selected, or `null` if none should be + * selected. + */ + selected: null | string; } /** @@ -1562,29 +1660,29 @@ export interface Fdc3UserInterfaceChannelSelectedPayload { * sent in either direction. */ export interface Fdc3UserInterfaceChannels { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceChannelsPayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceChannels"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceChannelsPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceChannels'; } /** * The message payload. */ export interface Fdc3UserInterfaceChannelsPayload { - /** - * The id of the channel that should be currently selected, or `null` if none should be - * selected. - */ - selected: null | string; - /** - * User Channel definitions.```````s - */ - userChannels: Channel[]; + /** + * 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[]; } /** @@ -1602,32 +1700,32 @@ export interface Fdc3UserInterfaceChannelsPayload { * sent in either direction. */ export interface Fdc3UserInterfaceDrag { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceDragPayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceDrag"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceDragPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceDrag'; } /** * The message payload. */ export interface Fdc3UserInterfaceDragPayload { - /** - * The offset to move the frame by. - */ - mouseOffsets: MouseOffsets; + /** + * The offset to move the frame by. + */ + mouseOffsets: MouseOffsets; } /** * The offset to move the frame by. */ export interface MouseOffsets { - x: number; - y: number; + x: number; + y: number; } /** @@ -1644,24 +1742,24 @@ export interface MouseOffsets { * sent in either direction. */ export interface Fdc3UserInterfaceHandshake { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceHandshakePayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceHandshake"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceHandshakePayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceHandshake'; } /** * The message payload. */ export interface Fdc3UserInterfaceHandshakePayload { - /** - * The version of FDC3 API that the Desktop Agent will provide support for. - */ - fdc3Version: string; + /** + * The version of FDC3 API that the Desktop Agent will provide support for. + */ + fdc3Version: string; } /** @@ -1678,29 +1776,29 @@ export interface Fdc3UserInterfaceHandshakePayload { * sent in either direction. */ export interface Fdc3UserInterfaceHello { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceHelloPayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceHello"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceHelloPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceHello'; } /** * The message payload. */ export interface Fdc3UserInterfaceHelloPayload { - /** - * Details about the UI implementation, such as vendor and version, for logging purposes. - */ - implementationDetails: string; - /** - * A constrained set of styling properties that should be set on the user interface before - * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. - */ - initialCSS: InitialCSS; + /** + * Details about the UI implementation, such as vendor and version, for logging purposes. + */ + implementationDetails: string; + /** + * A constrained set of styling properties that should be set on the user interface before + * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. + */ + initialCSS: InitialCSS; } /** @@ -1708,47 +1806,47 @@ export interface Fdc3UserInterfaceHelloPayload { * it is displayed. Note `position` cannot be specified and should always be set to `fixed`. */ export interface InitialCSS { - /** - * The initial bottom property to apply to the iframe. - */ - bottom?: string; - /** - * The initial height of the iframe. - */ - height?: string; - /** - * The initial left property to apply to the iframe. - */ - left?: string; - /** - * The maximum height to apply to the iframe. - */ - maxHeight?: string; - /** - * The maximum with to apply to the iframe. - */ - maxWidth?: string; - /** - * The initial right property to apply to the iframe. - */ - right?: string; - /** - * The initial top property to apply to the iframe. - */ - top?: string; - /** - * The transition property to apply to the iframe. - */ - transition?: string; - /** - * The initial width of the iframe. - */ - width?: string; - /** - * The initial zindex to apply to the iframe. - */ - zIndex?: string; - [property: string]: any; + /** + * The initial bottom property to apply to the iframe. + */ + bottom?: string; + /** + * The initial height of the iframe. + */ + height?: string; + /** + * The initial left property to apply to the iframe. + */ + left?: string; + /** + * The maximum height to apply to the iframe. + */ + maxHeight?: string; + /** + * The maximum with to apply to the iframe. + */ + maxWidth?: string; + /** + * The initial right property to apply to the iframe. + */ + right?: string; + /** + * The initial top property to apply to the iframe. + */ + top?: string; + /** + * The transition property to apply to the iframe. + */ + transition?: string; + /** + * The initial width of the iframe. + */ + width?: string; + /** + * The initial zindex to apply to the iframe. + */ + zIndex?: string; + [property: string]: any; } /** @@ -1761,20 +1859,28 @@ export interface InitialCSS { * sent in either direction. */ export interface Fdc3UserInterfaceMessage { - /** - * The message payload. - */ - payload?: { [key: string]: any }; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: Fdc3UserInterfaceMessageType; + /** + * The message payload. + */ + payload?: { [key: string]: any }; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: Fdc3UserInterfaceMessageType; } /** * Identifies the type of the message to or from the user interface frame. */ -export type Fdc3UserInterfaceMessageType = "Fdc3UserInterfaceHello" | "Fdc3UserInterfaceHandshake" | "Fdc3UserInterfaceRestyle" | "Fdc3UserInterfaceDrag" | "Fdc3UserInterfaceResolve" | "Fdc3UserInterfaceResolveAction" | "Fdc3UserInterfaceChannels" | "Fdc3UserInterfaceChannelSelected"; +export type Fdc3UserInterfaceMessageType = + | 'Fdc3UserInterfaceHello' + | 'Fdc3UserInterfaceHandshake' + | 'Fdc3UserInterfaceRestyle' + | 'Fdc3UserInterfaceDrag' + | 'Fdc3UserInterfaceResolve' + | 'Fdc3UserInterfaceResolveAction' + | 'Fdc3UserInterfaceChannels' + | 'Fdc3UserInterfaceChannelSelected'; /** * Setup message sent by the DA proxy code in getAgent() to an intent resolver UI with the @@ -1785,25 +1891,25 @@ export type Fdc3UserInterfaceMessageType = "Fdc3UserInterfaceHello" | "Fdc3UserI * sent in either direction. */ export interface Fdc3UserInterfaceResolve { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceResolvePayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceResolve"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceResolvePayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceResolve'; } /** * The message payload. */ export interface Fdc3UserInterfaceResolvePayload { - /** - * An array of AppIntent objects defining the resolution options. - */ - appIntents: AppIntent[]; - context: Context; + /** + * An array of AppIntent objects defining the resolution options. + */ + appIntents: AppIntent[]; + context: Context; } /** @@ -1813,14 +1919,14 @@ export interface Fdc3UserInterfaceResolvePayload { * resolver) before it can be handled. */ export interface AppIntent { - /** - * Details of applications that can resolve the intent. - */ - apps: AppMetadata[]; - /** - * Details of the intent whose relationship to resolving applications is being described. - */ - intent: IntentMetadata; + /** + * Details of applications that can resolve the intent. + */ + apps: AppMetadata[]; + /** + * Details of the intent whose relationship to resolving applications is being described. + */ + intent: IntentMetadata; } /** @@ -1829,14 +1935,14 @@ export interface AppIntent { * Metadata describing an Intent. */ export interface IntentMetadata { - /** - * Display name for the intent. - */ - displayName?: string; - /** - * The unique name of the intent that can be invoked by the raiseIntent call. - */ - name: string; + /** + * Display name for the intent. + */ + displayName?: string; + /** + * The unique name of the intent that can be invoked by the raiseIntent call. + */ + name: string; } /** @@ -1852,32 +1958,32 @@ export interface IntentMetadata { * sent in either direction. */ export interface Fdc3UserInterfaceResolveAction { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceResolveActionPayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceResolveAction"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceResolveActionPayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceResolveAction'; } /** * The message payload. */ export interface Fdc3UserInterfaceResolveActionPayload { - action: Action; - /** - * The App resolution option chosen. - */ - appIdentifier?: AppIdentifier; - /** - * The intent resolved. - */ - intent?: string; + action: Action; + /** + * The App resolution option chosen. + */ + appIdentifier?: AppIdentifier; + /** + * The intent resolved. + */ + intent?: string; } -export type Action = "hover" | "click" | "cancel"; +export type Action = 'hover' | 'click' | 'cancel'; /** * Identifies the type of the message to or from the user interface frame. @@ -1893,25 +1999,25 @@ export type Action = "hover" | "click" | "cancel"; * sent in either direction. */ export interface Fdc3UserInterfaceRestyle { - /** - * The message payload. - */ - payload: Fdc3UserInterfaceRestylePayload; - /** - * Identifies the type of the message to or from the user interface frame. - */ - type: "Fdc3UserInterfaceRestyle"; + /** + * The message payload. + */ + payload: Fdc3UserInterfaceRestylePayload; + /** + * Identifies the type of the message to or from the user interface frame. + */ + type: 'Fdc3UserInterfaceRestyle'; } /** * The message payload. */ export interface Fdc3UserInterfaceRestylePayload { - /** - * A constrained set of styling properties that should be applied to the frame. Note - * `position` cannot be set, and should always be `fixed`. - */ - updatedCSS: UpdatedCSS; + /** + * A constrained set of styling properties that should be applied to the frame. Note + * `position` cannot be set, and should always be `fixed`. + */ + updatedCSS: UpdatedCSS; } /** @@ -1919,47 +2025,47 @@ export interface Fdc3UserInterfaceRestylePayload { * `position` cannot be set, and should always be `fixed`. */ export interface UpdatedCSS { - /** - * The initial bottom property to apply to the iframe. - */ - bottom?: string; - /** - * The updated height of the iframe. - */ - height?: string; - /** - * The initial left property to apply to the iframe. - */ - left?: string; - /** - * The updated maximum height to apply to the iframe. - */ - maxHeight?: string; - /** - * The updated maximum with to apply to the iframe. - */ - maxWidth?: string; - /** - * The initial right property to apply to the iframe. - */ - right?: string; - /** - * The initial top property to apply to the iframe. - */ - top?: string; - /** - * The updated transition property to apply to the iframe. - */ - transition?: string; - /** - * The updated width of the iframe. - */ - width?: string; - /** - * The updated zIndex to apply to the iframe. - */ - zIndex?: string; - [property: string]: any; + /** + * The initial bottom property to apply to the iframe. + */ + bottom?: string; + /** + * The updated height of the iframe. + */ + height?: string; + /** + * The initial left property to apply to the iframe. + */ + left?: string; + /** + * The updated maximum height to apply to the iframe. + */ + maxHeight?: string; + /** + * The updated maximum with to apply to the iframe. + */ + maxWidth?: string; + /** + * The initial right property to apply to the iframe. + */ + right?: string; + /** + * The initial top property to apply to the iframe. + */ + top?: string; + /** + * The updated transition property to apply to the iframe. + */ + transition?: string; + /** + * The updated width of the iframe. + */ + width?: string; + /** + * The updated zIndex to apply to the iframe. + */ + zIndex?: string; + [property: string]: any; } /** @@ -1972,26 +2078,26 @@ export interface UpdatedCSS { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface FindInstancesRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindInstancesRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findInstancesRequest"; + /** + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + */ + meta: AddContextListenerRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findInstancesRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindInstancesRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -2006,21 +2112,21 @@ export interface FindInstancesRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface FindInstancesResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: FindInstancesResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + /** + * Metadata for messages sent by a Desktop Agent to an app in response to an API call. + */ + meta: AddContextListenerResponseMeta; + /** + * A payload for a response to an API call that will contain any return values or an `error` + * property containing a standardized error message indicating that the request was + * unsuccessful. + */ + payload: FindInstancesResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** @@ -2033,8 +2139,8 @@ export interface FindInstancesResponse { * resulted in an error and including a standardized error message. */ export interface FindInstancesResponsePayload { - error?: FindInstancesErrors; - appIdentifiers?: AppMetadata[]; + error?: FindInstancesErrors; + appIdentifiers?: AppMetadata[]; } /** @@ -2062,7 +2168,20 @@ export interface FindInstancesResponsePayload { * * Should be set if the raiseIntent request returned an error. */ -export type FindInstancesErrors = "MalformedContext" | "DesktopAgentNotFound" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type FindInstancesErrors = + | 'MalformedContext' + | 'DesktopAgentNotFound' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2075,28 +2194,28 @@ export type FindInstancesErrors = "MalformedContext" | "DesktopAgentNotFound" | * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface FindIntentRequest { - /** - * 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: FindIntentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentRequest"; + /** + * 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: FindIntentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentRequestPayload { - context?: Context; - intent: string; - resultType?: string; + context?: Context; + intent: string; + resultType?: string; } /** @@ -2111,21 +2230,21 @@ export interface FindIntentRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface FindIntentResponse { - /** - * 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: FindIntentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + /** + * 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: FindIntentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** @@ -2134,8 +2253,8 @@ export interface FindIntentResponse { * unsuccessful. */ export interface FindIntentResponsePayload { - error?: FindInstancesErrors; - appIntent?: AppIntent; + error?: FindInstancesErrors; + appIntent?: AppIntent; } /** @@ -2150,27 +2269,27 @@ export interface FindIntentResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface FindIntentsByContextRequest { - /** - * 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: FindIntentsByContextRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentsByContextRequest"; + /** + * 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: FindIntentsByContextRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentsByContextRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextRequestPayload { - context: Context; - resultType?: string; + context: Context; + resultType?: string; } /** @@ -2185,21 +2304,21 @@ export interface FindIntentsByContextRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface FindIntentsByContextResponse { - /** - * 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: FindIntentsByContextResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + /** + * 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: FindIntentsByContextResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** @@ -2208,8 +2327,8 @@ export interface FindIntentsByContextResponse { * unsuccessful. */ export interface FindIntentsByContextResponsePayload { - error?: FindInstancesErrors; - appIntents?: AppIntent[]; + error?: FindInstancesErrors; + appIntents?: AppIntent[]; } /** @@ -2223,26 +2342,26 @@ export interface FindIntentsByContextResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetAppMetadataRequest { - /** - * 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: GetAppMetadataRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getAppMetadataRequest"; + /** + * 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: GetAppMetadataRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getAppMetadataRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetAppMetadataRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -2257,21 +2376,21 @@ export interface GetAppMetadataRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface GetAppMetadataResponse { - /** - * 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: GetAppMetadataResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + /** + * 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: GetAppMetadataResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** @@ -2280,8 +2399,8 @@ export interface GetAppMetadataResponse { * unsuccessful. */ export interface GetAppMetadataResponsePayload { - error?: FindInstancesErrors; - appMetadata?: AppMetadata; + error?: FindInstancesErrors; + appMetadata?: AppMetadata; } /** @@ -2296,26 +2415,25 @@ export interface GetAppMetadataResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetCurrentChannelRequest { - /** - * 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: GetCurrentChannelRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getCurrentChannelRequest"; + /** + * 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: GetCurrentChannelRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getCurrentChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetCurrentChannelRequestPayload { -} +export interface GetCurrentChannelRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2329,21 +2447,21 @@ export interface GetCurrentChannelRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface GetCurrentChannelResponse { - /** - * 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: GetCurrentChannelResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getCurrentChannelResponse"; + /** + * 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: GetCurrentChannelResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getCurrentChannelResponse'; } /** @@ -2352,8 +2470,8 @@ export interface GetCurrentChannelResponse { * unsuccessful. */ export interface GetCurrentChannelResponsePayload { - error?: ResponsePayloadError; - channel?: Channel | null; + error?: ResponsePayloadError; + channel?: Channel | null; } /** @@ -2369,34 +2487,34 @@ export interface GetCurrentChannelResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetCurrentContextRequest { - /** - * 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: GetCurrentContextRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getCurrentContextRequest"; + /** + * 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: GetCurrentContextRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getCurrentContextRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetCurrentContextRequestPayload { - /** - * The id of the channel to return the current context of. - */ - channelId: string; - /** - * The type of context to return for OR `null` indicating that the most recently broadcast - * context on the channel should be returned. - */ - contextType: null | string; + /** + * The id of the channel to return the current context of. + */ + channelId: string; + /** + * The type of context to return for OR `null` indicating that the most recently broadcast + * context on the channel should be returned. + */ + contextType: null | string; } /** @@ -2411,21 +2529,21 @@ export interface GetCurrentContextRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface GetCurrentContextResponse { - /** - * 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: GetCurrentContextResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getCurrentContextResponse"; + /** + * 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: GetCurrentContextResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getCurrentContextResponse'; } /** @@ -2434,12 +2552,12 @@ export interface GetCurrentContextResponse { * unsuccessful. */ export interface GetCurrentContextResponsePayload { - error?: PurpleError; - /** - * The most recently broadcast context object (of the specified type, if one was specified), - * or `null` if none was available in the channel. - */ - context?: null | Context; + error?: PurpleError; + /** + * The most recently broadcast context object (of the specified type, if one was specified), + * or `null` if none was available in the channel. + */ + context?: null | Context; } /** @@ -2454,26 +2572,25 @@ export interface GetCurrentContextResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetInfoRequest { - /** - * 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: GetInfoRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getInfoRequest"; + /** + * 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: GetInfoRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getInfoRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetInfoRequestPayload { -} +export interface GetInfoRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2487,21 +2604,21 @@ export interface GetInfoRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ 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"; + /** + * 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'; } /** @@ -2510,8 +2627,8 @@ export interface GetInfoResponse { * unsuccessful. */ export interface GetInfoResponsePayload { - error?: ResponsePayloadError; - implementationMetadata?: ImplementationMetadata; + error?: ResponsePayloadError; + implementationMetadata?: ImplementationMetadata; } /** @@ -2526,29 +2643,29 @@ export interface GetInfoResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetOrCreateChannelRequest { - /** - * 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: GetOrCreateChannelRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getOrCreateChannelRequest"; + /** + * 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: GetOrCreateChannelRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getOrCreateChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetOrCreateChannelRequestPayload { - /** - * The id of the channel to return - */ - channelId: string; + /** + * The id of the channel to return + */ + channelId: string; } /** @@ -2563,21 +2680,21 @@ export interface GetOrCreateChannelRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface GetOrCreateChannelResponse { - /** - * 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: GetOrCreateChannelResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getOrCreateChannelResponse"; + /** + * 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: GetOrCreateChannelResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getOrCreateChannelResponse'; } /** @@ -2586,8 +2703,8 @@ export interface GetOrCreateChannelResponse { * unsuccessful. */ export interface GetOrCreateChannelResponsePayload { - error?: PurpleError; - channel?: Channel; + error?: PurpleError; + channel?: Channel; } /** @@ -2601,26 +2718,25 @@ export interface GetOrCreateChannelResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface GetUserChannelsRequest { - /** - * 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: GetUserChannelsRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getUserChannelsRequest"; + /** + * 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: GetUserChannelsRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getUserChannelsRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface GetUserChannelsRequestPayload { -} +export interface GetUserChannelsRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2634,21 +2750,21 @@ export interface GetUserChannelsRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface GetUserChannelsResponse { - /** - * 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: GetUserChannelsResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getUserChannelsResponse"; + /** + * 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: GetUserChannelsResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getUserChannelsResponse'; } /** @@ -2657,8 +2773,8 @@ export interface GetUserChannelsResponse { * unsuccessful. */ export interface GetUserChannelsResponsePayload { - error?: PurpleError; - userChannels?: Channel[]; + error?: PurpleError; + userChannels?: Channel[]; } /** @@ -2673,29 +2789,29 @@ export interface GetUserChannelsResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface HeartbeatAcknowledgementRequest { - /** - * 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: HeartbeatAcknowledgementRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "heartbeatAcknowledgementRequest"; + /** + * 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: HeartbeatAcknowledgementRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'heartbeatAcknowledgementRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface HeartbeatAcknowledgementRequestPayload { - /** - * The eventUuid value of the HeartbeatEvent that the acknowledgement being sent relates to. - */ - heartbeatEventUuid: string; + /** + * The eventUuid value of the HeartbeatEvent that the acknowledgement being sent relates to. + */ + heartbeatEventUuid: string; } /** @@ -2711,26 +2827,25 @@ export interface HeartbeatAcknowledgementRequestPayload { * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface HeartbeatEvent { - /** - * 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: HeartbeatEventPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "heartbeatEvent"; + /** + * 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: HeartbeatEventPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'heartbeatEvent'; } /** * The message payload contains details of the event that the app is being notified about. */ -export interface HeartbeatEventPayload { -} +export interface HeartbeatEventPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2744,42 +2859,42 @@ export interface HeartbeatEventPayload { * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface IntentEvent { - /** - * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. - */ - meta: BroadcastEventMeta; - /** - * The message payload contains details of the event that the app is being notified about. - */ - payload: IntentEventPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "intentEvent"; + /** + * Metadata for messages sent by a Desktop Agent to an app notifying it of an event. + */ + meta: BroadcastEventMeta; + /** + * The message payload contains details of the event that the app is being notified about. + */ + payload: IntentEventPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'intentEvent'; } /** * The message payload contains details of the event that the app is being notified about. */ export interface IntentEventPayload { - /** - * The context object passed with the raised intent. - */ - context: Context; - /** - * The intent that was raised. - */ - intent: string; - /** - * Details of the application instance that raised the intent. - */ - originatingApp?: AppIdentifier; - /** - * The requestUuid value of the raiseIntentRequest that the intentEvent being sent relates - * to. - */ - raiseIntentRequestUuid: string; + /** + * 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; } /** @@ -2793,26 +2908,26 @@ export interface IntentEventPayload { * 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"; + /** + * 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; + listenerUUID: string; } /** @@ -2827,21 +2942,21 @@ export interface IntentListenerUnsubscribeRequestPayload { * 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"; + /** + * 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'; } /** @@ -2857,39 +2972,39 @@ export interface IntentListenerUnsubscribeResponse { * 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"; + /** + * 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; + /** + * 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; + context?: Context; + channel?: Channel; } /** @@ -2904,21 +3019,21 @@ export interface IntentResult { * 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"; + /** + * 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'; } /** @@ -2934,29 +3049,29 @@ export interface IntentResultResponse { * 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"; + /** + * 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; + /** + * The id of the channel to join. + */ + channelId: string; } /** @@ -2973,21 +3088,21 @@ export interface JoinUserChannelRequestPayload { * 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"; + /** + * 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'; } /** @@ -2996,7 +3111,7 @@ export interface JoinUserChannelResponse { * unsuccessful. */ export interface JoinUserChannelResponsePayload { - error?: PurpleError; + error?: PurpleError; } /** @@ -3010,26 +3125,25 @@ export interface JoinUserChannelResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface LeaveCurrentChannelRequest { - /** - * 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: 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: "leaveCurrentChannelRequest"; + /** + * 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: 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: 'leaveCurrentChannelRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ -export interface LeaveCurrentChannelRequestPayload { -} +export interface LeaveCurrentChannelRequestPayload {} /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3043,21 +3157,21 @@ export interface LeaveCurrentChannelRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface LeaveCurrentChannelResponse { - /** - * 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: 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: "leaveCurrentChannelResponse"; + /** + * 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: 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: 'leaveCurrentChannelResponse'; } /** @@ -3066,7 +3180,7 @@ export interface LeaveCurrentChannelResponse { * unsuccessful. */ export interface LeaveCurrentChannelResponsePayload { - error?: PurpleError; + error?: PurpleError; } /** @@ -3080,32 +3194,32 @@ export interface LeaveCurrentChannelResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface OpenRequest { - /** - * 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: OpenRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "openRequest"; + /** + * 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: OpenRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'openRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface OpenRequestPayload { - app: AppIdentifier; - /** - * If a Context object is passed in, this object will be provided to the opened application - * via a contextListener. The Context argument is functionally equivalent to opening the - * target app with no context and broadcasting the context directly to it. - */ - context?: Context; + app: AppIdentifier; + /** + * If a Context object is passed in, this object will be provided to the opened application + * via a contextListener. The Context argument is functionally equivalent to opening the + * target app with no context and broadcasting the context directly to it. + */ + context?: Context; } /** @@ -3120,21 +3234,21 @@ export interface OpenRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface OpenResponse { - /** - * 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: 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: "openResponse"; + /** + * 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: 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: 'openResponse'; } /** @@ -3143,8 +3257,8 @@ export interface OpenResponse { * unsuccessful. */ export interface OpenResponsePayload { - error?: OpenErrorResponsePayload; - appIdentifier?: AppIdentifier; + error?: OpenErrorResponsePayload; + appIdentifier?: AppIdentifier; } /** @@ -3155,7 +3269,17 @@ export interface OpenResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type OpenErrorResponsePayload = "MalformedContext" | "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "ResolverUnavailable" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +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 @@ -3168,33 +3292,33 @@ export type OpenErrorResponsePayload = "MalformedContext" | "AppNotFound" | "App * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface PrivateChannelAddEventListenerRequest { - /** - * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. - */ - meta: AddContextListenerRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: 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: "privateChannelAddEventListenerRequest"; + /** + * Metadata for a request message sent by an FDC3-enabled app to a Desktop Agent. + */ + meta: AddContextListenerRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: 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: 'privateChannelAddEventListenerRequest'; } /** * 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; - /** - * The Id of the PrivateChannel that the listener should be added to. - */ - privateChannelId: string; + /** + * The type of PrivateChannel event that the listener should be applied to. + */ + listenerType: PrivateChannelEventListenerTypes; + /** + * The Id of the PrivateChannel that the listener should be added to. + */ + privateChannelId: string; } /** @@ -3202,7 +3326,7 @@ export interface TPayload { * * Event listener type names for Private Channel events. */ -export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsubscribe" | "onDisconnect"; +export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3216,21 +3340,21 @@ export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsub * payload contains an `error` property, the request was unsuccessful. */ export interface PrivateChannelAddEventListenerResponse { - /** - * 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: 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: "privateChannelAddEventListenerResponse"; + /** + * 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: 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: 'privateChannelAddEventListenerResponse'; } /** @@ -3239,9 +3363,9 @@ export interface PrivateChannelAddEventListenerResponse { * unsuccessful. */ export interface PrivateChannelAddEventListenerResponsePayload { - error?: PurpleError; - listenerUUID?: string; - [property: string]: any; + error?: PurpleError; + listenerUUID?: string; + [property: string]: any; } /** @@ -3256,29 +3380,29 @@ export interface PrivateChannelAddEventListenerResponsePayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface PrivateChannelDisconnectRequest { - /** - * 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: 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: "privateChannelDisconnectRequest"; + /** + * 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: 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: 'privateChannelDisconnectRequest'; } /** * 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; + /** + * The Id of the Channel that should be disconnected from + */ + channelId: string; } /** @@ -3293,21 +3417,21 @@ export interface PrivateChannelDisconnectRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface PrivateChannelDisconnectResponse { - /** - * 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: PrivateChannelDisconnectResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "privateChannelDisconnectResponse"; + /** + * 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: PrivateChannelDisconnectResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'privateChannelDisconnectResponse'; } /** @@ -3316,7 +3440,7 @@ export interface PrivateChannelDisconnectResponse { * unsuccessful. */ export interface PrivateChannelDisconnectResponsePayload { - error?: PurpleError; + error?: PurpleError; } /** @@ -3331,34 +3455,34 @@ export interface PrivateChannelDisconnectResponsePayload { * 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"; + /** + * 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; + /** + * 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; } /** @@ -3373,29 +3497,29 @@ export interface PrivateChannelOnAddContextListenerEventPayload { * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface PrivateChannelOnDisconnectEvent { - /** - * 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: 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: "privateChannelOnDisconnectEvent"; + /** + * 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: 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: 'privateChannelOnDisconnectEvent'; } /** * The message payload contains details of the event that the app is being notified about. */ export interface PrivateChannelOnDisconnectEventPayload { - /** - * The Id of the PrivateChannel that the app has disconnected from. - */ - privateChannelId: string; + /** + * The Id of the PrivateChannel that the app has disconnected from. + */ + privateChannelId: string; } /** @@ -3410,34 +3534,34 @@ export interface PrivateChannelOnDisconnectEventPayload { * A message from a Desktop Agent to an FDC3-enabled app representing an event. */ export interface PrivateChannelOnUnsubscribeEvent { - /** - * 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: 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: "privateChannelOnUnsubscribeEvent"; + /** + * 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: 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: 'privateChannelOnUnsubscribeEvent'; } /** * The message payload contains details of the event that the app is being notified about. */ 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; + /** + * 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; } /** @@ -3451,26 +3575,26 @@ export interface PrivateChannelOnUnsubscribeEventPayload { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface PrivateChannelUnsubscribeEventListenerRequest { - /** - * 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: PrivateChannelUnsubscribeEventListenerRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "privateChannelUnsubscribeEventListenerRequest"; + /** + * 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: PrivateChannelUnsubscribeEventListenerRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'privateChannelUnsubscribeEventListenerRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelUnsubscribeEventListenerRequestPayload { - listenerUUID: string; + listenerUUID: string; } /** @@ -3485,21 +3609,21 @@ export interface PrivateChannelUnsubscribeEventListenerRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface PrivateChannelUnsubscribeEventListenerResponse { - /** - * Metadata for messages sent by a Desktop Agent to an app in response to an API call. - */ - meta: AddContextListenerResponseMeta; - /** - * A payload for a response to an API call that will contain any return values or an `error` - * property containing a standardized error message indicating that the request was - * unsuccessful. - */ - payload: BroadcastResponseResponsePayload; - /** - * Identifies 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"; + /** + * 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: 'privateChannelUnsubscribeEventListenerResponse'; } /** @@ -3513,27 +3637,27 @@ export interface PrivateChannelUnsubscribeEventListenerResponse { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface RaiseIntentForContextRequest { - /** - * 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: RaiseIntentForContextRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "raiseIntentForContextRequest"; + /** + * 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: RaiseIntentForContextRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'raiseIntentForContextRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentForContextRequestPayload { - app?: AppIdentifier; - context: Context; + app?: AppIdentifier; + context: Context; } /** @@ -3548,25 +3672,25 @@ export interface RaiseIntentForContextRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface RaiseIntentForContextResponse { - /** - * 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. - * - * 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; - /** - * Identifies 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"; + /** + * 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. + * + * 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; + /** + * Identifies 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'; } /** @@ -3584,19 +3708,19 @@ export interface RaiseIntentForContextResponse { * 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[]; + /** + * 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[]; } /** @@ -3628,17 +3752,17 @@ export interface RaiseIntentForContextResponsePayload { * ``` */ 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; + /** + * 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; } /** @@ -3652,28 +3776,28 @@ export interface IntentResolution { * A request message from an FDC3-enabled app to a Desktop Agent. */ export interface RaiseIntentRequest { - /** - * 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: RaiseIntentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "raiseIntentRequest"; + /** + * 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: RaiseIntentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'raiseIntentRequest'; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentRequestPayload { - app?: AppIdentifier; - context: Context; - intent: string; + app?: AppIdentifier; + context: Context; + intent: string; } /** @@ -3688,25 +3812,25 @@ export interface RaiseIntentRequestPayload { * payload contains an `error` property, the request was unsuccessful. */ export interface RaiseIntentResponse { - /** - * 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. - * - * 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: RaiseIntentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "raiseIntentResponse"; + /** + * 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. + * + * 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: RaiseIntentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'raiseIntentResponse'; } /** @@ -3724,19 +3848,19 @@ export interface RaiseIntentResponse { * Used if a raiseIntent request resulted in an error. */ export interface RaiseIntentResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error?: FindInstancesErrors; - /** - * Used if the raiseIntent request was successfully resolved. - */ - intentResolution?: IntentResolution; - /** - * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent - * resolver) before it can be handled. - */ - appIntent?: AppIntent; + /** + * Should be set if the raiseIntent request returned an error. + */ + error?: FindInstancesErrors; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution?: IntentResolution; + /** + * Used if a raiseIntent request requires additional resolution (e.g. by showing an intent + * resolver) before it can be handled. + */ + appIntent?: AppIntent; } /** @@ -3753,21 +3877,21 @@ export interface RaiseIntentResponsePayload { * payload contains an `error` property, the request was unsuccessful. */ export interface RaiseIntentResultResponse { - /** - * 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: 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 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: 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'; } /** @@ -3776,8 +3900,8 @@ export interface RaiseIntentResultResponse { * unsuccessful. */ export interface RaiseIntentResultResponsePayload { - error?: ResponsePayloadError; - intentResult?: IntentResult; + error?: ResponsePayloadError; + intentResult?: IntentResult; } /** @@ -3788,3637 +3912,3982 @@ export interface RaiseIntentResultResponsePayload { // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toWebConnectionProtocol1Hello(json: string): WebConnectionProtocol1Hello { - return cast(JSON.parse(json), r("WebConnectionProtocol1Hello")); - } - - public static webConnectionProtocol1HelloToJson(value: WebConnectionProtocol1Hello): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol1Hello")), null, 2); - } - - public static toWebConnectionProtocol2LoadURL(json: string): WebConnectionProtocol2LoadURL { - return cast(JSON.parse(json), r("WebConnectionProtocol2LoadURL")); - } - - public static webConnectionProtocol2LoadURLToJson(value: WebConnectionProtocol2LoadURL): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol2LoadURL")), null, 2); - } - - public static toWebConnectionProtocol3Handshake(json: string): WebConnectionProtocol3Handshake { - return cast(JSON.parse(json), r("WebConnectionProtocol3Handshake")); - } - - public static webConnectionProtocol3HandshakeToJson(value: WebConnectionProtocol3Handshake): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol3Handshake")), null, 2); - } - - public static toWebConnectionProtocol4ValidateAppIdentity(json: string): WebConnectionProtocol4ValidateAppIdentity { - return cast(JSON.parse(json), r("WebConnectionProtocol4ValidateAppIdentity")); - } - - public static webConnectionProtocol4ValidateAppIdentityToJson(value: WebConnectionProtocol4ValidateAppIdentity): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol4ValidateAppIdentity")), null, 2); - } - - public static toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json: string): WebConnectionProtocol5ValidateAppIdentityFailedResponse { - return cast(JSON.parse(json), r("WebConnectionProtocol5ValidateAppIdentityFailedResponse")); - } - - public static webConnectionProtocol5ValidateAppIdentityFailedResponseToJson(value: WebConnectionProtocol5ValidateAppIdentityFailedResponse): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol5ValidateAppIdentityFailedResponse")), null, 2); - } - - public static toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json: string): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { - return cast(JSON.parse(json), r("WebConnectionProtocol5ValidateAppIdentitySuccessResponse")); - } - - public static webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson(value: WebConnectionProtocol5ValidateAppIdentitySuccessResponse): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol5ValidateAppIdentitySuccessResponse")), null, 2); - } - - public static toWebConnectionProtocol6Goodbye(json: string): WebConnectionProtocol6Goodbye { - return cast(JSON.parse(json), r("WebConnectionProtocol6Goodbye")); - } - - public static webConnectionProtocol6GoodbyeToJson(value: WebConnectionProtocol6Goodbye): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocol6Goodbye")), null, 2); - } - - public static toWebConnectionProtocolMessage(json: string): WebConnectionProtocolMessage { - return cast(JSON.parse(json), r("WebConnectionProtocolMessage")); - } - - public static webConnectionProtocolMessageToJson(value: WebConnectionProtocolMessage): string { - return JSON.stringify(uncast(value, r("WebConnectionProtocolMessage")), null, 2); - } - - public static toAddContextListenerRequest(json: string): AddContextListenerRequest { - return cast(JSON.parse(json), r("AddContextListenerRequest")); - } - - public static addContextListenerRequestToJson(value: AddContextListenerRequest): string { - return JSON.stringify(uncast(value, r("AddContextListenerRequest")), null, 2); - } - - public static toAddContextListenerResponse(json: string): AddContextListenerResponse { - return cast(JSON.parse(json), r("AddContextListenerResponse")); - } - - public static addContextListenerResponseToJson(value: AddContextListenerResponse): string { - return JSON.stringify(uncast(value, r("AddContextListenerResponse")), null, 2); - } - - public static toAddEventListenerRequest(json: string): AddEventListenerRequest { - return cast(JSON.parse(json), r("AddEventListenerRequest")); - } - - public static addEventListenerRequestToJson(value: AddEventListenerRequest): string { - return JSON.stringify(uncast(value, r("AddEventListenerRequest")), null, 2); - } - - public static toAddEventListenerResponse(json: string): AddEventListenerResponse { - return cast(JSON.parse(json), r("AddEventListenerResponse")); - } + public static toWebConnectionProtocol1Hello(json: string): WebConnectionProtocol1Hello { + return cast(JSON.parse(json), r('WebConnectionProtocol1Hello')); + } + + public static webConnectionProtocol1HelloToJson(value: WebConnectionProtocol1Hello): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol1Hello')), null, 2); + } + + public static toWebConnectionProtocol2LoadURL(json: string): WebConnectionProtocol2LoadURL { + return cast(JSON.parse(json), r('WebConnectionProtocol2LoadURL')); + } + + public static webConnectionProtocol2LoadURLToJson(value: WebConnectionProtocol2LoadURL): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol2LoadURL')), null, 2); + } + + public static toWebConnectionProtocol3Handshake(json: string): WebConnectionProtocol3Handshake { + return cast(JSON.parse(json), r('WebConnectionProtocol3Handshake')); + } + + public static webConnectionProtocol3HandshakeToJson(value: WebConnectionProtocol3Handshake): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol3Handshake')), null, 2); + } + + public static toWebConnectionProtocol4ValidateAppIdentity(json: string): WebConnectionProtocol4ValidateAppIdentity { + return cast(JSON.parse(json), r('WebConnectionProtocol4ValidateAppIdentity')); + } + + public static webConnectionProtocol4ValidateAppIdentityToJson( + value: WebConnectionProtocol4ValidateAppIdentity + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol4ValidateAppIdentity')), null, 2); + } + + public static toWebConnectionProtocol5ValidateAppIdentityFailedResponse( + json: string + ): WebConnectionProtocol5ValidateAppIdentityFailedResponse { + return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')); + } + + public static webConnectionProtocol5ValidateAppIdentityFailedResponseToJson( + value: WebConnectionProtocol5ValidateAppIdentityFailedResponse + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentityFailedResponse')), null, 2); + } + + public static toWebConnectionProtocol5ValidateAppIdentitySuccessResponse( + json: string + ): WebConnectionProtocol5ValidateAppIdentitySuccessResponse { + return cast(JSON.parse(json), r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')); + } + + public static webConnectionProtocol5ValidateAppIdentitySuccessResponseToJson( + value: WebConnectionProtocol5ValidateAppIdentitySuccessResponse + ): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol5ValidateAppIdentitySuccessResponse')), null, 2); + } + + public static toWebConnectionProtocol6Goodbye(json: string): WebConnectionProtocol6Goodbye { + return cast(JSON.parse(json), r('WebConnectionProtocol6Goodbye')); + } + + public static webConnectionProtocol6GoodbyeToJson(value: WebConnectionProtocol6Goodbye): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocol6Goodbye')), null, 2); + } + + public static toWebConnectionProtocolMessage(json: string): WebConnectionProtocolMessage { + return cast(JSON.parse(json), r('WebConnectionProtocolMessage')); + } + + public static webConnectionProtocolMessageToJson(value: WebConnectionProtocolMessage): string { + return JSON.stringify(uncast(value, r('WebConnectionProtocolMessage')), null, 2); + } + + public static toAddContextListenerRequest(json: string): AddContextListenerRequest { + return cast(JSON.parse(json), r('AddContextListenerRequest')); + } + + public static addContextListenerRequestToJson(value: AddContextListenerRequest): string { + return JSON.stringify(uncast(value, r('AddContextListenerRequest')), null, 2); + } + + public static toAddContextListenerResponse(json: string): AddContextListenerResponse { + return cast(JSON.parse(json), r('AddContextListenerResponse')); + } + + public static addContextListenerResponseToJson(value: AddContextListenerResponse): string { + return JSON.stringify(uncast(value, r('AddContextListenerResponse')), null, 2); + } + + public static toAddEventListenerRequest(json: string): AddEventListenerRequest { + return cast(JSON.parse(json), r('AddEventListenerRequest')); + } + + public static addEventListenerRequestToJson(value: AddEventListenerRequest): string { + return JSON.stringify(uncast(value, r('AddEventListenerRequest')), null, 2); + } + + public static toAddEventListenerResponse(json: string): AddEventListenerResponse { + return cast(JSON.parse(json), r('AddEventListenerResponse')); + } + + public static addEventListenerResponseToJson(value: AddEventListenerResponse): string { + return JSON.stringify(uncast(value, r('AddEventListenerResponse')), null, 2); + } + + public static toAddIntentListenerRequest(json: string): AddIntentListenerRequest { + return cast(JSON.parse(json), r('AddIntentListenerRequest')); + } + + public static addIntentListenerRequestToJson(value: AddIntentListenerRequest): string { + return JSON.stringify(uncast(value, r('AddIntentListenerRequest')), null, 2); + } + + public static toAddIntentListenerResponse(json: string): AddIntentListenerResponse { + return cast(JSON.parse(json), r('AddIntentListenerResponse')); + } + + public static addIntentListenerResponseToJson(value: AddIntentListenerResponse): string { + return JSON.stringify(uncast(value, r('AddIntentListenerResponse')), null, 2); + } + + public static toAgentEventMessage(json: string): AgentEventMessage { + return cast(JSON.parse(json), r('AgentEventMessage')); + } + + public static agentEventMessageToJson(value: AgentEventMessage): string { + return JSON.stringify(uncast(value, r('AgentEventMessage')), null, 2); + } + + public static toAgentResponseMessage(json: string): AgentResponseMessage { + return cast(JSON.parse(json), r('AgentResponseMessage')); + } + + public static agentResponseMessageToJson(value: AgentResponseMessage): string { + return JSON.stringify(uncast(value, r('AgentResponseMessage')), null, 2); + } + + public static toAppRequestMessage(json: string): AppRequestMessage { + return cast(JSON.parse(json), r('AppRequestMessage')); + } + + public static appRequestMessageToJson(value: AppRequestMessage): string { + return JSON.stringify(uncast(value, r('AppRequestMessage')), null, 2); + } - public static addEventListenerResponseToJson(value: AddEventListenerResponse): string { - return JSON.stringify(uncast(value, r("AddEventListenerResponse")), null, 2); - } - - public static toAddIntentListenerRequest(json: string): AddIntentListenerRequest { - return cast(JSON.parse(json), r("AddIntentListenerRequest")); - } - - public static addIntentListenerRequestToJson(value: AddIntentListenerRequest): string { - return JSON.stringify(uncast(value, r("AddIntentListenerRequest")), null, 2); - } - - public static toAddIntentListenerResponse(json: string): AddIntentListenerResponse { - return cast(JSON.parse(json), r("AddIntentListenerResponse")); - } - - public static addIntentListenerResponseToJson(value: AddIntentListenerResponse): string { - return JSON.stringify(uncast(value, r("AddIntentListenerResponse")), null, 2); - } - - public static toAgentEventMessage(json: string): AgentEventMessage { - return cast(JSON.parse(json), r("AgentEventMessage")); - } - - public static agentEventMessageToJson(value: AgentEventMessage): string { - return JSON.stringify(uncast(value, r("AgentEventMessage")), null, 2); - } + public static toBroadcastEvent(json: string): BroadcastEvent { + return cast(JSON.parse(json), r('BroadcastEvent')); + } - public static toAgentResponseMessage(json: string): AgentResponseMessage { - return cast(JSON.parse(json), r("AgentResponseMessage")); - } + public static broadcastEventToJson(value: BroadcastEvent): string { + return JSON.stringify(uncast(value, r('BroadcastEvent')), null, 2); + } - public static agentResponseMessageToJson(value: AgentResponseMessage): string { - return JSON.stringify(uncast(value, r("AgentResponseMessage")), null, 2); - } + public static toBroadcastRequest(json: string): BroadcastRequest { + return cast(JSON.parse(json), r('BroadcastRequest')); + } - public static toAppRequestMessage(json: string): AppRequestMessage { - return cast(JSON.parse(json), r("AppRequestMessage")); - } + public static broadcastRequestToJson(value: BroadcastRequest): string { + return JSON.stringify(uncast(value, r('BroadcastRequest')), null, 2); + } - public static appRequestMessageToJson(value: AppRequestMessage): string { - return JSON.stringify(uncast(value, r("AppRequestMessage")), null, 2); - } + public static toBroadcastResponse(json: string): BroadcastResponse { + return cast(JSON.parse(json), r('BroadcastResponse')); + } - public static toBroadcastEvent(json: string): BroadcastEvent { - return cast(JSON.parse(json), r("BroadcastEvent")); - } + public static broadcastResponseToJson(value: BroadcastResponse): string { + return JSON.stringify(uncast(value, r('BroadcastResponse')), null, 2); + } - public static broadcastEventToJson(value: BroadcastEvent): string { - return JSON.stringify(uncast(value, r("BroadcastEvent")), null, 2); - } + public static toChannelChangedEvent(json: string): ChannelChangedEvent { + return cast(JSON.parse(json), r('ChannelChangedEvent')); + } - public static toBroadcastRequest(json: string): BroadcastRequest { - return cast(JSON.parse(json), r("BroadcastRequest")); - } + public static channelChangedEventToJson(value: ChannelChangedEvent): string { + return JSON.stringify(uncast(value, r('ChannelChangedEvent')), null, 2); + } - public static broadcastRequestToJson(value: BroadcastRequest): string { - return JSON.stringify(uncast(value, r("BroadcastRequest")), null, 2); - } - - public static toBroadcastResponse(json: string): BroadcastResponse { - return cast(JSON.parse(json), r("BroadcastResponse")); - } + public static toContextListenerUnsubscribeRequest(json: string): ContextListenerUnsubscribeRequest { + return cast(JSON.parse(json), r('ContextListenerUnsubscribeRequest')); + } - public static broadcastResponseToJson(value: BroadcastResponse): string { - return JSON.stringify(uncast(value, r("BroadcastResponse")), null, 2); - } - - public static toChannelChangedEvent(json: string): ChannelChangedEvent { - return cast(JSON.parse(json), r("ChannelChangedEvent")); - } + public static contextListenerUnsubscribeRequestToJson(value: ContextListenerUnsubscribeRequest): string { + return JSON.stringify(uncast(value, r('ContextListenerUnsubscribeRequest')), null, 2); + } - public static channelChangedEventToJson(value: ChannelChangedEvent): string { - return JSON.stringify(uncast(value, r("ChannelChangedEvent")), null, 2); - } - - public static toContextListenerUnsubscribeRequest(json: string): ContextListenerUnsubscribeRequest { - return cast(JSON.parse(json), r("ContextListenerUnsubscribeRequest")); - } - - public static contextListenerUnsubscribeRequestToJson(value: ContextListenerUnsubscribeRequest): string { - return JSON.stringify(uncast(value, r("ContextListenerUnsubscribeRequest")), null, 2); - } - - public static toContextListenerUnsubscribeResponse(json: string): ContextListenerUnsubscribeResponse { - return cast(JSON.parse(json), r("ContextListenerUnsubscribeResponse")); - } - - public static contextListenerUnsubscribeResponseToJson(value: ContextListenerUnsubscribeResponse): string { - return JSON.stringify(uncast(value, r("ContextListenerUnsubscribeResponse")), null, 2); - } - - public static toCreatePrivateChannelRequest(json: string): CreatePrivateChannelRequest { - return cast(JSON.parse(json), r("CreatePrivateChannelRequest")); - } - - public static createPrivateChannelRequestToJson(value: CreatePrivateChannelRequest): string { - return JSON.stringify(uncast(value, r("CreatePrivateChannelRequest")), null, 2); - } - - public static toCreatePrivateChannelResponse(json: string): CreatePrivateChannelResponse { - return cast(JSON.parse(json), r("CreatePrivateChannelResponse")); - } - - public static createPrivateChannelResponseToJson(value: CreatePrivateChannelResponse): string { - return JSON.stringify(uncast(value, r("CreatePrivateChannelResponse")), null, 2); - } - - public static toEventListenerUnsubscribeRequest(json: string): EventListenerUnsubscribeRequest { - return cast(JSON.parse(json), r("EventListenerUnsubscribeRequest")); - } - - public static eventListenerUnsubscribeRequestToJson(value: EventListenerUnsubscribeRequest): string { - return JSON.stringify(uncast(value, r("EventListenerUnsubscribeRequest")), null, 2); - } - - public static toEventListenerUnsubscribeResponse(json: string): EventListenerUnsubscribeResponse { - return cast(JSON.parse(json), r("EventListenerUnsubscribeResponse")); - } - - public static eventListenerUnsubscribeResponseToJson(value: EventListenerUnsubscribeResponse): string { - return JSON.stringify(uncast(value, r("EventListenerUnsubscribeResponse")), null, 2); - } + public static toContextListenerUnsubscribeResponse(json: string): ContextListenerUnsubscribeResponse { + return cast(JSON.parse(json), r('ContextListenerUnsubscribeResponse')); + } - public static toFdc3UserInterfaceChannelSelected(json: string): Fdc3UserInterfaceChannelSelected { - return cast(JSON.parse(json), r("Fdc3UserInterfaceChannelSelected")); - } + public static contextListenerUnsubscribeResponseToJson(value: ContextListenerUnsubscribeResponse): string { + return JSON.stringify(uncast(value, r('ContextListenerUnsubscribeResponse')), null, 2); + } - public static fdc3UserInterfaceChannelSelectedToJson(value: Fdc3UserInterfaceChannelSelected): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceChannelSelected")), null, 2); - } + public static toCreatePrivateChannelRequest(json: string): CreatePrivateChannelRequest { + return cast(JSON.parse(json), r('CreatePrivateChannelRequest')); + } - public static toFdc3UserInterfaceChannels(json: string): Fdc3UserInterfaceChannels { - return cast(JSON.parse(json), r("Fdc3UserInterfaceChannels")); - } + public static createPrivateChannelRequestToJson(value: CreatePrivateChannelRequest): string { + return JSON.stringify(uncast(value, r('CreatePrivateChannelRequest')), null, 2); + } - public static fdc3UserInterfaceChannelsToJson(value: Fdc3UserInterfaceChannels): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceChannels")), null, 2); - } + public static toCreatePrivateChannelResponse(json: string): CreatePrivateChannelResponse { + return cast(JSON.parse(json), r('CreatePrivateChannelResponse')); + } - public static toFdc3UserInterfaceDrag(json: string): Fdc3UserInterfaceDrag { - return cast(JSON.parse(json), r("Fdc3UserInterfaceDrag")); - } + public static createPrivateChannelResponseToJson(value: CreatePrivateChannelResponse): string { + return JSON.stringify(uncast(value, r('CreatePrivateChannelResponse')), null, 2); + } - public static fdc3UserInterfaceDragToJson(value: Fdc3UserInterfaceDrag): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceDrag")), null, 2); - } + public static toEventListenerUnsubscribeRequest(json: string): EventListenerUnsubscribeRequest { + return cast(JSON.parse(json), r('EventListenerUnsubscribeRequest')); + } - public static toFdc3UserInterfaceHandshake(json: string): Fdc3UserInterfaceHandshake { - return cast(JSON.parse(json), r("Fdc3UserInterfaceHandshake")); - } + public static eventListenerUnsubscribeRequestToJson(value: EventListenerUnsubscribeRequest): string { + return JSON.stringify(uncast(value, r('EventListenerUnsubscribeRequest')), null, 2); + } - public static fdc3UserInterfaceHandshakeToJson(value: Fdc3UserInterfaceHandshake): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceHandshake")), null, 2); - } + public static toEventListenerUnsubscribeResponse(json: string): EventListenerUnsubscribeResponse { + return cast(JSON.parse(json), r('EventListenerUnsubscribeResponse')); + } - public static toFdc3UserInterfaceHello(json: string): Fdc3UserInterfaceHello { - return cast(JSON.parse(json), r("Fdc3UserInterfaceHello")); - } + public static eventListenerUnsubscribeResponseToJson(value: EventListenerUnsubscribeResponse): string { + return JSON.stringify(uncast(value, r('EventListenerUnsubscribeResponse')), null, 2); + } - public static fdc3UserInterfaceHelloToJson(value: Fdc3UserInterfaceHello): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceHello")), null, 2); - } + public static toFdc3UserInterfaceChannelSelected(json: string): Fdc3UserInterfaceChannelSelected { + return cast(JSON.parse(json), r('Fdc3UserInterfaceChannelSelected')); + } - public static toFdc3UserInterfaceMessage(json: string): Fdc3UserInterfaceMessage { - return cast(JSON.parse(json), r("Fdc3UserInterfaceMessage")); - } + public static fdc3UserInterfaceChannelSelectedToJson(value: Fdc3UserInterfaceChannelSelected): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannelSelected')), null, 2); + } - public static fdc3UserInterfaceMessageToJson(value: Fdc3UserInterfaceMessage): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceMessage")), null, 2); - } + public static toFdc3UserInterfaceChannels(json: string): Fdc3UserInterfaceChannels { + return cast(JSON.parse(json), r('Fdc3UserInterfaceChannels')); + } - public static toFdc3UserInterfaceResolve(json: string): Fdc3UserInterfaceResolve { - return cast(JSON.parse(json), r("Fdc3UserInterfaceResolve")); - } + public static fdc3UserInterfaceChannelsToJson(value: Fdc3UserInterfaceChannels): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceChannels')), null, 2); + } - public static fdc3UserInterfaceResolveToJson(value: Fdc3UserInterfaceResolve): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceResolve")), null, 2); - } + public static toFdc3UserInterfaceDrag(json: string): Fdc3UserInterfaceDrag { + return cast(JSON.parse(json), r('Fdc3UserInterfaceDrag')); + } - public static toFdc3UserInterfaceResolveAction(json: string): Fdc3UserInterfaceResolveAction { - return cast(JSON.parse(json), r("Fdc3UserInterfaceResolveAction")); - } + public static fdc3UserInterfaceDragToJson(value: Fdc3UserInterfaceDrag): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceDrag')), null, 2); + } - public static fdc3UserInterfaceResolveActionToJson(value: Fdc3UserInterfaceResolveAction): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceResolveAction")), null, 2); - } + public static toFdc3UserInterfaceHandshake(json: string): Fdc3UserInterfaceHandshake { + return cast(JSON.parse(json), r('Fdc3UserInterfaceHandshake')); + } - public static toFdc3UserInterfaceRestyle(json: string): Fdc3UserInterfaceRestyle { - return cast(JSON.parse(json), r("Fdc3UserInterfaceRestyle")); - } + public static fdc3UserInterfaceHandshakeToJson(value: Fdc3UserInterfaceHandshake): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceHandshake')), null, 2); + } - public static fdc3UserInterfaceRestyleToJson(value: Fdc3UserInterfaceRestyle): string { - return JSON.stringify(uncast(value, r("Fdc3UserInterfaceRestyle")), null, 2); - } + public static toFdc3UserInterfaceHello(json: string): Fdc3UserInterfaceHello { + return cast(JSON.parse(json), r('Fdc3UserInterfaceHello')); + } - public static toFindInstancesRequest(json: string): FindInstancesRequest { - return cast(JSON.parse(json), r("FindInstancesRequest")); - } + public static fdc3UserInterfaceHelloToJson(value: Fdc3UserInterfaceHello): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceHello')), null, 2); + } - public static findInstancesRequestToJson(value: FindInstancesRequest): string { - return JSON.stringify(uncast(value, r("FindInstancesRequest")), null, 2); - } + public static toFdc3UserInterfaceMessage(json: string): Fdc3UserInterfaceMessage { + return cast(JSON.parse(json), r('Fdc3UserInterfaceMessage')); + } - public static toFindInstancesResponse(json: string): FindInstancesResponse { - return cast(JSON.parse(json), r("FindInstancesResponse")); - } + public static fdc3UserInterfaceMessageToJson(value: Fdc3UserInterfaceMessage): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceMessage')), null, 2); + } - public static findInstancesResponseToJson(value: FindInstancesResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesResponse")), null, 2); - } + public static toFdc3UserInterfaceResolve(json: string): Fdc3UserInterfaceResolve { + return cast(JSON.parse(json), r('Fdc3UserInterfaceResolve')); + } - public static toFindIntentRequest(json: string): FindIntentRequest { - return cast(JSON.parse(json), r("FindIntentRequest")); - } + public static fdc3UserInterfaceResolveToJson(value: Fdc3UserInterfaceResolve): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceResolve')), null, 2); + } - public static findIntentRequestToJson(value: FindIntentRequest): string { - return JSON.stringify(uncast(value, r("FindIntentRequest")), null, 2); - } + public static toFdc3UserInterfaceResolveAction(json: string): Fdc3UserInterfaceResolveAction { + return cast(JSON.parse(json), r('Fdc3UserInterfaceResolveAction')); + } - public static toFindIntentResponse(json: string): FindIntentResponse { - return cast(JSON.parse(json), r("FindIntentResponse")); - } + public static fdc3UserInterfaceResolveActionToJson(value: Fdc3UserInterfaceResolveAction): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceResolveAction')), null, 2); + } - public static findIntentResponseToJson(value: FindIntentResponse): string { - return JSON.stringify(uncast(value, r("FindIntentResponse")), null, 2); - } + public static toFdc3UserInterfaceRestyle(json: string): Fdc3UserInterfaceRestyle { + return cast(JSON.parse(json), r('Fdc3UserInterfaceRestyle')); + } - public static toFindIntentsByContextRequest(json: string): FindIntentsByContextRequest { - return cast(JSON.parse(json), r("FindIntentsByContextRequest")); - } + public static fdc3UserInterfaceRestyleToJson(value: Fdc3UserInterfaceRestyle): string { + return JSON.stringify(uncast(value, r('Fdc3UserInterfaceRestyle')), null, 2); + } - public static findIntentsByContextRequestToJson(value: FindIntentsByContextRequest): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextRequest")), null, 2); - } + public static toFindInstancesRequest(json: string): FindInstancesRequest { + return cast(JSON.parse(json), r('FindInstancesRequest')); + } - public static toFindIntentsByContextResponse(json: string): FindIntentsByContextResponse { - return cast(JSON.parse(json), r("FindIntentsByContextResponse")); - } + public static findInstancesRequestToJson(value: FindInstancesRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesRequest')), null, 2); + } - public static findIntentsByContextResponseToJson(value: FindIntentsByContextResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextResponse")), null, 2); - } + public static toFindInstancesResponse(json: string): FindInstancesResponse { + return cast(JSON.parse(json), r('FindInstancesResponse')); + } - public static toGetAppMetadataRequest(json: string): GetAppMetadataRequest { - return cast(JSON.parse(json), r("GetAppMetadataRequest")); - } + public static findInstancesResponseToJson(value: FindInstancesResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesResponse')), null, 2); + } - public static getAppMetadataRequestToJson(value: GetAppMetadataRequest): string { - return JSON.stringify(uncast(value, r("GetAppMetadataRequest")), null, 2); - } + public static toFindIntentRequest(json: string): FindIntentRequest { + return cast(JSON.parse(json), r('FindIntentRequest')); + } - public static toGetAppMetadataResponse(json: string): GetAppMetadataResponse { - return cast(JSON.parse(json), r("GetAppMetadataResponse")); - } + public static findIntentRequestToJson(value: FindIntentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentRequest')), null, 2); + } - public static getAppMetadataResponseToJson(value: GetAppMetadataResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataResponse")), null, 2); - } + public static toFindIntentResponse(json: string): FindIntentResponse { + return cast(JSON.parse(json), r('FindIntentResponse')); + } - public static toGetCurrentChannelRequest(json: string): GetCurrentChannelRequest { - return cast(JSON.parse(json), r("GetCurrentChannelRequest")); - } + public static findIntentResponseToJson(value: FindIntentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentResponse')), null, 2); + } - public static getCurrentChannelRequestToJson(value: GetCurrentChannelRequest): string { - return JSON.stringify(uncast(value, r("GetCurrentChannelRequest")), null, 2); - } + public static toFindIntentsByContextRequest(json: string): FindIntentsByContextRequest { + return cast(JSON.parse(json), r('FindIntentsByContextRequest')); + } - public static toGetCurrentChannelResponse(json: string): GetCurrentChannelResponse { - return cast(JSON.parse(json), r("GetCurrentChannelResponse")); - } + public static findIntentsByContextRequestToJson(value: FindIntentsByContextRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextRequest')), null, 2); + } - public static getCurrentChannelResponseToJson(value: GetCurrentChannelResponse): string { - return JSON.stringify(uncast(value, r("GetCurrentChannelResponse")), null, 2); - } + public static toFindIntentsByContextResponse(json: string): FindIntentsByContextResponse { + return cast(JSON.parse(json), r('FindIntentsByContextResponse')); + } - public static toGetCurrentContextRequest(json: string): GetCurrentContextRequest { - return cast(JSON.parse(json), r("GetCurrentContextRequest")); - } + public static findIntentsByContextResponseToJson(value: FindIntentsByContextResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextResponse')), null, 2); + } - public static getCurrentContextRequestToJson(value: GetCurrentContextRequest): string { - return JSON.stringify(uncast(value, r("GetCurrentContextRequest")), null, 2); - } + public static toGetAppMetadataRequest(json: string): GetAppMetadataRequest { + return cast(JSON.parse(json), r('GetAppMetadataRequest')); + } - public static toGetCurrentContextResponse(json: string): GetCurrentContextResponse { - return cast(JSON.parse(json), r("GetCurrentContextResponse")); - } + public static getAppMetadataRequestToJson(value: GetAppMetadataRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataRequest')), null, 2); + } - public static getCurrentContextResponseToJson(value: GetCurrentContextResponse): string { - return JSON.stringify(uncast(value, r("GetCurrentContextResponse")), null, 2); - } + public static toGetAppMetadataResponse(json: string): GetAppMetadataResponse { + return cast(JSON.parse(json), r('GetAppMetadataResponse')); + } - public static toGetInfoRequest(json: string): GetInfoRequest { - return cast(JSON.parse(json), r("GetInfoRequest")); - } + public static getAppMetadataResponseToJson(value: GetAppMetadataResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataResponse')), null, 2); + } - public static getInfoRequestToJson(value: GetInfoRequest): string { - return JSON.stringify(uncast(value, r("GetInfoRequest")), null, 2); - } + public static toGetCurrentChannelRequest(json: string): GetCurrentChannelRequest { + return cast(JSON.parse(json), r('GetCurrentChannelRequest')); + } - public static toGetInfoResponse(json: string): GetInfoResponse { - return cast(JSON.parse(json), r("GetInfoResponse")); - } + public static getCurrentChannelRequestToJson(value: GetCurrentChannelRequest): string { + return JSON.stringify(uncast(value, r('GetCurrentChannelRequest')), null, 2); + } - public static getInfoResponseToJson(value: GetInfoResponse): string { - return JSON.stringify(uncast(value, r("GetInfoResponse")), null, 2); - } + public static toGetCurrentChannelResponse(json: string): GetCurrentChannelResponse { + return cast(JSON.parse(json), r('GetCurrentChannelResponse')); + } - public static toGetOrCreateChannelRequest(json: string): GetOrCreateChannelRequest { - return cast(JSON.parse(json), r("GetOrCreateChannelRequest")); - } + public static getCurrentChannelResponseToJson(value: GetCurrentChannelResponse): string { + return JSON.stringify(uncast(value, r('GetCurrentChannelResponse')), null, 2); + } - public static getOrCreateChannelRequestToJson(value: GetOrCreateChannelRequest): string { - return JSON.stringify(uncast(value, r("GetOrCreateChannelRequest")), null, 2); - } + public static toGetCurrentContextRequest(json: string): GetCurrentContextRequest { + return cast(JSON.parse(json), r('GetCurrentContextRequest')); + } - public static toGetOrCreateChannelResponse(json: string): GetOrCreateChannelResponse { - return cast(JSON.parse(json), r("GetOrCreateChannelResponse")); - } + public static getCurrentContextRequestToJson(value: GetCurrentContextRequest): string { + return JSON.stringify(uncast(value, r('GetCurrentContextRequest')), null, 2); + } - public static getOrCreateChannelResponseToJson(value: GetOrCreateChannelResponse): string { - return JSON.stringify(uncast(value, r("GetOrCreateChannelResponse")), null, 2); - } + public static toGetCurrentContextResponse(json: string): GetCurrentContextResponse { + return cast(JSON.parse(json), r('GetCurrentContextResponse')); + } - public static toGetUserChannelsRequest(json: string): GetUserChannelsRequest { - return cast(JSON.parse(json), r("GetUserChannelsRequest")); - } + public static getCurrentContextResponseToJson(value: GetCurrentContextResponse): string { + return JSON.stringify(uncast(value, r('GetCurrentContextResponse')), null, 2); + } - public static getUserChannelsRequestToJson(value: GetUserChannelsRequest): string { - return JSON.stringify(uncast(value, r("GetUserChannelsRequest")), null, 2); - } + public static toGetInfoRequest(json: string): GetInfoRequest { + return cast(JSON.parse(json), r('GetInfoRequest')); + } - public static toGetUserChannelsResponse(json: string): GetUserChannelsResponse { - return cast(JSON.parse(json), r("GetUserChannelsResponse")); - } + public static getInfoRequestToJson(value: GetInfoRequest): string { + return JSON.stringify(uncast(value, r('GetInfoRequest')), null, 2); + } - public static getUserChannelsResponseToJson(value: GetUserChannelsResponse): string { - return JSON.stringify(uncast(value, r("GetUserChannelsResponse")), null, 2); - } + public static toGetInfoResponse(json: string): GetInfoResponse { + return cast(JSON.parse(json), r('GetInfoResponse')); + } - public static toHeartbeatAcknowledgementRequest(json: string): HeartbeatAcknowledgementRequest { - return cast(JSON.parse(json), r("HeartbeatAcknowledgementRequest")); - } + public static getInfoResponseToJson(value: GetInfoResponse): string { + return JSON.stringify(uncast(value, r('GetInfoResponse')), null, 2); + } - public static heartbeatAcknowledgementRequestToJson(value: HeartbeatAcknowledgementRequest): string { - return JSON.stringify(uncast(value, r("HeartbeatAcknowledgementRequest")), null, 2); - } + public static toGetOrCreateChannelRequest(json: string): GetOrCreateChannelRequest { + return cast(JSON.parse(json), r('GetOrCreateChannelRequest')); + } - public static toHeartbeatEvent(json: string): HeartbeatEvent { - return cast(JSON.parse(json), r("HeartbeatEvent")); - } + public static getOrCreateChannelRequestToJson(value: GetOrCreateChannelRequest): string { + return JSON.stringify(uncast(value, r('GetOrCreateChannelRequest')), null, 2); + } - public static heartbeatEventToJson(value: HeartbeatEvent): string { - return JSON.stringify(uncast(value, r("HeartbeatEvent")), null, 2); - } + public static toGetOrCreateChannelResponse(json: string): GetOrCreateChannelResponse { + return cast(JSON.parse(json), r('GetOrCreateChannelResponse')); + } - public static toIntentEvent(json: string): IntentEvent { - return cast(JSON.parse(json), r("IntentEvent")); - } + public static getOrCreateChannelResponseToJson(value: GetOrCreateChannelResponse): string { + return JSON.stringify(uncast(value, r('GetOrCreateChannelResponse')), null, 2); + } - public static intentEventToJson(value: IntentEvent): string { - return JSON.stringify(uncast(value, r("IntentEvent")), null, 2); - } + public static toGetUserChannelsRequest(json: string): GetUserChannelsRequest { + return cast(JSON.parse(json), r('GetUserChannelsRequest')); + } - public static toIntentListenerUnsubscribeRequest(json: string): IntentListenerUnsubscribeRequest { - return cast(JSON.parse(json), r("IntentListenerUnsubscribeRequest")); - } + public static getUserChannelsRequestToJson(value: GetUserChannelsRequest): string { + return JSON.stringify(uncast(value, r('GetUserChannelsRequest')), null, 2); + } - public static intentListenerUnsubscribeRequestToJson(value: IntentListenerUnsubscribeRequest): string { - return JSON.stringify(uncast(value, r("IntentListenerUnsubscribeRequest")), null, 2); - } + public static toGetUserChannelsResponse(json: string): GetUserChannelsResponse { + return cast(JSON.parse(json), r('GetUserChannelsResponse')); + } - public static toIntentListenerUnsubscribeResponse(json: string): IntentListenerUnsubscribeResponse { - return cast(JSON.parse(json), r("IntentListenerUnsubscribeResponse")); - } + public static getUserChannelsResponseToJson(value: GetUserChannelsResponse): string { + return JSON.stringify(uncast(value, r('GetUserChannelsResponse')), null, 2); + } - public static intentListenerUnsubscribeResponseToJson(value: IntentListenerUnsubscribeResponse): string { - return JSON.stringify(uncast(value, r("IntentListenerUnsubscribeResponse")), null, 2); - } + public static toHeartbeatAcknowledgementRequest(json: string): HeartbeatAcknowledgementRequest { + return cast(JSON.parse(json), r('HeartbeatAcknowledgementRequest')); + } - public static toIntentResultRequest(json: string): IntentResultRequest { - return cast(JSON.parse(json), r("IntentResultRequest")); - } + public static heartbeatAcknowledgementRequestToJson(value: HeartbeatAcknowledgementRequest): string { + return JSON.stringify(uncast(value, r('HeartbeatAcknowledgementRequest')), null, 2); + } - public static intentResultRequestToJson(value: IntentResultRequest): string { - return JSON.stringify(uncast(value, r("IntentResultRequest")), null, 2); - } + public static toHeartbeatEvent(json: string): HeartbeatEvent { + return cast(JSON.parse(json), r('HeartbeatEvent')); + } - public static toIntentResultResponse(json: string): IntentResultResponse { - return cast(JSON.parse(json), r("IntentResultResponse")); - } + public static heartbeatEventToJson(value: HeartbeatEvent): string { + return JSON.stringify(uncast(value, r('HeartbeatEvent')), null, 2); + } - public static intentResultResponseToJson(value: IntentResultResponse): string { - return JSON.stringify(uncast(value, r("IntentResultResponse")), null, 2); - } + public static toIntentEvent(json: string): IntentEvent { + return cast(JSON.parse(json), r('IntentEvent')); + } - public static toJoinUserChannelRequest(json: string): JoinUserChannelRequest { - return cast(JSON.parse(json), r("JoinUserChannelRequest")); - } + public static intentEventToJson(value: IntentEvent): string { + return JSON.stringify(uncast(value, r('IntentEvent')), null, 2); + } - public static joinUserChannelRequestToJson(value: JoinUserChannelRequest): string { - return JSON.stringify(uncast(value, r("JoinUserChannelRequest")), null, 2); - } + public static toIntentListenerUnsubscribeRequest(json: string): IntentListenerUnsubscribeRequest { + return cast(JSON.parse(json), r('IntentListenerUnsubscribeRequest')); + } - public static toJoinUserChannelResponse(json: string): JoinUserChannelResponse { - return cast(JSON.parse(json), r("JoinUserChannelResponse")); - } + public static intentListenerUnsubscribeRequestToJson(value: IntentListenerUnsubscribeRequest): string { + return JSON.stringify(uncast(value, r('IntentListenerUnsubscribeRequest')), null, 2); + } - public static joinUserChannelResponseToJson(value: JoinUserChannelResponse): string { - return JSON.stringify(uncast(value, r("JoinUserChannelResponse")), null, 2); - } + public static toIntentListenerUnsubscribeResponse(json: string): IntentListenerUnsubscribeResponse { + return cast(JSON.parse(json), r('IntentListenerUnsubscribeResponse')); + } - public static toLeaveCurrentChannelRequest(json: string): LeaveCurrentChannelRequest { - return cast(JSON.parse(json), r("LeaveCurrentChannelRequest")); - } + public static intentListenerUnsubscribeResponseToJson(value: IntentListenerUnsubscribeResponse): string { + return JSON.stringify(uncast(value, r('IntentListenerUnsubscribeResponse')), null, 2); + } - public static leaveCurrentChannelRequestToJson(value: LeaveCurrentChannelRequest): string { - return JSON.stringify(uncast(value, r("LeaveCurrentChannelRequest")), null, 2); - } + public static toIntentResultRequest(json: string): IntentResultRequest { + return cast(JSON.parse(json), r('IntentResultRequest')); + } - public static toLeaveCurrentChannelResponse(json: string): LeaveCurrentChannelResponse { - return cast(JSON.parse(json), r("LeaveCurrentChannelResponse")); - } + public static intentResultRequestToJson(value: IntentResultRequest): string { + return JSON.stringify(uncast(value, r('IntentResultRequest')), null, 2); + } - public static leaveCurrentChannelResponseToJson(value: LeaveCurrentChannelResponse): string { - return JSON.stringify(uncast(value, r("LeaveCurrentChannelResponse")), null, 2); - } + public static toIntentResultResponse(json: string): IntentResultResponse { + return cast(JSON.parse(json), r('IntentResultResponse')); + } - public static toOpenRequest(json: string): OpenRequest { - return cast(JSON.parse(json), r("OpenRequest")); - } + public static intentResultResponseToJson(value: IntentResultResponse): string { + return JSON.stringify(uncast(value, r('IntentResultResponse')), null, 2); + } - public static openRequestToJson(value: OpenRequest): string { - return JSON.stringify(uncast(value, r("OpenRequest")), null, 2); - } + public static toJoinUserChannelRequest(json: string): JoinUserChannelRequest { + return cast(JSON.parse(json), r('JoinUserChannelRequest')); + } - public static toOpenResponse(json: string): OpenResponse { - return cast(JSON.parse(json), r("OpenResponse")); - } + public static joinUserChannelRequestToJson(value: JoinUserChannelRequest): string { + return JSON.stringify(uncast(value, r('JoinUserChannelRequest')), null, 2); + } - public static openResponseToJson(value: OpenResponse): string { - return JSON.stringify(uncast(value, r("OpenResponse")), null, 2); - } + public static toJoinUserChannelResponse(json: string): JoinUserChannelResponse { + return cast(JSON.parse(json), r('JoinUserChannelResponse')); + } - public static toPrivateChannelAddEventListenerRequest(json: string): PrivateChannelAddEventListenerRequest { - return cast(JSON.parse(json), r("PrivateChannelAddEventListenerRequest")); - } + public static joinUserChannelResponseToJson(value: JoinUserChannelResponse): string { + return JSON.stringify(uncast(value, r('JoinUserChannelResponse')), null, 2); + } - public static privateChannelAddEventListenerRequestToJson(value: PrivateChannelAddEventListenerRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelAddEventListenerRequest")), null, 2); - } + public static toLeaveCurrentChannelRequest(json: string): LeaveCurrentChannelRequest { + return cast(JSON.parse(json), r('LeaveCurrentChannelRequest')); + } + + public static leaveCurrentChannelRequestToJson(value: LeaveCurrentChannelRequest): string { + return JSON.stringify(uncast(value, r('LeaveCurrentChannelRequest')), null, 2); + } + + public static toLeaveCurrentChannelResponse(json: string): LeaveCurrentChannelResponse { + return cast(JSON.parse(json), r('LeaveCurrentChannelResponse')); + } + + public static leaveCurrentChannelResponseToJson(value: LeaveCurrentChannelResponse): string { + return JSON.stringify(uncast(value, r('LeaveCurrentChannelResponse')), null, 2); + } + + public static toOpenRequest(json: string): OpenRequest { + return cast(JSON.parse(json), r('OpenRequest')); + } + + public static openRequestToJson(value: OpenRequest): string { + return JSON.stringify(uncast(value, r('OpenRequest')), null, 2); + } + + public static toOpenResponse(json: string): OpenResponse { + return cast(JSON.parse(json), r('OpenResponse')); + } + + public static openResponseToJson(value: OpenResponse): string { + return JSON.stringify(uncast(value, r('OpenResponse')), null, 2); + } + + public static toPrivateChannelAddEventListenerRequest(json: string): PrivateChannelAddEventListenerRequest { + return cast(JSON.parse(json), r('PrivateChannelAddEventListenerRequest')); + } + + public static privateChannelAddEventListenerRequestToJson(value: PrivateChannelAddEventListenerRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelAddEventListenerRequest')), null, 2); + } + + public static toPrivateChannelAddEventListenerResponse(json: string): PrivateChannelAddEventListenerResponse { + return cast(JSON.parse(json), r('PrivateChannelAddEventListenerResponse')); + } + + public static privateChannelAddEventListenerResponseToJson(value: PrivateChannelAddEventListenerResponse): string { + return JSON.stringify(uncast(value, r('PrivateChannelAddEventListenerResponse')), null, 2); + } + + public static toPrivateChannelDisconnectRequest(json: string): PrivateChannelDisconnectRequest { + return cast(JSON.parse(json), r('PrivateChannelDisconnectRequest')); + } + + public static privateChannelDisconnectRequestToJson(value: PrivateChannelDisconnectRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelDisconnectRequest')), null, 2); + } - public static toPrivateChannelAddEventListenerResponse(json: string): PrivateChannelAddEventListenerResponse { - return cast(JSON.parse(json), r("PrivateChannelAddEventListenerResponse")); - } + public static toPrivateChannelDisconnectResponse(json: string): PrivateChannelDisconnectResponse { + return cast(JSON.parse(json), r('PrivateChannelDisconnectResponse')); + } - public static privateChannelAddEventListenerResponseToJson(value: PrivateChannelAddEventListenerResponse): string { - return JSON.stringify(uncast(value, r("PrivateChannelAddEventListenerResponse")), null, 2); - } + public static privateChannelDisconnectResponseToJson(value: PrivateChannelDisconnectResponse): string { + return JSON.stringify(uncast(value, r('PrivateChannelDisconnectResponse')), null, 2); + } - public static toPrivateChannelDisconnectRequest(json: string): PrivateChannelDisconnectRequest { - return cast(JSON.parse(json), r("PrivateChannelDisconnectRequest")); - } + public static toPrivateChannelOnAddContextListenerEvent(json: string): PrivateChannelOnAddContextListenerEvent { + return cast(JSON.parse(json), r('PrivateChannelOnAddContextListenerEvent')); + } - public static privateChannelDisconnectRequestToJson(value: PrivateChannelDisconnectRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelDisconnectRequest")), null, 2); - } + public static privateChannelOnAddContextListenerEventToJson(value: PrivateChannelOnAddContextListenerEvent): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnAddContextListenerEvent')), null, 2); + } - public static toPrivateChannelDisconnectResponse(json: string): PrivateChannelDisconnectResponse { - return cast(JSON.parse(json), r("PrivateChannelDisconnectResponse")); - } + public static toPrivateChannelOnDisconnectEvent(json: string): PrivateChannelOnDisconnectEvent { + return cast(JSON.parse(json), r('PrivateChannelOnDisconnectEvent')); + } - public static privateChannelDisconnectResponseToJson(value: PrivateChannelDisconnectResponse): string { - return JSON.stringify(uncast(value, r("PrivateChannelDisconnectResponse")), null, 2); - } + public static privateChannelOnDisconnectEventToJson(value: PrivateChannelOnDisconnectEvent): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnDisconnectEvent')), null, 2); + } - public static toPrivateChannelOnAddContextListenerEvent(json: string): PrivateChannelOnAddContextListenerEvent { - return cast(JSON.parse(json), r("PrivateChannelOnAddContextListenerEvent")); - } + public static toPrivateChannelOnUnsubscribeEvent(json: string): PrivateChannelOnUnsubscribeEvent { + return cast(JSON.parse(json), r('PrivateChannelOnUnsubscribeEvent')); + } - public static privateChannelOnAddContextListenerEventToJson(value: PrivateChannelOnAddContextListenerEvent): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnAddContextListenerEvent")), null, 2); - } + public static privateChannelOnUnsubscribeEventToJson(value: PrivateChannelOnUnsubscribeEvent): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnUnsubscribeEvent')), null, 2); + } - public static toPrivateChannelOnDisconnectEvent(json: string): PrivateChannelOnDisconnectEvent { - return cast(JSON.parse(json), r("PrivateChannelOnDisconnectEvent")); - } + public static toPrivateChannelUnsubscribeEventListenerRequest( + json: string + ): PrivateChannelUnsubscribeEventListenerRequest { + return cast(JSON.parse(json), r('PrivateChannelUnsubscribeEventListenerRequest')); + } + + public static privateChannelUnsubscribeEventListenerRequestToJson( + value: PrivateChannelUnsubscribeEventListenerRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelUnsubscribeEventListenerRequest')), null, 2); + } - public static privateChannelOnDisconnectEventToJson(value: PrivateChannelOnDisconnectEvent): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnDisconnectEvent")), null, 2); - } + public static toPrivateChannelUnsubscribeEventListenerResponse( + json: string + ): PrivateChannelUnsubscribeEventListenerResponse { + return cast(JSON.parse(json), r('PrivateChannelUnsubscribeEventListenerResponse')); + } + + public static privateChannelUnsubscribeEventListenerResponseToJson( + value: PrivateChannelUnsubscribeEventListenerResponse + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelUnsubscribeEventListenerResponse')), null, 2); + } - public static toPrivateChannelOnUnsubscribeEvent(json: string): PrivateChannelOnUnsubscribeEvent { - return cast(JSON.parse(json), r("PrivateChannelOnUnsubscribeEvent")); - } + public static toRaiseIntentForContextRequest(json: string): RaiseIntentForContextRequest { + return cast(JSON.parse(json), r('RaiseIntentForContextRequest')); + } - public static privateChannelOnUnsubscribeEventToJson(value: PrivateChannelOnUnsubscribeEvent): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnUnsubscribeEvent")), null, 2); - } + public static raiseIntentForContextRequestToJson(value: RaiseIntentForContextRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentForContextRequest')), null, 2); + } - public static toPrivateChannelUnsubscribeEventListenerRequest(json: string): PrivateChannelUnsubscribeEventListenerRequest { - return cast(JSON.parse(json), r("PrivateChannelUnsubscribeEventListenerRequest")); - } + public static toRaiseIntentForContextResponse(json: string): RaiseIntentForContextResponse { + return cast(JSON.parse(json), r('RaiseIntentForContextResponse')); + } - public static privateChannelUnsubscribeEventListenerRequestToJson(value: PrivateChannelUnsubscribeEventListenerRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelUnsubscribeEventListenerRequest")), null, 2); - } + public static raiseIntentForContextResponseToJson(value: RaiseIntentForContextResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentForContextResponse')), null, 2); + } - public static toPrivateChannelUnsubscribeEventListenerResponse(json: string): PrivateChannelUnsubscribeEventListenerResponse { - return cast(JSON.parse(json), r("PrivateChannelUnsubscribeEventListenerResponse")); - } + public static toRaiseIntentRequest(json: string): RaiseIntentRequest { + return cast(JSON.parse(json), r('RaiseIntentRequest')); + } - public static privateChannelUnsubscribeEventListenerResponseToJson(value: PrivateChannelUnsubscribeEventListenerResponse): string { - return JSON.stringify(uncast(value, r("PrivateChannelUnsubscribeEventListenerResponse")), null, 2); - } + public static raiseIntentRequestToJson(value: RaiseIntentRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentRequest')), null, 2); + } - public static toRaiseIntentForContextRequest(json: string): RaiseIntentForContextRequest { - return cast(JSON.parse(json), r("RaiseIntentForContextRequest")); - } + public static toRaiseIntentResponse(json: string): RaiseIntentResponse { + return cast(JSON.parse(json), r('RaiseIntentResponse')); + } - public static raiseIntentForContextRequestToJson(value: RaiseIntentForContextRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentForContextRequest")), null, 2); - } + public static raiseIntentResponseToJson(value: RaiseIntentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResponse')), null, 2); + } - public static toRaiseIntentForContextResponse(json: string): RaiseIntentForContextResponse { - return cast(JSON.parse(json), r("RaiseIntentForContextResponse")); - } + public static toRaiseIntentResultResponse(json: string): RaiseIntentResultResponse { + return cast(JSON.parse(json), r('RaiseIntentResultResponse')); + } - public static raiseIntentForContextResponseToJson(value: RaiseIntentForContextResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentForContextResponse")), null, 2); - } - - public static toRaiseIntentRequest(json: string): RaiseIntentRequest { - return cast(JSON.parse(json), r("RaiseIntentRequest")); - } - - public static raiseIntentRequestToJson(value: RaiseIntentRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentRequest")), null, 2); - } - - public static toRaiseIntentResponse(json: string): RaiseIntentResponse { - return cast(JSON.parse(json), r("RaiseIntentResponse")); - } - - public static raiseIntentResponseToJson(value: RaiseIntentResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResponse")), null, 2); - } - - public static toRaiseIntentResultResponse(json: string): RaiseIntentResultResponse { - return cast(JSON.parse(json), r("RaiseIntentResultResponse")); - } - - public static raiseIntentResultResponseToJson(value: RaiseIntentResultResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultResponse")), null, 2); - } + public static raiseIntentResultResponseToJson(value: RaiseIntentResultResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultResponse')), null, 2); + } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); } function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; } else { - return typeof typ; + return `one of [${typ + .map(a => { + return prettyTypeName(a); + }) + .join(', ')}]`; } + } else if (typeof typ === 'object' && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } } function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; + if (typ.jsonToJS === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.json] = { key: p.js, typ: p.typ })); + typ.jsonToJS = map; + } + return typ.jsonToJS; } function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; + if (typ.jsToJSON === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.js] = { key: p.json, typ: p.typ })); + typ.jsToJSON = map; + } + return typ.jsToJSON; } function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) { } - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); + function transformPrimitive(typ: string, val: any): any { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs: any[], val: any): any { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases: string[], val: any): any { + if (cases.indexOf(val) !== -1) return val; + return invalidValue( + cases.map(a => { + return l(a); + }), + val, + key, + parent + ); + } + + function transformArray(typ: any, val: any): any { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l('array'), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val: any): any { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l('Date'), val, key, parent); + } + return d; + } + + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { + if (val === null || typeof val !== 'object' || Array.isArray(val)) { + return invalidValue(l(ref || 'object'), val, key, parent); + } + const result: any = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); } function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); + return transform(val, typ, jsonToJSProps); } function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); + return transform(val, typ, jsToJSONProps); } function l(typ: any) { - return { literal: typ }; + return { literal: typ }; } function a(typ: any) { - return { arrayItems: typ }; + return { arrayItems: typ }; } function u(...typs: any[]) { - return { unionMembers: typs }; + return { unionMembers: typs }; } function o(props: any[], additional: any) { - return { props, additional }; + return { props, additional }; } function m(additional: any) { - return { props: [], additional }; + return { props: [], additional }; } function r(name: string) { - return { ref: name }; + return { ref: name }; } const typeMap: any = { - "WebConnectionProtocol1Hello": o([ - { json: "meta", js: "meta", typ: r("WebConnectionProtocol1HelloMeta") }, - { json: "payload", js: "payload", typ: r("WebConnectionProtocol1HelloPayload") }, - { json: "type", js: "type", typ: r("WebConnectionProtocol1HelloType") }, - ], false), - "WebConnectionProtocol1HelloMeta": o([ - { json: "connectionAttemptUuid", js: "connectionAttemptUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "WebConnectionProtocol1HelloPayload": o([ - { json: "actualUrl", js: "actualUrl", typ: "" }, - { json: "channelSelector", js: "channelSelector", typ: u(undefined, true) }, - { json: "fdc3Version", js: "fdc3Version", typ: "" }, - { json: "identityUrl", js: "identityUrl", typ: "" }, - { json: "intentResolver", js: "intentResolver", typ: u(undefined, true) }, - ], "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") }, - { json: "payload", js: "payload", typ: r("AddContextListenerRequestPayload") }, - { json: "type", js: "type", typ: r("AddContextListenerRequestType") }, - ], false), - "AddContextListenerRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("AppIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "AppIdentifier": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "AddContextListenerRequestPayload": o([ - { json: "channelId", js: "channelId", typ: u(null, "") }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "AddContextListenerResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("AddContextListenerResponsePayload") }, - { json: "type", js: "type", typ: r("AddContextListenerResponseType") }, - ], false), - "AddContextListenerResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("AppIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "AddContextListenerResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "listenerUUID", js: "listenerUUID", typ: u(undefined, "") }, - ], false), - "AddEventListenerRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("AddEventListenerRequestPayload") }, - { json: "type", js: "type", typ: r("AddEventListenerRequestType") }, - ], false), - "AddEventListenerRequestPayload": o([ - { json: "type", js: "type", typ: u(r("FDC3EventType"), null) }, - ], false), - "AddEventListenerResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("AddEventListenerResponsePayload") }, - { json: "type", js: "type", typ: r("AddEventListenerResponseType") }, - ], false), - "AddEventListenerResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponsePayloadError")) }, - { json: "listenerUUID", js: "listenerUUID", typ: u(undefined, "") }, - ], false), - "AddIntentListenerRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("AddIntentListenerRequestPayload") }, - { json: "type", js: "type", typ: r("AddIntentListenerRequestType") }, - ], false), - "AddIntentListenerRequestPayload": o([ - { json: "intent", js: "intent", typ: "" }, - ], false), - "AddIntentListenerResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("AddIntentListenerResponsePayload") }, - { json: "type", js: "type", typ: r("AddIntentListenerResponseType") }, - ], false), - "AddIntentListenerResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FluffyError")) }, - { json: "listenerUUID", js: "listenerUUID", typ: u(undefined, "") }, - ], "any"), - "AgentEventMessage": o([ - { json: "meta", js: "meta", typ: r("AgentEventMessageMeta") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("EventMessageType") }, - ], false), - "AgentEventMessageMeta": o([ - { json: "eventUuid", js: "eventUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "AgentResponseMessage": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMessageMeta") }, - { json: "payload", js: "payload", typ: r("AgentResponseMessageResponsePayload") }, - { json: "type", js: "type", typ: r("ResponseMessageType") }, - ], false), - "AgentResponseMessageMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("AppIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "AgentResponseMessageResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponsePayloadError")) }, - ], "any"), - "AppRequestMessage": o([ - { json: "meta", js: "meta", typ: r("AppRequestMessageMeta") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("RequestMessageType") }, - ], false), - "AppRequestMessageMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("AppIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BroadcastEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastEventPayload") }, - { json: "type", js: "type", typ: r("BroadcastEventType") }, - ], false), - "BroadcastEventMeta": o([ - { json: "eventUuid", js: "eventUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BroadcastEventPayload": o([ - { json: "channelId", js: "channelId", typ: u(null, "") }, - { json: "context", js: "context", typ: r("Context") }, - { json: "originatingApp", js: "originatingApp", typ: u(undefined, r("AppIdentifier")) }, - ], false), - "Context": o([ - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: "" }, - ], "any"), - "BroadcastRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastRequestPayload") }, - { json: "type", js: "type", typ: r("BroadcastRequestType") }, - ], false), - "BroadcastRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "BroadcastResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("BroadcastResponseType") }, - ], false), - "BroadcastResponseResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponsePayloadError")) }, - ], "any"), - "ChannelChangedEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("ChannelChangedEventPayload") }, - { json: "type", js: "type", typ: r("ChannelChangedEventType") }, - ], false), - "ChannelChangedEventPayload": o([ - { json: "newChannelId", js: "newChannelId", typ: u(null, "") }, - ], false), - "ContextListenerUnsubscribeRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("ContextListenerUnsubscribeRequestPayload") }, - { json: "type", js: "type", typ: r("ContextListenerUnsubscribeRequestType") }, - ], false), - "ContextListenerUnsubscribeRequestPayload": o([ - { json: "listenerUUID", js: "listenerUUID", typ: "" }, - ], false), - "ContextListenerUnsubscribeResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("ContextListenerUnsubscribeResponseType") }, - ], false), - "CreatePrivateChannelRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("CreatePrivateChannelRequestPayload") }, - { json: "type", js: "type", typ: r("CreatePrivateChannelRequestType") }, - ], false), - "CreatePrivateChannelRequestPayload": o([ - ], false), - "CreatePrivateChannelResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("CreatePrivateChannelResponsePayload") }, - { json: "type", js: "type", typ: r("CreatePrivateChannelResponseType") }, - ], false), - "CreatePrivateChannelResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "privateChannel", js: "privateChannel", typ: u(undefined, r("Channel")) }, - ], false), - "Channel": o([ - { json: "displayMetadata", js: "displayMetadata", typ: u(undefined, r("DisplayMetadata")) }, - { json: "id", js: "id", typ: "" }, - { json: "type", js: "type", typ: r("Type") }, - ], false), - "DisplayMetadata": o([ - { json: "color", js: "color", typ: u(undefined, "") }, - { json: "glyph", js: "glyph", typ: u(undefined, "") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], false), - "EventListenerUnsubscribeRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("EventListenerUnsubscribeRequestPayload") }, - { json: "type", js: "type", typ: r("EventListenerUnsubscribeRequestType") }, - ], false), - "EventListenerUnsubscribeRequestPayload": o([ - { json: "listenerUUID", js: "listenerUUID", typ: "" }, - ], false), - "EventListenerUnsubscribeResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("EventListenerUnsubscribeResponseType") }, - ], 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") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceChannelsType") }, - ], false), - "Fdc3UserInterfaceChannelsPayload": o([ - { json: "selected", js: "selected", typ: u(null, "") }, - { json: "userChannels", js: "userChannels", typ: a(r("Channel")) }, - ], false), - "Fdc3UserInterfaceDrag": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceDragPayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceDragType") }, - ], false), - "Fdc3UserInterfaceDragPayload": o([ - { json: "mouseOffsets", js: "mouseOffsets", typ: r("MouseOffsets") }, - ], false), - "MouseOffsets": o([ - { json: "x", js: "x", typ: 0 }, - { json: "y", js: "y", typ: 0 }, - ], false), - "Fdc3UserInterfaceHandshake": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceHandshakePayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceHandshakeType") }, - ], false), - "Fdc3UserInterfaceHandshakePayload": o([ - { json: "fdc3Version", js: "fdc3Version", typ: "" }, - ], false), - "Fdc3UserInterfaceHello": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceHelloPayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceHelloType") }, - ], false), - "Fdc3UserInterfaceHelloPayload": o([ - { json: "implementationDetails", js: "implementationDetails", typ: "" }, - { json: "initialCSS", js: "initialCSS", typ: r("InitialCSS") }, - ], false), - "InitialCSS": o([ - { json: "bottom", js: "bottom", typ: u(undefined, "") }, - { json: "height", js: "height", typ: u(undefined, "") }, - { json: "left", js: "left", typ: u(undefined, "") }, - { json: "maxHeight", js: "maxHeight", typ: u(undefined, "") }, - { json: "maxWidth", js: "maxWidth", typ: u(undefined, "") }, - { json: "right", js: "right", typ: u(undefined, "") }, - { json: "top", js: "top", typ: u(undefined, "") }, - { json: "transition", js: "transition", typ: u(undefined, "") }, - { json: "width", js: "width", typ: u(undefined, "") }, - { json: "zIndex", js: "zIndex", typ: u(undefined, "") }, - ], "any"), - "Fdc3UserInterfaceMessage": o([ - { json: "payload", js: "payload", typ: u(undefined, m("any")) }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceMessageType") }, - ], false), - "Fdc3UserInterfaceResolve": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceResolvePayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceResolveType") }, - ], false), - "Fdc3UserInterfaceResolvePayload": o([ - { json: "appIntents", js: "appIntents", typ: a(r("AppIntent")) }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "AppIntent": o([ - { json: "apps", js: "apps", typ: a(r("AppMetadata")) }, - { json: "intent", js: "intent", typ: r("IntentMetadata") }, - ], false), - "IntentMetadata": o([ - { json: "displayName", js: "displayName", typ: u(undefined, "") }, - { json: "name", js: "name", typ: "" }, - ], false), - "Fdc3UserInterfaceResolveAction": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceResolveActionPayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceResolveActionType") }, - ], false), - "Fdc3UserInterfaceResolveActionPayload": o([ - { json: "action", js: "action", typ: r("Action") }, - { json: "appIdentifier", js: "appIdentifier", typ: u(undefined, r("AppIdentifier")) }, - { json: "intent", js: "intent", typ: u(undefined, "") }, - ], false), - "Fdc3UserInterfaceRestyle": o([ - { json: "payload", js: "payload", typ: r("Fdc3UserInterfaceRestylePayload") }, - { json: "type", js: "type", typ: r("Fdc3UserInterfaceRestyleType") }, - ], false), - "Fdc3UserInterfaceRestylePayload": o([ - { json: "updatedCSS", js: "updatedCSS", typ: r("UpdatedCSS") }, - ], false), - "UpdatedCSS": o([ - { json: "bottom", js: "bottom", typ: u(undefined, "") }, - { json: "height", js: "height", typ: u(undefined, "") }, - { json: "left", js: "left", typ: u(undefined, "") }, - { json: "maxHeight", js: "maxHeight", typ: u(undefined, "") }, - { json: "maxWidth", js: "maxWidth", typ: u(undefined, "") }, - { json: "right", js: "right", typ: u(undefined, "") }, - { json: "top", js: "top", typ: u(undefined, "") }, - { json: "transition", js: "transition", typ: u(undefined, "") }, - { json: "width", js: "width", typ: u(undefined, "") }, - { json: "zIndex", js: "zIndex", typ: u(undefined, "") }, - ], "any"), - "FindInstancesRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesRequestPayload") }, - { json: "type", js: "type", typ: r("FindInstancesRequestType") }, - ], false), - "FindInstancesRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "FindInstancesResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesResponsePayload") }, - { json: "type", js: "type", typ: r("FindInstancesResponseType") }, - ], false), - "FindInstancesResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) }, - { json: "appIdentifiers", js: "appIdentifiers", typ: u(undefined, a(r("AppMetadata"))) }, - ], false), - "FindIntentRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentRequestType") }, - ], false), - "FindIntentRequestPayload": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "intent", js: "intent", typ: "" }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentResponseType") }, - ], false), - "FindIntentResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) }, - { json: "appIntent", js: "appIntent", typ: u(undefined, r("AppIntent")) }, - ], false), - "FindIntentsByContextRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextRequestType") }, - ], false), - "FindIntentsByContextRequestPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentsByContextResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextResponseType") }, - ], false), - "FindIntentsByContextResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) }, - { json: "appIntents", js: "appIntents", typ: u(undefined, a(r("AppIntent"))) }, - ], false), - "GetAppMetadataRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataRequestPayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataRequestType") }, - ], false), - "GetAppMetadataRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "GetAppMetadataResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataResponseType") }, - ], false), - "GetAppMetadataResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) }, - { json: "appMetadata", js: "appMetadata", typ: u(undefined, r("AppMetadata")) }, - ], false), - "GetCurrentChannelRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetCurrentChannelRequestPayload") }, - { json: "type", js: "type", typ: r("GetCurrentChannelRequestType") }, - ], false), - "GetCurrentChannelRequestPayload": o([ - ], false), - "GetCurrentChannelResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetCurrentChannelResponsePayload") }, - { json: "type", js: "type", typ: r("GetCurrentChannelResponseType") }, - ], false), - "GetCurrentChannelResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponsePayloadError")) }, - { json: "channel", js: "channel", typ: u(undefined, u(r("Channel"), null)) }, - ], false), - "GetCurrentContextRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetCurrentContextRequestPayload") }, - { json: "type", js: "type", typ: r("GetCurrentContextRequestType") }, - ], false), - "GetCurrentContextRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "GetCurrentContextResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetCurrentContextResponsePayload") }, - { json: "type", js: "type", typ: r("GetCurrentContextResponseType") }, - ], false), - "GetCurrentContextResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "context", js: "context", typ: u(undefined, u(null, r("Context"))) }, - ], false), - "GetInfoRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetInfoRequestPayload") }, - { json: "type", js: "type", typ: r("GetInfoRequestType") }, - ], false), - "GetInfoRequestPayload": o([ - ], false), - "GetInfoResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetInfoResponsePayload") }, - { json: "type", js: "type", typ: r("GetInfoResponseType") }, - ], false), - "GetInfoResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponsePayloadError")) }, - { json: "implementationMetadata", js: "implementationMetadata", typ: u(undefined, r("ImplementationMetadata")) }, - ], false), - "GetOrCreateChannelRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetOrCreateChannelRequestPayload") }, - { json: "type", js: "type", typ: r("GetOrCreateChannelRequestType") }, - ], false), - "GetOrCreateChannelRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "GetOrCreateChannelResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetOrCreateChannelResponsePayload") }, - { json: "type", js: "type", typ: r("GetOrCreateChannelResponseType") }, - ], false), - "GetOrCreateChannelResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "channel", js: "channel", typ: u(undefined, r("Channel")) }, - ], false), - "GetUserChannelsRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetUserChannelsRequestPayload") }, - { json: "type", js: "type", typ: r("GetUserChannelsRequestType") }, - ], false), - "GetUserChannelsRequestPayload": o([ - ], false), - "GetUserChannelsResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetUserChannelsResponsePayload") }, - { json: "type", js: "type", typ: r("GetUserChannelsResponseType") }, - ], false), - "GetUserChannelsResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "userChannels", js: "userChannels", typ: u(undefined, a(r("Channel"))) }, - ], false), - "HeartbeatAcknowledgementRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("HeartbeatAcknowledgementRequestPayload") }, - { json: "type", js: "type", typ: r("HeartbeatAcknowledgementRequestType") }, - ], false), - "HeartbeatAcknowledgementRequestPayload": o([ - { json: "heartbeatEventUuid", js: "heartbeatEventUuid", typ: "" }, - ], false), - "HeartbeatEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("HeartbeatEventPayload") }, - { json: "type", js: "type", typ: r("HeartbeatEventType") }, - ], false), - "HeartbeatEventPayload": o([ - ], false), - "IntentEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("IntentEventPayload") }, - { json: "type", js: "type", typ: r("IntentEventType") }, - ], false), - "IntentEventPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "intent", js: "intent", typ: "" }, - { json: "originatingApp", js: "originatingApp", typ: u(undefined, r("AppIdentifier")) }, - { json: "raiseIntentRequestUuid", js: "raiseIntentRequestUuid", typ: "" }, - ], false), - "IntentListenerUnsubscribeRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("IntentListenerUnsubscribeRequestPayload") }, - { json: "type", js: "type", typ: r("IntentListenerUnsubscribeRequestType") }, - ], false), - "IntentListenerUnsubscribeRequestPayload": o([ - { json: "listenerUUID", js: "listenerUUID", typ: "" }, - ], false), - "IntentListenerUnsubscribeResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("IntentListenerUnsubscribeResponseType") }, - ], false), - "IntentResultRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("IntentResultRequestPayload") }, - { json: "type", js: "type", typ: r("IntentResultRequestType") }, - ], false), - "IntentResultRequestPayload": o([ - { json: "intentEventUuid", js: "intentEventUuid", typ: "" }, - { json: "intentResult", js: "intentResult", typ: r("IntentResult") }, - { json: "raiseIntentRequestUuid", js: "raiseIntentRequestUuid", typ: "" }, - ], false), - "IntentResult": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "channel", js: "channel", typ: u(undefined, r("Channel")) }, - ], false), - "IntentResultResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("IntentResultResponseType") }, - ], false), - "JoinUserChannelRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("JoinUserChannelRequestPayload") }, - { json: "type", js: "type", typ: r("JoinUserChannelRequestType") }, - ], false), - "JoinUserChannelRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "JoinUserChannelResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("JoinUserChannelResponsePayload") }, - { json: "type", js: "type", typ: r("JoinUserChannelResponseType") }, - ], false), - "JoinUserChannelResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - ], false), - "LeaveCurrentChannelRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("LeaveCurrentChannelRequestPayload") }, - { json: "type", js: "type", typ: r("LeaveCurrentChannelRequestType") }, - ], false), - "LeaveCurrentChannelRequestPayload": o([ - ], false), - "LeaveCurrentChannelResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("LeaveCurrentChannelResponsePayload") }, - { json: "type", js: "type", typ: r("LeaveCurrentChannelResponseType") }, - ], false), - "LeaveCurrentChannelResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - ], false), - "OpenRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("OpenRequestPayload") }, - { json: "type", js: "type", typ: r("OpenRequestType") }, - ], false), - "OpenRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - ], false), - "OpenResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenResponsePayload") }, - { json: "type", js: "type", typ: r("OpenResponseType") }, - ], false), - "OpenResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("OpenErrorResponsePayload")) }, - { json: "appIdentifier", js: "appIdentifier", typ: u(undefined, r("AppIdentifier")) }, - ], false), - "PrivateChannelAddEventListenerRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("TPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelAddEventListenerRequestType") }, - ], false), - "TPayload": o([ - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - { json: "privateChannelId", js: "privateChannelId", typ: "" }, - ], false), - "PrivateChannelAddEventListenerResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelAddEventListenerResponsePayload") }, - { json: "type", js: "type", typ: r("PrivateChannelAddEventListenerResponseType") }, - ], false), - "PrivateChannelAddEventListenerResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - { json: "listenerUUID", js: "listenerUUID", typ: u(undefined, "") }, - ], "any"), - "PrivateChannelDisconnectRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelDisconnectRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelDisconnectRequestType") }, - ], false), - "PrivateChannelDisconnectRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "PrivateChannelDisconnectResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelDisconnectResponsePayload") }, - { json: "type", js: "type", typ: r("PrivateChannelDisconnectResponseType") }, - ], false), - "PrivateChannelDisconnectResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("PurpleError")) }, - ], false), - "PrivateChannelOnAddContextListenerEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnAddContextListenerEventPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnAddContextListenerEventType") }, - ], false), - "PrivateChannelOnAddContextListenerEventPayload": o([ - { json: "contextType", js: "contextType", typ: u(null, "") }, - { json: "privateChannelId", js: "privateChannelId", typ: "" }, - ], false), - "PrivateChannelOnDisconnectEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnDisconnectEventPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnDisconnectEventType") }, - ], false), - "PrivateChannelOnDisconnectEventPayload": o([ - { json: "privateChannelId", js: "privateChannelId", typ: "" }, - ], false), - "PrivateChannelOnUnsubscribeEvent": o([ - { json: "meta", js: "meta", typ: r("BroadcastEventMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnUnsubscribeEventPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnUnsubscribeEventType") }, - ], false), - "PrivateChannelOnUnsubscribeEventPayload": o([ - { json: "contextType", js: "contextType", typ: u(null, "") }, - { json: "privateChannelId", js: "privateChannelId", typ: "" }, - ], false), - "PrivateChannelUnsubscribeEventListenerRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelUnsubscribeEventListenerRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelUnsubscribeEventListenerRequestType") }, - ], false), - "PrivateChannelUnsubscribeEventListenerRequestPayload": o([ - { json: "listenerUUID", js: "listenerUUID", typ: "" }, - ], false), - "PrivateChannelUnsubscribeEventListenerResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastResponseResponsePayload") }, - { json: "type", js: "type", typ: r("PrivateChannelUnsubscribeEventListenerResponseType") }, - ], false), - "RaiseIntentForContextRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentForContextRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentForContextRequestType") }, - ], false), - "RaiseIntentForContextRequestPayload": o([ - { json: "app", js: "app", typ: u(undefined, r("AppIdentifier")) }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "RaiseIntentForContextResponse": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentForContextResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentForContextResponseType") }, - ], false), - "RaiseIntentForContextResponsePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("FindInstancesErrors")) }, - { json: "intentResolution", js: "intentResolution", typ: u(undefined, r("IntentResolution")) }, - { json: "appIntents", js: "appIntents", typ: u(undefined, a(r("AppIntent"))) }, - ], false), - "IntentResolution": o([ - { json: "intent", js: "intent", typ: "" }, - { json: "source", js: "source", typ: r("AppIdentifier") }, - ], false), - "RaiseIntentRequest": o([ - { json: "meta", js: "meta", typ: r("AddContextListenerRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentRequestType") }, - ], false), - "RaiseIntentRequestPayload": o([ - { json: "app", js: "app", typ: u(undefined, r("AppIdentifier")) }, - { json: "context", js: "context", typ: r("Context") }, - { 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), - "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", - ], - "FDC3EventType": [ - "USER_CHANNEL_CHANGED", - ], - "AddEventListenerRequestType": [ - "addEventListenerRequest", - ], - "ResponsePayloadError": [ - "AccessDenied", - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "CreationFailed", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "IntentDeliveryFailed", - "IntentHandlerRejected", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NoChannelFound", - "NoResultReturned", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "AddEventListenerResponseType": [ - "addEventListenerResponse", - ], - "AddIntentListenerRequestType": [ - "addIntentListenerRequest", - ], - "FluffyError": [ - "DesktopAgentNotFound", - "IntentDeliveryFailed", - "MalformedContext", - "NoAppsFound", - "ResolverTimeout", - "ResolverUnavailable", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "AddIntentListenerResponseType": [ - "addIntentListenerResponse", - ], - "EventMessageType": [ - "addEventListenerEvent", - "broadcastEvent", - "channelChangedEvent", - "heartbeatEvent", - "intentEvent", - "privateChannelOnAddContextListenerEvent", - "privateChannelOnDisconnectEvent", - "privateChannelOnUnsubscribeEvent", - ], - "ResponseMessageType": [ - "addContextListenerResponse", - "addEventListenerResponse", - "addIntentListenerResponse", - "broadcastResponse", - "contextListenerUnsubscribeResponse", - "createPrivateChannelResponse", - "eventListenerUnsubscribeResponse", - "findInstancesResponse", - "findIntentResponse", - "findIntentsByContextResponse", - "getAppMetadataResponse", - "getCurrentChannelResponse", - "getCurrentContextResponse", - "getInfoResponse", - "getOrCreateChannelResponse", - "getUserChannelsResponse", - "intentListenerUnsubscribeResponse", - "intentResultResponse", - "joinUserChannelResponse", - "leaveCurrentChannelResponse", - "openResponse", - "privateChannelAddEventListenerResponse", - "privateChannelDisconnectResponse", - "privateChannelUnsubscribeEventListenerResponse", - "raiseIntentForContextResponse", - "raiseIntentResponse", - "raiseIntentResultResponse", - ], - "RequestMessageType": [ - "addContextListenerRequest", - "addEventListenerRequest", - "addIntentListenerRequest", - "broadcastRequest", - "contextListenerUnsubscribeRequest", - "createPrivateChannelRequest", - "eventListenerUnsubscribeRequest", - "findInstancesRequest", - "findIntentRequest", - "findIntentsByContextRequest", - "getAppMetadataRequest", - "getCurrentChannelRequest", - "getCurrentContextRequest", - "getInfoRequest", - "getOrCreateChannelRequest", - "getUserChannelsRequest", - "heartbeatAcknowledgementRequest", - "intentListenerUnsubscribeRequest", - "intentResultRequest", - "joinUserChannelRequest", - "leaveCurrentChannelRequest", - "openRequest", - "privateChannelAddEventListenerRequest", - "privateChannelDisconnectRequest", - "privateChannelUnsubscribeEventListenerRequest", - "raiseIntentForContextRequest", - "raiseIntentRequest", - ], - "BroadcastEventType": [ - "broadcastEvent", - ], - "BroadcastRequestType": [ - "broadcastRequest", - ], - "BroadcastResponseType": [ - "broadcastResponse", - ], - "ChannelChangedEventType": [ - "channelChangedEvent", - ], - "ContextListenerUnsubscribeRequestType": [ - "contextListenerUnsubscribeRequest", - ], - "ContextListenerUnsubscribeResponseType": [ - "contextListenerUnsubscribeResponse", - ], - "CreatePrivateChannelRequestType": [ - "createPrivateChannelRequest", - ], - "Type": [ - "app", - "private", - "user", - ], - "CreatePrivateChannelResponseType": [ - "createPrivateChannelResponse", - ], - "EventListenerUnsubscribeRequestType": [ - "eventListenerUnsubscribeRequest", - ], - "EventListenerUnsubscribeResponseType": [ - "eventListenerUnsubscribeResponse", - ], - "Fdc3UserInterfaceChannelSelectedType": [ - "Fdc3UserInterfaceChannelSelected", - ], - "Fdc3UserInterfaceChannelsType": [ - "Fdc3UserInterfaceChannels", - ], - "Fdc3UserInterfaceDragType": [ - "Fdc3UserInterfaceDrag", - ], - "Fdc3UserInterfaceHandshakeType": [ - "Fdc3UserInterfaceHandshake", - ], - "Fdc3UserInterfaceHelloType": [ - "Fdc3UserInterfaceHello", - ], - "Fdc3UserInterfaceMessageType": [ - "Fdc3UserInterfaceChannelSelected", - "Fdc3UserInterfaceChannels", - "Fdc3UserInterfaceDrag", - "Fdc3UserInterfaceHandshake", - "Fdc3UserInterfaceHello", - "Fdc3UserInterfaceResolve", - "Fdc3UserInterfaceResolveAction", - "Fdc3UserInterfaceRestyle", - ], - "Fdc3UserInterfaceResolveType": [ - "Fdc3UserInterfaceResolve", - ], - "Action": [ - "cancel", - "click", - "hover", + 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') }, + { json: 'payload', js: 'payload', typ: r('AddContextListenerRequestPayload') }, + { json: 'type', js: 'type', typ: r('AddContextListenerRequestType') }, + ], + false + ), + AddContextListenerRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('AppIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + AppIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + AddContextListenerRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: u(null, '') }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + AddContextListenerResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('AddContextListenerResponsePayload') }, + { json: 'type', js: 'type', typ: r('AddContextListenerResponseType') }, + ], + false + ), + AddContextListenerResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('AppIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + AddContextListenerResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'listenerUUID', js: 'listenerUUID', typ: u(undefined, '') }, + ], + false + ), + AddEventListenerRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('AddEventListenerRequestPayload') }, + { json: 'type', js: 'type', typ: r('AddEventListenerRequestType') }, + ], + false + ), + AddEventListenerRequestPayload: o([{ json: 'type', js: 'type', typ: u(r('FDC3EventType'), null) }], false), + AddEventListenerResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('AddEventListenerResponsePayload') }, + { json: 'type', js: 'type', typ: r('AddEventListenerResponseType') }, + ], + false + ), + AddEventListenerResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, + { json: 'listenerUUID', js: 'listenerUUID', typ: u(undefined, '') }, + ], + false + ), + AddIntentListenerRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('AddIntentListenerRequestPayload') }, + { json: 'type', js: 'type', typ: r('AddIntentListenerRequestType') }, + ], + false + ), + AddIntentListenerRequestPayload: o([{ json: 'intent', js: 'intent', typ: '' }], false), + AddIntentListenerResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('AddIntentListenerResponsePayload') }, + { json: 'type', js: 'type', typ: r('AddIntentListenerResponseType') }, + ], + false + ), + AddIntentListenerResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FluffyError')) }, + { json: 'listenerUUID', js: 'listenerUUID', typ: u(undefined, '') }, + ], + 'any' + ), + AgentEventMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentEventMessageMeta') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('EventMessageType') }, + ], + false + ), + AgentEventMessageMeta: o( + [ + { json: 'eventUuid', js: 'eventUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + AgentResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: r('AgentResponseMessageResponsePayload') }, + { json: 'type', js: 'type', typ: r('ResponseMessageType') }, + ], + false + ), + AgentResponseMessageMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('AppIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + AgentResponseMessageResponsePayload: o( + [{ json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }], + 'any' + ), + AppRequestMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AppRequestMessageMeta') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('RequestMessageType') }, + ], + false + ), + AppRequestMessageMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('AppIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BroadcastEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastEventPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastEventType') }, + ], + false + ), + BroadcastEventMeta: o( + [ + { json: 'eventUuid', js: 'eventUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BroadcastEventPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: u(null, '') }, + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'originatingApp', js: 'originatingApp', typ: u(undefined, r('AppIdentifier')) }, + ], + false + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + BroadcastRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastRequestPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastRequestType') }, + ], + false + ), + BroadcastRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + BroadcastResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('BroadcastResponseType') }, + ], + false + ), + BroadcastResponseResponsePayload: o( + [{ json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }], + 'any' + ), + ChannelChangedEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('ChannelChangedEventPayload') }, + { json: 'type', js: 'type', typ: r('ChannelChangedEventType') }, + ], + false + ), + ChannelChangedEventPayload: o([{ json: 'newChannelId', js: 'newChannelId', typ: u(null, '') }], false), + ContextListenerUnsubscribeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('ContextListenerUnsubscribeRequestPayload') }, + { json: 'type', js: 'type', typ: r('ContextListenerUnsubscribeRequestType') }, + ], + false + ), + ContextListenerUnsubscribeRequestPayload: o([{ json: 'listenerUUID', js: 'listenerUUID', typ: '' }], false), + ContextListenerUnsubscribeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('ContextListenerUnsubscribeResponseType') }, + ], + false + ), + CreatePrivateChannelRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('CreatePrivateChannelRequestPayload') }, + { json: 'type', js: 'type', typ: r('CreatePrivateChannelRequestType') }, + ], + false + ), + CreatePrivateChannelRequestPayload: o([], false), + CreatePrivateChannelResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('CreatePrivateChannelResponsePayload') }, + { json: 'type', js: 'type', typ: r('CreatePrivateChannelResponseType') }, + ], + false + ), + CreatePrivateChannelResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'privateChannel', js: 'privateChannel', typ: u(undefined, r('Channel')) }, + ], + false + ), + Channel: o( + [ + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadata')) }, + { json: 'id', js: 'id', typ: '' }, + { json: 'type', js: 'type', typ: r('Type') }, + ], + false + ), + DisplayMetadata: o( + [ + { json: 'color', js: 'color', typ: u(undefined, '') }, + { json: 'glyph', js: 'glyph', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + ], + false + ), + EventListenerUnsubscribeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('EventListenerUnsubscribeRequestPayload') }, + { json: 'type', js: 'type', typ: r('EventListenerUnsubscribeRequestType') }, + ], + false + ), + EventListenerUnsubscribeRequestPayload: o([{ json: 'listenerUUID', js: 'listenerUUID', typ: '' }], false), + EventListenerUnsubscribeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('EventListenerUnsubscribeResponseType') }, + ], + 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') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceChannelsType') }, + ], + false + ), + Fdc3UserInterfaceChannelsPayload: o( + [ + { json: 'selected', js: 'selected', typ: u(null, '') }, + { json: 'userChannels', js: 'userChannels', typ: a(r('Channel')) }, + ], + false + ), + Fdc3UserInterfaceDrag: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceDragPayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceDragType') }, + ], + false + ), + Fdc3UserInterfaceDragPayload: o([{ json: 'mouseOffsets', js: 'mouseOffsets', typ: r('MouseOffsets') }], false), + MouseOffsets: o( + [ + { json: 'x', js: 'x', typ: 0 }, + { json: 'y', js: 'y', typ: 0 }, + ], + false + ), + Fdc3UserInterfaceHandshake: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceHandshakePayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceHandshakeType') }, + ], + false + ), + Fdc3UserInterfaceHandshakePayload: o([{ json: 'fdc3Version', js: 'fdc3Version', typ: '' }], false), + Fdc3UserInterfaceHello: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceHelloPayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceHelloType') }, + ], + false + ), + Fdc3UserInterfaceHelloPayload: o( + [ + { json: 'implementationDetails', js: 'implementationDetails', typ: '' }, + { json: 'initialCSS', js: 'initialCSS', typ: r('InitialCSS') }, + ], + false + ), + InitialCSS: o( + [ + { json: 'bottom', js: 'bottom', typ: u(undefined, '') }, + { json: 'height', js: 'height', typ: u(undefined, '') }, + { json: 'left', js: 'left', typ: u(undefined, '') }, + { json: 'maxHeight', js: 'maxHeight', typ: u(undefined, '') }, + { json: 'maxWidth', js: 'maxWidth', typ: u(undefined, '') }, + { json: 'right', js: 'right', typ: u(undefined, '') }, + { json: 'top', js: 'top', typ: u(undefined, '') }, + { json: 'transition', js: 'transition', typ: u(undefined, '') }, + { json: 'width', js: 'width', typ: u(undefined, '') }, + { json: 'zIndex', js: 'zIndex', typ: u(undefined, '') }, + ], + 'any' + ), + Fdc3UserInterfaceMessage: o( + [ + { json: 'payload', js: 'payload', typ: u(undefined, m('any')) }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceMessageType') }, + ], + false + ), + Fdc3UserInterfaceResolve: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceResolvePayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceResolveType') }, + ], + false + ), + Fdc3UserInterfaceResolvePayload: o( + [ + { json: 'appIntents', js: 'appIntents', typ: a(r('AppIntent')) }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + AppIntent: o( + [ + { json: 'apps', js: 'apps', typ: a(r('AppMetadata')) }, + { json: 'intent', js: 'intent', typ: r('IntentMetadata') }, + ], + false + ), + IntentMetadata: o( + [ + { json: 'displayName', js: 'displayName', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: '' }, + ], + false + ), + Fdc3UserInterfaceResolveAction: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceResolveActionPayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceResolveActionType') }, + ], + false + ), + Fdc3UserInterfaceResolveActionPayload: o( + [ + { json: 'action', js: 'action', typ: r('Action') }, + { json: 'appIdentifier', js: 'appIdentifier', typ: u(undefined, r('AppIdentifier')) }, + { json: 'intent', js: 'intent', typ: u(undefined, '') }, + ], + false + ), + Fdc3UserInterfaceRestyle: o( + [ + { json: 'payload', js: 'payload', typ: r('Fdc3UserInterfaceRestylePayload') }, + { json: 'type', js: 'type', typ: r('Fdc3UserInterfaceRestyleType') }, + ], + false + ), + Fdc3UserInterfaceRestylePayload: o([{ json: 'updatedCSS', js: 'updatedCSS', typ: r('UpdatedCSS') }], false), + UpdatedCSS: o( + [ + { json: 'bottom', js: 'bottom', typ: u(undefined, '') }, + { json: 'height', js: 'height', typ: u(undefined, '') }, + { json: 'left', js: 'left', typ: u(undefined, '') }, + { json: 'maxHeight', js: 'maxHeight', typ: u(undefined, '') }, + { json: 'maxWidth', js: 'maxWidth', typ: u(undefined, '') }, + { json: 'right', js: 'right', typ: u(undefined, '') }, + { json: 'top', js: 'top', typ: u(undefined, '') }, + { json: 'transition', js: 'transition', typ: u(undefined, '') }, + { json: 'width', js: 'width', typ: u(undefined, '') }, + { json: 'zIndex', js: 'zIndex', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesRequestType') }, ], - "Fdc3UserInterfaceResolveActionType": [ - "Fdc3UserInterfaceResolveAction", + false + ), + FindInstancesRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + FindInstancesResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesResponseType') }, ], - "Fdc3UserInterfaceRestyleType": [ - "Fdc3UserInterfaceRestyle", + false + ), + FindInstancesResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'appIdentifiers', js: 'appIdentifiers', typ: u(undefined, a(r('AppMetadata'))) }, ], - "FindInstancesRequestType": [ - "findInstancesRequest", + false + ), + FindIntentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentRequestType') }, ], - "FindInstancesErrors": [ - "AgentDisconnected", - "DesktopAgentNotFound", - "IntentDeliveryFailed", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", + false + ), + FindIntentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, ], - "FindInstancesResponseType": [ - "findInstancesResponse", + false + ), + FindIntentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentResponseType') }, ], - "FindIntentRequestType": [ - "findIntentRequest", + false + ), + FindIntentResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'appIntent', js: 'appIntent', typ: u(undefined, r('AppIntent')) }, ], - "FindIntentResponseType": [ - "findIntentResponse", + false + ), + FindIntentsByContextRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextRequestType') }, ], - "FindIntentsByContextRequestType": [ - "findIntentsByContextRequest", + false + ), + FindIntentsByContextRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, ], - "FindIntentsByContextResponseType": [ - "findIntentsByContextResponse", + false + ), + FindIntentsByContextResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextResponseType') }, ], - "GetAppMetadataRequestType": [ - "getAppMetadataRequest", + false + ), + FindIntentsByContextResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'appIntents', js: 'appIntents', typ: u(undefined, a(r('AppIntent'))) }, ], - "GetAppMetadataResponseType": [ - "getAppMetadataResponse", + false + ), + GetAppMetadataRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataRequestType') }, ], - "GetCurrentChannelRequestType": [ - "getCurrentChannelRequest", + false + ), + GetAppMetadataRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + GetAppMetadataResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataResponseType') }, ], - "GetCurrentChannelResponseType": [ - "getCurrentChannelResponse", + false + ), + GetAppMetadataResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'appMetadata', js: 'appMetadata', typ: u(undefined, r('AppMetadata')) }, ], - "GetCurrentContextRequestType": [ - "getCurrentContextRequest", + false + ), + GetCurrentChannelRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetCurrentChannelRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetCurrentChannelRequestType') }, ], - "GetCurrentContextResponseType": [ - "getCurrentContextResponse", + false + ), + GetCurrentChannelRequestPayload: o([], false), + GetCurrentChannelResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetCurrentChannelResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetCurrentChannelResponseType') }, ], - "GetInfoRequestType": [ - "getInfoRequest", + false + ), + GetCurrentChannelResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, + { json: 'channel', js: 'channel', typ: u(undefined, u(r('Channel'), null)) }, ], - "GetInfoResponseType": [ - "getInfoResponse", + false + ), + GetCurrentContextRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetCurrentContextRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetCurrentContextRequestType') }, ], - "GetOrCreateChannelRequestType": [ - "getOrCreateChannelRequest", + false + ), + GetCurrentContextRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, ], - "GetOrCreateChannelResponseType": [ - "getOrCreateChannelResponse", + false + ), + GetCurrentContextResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetCurrentContextResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetCurrentContextResponseType') }, ], - "GetUserChannelsRequestType": [ - "getUserChannelsRequest", + false + ), + GetCurrentContextResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'context', js: 'context', typ: u(undefined, u(null, r('Context'))) }, ], - "GetUserChannelsResponseType": [ - "getUserChannelsResponse", + false + ), + GetInfoRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetInfoRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetInfoRequestType') }, ], - "HeartbeatAcknowledgementRequestType": [ - "heartbeatAcknowledgementRequest", + false + ), + GetInfoRequestPayload: o([], false), + GetInfoResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetInfoResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetInfoResponseType') }, ], - "HeartbeatEventType": [ - "heartbeatEvent", + false + ), + GetInfoResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('ResponsePayloadError')) }, + { json: 'implementationMetadata', js: 'implementationMetadata', typ: u(undefined, r('ImplementationMetadata')) }, ], - "IntentEventType": [ - "intentEvent", + false + ), + GetOrCreateChannelRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetOrCreateChannelRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetOrCreateChannelRequestType') }, ], - "IntentListenerUnsubscribeRequestType": [ - "intentListenerUnsubscribeRequest", + false + ), + GetOrCreateChannelRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + GetOrCreateChannelResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetOrCreateChannelResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetOrCreateChannelResponseType') }, ], - "IntentListenerUnsubscribeResponseType": [ - "intentListenerUnsubscribeResponse", + false + ), + GetOrCreateChannelResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) }, ], - "IntentResultRequestType": [ - "intentResultRequest", + false + ), + GetUserChannelsRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetUserChannelsRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetUserChannelsRequestType') }, ], - "IntentResultResponseType": [ - "intentResultResponse", + false + ), + GetUserChannelsRequestPayload: o([], false), + GetUserChannelsResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetUserChannelsResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetUserChannelsResponseType') }, ], - "JoinUserChannelRequestType": [ - "joinUserChannelRequest", + false + ), + GetUserChannelsResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'userChannels', js: 'userChannels', typ: u(undefined, a(r('Channel'))) }, ], - "JoinUserChannelResponseType": [ - "joinUserChannelResponse", + false + ), + HeartbeatAcknowledgementRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('HeartbeatAcknowledgementRequestPayload') }, + { json: 'type', js: 'type', typ: r('HeartbeatAcknowledgementRequestType') }, ], - "LeaveCurrentChannelRequestType": [ - "leaveCurrentChannelRequest", + false + ), + HeartbeatAcknowledgementRequestPayload: o([{ json: 'heartbeatEventUuid', js: 'heartbeatEventUuid', typ: '' }], false), + HeartbeatEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('HeartbeatEventPayload') }, + { json: 'type', js: 'type', typ: r('HeartbeatEventType') }, ], - "LeaveCurrentChannelResponseType": [ - "leaveCurrentChannelResponse", + false + ), + HeartbeatEventPayload: o([], false), + IntentEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('IntentEventPayload') }, + { json: 'type', js: 'type', typ: r('IntentEventType') }, ], - "OpenRequestType": [ - "openRequest", + false + ), + IntentEventPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'originatingApp', js: 'originatingApp', typ: u(undefined, r('AppIdentifier')) }, + { json: 'raiseIntentRequestUuid', js: 'raiseIntentRequestUuid', typ: '' }, ], - "OpenErrorResponsePayload": [ - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "MalformedContext", - "MalformedMessage", - "NotConnectedToBridge", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", + false + ), + IntentListenerUnsubscribeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('IntentListenerUnsubscribeRequestPayload') }, + { json: 'type', js: 'type', typ: r('IntentListenerUnsubscribeRequestType') }, ], - "OpenResponseType": [ - "openResponse", + false + ), + IntentListenerUnsubscribeRequestPayload: o([{ json: 'listenerUUID', js: 'listenerUUID', typ: '' }], false), + IntentListenerUnsubscribeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('IntentListenerUnsubscribeResponseType') }, ], - "PrivateChannelEventListenerTypes": [ - "onAddContextListener", - "onDisconnect", - "onUnsubscribe", + false + ), + IntentResultRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('IntentResultRequestPayload') }, + { json: 'type', js: 'type', typ: r('IntentResultRequestType') }, ], - "PrivateChannelAddEventListenerRequestType": [ - "privateChannelAddEventListenerRequest", + false + ), + IntentResultRequestPayload: o( + [ + { json: 'intentEventUuid', js: 'intentEventUuid', typ: '' }, + { json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }, + { json: 'raiseIntentRequestUuid', js: 'raiseIntentRequestUuid', typ: '' }, ], - "PrivateChannelAddEventListenerResponseType": [ - "privateChannelAddEventListenerResponse", + false + ), + IntentResult: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) }, ], - "PrivateChannelDisconnectRequestType": [ - "privateChannelDisconnectRequest", + false + ), + IntentResultResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('IntentResultResponseType') }, ], - "PrivateChannelDisconnectResponseType": [ - "privateChannelDisconnectResponse", + false + ), + JoinUserChannelRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('JoinUserChannelRequestPayload') }, + { json: 'type', js: 'type', typ: r('JoinUserChannelRequestType') }, ], - "PrivateChannelOnAddContextListenerEventType": [ - "privateChannelOnAddContextListenerEvent", + false + ), + JoinUserChannelRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + JoinUserChannelResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('JoinUserChannelResponsePayload') }, + { json: 'type', js: 'type', typ: r('JoinUserChannelResponseType') }, ], - "PrivateChannelOnDisconnectEventType": [ - "privateChannelOnDisconnectEvent", + false + ), + JoinUserChannelResponsePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }], false), + LeaveCurrentChannelRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('LeaveCurrentChannelRequestPayload') }, + { json: 'type', js: 'type', typ: r('LeaveCurrentChannelRequestType') }, ], - "PrivateChannelOnUnsubscribeEventType": [ - "privateChannelOnUnsubscribeEvent", + false + ), + LeaveCurrentChannelRequestPayload: o([], false), + LeaveCurrentChannelResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('LeaveCurrentChannelResponsePayload') }, + { json: 'type', js: 'type', typ: r('LeaveCurrentChannelResponseType') }, ], - "PrivateChannelUnsubscribeEventListenerRequestType": [ - "privateChannelUnsubscribeEventListenerRequest", + false + ), + LeaveCurrentChannelResponsePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }], false), + OpenRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenRequestPayload') }, + { json: 'type', js: 'type', typ: r('OpenRequestType') }, ], - "PrivateChannelUnsubscribeEventListenerResponseType": [ - "privateChannelUnsubscribeEventListenerResponse", + false + ), + OpenRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppIdentifier') }, + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, ], - "RaiseIntentForContextRequestType": [ - "raiseIntentForContextRequest", + false + ), + OpenResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenResponseType') }, ], - "RaiseIntentForContextResponseType": [ - "raiseIntentForContextResponse", + false + ), + OpenResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('OpenErrorResponsePayload')) }, + { json: 'appIdentifier', js: 'appIdentifier', typ: u(undefined, r('AppIdentifier')) }, ], - "RaiseIntentRequestType": [ - "raiseIntentRequest", + false + ), + PrivateChannelAddEventListenerRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('TPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelAddEventListenerRequestType') }, ], - "RaiseIntentResponseType": [ - "raiseIntentResponse", + false + ), + TPayload: o( + [ + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + { json: 'privateChannelId', js: 'privateChannelId', typ: '' }, ], - "RaiseIntentResultResponseType": [ - "raiseIntentResultResponse", + false + ), + PrivateChannelAddEventListenerResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelAddEventListenerResponsePayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelAddEventListenerResponseType') }, ], + false + ), + PrivateChannelAddEventListenerResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }, + { json: 'listenerUUID', js: 'listenerUUID', typ: u(undefined, '') }, + ], + 'any' + ), + PrivateChannelDisconnectRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelDisconnectRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelDisconnectRequestType') }, + ], + false + ), + PrivateChannelDisconnectRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + PrivateChannelDisconnectResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelDisconnectResponsePayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelDisconnectResponseType') }, + ], + false + ), + PrivateChannelDisconnectResponsePayload: o( + [{ json: 'error', js: 'error', typ: u(undefined, r('PurpleError')) }], + false + ), + PrivateChannelOnAddContextListenerEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnAddContextListenerEventPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnAddContextListenerEventType') }, + ], + false + ), + PrivateChannelOnAddContextListenerEventPayload: o( + [ + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + { json: 'privateChannelId', js: 'privateChannelId', typ: '' }, + ], + false + ), + PrivateChannelOnDisconnectEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnDisconnectEventPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnDisconnectEventType') }, + ], + false + ), + PrivateChannelOnDisconnectEventPayload: o([{ json: 'privateChannelId', js: 'privateChannelId', typ: '' }], false), + PrivateChannelOnUnsubscribeEvent: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastEventMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnUnsubscribeEventPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnUnsubscribeEventType') }, + ], + false + ), + PrivateChannelOnUnsubscribeEventPayload: o( + [ + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + { json: 'privateChannelId', js: 'privateChannelId', typ: '' }, + ], + false + ), + PrivateChannelUnsubscribeEventListenerRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelUnsubscribeEventListenerRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelUnsubscribeEventListenerRequestType') }, + ], + false + ), + PrivateChannelUnsubscribeEventListenerRequestPayload: o( + [{ json: 'listenerUUID', js: 'listenerUUID', typ: '' }], + false + ), + PrivateChannelUnsubscribeEventListenerResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastResponseResponsePayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelUnsubscribeEventListenerResponseType') }, + ], + false + ), + RaiseIntentForContextRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentForContextRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentForContextRequestType') }, + ], + false + ), + RaiseIntentForContextRequestPayload: o( + [ + { json: 'app', js: 'app', typ: u(undefined, r('AppIdentifier')) }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + RaiseIntentForContextResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentForContextResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentForContextResponseType') }, + ], + false + ), + RaiseIntentForContextResponsePayload: o( + [ + { json: 'error', js: 'error', typ: u(undefined, r('FindInstancesErrors')) }, + { json: 'intentResolution', js: 'intentResolution', typ: u(undefined, r('IntentResolution')) }, + { json: 'appIntents', js: 'appIntents', typ: u(undefined, a(r('AppIntent'))) }, + ], + false + ), + IntentResolution: o( + [ + { json: 'intent', js: 'intent', typ: '' }, + { json: 'source', js: 'source', typ: r('AppIdentifier') }, + ], + false + ), + RaiseIntentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('AddContextListenerRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentRequestType') }, + ], + false + ), + RaiseIntentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: u(undefined, r('AppIdentifier')) }, + { json: 'context', js: 'context', typ: r('Context') }, + { 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 + ), + 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'], + FDC3EventType: ['USER_CHANNEL_CHANGED'], + AddEventListenerRequestType: ['addEventListenerRequest'], + ResponsePayloadError: [ + 'AccessDenied', + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'CreationFailed', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'IntentDeliveryFailed', + 'IntentHandlerRejected', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NoChannelFound', + 'NoResultReturned', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + AddEventListenerResponseType: ['addEventListenerResponse'], + AddIntentListenerRequestType: ['addIntentListenerRequest'], + FluffyError: [ + 'DesktopAgentNotFound', + 'IntentDeliveryFailed', + 'MalformedContext', + 'NoAppsFound', + 'ResolverTimeout', + 'ResolverUnavailable', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + AddIntentListenerResponseType: ['addIntentListenerResponse'], + EventMessageType: [ + 'addEventListenerEvent', + 'broadcastEvent', + 'channelChangedEvent', + 'heartbeatEvent', + 'intentEvent', + 'privateChannelOnAddContextListenerEvent', + 'privateChannelOnDisconnectEvent', + 'privateChannelOnUnsubscribeEvent', + ], + ResponseMessageType: [ + 'addContextListenerResponse', + 'addEventListenerResponse', + 'addIntentListenerResponse', + 'broadcastResponse', + 'contextListenerUnsubscribeResponse', + 'createPrivateChannelResponse', + 'eventListenerUnsubscribeResponse', + 'findInstancesResponse', + 'findIntentResponse', + 'findIntentsByContextResponse', + 'getAppMetadataResponse', + 'getCurrentChannelResponse', + 'getCurrentContextResponse', + 'getInfoResponse', + 'getOrCreateChannelResponse', + 'getUserChannelsResponse', + 'intentListenerUnsubscribeResponse', + 'intentResultResponse', + 'joinUserChannelResponse', + 'leaveCurrentChannelResponse', + 'openResponse', + 'privateChannelAddEventListenerResponse', + 'privateChannelDisconnectResponse', + 'privateChannelUnsubscribeEventListenerResponse', + 'raiseIntentForContextResponse', + 'raiseIntentResponse', + 'raiseIntentResultResponse', + ], + RequestMessageType: [ + 'addContextListenerRequest', + 'addEventListenerRequest', + 'addIntentListenerRequest', + 'broadcastRequest', + 'contextListenerUnsubscribeRequest', + 'createPrivateChannelRequest', + 'eventListenerUnsubscribeRequest', + 'findInstancesRequest', + 'findIntentRequest', + 'findIntentsByContextRequest', + 'getAppMetadataRequest', + 'getCurrentChannelRequest', + 'getCurrentContextRequest', + 'getInfoRequest', + 'getOrCreateChannelRequest', + 'getUserChannelsRequest', + 'heartbeatAcknowledgementRequest', + 'intentListenerUnsubscribeRequest', + 'intentResultRequest', + 'joinUserChannelRequest', + 'leaveCurrentChannelRequest', + 'openRequest', + 'privateChannelAddEventListenerRequest', + 'privateChannelDisconnectRequest', + 'privateChannelUnsubscribeEventListenerRequest', + 'raiseIntentForContextRequest', + 'raiseIntentRequest', + ], + BroadcastEventType: ['broadcastEvent'], + BroadcastRequestType: ['broadcastRequest'], + BroadcastResponseType: ['broadcastResponse'], + ChannelChangedEventType: ['channelChangedEvent'], + ContextListenerUnsubscribeRequestType: ['contextListenerUnsubscribeRequest'], + ContextListenerUnsubscribeResponseType: ['contextListenerUnsubscribeResponse'], + CreatePrivateChannelRequestType: ['createPrivateChannelRequest'], + Type: ['app', 'private', 'user'], + CreatePrivateChannelResponseType: ['createPrivateChannelResponse'], + EventListenerUnsubscribeRequestType: ['eventListenerUnsubscribeRequest'], + EventListenerUnsubscribeResponseType: ['eventListenerUnsubscribeResponse'], + Fdc3UserInterfaceChannelSelectedType: ['Fdc3UserInterfaceChannelSelected'], + Fdc3UserInterfaceChannelsType: ['Fdc3UserInterfaceChannels'], + Fdc3UserInterfaceDragType: ['Fdc3UserInterfaceDrag'], + Fdc3UserInterfaceHandshakeType: ['Fdc3UserInterfaceHandshake'], + Fdc3UserInterfaceHelloType: ['Fdc3UserInterfaceHello'], + Fdc3UserInterfaceMessageType: [ + 'Fdc3UserInterfaceChannelSelected', + 'Fdc3UserInterfaceChannels', + 'Fdc3UserInterfaceDrag', + 'Fdc3UserInterfaceHandshake', + 'Fdc3UserInterfaceHello', + 'Fdc3UserInterfaceResolve', + 'Fdc3UserInterfaceResolveAction', + 'Fdc3UserInterfaceRestyle', + ], + Fdc3UserInterfaceResolveType: ['Fdc3UserInterfaceResolve'], + Action: ['cancel', 'click', 'hover'], + Fdc3UserInterfaceResolveActionType: ['Fdc3UserInterfaceResolveAction'], + Fdc3UserInterfaceRestyleType: ['Fdc3UserInterfaceRestyle'], + FindInstancesRequestType: ['findInstancesRequest'], + FindInstancesErrors: [ + 'AgentDisconnected', + 'DesktopAgentNotFound', + 'IntentDeliveryFailed', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + FindInstancesResponseType: ['findInstancesResponse'], + FindIntentRequestType: ['findIntentRequest'], + FindIntentResponseType: ['findIntentResponse'], + FindIntentsByContextRequestType: ['findIntentsByContextRequest'], + FindIntentsByContextResponseType: ['findIntentsByContextResponse'], + GetAppMetadataRequestType: ['getAppMetadataRequest'], + GetAppMetadataResponseType: ['getAppMetadataResponse'], + GetCurrentChannelRequestType: ['getCurrentChannelRequest'], + GetCurrentChannelResponseType: ['getCurrentChannelResponse'], + GetCurrentContextRequestType: ['getCurrentContextRequest'], + GetCurrentContextResponseType: ['getCurrentContextResponse'], + GetInfoRequestType: ['getInfoRequest'], + GetInfoResponseType: ['getInfoResponse'], + GetOrCreateChannelRequestType: ['getOrCreateChannelRequest'], + GetOrCreateChannelResponseType: ['getOrCreateChannelResponse'], + GetUserChannelsRequestType: ['getUserChannelsRequest'], + GetUserChannelsResponseType: ['getUserChannelsResponse'], + HeartbeatAcknowledgementRequestType: ['heartbeatAcknowledgementRequest'], + HeartbeatEventType: ['heartbeatEvent'], + IntentEventType: ['intentEvent'], + IntentListenerUnsubscribeRequestType: ['intentListenerUnsubscribeRequest'], + IntentListenerUnsubscribeResponseType: ['intentListenerUnsubscribeResponse'], + IntentResultRequestType: ['intentResultRequest'], + IntentResultResponseType: ['intentResultResponse'], + JoinUserChannelRequestType: ['joinUserChannelRequest'], + JoinUserChannelResponseType: ['joinUserChannelResponse'], + LeaveCurrentChannelRequestType: ['leaveCurrentChannelRequest'], + LeaveCurrentChannelResponseType: ['leaveCurrentChannelResponse'], + OpenRequestType: ['openRequest'], + OpenErrorResponsePayload: [ + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'MalformedContext', + 'MalformedMessage', + 'NotConnectedToBridge', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + ], + OpenResponseType: ['openResponse'], + PrivateChannelEventListenerTypes: ['onAddContextListener', 'onDisconnect', 'onUnsubscribe'], + PrivateChannelAddEventListenerRequestType: ['privateChannelAddEventListenerRequest'], + PrivateChannelAddEventListenerResponseType: ['privateChannelAddEventListenerResponse'], + PrivateChannelDisconnectRequestType: ['privateChannelDisconnectRequest'], + PrivateChannelDisconnectResponseType: ['privateChannelDisconnectResponse'], + PrivateChannelOnAddContextListenerEventType: ['privateChannelOnAddContextListenerEvent'], + PrivateChannelOnDisconnectEventType: ['privateChannelOnDisconnectEvent'], + PrivateChannelOnUnsubscribeEventType: ['privateChannelOnUnsubscribeEvent'], + PrivateChannelUnsubscribeEventListenerRequestType: ['privateChannelUnsubscribeEventListenerRequest'], + PrivateChannelUnsubscribeEventListenerResponseType: ['privateChannelUnsubscribeEventListenerResponse'], + RaiseIntentForContextRequestType: ['raiseIntentForContextRequest'], + RaiseIntentForContextResponseType: ['raiseIntentForContextResponse'], + RaiseIntentRequestType: ['raiseIntentRequest'], + RaiseIntentResponseType: ['raiseIntentResponse'], + RaiseIntentResultResponseType: ['raiseIntentResultResponse'], }; -export type AppRequestMessage = AddContextListenerRequest | AddEventListenerRequest | AddIntentListenerRequest | BroadcastRequest | ContextListenerUnsubscribeRequest | CreatePrivateChannelRequest | EventListenerUnsubscribeRequest | FindInstancesRequest | FindIntentRequest | FindIntentsByContextRequest | GetAppMetadataRequest | GetCurrentChannelRequest | GetCurrentContextRequest | GetInfoRequest | GetOrCreateChannelRequest | GetUserChannelsRequest | HeartbeatAcknowledgementRequest | IntentListenerUnsubscribeRequest | IntentResultRequest | JoinUserChannelRequest | LeaveCurrentChannelRequest | OpenRequest | PrivateChannelAddEventListenerRequest | PrivateChannelDisconnectRequest | PrivateChannelUnsubscribeEventListenerRequest | RaiseIntentForContextRequest | RaiseIntentRequest; - -export type AgentResponseMessage = AddContextListenerResponse | AddEventListenerResponse | AddIntentListenerResponse | BroadcastResponse | ContextListenerUnsubscribeResponse | CreatePrivateChannelResponse | EventListenerUnsubscribeResponse | FindInstancesResponse | FindIntentResponse | FindIntentsByContextResponse | GetAppMetadataResponse | GetCurrentChannelResponse | GetCurrentContextResponse | GetInfoResponse | GetOrCreateChannelResponse | GetUserChannelsResponse | IntentListenerUnsubscribeResponse | IntentResultResponse | JoinUserChannelResponse | LeaveCurrentChannelResponse | OpenResponse | PrivateChannelAddEventListenerResponse | PrivateChannelDisconnectResponse | PrivateChannelUnsubscribeEventListenerResponse | RaiseIntentForContextResponse | RaiseIntentResponse | RaiseIntentResultResponse; - -export type AgentEventMessage = BroadcastEvent | ChannelChangedEvent | HeartbeatEvent | IntentEvent | PrivateChannelOnAddContextListenerEvent | PrivateChannelOnDisconnectEvent | PrivateChannelOnUnsubscribeEvent; +export type AppRequestMessage = + | AddContextListenerRequest + | AddEventListenerRequest + | AddIntentListenerRequest + | BroadcastRequest + | ContextListenerUnsubscribeRequest + | CreatePrivateChannelRequest + | EventListenerUnsubscribeRequest + | FindInstancesRequest + | FindIntentRequest + | FindIntentsByContextRequest + | GetAppMetadataRequest + | GetCurrentChannelRequest + | GetCurrentContextRequest + | GetInfoRequest + | GetOrCreateChannelRequest + | GetUserChannelsRequest + | HeartbeatAcknowledgementRequest + | IntentListenerUnsubscribeRequest + | IntentResultRequest + | JoinUserChannelRequest + | LeaveCurrentChannelRequest + | OpenRequest + | PrivateChannelAddEventListenerRequest + | PrivateChannelDisconnectRequest + | PrivateChannelUnsubscribeEventListenerRequest + | RaiseIntentForContextRequest + | RaiseIntentRequest; + +export type AgentResponseMessage = + | AddContextListenerResponse + | AddEventListenerResponse + | AddIntentListenerResponse + | BroadcastResponse + | ContextListenerUnsubscribeResponse + | CreatePrivateChannelResponse + | EventListenerUnsubscribeResponse + | FindInstancesResponse + | FindIntentResponse + | FindIntentsByContextResponse + | GetAppMetadataResponse + | GetCurrentChannelResponse + | GetCurrentContextResponse + | GetInfoResponse + | GetOrCreateChannelResponse + | GetUserChannelsResponse + | IntentListenerUnsubscribeResponse + | IntentResultResponse + | JoinUserChannelResponse + | LeaveCurrentChannelResponse + | OpenResponse + | PrivateChannelAddEventListenerResponse + | PrivateChannelDisconnectResponse + | PrivateChannelUnsubscribeEventListenerResponse + | RaiseIntentForContextResponse + | RaiseIntentResponse + | RaiseIntentResultResponse; + +export type AgentEventMessage = + | BroadcastEvent + | ChannelChangedEvent + | HeartbeatEvent + | IntentEvent + | PrivateChannelOnAddContextListenerEvent + | PrivateChannelOnDisconnectEvent + | PrivateChannelOnUnsubscribeEvent; /** * 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'; + 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; - } + try { + Convert.webConnectionProtocol1HelloToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const WEB_CONNECTION_PROTOCOL1_HELLO_TYPE = "WebConnectionProtocol1Hello"; +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'; + 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; - } + try { + Convert.webConnectionProtocol2LoadURLToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const WEB_CONNECTION_PROTOCOL2_LOAD_U_R_L_TYPE = "WebConnectionProtocol2LoadURL"; +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'; + 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; - } + try { + Convert.webConnectionProtocol3HandshakeToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const WEB_CONNECTION_PROTOCOL3_HANDSHAKE_TYPE = "WebConnectionProtocol3Handshake"; +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'; +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 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"; +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'; +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 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"; +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'; +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 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"; +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'; + 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; - } + try { + Convert.webConnectionProtocol6GoodbyeToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const WEB_CONNECTION_PROTOCOL6_GOODBYE_TYPE = "WebConnectionProtocol6Goodbye"; +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; - } + try { + Convert.webConnectionProtocolMessageToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const WEB_CONNECTION_PROTOCOL_MESSAGE_TYPE = "WebConnectionProtocolMessage"; +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 */ export function isAddContextListenerRequest(value: any): value is AddContextListenerRequest { - return value != null && value.type === 'addContextListenerRequest'; + return value != null && value.type === 'addContextListenerRequest'; } /** * Returns true if value is a valid AddContextListenerRequest. This checks the type against the json schema for the message and will be slower */ export function isValidAddContextListenerRequest(value: any): value is AddContextListenerRequest { - try { - Convert.addContextListenerRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addContextListenerRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_CONTEXT_LISTENER_REQUEST_TYPE = "AddContextListenerRequest"; +export const ADD_CONTEXT_LISTENER_REQUEST_TYPE = 'AddContextListenerRequest'; /** * Returns true if the value has a type property with value 'addContextListenerResponse'. This is a fast check that does not check the format of the message */ export function isAddContextListenerResponse(value: any): value is AddContextListenerResponse { - return value != null && value.type === 'addContextListenerResponse'; + return value != null && value.type === 'addContextListenerResponse'; } /** * Returns true if value is a valid AddContextListenerResponse. This checks the type against the json schema for the message and will be slower */ export function isValidAddContextListenerResponse(value: any): value is AddContextListenerResponse { - try { - Convert.addContextListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addContextListenerResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_CONTEXT_LISTENER_RESPONSE_TYPE = "AddContextListenerResponse"; +export const ADD_CONTEXT_LISTENER_RESPONSE_TYPE = 'AddContextListenerResponse'; /** * Returns true if the value has a type property with value 'addEventListenerRequest'. This is a fast check that does not check the format of the message */ export function isAddEventListenerRequest(value: any): value is AddEventListenerRequest { - return value != null && value.type === 'addEventListenerRequest'; + return value != null && value.type === 'addEventListenerRequest'; } /** * Returns true if value is a valid AddEventListenerRequest. This checks the type against the json schema for the message and will be slower */ export function isValidAddEventListenerRequest(value: any): value is AddEventListenerRequest { - try { - Convert.addEventListenerRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addEventListenerRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_EVENT_LISTENER_REQUEST_TYPE = "AddEventListenerRequest"; +export const ADD_EVENT_LISTENER_REQUEST_TYPE = 'AddEventListenerRequest'; /** * Returns true if the value has a type property with value 'addEventListenerResponse'. This is a fast check that does not check the format of the message */ export function isAddEventListenerResponse(value: any): value is AddEventListenerResponse { - return value != null && value.type === 'addEventListenerResponse'; + return value != null && value.type === 'addEventListenerResponse'; } /** * Returns true if value is a valid AddEventListenerResponse. This checks the type against the json schema for the message and will be slower */ export function isValidAddEventListenerResponse(value: any): value is AddEventListenerResponse { - try { - Convert.addEventListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addEventListenerResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_EVENT_LISTENER_RESPONSE_TYPE = "AddEventListenerResponse"; +export const ADD_EVENT_LISTENER_RESPONSE_TYPE = 'AddEventListenerResponse'; /** * Returns true if the value has a type property with value 'addIntentListenerRequest'. This is a fast check that does not check the format of the message */ export function isAddIntentListenerRequest(value: any): value is AddIntentListenerRequest { - return value != null && value.type === 'addIntentListenerRequest'; + return value != null && value.type === 'addIntentListenerRequest'; } /** * Returns true if value is a valid AddIntentListenerRequest. This checks the type against the json schema for the message and will be slower */ export function isValidAddIntentListenerRequest(value: any): value is AddIntentListenerRequest { - try { - Convert.addIntentListenerRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addIntentListenerRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_INTENT_LISTENER_REQUEST_TYPE = "AddIntentListenerRequest"; +export const ADD_INTENT_LISTENER_REQUEST_TYPE = 'AddIntentListenerRequest'; /** * Returns true if the value has a type property with value 'addIntentListenerResponse'. This is a fast check that does not check the format of the message */ export function isAddIntentListenerResponse(value: any): value is AddIntentListenerResponse { - return value != null && value.type === 'addIntentListenerResponse'; + return value != null && value.type === 'addIntentListenerResponse'; } /** * Returns true if value is a valid AddIntentListenerResponse. This checks the type against the json schema for the message and will be slower */ export function isValidAddIntentListenerResponse(value: any): value is AddIntentListenerResponse { - try { - Convert.addIntentListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.addIntentListenerResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const ADD_INTENT_LISTENER_RESPONSE_TYPE = "AddIntentListenerResponse"; +export const ADD_INTENT_LISTENER_RESPONSE_TYPE = 'AddIntentListenerResponse'; /** * Returns true if the value has a type property with value 'broadcastEvent'. This is a fast check that does not check the format of the message */ export function isBroadcastEvent(value: any): value is BroadcastEvent { - return value != null && value.type === 'broadcastEvent'; + return value != null && value.type === 'broadcastEvent'; } /** * Returns true if value is a valid BroadcastEvent. This checks the type against the json schema for the message and will be slower */ export function isValidBroadcastEvent(value: any): value is BroadcastEvent { - try { - Convert.broadcastEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.broadcastEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const BROADCAST_EVENT_TYPE = "BroadcastEvent"; +export const BROADCAST_EVENT_TYPE = 'BroadcastEvent'; /** * Returns true if the value has a type property with value 'broadcastRequest'. This is a fast check that does not check the format of the message */ export function isBroadcastRequest(value: any): value is BroadcastRequest { - return value != null && value.type === 'broadcastRequest'; + return value != null && value.type === 'broadcastRequest'; } /** * Returns true if value is a valid BroadcastRequest. This checks the type against the json schema for the message and will be slower */ export function isValidBroadcastRequest(value: any): value is BroadcastRequest { - try { - Convert.broadcastRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.broadcastRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const BROADCAST_REQUEST_TYPE = "BroadcastRequest"; +export const BROADCAST_REQUEST_TYPE = 'BroadcastRequest'; /** * Returns true if the value has a type property with value 'broadcastResponse'. This is a fast check that does not check the format of the message */ export function isBroadcastResponse(value: any): value is BroadcastResponse { - return value != null && value.type === 'broadcastResponse'; + return value != null && value.type === 'broadcastResponse'; } /** * Returns true if value is a valid BroadcastResponse. This checks the type against the json schema for the message and will be slower */ export function isValidBroadcastResponse(value: any): value is BroadcastResponse { - try { - Convert.broadcastResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.broadcastResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const BROADCAST_RESPONSE_TYPE = "BroadcastResponse"; +export const BROADCAST_RESPONSE_TYPE = 'BroadcastResponse'; /** * Returns true if the value has a type property with value 'channelChangedEvent'. This is a fast check that does not check the format of the message */ export function isChannelChangedEvent(value: any): value is ChannelChangedEvent { - return value != null && value.type === 'channelChangedEvent'; + return value != null && value.type === 'channelChangedEvent'; } /** * Returns true if value is a valid ChannelChangedEvent. This checks the type against the json schema for the message and will be slower */ export function isValidChannelChangedEvent(value: any): value is ChannelChangedEvent { - try { - Convert.channelChangedEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.channelChangedEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const CHANNEL_CHANGED_EVENT_TYPE = "ChannelChangedEvent"; +export const CHANNEL_CHANGED_EVENT_TYPE = 'ChannelChangedEvent'; /** * Returns true if the value has a type property with value 'contextListenerUnsubscribeRequest'. This is a fast check that does not check the format of the message */ export function isContextListenerUnsubscribeRequest(value: any): value is ContextListenerUnsubscribeRequest { - return value != null && value.type === 'contextListenerUnsubscribeRequest'; + return value != null && value.type === 'contextListenerUnsubscribeRequest'; } /** * Returns true if value is a valid ContextListenerUnsubscribeRequest. This checks the type against the json schema for the message and will be slower */ export function isValidContextListenerUnsubscribeRequest(value: any): value is ContextListenerUnsubscribeRequest { - try { - Convert.contextListenerUnsubscribeRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.contextListenerUnsubscribeRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const CONTEXT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "ContextListenerUnsubscribeRequest"; +export const CONTEXT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = 'ContextListenerUnsubscribeRequest'; /** * Returns true if the value has a type property with value 'contextListenerUnsubscribeResponse'. This is a fast check that does not check the format of the message */ export function isContextListenerUnsubscribeResponse(value: any): value is ContextListenerUnsubscribeResponse { - return value != null && value.type === 'contextListenerUnsubscribeResponse'; + return value != null && value.type === 'contextListenerUnsubscribeResponse'; } /** * Returns true if value is a valid ContextListenerUnsubscribeResponse. This checks the type against the json schema for the message and will be slower */ export function isValidContextListenerUnsubscribeResponse(value: any): value is ContextListenerUnsubscribeResponse { - try { - Convert.contextListenerUnsubscribeResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.contextListenerUnsubscribeResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const CONTEXT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "ContextListenerUnsubscribeResponse"; +export const CONTEXT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = 'ContextListenerUnsubscribeResponse'; /** * Returns true if the value has a type property with value 'createPrivateChannelRequest'. This is a fast check that does not check the format of the message */ export function isCreatePrivateChannelRequest(value: any): value is CreatePrivateChannelRequest { - return value != null && value.type === 'createPrivateChannelRequest'; + return value != null && value.type === 'createPrivateChannelRequest'; } /** * Returns true if value is a valid CreatePrivateChannelRequest. This checks the type against the json schema for the message and will be slower */ export function isValidCreatePrivateChannelRequest(value: any): value is CreatePrivateChannelRequest { - try { - Convert.createPrivateChannelRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.createPrivateChannelRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const CREATE_PRIVATE_CHANNEL_REQUEST_TYPE = "CreatePrivateChannelRequest"; +export const CREATE_PRIVATE_CHANNEL_REQUEST_TYPE = 'CreatePrivateChannelRequest'; /** * Returns true if the value has a type property with value 'createPrivateChannelResponse'. This is a fast check that does not check the format of the message */ export function isCreatePrivateChannelResponse(value: any): value is CreatePrivateChannelResponse { - return value != null && value.type === 'createPrivateChannelResponse'; + return value != null && value.type === 'createPrivateChannelResponse'; } /** * Returns true if value is a valid CreatePrivateChannelResponse. This checks the type against the json schema for the message and will be slower */ export function isValidCreatePrivateChannelResponse(value: any): value is CreatePrivateChannelResponse { - try { - Convert.createPrivateChannelResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.createPrivateChannelResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const CREATE_PRIVATE_CHANNEL_RESPONSE_TYPE = "CreatePrivateChannelResponse"; +export const CREATE_PRIVATE_CHANNEL_RESPONSE_TYPE = 'CreatePrivateChannelResponse'; /** * Returns true if the value has a type property with value 'eventListenerUnsubscribeRequest'. This is a fast check that does not check the format of the message */ export function isEventListenerUnsubscribeRequest(value: any): value is EventListenerUnsubscribeRequest { - return value != null && value.type === 'eventListenerUnsubscribeRequest'; + return value != null && value.type === 'eventListenerUnsubscribeRequest'; } /** * Returns true if value is a valid EventListenerUnsubscribeRequest. This checks the type against the json schema for the message and will be slower */ export function isValidEventListenerUnsubscribeRequest(value: any): value is EventListenerUnsubscribeRequest { - try { - Convert.eventListenerUnsubscribeRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.eventListenerUnsubscribeRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const EVENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "EventListenerUnsubscribeRequest"; +export const EVENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = 'EventListenerUnsubscribeRequest'; /** * Returns true if the value has a type property with value 'eventListenerUnsubscribeResponse'. This is a fast check that does not check the format of the message */ export function isEventListenerUnsubscribeResponse(value: any): value is EventListenerUnsubscribeResponse { - return value != null && value.type === 'eventListenerUnsubscribeResponse'; + return value != null && value.type === 'eventListenerUnsubscribeResponse'; } /** * Returns true if value is a valid EventListenerUnsubscribeResponse. This checks the type against the json schema for the message and will be slower */ export function isValidEventListenerUnsubscribeResponse(value: any): value is EventListenerUnsubscribeResponse { - try { - Convert.eventListenerUnsubscribeResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.eventListenerUnsubscribeResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const EVENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "EventListenerUnsubscribeResponse"; +export const EVENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = 'EventListenerUnsubscribeResponse'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceChannelSelected'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { - return value != null && value.type === 'Fdc3UserInterfaceChannelSelected'; + return value != null && value.type === 'Fdc3UserInterfaceChannelSelected'; } /** * 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 isValidFdc3UserInterfaceChannelSelected(value: any): value is Fdc3UserInterfaceChannelSelected { - try { - Convert.fdc3UserInterfaceChannelSelectedToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceChannelSelectedToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE = "Fdc3UserInterfaceChannelSelected"; +export const FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE = 'Fdc3UserInterfaceChannelSelected'; /** * 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 isFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { - return value != null && value.type === 'Fdc3UserInterfaceChannels'; + return value != null && value.type === 'Fdc3UserInterfaceChannels'; } /** * 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 isValidFdc3UserInterfaceChannels(value: any): value is Fdc3UserInterfaceChannels { - try { - Convert.fdc3UserInterfaceChannelsToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceChannelsToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_CHANNELS_TYPE = "Fdc3UserInterfaceChannels"; +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 */ export function isFdc3UserInterfaceDrag(value: any): value is Fdc3UserInterfaceDrag { - return value != null && value.type === 'Fdc3UserInterfaceDrag'; + return value != null && value.type === 'Fdc3UserInterfaceDrag'; } /** * Returns true if value is a valid Fdc3UserInterfaceDrag. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceDrag(value: any): value is Fdc3UserInterfaceDrag { - try { - Convert.fdc3UserInterfaceDragToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceDragToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_DRAG_TYPE = "Fdc3UserInterfaceDrag"; +export const FDC3_USER_INTERFACE_DRAG_TYPE = 'Fdc3UserInterfaceDrag'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceHandshake'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceHandshake(value: any): value is Fdc3UserInterfaceHandshake { - return value != null && value.type === 'Fdc3UserInterfaceHandshake'; + return value != null && value.type === 'Fdc3UserInterfaceHandshake'; } /** * Returns true if value is a valid Fdc3UserInterfaceHandshake. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceHandshake(value: any): value is Fdc3UserInterfaceHandshake { - try { - Convert.fdc3UserInterfaceHandshakeToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceHandshakeToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_HANDSHAKE_TYPE = "Fdc3UserInterfaceHandshake"; +export const FDC3_USER_INTERFACE_HANDSHAKE_TYPE = 'Fdc3UserInterfaceHandshake'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceHello'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceHello(value: any): value is Fdc3UserInterfaceHello { - return value != null && value.type === 'Fdc3UserInterfaceHello'; + return value != null && value.type === 'Fdc3UserInterfaceHello'; } /** * Returns true if value is a valid Fdc3UserInterfaceHello. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceHello(value: any): value is Fdc3UserInterfaceHello { - try { - Convert.fdc3UserInterfaceHelloToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceHelloToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_HELLO_TYPE = "Fdc3UserInterfaceHello"; +export const FDC3_USER_INTERFACE_HELLO_TYPE = 'Fdc3UserInterfaceHello'; /** * Returns true if value is a valid Fdc3UserInterfaceMessage. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceMessage(value: any): value is Fdc3UserInterfaceMessage { - try { - Convert.fdc3UserInterfaceMessageToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceMessageToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_MESSAGE_TYPE = "Fdc3UserInterfaceMessage"; +export const FDC3_USER_INTERFACE_MESSAGE_TYPE = 'Fdc3UserInterfaceMessage'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceResolve'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceResolve(value: any): value is Fdc3UserInterfaceResolve { - return value != null && value.type === 'Fdc3UserInterfaceResolve'; + return value != null && value.type === 'Fdc3UserInterfaceResolve'; } /** * Returns true if value is a valid Fdc3UserInterfaceResolve. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceResolve(value: any): value is Fdc3UserInterfaceResolve { - try { - Convert.fdc3UserInterfaceResolveToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceResolveToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_RESOLVE_TYPE = "Fdc3UserInterfaceResolve"; +export const FDC3_USER_INTERFACE_RESOLVE_TYPE = 'Fdc3UserInterfaceResolve'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceResolveAction'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceResolveAction(value: any): value is Fdc3UserInterfaceResolveAction { - return value != null && value.type === 'Fdc3UserInterfaceResolveAction'; + return value != null && value.type === 'Fdc3UserInterfaceResolveAction'; } /** * Returns true if value is a valid Fdc3UserInterfaceResolveAction. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceResolveAction(value: any): value is Fdc3UserInterfaceResolveAction { - try { - Convert.fdc3UserInterfaceResolveActionToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceResolveActionToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_RESOLVE_ACTION_TYPE = "Fdc3UserInterfaceResolveAction"; +export const FDC3_USER_INTERFACE_RESOLVE_ACTION_TYPE = 'Fdc3UserInterfaceResolveAction'; /** * Returns true if the value has a type property with value 'Fdc3UserInterfaceRestyle'. This is a fast check that does not check the format of the message */ export function isFdc3UserInterfaceRestyle(value: any): value is Fdc3UserInterfaceRestyle { - return value != null && value.type === 'Fdc3UserInterfaceRestyle'; + return value != null && value.type === 'Fdc3UserInterfaceRestyle'; } /** * Returns true if value is a valid Fdc3UserInterfaceRestyle. This checks the type against the json schema for the message and will be slower */ export function isValidFdc3UserInterfaceRestyle(value: any): value is Fdc3UserInterfaceRestyle { - try { - Convert.fdc3UserInterfaceRestyleToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.fdc3UserInterfaceRestyleToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FDC3_USER_INTERFACE_RESTYLE_TYPE = "Fdc3UserInterfaceRestyle"; +export const FDC3_USER_INTERFACE_RESTYLE_TYPE = 'Fdc3UserInterfaceRestyle'; /** * Returns true if the value has a type property with value 'findInstancesRequest'. This is a fast check that does not check the format of the message */ export function isFindInstancesRequest(value: any): value is FindInstancesRequest { - return value != null && value.type === 'findInstancesRequest'; + return value != null && value.type === 'findInstancesRequest'; } /** * Returns true if value is a valid FindInstancesRequest. This checks the type against the json schema for the message and will be slower */ export function isValidFindInstancesRequest(value: any): value is FindInstancesRequest { - try { - Convert.findInstancesRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findInstancesRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INSTANCES_REQUEST_TYPE = "FindInstancesRequest"; +export const FIND_INSTANCES_REQUEST_TYPE = 'FindInstancesRequest'; /** * Returns true if the value has a type property with value 'findInstancesResponse'. This is a fast check that does not check the format of the message */ export function isFindInstancesResponse(value: any): value is FindInstancesResponse { - return value != null && value.type === 'findInstancesResponse'; + return value != null && value.type === 'findInstancesResponse'; } /** * Returns true if value is a valid FindInstancesResponse. This checks the type against the json schema for the message and will be slower */ export function isValidFindInstancesResponse(value: any): value is FindInstancesResponse { - try { - Convert.findInstancesResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findInstancesResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INSTANCES_RESPONSE_TYPE = "FindInstancesResponse"; +export const FIND_INSTANCES_RESPONSE_TYPE = 'FindInstancesResponse'; /** * Returns true if the value has a type property with value 'findIntentRequest'. This is a fast check that does not check the format of the message */ export function isFindIntentRequest(value: any): value is FindIntentRequest { - return value != null && value.type === 'findIntentRequest'; + return value != null && value.type === 'findIntentRequest'; } /** * Returns true if value is a valid FindIntentRequest. This checks the type against the json schema for the message and will be slower */ export function isValidFindIntentRequest(value: any): value is FindIntentRequest { - try { - Convert.findIntentRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findIntentRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INTENT_REQUEST_TYPE = "FindIntentRequest"; +export const FIND_INTENT_REQUEST_TYPE = 'FindIntentRequest'; /** * Returns true if the value has a type property with value 'findIntentResponse'. This is a fast check that does not check the format of the message */ export function isFindIntentResponse(value: any): value is FindIntentResponse { - return value != null && value.type === 'findIntentResponse'; + return value != null && value.type === 'findIntentResponse'; } /** * Returns true if value is a valid FindIntentResponse. This checks the type against the json schema for the message and will be slower */ export function isValidFindIntentResponse(value: any): value is FindIntentResponse { - try { - Convert.findIntentResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findIntentResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INTENT_RESPONSE_TYPE = "FindIntentResponse"; +export const FIND_INTENT_RESPONSE_TYPE = 'FindIntentResponse'; /** * Returns true if the value has a type property with value 'findIntentsByContextRequest'. This is a fast check that does not check the format of the message */ export function isFindIntentsByContextRequest(value: any): value is FindIntentsByContextRequest { - return value != null && value.type === 'findIntentsByContextRequest'; + return value != null && value.type === 'findIntentsByContextRequest'; } /** * Returns true if value is a valid FindIntentsByContextRequest. This checks the type against the json schema for the message and will be slower */ export function isValidFindIntentsByContextRequest(value: any): value is FindIntentsByContextRequest { - try { - Convert.findIntentsByContextRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findIntentsByContextRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INTENTS_BY_CONTEXT_REQUEST_TYPE = "FindIntentsByContextRequest"; +export const FIND_INTENTS_BY_CONTEXT_REQUEST_TYPE = 'FindIntentsByContextRequest'; /** * Returns true if the value has a type property with value 'findIntentsByContextResponse'. This is a fast check that does not check the format of the message */ export function isFindIntentsByContextResponse(value: any): value is FindIntentsByContextResponse { - return value != null && value.type === 'findIntentsByContextResponse'; + return value != null && value.type === 'findIntentsByContextResponse'; } /** * Returns true if value is a valid FindIntentsByContextResponse. This checks the type against the json schema for the message and will be slower */ export function isValidFindIntentsByContextResponse(value: any): value is FindIntentsByContextResponse { - try { - Convert.findIntentsByContextResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.findIntentsByContextResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const FIND_INTENTS_BY_CONTEXT_RESPONSE_TYPE = "FindIntentsByContextResponse"; +export const FIND_INTENTS_BY_CONTEXT_RESPONSE_TYPE = 'FindIntentsByContextResponse'; /** * Returns true if the value has a type property with value 'getAppMetadataRequest'. This is a fast check that does not check the format of the message */ export function isGetAppMetadataRequest(value: any): value is GetAppMetadataRequest { - return value != null && value.type === 'getAppMetadataRequest'; + return value != null && value.type === 'getAppMetadataRequest'; } /** * Returns true if value is a valid GetAppMetadataRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetAppMetadataRequest(value: any): value is GetAppMetadataRequest { - try { - Convert.getAppMetadataRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getAppMetadataRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_APP_METADATA_REQUEST_TYPE = "GetAppMetadataRequest"; +export const GET_APP_METADATA_REQUEST_TYPE = 'GetAppMetadataRequest'; /** * Returns true if the value has a type property with value 'getAppMetadataResponse'. This is a fast check that does not check the format of the message */ export function isGetAppMetadataResponse(value: any): value is GetAppMetadataResponse { - return value != null && value.type === 'getAppMetadataResponse'; + return value != null && value.type === 'getAppMetadataResponse'; } /** * Returns true if value is a valid GetAppMetadataResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetAppMetadataResponse(value: any): value is GetAppMetadataResponse { - try { - Convert.getAppMetadataResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getAppMetadataResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_APP_METADATA_RESPONSE_TYPE = "GetAppMetadataResponse"; +export const GET_APP_METADATA_RESPONSE_TYPE = 'GetAppMetadataResponse'; /** * Returns true if the value has a type property with value 'getCurrentChannelRequest'. This is a fast check that does not check the format of the message */ export function isGetCurrentChannelRequest(value: any): value is GetCurrentChannelRequest { - return value != null && value.type === 'getCurrentChannelRequest'; + return value != null && value.type === 'getCurrentChannelRequest'; } /** * Returns true if value is a valid GetCurrentChannelRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetCurrentChannelRequest(value: any): value is GetCurrentChannelRequest { - try { - Convert.getCurrentChannelRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getCurrentChannelRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_CURRENT_CHANNEL_REQUEST_TYPE = "GetCurrentChannelRequest"; +export const GET_CURRENT_CHANNEL_REQUEST_TYPE = 'GetCurrentChannelRequest'; /** * Returns true if the value has a type property with value 'getCurrentChannelResponse'. This is a fast check that does not check the format of the message */ export function isGetCurrentChannelResponse(value: any): value is GetCurrentChannelResponse { - return value != null && value.type === 'getCurrentChannelResponse'; + return value != null && value.type === 'getCurrentChannelResponse'; } /** * Returns true if value is a valid GetCurrentChannelResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetCurrentChannelResponse(value: any): value is GetCurrentChannelResponse { - try { - Convert.getCurrentChannelResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getCurrentChannelResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_CURRENT_CHANNEL_RESPONSE_TYPE = "GetCurrentChannelResponse"; +export const GET_CURRENT_CHANNEL_RESPONSE_TYPE = 'GetCurrentChannelResponse'; /** * Returns true if the value has a type property with value 'getCurrentContextRequest'. This is a fast check that does not check the format of the message */ export function isGetCurrentContextRequest(value: any): value is GetCurrentContextRequest { - return value != null && value.type === 'getCurrentContextRequest'; + return value != null && value.type === 'getCurrentContextRequest'; } /** * Returns true if value is a valid GetCurrentContextRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetCurrentContextRequest(value: any): value is GetCurrentContextRequest { - try { - Convert.getCurrentContextRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getCurrentContextRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_CURRENT_CONTEXT_REQUEST_TYPE = "GetCurrentContextRequest"; +export const GET_CURRENT_CONTEXT_REQUEST_TYPE = 'GetCurrentContextRequest'; /** * Returns true if the value has a type property with value 'getCurrentContextResponse'. This is a fast check that does not check the format of the message */ export function isGetCurrentContextResponse(value: any): value is GetCurrentContextResponse { - return value != null && value.type === 'getCurrentContextResponse'; + return value != null && value.type === 'getCurrentContextResponse'; } /** * Returns true if value is a valid GetCurrentContextResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetCurrentContextResponse(value: any): value is GetCurrentContextResponse { - try { - Convert.getCurrentContextResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getCurrentContextResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_CURRENT_CONTEXT_RESPONSE_TYPE = "GetCurrentContextResponse"; +export const GET_CURRENT_CONTEXT_RESPONSE_TYPE = 'GetCurrentContextResponse'; /** * Returns true if the value has a type property with value 'getInfoRequest'. This is a fast check that does not check the format of the message */ export function isGetInfoRequest(value: any): value is GetInfoRequest { - return value != null && value.type === 'getInfoRequest'; + return value != null && value.type === 'getInfoRequest'; } /** * Returns true if value is a valid GetInfoRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetInfoRequest(value: any): value is GetInfoRequest { - try { - Convert.getInfoRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getInfoRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_INFO_REQUEST_TYPE = "GetInfoRequest"; +export const GET_INFO_REQUEST_TYPE = 'GetInfoRequest'; /** * Returns true if the value has a type property with value 'getInfoResponse'. This is a fast check that does not check the format of the message */ export function isGetInfoResponse(value: any): value is GetInfoResponse { - return value != null && value.type === 'getInfoResponse'; + return value != null && value.type === 'getInfoResponse'; } /** * Returns true if value is a valid GetInfoResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetInfoResponse(value: any): value is GetInfoResponse { - try { - Convert.getInfoResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getInfoResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_INFO_RESPONSE_TYPE = "GetInfoResponse"; +export const GET_INFO_RESPONSE_TYPE = 'GetInfoResponse'; /** * Returns true if the value has a type property with value 'getOrCreateChannelRequest'. This is a fast check that does not check the format of the message */ export function isGetOrCreateChannelRequest(value: any): value is GetOrCreateChannelRequest { - return value != null && value.type === 'getOrCreateChannelRequest'; + return value != null && value.type === 'getOrCreateChannelRequest'; } /** * Returns true if value is a valid GetOrCreateChannelRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetOrCreateChannelRequest(value: any): value is GetOrCreateChannelRequest { - try { - Convert.getOrCreateChannelRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getOrCreateChannelRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_OR_CREATE_CHANNEL_REQUEST_TYPE = "GetOrCreateChannelRequest"; +export const GET_OR_CREATE_CHANNEL_REQUEST_TYPE = 'GetOrCreateChannelRequest'; /** * Returns true if the value has a type property with value 'getOrCreateChannelResponse'. This is a fast check that does not check the format of the message */ export function isGetOrCreateChannelResponse(value: any): value is GetOrCreateChannelResponse { - return value != null && value.type === 'getOrCreateChannelResponse'; + return value != null && value.type === 'getOrCreateChannelResponse'; } /** * Returns true if value is a valid GetOrCreateChannelResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetOrCreateChannelResponse(value: any): value is GetOrCreateChannelResponse { - try { - Convert.getOrCreateChannelResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getOrCreateChannelResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_OR_CREATE_CHANNEL_RESPONSE_TYPE = "GetOrCreateChannelResponse"; +export const GET_OR_CREATE_CHANNEL_RESPONSE_TYPE = 'GetOrCreateChannelResponse'; /** * Returns true if the value has a type property with value 'getUserChannelsRequest'. This is a fast check that does not check the format of the message */ export function isGetUserChannelsRequest(value: any): value is GetUserChannelsRequest { - return value != null && value.type === 'getUserChannelsRequest'; + return value != null && value.type === 'getUserChannelsRequest'; } /** * Returns true if value is a valid GetUserChannelsRequest. This checks the type against the json schema for the message and will be slower */ export function isValidGetUserChannelsRequest(value: any): value is GetUserChannelsRequest { - try { - Convert.getUserChannelsRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getUserChannelsRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_USER_CHANNELS_REQUEST_TYPE = "GetUserChannelsRequest"; +export const GET_USER_CHANNELS_REQUEST_TYPE = 'GetUserChannelsRequest'; /** * Returns true if the value has a type property with value 'getUserChannelsResponse'. This is a fast check that does not check the format of the message */ export function isGetUserChannelsResponse(value: any): value is GetUserChannelsResponse { - return value != null && value.type === 'getUserChannelsResponse'; + return value != null && value.type === 'getUserChannelsResponse'; } /** * Returns true if value is a valid GetUserChannelsResponse. This checks the type against the json schema for the message and will be slower */ export function isValidGetUserChannelsResponse(value: any): value is GetUserChannelsResponse { - try { - Convert.getUserChannelsResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.getUserChannelsResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const GET_USER_CHANNELS_RESPONSE_TYPE = "GetUserChannelsResponse"; +export const GET_USER_CHANNELS_RESPONSE_TYPE = 'GetUserChannelsResponse'; /** * Returns true if the value has a type property with value 'heartbeatAcknowledgementRequest'. This is a fast check that does not check the format of the message */ export function isHeartbeatAcknowledgementRequest(value: any): value is HeartbeatAcknowledgementRequest { - return value != null && value.type === 'heartbeatAcknowledgementRequest'; + return value != null && value.type === 'heartbeatAcknowledgementRequest'; } /** * Returns true if value is a valid HeartbeatAcknowledgementRequest. This checks the type against the json schema for the message and will be slower */ export function isValidHeartbeatAcknowledgementRequest(value: any): value is HeartbeatAcknowledgementRequest { - try { - Convert.heartbeatAcknowledgementRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.heartbeatAcknowledgementRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const HEARTBEAT_ACKNOWLEDGEMENT_REQUEST_TYPE = "HeartbeatAcknowledgementRequest"; +export const HEARTBEAT_ACKNOWLEDGEMENT_REQUEST_TYPE = 'HeartbeatAcknowledgementRequest'; /** * Returns true if the value has a type property with value 'heartbeatEvent'. This is a fast check that does not check the format of the message */ export function isHeartbeatEvent(value: any): value is HeartbeatEvent { - return value != null && value.type === 'heartbeatEvent'; + return value != null && value.type === 'heartbeatEvent'; } /** * Returns true if value is a valid HeartbeatEvent. This checks the type against the json schema for the message and will be slower */ export function isValidHeartbeatEvent(value: any): value is HeartbeatEvent { - try { - Convert.heartbeatEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.heartbeatEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const HEARTBEAT_EVENT_TYPE = "HeartbeatEvent"; +export const HEARTBEAT_EVENT_TYPE = 'HeartbeatEvent'; /** * Returns true if the value has a type property with value 'intentEvent'. This is a fast check that does not check the format of the message */ export function isIntentEvent(value: any): value is IntentEvent { - return value != null && value.type === 'intentEvent'; + return value != null && value.type === 'intentEvent'; } /** * Returns true if value is a valid IntentEvent. This checks the type against the json schema for the message and will be slower */ export function isValidIntentEvent(value: any): value is IntentEvent { - try { - Convert.intentEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.intentEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const INTENT_EVENT_TYPE = "IntentEvent"; +export const INTENT_EVENT_TYPE = 'IntentEvent'; /** * Returns true if the value has a type property with value 'intentListenerUnsubscribeRequest'. This is a fast check that does not check the format of the message */ export function isIntentListenerUnsubscribeRequest(value: any): value is IntentListenerUnsubscribeRequest { - return value != null && value.type === 'intentListenerUnsubscribeRequest'; + return value != null && value.type === 'intentListenerUnsubscribeRequest'; } /** * Returns true if value is a valid IntentListenerUnsubscribeRequest. This checks the type against the json schema for the message and will be slower */ export function isValidIntentListenerUnsubscribeRequest(value: any): value is IntentListenerUnsubscribeRequest { - try { - Convert.intentListenerUnsubscribeRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.intentListenerUnsubscribeRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const INTENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = "IntentListenerUnsubscribeRequest"; +export const INTENT_LISTENER_UNSUBSCRIBE_REQUEST_TYPE = 'IntentListenerUnsubscribeRequest'; /** * Returns true if the value has a type property with value 'intentListenerUnsubscribeResponse'. This is a fast check that does not check the format of the message */ export function isIntentListenerUnsubscribeResponse(value: any): value is IntentListenerUnsubscribeResponse { - return value != null && value.type === 'intentListenerUnsubscribeResponse'; + return value != null && value.type === 'intentListenerUnsubscribeResponse'; } /** * Returns true if value is a valid IntentListenerUnsubscribeResponse. This checks the type against the json schema for the message and will be slower */ export function isValidIntentListenerUnsubscribeResponse(value: any): value is IntentListenerUnsubscribeResponse { - try { - Convert.intentListenerUnsubscribeResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.intentListenerUnsubscribeResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const INTENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = "IntentListenerUnsubscribeResponse"; +export const INTENT_LISTENER_UNSUBSCRIBE_RESPONSE_TYPE = 'IntentListenerUnsubscribeResponse'; /** * Returns true if the value has a type property with value 'intentResultRequest'. This is a fast check that does not check the format of the message */ export function isIntentResultRequest(value: any): value is IntentResultRequest { - return value != null && value.type === 'intentResultRequest'; + return value != null && value.type === 'intentResultRequest'; } /** * Returns true if value is a valid IntentResultRequest. This checks the type against the json schema for the message and will be slower */ export function isValidIntentResultRequest(value: any): value is IntentResultRequest { - try { - Convert.intentResultRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.intentResultRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const INTENT_RESULT_REQUEST_TYPE = "IntentResultRequest"; +export const INTENT_RESULT_REQUEST_TYPE = 'IntentResultRequest'; /** * Returns true if the value has a type property with value 'intentResultResponse'. This is a fast check that does not check the format of the message */ export function isIntentResultResponse(value: any): value is IntentResultResponse { - return value != null && value.type === 'intentResultResponse'; + return value != null && value.type === 'intentResultResponse'; } /** * Returns true if value is a valid IntentResultResponse. This checks the type against the json schema for the message and will be slower */ export function isValidIntentResultResponse(value: any): value is IntentResultResponse { - try { - Convert.intentResultResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.intentResultResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const INTENT_RESULT_RESPONSE_TYPE = "IntentResultResponse"; +export const INTENT_RESULT_RESPONSE_TYPE = 'IntentResultResponse'; /** * Returns true if the value has a type property with value 'joinUserChannelRequest'. This is a fast check that does not check the format of the message */ export function isJoinUserChannelRequest(value: any): value is JoinUserChannelRequest { - return value != null && value.type === 'joinUserChannelRequest'; + return value != null && value.type === 'joinUserChannelRequest'; } /** * Returns true if value is a valid JoinUserChannelRequest. This checks the type against the json schema for the message and will be slower */ export function isValidJoinUserChannelRequest(value: any): value is JoinUserChannelRequest { - try { - Convert.joinUserChannelRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.joinUserChannelRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const JOIN_USER_CHANNEL_REQUEST_TYPE = "JoinUserChannelRequest"; +export const JOIN_USER_CHANNEL_REQUEST_TYPE = 'JoinUserChannelRequest'; /** * Returns true if the value has a type property with value 'joinUserChannelResponse'. This is a fast check that does not check the format of the message */ export function isJoinUserChannelResponse(value: any): value is JoinUserChannelResponse { - return value != null && value.type === 'joinUserChannelResponse'; + return value != null && value.type === 'joinUserChannelResponse'; } /** * Returns true if value is a valid JoinUserChannelResponse. This checks the type against the json schema for the message and will be slower */ export function isValidJoinUserChannelResponse(value: any): value is JoinUserChannelResponse { - try { - Convert.joinUserChannelResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.joinUserChannelResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const JOIN_USER_CHANNEL_RESPONSE_TYPE = "JoinUserChannelResponse"; +export const JOIN_USER_CHANNEL_RESPONSE_TYPE = 'JoinUserChannelResponse'; /** * Returns true if the value has a type property with value 'leaveCurrentChannelRequest'. This is a fast check that does not check the format of the message */ export function isLeaveCurrentChannelRequest(value: any): value is LeaveCurrentChannelRequest { - return value != null && value.type === 'leaveCurrentChannelRequest'; + return value != null && value.type === 'leaveCurrentChannelRequest'; } /** * Returns true if value is a valid LeaveCurrentChannelRequest. This checks the type against the json schema for the message and will be slower */ export function isValidLeaveCurrentChannelRequest(value: any): value is LeaveCurrentChannelRequest { - try { - Convert.leaveCurrentChannelRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.leaveCurrentChannelRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const LEAVE_CURRENT_CHANNEL_REQUEST_TYPE = "LeaveCurrentChannelRequest"; +export const LEAVE_CURRENT_CHANNEL_REQUEST_TYPE = 'LeaveCurrentChannelRequest'; /** * Returns true if the value has a type property with value 'leaveCurrentChannelResponse'. This is a fast check that does not check the format of the message */ export function isLeaveCurrentChannelResponse(value: any): value is LeaveCurrentChannelResponse { - return value != null && value.type === 'leaveCurrentChannelResponse'; + return value != null && value.type === 'leaveCurrentChannelResponse'; } /** * Returns true if value is a valid LeaveCurrentChannelResponse. This checks the type against the json schema for the message and will be slower */ export function isValidLeaveCurrentChannelResponse(value: any): value is LeaveCurrentChannelResponse { - try { - Convert.leaveCurrentChannelResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.leaveCurrentChannelResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const LEAVE_CURRENT_CHANNEL_RESPONSE_TYPE = "LeaveCurrentChannelResponse"; +export const LEAVE_CURRENT_CHANNEL_RESPONSE_TYPE = 'LeaveCurrentChannelResponse'; /** * Returns true if the value has a type property with value 'openRequest'. This is a fast check that does not check the format of the message */ export function isOpenRequest(value: any): value is OpenRequest { - return value != null && value.type === 'openRequest'; + return value != null && value.type === 'openRequest'; } /** * Returns true if value is a valid OpenRequest. This checks the type against the json schema for the message and will be slower */ export function isValidOpenRequest(value: any): value is OpenRequest { - try { - Convert.openRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.openRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const OPEN_REQUEST_TYPE = "OpenRequest"; +export const OPEN_REQUEST_TYPE = 'OpenRequest'; /** * Returns true if the value has a type property with value 'openResponse'. This is a fast check that does not check the format of the message */ export function isOpenResponse(value: any): value is OpenResponse { - return value != null && value.type === 'openResponse'; + return value != null && value.type === 'openResponse'; } /** * Returns true if value is a valid OpenResponse. This checks the type against the json schema for the message and will be slower */ export function isValidOpenResponse(value: any): value is OpenResponse { - try { - Convert.openResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.openResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const OPEN_RESPONSE_TYPE = "OpenResponse"; +export const OPEN_RESPONSE_TYPE = 'OpenResponse'; /** * Returns true if the value has a type property with value 'privateChannelAddEventListenerRequest'. This is a fast check that does not check the format of the message */ export function isPrivateChannelAddEventListenerRequest(value: any): value is PrivateChannelAddEventListenerRequest { - return value != null && value.type === 'privateChannelAddEventListenerRequest'; + return value != null && value.type === 'privateChannelAddEventListenerRequest'; } /** * Returns true if value is a valid PrivateChannelAddEventListenerRequest. This checks the type against the json schema for the message and will be slower */ -export function isValidPrivateChannelAddEventListenerRequest(value: any): value is PrivateChannelAddEventListenerRequest { - try { - Convert.privateChannelAddEventListenerRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isValidPrivateChannelAddEventListenerRequest( + value: any +): value is PrivateChannelAddEventListenerRequest { + try { + Convert.privateChannelAddEventListenerRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_REQUEST_TYPE = "PrivateChannelAddEventListenerRequest"; +export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_REQUEST_TYPE = 'PrivateChannelAddEventListenerRequest'; /** * Returns true if the value has a type property with value 'privateChannelAddEventListenerResponse'. This is a fast check that does not check the format of the message */ export function isPrivateChannelAddEventListenerResponse(value: any): value is PrivateChannelAddEventListenerResponse { - return value != null && value.type === 'privateChannelAddEventListenerResponse'; + return value != null && value.type === 'privateChannelAddEventListenerResponse'; } /** * Returns true if value is a valid PrivateChannelAddEventListenerResponse. This checks the type against the json schema for the message and will be slower */ -export function isValidPrivateChannelAddEventListenerResponse(value: any): value is PrivateChannelAddEventListenerResponse { - try { - Convert.privateChannelAddEventListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isValidPrivateChannelAddEventListenerResponse( + value: any +): value is PrivateChannelAddEventListenerResponse { + try { + Convert.privateChannelAddEventListenerResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_RESPONSE_TYPE = "PrivateChannelAddEventListenerResponse"; +export const PRIVATE_CHANNEL_ADD_EVENT_LISTENER_RESPONSE_TYPE = 'PrivateChannelAddEventListenerResponse'; /** * Returns true if the value has a type property with value 'privateChannelDisconnectRequest'. This is a fast check that does not check the format of the message */ export function isPrivateChannelDisconnectRequest(value: any): value is PrivateChannelDisconnectRequest { - return value != null && value.type === 'privateChannelDisconnectRequest'; + return value != null && value.type === 'privateChannelDisconnectRequest'; } /** * Returns true if value is a valid PrivateChannelDisconnectRequest. This checks the type against the json schema for the message and will be slower */ export function isValidPrivateChannelDisconnectRequest(value: any): value is PrivateChannelDisconnectRequest { - try { - Convert.privateChannelDisconnectRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.privateChannelDisconnectRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_DISCONNECT_REQUEST_TYPE = "PrivateChannelDisconnectRequest"; +export const PRIVATE_CHANNEL_DISCONNECT_REQUEST_TYPE = 'PrivateChannelDisconnectRequest'; /** * Returns true if the value has a type property with value 'privateChannelDisconnectResponse'. This is a fast check that does not check the format of the message */ export function isPrivateChannelDisconnectResponse(value: any): value is PrivateChannelDisconnectResponse { - return value != null && value.type === 'privateChannelDisconnectResponse'; + return value != null && value.type === 'privateChannelDisconnectResponse'; } /** * Returns true if value is a valid PrivateChannelDisconnectResponse. This checks the type against the json schema for the message and will be slower */ export function isValidPrivateChannelDisconnectResponse(value: any): value is PrivateChannelDisconnectResponse { - try { - Convert.privateChannelDisconnectResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.privateChannelDisconnectResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_DISCONNECT_RESPONSE_TYPE = "PrivateChannelDisconnectResponse"; +export const PRIVATE_CHANNEL_DISCONNECT_RESPONSE_TYPE = 'PrivateChannelDisconnectResponse'; /** * Returns true if the value has a type property with value 'privateChannelOnAddContextListenerEvent'. This is a fast check that does not check the format of the message */ -export function isPrivateChannelOnAddContextListenerEvent(value: any): value is PrivateChannelOnAddContextListenerEvent { - return value != null && value.type === 'privateChannelOnAddContextListenerEvent'; +export function isPrivateChannelOnAddContextListenerEvent( + value: any +): value is PrivateChannelOnAddContextListenerEvent { + return value != null && value.type === 'privateChannelOnAddContextListenerEvent'; } /** * Returns true if value is a valid PrivateChannelOnAddContextListenerEvent. This checks the type against the json schema for the message and will be slower */ -export function isValidPrivateChannelOnAddContextListenerEvent(value: any): value is PrivateChannelOnAddContextListenerEvent { - try { - Convert.privateChannelOnAddContextListenerEventToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isValidPrivateChannelOnAddContextListenerEvent( + value: any +): value is PrivateChannelOnAddContextListenerEvent { + try { + Convert.privateChannelOnAddContextListenerEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_ON_ADD_CONTEXT_LISTENER_EVENT_TYPE = "PrivateChannelOnAddContextListenerEvent"; +export const PRIVATE_CHANNEL_ON_ADD_CONTEXT_LISTENER_EVENT_TYPE = 'PrivateChannelOnAddContextListenerEvent'; /** * Returns true if the value has a type property with value 'privateChannelOnDisconnectEvent'. This is a fast check that does not check the format of the message */ export function isPrivateChannelOnDisconnectEvent(value: any): value is PrivateChannelOnDisconnectEvent { - return value != null && value.type === 'privateChannelOnDisconnectEvent'; + return value != null && value.type === 'privateChannelOnDisconnectEvent'; } /** * Returns true if value is a valid PrivateChannelOnDisconnectEvent. This checks the type against the json schema for the message and will be slower */ export function isValidPrivateChannelOnDisconnectEvent(value: any): value is PrivateChannelOnDisconnectEvent { - try { - Convert.privateChannelOnDisconnectEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.privateChannelOnDisconnectEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_ON_DISCONNECT_EVENT_TYPE = "PrivateChannelOnDisconnectEvent"; +export const PRIVATE_CHANNEL_ON_DISCONNECT_EVENT_TYPE = 'PrivateChannelOnDisconnectEvent'; /** * Returns true if the value has a type property with value 'privateChannelOnUnsubscribeEvent'. This is a fast check that does not check the format of the message */ export function isPrivateChannelOnUnsubscribeEvent(value: any): value is PrivateChannelOnUnsubscribeEvent { - return value != null && value.type === 'privateChannelOnUnsubscribeEvent'; + return value != null && value.type === 'privateChannelOnUnsubscribeEvent'; } /** * Returns true if value is a valid PrivateChannelOnUnsubscribeEvent. This checks the type against the json schema for the message and will be slower */ export function isValidPrivateChannelOnUnsubscribeEvent(value: any): value is PrivateChannelOnUnsubscribeEvent { - try { - Convert.privateChannelOnUnsubscribeEventToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.privateChannelOnUnsubscribeEventToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_ON_UNSUBSCRIBE_EVENT_TYPE = "PrivateChannelOnUnsubscribeEvent"; +export const PRIVATE_CHANNEL_ON_UNSUBSCRIBE_EVENT_TYPE = 'PrivateChannelOnUnsubscribeEvent'; /** * Returns true if the value has a type property with value 'privateChannelUnsubscribeEventListenerRequest'. This is a fast check that does not check the format of the message */ -export function isPrivateChannelUnsubscribeEventListenerRequest(value: any): value is PrivateChannelUnsubscribeEventListenerRequest { - return value != null && value.type === 'privateChannelUnsubscribeEventListenerRequest'; +export function isPrivateChannelUnsubscribeEventListenerRequest( + value: any +): value is PrivateChannelUnsubscribeEventListenerRequest { + return value != null && value.type === 'privateChannelUnsubscribeEventListenerRequest'; } /** * Returns true if value is a valid PrivateChannelUnsubscribeEventListenerRequest. This checks the type against the json schema for the message and will be slower */ -export function isValidPrivateChannelUnsubscribeEventListenerRequest(value: any): value is PrivateChannelUnsubscribeEventListenerRequest { - try { - Convert.privateChannelUnsubscribeEventListenerRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isValidPrivateChannelUnsubscribeEventListenerRequest( + value: any +): value is PrivateChannelUnsubscribeEventListenerRequest { + try { + Convert.privateChannelUnsubscribeEventListenerRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_REQUEST_TYPE = "PrivateChannelUnsubscribeEventListenerRequest"; +export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_REQUEST_TYPE = 'PrivateChannelUnsubscribeEventListenerRequest'; /** * Returns true if the value has a type property with value 'privateChannelUnsubscribeEventListenerResponse'. This is a fast check that does not check the format of the message */ -export function isPrivateChannelUnsubscribeEventListenerResponse(value: any): value is PrivateChannelUnsubscribeEventListenerResponse { - return value != null && value.type === 'privateChannelUnsubscribeEventListenerResponse'; +export function isPrivateChannelUnsubscribeEventListenerResponse( + value: any +): value is PrivateChannelUnsubscribeEventListenerResponse { + return value != null && value.type === 'privateChannelUnsubscribeEventListenerResponse'; } /** * Returns true if value is a valid PrivateChannelUnsubscribeEventListenerResponse. This checks the type against the json schema for the message and will be slower */ -export function isValidPrivateChannelUnsubscribeEventListenerResponse(value: any): value is PrivateChannelUnsubscribeEventListenerResponse { - try { - Convert.privateChannelUnsubscribeEventListenerResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } +export function isValidPrivateChannelUnsubscribeEventListenerResponse( + value: any +): value is PrivateChannelUnsubscribeEventListenerResponse { + try { + Convert.privateChannelUnsubscribeEventListenerResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_RESPONSE_TYPE = "PrivateChannelUnsubscribeEventListenerResponse"; +export const PRIVATE_CHANNEL_UNSUBSCRIBE_EVENT_LISTENER_RESPONSE_TYPE = + 'PrivateChannelUnsubscribeEventListenerResponse'; /** * Returns true if the value has a type property with value 'raiseIntentForContextRequest'. This is a fast check that does not check the format of the message */ export function isRaiseIntentForContextRequest(value: any): value is RaiseIntentForContextRequest { - return value != null && value.type === 'raiseIntentForContextRequest'; + return value != null && value.type === 'raiseIntentForContextRequest'; } /** * Returns true if value is a valid RaiseIntentForContextRequest. This checks the type against the json schema for the message and will be slower */ export function isValidRaiseIntentForContextRequest(value: any): value is RaiseIntentForContextRequest { - try { - Convert.raiseIntentForContextRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.raiseIntentForContextRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const RAISE_INTENT_FOR_CONTEXT_REQUEST_TYPE = "RaiseIntentForContextRequest"; +export const RAISE_INTENT_FOR_CONTEXT_REQUEST_TYPE = 'RaiseIntentForContextRequest'; /** * Returns true if the value has a type property with value 'raiseIntentForContextResponse'. This is a fast check that does not check the format of the message */ export function isRaiseIntentForContextResponse(value: any): value is RaiseIntentForContextResponse { - return value != null && value.type === 'raiseIntentForContextResponse'; + return value != null && value.type === 'raiseIntentForContextResponse'; } /** * Returns true if value is a valid RaiseIntentForContextResponse. This checks the type against the json schema for the message and will be slower */ export function isValidRaiseIntentForContextResponse(value: any): value is RaiseIntentForContextResponse { - try { - Convert.raiseIntentForContextResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.raiseIntentForContextResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const RAISE_INTENT_FOR_CONTEXT_RESPONSE_TYPE = "RaiseIntentForContextResponse"; +export const RAISE_INTENT_FOR_CONTEXT_RESPONSE_TYPE = 'RaiseIntentForContextResponse'; /** * Returns true if the value has a type property with value 'raiseIntentRequest'. This is a fast check that does not check the format of the message */ export function isRaiseIntentRequest(value: any): value is RaiseIntentRequest { - return value != null && value.type === 'raiseIntentRequest'; + return value != null && value.type === 'raiseIntentRequest'; } /** * Returns true if value is a valid RaiseIntentRequest. This checks the type against the json schema for the message and will be slower */ export function isValidRaiseIntentRequest(value: any): value is RaiseIntentRequest { - try { - Convert.raiseIntentRequestToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.raiseIntentRequestToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const RAISE_INTENT_REQUEST_TYPE = "RaiseIntentRequest"; +export const RAISE_INTENT_REQUEST_TYPE = 'RaiseIntentRequest'; /** * Returns true if the value has a type property with value 'raiseIntentResponse'. This is a fast check that does not check the format of the message */ export function isRaiseIntentResponse(value: any): value is RaiseIntentResponse { - return value != null && value.type === 'raiseIntentResponse'; + return value != null && value.type === 'raiseIntentResponse'; } /** * Returns true if value is a valid RaiseIntentResponse. This checks the type against the json schema for the message and will be slower */ export function isValidRaiseIntentResponse(value: any): value is RaiseIntentResponse { - try { - Convert.raiseIntentResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.raiseIntentResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const RAISE_INTENT_RESPONSE_TYPE = "RaiseIntentResponse"; +export const RAISE_INTENT_RESPONSE_TYPE = 'RaiseIntentResponse'; /** * Returns true if the value has a type property with value 'raiseIntentResultResponse'. This is a fast check that does not check the format of the message */ export function isRaiseIntentResultResponse(value: any): value is RaiseIntentResultResponse { - return value != null && value.type === 'raiseIntentResultResponse'; + return value != null && value.type === 'raiseIntentResultResponse'; } /** * Returns true if value is a valid RaiseIntentResultResponse. This checks the type against the json schema for the message and will be slower */ export function isValidRaiseIntentResultResponse(value: any): value is RaiseIntentResultResponse { - try { - Convert.raiseIntentResultResponseToJson(value); - return true; - } catch (_e: any) { - return false; - } + try { + Convert.raiseIntentResultResponseToJson(value); + return true; + } catch (_e: any) { + return false; + } } -export const RAISE_INTENT_RESULT_RESPONSE_TYPE = "RaiseIntentResultResponse"; +export const RAISE_INTENT_RESULT_RESPONSE_TYPE = 'RaiseIntentResultResponse'; diff --git a/packages/fdc3-schema/generated/bridging/BridgingTypes.ts b/packages/fdc3-schema/generated/bridging/BridgingTypes.ts index 4a7b7e98a..9a15a3887 100644 --- a/packages/fdc3-schema/generated/bridging/BridgingTypes.ts +++ b/packages/fdc3-schema/generated/bridging/BridgingTypes.ts @@ -77,33 +77,33 @@ * preference to the standard response when an error needs to be returned. */ export interface AgentErrorResponseMessage { - meta: AgentResponseMetadata; - /** - * Error message payload containing an standardized error string. - */ - payload: ErrorResponseMessagePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: ResponseMessageType; + meta: AgentResponseMetadata; + /** + * Error message payload containing an standardized error string. + */ + payload: ErrorResponseMessagePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: ResponseMessageType; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface AgentResponseMetadata { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface ErrorResponseMessagePayload { - error: ResponseErrorDetail; - [property: string]: any; + error: ResponseErrorDetail; + [property: string]: any; } /** @@ -118,47 +118,75 @@ export interface ErrorResponseMessagePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type ResponseErrorDetail = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound" | "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type ResponseErrorDetail = + | 'AccessDenied' + | 'CreationFailed' + | 'MalformedContext' + | 'NoChannelFound' + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that * the message relates to, e.g. 'findIntent', with 'Response' appended. */ -export type ResponseMessageType = "findInstancesResponse" | "findIntentResponse" | "findIntentsByContextResponse" | "getAppMetadataResponse" | "openResponse" | "raiseIntentResponse" | "raiseIntentResultResponse"; +export type ResponseMessageType = + | 'findInstancesResponse' + | 'findIntentResponse' + | 'findIntentsByContextResponse' + | 'getAppMetadataResponse' + | 'openResponse' + | 'raiseIntentResponse' + | 'raiseIntentResultResponse'; /** * A request message from a Desktop Agent to the Bridge. */ export interface AgentRequestMessage { - meta: AgentRequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: RequestMessageType; + meta: AgentRequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: RequestMessageType; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface AgentRequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** @@ -210,25 +238,25 @@ export interface AgentRequestMetadata { * received the intent. */ export interface BridgeParticipantIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId?: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -272,47 +300,60 @@ export interface BridgeParticipantIdentifier { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface SourceIdentifier { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + desktopAgent?: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** * Identifies the type of the message and it is typically set to the FDC3 function name that * the message relates to, e.g. 'findIntent', with 'Request' appended. */ -export type RequestMessageType = "broadcastRequest" | "findInstancesRequest" | "findIntentRequest" | "findIntentsByContextRequest" | "getAppMetadataRequest" | "openRequest" | "PrivateChannel.broadcast" | "PrivateChannel.eventListenerAdded" | "PrivateChannel.eventListenerRemoved" | "PrivateChannel.onAddContextListener" | "PrivateChannel.onDisconnect" | "PrivateChannel.onUnsubscribe" | "raiseIntentRequest"; +export type RequestMessageType = + | 'broadcastRequest' + | 'findInstancesRequest' + | 'findIntentRequest' + | 'findIntentsByContextRequest' + | 'getAppMetadataRequest' + | 'openRequest' + | 'PrivateChannel.broadcast' + | 'PrivateChannel.eventListenerAdded' + | 'PrivateChannel.eventListenerRemoved' + | 'PrivateChannel.onAddContextListener' + | 'PrivateChannel.onDisconnect' + | 'PrivateChannel.onUnsubscribe' + | 'raiseIntentRequest'; /** * A response message from a Desktop Agent to the Bridge. */ export interface AgentResponseMessage { - meta: AgentResponseMetadata; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: ResponseMessageType; + meta: AgentResponseMetadata; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: ResponseMessageType; } /** @@ -320,28 +361,28 @@ export interface AgentResponseMessage { * request, used where all connected agents returned errors. */ export interface BridgeErrorResponseMessage { - meta: BridgeErrorResponseMessageMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: ResponseErrorMessagePayload; - /** - * Identifies 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: string; + meta: BridgeErrorResponseMessageMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: ResponseErrorMessagePayload; + /** + * Identifies 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: string; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface BridgeErrorResponseMessageMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -363,12 +404,12 @@ export interface BridgeErrorResponseMessageMeta { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface DesktopAgentIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + desktopAgent: string; + [property: string]: any; } /** @@ -376,44 +417,44 @@ export interface DesktopAgentIdentifier { * raised the original request. */ export interface ResponseErrorMessagePayload { - error?: ResponseErrorDetail; - [property: string]: any; + error?: ResponseErrorDetail; + [property: string]: any; } /** * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface BridgeRequestMessage { - meta: BridgeRequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: string; + meta: BridgeRequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface BridgeRequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: BridgeParticipantIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: BridgeParticipantIdentifier; + timestamp: Date; } /** @@ -421,28 +462,28 @@ export interface BridgeRequestMetadata { * request. */ export interface BridgeResponseMessage { - meta: BridgeResponseMessageMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: string; + meta: BridgeResponseMessageMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface BridgeResponseMessageMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** @@ -451,29 +492,29 @@ export interface BridgeResponseMessageMeta { * A request message from a Desktop Agent to the Bridge. */ export interface BroadcastAgentRequest { - meta: BroadcastAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: BroadcastAgentRequestPayload; - /** - * Identifies 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: "broadcastRequest"; + meta: BroadcastAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: BroadcastAgentRequestPayload; + /** + * Identifies 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: 'broadcastRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface BroadcastAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** @@ -517,39 +558,39 @@ export interface BroadcastAgentRequestMeta { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface SourceObject { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 BroadcastAgentRequestPayload { - /** - * The Id of the Channel that the broadcast was sent on. - */ - channelId: string; - /** - * The context object that is to be broadcast. - */ - context: Context; + /** + * The Id of the Channel that the broadcast was sent on. + */ + channelId: string; + /** + * The context object that is to be broadcast. + */ + context: Context; } /** @@ -570,44 +611,44 @@ export interface BroadcastAgentRequestPayload { * with custom fields as appropriate. */ export interface Context { - /** - * Context data objects may include a set of equivalent key-value pairs that can be used to - * help applications identify and look up the context type they receive in their own domain. - * The idea behind this design is that applications can provide as many equivalent - * identifiers to a target application as possible, e.g. an instrument may be represented by - * an ISIN, CUSIP or Bloomberg identifier. - * - * Identifiers do not make sense for all types of data, so the `id` property is therefore - * optional, but some derived types may choose to require at least one identifier. - * Identifier values SHOULD always be of type string. - */ - id?: { [key: string]: any }; - /** - * Context data objects may include a name property that can be used for more information, - * or display purposes. Some derived types may require the name object as mandatory, - * depending on use case. - */ - name?: string; - /** - * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 - * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present - * to route shared context data appropriately. - * - * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data - * types they support in an FDC3 [App - * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery - * and routing. - * - * Standardized FDC3 context types have well-known `type` properties prefixed with the - * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and - * used by a particular organization, the convention is to prefix them with an - * organization-specific namespace, e.g. `blackrock.fund`. - * - * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more - * information about context data types. - */ - type: string; - [property: string]: any; + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + * Identifier values SHOULD always be of type string. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -626,30 +667,30 @@ export interface Context { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface BroadcastBridgeRequest { - meta: BroadcastBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: BroadcastBridgeRequestPayload; - /** - * Identifies 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: "broadcastRequest"; + meta: BroadcastBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: BroadcastBridgeRequestPayload; + /** + * Identifies 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: 'broadcastRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface BroadcastBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** @@ -701,39 +742,39 @@ export interface BroadcastBridgeRequestMeta { * sent to. */ export interface MetaSource { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 BroadcastBridgeRequestPayload { - /** - * The Id of the Channel that the broadcast was sent on. - */ - channelId: string; - /** - * The context object that is to be broadcast. - */ - context: Context; + /** + * The Id of the Channel that the broadcast was sent on. + */ + channelId: string; + /** + * The context object that is to be broadcast. + */ + context: Context; } /** @@ -741,30 +782,30 @@ export interface BroadcastBridgeRequestPayload { * messages sent in either direction. */ export interface ConnectionStepMessage { - 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; + 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 this connection step message. */ export interface ConnectionStepMetadata { - requestUuid?: string; - responseUuid?: string; - timestamp: Date; + requestUuid?: string; + responseUuid?: string; + timestamp: Date; } /** * Identifies the type of the connection step message. */ -export type ConnectionStepMessageType = "hello" | "handshake" | "authenticationFailed" | "connectedAgentsUpdate"; +export type ConnectionStepMessageType = 'hello' | 'handshake' | 'authenticationFailed' | 'connectedAgentsUpdate'; /** * Hello message sent by the Bridge to anyone connecting to the Bridge (enables @@ -774,45 +815,45 @@ export type ConnectionStepMessageType = "hello" | "handshake" | "authenticationF * messages sent in either direction. */ export interface ConnectionStep2Hello { - meta: ConnectionStep2HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep2HelloPayload; - /** - * Identifies the type of the connection step message. - */ - type: "hello"; + meta: ConnectionStep2HelloMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep2HelloPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'hello'; } /** * Metadata for this connection step message. */ export interface ConnectionStep2HelloMeta { - timestamp: Date; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep2HelloPayload { - /** - * A flag indicating whether the Desktop Agent Bridge requires authentication or not. - */ - authRequired: boolean; - /** - * An optional Desktop Agent Bridge JWT authentication token if the Desktop Agent want to - * authenticate a bridge. - */ - authToken?: string; - /** - * The version of the Bridge - */ - desktopAgentBridgeVersion: string; - /** - * The FDC3 versions supported by the Bridge - */ - supportedFDC3Versions: string[]; + /** + * A flag indicating whether the Desktop Agent Bridge requires authentication or not. + */ + authRequired: boolean; + /** + * An optional Desktop Agent Bridge JWT authentication token if the Desktop Agent want to + * authenticate a bridge. + */ + authToken?: string; + /** + * The version of the Bridge + */ + desktopAgentBridgeVersion: string; + /** + * The FDC3 versions supported by the Bridge + */ + supportedFDC3Versions: string[]; } /** @@ -827,44 +868,44 @@ export interface ConnectionStep2HelloPayload { * messages sent in either direction. */ export interface ConnectionStep3Handshake { - meta: ConnectionStep3HandshakeMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep3HandshakePayload; - /** - * Identifies the type of the connection step message. - */ - type: "handshake"; + meta: ConnectionStep3HandshakeMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep3HandshakePayload; + /** + * Identifies the type of the connection step message. + */ + type: 'handshake'; } /** * Metadata for this connection step message. */ export interface ConnectionStep3HandshakeMeta { - requestUuid: string; - timestamp: Date; + requestUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep3HandshakePayload { - authToken?: string; - /** - * The current state of the Desktop Agent's App and User channels (exclude any Private - * channels), as a mapping of channel id to an array of Context objects, one per type found - * in the channel, most recent first. - */ - channelsState: { [key: string]: Context[] }; - /** - * Desktop Agent ImplementationMetadata trying to connect to the bridge. - */ - implementationMetadata: ConnectingAgentImplementationMetadata; - /** - * The requested Desktop Agent name - */ - requestedName: string; + authToken?: string; + /** + * The current state of the Desktop Agent's App and User channels (exclude any Private + * channels), as a mapping of channel id to an array of Context objects, one per type found + * in the channel, most recent first. + */ + channelsState: { [key: string]: Context[] }; + /** + * Desktop Agent ImplementationMetadata trying to connect to the bridge. + */ + implementationMetadata: ConnectingAgentImplementationMetadata; + /** + * The requested Desktop Agent name + */ + requestedName: string; } /** @@ -873,25 +914,25 @@ export interface ConnectionStep3HandshakePayload { * Metadata relating to the FDC3 Desktop Agent implementation and its provider. */ export interface ConnectingAgentImplementationMetadata { - /** - * 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 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; } /** @@ -899,22 +940,22 @@ export interface ConnectingAgentImplementationMetadata { * 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; + /** + * 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; } /** @@ -928,31 +969,31 @@ export interface OptionalFeatures { * messages sent in either direction. */ export interface ConnectionStep4AuthenticationFailed { - meta: ConnectionStep4AuthenticationFailedMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep4AuthenticationFailedPayload; - /** - * Identifies the type of the connection step message. - */ - type: "authenticationFailed"; + meta: ConnectionStep4AuthenticationFailedMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep4AuthenticationFailedPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'authenticationFailed'; } /** * Metadata for this connection step message. */ export interface ConnectionStep4AuthenticationFailedMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep4AuthenticationFailedPayload { - message?: string; + message?: string; } /** @@ -968,48 +1009,48 @@ export interface ConnectionStep4AuthenticationFailedPayload { * messages sent in either direction. */ export interface ConnectionStep6ConnectedAgentsUpdate { - meta: ConnectionStep6ConnectedAgentsUpdateMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep6ConnectedAgentsUpdatePayload; - /** - * Identifies the type of the connection step message. - */ - type: "connectedAgentsUpdate"; + meta: ConnectionStep6ConnectedAgentsUpdateMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep6ConnectedAgentsUpdatePayload; + /** + * Identifies the type of the connection step message. + */ + type: 'connectedAgentsUpdate'; } /** * Metadata for this connection step message. */ export interface ConnectionStep6ConnectedAgentsUpdateMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep6ConnectedAgentsUpdatePayload { - /** - * Should be set when an agent first connects to the bridge and provide its assigned name. - */ - addAgent?: string; - /** - * Desktop Agent Bridge implementation metadata of all connected agents. - */ - allAgents: DesktopAgentImplementationMetadata[]; - /** - * The updated state of channels that should be adopted by the agents. Should only be set - * when an agent is connecting to the bridge. - */ - channelsState?: { [key: string]: Context[] }; - /** - * Should be set when an agent disconnects from the bridge and provide the name that no - * longer is assigned. - */ - removeAgent?: string; + /** + * Should be set when an agent first connects to the bridge and provide its assigned name. + */ + addAgent?: string; + /** + * Desktop Agent Bridge implementation metadata of all connected agents. + */ + allAgents: DesktopAgentImplementationMetadata[]; + /** + * The updated state of channels that should be adopted by the agents. Should only be set + * when an agent is connecting to the bridge. + */ + channelsState?: { [key: string]: Context[] }; + /** + * Should be set when an agent disconnects from the bridge and provide the name that no + * longer is assigned. + */ + removeAgent?: string; } /** @@ -1018,30 +1059,30 @@ export interface ConnectionStep6ConnectedAgentsUpdatePayload { * Metadata relating to the FDC3 Desktop Agent implementation and its provider. */ export interface DesktopAgentImplementationMetadata { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a particular Desktop - * Agent. - */ - desktopAgent: string; - /** - * 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; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a particular Desktop + * Agent. + */ + desktopAgent: string; + /** + * 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; } /** @@ -1055,32 +1096,32 @@ export interface DesktopAgentImplementationMetadata { * preference to the standard response when an error needs to be returned. */ export interface FindInstancesAgentErrorResponse { - meta: FindInstancesAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: PayloadClass; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: FindInstancesAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: PayloadClass; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindInstancesAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface PayloadClass { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1102,7 +1143,20 @@ export interface PayloadClass { * Constants representing the errors that can be encountered when calling the `open` method * on the DesktopAgent object (`fdc3`). */ -export type FindInstancesErrors = "DesktopAgentNotFound" | "IntentDeliveryFailed" | "MalformedContext" | "NoAppsFound" | "ResolverTimeout" | "ResolverUnavailable" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type FindInstancesErrors = + | 'DesktopAgentNotFound' + | 'IntentDeliveryFailed' + | 'MalformedContext' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'ResolverUnavailable' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -1120,35 +1174,35 @@ export type FindInstancesErrors = "DesktopAgentNotFound" | "IntentDeliveryFailed * A request message from a Desktop Agent to the Bridge. */ export interface FindInstancesAgentRequest { - meta: FindInstancesAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindInstancesAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findInstancesRequest"; + meta: FindInstancesAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findInstancesRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindInstancesAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** @@ -1200,32 +1254,32 @@ export interface FindInstancesAgentRequestMeta { * received the intent. */ export interface DestinationObject { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId?: 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 FindInstancesAgentRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -1246,22 +1300,22 @@ export interface FindInstancesAgentRequestPayload { * 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 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; } /** @@ -1280,16 +1334,16 @@ export interface AppIdentifier { * A response message from a Desktop Agent to the Bridge. */ export interface FindInstancesAgentResponse { - meta: AgentResponseMetadata; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindInstancesAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: AgentResponseMetadata; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindInstancesAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** @@ -1300,7 +1354,7 @@ export interface FindInstancesAgentResponse { * The message payload typically contains return values for FDC3 API functions. */ export interface FindInstancesAgentResponsePayload { - appIdentifiers: AppMetadata[]; + appIdentifiers: AppMetadata[]; } /** @@ -1316,84 +1370,84 @@ export interface FindInstancesAgentResponsePayload { * `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; + /** + * 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; + /** + * 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; } /** @@ -1401,22 +1455,22 @@ export interface Icon { * 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; + /** + * 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; } /** @@ -1426,28 +1480,28 @@ export interface Image { * request, used where all connected agents returned errors. */ export interface FindInstancesBridgeErrorResponse { - meta: FindInstancesBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: MessagePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: FindInstancesBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: MessagePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindInstancesBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -1455,7 +1509,7 @@ export interface FindInstancesBridgeErrorResponseMeta { * raised the original request. */ export interface MessagePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1464,36 +1518,36 @@ export interface MessagePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindInstancesBridgeRequest { - meta: FindInstancesBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindInstancesBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findInstancesRequest"; + meta: FindInstancesBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findInstancesRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindInstancesBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSourceObject; + timestamp: Date; } /** @@ -1551,32 +1605,32 @@ export interface FindInstancesBridgeRequestMeta { * sent to. */ export interface MetaSourceObject { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 FindInstancesBridgeRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -1586,16 +1640,16 @@ export interface FindInstancesBridgeRequestPayload { * request. */ export interface FindInstancesBridgeResponse { - meta: BridgeResponseMessageMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindInstancesBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: BridgeResponseMessageMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindInstancesBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** @@ -1606,7 +1660,7 @@ export interface FindInstancesBridgeResponse { * The message payload typically contains return values for FDC3 API functions. */ export interface FindInstancesBridgeResponsePayload { - appIdentifiers: AppMetadata[]; + appIdentifiers: AppMetadata[]; } /** @@ -1616,32 +1670,32 @@ export interface FindInstancesBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface FindIntentAgentErrorResponse { - meta: FindIntentAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: FindIntentAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: FindIntentAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface FindIntentAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1660,44 +1714,44 @@ export interface FindIntentAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface FindIntentAgentRequest { - meta: FindIntentAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentRequest"; + meta: FindIntentAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindIntentAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentAgentRequestPayload { - context?: Context; - intent: string; - resultType?: string; + context?: Context; + intent: string; + resultType?: string; } /** @@ -1716,46 +1770,46 @@ export interface FindIntentAgentRequestPayload { * A response message from a Desktop Agent to the Bridge. */ export interface FindIntentAgentResponse { - meta: FindIntentAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentAgentResponsePayload { - appIntent: AppIntent; + appIntent: AppIntent; } /** * An interface that relates an intent to apps. */ export interface AppIntent { - /** - * Details of applications that can resolve the intent. - */ - apps: AppMetadata[]; - /** - * Details of the intent whose relationship to resolving applications is being described. - */ - intent: IntentMetadata; + /** + * Details of applications that can resolve the intent. + */ + apps: AppMetadata[]; + /** + * Details of the intent whose relationship to resolving applications is being described. + */ + intent: IntentMetadata; } /** @@ -1764,14 +1818,14 @@ export interface AppIntent { * Metadata describing an Intent. */ export interface IntentMetadata { - /** - * Display name for the intent. - */ - displayName?: string; - /** - * The unique name of the intent that can be invoked by the raiseIntent call. - */ - name: string; + /** + * Display name for the intent. + */ + displayName?: string; + /** + * The unique name of the intent that can be invoked by the raiseIntent call. + */ + name: string; } /** @@ -1781,28 +1835,28 @@ export interface IntentMetadata { * request, used where all connected agents returned errors. */ export interface FindIntentBridgeErrorResponse { - meta: FindIntentBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: FindIntentBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: FindIntentBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -1810,7 +1864,7 @@ export interface FindIntentBridgeErrorResponseMeta { * raised the original request. */ export interface FindIntentBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1819,45 +1873,45 @@ export interface FindIntentBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindIntentBridgeRequest { - meta: FindIntentBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentRequest"; + meta: FindIntentBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindIntentBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: BridgeParticipantIdentifier; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: BridgeParticipantIdentifier; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentBridgeRequestPayload { - context?: Context; - intent: string; - resultType?: string; + context?: Context; + intent: string; + resultType?: string; } /** @@ -1867,35 +1921,35 @@ export interface FindIntentBridgeRequestPayload { * request. */ export interface FindIntentBridgeResponse { - meta: FindIntentBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentBridgeResponsePayload { - appIntent: AppIntent; + appIntent: AppIntent; } /** @@ -1905,32 +1959,32 @@ export interface FindIntentBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface FindIntentsByContextAgentErrorResponse { - meta: FindIntentsByContextAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: FindIntentsByContextAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: FindIntentsByContextAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentsByContextAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface FindIntentsByContextAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1950,43 +2004,43 @@ export interface FindIntentsByContextAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface FindIntentsByContextAgentRequest { - meta: FindIntentsByContextAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentsByContextAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentsByContextRequest"; + meta: FindIntentsByContextAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentsByContextAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentsByContextRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindIntentsByContextAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextAgentRequestPayload { - context: Context; - resultType?: string; + context: Context; + resultType?: string; } /** @@ -2005,32 +2059,32 @@ export interface FindIntentsByContextAgentRequestPayload { * A response message from a Desktop Agent to the Bridge. */ export interface FindIntentsByContextAgentResponse { - meta: FindIntentsByContextAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentsByContextAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentsByContextAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentsByContextAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentsByContextAgentResponsePayload { - appIntents: AppIntent[]; + appIntents: AppIntent[]; } /** @@ -2040,28 +2094,28 @@ export interface FindIntentsByContextAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface FindIntentsByContextBridgeErrorResponse { - meta: FindIntentsByContextBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: FindIntentsByContextBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: FindIntentsByContextBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentsByContextBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2069,7 +2123,7 @@ export interface FindIntentsByContextBridgeErrorResponseMeta { * raised the original request. */ export interface FindIntentsByContextBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2079,44 +2133,44 @@ export interface FindIntentsByContextBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindIntentsByContextBridgeRequest { - meta: FindIntentsByContextBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentsByContextBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentsByContextRequest"; + meta: FindIntentsByContextBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentsByContextBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentsByContextRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindIntentsByContextBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextBridgeRequestPayload { - context: Context; - resultType?: string; + context: Context; + resultType?: string; } /** @@ -2126,35 +2180,35 @@ export interface FindIntentsByContextBridgeRequestPayload { * request. */ export interface FindIntentsByContextBridgeResponse { - meta: FindIntentsByContextBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentsByContextBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentsByContextBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentsByContextBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentsByContextBridgeResponsePayload { - appIntents: AppIntent[]; + appIntents: AppIntent[]; } /** @@ -2164,32 +2218,32 @@ export interface FindIntentsByContextBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface GetAppMetadataAgentErrorResponse { - meta: GetAppMetadataAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: GetAppMetadataAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: GetAppMetadataAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface GetAppMetadataAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface GetAppMetadataAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2208,42 +2262,42 @@ export interface GetAppMetadataAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface GetAppMetadataAgentRequest { - meta: GetAppMetadataAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: GetAppMetadataAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getAppMetadataRequest"; + meta: GetAppMetadataAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: GetAppMetadataAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getAppMetadataRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface GetAppMetadataAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetAppMetadataAgentRequestPayload { - app: AppObject; + app: AppObject; } /** @@ -2284,25 +2338,25 @@ export interface GetAppMetadataAgentRequestPayload { * received the intent. */ export interface AppObject { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -2321,32 +2375,32 @@ export interface AppObject { * A response message from a Desktop Agent to the Bridge. */ export interface GetAppMetadataAgentResponse { - meta: GetAppMetadataAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: GetAppMetadataAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: GetAppMetadataAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface GetAppMetadataAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface GetAppMetadataAgentResponsePayload { - appMetadata: AppMetadata; + appMetadata: AppMetadata; } /** @@ -2356,28 +2410,28 @@ export interface GetAppMetadataAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface GetAppMetadataBridgeErrorResponse { - meta: GetAppMetadataBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: GetAppMetadataBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: GetAppMetadataBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface GetAppMetadataBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2385,7 +2439,7 @@ export interface GetAppMetadataBridgeErrorResponseMeta { * raised the original request. */ export interface GetAppMetadataBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2394,43 +2448,43 @@ export interface GetAppMetadataBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface GetAppMetadataBridgeRequest { - meta: GetAppMetadataBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: GetAppMetadataBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getAppMetadataRequest"; + meta: GetAppMetadataBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: GetAppMetadataBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getAppMetadataRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface GetAppMetadataBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetAppMetadataBridgeRequestPayload { - app: AppObject; + app: AppObject; } /** @@ -2440,35 +2494,35 @@ export interface GetAppMetadataBridgeRequestPayload { * request. */ export interface GetAppMetadataBridgeResponse { - meta: GetAppMetadataBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: GetAppMetadataBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: GetAppMetadataBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface GetAppMetadataBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface GetAppMetadataBridgeResponsePayload { - appMetadata: AppMetadata; + appMetadata: AppMetadata; } /** @@ -2478,32 +2532,32 @@ export interface GetAppMetadataBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface OpenAgentErrorResponse { - meta: OpenAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: OpenAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: OpenAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: OpenAgentErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface OpenAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface OpenAgentErrorResponsePayload { - error: OpenErrorResponsePayload; + error: OpenErrorResponsePayload; } /** @@ -2518,7 +2572,17 @@ export interface OpenAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type OpenErrorResponsePayload = "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "MalformedContext" | "ResolverUnavailable" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type OpenErrorResponsePayload = + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'MalformedContext' + | 'ResolverUnavailable' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2536,46 +2600,46 @@ export type OpenErrorResponsePayload = "AppNotFound" | "AppTimeout" | "DesktopAg * A request message from a Desktop Agent to the Bridge. */ export interface OpenAgentRequest { - meta: OpenAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: OpenAgentRequestPayload; - /** - * Identifies 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"; + meta: OpenAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: OpenAgentRequestPayload; + /** + * Identifies 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'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface OpenAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface OpenAgentRequestPayload { - /** - * The application to open on the specified Desktop Agent - */ - app: AppToOpen; - context?: Context; + /** + * The application to open on the specified Desktop Agent + */ + app: AppToOpen; + context?: Context; } /** @@ -2615,25 +2679,25 @@ export interface OpenAgentRequestPayload { * received the intent. */ export interface AppToOpen { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -2652,32 +2716,32 @@ export interface AppToOpen { * A response message from a Desktop Agent to the Bridge. */ export interface OpenAgentResponse { - meta: OpenAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: OpenAgentResponsePayload; - /** - * Identifies 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"; + meta: OpenAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: OpenAgentResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface OpenAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface OpenAgentResponsePayload { - appIdentifier: AppIdentifier; + appIdentifier: AppIdentifier; } /** @@ -2687,28 +2751,28 @@ export interface OpenAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface OpenBridgeErrorResponse { - meta: OpenBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: OpenBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: OpenBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: OpenBridgeErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface OpenBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2716,7 +2780,7 @@ export interface OpenBridgeErrorResponseMeta { * raised the original request. */ export interface OpenBridgeErrorResponsePayload { - error: OpenErrorResponsePayload; + error: OpenErrorResponsePayload; } /** @@ -2725,47 +2789,47 @@ export interface OpenBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface OpenBridgeRequest { - meta: OpenBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: OpenBridgeRequestPayload; - /** - * Identifies 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"; + meta: OpenBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: OpenBridgeRequestPayload; + /** + * Identifies 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'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface OpenBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface OpenBridgeRequestPayload { - /** - * The application to open on the specified Desktop Agent - */ - app: AppToOpen; - context?: Context; + /** + * The application to open on the specified Desktop Agent + */ + app: AppToOpen; + context?: Context; } /** @@ -2775,35 +2839,35 @@ export interface OpenBridgeRequestPayload { * request. */ export interface OpenBridgeResponse { - meta: OpenBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: OpenBridgeResponsePayload; - /** - * Identifies 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"; + meta: OpenBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: OpenBridgeResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface OpenBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface OpenBridgeResponsePayload { - appIdentifier: AppIdentifier; + appIdentifier: AppIdentifier; } /** @@ -2812,35 +2876,35 @@ export interface OpenBridgeResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelBroadcastAgentRequest { - meta: PrivateChannelBroadcastAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelBroadcastAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.broadcast"; + meta: PrivateChannelBroadcastAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelBroadcastAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.broadcast'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelBroadcastAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** @@ -2892,39 +2956,39 @@ export interface PrivateChannelBroadcastAgentRequestMeta { * be set by the bridge. */ export interface MetaDestination { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: 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 PrivateChannelBroadcastAgentRequestPayload { - /** - * The Id of the PrivateChannel that the broadcast was sent on - */ - channelId: string; - /** - * The context object that was the payload of a broadcast message. - */ - context: Context; + /** + * The Id of the PrivateChannel that the broadcast was sent on + */ + channelId: string; + /** + * The context object that was the payload of a broadcast message. + */ + context: Context; } /** @@ -2943,50 +3007,50 @@ export interface PrivateChannelBroadcastAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelBroadcastBridgeRequest { - meta: PrivateChannelBroadcastBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelBroadcastBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.broadcast"; + meta: PrivateChannelBroadcastBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelBroadcastBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.broadcast'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelBroadcastBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelBroadcastBridgeRequestPayload { - /** - * The Id of the PrivateChannel that the broadcast was sent on - */ - channelId: string; - /** - * The context object that was the payload of a broadcast message. - */ - context: Context; + /** + * The Id of the PrivateChannel that the broadcast was sent on + */ + channelId: string; + /** + * The context object that was the payload of a broadcast message. + */ + context: Context; } /** @@ -2995,52 +3059,52 @@ export interface PrivateChannelBroadcastBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelEventListenerAddedAgentRequest { - meta: PrivateChannelEventListenerAddedAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerAddedAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerAdded"; + meta: PrivateChannelEventListenerAddedAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerAddedAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerAdded'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelEventListenerAddedAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerAddedAgentRequestPayload { - /** - * The id of the PrivateChannel that the event listener was added to. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was added to. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** * Event listener type names for Private Channel events. */ -export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsubscribe" | "onDisconnect"; +export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3058,47 +3122,47 @@ export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsub * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelEventListenerAddedBridgeRequest { - meta: PrivateChannelEventListenerAddedBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerAddedBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerAdded"; + meta: PrivateChannelEventListenerAddedBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerAddedBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerAdded'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelEventListenerAddedBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerAddedBridgeRequestPayload { - /** - * The id of the PrivateChannel that the event listener was added to. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was added to. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3107,46 +3171,46 @@ export interface PrivateChannelEventListenerAddedBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelEventListenerRemovedAgentRequest { - meta: PrivateChannelEventListenerRemovedAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerRemovedAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerRemoved"; + meta: PrivateChannelEventListenerRemovedAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerRemovedAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerRemoved'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelEventListenerRemovedAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerRemovedAgentRequestPayload { - /** - * The id of the PrivateChannel that the event listener was removed from. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was removed from. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3165,47 +3229,47 @@ export interface PrivateChannelEventListenerRemovedAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelEventListenerRemovedBridgeRequest { - meta: PrivateChannelEventListenerRemovedBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerRemovedBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerRemoved"; + meta: PrivateChannelEventListenerRemovedBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerRemovedBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerRemoved'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelEventListenerRemovedBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerRemovedBridgeRequestPayload { - /** - * The id of the PrivateChannel that the event listener was removed from. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was removed from. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3214,49 +3278,49 @@ export interface PrivateChannelEventListenerRemovedBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnAddContextListenerAgentRequest { - meta: PrivateChannelOnAddContextListenerAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnAddContextListenerAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onAddContextListener"; + meta: PrivateChannelOnAddContextListenerAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnAddContextListenerAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onAddContextListener'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnAddContextListenerAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnAddContextListenerAgentRequestPayload { - /** - * The id of the PrivateChannel that the context listener was added to. - */ - channelId: string; - /** - * The type of the context listener added. Should be null for an untyped listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was added to. + */ + channelId: string; + /** + * The type of the context listener added. Should be null for an untyped listener. + */ + contextType: null | string; } /** @@ -3275,50 +3339,50 @@ export interface PrivateChannelOnAddContextListenerAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnAddContextListenerBridgeRequest { - meta: PrivateChannelOnAddContextListenerBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnAddContextListenerBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onAddContextListener"; + meta: PrivateChannelOnAddContextListenerBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnAddContextListenerBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onAddContextListener'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelOnAddContextListenerBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnAddContextListenerBridgeRequestPayload { - /** - * The id of the PrivateChannel that the context listener was added to. - */ - channelId: string; - /** - * The type of the context listener added. Should be null for an untyped listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was added to. + */ + channelId: string; + /** + * The type of the context listener added. Should be null for an untyped listener. + */ + contextType: null | string; } /** @@ -3327,45 +3391,45 @@ export interface PrivateChannelOnAddContextListenerBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnDisconnectAgentRequest { - meta: PrivateChannelOnDisconnectAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnDisconnectAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onDisconnect"; + meta: PrivateChannelOnDisconnectAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnDisconnectAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onDisconnect'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnDisconnectAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnDisconnectAgentRequestPayload { - /** - * The id of the PrivateChannel that the agent discconnected from. - */ - channelId: string; + /** + * The id of the PrivateChannel that the agent discconnected from. + */ + channelId: string; } /** @@ -3384,46 +3448,46 @@ export interface PrivateChannelOnDisconnectAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnDisconnectBridgeRequest { - meta: PrivateChannelOnDisconnectBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnDisconnectBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onDisconnect"; + meta: PrivateChannelOnDisconnectBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnDisconnectBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onDisconnect'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelOnDisconnectBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnDisconnectBridgeRequestPayload { - /** - * The id of the PrivateChannel that the agent discconnected from. - */ - channelId: string; + /** + * The id of the PrivateChannel that the agent discconnected from. + */ + channelId: string; } /** @@ -3432,50 +3496,50 @@ export interface PrivateChannelOnDisconnectBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnUnsubscribeAgentRequest { - meta: PrivateChannelOnUnsubscribeAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnUnsubscribeAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onUnsubscribe"; + meta: PrivateChannelOnUnsubscribeAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnUnsubscribeAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onUnsubscribe'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnUnsubscribeAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnUnsubscribeAgentRequestPayload { - /** - * The id of the PrivateChannel that the context listener was unsubscribed from. - */ - channelId: string; - /** - * The type of the context listener that was unsubscribed. Should be null for an untyped - * listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was unsubscribed from. + */ + channelId: string; + /** + * The type of the context listener that was unsubscribed. Should be null for an untyped + * listener. + */ + contextType: null | string; } /** @@ -3494,51 +3558,51 @@ export interface PrivateChannelOnUnsubscribeAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnUnsubscribeBridgeRequest { - meta: ERequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnUnsubscribeBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onUnsubscribe"; + meta: ERequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnUnsubscribeBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onUnsubscribe'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface ERequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnUnsubscribeBridgeRequestPayload { - /** - * The id of the PrivateChannel that the context listener was unsubscribed from. - */ - channelId: string; - /** - * The type of the context listener that was unsubscribed. Should be null for an untyped - * listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was unsubscribed from. + */ + channelId: string; + /** + * The type of the context listener that was unsubscribed. Should be null for an untyped + * listener. + */ + contextType: null | string; } /** @@ -3548,25 +3612,25 @@ export interface PrivateChannelOnUnsubscribeBridgeRequestPayload { * preference to the standard response when an error needs to be returned. */ export interface RaiseIntentAgentErrorResponse { - meta: RaiseIntentAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: RaiseIntentAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: RaiseIntentAgentErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -3575,10 +3639,10 @@ export interface RaiseIntentAgentErrorResponseMeta { * Error message payload containing an standardized error string. */ export interface RaiseIntentAgentErrorResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error: FindInstancesErrors; + /** + * Should be set if the raiseIntent request returned an error. + */ + error: FindInstancesErrors; } /** @@ -3597,44 +3661,44 @@ export interface RaiseIntentAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface RaiseIntentAgentRequest { - meta: RaiseIntentAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: RaiseIntentAgentRequestPayload; - /** - * Identifies 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: "raiseIntentRequest"; + meta: RaiseIntentAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: RaiseIntentAgentRequestPayload; + /** + * Identifies 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: 'raiseIntentRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface RaiseIntentAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentAgentRequestPayload { - app: AppDestinationIdentifier; - context: Context; - intent: string; + app: AppDestinationIdentifier; + context: Context; + intent: string; } /** @@ -3675,25 +3739,25 @@ export interface RaiseIntentAgentRequestPayload { * received the intent. */ export interface AppDestinationIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -3712,35 +3776,35 @@ export interface AppDestinationIdentifier { * A response message from a Desktop Agent to the Bridge. */ export interface RaiseIntentAgentResponse { - meta: RaiseIntentAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentAgentResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentAgentResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentAgentResponsePayload { - /** - * Used if the raiseIntent request was successfully resolved. - */ - intentResolution: IntentResolution; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution: IntentResolution; } /** @@ -3772,17 +3836,17 @@ export interface RaiseIntentAgentResponsePayload { * ``` */ 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; + /** + * 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; } /** @@ -3792,28 +3856,28 @@ export interface IntentResolution { * request, used where all connected agents returned errors. */ export interface RaiseIntentBridgeErrorResponse { - meta: RaiseIntentBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: RaiseIntentBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: RaiseIntentBridgeErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -3823,10 +3887,10 @@ export interface RaiseIntentBridgeErrorResponseMeta { * raised the original request. */ export interface RaiseIntentBridgeErrorResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error: FindInstancesErrors; + /** + * Should be set if the raiseIntent request returned an error. + */ + error: FindInstancesErrors; } /** @@ -3835,45 +3899,45 @@ export interface RaiseIntentBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface RaiseIntentBridgeRequest { - meta: RaiseIntentBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: RaiseIntentBridgeRequestPayload; - /** - * Identifies 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: "raiseIntentRequest"; + meta: RaiseIntentBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: RaiseIntentBridgeRequestPayload; + /** + * Identifies 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: 'raiseIntentRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface RaiseIntentBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentBridgeRequestPayload { - app: AppDestinationIdentifier; - context: Context; - intent: string; + app: AppDestinationIdentifier; + context: Context; + intent: string; } /** @@ -3883,38 +3947,38 @@ export interface RaiseIntentBridgeRequestPayload { * request. */ export interface RaiseIntentBridgeResponse { - meta: RaiseIntentBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentBridgeResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentBridgeResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentBridgeResponsePayload { - /** - * Used if the raiseIntent request was successfully resolved. - */ - intentResolution: IntentResolution; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution: IntentResolution; } /** @@ -3925,32 +3989,32 @@ export interface RaiseIntentBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface RaiseIntentResultAgentErrorResponse { - meta: RaiseIntentResultAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: RaiseIntentResultAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: RaiseIntentResultAgentErrorResponsePayload; + /** + * Identifies 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 response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentResultAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface RaiseIntentResultAgentErrorResponsePayload { - error: RaiseIntentResultErrorMessage; + error: RaiseIntentResultErrorMessage; } /** @@ -3965,7 +4029,13 @@ export interface RaiseIntentResultAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type RaiseIntentResultErrorMessage = "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type RaiseIntentResultErrorMessage = + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3983,37 +4053,37 @@ export type RaiseIntentResultErrorMessage = "IntentHandlerRejected" | "NoResultR * A response message from a Desktop Agent to the Bridge. */ export interface RaiseIntentResultAgentResponse { - meta: RaiseIntentResultAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentResultAgentResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResultAgentResponsePayload; + /** + * Identifies 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 response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentResultAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentResultAgentResponsePayload { - intentResult: IntentResult; + intentResult: IntentResult; } export interface IntentResult { - context?: Context; - channel?: Channel; + context?: Context; + channel?: Channel; } /** @@ -4031,21 +4101,21 @@ export interface IntentResult { * function. */ export interface Channel { - /** - * Channels may be visualized and selectable by users. DisplayMetadata may be used to - * provide hints on how to see them. - * For App channels, displayMetadata would typically not be present. - */ - displayMetadata?: DisplayMetadata; - /** - * Constant that uniquely identifies this channel. - */ - id: string; - /** - * Uniquely defines each channel type. - * Can be "user", "app" or "private". - */ - type: Type; + /** + * Channels may be visualized and selectable by users. DisplayMetadata may be used to + * provide hints on how to see them. + * For App channels, displayMetadata would typically not be present. + */ + displayMetadata?: DisplayMetadata; + /** + * Constant that uniquely identifies this channel. + */ + id: string; + /** + * Uniquely defines each channel type. + * Can be "user", "app" or "private". + */ + type: Type; } /** @@ -4060,26 +4130,26 @@ export interface Channel { * this is their meaning. */ export interface DisplayMetadata { - /** - * The color that should be associated within this channel when displaying this channel in a - * UI, e.g: `0xFF0000`. - */ - color?: string; - /** - * A URL of an image that can be used to display this channel. - */ - glyph?: string; - /** - * A user-readable name for this channel, e.g: `"Red"`. - */ - name?: string; + /** + * The color that should be associated within this channel when displaying this channel in a + * UI, e.g: `0xFF0000`. + */ + color?: string; + /** + * A URL of an image that can be used to display this channel. + */ + glyph?: string; + /** + * A user-readable name for this channel, e.g: `"Red"`. + */ + name?: string; } /** * Uniquely defines each channel type. * Can be "user", "app" or "private". */ -export type Type = "app" | "private" | "user"; +export type Type = 'app' | 'private' | 'user'; /** * A secondary response to a request to raise an intent used to deliver the intent result, @@ -4089,28 +4159,28 @@ export type Type = "app" | "private" | "user"; * request, used where all connected agents returned errors. */ export interface RaiseIntentResultBridgeErrorResponse { - meta: RaiseIntentResultBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: RaiseIntentResultBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: RaiseIntentResultBridgeErrorResponsePayload; + /** + * Identifies 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 required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentResultBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -4118,7 +4188,7 @@ export interface RaiseIntentResultBridgeErrorResponseMeta { * raised the original request. */ export interface RaiseIntentResultBridgeErrorResponsePayload { - error: RaiseIntentResultErrorMessage; + error: RaiseIntentResultErrorMessage; } /** @@ -4128,1930 +4198,2386 @@ export interface RaiseIntentResultBridgeErrorResponsePayload { * request. */ export interface RaiseIntentResultBridgeResponse { - meta: RaiseIntentResultBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentResultBridgeResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResultBridgeResponsePayload; + /** + * Identifies 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 required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentResultBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentResultBridgeResponsePayload { - intentResult: IntentResult; + intentResult: IntentResult; } // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toAgentErrorResponseMessage(json: string): AgentErrorResponseMessage { - return cast(JSON.parse(json), r("AgentErrorResponseMessage")); - } + public static toAgentErrorResponseMessage(json: string): AgentErrorResponseMessage { + return cast(JSON.parse(json), r('AgentErrorResponseMessage')); + } - public static agentErrorResponseMessageToJson(value: AgentErrorResponseMessage): string { - return JSON.stringify(uncast(value, r("AgentErrorResponseMessage")), null, 2); - } + public static agentErrorResponseMessageToJson(value: AgentErrorResponseMessage): string { + return JSON.stringify(uncast(value, r('AgentErrorResponseMessage')), null, 2); + } - public static toAgentRequestMessage(json: string): AgentRequestMessage { - return cast(JSON.parse(json), r("AgentRequestMessage")); - } + public static toAgentRequestMessage(json: string): AgentRequestMessage { + return cast(JSON.parse(json), r('AgentRequestMessage')); + } - public static agentRequestMessageToJson(value: AgentRequestMessage): string { - return JSON.stringify(uncast(value, r("AgentRequestMessage")), null, 2); - } + public static agentRequestMessageToJson(value: AgentRequestMessage): string { + return JSON.stringify(uncast(value, r('AgentRequestMessage')), null, 2); + } - public static toAgentResponseMessage(json: string): AgentResponseMessage { - return cast(JSON.parse(json), r("AgentResponseMessage")); - } + public static toAgentResponseMessage(json: string): AgentResponseMessage { + return cast(JSON.parse(json), r('AgentResponseMessage')); + } - public static agentResponseMessageToJson(value: AgentResponseMessage): string { - return JSON.stringify(uncast(value, r("AgentResponseMessage")), null, 2); - } + public static agentResponseMessageToJson(value: AgentResponseMessage): string { + return JSON.stringify(uncast(value, r('AgentResponseMessage')), null, 2); + } - public static toBridgeErrorResponseMessage(json: string): BridgeErrorResponseMessage { - return cast(JSON.parse(json), r("BridgeErrorResponseMessage")); - } + public static toBridgeErrorResponseMessage(json: string): BridgeErrorResponseMessage { + return cast(JSON.parse(json), r('BridgeErrorResponseMessage')); + } - public static bridgeErrorResponseMessageToJson(value: BridgeErrorResponseMessage): string { - return JSON.stringify(uncast(value, r("BridgeErrorResponseMessage")), null, 2); - } + public static bridgeErrorResponseMessageToJson(value: BridgeErrorResponseMessage): string { + return JSON.stringify(uncast(value, r('BridgeErrorResponseMessage')), null, 2); + } - public static toBridgeRequestMessage(json: string): BridgeRequestMessage { - return cast(JSON.parse(json), r("BridgeRequestMessage")); - } + public static toBridgeRequestMessage(json: string): BridgeRequestMessage { + return cast(JSON.parse(json), r('BridgeRequestMessage')); + } - public static bridgeRequestMessageToJson(value: BridgeRequestMessage): string { - return JSON.stringify(uncast(value, r("BridgeRequestMessage")), null, 2); - } + public static bridgeRequestMessageToJson(value: BridgeRequestMessage): string { + return JSON.stringify(uncast(value, r('BridgeRequestMessage')), null, 2); + } - public static toBridgeResponseMessage(json: string): BridgeResponseMessage { - return cast(JSON.parse(json), r("BridgeResponseMessage")); - } + public static toBridgeResponseMessage(json: string): BridgeResponseMessage { + return cast(JSON.parse(json), r('BridgeResponseMessage')); + } - public static bridgeResponseMessageToJson(value: BridgeResponseMessage): string { - return JSON.stringify(uncast(value, r("BridgeResponseMessage")), null, 2); - } + public static bridgeResponseMessageToJson(value: BridgeResponseMessage): string { + return JSON.stringify(uncast(value, r('BridgeResponseMessage')), null, 2); + } - public static toBroadcastAgentRequest(json: string): BroadcastAgentRequest { - return cast(JSON.parse(json), r("BroadcastAgentRequest")); - } + public static toBroadcastAgentRequest(json: string): BroadcastAgentRequest { + return cast(JSON.parse(json), r('BroadcastAgentRequest')); + } - public static broadcastAgentRequestToJson(value: BroadcastAgentRequest): string { - return JSON.stringify(uncast(value, r("BroadcastAgentRequest")), null, 2); - } + public static broadcastAgentRequestToJson(value: BroadcastAgentRequest): string { + return JSON.stringify(uncast(value, r('BroadcastAgentRequest')), null, 2); + } - public static toBroadcastBridgeRequest(json: string): BroadcastBridgeRequest { - return cast(JSON.parse(json), r("BroadcastBridgeRequest")); - } + public static toBroadcastBridgeRequest(json: string): BroadcastBridgeRequest { + return cast(JSON.parse(json), r('BroadcastBridgeRequest')); + } - public static broadcastBridgeRequestToJson(value: BroadcastBridgeRequest): string { - return JSON.stringify(uncast(value, r("BroadcastBridgeRequest")), null, 2); - } + public static broadcastBridgeRequestToJson(value: BroadcastBridgeRequest): string { + return JSON.stringify(uncast(value, r('BroadcastBridgeRequest')), null, 2); + } - public static toBridgeCommonDefinitions(json: string): { [key: string]: any } { - return cast(JSON.parse(json), m("any")); - } + public static toBridgeCommonDefinitions(json: string): { [key: string]: any } { + return cast(JSON.parse(json), m('any')); + } - public static bridgeCommonDefinitionsToJson(value: { [key: string]: any }): string { - return JSON.stringify(uncast(value, m("any")), null, 2); - } + public static bridgeCommonDefinitionsToJson(value: { [key: string]: any }): string { + return JSON.stringify(uncast(value, m('any')), null, 2); + } - public static toConnectionStepMessage(json: string): ConnectionStepMessage { - return cast(JSON.parse(json), r("ConnectionStepMessage")); - } + public static toConnectionStepMessage(json: string): ConnectionStepMessage { + return cast(JSON.parse(json), r('ConnectionStepMessage')); + } - public static connectionStepMessageToJson(value: ConnectionStepMessage): string { - return JSON.stringify(uncast(value, r("ConnectionStepMessage")), null, 2); - } + public static connectionStepMessageToJson(value: ConnectionStepMessage): string { + return JSON.stringify(uncast(value, r('ConnectionStepMessage')), null, 2); + } - public static toConnectionStep2Hello(json: string): ConnectionStep2Hello { - return cast(JSON.parse(json), r("ConnectionStep2Hello")); - } + public static toConnectionStep2Hello(json: string): ConnectionStep2Hello { + return cast(JSON.parse(json), r('ConnectionStep2Hello')); + } - public static connectionStep2HelloToJson(value: ConnectionStep2Hello): string { - return JSON.stringify(uncast(value, r("ConnectionStep2Hello")), null, 2); - } + public static connectionStep2HelloToJson(value: ConnectionStep2Hello): string { + return JSON.stringify(uncast(value, r('ConnectionStep2Hello')), null, 2); + } - public static toConnectionStep3Handshake(json: string): ConnectionStep3Handshake { - return cast(JSON.parse(json), r("ConnectionStep3Handshake")); - } + public static toConnectionStep3Handshake(json: string): ConnectionStep3Handshake { + return cast(JSON.parse(json), r('ConnectionStep3Handshake')); + } - public static connectionStep3HandshakeToJson(value: ConnectionStep3Handshake): string { - return JSON.stringify(uncast(value, r("ConnectionStep3Handshake")), null, 2); - } + public static connectionStep3HandshakeToJson(value: ConnectionStep3Handshake): string { + return JSON.stringify(uncast(value, r('ConnectionStep3Handshake')), null, 2); + } - public static toConnectionStep4AuthenticationFailed(json: string): ConnectionStep4AuthenticationFailed { - return cast(JSON.parse(json), r("ConnectionStep4AuthenticationFailed")); - } + public static toConnectionStep4AuthenticationFailed(json: string): ConnectionStep4AuthenticationFailed { + return cast(JSON.parse(json), r('ConnectionStep4AuthenticationFailed')); + } - public static connectionStep4AuthenticationFailedToJson(value: ConnectionStep4AuthenticationFailed): string { - return JSON.stringify(uncast(value, r("ConnectionStep4AuthenticationFailed")), null, 2); - } + public static connectionStep4AuthenticationFailedToJson(value: ConnectionStep4AuthenticationFailed): string { + return JSON.stringify(uncast(value, r('ConnectionStep4AuthenticationFailed')), null, 2); + } - public static toConnectionStep6ConnectedAgentsUpdate(json: string): ConnectionStep6ConnectedAgentsUpdate { - return cast(JSON.parse(json), r("ConnectionStep6ConnectedAgentsUpdate")); - } + public static toConnectionStep6ConnectedAgentsUpdate(json: string): ConnectionStep6ConnectedAgentsUpdate { + return cast(JSON.parse(json), r('ConnectionStep6ConnectedAgentsUpdate')); + } - public static connectionStep6ConnectedAgentsUpdateToJson(value: ConnectionStep6ConnectedAgentsUpdate): string { - return JSON.stringify(uncast(value, r("ConnectionStep6ConnectedAgentsUpdate")), null, 2); - } + public static connectionStep6ConnectedAgentsUpdateToJson(value: ConnectionStep6ConnectedAgentsUpdate): string { + return JSON.stringify(uncast(value, r('ConnectionStep6ConnectedAgentsUpdate')), null, 2); + } - public static toFindInstancesAgentErrorResponse(json: string): FindInstancesAgentErrorResponse { - return cast(JSON.parse(json), r("FindInstancesAgentErrorResponse")); - } + public static toFindInstancesAgentErrorResponse(json: string): FindInstancesAgentErrorResponse { + return cast(JSON.parse(json), r('FindInstancesAgentErrorResponse')); + } - public static findInstancesAgentErrorResponseToJson(value: FindInstancesAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentErrorResponse")), null, 2); - } + public static findInstancesAgentErrorResponseToJson(value: FindInstancesAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentErrorResponse')), null, 2); + } - public static toFindInstancesAgentRequest(json: string): FindInstancesAgentRequest { - return cast(JSON.parse(json), r("FindInstancesAgentRequest")); - } + public static toFindInstancesAgentRequest(json: string): FindInstancesAgentRequest { + return cast(JSON.parse(json), r('FindInstancesAgentRequest')); + } - public static findInstancesAgentRequestToJson(value: FindInstancesAgentRequest): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentRequest")), null, 2); - } + public static findInstancesAgentRequestToJson(value: FindInstancesAgentRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentRequest')), null, 2); + } - public static toFindInstancesAgentResponse(json: string): FindInstancesAgentResponse { - return cast(JSON.parse(json), r("FindInstancesAgentResponse")); - } + public static toFindInstancesAgentResponse(json: string): FindInstancesAgentResponse { + return cast(JSON.parse(json), r('FindInstancesAgentResponse')); + } - public static findInstancesAgentResponseToJson(value: FindInstancesAgentResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentResponse")), null, 2); - } + public static findInstancesAgentResponseToJson(value: FindInstancesAgentResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentResponse')), null, 2); + } - public static toFindInstancesBridgeErrorResponse(json: string): FindInstancesBridgeErrorResponse { - return cast(JSON.parse(json), r("FindInstancesBridgeErrorResponse")); - } + public static toFindInstancesBridgeErrorResponse(json: string): FindInstancesBridgeErrorResponse { + return cast(JSON.parse(json), r('FindInstancesBridgeErrorResponse')); + } - public static findInstancesBridgeErrorResponseToJson(value: FindInstancesBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeErrorResponse")), null, 2); - } + public static findInstancesBridgeErrorResponseToJson(value: FindInstancesBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeErrorResponse')), null, 2); + } - public static toFindInstancesBridgeRequest(json: string): FindInstancesBridgeRequest { - return cast(JSON.parse(json), r("FindInstancesBridgeRequest")); - } + public static toFindInstancesBridgeRequest(json: string): FindInstancesBridgeRequest { + return cast(JSON.parse(json), r('FindInstancesBridgeRequest')); + } - public static findInstancesBridgeRequestToJson(value: FindInstancesBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeRequest")), null, 2); - } + public static findInstancesBridgeRequestToJson(value: FindInstancesBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeRequest')), null, 2); + } - public static toFindInstancesBridgeResponse(json: string): FindInstancesBridgeResponse { - return cast(JSON.parse(json), r("FindInstancesBridgeResponse")); - } + public static toFindInstancesBridgeResponse(json: string): FindInstancesBridgeResponse { + return cast(JSON.parse(json), r('FindInstancesBridgeResponse')); + } - public static findInstancesBridgeResponseToJson(value: FindInstancesBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeResponse")), null, 2); - } + public static findInstancesBridgeResponseToJson(value: FindInstancesBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeResponse')), null, 2); + } - public static toFindIntentAgentErrorResponse(json: string): FindIntentAgentErrorResponse { - return cast(JSON.parse(json), r("FindIntentAgentErrorResponse")); - } + public static toFindIntentAgentErrorResponse(json: string): FindIntentAgentErrorResponse { + return cast(JSON.parse(json), r('FindIntentAgentErrorResponse')); + } - public static findIntentAgentErrorResponseToJson(value: FindIntentAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentAgentErrorResponse")), null, 2); - } + public static findIntentAgentErrorResponseToJson(value: FindIntentAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentAgentErrorResponse')), null, 2); + } - public static toFindIntentAgentRequest(json: string): FindIntentAgentRequest { - return cast(JSON.parse(json), r("FindIntentAgentRequest")); - } + public static toFindIntentAgentRequest(json: string): FindIntentAgentRequest { + return cast(JSON.parse(json), r('FindIntentAgentRequest')); + } - public static findIntentAgentRequestToJson(value: FindIntentAgentRequest): string { - return JSON.stringify(uncast(value, r("FindIntentAgentRequest")), null, 2); - } + public static findIntentAgentRequestToJson(value: FindIntentAgentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentAgentRequest')), null, 2); + } - public static toFindIntentAgentResponse(json: string): FindIntentAgentResponse { - return cast(JSON.parse(json), r("FindIntentAgentResponse")); - } + public static toFindIntentAgentResponse(json: string): FindIntentAgentResponse { + return cast(JSON.parse(json), r('FindIntentAgentResponse')); + } - public static findIntentAgentResponseToJson(value: FindIntentAgentResponse): string { - return JSON.stringify(uncast(value, r("FindIntentAgentResponse")), null, 2); - } + public static findIntentAgentResponseToJson(value: FindIntentAgentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentAgentResponse')), null, 2); + } - public static toFindIntentBridgeErrorResponse(json: string): FindIntentBridgeErrorResponse { - return cast(JSON.parse(json), r("FindIntentBridgeErrorResponse")); - } + public static toFindIntentBridgeErrorResponse(json: string): FindIntentBridgeErrorResponse { + return cast(JSON.parse(json), r('FindIntentBridgeErrorResponse')); + } - public static findIntentBridgeErrorResponseToJson(value: FindIntentBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeErrorResponse")), null, 2); - } - - public static toFindIntentBridgeRequest(json: string): FindIntentBridgeRequest { - return cast(JSON.parse(json), r("FindIntentBridgeRequest")); - } + public static findIntentBridgeErrorResponseToJson(value: FindIntentBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeErrorResponse')), null, 2); + } - public static findIntentBridgeRequestToJson(value: FindIntentBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeRequest")), null, 2); - } - - public static toFindIntentBridgeResponse(json: string): FindIntentBridgeResponse { - return cast(JSON.parse(json), r("FindIntentBridgeResponse")); - } + public static toFindIntentBridgeRequest(json: string): FindIntentBridgeRequest { + return cast(JSON.parse(json), r('FindIntentBridgeRequest')); + } - public static findIntentBridgeResponseToJson(value: FindIntentBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeResponse")), null, 2); - } + public static findIntentBridgeRequestToJson(value: FindIntentBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeRequest')), null, 2); + } - public static toFindIntentsByContextAgentErrorResponse(json: string): FindIntentsByContextAgentErrorResponse { - return cast(JSON.parse(json), r("FindIntentsByContextAgentErrorResponse")); - } + public static toFindIntentBridgeResponse(json: string): FindIntentBridgeResponse { + return cast(JSON.parse(json), r('FindIntentBridgeResponse')); + } - public static findIntentsByContextAgentErrorResponseToJson(value: FindIntentsByContextAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentErrorResponse")), null, 2); - } + public static findIntentBridgeResponseToJson(value: FindIntentBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeResponse')), null, 2); + } - public static toFindIntentsByContextAgentRequest(json: string): FindIntentsByContextAgentRequest { - return cast(JSON.parse(json), r("FindIntentsByContextAgentRequest")); - } + public static toFindIntentsByContextAgentErrorResponse(json: string): FindIntentsByContextAgentErrorResponse { + return cast(JSON.parse(json), r('FindIntentsByContextAgentErrorResponse')); + } - public static findIntentsByContextAgentRequestToJson(value: FindIntentsByContextAgentRequest): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentRequest")), null, 2); - } + public static findIntentsByContextAgentErrorResponseToJson(value: FindIntentsByContextAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentErrorResponse')), null, 2); + } - public static toFindIntentsByContextAgentResponse(json: string): FindIntentsByContextAgentResponse { - return cast(JSON.parse(json), r("FindIntentsByContextAgentResponse")); - } + public static toFindIntentsByContextAgentRequest(json: string): FindIntentsByContextAgentRequest { + return cast(JSON.parse(json), r('FindIntentsByContextAgentRequest')); + } - public static findIntentsByContextAgentResponseToJson(value: FindIntentsByContextAgentResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentResponse")), null, 2); - } - - public static toFindIntentsByContextBridgeErrorResponse(json: string): FindIntentsByContextBridgeErrorResponse { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeErrorResponse")); - } - - public static findIntentsByContextBridgeErrorResponseToJson(value: FindIntentsByContextBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeErrorResponse")), null, 2); - } - - public static toFindIntentsByContextBridgeRequest(json: string): FindIntentsByContextBridgeRequest { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeRequest")); - } - - public static findIntentsByContextBridgeRequestToJson(value: FindIntentsByContextBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeRequest")), null, 2); - } - - public static toFindIntentsByContextBridgeResponse(json: string): FindIntentsByContextBridgeResponse { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeResponse")); - } + public static findIntentsByContextAgentRequestToJson(value: FindIntentsByContextAgentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentRequest')), null, 2); + } - public static findIntentsByContextBridgeResponseToJson(value: FindIntentsByContextBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeResponse")), null, 2); - } + public static toFindIntentsByContextAgentResponse(json: string): FindIntentsByContextAgentResponse { + return cast(JSON.parse(json), r('FindIntentsByContextAgentResponse')); + } - public static toGetAppMetadataAgentErrorResponse(json: string): GetAppMetadataAgentErrorResponse { - return cast(JSON.parse(json), r("GetAppMetadataAgentErrorResponse")); - } + public static findIntentsByContextAgentResponseToJson(value: FindIntentsByContextAgentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentResponse')), null, 2); + } - public static getAppMetadataAgentErrorResponseToJson(value: GetAppMetadataAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentErrorResponse")), null, 2); - } + public static toFindIntentsByContextBridgeErrorResponse(json: string): FindIntentsByContextBridgeErrorResponse { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeErrorResponse')); + } - public static toGetAppMetadataAgentRequest(json: string): GetAppMetadataAgentRequest { - return cast(JSON.parse(json), r("GetAppMetadataAgentRequest")); - } + public static findIntentsByContextBridgeErrorResponseToJson(value: FindIntentsByContextBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeErrorResponse')), null, 2); + } - public static getAppMetadataAgentRequestToJson(value: GetAppMetadataAgentRequest): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentRequest")), null, 2); - } + public static toFindIntentsByContextBridgeRequest(json: string): FindIntentsByContextBridgeRequest { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeRequest')); + } - public static toGetAppMetadataAgentResponse(json: string): GetAppMetadataAgentResponse { - return cast(JSON.parse(json), r("GetAppMetadataAgentResponse")); - } + public static findIntentsByContextBridgeRequestToJson(value: FindIntentsByContextBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeRequest')), null, 2); + } - public static getAppMetadataAgentResponseToJson(value: GetAppMetadataAgentResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentResponse")), null, 2); - } + public static toFindIntentsByContextBridgeResponse(json: string): FindIntentsByContextBridgeResponse { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeResponse')); + } - public static toGetAppMetadataBridgeErrorResponse(json: string): GetAppMetadataBridgeErrorResponse { - return cast(JSON.parse(json), r("GetAppMetadataBridgeErrorResponse")); - } + public static findIntentsByContextBridgeResponseToJson(value: FindIntentsByContextBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeResponse')), null, 2); + } - public static getAppMetadataBridgeErrorResponseToJson(value: GetAppMetadataBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeErrorResponse")), null, 2); - } + public static toGetAppMetadataAgentErrorResponse(json: string): GetAppMetadataAgentErrorResponse { + return cast(JSON.parse(json), r('GetAppMetadataAgentErrorResponse')); + } - public static toGetAppMetadataBridgeRequest(json: string): GetAppMetadataBridgeRequest { - return cast(JSON.parse(json), r("GetAppMetadataBridgeRequest")); - } + public static getAppMetadataAgentErrorResponseToJson(value: GetAppMetadataAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentErrorResponse')), null, 2); + } - public static getAppMetadataBridgeRequestToJson(value: GetAppMetadataBridgeRequest): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeRequest")), null, 2); - } + public static toGetAppMetadataAgentRequest(json: string): GetAppMetadataAgentRequest { + return cast(JSON.parse(json), r('GetAppMetadataAgentRequest')); + } - public static toGetAppMetadataBridgeResponse(json: string): GetAppMetadataBridgeResponse { - return cast(JSON.parse(json), r("GetAppMetadataBridgeResponse")); - } + public static getAppMetadataAgentRequestToJson(value: GetAppMetadataAgentRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentRequest')), null, 2); + } - public static getAppMetadataBridgeResponseToJson(value: GetAppMetadataBridgeResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeResponse")), null, 2); - } + public static toGetAppMetadataAgentResponse(json: string): GetAppMetadataAgentResponse { + return cast(JSON.parse(json), r('GetAppMetadataAgentResponse')); + } - public static toOpenAgentErrorResponse(json: string): OpenAgentErrorResponse { - return cast(JSON.parse(json), r("OpenAgentErrorResponse")); - } + public static getAppMetadataAgentResponseToJson(value: GetAppMetadataAgentResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentResponse')), null, 2); + } - public static openAgentErrorResponseToJson(value: OpenAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("OpenAgentErrorResponse")), null, 2); - } + public static toGetAppMetadataBridgeErrorResponse(json: string): GetAppMetadataBridgeErrorResponse { + return cast(JSON.parse(json), r('GetAppMetadataBridgeErrorResponse')); + } + + public static getAppMetadataBridgeErrorResponseToJson(value: GetAppMetadataBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeErrorResponse')), null, 2); + } + + public static toGetAppMetadataBridgeRequest(json: string): GetAppMetadataBridgeRequest { + return cast(JSON.parse(json), r('GetAppMetadataBridgeRequest')); + } + + public static getAppMetadataBridgeRequestToJson(value: GetAppMetadataBridgeRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeRequest')), null, 2); + } + + public static toGetAppMetadataBridgeResponse(json: string): GetAppMetadataBridgeResponse { + return cast(JSON.parse(json), r('GetAppMetadataBridgeResponse')); + } + + public static getAppMetadataBridgeResponseToJson(value: GetAppMetadataBridgeResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeResponse')), null, 2); + } + + public static toOpenAgentErrorResponse(json: string): OpenAgentErrorResponse { + return cast(JSON.parse(json), r('OpenAgentErrorResponse')); + } + + public static openAgentErrorResponseToJson(value: OpenAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('OpenAgentErrorResponse')), null, 2); + } + + public static toOpenAgentRequest(json: string): OpenAgentRequest { + return cast(JSON.parse(json), r('OpenAgentRequest')); + } + + public static openAgentRequestToJson(value: OpenAgentRequest): string { + return JSON.stringify(uncast(value, r('OpenAgentRequest')), null, 2); + } + + public static toOpenAgentResponse(json: string): OpenAgentResponse { + return cast(JSON.parse(json), r('OpenAgentResponse')); + } + + public static openAgentResponseToJson(value: OpenAgentResponse): string { + return JSON.stringify(uncast(value, r('OpenAgentResponse')), null, 2); + } + + public static toOpenBridgeErrorResponse(json: string): OpenBridgeErrorResponse { + return cast(JSON.parse(json), r('OpenBridgeErrorResponse')); + } + + public static openBridgeErrorResponseToJson(value: OpenBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('OpenBridgeErrorResponse')), null, 2); + } + + public static toOpenBridgeRequest(json: string): OpenBridgeRequest { + return cast(JSON.parse(json), r('OpenBridgeRequest')); + } + + public static openBridgeRequestToJson(value: OpenBridgeRequest): string { + return JSON.stringify(uncast(value, r('OpenBridgeRequest')), null, 2); + } + + public static toOpenBridgeResponse(json: string): OpenBridgeResponse { + return cast(JSON.parse(json), r('OpenBridgeResponse')); + } + + public static openBridgeResponseToJson(value: OpenBridgeResponse): string { + return JSON.stringify(uncast(value, r('OpenBridgeResponse')), null, 2); + } + + public static toPrivateChannelBroadcastAgentRequest(json: string): PrivateChannelBroadcastAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelBroadcastAgentRequest')); + } + + public static privateChannelBroadcastAgentRequestToJson(value: PrivateChannelBroadcastAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelBroadcastAgentRequest')), null, 2); + } + + public static toPrivateChannelBroadcastBridgeRequest(json: string): PrivateChannelBroadcastBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelBroadcastBridgeRequest')); + } + + public static privateChannelBroadcastBridgeRequestToJson(value: PrivateChannelBroadcastBridgeRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelBroadcastBridgeRequest')), null, 2); + } + + public static toPrivateChannelEventListenerAddedAgentRequest( + json: string + ): PrivateChannelEventListenerAddedAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerAddedAgentRequest')); + } + + public static privateChannelEventListenerAddedAgentRequestToJson( + value: PrivateChannelEventListenerAddedAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerAddedAgentRequest')), null, 2); + } + + public static toPrivateChannelEventListenerAddedBridgeRequest( + json: string + ): PrivateChannelEventListenerAddedBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerAddedBridgeRequest')); + } + + public static privateChannelEventListenerAddedBridgeRequestToJson( + value: PrivateChannelEventListenerAddedBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerAddedBridgeRequest')), null, 2); + } + + public static toPrivateChannelEventListenerRemovedAgentRequest( + json: string + ): PrivateChannelEventListenerRemovedAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerRemovedAgentRequest')); + } + + public static privateChannelEventListenerRemovedAgentRequestToJson( + value: PrivateChannelEventListenerRemovedAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerRemovedAgentRequest')), null, 2); + } + + public static toPrivateChannelEventListenerRemovedBridgeRequest( + json: string + ): PrivateChannelEventListenerRemovedBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerRemovedBridgeRequest')); + } + + public static privateChannelEventListenerRemovedBridgeRequestToJson( + value: PrivateChannelEventListenerRemovedBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerRemovedBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnAddContextListenerAgentRequest( + json: string + ): PrivateChannelOnAddContextListenerAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnAddContextListenerAgentRequest')); + } + + public static privateChannelOnAddContextListenerAgentRequestToJson( + value: PrivateChannelOnAddContextListenerAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnAddContextListenerAgentRequest')), null, 2); + } + + public static toPrivateChannelOnAddContextListenerBridgeRequest( + json: string + ): PrivateChannelOnAddContextListenerBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnAddContextListenerBridgeRequest')); + } + + public static privateChannelOnAddContextListenerBridgeRequestToJson( + value: PrivateChannelOnAddContextListenerBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnAddContextListenerBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnDisconnectAgentRequest(json: string): PrivateChannelOnDisconnectAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnDisconnectAgentRequest')); + } + + public static privateChannelOnDisconnectAgentRequestToJson(value: PrivateChannelOnDisconnectAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnDisconnectAgentRequest')), null, 2); + } + + public static toPrivateChannelOnDisconnectBridgeRequest(json: string): PrivateChannelOnDisconnectBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnDisconnectBridgeRequest')); + } + + public static privateChannelOnDisconnectBridgeRequestToJson(value: PrivateChannelOnDisconnectBridgeRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnDisconnectBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnUnsubscribeAgentRequest(json: string): PrivateChannelOnUnsubscribeAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnUnsubscribeAgentRequest')); + } + + public static privateChannelOnUnsubscribeAgentRequestToJson(value: PrivateChannelOnUnsubscribeAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnUnsubscribeAgentRequest')), null, 2); + } + + public static toPrivateChannelOnUnsubscribeBridgeRequest(json: string): PrivateChannelOnUnsubscribeBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnUnsubscribeBridgeRequest')); + } + + public static privateChannelOnUnsubscribeBridgeRequestToJson( + value: PrivateChannelOnUnsubscribeBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnUnsubscribeBridgeRequest')), null, 2); + } + + public static toRaiseIntentAgentErrorResponse(json: string): RaiseIntentAgentErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentAgentErrorResponse')); + } + + public static raiseIntentAgentErrorResponseToJson(value: RaiseIntentAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentErrorResponse')), null, 2); + } + + public static toRaiseIntentAgentRequest(json: string): RaiseIntentAgentRequest { + return cast(JSON.parse(json), r('RaiseIntentAgentRequest')); + } + + public static raiseIntentAgentRequestToJson(value: RaiseIntentAgentRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentRequest')), null, 2); + } + + public static toRaiseIntentAgentResponse(json: string): RaiseIntentAgentResponse { + return cast(JSON.parse(json), r('RaiseIntentAgentResponse')); + } + + public static raiseIntentAgentResponseToJson(value: RaiseIntentAgentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentResponse')), null, 2); + } + + public static toRaiseIntentBridgeErrorResponse(json: string): RaiseIntentBridgeErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentBridgeErrorResponse')); + } + + public static raiseIntentBridgeErrorResponseToJson(value: RaiseIntentBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeErrorResponse')), null, 2); + } + + public static toRaiseIntentBridgeRequest(json: string): RaiseIntentBridgeRequest { + return cast(JSON.parse(json), r('RaiseIntentBridgeRequest')); + } + + public static raiseIntentBridgeRequestToJson(value: RaiseIntentBridgeRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeRequest')), null, 2); + } + + public static toRaiseIntentBridgeResponse(json: string): RaiseIntentBridgeResponse { + return cast(JSON.parse(json), r('RaiseIntentBridgeResponse')); + } + + public static raiseIntentBridgeResponseToJson(value: RaiseIntentBridgeResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeResponse')), null, 2); + } - public static toOpenAgentRequest(json: string): OpenAgentRequest { - return cast(JSON.parse(json), r("OpenAgentRequest")); - } + public static toRaiseIntentResultAgentErrorResponse(json: string): RaiseIntentResultAgentErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentResultAgentErrorResponse')); + } - public static openAgentRequestToJson(value: OpenAgentRequest): string { - return JSON.stringify(uncast(value, r("OpenAgentRequest")), null, 2); - } + public static raiseIntentResultAgentErrorResponseToJson(value: RaiseIntentResultAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultAgentErrorResponse')), null, 2); + } - public static toOpenAgentResponse(json: string): OpenAgentResponse { - return cast(JSON.parse(json), r("OpenAgentResponse")); - } + public static toRaiseIntentResultAgentResponse(json: string): RaiseIntentResultAgentResponse { + return cast(JSON.parse(json), r('RaiseIntentResultAgentResponse')); + } - public static openAgentResponseToJson(value: OpenAgentResponse): string { - return JSON.stringify(uncast(value, r("OpenAgentResponse")), null, 2); - } + public static raiseIntentResultAgentResponseToJson(value: RaiseIntentResultAgentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultAgentResponse')), null, 2); + } - public static toOpenBridgeErrorResponse(json: string): OpenBridgeErrorResponse { - return cast(JSON.parse(json), r("OpenBridgeErrorResponse")); - } + public static toRaiseIntentResultBridgeErrorResponse(json: string): RaiseIntentResultBridgeErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentResultBridgeErrorResponse')); + } - public static openBridgeErrorResponseToJson(value: OpenBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("OpenBridgeErrorResponse")), null, 2); - } + public static raiseIntentResultBridgeErrorResponseToJson(value: RaiseIntentResultBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultBridgeErrorResponse')), null, 2); + } - public static toOpenBridgeRequest(json: string): OpenBridgeRequest { - return cast(JSON.parse(json), r("OpenBridgeRequest")); - } + public static toRaiseIntentResultBridgeResponse(json: string): RaiseIntentResultBridgeResponse { + return cast(JSON.parse(json), r('RaiseIntentResultBridgeResponse')); + } - public static openBridgeRequestToJson(value: OpenBridgeRequest): string { - return JSON.stringify(uncast(value, r("OpenBridgeRequest")), null, 2); - } - - public static toOpenBridgeResponse(json: string): OpenBridgeResponse { - return cast(JSON.parse(json), r("OpenBridgeResponse")); - } - - public static openBridgeResponseToJson(value: OpenBridgeResponse): string { - return JSON.stringify(uncast(value, r("OpenBridgeResponse")), null, 2); - } - - public static toPrivateChannelBroadcastAgentRequest(json: string): PrivateChannelBroadcastAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelBroadcastAgentRequest")); - } - - public static privateChannelBroadcastAgentRequestToJson(value: PrivateChannelBroadcastAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelBroadcastAgentRequest")), null, 2); - } - - public static toPrivateChannelBroadcastBridgeRequest(json: string): PrivateChannelBroadcastBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelBroadcastBridgeRequest")); - } - - public static privateChannelBroadcastBridgeRequestToJson(value: PrivateChannelBroadcastBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelBroadcastBridgeRequest")), null, 2); - } - - public static toPrivateChannelEventListenerAddedAgentRequest(json: string): PrivateChannelEventListenerAddedAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerAddedAgentRequest")); - } - - public static privateChannelEventListenerAddedAgentRequestToJson(value: PrivateChannelEventListenerAddedAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerAddedAgentRequest")), null, 2); - } - - public static toPrivateChannelEventListenerAddedBridgeRequest(json: string): PrivateChannelEventListenerAddedBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerAddedBridgeRequest")); - } - - public static privateChannelEventListenerAddedBridgeRequestToJson(value: PrivateChannelEventListenerAddedBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerAddedBridgeRequest")), null, 2); - } - - public static toPrivateChannelEventListenerRemovedAgentRequest(json: string): PrivateChannelEventListenerRemovedAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerRemovedAgentRequest")); - } - - public static privateChannelEventListenerRemovedAgentRequestToJson(value: PrivateChannelEventListenerRemovedAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerRemovedAgentRequest")), null, 2); - } - - public static toPrivateChannelEventListenerRemovedBridgeRequest(json: string): PrivateChannelEventListenerRemovedBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerRemovedBridgeRequest")); - } - - public static privateChannelEventListenerRemovedBridgeRequestToJson(value: PrivateChannelEventListenerRemovedBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerRemovedBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnAddContextListenerAgentRequest(json: string): PrivateChannelOnAddContextListenerAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnAddContextListenerAgentRequest")); - } - - public static privateChannelOnAddContextListenerAgentRequestToJson(value: PrivateChannelOnAddContextListenerAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnAddContextListenerAgentRequest")), null, 2); - } - - public static toPrivateChannelOnAddContextListenerBridgeRequest(json: string): PrivateChannelOnAddContextListenerBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnAddContextListenerBridgeRequest")); - } - - public static privateChannelOnAddContextListenerBridgeRequestToJson(value: PrivateChannelOnAddContextListenerBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnAddContextListenerBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnDisconnectAgentRequest(json: string): PrivateChannelOnDisconnectAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnDisconnectAgentRequest")); - } - - public static privateChannelOnDisconnectAgentRequestToJson(value: PrivateChannelOnDisconnectAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnDisconnectAgentRequest")), null, 2); - } - - public static toPrivateChannelOnDisconnectBridgeRequest(json: string): PrivateChannelOnDisconnectBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnDisconnectBridgeRequest")); - } - - public static privateChannelOnDisconnectBridgeRequestToJson(value: PrivateChannelOnDisconnectBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnDisconnectBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnUnsubscribeAgentRequest(json: string): PrivateChannelOnUnsubscribeAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnUnsubscribeAgentRequest")); - } - - public static privateChannelOnUnsubscribeAgentRequestToJson(value: PrivateChannelOnUnsubscribeAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnUnsubscribeAgentRequest")), null, 2); - } - - public static toPrivateChannelOnUnsubscribeBridgeRequest(json: string): PrivateChannelOnUnsubscribeBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnUnsubscribeBridgeRequest")); - } - - public static privateChannelOnUnsubscribeBridgeRequestToJson(value: PrivateChannelOnUnsubscribeBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnUnsubscribeBridgeRequest")), null, 2); - } - - public static toRaiseIntentAgentErrorResponse(json: string): RaiseIntentAgentErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentAgentErrorResponse")); - } - - public static raiseIntentAgentErrorResponseToJson(value: RaiseIntentAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentErrorResponse")), null, 2); - } - - public static toRaiseIntentAgentRequest(json: string): RaiseIntentAgentRequest { - return cast(JSON.parse(json), r("RaiseIntentAgentRequest")); - } - - public static raiseIntentAgentRequestToJson(value: RaiseIntentAgentRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentRequest")), null, 2); - } - - public static toRaiseIntentAgentResponse(json: string): RaiseIntentAgentResponse { - return cast(JSON.parse(json), r("RaiseIntentAgentResponse")); - } - - public static raiseIntentAgentResponseToJson(value: RaiseIntentAgentResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentResponse")), null, 2); - } - - public static toRaiseIntentBridgeErrorResponse(json: string): RaiseIntentBridgeErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentBridgeErrorResponse")); - } - - public static raiseIntentBridgeErrorResponseToJson(value: RaiseIntentBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeErrorResponse")), null, 2); - } - - public static toRaiseIntentBridgeRequest(json: string): RaiseIntentBridgeRequest { - return cast(JSON.parse(json), r("RaiseIntentBridgeRequest")); - } - - public static raiseIntentBridgeRequestToJson(value: RaiseIntentBridgeRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeRequest")), null, 2); - } - - public static toRaiseIntentBridgeResponse(json: string): RaiseIntentBridgeResponse { - return cast(JSON.parse(json), r("RaiseIntentBridgeResponse")); - } - - public static raiseIntentBridgeResponseToJson(value: RaiseIntentBridgeResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeResponse")), null, 2); - } - - public static toRaiseIntentResultAgentErrorResponse(json: string): RaiseIntentResultAgentErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentResultAgentErrorResponse")); - } - - public static raiseIntentResultAgentErrorResponseToJson(value: RaiseIntentResultAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultAgentErrorResponse")), null, 2); - } - - public static toRaiseIntentResultAgentResponse(json: string): RaiseIntentResultAgentResponse { - return cast(JSON.parse(json), r("RaiseIntentResultAgentResponse")); - } - - public static raiseIntentResultAgentResponseToJson(value: RaiseIntentResultAgentResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultAgentResponse")), null, 2); - } - - public static toRaiseIntentResultBridgeErrorResponse(json: string): RaiseIntentResultBridgeErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentResultBridgeErrorResponse")); - } - - public static raiseIntentResultBridgeErrorResponseToJson(value: RaiseIntentResultBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultBridgeErrorResponse")), null, 2); - } - - public static toRaiseIntentResultBridgeResponse(json: string): RaiseIntentResultBridgeResponse { - return cast(JSON.parse(json), r("RaiseIntentResultBridgeResponse")); - } - - public static raiseIntentResultBridgeResponseToJson(value: RaiseIntentResultBridgeResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultBridgeResponse")), null, 2); - } + public static raiseIntentResultBridgeResponseToJson(value: RaiseIntentResultBridgeResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultBridgeResponse')), null, 2); + } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); } function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; } else { - return typeof typ; + return `one of [${typ + .map(a => { + return prettyTypeName(a); + }) + .join(', ')}]`; } + } else if (typeof typ === 'object' && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } } function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; + if (typ.jsonToJS === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.json] = { key: p.js, typ: p.typ })); + typ.jsonToJS = map; + } + return typ.jsonToJS; } function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; + if (typ.jsToJSON === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.js] = { key: p.json, typ: p.typ })); + typ.jsToJSON = map; + } + return typ.jsToJSON; } function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) {} - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); + function transformPrimitive(typ: string, val: any): any { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs: any[], val: any): any { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases: string[], val: any): any { + if (cases.indexOf(val) !== -1) return val; + return invalidValue( + cases.map(a => { + return l(a); + }), + val, + key, + parent + ); + } + + function transformArray(typ: any, val: any): any { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l('array'), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val: any): any { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l('Date'), val, key, parent); + } + return d; + } + + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { + if (val === null || typeof val !== 'object' || Array.isArray(val)) { + return invalidValue(l(ref || 'object'), val, key, parent); + } + const result: any = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); } function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); + return transform(val, typ, jsonToJSProps); } function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); + return transform(val, typ, jsToJSONProps); } function l(typ: any) { - return { literal: typ }; + return { literal: typ }; } function a(typ: any) { - return { arrayItems: typ }; + return { arrayItems: typ }; } function u(...typs: any[]) { - return { unionMembers: typs }; + return { unionMembers: typs }; } function o(props: any[], additional: any) { - return { props, additional }; + return { props, additional }; } function m(additional: any) { - return { props: [], additional }; + return { props: [], additional }; } function r(name: string) { - return { ref: name }; + return { ref: name }; } const typeMap: any = { - "AgentErrorResponseMessage": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: r("ErrorResponseMessagePayload") }, - { json: "type", js: "type", typ: r("ResponseMessageType") }, - ], false), - "AgentResponseMetadata": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ErrorResponseMessagePayload": o([ - { json: "error", js: "error", typ: r("ResponseErrorDetail") }, - ], "any"), - "AgentRequestMessage": o([ - { json: "meta", js: "meta", typ: r("AgentRequestMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("RequestMessageType") }, - ], false), - "AgentRequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BridgeParticipantIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "SourceIdentifier": o([ - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "AgentResponseMessage": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("ResponseMessageType") }, - ], false), - "BridgeErrorResponseMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeErrorResponseMessageMeta") }, - { json: "payload", js: "payload", typ: r("ResponseErrorMessagePayload") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeErrorResponseMessageMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "DesktopAgentIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - ], "any"), - "ResponseErrorMessagePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponseErrorDetail")) }, - ], "any"), - "BridgeRequestMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeRequestMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeRequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("BridgeParticipantIdentifier") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BridgeResponseMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeResponseMessageMeta") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeResponseMessageMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BroadcastAgentRequest": o([ - { json: "meta", js: "meta", typ: r("BroadcastAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastAgentRequestPayload") }, - { json: "type", js: "type", typ: r("BroadcastAgentRequestType") }, - ], false), - "BroadcastAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "SourceObject": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "BroadcastAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "Context": o([ - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: "" }, - ], "any"), - "BroadcastBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("BroadcastBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("BroadcastAgentRequestType") }, - ], false), - "BroadcastBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaSource": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "BroadcastBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "ConnectionStepMessage": o([ - { json: "meta", js: "meta", typ: r("ConnectionStepMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("ConnectionStepMessageType") }, - ], false), - "ConnectionStepMetadata": o([ - { json: "requestUuid", js: "requestUuid", typ: u(undefined, "") }, - { json: "responseUuid", js: "responseUuid", typ: u(undefined, "") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep2Hello": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep2HelloMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep2HelloPayload") }, - { json: "type", js: "type", typ: r("ConnectionStep2HelloType") }, - ], false), - "ConnectionStep2HelloMeta": o([ - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep2HelloPayload": o([ - { json: "authRequired", js: "authRequired", typ: true }, - { json: "authToken", js: "authToken", typ: u(undefined, "") }, - { json: "desktopAgentBridgeVersion", js: "desktopAgentBridgeVersion", typ: "" }, - { json: "supportedFDC3Versions", js: "supportedFDC3Versions", typ: a("") }, - ], false), - "ConnectionStep3Handshake": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep3HandshakeMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep3HandshakePayload") }, - { json: "type", js: "type", typ: r("ConnectionStep3HandshakeType") }, - ], false), - "ConnectionStep3HandshakeMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep3HandshakePayload": o([ - { json: "authToken", js: "authToken", typ: u(undefined, "") }, - { json: "channelsState", js: "channelsState", typ: m(a(r("Context"))) }, - { json: "implementationMetadata", js: "implementationMetadata", typ: r("ConnectingAgentImplementationMetadata") }, - { json: "requestedName", js: "requestedName", typ: "" }, - ], false), - "ConnectingAgentImplementationMetadata": o([ - { 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), - "ConnectionStep4AuthenticationFailed": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep4AuthenticationFailedMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep4AuthenticationFailedPayload") }, - { json: "type", js: "type", typ: r("ConnectionStep4AuthenticationFailedType") }, - ], false), - "ConnectionStep4AuthenticationFailedMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep4AuthenticationFailedPayload": o([ - { json: "message", js: "message", typ: u(undefined, "") }, - ], false), - "ConnectionStep6ConnectedAgentsUpdate": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep6ConnectedAgentsUpdateMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep6ConnectedAgentsUpdatePayload") }, - { json: "type", js: "type", typ: r("ConnectionStep6ConnectedAgentsUpdateType") }, - ], false), - "ConnectionStep6ConnectedAgentsUpdateMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep6ConnectedAgentsUpdatePayload": o([ - { json: "addAgent", js: "addAgent", typ: u(undefined, "") }, - { json: "allAgents", js: "allAgents", typ: a(r("DesktopAgentImplementationMetadata")) }, - { json: "channelsState", js: "channelsState", typ: u(undefined, m(a(r("Context")))) }, - { json: "removeAgent", js: "removeAgent", typ: u(undefined, "") }, - ], false), - "DesktopAgentImplementationMetadata": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { 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), - "FindInstancesAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindInstancesAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("PayloadClass") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PayloadClass": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindInstancesAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindInstancesAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentRequestType") }, - ], false), - "FindInstancesAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "DestinationObject": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "AppIdentifier": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesAgentResponse": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: r("FindInstancesAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesAgentResponsePayload": o([ - { json: "appIdentifiers", js: "appIdentifiers", typ: a(r("AppMetadata")) }, - ], 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), - "FindInstancesBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindInstancesBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("MessagePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MessagePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindInstancesBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindInstancesBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentRequestType") }, - ], false), - "FindInstancesBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaSourceObject": o([ - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "FindInstancesBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("BridgeResponseMessageMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesBridgeResponsePayload": o([ - { json: "appIdentifiers", js: "appIdentifiers", typ: a(r("AppMetadata")) }, - ], false), - "FindIntentAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentRequestType") }, - ], false), - "FindIntentAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentAgentRequestPayload": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "intent", js: "intent", typ: "" }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentAgentResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentAgentResponsePayload": o([ - { json: "appIntent", js: "appIntent", typ: r("AppIntent") }, - ], false), - "AppIntent": o([ - { json: "apps", js: "apps", typ: a(r("AppMetadata")) }, - { json: "intent", js: "intent", typ: r("IntentMetadata") }, - ], false), - "IntentMetadata": o([ - { json: "displayName", js: "displayName", typ: u(undefined, "") }, - { json: "name", js: "name", typ: "" }, - ], false), - "FindIntentBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentRequestType") }, - ], false), - "FindIntentBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("BridgeParticipantIdentifier") }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentBridgeRequestPayload": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "intent", js: "intent", typ: "" }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentBridgeResponsePayload": o([ - { json: "appIntent", js: "appIntent", typ: r("AppIntent") }, - ], false), - "FindIntentsByContextAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentsByContextAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentRequestType") }, - ], false), - "FindIntentsByContextAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentsByContextAgentRequestPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentsByContextAgentResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextAgentResponsePayload": o([ - { json: "appIntents", js: "appIntents", typ: a(r("AppIntent")) }, - ], false), - "FindIntentsByContextBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentsByContextBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentRequestType") }, - ], false), - "FindIntentsByContextBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentsByContextBridgeRequestPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentsByContextBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextBridgeResponsePayload": o([ - { json: "appIntents", js: "appIntents", typ: a(r("AppIntent")) }, - ], false), - "GetAppMetadataAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "GetAppMetadataAgentRequest": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentRequestPayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentRequestType") }, - ], false), - "GetAppMetadataAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppObject") }, - ], false), - "AppObject": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "GetAppMetadataAgentResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentResponsePayload": o([ - { json: "appMetadata", js: "appMetadata", typ: r("AppMetadata") }, - ], false), - "GetAppMetadataBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "GetAppMetadataBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentRequestType") }, - ], false), - "GetAppMetadataBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppObject") }, - ], false), - "GetAppMetadataBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeResponsePayload": o([ - { json: "appMetadata", js: "appMetadata", typ: r("AppMetadata") }, - ], false), - "OpenAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("OpenAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("OpenErrorResponsePayload") }, - ], false), - "OpenAgentRequest": o([ - { json: "meta", js: "meta", typ: r("OpenAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentRequestPayload") }, - { json: "type", js: "type", typ: r("OpenAgentRequestType") }, - ], false), - "OpenAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppToOpen") }, - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - ], false), - "AppToOpen": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "OpenAgentResponse": o([ - { json: "meta", js: "meta", typ: r("OpenAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentResponsePayload": o([ - { json: "appIdentifier", js: "appIdentifier", typ: r("AppIdentifier") }, - ], false), - "OpenBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("OpenErrorResponsePayload") }, - ], false), - "OpenBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("OpenAgentRequestType") }, - ], false), - "OpenBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppToOpen") }, - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - ], false), - "OpenBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeResponsePayload": o([ - { json: "appIdentifier", js: "appIdentifier", typ: r("AppIdentifier") }, - ], false), - "PrivateChannelBroadcastAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelBroadcastAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelBroadcastAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelBroadcastAgentRequestType") }, - ], false), - "PrivateChannelBroadcastAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaDestination": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "PrivateChannelBroadcastAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "PrivateChannelBroadcastBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelBroadcastBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelBroadcastBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelBroadcastAgentRequestType") }, - ], false), - "PrivateChannelBroadcastBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelBroadcastBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "PrivateChannelEventListenerAddedAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerAddedAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerAddedAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerAddedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerAddedAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerAddedAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerAddedBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerAddedBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerAddedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerRemovedAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerRemovedAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerRemovedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerRemovedBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerRemovedBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerRemovedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnAddContextListenerAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnAddContextListenerAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnAddContextListenerAgentRequestType") }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnAddContextListenerBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnAddContextListenerBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnAddContextListenerAgentRequestType") }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnDisconnectAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnDisconnectAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnDisconnectAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnDisconnectAgentRequestType") }, - ], false), - "PrivateChannelOnDisconnectAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnDisconnectAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "PrivateChannelOnDisconnectBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnDisconnectBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnDisconnectBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnDisconnectAgentRequestType") }, - ], false), - "PrivateChannelOnDisconnectBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnDisconnectBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnUnsubscribeAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnUnsubscribeAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnUnsubscribeAgentRequestType") }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnUnsubscribeBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("ERequestMetadata") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnUnsubscribeBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnUnsubscribeAgentRequestType") }, - ], false), - "ERequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnUnsubscribeBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "RaiseIntentAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "RaiseIntentAgentRequest": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentRequestType") }, - ], false), - "RaiseIntentAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: r("MetaDestination") }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppDestinationIdentifier") }, - { json: "context", js: "context", typ: r("Context") }, - { json: "intent", js: "intent", typ: "" }, - ], false), - "AppDestinationIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "RaiseIntentAgentResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentResponsePayload": o([ - { json: "intentResolution", js: "intentResolution", typ: r("IntentResolution") }, - ], false), - "IntentResolution": o([ - { json: "intent", js: "intent", typ: "" }, - { json: "source", js: "source", typ: r("AppIdentifier") }, - ], false), - "RaiseIntentBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "RaiseIntentBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentRequestType") }, - ], false), - "RaiseIntentBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: r("MetaDestination") }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppDestinationIdentifier") }, - { json: "context", js: "context", typ: r("Context") }, - { json: "intent", js: "intent", typ: "" }, - ], false), - "RaiseIntentBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeResponsePayload": o([ - { json: "intentResolution", js: "intentResolution", typ: r("IntentResolution") }, - ], false), - "RaiseIntentResultAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("RaiseIntentResultErrorMessage") }, - ], false), - "RaiseIntentResultAgentResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultAgentResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultAgentResponsePayload": o([ - { json: "intentResult", js: "intentResult", typ: r("IntentResult") }, - ], false), - "IntentResult": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "channel", js: "channel", typ: u(undefined, r("Channel")) }, - ], false), - "Channel": o([ - { json: "displayMetadata", js: "displayMetadata", typ: u(undefined, r("DisplayMetadata")) }, - { json: "id", js: "id", typ: "" }, - { json: "type", js: "type", typ: r("Type") }, - ], false), - "DisplayMetadata": o([ - { json: "color", js: "color", typ: u(undefined, "") }, - { json: "glyph", js: "glyph", typ: u(undefined, "") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], false), - "RaiseIntentResultBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("RaiseIntentResultErrorMessage") }, - ], false), - "RaiseIntentResultBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultBridgeResponsePayload": o([ - { json: "intentResult", js: "intentResult", typ: r("IntentResult") }, - ], false), - "ResponseErrorDetail": [ - "AccessDenied", - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "CreationFailed", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "IntentDeliveryFailed", - "IntentHandlerRejected", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NoChannelFound", - "NoResultReturned", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "ResponseMessageType": [ - "findInstancesResponse", - "findIntentResponse", - "findIntentsByContextResponse", - "getAppMetadataResponse", - "openResponse", - "raiseIntentResponse", - "raiseIntentResultResponse", - ], - "RequestMessageType": [ - "broadcastRequest", - "findInstancesRequest", - "findIntentRequest", - "findIntentsByContextRequest", - "getAppMetadataRequest", - "openRequest", - "PrivateChannel.broadcast", - "PrivateChannel.eventListenerAdded", - "PrivateChannel.eventListenerRemoved", - "PrivateChannel.onAddContextListener", - "PrivateChannel.onDisconnect", - "PrivateChannel.onUnsubscribe", - "raiseIntentRequest", - ], - "BroadcastAgentRequestType": [ - "broadcastRequest", - ], - "ConnectionStepMessageType": [ - "authenticationFailed", - "connectedAgentsUpdate", - "handshake", - "hello", - ], - "ConnectionStep2HelloType": [ - "hello", - ], - "ConnectionStep3HandshakeType": [ - "handshake", - ], - "ConnectionStep4AuthenticationFailedType": [ - "authenticationFailed", - ], - "ConnectionStep6ConnectedAgentsUpdateType": [ - "connectedAgentsUpdate", - ], - "FindInstancesErrors": [ - "AgentDisconnected", - "DesktopAgentNotFound", - "IntentDeliveryFailed", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "FindInstancesAgentErrorResponseType": [ - "findInstancesResponse", - ], - "FindInstancesAgentRequestType": [ - "findInstancesRequest", - ], - "FindIntentAgentErrorResponseType": [ - "findIntentResponse", - ], - "FindIntentAgentRequestType": [ - "findIntentRequest", - ], - "FindIntentsByContextAgentErrorResponseType": [ - "findIntentsByContextResponse", - ], - "FindIntentsByContextAgentRequestType": [ - "findIntentsByContextRequest", - ], - "GetAppMetadataAgentErrorResponseType": [ - "getAppMetadataResponse", - ], - "GetAppMetadataAgentRequestType": [ - "getAppMetadataRequest", - ], - "OpenErrorResponsePayload": [ - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "MalformedContext", - "MalformedMessage", - "NotConnectedToBridge", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - ], - "OpenAgentErrorResponseType": [ - "openResponse", - ], - "OpenAgentRequestType": [ - "openRequest", - ], - "PrivateChannelBroadcastAgentRequestType": [ - "PrivateChannel.broadcast", - ], - "PrivateChannelEventListenerTypes": [ - "onAddContextListener", - "onDisconnect", - "onUnsubscribe", - ], - "PrivateChannelEventListenerAddedAgentRequestType": [ - "PrivateChannel.eventListenerAdded", - ], - "PrivateChannelEventListenerRemovedAgentRequestType": [ - "PrivateChannel.eventListenerRemoved", - ], - "PrivateChannelOnAddContextListenerAgentRequestType": [ - "PrivateChannel.onAddContextListener", - ], - "PrivateChannelOnDisconnectAgentRequestType": [ - "PrivateChannel.onDisconnect", + AgentErrorResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: r('ErrorResponseMessagePayload') }, + { json: 'type', js: 'type', typ: r('ResponseMessageType') }, + ], + false + ), + AgentResponseMetadata: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ErrorResponseMessagePayload: o([{ json: 'error', js: 'error', typ: r('ResponseErrorDetail') }], 'any'), + AgentRequestMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentRequestMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('RequestMessageType') }, + ], + false + ), + AgentRequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BridgeParticipantIdentifier: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + SourceIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + AgentResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('ResponseMessageType') }, + ], + false + ), + BridgeErrorResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeErrorResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: r('ResponseErrorMessagePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeErrorResponseMessageMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + DesktopAgentIdentifier: o([{ json: 'desktopAgent', js: 'desktopAgent', typ: '' }], 'any'), + ResponseErrorMessagePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('ResponseErrorDetail')) }], 'any'), + BridgeRequestMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeRequestMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeRequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BridgeResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeResponseMessageMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BroadcastAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastAgentRequestType') }, + ], + false + ), + BroadcastAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + SourceObject: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BroadcastAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + BroadcastBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastAgentRequestType') }, + ], + false + ), + BroadcastBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaSource: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BroadcastBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + ConnectionStepMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStepMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('ConnectionStepMessageType') }, + ], + false + ), + ConnectionStepMetadata: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: u(undefined, '') }, + { json: 'responseUuid', js: 'responseUuid', typ: u(undefined, '') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep2Hello: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep2HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep2HelloPayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep2HelloType') }, + ], + false + ), + ConnectionStep2HelloMeta: o([{ json: 'timestamp', js: 'timestamp', typ: Date }], false), + ConnectionStep2HelloPayload: o( + [ + { json: 'authRequired', js: 'authRequired', typ: true }, + { json: 'authToken', js: 'authToken', typ: u(undefined, '') }, + { json: 'desktopAgentBridgeVersion', js: 'desktopAgentBridgeVersion', typ: '' }, + { json: 'supportedFDC3Versions', js: 'supportedFDC3Versions', typ: a('') }, + ], + false + ), + ConnectionStep3Handshake: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep3HandshakeMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep3HandshakePayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep3HandshakeType') }, + ], + false + ), + ConnectionStep3HandshakeMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep3HandshakePayload: o( + [ + { json: 'authToken', js: 'authToken', typ: u(undefined, '') }, + { json: 'channelsState', js: 'channelsState', typ: m(a(r('Context'))) }, + { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ConnectingAgentImplementationMetadata') }, + { json: 'requestedName', js: 'requestedName', typ: '' }, + ], + false + ), + ConnectingAgentImplementationMetadata: o( + [ + { 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 + ), + ConnectionStep4AuthenticationFailed: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep4AuthenticationFailedMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep4AuthenticationFailedPayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep4AuthenticationFailedType') }, + ], + false + ), + ConnectionStep4AuthenticationFailedMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep4AuthenticationFailedPayload: o([{ json: 'message', js: 'message', typ: u(undefined, '') }], false), + ConnectionStep6ConnectedAgentsUpdate: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep6ConnectedAgentsUpdateMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep6ConnectedAgentsUpdatePayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep6ConnectedAgentsUpdateType') }, + ], + false + ), + ConnectionStep6ConnectedAgentsUpdateMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep6ConnectedAgentsUpdatePayload: o( + [ + { json: 'addAgent', js: 'addAgent', typ: u(undefined, '') }, + { json: 'allAgents', js: 'allAgents', typ: a(r('DesktopAgentImplementationMetadata')) }, + { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('Context')))) }, + { json: 'removeAgent', js: 'removeAgent', typ: u(undefined, '') }, + ], + false + ), + DesktopAgentImplementationMetadata: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { 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 + ), + FindInstancesAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('PayloadClass') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PayloadClass: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindInstancesAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentRequestType') }, + ], + false + ), + FindInstancesAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + DestinationObject: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesAgentRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + AppIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesAgentResponsePayload: o( + [{ json: 'appIdentifiers', js: 'appIdentifiers', typ: a(r('AppMetadata')) }], + 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 + ), + FindInstancesBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('MessagePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MessagePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindInstancesBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentRequestType') }, + ], + false + ), + FindInstancesBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaSourceObject: o( + [ + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesBridgeRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + FindInstancesBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesBridgeResponsePayload: o( + [{ json: 'appIdentifiers', js: 'appIdentifiers', typ: a(r('AppMetadata')) }], + false + ), + FindIntentAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindIntentAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentRequestType') }, + ], + false + ), + FindIntentAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentAgentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentAgentResponsePayload: o([{ json: 'appIntent', js: 'appIntent', typ: r('AppIntent') }], false), + AppIntent: o( + [ + { json: 'apps', js: 'apps', typ: a(r('AppMetadata')) }, + { json: 'intent', js: 'intent', typ: r('IntentMetadata') }, + ], + false + ), + IntentMetadata: o( + [ + { json: 'displayName', js: 'displayName', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: '' }, + ], + false + ), + FindIntentBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindIntentBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentRequestType') }, + ], + false + ), + FindIntentBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentBridgeRequestPayload: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentBridgeResponsePayload: o([{ json: 'appIntent', js: 'appIntent', typ: r('AppIntent') }], false), + FindIntentsByContextAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextAgentErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], + false + ), + FindIntentsByContextAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentRequestType') }, + ], + false + ), + FindIntentsByContextAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentsByContextAgentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentsByContextAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextAgentResponsePayload: o( + [{ json: 'appIntents', js: 'appIntents', typ: a(r('AppIntent')) }], + false + ), + FindIntentsByContextBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextBridgeErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], + false + ), + FindIntentsByContextBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentRequestType') }, + ], + false + ), + FindIntentsByContextBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentsByContextBridgeRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentsByContextBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextBridgeResponsePayload: o( + [{ json: 'appIntents', js: 'appIntents', typ: a(r('AppIntent')) }], + false + ), + GetAppMetadataAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + GetAppMetadataAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentRequestType') }, + ], + false + ), + GetAppMetadataAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppObject') }], false), + AppObject: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + GetAppMetadataAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentResponsePayload: o([{ json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }], false), + GetAppMetadataBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + GetAppMetadataBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentRequestType') }, + ], + false + ), + GetAppMetadataBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppObject') }], false), + GetAppMetadataBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeResponsePayload: o([{ json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }], false), + OpenAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('OpenErrorResponsePayload') }], false), + OpenAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentRequestType') }, + ], + false + ), + OpenAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppToOpen') }, + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + ], + false + ), + AppToOpen: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + OpenAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentResponsePayload: o([{ json: 'appIdentifier', js: 'appIdentifier', typ: r('AppIdentifier') }], false), + OpenBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('OpenErrorResponsePayload') }], false), + OpenBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentRequestType') }, + ], + false + ), + OpenBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppToOpen') }, + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + ], + false + ), + OpenBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeResponsePayload: o([{ json: 'appIdentifier', js: 'appIdentifier', typ: r('AppIdentifier') }], false), + PrivateChannelBroadcastAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelBroadcastAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelBroadcastAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelBroadcastAgentRequestType') }, + ], + false + ), + PrivateChannelBroadcastAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaDestination: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + PrivateChannelBroadcastAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + PrivateChannelBroadcastBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelBroadcastBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelBroadcastBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelBroadcastAgentRequestType') }, + ], + false + ), + PrivateChannelBroadcastBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelBroadcastBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerAddedAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerAddedAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerAddedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerAddedBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerAddedBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerAddedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerRemovedAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerRemovedAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerRemovedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerRemovedBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerRemovedBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerRemovedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnAddContextListenerAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnAddContextListenerAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnAddContextListenerAgentRequestType') }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnAddContextListenerBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnAddContextListenerBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnAddContextListenerAgentRequestType') }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnDisconnectAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnDisconnectAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnDisconnectAgentRequestType') }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + PrivateChannelOnDisconnectBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnDisconnectBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnDisconnectBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnDisconnectAgentRequestType') }, + ], + false + ), + PrivateChannelOnDisconnectBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnDisconnectBridgeRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + PrivateChannelOnUnsubscribeAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnUnsubscribeAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnUnsubscribeAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnUnsubscribeAgentRequestType') }, + ], + false + ), + PrivateChannelOnUnsubscribeAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnUnsubscribeAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnUnsubscribeBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('ERequestMetadata') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnUnsubscribeBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnUnsubscribeAgentRequestType') }, + ], + false + ), + ERequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnUnsubscribeBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + RaiseIntentAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + RaiseIntentAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentRequestType') }, + ], + false + ), + RaiseIntentAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: r('MetaDestination') }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'intent', js: 'intent', typ: '' }, + ], + false + ), + AppDestinationIdentifier: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + RaiseIntentAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentResponsePayload: o( + [{ json: 'intentResolution', js: 'intentResolution', typ: r('IntentResolution') }], + false + ), + IntentResolution: o( + [ + { json: 'intent', js: 'intent', typ: '' }, + { json: 'source', js: 'source', typ: r('AppIdentifier') }, + ], + false + ), + RaiseIntentBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + RaiseIntentBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentRequestType') }, + ], + false + ), + RaiseIntentBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: r('MetaDestination') }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'intent', js: 'intent', typ: '' }, + ], + false + ), + RaiseIntentBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeResponsePayload: o( + [{ json: 'intentResolution', js: 'intentResolution', typ: r('IntentResolution') }], + false + ), + RaiseIntentResultAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, + ], + false + ), + RaiseIntentResultAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentResultAgentErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('RaiseIntentResultErrorMessage') }], + false + ), + RaiseIntentResultAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, + ], + false + ), + RaiseIntentResultAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentResultAgentResponsePayload: o( + [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }], + false + ), + IntentResult: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) }, + ], + false + ), + Channel: o( + [ + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadata')) }, + { json: 'id', js: 'id', typ: '' }, + { json: 'type', js: 'type', typ: r('Type') }, ], - "PrivateChannelOnUnsubscribeAgentRequestType": [ - "PrivateChannel.onUnsubscribe", + false + ), + DisplayMetadata: o( + [ + { json: 'color', js: 'color', typ: u(undefined, '') }, + { json: 'glyph', js: 'glyph', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "RaiseIntentAgentErrorResponseType": [ - "raiseIntentResponse", - ], - "RaiseIntentAgentRequestType": [ - "raiseIntentRequest", + false + ), + RaiseIntentResultBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, ], - "RaiseIntentResultErrorMessage": [ - "AgentDisconnected", - "IntentHandlerRejected", - "MalformedMessage", - "NoResultReturned", - "NotConnectedToBridge", - "ResponseToBridgeTimedOut", + false + ), + RaiseIntentResultBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, ], - "RaiseIntentResultAgentErrorResponseType": [ - "raiseIntentResultResponse", + false + ), + RaiseIntentResultBridgeErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('RaiseIntentResultErrorMessage') }], + false + ), + RaiseIntentResultBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, ], - "Type": [ - "app", - "private", - "user", + false + ), + RaiseIntentResultBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, ], + false + ), + RaiseIntentResultBridgeResponsePayload: o( + [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }], + false + ), + ResponseErrorDetail: [ + 'AccessDenied', + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'CreationFailed', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'IntentDeliveryFailed', + 'IntentHandlerRejected', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NoChannelFound', + 'NoResultReturned', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + ResponseMessageType: [ + 'findInstancesResponse', + 'findIntentResponse', + 'findIntentsByContextResponse', + 'getAppMetadataResponse', + 'openResponse', + 'raiseIntentResponse', + 'raiseIntentResultResponse', + ], + RequestMessageType: [ + 'broadcastRequest', + 'findInstancesRequest', + 'findIntentRequest', + 'findIntentsByContextRequest', + 'getAppMetadataRequest', + 'openRequest', + 'PrivateChannel.broadcast', + 'PrivateChannel.eventListenerAdded', + 'PrivateChannel.eventListenerRemoved', + 'PrivateChannel.onAddContextListener', + 'PrivateChannel.onDisconnect', + 'PrivateChannel.onUnsubscribe', + 'raiseIntentRequest', + ], + BroadcastAgentRequestType: ['broadcastRequest'], + ConnectionStepMessageType: ['authenticationFailed', 'connectedAgentsUpdate', 'handshake', 'hello'], + ConnectionStep2HelloType: ['hello'], + ConnectionStep3HandshakeType: ['handshake'], + ConnectionStep4AuthenticationFailedType: ['authenticationFailed'], + ConnectionStep6ConnectedAgentsUpdateType: ['connectedAgentsUpdate'], + FindInstancesErrors: [ + 'AgentDisconnected', + 'DesktopAgentNotFound', + 'IntentDeliveryFailed', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + FindInstancesAgentErrorResponseType: ['findInstancesResponse'], + FindInstancesAgentRequestType: ['findInstancesRequest'], + FindIntentAgentErrorResponseType: ['findIntentResponse'], + FindIntentAgentRequestType: ['findIntentRequest'], + FindIntentsByContextAgentErrorResponseType: ['findIntentsByContextResponse'], + FindIntentsByContextAgentRequestType: ['findIntentsByContextRequest'], + GetAppMetadataAgentErrorResponseType: ['getAppMetadataResponse'], + GetAppMetadataAgentRequestType: ['getAppMetadataRequest'], + OpenErrorResponsePayload: [ + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'MalformedContext', + 'MalformedMessage', + 'NotConnectedToBridge', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + ], + OpenAgentErrorResponseType: ['openResponse'], + OpenAgentRequestType: ['openRequest'], + PrivateChannelBroadcastAgentRequestType: ['PrivateChannel.broadcast'], + PrivateChannelEventListenerTypes: ['onAddContextListener', 'onDisconnect', 'onUnsubscribe'], + PrivateChannelEventListenerAddedAgentRequestType: ['PrivateChannel.eventListenerAdded'], + PrivateChannelEventListenerRemovedAgentRequestType: ['PrivateChannel.eventListenerRemoved'], + PrivateChannelOnAddContextListenerAgentRequestType: ['PrivateChannel.onAddContextListener'], + PrivateChannelOnDisconnectAgentRequestType: ['PrivateChannel.onDisconnect'], + PrivateChannelOnUnsubscribeAgentRequestType: ['PrivateChannel.onUnsubscribe'], + RaiseIntentAgentErrorResponseType: ['raiseIntentResponse'], + RaiseIntentAgentRequestType: ['raiseIntentRequest'], + RaiseIntentResultErrorMessage: [ + 'AgentDisconnected', + 'IntentHandlerRejected', + 'MalformedMessage', + 'NoResultReturned', + 'NotConnectedToBridge', + 'ResponseToBridgeTimedOut', + ], + RaiseIntentResultAgentErrorResponseType: ['raiseIntentResultResponse'], + Type: ['app', 'private', 'user'], }; diff --git a/packages/fdc3-schema/s2tQuicktypeUtil.js b/packages/fdc3-schema/s2tQuicktypeUtil.js index 4b586d301..2008c1cc9 100644 --- a/packages/fdc3-schema/s2tQuicktypeUtil.js +++ b/packages/fdc3-schema/s2tQuicktypeUtil.js @@ -1,17 +1,17 @@ /** * SPDX-License-Identifier: Apache-2.0 * Copyright FINOS FDC3 contributors - see NOTICE file - */ + */ /** Utility for preparing arguments to quicktype, which workaround a specific * quicktype bug in command line argument handling (where a directory is used * as input the source language argument is ignored which causes our schemas * to be interpreted as JSON input, rather than JSONSchema). - * + * * Individual file arguments will be interpreted as 'additional' schema files - * that will be referenced from the other schemas and may not have top-level output + * that will be referenced from the other schemas and may not have top-level output * schemas generated, while folders of files w - * + * * */ const path = require('path'); @@ -28,33 +28,33 @@ console.log('Inputs schema files: ' + inputs.join(' | ')); console.log('Output file argument: ' + outputFile); let sources = ''; -let additionalSchemaFiles = '' +let additionalSchemaFiles = ''; //skip duplicate paths (we might want to specify some files to go first, and might duplicate them) const allPaths = new Set(); -const addAPath = (aPath,paths,sources,type) => { +const addAPath = (aPath, paths, sources, type) => { if (!paths.has(aPath)) { - paths.add(aPath) + paths.add(aPath); return sources + ` ${type} ${aPath}`; } else { console.log(`skipping duplicate path ${aPath}`); return sources; } -} +}; //process the content of folders to produce code for top-level types let inputIndex = 0; while (inputIndex < inputs.length) { if (inputs[inputIndex].endsWith('.schema.json')) { //add individual files with -S as additional schema files used in references (rather than ones that need a top-level output) - additionalSchemaFiles = addAPath(path.join(inputs[inputIndex]),allPaths,additionalSchemaFiles, "-S"); + additionalSchemaFiles = addAPath(path.join(inputs[inputIndex]), allPaths, additionalSchemaFiles, '-S'); } else { fs.readdirSync(inputs[inputIndex], { withFileTypes: true }).forEach(file => { if (file.isDirectory()) { inputs.push(path.join(inputs[inputIndex], file.name)); } else if (file.name.endsWith('.schema.json')) { - sources = addAPath(path.join(inputs[inputIndex], file.name),allPaths,sources, "--src"); + sources = addAPath(path.join(inputs[inputIndex], file.name), allPaths, sources, '--src'); } }); } @@ -68,7 +68,7 @@ const quicktypeExec = ['..', '..', '..', 'node_modules', '.bin', 'quicktype'].jo const command = `${quicktypeExec} --prefer-const-values --prefer-unions -s schema -o ${outputFile} ${additionalSchemaFiles} ${sources}`; console.log('command to run: ' + command); -exec(command, function(error, stdout, stderr) { +exec(command, function (error, stdout, stderr) { if (stdout) { console.log(stdout); } diff --git a/packages/fdc3-schema/src/index.ts b/packages/fdc3-schema/src/index.ts index 1a67369ad..7d7982455 100644 --- a/packages/fdc3-schema/src/index.ts +++ b/packages/fdc3-schema/src/index.ts @@ -1,6 +1,4 @@ - - import * as BrowserTypes from '../generated/api/BrowserTypes'; import * as BridgingTypes from '../generated/bridging/BridgingTypes'; -export { BrowserTypes, BridgingTypes }; \ No newline at end of file +export { BrowserTypes, BridgingTypes }; diff --git a/packages/fdc3-standard/eslint.config.mjs b/packages/fdc3-standard/eslint.config.mjs index 4845cdab9..fecd6dfad 100644 --- a/packages/fdc3-standard/eslint.config.mjs +++ b/packages/fdc3-standard/eslint.config.mjs @@ -1,55 +1,61 @@ -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -import jsxA11Y from "eslint-plugin-jsx-a11y"; -import globals from "globals"; -import tsParser from "@typescript-eslint/parser"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; +import typescriptEslint from '@typescript-eslint/eslint-plugin'; +import jsxA11Y from 'eslint-plugin-jsx-a11y'; +import globals from 'globals'; +import tsParser from '@typescript-eslint/parser'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import js from '@eslint/js'; +import { FlatCompat } from '@eslint/eslintrc'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, }); -export default [...compat.extends( - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended", - "prettier", -), { - files: ["**/*.ts", "**/*.tsx"], - +export default [ + ...compat.extends( + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier' + ), + { + files: ['**/*.ts', '**/*.tsx'], + plugins: { - "@typescript-eslint": typescriptEslint, - "jsx-a11y": jsxA11Y, + '@typescript-eslint': typescriptEslint, + 'jsx-a11y': jsxA11Y, }, languageOptions: { - globals: { - ...globals.browser, - ...globals.jest, - }, + globals: { + ...globals.browser, + ...globals.jest, + }, - parser: tsParser, - ecmaVersion: 5, - sourceType: "script", + parser: tsParser, + ecmaVersion: 5, + sourceType: 'script', - parserOptions: { - project: ["./tsconfig.json"], - }, + parserOptions: { + project: ['./tsconfig.json'], + }, }, rules: { - "@typescript-eslint/adjacent-overload-signatures": "warn", - "@typescript-eslint/no-empty-interface": "warn", - "@typescript-eslint/no-empty-function": "warn", - "@typescript-eslint/no-explicit-any": "off", - - "@typescript-eslint/no-unused-vars": ["error", { - argsIgnorePattern: "^_", - }], + '@typescript-eslint/adjacent-overload-signatures': 'warn', + '@typescript-eslint/no-empty-interface': 'warn', + '@typescript-eslint/no-empty-function': 'warn', + '@typescript-eslint/no-explicit-any': 'off', + + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + }, + ], }, -}]; \ No newline at end of file + }, +]; diff --git a/packages/fdc3-standard/jest.config.js b/packages/fdc3-standard/jest.config.js index 0bb7f16f7..f644b42fb 100644 --- a/packages/fdc3-standard/jest.config.js +++ b/packages/fdc3-standard/jest.config.js @@ -1,15 +1,13 @@ /** @type {import('jest').Config} */ module.exports = { - moduleFileExtensions: ["js", "ts"], - globals: { - - }, - transform: { - "^.+\\.ts?$": ["ts-jest", { isolatedModules: true }] - }, - testRegex: ".+\\.test\\.ts?$", - testEnvironment: "jsdom", - "reporters": [ "default", "jest-junit" ], - "collectCoverage": true, - "coverageReporters": [ "lcov", "text", "json"] -}; \ No newline at end of file + moduleFileExtensions: ['js', 'ts'], + globals: {}, + transform: { + '^.+\\.ts?$': ['ts-jest', { isolatedModules: true }], + }, + testRegex: '.+\\.test\\.ts?$', + testEnvironment: 'jsdom', + reporters: ['default', 'jest-junit'], + collectCoverage: true, + coverageReporters: ['lcov', 'text', 'json'], +}; diff --git a/packages/fdc3-standard/src/api/DesktopAgent.ts b/packages/fdc3-standard/src/api/DesktopAgent.ts index 0dc19ab69..890f63cba 100644 --- a/packages/fdc3-standard/src/api/DesktopAgent.ts +++ b/packages/fdc3-standard/src/api/DesktopAgent.ts @@ -376,24 +376,24 @@ export interface DesktopAgent { */ addContextListener(contextType: ContextType | null, handler: ContextHandler): Promise; - /** - * Register a handler for events from the Desktop Agent. Whenever the handler function + /** + * Register a handler for events from the Desktop Agent. Whenever the handler function * is called it will be passed an event object with details related to the event. - * + * * ```js * // any event type * const listener = await fdc3.addEventListener(null, event => { ... }); - * + * * // listener for a specific event type that logs its details - * const userChannelChangedListener = await fdc3.addEventListener("userChannelChanged", event => { + * const userChannelChangedListener = await fdc3.addEventListener("userChannelChanged", event => { * console.log(`Received event ${event.type}\n\tDetails: ${event.details}`); * //do something else with the event * }); * ``` - * - * @param {FDC3EventType|null} type If non-null, only events of the specified type will be received by the handler. - * @param {EventHandler} handler A function that events received will be passed to. - * + * + * @param {FDC3EventType|null} type If non-null, only events of the specified type will be received by the handler. + * @param {EventHandler} handler A function that events received will be passed to. + * */ addEventListener(type: FDC3EventTypes | null, handler: EventHandler): Promise; diff --git a/packages/fdc3-standard/src/api/Errors.ts b/packages/fdc3-standard/src/api/Errors.ts index 858f36118..3a55aef6b 100644 --- a/packages/fdc3-standard/src/api/Errors.ts +++ b/packages/fdc3-standard/src/api/Errors.ts @@ -3,112 +3,112 @@ * Copyright FINOS FDC3 contributors - see NOTICE file */ -/** - * Contains constants representing the errors that can be encountered when trying to connect to a web-based Desktop Agent with the getAgent function. - */ -export enum AgentError { - /** Returned if no Desktop Agent was found by any means available or - * if the Agent previously connected to is not contactable on a +/** + * Contains constants representing the errors that can be encountered when trying to connect to a web-based Desktop Agent with the getAgent function. + */ +export enum AgentError { + /** Returned if no Desktop Agent was found by any means available or + * if the Agent previously connected to is not contactable on a * subsequent connection attempt.*/ - AgentNotFound = "AgentNotFound", + AgentNotFound = 'AgentNotFound', - /** Returned if validation of the app identity by the Desktop Agent - * Failed or the app is not being allowed to connect to the Desktop Agent - * for another reason. */ - AccessDenied = "AccessDenied", + /** Returned if validation of the app identity by the Desktop Agent + * Failed or the app is not being allowed to connect to the Desktop Agent + * for another reason. */ + AccessDenied = 'AccessDenied', - /** Returned if an error or exception occurs while trying to set - * up communication with a Desktop Agent. */ - ErrorOnConnect = "ErrorOnConnect", + /** Returned if an error or exception occurs while trying to set + * up communication with a Desktop Agent. */ + ErrorOnConnect = 'ErrorOnConnect', /** Returned if the failover function is not a function, or it did not - * resolve to one of the allowed types. */ - InvalidFailover = "InvalidFailover", -}; + * resolve to one of the allowed types. */ + InvalidFailover = 'InvalidFailover', +} /** Constants representing the errors that can be encountered when calling the `open` method on the DesktopAgent object (`fdc3`). */ export enum OpenError { /** Returned if the specified application is not found.*/ - AppNotFound = "AppNotFound", + AppNotFound = 'AppNotFound', /** Returned if the specified application fails to launch correctly.*/ - ErrorOnLaunch = "ErrorOnLaunch", + ErrorOnLaunch = 'ErrorOnLaunch', /** Returned if the specified application launches but fails to add a context listener in order to receive the context passed to the `fdc3.open` call.*/ - AppTimeout = "AppTimeout", + AppTimeout = 'AppTimeout', /** Returned if the FDC3 desktop agent implementation is not currently able to handle the request.*/ - ResolverUnavailable = "ResolverUnavailable", + ResolverUnavailable = 'ResolverUnavailable', /** Returned if a call to the `open` function is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/ - MalformedContext = "MalformedContext", + MalformedContext = 'MalformedContext', /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/ - DesktopAgentNotFound = "DesktopAgentNotFound", + DesktopAgentNotFound = 'DesktopAgentNotFound', } /** Constants representing the errors that can be encountered when calling the `findIntent`, `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */ export enum ResolveError { /** SHOULD be returned if no apps are available that can resolve the intent and context combination.*/ - NoAppsFound = "NoAppsFound", + NoAppsFound = 'NoAppsFound', /** Returned if the FDC3 desktop agent implementation is not currently able to handle the request.*/ - ResolverUnavailable = "ResolverUnavailable", + ResolverUnavailable = 'ResolverUnavailable', /** Returned if the user cancelled the resolution request, for example by closing or cancelling a resolver UI.*/ - UserCancelled = "UserCancelledResolution", + UserCancelled = 'UserCancelledResolution', /** SHOULD be returned if a timeout cancels an intent resolution that required user interaction. Please use `ResolverUnavailable` instead for situations where a resolver UI or similar fails.*/ - ResolverTimeout = "ResolverTimeout", + ResolverTimeout = 'ResolverTimeout', /** Returned if a specified target application is not available or a new instance of it cannot be opened. */ - TargetAppUnavailable = "TargetAppUnavailable", + TargetAppUnavailable = 'TargetAppUnavailable', /** Returned if a specified target application instance is not available, for example because it has been closed. */ - TargetInstanceUnavailable = "TargetInstanceUnavailable", + TargetInstanceUnavailable = 'TargetInstanceUnavailable', /** Returned if the intent and context could not be delivered to the selected application or instance, for example because it has not added an intent handler within a timeout.*/ - IntentDeliveryFailed = "IntentDeliveryFailed", + IntentDeliveryFailed = 'IntentDeliveryFailed', /** Returned if a call to one of the `raiseIntent` functions is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/ - MalformedContext = "MalformedContext", + MalformedContext = 'MalformedContext', /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/ - DesktopAgentNotFound = "DesktopAgentNotFound", + DesktopAgentNotFound = 'DesktopAgentNotFound', } export enum ResultError { /** Returned if the intent handler exited without returning a valid result (a promise resolving to a Context, Channel object or void). */ - NoResultReturned = "NoResultReturned", + NoResultReturned = 'NoResultReturned', /** Returned if the Intent handler function processing the raised intent throws an error or rejects the Promise it returned. */ - IntentHandlerRejected = "IntentHandlerRejected", + IntentHandlerRejected = 'IntentHandlerRejected', } export enum ChannelError { /** Returned if the specified channel is not found when attempting to join a channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).*/ - NoChannelFound = "NoChannelFound", + NoChannelFound = 'NoChannelFound', /** SHOULD be returned when a request to join a user channel or to a retrieve a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods of the DesktopAgent (`fdc3`) object is denied. */ - AccessDenied = "AccessDenied", + AccessDenied = 'AccessDenied', /** SHOULD be returned when a channel cannot be created or retrieved via the `getOrCreateChannel` method of the DesktopAgent (`fdc3`).*/ - CreationFailed = "CreationFailed", + CreationFailed = 'CreationFailed', /** Returned if a call to the `broadcast` functions is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/ - MalformedContext = "MalformedContext", + MalformedContext = 'MalformedContext', } export enum BridgingError { /** @experimental Returned if a Desktop Agent did not return a response, via Desktop Agent Bridging, within the alloted timeout. */ - ResponseTimedOut = "ResponseToBridgeTimedOut", + ResponseTimedOut = 'ResponseToBridgeTimedOut', /** @experimental Returned if a Desktop Agent that has been targeted by a particular request has been disconnected from the Bridge before a response has been received from it. */ - AgentDisconnected = "AgentDisconnected", + AgentDisconnected = 'AgentDisconnected', /** @experimental Returned for FDC3 API calls that are specified with arguments indicating that a remote Desktop agent should be targeted (e.g. raiseIntent with an app on a remote DesktopAgent targeted), when the local Desktop Agent is not connected to a bridge. */ - NotConnectedToBridge = "NotConnectedToBridge", - + NotConnectedToBridge = 'NotConnectedToBridge', + /** @experimental Returned if a message to a Bridge deviates from the schema for that message sufficiently that it could not be processed. */ - MalformedMessage = "MalformedMessage", + MalformedMessage = 'MalformedMessage', } diff --git a/packages/fdc3-standard/src/api/Events.ts b/packages/fdc3-standard/src/api/Events.ts index bf507d74f..f1d46012a 100644 --- a/packages/fdc3-standard/src/api/Events.ts +++ b/packages/fdc3-standard/src/api/Events.ts @@ -6,7 +6,7 @@ /** * Type defining a basic event object that may be emitted by an FDC3 API interface * such as DesktopAgent or PrivateChannel. There are more specific event types - * defined for each interface. + * defined for each interface. */ export interface ApiEvent { readonly type: string; @@ -14,19 +14,18 @@ export interface ApiEvent { } /** Type representing a handler function for events from the Desktop Agent - * or a PrivateChannel. + * or a PrivateChannel. * @param event The handler function will be passed an `ApiEvent` (or more specifically - * an `FDC3Event` or `PrivateChannelEvent`) Object providing details of the event (such + * an `FDC3Event` or `PrivateChannelEvent`) Object providing details of the event (such * as a change of channel membership for the app, or type of context listener added) * as the only parameter. */ -export type EventHandler = (event: ApiEvent ) => void; +export type EventHandler = (event: ApiEvent) => void; /** * Type defining valid type strings for DesktopAgent interface events. */ -export type FDC3EventTypes = "userChannelChanged"; - +export type FDC3EventTypes = 'userChannelChanged'; /** * Type defining the format of event objects that may be received @@ -41,16 +40,16 @@ export interface FDC3Event extends ApiEvent { * Type defining the format of event `userChannelChanged` objects */ export interface FDC3ChannelChangedEvent extends FDC3Event { - readonly type: "userChannelChanged"; + readonly type: 'userChannelChanged'; readonly details: { - currentChannelId: string | null + currentChannelId: string | null; }; } /** * Type defining valid type strings for Private Channel events. */ -export type PrivateChannelEventTypes = "addContextListener" | "unsubscribe" | "disconnect"; +export type PrivateChannelEventTypes = 'addContextListener' | 'unsubscribe' | 'disconnect'; /** * Type defining the format of event objects that may be received @@ -62,43 +61,43 @@ export interface PrivateChannelEvent { } /** - * Type defining the format of events representing a context listener being - * added to the channel (`addContextListener`). Desktop Agents MUST fire this - * event for each invocation of `addContextListener` on the channel, including + * Type defining the format of events representing a context listener being + * added to the channel (`addContextListener`). Desktop Agents MUST fire this + * event for each invocation of `addContextListener` on the channel, including * those that occurred before this handler was registered (to prevent race * conditions). - * The context type of the listener added is provided as `details.contextType`, + * The context type of the listener added is provided as `details.contextType`, * which will be `null` if all event types are being listened to. */ export interface PrivateChannelAddContextListenerEvent extends PrivateChannelEvent { - readonly type: "addContextListener"; + readonly type: 'addContextListener'; readonly details: { - contextType: string | null + contextType: string | null; }; } /** - * Type defining the format of events representing a context listener - * removed from the channel (`Listener.unsubscribe()`). Desktop Agents MUST call - * this when `disconnect()` is called by the other party, for each listener that + * Type defining the format of events representing a context listener + * removed from the channel (`Listener.unsubscribe()`). Desktop Agents MUST call + * this when `disconnect()` is called by the other party, for each listener that * they had added. - * The context type of the listener removed is provided as `details.contextType`, + * The context type of the listener removed is provided as `details.contextType`, * which will be `null` if all event types were being listened to. */ export interface PrivateChannelUnsubscribeEvent extends PrivateChannelEvent { - readonly type: "unsubscribe"; + readonly type: 'unsubscribe'; readonly details: { - contextType: string | null + contextType: string | null; }; } /** * Type defining the format of events representing a remote app being terminated - * or otherwise disconnecting from the PrivateChannel. This event is in addition to + * or otherwise disconnecting from the PrivateChannel. This event is in addition to * unsubscribe events that will also be fired for any context listeners they had added. * No details are provided. */ export interface PrivateChannelDisconnectEvent extends PrivateChannelEvent { - readonly type: "disconnect"; + readonly type: 'disconnect'; readonly details: null | undefined; } diff --git a/packages/fdc3-standard/src/api/Methods.ts b/packages/fdc3-standard/src/api/Methods.ts index 64f6880cf..f8ba1a3c5 100644 --- a/packages/fdc3-standard/src/api/Methods.ts +++ b/packages/fdc3-standard/src/api/Methods.ts @@ -23,12 +23,12 @@ import { } from '..'; import { StandardContextsSet } from '../internal/contextConfiguration'; import { StandardIntentsSet } from '../internal/intentConfiguration'; -import { Context } from '@kite9/fdc3-context' +import { Context } from '@kite9/fdc3-context'; const UnavailableError = new Error('FDC3 DesktopAgent not available at `window.fdc3`.'); /** - * @deprecated This function depends on window.fdc3 (which may not be set for web-based Desktop Agents) + * @deprecated This function depends on window.fdc3 (which may not be set for web-based Desktop Agents) * and does not wait on the fdc3Ready event, so it may return errors on container-based Desktop Agents. * Use `const fdc3 = getAgent()` to retrieve (and wait for) a reference to the FDC3 API instead. */ @@ -40,10 +40,10 @@ function isString(app: AppIdentifier | string | undefined): app is string { return !!app && typeof app === 'string'; } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function open(app: AppIdentifier | string, context?: Context): Promise { if (isString(app)) { return window.fdc3 ? window.fdc3.open(app, context) : Promise.reject(UnavailableError); @@ -52,34 +52,34 @@ export function open(app: AppIdentifier | string, context?: Context): Promise { return window.fdc3 ? window.fdc3.findIntent(intent, context, resultType) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function findIntentsByContext(context: Context, resultType?: string): Promise { return window.fdc3 ? window.fdc3.findIntentsByContext(context, resultType) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function broadcast(context: Context): Promise { return window.fdc3 ? window.fdc3.broadcast(context) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function raiseIntent(intent: Intent, context: Context, app?: AppIdentifier | string): Promise { if (isString(app)) { return window.fdc3 ? window.fdc3.raiseIntent(intent, context, app) : Promise.reject(UnavailableError); @@ -88,10 +88,10 @@ export function raiseIntent(intent: Intent, context: Context, app?: AppIdentifie } } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function raiseIntentForContext(context: Context, app?: AppIdentifier | string): Promise { if (isString(app)) { return window.fdc3 ? window.fdc3.raiseIntentForContext(context, app) : Promise.reject(UnavailableError); @@ -100,42 +100,46 @@ export function raiseIntentForContext(context: Context, app?: AppIdentifier | st } } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function addIntentListener(intent: Intent, handler: IntentHandler): Promise { return window.fdc3 ? window.fdc3.addIntentListener(intent, handler) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function addContextListener( contextTypeOrHandler: ContextType | null | ContextHandler, handler?: ContextHandler ): Promise { //Handle (deprecated) function signature that allowed contextType argument to be omitted if (typeof contextTypeOrHandler !== 'function') { - return window.fdc3 ? window.fdc3.addContextListener(contextTypeOrHandler, handler as ContextHandler) : Promise.reject(UnavailableError); + return window.fdc3 + ? window.fdc3.addContextListener(contextTypeOrHandler, handler as ContextHandler) + : Promise.reject(UnavailableError); } else { - return window.fdc3 ? window.fdc3.addContextListener(null, contextTypeOrHandler as ContextHandler) : Promise.reject(UnavailableError); + return window.fdc3 + ? window.fdc3.addContextListener(null, contextTypeOrHandler as ContextHandler) + : Promise.reject(UnavailableError); } } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function addEventListener(eventType: FDC3EventTypes, handler: EventHandler): Promise { - return rejectIfNoGlobal((fdc3) => fdc3.addEventListener(eventType, handler)); + return rejectIfNoGlobal(fdc3 => fdc3.addEventListener(eventType, handler)); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getUserChannels(): Promise { if (window.fdc3) { //fallback to getSystemChannels for FDC3 <2.0 implementations @@ -146,22 +150,22 @@ export function getUserChannels(): Promise { } } else { return Promise.reject(UnavailableError); - }; + } } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getSystemChannels(): Promise { //fall-forward to getUserChannels for FDC3 2.0+ implementations return getUserChannels(); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function joinUserChannel(channelId: string): Promise { if (window.fdc3) { //fallback to joinChannel for FDC3 <2.0 implementations @@ -175,67 +179,67 @@ export function joinUserChannel(channelId: string): Promise { } } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function joinChannel(channelId: string): Promise { //fall-forward to joinUserChannel for FDC3 2.0+ implementations return joinUserChannel(channelId); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getOrCreateChannel(channelId: string): Promise { return window.fdc3 ? window.fdc3.getOrCreateChannel(channelId) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getCurrentChannel(): Promise { return window.fdc3 ? window.fdc3.getCurrentChannel() : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function leaveCurrentChannel(): Promise { return window.fdc3 ? window.fdc3.leaveCurrentChannel() : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function createPrivateChannel(): Promise { return window.fdc3 ? window.fdc3.createPrivateChannel() : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getInfo(): Promise { return window.fdc3 ? window.fdc3.getInfo() : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function getAppMetadata(app: AppIdentifier): Promise { return window.fdc3 ? window.fdc3.getAppMetadata(app) : Promise.reject(UnavailableError); } -/** +/** * @deprecated Importing individual FDC3 API calls is deprecated. Use `getAgent` to retrieve * an FDC3 API reference and use the functions that it provides instead. -*/ + */ export function findInstances(app: AppIdentifier): Promise { return window.fdc3 ? window.fdc3.findInstances(app) : Promise.reject(UnavailableError); } diff --git a/packages/fdc3-standard/src/api/PrivateChannel.ts b/packages/fdc3-standard/src/api/PrivateChannel.ts index f9a15fa09..922411466 100644 --- a/packages/fdc3-standard/src/api/PrivateChannel.ts +++ b/packages/fdc3-standard/src/api/PrivateChannel.ts @@ -21,30 +21,29 @@ import { EventHandler, PrivateChannelEventTypes } from './Events'; * - MUST provide the `id` value for the channel as required by the Channel interface. */ export interface PrivateChannel extends Channel { - - /** - * Register a handler for events from the PrivateChannel. Whenever the handler function + /** + * Register a handler for events from the PrivateChannel. Whenever the handler function * is called it will be passed an event object with details related to the event. - * + * * ```js * // any event type * const listener = await myPrivateChannel.addEventListener(null, event => { * console.log(`Received event ${event.type}\n\tDetails: ${event.details}`); * }); - * - * // listener for a specific event type + * + * // listener for a specific event type * const channelChangedListener = await myPrivateChannel.addEventListener( - * "addContextListener", + * "addContextListener", * event => { ... } * ); * ``` - * - * @param {PrivateChannelEventType | null} type If non-null, only events of the specified type will be received by the handler. - * @param {EventHandler} handler A function that events received will be passed to. - * - */ - addEventListener(type: PrivateChannelEventTypes | null, handler: EventHandler): Promise; - + * + * @param {PrivateChannelEventType | null} type If non-null, only events of the specified type will be received by the handler. + * @param {EventHandler} handler A function that events received will be passed to. + * + */ + addEventListener(type: PrivateChannelEventTypes | null, handler: EventHandler): Promise; + /** * May be called to indicate that a participant will no longer interact with this channel. * @@ -61,7 +60,7 @@ export interface PrivateChannel extends Channel { /** * @deprecated use `addEventListener("addContextListener", handler)` instead. - * + * * Adds a listener that will be called each time that the remote app invokes * addContextListener on this channel. * @@ -73,7 +72,7 @@ export interface PrivateChannel extends Channel { /** * @deprecated use `addEventListener("unsubscribe", handler)` instead. - * + * * Adds a listener that will be called whenever the remote app invokes * Listener.unsubscribe() on a context listener that it previously added. * @@ -84,7 +83,7 @@ export interface PrivateChannel extends Channel { /** * @deprecated use `addEventListener("disconnect", handler)` instead. - * + * * Adds a listener that will be called when the remote app terminates, for example * when its window is closed or because disconnect was called. This is in addition * to calls that will be made to onUnsubscribe listeners. diff --git a/packages/fdc3-standard/src/api/Types.ts b/packages/fdc3-standard/src/api/Types.ts index 1329b53dc..c20c461b8 100644 --- a/packages/fdc3-standard/src/api/Types.ts +++ b/packages/fdc3-standard/src/api/Types.ts @@ -4,7 +4,7 @@ */ import { Channel, ContextMetadata } from '..'; -import { Context } from '@kite9/fdc3-context' +import { Context } from '@kite9/fdc3-context'; /** * Describes a callback that handles a context event. diff --git a/packages/fdc3-standard/src/app-directory/specification/test/index.js b/packages/fdc3-standard/src/app-directory/specification/test/index.js index 516bd3884..dd035292e 100644 --- a/packages/fdc3-standard/src/app-directory/specification/test/index.js +++ b/packages/fdc3-standard/src/app-directory/specification/test/index.js @@ -1,7 +1,7 @@ -import SwaggerParser from "@apidevtools/swagger-parser"; +import SwaggerParser from '@apidevtools/swagger-parser'; import { Validator } from 'jsonschema'; -import exampleApplication1 from '../examples/application/myApplication.json' with { type: "json" }; -import exampleApplication2 from '../examples/application/fdc3-workbench.json' with { type: "json" }; +import exampleApplication1 from '../examples/application/myApplication.json' with { type: 'json' }; +import exampleApplication2 from '../examples/application/fdc3-workbench.json' with { type: 'json' }; import { strict as assert } from 'assert'; (async () => { diff --git a/packages/fdc3-standard/src/index.ts b/packages/fdc3-standard/src/index.ts index f784c1108..1df3cdd52 100644 --- a/packages/fdc3-standard/src/index.ts +++ b/packages/fdc3-standard/src/index.ts @@ -5,7 +5,6 @@ import { DesktopAgent } from './api/DesktopAgent'; - //explicit overwrite of conflicting & equivalent export from ContextTypes export { AppIdentifier } from './api/AppIdentifier'; export * from './api/AppIntent'; @@ -32,10 +31,10 @@ export * from './context/ContextType'; export * from './intents/Intents'; export * from './ui/IntentResolver'; export * from './ui/ChannelSelector'; -export * from './ui/Connectable' +export * from './ui/Connectable'; declare global { interface Window { fdc3?: DesktopAgent; } -} \ No newline at end of file +} diff --git a/packages/fdc3-standard/src/internal/typeHelpers.ts b/packages/fdc3-standard/src/internal/typeHelpers.ts index bc3583497..f30fd507a 100644 --- a/packages/fdc3-standard/src/internal/typeHelpers.ts +++ b/packages/fdc3-standard/src/internal/typeHelpers.ts @@ -3,10 +3,13 @@ type AtLeastOne = [T, ...T[]]; /** * Ensures at compile time that the given string tuple is exhaustive on a given union type, i.e. contains ALL possible values of the given UNION_TYPE. */ -export const exhaustiveStringTuple = () => >( - ...tuple: L extends any - ? Exclude extends never - ? L - : Exclude[] - : never -) => tuple; +export const exhaustiveStringTuple = + () => + >( + ...tuple: L extends any + ? Exclude extends never + ? L + : Exclude[] + : never + ) => + tuple; diff --git a/packages/fdc3-standard/src/ui/ChannelSelector.ts b/packages/fdc3-standard/src/ui/ChannelSelector.ts index 61c23b541..7c6ab4aa5 100644 --- a/packages/fdc3-standard/src/ui/ChannelSelector.ts +++ b/packages/fdc3-standard/src/ui/ChannelSelector.ts @@ -1,20 +1,18 @@ -import { Channel } from "../api/Channel" -import { Connectable } from "../ui/Connectable" +import { Channel } from '../api/Channel'; +import { Connectable } from '../ui/Connectable'; /** * Interface used by the desktop agent proxy to handle the channel selection process. */ export interface ChannelSelector extends Connectable { + /** + * Called when the list of user channels is updated, or the selected channel changes. + */ + updateChannel(channelId: string | null, availableChannels: Channel[]): void; - /** - * Called when the list of user channels is updated, or the selected channel changes. - */ - updateChannel(channelId: string | null, availableChannels: Channel[]): void - - /** - * Called on initialisation. The channel selector will invoke the callback after the - * channel is changed. - */ - setChannelChangeCallback(callback: (channelId: string | null) => void): void - + /** + * Called on initialisation. The channel selector will invoke the callback after the + * channel is changed. + */ + setChannelChangeCallback(callback: (channelId: string | null) => void): void; } diff --git a/packages/fdc3-standard/src/ui/Connectable.ts b/packages/fdc3-standard/src/ui/Connectable.ts index 3459e7028..5da54767f 100644 --- a/packages/fdc3-standard/src/ui/Connectable.ts +++ b/packages/fdc3-standard/src/ui/Connectable.ts @@ -1,6 +1,5 @@ export interface Connectable { + connect(): Promise; - connect(): Promise - - disconnect(): Promise -} \ No newline at end of file + disconnect(): Promise; +} diff --git a/packages/fdc3-standard/src/ui/IntentResolver.ts b/packages/fdc3-standard/src/ui/IntentResolver.ts index bbd54e0d4..1724a47b9 100644 --- a/packages/fdc3-standard/src/ui/IntentResolver.ts +++ b/packages/fdc3-standard/src/ui/IntentResolver.ts @@ -1,23 +1,20 @@ -import { Context } from "@kite9/fdc3-context"; -import { AppIdentifier } from "../api/AppIdentifier"; -import { AppIntent } from "../api/AppIntent"; -import { Connectable } from "./Connectable"; - +import { Context } from '@kite9/fdc3-context'; +import { AppIdentifier } from '../api/AppIdentifier'; +import { AppIntent } from '../api/AppIntent'; +import { Connectable } from './Connectable'; export type IntentResolutionChoice = { - intent: string, - appId: AppIdentifier -} + intent: string; + appId: AppIdentifier; +}; /** * Interface used by the desktop agent proxy to handle the intent resolution process. */ export interface IntentResolver extends Connectable { - - /** - * Called when the user needs to resolve an intent. Returns either the app chosen to - * resolve the intent or void if the operation was cancelled. - */ - chooseIntent(appIntents: AppIntent[], context: Context): Promise + /** + * Called when the user needs to resolve an intent. Returns either the app chosen to + * resolve the intent or void if the operation was cancelled. + */ + chooseIntent(appIntents: AppIntent[], context: Context): Promise; } - diff --git a/packages/fdc3-standard/test/Methods.test.ts b/packages/fdc3-standard/test/Methods.test.ts index 2d8546c48..33ba75733 100644 --- a/packages/fdc3-standard/test/Methods.test.ts +++ b/packages/fdc3-standard/test/Methods.test.ts @@ -97,7 +97,6 @@ describe('test ES6 module', () => { await expect(getUserChannels()).rejects.toEqual(UnavailableError); }); - test('addEventListener should reject', async () => { await expect(addEventListener(expect.any(String), expect.any(Object))).rejects.toEqual(UnavailableError); }); @@ -145,7 +144,7 @@ describe('test ES6 module', () => { }); afterAll(() => { - window.fdc3 = (undefined as unknown) as DesktopAgent; + window.fdc3 = undefined as unknown as DesktopAgent; }); test('open should delegate to window.fdc3.open', async () => { @@ -217,7 +216,7 @@ describe('test ES6 module', () => { test('addIntentListener should delegate to window.fdc3.addIntentListener', async () => { const intent = 'ViewChart'; - const handler: ContextHandler = _ => { }; + const handler: ContextHandler = _ => {}; await addIntentListener(intent, handler); @@ -227,8 +226,8 @@ describe('test ES6 module', () => { test('addContextListener should delegate to window.fdc3.addContextListener', async () => { const type = 'fdc3.instrument'; - const handler1: ContextHandler = _ => { }; - const handler2: ContextHandler = _ => { }; + const handler1: ContextHandler = _ => {}; + const handler2: ContextHandler = _ => {}; await addContextListener(type, handler1); await addContextListener(handler2); @@ -322,8 +321,6 @@ describe('test ES6 module', () => { expect(window.fdc3.findInstances).toHaveBeenCalledWith(dummyApp); }); }); - - }); describe('test version comparison functions', () => { diff --git a/packages/fdc3/src/index.ts b/packages/fdc3/src/index.ts index 635698a68..ce819e58d 100644 --- a/packages/fdc3/src/index.ts +++ b/packages/fdc3/src/index.ts @@ -1,19 +1,18 @@ +export * from '@kite9/fdc3-context'; -export * from "@kite9/fdc3-context" - -import { BrowserTypes, BridgingTypes } from "@kite9/fdc3-schema"; +import { BrowserTypes, BridgingTypes } from '@kite9/fdc3-schema'; export { BridgingTypes, BrowserTypes }; -import { DesktopAgent, AppIdentifier } from "@kite9/fdc3-standard"; +import { DesktopAgent, AppIdentifier } from '@kite9/fdc3-standard'; export * from '@kite9/fdc3-standard'; export { AppIdentifier }; -import { getAgent, fdc3Ready } from "@kite9/fdc3-get-agent"; +import { getAgent, fdc3Ready } from '@kite9/fdc3-get-agent'; export { getAgent, fdc3Ready }; /** Might not be needed */ declare global { - interface Window { - fdc3?: DesktopAgent; - } -} \ No newline at end of file + interface Window { + fdc3?: DesktopAgent; + } +} diff --git a/packages/testing/src/agent/index.ts b/packages/testing/src/agent/index.ts index e299672d1..e61bdf51c 100644 --- a/packages/testing/src/agent/index.ts +++ b/packages/testing/src/agent/index.ts @@ -1,72 +1,63 @@ -import { AppIntent, Channel, IntentResult } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; -import { IntentResolver, IntentResolutionChoice, ChannelSelector } from "@kite9/fdc3-standard"; -import { PropsWorld } from "../world"; +import { AppIntent, Channel, IntentResult } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; +import { IntentResolver, IntentResolutionChoice, ChannelSelector } from '@kite9/fdc3-standard'; +import { PropsWorld } from '../world'; /** * This super-simple intent resolver just resolves to the first * intent / app in the list, unless the context is fdc3.cancel-me and then it just cancels. */ export class SimpleIntentResolver implements IntentResolver { + cw: PropsWorld; - cw: PropsWorld + constructor(cw: PropsWorld) { + this.cw = cw; + } - constructor(cw: PropsWorld) { - this.cw = cw; - } + async connect(): Promise {} - async connect(): Promise { - } + async disconnect(): Promise {} - async disconnect(): Promise { - } + async intentChosen(ir: IntentResult): Promise { + this.cw.props['intent-result'] = ir; + return ir; + } - async intentChosen(ir: IntentResult): Promise { - this.cw.props['intent-result'] = ir - return ir + async chooseIntent(appIntents: AppIntent[], ctx: Context): Promise { + if (ctx.type == 'fdc3.cancel-me') { + return; } - async chooseIntent(appIntents: AppIntent[], ctx: Context): Promise { - if (ctx.type == 'fdc3.cancel-me') { - return; - } - - const out = { - intent: appIntents[0].intent, - chosenApp: appIntents[0].apps[0] - } + const out = { + intent: appIntents[0].intent, + chosenApp: appIntents[0].apps[0], + }; - this.cw.props['intent-resolution'] = out - return { - appId: appIntents[0].apps[0], - intent: appIntents[0].intent.name - } - } + this.cw.props['intent-resolution'] = out; + return { + appId: appIntents[0].apps[0], + intent: appIntents[0].intent.name, + }; + } } -export const CHANNEL_STATE = 'CHANNEL_STATE' +export const CHANNEL_STATE = 'CHANNEL_STATE'; export class SimpleChannelSelector implements ChannelSelector { + cw: PropsWorld; - cw: PropsWorld + constructor(cw: PropsWorld) { + this.cw = cw; + } - constructor(cw: PropsWorld) { - this.cw = cw; - } + updateChannel(channelId: string | null, availableChannels: Channel[]): void { + this.cw.props['channelId'] = channelId; + this.cw.props['channels'] = availableChannels; + } - updateChannel(channelId: string | null, availableChannels: Channel[]): void { - this.cw.props['channelId'] = channelId - this.cw.props['channels'] = availableChannels - } + setChannelChangeCallback(_callback: (channelId: string | null) => void): void {} - setChannelChangeCallback(_callback: (channelId: string | null) => void): void { - } - - async connect(): Promise { - } - - async disconnect(): Promise { - } + async connect(): Promise {} + async disconnect(): Promise {} } - diff --git a/packages/testing/src/index.ts b/packages/testing/src/index.ts index eb26eec2d..5c99d48c6 100644 --- a/packages/testing/src/index.ts +++ b/packages/testing/src/index.ts @@ -1,19 +1,19 @@ -import { setupGenericSteps } from "./steps/generic.steps"; -import { doesRowMatch, handleResolve, indexOf, matchData } from './support/matching' -import { PropsWorld } from "./world"; +import { setupGenericSteps } from './steps/generic.steps'; +import { doesRowMatch, handleResolve, indexOf, matchData } from './support/matching'; +import { PropsWorld } from './world'; import Ajv2019 from 'ajv/dist/2019'; -import addFormats from "ajv-formats" -import { SimpleIntentResolver, CHANNEL_STATE } from "./agent"; +import addFormats from 'ajv-formats'; +import { SimpleIntentResolver, CHANNEL_STATE } from './agent'; export { - PropsWorld, - doesRowMatch, - handleResolve, - indexOf, - matchData, - setupGenericSteps, - SimpleIntentResolver, - addFormats, - Ajv2019, - CHANNEL_STATE -} \ No newline at end of file + PropsWorld, + doesRowMatch, + handleResolve, + indexOf, + matchData, + setupGenericSteps, + SimpleIntentResolver, + addFormats, + Ajv2019, + CHANNEL_STATE, +}; diff --git a/packages/testing/src/steps/generic.steps.ts b/packages/testing/src/steps/generic.steps.ts index b8f07ef24..3b9dc8d2b 100644 --- a/packages/testing/src/steps/generic.steps.ts +++ b/packages/testing/src/steps/generic.steps.ts @@ -1,7 +1,7 @@ -import { DataTable, Given, Then, When } from '@cucumber/cucumber' -import Ajv2019 from "ajv/dist/2019"; -import * as draft7MetaSchema from "ajv/dist/refs/json-schema-draft-07.json" -import addFormats from "ajv-formats" +import { DataTable, Given, Then, When } from '@cucumber/cucumber'; +import Ajv2019 from 'ajv/dist/2019'; +import * as draft7MetaSchema from 'ajv/dist/refs/json-schema-draft-07.json'; +import addFormats from 'ajv-formats'; import { expect } from 'expect'; import { doesRowMatch, handleResolve, matchData } from '../support/matching'; import { PropsWorld } from '../world'; @@ -9,167 +9,197 @@ import fs from 'fs'; import path from 'path'; export function setupGenericSteps() { - - When('the promise {string} should resolve', async function (this: PropsWorld, field: string) { - try { - const promise = handleResolve(field, this) - const object = await promise - this.props['result'] = object - } catch (error) { - this.props['result'] = error - } - }) - - When('I call {string} with {string}', async function (this: PropsWorld, field: string, fnName: string) { - try { - const object = handleResolve(field, this) - const fn = object[fnName]; - const result = await fn.call(object) - this.props['result'] = result; - } catch (error) { - this.props['result'] = error - } - }) - - When('I call {string} with {string} with parameter {string}', async function (this: PropsWorld, field: string, fnName: string, param: string) { - try { - const object = handleResolve(field, this) - const fn = object[fnName]; - const result = await fn.call(object, handleResolve(param, this)) - this.props['result'] = result; - } catch (error) { - this.props['result'] = error - } - }) - - When('I call {string} with {string} with parameters {string} and {string}', async function (this: PropsWorld, field: string, fnName: string, param1: string, param2: string) { - try { - const object = handleResolve(field, this) - const fn = object[fnName]; - const result = await fn.call(object, handleResolve(param1, this), handleResolve(param2, this)) - this.props['result'] = result; - } catch (error) { - this.props['result'] = error - } + When('the promise {string} should resolve', async function (this: PropsWorld, field: string) { + try { + const promise = handleResolve(field, this); + const object = await promise; + this.props['result'] = object; + } catch (error) { + this.props['result'] = error; + } + }); + + When('I call {string} with {string}', async function (this: PropsWorld, field: string, fnName: string) { + try { + const object = handleResolve(field, this); + const fn = object[fnName]; + const result = await fn.call(object); + this.props['result'] = result; + } catch (error) { + this.props['result'] = error; + } + }); + + When( + 'I call {string} with {string} with parameter {string}', + async function (this: PropsWorld, field: string, fnName: string, param: string) { + try { + const object = handleResolve(field, this); + const fn = object[fnName]; + const result = await fn.call(object, handleResolve(param, this)); + this.props['result'] = result; + } catch (error) { + this.props['result'] = error; + } + } + ); + + When( + 'I call {string} with {string} with parameters {string} and {string}', + async function (this: PropsWorld, field: string, fnName: string, param1: string, param2: string) { + try { + const object = handleResolve(field, this); + const fn = object[fnName]; + const result = await fn.call(object, handleResolve(param1, this), handleResolve(param2, this)); + this.props['result'] = result; + } catch (error) { + this.props['result'] = error; + } + } + ); + + When( + 'I call {string} with {string} with parameters {string} and {string} and {string}', + async function (this: PropsWorld, field: string, fnName: string, param1: string, param2: string, param3: string) { + try { + const object = handleResolve(field, this); + const fn = object[fnName]; + const result = await fn.call( + object, + handleResolve(param1, this), + handleResolve(param2, this), + handleResolve(param3, this) + ); + this.props['result'] = result; + } catch (error) { + this.props['result'] = error; + } + } + ); + + When('I refer to {string} as {string}', async function (this: PropsWorld, from: string, to: string) { + this.props[to] = handleResolve(from, this); + }); + + Then( + '{string} is an array of objects with the following contents', + function (this: PropsWorld, field: string, dt: DataTable) { + matchData(this, handleResolve(field, this), dt); + } + ); + + Then( + '{string} is an array of strings with the following values', + function (this: PropsWorld, field: string, dt: DataTable) { + const values = handleResolve(field, this).map((s: string) => { + return { value: s }; + }); + matchData(this, values, dt); + } + ); + + Then( + '{string} is an object with the following contents', + function (this: PropsWorld, field: string, params: DataTable) { + const table = params.hashes(); + expect(doesRowMatch(this, table[0], handleResolve(field, this))).toBeTruthy(); + } + ); + + Then('{string} is null', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toBeNull(); + }); + + Then('{string} is not null', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toBeDefined(); + }); + + Then('{string} is true', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toBeTruthy(); + }); + + Then('{string} is false', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toBeFalsy(); + }); + + Then('{string} is undefined', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toBeUndefined(); + }); + + Then('{string} is empty', function (this: PropsWorld, field: string) { + expect(handleResolve(field, this)).toHaveLength(0); + }); + + Then('{string} is {string}', function (this: PropsWorld, field: string, expected: string) { + const fVal = handleResolve(field, this); + const eVal = handleResolve(expected, this); + expect('' + fVal).toEqual('' + eVal); + }); + + Then('{string} is an error with message {string}', function (this: PropsWorld, field: string, errorType: string) { + expect(handleResolve(field, this)['message']).toBe(errorType); + }); + + Given( + '{string} is a invocation counter into {string}', + function (this: PropsWorld, handlerName: string, field: string) { + this.props[handlerName] = () => { + var amount: number = this.props[field]; + amount++; + this.props[field] = amount; + }; + this.props[field] = 0; + } + ); + + Given( + '{string} is a function which returns a promise of {string}', + function (this: PropsWorld, fnName: string, field: string) { + const value = handleResolve(field, this); + this.props[fnName] = async () => { + return value; + }; + } + ); + + Given('we wait for a period of {string} ms', function (this: PropsWorld, ms: string) { + return new Promise((resolve, _reject) => { + setTimeout(() => resolve(), parseInt(ms)); }); + }); - When('I call {string} with {string} with parameters {string} and {string} and {string}', async function (this: PropsWorld, field: string, fnName: string, param1: string, param2: string, param3: string) { - try { - const object = handleResolve(field, this) - const fn = object[fnName]; - const result = await fn.call(object, handleResolve(param1, this), handleResolve(param2, this), handleResolve(param3, this)) - this.props['result'] = result; - } catch (error) { - this.props['result'] = error - } - }); + Given('schemas loaded', async function (this: PropsWorld) { + const ajv = new Ajv2019(); + ajv.addMetaSchema(draft7MetaSchema); + addFormats(ajv); - When('I refer to {string} as {string}', async function (this: PropsWorld, from: string, to: string) { - this.props[to] = handleResolve(from, this); - }) + const f2 = fs; + const p = path; - Then('{string} is an array of objects with the following contents', function (this: PropsWorld, field: string, dt: DataTable) { - matchData(this, handleResolve(field, this), dt) - }); + const schemaDir = p.join(__dirname, '../../../../fdc3-schema/schemas'); + const contextDir = p.join(__dirname, '../../../../fdc3-context/schemas'); - Then('{string} is an array of strings with the following values', function (this: PropsWorld, field: string, dt: DataTable) { - const values = handleResolve(field, this).map((s: string) => { return { "value": s } }) - matchData(this, values, dt) - }); + const abspath = p.join(schemaDir, 'api'); - Then('{string} is an object with the following contents', function (this: PropsWorld, field: string, params: DataTable) { - const table = params.hashes() - expect(doesRowMatch(this, table[0], handleResolve(field, this))).toBeTruthy(); - }); - - Then('{string} is null', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toBeNull() - }) - - Then('{string} is not null', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toBeDefined() - }) - - Then('{string} is true', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toBeTruthy() - }) - - Then('{string} is false', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toBeFalsy() - }) - - Then('{string} is undefined', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toBeUndefined() - }) - - Then('{string} is empty', function (this: PropsWorld, field: string) { - expect(handleResolve(field, this)).toHaveLength(0) - }) - - Then('{string} is {string}', function (this: PropsWorld, field: string, expected: string) { - const fVal = handleResolve(field, this) - const eVal = handleResolve(expected, this) - expect("" + fVal).toEqual("" + eVal) - }) - - Then('{string} is an error with message {string}', function (this: PropsWorld, field: string, errorType: string) { - expect(handleResolve(field, this)['message']).toBe(errorType) - }) - - Given('{string} is a invocation counter into {string}', function (this: PropsWorld, handlerName: string, field: string) { - this.props[handlerName] = () => { - var amount: number = this.props[field] - amount++; - this.props[field] = amount - } - this.props[field] = 0; - }) - - Given('{string} is a function which returns a promise of {string}', function (this: PropsWorld, fnName: string, field: string) { - const value = handleResolve(field, this) - this.props[fnName] = async () => { - return value + try { + f2.readdirSync(abspath).forEach(file => { + if (file.endsWith('.json')) { + const filePath = p.join(abspath, file); + const contents = fs.readFileSync(filePath, 'utf8'); + const schema = JSON.parse(contents); + ajv.addSchema(schema); + //console.log(`Content of ${file}: ${contents}`); } - }) - - Given('we wait for a period of {string} ms', function (this: PropsWorld, ms: string) { - return new Promise((resolve, _reject) => { - setTimeout(() => resolve(), parseInt(ms)) - }) - }); - - Given('schemas loaded', async function (this: PropsWorld) { - const ajv = new Ajv2019(); - ajv.addMetaSchema(draft7MetaSchema) - addFormats(ajv); - - const f2 = fs - const p = path - - const schemaDir = p.join(__dirname, '../../../../fdc3-schema/schemas') - const contextDir = p.join(__dirname, '../../../../fdc3-context/schemas') - - const abspath = p.join(schemaDir, 'api') - - try { - f2.readdirSync(abspath).forEach(file => { - if (file.endsWith('.json')) { - const filePath = p.join(abspath, file); - const contents = fs.readFileSync(filePath, 'utf8'); - const schema = JSON.parse(contents); - ajv.addSchema(schema); - //console.log(`Content of ${file}: ${contents}`); - } - }); - } catch (error) { - console.log(error) - } - - const contextPath = p.join(contextDir, 'context/context.schema.json') - const contents = fs.readFileSync(contextPath, 'utf8') - const schema = JSON.parse(contents); - ajv.addSchema(schema); - - this.props['ajv'] = ajv; - }) + }); + } catch (error) { + console.log(error); + } + + const contextPath = p.join(contextDir, 'context/context.schema.json'); + const contents = fs.readFileSync(contextPath, 'utf8'); + const schema = JSON.parse(contents); + ajv.addSchema(schema); + + this.props['ajv'] = ajv; + }); } diff --git a/packages/testing/src/support/matching.ts b/packages/testing/src/support/matching.ts index f4c75df7d..ec7ce3c2e 100644 --- a/packages/testing/src/support/matching.ts +++ b/packages/testing/src/support/matching.ts @@ -1,101 +1,102 @@ -import { JSONPath } from "jsonpath-plus"; -import { PropsWorld } from "../world"; -import expect from "expect"; -import { DataTable } from "@cucumber/cucumber"; -import Ajv from "ajv/dist/2019"; +import { JSONPath } from 'jsonpath-plus'; +import { PropsWorld } from '../world'; +import expect from 'expect'; +import { DataTable } from '@cucumber/cucumber'; +import Ajv from 'ajv/dist/2019'; export function doesRowMatch(cw: PropsWorld, t: Record, data: any): boolean { + for (const [field, actual] of Object.entries(t)) { + if (field.endsWith('matches_type')) { + // validation mode + var valdata = data; - for (const [field, actual] of Object.entries(t)) { - if (field.endsWith('matches_type')) { - // validation mode - var valdata = data + if (field.length > 'matches_type'.length) { + // deals with the case where we're validating part of the object + const path = field.substring(0, field.length - 'matches_type'.length - 1); + valdata = JSONPath({ path: path, json: data })[0]; + } - if (field.length > 'matches_type'.length) { - // deals with the case where we're validating part of the object - const path = field.substring(0, field.length - 'matches_type'.length - 1) - valdata = JSONPath({ path: path, json: data })[0]; - } - - const validator: Ajv = cw.props['ajv'] - const validate = validator.getSchema('https://fdc3.finos.org/schemas/next/api/' + actual + '.schema.json') - if (validate == undefined) { - throw Error("No schema found for " + actual) - } - const valid = validate(valdata) - if (!valid) { - try { - cw.log(`Comparing Validation failed: ${JSON.stringify(data, null, 2)} \n ${JSON.stringify(validate.errors)}`) - } catch (e) { - cw.log(`Comparing Validation failed: ${JSON.stringify(validate.errors)}`) - } - return false - } - } else { - const found = JSONPath({ path: field, json: data })[0]; - const resolved = handleResolve(actual, cw) + const validator: Ajv = cw.props['ajv']; + const validate = validator.getSchema('https://fdc3.finos.org/schemas/next/api/' + actual + '.schema.json'); + if (validate == undefined) { + throw Error('No schema found for ' + actual); + } + const valid = validate(valdata); + if (!valid) { + try { + cw.log(`Comparing Validation failed: ${JSON.stringify(data, null, 2)} \n ${JSON.stringify(validate.errors)}`); + } catch (e) { + cw.log(`Comparing Validation failed: ${JSON.stringify(validate.errors)}`); + } + return false; + } + } else { + const found = JSONPath({ path: field, json: data })[0]; + const resolved = handleResolve(actual, cw); - if (found != resolved) { - try { - cw.log(`Comparing Validation failed: ${JSON.stringify(data, null, 2)} \n Match failed on ${field} '${found}' vs '${resolved}'`) - } catch (e) { - cw.log("Match failed on " + field + " '" + found + "' vs '" + resolved + "'") - } - return false; - } + if (found != resolved) { + try { + cw.log( + `Comparing Validation failed: ${JSON.stringify(data, null, 2)} \n Match failed on ${field} '${found}' vs '${resolved}'` + ); + } catch (e) { + cw.log('Match failed on ' + field + " '" + found + "' vs '" + resolved + "'"); } + return false; + } } + } - return true; + return true; } export function indexOf(cw: PropsWorld, rows: Record[], data: any): number { - for (var i = 0; i < rows.length; i++) { - if (doesRowMatch(cw, rows[i], data)) { - return i; - } + for (var i = 0; i < rows.length; i++) { + if (doesRowMatch(cw, rows[i], data)) { + return i; } + } - return -1; + return -1; } export function handleResolve(name: string, on: PropsWorld): any { - if (name.startsWith("{") && name.endsWith("}")) { - const stripped = name.substring(1, name.length - 1) - if (stripped == 'null') { - return null - } else if (stripped == 'true') { - return true - } else if (stripped == 'false') { - return false - } else { - const out = JSONPath({ path: stripped, json: on.props })[0]; - return out - } + if (name.startsWith('{') && name.endsWith('}')) { + const stripped = name.substring(1, name.length - 1); + if (stripped == 'null') { + return null; + } else if (stripped == 'true') { + return true; + } else if (stripped == 'false') { + return false; } else { - return name + const out = JSONPath({ path: stripped, json: on.props })[0]; + return out; } + } else { + return name; + } } export function matchData(cw: PropsWorld, actual: any[], dt: DataTable) { - const tableData = dt.hashes(); - const rowCount = tableData.length + const tableData = dt.hashes(); + const rowCount = tableData.length; - var resultCopy = JSON.parse(JSON.stringify(actual)) as any[]; - cw.log(`result ${JSON.stringify(resultCopy, null, 2)} length ${resultCopy.length}`) - expect(resultCopy).toHaveLength(rowCount); - var row = 0 + var resultCopy = JSON.parse(JSON.stringify(actual)) as any[]; + cw.log(`result ${JSON.stringify(resultCopy, null, 2)} length ${resultCopy.length}`); + expect(resultCopy).toHaveLength(rowCount); + var row = 0; - resultCopy = resultCopy.filter(rr => { - const matchingRow = tableData[row] - row++; - if (doesRowMatch(cw, matchingRow, rr)) { - return false - } else { - cw.log(`Couldn't match row: ${JSON.stringify(rr, null, 2)}`) - return true - } - }) + resultCopy = resultCopy.filter(rr => { + const matchingRow = tableData[row]; + row++; + if (doesRowMatch(cw, matchingRow, rr)) { + return false; + } else { + cw.log(`Couldn't match row: ${JSON.stringify(rr, null, 2)}`); + return true; + } + }); - expect(resultCopy).toHaveLength(0) -} \ No newline at end of file + expect(resultCopy).toHaveLength(0); +} diff --git a/packages/testing/src/world/index.ts b/packages/testing/src/world/index.ts index a85a65c97..f4794a3ad 100644 --- a/packages/testing/src/world/index.ts +++ b/packages/testing/src/world/index.ts @@ -1,8 +1,5 @@ -import { World } from "@cucumber/cucumber"; +import { World } from '@cucumber/cucumber'; export class PropsWorld extends World { - - props: Record = {} - + props: Record = {}; } - diff --git a/src/bridging/BridgingTypes.ts b/src/bridging/BridgingTypes.ts index 4a7b7e98a..9a15a3887 100644 --- a/src/bridging/BridgingTypes.ts +++ b/src/bridging/BridgingTypes.ts @@ -77,33 +77,33 @@ * preference to the standard response when an error needs to be returned. */ export interface AgentErrorResponseMessage { - meta: AgentResponseMetadata; - /** - * Error message payload containing an standardized error string. - */ - payload: ErrorResponseMessagePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: ResponseMessageType; + meta: AgentResponseMetadata; + /** + * Error message payload containing an standardized error string. + */ + payload: ErrorResponseMessagePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: ResponseMessageType; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface AgentResponseMetadata { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface ErrorResponseMessagePayload { - error: ResponseErrorDetail; - [property: string]: any; + error: ResponseErrorDetail; + [property: string]: any; } /** @@ -118,47 +118,75 @@ export interface ErrorResponseMessagePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type ResponseErrorDetail = "AccessDenied" | "CreationFailed" | "MalformedContext" | "NoChannelFound" | "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "ResolverUnavailable" | "IntentDeliveryFailed" | "NoAppsFound" | "ResolverTimeout" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type ResponseErrorDetail = + | 'AccessDenied' + | 'CreationFailed' + | 'MalformedContext' + | 'NoChannelFound' + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'ResolverUnavailable' + | 'IntentDeliveryFailed' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that * the message relates to, e.g. 'findIntent', with 'Response' appended. */ -export type ResponseMessageType = "findInstancesResponse" | "findIntentResponse" | "findIntentsByContextResponse" | "getAppMetadataResponse" | "openResponse" | "raiseIntentResponse" | "raiseIntentResultResponse"; +export type ResponseMessageType = + | 'findInstancesResponse' + | 'findIntentResponse' + | 'findIntentsByContextResponse' + | 'getAppMetadataResponse' + | 'openResponse' + | 'raiseIntentResponse' + | 'raiseIntentResultResponse'; /** * A request message from a Desktop Agent to the Bridge. */ export interface AgentRequestMessage { - meta: AgentRequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: RequestMessageType; + meta: AgentRequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: RequestMessageType; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface AgentRequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** @@ -210,25 +238,25 @@ export interface AgentRequestMetadata { * received the intent. */ export interface BridgeParticipantIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId?: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -272,47 +300,60 @@ export interface BridgeParticipantIdentifier { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface SourceIdentifier { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + desktopAgent?: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** * Identifies the type of the message and it is typically set to the FDC3 function name that * the message relates to, e.g. 'findIntent', with 'Request' appended. */ -export type RequestMessageType = "broadcastRequest" | "findInstancesRequest" | "findIntentRequest" | "findIntentsByContextRequest" | "getAppMetadataRequest" | "openRequest" | "PrivateChannel.broadcast" | "PrivateChannel.eventListenerAdded" | "PrivateChannel.eventListenerRemoved" | "PrivateChannel.onAddContextListener" | "PrivateChannel.onDisconnect" | "PrivateChannel.onUnsubscribe" | "raiseIntentRequest"; +export type RequestMessageType = + | 'broadcastRequest' + | 'findInstancesRequest' + | 'findIntentRequest' + | 'findIntentsByContextRequest' + | 'getAppMetadataRequest' + | 'openRequest' + | 'PrivateChannel.broadcast' + | 'PrivateChannel.eventListenerAdded' + | 'PrivateChannel.eventListenerRemoved' + | 'PrivateChannel.onAddContextListener' + | 'PrivateChannel.onDisconnect' + | 'PrivateChannel.onUnsubscribe' + | 'raiseIntentRequest'; /** * A response message from a Desktop Agent to the Bridge. */ export interface AgentResponseMessage { - meta: AgentResponseMetadata; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: ResponseMessageType; + meta: AgentResponseMetadata; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: ResponseMessageType; } /** @@ -320,28 +361,28 @@ export interface AgentResponseMessage { * request, used where all connected agents returned errors. */ export interface BridgeErrorResponseMessage { - meta: BridgeErrorResponseMessageMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: ResponseErrorMessagePayload; - /** - * Identifies 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: string; + meta: BridgeErrorResponseMessageMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: ResponseErrorMessagePayload; + /** + * Identifies 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: string; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface BridgeErrorResponseMessageMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -363,12 +404,12 @@ export interface BridgeErrorResponseMessageMeta { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface DesktopAgentIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + desktopAgent: string; + [property: string]: any; } /** @@ -376,44 +417,44 @@ export interface DesktopAgentIdentifier { * raised the original request. */ export interface ResponseErrorMessagePayload { - error?: ResponseErrorDetail; - [property: string]: any; + error?: ResponseErrorDetail; + [property: string]: any; } /** * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface BridgeRequestMessage { - meta: BridgeRequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: string; + meta: BridgeRequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: string; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface BridgeRequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: BridgeParticipantIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: BridgeParticipantIdentifier; + timestamp: Date; } /** @@ -421,28 +462,28 @@ export interface BridgeRequestMetadata { * request. */ export interface BridgeResponseMessage { - meta: BridgeResponseMessageMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: { [key: string]: any }; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: string; + meta: BridgeResponseMessageMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: { [key: string]: any }; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: string; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface BridgeResponseMessageMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** @@ -451,29 +492,29 @@ export interface BridgeResponseMessageMeta { * A request message from a Desktop Agent to the Bridge. */ export interface BroadcastAgentRequest { - meta: BroadcastAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: BroadcastAgentRequestPayload; - /** - * Identifies 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: "broadcastRequest"; + meta: BroadcastAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: BroadcastAgentRequestPayload; + /** + * Identifies 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: 'broadcastRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface BroadcastAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** @@ -517,39 +558,39 @@ export interface BroadcastAgentRequestMeta { * Field that represents a destination Desktop Agent that a request is to be sent to. */ export interface SourceObject { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 BroadcastAgentRequestPayload { - /** - * The Id of the Channel that the broadcast was sent on. - */ - channelId: string; - /** - * The context object that is to be broadcast. - */ - context: Context; + /** + * The Id of the Channel that the broadcast was sent on. + */ + channelId: string; + /** + * The context object that is to be broadcast. + */ + context: Context; } /** @@ -570,44 +611,44 @@ export interface BroadcastAgentRequestPayload { * with custom fields as appropriate. */ export interface Context { - /** - * Context data objects may include a set of equivalent key-value pairs that can be used to - * help applications identify and look up the context type they receive in their own domain. - * The idea behind this design is that applications can provide as many equivalent - * identifiers to a target application as possible, e.g. an instrument may be represented by - * an ISIN, CUSIP or Bloomberg identifier. - * - * Identifiers do not make sense for all types of data, so the `id` property is therefore - * optional, but some derived types may choose to require at least one identifier. - * Identifier values SHOULD always be of type string. - */ - id?: { [key: string]: any }; - /** - * Context data objects may include a name property that can be used for more information, - * or display purposes. Some derived types may require the name object as mandatory, - * depending on use case. - */ - name?: string; - /** - * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 - * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present - * to route shared context data appropriately. - * - * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data - * types they support in an FDC3 [App - * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery - * and routing. - * - * Standardized FDC3 context types have well-known `type` properties prefixed with the - * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and - * used by a particular organization, the convention is to prefix them with an - * organization-specific namespace, e.g. `blackrock.fund`. - * - * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more - * information about context data types. - */ - type: string; - [property: string]: any; + /** + * Context data objects may include a set of equivalent key-value pairs that can be used to + * help applications identify and look up the context type they receive in their own domain. + * The idea behind this design is that applications can provide as many equivalent + * identifiers to a target application as possible, e.g. an instrument may be represented by + * an ISIN, CUSIP or Bloomberg identifier. + * + * Identifiers do not make sense for all types of data, so the `id` property is therefore + * optional, but some derived types may choose to require at least one identifier. + * Identifier values SHOULD always be of type string. + */ + id?: { [key: string]: any }; + /** + * Context data objects may include a name property that can be used for more information, + * or display purposes. Some derived types may require the name object as mandatory, + * depending on use case. + */ + name?: string; + /** + * The type property is the only _required_ part of the FDC3 context data schema. The FDC3 + * [API](https://fdc3.finos.org/docs/api/spec) relies on the `type` property being present + * to route shared context data appropriately. + * + * FDC3 [Intents](https://fdc3.finos.org/docs/intents/spec) also register the context data + * types they support in an FDC3 [App + * Directory](https://fdc3.finos.org/docs/app-directory/overview), used for intent discovery + * and routing. + * + * Standardized FDC3 context types have well-known `type` properties prefixed with the + * `fdc3` namespace, e.g. `fdc3.instrument`. For non-standard types, e.g. those defined and + * used by a particular organization, the convention is to prefix them with an + * organization-specific namespace, e.g. `blackrock.fund`. + * + * See the [Context Data Specification](https://fdc3.finos.org/docs/context/spec) for more + * information about context data types. + */ + type: string; + [property: string]: any; } /** @@ -626,30 +667,30 @@ export interface Context { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface BroadcastBridgeRequest { - meta: BroadcastBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: BroadcastBridgeRequestPayload; - /** - * Identifies 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: "broadcastRequest"; + meta: BroadcastBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: BroadcastBridgeRequestPayload; + /** + * Identifies 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: 'broadcastRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface BroadcastBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** @@ -701,39 +742,39 @@ export interface BroadcastBridgeRequestMeta { * sent to. */ export interface MetaSource { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 BroadcastBridgeRequestPayload { - /** - * The Id of the Channel that the broadcast was sent on. - */ - channelId: string; - /** - * The context object that is to be broadcast. - */ - context: Context; + /** + * The Id of the Channel that the broadcast was sent on. + */ + channelId: string; + /** + * The context object that is to be broadcast. + */ + context: Context; } /** @@ -741,30 +782,30 @@ export interface BroadcastBridgeRequestPayload { * messages sent in either direction. */ export interface ConnectionStepMessage { - 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; + 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 this connection step message. */ export interface ConnectionStepMetadata { - requestUuid?: string; - responseUuid?: string; - timestamp: Date; + requestUuid?: string; + responseUuid?: string; + timestamp: Date; } /** * Identifies the type of the connection step message. */ -export type ConnectionStepMessageType = "hello" | "handshake" | "authenticationFailed" | "connectedAgentsUpdate"; +export type ConnectionStepMessageType = 'hello' | 'handshake' | 'authenticationFailed' | 'connectedAgentsUpdate'; /** * Hello message sent by the Bridge to anyone connecting to the Bridge (enables @@ -774,45 +815,45 @@ export type ConnectionStepMessageType = "hello" | "handshake" | "authenticationF * messages sent in either direction. */ export interface ConnectionStep2Hello { - meta: ConnectionStep2HelloMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep2HelloPayload; - /** - * Identifies the type of the connection step message. - */ - type: "hello"; + meta: ConnectionStep2HelloMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep2HelloPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'hello'; } /** * Metadata for this connection step message. */ export interface ConnectionStep2HelloMeta { - timestamp: Date; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep2HelloPayload { - /** - * A flag indicating whether the Desktop Agent Bridge requires authentication or not. - */ - authRequired: boolean; - /** - * An optional Desktop Agent Bridge JWT authentication token if the Desktop Agent want to - * authenticate a bridge. - */ - authToken?: string; - /** - * The version of the Bridge - */ - desktopAgentBridgeVersion: string; - /** - * The FDC3 versions supported by the Bridge - */ - supportedFDC3Versions: string[]; + /** + * A flag indicating whether the Desktop Agent Bridge requires authentication or not. + */ + authRequired: boolean; + /** + * An optional Desktop Agent Bridge JWT authentication token if the Desktop Agent want to + * authenticate a bridge. + */ + authToken?: string; + /** + * The version of the Bridge + */ + desktopAgentBridgeVersion: string; + /** + * The FDC3 versions supported by the Bridge + */ + supportedFDC3Versions: string[]; } /** @@ -827,44 +868,44 @@ export interface ConnectionStep2HelloPayload { * messages sent in either direction. */ export interface ConnectionStep3Handshake { - meta: ConnectionStep3HandshakeMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep3HandshakePayload; - /** - * Identifies the type of the connection step message. - */ - type: "handshake"; + meta: ConnectionStep3HandshakeMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep3HandshakePayload; + /** + * Identifies the type of the connection step message. + */ + type: 'handshake'; } /** * Metadata for this connection step message. */ export interface ConnectionStep3HandshakeMeta { - requestUuid: string; - timestamp: Date; + requestUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep3HandshakePayload { - authToken?: string; - /** - * The current state of the Desktop Agent's App and User channels (exclude any Private - * channels), as a mapping of channel id to an array of Context objects, one per type found - * in the channel, most recent first. - */ - channelsState: { [key: string]: Context[] }; - /** - * Desktop Agent ImplementationMetadata trying to connect to the bridge. - */ - implementationMetadata: ConnectingAgentImplementationMetadata; - /** - * The requested Desktop Agent name - */ - requestedName: string; + authToken?: string; + /** + * The current state of the Desktop Agent's App and User channels (exclude any Private + * channels), as a mapping of channel id to an array of Context objects, one per type found + * in the channel, most recent first. + */ + channelsState: { [key: string]: Context[] }; + /** + * Desktop Agent ImplementationMetadata trying to connect to the bridge. + */ + implementationMetadata: ConnectingAgentImplementationMetadata; + /** + * The requested Desktop Agent name + */ + requestedName: string; } /** @@ -873,25 +914,25 @@ export interface ConnectionStep3HandshakePayload { * Metadata relating to the FDC3 Desktop Agent implementation and its provider. */ export interface ConnectingAgentImplementationMetadata { - /** - * 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 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; } /** @@ -899,22 +940,22 @@ export interface ConnectingAgentImplementationMetadata { * 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; + /** + * 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; } /** @@ -928,31 +969,31 @@ export interface OptionalFeatures { * messages sent in either direction. */ export interface ConnectionStep4AuthenticationFailed { - meta: ConnectionStep4AuthenticationFailedMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep4AuthenticationFailedPayload; - /** - * Identifies the type of the connection step message. - */ - type: "authenticationFailed"; + meta: ConnectionStep4AuthenticationFailedMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep4AuthenticationFailedPayload; + /** + * Identifies the type of the connection step message. + */ + type: 'authenticationFailed'; } /** * Metadata for this connection step message. */ export interface ConnectionStep4AuthenticationFailedMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep4AuthenticationFailedPayload { - message?: string; + message?: string; } /** @@ -968,48 +1009,48 @@ export interface ConnectionStep4AuthenticationFailedPayload { * messages sent in either direction. */ export interface ConnectionStep6ConnectedAgentsUpdate { - meta: ConnectionStep6ConnectedAgentsUpdateMeta; - /** - * The message payload, containing data pertaining to this connection step. - */ - payload: ConnectionStep6ConnectedAgentsUpdatePayload; - /** - * Identifies the type of the connection step message. - */ - type: "connectedAgentsUpdate"; + meta: ConnectionStep6ConnectedAgentsUpdateMeta; + /** + * The message payload, containing data pertaining to this connection step. + */ + payload: ConnectionStep6ConnectedAgentsUpdatePayload; + /** + * Identifies the type of the connection step message. + */ + type: 'connectedAgentsUpdate'; } /** * Metadata for this connection step message. */ export interface ConnectionStep6ConnectedAgentsUpdateMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload, containing data pertaining to this connection step. */ export interface ConnectionStep6ConnectedAgentsUpdatePayload { - /** - * Should be set when an agent first connects to the bridge and provide its assigned name. - */ - addAgent?: string; - /** - * Desktop Agent Bridge implementation metadata of all connected agents. - */ - allAgents: DesktopAgentImplementationMetadata[]; - /** - * The updated state of channels that should be adopted by the agents. Should only be set - * when an agent is connecting to the bridge. - */ - channelsState?: { [key: string]: Context[] }; - /** - * Should be set when an agent disconnects from the bridge and provide the name that no - * longer is assigned. - */ - removeAgent?: string; + /** + * Should be set when an agent first connects to the bridge and provide its assigned name. + */ + addAgent?: string; + /** + * Desktop Agent Bridge implementation metadata of all connected agents. + */ + allAgents: DesktopAgentImplementationMetadata[]; + /** + * The updated state of channels that should be adopted by the agents. Should only be set + * when an agent is connecting to the bridge. + */ + channelsState?: { [key: string]: Context[] }; + /** + * Should be set when an agent disconnects from the bridge and provide the name that no + * longer is assigned. + */ + removeAgent?: string; } /** @@ -1018,30 +1059,30 @@ export interface ConnectionStep6ConnectedAgentsUpdatePayload { * Metadata relating to the FDC3 Desktop Agent implementation and its provider. */ export interface DesktopAgentImplementationMetadata { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a particular Desktop - * Agent. - */ - desktopAgent: string; - /** - * 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; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a particular Desktop + * Agent. + */ + desktopAgent: string; + /** + * 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; } /** @@ -1055,32 +1096,32 @@ export interface DesktopAgentImplementationMetadata { * preference to the standard response when an error needs to be returned. */ export interface FindInstancesAgentErrorResponse { - meta: FindInstancesAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: PayloadClass; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: FindInstancesAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: PayloadClass; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindInstancesAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface PayloadClass { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1102,7 +1143,20 @@ export interface PayloadClass { * Constants representing the errors that can be encountered when calling the `open` method * on the DesktopAgent object (`fdc3`). */ -export type FindInstancesErrors = "DesktopAgentNotFound" | "IntentDeliveryFailed" | "MalformedContext" | "NoAppsFound" | "ResolverTimeout" | "ResolverUnavailable" | "TargetAppUnavailable" | "TargetInstanceUnavailable" | "UserCancelledResolution" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type FindInstancesErrors = + | 'DesktopAgentNotFound' + | 'IntentDeliveryFailed' + | 'MalformedContext' + | 'NoAppsFound' + | 'ResolverTimeout' + | 'ResolverUnavailable' + | 'TargetAppUnavailable' + | 'TargetInstanceUnavailable' + | 'UserCancelledResolution' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -1120,35 +1174,35 @@ export type FindInstancesErrors = "DesktopAgentNotFound" | "IntentDeliveryFailed * A request message from a Desktop Agent to the Bridge. */ export interface FindInstancesAgentRequest { - meta: FindInstancesAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindInstancesAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findInstancesRequest"; + meta: FindInstancesAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findInstancesRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindInstancesAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** @@ -1200,32 +1254,32 @@ export interface FindInstancesAgentRequestMeta { * received the intent. */ export interface DestinationObject { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId?: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId?: 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 FindInstancesAgentRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -1246,22 +1300,22 @@ export interface FindInstancesAgentRequestPayload { * 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 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; } /** @@ -1280,16 +1334,16 @@ export interface AppIdentifier { * A response message from a Desktop Agent to the Bridge. */ export interface FindInstancesAgentResponse { - meta: AgentResponseMetadata; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindInstancesAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: AgentResponseMetadata; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindInstancesAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** @@ -1300,7 +1354,7 @@ export interface FindInstancesAgentResponse { * The message payload typically contains return values for FDC3 API functions. */ export interface FindInstancesAgentResponsePayload { - appIdentifiers: AppMetadata[]; + appIdentifiers: AppMetadata[]; } /** @@ -1316,84 +1370,84 @@ export interface FindInstancesAgentResponsePayload { * `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; + /** + * 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; + /** + * 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; } /** @@ -1401,22 +1455,22 @@ export interface Icon { * 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; + /** + * 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; } /** @@ -1426,28 +1480,28 @@ export interface Image { * request, used where all connected agents returned errors. */ export interface FindInstancesBridgeErrorResponse { - meta: FindInstancesBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: MessagePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: FindInstancesBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: MessagePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindInstancesBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -1455,7 +1509,7 @@ export interface FindInstancesBridgeErrorResponseMeta { * raised the original request. */ export interface MessagePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1464,36 +1518,36 @@ export interface MessagePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindInstancesBridgeRequest { - meta: FindInstancesBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindInstancesBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findInstancesRequest"; + meta: FindInstancesBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindInstancesBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findInstancesRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindInstancesBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSourceObject; + timestamp: Date; } /** @@ -1551,32 +1605,32 @@ export interface FindInstancesBridgeRequestMeta { * sent to. */ export interface MetaSourceObject { - /** - * 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. - * - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - */ - desktopAgent: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * 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. + * + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + */ + 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 FindInstancesBridgeRequestPayload { - app: AppIdentifier; + app: AppIdentifier; } /** @@ -1586,16 +1640,16 @@ export interface FindInstancesBridgeRequestPayload { * request. */ export interface FindInstancesBridgeResponse { - meta: BridgeResponseMessageMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindInstancesBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findInstancesResponse"; + meta: BridgeResponseMessageMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindInstancesBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findInstancesResponse'; } /** @@ -1606,7 +1660,7 @@ export interface FindInstancesBridgeResponse { * The message payload typically contains return values for FDC3 API functions. */ export interface FindInstancesBridgeResponsePayload { - appIdentifiers: AppMetadata[]; + appIdentifiers: AppMetadata[]; } /** @@ -1616,32 +1670,32 @@ export interface FindInstancesBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface FindIntentAgentErrorResponse { - meta: FindIntentAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: FindIntentAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: FindIntentAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface FindIntentAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1660,44 +1714,44 @@ export interface FindIntentAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface FindIntentAgentRequest { - meta: FindIntentAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentRequest"; + meta: FindIntentAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindIntentAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentAgentRequestPayload { - context?: Context; - intent: string; - resultType?: string; + context?: Context; + intent: string; + resultType?: string; } /** @@ -1716,46 +1770,46 @@ export interface FindIntentAgentRequestPayload { * A response message from a Desktop Agent to the Bridge. */ export interface FindIntentAgentResponse { - meta: FindIntentAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentAgentResponsePayload { - appIntent: AppIntent; + appIntent: AppIntent; } /** * An interface that relates an intent to apps. */ export interface AppIntent { - /** - * Details of applications that can resolve the intent. - */ - apps: AppMetadata[]; - /** - * Details of the intent whose relationship to resolving applications is being described. - */ - intent: IntentMetadata; + /** + * Details of applications that can resolve the intent. + */ + apps: AppMetadata[]; + /** + * Details of the intent whose relationship to resolving applications is being described. + */ + intent: IntentMetadata; } /** @@ -1764,14 +1818,14 @@ export interface AppIntent { * Metadata describing an Intent. */ export interface IntentMetadata { - /** - * Display name for the intent. - */ - displayName?: string; - /** - * The unique name of the intent that can be invoked by the raiseIntent call. - */ - name: string; + /** + * Display name for the intent. + */ + displayName?: string; + /** + * The unique name of the intent that can be invoked by the raiseIntent call. + */ + name: string; } /** @@ -1781,28 +1835,28 @@ export interface IntentMetadata { * request, used where all connected agents returned errors. */ export interface FindIntentBridgeErrorResponse { - meta: FindIntentBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: FindIntentBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: FindIntentBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -1810,7 +1864,7 @@ export interface FindIntentBridgeErrorResponseMeta { * raised the original request. */ export interface FindIntentBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1819,45 +1873,45 @@ export interface FindIntentBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindIntentBridgeRequest { - meta: FindIntentBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentRequest"; + meta: FindIntentBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindIntentBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: BridgeParticipantIdentifier; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: BridgeParticipantIdentifier; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentBridgeRequestPayload { - context?: Context; - intent: string; - resultType?: string; + context?: Context; + intent: string; + resultType?: string; } /** @@ -1867,35 +1921,35 @@ export interface FindIntentBridgeRequestPayload { * request. */ export interface FindIntentBridgeResponse { - meta: FindIntentBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentResponse"; + meta: FindIntentBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentBridgeResponsePayload { - appIntent: AppIntent; + appIntent: AppIntent; } /** @@ -1905,32 +1959,32 @@ export interface FindIntentBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface FindIntentsByContextAgentErrorResponse { - meta: FindIntentsByContextAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: FindIntentsByContextAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: FindIntentsByContextAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentsByContextAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface FindIntentsByContextAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -1950,43 +2004,43 @@ export interface FindIntentsByContextAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface FindIntentsByContextAgentRequest { - meta: FindIntentsByContextAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentsByContextAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentsByContextRequest"; + meta: FindIntentsByContextAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentsByContextAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentsByContextRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface FindIntentsByContextAgentRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextAgentRequestPayload { - context: Context; - resultType?: string; + context: Context; + resultType?: string; } /** @@ -2005,32 +2059,32 @@ export interface FindIntentsByContextAgentRequestPayload { * A response message from a Desktop Agent to the Bridge. */ export interface FindIntentsByContextAgentResponse { - meta: FindIntentsByContextAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentsByContextAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentsByContextAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface FindIntentsByContextAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentsByContextAgentResponsePayload { - appIntents: AppIntent[]; + appIntents: AppIntent[]; } /** @@ -2040,28 +2094,28 @@ export interface FindIntentsByContextAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface FindIntentsByContextBridgeErrorResponse { - meta: FindIntentsByContextBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: FindIntentsByContextBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: FindIntentsByContextBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentsByContextBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2069,7 +2123,7 @@ export interface FindIntentsByContextBridgeErrorResponseMeta { * raised the original request. */ export interface FindIntentsByContextBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2079,44 +2133,44 @@ export interface FindIntentsByContextBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface FindIntentsByContextBridgeRequest { - meta: FindIntentsByContextBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: FindIntentsByContextBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "findIntentsByContextRequest"; + meta: FindIntentsByContextBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: FindIntentsByContextBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'findIntentsByContextRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface FindIntentsByContextBridgeRequestMeta { - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: BridgeParticipantIdentifier; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: BridgeParticipantIdentifier; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface FindIntentsByContextBridgeRequestPayload { - context: Context; - resultType?: string; + context: Context; + resultType?: string; } /** @@ -2126,35 +2180,35 @@ export interface FindIntentsByContextBridgeRequestPayload { * request. */ export interface FindIntentsByContextBridgeResponse { - meta: FindIntentsByContextBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: FindIntentsByContextBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "findIntentsByContextResponse"; + meta: FindIntentsByContextBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: FindIntentsByContextBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'findIntentsByContextResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface FindIntentsByContextBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface FindIntentsByContextBridgeResponsePayload { - appIntents: AppIntent[]; + appIntents: AppIntent[]; } /** @@ -2164,32 +2218,32 @@ export interface FindIntentsByContextBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface GetAppMetadataAgentErrorResponse { - meta: GetAppMetadataAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: GetAppMetadataAgentErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: GetAppMetadataAgentErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface GetAppMetadataAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface GetAppMetadataAgentErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2208,42 +2262,42 @@ export interface GetAppMetadataAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface GetAppMetadataAgentRequest { - meta: GetAppMetadataAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: GetAppMetadataAgentRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getAppMetadataRequest"; + meta: GetAppMetadataAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: GetAppMetadataAgentRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getAppMetadataRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface GetAppMetadataAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceIdentifier; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceIdentifier; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetAppMetadataAgentRequestPayload { - app: AppObject; + app: AppObject; } /** @@ -2284,25 +2338,25 @@ export interface GetAppMetadataAgentRequestPayload { * received the intent. */ export interface AppObject { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -2321,32 +2375,32 @@ export interface AppObject { * A response message from a Desktop Agent to the Bridge. */ export interface GetAppMetadataAgentResponse { - meta: GetAppMetadataAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: GetAppMetadataAgentResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: GetAppMetadataAgentResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface GetAppMetadataAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface GetAppMetadataAgentResponsePayload { - appMetadata: AppMetadata; + appMetadata: AppMetadata; } /** @@ -2356,28 +2410,28 @@ export interface GetAppMetadataAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface GetAppMetadataBridgeErrorResponse { - meta: GetAppMetadataBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: GetAppMetadataBridgeErrorResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: GetAppMetadataBridgeErrorResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface GetAppMetadataBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2385,7 +2439,7 @@ export interface GetAppMetadataBridgeErrorResponseMeta { * raised the original request. */ export interface GetAppMetadataBridgeErrorResponsePayload { - error: FindInstancesErrors; + error: FindInstancesErrors; } /** @@ -2394,43 +2448,43 @@ export interface GetAppMetadataBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface GetAppMetadataBridgeRequest { - meta: GetAppMetadataBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: GetAppMetadataBridgeRequestPayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Request' appended. - */ - type: "getAppMetadataRequest"; + meta: GetAppMetadataBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: GetAppMetadataBridgeRequestPayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Request' appended. + */ + type: 'getAppMetadataRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface GetAppMetadataBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface GetAppMetadataBridgeRequestPayload { - app: AppObject; + app: AppObject; } /** @@ -2440,35 +2494,35 @@ export interface GetAppMetadataBridgeRequestPayload { * request. */ export interface GetAppMetadataBridgeResponse { - meta: GetAppMetadataBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: GetAppMetadataBridgeResponsePayload; - /** - * Identifies the type of the message and it is typically set to the FDC3 function name that - * the message relates to, e.g. 'findIntent', with 'Response' appended. - */ - type: "getAppMetadataResponse"; + meta: GetAppMetadataBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: GetAppMetadataBridgeResponsePayload; + /** + * Identifies the type of the message and it is typically set to the FDC3 function name that + * the message relates to, e.g. 'findIntent', with 'Response' appended. + */ + type: 'getAppMetadataResponse'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface GetAppMetadataBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface GetAppMetadataBridgeResponsePayload { - appMetadata: AppMetadata; + appMetadata: AppMetadata; } /** @@ -2478,32 +2532,32 @@ export interface GetAppMetadataBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface OpenAgentErrorResponse { - meta: OpenAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: OpenAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: OpenAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: OpenAgentErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface OpenAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface OpenAgentErrorResponsePayload { - error: OpenErrorResponsePayload; + error: OpenErrorResponsePayload; } /** @@ -2518,7 +2572,17 @@ export interface OpenAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type OpenErrorResponsePayload = "AppNotFound" | "AppTimeout" | "DesktopAgentNotFound" | "ErrorOnLaunch" | "MalformedContext" | "ResolverUnavailable" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type OpenErrorResponsePayload = + | 'AppNotFound' + | 'AppTimeout' + | 'DesktopAgentNotFound' + | 'ErrorOnLaunch' + | 'MalformedContext' + | 'ResolverUnavailable' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -2536,46 +2600,46 @@ export type OpenErrorResponsePayload = "AppNotFound" | "AppTimeout" | "DesktopAg * A request message from a Desktop Agent to the Bridge. */ export interface OpenAgentRequest { - meta: OpenAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: OpenAgentRequestPayload; - /** - * Identifies 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"; + meta: OpenAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: OpenAgentRequestPayload; + /** + * Identifies 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'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface OpenAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface OpenAgentRequestPayload { - /** - * The application to open on the specified Desktop Agent - */ - app: AppToOpen; - context?: Context; + /** + * The application to open on the specified Desktop Agent + */ + app: AppToOpen; + context?: Context; } /** @@ -2615,25 +2679,25 @@ export interface OpenAgentRequestPayload { * received the intent. */ export interface AppToOpen { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -2652,32 +2716,32 @@ export interface AppToOpen { * A response message from a Desktop Agent to the Bridge. */ export interface OpenAgentResponse { - meta: OpenAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: OpenAgentResponsePayload; - /** - * Identifies 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"; + meta: OpenAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: OpenAgentResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface OpenAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface OpenAgentResponsePayload { - appIdentifier: AppIdentifier; + appIdentifier: AppIdentifier; } /** @@ -2687,28 +2751,28 @@ export interface OpenAgentResponsePayload { * request, used where all connected agents returned errors. */ export interface OpenBridgeErrorResponse { - meta: OpenBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: OpenBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: OpenBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: OpenBridgeErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface OpenBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -2716,7 +2780,7 @@ export interface OpenBridgeErrorResponseMeta { * raised the original request. */ export interface OpenBridgeErrorResponsePayload { - error: OpenErrorResponsePayload; + error: OpenErrorResponsePayload; } /** @@ -2725,47 +2789,47 @@ export interface OpenBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface OpenBridgeRequest { - meta: OpenBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: OpenBridgeRequestPayload; - /** - * Identifies 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"; + meta: OpenBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: OpenBridgeRequestPayload; + /** + * Identifies 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'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface OpenBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: DestinationObject; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: DestinationObject; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface OpenBridgeRequestPayload { - /** - * The application to open on the specified Desktop Agent - */ - app: AppToOpen; - context?: Context; + /** + * The application to open on the specified Desktop Agent + */ + app: AppToOpen; + context?: Context; } /** @@ -2775,35 +2839,35 @@ export interface OpenBridgeRequestPayload { * request. */ export interface OpenBridgeResponse { - meta: OpenBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: OpenBridgeResponsePayload; - /** - * Identifies 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"; + meta: OpenBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: OpenBridgeResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface OpenBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface OpenBridgeResponsePayload { - appIdentifier: AppIdentifier; + appIdentifier: AppIdentifier; } /** @@ -2812,35 +2876,35 @@ export interface OpenBridgeResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelBroadcastAgentRequest { - meta: PrivateChannelBroadcastAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelBroadcastAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.broadcast"; + meta: PrivateChannelBroadcastAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelBroadcastAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.broadcast'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelBroadcastAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** @@ -2892,39 +2956,39 @@ export interface PrivateChannelBroadcastAgentRequestMeta { * be set by the bridge. */ export interface MetaDestination { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: 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 PrivateChannelBroadcastAgentRequestPayload { - /** - * The Id of the PrivateChannel that the broadcast was sent on - */ - channelId: string; - /** - * The context object that was the payload of a broadcast message. - */ - context: Context; + /** + * The Id of the PrivateChannel that the broadcast was sent on + */ + channelId: string; + /** + * The context object that was the payload of a broadcast message. + */ + context: Context; } /** @@ -2943,50 +3007,50 @@ export interface PrivateChannelBroadcastAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelBroadcastBridgeRequest { - meta: PrivateChannelBroadcastBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelBroadcastBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.broadcast"; + meta: PrivateChannelBroadcastBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelBroadcastBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.broadcast'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelBroadcastBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelBroadcastBridgeRequestPayload { - /** - * The Id of the PrivateChannel that the broadcast was sent on - */ - channelId: string; - /** - * The context object that was the payload of a broadcast message. - */ - context: Context; + /** + * The Id of the PrivateChannel that the broadcast was sent on + */ + channelId: string; + /** + * The context object that was the payload of a broadcast message. + */ + context: Context; } /** @@ -2995,52 +3059,52 @@ export interface PrivateChannelBroadcastBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelEventListenerAddedAgentRequest { - meta: PrivateChannelEventListenerAddedAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerAddedAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerAdded"; + meta: PrivateChannelEventListenerAddedAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerAddedAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerAdded'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelEventListenerAddedAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerAddedAgentRequestPayload { - /** - * The id of the PrivateChannel that the event listener was added to. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was added to. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** * Event listener type names for Private Channel events. */ -export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsubscribe" | "onDisconnect"; +export type PrivateChannelEventListenerTypes = 'onAddContextListener' | 'onUnsubscribe' | 'onDisconnect'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3058,47 +3122,47 @@ export type PrivateChannelEventListenerTypes = "onAddContextListener" | "onUnsub * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelEventListenerAddedBridgeRequest { - meta: PrivateChannelEventListenerAddedBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerAddedBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerAdded"; + meta: PrivateChannelEventListenerAddedBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerAddedBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerAdded'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelEventListenerAddedBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerAddedBridgeRequestPayload { - /** - * The id of the PrivateChannel that the event listener was added to. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was added to. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3107,46 +3171,46 @@ export interface PrivateChannelEventListenerAddedBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelEventListenerRemovedAgentRequest { - meta: PrivateChannelEventListenerRemovedAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerRemovedAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerRemoved"; + meta: PrivateChannelEventListenerRemovedAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerRemovedAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerRemoved'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelEventListenerRemovedAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerRemovedAgentRequestPayload { - /** - * The id of the PrivateChannel that the event listener was removed from. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was removed from. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3165,47 +3229,47 @@ export interface PrivateChannelEventListenerRemovedAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelEventListenerRemovedBridgeRequest { - meta: PrivateChannelEventListenerRemovedBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelEventListenerRemovedBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.eventListenerRemoved"; + meta: PrivateChannelEventListenerRemovedBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelEventListenerRemovedBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.eventListenerRemoved'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelEventListenerRemovedBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelEventListenerRemovedBridgeRequestPayload { - /** - * The id of the PrivateChannel that the event listener was removed from. - */ - channelId: string; - listenerType: PrivateChannelEventListenerTypes; + /** + * The id of the PrivateChannel that the event listener was removed from. + */ + channelId: string; + listenerType: PrivateChannelEventListenerTypes; } /** @@ -3214,49 +3278,49 @@ export interface PrivateChannelEventListenerRemovedBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnAddContextListenerAgentRequest { - meta: PrivateChannelOnAddContextListenerAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnAddContextListenerAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onAddContextListener"; + meta: PrivateChannelOnAddContextListenerAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnAddContextListenerAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onAddContextListener'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnAddContextListenerAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnAddContextListenerAgentRequestPayload { - /** - * The id of the PrivateChannel that the context listener was added to. - */ - channelId: string; - /** - * The type of the context listener added. Should be null for an untyped listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was added to. + */ + channelId: string; + /** + * The type of the context listener added. Should be null for an untyped listener. + */ + contextType: null | string; } /** @@ -3275,50 +3339,50 @@ export interface PrivateChannelOnAddContextListenerAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnAddContextListenerBridgeRequest { - meta: PrivateChannelOnAddContextListenerBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnAddContextListenerBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onAddContextListener"; + meta: PrivateChannelOnAddContextListenerBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnAddContextListenerBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onAddContextListener'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelOnAddContextListenerBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnAddContextListenerBridgeRequestPayload { - /** - * The id of the PrivateChannel that the context listener was added to. - */ - channelId: string; - /** - * The type of the context listener added. Should be null for an untyped listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was added to. + */ + channelId: string; + /** + * The type of the context listener added. Should be null for an untyped listener. + */ + contextType: null | string; } /** @@ -3327,45 +3391,45 @@ export interface PrivateChannelOnAddContextListenerBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnDisconnectAgentRequest { - meta: PrivateChannelOnDisconnectAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnDisconnectAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onDisconnect"; + meta: PrivateChannelOnDisconnectAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnDisconnectAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onDisconnect'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnDisconnectAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnDisconnectAgentRequestPayload { - /** - * The id of the PrivateChannel that the agent discconnected from. - */ - channelId: string; + /** + * The id of the PrivateChannel that the agent discconnected from. + */ + channelId: string; } /** @@ -3384,46 +3448,46 @@ export interface PrivateChannelOnDisconnectAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnDisconnectBridgeRequest { - meta: PrivateChannelOnDisconnectBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnDisconnectBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onDisconnect"; + meta: PrivateChannelOnDisconnectBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnDisconnectBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onDisconnect'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface PrivateChannelOnDisconnectBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnDisconnectBridgeRequestPayload { - /** - * The id of the PrivateChannel that the agent discconnected from. - */ - channelId: string; + /** + * The id of the PrivateChannel that the agent discconnected from. + */ + channelId: string; } /** @@ -3432,50 +3496,50 @@ export interface PrivateChannelOnDisconnectBridgeRequestPayload { * A request message from a Desktop Agent to the Bridge. */ export interface PrivateChannelOnUnsubscribeAgentRequest { - meta: PrivateChannelOnUnsubscribeAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnUnsubscribeAgentRequestPayload; - /** - * Identifies 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: "PrivateChannel.onUnsubscribe"; + meta: PrivateChannelOnUnsubscribeAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnUnsubscribeAgentRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onUnsubscribe'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface PrivateChannelOnUnsubscribeAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source?: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source?: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnUnsubscribeAgentRequestPayload { - /** - * The id of the PrivateChannel that the context listener was unsubscribed from. - */ - channelId: string; - /** - * The type of the context listener that was unsubscribed. Should be null for an untyped - * listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was unsubscribed from. + */ + channelId: string; + /** + * The type of the context listener that was unsubscribed. Should be null for an untyped + * listener. + */ + contextType: null | string; } /** @@ -3494,51 +3558,51 @@ export interface PrivateChannelOnUnsubscribeAgentRequestPayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface PrivateChannelOnUnsubscribeBridgeRequest { - meta: ERequestMetadata; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: PrivateChannelOnUnsubscribeBridgeRequestPayload; - /** - * Identifies 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: "PrivateChannel.onUnsubscribe"; + meta: ERequestMetadata; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: PrivateChannelOnUnsubscribeBridgeRequestPayload; + /** + * Identifies 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: 'PrivateChannel.onUnsubscribe'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface ERequestMetadata { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination?: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination?: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface PrivateChannelOnUnsubscribeBridgeRequestPayload { - /** - * The id of the PrivateChannel that the context listener was unsubscribed from. - */ - channelId: string; - /** - * The type of the context listener that was unsubscribed. Should be null for an untyped - * listener. - */ - contextType: null | string; + /** + * The id of the PrivateChannel that the context listener was unsubscribed from. + */ + channelId: string; + /** + * The type of the context listener that was unsubscribed. Should be null for an untyped + * listener. + */ + contextType: null | string; } /** @@ -3548,25 +3612,25 @@ export interface PrivateChannelOnUnsubscribeBridgeRequestPayload { * preference to the standard response when an error needs to be returned. */ export interface RaiseIntentAgentErrorResponse { - meta: RaiseIntentAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: RaiseIntentAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: RaiseIntentAgentErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -3575,10 +3639,10 @@ export interface RaiseIntentAgentErrorResponseMeta { * Error message payload containing an standardized error string. */ export interface RaiseIntentAgentErrorResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error: FindInstancesErrors; + /** + * Should be set if the raiseIntent request returned an error. + */ + error: FindInstancesErrors; } /** @@ -3597,44 +3661,44 @@ export interface RaiseIntentAgentErrorResponsePayload { * A request message from a Desktop Agent to the Bridge. */ export interface RaiseIntentAgentRequest { - meta: RaiseIntentAgentRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: RaiseIntentAgentRequestPayload; - /** - * Identifies 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: "raiseIntentRequest"; + meta: RaiseIntentAgentRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: RaiseIntentAgentRequestPayload; + /** + * Identifies 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: 'raiseIntentRequest'; } /** * Metadata for a request message sent by Desktop Agents to the Bridge. */ export interface RaiseIntentAgentRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. - */ - source: SourceObject; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. + */ + source: SourceObject; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentAgentRequestPayload { - app: AppDestinationIdentifier; - context: Context; - intent: string; + app: AppDestinationIdentifier; + context: Context; + intent: string; } /** @@ -3675,25 +3739,25 @@ export interface RaiseIntentAgentRequestPayload { * received the intent. */ export interface AppDestinationIdentifier { - /** - * Used in Desktop Agent Bridging to attribute or target a message to a - * particular Desktop Agent. - * - * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to - * identify the Desktop Agent to target. - */ - desktopAgent: string; - /** - * The unique application identifier located within a specific application directory - * instance. An example of an appId might be 'app@sub.root'. - */ - appId: string; - /** - * An optional instance identifier, indicating that this object represents a specific - * instance of the application described. - */ - instanceId?: string; - [property: string]: any; + /** + * Used in Desktop Agent Bridging to attribute or target a message to a + * particular Desktop Agent. + * + * The Desktop Agent that the app is available on. Used in Desktop Agent Bridging to + * identify the Desktop Agent to target. + */ + desktopAgent: string; + /** + * The unique application identifier located within a specific application directory + * instance. An example of an appId might be 'app@sub.root'. + */ + appId: string; + /** + * An optional instance identifier, indicating that this object represents a specific + * instance of the application described. + */ + instanceId?: string; + [property: string]: any; } /** @@ -3712,35 +3776,35 @@ export interface AppDestinationIdentifier { * A response message from a Desktop Agent to the Bridge. */ export interface RaiseIntentAgentResponse { - meta: RaiseIntentAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentAgentResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentAgentResponsePayload; + /** + * Identifies 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'; } /** * Metadata for a response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentAgentResponsePayload { - /** - * Used if the raiseIntent request was successfully resolved. - */ - intentResolution: IntentResolution; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution: IntentResolution; } /** @@ -3772,17 +3836,17 @@ export interface RaiseIntentAgentResponsePayload { * ``` */ 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; + /** + * 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; } /** @@ -3792,28 +3856,28 @@ export interface IntentResolution { * request, used where all connected agents returned errors. */ export interface RaiseIntentBridgeErrorResponse { - meta: RaiseIntentBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: RaiseIntentBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: RaiseIntentBridgeErrorResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -3823,10 +3887,10 @@ export interface RaiseIntentBridgeErrorResponseMeta { * raised the original request. */ export interface RaiseIntentBridgeErrorResponsePayload { - /** - * Should be set if the raiseIntent request returned an error. - */ - error: FindInstancesErrors; + /** + * Should be set if the raiseIntent request returned an error. + */ + error: FindInstancesErrors; } /** @@ -3835,45 +3899,45 @@ export interface RaiseIntentBridgeErrorResponsePayload { * A request message forwarded from the Bridge onto a Desktop Agent connected to it. */ export interface RaiseIntentBridgeRequest { - meta: RaiseIntentBridgeRequestMeta; - /** - * The message payload typically contains the arguments to FDC3 API functions. - */ - payload: RaiseIntentBridgeRequestPayload; - /** - * Identifies 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: "raiseIntentRequest"; + meta: RaiseIntentBridgeRequestMeta; + /** + * The message payload typically contains the arguments to FDC3 API functions. + */ + payload: RaiseIntentBridgeRequestPayload; + /** + * Identifies 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: 'raiseIntentRequest'; } /** * Metadata required in a request message forwarded on by the Bridge */ export interface RaiseIntentBridgeRequestMeta { - /** - * Optional field that represents the destination that the request should be routed to. Must - * be set by the Desktop Agent for API calls that include a target app parameter and must - * include the name of the Desktop Agent hosting the target application. - */ - destination: MetaDestination; - requestUuid: string; - /** - * Field that represents the source application that the request was received from, or the - * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST - * be set by the bridge. - */ - source: MetaSource; - timestamp: Date; + /** + * Optional field that represents the destination that the request should be routed to. Must + * be set by the Desktop Agent for API calls that include a target app parameter and must + * include the name of the Desktop Agent hosting the target application. + */ + destination: MetaDestination; + requestUuid: string; + /** + * Field that represents the source application that the request was received from, or the + * source Desktop Agent if it issued the request itself. The Desktop Agent identifier MUST + * be set by the bridge. + */ + source: MetaSource; + timestamp: Date; } /** * The message payload typically contains the arguments to FDC3 API functions. */ export interface RaiseIntentBridgeRequestPayload { - app: AppDestinationIdentifier; - context: Context; - intent: string; + app: AppDestinationIdentifier; + context: Context; + intent: string; } /** @@ -3883,38 +3947,38 @@ export interface RaiseIntentBridgeRequestPayload { * request. */ export interface RaiseIntentBridgeResponse { - meta: RaiseIntentBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentBridgeResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentBridgeResponsePayload; + /** + * Identifies 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'; } /** * Metadata required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentBridgeResponsePayload { - /** - * Used if the raiseIntent request was successfully resolved. - */ - intentResolution: IntentResolution; + /** + * Used if the raiseIntent request was successfully resolved. + */ + intentResolution: IntentResolution; } /** @@ -3925,32 +3989,32 @@ export interface RaiseIntentBridgeResponsePayload { * preference to the standard response when an error needs to be returned. */ export interface RaiseIntentResultAgentErrorResponse { - meta: RaiseIntentResultAgentErrorResponseMeta; - /** - * Error message payload containing an standardized error string. - */ - payload: RaiseIntentResultAgentErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultAgentErrorResponseMeta; + /** + * Error message payload containing an standardized error string. + */ + payload: RaiseIntentResultAgentErrorResponsePayload; + /** + * Identifies 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 response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentResultAgentErrorResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * Error message payload containing an standardized error string. */ export interface RaiseIntentResultAgentErrorResponsePayload { - error: RaiseIntentResultErrorMessage; + error: RaiseIntentResultErrorMessage; } /** @@ -3965,7 +4029,13 @@ export interface RaiseIntentResultAgentErrorResponsePayload { * `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the * DesktopAgent (`fdc3`). */ -export type RaiseIntentResultErrorMessage = "IntentHandlerRejected" | "NoResultReturned" | "AgentDisconnected" | "NotConnectedToBridge" | "ResponseToBridgeTimedOut" | "MalformedMessage"; +export type RaiseIntentResultErrorMessage = + | 'IntentHandlerRejected' + | 'NoResultReturned' + | 'AgentDisconnected' + | 'NotConnectedToBridge' + | 'ResponseToBridgeTimedOut' + | 'MalformedMessage'; /** * Identifies the type of the message and it is typically set to the FDC3 function name that @@ -3983,37 +4053,37 @@ export type RaiseIntentResultErrorMessage = "IntentHandlerRejected" | "NoResultR * A response message from a Desktop Agent to the Bridge. */ export interface RaiseIntentResultAgentResponse { - meta: RaiseIntentResultAgentResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentResultAgentResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultAgentResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResultAgentResponsePayload; + /** + * Identifies 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 response messages sent by a Desktop Agent to the Bridge */ export interface RaiseIntentResultAgentResponseMeta { - requestUuid: string; - responseUuid: string; - timestamp: Date; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentResultAgentResponsePayload { - intentResult: IntentResult; + intentResult: IntentResult; } export interface IntentResult { - context?: Context; - channel?: Channel; + context?: Context; + channel?: Channel; } /** @@ -4031,21 +4101,21 @@ export interface IntentResult { * function. */ export interface Channel { - /** - * Channels may be visualized and selectable by users. DisplayMetadata may be used to - * provide hints on how to see them. - * For App channels, displayMetadata would typically not be present. - */ - displayMetadata?: DisplayMetadata; - /** - * Constant that uniquely identifies this channel. - */ - id: string; - /** - * Uniquely defines each channel type. - * Can be "user", "app" or "private". - */ - type: Type; + /** + * Channels may be visualized and selectable by users. DisplayMetadata may be used to + * provide hints on how to see them. + * For App channels, displayMetadata would typically not be present. + */ + displayMetadata?: DisplayMetadata; + /** + * Constant that uniquely identifies this channel. + */ + id: string; + /** + * Uniquely defines each channel type. + * Can be "user", "app" or "private". + */ + type: Type; } /** @@ -4060,26 +4130,26 @@ export interface Channel { * this is their meaning. */ export interface DisplayMetadata { - /** - * The color that should be associated within this channel when displaying this channel in a - * UI, e.g: `0xFF0000`. - */ - color?: string; - /** - * A URL of an image that can be used to display this channel. - */ - glyph?: string; - /** - * A user-readable name for this channel, e.g: `"Red"`. - */ - name?: string; + /** + * The color that should be associated within this channel when displaying this channel in a + * UI, e.g: `0xFF0000`. + */ + color?: string; + /** + * A URL of an image that can be used to display this channel. + */ + glyph?: string; + /** + * A user-readable name for this channel, e.g: `"Red"`. + */ + name?: string; } /** * Uniquely defines each channel type. * Can be "user", "app" or "private". */ -export type Type = "app" | "private" | "user"; +export type Type = 'app' | 'private' | 'user'; /** * A secondary response to a request to raise an intent used to deliver the intent result, @@ -4089,28 +4159,28 @@ export type Type = "app" | "private" | "user"; * request, used where all connected agents returned errors. */ export interface RaiseIntentResultBridgeErrorResponse { - meta: RaiseIntentResultBridgeErrorResponseMeta; - /** - * The error message payload contains details of an error return to the app or agent that - * raised the original request. - */ - payload: RaiseIntentResultBridgeErrorResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultBridgeErrorResponseMeta; + /** + * The error message payload contains details of an error return to the app or agent that + * raised the original request. + */ + payload: RaiseIntentResultBridgeErrorResponsePayload; + /** + * Identifies 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 required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentResultBridgeErrorResponseMeta { - errorDetails: ResponseErrorDetail[]; - errorSources: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - timestamp: Date; + errorDetails: ResponseErrorDetail[]; + errorSources: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + timestamp: Date; } /** @@ -4118,7 +4188,7 @@ export interface RaiseIntentResultBridgeErrorResponseMeta { * raised the original request. */ export interface RaiseIntentResultBridgeErrorResponsePayload { - error: RaiseIntentResultErrorMessage; + error: RaiseIntentResultErrorMessage; } /** @@ -4128,1930 +4198,2386 @@ export interface RaiseIntentResultBridgeErrorResponsePayload { * request. */ export interface RaiseIntentResultBridgeResponse { - meta: RaiseIntentResultBridgeResponseMeta; - /** - * The message payload typically contains return values for FDC3 API functions. - */ - payload: RaiseIntentResultBridgeResponsePayload; - /** - * Identifies 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"; + meta: RaiseIntentResultBridgeResponseMeta; + /** + * The message payload typically contains return values for FDC3 API functions. + */ + payload: RaiseIntentResultBridgeResponsePayload; + /** + * Identifies 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 required in a response message collated and/or forwarded on by the Bridge */ export interface RaiseIntentResultBridgeResponseMeta { - errorDetails?: ResponseErrorDetail[]; - errorSources?: DesktopAgentIdentifier[]; - requestUuid: string; - responseUuid: string; - sources?: DesktopAgentIdentifier[]; - timestamp: Date; + errorDetails?: ResponseErrorDetail[]; + errorSources?: DesktopAgentIdentifier[]; + requestUuid: string; + responseUuid: string; + sources?: DesktopAgentIdentifier[]; + timestamp: Date; } /** * The message payload typically contains return values for FDC3 API functions. */ export interface RaiseIntentResultBridgeResponsePayload { - intentResult: IntentResult; + intentResult: IntentResult; } // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime export class Convert { - public static toAgentErrorResponseMessage(json: string): AgentErrorResponseMessage { - return cast(JSON.parse(json), r("AgentErrorResponseMessage")); - } + public static toAgentErrorResponseMessage(json: string): AgentErrorResponseMessage { + return cast(JSON.parse(json), r('AgentErrorResponseMessage')); + } - public static agentErrorResponseMessageToJson(value: AgentErrorResponseMessage): string { - return JSON.stringify(uncast(value, r("AgentErrorResponseMessage")), null, 2); - } + public static agentErrorResponseMessageToJson(value: AgentErrorResponseMessage): string { + return JSON.stringify(uncast(value, r('AgentErrorResponseMessage')), null, 2); + } - public static toAgentRequestMessage(json: string): AgentRequestMessage { - return cast(JSON.parse(json), r("AgentRequestMessage")); - } + public static toAgentRequestMessage(json: string): AgentRequestMessage { + return cast(JSON.parse(json), r('AgentRequestMessage')); + } - public static agentRequestMessageToJson(value: AgentRequestMessage): string { - return JSON.stringify(uncast(value, r("AgentRequestMessage")), null, 2); - } + public static agentRequestMessageToJson(value: AgentRequestMessage): string { + return JSON.stringify(uncast(value, r('AgentRequestMessage')), null, 2); + } - public static toAgentResponseMessage(json: string): AgentResponseMessage { - return cast(JSON.parse(json), r("AgentResponseMessage")); - } + public static toAgentResponseMessage(json: string): AgentResponseMessage { + return cast(JSON.parse(json), r('AgentResponseMessage')); + } - public static agentResponseMessageToJson(value: AgentResponseMessage): string { - return JSON.stringify(uncast(value, r("AgentResponseMessage")), null, 2); - } + public static agentResponseMessageToJson(value: AgentResponseMessage): string { + return JSON.stringify(uncast(value, r('AgentResponseMessage')), null, 2); + } - public static toBridgeErrorResponseMessage(json: string): BridgeErrorResponseMessage { - return cast(JSON.parse(json), r("BridgeErrorResponseMessage")); - } + public static toBridgeErrorResponseMessage(json: string): BridgeErrorResponseMessage { + return cast(JSON.parse(json), r('BridgeErrorResponseMessage')); + } - public static bridgeErrorResponseMessageToJson(value: BridgeErrorResponseMessage): string { - return JSON.stringify(uncast(value, r("BridgeErrorResponseMessage")), null, 2); - } + public static bridgeErrorResponseMessageToJson(value: BridgeErrorResponseMessage): string { + return JSON.stringify(uncast(value, r('BridgeErrorResponseMessage')), null, 2); + } - public static toBridgeRequestMessage(json: string): BridgeRequestMessage { - return cast(JSON.parse(json), r("BridgeRequestMessage")); - } + public static toBridgeRequestMessage(json: string): BridgeRequestMessage { + return cast(JSON.parse(json), r('BridgeRequestMessage')); + } - public static bridgeRequestMessageToJson(value: BridgeRequestMessage): string { - return JSON.stringify(uncast(value, r("BridgeRequestMessage")), null, 2); - } + public static bridgeRequestMessageToJson(value: BridgeRequestMessage): string { + return JSON.stringify(uncast(value, r('BridgeRequestMessage')), null, 2); + } - public static toBridgeResponseMessage(json: string): BridgeResponseMessage { - return cast(JSON.parse(json), r("BridgeResponseMessage")); - } + public static toBridgeResponseMessage(json: string): BridgeResponseMessage { + return cast(JSON.parse(json), r('BridgeResponseMessage')); + } - public static bridgeResponseMessageToJson(value: BridgeResponseMessage): string { - return JSON.stringify(uncast(value, r("BridgeResponseMessage")), null, 2); - } + public static bridgeResponseMessageToJson(value: BridgeResponseMessage): string { + return JSON.stringify(uncast(value, r('BridgeResponseMessage')), null, 2); + } - public static toBroadcastAgentRequest(json: string): BroadcastAgentRequest { - return cast(JSON.parse(json), r("BroadcastAgentRequest")); - } + public static toBroadcastAgentRequest(json: string): BroadcastAgentRequest { + return cast(JSON.parse(json), r('BroadcastAgentRequest')); + } - public static broadcastAgentRequestToJson(value: BroadcastAgentRequest): string { - return JSON.stringify(uncast(value, r("BroadcastAgentRequest")), null, 2); - } + public static broadcastAgentRequestToJson(value: BroadcastAgentRequest): string { + return JSON.stringify(uncast(value, r('BroadcastAgentRequest')), null, 2); + } - public static toBroadcastBridgeRequest(json: string): BroadcastBridgeRequest { - return cast(JSON.parse(json), r("BroadcastBridgeRequest")); - } + public static toBroadcastBridgeRequest(json: string): BroadcastBridgeRequest { + return cast(JSON.parse(json), r('BroadcastBridgeRequest')); + } - public static broadcastBridgeRequestToJson(value: BroadcastBridgeRequest): string { - return JSON.stringify(uncast(value, r("BroadcastBridgeRequest")), null, 2); - } + public static broadcastBridgeRequestToJson(value: BroadcastBridgeRequest): string { + return JSON.stringify(uncast(value, r('BroadcastBridgeRequest')), null, 2); + } - public static toBridgeCommonDefinitions(json: string): { [key: string]: any } { - return cast(JSON.parse(json), m("any")); - } + public static toBridgeCommonDefinitions(json: string): { [key: string]: any } { + return cast(JSON.parse(json), m('any')); + } - public static bridgeCommonDefinitionsToJson(value: { [key: string]: any }): string { - return JSON.stringify(uncast(value, m("any")), null, 2); - } + public static bridgeCommonDefinitionsToJson(value: { [key: string]: any }): string { + return JSON.stringify(uncast(value, m('any')), null, 2); + } - public static toConnectionStepMessage(json: string): ConnectionStepMessage { - return cast(JSON.parse(json), r("ConnectionStepMessage")); - } + public static toConnectionStepMessage(json: string): ConnectionStepMessage { + return cast(JSON.parse(json), r('ConnectionStepMessage')); + } - public static connectionStepMessageToJson(value: ConnectionStepMessage): string { - return JSON.stringify(uncast(value, r("ConnectionStepMessage")), null, 2); - } + public static connectionStepMessageToJson(value: ConnectionStepMessage): string { + return JSON.stringify(uncast(value, r('ConnectionStepMessage')), null, 2); + } - public static toConnectionStep2Hello(json: string): ConnectionStep2Hello { - return cast(JSON.parse(json), r("ConnectionStep2Hello")); - } + public static toConnectionStep2Hello(json: string): ConnectionStep2Hello { + return cast(JSON.parse(json), r('ConnectionStep2Hello')); + } - public static connectionStep2HelloToJson(value: ConnectionStep2Hello): string { - return JSON.stringify(uncast(value, r("ConnectionStep2Hello")), null, 2); - } + public static connectionStep2HelloToJson(value: ConnectionStep2Hello): string { + return JSON.stringify(uncast(value, r('ConnectionStep2Hello')), null, 2); + } - public static toConnectionStep3Handshake(json: string): ConnectionStep3Handshake { - return cast(JSON.parse(json), r("ConnectionStep3Handshake")); - } + public static toConnectionStep3Handshake(json: string): ConnectionStep3Handshake { + return cast(JSON.parse(json), r('ConnectionStep3Handshake')); + } - public static connectionStep3HandshakeToJson(value: ConnectionStep3Handshake): string { - return JSON.stringify(uncast(value, r("ConnectionStep3Handshake")), null, 2); - } + public static connectionStep3HandshakeToJson(value: ConnectionStep3Handshake): string { + return JSON.stringify(uncast(value, r('ConnectionStep3Handshake')), null, 2); + } - public static toConnectionStep4AuthenticationFailed(json: string): ConnectionStep4AuthenticationFailed { - return cast(JSON.parse(json), r("ConnectionStep4AuthenticationFailed")); - } + public static toConnectionStep4AuthenticationFailed(json: string): ConnectionStep4AuthenticationFailed { + return cast(JSON.parse(json), r('ConnectionStep4AuthenticationFailed')); + } - public static connectionStep4AuthenticationFailedToJson(value: ConnectionStep4AuthenticationFailed): string { - return JSON.stringify(uncast(value, r("ConnectionStep4AuthenticationFailed")), null, 2); - } + public static connectionStep4AuthenticationFailedToJson(value: ConnectionStep4AuthenticationFailed): string { + return JSON.stringify(uncast(value, r('ConnectionStep4AuthenticationFailed')), null, 2); + } - public static toConnectionStep6ConnectedAgentsUpdate(json: string): ConnectionStep6ConnectedAgentsUpdate { - return cast(JSON.parse(json), r("ConnectionStep6ConnectedAgentsUpdate")); - } + public static toConnectionStep6ConnectedAgentsUpdate(json: string): ConnectionStep6ConnectedAgentsUpdate { + return cast(JSON.parse(json), r('ConnectionStep6ConnectedAgentsUpdate')); + } - public static connectionStep6ConnectedAgentsUpdateToJson(value: ConnectionStep6ConnectedAgentsUpdate): string { - return JSON.stringify(uncast(value, r("ConnectionStep6ConnectedAgentsUpdate")), null, 2); - } + public static connectionStep6ConnectedAgentsUpdateToJson(value: ConnectionStep6ConnectedAgentsUpdate): string { + return JSON.stringify(uncast(value, r('ConnectionStep6ConnectedAgentsUpdate')), null, 2); + } - public static toFindInstancesAgentErrorResponse(json: string): FindInstancesAgentErrorResponse { - return cast(JSON.parse(json), r("FindInstancesAgentErrorResponse")); - } + public static toFindInstancesAgentErrorResponse(json: string): FindInstancesAgentErrorResponse { + return cast(JSON.parse(json), r('FindInstancesAgentErrorResponse')); + } - public static findInstancesAgentErrorResponseToJson(value: FindInstancesAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentErrorResponse")), null, 2); - } + public static findInstancesAgentErrorResponseToJson(value: FindInstancesAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentErrorResponse')), null, 2); + } - public static toFindInstancesAgentRequest(json: string): FindInstancesAgentRequest { - return cast(JSON.parse(json), r("FindInstancesAgentRequest")); - } + public static toFindInstancesAgentRequest(json: string): FindInstancesAgentRequest { + return cast(JSON.parse(json), r('FindInstancesAgentRequest')); + } - public static findInstancesAgentRequestToJson(value: FindInstancesAgentRequest): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentRequest")), null, 2); - } + public static findInstancesAgentRequestToJson(value: FindInstancesAgentRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentRequest')), null, 2); + } - public static toFindInstancesAgentResponse(json: string): FindInstancesAgentResponse { - return cast(JSON.parse(json), r("FindInstancesAgentResponse")); - } + public static toFindInstancesAgentResponse(json: string): FindInstancesAgentResponse { + return cast(JSON.parse(json), r('FindInstancesAgentResponse')); + } - public static findInstancesAgentResponseToJson(value: FindInstancesAgentResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesAgentResponse")), null, 2); - } + public static findInstancesAgentResponseToJson(value: FindInstancesAgentResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesAgentResponse')), null, 2); + } - public static toFindInstancesBridgeErrorResponse(json: string): FindInstancesBridgeErrorResponse { - return cast(JSON.parse(json), r("FindInstancesBridgeErrorResponse")); - } + public static toFindInstancesBridgeErrorResponse(json: string): FindInstancesBridgeErrorResponse { + return cast(JSON.parse(json), r('FindInstancesBridgeErrorResponse')); + } - public static findInstancesBridgeErrorResponseToJson(value: FindInstancesBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeErrorResponse")), null, 2); - } + public static findInstancesBridgeErrorResponseToJson(value: FindInstancesBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeErrorResponse')), null, 2); + } - public static toFindInstancesBridgeRequest(json: string): FindInstancesBridgeRequest { - return cast(JSON.parse(json), r("FindInstancesBridgeRequest")); - } + public static toFindInstancesBridgeRequest(json: string): FindInstancesBridgeRequest { + return cast(JSON.parse(json), r('FindInstancesBridgeRequest')); + } - public static findInstancesBridgeRequestToJson(value: FindInstancesBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeRequest")), null, 2); - } + public static findInstancesBridgeRequestToJson(value: FindInstancesBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeRequest')), null, 2); + } - public static toFindInstancesBridgeResponse(json: string): FindInstancesBridgeResponse { - return cast(JSON.parse(json), r("FindInstancesBridgeResponse")); - } + public static toFindInstancesBridgeResponse(json: string): FindInstancesBridgeResponse { + return cast(JSON.parse(json), r('FindInstancesBridgeResponse')); + } - public static findInstancesBridgeResponseToJson(value: FindInstancesBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindInstancesBridgeResponse")), null, 2); - } + public static findInstancesBridgeResponseToJson(value: FindInstancesBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindInstancesBridgeResponse')), null, 2); + } - public static toFindIntentAgentErrorResponse(json: string): FindIntentAgentErrorResponse { - return cast(JSON.parse(json), r("FindIntentAgentErrorResponse")); - } + public static toFindIntentAgentErrorResponse(json: string): FindIntentAgentErrorResponse { + return cast(JSON.parse(json), r('FindIntentAgentErrorResponse')); + } - public static findIntentAgentErrorResponseToJson(value: FindIntentAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentAgentErrorResponse")), null, 2); - } + public static findIntentAgentErrorResponseToJson(value: FindIntentAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentAgentErrorResponse')), null, 2); + } - public static toFindIntentAgentRequest(json: string): FindIntentAgentRequest { - return cast(JSON.parse(json), r("FindIntentAgentRequest")); - } + public static toFindIntentAgentRequest(json: string): FindIntentAgentRequest { + return cast(JSON.parse(json), r('FindIntentAgentRequest')); + } - public static findIntentAgentRequestToJson(value: FindIntentAgentRequest): string { - return JSON.stringify(uncast(value, r("FindIntentAgentRequest")), null, 2); - } + public static findIntentAgentRequestToJson(value: FindIntentAgentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentAgentRequest')), null, 2); + } - public static toFindIntentAgentResponse(json: string): FindIntentAgentResponse { - return cast(JSON.parse(json), r("FindIntentAgentResponse")); - } + public static toFindIntentAgentResponse(json: string): FindIntentAgentResponse { + return cast(JSON.parse(json), r('FindIntentAgentResponse')); + } - public static findIntentAgentResponseToJson(value: FindIntentAgentResponse): string { - return JSON.stringify(uncast(value, r("FindIntentAgentResponse")), null, 2); - } + public static findIntentAgentResponseToJson(value: FindIntentAgentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentAgentResponse')), null, 2); + } - public static toFindIntentBridgeErrorResponse(json: string): FindIntentBridgeErrorResponse { - return cast(JSON.parse(json), r("FindIntentBridgeErrorResponse")); - } + public static toFindIntentBridgeErrorResponse(json: string): FindIntentBridgeErrorResponse { + return cast(JSON.parse(json), r('FindIntentBridgeErrorResponse')); + } - public static findIntentBridgeErrorResponseToJson(value: FindIntentBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeErrorResponse")), null, 2); - } - - public static toFindIntentBridgeRequest(json: string): FindIntentBridgeRequest { - return cast(JSON.parse(json), r("FindIntentBridgeRequest")); - } + public static findIntentBridgeErrorResponseToJson(value: FindIntentBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeErrorResponse')), null, 2); + } - public static findIntentBridgeRequestToJson(value: FindIntentBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeRequest")), null, 2); - } - - public static toFindIntentBridgeResponse(json: string): FindIntentBridgeResponse { - return cast(JSON.parse(json), r("FindIntentBridgeResponse")); - } + public static toFindIntentBridgeRequest(json: string): FindIntentBridgeRequest { + return cast(JSON.parse(json), r('FindIntentBridgeRequest')); + } - public static findIntentBridgeResponseToJson(value: FindIntentBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindIntentBridgeResponse")), null, 2); - } + public static findIntentBridgeRequestToJson(value: FindIntentBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeRequest')), null, 2); + } - public static toFindIntentsByContextAgentErrorResponse(json: string): FindIntentsByContextAgentErrorResponse { - return cast(JSON.parse(json), r("FindIntentsByContextAgentErrorResponse")); - } + public static toFindIntentBridgeResponse(json: string): FindIntentBridgeResponse { + return cast(JSON.parse(json), r('FindIntentBridgeResponse')); + } - public static findIntentsByContextAgentErrorResponseToJson(value: FindIntentsByContextAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentErrorResponse")), null, 2); - } + public static findIntentBridgeResponseToJson(value: FindIntentBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindIntentBridgeResponse')), null, 2); + } - public static toFindIntentsByContextAgentRequest(json: string): FindIntentsByContextAgentRequest { - return cast(JSON.parse(json), r("FindIntentsByContextAgentRequest")); - } + public static toFindIntentsByContextAgentErrorResponse(json: string): FindIntentsByContextAgentErrorResponse { + return cast(JSON.parse(json), r('FindIntentsByContextAgentErrorResponse')); + } - public static findIntentsByContextAgentRequestToJson(value: FindIntentsByContextAgentRequest): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentRequest")), null, 2); - } + public static findIntentsByContextAgentErrorResponseToJson(value: FindIntentsByContextAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentErrorResponse')), null, 2); + } - public static toFindIntentsByContextAgentResponse(json: string): FindIntentsByContextAgentResponse { - return cast(JSON.parse(json), r("FindIntentsByContextAgentResponse")); - } + public static toFindIntentsByContextAgentRequest(json: string): FindIntentsByContextAgentRequest { + return cast(JSON.parse(json), r('FindIntentsByContextAgentRequest')); + } - public static findIntentsByContextAgentResponseToJson(value: FindIntentsByContextAgentResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextAgentResponse")), null, 2); - } - - public static toFindIntentsByContextBridgeErrorResponse(json: string): FindIntentsByContextBridgeErrorResponse { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeErrorResponse")); - } - - public static findIntentsByContextBridgeErrorResponseToJson(value: FindIntentsByContextBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeErrorResponse")), null, 2); - } - - public static toFindIntentsByContextBridgeRequest(json: string): FindIntentsByContextBridgeRequest { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeRequest")); - } - - public static findIntentsByContextBridgeRequestToJson(value: FindIntentsByContextBridgeRequest): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeRequest")), null, 2); - } - - public static toFindIntentsByContextBridgeResponse(json: string): FindIntentsByContextBridgeResponse { - return cast(JSON.parse(json), r("FindIntentsByContextBridgeResponse")); - } + public static findIntentsByContextAgentRequestToJson(value: FindIntentsByContextAgentRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentRequest')), null, 2); + } - public static findIntentsByContextBridgeResponseToJson(value: FindIntentsByContextBridgeResponse): string { - return JSON.stringify(uncast(value, r("FindIntentsByContextBridgeResponse")), null, 2); - } + public static toFindIntentsByContextAgentResponse(json: string): FindIntentsByContextAgentResponse { + return cast(JSON.parse(json), r('FindIntentsByContextAgentResponse')); + } - public static toGetAppMetadataAgentErrorResponse(json: string): GetAppMetadataAgentErrorResponse { - return cast(JSON.parse(json), r("GetAppMetadataAgentErrorResponse")); - } + public static findIntentsByContextAgentResponseToJson(value: FindIntentsByContextAgentResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextAgentResponse')), null, 2); + } - public static getAppMetadataAgentErrorResponseToJson(value: GetAppMetadataAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentErrorResponse")), null, 2); - } + public static toFindIntentsByContextBridgeErrorResponse(json: string): FindIntentsByContextBridgeErrorResponse { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeErrorResponse')); + } - public static toGetAppMetadataAgentRequest(json: string): GetAppMetadataAgentRequest { - return cast(JSON.parse(json), r("GetAppMetadataAgentRequest")); - } + public static findIntentsByContextBridgeErrorResponseToJson(value: FindIntentsByContextBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeErrorResponse')), null, 2); + } - public static getAppMetadataAgentRequestToJson(value: GetAppMetadataAgentRequest): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentRequest")), null, 2); - } + public static toFindIntentsByContextBridgeRequest(json: string): FindIntentsByContextBridgeRequest { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeRequest')); + } - public static toGetAppMetadataAgentResponse(json: string): GetAppMetadataAgentResponse { - return cast(JSON.parse(json), r("GetAppMetadataAgentResponse")); - } + public static findIntentsByContextBridgeRequestToJson(value: FindIntentsByContextBridgeRequest): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeRequest')), null, 2); + } - public static getAppMetadataAgentResponseToJson(value: GetAppMetadataAgentResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataAgentResponse")), null, 2); - } + public static toFindIntentsByContextBridgeResponse(json: string): FindIntentsByContextBridgeResponse { + return cast(JSON.parse(json), r('FindIntentsByContextBridgeResponse')); + } - public static toGetAppMetadataBridgeErrorResponse(json: string): GetAppMetadataBridgeErrorResponse { - return cast(JSON.parse(json), r("GetAppMetadataBridgeErrorResponse")); - } + public static findIntentsByContextBridgeResponseToJson(value: FindIntentsByContextBridgeResponse): string { + return JSON.stringify(uncast(value, r('FindIntentsByContextBridgeResponse')), null, 2); + } - public static getAppMetadataBridgeErrorResponseToJson(value: GetAppMetadataBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeErrorResponse")), null, 2); - } + public static toGetAppMetadataAgentErrorResponse(json: string): GetAppMetadataAgentErrorResponse { + return cast(JSON.parse(json), r('GetAppMetadataAgentErrorResponse')); + } - public static toGetAppMetadataBridgeRequest(json: string): GetAppMetadataBridgeRequest { - return cast(JSON.parse(json), r("GetAppMetadataBridgeRequest")); - } + public static getAppMetadataAgentErrorResponseToJson(value: GetAppMetadataAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentErrorResponse')), null, 2); + } - public static getAppMetadataBridgeRequestToJson(value: GetAppMetadataBridgeRequest): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeRequest")), null, 2); - } + public static toGetAppMetadataAgentRequest(json: string): GetAppMetadataAgentRequest { + return cast(JSON.parse(json), r('GetAppMetadataAgentRequest')); + } - public static toGetAppMetadataBridgeResponse(json: string): GetAppMetadataBridgeResponse { - return cast(JSON.parse(json), r("GetAppMetadataBridgeResponse")); - } + public static getAppMetadataAgentRequestToJson(value: GetAppMetadataAgentRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentRequest')), null, 2); + } - public static getAppMetadataBridgeResponseToJson(value: GetAppMetadataBridgeResponse): string { - return JSON.stringify(uncast(value, r("GetAppMetadataBridgeResponse")), null, 2); - } + public static toGetAppMetadataAgentResponse(json: string): GetAppMetadataAgentResponse { + return cast(JSON.parse(json), r('GetAppMetadataAgentResponse')); + } - public static toOpenAgentErrorResponse(json: string): OpenAgentErrorResponse { - return cast(JSON.parse(json), r("OpenAgentErrorResponse")); - } + public static getAppMetadataAgentResponseToJson(value: GetAppMetadataAgentResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataAgentResponse')), null, 2); + } - public static openAgentErrorResponseToJson(value: OpenAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("OpenAgentErrorResponse")), null, 2); - } + public static toGetAppMetadataBridgeErrorResponse(json: string): GetAppMetadataBridgeErrorResponse { + return cast(JSON.parse(json), r('GetAppMetadataBridgeErrorResponse')); + } + + public static getAppMetadataBridgeErrorResponseToJson(value: GetAppMetadataBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeErrorResponse')), null, 2); + } + + public static toGetAppMetadataBridgeRequest(json: string): GetAppMetadataBridgeRequest { + return cast(JSON.parse(json), r('GetAppMetadataBridgeRequest')); + } + + public static getAppMetadataBridgeRequestToJson(value: GetAppMetadataBridgeRequest): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeRequest')), null, 2); + } + + public static toGetAppMetadataBridgeResponse(json: string): GetAppMetadataBridgeResponse { + return cast(JSON.parse(json), r('GetAppMetadataBridgeResponse')); + } + + public static getAppMetadataBridgeResponseToJson(value: GetAppMetadataBridgeResponse): string { + return JSON.stringify(uncast(value, r('GetAppMetadataBridgeResponse')), null, 2); + } + + public static toOpenAgentErrorResponse(json: string): OpenAgentErrorResponse { + return cast(JSON.parse(json), r('OpenAgentErrorResponse')); + } + + public static openAgentErrorResponseToJson(value: OpenAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('OpenAgentErrorResponse')), null, 2); + } + + public static toOpenAgentRequest(json: string): OpenAgentRequest { + return cast(JSON.parse(json), r('OpenAgentRequest')); + } + + public static openAgentRequestToJson(value: OpenAgentRequest): string { + return JSON.stringify(uncast(value, r('OpenAgentRequest')), null, 2); + } + + public static toOpenAgentResponse(json: string): OpenAgentResponse { + return cast(JSON.parse(json), r('OpenAgentResponse')); + } + + public static openAgentResponseToJson(value: OpenAgentResponse): string { + return JSON.stringify(uncast(value, r('OpenAgentResponse')), null, 2); + } + + public static toOpenBridgeErrorResponse(json: string): OpenBridgeErrorResponse { + return cast(JSON.parse(json), r('OpenBridgeErrorResponse')); + } + + public static openBridgeErrorResponseToJson(value: OpenBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('OpenBridgeErrorResponse')), null, 2); + } + + public static toOpenBridgeRequest(json: string): OpenBridgeRequest { + return cast(JSON.parse(json), r('OpenBridgeRequest')); + } + + public static openBridgeRequestToJson(value: OpenBridgeRequest): string { + return JSON.stringify(uncast(value, r('OpenBridgeRequest')), null, 2); + } + + public static toOpenBridgeResponse(json: string): OpenBridgeResponse { + return cast(JSON.parse(json), r('OpenBridgeResponse')); + } + + public static openBridgeResponseToJson(value: OpenBridgeResponse): string { + return JSON.stringify(uncast(value, r('OpenBridgeResponse')), null, 2); + } + + public static toPrivateChannelBroadcastAgentRequest(json: string): PrivateChannelBroadcastAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelBroadcastAgentRequest')); + } + + public static privateChannelBroadcastAgentRequestToJson(value: PrivateChannelBroadcastAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelBroadcastAgentRequest')), null, 2); + } + + public static toPrivateChannelBroadcastBridgeRequest(json: string): PrivateChannelBroadcastBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelBroadcastBridgeRequest')); + } + + public static privateChannelBroadcastBridgeRequestToJson(value: PrivateChannelBroadcastBridgeRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelBroadcastBridgeRequest')), null, 2); + } + + public static toPrivateChannelEventListenerAddedAgentRequest( + json: string + ): PrivateChannelEventListenerAddedAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerAddedAgentRequest')); + } + + public static privateChannelEventListenerAddedAgentRequestToJson( + value: PrivateChannelEventListenerAddedAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerAddedAgentRequest')), null, 2); + } + + public static toPrivateChannelEventListenerAddedBridgeRequest( + json: string + ): PrivateChannelEventListenerAddedBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerAddedBridgeRequest')); + } + + public static privateChannelEventListenerAddedBridgeRequestToJson( + value: PrivateChannelEventListenerAddedBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerAddedBridgeRequest')), null, 2); + } + + public static toPrivateChannelEventListenerRemovedAgentRequest( + json: string + ): PrivateChannelEventListenerRemovedAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerRemovedAgentRequest')); + } + + public static privateChannelEventListenerRemovedAgentRequestToJson( + value: PrivateChannelEventListenerRemovedAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerRemovedAgentRequest')), null, 2); + } + + public static toPrivateChannelEventListenerRemovedBridgeRequest( + json: string + ): PrivateChannelEventListenerRemovedBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelEventListenerRemovedBridgeRequest')); + } + + public static privateChannelEventListenerRemovedBridgeRequestToJson( + value: PrivateChannelEventListenerRemovedBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelEventListenerRemovedBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnAddContextListenerAgentRequest( + json: string + ): PrivateChannelOnAddContextListenerAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnAddContextListenerAgentRequest')); + } + + public static privateChannelOnAddContextListenerAgentRequestToJson( + value: PrivateChannelOnAddContextListenerAgentRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnAddContextListenerAgentRequest')), null, 2); + } + + public static toPrivateChannelOnAddContextListenerBridgeRequest( + json: string + ): PrivateChannelOnAddContextListenerBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnAddContextListenerBridgeRequest')); + } + + public static privateChannelOnAddContextListenerBridgeRequestToJson( + value: PrivateChannelOnAddContextListenerBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnAddContextListenerBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnDisconnectAgentRequest(json: string): PrivateChannelOnDisconnectAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnDisconnectAgentRequest')); + } + + public static privateChannelOnDisconnectAgentRequestToJson(value: PrivateChannelOnDisconnectAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnDisconnectAgentRequest')), null, 2); + } + + public static toPrivateChannelOnDisconnectBridgeRequest(json: string): PrivateChannelOnDisconnectBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnDisconnectBridgeRequest')); + } + + public static privateChannelOnDisconnectBridgeRequestToJson(value: PrivateChannelOnDisconnectBridgeRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnDisconnectBridgeRequest')), null, 2); + } + + public static toPrivateChannelOnUnsubscribeAgentRequest(json: string): PrivateChannelOnUnsubscribeAgentRequest { + return cast(JSON.parse(json), r('PrivateChannelOnUnsubscribeAgentRequest')); + } + + public static privateChannelOnUnsubscribeAgentRequestToJson(value: PrivateChannelOnUnsubscribeAgentRequest): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnUnsubscribeAgentRequest')), null, 2); + } + + public static toPrivateChannelOnUnsubscribeBridgeRequest(json: string): PrivateChannelOnUnsubscribeBridgeRequest { + return cast(JSON.parse(json), r('PrivateChannelOnUnsubscribeBridgeRequest')); + } + + public static privateChannelOnUnsubscribeBridgeRequestToJson( + value: PrivateChannelOnUnsubscribeBridgeRequest + ): string { + return JSON.stringify(uncast(value, r('PrivateChannelOnUnsubscribeBridgeRequest')), null, 2); + } + + public static toRaiseIntentAgentErrorResponse(json: string): RaiseIntentAgentErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentAgentErrorResponse')); + } + + public static raiseIntentAgentErrorResponseToJson(value: RaiseIntentAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentErrorResponse')), null, 2); + } + + public static toRaiseIntentAgentRequest(json: string): RaiseIntentAgentRequest { + return cast(JSON.parse(json), r('RaiseIntentAgentRequest')); + } + + public static raiseIntentAgentRequestToJson(value: RaiseIntentAgentRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentRequest')), null, 2); + } + + public static toRaiseIntentAgentResponse(json: string): RaiseIntentAgentResponse { + return cast(JSON.parse(json), r('RaiseIntentAgentResponse')); + } + + public static raiseIntentAgentResponseToJson(value: RaiseIntentAgentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentAgentResponse')), null, 2); + } + + public static toRaiseIntentBridgeErrorResponse(json: string): RaiseIntentBridgeErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentBridgeErrorResponse')); + } + + public static raiseIntentBridgeErrorResponseToJson(value: RaiseIntentBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeErrorResponse')), null, 2); + } + + public static toRaiseIntentBridgeRequest(json: string): RaiseIntentBridgeRequest { + return cast(JSON.parse(json), r('RaiseIntentBridgeRequest')); + } + + public static raiseIntentBridgeRequestToJson(value: RaiseIntentBridgeRequest): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeRequest')), null, 2); + } + + public static toRaiseIntentBridgeResponse(json: string): RaiseIntentBridgeResponse { + return cast(JSON.parse(json), r('RaiseIntentBridgeResponse')); + } + + public static raiseIntentBridgeResponseToJson(value: RaiseIntentBridgeResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentBridgeResponse')), null, 2); + } - public static toOpenAgentRequest(json: string): OpenAgentRequest { - return cast(JSON.parse(json), r("OpenAgentRequest")); - } + public static toRaiseIntentResultAgentErrorResponse(json: string): RaiseIntentResultAgentErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentResultAgentErrorResponse')); + } - public static openAgentRequestToJson(value: OpenAgentRequest): string { - return JSON.stringify(uncast(value, r("OpenAgentRequest")), null, 2); - } + public static raiseIntentResultAgentErrorResponseToJson(value: RaiseIntentResultAgentErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultAgentErrorResponse')), null, 2); + } - public static toOpenAgentResponse(json: string): OpenAgentResponse { - return cast(JSON.parse(json), r("OpenAgentResponse")); - } + public static toRaiseIntentResultAgentResponse(json: string): RaiseIntentResultAgentResponse { + return cast(JSON.parse(json), r('RaiseIntentResultAgentResponse')); + } - public static openAgentResponseToJson(value: OpenAgentResponse): string { - return JSON.stringify(uncast(value, r("OpenAgentResponse")), null, 2); - } + public static raiseIntentResultAgentResponseToJson(value: RaiseIntentResultAgentResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultAgentResponse')), null, 2); + } - public static toOpenBridgeErrorResponse(json: string): OpenBridgeErrorResponse { - return cast(JSON.parse(json), r("OpenBridgeErrorResponse")); - } + public static toRaiseIntentResultBridgeErrorResponse(json: string): RaiseIntentResultBridgeErrorResponse { + return cast(JSON.parse(json), r('RaiseIntentResultBridgeErrorResponse')); + } - public static openBridgeErrorResponseToJson(value: OpenBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("OpenBridgeErrorResponse")), null, 2); - } + public static raiseIntentResultBridgeErrorResponseToJson(value: RaiseIntentResultBridgeErrorResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultBridgeErrorResponse')), null, 2); + } - public static toOpenBridgeRequest(json: string): OpenBridgeRequest { - return cast(JSON.parse(json), r("OpenBridgeRequest")); - } + public static toRaiseIntentResultBridgeResponse(json: string): RaiseIntentResultBridgeResponse { + return cast(JSON.parse(json), r('RaiseIntentResultBridgeResponse')); + } - public static openBridgeRequestToJson(value: OpenBridgeRequest): string { - return JSON.stringify(uncast(value, r("OpenBridgeRequest")), null, 2); - } - - public static toOpenBridgeResponse(json: string): OpenBridgeResponse { - return cast(JSON.parse(json), r("OpenBridgeResponse")); - } - - public static openBridgeResponseToJson(value: OpenBridgeResponse): string { - return JSON.stringify(uncast(value, r("OpenBridgeResponse")), null, 2); - } - - public static toPrivateChannelBroadcastAgentRequest(json: string): PrivateChannelBroadcastAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelBroadcastAgentRequest")); - } - - public static privateChannelBroadcastAgentRequestToJson(value: PrivateChannelBroadcastAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelBroadcastAgentRequest")), null, 2); - } - - public static toPrivateChannelBroadcastBridgeRequest(json: string): PrivateChannelBroadcastBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelBroadcastBridgeRequest")); - } - - public static privateChannelBroadcastBridgeRequestToJson(value: PrivateChannelBroadcastBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelBroadcastBridgeRequest")), null, 2); - } - - public static toPrivateChannelEventListenerAddedAgentRequest(json: string): PrivateChannelEventListenerAddedAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerAddedAgentRequest")); - } - - public static privateChannelEventListenerAddedAgentRequestToJson(value: PrivateChannelEventListenerAddedAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerAddedAgentRequest")), null, 2); - } - - public static toPrivateChannelEventListenerAddedBridgeRequest(json: string): PrivateChannelEventListenerAddedBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerAddedBridgeRequest")); - } - - public static privateChannelEventListenerAddedBridgeRequestToJson(value: PrivateChannelEventListenerAddedBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerAddedBridgeRequest")), null, 2); - } - - public static toPrivateChannelEventListenerRemovedAgentRequest(json: string): PrivateChannelEventListenerRemovedAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerRemovedAgentRequest")); - } - - public static privateChannelEventListenerRemovedAgentRequestToJson(value: PrivateChannelEventListenerRemovedAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerRemovedAgentRequest")), null, 2); - } - - public static toPrivateChannelEventListenerRemovedBridgeRequest(json: string): PrivateChannelEventListenerRemovedBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelEventListenerRemovedBridgeRequest")); - } - - public static privateChannelEventListenerRemovedBridgeRequestToJson(value: PrivateChannelEventListenerRemovedBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelEventListenerRemovedBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnAddContextListenerAgentRequest(json: string): PrivateChannelOnAddContextListenerAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnAddContextListenerAgentRequest")); - } - - public static privateChannelOnAddContextListenerAgentRequestToJson(value: PrivateChannelOnAddContextListenerAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnAddContextListenerAgentRequest")), null, 2); - } - - public static toPrivateChannelOnAddContextListenerBridgeRequest(json: string): PrivateChannelOnAddContextListenerBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnAddContextListenerBridgeRequest")); - } - - public static privateChannelOnAddContextListenerBridgeRequestToJson(value: PrivateChannelOnAddContextListenerBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnAddContextListenerBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnDisconnectAgentRequest(json: string): PrivateChannelOnDisconnectAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnDisconnectAgentRequest")); - } - - public static privateChannelOnDisconnectAgentRequestToJson(value: PrivateChannelOnDisconnectAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnDisconnectAgentRequest")), null, 2); - } - - public static toPrivateChannelOnDisconnectBridgeRequest(json: string): PrivateChannelOnDisconnectBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnDisconnectBridgeRequest")); - } - - public static privateChannelOnDisconnectBridgeRequestToJson(value: PrivateChannelOnDisconnectBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnDisconnectBridgeRequest")), null, 2); - } - - public static toPrivateChannelOnUnsubscribeAgentRequest(json: string): PrivateChannelOnUnsubscribeAgentRequest { - return cast(JSON.parse(json), r("PrivateChannelOnUnsubscribeAgentRequest")); - } - - public static privateChannelOnUnsubscribeAgentRequestToJson(value: PrivateChannelOnUnsubscribeAgentRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnUnsubscribeAgentRequest")), null, 2); - } - - public static toPrivateChannelOnUnsubscribeBridgeRequest(json: string): PrivateChannelOnUnsubscribeBridgeRequest { - return cast(JSON.parse(json), r("PrivateChannelOnUnsubscribeBridgeRequest")); - } - - public static privateChannelOnUnsubscribeBridgeRequestToJson(value: PrivateChannelOnUnsubscribeBridgeRequest): string { - return JSON.stringify(uncast(value, r("PrivateChannelOnUnsubscribeBridgeRequest")), null, 2); - } - - public static toRaiseIntentAgentErrorResponse(json: string): RaiseIntentAgentErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentAgentErrorResponse")); - } - - public static raiseIntentAgentErrorResponseToJson(value: RaiseIntentAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentErrorResponse")), null, 2); - } - - public static toRaiseIntentAgentRequest(json: string): RaiseIntentAgentRequest { - return cast(JSON.parse(json), r("RaiseIntentAgentRequest")); - } - - public static raiseIntentAgentRequestToJson(value: RaiseIntentAgentRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentRequest")), null, 2); - } - - public static toRaiseIntentAgentResponse(json: string): RaiseIntentAgentResponse { - return cast(JSON.parse(json), r("RaiseIntentAgentResponse")); - } - - public static raiseIntentAgentResponseToJson(value: RaiseIntentAgentResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentAgentResponse")), null, 2); - } - - public static toRaiseIntentBridgeErrorResponse(json: string): RaiseIntentBridgeErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentBridgeErrorResponse")); - } - - public static raiseIntentBridgeErrorResponseToJson(value: RaiseIntentBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeErrorResponse")), null, 2); - } - - public static toRaiseIntentBridgeRequest(json: string): RaiseIntentBridgeRequest { - return cast(JSON.parse(json), r("RaiseIntentBridgeRequest")); - } - - public static raiseIntentBridgeRequestToJson(value: RaiseIntentBridgeRequest): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeRequest")), null, 2); - } - - public static toRaiseIntentBridgeResponse(json: string): RaiseIntentBridgeResponse { - return cast(JSON.parse(json), r("RaiseIntentBridgeResponse")); - } - - public static raiseIntentBridgeResponseToJson(value: RaiseIntentBridgeResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentBridgeResponse")), null, 2); - } - - public static toRaiseIntentResultAgentErrorResponse(json: string): RaiseIntentResultAgentErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentResultAgentErrorResponse")); - } - - public static raiseIntentResultAgentErrorResponseToJson(value: RaiseIntentResultAgentErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultAgentErrorResponse")), null, 2); - } - - public static toRaiseIntentResultAgentResponse(json: string): RaiseIntentResultAgentResponse { - return cast(JSON.parse(json), r("RaiseIntentResultAgentResponse")); - } - - public static raiseIntentResultAgentResponseToJson(value: RaiseIntentResultAgentResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultAgentResponse")), null, 2); - } - - public static toRaiseIntentResultBridgeErrorResponse(json: string): RaiseIntentResultBridgeErrorResponse { - return cast(JSON.parse(json), r("RaiseIntentResultBridgeErrorResponse")); - } - - public static raiseIntentResultBridgeErrorResponseToJson(value: RaiseIntentResultBridgeErrorResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultBridgeErrorResponse")), null, 2); - } - - public static toRaiseIntentResultBridgeResponse(json: string): RaiseIntentResultBridgeResponse { - return cast(JSON.parse(json), r("RaiseIntentResultBridgeResponse")); - } - - public static raiseIntentResultBridgeResponseToJson(value: RaiseIntentResultBridgeResponse): string { - return JSON.stringify(uncast(value, r("RaiseIntentResultBridgeResponse")), null, 2); - } + public static raiseIntentResultBridgeResponseToJson(value: RaiseIntentResultBridgeResponse): string { + return JSON.stringify(uncast(value, r('RaiseIntentResultBridgeResponse')), null, 2); + } } function invalidValue(typ: any, val: any, key: any, parent: any = ''): never { - const prettyTyp = prettyTypeName(typ); - const parentText = parent ? ` on ${parent}` : ''; - const keyText = key ? ` for key "${key}"` : ''; - throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); + const prettyTyp = prettyTypeName(typ); + const parentText = parent ? ` on ${parent}` : ''; + const keyText = key ? ` for key "${key}"` : ''; + throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`); } function prettyTypeName(typ: any): string { - if (Array.isArray(typ)) { - if (typ.length === 2 && typ[0] === undefined) { - return `an optional ${prettyTypeName(typ[1])}`; - } else { - return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`; - } - } else if (typeof typ === "object" && typ.literal !== undefined) { - return typ.literal; + if (Array.isArray(typ)) { + if (typ.length === 2 && typ[0] === undefined) { + return `an optional ${prettyTypeName(typ[1])}`; } else { - return typeof typ; + return `one of [${typ + .map(a => { + return prettyTypeName(a); + }) + .join(', ')}]`; } + } else if (typeof typ === 'object' && typ.literal !== undefined) { + return typ.literal; + } else { + return typeof typ; + } } function jsonToJSProps(typ: any): any { - if (typ.jsonToJS === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ }); - typ.jsonToJS = map; - } - return typ.jsonToJS; + if (typ.jsonToJS === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.json] = { key: p.js, typ: p.typ })); + typ.jsonToJS = map; + } + return typ.jsonToJS; } function jsToJSONProps(typ: any): any { - if (typ.jsToJSON === undefined) { - const map: any = {}; - typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ }); - typ.jsToJSON = map; - } - return typ.jsToJSON; + if (typ.jsToJSON === undefined) { + const map: any = {}; + typ.props.forEach((p: any) => (map[p.js] = { key: p.json, typ: p.typ })); + typ.jsToJSON = map; + } + return typ.jsToJSON; } function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any { - function transformPrimitive(typ: string, val: any): any { - if (typeof typ === typeof val) return val; - return invalidValue(typ, val, key, parent); - } - - function transformUnion(typs: any[], val: any): any { - // val must validate against one typ in typs - const l = typs.length; - for (let i = 0; i < l; i++) { - const typ = typs[i]; - try { - return transform(val, typ, getProps); - } catch (_) {} - } - return invalidValue(typs, val, key, parent); - } - - function transformEnum(cases: string[], val: any): any { - if (cases.indexOf(val) !== -1) return val; - return invalidValue(cases.map(a => { return l(a); }), val, key, parent); - } - - function transformArray(typ: any, val: any): any { - // val must be an array with no invalid elements - if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent); - return val.map(el => transform(el, typ, getProps)); - } - - function transformDate(val: any): any { - if (val === null) { - return null; - } - const d = new Date(val); - if (isNaN(d.valueOf())) { - return invalidValue(l("Date"), val, key, parent); - } - return d; - } - - function transformObject(props: { [k: string]: any }, additional: any, val: any): any { - if (val === null || typeof val !== "object" || Array.isArray(val)) { - return invalidValue(l(ref || "object"), val, key, parent); - } - const result: any = {}; - Object.getOwnPropertyNames(props).forEach(key => { - const prop = props[key]; - const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; - result[prop.key] = transform(v, prop.typ, getProps, key, ref); - }); - Object.getOwnPropertyNames(val).forEach(key => { - if (!Object.prototype.hasOwnProperty.call(props, key)) { - result[key] = transform(val[key], additional, getProps, key, ref); - } - }); - return result; - } - - if (typ === "any") return val; - if (typ === null) { - if (val === null) return val; - return invalidValue(typ, val, key, parent); - } - if (typ === false) return invalidValue(typ, val, key, parent); - let ref: any = undefined; - while (typeof typ === "object" && typ.ref !== undefined) { - ref = typ.ref; - typ = typeMap[typ.ref]; - } - if (Array.isArray(typ)) return transformEnum(typ, val); - if (typeof typ === "object") { - return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val) - : typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val) - : typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val) - : invalidValue(typ, val, key, parent); - } - // Numbers can be parsed by Date but shouldn't be. - if (typ === Date && typeof val !== "number") return transformDate(val); - return transformPrimitive(typ, val); + function transformPrimitive(typ: string, val: any): any { + if (typeof typ === typeof val) return val; + return invalidValue(typ, val, key, parent); + } + + function transformUnion(typs: any[], val: any): any { + // val must validate against one typ in typs + const l = typs.length; + for (let i = 0; i < l; i++) { + const typ = typs[i]; + try { + return transform(val, typ, getProps); + } catch (_) {} + } + return invalidValue(typs, val, key, parent); + } + + function transformEnum(cases: string[], val: any): any { + if (cases.indexOf(val) !== -1) return val; + return invalidValue( + cases.map(a => { + return l(a); + }), + val, + key, + parent + ); + } + + function transformArray(typ: any, val: any): any { + // val must be an array with no invalid elements + if (!Array.isArray(val)) return invalidValue(l('array'), val, key, parent); + return val.map(el => transform(el, typ, getProps)); + } + + function transformDate(val: any): any { + if (val === null) { + return null; + } + const d = new Date(val); + if (isNaN(d.valueOf())) { + return invalidValue(l('Date'), val, key, parent); + } + return d; + } + + function transformObject(props: { [k: string]: any }, additional: any, val: any): any { + if (val === null || typeof val !== 'object' || Array.isArray(val)) { + return invalidValue(l(ref || 'object'), val, key, parent); + } + const result: any = {}; + Object.getOwnPropertyNames(props).forEach(key => { + const prop = props[key]; + const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; + result[prop.key] = transform(v, prop.typ, getProps, key, ref); + }); + Object.getOwnPropertyNames(val).forEach(key => { + if (!Object.prototype.hasOwnProperty.call(props, key)) { + result[key] = transform(val[key], additional, getProps, key, ref); + } + }); + return result; + } + + if (typ === 'any') return val; + if (typ === null) { + if (val === null) return val; + return invalidValue(typ, val, key, parent); + } + if (typ === false) return invalidValue(typ, val, key, parent); + let ref: any = undefined; + while (typeof typ === 'object' && typ.ref !== undefined) { + ref = typ.ref; + typ = typeMap[typ.ref]; + } + if (Array.isArray(typ)) return transformEnum(typ, val); + if (typeof typ === 'object') { + return typ.hasOwnProperty('unionMembers') + ? transformUnion(typ.unionMembers, val) + : typ.hasOwnProperty('arrayItems') + ? transformArray(typ.arrayItems, val) + : typ.hasOwnProperty('props') + ? transformObject(getProps(typ), typ.additional, val) + : invalidValue(typ, val, key, parent); + } + // Numbers can be parsed by Date but shouldn't be. + if (typ === Date && typeof val !== 'number') return transformDate(val); + return transformPrimitive(typ, val); } function cast(val: any, typ: any): T { - return transform(val, typ, jsonToJSProps); + return transform(val, typ, jsonToJSProps); } function uncast(val: T, typ: any): any { - return transform(val, typ, jsToJSONProps); + return transform(val, typ, jsToJSONProps); } function l(typ: any) { - return { literal: typ }; + return { literal: typ }; } function a(typ: any) { - return { arrayItems: typ }; + return { arrayItems: typ }; } function u(...typs: any[]) { - return { unionMembers: typs }; + return { unionMembers: typs }; } function o(props: any[], additional: any) { - return { props, additional }; + return { props, additional }; } function m(additional: any) { - return { props: [], additional }; + return { props: [], additional }; } function r(name: string) { - return { ref: name }; + return { ref: name }; } const typeMap: any = { - "AgentErrorResponseMessage": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: r("ErrorResponseMessagePayload") }, - { json: "type", js: "type", typ: r("ResponseMessageType") }, - ], false), - "AgentResponseMetadata": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ErrorResponseMessagePayload": o([ - { json: "error", js: "error", typ: r("ResponseErrorDetail") }, - ], "any"), - "AgentRequestMessage": o([ - { json: "meta", js: "meta", typ: r("AgentRequestMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("RequestMessageType") }, - ], false), - "AgentRequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BridgeParticipantIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "SourceIdentifier": o([ - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "AgentResponseMessage": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("ResponseMessageType") }, - ], false), - "BridgeErrorResponseMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeErrorResponseMessageMeta") }, - { json: "payload", js: "payload", typ: r("ResponseErrorMessagePayload") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeErrorResponseMessageMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "DesktopAgentIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - ], "any"), - "ResponseErrorMessagePayload": o([ - { json: "error", js: "error", typ: u(undefined, r("ResponseErrorDetail")) }, - ], "any"), - "BridgeRequestMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeRequestMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeRequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("BridgeParticipantIdentifier") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BridgeResponseMessage": o([ - { json: "meta", js: "meta", typ: r("BridgeResponseMessageMeta") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: "" }, - ], false), - "BridgeResponseMessageMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "BroadcastAgentRequest": o([ - { json: "meta", js: "meta", typ: r("BroadcastAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastAgentRequestPayload") }, - { json: "type", js: "type", typ: r("BroadcastAgentRequestType") }, - ], false), - "BroadcastAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "SourceObject": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "BroadcastAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "Context": o([ - { json: "id", js: "id", typ: u(undefined, m("any")) }, - { json: "name", js: "name", typ: u(undefined, "") }, - { json: "type", js: "type", typ: "" }, - ], "any"), - "BroadcastBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("BroadcastBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("BroadcastBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("BroadcastAgentRequestType") }, - ], false), - "BroadcastBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaSource": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "BroadcastBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "ConnectionStepMessage": o([ - { json: "meta", js: "meta", typ: r("ConnectionStepMetadata") }, - { json: "payload", js: "payload", typ: m("any") }, - { json: "type", js: "type", typ: r("ConnectionStepMessageType") }, - ], false), - "ConnectionStepMetadata": o([ - { json: "requestUuid", js: "requestUuid", typ: u(undefined, "") }, - { json: "responseUuid", js: "responseUuid", typ: u(undefined, "") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep2Hello": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep2HelloMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep2HelloPayload") }, - { json: "type", js: "type", typ: r("ConnectionStep2HelloType") }, - ], false), - "ConnectionStep2HelloMeta": o([ - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep2HelloPayload": o([ - { json: "authRequired", js: "authRequired", typ: true }, - { json: "authToken", js: "authToken", typ: u(undefined, "") }, - { json: "desktopAgentBridgeVersion", js: "desktopAgentBridgeVersion", typ: "" }, - { json: "supportedFDC3Versions", js: "supportedFDC3Versions", typ: a("") }, - ], false), - "ConnectionStep3Handshake": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep3HandshakeMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep3HandshakePayload") }, - { json: "type", js: "type", typ: r("ConnectionStep3HandshakeType") }, - ], false), - "ConnectionStep3HandshakeMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep3HandshakePayload": o([ - { json: "authToken", js: "authToken", typ: u(undefined, "") }, - { json: "channelsState", js: "channelsState", typ: m(a(r("Context"))) }, - { json: "implementationMetadata", js: "implementationMetadata", typ: r("ConnectingAgentImplementationMetadata") }, - { json: "requestedName", js: "requestedName", typ: "" }, - ], false), - "ConnectingAgentImplementationMetadata": o([ - { 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), - "ConnectionStep4AuthenticationFailed": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep4AuthenticationFailedMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep4AuthenticationFailedPayload") }, - { json: "type", js: "type", typ: r("ConnectionStep4AuthenticationFailedType") }, - ], false), - "ConnectionStep4AuthenticationFailedMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep4AuthenticationFailedPayload": o([ - { json: "message", js: "message", typ: u(undefined, "") }, - ], false), - "ConnectionStep6ConnectedAgentsUpdate": o([ - { json: "meta", js: "meta", typ: r("ConnectionStep6ConnectedAgentsUpdateMeta") }, - { json: "payload", js: "payload", typ: r("ConnectionStep6ConnectedAgentsUpdatePayload") }, - { json: "type", js: "type", typ: r("ConnectionStep6ConnectedAgentsUpdateType") }, - ], false), - "ConnectionStep6ConnectedAgentsUpdateMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "ConnectionStep6ConnectedAgentsUpdatePayload": o([ - { json: "addAgent", js: "addAgent", typ: u(undefined, "") }, - { json: "allAgents", js: "allAgents", typ: a(r("DesktopAgentImplementationMetadata")) }, - { json: "channelsState", js: "channelsState", typ: u(undefined, m(a(r("Context")))) }, - { json: "removeAgent", js: "removeAgent", typ: u(undefined, "") }, - ], false), - "DesktopAgentImplementationMetadata": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { 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), - "FindInstancesAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindInstancesAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("PayloadClass") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PayloadClass": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindInstancesAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindInstancesAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentRequestType") }, - ], false), - "FindInstancesAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "DestinationObject": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "AppIdentifier": o([ - { json: "appId", js: "appId", typ: "" }, - { json: "desktopAgent", js: "desktopAgent", typ: u(undefined, "") }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesAgentResponse": o([ - { json: "meta", js: "meta", typ: r("AgentResponseMetadata") }, - { json: "payload", js: "payload", typ: r("FindInstancesAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesAgentResponsePayload": o([ - { json: "appIdentifiers", js: "appIdentifiers", typ: a(r("AppMetadata")) }, - ], 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), - "FindInstancesBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindInstancesBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("MessagePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MessagePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindInstancesBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindInstancesBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentRequestType") }, - ], false), - "FindInstancesBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaSourceObject": o([ - { json: "appId", js: "appId", typ: u(undefined, "") }, - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "FindInstancesBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppIdentifier") }, - ], false), - "FindInstancesBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("BridgeResponseMessageMeta") }, - { json: "payload", js: "payload", typ: r("FindInstancesBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindInstancesAgentErrorResponseType") }, - ], false), - "FindInstancesBridgeResponsePayload": o([ - { json: "appIdentifiers", js: "appIdentifiers", typ: a(r("AppMetadata")) }, - ], false), - "FindIntentAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentRequestType") }, - ], false), - "FindIntentAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentAgentRequestPayload": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "intent", js: "intent", typ: "" }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentAgentResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentAgentResponsePayload": o([ - { json: "appIntent", js: "appIntent", typ: r("AppIntent") }, - ], false), - "AppIntent": o([ - { json: "apps", js: "apps", typ: a(r("AppMetadata")) }, - { json: "intent", js: "intent", typ: r("IntentMetadata") }, - ], false), - "IntentMetadata": o([ - { json: "displayName", js: "displayName", typ: u(undefined, "") }, - { json: "name", js: "name", typ: "" }, - ], false), - "FindIntentBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentRequestType") }, - ], false), - "FindIntentBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("BridgeParticipantIdentifier") }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentBridgeRequestPayload": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "intent", js: "intent", typ: "" }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentAgentErrorResponseType") }, - ], false), - "FindIntentBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentBridgeResponsePayload": o([ - { json: "appIntent", js: "appIntent", typ: r("AppIntent") }, - ], false), - "FindIntentsByContextAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentsByContextAgentRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentRequestType") }, - ], false), - "FindIntentsByContextAgentRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentsByContextAgentRequestPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentsByContextAgentResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextAgentResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextAgentResponsePayload": o([ - { json: "appIntents", js: "appIntents", typ: a(r("AppIntent")) }, - ], false), - "FindIntentsByContextBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "FindIntentsByContextBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentRequestType") }, - ], false), - "FindIntentsByContextBridgeRequestMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - { json: "destination", js: "destination", typ: u(undefined, r("BridgeParticipantIdentifier")) }, - ], false), - "FindIntentsByContextBridgeRequestPayload": o([ - { json: "context", js: "context", typ: r("Context") }, - { json: "resultType", js: "resultType", typ: u(undefined, "") }, - ], false), - "FindIntentsByContextBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("FindIntentsByContextBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("FindIntentsByContextBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("FindIntentsByContextAgentErrorResponseType") }, - ], false), - "FindIntentsByContextBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "FindIntentsByContextBridgeResponsePayload": o([ - { json: "appIntents", js: "appIntents", typ: a(r("AppIntent")) }, - ], false), - "GetAppMetadataAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "GetAppMetadataAgentRequest": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentRequestPayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentRequestType") }, - ], false), - "GetAppMetadataAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceIdentifier")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppObject") }, - ], false), - "AppObject": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "GetAppMetadataAgentResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataAgentResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataAgentResponsePayload": o([ - { json: "appMetadata", js: "appMetadata", typ: r("AppMetadata") }, - ], false), - "GetAppMetadataBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "GetAppMetadataBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentRequestType") }, - ], false), - "GetAppMetadataBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppObject") }, - ], false), - "GetAppMetadataBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("GetAppMetadataBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("GetAppMetadataBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("GetAppMetadataAgentErrorResponseType") }, - ], false), - "GetAppMetadataBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "GetAppMetadataBridgeResponsePayload": o([ - { json: "appMetadata", js: "appMetadata", typ: r("AppMetadata") }, - ], false), - "OpenAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("OpenAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("OpenErrorResponsePayload") }, - ], false), - "OpenAgentRequest": o([ - { json: "meta", js: "meta", typ: r("OpenAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentRequestPayload") }, - { json: "type", js: "type", typ: r("OpenAgentRequestType") }, - ], false), - "OpenAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppToOpen") }, - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - ], false), - "AppToOpen": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "OpenAgentResponse": o([ - { json: "meta", js: "meta", typ: r("OpenAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenAgentResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenAgentResponsePayload": o([ - { json: "appIdentifier", js: "appIdentifier", typ: r("AppIdentifier") }, - ], false), - "OpenBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("OpenErrorResponsePayload") }, - ], false), - "OpenBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("OpenAgentRequestType") }, - ], false), - "OpenBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("DestinationObject")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppToOpen") }, - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - ], false), - "OpenBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("OpenBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("OpenBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("OpenAgentErrorResponseType") }, - ], false), - "OpenBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "OpenBridgeResponsePayload": o([ - { json: "appIdentifier", js: "appIdentifier", typ: r("AppIdentifier") }, - ], false), - "PrivateChannelBroadcastAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelBroadcastAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelBroadcastAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelBroadcastAgentRequestType") }, - ], false), - "PrivateChannelBroadcastAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "MetaDestination": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "PrivateChannelBroadcastAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "PrivateChannelBroadcastBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelBroadcastBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelBroadcastBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelBroadcastAgentRequestType") }, - ], false), - "PrivateChannelBroadcastBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelBroadcastBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "context", js: "context", typ: r("Context") }, - ], false), - "PrivateChannelEventListenerAddedAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerAddedAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerAddedAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerAddedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerAddedAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerAddedAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerAddedBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerAddedBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerAddedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerAddedBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerRemovedAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerRemovedAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerRemovedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerRemovedAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelEventListenerRemovedBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelEventListenerRemovedBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelEventListenerRemovedAgentRequestType") }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelEventListenerRemovedBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "listenerType", js: "listenerType", typ: r("PrivateChannelEventListenerTypes") }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnAddContextListenerAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnAddContextListenerAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnAddContextListenerAgentRequestType") }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnAddContextListenerAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnAddContextListenerBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnAddContextListenerBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnAddContextListenerAgentRequestType") }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnAddContextListenerBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnDisconnectAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnDisconnectAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnDisconnectAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnDisconnectAgentRequestType") }, - ], false), - "PrivateChannelOnDisconnectAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnDisconnectAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "PrivateChannelOnDisconnectBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnDisconnectBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnDisconnectBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnDisconnectAgentRequestType") }, - ], false), - "PrivateChannelOnDisconnectBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnDisconnectBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequest": o([ - { json: "meta", js: "meta", typ: r("PrivateChannelOnUnsubscribeAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnUnsubscribeAgentRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnUnsubscribeAgentRequestType") }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: u(undefined, r("SourceObject")) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnUnsubscribeAgentRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "PrivateChannelOnUnsubscribeBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("ERequestMetadata") }, - { json: "payload", js: "payload", typ: r("PrivateChannelOnUnsubscribeBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("PrivateChannelOnUnsubscribeAgentRequestType") }, - ], false), - "ERequestMetadata": o([ - { json: "destination", js: "destination", typ: u(undefined, r("MetaDestination")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "PrivateChannelOnUnsubscribeBridgeRequestPayload": o([ - { json: "channelId", js: "channelId", typ: "" }, - { json: "contextType", js: "contextType", typ: u(null, "") }, - ], false), - "RaiseIntentAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "RaiseIntentAgentRequest": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentRequestType") }, - ], false), - "RaiseIntentAgentRequestMeta": o([ - { json: "destination", js: "destination", typ: r("MetaDestination") }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("SourceObject") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentRequestPayload": o([ - { json: "app", js: "app", typ: r("AppDestinationIdentifier") }, - { json: "context", js: "context", typ: r("Context") }, - { json: "intent", js: "intent", typ: "" }, - ], false), - "AppDestinationIdentifier": o([ - { json: "desktopAgent", js: "desktopAgent", typ: "" }, - { json: "appId", js: "appId", typ: "" }, - { json: "instanceId", js: "instanceId", typ: u(undefined, "") }, - ], "any"), - "RaiseIntentAgentResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentAgentResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentAgentResponsePayload": o([ - { json: "intentResolution", js: "intentResolution", typ: r("IntentResolution") }, - ], false), - "IntentResolution": o([ - { json: "intent", js: "intent", typ: "" }, - { json: "source", js: "source", typ: r("AppIdentifier") }, - ], false), - "RaiseIntentBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("FindInstancesErrors") }, - ], false), - "RaiseIntentBridgeRequest": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeRequestMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeRequestPayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentRequestType") }, - ], false), - "RaiseIntentBridgeRequestMeta": o([ - { json: "destination", js: "destination", typ: r("MetaDestination") }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "source", js: "source", typ: r("MetaSource") }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeRequestPayload": o([ - { json: "app", js: "app", typ: r("AppDestinationIdentifier") }, - { json: "context", js: "context", typ: r("Context") }, - { json: "intent", js: "intent", typ: "" }, - ], false), - "RaiseIntentBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentAgentErrorResponseType") }, - ], false), - "RaiseIntentBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentBridgeResponsePayload": o([ - { json: "intentResolution", js: "intentResolution", typ: r("IntentResolution") }, - ], false), - "RaiseIntentResultAgentErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultAgentErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultAgentErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultAgentErrorResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultAgentErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("RaiseIntentResultErrorMessage") }, - ], false), - "RaiseIntentResultAgentResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultAgentResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultAgentResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultAgentResponseMeta": o([ - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultAgentResponsePayload": o([ - { json: "intentResult", js: "intentResult", typ: r("IntentResult") }, - ], false), - "IntentResult": o([ - { json: "context", js: "context", typ: u(undefined, r("Context")) }, - { json: "channel", js: "channel", typ: u(undefined, r("Channel")) }, - ], false), - "Channel": o([ - { json: "displayMetadata", js: "displayMetadata", typ: u(undefined, r("DisplayMetadata")) }, - { json: "id", js: "id", typ: "" }, - { json: "type", js: "type", typ: r("Type") }, - ], false), - "DisplayMetadata": o([ - { json: "color", js: "color", typ: u(undefined, "") }, - { json: "glyph", js: "glyph", typ: u(undefined, "") }, - { json: "name", js: "name", typ: u(undefined, "") }, - ], false), - "RaiseIntentResultBridgeErrorResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultBridgeErrorResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultBridgeErrorResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultBridgeErrorResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: a(r("ResponseErrorDetail")) }, - { json: "errorSources", js: "errorSources", typ: a(r("DesktopAgentIdentifier")) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultBridgeErrorResponsePayload": o([ - { json: "error", js: "error", typ: r("RaiseIntentResultErrorMessage") }, - ], false), - "RaiseIntentResultBridgeResponse": o([ - { json: "meta", js: "meta", typ: r("RaiseIntentResultBridgeResponseMeta") }, - { json: "payload", js: "payload", typ: r("RaiseIntentResultBridgeResponsePayload") }, - { json: "type", js: "type", typ: r("RaiseIntentResultAgentErrorResponseType") }, - ], false), - "RaiseIntentResultBridgeResponseMeta": o([ - { json: "errorDetails", js: "errorDetails", typ: u(undefined, a(r("ResponseErrorDetail"))) }, - { json: "errorSources", js: "errorSources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "requestUuid", js: "requestUuid", typ: "" }, - { json: "responseUuid", js: "responseUuid", typ: "" }, - { json: "sources", js: "sources", typ: u(undefined, a(r("DesktopAgentIdentifier"))) }, - { json: "timestamp", js: "timestamp", typ: Date }, - ], false), - "RaiseIntentResultBridgeResponsePayload": o([ - { json: "intentResult", js: "intentResult", typ: r("IntentResult") }, - ], false), - "ResponseErrorDetail": [ - "AccessDenied", - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "CreationFailed", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "IntentDeliveryFailed", - "IntentHandlerRejected", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NoChannelFound", - "NoResultReturned", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "ResponseMessageType": [ - "findInstancesResponse", - "findIntentResponse", - "findIntentsByContextResponse", - "getAppMetadataResponse", - "openResponse", - "raiseIntentResponse", - "raiseIntentResultResponse", - ], - "RequestMessageType": [ - "broadcastRequest", - "findInstancesRequest", - "findIntentRequest", - "findIntentsByContextRequest", - "getAppMetadataRequest", - "openRequest", - "PrivateChannel.broadcast", - "PrivateChannel.eventListenerAdded", - "PrivateChannel.eventListenerRemoved", - "PrivateChannel.onAddContextListener", - "PrivateChannel.onDisconnect", - "PrivateChannel.onUnsubscribe", - "raiseIntentRequest", - ], - "BroadcastAgentRequestType": [ - "broadcastRequest", - ], - "ConnectionStepMessageType": [ - "authenticationFailed", - "connectedAgentsUpdate", - "handshake", - "hello", - ], - "ConnectionStep2HelloType": [ - "hello", - ], - "ConnectionStep3HandshakeType": [ - "handshake", - ], - "ConnectionStep4AuthenticationFailedType": [ - "authenticationFailed", - ], - "ConnectionStep6ConnectedAgentsUpdateType": [ - "connectedAgentsUpdate", - ], - "FindInstancesErrors": [ - "AgentDisconnected", - "DesktopAgentNotFound", - "IntentDeliveryFailed", - "MalformedContext", - "MalformedMessage", - "NoAppsFound", - "NotConnectedToBridge", - "ResolverTimeout", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - "TargetAppUnavailable", - "TargetInstanceUnavailable", - "UserCancelledResolution", - ], - "FindInstancesAgentErrorResponseType": [ - "findInstancesResponse", - ], - "FindInstancesAgentRequestType": [ - "findInstancesRequest", - ], - "FindIntentAgentErrorResponseType": [ - "findIntentResponse", - ], - "FindIntentAgentRequestType": [ - "findIntentRequest", - ], - "FindIntentsByContextAgentErrorResponseType": [ - "findIntentsByContextResponse", - ], - "FindIntentsByContextAgentRequestType": [ - "findIntentsByContextRequest", - ], - "GetAppMetadataAgentErrorResponseType": [ - "getAppMetadataResponse", - ], - "GetAppMetadataAgentRequestType": [ - "getAppMetadataRequest", - ], - "OpenErrorResponsePayload": [ - "AgentDisconnected", - "AppNotFound", - "AppTimeout", - "DesktopAgentNotFound", - "ErrorOnLaunch", - "MalformedContext", - "MalformedMessage", - "NotConnectedToBridge", - "ResolverUnavailable", - "ResponseToBridgeTimedOut", - ], - "OpenAgentErrorResponseType": [ - "openResponse", - ], - "OpenAgentRequestType": [ - "openRequest", - ], - "PrivateChannelBroadcastAgentRequestType": [ - "PrivateChannel.broadcast", - ], - "PrivateChannelEventListenerTypes": [ - "onAddContextListener", - "onDisconnect", - "onUnsubscribe", - ], - "PrivateChannelEventListenerAddedAgentRequestType": [ - "PrivateChannel.eventListenerAdded", - ], - "PrivateChannelEventListenerRemovedAgentRequestType": [ - "PrivateChannel.eventListenerRemoved", - ], - "PrivateChannelOnAddContextListenerAgentRequestType": [ - "PrivateChannel.onAddContextListener", - ], - "PrivateChannelOnDisconnectAgentRequestType": [ - "PrivateChannel.onDisconnect", + AgentErrorResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: r('ErrorResponseMessagePayload') }, + { json: 'type', js: 'type', typ: r('ResponseMessageType') }, + ], + false + ), + AgentResponseMetadata: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ErrorResponseMessagePayload: o([{ json: 'error', js: 'error', typ: r('ResponseErrorDetail') }], 'any'), + AgentRequestMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentRequestMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('RequestMessageType') }, + ], + false + ), + AgentRequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BridgeParticipantIdentifier: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + SourceIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + AgentResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('ResponseMessageType') }, + ], + false + ), + BridgeErrorResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeErrorResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: r('ResponseErrorMessagePayload') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeErrorResponseMessageMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + DesktopAgentIdentifier: o([{ json: 'desktopAgent', js: 'desktopAgent', typ: '' }], 'any'), + ResponseErrorMessagePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('ResponseErrorDetail')) }], 'any'), + BridgeRequestMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeRequestMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeRequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BridgeResponseMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: '' }, + ], + false + ), + BridgeResponseMessageMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + BroadcastAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastAgentRequestType') }, + ], + false + ), + BroadcastAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + SourceObject: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BroadcastAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + Context: o( + [ + { json: 'id', js: 'id', typ: u(undefined, m('any')) }, + { json: 'name', js: 'name', typ: u(undefined, '') }, + { json: 'type', js: 'type', typ: '' }, + ], + 'any' + ), + BroadcastBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('BroadcastBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('BroadcastBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('BroadcastAgentRequestType') }, + ], + false + ), + BroadcastBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaSource: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + BroadcastBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + ConnectionStepMessage: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStepMetadata') }, + { json: 'payload', js: 'payload', typ: m('any') }, + { json: 'type', js: 'type', typ: r('ConnectionStepMessageType') }, + ], + false + ), + ConnectionStepMetadata: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: u(undefined, '') }, + { json: 'responseUuid', js: 'responseUuid', typ: u(undefined, '') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep2Hello: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep2HelloMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep2HelloPayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep2HelloType') }, + ], + false + ), + ConnectionStep2HelloMeta: o([{ json: 'timestamp', js: 'timestamp', typ: Date }], false), + ConnectionStep2HelloPayload: o( + [ + { json: 'authRequired', js: 'authRequired', typ: true }, + { json: 'authToken', js: 'authToken', typ: u(undefined, '') }, + { json: 'desktopAgentBridgeVersion', js: 'desktopAgentBridgeVersion', typ: '' }, + { json: 'supportedFDC3Versions', js: 'supportedFDC3Versions', typ: a('') }, + ], + false + ), + ConnectionStep3Handshake: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep3HandshakeMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep3HandshakePayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep3HandshakeType') }, + ], + false + ), + ConnectionStep3HandshakeMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep3HandshakePayload: o( + [ + { json: 'authToken', js: 'authToken', typ: u(undefined, '') }, + { json: 'channelsState', js: 'channelsState', typ: m(a(r('Context'))) }, + { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ConnectingAgentImplementationMetadata') }, + { json: 'requestedName', js: 'requestedName', typ: '' }, + ], + false + ), + ConnectingAgentImplementationMetadata: o( + [ + { 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 + ), + ConnectionStep4AuthenticationFailed: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep4AuthenticationFailedMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep4AuthenticationFailedPayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep4AuthenticationFailedType') }, + ], + false + ), + ConnectionStep4AuthenticationFailedMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep4AuthenticationFailedPayload: o([{ json: 'message', js: 'message', typ: u(undefined, '') }], false), + ConnectionStep6ConnectedAgentsUpdate: o( + [ + { json: 'meta', js: 'meta', typ: r('ConnectionStep6ConnectedAgentsUpdateMeta') }, + { json: 'payload', js: 'payload', typ: r('ConnectionStep6ConnectedAgentsUpdatePayload') }, + { json: 'type', js: 'type', typ: r('ConnectionStep6ConnectedAgentsUpdateType') }, + ], + false + ), + ConnectionStep6ConnectedAgentsUpdateMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + ConnectionStep6ConnectedAgentsUpdatePayload: o( + [ + { json: 'addAgent', js: 'addAgent', typ: u(undefined, '') }, + { json: 'allAgents', js: 'allAgents', typ: a(r('DesktopAgentImplementationMetadata')) }, + { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('Context')))) }, + { json: 'removeAgent', js: 'removeAgent', typ: u(undefined, '') }, + ], + false + ), + DesktopAgentImplementationMetadata: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { 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 + ), + FindInstancesAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('PayloadClass') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PayloadClass: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindInstancesAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentRequestType') }, + ], + false + ), + FindInstancesAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + DestinationObject: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesAgentRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + AppIdentifier: o( + [ + { json: 'appId', js: 'appId', typ: '' }, + { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('AgentResponseMetadata') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesAgentResponsePayload: o( + [{ json: 'appIdentifiers', js: 'appIdentifiers', typ: a(r('AppMetadata')) }], + 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 + ), + FindInstancesBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('MessagePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MessagePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindInstancesBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindInstancesBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentRequestType') }, + ], + false + ), + FindInstancesBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaSourceObject: o( + [ + { json: 'appId', js: 'appId', typ: u(undefined, '') }, + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + FindInstancesBridgeRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppIdentifier') }], false), + FindInstancesBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('BridgeResponseMessageMeta') }, + { json: 'payload', js: 'payload', typ: r('FindInstancesBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindInstancesAgentErrorResponseType') }, + ], + false + ), + FindInstancesBridgeResponsePayload: o( + [{ json: 'appIdentifiers', js: 'appIdentifiers', typ: a(r('AppMetadata')) }], + false + ), + FindIntentAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindIntentAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentRequestType') }, + ], + false + ), + FindIntentAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentAgentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentAgentResponsePayload: o([{ json: 'appIntent', js: 'appIntent', typ: r('AppIntent') }], false), + AppIntent: o( + [ + { json: 'apps', js: 'apps', typ: a(r('AppMetadata')) }, + { json: 'intent', js: 'intent', typ: r('IntentMetadata') }, + ], + false + ), + IntentMetadata: o( + [ + { json: 'displayName', js: 'displayName', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: '' }, + ], + false + ), + FindIntentBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + FindIntentBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentRequestType') }, + ], + false + ), + FindIntentBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentBridgeRequestPayload: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'intent', js: 'intent', typ: '' }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentAgentErrorResponseType') }, + ], + false + ), + FindIntentBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentBridgeResponsePayload: o([{ json: 'appIntent', js: 'appIntent', typ: r('AppIntent') }], false), + FindIntentsByContextAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextAgentErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], + false + ), + FindIntentsByContextAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentRequestType') }, + ], + false + ), + FindIntentsByContextAgentRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentsByContextAgentRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentsByContextAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextAgentResponsePayload: o( + [{ json: 'appIntents', js: 'appIntents', typ: a(r('AppIntent')) }], + false + ), + FindIntentsByContextBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextBridgeErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], + false + ), + FindIntentsByContextBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentRequestType') }, + ], + false + ), + FindIntentsByContextBridgeRequestMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) }, + ], + false + ), + FindIntentsByContextBridgeRequestPayload: o( + [ + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'resultType', js: 'resultType', typ: u(undefined, '') }, + ], + false + ), + FindIntentsByContextBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('FindIntentsByContextBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('FindIntentsByContextBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('FindIntentsByContextAgentErrorResponseType') }, + ], + false + ), + FindIntentsByContextBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + FindIntentsByContextBridgeResponsePayload: o( + [{ json: 'appIntents', js: 'appIntents', typ: a(r('AppIntent')) }], + false + ), + GetAppMetadataAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + GetAppMetadataAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentRequestType') }, + ], + false + ), + GetAppMetadataAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppObject') }], false), + AppObject: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + GetAppMetadataAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataAgentResponsePayload: o([{ json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }], false), + GetAppMetadataBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + GetAppMetadataBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentRequestType') }, + ], + false + ), + GetAppMetadataBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeRequestPayload: o([{ json: 'app', js: 'app', typ: r('AppObject') }], false), + GetAppMetadataBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('GetAppMetadataBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('GetAppMetadataBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('GetAppMetadataAgentErrorResponseType') }, + ], + false + ), + GetAppMetadataBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + GetAppMetadataBridgeResponsePayload: o([{ json: 'appMetadata', js: 'appMetadata', typ: r('AppMetadata') }], false), + OpenAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('OpenErrorResponsePayload') }], false), + OpenAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentRequestType') }, + ], + false + ), + OpenAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppToOpen') }, + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + ], + false + ), + AppToOpen: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + OpenAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenAgentResponsePayload: o([{ json: 'appIdentifier', js: 'appIdentifier', typ: r('AppIdentifier') }], false), + OpenBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('OpenErrorResponsePayload') }], false), + OpenBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentRequestType') }, + ], + false + ), + OpenBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppToOpen') }, + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + ], + false + ), + OpenBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('OpenBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('OpenBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('OpenAgentErrorResponseType') }, + ], + false + ), + OpenBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + OpenBridgeResponsePayload: o([{ json: 'appIdentifier', js: 'appIdentifier', typ: r('AppIdentifier') }], false), + PrivateChannelBroadcastAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelBroadcastAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelBroadcastAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelBroadcastAgentRequestType') }, + ], + false + ), + PrivateChannelBroadcastAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + MetaDestination: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + PrivateChannelBroadcastAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + PrivateChannelBroadcastBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelBroadcastBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelBroadcastBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelBroadcastAgentRequestType') }, + ], + false + ), + PrivateChannelBroadcastBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelBroadcastBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'context', js: 'context', typ: r('Context') }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerAddedAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerAddedAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerAddedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerAddedAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerAddedBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerAddedBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerAddedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerAddedBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerRemovedAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerRemovedAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerRemovedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerRemovedAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelEventListenerRemovedBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelEventListenerRemovedBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelEventListenerRemovedAgentRequestType') }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelEventListenerRemovedBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'listenerType', js: 'listenerType', typ: r('PrivateChannelEventListenerTypes') }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnAddContextListenerAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnAddContextListenerAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnAddContextListenerAgentRequestType') }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnAddContextListenerAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnAddContextListenerBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnAddContextListenerBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnAddContextListenerAgentRequestType') }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnAddContextListenerBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnDisconnectAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnDisconnectAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnDisconnectAgentRequestType') }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnDisconnectAgentRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + PrivateChannelOnDisconnectBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnDisconnectBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnDisconnectBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnDisconnectAgentRequestType') }, + ], + false + ), + PrivateChannelOnDisconnectBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnDisconnectBridgeRequestPayload: o([{ json: 'channelId', js: 'channelId', typ: '' }], false), + PrivateChannelOnUnsubscribeAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('PrivateChannelOnUnsubscribeAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnUnsubscribeAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnUnsubscribeAgentRequestType') }, + ], + false + ), + PrivateChannelOnUnsubscribeAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnUnsubscribeAgentRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + PrivateChannelOnUnsubscribeBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('ERequestMetadata') }, + { json: 'payload', js: 'payload', typ: r('PrivateChannelOnUnsubscribeBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('PrivateChannelOnUnsubscribeAgentRequestType') }, + ], + false + ), + ERequestMetadata: o( + [ + { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + PrivateChannelOnUnsubscribeBridgeRequestPayload: o( + [ + { json: 'channelId', js: 'channelId', typ: '' }, + { json: 'contextType', js: 'contextType', typ: u(null, '') }, + ], + false + ), + RaiseIntentAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + RaiseIntentAgentRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentRequestType') }, + ], + false + ), + RaiseIntentAgentRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: r('MetaDestination') }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('SourceObject') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'intent', js: 'intent', typ: '' }, + ], + false + ), + AppDestinationIdentifier: o( + [ + { json: 'desktopAgent', js: 'desktopAgent', typ: '' }, + { json: 'appId', js: 'appId', typ: '' }, + { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') }, + ], + 'any' + ), + RaiseIntentAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentAgentResponsePayload: o( + [{ json: 'intentResolution', js: 'intentResolution', typ: r('IntentResolution') }], + false + ), + IntentResolution: o( + [ + { json: 'intent', js: 'intent', typ: '' }, + { json: 'source', js: 'source', typ: r('AppIdentifier') }, + ], + false + ), + RaiseIntentBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeErrorResponsePayload: o([{ json: 'error', js: 'error', typ: r('FindInstancesErrors') }], false), + RaiseIntentBridgeRequest: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeRequestMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeRequestPayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentRequestType') }, + ], + false + ), + RaiseIntentBridgeRequestMeta: o( + [ + { json: 'destination', js: 'destination', typ: r('MetaDestination') }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'source', js: 'source', typ: r('MetaSource') }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeRequestPayload: o( + [ + { json: 'app', js: 'app', typ: r('AppDestinationIdentifier') }, + { json: 'context', js: 'context', typ: r('Context') }, + { json: 'intent', js: 'intent', typ: '' }, + ], + false + ), + RaiseIntentBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentAgentErrorResponseType') }, + ], + false + ), + RaiseIntentBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentBridgeResponsePayload: o( + [{ json: 'intentResolution', js: 'intentResolution', typ: r('IntentResolution') }], + false + ), + RaiseIntentResultAgentErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultAgentErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultAgentErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, + ], + false + ), + RaiseIntentResultAgentErrorResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentResultAgentErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('RaiseIntentResultErrorMessage') }], + false + ), + RaiseIntentResultAgentResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultAgentResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultAgentResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, + ], + false + ), + RaiseIntentResultAgentResponseMeta: o( + [ + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, + ], + false + ), + RaiseIntentResultAgentResponsePayload: o( + [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }], + false + ), + IntentResult: o( + [ + { json: 'context', js: 'context', typ: u(undefined, r('Context')) }, + { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) }, + ], + false + ), + Channel: o( + [ + { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadata')) }, + { json: 'id', js: 'id', typ: '' }, + { json: 'type', js: 'type', typ: r('Type') }, ], - "PrivateChannelOnUnsubscribeAgentRequestType": [ - "PrivateChannel.onUnsubscribe", + false + ), + DisplayMetadata: o( + [ + { json: 'color', js: 'color', typ: u(undefined, '') }, + { json: 'glyph', js: 'glyph', typ: u(undefined, '') }, + { json: 'name', js: 'name', typ: u(undefined, '') }, ], - "RaiseIntentAgentErrorResponseType": [ - "raiseIntentResponse", - ], - "RaiseIntentAgentRequestType": [ - "raiseIntentRequest", + false + ), + RaiseIntentResultBridgeErrorResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultBridgeErrorResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultBridgeErrorResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, ], - "RaiseIntentResultErrorMessage": [ - "AgentDisconnected", - "IntentHandlerRejected", - "MalformedMessage", - "NoResultReturned", - "NotConnectedToBridge", - "ResponseToBridgeTimedOut", + false + ), + RaiseIntentResultBridgeErrorResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: a(r('ResponseErrorDetail')) }, + { json: 'errorSources', js: 'errorSources', typ: a(r('DesktopAgentIdentifier')) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'timestamp', js: 'timestamp', typ: Date }, ], - "RaiseIntentResultAgentErrorResponseType": [ - "raiseIntentResultResponse", + false + ), + RaiseIntentResultBridgeErrorResponsePayload: o( + [{ json: 'error', js: 'error', typ: r('RaiseIntentResultErrorMessage') }], + false + ), + RaiseIntentResultBridgeResponse: o( + [ + { json: 'meta', js: 'meta', typ: r('RaiseIntentResultBridgeResponseMeta') }, + { json: 'payload', js: 'payload', typ: r('RaiseIntentResultBridgeResponsePayload') }, + { json: 'type', js: 'type', typ: r('RaiseIntentResultAgentErrorResponseType') }, ], - "Type": [ - "app", - "private", - "user", + false + ), + RaiseIntentResultBridgeResponseMeta: o( + [ + { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) }, + { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'requestUuid', js: 'requestUuid', typ: '' }, + { json: 'responseUuid', js: 'responseUuid', typ: '' }, + { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) }, + { json: 'timestamp', js: 'timestamp', typ: Date }, ], + false + ), + RaiseIntentResultBridgeResponsePayload: o( + [{ json: 'intentResult', js: 'intentResult', typ: r('IntentResult') }], + false + ), + ResponseErrorDetail: [ + 'AccessDenied', + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'CreationFailed', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'IntentDeliveryFailed', + 'IntentHandlerRejected', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NoChannelFound', + 'NoResultReturned', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + ResponseMessageType: [ + 'findInstancesResponse', + 'findIntentResponse', + 'findIntentsByContextResponse', + 'getAppMetadataResponse', + 'openResponse', + 'raiseIntentResponse', + 'raiseIntentResultResponse', + ], + RequestMessageType: [ + 'broadcastRequest', + 'findInstancesRequest', + 'findIntentRequest', + 'findIntentsByContextRequest', + 'getAppMetadataRequest', + 'openRequest', + 'PrivateChannel.broadcast', + 'PrivateChannel.eventListenerAdded', + 'PrivateChannel.eventListenerRemoved', + 'PrivateChannel.onAddContextListener', + 'PrivateChannel.onDisconnect', + 'PrivateChannel.onUnsubscribe', + 'raiseIntentRequest', + ], + BroadcastAgentRequestType: ['broadcastRequest'], + ConnectionStepMessageType: ['authenticationFailed', 'connectedAgentsUpdate', 'handshake', 'hello'], + ConnectionStep2HelloType: ['hello'], + ConnectionStep3HandshakeType: ['handshake'], + ConnectionStep4AuthenticationFailedType: ['authenticationFailed'], + ConnectionStep6ConnectedAgentsUpdateType: ['connectedAgentsUpdate'], + FindInstancesErrors: [ + 'AgentDisconnected', + 'DesktopAgentNotFound', + 'IntentDeliveryFailed', + 'MalformedContext', + 'MalformedMessage', + 'NoAppsFound', + 'NotConnectedToBridge', + 'ResolverTimeout', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + 'TargetAppUnavailable', + 'TargetInstanceUnavailable', + 'UserCancelledResolution', + ], + FindInstancesAgentErrorResponseType: ['findInstancesResponse'], + FindInstancesAgentRequestType: ['findInstancesRequest'], + FindIntentAgentErrorResponseType: ['findIntentResponse'], + FindIntentAgentRequestType: ['findIntentRequest'], + FindIntentsByContextAgentErrorResponseType: ['findIntentsByContextResponse'], + FindIntentsByContextAgentRequestType: ['findIntentsByContextRequest'], + GetAppMetadataAgentErrorResponseType: ['getAppMetadataResponse'], + GetAppMetadataAgentRequestType: ['getAppMetadataRequest'], + OpenErrorResponsePayload: [ + 'AgentDisconnected', + 'AppNotFound', + 'AppTimeout', + 'DesktopAgentNotFound', + 'ErrorOnLaunch', + 'MalformedContext', + 'MalformedMessage', + 'NotConnectedToBridge', + 'ResolverUnavailable', + 'ResponseToBridgeTimedOut', + ], + OpenAgentErrorResponseType: ['openResponse'], + OpenAgentRequestType: ['openRequest'], + PrivateChannelBroadcastAgentRequestType: ['PrivateChannel.broadcast'], + PrivateChannelEventListenerTypes: ['onAddContextListener', 'onDisconnect', 'onUnsubscribe'], + PrivateChannelEventListenerAddedAgentRequestType: ['PrivateChannel.eventListenerAdded'], + PrivateChannelEventListenerRemovedAgentRequestType: ['PrivateChannel.eventListenerRemoved'], + PrivateChannelOnAddContextListenerAgentRequestType: ['PrivateChannel.onAddContextListener'], + PrivateChannelOnDisconnectAgentRequestType: ['PrivateChannel.onDisconnect'], + PrivateChannelOnUnsubscribeAgentRequestType: ['PrivateChannel.onUnsubscribe'], + RaiseIntentAgentErrorResponseType: ['raiseIntentResponse'], + RaiseIntentAgentRequestType: ['raiseIntentRequest'], + RaiseIntentResultErrorMessage: [ + 'AgentDisconnected', + 'IntentHandlerRejected', + 'MalformedMessage', + 'NoResultReturned', + 'NotConnectedToBridge', + 'ResponseToBridgeTimedOut', + ], + RaiseIntentResultAgentErrorResponseType: ['raiseIntentResultResponse'], + Type: ['app', 'private', 'user'], }; diff --git a/toolbox/fdc3-explained/1.0/main.js b/toolbox/fdc3-explained/1.0/main.js index 13242324b..223bd8342 100644 --- a/toolbox/fdc3-explained/1.0/main.js +++ b/toolbox/fdc3-explained/1.0/main.js @@ -3,7 +3,6 @@ * Copyright FINOS FDC3 contributors - see NOTICE file */ - // enable application when FDC3 is available document.addEventListener('DOMContentLoaded', () => { fdc3Init(enablePage); @@ -11,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => { // check if FDC3 is available function fdc3Init(callback) { - let fdc3Tries = 10 + let fdc3Tries = 10; const onFDC3Ready = () => { if (window.fdc3) { @@ -22,14 +21,14 @@ function fdc3Init(callback) { window.setTimeout(onFDC3Ready, 100); } } - } + }; onFDC3Ready(); } -const providerDetails = document.getElementById("providerDetails") -const broadcastButton = document.getElementById("broadcastButton") -const broadcastText = document.getElementById("broadcastText") +const providerDetails = document.getElementById('providerDetails'); +const broadcastButton = document.getElementById('broadcastButton'); +const broadcastText = document.getElementById('broadcastText'); function enablePage() { console.log('FDC3 is available'); @@ -47,7 +46,7 @@ function enablePage() { broadcastText.disabled = false; } -function updateProviderDetails(details){ +function updateProviderDetails(details) { providerDetails.innerText = details; } diff --git a/toolbox/fdc3-explained/1.1/main.js b/toolbox/fdc3-explained/1.1/main.js index db11fc8b5..ae43309a9 100644 --- a/toolbox/fdc3-explained/1.1/main.js +++ b/toolbox/fdc3-explained/1.1/main.js @@ -56,7 +56,6 @@ function displayFDC3Support() { } function getPlatform() { - // TODO: add G42 and FDC3 Desktop Agent to vendors // NOTE: conceptually replaced with fdc3.getInfo if (window.FSBL) { @@ -68,7 +67,7 @@ function getPlatform() { } } -function updateProviderDetails(details){ +function updateProviderDetails(details) { const providerDetails = document.getElementById('providerDetails'); providerDetails.innerText = details; } @@ -109,7 +108,9 @@ function setUpEventListeners() { document.getElementById('join-channel__btn').addEventListener('click', joinChannel); - document.getElementById('leave-channel__btn').addEventListener('click', () => { fdc3.leaveCurrentChannel(); }); + document.getElementById('leave-channel__btn').addEventListener('click', () => { + fdc3.leaveCurrentChannel(); + }); document.getElementById('broadcast__btn').addEventListener('click', broadcastFDC3Context); diff --git a/toolbox/fdc3-explained/1.1/styles.css b/toolbox/fdc3-explained/1.1/styles.css index f264a1cca..385afc6ff 100644 --- a/toolbox/fdc3-explained/1.1/styles.css +++ b/toolbox/fdc3-explained/1.1/styles.css @@ -6,9 +6,9 @@ @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap'); body { - font-family: "Noto Sans JP",sans-serif; - margin:0; - padding:0; + font-family: 'Noto Sans JP', sans-serif; + margin: 0; + padding: 0; background-color: white; } @@ -19,13 +19,13 @@ body { place-content: center; } table { - border:0; + border: 0; } -tr{ - border:0; +tr { + border: 0; } -td{ - border:0; +td { + border: 0; } textarea { width: 400px; diff --git a/toolbox/fdc3-explained/1.2/main.js b/toolbox/fdc3-explained/1.2/main.js index 5f41901d8..d4ec481a8 100644 --- a/toolbox/fdc3-explained/1.2/main.js +++ b/toolbox/fdc3-explained/1.2/main.js @@ -66,12 +66,12 @@ function getPlatform() { updateFDC3Version(`${fdc3Info.fdc3Version}`); } -function updateProviderDetails(details){ +function updateProviderDetails(details) { const providerDetails = document.getElementById('providerDetails'); providerDetails.innerText = details; } -function updateFDC3Version(details){ +function updateFDC3Version(details) { const fdc3Details = document.getElementById('fdc3Details'); fdc3Details.innerText = details; } @@ -113,15 +113,17 @@ function setUpEventListeners() { document.getElementById('join-channel__btn').addEventListener('click', joinChannel); - document.getElementById('leave-channel__btn').addEventListener('click', () => { fdc3.leaveCurrentChannel(); }); + document.getElementById('leave-channel__btn').addEventListener('click', () => { + fdc3.leaveCurrentChannel(); + }); document.getElementById('broadcast__btn').addEventListener('click', broadcastFDC3Context); document.getElementById('raise-intent__btn').addEventListener('click', raiseIntent); document.getElementById('get_context__btn').addEventListener('click', event => { - let contextType = document.getElementById('context-type').value; - getContext(contextType); + let contextType = document.getElementById('context-type').value; + getContext(contextType); }); } @@ -167,21 +169,18 @@ async function getContext(contextType) { // if context type is passed in then only listen on that specific context if (contextType) { - contextListener = fdc3.addContextListener( - contextType, - context => displayContext(JSON.stringify(context, null, 2)) + contextListener = fdc3.addContextListener(contextType, context => + displayContext(JSON.stringify(context, null, 2)) ); } else { - contextListener = fdc3.addContextListener( - context => displayContext(JSON.stringify(context, null, 2)) - ); + contextListener = fdc3.addContextListener(context => displayContext(JSON.stringify(context, null, 2))); } } catch (error) { console.error('Unable to add a context listener', error); } } -function displayContext(text){ +function displayContext(text) { let contextResultBox = document.getElementById('context-result'); contextResultBox.innerText = text; } diff --git a/toolbox/fdc3-explained/1.2/styles.css b/toolbox/fdc3-explained/1.2/styles.css index 3ac85c94b..fe3e2942f 100644 --- a/toolbox/fdc3-explained/1.2/styles.css +++ b/toolbox/fdc3-explained/1.2/styles.css @@ -3,10 +3,10 @@ * Copyright FINOS FDC3 contributors - see NOTICE file */ -@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap"); +@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap'); .body { - font-family: "Noto Sans JP", sans-serif; + font-family: 'Noto Sans JP', sans-serif; margin: 0; padding: 0; background-color: #284b63; @@ -36,7 +36,9 @@ button { } button:active { outline: transparent; - box-shadow: inset #3c3c3c70 2px 3px 3px 0px, #03a9f433 1px 2px 0px 0px; + box-shadow: + inset #3c3c3c70 2px 3px 3px 0px, + #03a9f433 1px 2px 0px 0px; transform: translateY(2px); transition: ease-out 0.1s; } @@ -45,7 +47,8 @@ button:focus { } input { background: #e8f7ff; - box-shadow: inset -2px -2px 2px 0px rgb(255 255 255 / 12%), + box-shadow: + inset -2px -2px 2px 0px rgb(255 255 255 / 12%), inset 2px 3px 6px 2px rgb(0 0 0 / 19%); border-radius: 6px; border: 2px solid transparent; @@ -58,7 +61,8 @@ input:focus { } textarea { background: #e8f7ff; - box-shadow: inset -3px -5px 5px 1px rgb(255 255 255 / 12%), + box-shadow: + inset -3px -5px 5px 1px rgb(255 255 255 / 12%), inset 2px 3px 6px 2px rgb(0 0 0 / 19%); border-radius: 6px; border: 2px solid transparent; diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app1.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app1.ts index 9dfeb8ebd..3c935f918 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app1.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app1.ts @@ -1,34 +1,34 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; function createContext(i: number) { - return { - type: "demo.counter", - count: i - } + return { + type: 'demo.counter', + count: i, + }; } /** - * Calling this function should get the fdc3 DesktopAgent and then + * Calling this function should get the fdc3 DesktopAgent and then * broadcast 50 context elements to the default channel. - * + * * Can be called any number of times. */ async function startBroadcasting() { - console.log("starting...") - const fdc3 = await getAgent(); - console.log("got api...") - const cc = await fdc3.getCurrentChannel() + console.log('starting...'); + const fdc3 = await getAgent(); + console.log('got api...'); + const cc = await fdc3.getCurrentChannel(); - if (cc == null) { - const channels = await fdc3.getUserChannels() - await fdc3.joinUserChannel(channels[0].id) - } - for (let index = 0; index < 50; index++) { - setTimeout(() => fdc3.broadcast(createContext(index)), index * 1000); - } + if (cc == null) { + const channels = await fdc3.getUserChannels(); + await fdc3.joinUserChannel(channels[0].id); + } + for (let index = 0; index < 50; index++) { + setTimeout(() => fdc3.broadcast(createContext(index)), index * 1000); + } } -window.addEventListener("load", () => { - const broadcast = document.getElementById("broadcast"); - broadcast?.addEventListener("click", () => startBroadcasting()); -}) +window.addEventListener('load', () => { + const broadcast = document.getElementById('broadcast'); + broadcast?.addEventListener('click', () => startBroadcasting()); +}); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app2.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app2.ts index 4c5654108..337760d97 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app2.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app2.ts @@ -1,25 +1,25 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; /** * This demonstrates using the API via a promise */ getAgent().then(async fdc3 => { - console.log("in promise") - const log = document.getElementById("log"); - const msg = document.createElement("p"); - const info = await fdc3.getInfo() - msg.textContent = "FDC3 Loaded: " + JSON.stringify(info); - log?.appendChild(msg); + console.log('in promise'); + const log = document.getElementById('log'); + const msg = document.createElement('p'); + const info = await fdc3.getInfo(); + msg.textContent = 'FDC3 Loaded: ' + JSON.stringify(info); + log?.appendChild(msg); - const cc = await fdc3.getCurrentChannel() - if (cc == null) { - const channels = await fdc3.getUserChannels() - await fdc3.joinUserChannel(channels[0].id) - } + const cc = await fdc3.getCurrentChannel(); + if (cc == null) { + const channels = await fdc3.getUserChannels(); + await fdc3.joinUserChannel(channels[0].id); + } - fdc3.addContextListener(null, context => { - const msg = document.createElement("p"); - msg.textContent = "Received: " + JSON.stringify(context); - log?.appendChild(msg); - }) + fdc3.addContextListener(null, context => { + const msg = document.createElement('p'); + msg.textContent = 'Received: ' + JSON.stringify(context); + log?.appendChild(msg); + }); }); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app3.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app3.ts index ffffdbcbf..125001577 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app3.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app3.ts @@ -1,7 +1,7 @@ -import './app1' -import './app2' +import './app1'; +import './app2'; /** - * This demonstrates getting two separate APIs in the same app, and using them for + * This demonstrates getting two separate APIs in the same app, and using them for * intra-app comms. */ diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app4.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app4.ts index 1cec789ef..62592d055 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app4.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app4.ts @@ -1,23 +1,23 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; /** * This demonstrates using the API via a promise */ getAgent().then(async fdc3 => { - console.log("in promise") + console.log('in promise'); - fdc3.addIntentListener("ViewNews", async context => { - const msg = document.createElement("p"); - msg.textContent = "Received News!: " + JSON.stringify(context); - const log = document.getElementById("log"); - log?.appendChild(msg); + fdc3.addIntentListener('ViewNews', async context => { + const msg = document.createElement('p'); + msg.textContent = 'Received News!: ' + JSON.stringify(context); + const log = document.getElementById('log'); + log?.appendChild(msg); - return { - type: "fdc3.test", - id: { - from: "app4", - intent: "ViewNews" - } - } - }) + return { + type: 'fdc3.test', + id: { + from: 'app4', + intent: 'ViewNews', + }, + }; + }); }); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app5.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app5.ts index 6294f381a..ad83fcec1 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app5.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app5.ts @@ -1,36 +1,36 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; /** * This demonstrates using the API via a promise */ getAgent().then(async fdc3 => { - console.log("in promise") + console.log('in promise'); - fdc3.addIntentListener("ViewNews", async context => { - const msg = document.createElement("p"); - msg.textContent = "Received News!: " + JSON.stringify(context); - const log = document.getElementById("log"); - log?.appendChild(msg); - return { - type: "fdc3.test", - id: { - from: "app5", - intent: "ViewNews" - } - } - }) + fdc3.addIntentListener('ViewNews', async context => { + const msg = document.createElement('p'); + msg.textContent = 'Received News!: ' + JSON.stringify(context); + const log = document.getElementById('log'); + log?.appendChild(msg); + return { + type: 'fdc3.test', + id: { + from: 'app5', + intent: 'ViewNews', + }, + }; + }); - fdc3.addIntentListener("ViewQuote", async context => { - const msg = document.createElement("p"); - msg.textContent = "Received Quote!: " + JSON.stringify(context); - const log = document.getElementById("log"); - log?.appendChild(msg); - return { - type: "fdc3.test", - id: { - from: "app5", - intent: "ViewQuote" - } - } - }) + fdc3.addIntentListener('ViewQuote', async context => { + const msg = document.createElement('p'); + msg.textContent = 'Received Quote!: ' + JSON.stringify(context); + const log = document.getElementById('log'); + log?.appendChild(msg); + return { + type: 'fdc3.test', + id: { + from: 'app5', + intent: 'ViewQuote', + }, + }; + }); }); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app6.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app6.ts index 3c543b192..632d92f7e 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app6.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app6.ts @@ -1,19 +1,19 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; /** * This demonstrates using the API via a promise */ getAgent().then(async fdc3 => { - console.log("in promise") - const log = document.getElementById("log"); - const reso = await fdc3.raiseIntent("ViewQuote", { - type: "fdc3.instrument", - id: { - isin: "Abc123" - } - }) + console.log('in promise'); + const log = document.getElementById('log'); + const reso = await fdc3.raiseIntent('ViewQuote', { + type: 'fdc3.instrument', + id: { + isin: 'Abc123', + }, + }); - log!!.textContent = `Got resolution: ${JSON.stringify(reso)}` - const result = await reso.getResult() - log!!.textContent += `Got result: ${JSON.stringify(result)}` + log!!.textContent = `Got resolution: ${JSON.stringify(reso)}`; + const result = await reso.getResult(); + log!!.textContent += `Got result: ${JSON.stringify(result)}`; }); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/app7.ts b/toolbox/fdc3-for-web/demo/src/client/apps/app7.ts index 01a8442ec..979c8b07a 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/app7.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/app7.ts @@ -1,19 +1,19 @@ -import { getAgent } from '@kite9/fdc3-get-agent' +import { getAgent } from '@kite9/fdc3-get-agent'; /** * This demonstrates using the API via a promise */ getAgent().then(async fdc3 => { - console.log("in promise") - const log = document.getElementById("log"); - const reso = await fdc3.raiseIntent("ViewNews", { - type: "fdc3.instrument", - id: { - isin: "Abc123" - } - }) + console.log('in promise'); + const log = document.getElementById('log'); + const reso = await fdc3.raiseIntent('ViewNews', { + type: 'fdc3.instrument', + id: { + isin: 'Abc123', + }, + }); - log!!.textContent = `Got resolution: ${JSON.stringify(reso)}` - const result = await reso.getResult() - log!!.textContent += `Got result: ${JSON.stringify(result)}` + log!!.textContent = `Got resolution: ${JSON.stringify(reso)}`; + const result = await reso.getResult(); + log!!.textContent += `Got result: ${JSON.stringify(result)}`; }); diff --git a/toolbox/fdc3-for-web/demo/src/client/apps/chartiq.ts b/toolbox/fdc3-for-web/demo/src/client/apps/chartiq.ts index ce31703ea..789ded04b 100644 --- a/toolbox/fdc3-for-web/demo/src/client/apps/chartiq.ts +++ b/toolbox/fdc3-for-web/demo/src/client/apps/chartiq.ts @@ -1,41 +1,39 @@ -import { getAgent } from "@kite9/fdc3-get-agent"; +import { getAgent } from '@kite9/fdc3-get-agent'; const init = async () => { - const fdc3 = await getAgent(); - console.log("get fdc3", fdc3); + const fdc3 = await getAgent(); + console.log('get fdc3', fdc3); + const cc = await fdc3.getCurrentChannel(); - const cc = await fdc3.getCurrentChannel() + if (cc == null) { + const channels = await fdc3.getUserChannels(); + await fdc3.joinUserChannel(channels[0].id); + } - if (cc == null) { - const channels = await fdc3.getUserChannels() - await fdc3.joinUserChannel(channels[0].id) - } + const stx: any = (window as any).stxx; - const stx: any = (window as any).stxx; - - // If the user changes the symbol, broadcast the new symbol - stx.callbacks.symbolChange = () => { - const ticker = stx.chart.symbol; - fdc3.broadcast({ - type: "fdc3.instrument", - name: ticker, - id: { ticker } - }); - }; - - // Listen for changes to fdc3.instrument, and update the symbol - fdc3.addContextListener("fdc3.instrument", (context) => { - if(context.id?.ticker !== stx.chart.symbol){ - stx.newChart(context.id?.ticker); - } + // If the user changes the symbol, broadcast the new symbol + stx.callbacks.symbolChange = () => { + const ticker = stx.chart.symbol; + fdc3.broadcast({ + type: 'fdc3.instrument', + name: ticker, + id: { ticker }, }); + }; - // Listen for ViewChart events - fdc3.addIntentListener("ViewChart", (context) => { - stx.newChart(context.id?.ticker); - }) -}; + // Listen for changes to fdc3.instrument, and update the symbol + fdc3.addContextListener('fdc3.instrument', context => { + if (context.id?.ticker !== stx.chart.symbol) { + stx.newChart(context.id?.ticker); + } + }); + // Listen for ViewChart events + fdc3.addIntentListener('ViewChart', context => { + stx.newChart(context.id?.ticker); + }); +}; -window.addEventListener("load", init); \ No newline at end of file +window.addEventListener('load', init); diff --git a/toolbox/fdc3-for-web/demo/src/client/da/DemoServerContext.ts b/toolbox/fdc3-for-web/demo/src/client/da/DemoServerContext.ts index ad584d72e..1167b739f 100644 --- a/toolbox/fdc3-for-web/demo/src/client/da/DemoServerContext.ts +++ b/toolbox/fdc3-for-web/demo/src/client/da/DemoServerContext.ts @@ -1,172 +1,176 @@ -import { AppRegistration, Directory, DirectoryApp, InstanceID, ServerContext, State } from '@kite9/fdc3-web-impl' +import { AppRegistration, Directory, DirectoryApp, InstanceID, ServerContext, State } from '@kite9/fdc3-web-impl'; import { Socket } from 'socket.io-client'; -import { v4 as uuid } from 'uuid' +import { v4 as uuid } from 'uuid'; import { FDC3_DA_EVENT } from '../../message-types'; import { AppIdentifier, AppIntent, Context, OpenError } from '@kite9/fdc3'; -enum Opener { Tab, Frame, Nested } - - -type DemoRegistration = AppRegistration & { - window: Window, - url: string, +enum Opener { + Tab, + Frame, + Nested, } +type DemoRegistration = AppRegistration & { + window: Window; + url: string; +}; export class DemoServerContext implements ServerContext { - - private readonly socket: Socket - private readonly directory: Directory - private connections: DemoRegistration[] = [] - - constructor(socket: Socket, directory: Directory) { - this.socket = socket - this.directory = directory - } - - async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { - return appIntents - } - - /** - * Sets the appId and instanceId for a given connection UUID - */ - setInstanceDetails(uuid: InstanceID, meta: DemoRegistration): void { - this.connections = this.connections.filter(ca => ca.instanceId !== uuid) - - this.connections.push({ - ...meta, - instanceId: uuid - }) - } - - getInstanceForWindow(window: Window): DemoRegistration | undefined { - return this.connections.find(i => i.window == window) - } - - getOpener(): Opener { - const cb = document.getElementById("opener") as HTMLInputElement; - const val = cb.value - var out: Opener = Opener[val as keyof typeof Opener]; //Works with --noImplicitAny - return out; - } - - createUUID(): string { - return uuid() - } - - /** - * Post an outgoing message to a particular app - */ - async post(message: object, to: InstanceID): Promise { - console.debug(`Responding to app instance:`, to, message) - this.socket.emit(FDC3_DA_EVENT, message, to) - } - - openFrame(url: string): Window { - var ifrm = document.createElement("iframe"); - ifrm.setAttribute("src", url); - ifrm.style.width = "640px"; - ifrm.style.height = "480px"; - document.body.appendChild(ifrm); - return ifrm.contentWindow!!; - } - - goodbye(id: string) { - this.connections = this.connections.filter(i => i.instanceId !== id) - console.debug(`Closed instance`, id) - console.debug(`Open apps:`, this.connections.map(i => i.instanceId)); - } - - openTab(url: string): Window { - return window.open(url, "_blank")!!; - } - - openNested(url: string): Window { - var ifrm = document.createElement("iframe"); - ifrm.setAttribute("src", "nested.html?url=" + url); - ifrm.style.width = "640px"; - ifrm.style.height = "480px"; - document.body.appendChild(ifrm); - return ifrm.contentWindow!!; - } - - openUrl(url: string): Window { - const opener = this.getOpener(); - switch (opener) { - case Opener.Tab: - return this.openTab(url); - case Opener.Nested: - return this.openNested(url); - case Opener.Frame: - return this.openFrame(url); - } - } - - async open(appId: string): Promise { - const details: DirectoryApp[] = this.directory.retrieveAppsById(appId) as DirectoryApp[] - if (details.length > 0) { - const url = (details[0].details as any)?.url ?? undefined - const window = this.openUrl(url) - const instanceId: InstanceID = this.createUUID() - const metadata = { - appId, - instanceId, - window, - url, - state: State.Pending, - } - - this.setInstanceDetails(instanceId, metadata) - return instanceId - } - - throw new Error(OpenError.AppNotFound) - } - - async getConnectedApps(): Promise { - return (await this.getAllApps()).filter(ca => ca.state == State.Connected) - } - - async isAppConnected(app: InstanceID): Promise { - const found = this.connections.find(a => (a.instanceId == app) && (a.state == State.Connected)) - return found != null - } - - async setAppState(app: InstanceID, state: State): Promise { - const found = this.connections.find(a => (a.instanceId == app)) - if (found) { - found.state = state - } - } - - async getAllApps(): Promise { - return this.connections.map(x => { - return { - appId: x.appId, - instanceId: x.instanceId, - state: x.state - } - }) - } - - getInstanceDetails(uuid: InstanceID): DemoRegistration | undefined { - return this.connections.find(i => i.instanceId == uuid) - } - - log(message: string): void { - console.log(message); - } - - provider(): string { - return "FDC3-Web-Demo" - } - - providerVersion(): string { - return "0.1" - } - - fdc3Version(): string { - return "2.0" - } -} \ No newline at end of file + private readonly socket: Socket; + private readonly directory: Directory; + private connections: DemoRegistration[] = []; + + constructor(socket: Socket, directory: Directory) { + this.socket = socket; + this.directory = directory; + } + + async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { + return appIntents; + } + + /** + * Sets the appId and instanceId for a given connection UUID + */ + setInstanceDetails(uuid: InstanceID, meta: DemoRegistration): void { + this.connections = this.connections.filter(ca => ca.instanceId !== uuid); + + this.connections.push({ + ...meta, + instanceId: uuid, + }); + } + + getInstanceForWindow(window: Window): DemoRegistration | undefined { + return this.connections.find(i => i.window == window); + } + + getOpener(): Opener { + const cb = document.getElementById('opener') as HTMLInputElement; + const val = cb.value; + var out: Opener = Opener[val as keyof typeof Opener]; //Works with --noImplicitAny + return out; + } + + createUUID(): string { + return uuid(); + } + + /** + * Post an outgoing message to a particular app + */ + async post(message: object, to: InstanceID): Promise { + console.debug(`Responding to app instance:`, to, message); + this.socket.emit(FDC3_DA_EVENT, message, to); + } + + openFrame(url: string): Window { + var ifrm = document.createElement('iframe'); + ifrm.setAttribute('src', url); + ifrm.style.width = '640px'; + ifrm.style.height = '480px'; + document.body.appendChild(ifrm); + return ifrm.contentWindow!!; + } + + goodbye(id: string) { + this.connections = this.connections.filter(i => i.instanceId !== id); + console.debug(`Closed instance`, id); + console.debug( + `Open apps:`, + this.connections.map(i => i.instanceId) + ); + } + + openTab(url: string): Window { + return window.open(url, '_blank')!!; + } + + openNested(url: string): Window { + var ifrm = document.createElement('iframe'); + ifrm.setAttribute('src', 'nested.html?url=' + url); + ifrm.style.width = '640px'; + ifrm.style.height = '480px'; + document.body.appendChild(ifrm); + return ifrm.contentWindow!!; + } + + openUrl(url: string): Window { + const opener = this.getOpener(); + switch (opener) { + case Opener.Tab: + return this.openTab(url); + case Opener.Nested: + return this.openNested(url); + case Opener.Frame: + return this.openFrame(url); + } + } + + async open(appId: string): Promise { + const details: DirectoryApp[] = this.directory.retrieveAppsById(appId) as DirectoryApp[]; + if (details.length > 0) { + const url = (details[0].details as any)?.url ?? undefined; + const window = this.openUrl(url); + const instanceId: InstanceID = this.createUUID(); + const metadata = { + appId, + instanceId, + window, + url, + state: State.Pending, + }; + + this.setInstanceDetails(instanceId, metadata); + return instanceId; + } + + throw new Error(OpenError.AppNotFound); + } + + async getConnectedApps(): Promise { + return (await this.getAllApps()).filter(ca => ca.state == State.Connected); + } + + async isAppConnected(app: InstanceID): Promise { + const found = this.connections.find(a => a.instanceId == app && a.state == State.Connected); + return found != null; + } + + async setAppState(app: InstanceID, state: State): Promise { + const found = this.connections.find(a => a.instanceId == app); + if (found) { + found.state = state; + } + } + + async getAllApps(): Promise { + return this.connections.map(x => { + return { + appId: x.appId, + instanceId: x.instanceId, + state: x.state, + }; + }); + } + + getInstanceDetails(uuid: InstanceID): DemoRegistration | undefined { + return this.connections.find(i => i.instanceId == uuid); + } + + log(message: string): void { + console.log(message); + } + + provider(): string { + return 'FDC3-Web-Demo'; + } + + providerVersion(): string { + return '0.1'; + } + + fdc3Version(): string { + return '2.0'; + } +} diff --git a/toolbox/fdc3-for-web/demo/src/client/da/FDC3_2_1_JSONDirectory.ts b/toolbox/fdc3-for-web/demo/src/client/da/FDC3_2_1_JSONDirectory.ts index f4e7c6354..fa49cb338 100644 --- a/toolbox/fdc3-for-web/demo/src/client/da/FDC3_2_1_JSONDirectory.ts +++ b/toolbox/fdc3-for-web/demo/src/client/da/FDC3_2_1_JSONDirectory.ts @@ -1,31 +1,28 @@ -import { BasicDirectory } from "@kite9/fdc3-web-impl/src/directory/BasicDirectory"; -import { DirectoryApp } from "@kite9/fdc3-web-impl/src/directory/DirectoryInterface"; +import { BasicDirectory } from '@kite9/fdc3-web-impl/src/directory/BasicDirectory'; +import { DirectoryApp } from '@kite9/fdc3-web-impl/src/directory/DirectoryInterface'; async function loadRemotely(u: string) { - const response = await fetch(u); - return await response.json(); + const response = await fetch(u); + return await response.json(); } async function load(url: string): Promise { - if (url.startsWith('http')) { - return await loadRemotely(url).then(convertToDirectoryList); - } else { - return await loadRemotely(window.location.origin + url).then(convertToDirectoryList); - - } + if (url.startsWith('http')) { + return await loadRemotely(url).then(convertToDirectoryList); + } else { + return await loadRemotely(window.location.origin + url).then(convertToDirectoryList); + } } const convertToDirectoryList = (data: any) => { - return data.applications as DirectoryApp[]; -} + return data.applications as DirectoryApp[]; +}; export class FDC3_2_1_JSONDirectory extends BasicDirectory { + constructor() { + super([]); + } - constructor() { - super([]) - } - - async load(url: string) { - this.allApps = await load(url); - } - -} \ No newline at end of file + async load(url: string) { + this.allApps = await load(url); + } +} diff --git a/toolbox/fdc3-for-web/demo/src/client/da/dummy-desktop-agent.ts b/toolbox/fdc3-for-web/demo/src/client/da/dummy-desktop-agent.ts index 36efd7c68..7b9d19f46 100644 --- a/toolbox/fdc3-for-web/demo/src/client/da/dummy-desktop-agent.ts +++ b/toolbox/fdc3-for-web/demo/src/client/da/dummy-desktop-agent.ts @@ -1,176 +1,191 @@ -import { io } from "socket.io-client" -import { v4 as uuid } from 'uuid' -import { APP_GOODBYE, APP_HELLO, DA_HELLO, FDC3_APP_EVENT } from "../../message-types"; -import { DemoServerContext } from "./DemoServerContext"; -import { FDC3_2_1_JSONDirectory } from "./FDC3_2_1_JSONDirectory"; -import { AppRegistration, DefaultFDC3Server, DirectoryApp, ServerContext } from "@kite9/fdc3-web-impl"; -import { ChannelState, ChannelType } from "@kite9/fdc3-web-impl/src/handlers/BroadcastHandler"; -import { link, UI, UI_URLS } from "./util"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL +import { io } from 'socket.io-client'; +import { v4 as uuid } from 'uuid'; +import { APP_GOODBYE, APP_HELLO, DA_HELLO, FDC3_APP_EVENT } from '../../message-types'; +import { DemoServerContext } from './DemoServerContext'; +import { FDC3_2_1_JSONDirectory } from './FDC3_2_1_JSONDirectory'; +import { AppRegistration, DefaultFDC3Server, DirectoryApp, ServerContext } from '@kite9/fdc3-web-impl'; +import { ChannelState, ChannelType } from '@kite9/fdc3-web-impl/src/handlers/BroadcastHandler'; +import { link, UI, UI_URLS } from './util'; +import { BrowserTypes } from '@kite9/fdc3-schema'; + +type WebConnectionProtocol2LoadURL = BrowserTypes.WebConnectionProtocol2LoadURL; function createAppStartButton(app: DirectoryApp, sc: ServerContext): HTMLDivElement { - const div: HTMLDivElement = document.createElement("div") - div.classList.add("app") - const h3 = document.createElement("h3") - h3.textContent = app.title - div.appendChild(h3) - const button = document.createElement("button") - button.textContent = "Start" - button.onclick = () => sc.open(app.appId) - div.appendChild(button) - const p = document.createElement("p") - p.textContent = app.description ?? '' - div.appendChild(p) - return div + const div: HTMLDivElement = document.createElement('div'); + div.classList.add('app'); + const h3 = document.createElement('h3'); + h3.textContent = app.title; + div.appendChild(h3); + const button = document.createElement('button'); + button.textContent = 'Start'; + button.onclick = () => sc.open(app.appId); + div.appendChild(button); + const p = document.createElement('p'); + p.textContent = app.description ?? ''; + div.appendChild(p); + return div; } -enum Approach { IFRAME, PARENT_POST_MESSAGE } +enum Approach { + IFRAME, + PARENT_POST_MESSAGE, +} function getApproach(): Approach { - const cb = document.getElementById("approach") as HTMLInputElement; - const val = cb.value - var out: Approach = Approach[val as keyof typeof Approach]; //Works with --noImplicitAny - return out; + const cb = document.getElementById('approach') as HTMLInputElement; + const val = cb.value; + var out: Approach = Approach[val as keyof typeof Approach]; //Works with --noImplicitAny + return out; } function getUIKey(): UI { - const cb = document.getElementById("ui") as HTMLInputElement; - const val = cb.value - var out: UI = UI[val as keyof typeof UI]; //Works with --noImplicitAny - return out; + const cb = document.getElementById('ui') as HTMLInputElement; + const val = cb.value; + var out: UI = UI[val as keyof typeof UI]; //Works with --noImplicitAny + return out; } -window.addEventListener("load", () => { - - let desktopAgentUUID = uuid() - - const socket = io() - - socket.on("connect", async () => { - socket.emit(DA_HELLO, desktopAgentUUID) - - const directory = new FDC3_2_1_JSONDirectory() - await directory.load("/static/da/appd.json") - const sc = new DemoServerContext(socket, directory) - - const channelDetails: ChannelState[] = [ - { id: "one", type: ChannelType.user, context: [], displayMetadata: { name: "THE RED CHANNEL", color: "red" } }, - { id: "two", type: ChannelType.user, context: [], displayMetadata: { name: "THE BLUE CHANNEL", color: "blue" } }, - { id: "three", type: ChannelType.user, context: [], displayMetadata: { name: "THE GREEN CHANNEL", color: "green" } } - ] - const fdc3Server = new DefaultFDC3Server(sc, directory, channelDetails, true, 20000, 10017) - - socket.on(FDC3_APP_EVENT, (msg, from) => { - fdc3Server.receive(msg, from) - }) - - socket.on(APP_GOODBYE, (id: string) => { - sc.goodbye(id) - }) - - // let's create buttons for some apps - const appList = document.getElementById('app-list') as HTMLOListElement - directory.retrieveAllApps().forEach(app => { - appList.appendChild(createAppStartButton(app, sc)) - }) - - // set up Desktop Agent Proxy interface here - // disabling rule for checks on origin of messages - this could be improved by validating for origins we know we are working with - // nosemgrep: javascript.browser.security.insufficient-postmessage-origin-validation.insufficient-postmessage-origin-validation - window.addEventListener( - "message", - (e) => { - const event = e as MessageEvent - const data = event.data; - const source = event.source as Window - const origin = event.origin; - - console.log("Received: " + JSON.stringify(event.data)); - if (data.type == "WCP1Hello") { - if (getApproach() == Approach.IFRAME) { - const instance = sc.getInstanceForWindow(source) - source.postMessage({ - type: "WCP2LoadUrl", - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - iframeUrl: window.location.origin + `/static/da/embed.html?connectionAttemptUuid=${data.meta.connectionAttemptUuid}&desktopAgentId=${desktopAgentUUID}&instanceId=${instance?.instanceId}&UI=${getUIKey()}` - } - } as WebConnectionProtocol2LoadURL, origin) - } else { - const instance = sc.getInstanceForWindow(source)!! - const channel = new MessageChannel() - link(socket, channel, instance.instanceId!!) - - socket.emit(APP_HELLO, desktopAgentUUID, instance.instanceId) - - const ui = UI_URLS[getUIKey()] - - // send the other end of the channel to the app - source.postMessage({ - type: 'WCP3Handshake', - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - fdc3Version: "2.2", - ...ui - } - }, origin, [channel.port1]) - } - } - - // If this is in an iframe... - if (getApproach() == Approach.IFRAME) { - const instance = sc.getInstanceForWindow(source) - const message: WebConnectionProtocol2LoadURL = { - type: "WCP2LoadUrl", - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - iframeUrl: window.location.origin + `/static/da/embed.html?connectionAttemptUuid=${data.meta.connectionAttemptUuid}&desktopAgentId=${desktopAgentUUID}&instanceId=${instance?.instanceId}` - } - } - source.postMessage(message, origin) - return - } - - const instance = sc.getInstanceForWindow(source) - - if(!instance){ - throw new Error("Unable to find registration for this window") - } - - const channel = new MessageChannel() - link(socket, channel, instance.instanceId) - - socket.emit(APP_HELLO, desktopAgentUUID, instance.instanceId) - - // send the other end of the channel to the app - source.postMessage({ - type: 'WCP3Handshake', - meta: { - connectionAttemptUuid: data.meta.connectionAttemptUuid, - timestamp: new Date() - }, - payload: { - fdc3Version: "2.2", - intentResolverUrl: window.location.origin + "/static/da/intent-resolver.html", - channelSelectorUrl: window.location.origin + "/static/da/channel-selector.html", - } - }, origin, [channel.port1]) - } - ); - }) - - - -}) - +window.addEventListener('load', () => { + let desktopAgentUUID = uuid(); + + const socket = io(); + + socket.on('connect', async () => { + socket.emit(DA_HELLO, desktopAgentUUID); + + const directory = new FDC3_2_1_JSONDirectory(); + await directory.load('/static/da/appd.json'); + const sc = new DemoServerContext(socket, directory); + + const channelDetails: ChannelState[] = [ + { id: 'one', type: ChannelType.user, context: [], displayMetadata: { name: 'THE RED CHANNEL', color: 'red' } }, + { id: 'two', type: ChannelType.user, context: [], displayMetadata: { name: 'THE BLUE CHANNEL', color: 'blue' } }, + { + id: 'three', + type: ChannelType.user, + context: [], + displayMetadata: { name: 'THE GREEN CHANNEL', color: 'green' }, + }, + ]; + const fdc3Server = new DefaultFDC3Server(sc, directory, channelDetails, true, 20000, 10017); + + socket.on(FDC3_APP_EVENT, (msg, from) => { + fdc3Server.receive(msg, from); + }); + + socket.on(APP_GOODBYE, (id: string) => { + sc.goodbye(id); + }); + + // let's create buttons for some apps + const appList = document.getElementById('app-list') as HTMLOListElement; + directory.retrieveAllApps().forEach(app => { + appList.appendChild(createAppStartButton(app, sc)); + }); + + // set up Desktop Agent Proxy interface here + // disabling rule for checks on origin of messages - this could be improved by validating for origins we know we are working with + // nosemgrep: javascript.browser.security.insufficient-postmessage-origin-validation.insufficient-postmessage-origin-validation + window.addEventListener('message', e => { + const event = e as MessageEvent; + const data = event.data; + const source = event.source as Window; + const origin = event.origin; + + console.log('Received: ' + JSON.stringify(event.data)); + if (data.type == 'WCP1Hello') { + if (getApproach() == Approach.IFRAME) { + const instance = sc.getInstanceForWindow(source); + source.postMessage( + { + type: 'WCP2LoadUrl', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + iframeUrl: + window.location.origin + + `/static/da/embed.html?connectionAttemptUuid=${data.meta.connectionAttemptUuid}&desktopAgentId=${desktopAgentUUID}&instanceId=${instance?.instanceId}&UI=${getUIKey()}`, + }, + } as WebConnectionProtocol2LoadURL, + origin + ); + } else { + const instance = sc.getInstanceForWindow(source)!!; + const channel = new MessageChannel(); + link(socket, channel, instance.instanceId!!); + + socket.emit(APP_HELLO, desktopAgentUUID, instance.instanceId); + + const ui = UI_URLS[getUIKey()]; + + // send the other end of the channel to the app + source.postMessage( + { + type: 'WCP3Handshake', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + fdc3Version: '2.2', + ...ui, + }, + }, + origin, + [channel.port1] + ); + } + } + + // If this is in an iframe... + if (getApproach() == Approach.IFRAME) { + const instance = sc.getInstanceForWindow(source); + const message: WebConnectionProtocol2LoadURL = { + type: 'WCP2LoadUrl', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + iframeUrl: + window.location.origin + + `/static/da/embed.html?connectionAttemptUuid=${data.meta.connectionAttemptUuid}&desktopAgentId=${desktopAgentUUID}&instanceId=${instance?.instanceId}`, + }, + }; + source.postMessage(message, origin); + return; + } + + const instance = sc.getInstanceForWindow(source); + + if (!instance) { + throw new Error('Unable to find registration for this window'); + } + + const channel = new MessageChannel(); + link(socket, channel, instance.instanceId); + + socket.emit(APP_HELLO, desktopAgentUUID, instance.instanceId); + + // send the other end of the channel to the app + source.postMessage( + { + type: 'WCP3Handshake', + meta: { + connectionAttemptUuid: data.meta.connectionAttemptUuid, + timestamp: new Date(), + }, + payload: { + fdc3Version: '2.2', + intentResolverUrl: window.location.origin + '/static/da/intent-resolver.html', + channelSelectorUrl: window.location.origin + '/static/da/channel-selector.html', + }, + }, + origin, + [channel.port1] + ); + }); + }); +}); diff --git a/toolbox/fdc3-for-web/demo/src/client/da/embed.ts b/toolbox/fdc3-for-web/demo/src/client/da/embed.ts index 5f4f99a80..dacdc8fc0 100644 --- a/toolbox/fdc3-for-web/demo/src/client/da/embed.ts +++ b/toolbox/fdc3-for-web/demo/src/client/da/embed.ts @@ -1,68 +1,67 @@ -import { io } from "socket.io-client" -import { link, UI, UI_URLS } from "./util"; -import { APP_HELLO } from "../../message-types"; +import { io } from 'socket.io-client'; +import { link, UI, UI_URLS } from './util'; +import { APP_HELLO } from '../../message-types'; const appWindow = window.parent; function getQueryVariable(variable: string): string { - var query = window.location.search.substring(1); - var vars = query.split("&"); - for (var i = 0; i < vars.length; i++) { - var pair = vars[i].split("="); - if (pair[0] == variable) { - return pair[1]; - } + var query = window.location.search.substring(1); + var vars = query.split('&'); + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split('='); + if (pair[0] == variable) { + return pair[1]; } + } - return "" - + return ''; } function getConnectionAttemptUuid(): string { - return getQueryVariable("connectionAttemptUuid") + return getQueryVariable('connectionAttemptUuid'); } function getSource(): string { - return getQueryVariable("instanceId") + return getQueryVariable('instanceId'); } function getDesktopAgentId(): string { - return getQueryVariable("desktopAgentId") + return getQueryVariable('desktopAgentId'); } function getUIKey(): UI { - const ui = getQueryVariable("UI") - return parseInt(ui) as UI + const ui = getQueryVariable('UI'); + return parseInt(ui) as UI; } -window.addEventListener("load", () => { - - const socket = io() - const channel = new MessageChannel() - const source = getSource() - const desktopAgentUUID = getDesktopAgentId() - - socket.on("connect", () => { - - link(socket, channel, source) - - socket.emit(APP_HELLO, desktopAgentUUID, source) - - const ui = UI_URLS[getUIKey()] - - // send the other end of the channel to the app - appWindow.postMessage({ - type: 'WCP3Handshake', - meta: { - connectionAttemptUuid: getConnectionAttemptUuid(), - timestamp: new Date() - }, - payload: { - fdc3Version: "2.2", - ...ui - } - }, "*", [channel.port1]) - - - }) -}) +window.addEventListener('load', () => { + const socket = io(); + const channel = new MessageChannel(); + const source = getSource(); + const desktopAgentUUID = getDesktopAgentId(); + + socket.on('connect', () => { + link(socket, channel, source); + + socket.emit(APP_HELLO, desktopAgentUUID, source); + + const ui = UI_URLS[getUIKey()]; + + // send the other end of the channel to the app + appWindow.postMessage( + { + type: 'WCP3Handshake', + meta: { + connectionAttemptUuid: getConnectionAttemptUuid(), + timestamp: new Date(), + }, + payload: { + fdc3Version: '2.2', + ...ui, + }, + }, + '*', + [channel.port1] + ); + }); +}); diff --git a/toolbox/fdc3-for-web/demo/src/client/da/util.ts b/toolbox/fdc3-for-web/demo/src/client/da/util.ts index 16fcf55b6..6c362a9f6 100644 --- a/toolbox/fdc3-for-web/demo/src/client/da/util.ts +++ b/toolbox/fdc3-for-web/demo/src/client/da/util.ts @@ -1,27 +1,30 @@ -import { InstanceID } from "@kite9/fdc3-web-impl" -import { Socket } from "socket.io-client" -import { FDC3_APP_EVENT, FDC3_DA_EVENT } from "../../message-types" +import { InstanceID } from '@kite9/fdc3-web-impl'; +import { Socket } from 'socket.io-client'; +import { FDC3_APP_EVENT, FDC3_DA_EVENT } from '../../message-types'; -export enum UI { DEFAULT, DEMO } +export enum UI { + DEFAULT, + DEMO, +} export const UI_URLS = { - [UI.DEMO]: { - intentResolverUrl: window.location.origin + "/static/da/intent-resolver.html", - channelSelectorUrl: window.location.origin + "/static/da/channel-selector.html", - }, - [UI.DEFAULT]: { - // TODO: REPLACE WITH FDC3.FINOS.ORG URLS AFTER GO-LIVE - intentResolverUrl: "http://localhost:4002/intent_resolver.html", - channelSelectorUrl: "http://localhost:4002/channel_selector.html", - } -} + [UI.DEMO]: { + intentResolverUrl: window.location.origin + '/static/da/intent-resolver.html', + channelSelectorUrl: window.location.origin + '/static/da/channel-selector.html', + }, + [UI.DEFAULT]: { + // TODO: REPLACE WITH FDC3.FINOS.ORG URLS AFTER GO-LIVE + intentResolverUrl: 'http://localhost:4002/intent_resolver.html', + channelSelectorUrl: 'http://localhost:4002/channel_selector.html', + }, +}; export function link(socket: Socket, channel: MessageChannel, source: InstanceID) { - socket.on(FDC3_DA_EVENT, (data: any) => { - channel.port2.postMessage(data) - }) + socket.on(FDC3_DA_EVENT, (data: any) => { + channel.port2.postMessage(data); + }); - channel.port2.onmessage = function (event) { - socket.emit(FDC3_APP_EVENT, event.data, source) - } + channel.port2.onmessage = function (event) { + socket.emit(FDC3_APP_EVENT, event.data, source); + }; } diff --git a/toolbox/fdc3-for-web/demo/src/client/ui/channel-selector.ts b/toolbox/fdc3-for-web/demo/src/client/ui/channel-selector.ts index 38b742c26..06cf8f12a 100644 --- a/toolbox/fdc3-for-web/demo/src/client/ui/channel-selector.ts +++ b/toolbox/fdc3-for-web/demo/src/client/ui/channel-selector.ts @@ -1,134 +1,140 @@ -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { dragElement } from "./drag"; -import { Fdc3UserInterfaceRestyle } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { dragElement } from './drag'; +import { Fdc3UserInterfaceRestyle } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; // TODO: Update typings -let channels: any[] = [] -let channelId: string | null = null - +let channels: any[] = []; +let channelId: string | null = null; export const DEFAULT_COLLAPSED_CSS = { - width: "50px", - height: "50px", - position: "fixed", - zIndex: "1000", -} + width: '50px', + height: '50px', + position: 'fixed', + zIndex: '1000', +}; const DEFAULT_EXPANDED_CSS = { - left: "0", - right: "0", - top: "0", - bottom: "0", - position: "fixed", - zIndex: "1000" -} + left: '0', + right: '0', + top: '0', + bottom: '0', + position: 'fixed', + zIndex: '1000', +}; export type Position = { - left: string, - top: string, - bottom: string, - right: string -} + left: string; + top: string; + bottom: string; + right: string; +}; const position: Position = { - right: "10px", - bottom: "10px", - left: "", - top: "" -} - -window.addEventListener("load", () => { - const parent = window.parent; - const logo = document.getElementById("logo")!! - const close = document.getElementById("close")!! - const drag = document.getElementById("drag")!! - const selector = document.getElementById("selector")!! - const list = document.getElementById("channel-list")!! - - const mc = new MessageChannel(); - const myPort = mc.port1 - myPort.start() - - - // ISSUE: 1302 - const helloMessage: BrowserTypes.Fdc3UserInterfaceHello = { - type: "Fdc3UserInterfaceHello", - payload: { - initialCSS: { - ...DEFAULT_COLLAPSED_CSS, ...position - }, - implementationDetails: "Demo Channel Selector v1.0" - } + right: '10px', + bottom: '10px', + left: '', + top: '', +}; + +window.addEventListener('load', () => { + const parent = window.parent; + const logo = document.getElementById('logo')!!; + const close = document.getElementById('close')!!; + const drag = document.getElementById('drag')!!; + const selector = document.getElementById('selector')!!; + const list = document.getElementById('channel-list')!!; + + const mc = new MessageChannel(); + const myPort = mc.port1; + myPort.start(); + + // ISSUE: 1302 + const helloMessage: BrowserTypes.Fdc3UserInterfaceHello = { + type: 'Fdc3UserInterfaceHello', + payload: { + initialCSS: { + ...DEFAULT_COLLAPSED_CSS, + ...position, + }, + implementationDetails: 'Demo Channel Selector v1.0', + }, + }; + parent.postMessage(helloMessage, '*', [mc.port2]); + + function changeSize(expanded: boolean) { + document.body.setAttribute('data-expanded', 'none'); + if (expanded) { + myPort.postMessage({ + type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, + payload: { updatedCSS: DEFAULT_EXPANDED_CSS }, + } as Fdc3UserInterfaceRestyle); + selector.style.left = position.left; + selector.style.top = position.top; + selector.style.right = position.right; + selector.style.bottom = position.bottom; + setTimeout(() => { + document.body.setAttribute('data-expanded', 'selector'); + }, 20); + } else { + myPort.postMessage({ + type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, + payload: { updatedCSS: { ...DEFAULT_COLLAPSED_CSS, ...position } }, + } as Fdc3UserInterfaceRestyle); + setTimeout(() => { + document.body.setAttribute('data-expanded', 'logo'); + }, 20); } - parent.postMessage(helloMessage, "*", [mc.port2]); - - function changeSize(expanded: boolean) { - document.body.setAttribute("data-expanded", "none"); - if (expanded) { - myPort.postMessage({ type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, payload: { updatedCSS: DEFAULT_EXPANDED_CSS } } as Fdc3UserInterfaceRestyle) - selector.style.left = position.left - selector.style.top = position.top - selector.style.right = position.right - selector.style.bottom = position.bottom - setTimeout(() => { - document.body.setAttribute("data-expanded", "selector"); - }, 20) - } else { - myPort.postMessage({ type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, payload: { updatedCSS: { ...DEFAULT_COLLAPSED_CSS, ...position } } } as Fdc3UserInterfaceRestyle) - setTimeout(() => { - document.body.setAttribute("data-expanded", "logo"); - }, 20) - } + } + + myPort.addEventListener('message', e => { + console.log(e.data.type); + if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { + // ok, port is ready, send the iframe position detials + myPort.postMessage({ + type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, + payload: { updatedCSS: { ...DEFAULT_COLLAPSED_CSS, ...position } }, + } as Fdc3UserInterfaceRestyle); + } else if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_CHANNELS_TYPE) { + const details = e.data as BrowserTypes.Fdc3UserInterfaceChannels; + console.log(JSON.stringify('CHANNEL DETAILS: ' + JSON.stringify(details))); + channels = details.payload.userChannels; + channelId = details.payload.selected; + + const selectedColor = + (channelId ? channels.find(c => c.id == channelId)?.displayMetadata?.color : null) ?? 'white'; + logo.style.backgroundColor = selectedColor; } - - myPort.addEventListener("message", (e) => { - console.log(e.data.type) - if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_HANDSHAKE_TYPE) { - // ok, port is ready, send the iframe position detials - myPort.postMessage({ type: BrowserTypes.FDC3_USER_INTERFACE_RESTYLE_TYPE, payload: { updatedCSS: { ...DEFAULT_COLLAPSED_CSS, ...position } } } as Fdc3UserInterfaceRestyle) - } else if (e.data.type == BrowserTypes.FDC3_USER_INTERFACE_CHANNELS_TYPE) { - const details = e.data as BrowserTypes.Fdc3UserInterfaceChannels - console.log(JSON.stringify("CHANNEL DETAILS: " + JSON.stringify(details))) - channels = details.payload.userChannels - channelId = details.payload.selected - - const selectedColor = (channelId ? (channels.find(c => c.id == channelId)?.displayMetadata?.color) : null) ?? 'white' - logo.style.backgroundColor = selectedColor - } - }) - - close.addEventListener("click", () => { - changeSize(false) - }) - - logo.addEventListener("click", () => { - list.innerHTML = '' - channels.forEach(channel => { - - const li = document.createElement("div") - li.style.backgroundColor = channel.displayMetadata.color - const description = document.createElement("em") - description.textContent = channel.displayMetadata.name = (channel.id == channelId ? " CURRENT CHANNEL " : "") - li.textContent = channel.id - - li.appendChild(description) - list.appendChild(li) - li.onclick = () => { - changeSize(false) - channelId = channel.id - const message: BrowserTypes.Fdc3UserInterfaceChannelSelected = { - type: "Fdc3UserInterfaceChannelSelected", - payload: { - selected: channel.id - } - } - myPort.postMessage(message) - } - }) - changeSize(true) - }) - - - dragElement(drag, selector, position) - -}) \ No newline at end of file + }); + + close.addEventListener('click', () => { + changeSize(false); + }); + + logo.addEventListener('click', () => { + list.innerHTML = ''; + channels.forEach(channel => { + const li = document.createElement('div'); + li.style.backgroundColor = channel.displayMetadata.color; + const description = document.createElement('em'); + description.textContent = channel.displayMetadata.name = channel.id == channelId ? ' CURRENT CHANNEL ' : ''; + li.textContent = channel.id; + + li.appendChild(description); + list.appendChild(li); + li.onclick = () => { + changeSize(false); + channelId = channel.id; + const message: BrowserTypes.Fdc3UserInterfaceChannelSelected = { + type: 'Fdc3UserInterfaceChannelSelected', + payload: { + selected: channel.id, + }, + }; + myPort.postMessage(message); + }; + }); + changeSize(true); + }); + + dragElement(drag, selector, position); +}); diff --git a/toolbox/fdc3-for-web/demo/src/client/ui/drag.ts b/toolbox/fdc3-for-web/demo/src/client/ui/drag.ts index aeb96de05..579fe28dc 100644 --- a/toolbox/fdc3-for-web/demo/src/client/ui/drag.ts +++ b/toolbox/fdc3-for-web/demo/src/client/ui/drag.ts @@ -1,52 +1,56 @@ -import { Position } from "./channel-selector"; +import { Position } from './channel-selector'; export function dragElement(drag: HTMLElement, selector: HTMLElement, position: Position) { - var posXDrag = 0, posYDrag = 0, posXStart = 0, posYStart = 0; - var top = 0, left = 0, screenX = 0, screenY = 0 - - drag.onmousedown = dragMouseDown; - - globalThis.window.onresize = () => { - screenX = window.innerWidth - screenY = window.innerHeight - } - - function updatePosition() { - position.left = (left < screenX / 2) ? `${Math.max(left, 0)}px` : "" - position.top = (top < screenY / 2) ? `${Math.max(top, 0)}px` : "" - position.right = (left > screenX / 2) ? `${Math.max(screenX - left - selector.offsetWidth, 0)}px` : "" - position.bottom = (top > screenY / 2) ? `${Math.max(screenY - top - selector.offsetHeight, 0)}px` : "" - - } - - function dragMouseDown(e: MouseEvent) { - console.log("astarting") - e.preventDefault(); - // get the mouse cursor position at startup: - posXStart = e.clientX; - posYStart = e.clientY; - document.onmousemove = elementDrag; - document.onmouseup = closeDragElement; - } - - function elementDrag(e: MouseEvent) { - e.preventDefault(); - // calculate the new cursor position: - posXDrag = posXStart - e.clientX; - posYDrag = posYStart - e.clientY; - posXStart = e.clientX; - posYStart = e.clientY; - // set the element's new position: - top = Math.max((selector.offsetTop - posYDrag), 0) - left = Math.max((selector.offsetLeft - posXDrag), 0) - selector.style.top = top + "px"; - selector.style.left = left + "px"; - updatePosition() - } - - function closeDragElement() { - - document.onmouseup = null; - document.onmousemove = null; - } -} \ No newline at end of file + var posXDrag = 0, + posYDrag = 0, + posXStart = 0, + posYStart = 0; + var top = 0, + left = 0, + screenX = 0, + screenY = 0; + + drag.onmousedown = dragMouseDown; + + globalThis.window.onresize = () => { + screenX = window.innerWidth; + screenY = window.innerHeight; + }; + + function updatePosition() { + position.left = left < screenX / 2 ? `${Math.max(left, 0)}px` : ''; + position.top = top < screenY / 2 ? `${Math.max(top, 0)}px` : ''; + position.right = left > screenX / 2 ? `${Math.max(screenX - left - selector.offsetWidth, 0)}px` : ''; + position.bottom = top > screenY / 2 ? `${Math.max(screenY - top - selector.offsetHeight, 0)}px` : ''; + } + + function dragMouseDown(e: MouseEvent) { + console.log('astarting'); + e.preventDefault(); + // get the mouse cursor position at startup: + posXStart = e.clientX; + posYStart = e.clientY; + document.onmousemove = elementDrag; + document.onmouseup = closeDragElement; + } + + function elementDrag(e: MouseEvent) { + e.preventDefault(); + // calculate the new cursor position: + posXDrag = posXStart - e.clientX; + posYDrag = posYStart - e.clientY; + posXStart = e.clientX; + posYStart = e.clientY; + // set the element's new position: + top = Math.max(selector.offsetTop - posYDrag, 0); + left = Math.max(selector.offsetLeft - posXDrag, 0); + selector.style.top = top + 'px'; + selector.style.left = left + 'px'; + updatePosition(); + } + + function closeDragElement() { + document.onmouseup = null; + document.onmousemove = null; + } +} diff --git a/toolbox/fdc3-for-web/demo/src/client/ui/intent-resolver.ts b/toolbox/fdc3-for-web/demo/src/client/ui/intent-resolver.ts index 4b60a73c5..5002b7740 100644 --- a/toolbox/fdc3-for-web/demo/src/client/ui/intent-resolver.ts +++ b/toolbox/fdc3-for-web/demo/src/client/ui/intent-resolver.ts @@ -1,106 +1,117 @@ -import { Fdc3UserInterfaceHello, Fdc3UserInterfaceResolve, Fdc3UserInterfaceResolveAction, Fdc3UserInterfaceRestyle } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; -import { AppIdentifier } from "@kite9/fdc3-standard"; +import { + Fdc3UserInterfaceHello, + Fdc3UserInterfaceResolve, + Fdc3UserInterfaceResolveAction, + Fdc3UserInterfaceRestyle, +} from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +import { AppIdentifier } from '@kite9/fdc3-standard'; const DEFAULT_COLLAPSED_CSS = { - position: "fixed", - display: "none", - zIndex: "1000", - right: "0", - bottom: "0", - width: "0", - height: "0" -} + position: 'fixed', + display: 'none', + zIndex: '1000', + right: '0', + bottom: '0', + width: '0', + height: '0', +}; const DEFAULT_EXPANDED_CSS = { - position: "fixed", - display: "block", - zIndex: "1000", - left: "10%", - top: "10%", - right: "10%", - bottom: "10%" -} -window.addEventListener("load", () => { + position: 'fixed', + display: 'block', + zIndex: '1000', + left: '10%', + top: '10%', + right: '10%', + bottom: '10%', +}; +window.addEventListener('load', () => { + const parent = window.parent; - const parent = window.parent; + const mc = new MessageChannel(); + const myPort = mc.port1; + myPort.start(); - const mc = new MessageChannel(); - const myPort = mc.port1 - myPort.start() + const list = document.getElementById('intent-list')!!; - const list = document.getElementById("intent-list")!! + // ISSUE: 1302 + const helloMessage: Fdc3UserInterfaceHello = { + type: 'Fdc3UserInterfaceHello', + payload: { + initialCSS: DEFAULT_COLLAPSED_CSS, + implementationDetails: 'Demo Intent Resolver v1.0', + }, + }; + parent.postMessage(helloMessage, '*', [mc.port2]); - // ISSUE: 1302 - const helloMessage: Fdc3UserInterfaceHello = { - type: "Fdc3UserInterfaceHello", - payload: { - initialCSS: DEFAULT_COLLAPSED_CSS, - implementationDetails: "Demo Intent Resolver v1.0" - } - } - parent.postMessage(helloMessage, "*", [mc.port2]); + function callback(intent: string | null, app: AppIdentifier | null) { + const restyleMessage: Fdc3UserInterfaceRestyle = { + type: 'Fdc3UserInterfaceRestyle', + payload: { updatedCSS: DEFAULT_COLLAPSED_CSS }, + }; + myPort.postMessage(restyleMessage); - function callback(intent: string | null, app: AppIdentifier | null) { - const restyleMessage: Fdc3UserInterfaceRestyle = { type: "Fdc3UserInterfaceRestyle", payload: { updatedCSS: DEFAULT_COLLAPSED_CSS } } - myPort.postMessage(restyleMessage) - - if (intent && app) { - const message: Fdc3UserInterfaceResolveAction = { - type: "Fdc3UserInterfaceResolveAction", - payload: { - action: "click", - appIdentifier: app, - intent: intent - } - } - myPort.postMessage(message) - } else { - const message: Fdc3UserInterfaceResolveAction = { - type: "Fdc3UserInterfaceResolveAction", - payload: { - action: "cancel" - } - } - myPort.postMessage(message) - } + if (intent && app) { + const message: Fdc3UserInterfaceResolveAction = { + type: 'Fdc3UserInterfaceResolveAction', + payload: { + action: 'click', + appIdentifier: app, + intent: intent, + }, + }; + myPort.postMessage(message); + } else { + const message: Fdc3UserInterfaceResolveAction = { + type: 'Fdc3UserInterfaceResolveAction', + payload: { + action: 'cancel', + }, + }; + myPort.postMessage(message); } + } - myPort.addEventListener("message", (e) => { - if (e.data.type == 'iframeHandshake') { - const message: Fdc3UserInterfaceRestyle = { type: "Fdc3UserInterfaceRestyle", payload: { updatedCSS: DEFAULT_COLLAPSED_CSS } } - myPort.postMessage(message) - } else if (e.data.type == 'iframeResolve') { - const message: Fdc3UserInterfaceRestyle = { type: "Fdc3UserInterfaceRestyle", payload: { updatedCSS: DEFAULT_EXPANDED_CSS } } - myPort.postMessage(message) - Array.from(list.children).forEach(i => i.remove()) - const details: Fdc3UserInterfaceResolve["payload"] = e.data.payload - details.appIntents.forEach(intent => { - - intent.apps.forEach(app => { - const li = document.createElement("li") - const a = document.createElement("a") - const description = document.createElement("em") + myPort.addEventListener('message', e => { + if (e.data.type == 'iframeHandshake') { + const message: Fdc3UserInterfaceRestyle = { + type: 'Fdc3UserInterfaceRestyle', + payload: { updatedCSS: DEFAULT_COLLAPSED_CSS }, + }; + myPort.postMessage(message); + } else if (e.data.type == 'iframeResolve') { + const message: Fdc3UserInterfaceRestyle = { + type: 'Fdc3UserInterfaceRestyle', + payload: { updatedCSS: DEFAULT_EXPANDED_CSS }, + }; + myPort.postMessage(message); + Array.from(list.children).forEach(i => i.remove()); + const details: Fdc3UserInterfaceResolve['payload'] = e.data.payload; + details.appIntents.forEach(intent => { + intent.apps.forEach(app => { + const li = document.createElement('li'); + const a = document.createElement('a'); + const description = document.createElement('em'); - if (app.instanceId) { - description.textContent = `${intent.intent.displayName ?? ""} on app instance ${app.instanceId} of ${app.appId}` - } else { - description.textContent = ` ${intent.intent.displayName ?? ""} on a new instance of ${app.appId}` - } + if (app.instanceId) { + description.textContent = `${intent.intent.displayName ?? ''} on app instance ${app.instanceId} of ${app.appId}`; + } else { + description.textContent = ` ${intent.intent.displayName ?? ''} on a new instance of ${app.appId}`; + } - a.textContent = intent.intent.name + a.textContent = intent.intent.name; - li.appendChild(a) - li.appendChild(description) - list.appendChild(li) - a.setAttribute("href", "#") - a.onclick = () => callback(intent.intent.name, app) - }) - }) - } - }) - - document.getElementById("cancel")!!.addEventListener("click", () => { - callback(null, null); - }) + li.appendChild(a); + li.appendChild(description); + list.appendChild(li); + a.setAttribute('href', '#'); + a.onclick = () => callback(intent.intent.name, app); + }); + }); + } + }); -}) \ No newline at end of file + document.getElementById('cancel')!!.addEventListener('click', () => { + callback(null, null); + }); +}); diff --git a/toolbox/fdc3-for-web/demo/src/message-types.ts b/toolbox/fdc3-for-web/demo/src/message-types.ts index 00bea4137..d6d08f96a 100644 --- a/toolbox/fdc3-for-web/demo/src/message-types.ts +++ b/toolbox/fdc3-for-web/demo/src/message-types.ts @@ -1,6 +1,5 @@ - -export const DA_HELLO = 'da-hello' -export const APP_HELLO = 'app-hello' -export const APP_GOODBYE = 'app-goodbye' -export const FDC3_APP_EVENT = 'fdc3-app-event' -export const FDC3_DA_EVENT = 'fdc3-da-event' +export const DA_HELLO = 'da-hello'; +export const APP_HELLO = 'app-hello'; +export const APP_GOODBYE = 'app-goodbye'; +export const FDC3_APP_EVENT = 'fdc3-app-event'; +export const FDC3_DA_EVENT = 'fdc3-da-event'; diff --git a/toolbox/fdc3-for-web/demo/src/server/main.ts b/toolbox/fdc3-for-web/demo/src/server/main.ts index 14250a3ef..ddaa420f9 100644 --- a/toolbox/fdc3-for-web/demo/src/server/main.ts +++ b/toolbox/fdc3-for-web/demo/src/server/main.ts @@ -1,105 +1,106 @@ -import express from "express"; -import ViteExpress from "vite-express"; -import { Server, Socket } from "socket.io" -import { APP_GOODBYE, APP_HELLO, DA_HELLO, FDC3_APP_EVENT, FDC3_DA_EVENT } from "../message-types"; +import express from 'express'; +import ViteExpress from 'vite-express'; +import { Server, Socket } from 'socket.io'; +import { APP_GOODBYE, APP_HELLO, DA_HELLO, FDC3_APP_EVENT, FDC3_DA_EVENT } from '../message-types'; const app = express(); -app.get("/iframe", (_, res) => { - res.send("Hello Vite + TypeScript!"); +app.get('/iframe', (_, res) => { + res.send('Hello Vite + TypeScript!'); }); - const httpServer = ViteExpress.listen(app, 4000, () => - console.log("Server is listening on port 4000. Head to http://localhost:4000/static/da/index.html"), + console.log('Server is listening on port 4000. Head to http://localhost:4000/static/da/index.html') ); -const io = new Server(httpServer) +const io = new Server(httpServer); type ConnectedWorld = { - server: Socket, - apps: Map -} + server: Socket; + apps: Map; +}; -enum ConnectionType { APP, DA } +enum ConnectionType { + APP, + DA, +} -const instances: Map = new Map() +const instances: Map = new Map(); io.on('connection', (socket: Socket) => { - - var myInstance: ConnectedWorld | undefined - var myId: string | undefined - var connectionType: ConnectionType | undefined + var myInstance: ConnectedWorld | undefined; + var myId: string | undefined; + var connectionType: ConnectionType | undefined; socket.on(DA_HELLO, function (id) { - myId = id + myId = id; const instance: ConnectedWorld = instances.get(id) ?? { server: socket, - apps: new Map() - } + apps: new Map(), + }; - instance.server = socket - instances.set(id, instance) - connectionType = ConnectionType.DA - console.log("instances " + instances.size) - myInstance = instance - console.log("A da connected: " + id) - }) + instance.server = socket; + instances.set(id, instance); + connectionType = ConnectionType.DA; + console.log('instances ' + instances.size); + myInstance = instance; + console.log('A da connected: ' + id); + }); socket.on(APP_HELLO, function (id: string, appId: string) { - const instance = instances.get(id) + const instance = instances.get(id); if (instance != undefined) { - console.log(`An app connected to DA ${id} with id ${appId}`) - instance.apps.set(appId, socket) - myInstance = instance - connectionType = ConnectionType.APP - myId = appId + console.log(`An app connected to DA ${id} with id ${appId}`); + instance.apps.set(appId, socket); + myInstance = instance; + connectionType = ConnectionType.APP; + myId = appId; } else { - console.log("App Tried Connecting to non-existent DA Instance " + id + " " + myId) + console.log('App Tried Connecting to non-existent DA Instance ' + id + ' ' + myId); } - }) + }); socket.on(FDC3_APP_EVENT, function (data, from): void { // message from app to da - console.log(`APP Sent ${JSON.stringify(data, null, 2)}`) + console.log(`APP Sent ${JSON.stringify(data, null, 2)}`); - if ((myInstance == null) && (data.type == 'intentResolutionChoice')) { + if (myInstance == null && data.type == 'intentResolutionChoice') { // message from app's intent resolver - myInstance = Array.from(instances.values()).find(cw => cw.apps.get(from)) + myInstance = Array.from(instances.values()).find(cw => cw.apps.get(from)); } - if ((myInstance == null) && (data.type == 'channelSelectionChoice')) { + if (myInstance == null && data.type == 'channelSelectionChoice') { // message from app's channelSelector - myInstance = Array.from(instances.values()).find(cw => cw.apps.get(from)) + myInstance = Array.from(instances.values()).find(cw => cw.apps.get(from)); } if (myInstance != undefined) { - myInstance!!.server.emit(FDC3_APP_EVENT, data, from) + myInstance!!.server.emit(FDC3_APP_EVENT, data, from); } - }) + }); socket.on(FDC3_DA_EVENT, function (data, to): void { // send message to app - const destSocket = myInstance?.apps.get(to) + const destSocket = myInstance?.apps.get(to); if (destSocket) { - console.log(`DA Sent ${JSON.stringify(data, null, 2)} to ${to}`) - destSocket.emit(FDC3_DA_EVENT, data, to) + console.log(`DA Sent ${JSON.stringify(data, null, 2)} to ${to}`); + destSocket.emit(FDC3_DA_EVENT, data, to); } else { - console.log("Failed to send message to app " + to) + console.log('Failed to send message to app ' + to); } - }) + }); - socket.on("disconnect", function (): void { + socket.on('disconnect', function (): void { if (myInstance) { if (connectionType == ConnectionType.DA) { - console.log("DA disconnected: " + myId) - instances.delete(myId!!) + console.log('DA disconnected: ' + myId); + instances.delete(myId!!); } else { - myInstance.apps.delete(myId!!) - console.log(`App Disconnected: ${myId} ( ${myInstance.apps.size} remaining )`) - myInstance.server.emit(APP_GOODBYE, myId!!) + myInstance.apps.delete(myId!!); + console.log(`App Disconnected: ${myId} ( ${myInstance.apps.size} remaining )`); + myInstance.server.emit(APP_GOODBYE, myId!!); } } - }) -}) + }); +}); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts index d038a0653..35a9f38eb 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/BasicFDC3Server.ts @@ -1,60 +1,64 @@ -import { FDC3Server } from "./FDC3Server"; -import { AppRegistration, InstanceID, ServerContext } from "./ServerContext"; -import { BroadcastHandler, ChannelState } from "./handlers/BroadcastHandler"; -import { IntentHandler } from "./handlers/IntentHandler"; -import { Directory } from "./directory/DirectoryInterface"; -import { OpenHandler } from "./handlers/OpenHandler"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { HeartbeatHandler } from "./handlers/HeartbeatHandler"; - -type AppRequestMessage = BrowserTypes.AppRequestMessage -type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity +import { FDC3Server } from './FDC3Server'; +import { AppRegistration, InstanceID, ServerContext } from './ServerContext'; +import { BroadcastHandler, ChannelState } from './handlers/BroadcastHandler'; +import { IntentHandler } from './handlers/IntentHandler'; +import { Directory } from './directory/DirectoryInterface'; +import { OpenHandler } from './handlers/OpenHandler'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { HeartbeatHandler } from './handlers/HeartbeatHandler'; -export interface MessageHandler { +type AppRequestMessage = BrowserTypes.AppRequestMessage; +type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity; - /** - * Handles an AgentRequestMessage from the messaging source - */ - accept(msg: any, sc: ServerContext, from: InstanceID): void +export interface MessageHandler { + /** + * Handles an AgentRequestMessage from the messaging source + */ + accept(msg: any, sc: ServerContext, from: InstanceID): void; - shutdown(): void + shutdown(): void; } /** * This defers all functionality to either MessageHandler's or the ServerContext objects. */ export class BasicFDC3Server implements FDC3Server { + readonly handlers: MessageHandler[]; + private sc: ServerContext; - readonly handlers: MessageHandler[] - private sc: ServerContext + constructor(handlers: MessageHandler[], sc: ServerContext) { + this.handlers = handlers; + this.sc = sc; + } - constructor(handlers: MessageHandler[], sc: ServerContext) { - this.handlers = handlers - this.sc = sc; - } - - receive(message: AppRequestMessage | WebConnectionProtocol4ValidateAppIdentity, from: InstanceID): void { - this.handlers.forEach(h => h.accept(message, this.sc, from)) - } + receive(message: AppRequestMessage | WebConnectionProtocol4ValidateAppIdentity, from: InstanceID): void { + this.handlers.forEach(h => h.accept(message, this.sc, from)); + } - shutdown(): void { - this.handlers.forEach(h => h.shutdown()) - } + shutdown(): void { + this.handlers.forEach(h => h.shutdown()); + } } export class DefaultFDC3Server extends BasicFDC3Server { + constructor( + sc: ServerContext, + directory: Directory, + userChannels: ChannelState[], + heartbeats: boolean, + intentTimeoutMs: number = 20000, + openHandlerTimeoutMs: number = 10000 + ) { + const handlers: MessageHandler[] = [ + new BroadcastHandler(userChannels), + new IntentHandler(directory, intentTimeoutMs), + new OpenHandler(directory, openHandlerTimeoutMs), + ]; - constructor(sc: ServerContext, directory: Directory, userChannels: ChannelState[], heartbeats: boolean, intentTimeoutMs: number = 20000, openHandlerTimeoutMs: number = 10000) { - const handlers: MessageHandler[] = [ - new BroadcastHandler(userChannels), - new IntentHandler(directory, intentTimeoutMs), - new OpenHandler(directory, openHandlerTimeoutMs), - ] - - if (heartbeats) { - handlers.push(new HeartbeatHandler(openHandlerTimeoutMs / 10, openHandlerTimeoutMs / 2, openHandlerTimeoutMs)) - } - - super(handlers, sc) + if (heartbeats) { + handlers.push(new HeartbeatHandler(openHandlerTimeoutMs / 10, openHandlerTimeoutMs / 2, openHandlerTimeoutMs)); } -} \ No newline at end of file + + super(handlers, sc); + } +} diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts index fea90855c..6f33364f2 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/FDC3Server.ts @@ -1,13 +1,11 @@ -import { InstanceID } from "./ServerContext"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { InstanceID } from './ServerContext'; +import { BrowserTypes } from '@kite9/fdc3-schema'; -type AppRequestMessage = BrowserTypes.AppRequestMessage +type AppRequestMessage = BrowserTypes.AppRequestMessage; export interface FDC3Server { - /** * Receive an incoming message */ - receive(message: AppRequestMessage, from: InstanceID): void - -} \ No newline at end of file + receive(message: AppRequestMessage, from: InstanceID): void; +} diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts index 3b9ac236e..8ea698ac8 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/ServerContext.ts @@ -1,110 +1,109 @@ -import { AppIdentifier, AppIntent } from "@kite9/fdc3-standard"; -import { Context } from "@kite9/fdc3-context"; +import { AppIdentifier, AppIntent } from '@kite9/fdc3-standard'; +import { Context } from '@kite9/fdc3-context'; export enum State { - Pending, /* App has started, but not completed FDC3 Handshake */ - Connected, /* App has completed FDC3 handshake */ - NotResponding, /* App has not responded to a heartbeat */ - Terminated /* App has sent a termination message */ + Pending /* App has started, but not completed FDC3 Handshake */, + Connected /* App has completed FDC3 handshake */, + NotResponding /* App has not responded to a heartbeat */, + Terminated /* App has sent a termination message */, } export type AppRegistration = { - state: State, - appId: string; - instanceId: InstanceID -} + state: State; + appId: string; + instanceId: InstanceID; +}; /** * This is a unique, long, unguessable string that identifies a particular instance of an app. * All messages arriving at the desktop agent will have this UUID attached to them. - * It is important that this is unguessable as it is a "password" of sorts used to + * It is important that this is unguessable as it is a "password" of sorts used to * identify the app between reconnections. */ -export type InstanceID = string +export type InstanceID = string; /** * Handles messaging to apps and opening apps */ export interface ServerContext { - - /** - * UUID for outgoing message - */ - createUUID(): string; - - /** - * Post an outgoing message to a particular app - */ - post(message: object, instanceId: InstanceID): Promise - - /** - * Post an outgoing message to a particular app - */ - post(message: object, instanceId: InstanceID): Promise - - /** - * Opens a new instance of an application. - * Promise completes once the application window is opened - */ - open(appId: string): Promise - - /** - * Registers a particular instance id with a given app id - */ - setInstanceDetails(uuid: InstanceID, details: X): void - - /** - * Returns the UUID for a particular instance of an app. - * This is used in situations where an app is reconnecting to the same desktop agent. - */ - getInstanceDetails(uuid: InstanceID): X | undefined - - /** - * Registers an app as connected to the desktop agent. - */ - setAppState(app: InstanceID, state: State): Promise - - /** - * Returns the list of apps open and connected to FDC3 at the current time. - * Note, it is the implementor's job to ensure this list is - * up-to-date in the event of app crashes or disconnections. - */ - getConnectedApps(): Promise - - /** - * Return the list of all apps that have ever been registed with the ServerContext. - */ - getAllApps(): Promise - - /** - * Helper function for determining if an app is currently open and connected to the da - */ - isAppConnected(app: InstanceID): Promise - - /** - * Allows you to write a log message somewhere - */ - log(message: string): void - - /** - * Name of the provider of this desktop agent server - */ - provider(): string - - /** - * Version of the provider of this desktop agent server - */ - providerVersion(): string - - /** - * Supported version of the FDC3 API of the desktop agent server. - */ - fdc3Version(): string - - /** - * This is called prior to returning intents to the client. It is a - * an opportunity for the server to either present an intent resolver - * or otherwise mess with the availble intents, or do nothing. - */ - narrowIntents(raiser: AppIdentifier, IappIntents: AppIntent[], context: Context): Promise + /** + * UUID for outgoing message + */ + createUUID(): string; + + /** + * Post an outgoing message to a particular app + */ + post(message: object, instanceId: InstanceID): Promise; + + /** + * Post an outgoing message to a particular app + */ + post(message: object, instanceId: InstanceID): Promise; + + /** + * Opens a new instance of an application. + * Promise completes once the application window is opened + */ + open(appId: string): Promise; + + /** + * Registers a particular instance id with a given app id + */ + setInstanceDetails(uuid: InstanceID, details: X): void; + + /** + * Returns the UUID for a particular instance of an app. + * This is used in situations where an app is reconnecting to the same desktop agent. + */ + getInstanceDetails(uuid: InstanceID): X | undefined; + + /** + * Registers an app as connected to the desktop agent. + */ + setAppState(app: InstanceID, state: State): Promise; + + /** + * Returns the list of apps open and connected to FDC3 at the current time. + * Note, it is the implementor's job to ensure this list is + * up-to-date in the event of app crashes or disconnections. + */ + getConnectedApps(): Promise; + + /** + * Return the list of all apps that have ever been registed with the ServerContext. + */ + getAllApps(): Promise; + + /** + * Helper function for determining if an app is currently open and connected to the da + */ + isAppConnected(app: InstanceID): Promise; + + /** + * Allows you to write a log message somewhere + */ + log(message: string): void; + + /** + * Name of the provider of this desktop agent server + */ + provider(): string; + + /** + * Version of the provider of this desktop agent server + */ + providerVersion(): string; + + /** + * Supported version of the FDC3 API of the desktop agent server. + */ + fdc3Version(): string; + + /** + * This is called prior to returning intents to the client. It is a + * an opportunity for the server to either present an intent resolver + * or otherwise mess with the availble intents, or do nothing. + */ + narrowIntents(raiser: AppIdentifier, IappIntents: AppIntent[], context: Context): Promise; } diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts index 044921682..df7efaedc 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/BasicDirectory.ts @@ -1,78 +1,88 @@ -import { Directory, DirectoryApp, DirectoryIntent } from "./DirectoryInterface" +import { Directory, DirectoryApp, DirectoryIntent } from './DirectoryInterface'; export function genericResultTypeSame(real: string | undefined, required: string | undefined) { - if (required == undefined) { - return true - } else if (real == required) { - return true - } else if (real == undefined) { - return false // required is not undefined, so asking for something - } else if (real.startsWith("channel<") && required == "channel") { - return true - } else { - return false - } + if (required == undefined) { + return true; + } else if (real == required) { + return true; + } else if (real == undefined) { + return false; // required is not undefined, so asking for something + } else if (real.startsWith('channel<') && required == 'channel') { + return true; + } else { + return false; + } } /** * Basic directory implementation that allows queries over a set of apps. */ export class BasicDirectory implements Directory { + allApps: DirectoryApp[]; - allApps: DirectoryApp[] + constructor(apps: DirectoryApp[]) { + this.allApps = apps; + } - constructor(apps: DirectoryApp[]) { - this.allApps = apps - } + private intentMatches( + i: DirectoryIntent, + contextType: string | undefined, + intentName: string | undefined, + resultType: string | undefined + ): boolean { + const out = + (intentName == undefined || i.intentName == intentName) && + (contextType == undefined || (i.contexts ?? []).includes(contextType)) && + genericResultTypeSame(i.resultType, resultType); + return out; + } - private intentMatches(i: DirectoryIntent, contextType: string | undefined, intentName: string | undefined, resultType: string | undefined): boolean { - const out = ((intentName == undefined) || (i.intentName == intentName)) && - ((contextType == undefined) || ((i.contexts ?? []).includes(contextType))) && - (genericResultTypeSame(i.resultType, resultType)) - return out - } + private retrieveIntentsForApp(a: DirectoryApp): DirectoryIntent[] { + const lf = a.interop?.intents?.listensFor ?? {}; + const lfa = Object.entries(lf); + const lfAugmented = lfa.map(([key, value]) => { + return { + intentName: key, + ...(value as any), + appId: a.appId, + }; + }); + return lfAugmented as DirectoryIntent[]; + } - private retrieveIntentsForApp(a: DirectoryApp): DirectoryIntent[] { - const lf = a.interop?.intents?.listensFor ?? {} - const lfa = Object.entries(lf) - const lfAugmented = lfa.map(([key, value]) => { - return { - intentName: key, - ...(value as any), - appId: a.appId - } - }) - return lfAugmented as DirectoryIntent[] - } + retrieveAllIntents(): DirectoryIntent[] { + const allIntents = this.retrieveAllApps().flatMap(a => this.retrieveIntentsForApp(a)); - retrieveAllIntents(): DirectoryIntent[] { - const allIntents = this.retrieveAllApps() - .flatMap(a => this.retrieveIntentsForApp(a)) + return allIntents; + } - return allIntents - } + retrieveIntents( + contextType: string | undefined, + intentName: string | undefined, + resultType: string | undefined + ): DirectoryIntent[] { + const matchingIntents = this.retrieveAllIntents().filter(i => + this.intentMatches(i, contextType, intentName, resultType) + ); + return matchingIntents; + } - retrieveIntents(contextType: string | undefined, intentName: string | undefined, resultType: string | undefined): DirectoryIntent[] { - const matchingIntents = this.retrieveAllIntents() - .filter(i => this.intentMatches(i, contextType, intentName, resultType)) - return matchingIntents - } + retrieveApps( + contextType: string | undefined, + intentName: string | undefined, + resultType: string | undefined + ): DirectoryApp[] { + return this.retrieveAllApps().filter( + a => + this.retrieveIntentsForApp(a).filter(i => this.intentMatches(i, contextType, intentName, resultType)).length > 0 + ); + } - retrieveApps(contextType: string | undefined, intentName: string | undefined, resultType: string | undefined): DirectoryApp[] { - return this.retrieveAllApps() - .filter(a => this.retrieveIntentsForApp(a) - .filter(i => this.intentMatches(i, contextType, intentName, resultType)) - .length > 0) - } + retrieveAppsById(appId: string): DirectoryApp[] { + return this.retrieveAllApps().filter(a => a.appId == appId); + } - - retrieveAppsById(appId: string): DirectoryApp[] { - return this.retrieveAllApps().filter(a => a.appId == appId) - } - - retrieveAllApps(): DirectoryApp[] { - return this.allApps - } + retrieveAllApps(): DirectoryApp[] { + return this.allApps; + } } - - diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts index ce9946ef4..93407f0b8 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/directory/DirectoryInterface.ts @@ -1,11 +1,10 @@ -import { components } from '../directory-schema' +import { components } from '../directory-schema'; -type schemas = components['schemas'] +type schemas = components['schemas']; -export type DirectoryIntent = schemas['Intent'] & { intentName: string, appId: string } +export type DirectoryIntent = schemas['Intent'] & { intentName: string; appId: string }; export type DirectoryApp = schemas['Application']; -export type WebAppDetails = schemas['WebAppDetails'] - +export type WebAppDetails = schemas['WebAppDetails']; /** * This interface wraps the functionality of the FDC3 Directory structure (stored in JSON), @@ -13,16 +12,21 @@ export type WebAppDetails = schemas['WebAppDetails'] */ export interface Directory { + retrieveAllApps(): DirectoryApp[]; - retrieveAllApps(): DirectoryApp[] - - retrieveApps(contextType: string | undefined, intentName: string | undefined, resultType: string | undefined): DirectoryApp[] - - retrieveAllIntents(): DirectoryIntent[] - - retrieveIntents(contextType: string | undefined, intentName: string | undefined, resultType: string | undefined): DirectoryIntent[] + retrieveApps( + contextType: string | undefined, + intentName: string | undefined, + resultType: string | undefined + ): DirectoryApp[]; - retrieveAppsById(appId: string): DirectoryApp[] + retrieveAllIntents(): DirectoryIntent[]; + retrieveIntents( + contextType: string | undefined, + intentName: string | undefined, + resultType: string | undefined + ): DirectoryIntent[]; + retrieveAppsById(appId: string): DirectoryApp[]; } 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 686db2411..1b8962704 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 @@ -1,380 +1,472 @@ -import { MessageHandler } from "../BasicFDC3Server"; -import { InstanceID, ServerContext } from "../ServerContext"; -import { Context } from "@kite9/fdc3-context"; -import { AppIdentifier, ChannelError, DisplayMetadata } from "@kite9/fdc3-standard"; -import { successResponse, errorResponse, onlyUnique } from "./support"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type PrivateChannelEventListenerTypes = BrowserTypes.PrivateChannelEventListenerTypes -type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest -type BroadcastRequest = BrowserTypes.BroadcastRequest -type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest -type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest -type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest -type PrivateChannelAddEventListenerRequest = BrowserTypes.PrivateChannelAddEventListenerRequest -type PrivateChannelUnsubscribeEventListenerRequest = BrowserTypes.PrivateChannelUnsubscribeEventListenerRequest -type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest -type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest -type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest -type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest -type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest -type AgentEventMessage = BrowserTypes.AgentEventMessage -type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest +import { MessageHandler } from '../BasicFDC3Server'; +import { InstanceID, ServerContext } from '../ServerContext'; +import { Context } from '@kite9/fdc3-context'; +import { AppIdentifier, ChannelError, DisplayMetadata } from '@kite9/fdc3-standard'; +import { successResponse, errorResponse, onlyUnique } from './support'; +import { BrowserTypes } from '@kite9/fdc3-schema'; + +type PrivateChannelEventListenerTypes = BrowserTypes.PrivateChannelEventListenerTypes; +type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest; +type BroadcastRequest = BrowserTypes.BroadcastRequest; +type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest; +type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest; +type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest; +type PrivateChannelAddEventListenerRequest = BrowserTypes.PrivateChannelAddEventListenerRequest; +type PrivateChannelUnsubscribeEventListenerRequest = BrowserTypes.PrivateChannelUnsubscribeEventListenerRequest; +type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest; +type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest; +type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest; +type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest; +type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest; +type AgentEventMessage = BrowserTypes.AgentEventMessage; +type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest; type ContextListenerRegistration = { - appId: string, - instanceId: string, - listenerUuid: string, - channelId: string | null, - contextType: string | null - userChannelListener: boolean -} - -type NotificationAgentEventMessage = 'privateChannelOnAddContextListenerEvent' | 'privateChannelOnDisconnectEvent' | 'privateChannelOnUnsubscribeEvent' + appId: string; + instanceId: string; + listenerUuid: string; + channelId: string | null; + contextType: string | null; + userChannelListener: boolean; +}; + +type NotificationAgentEventMessage = + | 'privateChannelOnAddContextListenerEvent' + | 'privateChannelOnDisconnectEvent' + | 'privateChannelOnUnsubscribeEvent'; type PrivateChannelEventListener = { - appId: string, - instanceId: string, - channelId: string, - eventType: PrivateChannelEventListenerTypes, - listenerUuid: string + appId: string; + instanceId: string; + channelId: string; + eventType: PrivateChannelEventListenerTypes; + listenerUuid: string; +}; + +export enum ChannelType { + 'user', + 'app', + 'private', } -export enum ChannelType { 'user', 'app', 'private' } - export type ChannelState = { - id: string, - type: ChannelType, - context: Context[], - displayMetadata: DisplayMetadata -} + id: string; + type: ChannelType; + context: Context[]; + displayMetadata: DisplayMetadata; +}; export class BroadcastHandler implements MessageHandler { + private contextListeners: ContextListenerRegistration[] = []; + private readonly eventListeners: PrivateChannelEventListener[] = []; + private readonly state: ChannelState[] = []; + private readonly currentChannel: { [instanceId: string]: ChannelState } = {}; - private contextListeners: ContextListenerRegistration[] = [] - private readonly eventListeners: PrivateChannelEventListener[] = [] - private readonly state: ChannelState[] = [] - private readonly currentChannel: { [instanceId: string]: ChannelState } = {} + constructor(initialChannelState: ChannelState[]) { + this.state = initialChannelState; + } - constructor(initialChannelState: ChannelState[]) { - this.state = initialChannelState - } + shutdown(): void {} - shutdown(): void { + getCurrentChannel(from: AppIdentifier): ChannelState | null { + // instanceId is optional + if (!from.instanceId) { + return null; } + return this.currentChannel[from.instanceId]; + } - getCurrentChannel(from: AppIdentifier): ChannelState | null { - // instanceId is optional - if (!from.instanceId) { - return null - } - return this.currentChannel[from.instanceId] + getChannelById(id: string | null): ChannelState | null { + if (id == null) { + return null; } - - getChannelById(id: string | null): ChannelState | null { - if (id == null) { - return null - } - return this.state.find(c => c.id == id) ?? null - } - - convertChannelTypeToString(type: ChannelType): string { - switch (type) { - case ChannelType.app: return 'app' - case ChannelType.user: return 'user' - case ChannelType.private: return 'private' - } - } - - getListeners(appId: AppIdentifier) { - return this.contextListeners.filter(r => r.instanceId == appId.instanceId) - } - - moveUserChannelListeners(app: AppIdentifier, channelId: string | null) { - this.getListeners(app) - .filter(l => l.userChannelListener) - .forEach(l => { - l.channelId = channelId - }) - } - - updateChannelState(channelId: string, context: Context) { - const cs = this.getChannelById(channelId) - if (cs) { - cs.context = cs.context.filter(c => c.type != context.type) - cs.context.unshift(context) - } - } - - accept(msg: any, sc: ServerContext, uuid: InstanceID) { - const from = sc.getInstanceDetails(uuid) - - if (from == null) { - // this handler only deals with connected apps - return - } - - try { - - switch (msg.type as string | null) { - // app channels registration - case 'getOrCreateChannelRequest': return this.handleGetOrCreateRequest(msg as GetOrCreateChannelRequest, sc, from) - - // user channel management - case 'getUserChannelsRequest': return this.handleGetUserChannelsRequest(msg as GetUserChannelsRequest, sc, from) - case 'leaveCurrentChannelRequest': return this.handleLeaveCurrentChannelRequest(msg as LeaveCurrentChannelRequest, sc, from) - case 'joinUserChannelRequest': return this.handleJoinUserChannelRequest(msg as JoinUserChannelRequest, sc, from) - case 'getCurrentChannelRequest': return this.handleGetCurrentChannelRequest(msg as GetCurrentChannelRequest, sc, from) - - // general broadcast - case 'broadcastRequest': return this.handleBroadcastRequest(msg as BroadcastRequest, sc, from) - - // context listeners - case 'addContextListenerRequest': return this.handleAddContextListenerRequest(msg as AddContextListenerRequest, sc, from) - case 'contextListenerUnsubscribeRequest': return this.handleContextListenerUnsubscribeRequest(msg as ContextListenerUnsubscribeRequest, sc, from) - - // private channels create/disconnect - case 'createPrivateChannelRequest': return this.handleCreatePrivateChannelRequest(msg as CreatePrivateChannelRequest, sc, from) - case 'privateChannelDisconnectRequest': return this.handlePrivateChannelDisconnectRequest(msg as PrivateChannelDisconnectRequest, sc, from) - - // private channel event listeners - case 'privateChannelAddEventListenerRequest': return this.handlePrivateChannelAddEventListenerRequest(msg as PrivateChannelAddEventListenerRequest, from, sc) - case 'privateChannelUnsubscribeEventListenerRequest': return this.handlePrivateChannelUnsubscribeEventListenerRequest(msg as PrivateChannelUnsubscribeEventListenerRequest, sc, from) - - // handling state synchronisation of channels - case 'getCurrentContextRequest': return this.handleGetCurrentContextRequest(msg as GetCurrentContextRequest, sc, from) - } - } catch (e: any) { - const responseType = msg.type.replace(new RegExp("Request$"), 'Response') - errorResponse(sc, msg, from, e.message ?? e, responseType) - } + return this.state.find(c => c.id == id) ?? null; + } + + convertChannelTypeToString(type: ChannelType): string { + switch (type) { + case ChannelType.app: + return 'app'; + case ChannelType.user: + return 'user'; + case ChannelType.private: + return 'private'; } - - handleCreatePrivateChannelRequest(arg0: CreatePrivateChannelRequest, sc: ServerContext, from: AppIdentifier) { - const id = sc.createUUID() - this.state.push({ - id, - type: ChannelType.private, - context: [], - displayMetadata: { - } - }) - - successResponse(sc, arg0, from, { privateChannel: { id, type: this.convertChannelTypeToString(ChannelType.private) } }, 'createPrivateChannelResponse') + } + + getListeners(appId: AppIdentifier) { + return this.contextListeners.filter(r => r.instanceId == appId.instanceId); + } + + moveUserChannelListeners(app: AppIdentifier, channelId: string | null) { + this.getListeners(app) + .filter(l => l.userChannelListener) + .forEach(l => { + l.channelId = channelId; + }); + } + + updateChannelState(channelId: string, context: Context) { + const cs = this.getChannelById(channelId); + if (cs) { + cs.context = cs.context.filter(c => c.type != context.type); + cs.context.unshift(context); } + } - handleGetCurrentContextRequest(arg0: GetCurrentContextRequest, sc: ServerContext, from: AppIdentifier) { - const channel = this.getChannelById(arg0.payload.channelId) - const type = arg0.payload.contextType + accept(msg: any, sc: ServerContext, uuid: InstanceID) { + const from = sc.getInstanceDetails(uuid); - if (channel) { - 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') - } + if (from == null) { + // this handler only deals with connected apps + return; } - handlePrivateChannelUnsubscribeEventListenerRequest(arg0: PrivateChannelUnsubscribeEventListenerRequest, sc: ServerContext, from: AppIdentifier) { - const i = this.eventListeners.findIndex(r => r.listenerUuid == arg0.payload.listenerUUID) - if (i > -1) { - this.eventListeners.splice(i, 1) - successResponse(sc, arg0, from, {}, 'privateChannelUnsubscribeEventListenerResponse') - } else { - errorResponse(sc, arg0, from, "ListenerNotFound", 'privateChannelUnsubscribeEventListenerResponse') - } + try { + switch (msg.type as string | null) { + // app channels registration + case 'getOrCreateChannelRequest': + return this.handleGetOrCreateRequest(msg as GetOrCreateChannelRequest, sc, from); + + // user channel management + case 'getUserChannelsRequest': + return this.handleGetUserChannelsRequest(msg as GetUserChannelsRequest, sc, from); + case 'leaveCurrentChannelRequest': + return this.handleLeaveCurrentChannelRequest(msg as LeaveCurrentChannelRequest, sc, from); + case 'joinUserChannelRequest': + return this.handleJoinUserChannelRequest(msg as JoinUserChannelRequest, sc, from); + case 'getCurrentChannelRequest': + return this.handleGetCurrentChannelRequest(msg as GetCurrentChannelRequest, sc, from); + + // general broadcast + case 'broadcastRequest': + return this.handleBroadcastRequest(msg as BroadcastRequest, sc, from); + + // context listeners + case 'addContextListenerRequest': + return this.handleAddContextListenerRequest(msg as AddContextListenerRequest, sc, from); + case 'contextListenerUnsubscribeRequest': + return this.handleContextListenerUnsubscribeRequest(msg as ContextListenerUnsubscribeRequest, sc, from); + + // private channels create/disconnect + case 'createPrivateChannelRequest': + return this.handleCreatePrivateChannelRequest(msg as CreatePrivateChannelRequest, sc, from); + case 'privateChannelDisconnectRequest': + return this.handlePrivateChannelDisconnectRequest(msg as PrivateChannelDisconnectRequest, sc, from); + + // private channel event listeners + case 'privateChannelAddEventListenerRequest': + return this.handlePrivateChannelAddEventListenerRequest( + msg as PrivateChannelAddEventListenerRequest, + from, + sc + ); + case 'privateChannelUnsubscribeEventListenerRequest': + return this.handlePrivateChannelUnsubscribeEventListenerRequest( + msg as PrivateChannelUnsubscribeEventListenerRequest, + sc, + from + ); + + // handling state synchronisation of channels + case 'getCurrentContextRequest': + return this.handleGetCurrentContextRequest(msg as GetCurrentContextRequest, sc, from); + } + } catch (e: any) { + const responseType = msg.type.replace(new RegExp('Request$'), 'Response'); + errorResponse(sc, msg, from, e.message ?? e, responseType); } - - handlePrivateChannelDisconnectRequest(arg0: PrivateChannelDisconnectRequest, sc: ServerContext, from: AppIdentifier) { - const toUnsubscribe = this.contextListeners - .filter(r => (r.appId == from.appId) && (r.instanceId == from.instanceId)) - .filter(r => r.channelId == arg0.payload.channelId) - - toUnsubscribe.forEach(u => { - this.invokeEventListeners(arg0.payload.channelId, "onUnsubscribe", 'privateChannelOnUnsubscribeEvent', sc, u.contextType ?? undefined) - }) - - this.contextListeners = this.contextListeners.filter(r => !toUnsubscribe.includes(r)) - this.invokeEventListeners(arg0.payload.channelId, "onDisconnect", 'privateChannelOnDisconnectEvent', sc) - successResponse(sc, arg0, from, {}, 'privateChannelDisconnectResponse') + } + + handleCreatePrivateChannelRequest(arg0: CreatePrivateChannelRequest, sc: ServerContext, from: AppIdentifier) { + const id = sc.createUUID(); + this.state.push({ + id, + type: ChannelType.private, + context: [], + displayMetadata: {}, + }); + + successResponse( + sc, + arg0, + from, + { privateChannel: { id, type: this.convertChannelTypeToString(ChannelType.private) } }, + 'createPrivateChannelResponse' + ); + } + + handleGetCurrentContextRequest(arg0: GetCurrentContextRequest, sc: ServerContext, from: AppIdentifier) { + const channel = this.getChannelById(arg0.payload.channelId); + const type = arg0.payload.contextType; + + if (channel) { + 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'); } - - handleContextListenerUnsubscribeRequest(arg0: ContextListenerUnsubscribeRequest, sc: ServerContext, from: AppIdentifier) { - const i = this.contextListeners - .findIndex(r => (r.listenerUuid == arg0.payload.listenerUUID) && (r.instanceId == from.instanceId)) - - if (i > -1) { - const rl = this.contextListeners[i] - const channel = this.getChannelById(rl.channelId) - this.invokeEventListeners(channel?.id ?? null, "onUnsubscribe", 'privateChannelOnUnsubscribeEvent', sc, rl.contextType ?? undefined) - this.contextListeners.splice(i, 1) - successResponse(sc, arg0, from, {}, 'contextListenerUnsubscribeResponse') - } else { - errorResponse(sc, arg0, from, "ListenerNotFound", 'contextListenerUnsubscribeResponse') - } + } + + handlePrivateChannelUnsubscribeEventListenerRequest( + arg0: PrivateChannelUnsubscribeEventListenerRequest, + sc: ServerContext, + from: AppIdentifier + ) { + const i = this.eventListeners.findIndex(r => r.listenerUuid == arg0.payload.listenerUUID); + if (i > -1) { + this.eventListeners.splice(i, 1); + successResponse(sc, arg0, from, {}, 'privateChannelUnsubscribeEventListenerResponse'); + } else { + errorResponse(sc, arg0, from, 'ListenerNotFound', 'privateChannelUnsubscribeEventListenerResponse'); } - - handleAddContextListenerRequest(arg0: AddContextListenerRequest, sc: ServerContext, from: AppIdentifier) { - var channelId = null - var channelType = ChannelType.user - - if (arg0.payload?.channelId) { - const channel = this.getChannelById(arg0.payload?.channelId) - channelType = channel?.type ?? ChannelType.user - - if (channel == null) { - errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'addContextListenerResponse') - return - } else { - channelId = channel.id - } - } - - const lr: ContextListenerRegistration = { - appId: from.appId, - instanceId: from.instanceId ?? 'no-instance-id', - channelId: channelId, - listenerUuid: sc.createUUID(), - contextType: arg0.payload.contextType, - userChannelListener: channelType == ChannelType.user - } - - this.contextListeners.push(lr) - this.invokeEventListeners(channelId, "onAddContextListener", "privateChannelOnAddContextListenerEvent", sc, arg0.payload.contextType ?? undefined) - successResponse(sc, arg0, from, { listenerUUID: lr.listenerUuid }, 'addContextListenerResponse') - + } + + handlePrivateChannelDisconnectRequest( + arg0: PrivateChannelDisconnectRequest, + sc: ServerContext, + from: AppIdentifier + ) { + const toUnsubscribe = this.contextListeners + .filter(r => r.appId == from.appId && r.instanceId == from.instanceId) + .filter(r => r.channelId == arg0.payload.channelId); + + toUnsubscribe.forEach(u => { + this.invokeEventListeners( + arg0.payload.channelId, + 'onUnsubscribe', + 'privateChannelOnUnsubscribeEvent', + sc, + u.contextType ?? undefined + ); + }); + + this.contextListeners = this.contextListeners.filter(r => !toUnsubscribe.includes(r)); + this.invokeEventListeners(arg0.payload.channelId, 'onDisconnect', 'privateChannelOnDisconnectEvent', sc); + successResponse(sc, arg0, from, {}, 'privateChannelDisconnectResponse'); + } + + handleContextListenerUnsubscribeRequest( + arg0: ContextListenerUnsubscribeRequest, + sc: ServerContext, + from: AppIdentifier + ) { + const i = this.contextListeners.findIndex( + r => r.listenerUuid == arg0.payload.listenerUUID && r.instanceId == from.instanceId + ); + + if (i > -1) { + const rl = this.contextListeners[i]; + const channel = this.getChannelById(rl.channelId); + this.invokeEventListeners( + channel?.id ?? null, + 'onUnsubscribe', + 'privateChannelOnUnsubscribeEvent', + sc, + rl.contextType ?? undefined + ); + this.contextListeners.splice(i, 1); + successResponse(sc, arg0, from, {}, 'contextListenerUnsubscribeResponse'); + } else { + errorResponse(sc, arg0, from, 'ListenerNotFound', 'contextListenerUnsubscribeResponse'); } - - handleBroadcastRequest(arg0: BroadcastRequest, sc: ServerContext, from: AppIdentifier) { - const matchingListeners = this.contextListeners - .filter(r => r.channelId == arg0.payload.channelId) - .filter(r => r.contextType == null || r.contextType == arg0.payload.context.type) - - const matchingApps = matchingListeners - .map(r => { return { appId: r.appId, instanceId: r.instanceId } }) - .filter(onlyUnique) - - matchingApps.forEach(app => { - sc.post({ - meta: { - eventUuid: sc.createUUID(), - timestamp: new Date() - }, - type: 'broadcastEvent', - payload: { - channelId: arg0.payload.channelId, - context: arg0.payload.context - } - }, app.instanceId) - }) - - this.updateChannelState(arg0.payload.channelId, arg0.payload.context) - successResponse(sc, arg0, from, {}, 'broadcastResponse') + } + + handleAddContextListenerRequest(arg0: AddContextListenerRequest, sc: ServerContext, from: AppIdentifier) { + var channelId = null; + var channelType = ChannelType.user; + + if (arg0.payload?.channelId) { + const channel = this.getChannelById(arg0.payload?.channelId); + channelType = channel?.type ?? ChannelType.user; + + if (channel == null) { + errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'addContextListenerResponse'); + return; + } else { + channelId = channel.id; + } } - handleGetCurrentChannelRequest(arg0: GetCurrentChannelRequest, sc: ServerContext, from: AppIdentifier) { - const currentChannel = this.getCurrentChannel(from) - if (currentChannel) { - successResponse(sc, arg0, from, { - channel: { - id: currentChannel.id, - type: this.convertChannelTypeToString(currentChannel.type), - displayMetadata: currentChannel.displayMetadata - } - }, 'getCurrentChannelResponse') - } else { - successResponse(sc, arg0, from, { channel: null }, 'getCurrentChannelResponse') - } + const lr: ContextListenerRegistration = { + appId: from.appId, + instanceId: from.instanceId ?? 'no-instance-id', + channelId: channelId, + listenerUuid: sc.createUUID(), + contextType: arg0.payload.contextType, + userChannelListener: channelType == ChannelType.user, + }; + + this.contextListeners.push(lr); + this.invokeEventListeners( + channelId, + 'onAddContextListener', + 'privateChannelOnAddContextListenerEvent', + sc, + arg0.payload.contextType ?? undefined + ); + successResponse(sc, arg0, from, { listenerUUID: lr.listenerUuid }, 'addContextListenerResponse'); + } + + handleBroadcastRequest(arg0: BroadcastRequest, sc: ServerContext, from: AppIdentifier) { + const matchingListeners = this.contextListeners + .filter(r => r.channelId == arg0.payload.channelId) + .filter(r => r.contextType == null || r.contextType == arg0.payload.context.type); + + const matchingApps = matchingListeners + .map(r => { + return { appId: r.appId, instanceId: r.instanceId }; + }) + .filter(onlyUnique); + + matchingApps.forEach(app => { + sc.post( + { + meta: { + eventUuid: sc.createUUID(), + timestamp: new Date(), + }, + type: 'broadcastEvent', + payload: { + channelId: arg0.payload.channelId, + context: arg0.payload.context, + }, + }, + app.instanceId + ); + }); + + this.updateChannelState(arg0.payload.channelId, arg0.payload.context); + successResponse(sc, arg0, from, {}, 'broadcastResponse'); + } + + handleGetCurrentChannelRequest(arg0: GetCurrentChannelRequest, sc: ServerContext, from: AppIdentifier) { + const currentChannel = this.getCurrentChannel(from); + if (currentChannel) { + successResponse( + sc, + arg0, + from, + { + channel: { + id: currentChannel.id, + type: this.convertChannelTypeToString(currentChannel.type), + displayMetadata: currentChannel.displayMetadata, + }, + }, + 'getCurrentChannelResponse' + ); + } else { + successResponse(sc, arg0, from, { channel: null }, 'getCurrentChannelResponse'); } + } - handleJoinUserChannelRequest(arg0: JoinUserChannelRequest, sc: ServerContext, from: AppIdentifier) { - // check it's a user channel - const newChannel = this.getChannelById(arg0.payload.channelId) - if ((newChannel == null) || (newChannel.type != ChannelType.user)) { - return errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'joinUserChannelResponse') - } - - // join it. - const instanceId = from.instanceId ?? 'no-instance-id' - this.currentChannel[instanceId] = newChannel - this.moveUserChannelListeners(from, newChannel.id) - successResponse(sc, arg0, from, {}, 'joinUserChannelResponse') + handleJoinUserChannelRequest(arg0: JoinUserChannelRequest, sc: ServerContext, from: AppIdentifier) { + // check it's a user channel + const newChannel = this.getChannelById(arg0.payload.channelId); + if (newChannel == null || newChannel.type != ChannelType.user) { + return errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'joinUserChannelResponse'); } - handleLeaveCurrentChannelRequest(arg0: LeaveCurrentChannelRequest, sc: ServerContext, from: AppIdentifier) { - const instanceId = from.instanceId ?? 'no-instance-id' - const currentChannel = this.currentChannel[instanceId] - if (currentChannel) { - delete this.currentChannel[instanceId] - this.moveUserChannelListeners(from, null) - } - successResponse(sc, arg0, from, {}, 'leaveCurrentChannelResponse') + // join it. + const instanceId = from.instanceId ?? 'no-instance-id'; + this.currentChannel[instanceId] = newChannel; + this.moveUserChannelListeners(from, newChannel.id); + successResponse(sc, arg0, from, {}, 'joinUserChannelResponse'); + } + + handleLeaveCurrentChannelRequest(arg0: LeaveCurrentChannelRequest, sc: ServerContext, from: AppIdentifier) { + const instanceId = from.instanceId ?? 'no-instance-id'; + const currentChannel = this.currentChannel[instanceId]; + if (currentChannel) { + delete this.currentChannel[instanceId]; + this.moveUserChannelListeners(from, null); } - - handleGetOrCreateRequest(arg0: GetOrCreateChannelRequest, sc: ServerContext, from: AppIdentifier) { - const id = arg0.payload.channelId - var channel = this.getChannelById(id) - if (channel) { - if (channel.type != ChannelType.app) { - errorResponse(sc, arg0, from, ChannelError.AccessDenied, 'getOrCreateChannelResponse') - return - } - } - - channel = { - id: id, - type: ChannelType.app, - context: [], - displayMetadata: {} - } - this.state.push(channel) - successResponse(sc, arg0, from, { channel: { id: channel.id, type: channel.type, } }, 'getOrCreateChannelResponse') - } - - - handleGetUserChannelsRequest(arg0: GetUserChannelsRequest, sc: ServerContext, from: AppIdentifier) { - const userChannels = this.state.filter(c => c.type == ChannelType.user) - successResponse(sc, arg0, from, { userChannels: userChannels.map(c => ({ id: c.id, type: this.convertChannelTypeToString(c.type), displayMetadata: c.displayMetadata })) }, 'getUserChannelsResponse') + successResponse(sc, arg0, from, {}, 'leaveCurrentChannelResponse'); + } + + handleGetOrCreateRequest(arg0: GetOrCreateChannelRequest, sc: ServerContext, from: AppIdentifier) { + const id = arg0.payload.channelId; + var channel = this.getChannelById(id); + if (channel) { + if (channel.type != ChannelType.app) { + errorResponse(sc, arg0, from, ChannelError.AccessDenied, 'getOrCreateChannelResponse'); + return; + } } - handlePrivateChannelAddEventListenerRequest(arg0: PrivateChannelAddEventListenerRequest, from: AppIdentifier, sc: ServerContext) { - const channel = this.getChannelById(arg0.payload.privateChannelId) - - if ((channel == null) || (channel.type != ChannelType.private)) { - errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'privateChannelAddEventListenerResponse') - } else { - const el: PrivateChannelEventListener = { - appId: from.appId!!, - instanceId: from.instanceId!!, - channelId: arg0.payload.privateChannelId, - eventType: arg0.payload.listenerType, - listenerUuid: sc.createUUID(), - } - this.eventListeners.push(el) - successResponse(sc, arg0, from, { listenerUUID: el.listenerUuid }, 'privateChannelAddEventListenerResponse') - } + channel = { + id: id, + type: ChannelType.app, + context: [], + displayMetadata: {}, + }; + this.state.push(channel); + successResponse(sc, arg0, from, { channel: { id: channel.id, type: channel.type } }, 'getOrCreateChannelResponse'); + } + + handleGetUserChannelsRequest(arg0: GetUserChannelsRequest, sc: ServerContext, from: AppIdentifier) { + const userChannels = this.state.filter(c => c.type == ChannelType.user); + successResponse( + sc, + arg0, + from, + { + userChannels: userChannels.map(c => ({ + id: c.id, + type: this.convertChannelTypeToString(c.type), + displayMetadata: c.displayMetadata, + })), + }, + 'getUserChannelsResponse' + ); + } + + handlePrivateChannelAddEventListenerRequest( + arg0: PrivateChannelAddEventListenerRequest, + from: AppIdentifier, + sc: ServerContext + ) { + const channel = this.getChannelById(arg0.payload.privateChannelId); + + if (channel == null || channel.type != ChannelType.private) { + errorResponse(sc, arg0, from, ChannelError.NoChannelFound, 'privateChannelAddEventListenerResponse'); + } else { + const el: PrivateChannelEventListener = { + appId: from.appId!!, + instanceId: from.instanceId!!, + channelId: arg0.payload.privateChannelId, + eventType: arg0.payload.listenerType, + listenerUuid: sc.createUUID(), + }; + this.eventListeners.push(el); + successResponse(sc, arg0, from, { listenerUUID: el.listenerUuid }, 'privateChannelAddEventListenerResponse'); } + } - invokeEventListeners(privateChannelId: string | null, eventType: PrivateChannelEventListenerTypes, messageType: NotificationAgentEventMessage, sc: ServerContext, contextType?: string) { - if (privateChannelId) { - const msg = { - type: messageType, - meta: { - eventUuid: sc.createUUID(), - timestamp: new Date() - }, - payload: { - privateChannelId, - contextType: contextType - } - } as AgentEventMessage - - this.eventListeners - .filter(e => (e.channelId == privateChannelId) && (e.eventType == eventType)) - .forEach(e => sc.post(msg, e.instanceId)) - } + invokeEventListeners( + privateChannelId: string | null, + eventType: PrivateChannelEventListenerTypes, + messageType: NotificationAgentEventMessage, + sc: ServerContext, + contextType?: string + ) { + if (privateChannelId) { + const msg = { + type: messageType, + meta: { + eventUuid: sc.createUUID(), + timestamp: new Date(), + }, + payload: { + privateChannelId, + contextType: contextType, + }, + } as AgentEventMessage; + + this.eventListeners + .filter(e => e.channelId == privateChannelId && e.eventType == eventType) + .forEach(e => sc.post(msg, e.instanceId)); } - + } } - - diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts index 73769a74e..1c9307a6e 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/HeartbeatHandler.ts @@ -1,126 +1,129 @@ -import { AppIdentifier } from "@kite9/fdc3-standard"; -import { MessageHandler } from "../BasicFDC3Server"; -import { AppRegistration, InstanceID, ServerContext, State } from "../ServerContext"; -import { BrowserTypes } from "@kite9/fdc3-schema"; +import { AppIdentifier } from '@kite9/fdc3-standard'; +import { MessageHandler } from '../BasicFDC3Server'; +import { AppRegistration, InstanceID, ServerContext, State } from '../ServerContext'; +import { BrowserTypes } from '@kite9/fdc3-schema'; type HeartbeatDetails = { - instanceId: string, - time: number, - state: string -} + instanceId: string; + time: number; + state: string; +}; function convertToText(s?: State): string { - if (s == undefined) { - return "Unknown" - } else { - switch (s) { - case State.Pending: - return "Pending" - case State.Connected: - return "Connected" - case State.NotResponding: - return "Not Responding" - case State.Terminated: - return "Terminated" - } + if (s == undefined) { + return 'Unknown'; + } else { + switch (s) { + case State.Pending: + return 'Pending'; + case State.Connected: + return 'Connected'; + case State.NotResponding: + return 'Not Responding'; + case State.Terminated: + return 'Terminated'; } + } } /* * Handles heartbeat pings and responses */ export class HeartbeatHandler implements MessageHandler { - - private readonly contexts: ServerContext[] = [] - private readonly lastHeartbeats: Map = new Map() - private readonly timerFunction: NodeJS.Timeout - - constructor(pingInterval: number = 1000, disconnectedAfter: number = 5000, deadAfter: number = 20000) { - - this.timerFunction = setInterval(() => { - - this.contexts.forEach(async (sc) => { - const apps = await sc.getAllApps() - apps - .filter(app => (app.state == State.Connected) || (app.state == State.NotResponding)) - .forEach(app => { - const now = new Date().getTime() - this.sendHeartbeat(sc, app) - - // check when the last heartbeat happened - const lastHeartbeat = this.lastHeartbeats.get(app.instanceId!!) - const currentState = app.state - - if (lastHeartbeat != undefined) { - const timeSinceLastHeartbeat = now - lastHeartbeat - - if ((timeSinceLastHeartbeat < disconnectedAfter) && (currentState != State.Connected)) { - console.error(`Heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered connected.`) - sc.setAppState(app.instanceId!!, State.Connected) - } else if ((timeSinceLastHeartbeat > disconnectedAfter) && (currentState == State.Connected)) { - console.error(`No heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered not responding.`) - sc.setAppState(app.instanceId!!, State.NotResponding) - } else if ((timeSinceLastHeartbeat > deadAfter) && (currentState == State.NotResponding)) { - console.error(`No heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered terminated.`) - sc.setAppState(app.instanceId!!, State.Terminated) - } else { - // no action - } - - } else { - // start the clock - this.lastHeartbeats.set(app.instanceId!!, now) - } - }) - }) - }, pingInterval) - } - - heartbeatTimes(): HeartbeatDetails[] { - const now = new Date().getTime() - return Array.from(this.lastHeartbeats).map(e => { - return { - instanceId: e[0], time: now - e[1], state: convertToText(this.contexts.map(sc => sc.getInstanceDetails(e[0])).reduce((a, b) => a || b)?.state) - } as HeartbeatDetails - }).filter(e => e.state != "Terminated") - } - - shutdown(): void { - clearInterval(this.timerFunction) - } - - accept(msg: any, sc: ServerContext, from: InstanceID): void { - if (!this.contexts.includes(sc)) { - this.contexts.push(sc) - } - - if (msg.type == 'heartbeatAcknowledgementRequest') { - const app = sc.getInstanceDetails(from) - if (app) { - this.lastHeartbeats.set(app.instanceId!!, new Date().getTime()) + private readonly contexts: ServerContext[] = []; + private readonly lastHeartbeats: Map = new Map(); + private readonly timerFunction: NodeJS.Timeout; + + constructor(pingInterval: number = 1000, disconnectedAfter: number = 5000, deadAfter: number = 20000) { + this.timerFunction = setInterval(() => { + this.contexts.forEach(async sc => { + const apps = await sc.getAllApps(); + apps + .filter(app => app.state == State.Connected || app.state == State.NotResponding) + .forEach(app => { + const now = new Date().getTime(); + this.sendHeartbeat(sc, app); + + // check when the last heartbeat happened + const lastHeartbeat = this.lastHeartbeats.get(app.instanceId!!); + const currentState = app.state; + + if (lastHeartbeat != undefined) { + const timeSinceLastHeartbeat = now - lastHeartbeat; + + if (timeSinceLastHeartbeat < disconnectedAfter && currentState != State.Connected) { + console.error( + `Heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered connected.` + ); + sc.setAppState(app.instanceId!!, State.Connected); + } else if (timeSinceLastHeartbeat > disconnectedAfter && currentState == State.Connected) { + console.error( + `No heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered not responding.` + ); + sc.setAppState(app.instanceId!!, State.NotResponding); + } else if (timeSinceLastHeartbeat > deadAfter && currentState == State.NotResponding) { + console.error( + `No heartbeat from ${app.instanceId} for ${timeSinceLastHeartbeat}ms. App is considered terminated.` + ); + sc.setAppState(app.instanceId!!, State.Terminated); + } else { + // no action + } + } else { + // start the clock + this.lastHeartbeats.set(app.instanceId!!, now); } - } - - if (msg.type == 'WCP5Shutdown') { - const app = sc.getInstanceDetails(from) - if (app) { - sc.setAppState(from, State.Terminated) - } - } + }); + }); + }, pingInterval); + } + + heartbeatTimes(): HeartbeatDetails[] { + const now = new Date().getTime(); + return Array.from(this.lastHeartbeats) + .map(e => { + return { + instanceId: e[0], + time: now - e[1], + state: convertToText(this.contexts.map(sc => sc.getInstanceDetails(e[0])).reduce((a, b) => a || b)?.state), + } as HeartbeatDetails; + }) + .filter(e => e.state != 'Terminated'); + } + + shutdown(): void { + clearInterval(this.timerFunction); + } + + accept(msg: any, sc: ServerContext, from: InstanceID): void { + if (!this.contexts.includes(sc)) { + this.contexts.push(sc); } - - async sendHeartbeat(sc: ServerContext, app: AppIdentifier): Promise { - const heartbeatEventMessage: BrowserTypes.HeartbeatEvent = { - type: 'heartbeatEvent', - meta: { - timestamp: new Date(), - eventUuid: sc.createUUID(), - }, - payload: { - } - } - sc.post(heartbeatEventMessage, app.instanceId!!) + if (msg.type == 'heartbeatAcknowledgementRequest') { + const app = sc.getInstanceDetails(from); + if (app) { + this.lastHeartbeats.set(app.instanceId!!, new Date().getTime()); + } } + if (msg.type == 'WCP5Shutdown') { + const app = sc.getInstanceDetails(from); + if (app) { + sc.setAppState(from, State.Terminated); + } + } + } + + async sendHeartbeat(sc: ServerContext, app: AppIdentifier): Promise { + const heartbeatEventMessage: BrowserTypes.HeartbeatEvent = { + type: 'heartbeatEvent', + meta: { + timestamp: new Date(), + eventUuid: sc.createUUID(), + }, + payload: {}, + }; + sc.post(heartbeatEventMessage, app.instanceId!!); + } } diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts index ef5bb200f..3c597cca5 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/IntentHandler.ts @@ -1,508 +1,618 @@ -import { MessageHandler } from "../BasicFDC3Server"; -import { AppRegistration, InstanceID, ServerContext } from "../ServerContext"; -import { Directory, DirectoryIntent } from "../directory/DirectoryInterface"; -import { Context } from "@kite9/fdc3-context"; -import { AppIntent, ResolveError, AppIdentifier, } from "@kite9/fdc3-standard"; -import { errorResponse, errorResponseId, successResponse, successResponseId } from "./support"; -import { BrowserTypes } from "@kite9/fdc3-schema"; - -type AddIntentListenerRequest = BrowserTypes.AddIntentListenerRequest -type FindIntentRequest = BrowserTypes.FindIntentRequest -type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest -type IntentEvent = BrowserTypes.IntentEvent -type IntentListenerUnsubscribeRequest = BrowserTypes.IntentListenerUnsubscribeRequest -type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest -type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest -type IntentResultRequest = BrowserTypes.IntentResultRequest +import { MessageHandler } from '../BasicFDC3Server'; +import { AppRegistration, InstanceID, ServerContext } from '../ServerContext'; +import { Directory, DirectoryIntent } from '../directory/DirectoryInterface'; +import { Context } from '@kite9/fdc3-context'; +import { AppIntent, ResolveError, AppIdentifier } from '@kite9/fdc3-standard'; +import { errorResponse, errorResponseId, successResponse, successResponseId } from './support'; +import { BrowserTypes } from '@kite9/fdc3-schema'; + +type AddIntentListenerRequest = BrowserTypes.AddIntentListenerRequest; +type FindIntentRequest = BrowserTypes.FindIntentRequest; +type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest; +type IntentEvent = BrowserTypes.IntentEvent; +type IntentListenerUnsubscribeRequest = BrowserTypes.IntentListenerUnsubscribeRequest; +type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest; +type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest; +type IntentResultRequest = BrowserTypes.IntentResultRequest; type ListenerRegistration = { - appId: string | undefined, - instanceId: string | undefined, - intentName: string | undefined, - listenerUUID: string -} + appId: string | undefined; + instanceId: string | undefined; + intentName: string | undefined; + listenerUUID: string; +}; type IntentRequest = { - intent: string, - context: Context, - requestUuid: string, - from: AppIdentifier, - type: 'raiseIntentResponse' | 'raiseIntentForContextResponse' -} - + intent: string; + context: Context; + requestUuid: string; + from: AppIdentifier; + type: 'raiseIntentResponse' | 'raiseIntentForContextResponse'; +}; /** * Re-writes the request to forward it on to the target application */ -async function forwardRequest(arg0: IntentRequest, to: AppIdentifier, sc: ServerContext, ih: IntentHandler): Promise { - const out: IntentEvent = { - type: 'intentEvent', - payload: { - context: arg0.context, - intent: arg0.intent, - originatingApp: { - appId: arg0.from.appId, - instanceId: arg0.from.instanceId - }, - raiseIntentRequestUuid: arg0.requestUuid - }, - meta: { - eventUuid: sc.createUUID(), - timestamp: new Date() - } - } - - // register the resolution destination - ih.pendingResolutions.set(arg0.requestUuid, arg0.from) - await sc.post(out, to.instanceId!!) - successResponseId(sc, arg0.requestUuid, arg0.from, { - intentResolution: { - intent: arg0.intent, - source: to - } - }, arg0.type) +async function forwardRequest( + arg0: IntentRequest, + to: AppIdentifier, + sc: ServerContext, + ih: IntentHandler +): Promise { + const out: IntentEvent = { + type: 'intentEvent', + payload: { + context: arg0.context, + intent: arg0.intent, + originatingApp: { + appId: arg0.from.appId, + instanceId: arg0.from.instanceId, + }, + raiseIntentRequestUuid: arg0.requestUuid, + }, + meta: { + eventUuid: sc.createUUID(), + timestamp: new Date(), + }, + }; + + // register the resolution destination + ih.pendingResolutions.set(arg0.requestUuid, arg0.from); + await sc.post(out, to.instanceId!!); + successResponseId( + sc, + arg0.requestUuid, + arg0.from, + { + intentResolution: { + intent: arg0.intent, + source: to, + }, + }, + arg0.type + ); } /** * A pending intent is one for an app that hasn't registered it's intent listener yet. * (Possibly it is being opened) - * + * * Pending intents wait for that registration and then message the app. */ class PendingIntent { - - complete: boolean = false - r: IntentRequest - appId: AppIdentifier - sc: ServerContext - ih: IntentHandler - - constructor(r: IntentRequest, sc: ServerContext, ih: IntentHandler, appId: AppIdentifier) { - this.r = r - this.appId = appId - this.sc = sc - this.ih = ih - - // handle the timeout - setTimeout(() => { - if (!this.complete) { - errorResponseId(sc, r.requestUuid, r.from, ResolveError.IntentDeliveryFailed, r.type) - this.ih.pendingIntents.delete(this) - } - }, ih.timeoutMs) - } - - - async accept(arg0: ListenerRegistration): Promise { - if ((arg0.appId == this.appId.appId) && - (arg0.intentName == this.r.intent) && - ((arg0.instanceId == this.appId.instanceId) || (this.appId.instanceId == undefined)) - ) { - this.complete = true - this.ih.pendingIntents.delete(this) - forwardRequest(this.r, { appId: arg0.appId, instanceId: arg0.instanceId }, this.sc, this.ih) - } + complete: boolean = false; + r: IntentRequest; + appId: AppIdentifier; + sc: ServerContext; + ih: IntentHandler; + + constructor(r: IntentRequest, sc: ServerContext, ih: IntentHandler, appId: AppIdentifier) { + this.r = r; + this.appId = appId; + this.sc = sc; + this.ih = ih; + + // handle the timeout + setTimeout(() => { + if (!this.complete) { + errorResponseId(sc, r.requestUuid, r.from, ResolveError.IntentDeliveryFailed, r.type); + this.ih.pendingIntents.delete(this); + } + }, ih.timeoutMs); + } + + async accept(arg0: ListenerRegistration): Promise { + if ( + arg0.appId == this.appId.appId && + arg0.intentName == this.r.intent && + (arg0.instanceId == this.appId.instanceId || this.appId.instanceId == undefined) + ) { + this.complete = true; + this.ih.pendingIntents.delete(this); + forwardRequest(this.r, { appId: arg0.appId, instanceId: arg0.instanceId }, this.sc, this.ih); } + } } export class IntentHandler implements MessageHandler { + private readonly directory: Directory; + private readonly regs: ListenerRegistration[] = []; + readonly pendingIntents: Set = new Set(); + readonly pendingResolutions: Map = new Map(); + readonly timeoutMs: number; + + constructor(d: Directory, timeoutMs: number) { + this.directory = d; + this.timeoutMs = timeoutMs; + } + + shutdown(): void {} + + async narrowIntents( + raiser: AppIdentifier, + appIntents: AppIntent[], + context: Context, + sc: ServerContext + ): Promise { + const out = await sc.narrowIntents(raiser, appIntents, context); + return out; + } - private readonly directory: Directory - private readonly regs: ListenerRegistration[] = [] - readonly pendingIntents: Set = new Set() - readonly pendingResolutions: Map = new Map() - readonly timeoutMs: number - - constructor(d: Directory, timeoutMs: number) { - this.directory = d - this.timeoutMs = timeoutMs - } - - shutdown(): void { - } - - async narrowIntents(raiser: AppIdentifier, appIntents: AppIntent[], context: Context, sc: ServerContext): Promise { - const out = await sc.narrowIntents(raiser, appIntents, context) - return out - } - - async accept(msg: any, sc: ServerContext, uuid: InstanceID): Promise { - const from = sc.getInstanceDetails(uuid) - - if (from == null) { - // this handler only deals with connected apps - return - } - - try { - - - switch (msg.type as string) { - // finding intents - case 'findIntentsByContextRequest': return this.findIntentsByContextRequest(msg as FindIntentsByContextRequest, sc, from) - case 'findIntentRequest': return this.findIntentRequest(msg as FindIntentRequest, sc, from) - - // listeners - case 'addIntentListenerRequest': return this.onAddIntentListener(msg as AddIntentListenerRequest, sc, from) - case 'intentListenerUnsubscribeRequest': return this.onUnsubscribe(msg as IntentListenerUnsubscribeRequest, sc, from) - - // raising intents and returning results - case 'raiseIntentRequest': return this.raiseIntentRequest(msg as RaiseIntentRequest, sc, from) - case 'raiseIntentForContextRequest': return this.raiseIntentForContextRequest(msg as RaiseIntentForContextRequest, sc, from) - case 'intentResultRequest': return this.intentResultRequest(msg as IntentResultRequest, sc, from) - } + async accept(msg: any, sc: ServerContext, uuid: InstanceID): Promise { + const from = sc.getInstanceDetails(uuid); - } catch (e: any) { - const responseType = msg.type.replace(new RegExp("Request$"), 'Response') - errorResponse(sc, msg, from, e.message ?? e, responseType) - } + if (from == null) { + // this handler only deals with connected apps + return; } - /** - * Called when target app handles an intent - */ - intentResultRequest(arg0: IntentResultRequest, sc: ServerContext, from: AppIdentifier): void | PromiseLike { - const requestId = arg0.payload.raiseIntentRequestUuid - const to = this.pendingResolutions.get(requestId) - if (to) { - // post the result to the app that raised the intent - successResponseId(sc, requestId, to!!, { - intentResult: arg0.payload.intentResult - }, 'raiseIntentResultResponse') - - // respond to the app that handled the intent - successResponse(sc, arg0, from, {}, 'intentResultResponse') - this.pendingResolutions.delete(requestId) - } else { - // no-one waiting for this result - errorResponse(sc, arg0, from, "No-one waiting for this result", 'intentResultResponse') - } + try { + switch (msg.type as string) { + // finding intents + case 'findIntentsByContextRequest': + return this.findIntentsByContextRequest(msg as FindIntentsByContextRequest, sc, from); + case 'findIntentRequest': + return this.findIntentRequest(msg as FindIntentRequest, sc, from); + + // listeners + case 'addIntentListenerRequest': + return this.onAddIntentListener(msg as AddIntentListenerRequest, sc, from); + case 'intentListenerUnsubscribeRequest': + return this.onUnsubscribe(msg as IntentListenerUnsubscribeRequest, sc, from); + + // raising intents and returning results + case 'raiseIntentRequest': + return this.raiseIntentRequest(msg as RaiseIntentRequest, sc, from); + case 'raiseIntentForContextRequest': + return this.raiseIntentForContextRequest(msg as RaiseIntentForContextRequest, sc, from); + case 'intentResultRequest': + return this.intentResultRequest(msg as IntentResultRequest, sc, from); + } + } catch (e: any) { + const responseType = msg.type.replace(new RegExp('Request$'), 'Response'); + errorResponse(sc, msg, from, e.message ?? e, responseType); } - - onUnsubscribe(arg0: IntentListenerUnsubscribeRequest, sc: ServerContext, from: AppIdentifier): void { - const id = arg0.payload.listenerUUID - const fi = this.regs.findIndex((e) => e.listenerUUID == id) - if (fi > -1) { - this.regs.splice(fi, 1) - successResponse(sc, arg0, from, {}, 'intentListenerUnsubscribeResponse') - } else { - errorResponse(sc, arg0, from, "Non-Existent Listener", 'intentListenerUnsubscribeResponse') - } + } + + /** + * Called when target app handles an intent + */ + intentResultRequest( + arg0: IntentResultRequest, + sc: ServerContext, + from: AppIdentifier + ): void | PromiseLike { + const requestId = arg0.payload.raiseIntentRequestUuid; + const to = this.pendingResolutions.get(requestId); + if (to) { + // post the result to the app that raised the intent + successResponseId( + sc, + requestId, + to!!, + { + intentResult: arg0.payload.intentResult, + }, + 'raiseIntentResultResponse' + ); + + // respond to the app that handled the intent + successResponse(sc, arg0, from, {}, 'intentResultResponse'); + this.pendingResolutions.delete(requestId); + } else { + // no-one waiting for this result + errorResponse(sc, arg0, from, 'No-one waiting for this result', 'intentResultResponse'); } - - onAddIntentListener(arg0: AddIntentListenerRequest, sc: ServerContext, from: AppIdentifier): void { - const lr = { - appId: from.appId, - instanceId: from.instanceId, - intentName: arg0.payload.intent, - listenerUUID: sc.createUUID() - } as ListenerRegistration - - this.regs.push(lr) - successResponse(sc, arg0, from, { - listenerUUID: lr.listenerUUID - }, 'addIntentListenerResponse') - - // see if this intent listener is the destination for any pending intents - for (let x of this.pendingIntents) { - x.accept(lr) - if (x.complete) { - this.pendingIntents.delete(x) - } - } + } + + onUnsubscribe(arg0: IntentListenerUnsubscribeRequest, sc: ServerContext, from: AppIdentifier): void { + const id = arg0.payload.listenerUUID; + const fi = this.regs.findIndex(e => e.listenerUUID == id); + if (fi > -1) { + this.regs.splice(fi, 1); + successResponse(sc, arg0, from, {}, 'intentListenerUnsubscribeResponse'); + } else { + errorResponse(sc, arg0, from, 'Non-Existent Listener', 'intentListenerUnsubscribeResponse'); } - - hasListener(instanceId: string, intentName: string): boolean { - return this.regs.find(r => (r.instanceId == instanceId) && (r.intentName == intentName)) != null + } + + onAddIntentListener(arg0: AddIntentListenerRequest, sc: ServerContext, from: AppIdentifier): void { + const lr = { + appId: from.appId, + instanceId: from.instanceId, + intentName: arg0.payload.intent, + listenerUUID: sc.createUUID(), + } as ListenerRegistration; + + this.regs.push(lr); + successResponse( + sc, + arg0, + from, + { + listenerUUID: lr.listenerUUID, + }, + 'addIntentListenerResponse' + ); + + // see if this intent listener is the destination for any pending intents + for (let x of this.pendingIntents) { + x.accept(lr); + if (x.complete) { + this.pendingIntents.delete(x); + } } - - async getRunningApps(appId: string, sc: ServerContext): Promise { - return (await sc.getConnectedApps()).filter(a => a.appId == appId) + } + + hasListener(instanceId: string, intentName: string): boolean { + return this.regs.find(r => r.instanceId == instanceId && r.intentName == intentName) != null; + } + + async getRunningApps(appId: string, sc: ServerContext): Promise { + return (await sc.getConnectedApps()).filter(a => a.appId == appId); + } + + async startWithPendingIntent( + arg0: IntentRequest, + sc: ServerContext, + target: AppIdentifier + ): Promise { + // app exists but needs starting + const pi = new PendingIntent(arg0, sc, this, target); + this.pendingIntents.add(pi); + sc.open(target?.appId!!).then(() => { + return undefined; + }); + } + + createAppIntents(ir: IntentRequest[], target: AppIdentifier[]): AppIntent[] { + return ir.map(r => { + return { + intent: { + name: r.intent, + displayName: r.intent, + }, + apps: target, + }; + }); + } + + async raiseIntentRequestToSpecificInstance( + arg0: IntentRequest[], + sc: ServerContext, + target: AppIdentifier + ): Promise { + if (!(await sc.isAppConnected(target.instanceId!!))) { + // instance doesn't exist + return errorResponseId( + sc, + arg0[0].requestUuid, + arg0[0].from, + ResolveError.TargetInstanceUnavailable, + arg0[0].type + ); } - async startWithPendingIntent(arg0: IntentRequest, sc: ServerContext, target: AppIdentifier): Promise { - // app exists but needs starting - const pi = new PendingIntent(arg0, sc, this, target) - this.pendingIntents.add(pi) - sc.open(target?.appId!!).then(() => { return undefined }) - } + const requestsWithListeners = arg0.filter(r => this.hasListener(target.instanceId!!, r.intent)); - createAppIntents(ir: IntentRequest[], target: AppIdentifier[]): AppIntent[] { - return ir.map(r => { - return { - intent: { - name: r.intent, - displayName: r.intent - }, - apps: target - } - }) + if (requestsWithListeners.length == 0) { + this.createPendingIntentIfAllowed(arg0[0], sc, target); + } else { + // ok, deliver to the current running app. + return forwardRequest(requestsWithListeners[0], target, sc, this); } - - async raiseIntentRequestToSpecificInstance(arg0: IntentRequest[], sc: ServerContext, target: AppIdentifier): Promise { - if (!(await sc.isAppConnected(target.instanceId!!))) { - // instance doesn't exist - return errorResponseId(sc, arg0[0].requestUuid, arg0[0].from, ResolveError.TargetInstanceUnavailable, arg0[0].type) - } - - const requestsWithListeners = arg0.filter(r => this.hasListener(target.instanceId!!, r.intent)) - - if (requestsWithListeners.length == 0) { - this.createPendingIntentIfAllowed(arg0[0], sc, target) - } else { - // ok, deliver to the current running app. - return forwardRequest(requestsWithListeners[0], target, sc, this) - } + } + + async createPendingIntentIfAllowed(ir: IntentRequest, sc: ServerContext, target: AppIdentifier) { + // if this app declares that it supports the intent, we'll create a pending intent + const matchingIntents: DirectoryIntent[] = this.directory.retrieveIntents(ir.context.type, ir.intent, undefined); + const declared = matchingIntents.find(i => i.appId == target.appId); + + if (declared) { + // maybe listener hasn't been registered yet - create a pending intent + const pi = new PendingIntent(ir, sc, this, target); + this.pendingIntents.add(pi); + } else { + errorResponseId(sc, ir.requestUuid, ir.from, ResolveError.NoAppsFound, ir.type); } - - async createPendingIntentIfAllowed(ir: IntentRequest, sc: ServerContext, target: AppIdentifier) { - // if this app declares that it supports the intent, we'll create a pending intent - const matchingIntents: DirectoryIntent[] = this.directory.retrieveIntents(ir.context.type, ir.intent, undefined) - const declared = matchingIntents.find(i => i.appId == target.appId) - - if (declared) { - // maybe listener hasn't been registered yet - create a pending intent - const pi = new PendingIntent(ir, sc, this, target) - this.pendingIntents.add(pi) + } + + async raiseIntentRequestToSpecificAppId( + arg0: IntentRequest[], + sc: ServerContext, + target: AppIdentifier + ): Promise { + // dealing with a specific app, which may or may not be open + const runningApps = await this.getRunningApps(target.appId, sc); + + const appIntents = this.createAppIntents(arg0, [...runningApps, { appId: target.appId }]); + + const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc); + + if (narrowedAppIntents.length == 1) { + if (narrowedAppIntents[0].apps.length == 2 && narrowedAppIntents[0].apps[0].instanceId) { + // single running instance + return this.raiseIntentRequestToSpecificInstance(arg0, sc, runningApps[0]); + } else if (narrowedAppIntents[0].apps.length == 1) { + // no running instance, single app + const appRecords = this.directory.retrieveAppsById(target.appId); + if (appRecords.length >= 1) { + const ir: IntentRequest = { + ...arg0[0], + intent: narrowedAppIntents[0].intent.name, + }; + return this.startWithPendingIntent(ir, sc, target); } else { - errorResponseId(sc, ir.requestUuid, ir.from, ResolveError.NoAppsFound, ir.type) + // app doesn't exist + return errorResponseId( + sc, + arg0[0].requestUuid, + arg0[0].from, + ResolveError.TargetAppUnavailable, + arg0[0].type + ); } + } } - async raiseIntentRequestToSpecificAppId(arg0: IntentRequest[], sc: ServerContext, target: AppIdentifier): Promise { - // dealing with a specific app, which may or may not be open - const runningApps = await this.getRunningApps(target.appId, sc) - - const appIntents = this.createAppIntents(arg0, [...runningApps, { appId: target.appId }]) - - const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc) - - if (narrowedAppIntents.length == 1) { - if ((narrowedAppIntents[0].apps.length == 2) && (narrowedAppIntents[0].apps[0].instanceId)) { - // single running instance - return this.raiseIntentRequestToSpecificInstance(arg0, sc, runningApps[0]) - } else if (narrowedAppIntents[0].apps.length == 1) { - // no running instance, single app - const appRecords = this.directory.retrieveAppsById(target.appId) - if (appRecords.length >= 1) { - const ir: IntentRequest = { - ...arg0[0], - intent: narrowedAppIntents[0].intent.name - } - return this.startWithPendingIntent(ir, sc, target) - } else { - // app doesn't exist - return errorResponseId(sc, arg0[0].requestUuid, arg0[0].from, ResolveError.TargetAppUnavailable, arg0[0].type) - } - } - } - - // need to use the resolver to choose a running app instance + // need to use the resolver to choose a running app instance - if (arg0[0].type == 'raiseIntentResponse') { - return successResponseId(sc, arg0[0].requestUuid, arg0[0].from, { - appIntent: narrowedAppIntents[0] - }, arg0[0].type) - } else { - // raise intent for context - return successResponseId(sc, arg0[0].requestUuid, arg0[0].from, { - appIntents: narrowedAppIntents - }, arg0[0].type) - } + if (arg0[0].type == 'raiseIntentResponse') { + return successResponseId( + sc, + arg0[0].requestUuid, + arg0[0].from, + { + appIntent: narrowedAppIntents[0], + }, + arg0[0].type + ); + } else { + // raise intent for context + return successResponseId( + sc, + arg0[0].requestUuid, + arg0[0].from, + { + appIntents: narrowedAppIntents, + }, + arg0[0].type + ); } - - oneAppOnly(appIntent: AppIntent): boolean { - const apps = appIntent.apps.map(a => a.appId) - const uniqueApps = apps.filter((v, i, a) => a.indexOf(v) === i).length - return (uniqueApps == 1) + } + + oneAppOnly(appIntent: AppIntent): boolean { + const apps = appIntent.apps.map(a => a.appId); + const uniqueApps = apps.filter((v, i, a) => a.indexOf(v) === i).length; + return uniqueApps == 1; + } + + async raiseIntentToAnyApp(arg0: IntentRequest[], sc: ServerContext): Promise { + const connectedApps = await sc.getConnectedApps(); + const matchingIntents = arg0.flatMap(i => this.directory.retrieveIntents(i.context.type, i.intent, undefined)); + const uniqueIntentNames = matchingIntents.map(i => i.intentName).filter((v, i, a) => a.indexOf(v) === i); + + const appIntents: AppIntent[] = uniqueIntentNames.map(i => { + const directoryAppsWithIntent = matchingIntents.filter(mi => mi.intentName == i).map(mi => mi.appId); + const runningApps = connectedApps.filter(ca => directoryAppsWithIntent.includes(ca.appId)); + + return { + intent: { + name: i, + displayName: i, + }, + apps: [ + ...runningApps, + ...directoryAppsWithIntent.map(d => { + return { appId: d }; + }), + ], + }; + }); + + const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc); + + if (narrowedAppIntents.length == 0) { + // nothing can resolve the intent, fail + return errorResponseId(sc, arg0[0].requestUuid, arg0[0].from, ResolveError.NoAppsFound, arg0[0].type); } - async raiseIntentToAnyApp(arg0: IntentRequest[], sc: ServerContext): Promise { - const connectedApps = await sc.getConnectedApps() - const matchingIntents = arg0.flatMap(i => this.directory.retrieveIntents(i.context.type, i.intent, undefined)) - const uniqueIntentNames = matchingIntents.map(i => i.intentName).filter((v, i, a) => a.indexOf(v) === i) - - const appIntents: AppIntent[] = uniqueIntentNames.map(i => { - const directoryAppsWithIntent = matchingIntents.filter(mi => mi.intentName == i).map(mi => mi.appId) - const runningApps = connectedApps.filter(ca => directoryAppsWithIntent.includes(ca.appId)) - - return { - intent: { - name: i, - displayName: i - }, - apps: [ - ...runningApps, - ...directoryAppsWithIntent.map(d => { return { appId: d } }) - ] - } - }) - - const narrowedAppIntents = await this.narrowIntents(arg0[0].from, appIntents, arg0[0].context, sc) - - if (narrowedAppIntents.length == 0) { - // nothing can resolve the intent, fail - return errorResponseId(sc, arg0[0].requestUuid, arg0[0].from, ResolveError.NoAppsFound, arg0[0].type) - } - - if (narrowedAppIntents.length == 1) { - const theAppIntent = narrowedAppIntents[0] - if (this.oneAppOnly(theAppIntent)) { - const instanceCount = theAppIntent.apps.filter(a => a.instanceId).length - const ir: IntentRequest = { - ...arg0[0], - intent: narrowedAppIntents[0].intent.name - } - if (instanceCount == 1) { - // app is running - return forwardRequest(ir, theAppIntent.apps[0], sc, this) - } else if (instanceCount == 0) { - return this.startWithPendingIntent(ir, sc, theAppIntent.apps[0]) - } - } + if (narrowedAppIntents.length == 1) { + const theAppIntent = narrowedAppIntents[0]; + if (this.oneAppOnly(theAppIntent)) { + const instanceCount = theAppIntent.apps.filter(a => a.instanceId).length; + const ir: IntentRequest = { + ...arg0[0], + intent: narrowedAppIntents[0].intent.name, + }; + if (instanceCount == 1) { + // app is running + return forwardRequest(ir, theAppIntent.apps[0], sc, this); + } else if (instanceCount == 0) { + return this.startWithPendingIntent(ir, sc, theAppIntent.apps[0]); } - - if (arg0[0].type == 'raiseIntentResponse') { - // raise intent - return successResponseId(sc, arg0[0].requestUuid, arg0[0].from, { - appIntent: narrowedAppIntents[0] - }, arg0[0].type) - } else { - // raise intent for context - return successResponseId(sc, arg0[0].requestUuid, arg0[0].from, { appIntents: narrowedAppIntents }, arg0[0].type) - } - + } } - async raiseIntentRequest(arg0: RaiseIntentRequest, sc: ServerContext, from: AppIdentifier): Promise { - const intentRequest: IntentRequest = { - context: arg0.payload.context, - from, - intent: arg0.payload.intent, - requestUuid: arg0.meta.requestUuid, - type: 'raiseIntentResponse' - } - - const target = arg0.payload.app!! - if (target?.instanceId) { - return this.raiseIntentRequestToSpecificInstance([intentRequest], sc, target) - } else if (target?.appId) { - return this.raiseIntentRequestToSpecificAppId([intentRequest], sc, target) - } else { - return this.raiseIntentToAnyApp([intentRequest], sc) - } + if (arg0[0].type == 'raiseIntentResponse') { + // raise intent + return successResponseId( + sc, + arg0[0].requestUuid, + arg0[0].from, + { + appIntent: narrowedAppIntents[0], + }, + arg0[0].type + ); + } else { + // raise intent for context + return successResponseId(sc, arg0[0].requestUuid, arg0[0].from, { appIntents: narrowedAppIntents }, arg0[0].type); } - - async raiseIntentForContextRequest(arg0: RaiseIntentForContextRequest, sc: ServerContext, from: AppIdentifier): Promise { - // dealing with a specific instance of an app - const mappedIntents = this.directory.retrieveIntents(arg0.payload.context.type, undefined, undefined) - const uniqueIntentNames = mappedIntents.filter((v, i, a) => a.findIndex(v2 => v2.intentName == v.intentName) == i) - const possibleIntentRequests: IntentRequest[] = uniqueIntentNames.map(i => { - return { - context: arg0.payload.context, - from, - intent: i.intentName, - requestUuid: arg0.meta.requestUuid, - type: 'raiseIntentForContextResponse' - } - }) - - if (possibleIntentRequests.length == 0) { - return errorResponseId(sc, arg0.meta.requestUuid, from, ResolveError.NoAppsFound, 'raiseIntentForContextResponse') - } - - const target = arg0.payload.app!! - if (target?.instanceId) { - return this.raiseIntentRequestToSpecificInstance(possibleIntentRequests, sc, target) - } else if (target?.appId) { - return this.raiseIntentRequestToSpecificAppId(possibleIntentRequests, sc, target) - } else { - return this.raiseIntentToAnyApp(possibleIntentRequests, sc) - } + } + + async raiseIntentRequest( + arg0: RaiseIntentRequest, + sc: ServerContext, + from: AppIdentifier + ): Promise { + const intentRequest: IntentRequest = { + context: arg0.payload.context, + from, + intent: arg0.payload.intent, + requestUuid: arg0.meta.requestUuid, + type: 'raiseIntentResponse', + }; + + const target = arg0.payload.app!!; + if (target?.instanceId) { + return this.raiseIntentRequestToSpecificInstance([intentRequest], sc, target); + } else if (target?.appId) { + return this.raiseIntentRequestToSpecificAppId([intentRequest], sc, target); + } else { + return this.raiseIntentToAnyApp([intentRequest], sc); } - - async findIntentsByContextRequest(r: FindIntentsByContextRequest, sc: ServerContext, from: AppIdentifier): Promise { - - // TODO: Add result type - const { context } = r.payload - - const apps1 = this.directory.retrieveIntents(context?.type, undefined, undefined) - - // fold apps so same intents aren't duplicated - const apps2: AppIntent[] = [] - apps1.forEach(a1 => { - const existing = apps2.find(a2 => a2.intent.name == a1.intentName) - if (existing) { - existing.apps.push({ appId: a1.appId }) - } else { - apps2.push({ - intent: { - name: a1.intentName, - displayName: a1.displayName ?? a1.intentName - }, - apps: [ - { - appId: a1.appId - } - ] - }) - } - }) - - successResponse(sc, r, from, { - appIntents: apps2 - }, 'findIntentsByContextResponse') + } + + async raiseIntentForContextRequest( + arg0: RaiseIntentForContextRequest, + sc: ServerContext, + from: AppIdentifier + ): Promise { + // dealing with a specific instance of an app + const mappedIntents = this.directory.retrieveIntents(arg0.payload.context.type, undefined, undefined); + const uniqueIntentNames = mappedIntents.filter((v, i, a) => a.findIndex(v2 => v2.intentName == v.intentName) == i); + const possibleIntentRequests: IntentRequest[] = uniqueIntentNames.map(i => { + return { + context: arg0.payload.context, + from, + intent: i.intentName, + requestUuid: arg0.meta.requestUuid, + type: 'raiseIntentForContextResponse', + }; + }); + + if (possibleIntentRequests.length == 0) { + return errorResponseId( + sc, + arg0.meta.requestUuid, + from, + ResolveError.NoAppsFound, + 'raiseIntentForContextResponse' + ); } - - async findIntentRequest(r: FindIntentRequest, sc: ServerContext, from: AppIdentifier): Promise { - const { intent, context, resultType } = r.payload - - // listeners for connected applications - const apps2 = (await this.retrieveListeners(intent, sc)) - .map(lr => { - return { - appId: lr.appId, - instanceId: lr.instanceId - } - }) as AppIdentifier[] - - // directory entries - const apps1 = this.directory.retrieveApps(context?.type, intent, resultType) - .map(a => { - return { - appId: a.appId, - } - }) - .filter(i => { - // remove any directory entries that are already started - const running = apps2.find(i2 => i2.appId == i.appId) - return !running - }) as AppIdentifier[] - - // just need this for the (deprecated) display name - const allMatchingIntents = this.directory.retrieveIntents(context?.type, intent, resultType) - const displayName = (allMatchingIntents.length > 0) ? allMatchingIntents[0].displayName : undefined - - successResponse(sc, r, from, { - appIntent: { - intent: { - name: intent, - displayName - }, - apps: [...apps1, ...apps2] - } - }, 'findIntentResponse') + const target = arg0.payload.app!!; + if (target?.instanceId) { + return this.raiseIntentRequestToSpecificInstance(possibleIntentRequests, sc, target); + } else if (target?.appId) { + return this.raiseIntentRequestToSpecificAppId(possibleIntentRequests, sc, target); + } else { + return this.raiseIntentToAnyApp(possibleIntentRequests, sc); } + } + + async findIntentsByContextRequest( + r: FindIntentsByContextRequest, + sc: ServerContext, + from: AppIdentifier + ): Promise { + // TODO: Add result type + const { context } = r.payload; + + const apps1 = this.directory.retrieveIntents(context?.type, undefined, undefined); + + // fold apps so same intents aren't duplicated + const apps2: AppIntent[] = []; + apps1.forEach(a1 => { + const existing = apps2.find(a2 => a2.intent.name == a1.intentName); + if (existing) { + existing.apps.push({ appId: a1.appId }); + } else { + apps2.push({ + intent: { + name: a1.intentName, + displayName: a1.displayName ?? a1.intentName, + }, + apps: [ + { + appId: a1.appId, + }, + ], + }); + } + }); + + successResponse( + sc, + r, + from, + { + appIntents: apps2, + }, + 'findIntentsByContextResponse' + ); + } + + async findIntentRequest( + r: FindIntentRequest, + sc: ServerContext, + from: AppIdentifier + ): Promise { + const { intent, context, resultType } = r.payload; + + // listeners for connected applications + const apps2 = (await this.retrieveListeners(intent, sc)).map(lr => { + return { + appId: lr.appId, + instanceId: lr.instanceId, + }; + }) as AppIdentifier[]; + + // directory entries + const apps1 = this.directory + .retrieveApps(context?.type, intent, resultType) + .map(a => { + return { + appId: a.appId, + }; + }) + .filter(i => { + // remove any directory entries that are already started + const running = apps2.find(i2 => i2.appId == i.appId); + return !running; + }) as AppIdentifier[]; + + // just need this for the (deprecated) display name + const allMatchingIntents = this.directory.retrieveIntents(context?.type, intent, resultType); + const displayName = allMatchingIntents.length > 0 ? allMatchingIntents[0].displayName : undefined; + + successResponse( + sc, + r, + from, + { + appIntent: { + intent: { + name: intent, + displayName, + }, + apps: [...apps1, ...apps2], + }, + }, + 'findIntentResponse' + ); + } - async retrieveListeners(intentName: string | undefined, sc: ServerContext): Promise { - const activeApps = await sc.getConnectedApps() - const matching = this.regs.filter(r => r.intentName == intentName) - - const active = matching.filter(r => activeApps.find(a => a.instanceId == r.instanceId)) - - return active - } + async retrieveListeners( + intentName: string | undefined, + sc: ServerContext + ): Promise { + const activeApps = await sc.getConnectedApps(); + const matching = this.regs.filter(r => r.intentName == intentName); + const active = matching.filter(r => activeApps.find(a => a.instanceId == r.instanceId)); + return active; + } } diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts index 567aa7f5c..93114b255 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/OpenHandler.ts @@ -1,281 +1,322 @@ -import { MessageHandler } from "../BasicFDC3Server"; -import { AppRegistration, InstanceID, ServerContext, State } from "../ServerContext"; -import { Directory, DirectoryApp } from "../directory/DirectoryInterface"; -import { ContextElement } from "@kite9/fdc3-context"; -import { - OpenError, ResolveError, - AppIdentifier, AppMetadata, -} from "@kite9/fdc3-standard"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { errorResponse, successResponse } from './support' - - -type BroadcastEvent = BrowserTypes.BroadcastEvent -type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest -type FindInstancesRequest = BrowserTypes.FindInstancesRequest -type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest -type OpenRequest = BrowserTypes.OpenRequest -type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity -type WebConnectionProtocol5ValidateAppIdentityFailedResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentityFailedResponse -type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse - -enum AppState { Opening, DeliveringContext, Done } +import { MessageHandler } from '../BasicFDC3Server'; +import { AppRegistration, InstanceID, ServerContext, State } from '../ServerContext'; +import { Directory, DirectoryApp } from '../directory/DirectoryInterface'; +import { ContextElement } from '@kite9/fdc3-context'; +import { OpenError, ResolveError, AppIdentifier, AppMetadata } from '@kite9/fdc3-standard'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { errorResponse, successResponse } from './support'; + +type BroadcastEvent = BrowserTypes.BroadcastEvent; +type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest; +type FindInstancesRequest = BrowserTypes.FindInstancesRequest; +type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest; +type OpenRequest = BrowserTypes.OpenRequest; +type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity; +type WebConnectionProtocol5ValidateAppIdentityFailedResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentityFailedResponse; +type WebConnectionProtocol5ValidateAppIdentitySuccessResponse = + BrowserTypes.WebConnectionProtocol5ValidateAppIdentitySuccessResponse; + +enum AppState { + Opening, + DeliveringContext, + Done, +} class PendingApp { - - private readonly sc: ServerContext - private readonly msg: OpenRequest - readonly context: ContextElement | undefined - readonly source: AppMetadata - state: AppState = AppState.Opening - private openedApp: AppIdentifier | undefined = undefined - - constructor(sc: ServerContext, msg: OpenRequest, context: ContextElement | undefined, source: AppIdentifier, timeoutMs: number) { - this.context = context - this.source = source - this.sc = sc - this.msg = msg - - setTimeout(() => { - if (this.state != AppState.Done) { - this.onError() - } - }, timeoutMs) - } - - private onSuccess() { - this.sc.setAppState(this.openedApp?.instanceId!!, State.Connected) - successResponse(this.sc, this.msg, this.source, { - appIdentifier: { - appId: this.openedApp!!.appId, - instanceId: this.openedApp!!.instanceId - } - }, 'openResponse') - } - - private onError() { - errorResponse(this.sc, this.msg, this.source, OpenError.AppTimeout, 'openResponse') + private readonly sc: ServerContext; + private readonly msg: OpenRequest; + readonly context: ContextElement | undefined; + readonly source: AppMetadata; + state: AppState = AppState.Opening; + private openedApp: AppIdentifier | undefined = undefined; + + constructor( + sc: ServerContext, + msg: OpenRequest, + context: ContextElement | undefined, + source: AppIdentifier, + timeoutMs: number + ) { + this.context = context; + this.source = source; + this.sc = sc; + this.msg = msg; + + setTimeout(() => { + if (this.state != AppState.Done) { + this.onError(); + } + }, timeoutMs); + } + + private onSuccess() { + this.sc.setAppState(this.openedApp?.instanceId!!, State.Connected); + successResponse( + this.sc, + this.msg, + this.source, + { + appIdentifier: { + appId: this.openedApp!!.appId, + instanceId: this.openedApp!!.instanceId, + }, + }, + 'openResponse' + ); + } + + private onError() { + errorResponse(this.sc, this.msg, this.source, OpenError.AppTimeout, 'openResponse'); + } + + setOpened(openedApp: AppIdentifier) { + this.openedApp = openedApp; + if (this.context) { + this.state = AppState.DeliveringContext; + } else { + this.setDone(); } + } - setOpened(openedApp: AppIdentifier) { - this.openedApp = openedApp - if (this.context) { - this.state = AppState.DeliveringContext - } else { - this.setDone() - } - } - - setDone() { - this.state = AppState.Done - this.onSuccess() - } + setDone() { + this.state = AppState.Done; + this.onSuccess(); + } } export class OpenHandler implements MessageHandler { - - private readonly directory: Directory - readonly pending: Map = new Map() - readonly timeoutMs: number - - constructor(d: Directory, timeoutMs: number) { - this.directory = d - this.timeoutMs = timeoutMs + private readonly directory: Directory; + readonly pending: Map = new Map(); + readonly timeoutMs: number; + + constructor(d: Directory, timeoutMs: number) { + this.directory = d; + this.timeoutMs = timeoutMs; + } + + shutdown(): void {} + + async accept(msg: any, sc: ServerContext, uuid: InstanceID): Promise { + switch (msg.type as string) { + case 'addContextListenerRequest': + return this.handleAddContextListener(msg as AddContextListenerRequest, sc, uuid); + case 'WCP4ValidateAppIdentity': + return this.handleValidate(msg as WebConnectionProtocol4ValidateAppIdentity, sc, uuid); } - shutdown(): void { - } - - async accept(msg: any, sc: ServerContext, uuid: InstanceID): Promise { + const from = sc.getInstanceDetails(uuid); + try { + if (from) { switch (msg.type as string) { - case 'addContextListenerRequest': return this.handleAddContextListener(msg as AddContextListenerRequest, sc, uuid) - case 'WCP4ValidateAppIdentity': return this.handleValidate(msg as WebConnectionProtocol4ValidateAppIdentity, sc, uuid) + case 'openRequest': + return this.open(msg as OpenRequest, sc, from); + case 'findInstancesRequest': + return this.findInstances(msg as FindInstancesRequest, sc, from); + case 'getAppMetadataRequest': + return this.getAppMetadata(msg as GetAppMetadataRequest, sc, from); } - - const from = sc.getInstanceDetails(uuid) - try { - if (from) { - switch (msg.type as string) { - case 'openRequest': return this.open(msg as OpenRequest, sc, from) - case 'findInstancesRequest': return this.findInstances(msg as FindInstancesRequest, sc, from) - case 'getAppMetadataRequest': return this.getAppMetadata(msg as GetAppMetadataRequest, sc, from) - } - } - } catch (e: any) { - const responseType = msg.type.replace(new RegExp("Request$"), 'Response') - errorResponse(sc, msg, from!!, e.message ?? e, responseType) - } - + } + } catch (e: any) { + const responseType = msg.type.replace(new RegExp('Request$'), 'Response'); + errorResponse(sc, msg, from!!, e.message ?? e, responseType); } - - /** - * This deals with sending pending context to listeners of newly-opened apps. - */ - handleAddContextListener(arg0: AddContextListenerRequest, sc: ServerContext, from: InstanceID): void { - const pendingOpen = this.pending.get(from) - - if (pendingOpen) { - const channelId = arg0.payload.channelId!! - const contextType = arg0.payload.contextType - - if ((pendingOpen.context) && (pendingOpen.state == AppState.DeliveringContext)) { - if ((contextType == pendingOpen.context.type) || (contextType == undefined)) { - // ok, we can deliver to this listener - - const message: BroadcastEvent = { - meta: { - eventUuid: sc.createUUID(), - timestamp: new Date() - }, - type: "broadcastEvent", - payload: { - channelId, - context: pendingOpen.context, - originatingApp: { - appId: pendingOpen.source.appId, - instanceId: pendingOpen.source.instanceId - } - } - } - - pendingOpen.setDone() - this.pending.delete(from) - sc.post(message, arg0.meta.source?.instanceId!!) - } - } + } + + /** + * This deals with sending pending context to listeners of newly-opened apps. + */ + handleAddContextListener( + arg0: AddContextListenerRequest, + sc: ServerContext, + from: InstanceID + ): void { + const pendingOpen = this.pending.get(from); + + if (pendingOpen) { + const channelId = arg0.payload.channelId!!; + const contextType = arg0.payload.contextType; + + if (pendingOpen.context && pendingOpen.state == AppState.DeliveringContext) { + if (contextType == pendingOpen.context.type || contextType == undefined) { + // ok, we can deliver to this listener + + const message: BroadcastEvent = { + meta: { + eventUuid: sc.createUUID(), + timestamp: new Date(), + }, + type: 'broadcastEvent', + payload: { + channelId, + context: pendingOpen.context, + originatingApp: { + appId: pendingOpen.source.appId, + instanceId: pendingOpen.source.instanceId, + }, + }, + }; + + pendingOpen.setDone(); + this.pending.delete(from); + sc.post(message, arg0.meta.source?.instanceId!!); } + } } - - filterPublicDetails(appD: DirectoryApp, appID: AppIdentifier): AppMetadata { + } + + filterPublicDetails(appD: DirectoryApp, appID: AppIdentifier): AppMetadata { + return { + appId: appD.appId, + name: appD.name, + version: appD.version, + title: appD.title, + tooltip: appD.tooltip, + description: appD.description, + icons: appD.icons, + screenshots: appD.screenshots, + instanceId: appID.instanceId, + }; + } + + getAppMetadata(arg0: GetAppMetadataRequest, sc: ServerContext, from: AppIdentifier): void { + const appID = arg0.payload.app; + const details = this.directory.retrieveAppsById(appID.appId); + if (details.length > 0) { + successResponse( + sc, + arg0, + from, + { + appMetadata: this.filterPublicDetails(details[0], appID), + }, + 'getAppMetadataResponse' + ); + } else { + errorResponse(sc, arg0, from, ResolveError.TargetAppUnavailable, 'getAppMetadataResponse'); + } + } + + async findInstances( + arg0: FindInstancesRequest, + sc: ServerContext, + from: AppIdentifier + ): Promise { + const appId = arg0.payload.app.appId; + const openApps = await sc.getConnectedApps(); + const matching = openApps + .filter(a => a.appId == appId) + .map(a => { return { - appId: appD.appId, - name: appD.name, - version: appD.version, - title: appD.title, - tooltip: appD.tooltip, - description: appD.description, - icons: appD.icons, - screenshots: appD.screenshots, - instanceId: appID.instanceId - } + appId: a.appId, + instanceId: a.instanceId, + }; + }); + successResponse( + sc, + arg0, + from, + { + appIdentifiers: matching, + }, + 'findInstancesResponse' + ); + } + + async open(arg0: OpenRequest, sc: ServerContext, from: AppIdentifier): Promise { + const source = arg0.payload.app; + const context = arg0.payload.context; + + try { + const uuid = await sc.open(source.appId); + this.pending.set(uuid, new PendingApp(sc, arg0, context, from, this.timeoutMs)); + } catch (e: any) { + errorResponse(sc, arg0, from, e.message, 'openResponse'); } - - getAppMetadata(arg0: GetAppMetadataRequest, sc: ServerContext, from: AppIdentifier): void { - const appID = arg0.payload.app - const details = this.directory.retrieveAppsById(appID.appId) - if (details.length > 0) { - successResponse(sc, arg0, from, { - appMetadata: this.filterPublicDetails(details[0], appID) - }, 'getAppMetadataResponse') - } else { - errorResponse(sc, arg0, from, ResolveError.TargetAppUnavailable, 'getAppMetadataResponse') - } + } + + async handleValidate( + arg0: WebConnectionProtocol4ValidateAppIdentity, + sc: ServerContext, + from: InstanceID + ): Promise { + const _this = this; + + const responseMeta = { + connectionAttemptUuid: arg0.meta.connectionAttemptUuid, + timestamp: new Date(), + }; + + function returnError() { + const message: WebConnectionProtocol5ValidateAppIdentityFailedResponse = { + meta: responseMeta, + type: 'WCP5ValidateAppIdentityFailedResponse', + payload: { + message: 'App Instance not found', + }, + }; + sc.post(message, from); } - - async findInstances(arg0: FindInstancesRequest, sc: ServerContext, from: AppIdentifier): Promise { - const appId = arg0.payload.app.appId - const openApps = await sc.getConnectedApps() - const matching = openApps.filter(a => a.appId == appId).map(a => { - return { - appId: a.appId, - instanceId: a.instanceId - } - }) - successResponse(sc, arg0, from, { - appIdentifiers: matching - }, 'findInstancesResponse') + function returnSuccess(appIdentity: AppIdentifier) { + if (!appIdentity.instanceId) { + throw new Error("App does not include an instanceId, can't "); + } + const aopMetadata = _this.filterPublicDetails( + _this.directory.retrieveAppsById(appIdentity.appId)[0], + appIdentity + ); + const message: WebConnectionProtocol5ValidateAppIdentitySuccessResponse = { + meta: responseMeta, + type: 'WCP5ValidateAppIdentityResponse', + payload: { + appId: appIdentity.appId, + instanceId: appIdentity.instanceId, + instanceUuid: from, + implementationMetadata: { + provider: sc.provider(), + providerVersion: sc.providerVersion(), + fdc3Version: sc.fdc3Version(), + optionalFeatures: { + DesktopAgentBridging: false, + OriginatingAppMetadata: true, + UserChannelMembershipAPIs: true, + }, + appMetadata: aopMetadata, + }, + }, + }; + sc.post(message, appIdentity.instanceId!!); } - async open(arg0: OpenRequest, sc: ServerContext, from: AppIdentifier): Promise { - - const source = arg0.payload.app - const context = arg0.payload.context - - try { - const uuid = await sc.open(source.appId) - this.pending.set(uuid, new PendingApp(sc, arg0, context, from, this.timeoutMs)) - } catch (e: any) { - errorResponse(sc, arg0, from, e.message, 'openResponse') - } + if (arg0.payload.instanceUuid) { + // existing app reconnecting + const appIdentity = sc.getInstanceDetails(arg0.payload.instanceUuid); + + if (appIdentity) { + // in this case, the app is reconnecting, so let's just re-assign the + // identity + sc.setInstanceDetails(from, appIdentity); + sc.setAppState(from, State.Connected); + return returnSuccess(appIdentity); + } } - async handleValidate(arg0: WebConnectionProtocol4ValidateAppIdentity, sc: ServerContext, from: InstanceID): Promise { - const _this = this - - const responseMeta = { - connectionAttemptUuid: arg0.meta.connectionAttemptUuid, - timestamp: new Date() + // we need to assign an identity to this app + const appIdentity = sc.getInstanceDetails(from); + if (appIdentity) { + sc.setAppState(appIdentity.instanceId, State.Connected); + returnSuccess(appIdentity); + + // make sure if the opener is listening for this app to open gets informed + const pendingOpen = this.pending.get(from); + if (pendingOpen) { + if (pendingOpen.state == AppState.Opening) { + pendingOpen.setOpened(appIdentity); } - - function returnError() { - const message: WebConnectionProtocol5ValidateAppIdentityFailedResponse = { - meta: responseMeta, - type: 'WCP5ValidateAppIdentityFailedResponse', - payload: { - message: 'App Instance not found' - } - } - sc.post(message, from) - } - - function returnSuccess(appIdentity: AppIdentifier) { - if(!appIdentity.instanceId){ - throw new Error("App does not include an instanceId, can't ") - } - const aopMetadata = _this.filterPublicDetails(_this.directory.retrieveAppsById(appIdentity.appId)[0], appIdentity) - const message: WebConnectionProtocol5ValidateAppIdentitySuccessResponse = { - meta: responseMeta, - type: 'WCP5ValidateAppIdentityResponse', - payload: { - appId: appIdentity.appId, - instanceId: appIdentity.instanceId, - instanceUuid: from, - implementationMetadata: { - provider: sc.provider(), - providerVersion: sc.providerVersion(), - fdc3Version: sc.fdc3Version(), - optionalFeatures: { - DesktopAgentBridging: false, - OriginatingAppMetadata: true, - UserChannelMembershipAPIs: true - }, - appMetadata: aopMetadata - } - } - } - sc.post(message, appIdentity.instanceId!!) - } - - if (arg0.payload.instanceUuid) { - // existing app reconnecting - const appIdentity = sc.getInstanceDetails(arg0.payload.instanceUuid) - - if (appIdentity) { - // in this case, the app is reconnecting, so let's just re-assign the - // identity - sc.setInstanceDetails(from, appIdentity) - sc.setAppState(from, State.Connected) - return returnSuccess(appIdentity) - } - } - - // we need to assign an identity to this app - const appIdentity = sc.getInstanceDetails(from) - if (appIdentity) { - sc.setAppState(appIdentity.instanceId, State.Connected) - returnSuccess(appIdentity) - - // make sure if the opener is listening for this app to open gets informed - const pendingOpen = this.pending.get(from) - if (pendingOpen) { - if (pendingOpen.state == AppState.Opening) { - pendingOpen.setOpened(appIdentity) - } - } - } else { - returnError() - } - + } + } else { + returnError(); } -} \ No newline at end of file + } +} diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts index f8fe3889c..68f44a3ae 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/handlers/support.ts @@ -1,47 +1,77 @@ -import { AppRegistration, ServerContext } from "../ServerContext"; -import { BrowserTypes } from "@kite9/fdc3-schema"; -import { AppIdentifier } from "@kite9/fdc3-standard"; +import { AppRegistration, ServerContext } from '../ServerContext'; +import { BrowserTypes } from '@kite9/fdc3-schema'; +import { AppIdentifier } from '@kite9/fdc3-standard'; -type AppRequestMessage = BrowserTypes.AppRequestMessage -type AgentResponseMessage = BrowserTypes.AgentResponseMessage +type AppRequestMessage = BrowserTypes.AppRequestMessage; +type AgentResponseMessage = BrowserTypes.AgentResponseMessage; -export function successResponse(sc: ServerContext, request: AppRequestMessage, to: AppIdentifier, payload: any, type: string) { - return successResponseId(sc, request.meta.requestUuid, to, payload, type); +export function successResponse( + sc: ServerContext, + request: AppRequestMessage, + to: AppIdentifier, + payload: any, + type: string +) { + return successResponseId(sc, request.meta.requestUuid, to, payload, type); } -export function errorResponse(sc: ServerContext, request: AppRequestMessage, to: AppIdentifier, error: string, type: string) { - return errorResponseId(sc, request.meta.requestUuid, to, error, type); +export function errorResponse( + sc: ServerContext, + request: AppRequestMessage, + to: AppIdentifier, + error: string, + type: string +) { + return errorResponseId(sc, request.meta.requestUuid, to, error, type); } -export function successResponseId(sc: ServerContext, requestId: string, to: AppIdentifier, payload: any, type: string) { - sc.post({ - meta: { - responseUuid: sc.createUUID(), - requestUuid: requestId, - timestamp: new Date() - }, - type, - payload, - } as AgentResponseMessage, to.instanceId!!) +export function successResponseId( + sc: ServerContext, + requestId: string, + to: AppIdentifier, + payload: any, + type: string +) { + sc.post( + { + meta: { + responseUuid: sc.createUUID(), + requestUuid: requestId, + timestamp: new Date(), + }, + type, + payload, + } as AgentResponseMessage, + to.instanceId!! + ); } -export function errorResponseId(sc: ServerContext, requestId: string, to: AppIdentifier, error: string, type: string) { - sc.post({ - meta: { - responseUuid: sc.createUUID(), - requestUuid: requestId, - timestamp: new Date() - }, - type, - payload: { - error - }, - } as AgentResponseMessage, to.instanceId!!) +export function errorResponseId( + sc: ServerContext, + requestId: string, + to: AppIdentifier, + error: string, + type: string +) { + sc.post( + { + meta: { + responseUuid: sc.createUUID(), + requestUuid: requestId, + timestamp: new Date(), + }, + type, + payload: { + error, + }, + } as AgentResponseMessage, + to.instanceId!! + ); } -/* +/* * from: https://stackoverflow.com/questions/1960473/get-all-unique-values-in-a-javascript-array-remove-duplicates#14438954 */ export function onlyUnique(value: any, index: any, self: any) { - return self.indexOf(value) === index; + return self.indexOf(value) === index; } diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts b/toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts index 850b562e4..1fef23ec3 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/src/index.ts @@ -1,28 +1,28 @@ -import { ServerContext, InstanceID, State, AppRegistration, } from "./ServerContext" -import { BasicFDC3Server, DefaultFDC3Server } from "./BasicFDC3Server" -import { FDC3Server } from "./FDC3Server" -import { Directory, DirectoryApp, DirectoryIntent, WebAppDetails } from "./directory/DirectoryInterface" -import { BasicDirectory } from "./directory/BasicDirectory" -import { BroadcastHandler, ChannelState, ChannelType } from "./handlers/BroadcastHandler" -import { IntentHandler } from "./handlers/IntentHandler" -import { OpenHandler } from "./handlers/OpenHandler" +import { ServerContext, InstanceID, State, AppRegistration } from './ServerContext'; +import { BasicFDC3Server, DefaultFDC3Server } from './BasicFDC3Server'; +import { FDC3Server } from './FDC3Server'; +import { Directory, DirectoryApp, DirectoryIntent, WebAppDetails } from './directory/DirectoryInterface'; +import { BasicDirectory } from './directory/BasicDirectory'; +import { BroadcastHandler, ChannelState, ChannelType } from './handlers/BroadcastHandler'; +import { IntentHandler } from './handlers/IntentHandler'; +import { OpenHandler } from './handlers/OpenHandler'; export { - type InstanceID, - type ServerContext, - State, - type AppRegistration, - BasicFDC3Server, - DefaultFDC3Server, - type FDC3Server, - type Directory, - BasicDirectory, - type DirectoryApp, - type DirectoryIntent, - BroadcastHandler, - ChannelState, - IntentHandler, - OpenHandler, - ChannelType, - type WebAppDetails -} \ No newline at end of file + type InstanceID, + type ServerContext, + State, + type AppRegistration, + BasicFDC3Server, + DefaultFDC3Server, + type FDC3Server, + type Directory, + BasicDirectory, + type DirectoryApp, + type DirectoryIntent, + BroadcastHandler, + ChannelState, + IntentHandler, + OpenHandler, + ChannelType, + type WebAppDetails, +}; diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/app-channel.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/app-channel.steps.ts index a99e94d00..455ed05ab 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/app-channel.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/app-channel.steps.ts @@ -1,20 +1,23 @@ -import { When } from '@cucumber/cucumber' +import { When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { createMeta } from './generic.steps'; -import { handleResolve } from "@kite9/testing"; +import { handleResolve } from '@kite9/testing'; import { BrowserTypes } from '@kite9/fdc3-schema'; -type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest +type GetOrCreateChannelRequest = BrowserTypes.GetOrCreateChannelRequest; -When('{string} creates or gets an app channel called {string}', function (this: CustomWorld, app: string, channel: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} creates or gets an app channel called {string}', + function (this: CustomWorld, app: string, channel: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - channelId: handleResolve(channel, this) - }, - type: 'getOrCreateChannelRequest' - } as GetOrCreateChannelRequest + meta, + payload: { + channelId: handleResolve(channel, this), + }, + type: 'getOrCreateChannelRequest', + } as GetOrCreateChannelRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); + } +); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/broadcast.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/broadcast.steps.ts index 8d96c297d..f2d07e903 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/broadcast.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/broadcast.steps.ts @@ -1,75 +1,82 @@ -import { When } from '@cucumber/cucumber' +import { When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { createMeta } from './generic.steps'; -import { } from '@kite9/fdc3-standard'; -import { handleResolve } from "@kite9/testing"; +import {} from '@kite9/fdc3-standard'; +import { handleResolve } from '@kite9/testing'; import { contextMap } from './generic.steps'; import { BrowserTypes } from '@kite9/fdc3-schema'; -type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest -type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest -type BroadcastRequest = BrowserTypes.BroadcastRequest -type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest +type AddContextListenerRequest = BrowserTypes.AddContextListenerRequest; +type ContextListenerUnsubscribeRequest = BrowserTypes.ContextListenerUnsubscribeRequest; +type BroadcastRequest = BrowserTypes.BroadcastRequest; +type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest; -When('{string} adds a context listener on {string} with type {string}', function (this: CustomWorld, app: string, channelId: string, contextType: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: { - channelId: handleResolve(channelId, this), - contextType: handleResolve(contextType, this) - }, - type: 'addContextListenerRequest' - } as AddContextListenerRequest +When( + '{string} adds a context listener on {string} with type {string}', + function (this: CustomWorld, app: string, channelId: string, contextType: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: { + channelId: handleResolve(channelId, this), + contextType: handleResolve(contextType, this), + }, + type: 'addContextListenerRequest', + } as AddContextListenerRequest; - this.server.receive(message, uuid) -}) - -When('{string} asks for the latest context on {string} with type {string}', function (this: CustomWorld, app: string, channelId: string, contextType: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: { - channelId: handleResolve(channelId, this), - contextType - }, - type: 'getCurrentContextRequest' - } as GetCurrentContextRequest + this.server.receive(message, uuid); + } +); - this.server.receive(message, uuid) -}) +When( + '{string} asks for the latest context on {string} with type {string}', + function (this: CustomWorld, app: string, channelId: string, contextType: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: { + channelId: handleResolve(channelId, this), + contextType, + }, + type: 'getCurrentContextRequest', + } as GetCurrentContextRequest; + this.server.receive(message, uuid); + } +); When('{string} removes context listener with id {string}', function (this: CustomWorld, app: string, id: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { meta, payload: { - listenerUUID: id + listenerUUID: id, }, - type: 'contextListenerUnsubscribeRequest' - } as ContextListenerUnsubscribeRequest + type: 'contextListenerUnsubscribeRequest', + } as ContextListenerUnsubscribeRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); -When('{string} broadcasts {string} on {string}', function (this: CustomWorld, app: string, contextType: string, channelId: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - - const message = { - meta, - payload: { - channelId: handleResolve(channelId, this), - context: contextMap[contextType] - }, - type: 'broadcastRequest' - } as BroadcastRequest +When( + '{string} broadcasts {string} on {string}', + function (this: CustomWorld, app: string, contextType: string, channelId: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; - this.server.receive(message, uuid) + const message = { + meta, + payload: { + channelId: handleResolve(channelId, this), + context: contextMap[contextType], + }, + type: 'broadcastRequest', + } as BroadcastRequest; -}) + this.server.receive(message, uuid); + } +); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/generic.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/generic.steps.ts index 3b0784626..d701688a7 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/generic.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/generic.steps.ts @@ -1,109 +1,108 @@ -import { Given, When } from '@cucumber/cucumber' +import { Given, When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { TestServerContext } from '../support/TestServerContext'; import { DefaultFDC3Server } from '../../src/BasicFDC3Server'; import { BasicDirectory } from '../../src/directory/BasicDirectory'; import { ChannelType } from '../../src/handlers/BroadcastHandler'; -export const APP_FIELD = 'apps' +export const APP_FIELD = 'apps'; export const contextMap: Record = { - "fdc3.instrument": { - "type": "fdc3.instrument", - "name": "Apple", - "id": { - "ticker": "AAPL" - } + 'fdc3.instrument': { + type: 'fdc3.instrument', + name: 'Apple', + id: { + ticker: 'AAPL', }, - "fdc3.country": { - "type": "fdc3.country", - "name": "Sweden", - "id": { - "COUNTRY_ISOALPHA2": "SE", - "COUNTRY_ISOALPHA3": "SWE", - } + }, + 'fdc3.country': { + type: 'fdc3.country', + name: 'Sweden', + id: { + COUNTRY_ISOALPHA2: 'SE', + COUNTRY_ISOALPHA3: 'SWE', }, - "fdc3.unsupported": { - "type": "fdc3.unsupported", - "bogus": true + }, + 'fdc3.unsupported': { + type: 'fdc3.unsupported', + bogus: true, + }, + 'fdc3.book': { + type: 'fdc3.book', + author: 'Greg Wallace', + title: 'Cooking with Greg', + id: { + ISBN: '1234', }, - "fdc3.book": { - "type": "fdc3.book", - "author": "Greg Wallace", - "title": "Cooking with Greg", - "id": { - "ISBN": "1234" - } + }, + 'fdc3.magazine': { + type: 'fdc3.magazine', + title: 'The Economist', + price: 3.99, + id: { + ISSN: '1234', }, - "fdc3.magazine": { - "type": "fdc3.magazine", - "title": "The Economist", - "price": 3.99, - "id": { - "ISSN": "1234" - } - } -} + }, +}; function defaultChannels() { - return [ - { - id: 'one', - type: ChannelType.user, - context: [], - displayMetadata: { - name: 'One Channel', - color: 'orange' - } - }, - { - id: 'two', - type: ChannelType.user, - context: [], - displayMetadata: { - name: 'Two Channel', - color: 'skyblue' - } - }, - { - id: 'three', - type: ChannelType.user, - context: [], - displayMetadata: { - name: 'Three Channel', - color: 'ochre' - } - } - ] + return [ + { + id: 'one', + type: ChannelType.user, + context: [], + displayMetadata: { + name: 'One Channel', + color: 'orange', + }, + }, + { + id: 'two', + type: ChannelType.user, + context: [], + displayMetadata: { + name: 'Two Channel', + color: 'skyblue', + }, + }, + { + id: 'three', + type: ChannelType.user, + context: [], + displayMetadata: { + name: 'Three Channel', + color: 'ochre', + }, + }, + ]; } export function createMeta(cw: CustomWorld, appStr: string) { - const [appId, instanceId] = appStr.split("/") - const app = { appId, instanceId } + const [appId, instanceId] = appStr.split('/'); + const app = { appId, instanceId }; - return { - "requestUuid": cw.sc.createUUID(), - "timestamp": new Date(), - "source": app - } + return { + requestUuid: cw.sc.createUUID(), + timestamp: new Date(), + source: app, + }; } Given('A newly instantiated FDC3 Server', function (this: CustomWorld) { - const apps = this.props[APP_FIELD] ?? [] - const d = new BasicDirectory(apps) - this.sc = new TestServerContext(this) - this.server = new DefaultFDC3Server(this.sc, d, defaultChannels(), false, 2000, 2000) + const apps = this.props[APP_FIELD] ?? []; + const d = new BasicDirectory(apps); + this.sc = new TestServerContext(this); + this.server = new DefaultFDC3Server(this.sc, d, defaultChannels(), false, 2000, 2000); }); Given('A newly instantiated FDC3 Server with heartbeat checking', function (this: CustomWorld) { - const apps = this.props[APP_FIELD] ?? [] - const d = new BasicDirectory(apps) - + const apps = this.props[APP_FIELD] ?? []; + const d = new BasicDirectory(apps); - this.sc = new TestServerContext(this) - this.server = new DefaultFDC3Server(this.sc, d, defaultChannels(), true, 2000, 2000) + this.sc = new TestServerContext(this); + this.server = new DefaultFDC3Server(this.sc, d, defaultChannels(), true, 2000, 2000); }); -When("I shutdown the server", function (this: CustomWorld) { - this.server.shutdown() -}) +When('I shutdown the server', function (this: CustomWorld) { + this.server.shutdown(); +}); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/heartbeat.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/heartbeat.steps.ts index eadfbaec3..895257aec 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/heartbeat.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/heartbeat.steps.ts @@ -1,31 +1,34 @@ -import { Given, Then } from "@cucumber/cucumber"; -import { CustomWorld } from "../world"; -import { HeartbeatAcknowledgementRequest } from "@kite9/fdc3-schema/generated/api/BrowserTypes"; -import { createMeta } from "./generic.steps"; -import { HeartbeatHandler } from "../../src/handlers/HeartbeatHandler"; +import { Given, Then } from '@cucumber/cucumber'; +import { CustomWorld } from '../world'; +import { HeartbeatAcknowledgementRequest } from '@kite9/fdc3-schema/generated/api/BrowserTypes'; +import { createMeta } from './generic.steps'; +import { HeartbeatHandler } from '../../src/handlers/HeartbeatHandler'; -Given('{string} sends a heartbeat response to eventUuid {string}', function (this: CustomWorld, appStr: string, eventUuid: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! +Given( + '{string} sends a heartbeat response to eventUuid {string}', + function (this: CustomWorld, appStr: string, eventUuid: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - heartbeatEventUuid: eventUuid - }, - type: 'heartbeatAcknowledgementRequest' - } as HeartbeatAcknowledgementRequest + meta, + payload: { + heartbeatEventUuid: eventUuid, + }, + type: 'heartbeatAcknowledgementRequest', + } as HeartbeatAcknowledgementRequest; - this.server.receive(message, uuid) -}); + this.server.receive(message, uuid); + } +); Then('I test the liveness of {string}', async function (this: CustomWorld, appStr: string) { - const out = await this.sc.isAppConnected(createMeta(this, appStr).source.instanceId) - this.props["result"] = out -}) + const out = await this.sc.isAppConnected(createMeta(this, appStr).source.instanceId); + this.props['result'] = out; +}); -Then("I get the heartbeat times", async function (this: CustomWorld) { - const hbh = this.server.handlers[3] - const out = (hbh as HeartbeatHandler).heartbeatTimes() - this.props["result"] = out -}) \ No newline at end of file +Then('I get the heartbeat times', async function (this: CustomWorld) { + const hbh = this.server.handlers[3]; + const out = (hbh as HeartbeatHandler).heartbeatTimes(); + this.props['result'] = out; +}); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/intents.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/intents.steps.ts index 189e74b20..099423bb2 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/intents.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/intents.steps.ts @@ -1,279 +1,331 @@ -import { DataTable, Given, When } from "@cucumber/cucumber"; -import { CustomWorld } from "../world"; -import { DirectoryApp } from "../../src/directory/DirectoryInterface"; -import { APP_FIELD, contextMap, createMeta } from "./generic.steps"; -import { handleResolve } from "@kite9/testing"; +import { DataTable, Given, When } from '@cucumber/cucumber'; +import { CustomWorld } from '../world'; +import { DirectoryApp } from '../../src/directory/DirectoryInterface'; +import { APP_FIELD, contextMap, createMeta } from './generic.steps'; +import { handleResolve } from '@kite9/testing'; import { BrowserTypes } from '@kite9/fdc3-schema'; -type FindIntentRequest = BrowserTypes.FindIntentRequest -type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest -type AddIntentListenerRequest = BrowserTypes.AddIntentListenerRequest -type IntentListenerUnsubscribeRequest = BrowserTypes.IntentListenerUnsubscribeRequest -type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest -type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest -type IntentResultRequest = BrowserTypes.IntentResultRequest +type FindIntentRequest = BrowserTypes.FindIntentRequest; +type FindIntentsByContextRequest = BrowserTypes.FindIntentsByContextRequest; +type AddIntentListenerRequest = BrowserTypes.AddIntentListenerRequest; +type IntentListenerUnsubscribeRequest = BrowserTypes.IntentListenerUnsubscribeRequest; +type RaiseIntentRequest = BrowserTypes.RaiseIntentRequest; +type RaiseIntentForContextRequest = BrowserTypes.RaiseIntentForContextRequest; +type IntentResultRequest = BrowserTypes.IntentResultRequest; type ListensFor = { - [key: string]: { - displayName?: string | undefined; - contexts: string[]; - resultType?: string | undefined; - }; -} + [key: string]: { + displayName?: string | undefined; + contexts: string[]; + resultType?: string | undefined; + }; +}; function decamelize(str: string, separator: string) { - separator = typeof separator === 'undefined' ? '_' : separator; + separator = typeof separator === 'undefined' ? '_' : separator; - return str - .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') - .toLowerCase(); + return str + .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') + .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') + .toLowerCase(); } function convertDataTableToListensFor(cw: CustomWorld, dt: DataTable): ListensFor { - const hashes = dt.hashes() - const out: { [key: string]: any } = {} - hashes.forEach(h => { - out[h["Intent Name"]] = { - displayName: decamelize(h["Intent Name"], " "), - contexts: [handleResolve(h["Context Type"], cw)], - resultType: handleResolve(h["Result Type"], cw) - } - }) - - return out + const hashes = dt.hashes(); + const out: { [key: string]: any } = {}; + hashes.forEach(h => { + out[h['Intent Name']] = { + displayName: decamelize(h['Intent Name'], ' '), + contexts: [handleResolve(h['Context Type'], cw)], + resultType: handleResolve(h['Result Type'], cw), + }; + }); + + return out; } Given('{string} is an app with the following intents', function (this: CustomWorld, appId: string, dt: DataTable) { - - const currentApps = this.props[APP_FIELD] ?? [] - - const newApp: DirectoryApp = { - appId, - type: "web", - description: "", - title: "", - details: {}, - interop: { - intents: { - listensFor: convertDataTableToListensFor(this, dt) - } - } - } - - currentApps.push(newApp) - - this.props[APP_FIELD] = currentApps - + const currentApps = this.props[APP_FIELD] ?? []; + + const newApp: DirectoryApp = { + appId, + type: 'web', + description: '', + title: '', + details: {}, + interop: { + intents: { + listensFor: convertDataTableToListensFor(this, dt), + }, + }, + }; + + currentApps.push(newApp); + + this.props[APP_FIELD] = currentApps; }); -When('{string} finds intents with intent {string} and contextType {string} and result type {string}', function (this: CustomWorld, appStr: string, intentName: string, contextType: string, resultType: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} finds intents with intent {string} and contextType {string} and result type {string}', + function (this: CustomWorld, appStr: string, intentName: string, contextType: string, resultType: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - intent: handleResolve(intentName, this)!!, - resultType: handleResolve(resultType, this), - context: contextMap[contextType] - }, - type: 'findIntentRequest' - } as FindIntentRequest - - this.server.receive(message, uuid) -}); - -When('{string} finds intents with contextType {string}', function (this: CustomWorld, appStr: string, contextType: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + meta, + payload: { + intent: handleResolve(intentName, this)!!, + resultType: handleResolve(resultType, this), + context: contextMap[contextType], + }, + type: 'findIntentRequest', + } as FindIntentRequest; + + this.server.receive(message, uuid); + } +); + +When( + '{string} finds intents with contextType {string}', + function (this: CustomWorld, appStr: string, contextType: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - context: contextMap[contextType] - }, - type: 'findIntentsByContextRequest' - } as FindIntentsByContextRequest - - this.server.receive(message, uuid) -}); - -Given('{string} registers an intent listener for {string}', function (this: CustomWorld, appStr: string, intent: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + meta, + payload: { + context: contextMap[contextType], + }, + type: 'findIntentsByContextRequest', + } as FindIntentsByContextRequest; + + this.server.receive(message, uuid); + } +); + +Given( + '{string} registers an intent listener for {string}', + function (this: CustomWorld, appStr: string, intent: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - type: 'addIntentListenerRequest', - meta, - payload: { - intent: handleResolve(intent, this) - } - } as AddIntentListenerRequest - this.server.receive(message, uuid) -}); - -Given('{string} registers an intent listener for {string} with contextType {string}', function (this: CustomWorld, appStr: string, intent: string, contextType: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + type: 'addIntentListenerRequest', + meta, + payload: { + intent: handleResolve(intent, this), + }, + } as AddIntentListenerRequest; + this.server.receive(message, uuid); + } +); + +Given( + '{string} registers an intent listener for {string} with contextType {string}', + function (this: CustomWorld, appStr: string, intent: string, contextType: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - type: 'addIntentListenerRequest', - meta, - payload: { - intent: handleResolve(intent, this), - contextType: handleResolve(contextType, this) - } - } as AddIntentListenerRequest - this.server.receive(message, uuid) -}); - - -Given('{string} unsubscribes an intent listener with id {string}', function (this: CustomWorld, appStr: string, id: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + type: 'addIntentListenerRequest', + meta, + payload: { + intent: handleResolve(intent, this), + contextType: handleResolve(contextType, this), + }, + } as AddIntentListenerRequest; + this.server.receive(message, uuid); + } +); + +Given( + '{string} unsubscribes an intent listener with id {string}', + function (this: CustomWorld, appStr: string, id: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - type: 'intentListenerUnsubscribeRequest', - meta, - payload: { - listenerUUID: handleResolve(id, this), - } - } as IntentListenerUnsubscribeRequest - this.server.receive(message, uuid) -}); - -function raise(cw: CustomWorld, intentName: string, contextType: string, dest: string | null, meta: any): RaiseIntentRequest { - const destMeta = dest != null ? createMeta(cw, dest) : null - const message = { - type: 'raiseIntentRequest', - meta: { - ...meta, - }, - payload: { - intent: handleResolve(intentName, cw), - context: contextMap[contextType], - app: dest ? destMeta!!.source : null - } - } as RaiseIntentRequest - return message; + type: 'intentListenerUnsubscribeRequest', + meta, + payload: { + listenerUUID: handleResolve(id, this), + }, + } as IntentListenerUnsubscribeRequest; + this.server.receive(message, uuid); + } +); + +function raise( + cw: CustomWorld, + intentName: string, + contextType: string, + dest: string | null, + meta: any +): RaiseIntentRequest { + const destMeta = dest != null ? createMeta(cw, dest) : null; + const message = { + type: 'raiseIntentRequest', + meta: { + ...meta, + }, + payload: { + intent: handleResolve(intentName, cw), + context: contextMap[contextType], + app: dest ? destMeta!!.source : null, + }, + } as RaiseIntentRequest; + return message; } -function raiseWithContext(cw: CustomWorld, contextType: string, dest: string | null, meta: any): RaiseIntentForContextRequest { - const destMeta = dest != null ? createMeta(cw, dest) : null - const message = { - type: 'raiseIntentForContextRequest', - meta: { - ...meta, - }, - payload: { - context: contextMap[contextType], - app: dest ? destMeta!!.source : null - } - } as RaiseIntentForContextRequest - return message; +function raiseWithContext( + cw: CustomWorld, + contextType: string, + dest: string | null, + meta: any +): RaiseIntentForContextRequest { + const destMeta = dest != null ? createMeta(cw, dest) : null; + const message = { + type: 'raiseIntentForContextRequest', + meta: { + ...meta, + }, + payload: { + context: contextMap[contextType], + app: dest ? destMeta!!.source : null, + }, + } as RaiseIntentForContextRequest; + return message; } -When('{string} raises an intent with contextType {string}', function (this: CustomWorld, appStr: string, contextType: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = raiseWithContext(this, contextType, null, meta) - this.server.receive(message, uuid) -}); - -When('{string} raises an intent with contextType {string} on app {string}', function (this: CustomWorld, appStr: string, contextType: string, dest: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = raiseWithContext(this, contextType, dest, meta) - this.server.receive(message, uuid) -}); - -When('{string} raises an intent for {string} with contextType {string}', function (this: CustomWorld, appStr: string, intentName: string, contextType: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = raise(this, intentName, contextType, null, meta) - this.server.receive(message, uuid) -}); - -When('{string} raises an intent for {string} with contextType {string} on app {string}', function (this: CustomWorld, appStr: string, intentName: string, contextType: string, dest: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = raise(this, intentName, contextType, dest, meta) - this.server.receive(message, uuid) -}); - -When('{string} raises an intent for {string} with contextType {string} on app {string} with requestUuid {string}', function (this: CustomWorld, appStr: string, intentName: string, contextType: string, dest: string, requestUuid: string) { +When( + '{string} raises an intent with contextType {string}', + function (this: CustomWorld, appStr: string, contextType: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = raiseWithContext(this, contextType, null, meta); + this.server.receive(message, uuid); + } +); + +When( + '{string} raises an intent with contextType {string} on app {string}', + function (this: CustomWorld, appStr: string, contextType: string, dest: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = raiseWithContext(this, contextType, dest, meta); + this.server.receive(message, uuid); + } +); + +When( + '{string} raises an intent for {string} with contextType {string}', + function (this: CustomWorld, appStr: string, intentName: string, contextType: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = raise(this, intentName, contextType, null, meta); + this.server.receive(message, uuid); + } +); + +When( + '{string} raises an intent for {string} with contextType {string} on app {string}', + function (this: CustomWorld, appStr: string, intentName: string, contextType: string, dest: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = raise(this, intentName, contextType, dest, meta); + this.server.receive(message, uuid); + } +); + +When( + '{string} raises an intent for {string} with contextType {string} on app {string} with requestUuid {string}', + function ( + this: CustomWorld, + appStr: string, + intentName: string, + contextType: string, + dest: string, + requestUuid: string + ) { const meta = { - ...createMeta(this, appStr), requestUuid - } - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = raise(this, intentName, contextType, dest, meta) - this.server.receive(message, uuid) -}) - + ...createMeta(this, appStr), + requestUuid, + }; + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = raise(this, intentName, contextType, dest, meta); + this.server.receive(message, uuid); + } +); When('we wait for the intent timeout', function (this: CustomWorld) { - return new Promise((resolve, _reject) => { - setTimeout(() => resolve(), 2100) - }) + return new Promise((resolve, _reject) => { + setTimeout(() => resolve(), 2100); + }); }); -When('{string} sends a intentResultRequest with eventUuid {string} and contextType {string} and raiseIntentUuid {string}', function (this: CustomWorld, appStr: string, eventUuid: string, contextType: string, raiseIntentUuid: string) { - const meta = createMeta(this, appStr) - const uuid1 = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} sends a intentResultRequest with eventUuid {string} and contextType {string} and raiseIntentUuid {string}', + function (this: CustomWorld, appStr: string, eventUuid: string, contextType: string, raiseIntentUuid: string) { + const meta = createMeta(this, appStr); + const uuid1 = this.sc.getInstanceUUID(meta.source)!!; const message: IntentResultRequest = { - type: 'intentResultRequest', - meta: { - ...meta + type: 'intentResultRequest', + meta: { + ...meta, + }, + payload: { + intentResult: { + context: contextMap[contextType], }, - payload: { - intentResult: { - context: contextMap[contextType], - }, - intentEventUuid: eventUuid, - raiseIntentRequestUuid: raiseIntentUuid - } - } - this.server.receive(message, uuid1) -}) - - -When('{string} sends a intentResultRequest with eventUuid {string} and void contents and raiseIntentUuid {string}', function (this: CustomWorld, appStr: string, eventUuid: string, raiseIntentUuid: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + intentEventUuid: eventUuid, + raiseIntentRequestUuid: raiseIntentUuid, + }, + }; + this.server.receive(message, uuid1); + } +); + +When( + '{string} sends a intentResultRequest with eventUuid {string} and void contents and raiseIntentUuid {string}', + function (this: CustomWorld, appStr: string, eventUuid: string, raiseIntentUuid: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message: IntentResultRequest = { - type: 'intentResultRequest', - meta: { - ...meta - }, - payload: { - intentResult: { - }, - intentEventUuid: eventUuid, - raiseIntentRequestUuid: raiseIntentUuid - } - } - this.server.receive(message, uuid) -}) - -When('{string} sends a intentResultRequest with eventUuid {string} and private channel {string} and raiseIntentUuid {string}', function (this: CustomWorld, appStr: string, eventUuid: string, channelId: string, raiseIntentUuid: string) { - const meta = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(meta.source)!! + type: 'intentResultRequest', + meta: { + ...meta, + }, + payload: { + intentResult: {}, + intentEventUuid: eventUuid, + raiseIntentRequestUuid: raiseIntentUuid, + }, + }; + this.server.receive(message, uuid); + } +); + +When( + '{string} sends a intentResultRequest with eventUuid {string} and private channel {string} and raiseIntentUuid {string}', + function (this: CustomWorld, appStr: string, eventUuid: string, channelId: string, raiseIntentUuid: string) { + const meta = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message: IntentResultRequest = { - type: 'intentResultRequest', - meta: { - ...meta + type: 'intentResultRequest', + meta: { + ...meta, + }, + payload: { + intentResult: { + channel: { + type: 'private', + id: channelId, + }, }, - payload: { - intentResult: { - channel: { - type: 'private', - id: channelId - } - }, - intentEventUuid: eventUuid, - raiseIntentRequestUuid: raiseIntentUuid - } - } - this.server.receive(message, uuid) -}) + intentEventUuid: eventUuid, + raiseIntentRequestUuid: raiseIntentUuid, + }, + }; + this.server.receive(message, uuid); + } +); // When('{string} sends a intentResultRequest with eventUuid {string}', function (this: CustomWorld, appStr: string, requestUuid: string) { // const meta = createMeta(this, appStr) @@ -298,4 +350,4 @@ When('{string} sends a intentResultRequest with eventUuid {string} and private c // } as IntentResultRequest // this.server.receive(message, uuid) -// }); \ No newline at end of file +// }); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/messaging.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/messaging.steps.ts index 7bfc287a7..0601cd015 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/messaging.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/messaging.steps.ts @@ -1,21 +1,20 @@ -import { DataTable, Then } from '@cucumber/cucumber' +import { DataTable, Then } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; -import expect from "expect"; +import expect from 'expect'; import { setupGenericSteps, matchData } from '@kite9/testing'; - Then('messaging will have outgoing posts', function (this: CustomWorld, dt: DataTable) { // just take the last few posts and match those - const matching = dt.rows().length - var toUse = this.sc?.postedMessages + const matching = dt.rows().length; + var toUse = this.sc?.postedMessages; if (toUse.length > matching) { - toUse = toUse.slice(toUse.length - matching, toUse.length) + toUse = toUse.slice(toUse.length - matching, toUse.length); } - matchData(this, toUse, dt) -}) + matchData(this, toUse, dt); +}); Then('messaging will have {int} posts', function (this: CustomWorld, count: number) { - expect(this.sc.postedMessages.length).toEqual(count) -}) + expect(this.sc.postedMessages.length).toEqual(count); +}); -setupGenericSteps() \ No newline at end of file +setupGenericSteps(); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/private-channel.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/private-channel.steps.ts index 1e2978fc9..07017648b 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/private-channel.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/private-channel.steps.ts @@ -1,67 +1,72 @@ -import { When } from '@cucumber/cucumber' +import { When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { createMeta } from './generic.steps'; import { BrowserTypes } from '@kite9/fdc3-schema'; -import { handleResolve } from "@kite9/testing"; +import { handleResolve } from '@kite9/testing'; -type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest -type PrivateChannelAddEventListenerRequest = BrowserTypes.PrivateChannelAddEventListenerRequest -type PrivateChannelUnsubscribeEventListenerRequest = BrowserTypes.PrivateChannelUnsubscribeEventListenerRequest -type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest +type CreatePrivateChannelRequest = BrowserTypes.CreatePrivateChannelRequest; +type PrivateChannelAddEventListenerRequest = BrowserTypes.PrivateChannelAddEventListenerRequest; +type PrivateChannelUnsubscribeEventListenerRequest = BrowserTypes.PrivateChannelUnsubscribeEventListenerRequest; +type PrivateChannelDisconnectRequest = BrowserTypes.PrivateChannelDisconnectRequest; When('{string} creates a private channel', function (this: CustomWorld, app: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: {}, - type: 'createPrivateChannelRequest' - } as CreatePrivateChannelRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: {}, + type: 'createPrivateChannelRequest', + } as CreatePrivateChannelRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); When('{string} removes event listener {string}', function (this: CustomWorld, app: string, listenerUUID: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: { - listenerUUID - }, - type: 'privateChannelUnsubscribeEventListenerRequest' - } as PrivateChannelUnsubscribeEventListenerRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: { + listenerUUID, + }, + type: 'privateChannelUnsubscribeEventListenerRequest', + } as PrivateChannelUnsubscribeEventListenerRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); -When('{string} adds an {string} on {string}', function (this: CustomWorld, app: string, listenerType: string, channelId: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} adds an {string} on {string}', + function (this: CustomWorld, app: string, listenerType: string, channelId: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - privateChannelId: handleResolve(channelId, this), - listenerType - }, - type: 'privateChannelAddEventListenerRequest' - } as PrivateChannelAddEventListenerRequest - - this.server.receive(message, uuid) -}) + meta, + payload: { + privateChannelId: handleResolve(channelId, this), + listenerType, + }, + type: 'privateChannelAddEventListenerRequest', + } as PrivateChannelAddEventListenerRequest; + this.server.receive(message, uuid); + } +); -When('{string} disconnects from private channel {string}', function (this: CustomWorld, app: string, channelId: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} disconnects from private channel {string}', + function (this: CustomWorld, app: string, channelId: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - channelId: handleResolve(channelId, this), - }, - type: 'privateChannelDisconnectRequest' - } as PrivateChannelDisconnectRequest + meta, + payload: { + channelId: handleResolve(channelId, this), + }, + type: 'privateChannelDisconnectRequest', + } as PrivateChannelDisconnectRequest; - this.server.receive(message, uuid) -}) \ No newline at end of file + this.server.receive(message, uuid); + } +); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/start-app.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/start-app.steps.ts index c2e8b27ec..f57dec361 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/start-app.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/start-app.steps.ts @@ -1,136 +1,136 @@ -import { DataTable, Then, When } from '@cucumber/cucumber' +import { DataTable, Then, When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { contextMap, createMeta } from './generic.steps'; import { matchData } from '@kite9/testing'; import { BrowserTypes } from '@kite9/fdc3-schema'; import { State } from '../../src/ServerContext'; -type OpenRequest = BrowserTypes.OpenRequest -type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest -type FindInstancesRequest = BrowserTypes.FindInstancesRequest -type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity - +type OpenRequest = BrowserTypes.OpenRequest; +type GetAppMetadataRequest = BrowserTypes.GetAppMetadataRequest; +type FindInstancesRequest = BrowserTypes.FindInstancesRequest; +type WebConnectionProtocol4ValidateAppIdentity = BrowserTypes.WebConnectionProtocol4ValidateAppIdentity; When('{string} is opened with connection id {string}', function (this: CustomWorld, app: string, uuid: string) { - const meta = createMeta(this, app) + const meta = createMeta(this, app); this.sc.setInstanceDetails(uuid, { ...meta.source, - state: State.Connected - }) + state: State.Connected, + }); }); When('{string} is closed', function (this: CustomWorld, app: string) { - const meta = createMeta(this, app) - this.sc.disconnectApp(meta.source) + const meta = createMeta(this, app); + this.sc.disconnectApp(meta.source); }); When('{string} sends validate', function (this: CustomWorld, uuid: string) { - const identity = this.sc.getInstanceDetails(uuid) + const identity = this.sc.getInstanceDetails(uuid); const message: WebConnectionProtocol4ValidateAppIdentity = { type: 'WCP4ValidateAppIdentity', meta: { connectionAttemptUuid: this.sc.createUUID(), - timestamp: new Date() + timestamp: new Date(), }, payload: { - actualUrl: "something", - identityUrl: "something" - } - } - this.sc.setAppState(identity?.instanceId!!, State.Connected) - this.server.receive(message, uuid) + actualUrl: 'something', + identityUrl: 'something', + }, + }; + this.sc.setAppState(identity?.instanceId!!, State.Connected); + this.server.receive(message, uuid); }); When('{string} revalidates', function (this: CustomWorld, uuid: string) { - const message: WebConnectionProtocol4ValidateAppIdentity = { type: 'WCP4ValidateAppIdentity', meta: { connectionAttemptUuid: this.sc.createUUID(), - timestamp: new Date() + timestamp: new Date(), }, payload: { instanceUuid: uuid, - actualUrl: "something", - identityUrl: "something" - } - } + actualUrl: 'something', + identityUrl: 'something', + }, + }; - this.server.receive(message, uuid) + this.server.receive(message, uuid); }); Then('running apps will be', async function (this: CustomWorld, dataTable: DataTable) { - const apps = await this.sc.getConnectedApps() - matchData(this, apps, dataTable) + const apps = await this.sc.getConnectedApps(); + matchData(this, apps, dataTable); }); When('{string} opens app {string}', function (this: CustomWorld, appStr: string, open: string) { - const from = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(from.source)!! + const from = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(from.source)!!; const message: OpenRequest = { type: 'openRequest', meta: from, payload: { app: { appId: open, - desktopAgent: "n/a" + desktopAgent: 'n/a', }, - } - } - this.server.receive(message, uuid) + }, + }; + this.server.receive(message, uuid); }); -When('{string} opens app {string} with context data {string}', function (this: CustomWorld, appStr: string, open: string, context: string) { - const from = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(from.source)!! - const message: OpenRequest = { - type: 'openRequest', - meta: from, - payload: { - app: { - appId: open, - desktopAgent: "n/a" +When( + '{string} opens app {string} with context data {string}', + function (this: CustomWorld, appStr: string, open: string, context: string) { + const from = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(from.source)!!; + const message: OpenRequest = { + type: 'openRequest', + meta: from, + payload: { + app: { + appId: open, + desktopAgent: 'n/a', + }, + context: contextMap[context], }, - context: contextMap[context] - } + }; + this.server.receive(message, uuid); } - this.server.receive(message, uuid) -}); +); When('{string} requests metadata for {string}', function (this: CustomWorld, appStr: string, open: string) { - const from = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(from.source)!! + const from = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(from.source)!!; const message: GetAppMetadataRequest = { type: 'getAppMetadataRequest', meta: from, payload: { app: { appId: open, - desktopAgent: "n/a" - } - } - } - this.server.receive(message, uuid) + desktopAgent: 'n/a', + }, + }, + }; + this.server.receive(message, uuid); }); - When('{string} findsInstances of {string}', function (this: CustomWorld, appStr: string, open: string) { - const from = createMeta(this, appStr) - const uuid = this.sc.getInstanceUUID(from.source)!! + const from = createMeta(this, appStr); + const uuid = this.sc.getInstanceUUID(from.source)!!; const message: FindInstancesRequest = { type: 'findInstancesRequest', meta: from, payload: { app: { - appId: open - } - } - } - this.server.receive(message, uuid) + appId: open, + }, + }, + }; + this.server.receive(message, uuid); }); When('we wait for the listener timeout', function (this: CustomWorld) { return new Promise((resolve, _reject) => { - setTimeout(() => resolve(), 3100) - }) -}); \ No newline at end of file + setTimeout(() => resolve(), 3100); + }); +}); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/user-channel.steps.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/user-channel.steps.ts index db8837f10..5cc8d1307 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/user-channel.steps.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/step-definitions/user-channel.steps.ts @@ -1,77 +1,79 @@ -import { When } from '@cucumber/cucumber' +import { When } from '@cucumber/cucumber'; import { CustomWorld } from '../world'; import { createMeta } from './generic.steps'; import { BrowserTypes } from '@kite9/fdc3-schema'; -import { handleResolve } from "@kite9/testing"; - -type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest -type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest -type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest -type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest -type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest +import { handleResolve } from '@kite9/testing'; +type GetUserChannelsRequest = BrowserTypes.GetUserChannelsRequest; +type GetCurrentChannelRequest = BrowserTypes.GetCurrentChannelRequest; +type JoinUserChannelRequest = BrowserTypes.JoinUserChannelRequest; +type LeaveCurrentChannelRequest = BrowserTypes.LeaveCurrentChannelRequest; +type GetCurrentContextRequest = BrowserTypes.GetCurrentContextRequest; When('{string} gets the list of user channels', function (this: CustomWorld, app: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: {}, - type: 'getUserChannelsRequest' - } as GetUserChannelsRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: {}, + type: 'getUserChannelsRequest', + } as GetUserChannelsRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); When('{string} gets the current user channel', function (this: CustomWorld, app: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: {}, - type: 'getCurrentChannelRequest' - } as GetCurrentChannelRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: {}, + type: 'getCurrentChannelRequest', + } as GetCurrentChannelRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); When('{string} leaves user channel {string}', function (this: CustomWorld, app: string, _channel: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: {}, - type: 'leaveCurrentChannelRequest' - } as LeaveCurrentChannelRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: {}, + type: 'leaveCurrentChannelRequest', + } as LeaveCurrentChannelRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); When('{string} joins user channel {string}', function (this: CustomWorld, app: string, channel: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! - const message = { - meta, - payload: { - channelId: handleResolve(channel, this) - }, - type: 'joinUserChannelRequest' - } as JoinUserChannelRequest + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; + const message = { + meta, + payload: { + channelId: handleResolve(channel, this), + }, + type: 'joinUserChannelRequest', + } as JoinUserChannelRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); +}); -When('{string} gets the latest context on {string} with type {string}', function (this: CustomWorld, app: string, channel: string, type: string) { - const meta = createMeta(this, app) - const uuid = this.sc.getInstanceUUID(meta.source)!! +When( + '{string} gets the latest context on {string} with type {string}', + function (this: CustomWorld, app: string, channel: string, type: string) { + const meta = createMeta(this, app); + const uuid = this.sc.getInstanceUUID(meta.source)!!; const message = { - meta, - payload: { - channelId: handleResolve(channel, this), - contextType: handleResolve(type, this) - }, - type: 'getCurrentContextRequest' - } as GetCurrentContextRequest + meta, + payload: { + channelId: handleResolve(channel, this), + contextType: handleResolve(type, this), + }, + type: 'getCurrentContextRequest', + } as GetCurrentContextRequest; - this.server.receive(message, uuid) -}) + this.server.receive(message, uuid); + } +); diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/support/TestServerContext.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/support/TestServerContext.ts index 03f5a3853..904967cbc 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/support/TestServerContext.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/support/TestServerContext.ts @@ -1,129 +1,132 @@ -import { ServerContext, InstanceID, State, AppRegistration } from '../../src/ServerContext' -import { CustomWorld } from '../world' -import { Context } from '@kite9/fdc3-context' -import { OpenError, AppIdentifier, AppIntent } from '@kite9/fdc3-standard' +import { ServerContext, InstanceID, State, AppRegistration } from '../../src/ServerContext'; +import { CustomWorld } from '../world'; +import { Context } from '@kite9/fdc3-context'; +import { OpenError, AppIdentifier, AppIntent } from '@kite9/fdc3-standard'; type ConnectionDetails = AppRegistration & { - msg?: object -} + msg?: object; +}; type MessageRecord = { - to?: AppIdentifier, - uuid?: InstanceID, - msg: object -} + to?: AppIdentifier; + uuid?: InstanceID; + msg: object; +}; export class TestServerContext implements ServerContext { - - public postedMessages: MessageRecord[] = [] - private readonly cw: CustomWorld - private instances: ConnectionDetails[] = [] - private nextInstanceId: number = 0 - private nextUUID: number = 0 - - constructor(cw: CustomWorld) { - this.cw = cw - } - - async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { - return appIntents - } - - getInstanceDetails(uuid: string) { - return this.instances.find(ca => ca.instanceId === uuid) - } - - setInstanceDetails(uuid: InstanceID, appId: ConnectionDetails) { - if (uuid != appId.instanceId) { - throw new Error("UUID mismatch") - } - this.instances = this.instances.filter(ca => ca.instanceId !== uuid) - this.instances.push(appId) - } - - async disconnectApp(app: AppIdentifier): Promise { - this.instances = this.instances.filter(ca => ca.instanceId !== app.instanceId) - } - - async open(appId: string): Promise { - const ni = this.nextInstanceId++ - if (appId.includes("missing")) { - throw new Error(OpenError.AppNotFound) - } else { - const uuid = "uuid-" + ni - this.instances.push({ appId, instanceId: uuid, state: State.Pending }) - return uuid - } - } - - async setAppState(app: InstanceID, state: State): Promise { - const found = this.instances.find(a => a.instanceId == app) - if (found) { - found.state = state - } - } - - async getConnectedApps(): Promise { - return (await this.getAllApps()).filter(a => a.state == State.Connected) - } - - async getAllApps(): Promise { - return this.instances.map(x => { - return { - appId: x.appId, - instanceId: x.instanceId, - state: x.state - } - }) - } - - async isAppConnected(app: InstanceID): Promise { - const found = this.instances.find(a => (a.instanceId == app) && (a.state == State.Connected)) - return found != null - } - - provider(): string { - return "cucumber-provider" - } - providerVersion(): string { - return "1.2.3.TEST" - } - fdc3Version(): string { - return "2.0" - } - - createUUID(): string { - return "uuid" + this.nextUUID++ - } - - async post(msg: object, to: InstanceID): Promise { - if (to == null) { - this.postedMessages.push({ msg }) - } else { - const id = this.getInstanceDetails(to) - const app = id ? { - appId: id!!.appId, - instanceId: id!!.instanceId - } : undefined - this.postedMessages.push({ - msg, to: app, uuid: to - }) - } - } - - log(message: string): void { - this.cw.log(message) - } - - /** - * USED FOR TESTING - */ - getInstanceUUID(appId: AppIdentifier): InstanceID { - this.setInstanceDetails(appId.instanceId!!, { - appId: appId.appId, - instanceId: appId.instanceId!!, - state: State.Connected - }) - return appId.instanceId!! - } -} \ No newline at end of file + public postedMessages: MessageRecord[] = []; + private readonly cw: CustomWorld; + private instances: ConnectionDetails[] = []; + private nextInstanceId: number = 0; + private nextUUID: number = 0; + + constructor(cw: CustomWorld) { + this.cw = cw; + } + + async narrowIntents(_raiser: AppIdentifier, appIntents: AppIntent[], _context: Context): Promise { + return appIntents; + } + + getInstanceDetails(uuid: string) { + return this.instances.find(ca => ca.instanceId === uuid); + } + + setInstanceDetails(uuid: InstanceID, appId: ConnectionDetails) { + if (uuid != appId.instanceId) { + throw new Error('UUID mismatch'); + } + this.instances = this.instances.filter(ca => ca.instanceId !== uuid); + this.instances.push(appId); + } + + async disconnectApp(app: AppIdentifier): Promise { + this.instances = this.instances.filter(ca => ca.instanceId !== app.instanceId); + } + + async open(appId: string): Promise { + const ni = this.nextInstanceId++; + if (appId.includes('missing')) { + throw new Error(OpenError.AppNotFound); + } else { + const uuid = 'uuid-' + ni; + this.instances.push({ appId, instanceId: uuid, state: State.Pending }); + return uuid; + } + } + + async setAppState(app: InstanceID, state: State): Promise { + const found = this.instances.find(a => a.instanceId == app); + if (found) { + found.state = state; + } + } + + async getConnectedApps(): Promise { + return (await this.getAllApps()).filter(a => a.state == State.Connected); + } + + async getAllApps(): Promise { + return this.instances.map(x => { + return { + appId: x.appId, + instanceId: x.instanceId, + state: x.state, + }; + }); + } + + async isAppConnected(app: InstanceID): Promise { + const found = this.instances.find(a => a.instanceId == app && a.state == State.Connected); + return found != null; + } + + provider(): string { + return 'cucumber-provider'; + } + providerVersion(): string { + return '1.2.3.TEST'; + } + fdc3Version(): string { + return '2.0'; + } + + createUUID(): string { + return 'uuid' + this.nextUUID++; + } + + async post(msg: object, to: InstanceID): Promise { + if (to == null) { + this.postedMessages.push({ msg }); + } else { + const id = this.getInstanceDetails(to); + const app = id + ? { + appId: id!!.appId, + instanceId: id!!.instanceId, + } + : undefined; + this.postedMessages.push({ + msg, + to: app, + uuid: to, + }); + } + } + + log(message: string): void { + this.cw.log(message); + } + + /** + * USED FOR TESTING + */ + getInstanceUUID(appId: AppIdentifier): InstanceID { + this.setInstanceDetails(appId.instanceId!!, { + appId: appId.appId, + instanceId: appId.instanceId!!, + state: State.Connected, + }); + return appId.instanceId!!; + } +} diff --git a/toolbox/fdc3-for-web/fdc3-web-impl/test/world/index.ts b/toolbox/fdc3-for-web/fdc3-web-impl/test/world/index.ts index 2eaa83820..d37b030b6 100644 --- a/toolbox/fdc3-for-web/fdc3-web-impl/test/world/index.ts +++ b/toolbox/fdc3-for-web/fdc3-web-impl/test/world/index.ts @@ -1,13 +1,12 @@ -import { World, setWorldConstructor } from "@cucumber/cucumber"; -import { TestServerContext } from "../support/TestServerContext"; -import { DefaultFDC3Server } from "../../src/BasicFDC3Server"; -import { BasicDirectory } from "../../src/directory/BasicDirectory"; +import { World, setWorldConstructor } from '@cucumber/cucumber'; +import { TestServerContext } from '../support/TestServerContext'; +import { DefaultFDC3Server } from '../../src/BasicFDC3Server'; +import { BasicDirectory } from '../../src/directory/BasicDirectory'; export class CustomWorld extends World { - - sc = new TestServerContext(this) - server = new DefaultFDC3Server(this.sc, new BasicDirectory([]), [], false) - props: Record = {} + sc = new TestServerContext(this); + server = new DefaultFDC3Server(this.sc, new BasicDirectory([]), [], false); + props: Record = {}; } -setWorldConstructor(CustomWorld) \ No newline at end of file +setWorldConstructor(CustomWorld); diff --git a/toolbox/fdc3-for-web/reference-ui/src/channel_selector.ts b/toolbox/fdc3-for-web/reference-ui/src/channel_selector.ts index eeff0d477..b58a5115d 100644 --- a/toolbox/fdc3-for-web/reference-ui/src/channel_selector.ts +++ b/toolbox/fdc3-for-web/reference-ui/src/channel_selector.ts @@ -1,5 +1,10 @@ -import { Channel, Fdc3UserInterfaceHello, Fdc3UserInterfaceRestyle, isFdc3UserInterfaceChannels, isFdc3UserInterfaceHandshake } from "@kite9/fdc3-schema/dist/generated/api/BrowserTypes"; - +import { + Channel, + Fdc3UserInterfaceHello, + Fdc3UserInterfaceRestyle, + isFdc3UserInterfaceChannels, + isFdc3UserInterfaceHandshake, +} from '@kite9/fdc3-schema/dist/generated/api/BrowserTypes'; const fillChannels = (data: Channel[], selected: string | null, messageClickedChannel: (s: string | null) => void) => { const list = document.getElementById('list')!!; @@ -28,100 +33,99 @@ const fillChannels = (data: Channel[], selected: string | null, messageClickedCh list.appendChild(node); node.addEventListener('click', () => { - messageClickedChannel(id) + messageClickedChannel(id); }); if (id === selected) { - node.setAttribute("aria-selected", "true"); - node.style.backgroundColor = "#bbb"; + node.setAttribute('aria-selected', 'true'); + node.style.backgroundColor = '#bbb'; } }); }; -window.addEventListener("load", () => { +window.addEventListener('load', () => { const parent = window.parent; - const logo = document.getElementById("logo")!; + const logo = document.getElementById('logo')!; const mc = new MessageChannel(); const myPort = mc.port1; myPort.start(); myPort.onmessage = ({ data }) => { - console.debug("Received message: ", data); + console.debug('Received message: ', data); if (isFdc3UserInterfaceHandshake(data)) { collapse(); } else if (isFdc3UserInterfaceChannels(data)) { - logo.removeEventListener("click", expand); + logo.removeEventListener('click', expand); const { userChannels, selected } = data.payload; - fillChannels(userChannels, selected, (channelStr) => { + fillChannels(userChannels, selected, channelStr => { myPort.postMessage({ - type: "fdc3UserInterfaceSelected", + type: 'fdc3UserInterfaceSelected', payload: { - selected: channelStr || null - } + selected: channelStr || null, + }, }); collapse(); }); - const selectedChannel = userChannels.find((c) => c.id === selected); - logo.style.fill = selectedChannel?.displayMetadata?.color ?? "white"; - console.log("Adding event listener") - logo.addEventListener("click", expand); + const selectedChannel = userChannels.find(c => c.id === selected); + logo.style.fill = selectedChannel?.displayMetadata?.color ?? 'white'; + console.log('Adding event listener'); + logo.addEventListener('click', expand); } }; const helloMessage: Fdc3UserInterfaceHello = { - type: "Fdc3UserInterfaceHello", + type: 'Fdc3UserInterfaceHello', payload: { - implementationDetails: "", + implementationDetails: '', initialCSS: { width: `${8 * 4}px`, height: `${8 * 5}px`, - right: "2px", - bottom: "2px", - zIndex: "1000", - "z-index": "1000", - position: "fixed" - - } - } - } - parent.postMessage(helloMessage, "*", [mc.port2]); + right: '2px', + bottom: '2px', + zIndex: '1000', + 'z-index': '1000', + position: 'fixed', + }, + }, + }; + parent.postMessage(helloMessage, '*', [mc.port2]); const expand = () => { - document.body.setAttribute("data-expanded", "true"); + document.body.setAttribute('data-expanded', 'true'); const restyleMessage: Fdc3UserInterfaceRestyle = { - type: "Fdc3UserInterfaceRestyle", + type: 'Fdc3UserInterfaceRestyle', payload: { updatedCSS: { width: `100%`, height: `100%`, - top: "0", - left: "0", - zIndex: "1000", - "z-index": "1000", - position: "fixed" - } - } - } + top: '0', + left: '0', + zIndex: '1000', + 'z-index': '1000', + position: 'fixed', + }, + }, + }; myPort.postMessage(restyleMessage); - } + }; const collapse = () => { const restyleMessage: Fdc3UserInterfaceRestyle = { - type: "Fdc3UserInterfaceRestyle", + type: 'Fdc3UserInterfaceRestyle', payload: { updatedCSS: { width: `${8 * 4}px`, height: `${8 * 5}px`, - right: "2px", - bottom: "2px", - zIndex: "1000", - "z-index": "1000", - position: "fixed" - } - } - } + right: '2px', + bottom: '2px', + zIndex: '1000', + 'z-index': '1000', + position: 'fixed', + }, + }, + }; myPort.postMessage(restyleMessage); // If you immediately change to the logo, before the iframe has a chance to finish restyling, @@ -129,8 +133,7 @@ window.addEventListener("load", () => { // Here, we wait a negligible amount of time, and hope that the restyling has finished. This avoids the flicker. // It's not a *good* idea, it's just the best available, since we don't know when the restyle finishes. setTimeout(() => { - document.body.setAttribute("data-expanded", "false"); + document.body.setAttribute('data-expanded', 'false'); }, 15); - } - -}); \ No newline at end of file + }; +}); diff --git a/toolbox/fdc3-for-web/reference-ui/src/intent_resolver.ts b/toolbox/fdc3-for-web/reference-ui/src/intent_resolver.ts index 5dcabbfbd..a6627da29 100644 --- a/toolbox/fdc3-for-web/reference-ui/src/intent_resolver.ts +++ b/toolbox/fdc3-for-web/reference-ui/src/intent_resolver.ts @@ -1,72 +1,94 @@ -import { Icon } from "@kite9/fdc3"; -import { AppIntent } from "@kite9/fdc3"; -import { Fdc3UserInterfaceHello, Fdc3UserInterfaceResolve, Fdc3UserInterfaceResolveAction, Fdc3UserInterfaceRestyle, isFdc3UserInterfaceResolve } from "@kite9/fdc3-schema/dist/generated/api/BrowserTypes"; - - -const setup = (data: Fdc3UserInterfaceResolve["payload"], callback: (payload: Fdc3UserInterfaceResolveAction["payload"]) => void) => { - document.body.setAttribute("data-visible", "true"); - document.querySelector("dialog")?.showModal(); - - const intentSelect = document.getElementById("displayIntent") as HTMLSelectElement - - const justIntents = data.appIntents.map(({ intent }) => intent) - const doneIntents = new Set() +import { Icon } from '@kite9/fdc3'; +import { AppIntent } from '@kite9/fdc3'; +import { + Fdc3UserInterfaceHello, + Fdc3UserInterfaceResolve, + Fdc3UserInterfaceResolveAction, + Fdc3UserInterfaceRestyle, + isFdc3UserInterfaceResolve, +} from '@kite9/fdc3-schema/dist/generated/api/BrowserTypes'; + +const setup = ( + data: Fdc3UserInterfaceResolve['payload'], + callback: (payload: Fdc3UserInterfaceResolveAction['payload']) => void +) => { + document.body.setAttribute('data-visible', 'true'); + document.querySelector('dialog')?.showModal(); + + const intentSelect = document.getElementById('displayIntent') as HTMLSelectElement; + + const justIntents = data.appIntents.map(({ intent }) => intent); + const doneIntents = new Set(); justIntents.forEach(({ name, displayName }) => { if (doneIntents.has(name)) { return; } doneIntents.add(name); - const option = document.createElement("option"); + const option = document.createElement('option'); option.textContent = displayName as string; option.value = name; intentSelect.appendChild(option); }); - intentSelect.addEventListener("change", (e: any) => fillList(data.appIntents.filter(ai => ai.intent.name == e?.target?.value), e?.target?.value, callback)); - - fillList(data.appIntents.filter(ai => ai.intent.name == intentSelect.value), intentSelect.value, callback); - - const tabs = Array.from(document.querySelectorAll("[role='tab']")) - tabs.forEach((tab) => { - tab.addEventListener("click", () => { + intentSelect.addEventListener('change', (e: any) => + fillList( + data.appIntents.filter(ai => ai.intent.name == e?.target?.value), + e?.target?.value, + callback + ) + ); + + fillList( + data.appIntents.filter(ai => ai.intent.name == intentSelect.value), + intentSelect.value, + callback + ); + + const tabs = Array.from(document.querySelectorAll("[role='tab']")); + tabs.forEach(tab => { + tab.addEventListener('click', () => { // Remove selected state from every tab - tabs.forEach((t) => { - t.setAttribute("aria-selected", "false"); + tabs.forEach(t => { + t.setAttribute('aria-selected', 'false'); }); // Hide lists - Array.from(document.querySelectorAll(".list")).forEach((elem) => { - elem.setAttribute("data-visible", "false"); + Array.from(document.querySelectorAll('.list')).forEach(elem => { + elem.setAttribute('data-visible', 'false'); }); - tab.setAttribute("aria-selected", "true"); - const listRef = tab.getAttribute("data-list-ref")!!; - document.getElementById(listRef)!!.setAttribute("data-visible", "true"); + tab.setAttribute('aria-selected', 'true'); + const listRef = tab.getAttribute('data-list-ref')!!; + document.getElementById(listRef)!!.setAttribute('data-visible', 'true'); }); }); - document.getElementById("cancel")?.addEventListener("click", () => { + document.getElementById('cancel')?.addEventListener('click', () => { callback({ - action: "cancel" + action: 'cancel', }); }); -} +}; function createIcon(icons: Icon[] | undefined): HTMLElement { - const img = document.createElement("img"); + const img = document.createElement('img'); if (icons && icons.length > 0) { img.src = icons[0].src; } else { - img.style.opacity = "0"; + img.style.opacity = '0'; } - return img + return img; } -const fillList = (ai: AppIntent[], intent: string, callback: (payload: Fdc3UserInterfaceResolveAction["payload"]) => void) => { - const allApps = ai.flatMap(a => a.apps) - const openApps = allApps.filter(a => a.instanceId) - const newApps = allApps.filter(a => !a.instanceId) +const fillList = ( + ai: AppIntent[], + intent: string, + callback: (payload: Fdc3UserInterfaceResolveAction['payload']) => void +) => { + const allApps = ai.flatMap(a => a.apps); + const openApps = allApps.filter(a => a.instanceId); + const newApps = allApps.filter(a => !a.instanceId); // first, populate the "New Apps" tab const newList = document.getElementById('new-list') as HTMLDivElement; @@ -75,143 +97,139 @@ const fillList = (ai: AppIntent[], intent: string, callback: (payload: Fdc3UserI newApps.forEach(({ appId, title, name, icons }) => { const node = document.createElement('div'); node.setAttribute('tabIndex', '0'); - node.setAttribute("data-appId", appId); + node.setAttribute('data-appId', appId); - const span = document.createElement("span"); + const span = document.createElement('span'); span.textContent = title ?? name ?? appId; - const img = createIcon(icons) + const img = createIcon(icons); node.appendChild(img); node.appendChild(span); node.addEventListener('click', () => { callback({ - action: "click", + action: 'click', intent, appIdentifier: { - appId - } - }) + appId, + }, + }); }); node.addEventListener('hover', () => { callback({ - action: "hover", + action: 'hover', intent, appIdentifier: { - appId - } - }) + appId, + }, + }); }); newList.appendChild(node); - }); // then, populate the "Open Apps" tab - const openList = document.getElementById('open-list')!! + const openList = document.getElementById('open-list')!!; openList.innerHTML = ''; openApps.forEach(({ appId, title, icons, instanceId }) => { const node = document.createElement('div'); node.setAttribute('tabIndex', '0'); - node.setAttribute("data-appId", appId); + node.setAttribute('data-appId', appId); - const span = document.createElement("span"); + const span = document.createElement('span'); span.textContent = title ?? appId; - const img = createIcon(icons) + const img = createIcon(icons); node.appendChild(img); node.appendChild(span); node.addEventListener('click', () => { callback({ - action: "click", + action: 'click', intent, appIdentifier: { appId, - instanceId - } - }) + instanceId, + }, + }); }); node.addEventListener('hover', () => { callback({ - action: "hover", + action: 'hover', intent, appIdentifier: { appId, - instanceId - } - }) + instanceId, + }, + }); }); openList.appendChild(node); }); - }; -window.addEventListener("load", () => { +window.addEventListener('load', () => { const parent = window.parent; const mc = new MessageChannel(); const myPort = mc.port1; myPort.start(); myPort.onmessage = ({ data }) => { - console.debug("Received message: ", data); + console.debug('Received message: ', data); if (isFdc3UserInterfaceResolve(data)) { const restyleMessage: Fdc3UserInterfaceRestyle = { - type: "Fdc3UserInterfaceRestyle", + type: 'Fdc3UserInterfaceRestyle', payload: { updatedCSS: { - width: "100%", - height: "100%", - top: "0", - left: "0", - position: "fixed", - display: "block", - } - } - } + width: '100%', + height: '100%', + top: '0', + left: '0', + position: 'fixed', + display: 'block', + }, + }, + }; myPort.postMessage(restyleMessage); - setup(data.payload, (payload) => { - document.querySelector("dialog")?.close(); + setup(data.payload, payload => { + document.querySelector('dialog')?.close(); const resolveAction: Fdc3UserInterfaceResolveAction = { - type: "Fdc3UserInterfaceResolveAction", - payload - } + type: 'Fdc3UserInterfaceResolveAction', + payload, + }; myPort.postMessage(resolveAction); const restyleMessage: Fdc3UserInterfaceRestyle = { - type: "Fdc3UserInterfaceRestyle", + type: 'Fdc3UserInterfaceRestyle', payload: { updatedCSS: { - width: "0", - height: "0", - display: "none" - } - } - } + width: '0', + height: '0', + display: 'none', + }, + }, + }; myPort.postMessage(restyleMessage); - - }) + }); } - }; const helloMessage: Fdc3UserInterfaceHello = { - type: "Fdc3UserInterfaceHello", + type: 'Fdc3UserInterfaceHello', payload: { - implementationDetails: "", + implementationDetails: '', initialCSS: { - width: "0", - height: "0" - } - } - } - parent.postMessage(helloMessage, "*", [mc.port2]); -}); \ No newline at end of file + width: '0', + height: '0', + }, + }, + }; + parent.postMessage(helloMessage, '*', [mc.port2]); +}); diff --git a/toolbox/fdc3-for-web/reference-ui/src/main.ts b/toolbox/fdc3-for-web/reference-ui/src/main.ts index eee97452c..7b167c608 100644 --- a/toolbox/fdc3-for-web/reference-ui/src/main.ts +++ b/toolbox/fdc3-for-web/reference-ui/src/main.ts @@ -1,198 +1,206 @@ -import { FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE, FDC3_USER_INTERFACE_CHANNELS_TYPE, FDC3_USER_INTERFACE_HANDSHAKE_TYPE } from "@kite9/fdc3-schema/dist/generated/api/BrowserTypes"; -import "./style.css"; +import { + FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE, + FDC3_USER_INTERFACE_CHANNELS_TYPE, + FDC3_USER_INTERFACE_HANDSHAKE_TYPE, +} from '@kite9/fdc3-schema/dist/generated/api/BrowserTypes'; +import './style.css'; // Channel data const recommendedChannels = [ - { - id: 'fdc3.channel.1', - type: 'user', - displayMetadata: { - name: 'Channel 1', - color: 'red', - glyph: '1', - }, + { + id: 'fdc3.channel.1', + type: 'user', + displayMetadata: { + name: 'Channel 1', + color: 'red', + glyph: '1', }, - { - id: 'fdc3.channel.2', - type: 'user', - displayMetadata: { - name: 'Channel 2', - color: 'orange', - glyph: '2', - }, + }, + { + id: 'fdc3.channel.2', + type: 'user', + displayMetadata: { + name: 'Channel 2', + color: 'orange', + glyph: '2', }, - { - id: 'fdc3.channel.3', - type: 'user', - displayMetadata: { - name: 'Channel 3', - color: 'yellow', - glyph: '3', - }, + }, + { + id: 'fdc3.channel.3', + type: 'user', + displayMetadata: { + name: 'Channel 3', + color: 'yellow', + glyph: '3', }, - { - id: 'fdc3.channel.4', - type: 'user', - displayMetadata: { - name: 'Channel 4', - color: 'green', - glyph: '4', - }, + }, + { + id: 'fdc3.channel.4', + type: 'user', + displayMetadata: { + name: 'Channel 4', + color: 'green', + glyph: '4', }, - { - id: 'fdc3.channel.5', - type: 'user', - displayMetadata: { - name: 'Channel 5', - color: 'cyan', - glyph: '5', - }, + }, + { + id: 'fdc3.channel.5', + type: 'user', + displayMetadata: { + name: 'Channel 5', + color: 'cyan', + glyph: '5', }, - { - id: 'fdc3.channel.6', - type: 'user', - displayMetadata: { - name: 'Channel 6', - color: 'blue', - glyph: '6', - }, + }, + { + id: 'fdc3.channel.6', + type: 'user', + displayMetadata: { + name: 'Channel 6', + color: 'blue', + glyph: '6', }, - { - id: 'fdc3.channel.7', - type: 'user', - displayMetadata: { - name: 'Channel 7', - color: 'magenta', - glyph: '7', - }, + }, + { + id: 'fdc3.channel.7', + type: 'user', + displayMetadata: { + name: 'Channel 7', + color: 'magenta', + glyph: '7', }, - { - id: 'fdc3.channel.8', - type: 'user', - displayMetadata: { - name: 'Channel 8', - color: 'purple', - glyph: '8', - }, + }, + { + id: 'fdc3.channel.8', + type: 'user', + displayMetadata: { + name: 'Channel 8', + color: 'purple', + glyph: '8', }, + }, ]; // Example resolver data const exampleResolverData = { - type: "ResolverIntents", - appIntents: [ + type: 'ResolverIntents', + appIntents: [ + { + apps: [ { - apps: [{ - appId: "trading-view-chart", - description: "TradingView is a social network for traders and investors on Stock, Futures and Forex markets!", - icons: [{ - src: "https://apps.connectifi-interop.com/tradingviewChart/icon.png" - }], - title: "TradingView Chart" - }, { - appId: "adaptabledemo", - instanceId: "324587329238y7r59824", - description: "AdapTable is a powerful data grid with a range of advanced features", - icons: [{ - src: "https://apps.connectifi-interop.com/adaptableDemo/icon.png" - }], - title: "AdapTable" - }], - intent: { - name: "ViewInstrument", - displayName: "View Instrument" + appId: 'trading-view-chart', + description: 'TradingView is a social network for traders and investors on Stock, Futures and Forex markets!', + icons: [ + { + src: 'https://apps.connectifi-interop.com/tradingviewChart/icon.png', }, - }], - source: { - appId: "fdc3-demo", - instanceId: "fdc3-demo-instance" - } + ], + title: 'TradingView Chart', + }, + { + appId: 'adaptabledemo', + instanceId: '324587329238y7r59824', + description: 'AdapTable is a powerful data grid with a range of advanced features', + icons: [ + { + src: 'https://apps.connectifi-interop.com/adaptableDemo/icon.png', + }, + ], + title: 'AdapTable', + }, + ], + intent: { + name: 'ViewInstrument', + displayName: 'View Instrument', + }, + }, + ], + source: { + appId: 'fdc3-demo', + instanceId: 'fdc3-demo-instance', + }, }; let selected = recommendedChannels[2].id; let expanded = true; const openChannelIframe = (e: MouseEvent) => { - const channel = new MessageChannel(); - - // STEP 2B: Receive confirmation over port from iframe - channel.port1.onmessage = ({ data }) => { - switch (data.type) { - - // User clicked on one of the channels in the channel selector - // @ts-ignore: Explicit fall-through to Fdc3UserInterfaceHandshake - case FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE: { - // STEP 4B: Receive user selection information from iframe - selected = data.channel; - } - - // Handshake completed. Send channel data to iframe - case FDC3_USER_INTERFACE_HANDSHAKE_TYPE: { - // STEP 3A: Send channel data to iframe - channel.port1.postMessage({ - type: FDC3_USER_INTERFACE_CHANNELS_TYPE, - channels: recommendedChannels, - selected - }); - break; - } - - } - - }; - - const { target } = e; - if (target) (target as HTMLButtonElement).disabled = true; - - const iframe = document.querySelector("#channel-iframe")!; - iframe.parentElement?.setAttribute("data-visible", "true"); - - const resizeButton = document.getElementById("dimensions-btn-channel")!; - resizeButton.setAttribute("data-visible", "true"); - resizeButton.addEventListener("click", () => { - expanded = !expanded; - channel.port1.postMessage({ type: "Fdc3UserInterfaceChannelResize", expanded }) - iframe.setAttribute("data-expanded", `${expanded}`); - resizeButton.textContent = expanded ? "Collapse" : "Expand"; - }); - - // STEP 1A: Send port to iframe - iframe.contentWindow?.postMessage({ type: 'Fdc3UserInterfaceHello' }, '*', [channel.port2]); + const channel = new MessageChannel(); + + // STEP 2B: Receive confirmation over port from iframe + channel.port1.onmessage = ({ data }) => { + switch (data.type) { + // User clicked on one of the channels in the channel selector + // @ts-ignore: Explicit fall-through to Fdc3UserInterfaceHandshake + case FDC3_USER_INTERFACE_CHANNEL_SELECTED_TYPE: { + // STEP 4B: Receive user selection information from iframe + selected = data.channel; + } + + // Handshake completed. Send channel data to iframe + case FDC3_USER_INTERFACE_HANDSHAKE_TYPE: { + // STEP 3A: Send channel data to iframe + channel.port1.postMessage({ + type: FDC3_USER_INTERFACE_CHANNELS_TYPE, + channels: recommendedChannels, + selected, + }); + break; + } + } + }; + + const { target } = e; + if (target) (target as HTMLButtonElement).disabled = true; + + const iframe = document.querySelector('#channel-iframe')!; + iframe.parentElement?.setAttribute('data-visible', 'true'); + + const resizeButton = document.getElementById('dimensions-btn-channel')!; + resizeButton.setAttribute('data-visible', 'true'); + resizeButton.addEventListener('click', () => { + expanded = !expanded; + channel.port1.postMessage({ type: 'Fdc3UserInterfaceChannelResize', expanded }); + iframe.setAttribute('data-expanded', `${expanded}`); + resizeButton.textContent = expanded ? 'Collapse' : 'Expand'; + }); + + // STEP 1A: Send port to iframe + iframe.contentWindow?.postMessage({ type: 'Fdc3UserInterfaceHello' }, '*', [channel.port2]); }; const openResolverIframe = (e: MouseEvent) => { - const channel = new MessageChannel(); - - // STEP 2B: Receive confirmation over port from iframe - channel.port1.onmessage = ({ data }) => { - switch (data.type) { - case "Fdc3UserInterfaceHandshake": { - // STEP 3A: Send channel data to iframe - channel.port1.postMessage(exampleResolverData); - break; - } - case "Fdc3UserInterfaceResolveAction": - case "Fdc3UserInterfaceResolve": { - // STEP 4B: Receive user selection information from iframe - - // TODO - prettyPrintJson dependency is not referenced, re-enable when added - // document.getElementById('resolver-user-selection')!.innerHTML = prettyPrintJson.toHtml(data); - break; - } - } - - }; - const { target } = e; - if (target) (target as HTMLButtonElement).disabled = true; - - const iframe = document.querySelector("#resolver-iframe"); - iframe!.parentElement?.setAttribute("data-visible", "true"); - - // STEP 1A: Send port to iframe - iframe!.contentWindow?.postMessage({ type: 'Fdc3UserInterfaceHello' }, '*', [channel.port2]); + const channel = new MessageChannel(); + + // STEP 2B: Receive confirmation over port from iframe + channel.port1.onmessage = ({ data }) => { + switch (data.type) { + case 'Fdc3UserInterfaceHandshake': { + // STEP 3A: Send channel data to iframe + channel.port1.postMessage(exampleResolverData); + break; + } + case 'Fdc3UserInterfaceResolveAction': + case 'Fdc3UserInterfaceResolve': { + // STEP 4B: Receive user selection information from iframe + + // TODO - prettyPrintJson dependency is not referenced, re-enable when added + // document.getElementById('resolver-user-selection')!.innerHTML = prettyPrintJson.toHtml(data); + break; + } + } + }; + const { target } = e; + if (target) (target as HTMLButtonElement).disabled = true; + + const iframe = document.querySelector('#resolver-iframe'); + iframe!.parentElement?.setAttribute('data-visible', 'true'); + + // STEP 1A: Send port to iframe + iframe!.contentWindow?.postMessage({ type: 'Fdc3UserInterfaceHello' }, '*', [channel.port2]); }; window.addEventListener('load', () => { - document.getElementById('send-btn-channel')!.addEventListener('click', openChannelIframe); - document.getElementById('send-btn-resolver')!.addEventListener('click', openResolverIframe); -}); \ No newline at end of file + document.getElementById('send-btn-channel')!.addEventListener('click', openChannelIframe); + document.getElementById('send-btn-resolver')!.addEventListener('click', openResolverIframe); +}); diff --git a/toolbox/fdc3-for-web/reference-ui/src/style.css b/toolbox/fdc3-for-web/reference-ui/src/style.css index 41efc21e9..c66a4cb59 100644 --- a/toolbox/fdc3-for-web/reference-ui/src/style.css +++ b/toolbox/fdc3-for-web/reference-ui/src/style.css @@ -2,7 +2,7 @@ display: flex; justify-content: space-around; } -[data-visible="false"]{ +[data-visible='false'] { opacity: 0; } .returned:has(pre:empty) { @@ -15,13 +15,13 @@ h1 { #channel-iframe { border: none; - &[data-expanded="true"]{ - height: 210px; - width: 150px; + &[data-expanded='true'] { + height: 210px; + width: 150px; } - &[data-expanded="false"]{ - height: 36px; - width: 50px; + &[data-expanded='false'] { + height: 36px; + width: 50px; } -} \ No newline at end of file +} diff --git a/toolbox/fdc3-for-web/reference-ui/vite.config.ts b/toolbox/fdc3-for-web/reference-ui/vite.config.ts index cbce46b87..6c9734965 100644 --- a/toolbox/fdc3-for-web/reference-ui/vite.config.ts +++ b/toolbox/fdc3-for-web/reference-ui/vite.config.ts @@ -1,9 +1,9 @@ -import { defineConfig } from "vite"; +import { defineConfig } from 'vite'; // https://vitejs.dev/config/ export default defineConfig({ - server: { port: 4002 }, - build: { - outDir: "dist" - } + server: { port: 4002 }, + build: { + outDir: 'dist', + }, }); diff --git a/toolbox/fdc3-workbench/.prettierrc b/toolbox/fdc3-workbench/.prettierrc index 9e4ad7c81..3fce93d4b 100644 --- a/toolbox/fdc3-workbench/.prettierrc +++ b/toolbox/fdc3-workbench/.prettierrc @@ -1,7 +1,7 @@ { - "useTabs": true, - "arrowParens": "always", - "trailingComma": "es5", - "proseWrap": "always", - "printWidth": 120 -} \ No newline at end of file + "useTabs": true, + "arrowParens": "always", + "trailingComma": "es5", + "proseWrap": "always", + "printWidth": 120 +}