@openfin/core 25.68.30 → 25.70.2
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 +30 -826
- package/README.md +12 -2
- package/package.json +1 -1
- package/src/api/application/Factory.d.ts +145 -145
- package/src/api/application/Factory.js +229 -229
- package/src/api/application/Instance.d.ts +301 -302
- package/src/api/application/Instance.js +412 -412
- package/src/api/application/index.d.ts +3 -3
- package/src/api/application/index.js +15 -15
- package/src/api/base.d.ts +43 -43
- package/src/api/base.js +177 -177
- package/src/api/clipboard/index.d.ts +69 -69
- package/src/api/clipboard/index.js +88 -88
- package/src/api/events/application.d.ts +69 -0
- package/src/api/events/application.js +2 -0
- package/src/api/events/base.d.ts +17 -0
- package/src/api/events/base.js +2 -0
- package/src/api/events/channel.d.ts +10 -11
- package/src/api/events/channel.js +2 -2
- package/src/api/events/emitterMap.d.ts +11 -11
- package/src/api/events/emitterMap.js +35 -35
- package/src/api/events/eventAggregator.d.ts +5 -5
- package/src/api/events/eventAggregator.js +43 -43
- package/src/api/events/externalApplication.d.ts +5 -0
- package/src/api/events/externalApplication.js +2 -0
- package/src/api/events/frame.d.ts +9 -0
- package/src/api/events/frame.js +2 -0
- package/src/api/events/globalHotkey.d.ts +10 -0
- package/src/api/events/globalHotkey.js +2 -0
- package/src/api/events/platform.d.ts +18 -0
- package/src/api/events/platform.js +2 -0
- package/src/api/events/system.d.ts +22 -0
- package/src/api/events/system.js +2 -0
- package/src/api/events/view.d.ts +56 -0
- package/src/api/events/view.js +2 -0
- package/src/api/events/webcontents.d.ts +48 -0
- package/src/api/events/webcontents.js +2 -0
- package/src/api/events/window.d.ts +176 -0
- package/src/api/events/window.js +2 -0
- package/src/api/external-application/Factory.d.ts +26 -26
- package/src/api/external-application/Factory.js +40 -40
- package/src/api/external-application/Instance.d.ts +101 -102
- package/src/api/external-application/Instance.js +109 -109
- package/src/api/external-application/index.d.ts +3 -3
- package/src/api/external-application/index.js +15 -15
- package/src/api/fin.d.ts +49 -49
- package/src/api/fin.js +43 -43
- package/src/api/frame/Factory.d.ts +36 -36
- package/src/api/frame/Factory.js +69 -69
- package/src/api/frame/Instance.d.ts +121 -121
- package/src/api/frame/Instance.js +130 -130
- package/src/api/frame/index.d.ts +3 -3
- package/src/api/frame/index.js +15 -15
- package/src/api/global-hotkey/index.d.ts +38 -38
- package/src/api/global-hotkey/index.js +58 -58
- package/src/api/interappbus/channel/channel.d.ts +26 -26
- package/src/api/interappbus/channel/channel.js +77 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
- package/src/api/interappbus/channel/channels-docs.js +376 -376
- package/src/api/interappbus/channel/client.d.ts +22 -22
- package/src/api/interappbus/channel/client.js +84 -84
- package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
- package/src/api/interappbus/channel/connection-manager.js +244 -244
- package/src/api/interappbus/channel/index.d.ts +22 -23
- package/src/api/interappbus/channel/index.js +121 -121
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
- package/src/api/interappbus/channel/protocols/index.js +2 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
- package/src/api/interappbus/channel/protocols/strategy.js +2 -2
- package/src/api/interappbus/channel/provider.d.ts +31 -31
- package/src/api/interappbus/channel/provider.js +160 -160
- package/src/api/interappbus/index.d.ts +85 -86
- package/src/api/interappbus/index.js +175 -175
- package/src/api/interop/Factory.d.ts +37 -37
- package/src/api/interop/Factory.js +54 -54
- package/src/api/interop/InteropBroker.d.ts +363 -363
- package/src/api/interop/InteropBroker.js +914 -914
- package/src/api/interop/InteropClient.d.ts +268 -268
- package/src/api/interop/InteropClient.js +450 -450
- package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
- package/src/api/interop/SessionContextGroupBroker.js +107 -107
- package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
- package/src/api/interop/SessionContextGroupClient.js +85 -85
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
- package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
- package/src/api/interop/fdc3/fdc3.js +17 -17
- package/src/api/interop/fdc3/utils.d.ts +6 -6
- package/src/api/interop/fdc3/utils.js +17 -17
- package/src/api/interop/index.d.ts +4 -4
- package/src/api/interop/index.js +16 -16
- package/src/api/interop/utils.d.ts +11 -11
- package/src/api/interop/utils.js +36 -36
- package/src/api/me.d.ts +38 -35
- package/src/api/me.js +128 -60
- package/src/api/platform/Factory.d.ts +109 -109
- package/src/api/platform/Factory.js +188 -188
- package/src/api/platform/Instance.d.ts +122 -122
- package/src/api/platform/Instance.js +298 -298
- package/src/api/platform/common-utils.d.ts +6 -6
- package/src/api/platform/common-utils.js +16 -16
- package/src/api/platform/index.d.ts +3 -3
- package/src/api/platform/index.js +15 -15
- package/src/api/platform/layout/Factory.d.ts +108 -108
- package/src/api/platform/layout/Factory.js +189 -189
- package/src/api/platform/layout/Instance.d.ts +49 -49
- package/src/api/platform/layout/Instance.js +99 -99
- package/src/api/platform/layout/index.d.ts +2 -2
- package/src/api/platform/layout/index.js +14 -14
- package/src/api/platform/layout/shapes.d.ts +11 -0
- package/src/api/{window → platform/layout}/shapes.js +2 -2
- package/src/api/snapshot-source/Factory.d.ts +36 -36
- package/src/api/snapshot-source/Factory.js +65 -65
- package/src/api/snapshot-source/Instance.d.ts +30 -30
- package/src/api/snapshot-source/Instance.js +134 -134
- package/src/api/snapshot-source/index.d.ts +3 -3
- package/src/api/snapshot-source/index.js +15 -15
- package/src/api/snapshot-source/utils.d.ts +1 -1
- package/src/api/snapshot-source/utils.js +5 -5
- package/src/api/system/index.d.ts +960 -961
- package/src/api/system/index.js +1241 -1241
- package/src/api/view/Factory.d.ts +49 -49
- package/src/api/view/Factory.js +103 -103
- package/src/api/view/Instance.d.ts +387 -380
- package/src/api/view/Instance.js +422 -415
- package/src/api/view/index.d.ts +3 -3
- package/src/api/view/index.js +15 -15
- package/src/api/webcontents/main.d.ts +36 -36
- package/src/api/webcontents/main.js +82 -82
- package/src/api/window/Factory.d.ts +44 -44
- package/src/api/window/Factory.js +91 -91
- package/src/api/window/Instance.d.ts +972 -966
- package/src/api/window/Instance.js +1209 -1202
- package/src/api/window/index.d.ts +3 -5
- package/src/api/window/index.js +15 -17
- package/src/environment/environment.d.ts +28 -25
- package/src/environment/environment.js +4 -4
- package/src/environment/node-env.d.ts +25 -26
- package/src/environment/node-env.js +64 -64
- package/src/environment/openfin-env.d.ts +29 -30
- package/src/environment/openfin-env.js +107 -107
- package/src/mock.d.ts +3 -3
- package/src/mock.js +91 -90
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
- package/src/shapes/ERROR_BOX_TYPES.js +2 -0
- package/src/shapes/WebOptions.d.ts +12 -0
- package/src/shapes/WebOptions.js +2 -0
- package/src/shapes/WindowOptions.d.ts +42 -0
- package/src/shapes/WindowOptions.js +2 -0
- package/src/shapes/protocol.d.ts +178 -0
- package/src/shapes/protocol.js +2 -0
- package/src/transport/fin_store.d.ts +4 -4
- package/src/transport/fin_store.js +16 -16
- package/src/transport/transport-errors.d.ts +18 -18
- package/src/transport/transport-errors.js +37 -37
- package/src/transport/transport.d.ts +56 -43
- package/src/transport/transport.js +181 -181
- package/src/transport/wire.d.ts +71 -11
- package/src/transport/wire.js +32 -32
- package/src/util/asyncFilter.d.ts +1 -1
- package/src/util/asyncFilter.js +7 -7
- package/src/util/errors.d.ts +9 -5
- package/src/util/errors.js +11 -11
- package/src/util/exhaustive.d.ts +1 -1
- package/src/util/exhaustive.js +7 -7
- package/src/util/http.d.ts +11 -11
- package/src/util/http.js +83 -83
- package/src/util/normalize-config.d.ts +3 -5
- package/src/util/normalize-config.js +47 -47
- package/src/util/promises.d.ts +5 -5
- package/src/util/promises.js +27 -27
- package/src/util/ref-counter.d.ts +7 -7
- package/src/util/ref-counter.js +51 -51
- package/src/util/runtimeVersioning.d.ts +3 -3
- package/src/util/runtimeVersioning.js +25 -25
- package/src/util/utilTypes.d.ts +8 -8
- package/src/util/utilTypes.js +2 -2
- package/src/util/validate.d.ts +3 -3
- package/src/util/validate.js +11 -11
- package/docs.README(OLD).md +0 -82
- package/resources/win/OpenFinRVM.exe +0 -0
- package/src/api/window/bounds-changed.d.ts +0 -10
- package/src/api/window/bounds-changed.js +0 -6
- package/src/api/window/shapes.d.ts +0 -13
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { ChannelProvider } from '../interappbus/channel/provider';
|
|
2
|
-
export default class SessionContextGroupBroker {
|
|
3
|
-
id: string;
|
|
4
|
-
private contextGroupMap;
|
|
5
|
-
private provider;
|
|
6
|
-
private clients;
|
|
7
|
-
private lastContext;
|
|
8
|
-
constructor(provider: ChannelProvider, id: string);
|
|
9
|
-
registerListeners(): void;
|
|
10
|
-
getCurrentContext(payload: {
|
|
11
|
-
type?: string;
|
|
12
|
-
}): OpenFin.Context | undefined;
|
|
13
|
-
setContext(payload: {
|
|
14
|
-
context: OpenFin.Context;
|
|
15
|
-
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
16
|
-
private getClientState;
|
|
17
|
-
handlerAdded(payload: {
|
|
18
|
-
handlerId: string;
|
|
19
|
-
contextType?: string;
|
|
20
|
-
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
21
|
-
handlerRemoved(payload: {
|
|
22
|
-
handlerId: string;
|
|
23
|
-
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
24
|
-
registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
|
|
25
|
-
onDisconnection(clientIdentity: OpenFin.ClientIdentity): void;
|
|
26
|
-
}
|
|
1
|
+
import type { ChannelProvider } from '../interappbus/channel/provider';
|
|
2
|
+
export default class SessionContextGroupBroker {
|
|
3
|
+
id: string;
|
|
4
|
+
private contextGroupMap;
|
|
5
|
+
private provider;
|
|
6
|
+
private clients;
|
|
7
|
+
private lastContext;
|
|
8
|
+
constructor(provider: ChannelProvider, id: string);
|
|
9
|
+
registerListeners(): void;
|
|
10
|
+
getCurrentContext(payload: {
|
|
11
|
+
type?: string;
|
|
12
|
+
}): OpenFin.Context | undefined;
|
|
13
|
+
setContext(payload: {
|
|
14
|
+
context: OpenFin.Context;
|
|
15
|
+
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
16
|
+
private getClientState;
|
|
17
|
+
handlerAdded(payload: {
|
|
18
|
+
handlerId: string;
|
|
19
|
+
contextType?: string;
|
|
20
|
+
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
21
|
+
handlerRemoved(payload: {
|
|
22
|
+
handlerId: string;
|
|
23
|
+
}, clientIdentity: OpenFin.ClientIdentity): void;
|
|
24
|
+
registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
|
|
25
|
+
onDisconnection(clientIdentity: OpenFin.ClientIdentity): void;
|
|
26
|
+
}
|
|
@@ -1,107 +1,107 @@
|
|
|
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
|
-
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
|
-
this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
clientSubscriptionState.globalHandler = handlerId;
|
|
67
|
-
[...this.contextGroupMap.keys()].forEach((currentContextType) => {
|
|
68
|
-
const currentContext = this.contextGroupMap.get(currentContextType);
|
|
69
|
-
if (currentContext) {
|
|
70
|
-
this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
handlerRemoved(payload, clientIdentity) {
|
|
76
|
-
const { handlerId } = payload;
|
|
77
|
-
const client = this.clients.get(clientIdentity.endpointId);
|
|
78
|
-
if (client) {
|
|
79
|
-
Array.from(client.contextHandlers).forEach(([, handlers]) => {
|
|
80
|
-
const index = handlers.indexOf(handlerId);
|
|
81
|
-
if (index > -1) {
|
|
82
|
-
handlers.splice(index, 1);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
if (client.globalHandler === handlerId) {
|
|
86
|
-
client.globalHandler = undefined;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. clientIdentity: ${clientIdentity}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
registerNewClient(clientIdentity) {
|
|
94
|
-
if (!this.clients.has(clientIdentity.endpointId)) {
|
|
95
|
-
const clientSubscriptionState = {
|
|
96
|
-
contextHandlers: new Map(),
|
|
97
|
-
clientIdentity,
|
|
98
|
-
globalHandler: undefined
|
|
99
|
-
};
|
|
100
|
-
this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
onDisconnection(clientIdentity) {
|
|
104
|
-
this.clients.delete(clientIdentity.endpointId);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.default = SessionContextGroupBroker;
|
|
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
|
+
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
|
+
this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
clientSubscriptionState.globalHandler = handlerId;
|
|
67
|
+
[...this.contextGroupMap.keys()].forEach((currentContextType) => {
|
|
68
|
+
const currentContext = this.contextGroupMap.get(currentContextType);
|
|
69
|
+
if (currentContext) {
|
|
70
|
+
this.provider.dispatch(clientIdentity, handlerId, currentContext);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
handlerRemoved(payload, clientIdentity) {
|
|
76
|
+
const { handlerId } = payload;
|
|
77
|
+
const client = this.clients.get(clientIdentity.endpointId);
|
|
78
|
+
if (client) {
|
|
79
|
+
Array.from(client.contextHandlers).forEach(([, handlers]) => {
|
|
80
|
+
const index = handlers.indexOf(handlerId);
|
|
81
|
+
if (index > -1) {
|
|
82
|
+
handlers.splice(index, 1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (client.globalHandler === handlerId) {
|
|
86
|
+
client.globalHandler = undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.warn(`Trying to remove a handler from a client that isn't mapped. handlerId: ${handlerId}. clientIdentity: ${clientIdentity}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
registerNewClient(clientIdentity) {
|
|
94
|
+
if (!this.clients.has(clientIdentity.endpointId)) {
|
|
95
|
+
const clientSubscriptionState = {
|
|
96
|
+
contextHandlers: new Map(),
|
|
97
|
+
clientIdentity,
|
|
98
|
+
globalHandler: undefined
|
|
99
|
+
};
|
|
100
|
+
this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
onDisconnection(clientIdentity) {
|
|
104
|
+
this.clients.delete(clientIdentity.endpointId);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.default = SessionContextGroupBroker;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import Transport from '../../transport/transport';
|
|
2
|
-
import { Base } from '../base';
|
|
3
|
-
export default class SessionContextGroupClient extends Base {
|
|
4
|
-
#private;
|
|
5
|
-
id: string;
|
|
6
|
-
constructor(wire: Transport, client: Promise<OpenFin.ChannelClient>, id: string);
|
|
7
|
-
/**
|
|
8
|
-
* Sets a context for the session context group.
|
|
9
|
-
* @param { Context } context - New context to set.
|
|
10
|
-
* @return { Promise<void> }
|
|
11
|
-
* @tutorial interop.setContext
|
|
12
|
-
*/
|
|
13
|
-
setContext(context: OpenFin.Context): Promise<void>;
|
|
14
|
-
getCurrentContext(type?: string): Promise<OpenFin.Context>;
|
|
15
|
-
addContextHandler(contextHandler: OpenFin.ContextHandler, contextType?: string): Promise<{
|
|
16
|
-
unsubscribe: () => void;
|
|
17
|
-
}>;
|
|
18
|
-
private createUnsubscribeCb;
|
|
19
|
-
getUserInstance(): OpenFin.SessionContextGroup;
|
|
20
|
-
}
|
|
1
|
+
import Transport from '../../transport/transport';
|
|
2
|
+
import { Base } from '../base';
|
|
3
|
+
export default class SessionContextGroupClient extends Base {
|
|
4
|
+
#private;
|
|
5
|
+
id: string;
|
|
6
|
+
constructor(wire: Transport, client: Promise<OpenFin.ChannelClient>, id: string);
|
|
7
|
+
/**
|
|
8
|
+
* Sets a context for the session context group.
|
|
9
|
+
* @param { Context } context - New context to set.
|
|
10
|
+
* @return { Promise<void> }
|
|
11
|
+
* @tutorial interop.setContext
|
|
12
|
+
*/
|
|
13
|
+
setContext(context: OpenFin.Context): Promise<void>;
|
|
14
|
+
getCurrentContext(type?: string): Promise<OpenFin.Context>;
|
|
15
|
+
addContextHandler(contextHandler: OpenFin.ContextHandler, contextType?: string): Promise<{
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
}>;
|
|
18
|
+
private createUnsubscribeCb;
|
|
19
|
+
getUserInstance(): OpenFin.SessionContextGroup;
|
|
20
|
+
}
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
3
|
-
if (!privateMap.has(receiver)) {
|
|
4
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
5
|
-
}
|
|
6
|
-
privateMap.set(receiver, value);
|
|
7
|
-
return value;
|
|
8
|
-
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
10
|
-
if (!privateMap.has(receiver)) {
|
|
11
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
12
|
-
}
|
|
13
|
-
return privateMap.get(receiver);
|
|
14
|
-
};
|
|
15
|
-
var _clientPromise;
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const base_1 = require("../base");
|
|
18
|
-
const utils_1 = require("./utils");
|
|
19
|
-
class SessionContextGroupClient extends base_1.Base {
|
|
20
|
-
constructor(wire, client, id) {
|
|
21
|
-
super(wire);
|
|
22
|
-
_clientPromise.set(this, void 0);
|
|
23
|
-
this.id = id;
|
|
24
|
-
__classPrivateFieldSet(this, _clientPromise, client);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Sets a context for the session context group.
|
|
28
|
-
* @param { Context } context - New context to set.
|
|
29
|
-
* @return { Promise<void> }
|
|
30
|
-
* @tutorial interop.setContext
|
|
31
|
-
*/
|
|
32
|
-
async setContext(context) {
|
|
33
|
-
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
|
34
|
-
// don't expose, analytics-only call
|
|
35
|
-
});
|
|
36
|
-
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
37
|
-
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
|
38
|
-
sessionContextGroupId: this.id,
|
|
39
|
-
context
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async getCurrentContext(type) {
|
|
43
|
-
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
|
44
|
-
// don't expose, analytics-only call
|
|
45
|
-
});
|
|
46
|
-
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
47
|
-
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
|
48
|
-
sessionContextGroupId: this.id,
|
|
49
|
-
type
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
async addContextHandler(contextHandler, contextType) {
|
|
53
|
-
this.wire.sendAction('interop-session-context-group-add-handler').catch((e) => {
|
|
54
|
-
// don't expose, analytics-only call
|
|
55
|
-
});
|
|
56
|
-
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
57
|
-
let handlerId;
|
|
58
|
-
if (contextType) {
|
|
59
|
-
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${utils_1.generateId()}`;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
handlerId = `sessionContextHandler:invoke-${this.id}`;
|
|
63
|
-
}
|
|
64
|
-
client.register(handlerId, utils_1.wrapContextHandler(contextHandler, handlerId));
|
|
65
|
-
client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
|
|
66
|
-
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
|
67
|
-
}
|
|
68
|
-
async createUnsubscribeCb(handlerId) {
|
|
69
|
-
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
70
|
-
return async () => {
|
|
71
|
-
client.remove(handlerId);
|
|
72
|
-
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
getUserInstance() {
|
|
76
|
-
return {
|
|
77
|
-
id: this.id,
|
|
78
|
-
setContext: utils_1.wrapInTryCatch(this.setContext.bind(this), 'Failed to set context: '),
|
|
79
|
-
getCurrentContext: utils_1.wrapInTryCatch(this.getCurrentContext.bind(this), 'Failed to get context: '),
|
|
80
|
-
addContextHandler: utils_1.wrapInTryCatch(this.addContextHandler.bind(this), 'Failed to add context handler: ')
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.default = SessionContextGroupClient;
|
|
85
|
-
_clientPromise = new WeakMap();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
3
|
+
if (!privateMap.has(receiver)) {
|
|
4
|
+
throw new TypeError("attempted to set private field on non-instance");
|
|
5
|
+
}
|
|
6
|
+
privateMap.set(receiver, value);
|
|
7
|
+
return value;
|
|
8
|
+
};
|
|
9
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
10
|
+
if (!privateMap.has(receiver)) {
|
|
11
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
12
|
+
}
|
|
13
|
+
return privateMap.get(receiver);
|
|
14
|
+
};
|
|
15
|
+
var _clientPromise;
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const base_1 = require("../base");
|
|
18
|
+
const utils_1 = require("./utils");
|
|
19
|
+
class SessionContextGroupClient extends base_1.Base {
|
|
20
|
+
constructor(wire, client, id) {
|
|
21
|
+
super(wire);
|
|
22
|
+
_clientPromise.set(this, void 0);
|
|
23
|
+
this.id = id;
|
|
24
|
+
__classPrivateFieldSet(this, _clientPromise, client);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets a context for the session context group.
|
|
28
|
+
* @param { Context } context - New context to set.
|
|
29
|
+
* @return { Promise<void> }
|
|
30
|
+
* @tutorial interop.setContext
|
|
31
|
+
*/
|
|
32
|
+
async setContext(context) {
|
|
33
|
+
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
|
34
|
+
// don't expose, analytics-only call
|
|
35
|
+
});
|
|
36
|
+
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
37
|
+
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
|
38
|
+
sessionContextGroupId: this.id,
|
|
39
|
+
context
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async getCurrentContext(type) {
|
|
43
|
+
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
|
44
|
+
// don't expose, analytics-only call
|
|
45
|
+
});
|
|
46
|
+
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
47
|
+
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
|
48
|
+
sessionContextGroupId: this.id,
|
|
49
|
+
type
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async addContextHandler(contextHandler, contextType) {
|
|
53
|
+
this.wire.sendAction('interop-session-context-group-add-handler').catch((e) => {
|
|
54
|
+
// don't expose, analytics-only call
|
|
55
|
+
});
|
|
56
|
+
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
57
|
+
let handlerId;
|
|
58
|
+
if (contextType) {
|
|
59
|
+
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${utils_1.generateId()}`;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
handlerId = `sessionContextHandler:invoke-${this.id}`;
|
|
63
|
+
}
|
|
64
|
+
client.register(handlerId, utils_1.wrapContextHandler(contextHandler, handlerId));
|
|
65
|
+
client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
|
|
66
|
+
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
|
67
|
+
}
|
|
68
|
+
async createUnsubscribeCb(handlerId) {
|
|
69
|
+
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
70
|
+
return async () => {
|
|
71
|
+
client.remove(handlerId);
|
|
72
|
+
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
getUserInstance() {
|
|
76
|
+
return {
|
|
77
|
+
id: this.id,
|
|
78
|
+
setContext: utils_1.wrapInTryCatch(this.setContext.bind(this), 'Failed to set context: '),
|
|
79
|
+
getCurrentContext: utils_1.wrapInTryCatch(this.getCurrentContext.bind(this), 'Failed to get context: '),
|
|
80
|
+
addContextHandler: utils_1.wrapInTryCatch(this.addContextHandler.bind(this), 'Failed to add context handler: ')
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.default = SessionContextGroupClient;
|
|
85
|
+
_clientPromise = new WeakMap();
|