@openfin/core 33.76.31 → 33.76.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OpenFin.d.ts +1 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17104 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.31.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3080
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -148
- package/src/api/application/Factory.js +0 -230
- package/src/api/application/Instance.d.ts +0 -321
- package/src/api/application/Instance.js +0 -453
- package/src/api/application/index.d.ts +0 -3
- package/src/api/application/index.js +0 -19
- package/src/api/base.d.ts +0 -48
- package/src/api/base.js +0 -177
- package/src/api/clipboard/index.d.ts +0 -92
- package/src/api/clipboard/index.js +0 -120
- package/src/api/events/application.d.ts +0 -146
- package/src/api/events/application.js +0 -2
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -30
- package/src/api/events/channel.js +0 -2
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -19
- package/src/api/events/externalApplication.js +0 -2
- package/src/api/events/frame.d.ts +0 -30
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -20
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -26
- package/src/api/events/platform.js +0 -2
- package/src/api/events/system.d.ts +0 -113
- package/src/api/events/system.js +0 -2
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -82
- package/src/api/events/view.js +0 -2
- package/src/api/events/webcontents.d.ts +0 -266
- package/src/api/events/webcontents.js +0 -2
- package/src/api/events/window.d.ts +0 -352
- package/src/api/events/window.js +0 -2
- package/src/api/external-application/Factory.d.ts +0 -27
- package/src/api/external-application/Factory.js +0 -40
- package/src/api/external-application/Instance.d.ts +0 -102
- package/src/api/external-application/Instance.js +0 -109
- package/src/api/external-application/index.d.ts +0 -3
- package/src/api/external-application/index.js +0 -19
- package/src/api/fin.d.ts +0 -51
- package/src/api/fin.js +0 -42
- package/src/api/frame/Factory.d.ts +0 -37
- package/src/api/frame/Factory.js +0 -69
- package/src/api/frame/Instance.d.ts +0 -123
- package/src/api/frame/Instance.js +0 -130
- package/src/api/frame/index.d.ts +0 -3
- package/src/api/frame/index.js +0 -19
- package/src/api/global-hotkey/index.d.ts +0 -38
- package/src/api/global-hotkey/index.js +0 -64
- package/src/api/interappbus/channel/channel.d.ts +0 -28
- package/src/api/interappbus/channel/channel.js +0 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
- package/src/api/interappbus/channel/channels-docs.js +0 -398
- package/src/api/interappbus/channel/client.d.ts +0 -24
- package/src/api/interappbus/channel/client.js +0 -89
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -25
- package/src/api/interappbus/channel/index.js +0 -169
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -34
- package/src/api/interappbus/channel/provider.js +0 -166
- package/src/api/interappbus/index.d.ts +0 -85
- package/src/api/interappbus/index.js +0 -175
- package/src/api/interop/Factory.d.ts +0 -37
- package/src/api/interop/Factory.js +0 -76
- package/src/api/interop/InteropBroker.d.ts +0 -437
- package/src/api/interop/InteropBroker.js +0 -1085
- package/src/api/interop/InteropClient.d.ts +0 -278
- package/src/api/interop/InteropClient.js +0 -459
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -4
- package/src/api/interop/index.js +0 -20
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -115
- package/src/api/platform/Factory.js +0 -184
- package/src/api/platform/Instance.d.ts +0 -150
- package/src/api/platform/Instance.js +0 -332
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -3
- package/src/api/platform/index.js +0 -19
- package/src/api/platform/layout/Factory.d.ts +0 -114
- package/src/api/platform/layout/Factory.js +0 -174
- package/src/api/platform/layout/Instance.d.ts +0 -57
- package/src/api/platform/layout/Instance.js +0 -126
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
- package/src/api/platform/layout/entities/layout-entities.js +0 -312
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -2
- package/src/api/platform/layout/index.js +0 -18
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -163
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -38
- package/src/api/snapshot-source/Factory.js +0 -66
- package/src/api/snapshot-source/Instance.d.ts +0 -31
- package/src/api/snapshot-source/Instance.js +0 -132
- package/src/api/snapshot-source/index.d.ts +0 -3
- package/src/api/snapshot-source/index.js +0 -19
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -517
- package/src/api/system/index.js +0 -895
- package/src/api/view/Factory.d.ts +0 -50
- package/src/api/view/Factory.js +0 -103
- package/src/api/view/Instance.d.ts +0 -487
- package/src/api/view/Instance.js +0 -557
- package/src/api/view/index.d.ts +0 -3
- package/src/api/view/index.js +0 -19
- package/src/api/webcontents/main.d.ts +0 -32
- package/src/api/webcontents/main.js +0 -156
- package/src/api/window/Factory.d.ts +0 -45
- package/src/api/window/Factory.js +0 -91
- package/src/api/window/Instance.d.ts +0 -1090
- package/src/api/window/Instance.js +0 -1349
- package/src/api/window/index.d.ts +0 -3
- package/src/api/window/index.js +0 -19
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -21
- package/src/namespaces.js +0 -24
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -200
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.InteropClient = void 0;
|
|
16
|
-
const base_1 = require("../base");
|
|
17
|
-
const SessionContextGroupClient_1 = require("./SessionContextGroupClient");
|
|
18
|
-
const utils_1 = require("./utils");
|
|
19
|
-
/**
|
|
20
|
-
* @PORTED
|
|
21
|
-
* @typedef { object } Intent
|
|
22
|
-
* @summary The combination of an action and a context that is passed to an application for resolution.
|
|
23
|
-
* @property { string } name Name of the intent.
|
|
24
|
-
* @property { Context } context Data associated with the intent
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* @REMOVED
|
|
28
|
-
* @typedef { object } Subscription
|
|
29
|
-
* @summary Object returned when subscribing a handler.
|
|
30
|
-
* @property { function } unsubscribe Function to unsubscribe the handler.
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @typedef { function } ContextHandler
|
|
34
|
-
* @summary Subscription function for addContextHandler.
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* @typedef { function } IntentHandler
|
|
38
|
-
* @summary Subscription function for registerIntentHandler
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* @PORTED
|
|
42
|
-
* @typedef { object } ClientIdentity
|
|
43
|
-
* @summary The Identity for a Channel Client. Includes endpointId to differentiate between different connections for an entity.
|
|
44
|
-
* @property {string} uuid GUID of an application.
|
|
45
|
-
* @property {string} name Name of an entity in an application.
|
|
46
|
-
* @property {string} endpointId Unique differentiator for different Channel connections for an entity.
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* @PORTED
|
|
50
|
-
* @typedef { object } ContextGroupInfo
|
|
51
|
-
* @summary Information for a Context Group. Contains metadata for displaying the group properly.
|
|
52
|
-
* @property {string} id Name of the context group
|
|
53
|
-
* @property {DisplayMetadata} displayMetadata Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
|
|
54
|
-
*/
|
|
55
|
-
/**
|
|
56
|
-
* @PORTED
|
|
57
|
-
* @typedef { object } DisplayMetadata
|
|
58
|
-
* @summary The display data for a Context Group.
|
|
59
|
-
* @property {string} name A user-readable name for this context group, e.g: `"Red"`
|
|
60
|
-
* @property {string} [color] The color that should be associated within this context group when displaying this context group in a UI, e.g: `0xFF0000`.
|
|
61
|
-
* @property {string} [glyph] A URL of an image that can be used to display this context group
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* @PORTED
|
|
65
|
-
* @typedef { object } Context
|
|
66
|
-
* @summary Data passed between entities and applications.
|
|
67
|
-
* @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
|
|
68
|
-
* @property {string} [name] User-readable name for the incoming context.
|
|
69
|
-
* @property {string} type Conserved type for the context (e.g. `instrument` or `country`)
|
|
70
|
-
*/
|
|
71
|
-
/**
|
|
72
|
-
* @REMOVED
|
|
73
|
-
* @typedef { object } ContextForIntent
|
|
74
|
-
* @summary Data passed between entities and applications, including an optional metadata.
|
|
75
|
-
* @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
|
|
76
|
-
* @property {string} [name] User-readable name for the incoming context.
|
|
77
|
-
* @property {string} type Conserved type for the context (e.g. `instrument` or `country`)
|
|
78
|
-
* @property {any} [metadata]
|
|
79
|
-
*/
|
|
80
|
-
/**
|
|
81
|
-
* @REMOVED
|
|
82
|
-
* @typedef { object } SessionContextGroup
|
|
83
|
-
* @summary An instance of a SessionContextGroup
|
|
84
|
-
* @property {string} id The SessionContextGroup's id.
|
|
85
|
-
* @property {setContext} setContext Sets a context of a certain type
|
|
86
|
-
* @property {getCurrentContext} getCurrentContext Gets the currently set context of a certain type
|
|
87
|
-
* @property {addContextHandler} addContextHandler Adds a handler for context change.
|
|
88
|
-
*/
|
|
89
|
-
/**
|
|
90
|
-
* @typedef {function} setContext
|
|
91
|
-
* @summary A SessionContextGroup instance method for setting a context in the SessionContextGroup.
|
|
92
|
-
* @param {Context} context The Context to be set.
|
|
93
|
-
* @return {Promise<void>}
|
|
94
|
-
*/
|
|
95
|
-
/**
|
|
96
|
-
* @typedef {function} getCurrentContext
|
|
97
|
-
* @summary A SessionContextGroup instance method for getting the current context of a certain type.
|
|
98
|
-
* @param {string} [contextType] The Context Type to get. If not specified the last contextType set would get used.
|
|
99
|
-
* @return {Promise<Context>}
|
|
100
|
-
*/
|
|
101
|
-
/**
|
|
102
|
-
* @typedef {function} addContextHandler
|
|
103
|
-
* @summary A SessionContextGroup instance method for adding a handler for context change.
|
|
104
|
-
* @param {ContextHandler} contextHandler The callback to be invoked. Is invoked when (a) the context changes or (b) immediately after getting created if the context is already set.
|
|
105
|
-
* @param {string} [contextType] The context type this handler should listen to. If not specified, a global handler for all context types will get created. Only one global handler is allowed per SessionContextGroup.
|
|
106
|
-
* @return {Promise<Subscription>}
|
|
107
|
-
*/
|
|
108
|
-
/**
|
|
109
|
-
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
110
|
-
*
|
|
111
|
-
* The Interop Client API is broken up into two groups:
|
|
112
|
-
*
|
|
113
|
-
* **Content Facing APIs** - For Application Developers putting Views into a Platform Window, who care about Context. These are APIs that send out and receive the Context data that flows between applications. Think of this as the Water in the Interop Pipes.
|
|
114
|
-
*
|
|
115
|
-
* **Context Grouping APIs** - For Platform Developers, to add and remove Views to and from Context Groups. These APIs are utilized under-the-hood in Platforms, so they don't need to be used to participate in Interop. These are the APIs that decide which entities the context data flows between. Think of these as the valves or pipes that control the flow of Context Data for Interop.
|
|
116
|
-
*
|
|
117
|
-
* ---
|
|
118
|
-
*
|
|
119
|
-
* All APIs are available at the `fin.me.interop` namespace.
|
|
120
|
-
*
|
|
121
|
-
* ---
|
|
122
|
-
*
|
|
123
|
-
* **You only need 2 things to participate in Interop Context Grouping:**
|
|
124
|
-
* * A Context Handler for incoming context: {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
|
125
|
-
* * Call setContext on your context group when you want to share context with other group members: {@link InteropClient#setContext setContext(context)}
|
|
126
|
-
*
|
|
127
|
-
* ---
|
|
128
|
-
*
|
|
129
|
-
* ##### Constructor
|
|
130
|
-
* Returned by {@link Interop.connectSync Interop.connectSync}.
|
|
131
|
-
*
|
|
132
|
-
* ---
|
|
133
|
-
*
|
|
134
|
-
* ##### Interop methods intended for Views
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* **Context Groups API**
|
|
138
|
-
* * {@link InteropClient#addContextHandler addContextHandler(handler, contextType?)}
|
|
139
|
-
* * {@link InteropClient#setContext setContext(context)}
|
|
140
|
-
* * {@link InteropClient#getCurrentContext getCurrentContext(contextType?)}
|
|
141
|
-
* * {@link InteropClient#joinSessionContextGroup joinSessionContextGroup(sessionContextGroupId)}
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* **Intents API**
|
|
145
|
-
* * {@link InteropClient#fireIntent fireIntent(intent)}
|
|
146
|
-
* * {@link InteropClient#registerIntentHandler registerIntentHandler(intentHandler, intentName)}
|
|
147
|
-
* * {@link InteropClient#getInfoForIntent getInfoForIntent(infoForIntentOptions)}
|
|
148
|
-
* * {@link InteropClient#getInfoForIntentsByContext getInfoForIntentsByContext(context)}
|
|
149
|
-
* * {@link InteropClient#fireIntentForContext fireIntentForContext(contextForIntent)}
|
|
150
|
-
*
|
|
151
|
-
* ##### Interop methods intended for Windows
|
|
152
|
-
* * {@link InteropClient#getContextGroups getContextGroups()}
|
|
153
|
-
* * {@link InteropClient#joinContextGroup joinContextGroup(contextGroupId, target?)}
|
|
154
|
-
* * {@link InteropClient#removeFromContextGroup removeFromContextGroup(target?)}
|
|
155
|
-
* * {@link InteropClient#getInfoForContextGroup getInfoForContextGroup(contextGroupId)}
|
|
156
|
-
* * {@link InteropClient#getAllClientsInContextGroup getAllClientsInContextGroup(contextGroupId)}
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
* @hideconstructor
|
|
161
|
-
* @class
|
|
162
|
-
*/
|
|
163
|
-
class InteropClient extends base_1.Base {
|
|
164
|
-
constructor(wire, name, interopConfig = {}) {
|
|
165
|
-
super(wire);
|
|
166
|
-
_InteropClient_clientPromise.set(this, void 0);
|
|
167
|
-
_InteropClient_sessionContextGroups.set(this, void 0);
|
|
168
|
-
__classPrivateFieldSet(this, _InteropClient_sessionContextGroups, new Map(), "f");
|
|
169
|
-
__classPrivateFieldSet(this, _InteropClient_clientPromise, this.wire.environment.whenReady().then(() => {
|
|
170
|
-
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
|
171
|
-
payload: interopConfig
|
|
172
|
-
});
|
|
173
|
-
}), "f");
|
|
174
|
-
}
|
|
175
|
-
/*
|
|
176
|
-
Client APIs
|
|
177
|
-
*/
|
|
178
|
-
/**
|
|
179
|
-
* Sets a context for the context group of the current entity.
|
|
180
|
-
* @param { Context } context - New context to set.
|
|
181
|
-
* @return { Promise<void> }
|
|
182
|
-
* @tutorial interop.setContext
|
|
183
|
-
*/
|
|
184
|
-
async setContext(context) {
|
|
185
|
-
this.wire.sendAction('interop-client-set-context').catch((e) => {
|
|
186
|
-
// don't expose, analytics-only call
|
|
187
|
-
});
|
|
188
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
189
|
-
return client.dispatch('setContext', { context });
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts.
|
|
193
|
-
* @param { ContextHandler } handler - Handler for incoming context.
|
|
194
|
-
* @param { string } [contextType] - The type of context you wish to handle.
|
|
195
|
-
* @return { Promise<Subscription> }
|
|
196
|
-
* @tutorial interop.addContextHandler
|
|
197
|
-
*/
|
|
198
|
-
async addContextHandler(handler, contextType) {
|
|
199
|
-
this.wire.sendAction('interop-client-add-context-handler').catch((e) => {
|
|
200
|
-
// don't expose, analytics-only call
|
|
201
|
-
});
|
|
202
|
-
if (typeof handler !== 'function') {
|
|
203
|
-
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
204
|
-
}
|
|
205
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
206
|
-
let handlerId;
|
|
207
|
-
if (contextType) {
|
|
208
|
-
handlerId = `invokeContextHandler-${contextType}-${(0, utils_1.generateId)()}`;
|
|
209
|
-
console.warn(`Warning: By providing a contextType (${contextType}), you are using the experimental addContextHandler. To avoid issues, make sure you are adding your context handlers at the top level in your application.`);
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
handlerId = 'invokeContextHandler';
|
|
213
|
-
}
|
|
214
|
-
const wrappedHandler = (0, utils_1.wrapContextHandler)(handler, handlerId);
|
|
215
|
-
client.register(handlerId, wrappedHandler);
|
|
216
|
-
await client.dispatch('contextHandlerRegistered', { handlerId, contextType });
|
|
217
|
-
return {
|
|
218
|
-
unsubscribe: async () => {
|
|
219
|
-
client.remove(handlerId);
|
|
220
|
-
await client.dispatch('removeContextHandler', { handlerId });
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
/*
|
|
225
|
-
Platform Window APIs
|
|
226
|
-
*/
|
|
227
|
-
/**
|
|
228
|
-
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
|
229
|
-
* Used by Platform Windows.
|
|
230
|
-
* @return { Promise<ContextGroupInfo[]>}
|
|
231
|
-
* @tutorial interop.getContextGroups
|
|
232
|
-
*/
|
|
233
|
-
async getContextGroups() {
|
|
234
|
-
this.wire.sendAction('interop-client-get-context-groups').catch((e) => {
|
|
235
|
-
// don't expose, analytics-only call
|
|
236
|
-
});
|
|
237
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
238
|
-
return client.dispatch('getContextGroups');
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
|
242
|
-
* If no target is specified, it adds the sender to the context group.
|
|
243
|
-
* Because multiple Channel connections/Interop Clients can potentially exist at a `uuid`/`name` combo, we currently join all Channel connections/Interop Clients at the given identity to the context group.
|
|
244
|
-
* If an `endpointId` is provided (which is unlikely, unless the call is coming from an external adapter), then we only join that single connection to the context group.
|
|
245
|
-
* For all intents and purposes, there will only be 1 connection present in Platform and Browser implmentations, so this point is more-or-less moot.
|
|
246
|
-
* Used by Platform Windows.
|
|
247
|
-
* @param { string } contextGroupId - Id of the context group.
|
|
248
|
-
* @param { Identity } [target] - Identity of the entity you wish to join to a context group.
|
|
249
|
-
* @return { Promise<void>}
|
|
250
|
-
* @tutorial interop.joinContextGroup
|
|
251
|
-
*/
|
|
252
|
-
async joinContextGroup(contextGroupId, target) {
|
|
253
|
-
this.wire.sendAction('interop-client-join-context-group').catch((e) => {
|
|
254
|
-
// don't expose, analytics-only call
|
|
255
|
-
});
|
|
256
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
257
|
-
if (!contextGroupId) {
|
|
258
|
-
throw new Error('No contextGroupId specified for joinContextGroup.');
|
|
259
|
-
}
|
|
260
|
-
return client.dispatch('joinContextGroup', { contextGroupId, target });
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Removes the specified target from a context group.
|
|
264
|
-
* If no target is specified, it removes the sender from their context group.
|
|
265
|
-
* Used by Platform Windows.
|
|
266
|
-
* @param { Identity } [target] - Identity of the entity you wish to join to a context group.
|
|
267
|
-
* @return { Promise<void>}
|
|
268
|
-
* @tutorial interop.removeFromContextGroup
|
|
269
|
-
*/
|
|
270
|
-
async removeFromContextGroup(target) {
|
|
271
|
-
this.wire.sendAction('interop-client-remove-from-context-group').catch((e) => {
|
|
272
|
-
// don't expose, analytics-only call
|
|
273
|
-
});
|
|
274
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
275
|
-
return client.dispatch('removeFromContextGroup', { target });
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Gets all clients for a context group.
|
|
279
|
-
* Used by Platform Windows.
|
|
280
|
-
* @param { string } contextGroupId - The id of context group you wish to get clients for.
|
|
281
|
-
* @return { Promise<ClientIdentity[]>}
|
|
282
|
-
* @tutorial interop.getAllClientsInContextGroup
|
|
283
|
-
*/
|
|
284
|
-
async getAllClientsInContextGroup(contextGroupId) {
|
|
285
|
-
this.wire.sendAction('interop-client-get-all-clients-in-context-group').catch((e) => {
|
|
286
|
-
// don't expose, analytics-only call
|
|
287
|
-
});
|
|
288
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
289
|
-
if (!contextGroupId) {
|
|
290
|
-
throw new Error('No contextGroupId specified for getAllClientsInContextGroup.');
|
|
291
|
-
}
|
|
292
|
-
return client.dispatch('getAllClientsInContextGroup', { contextGroupId });
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Gets display info for a context group
|
|
296
|
-
* Used by Platform Windows.
|
|
297
|
-
* @param { string } contextGroupId - The id of context group you wish to get display info for.
|
|
298
|
-
* @return { Promise<ContextGroupInfo>}
|
|
299
|
-
* @tutorial interop.getInfoForContextGroup
|
|
300
|
-
*/
|
|
301
|
-
async getInfoForContextGroup(contextGroupId) {
|
|
302
|
-
this.wire.sendAction('interop-client-get-info-for-context-group').catch((e) => {
|
|
303
|
-
// don't expose, analytics-only call
|
|
304
|
-
});
|
|
305
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
306
|
-
if (!contextGroupId) {
|
|
307
|
-
throw new Error('No contextGroupId specified for getInfoForContextGroup.');
|
|
308
|
-
}
|
|
309
|
-
return client.dispatch('getInfoForContextGroup', { contextGroupId });
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Sends an intent to the Interop Broker to resolve.
|
|
313
|
-
* @param { Intent } intent - The combination of an action and a context that is passed to an application for resolution.
|
|
314
|
-
* @return { Promise<unknown>}
|
|
315
|
-
* @tutorial interop.fireIntent
|
|
316
|
-
*/
|
|
317
|
-
async fireIntent(intent) {
|
|
318
|
-
this.wire.sendAction('interop-client-fire-intent').catch((e) => {
|
|
319
|
-
// don't expose, this is only for api analytics purposes
|
|
320
|
-
});
|
|
321
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
322
|
-
return client.dispatch('fireIntent', intent);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Adds an intent handler for incoming intents. The last intent sent of the name subscribed to will be received.
|
|
326
|
-
* @param { IntentHandler } handler - Registered function meant to handle a specific intent type.
|
|
327
|
-
* @param { string } intentName - The name of an intent.
|
|
328
|
-
* @return { Promise<Subscription> }
|
|
329
|
-
* @tutorial interop.registerIntentHandler
|
|
330
|
-
*/
|
|
331
|
-
async registerIntentHandler(handler, intentName, options) {
|
|
332
|
-
this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
|
|
333
|
-
// don't expose, this is only for api analytics purposes
|
|
334
|
-
});
|
|
335
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
336
|
-
const handlerId = `intent-handler-${intentName}`;
|
|
337
|
-
const wrappedHandler = (0, utils_1.wrapIntentHandler)(handler, handlerId);
|
|
338
|
-
try {
|
|
339
|
-
await client.register(handlerId, wrappedHandler);
|
|
340
|
-
await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
|
|
341
|
-
}
|
|
342
|
-
catch (error) {
|
|
343
|
-
throw new Error('Unable to register intent handler');
|
|
344
|
-
}
|
|
345
|
-
return {
|
|
346
|
-
unsubscribe: async () => {
|
|
347
|
-
client.remove(handlerId);
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Gets the last context of the Context Group currently subscribed to. It takes an optional Context Type and returns the
|
|
353
|
-
* last context of that type.
|
|
354
|
-
* @param { string } [contextType]
|
|
355
|
-
* @return { Promise<Context> }
|
|
356
|
-
* @tutorial interop.getCurrentContext
|
|
357
|
-
*/
|
|
358
|
-
async getCurrentContext(contextType) {
|
|
359
|
-
this.wire.sendAction('interop-client-get-current-context').catch((e) => {
|
|
360
|
-
// don't expose, analytics-only call
|
|
361
|
-
});
|
|
362
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
363
|
-
return client.dispatch('getCurrentContext', { contextType });
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Get information for a particular Intent from the Interop Broker.
|
|
367
|
-
* @param { InfoForIntentOptions } options
|
|
368
|
-
* @return { Promise<unknown> }
|
|
369
|
-
* @tutorial interop.getInfoForIntent
|
|
370
|
-
*/
|
|
371
|
-
async getInfoForIntent(options) {
|
|
372
|
-
this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
|
|
373
|
-
// don't expose, analytics-only call
|
|
374
|
-
});
|
|
375
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
376
|
-
return client.dispatch('getInfoForIntent', options);
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Get information from the Interop Broker on all Intents that are meant to handle a particular context.
|
|
380
|
-
* @param { Context } context
|
|
381
|
-
* @return { Promise<unknown> }
|
|
382
|
-
* @tutorial interop.getInfoForIntentsByContext
|
|
383
|
-
*/
|
|
384
|
-
async getInfoForIntentsByContext(context) {
|
|
385
|
-
this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
|
|
386
|
-
// don't expose, analytics-only call
|
|
387
|
-
});
|
|
388
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
389
|
-
return client.dispatch('getInfoForIntentsByContext', context);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Sends a Context that will be resolved to an Intent by the Interop Broker.
|
|
393
|
-
* This context accepts a metadata property.
|
|
394
|
-
* @param { ContextForIntent } context
|
|
395
|
-
* @return { Promise<unknown> }
|
|
396
|
-
* @tutorial interop.fireIntentForContext
|
|
397
|
-
*/
|
|
398
|
-
async fireIntentForContext(context) {
|
|
399
|
-
this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
|
|
400
|
-
// don't expose, analytics-only call
|
|
401
|
-
});
|
|
402
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
403
|
-
return client.dispatch('fireIntentForContext', context);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Join the current entity to session context group `sessionContextGroupId` and return a sessionContextGroup instance.
|
|
407
|
-
* If the sessionContextGroup doesn't exist, one will get created.
|
|
408
|
-
* Session Context Groups do not persist between runs and aren't present on snapshots.
|
|
409
|
-
* @param { string } sessionContextGroupId - Id of the context group.
|
|
410
|
-
* @return { Promise<SessionContextGroup>}
|
|
411
|
-
* @tutorial interop.joinSessionContextGroup
|
|
412
|
-
*/
|
|
413
|
-
async joinSessionContextGroup(sessionContextGroupId) {
|
|
414
|
-
try {
|
|
415
|
-
const currentSessionContextGroup = __classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").get(sessionContextGroupId);
|
|
416
|
-
if (currentSessionContextGroup) {
|
|
417
|
-
return currentSessionContextGroup.getUserInstance();
|
|
418
|
-
}
|
|
419
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
420
|
-
const { hasConflict } = await client.dispatch('sessionContextGroup:createIfNeeded', {
|
|
421
|
-
sessionContextGroupId
|
|
422
|
-
});
|
|
423
|
-
if (hasConflict) {
|
|
424
|
-
console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
|
|
425
|
-
}
|
|
426
|
-
const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
|
|
427
|
-
__classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
|
|
428
|
-
return newSessionContextGroup.getUserInstance();
|
|
429
|
-
}
|
|
430
|
-
catch (error) {
|
|
431
|
-
console.error(`Error thrown trying to create Session Context Group with id "${sessionContextGroupId}": ${error}`);
|
|
432
|
-
throw error;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
|
|
437
|
-
* Only one listener per Interop Client can be set.
|
|
438
|
-
* @param listener
|
|
439
|
-
* @return { Promise<void> }
|
|
440
|
-
* @tutorial interop.onDisconnection
|
|
441
|
-
*/
|
|
442
|
-
async onDisconnection(listener) {
|
|
443
|
-
this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
|
|
444
|
-
// don't expose, analytics-only call
|
|
445
|
-
});
|
|
446
|
-
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
447
|
-
return client.onDisconnection((event) => {
|
|
448
|
-
const { uuid } = event;
|
|
449
|
-
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
// used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
|
|
453
|
-
static async ferryFdc3Call(interopClient, action, payload) {
|
|
454
|
-
const client = await __classPrivateFieldGet(interopClient, _InteropClient_clientPromise, "f");
|
|
455
|
-
return client.dispatch(action, payload || null);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
exports.InteropClient = InteropClient;
|
|
459
|
-
_InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap();
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import type { ChannelProvider } from '../interappbus/channel/provider';
|
|
3
|
-
export default class SessionContextGroupBroker {
|
|
4
|
-
id: string;
|
|
5
|
-
private contextGroupMap;
|
|
6
|
-
private provider;
|
|
7
|
-
private clients;
|
|
8
|
-
private lastContext;
|
|
9
|
-
constructor(provider: ChannelProvider, id: string);
|
|
10
|
-
registerListeners(): void;
|
|
11
|
-
getCurrentContext(payload: {
|
|
12
|
-
type?: string;
|
|
13
|
-
}): OpenFin.Context | undefined;
|
|
14
|
-
setContext(payload: {
|
|
15
|
-
context: OpenFin.Context;
|
|
16
|
-
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
17
|
-
private getClientState;
|
|
18
|
-
handlerAdded(payload: {
|
|
19
|
-
handlerId: string;
|
|
20
|
-
contextType?: string;
|
|
21
|
-
}, clientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
22
|
-
handlerRemoved(payload: {
|
|
23
|
-
handlerId: string;
|
|
24
|
-
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
25
|
-
registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
|
|
26
|
-
onDisconnection(clientIdentity: OpenFin.ClientIdentity): void;
|
|
27
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const _1 = require(".");
|
|
4
|
-
class SessionContextGroupBroker {
|
|
5
|
-
constructor(provider, id) {
|
|
6
|
-
this.provider = provider;
|
|
7
|
-
this.id = id;
|
|
8
|
-
this.lastContext = undefined;
|
|
9
|
-
this.contextGroupMap = new Map();
|
|
10
|
-
this.clients = new Map();
|
|
11
|
-
this.registerListeners();
|
|
12
|
-
}
|
|
13
|
-
registerListeners() {
|
|
14
|
-
this.provider.register(`sessionContextGroup:getContext-${this.id}`, this.getCurrentContext.bind(this));
|
|
15
|
-
this.provider.register(`sessionContextGroup:setContext-${this.id}`, this.setContext.bind(this));
|
|
16
|
-
this.provider.register(`sessionContextGroup:handlerAdded-${this.id}`, this.handlerAdded.bind(this));
|
|
17
|
-
this.provider.register(`sessionContextGroup:handlerRemoved-${this.id}`, this.handlerRemoved.bind(this));
|
|
18
|
-
}
|
|
19
|
-
getCurrentContext(payload) {
|
|
20
|
-
return payload.type ? this.contextGroupMap.get(payload.type) : this.lastContext;
|
|
21
|
-
}
|
|
22
|
-
setContext(payload, clientIdentity) {
|
|
23
|
-
const { context } = payload;
|
|
24
|
-
const contextIntegrityCheckResult = _1.InteropBroker.checkContextIntegrity(context);
|
|
25
|
-
if (contextIntegrityCheckResult.isValid === false) {
|
|
26
|
-
throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
|
|
27
|
-
}
|
|
28
|
-
const clientState = this.getClientState(clientIdentity);
|
|
29
|
-
if (!clientState) {
|
|
30
|
-
// This shouldn't get hit.
|
|
31
|
-
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Session Client State Map`);
|
|
32
|
-
}
|
|
33
|
-
// set the context
|
|
34
|
-
this.contextGroupMap.set(context.type, context);
|
|
35
|
-
this.lastContext = context;
|
|
36
|
-
const clientSubscriptionStates = Array.from(this.clients.values());
|
|
37
|
-
clientSubscriptionStates.forEach((client) => {
|
|
38
|
-
var _a;
|
|
39
|
-
// eslint-disable-next-line no-unused-expressions
|
|
40
|
-
(_a = client.contextHandlers.get(context.type)) === null || _a === void 0 ? void 0 : _a.forEach((handlerId) => {
|
|
41
|
-
this.provider.dispatch(client.clientIdentity, handlerId, context);
|
|
42
|
-
});
|
|
43
|
-
if (client.globalHandler) {
|
|
44
|
-
this.provider.dispatch(client.clientIdentity, client.globalHandler, context);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
getClientState(id) {
|
|
49
|
-
return this.clients.get(id.endpointId);
|
|
50
|
-
}
|
|
51
|
-
async handlerAdded(payload, clientIdentity) {
|
|
52
|
-
const { handlerId, contextType } = payload;
|
|
53
|
-
const clientSubscriptionState = this.getClientState(clientIdentity);
|
|
54
|
-
if (!clientSubscriptionState) {
|
|
55
|
-
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
|
|
56
|
-
}
|
|
57
|
-
if (contextType) {
|
|
58
|
-
const currentHandlerList = clientSubscriptionState.contextHandlers.get(contextType) || [];
|
|
59
|
-
clientSubscriptionState.contextHandlers.set(contextType, [...currentHandlerList, handlerId]);
|
|
60
|
-
const currentContext = this.contextGroupMap.get(contextType);
|
|
61
|
-
if (currentContext) {
|
|
62
|
-
await this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
clientSubscriptionState.globalHandler = handlerId;
|
|
67
|
-
const globalDispatchPromises = [...this.contextGroupMap.keys()].map(async (currentContextType) => {
|
|
68
|
-
const currentContext = this.contextGroupMap.get(currentContextType);
|
|
69
|
-
if (currentContext) {
|
|
70
|
-
await this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
await Promise.all(globalDispatchPromises);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
handlerRemoved(payload, clientIdentity) {
|
|
77
|
-
const { handlerId } = payload;
|
|
78
|
-
const client = this.clients.get(clientIdentity.endpointId);
|
|
79
|
-
if (client) {
|
|
80
|
-
Array.from(client.contextHandlers).forEach(([, handlers]) => {
|
|
81
|
-
const index = handlers.indexOf(handlerId);
|
|
82
|
-
if (index > -1) {
|
|
83
|
-
handlers.splice(index, 1);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
if (client.globalHandler === handlerId) {
|
|
87
|
-
client.globalHandler = undefined;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. clientIdentity: ${clientIdentity}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
registerNewClient(clientIdentity) {
|
|
95
|
-
if (!this.clients.has(clientIdentity.endpointId)) {
|
|
96
|
-
const clientSubscriptionState = {
|
|
97
|
-
contextHandlers: new Map(),
|
|
98
|
-
clientIdentity,
|
|
99
|
-
globalHandler: undefined
|
|
100
|
-
};
|
|
101
|
-
this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
onDisconnection(clientIdentity) {
|
|
105
|
-
this.clients.delete(clientIdentity.endpointId);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.default = SessionContextGroupBroker;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import { Transport } from '../../transport/transport';
|
|
3
|
-
import { Base } from '../base';
|
|
4
|
-
export default class SessionContextGroupClient extends Base {
|
|
5
|
-
#private;
|
|
6
|
-
id: string;
|
|
7
|
-
constructor(wire: Transport, client: Promise<OpenFin.ChannelClient>, id: string);
|
|
8
|
-
/**
|
|
9
|
-
* Sets a context for the session context group.
|
|
10
|
-
* @param { Context } context - New context to set.
|
|
11
|
-
* @return { Promise<void> }
|
|
12
|
-
* @tutorial interop.setContext
|
|
13
|
-
*/
|
|
14
|
-
setContext(context: OpenFin.Context): Promise<void>;
|
|
15
|
-
getCurrentContext(type?: string): Promise<OpenFin.Context>;
|
|
16
|
-
addContextHandler(contextHandler: OpenFin.ContextHandler, contextType?: string): Promise<{
|
|
17
|
-
unsubscribe: () => void;
|
|
18
|
-
}>;
|
|
19
|
-
private createUnsubscribeCb;
|
|
20
|
-
getUserInstance(): OpenFin.SessionContextGroup;
|
|
21
|
-
}
|