@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,34 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../../OpenFin';
|
|
2
|
-
import { ChannelBase } from './channel';
|
|
3
|
-
import { Transport } from '../../../transport/transport';
|
|
4
|
-
import { AnyStrategy } from './protocols/strategy-types';
|
|
5
|
-
type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
6
|
-
type ClientIdentity = OpenFin.ClientIdentity;
|
|
7
|
-
export type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
|
|
8
|
-
export type DisconnectionListener = (identity: ClientIdentity) => any;
|
|
9
|
-
export declare class ChannelProvider extends ChannelBase {
|
|
10
|
-
#private;
|
|
11
|
-
private static removalMap;
|
|
12
|
-
private connectListener;
|
|
13
|
-
private disconnectListener;
|
|
14
|
-
get connections(): OpenFin.ClientConnectionPayload[];
|
|
15
|
-
static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
|
|
16
|
-
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
17
|
-
constructor(providerIdentity: ProviderIdentity, wire: Transport, strategy: AnyStrategy);
|
|
18
|
-
dispatch(to: OpenFin.ClientIdentity | OpenFin.Identity, action: string, payload?: any): Promise<any>;
|
|
19
|
-
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime) => Promise<any>;
|
|
20
|
-
processConnection(senderId: OpenFin.ClientConnectionPayload, payload: any): Promise<any>;
|
|
21
|
-
publish(action: string, payload: any): Promise<any>[];
|
|
22
|
-
onConnection(listener: ConnectionListener): void;
|
|
23
|
-
onDisconnection(listener: DisconnectionListener): void;
|
|
24
|
-
destroy(): Promise<void>;
|
|
25
|
-
getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
|
|
26
|
-
private checkForClientConnection;
|
|
27
|
-
private isClientConnected;
|
|
28
|
-
private isLegacyClientConnected;
|
|
29
|
-
private handleMultiRuntimeLegacyClient;
|
|
30
|
-
private getEndpointIdForOpenFinId;
|
|
31
|
-
private static clientIdentityIncludesEndpointId;
|
|
32
|
-
private static clientIsMultiRuntime;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
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");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
|
-
var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ChannelProvider = void 0;
|
|
16
|
-
const channel_1 = require("./channel");
|
|
17
|
-
const runtimeVersioning_1 = require("../../../util/runtimeVersioning");
|
|
18
|
-
class ChannelProvider extends channel_1.ChannelBase {
|
|
19
|
-
get connections() {
|
|
20
|
-
return [...__classPrivateFieldGet(this, _ChannelProvider_connections, "f")];
|
|
21
|
-
}
|
|
22
|
-
static handleClientDisconnection(channel, payload) {
|
|
23
|
-
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
|
24
|
-
if (removeById) {
|
|
25
|
-
__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const multipleRemoves = channel.connections.filter((identity) => {
|
|
29
|
-
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
30
|
-
});
|
|
31
|
-
multipleRemoves.forEach(__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
32
|
-
}
|
|
33
|
-
channel.disconnectListener(payload);
|
|
34
|
-
}
|
|
35
|
-
static setProviderRemoval(provider, remove) {
|
|
36
|
-
ChannelProvider.removalMap.set(provider, remove);
|
|
37
|
-
}
|
|
38
|
-
constructor(providerIdentity, wire, strategy) {
|
|
39
|
-
super();
|
|
40
|
-
_ChannelProvider_connections.set(this, void 0);
|
|
41
|
-
_ChannelProvider_protectedObj.set(this, void 0);
|
|
42
|
-
_ChannelProvider_strategy.set(this, void 0);
|
|
43
|
-
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
|
44
|
-
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
45
|
-
__classPrivateFieldGet(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
|
46
|
-
__classPrivateFieldSet(this, _ChannelProvider_connections, remainingConnections, "f");
|
|
47
|
-
});
|
|
48
|
-
// Must be bound.
|
|
49
|
-
this.processAction = async (action, payload, senderIdentity) => {
|
|
50
|
-
if (ChannelProvider.clientIsMultiRuntime(senderIdentity) &&
|
|
51
|
-
!(0, runtimeVersioning_1.runtimeUuidMeetsMinimumRuntimeVersion)(senderIdentity.runtimeUuid, '18.87.56.0')) {
|
|
52
|
-
this.handleMultiRuntimeLegacyClient(senderIdentity);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.checkForClientConnection(senderIdentity);
|
|
56
|
-
}
|
|
57
|
-
return super.processAction(action, payload, senderIdentity);
|
|
58
|
-
};
|
|
59
|
-
_ChannelProvider_close.set(this, () => {
|
|
60
|
-
__classPrivateFieldGet(this, _ChannelProvider_strategy, "f").close();
|
|
61
|
-
const remove = ChannelProvider.removalMap.get(this);
|
|
62
|
-
if (remove) {
|
|
63
|
-
remove();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
__classPrivateFieldSet(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, wire), "f");
|
|
67
|
-
this.connectListener = () => undefined;
|
|
68
|
-
this.disconnectListener = () => undefined;
|
|
69
|
-
__classPrivateFieldSet(this, _ChannelProvider_connections, [], "f");
|
|
70
|
-
__classPrivateFieldSet(this, _ChannelProvider_strategy, strategy, "f");
|
|
71
|
-
strategy.receive(this.processAction);
|
|
72
|
-
}
|
|
73
|
-
dispatch(to, action, payload) {
|
|
74
|
-
var _a;
|
|
75
|
-
const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
|
|
76
|
-
if (endpointId && __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
77
|
-
return __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
|
|
78
|
-
}
|
|
79
|
-
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
80
|
-
}
|
|
81
|
-
async processConnection(senderId, payload) {
|
|
82
|
-
__classPrivateFieldGet(this, _ChannelProvider_connections, "f").push(senderId);
|
|
83
|
-
return this.connectListener(senderId, payload);
|
|
84
|
-
}
|
|
85
|
-
publish(action, payload) {
|
|
86
|
-
return this.connections.map((to) => __classPrivateFieldGet(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
|
87
|
-
}
|
|
88
|
-
onConnection(listener) {
|
|
89
|
-
this.connectListener = listener;
|
|
90
|
-
}
|
|
91
|
-
onDisconnection(listener) {
|
|
92
|
-
this.disconnectListener = listener;
|
|
93
|
-
}
|
|
94
|
-
async destroy() {
|
|
95
|
-
const protectedObj = __classPrivateFieldGet(this, _ChannelProvider_protectedObj, "f");
|
|
96
|
-
const { channelName } = protectedObj.providerIdentity;
|
|
97
|
-
__classPrivateFieldSet(this, _ChannelProvider_connections, [], "f");
|
|
98
|
-
await protectedObj.wire.sendAction('destroy-channel', { channelName });
|
|
99
|
-
__classPrivateFieldGet(this, _ChannelProvider_close, "f").call(this);
|
|
100
|
-
}
|
|
101
|
-
async getAllClientInfo() {
|
|
102
|
-
return this.connections.map((clientInfo) => {
|
|
103
|
-
const { uuid, name, endpointId, entityType, connectionUrl } = clientInfo;
|
|
104
|
-
return { uuid, name, endpointId, entityType, connectionUrl };
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
checkForClientConnection(clientIdentity) {
|
|
108
|
-
if (!this.isClientConnected(clientIdentity)) {
|
|
109
|
-
throw new Error(`This action was sent from a client that is not connected to the provider.
|
|
110
|
-
Client Identity: {uuid: ${clientIdentity.uuid}, name: ${clientIdentity.name}, endpointId: ${clientIdentity.endpointId}}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
isClientConnected(clientIdentity) {
|
|
114
|
-
if (ChannelProvider.clientIdentityIncludesEndpointId(clientIdentity)) {
|
|
115
|
-
return this.connections.some((identity) => {
|
|
116
|
-
return (
|
|
117
|
-
// Might be redundant to check for uuid and name here after we get an endpointId match, but just in case
|
|
118
|
-
identity.endpointId === clientIdentity.endpointId &&
|
|
119
|
-
identity.uuid === clientIdentity.uuid &&
|
|
120
|
-
identity.name === clientIdentity.name);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return this.isLegacyClientConnected(clientIdentity);
|
|
124
|
-
}
|
|
125
|
-
isLegacyClientConnected(clientIdentity) {
|
|
126
|
-
return this.connections.some((identity) => {
|
|
127
|
-
return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
handleMultiRuntimeLegacyClient(senderIdentity) {
|
|
131
|
-
if (!this.isLegacyClientConnected(senderIdentity)) {
|
|
132
|
-
throw new Error(`This action was sent from a client that is not connected to the provider. Client Identity:
|
|
133
|
-
{uuid: ${senderIdentity.uuid}, name: ${senderIdentity.name}, endpointId: ${senderIdentity.endpointId}}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
137
|
-
var _a;
|
|
138
|
-
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
139
|
-
if (matchingConnections.length >= 2) {
|
|
140
|
-
const protectedObj = __classPrivateFieldGet(this, _ChannelProvider_protectedObj, "f");
|
|
141
|
-
const { uuid, name } = clientIdentity;
|
|
142
|
-
const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
|
|
143
|
-
const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
|
|
144
|
-
// eslint-disable-next-line no-console
|
|
145
|
-
console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
|
|
146
|
-
"endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
|
|
147
|
-
has multiple channelClients for this channel. Your dispatched action: (${action}) from the provider:
|
|
148
|
-
({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
|
|
149
|
-
}
|
|
150
|
-
// Pop to return the most recently created endpointId.
|
|
151
|
-
return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
|
|
152
|
-
}
|
|
153
|
-
// eslint-disable-next-line class-methods-use-this
|
|
154
|
-
static clientIdentityIncludesEndpointId(subscriptionIdentity) {
|
|
155
|
-
return subscriptionIdentity.endpointId !== undefined;
|
|
156
|
-
}
|
|
157
|
-
// eslint-disable-next-line class-methods-use-this
|
|
158
|
-
static clientIsMultiRuntime(subscriptionIdentity) {
|
|
159
|
-
return subscriptionIdentity.runtimeUuid !== undefined;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
exports.ChannelProvider = ChannelProvider;
|
|
163
|
-
_ChannelProvider_connections = new WeakMap(), _ChannelProvider_protectedObj = new WeakMap(), _ChannelProvider_strategy = new WeakMap(), _ChannelProvider_removeEndpoint = new WeakMap(), _ChannelProvider_close = new WeakMap();
|
|
164
|
-
// The following line should be changed following a typescript update.
|
|
165
|
-
// static #removalMap = new WeakMap<ChannelProvider, Function>();
|
|
166
|
-
ChannelProvider.removalMap = new WeakMap();
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import { Base } from '../base';
|
|
4
|
-
import { Transport, Message } from '../../transport/transport';
|
|
5
|
-
import { Channel } from './channel/index';
|
|
6
|
-
/**
|
|
7
|
-
* A messaging bus that allows for pub/sub messaging between different applications.
|
|
8
|
-
* @namespace
|
|
9
|
-
*/
|
|
10
|
-
export default class InterApplicationBus extends Base {
|
|
11
|
-
Channel: Channel;
|
|
12
|
-
events: {
|
|
13
|
-
subscriberAdded: string;
|
|
14
|
-
subscriberRemoved: string;
|
|
15
|
-
};
|
|
16
|
-
private refCounter;
|
|
17
|
-
protected emitter: EventEmitter;
|
|
18
|
-
on: any;
|
|
19
|
-
removeAllListeners: any;
|
|
20
|
-
constructor(wire: Transport);
|
|
21
|
-
/**
|
|
22
|
-
* Publishes a message to all applications running on OpenFin Runtime that
|
|
23
|
-
* are subscribed to the specified topic.
|
|
24
|
-
* @param { string } topic The topic on which the message is sent
|
|
25
|
-
* @param { any } message The message to be published. Can be either a primitive
|
|
26
|
-
* data type (string, number, or boolean) or composite data type (object, array)
|
|
27
|
-
* that is composed of other primitive or composite data types
|
|
28
|
-
* @return {Promise.<void>}
|
|
29
|
-
* @tutorial InterApplicationBus.publish
|
|
30
|
-
*/
|
|
31
|
-
publish(topic: string, message: any): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Sends a message to a specific application on a specific topic.
|
|
34
|
-
* @param { Identity } destination The identity of the application to which the message is sent
|
|
35
|
-
* @param { string } topic The topic on which the message is sent
|
|
36
|
-
* @param { any } message The message to be sent. Can be either a primitive data
|
|
37
|
-
* type (string, number, or boolean) or composite data type (object, array) that
|
|
38
|
-
* is composed of other primitive or composite data types
|
|
39
|
-
* @return {Promise.<void>}
|
|
40
|
-
* @tutorial InterApplicationBus.send
|
|
41
|
-
*/
|
|
42
|
-
send(destination: {
|
|
43
|
-
uuid: string;
|
|
44
|
-
name?: string;
|
|
45
|
-
}, topic: string, message: any): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Subscribes to messages from the specified application on the specified topic.
|
|
48
|
-
* @param { Identity } source This object is described in the Identity in the typedef
|
|
49
|
-
* @param { string } topic The topic on which the message is sent
|
|
50
|
-
* @param { function } listener A function that is called when a message has
|
|
51
|
-
* been received. It is passed the message, uuid and name of the sending application.
|
|
52
|
-
* The message can be either a primitive data type (string, number, or boolean) or
|
|
53
|
-
* composite data type (object, array) that is composed of other primitive or composite
|
|
54
|
-
* data types
|
|
55
|
-
* @return {Promise.<void>}
|
|
56
|
-
* @tutorial InterApplicationBus.subscribe
|
|
57
|
-
*/
|
|
58
|
-
subscribe(source: {
|
|
59
|
-
uuid: string;
|
|
60
|
-
name?: string;
|
|
61
|
-
}, topic: string, listener: any): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Unsubscribes to messages from the specified application on the specified topic.
|
|
64
|
-
* @param { Identity } source This object is described in the Identity in the typedef
|
|
65
|
-
* @param { string } topic The topic on which the message is sent
|
|
66
|
-
* @param { function } listener A callback previously registered with subscribe()
|
|
67
|
-
* @return {Promise.<void>}
|
|
68
|
-
* @tutorial InterApplicationBus.unsubscribe
|
|
69
|
-
*/
|
|
70
|
-
unsubscribe(source: {
|
|
71
|
-
uuid: string;
|
|
72
|
-
name?: string;
|
|
73
|
-
}, topic: string, listener: any): Promise<void>;
|
|
74
|
-
private processMessage;
|
|
75
|
-
private emitSubscriverEvent;
|
|
76
|
-
protected createSubscriptionKey(uuid: string, name: string, topic: string): string;
|
|
77
|
-
protected onmessage(message: Message<InterAppPayload>): boolean;
|
|
78
|
-
}
|
|
79
|
-
export declare class InterAppPayload {
|
|
80
|
-
sourceUuid: string;
|
|
81
|
-
sourceWindowName: string;
|
|
82
|
-
topic: string;
|
|
83
|
-
destinationUuid?: string;
|
|
84
|
-
message?: any;
|
|
85
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InterAppPayload = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const ref_counter_1 = require("../../util/ref-counter");
|
|
7
|
-
const index_1 = require("./channel/index");
|
|
8
|
-
const validate_1 = require("../../util/validate");
|
|
9
|
-
/**
|
|
10
|
-
* A messaging bus that allows for pub/sub messaging between different applications.
|
|
11
|
-
* @namespace
|
|
12
|
-
*/
|
|
13
|
-
class InterApplicationBus extends base_1.Base {
|
|
14
|
-
constructor(wire) {
|
|
15
|
-
super(wire);
|
|
16
|
-
this.events = {
|
|
17
|
-
subscriberAdded: 'subscriber-added',
|
|
18
|
-
subscriberRemoved: 'subscriber-removed'
|
|
19
|
-
};
|
|
20
|
-
this.refCounter = new ref_counter_1.RefCounter();
|
|
21
|
-
this.Channel = new index_1.Channel(wire);
|
|
22
|
-
this.emitter = new events_1.EventEmitter();
|
|
23
|
-
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
24
|
-
this.on = this.emitter.on.bind(this.emitter);
|
|
25
|
-
this.removeAllListeners = this.emitter.removeAllListeners.bind(this.emitter);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Publishes a message to all applications running on OpenFin Runtime that
|
|
29
|
-
* are subscribed to the specified topic.
|
|
30
|
-
* @param { string } topic The topic on which the message is sent
|
|
31
|
-
* @param { any } message The message to be published. Can be either a primitive
|
|
32
|
-
* data type (string, number, or boolean) or composite data type (object, array)
|
|
33
|
-
* that is composed of other primitive or composite data types
|
|
34
|
-
* @return {Promise.<void>}
|
|
35
|
-
* @tutorial InterApplicationBus.publish
|
|
36
|
-
*/
|
|
37
|
-
publish(topic, message) {
|
|
38
|
-
return this.wire
|
|
39
|
-
.sendAction('publish-message', {
|
|
40
|
-
topic,
|
|
41
|
-
message,
|
|
42
|
-
sourceWindowName: this.me.name
|
|
43
|
-
})
|
|
44
|
-
.then(() => undefined);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Sends a message to a specific application on a specific topic.
|
|
48
|
-
* @param { Identity } destination The identity of the application to which the message is sent
|
|
49
|
-
* @param { string } topic The topic on which the message is sent
|
|
50
|
-
* @param { any } message The message to be sent. Can be either a primitive data
|
|
51
|
-
* type (string, number, or boolean) or composite data type (object, array) that
|
|
52
|
-
* is composed of other primitive or composite data types
|
|
53
|
-
* @return {Promise.<void>}
|
|
54
|
-
* @tutorial InterApplicationBus.send
|
|
55
|
-
*/
|
|
56
|
-
async send(destination, topic, message) {
|
|
57
|
-
const errorMsg = (0, validate_1.validateIdentity)(destination);
|
|
58
|
-
if (errorMsg) {
|
|
59
|
-
throw new Error(errorMsg);
|
|
60
|
-
}
|
|
61
|
-
await this.wire.sendAction('send-message', {
|
|
62
|
-
destinationUuid: destination.uuid,
|
|
63
|
-
destinationWindowName: destination.name,
|
|
64
|
-
topic,
|
|
65
|
-
message,
|
|
66
|
-
sourceWindowName: this.me.name
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Subscribes to messages from the specified application on the specified topic.
|
|
71
|
-
* @param { Identity } source This object is described in the Identity in the typedef
|
|
72
|
-
* @param { string } topic The topic on which the message is sent
|
|
73
|
-
* @param { function } listener A function that is called when a message has
|
|
74
|
-
* been received. It is passed the message, uuid and name of the sending application.
|
|
75
|
-
* The message can be either a primitive data type (string, number, or boolean) or
|
|
76
|
-
* composite data type (object, array) that is composed of other primitive or composite
|
|
77
|
-
* data types
|
|
78
|
-
* @return {Promise.<void>}
|
|
79
|
-
* @tutorial InterApplicationBus.subscribe
|
|
80
|
-
*/
|
|
81
|
-
subscribe(source, topic, listener) {
|
|
82
|
-
const subKey = this.createSubscriptionKey(source.uuid, source.name || '*', topic);
|
|
83
|
-
const sendSubscription = () => {
|
|
84
|
-
return this.wire.sendAction('subscribe', {
|
|
85
|
-
sourceUuid: source.uuid,
|
|
86
|
-
sourceWindowName: source.name || '*',
|
|
87
|
-
topic,
|
|
88
|
-
destinationWindowName: this.me.name
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
const alreadySubscribed = () => {
|
|
92
|
-
return Promise.resolve();
|
|
93
|
-
};
|
|
94
|
-
this.emitter.on(subKey, listener);
|
|
95
|
-
return this.refCounter.actOnFirst(subKey, sendSubscription, alreadySubscribed);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Unsubscribes to messages from the specified application on the specified topic.
|
|
99
|
-
* @param { Identity } source This object is described in the Identity in the typedef
|
|
100
|
-
* @param { string } topic The topic on which the message is sent
|
|
101
|
-
* @param { function } listener A callback previously registered with subscribe()
|
|
102
|
-
* @return {Promise.<void>}
|
|
103
|
-
* @tutorial InterApplicationBus.unsubscribe
|
|
104
|
-
*/
|
|
105
|
-
unsubscribe(source, topic, listener) {
|
|
106
|
-
const sourceWindowName = source.name || '*';
|
|
107
|
-
const subKey = this.createSubscriptionKey(source.uuid, sourceWindowName, topic);
|
|
108
|
-
const sendUnsubscription = () => {
|
|
109
|
-
return this.wire.sendAction('unsubscribe', {
|
|
110
|
-
sourceUuid: source.uuid,
|
|
111
|
-
sourceWindowName,
|
|
112
|
-
topic,
|
|
113
|
-
destinationWindowName: this.me.name
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
const dontSendUnsubscription = () => {
|
|
117
|
-
return new Promise((r) => r).then(() => undefined);
|
|
118
|
-
};
|
|
119
|
-
this.emitter.removeListener(subKey, listener);
|
|
120
|
-
return this.refCounter.actOnLast(subKey, sendUnsubscription, dontSendUnsubscription);
|
|
121
|
-
}
|
|
122
|
-
processMessage(message) {
|
|
123
|
-
const { payload: { message: payloadMessage, sourceWindowName, sourceUuid, topic } } = message;
|
|
124
|
-
const keys = [
|
|
125
|
-
this.createSubscriptionKey(sourceUuid, sourceWindowName, topic),
|
|
126
|
-
this.createSubscriptionKey(sourceUuid, '*', topic),
|
|
127
|
-
this.createSubscriptionKey('*', '*', topic)
|
|
128
|
-
];
|
|
129
|
-
const idOfSender = { uuid: sourceUuid, name: sourceWindowName };
|
|
130
|
-
keys.forEach((key) => {
|
|
131
|
-
this.emitter.emit(key, payloadMessage, idOfSender);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
emitSubscriverEvent(type, message) {
|
|
135
|
-
const { payload: { targetName: name, uuid, topic } } = message;
|
|
136
|
-
const payload = { name, uuid, topic };
|
|
137
|
-
this.emitter.emit(type, payload);
|
|
138
|
-
}
|
|
139
|
-
// eslint-disable-next-line class-methods-use-this
|
|
140
|
-
createSubscriptionKey(uuid, name, topic) {
|
|
141
|
-
const n = name || '*';
|
|
142
|
-
if (!(uuid && n && topic)) {
|
|
143
|
-
throw new Error('Missing uuid, name, or topic string');
|
|
144
|
-
}
|
|
145
|
-
return createKey(uuid, n, topic);
|
|
146
|
-
}
|
|
147
|
-
onmessage(message) {
|
|
148
|
-
const { action } = message;
|
|
149
|
-
switch (action) {
|
|
150
|
-
case 'process-message':
|
|
151
|
-
this.processMessage(message);
|
|
152
|
-
break;
|
|
153
|
-
case this.events.subscriberAdded:
|
|
154
|
-
this.emitSubscriverEvent(this.events.subscriberAdded, message);
|
|
155
|
-
break;
|
|
156
|
-
case this.events.subscriberRemoved:
|
|
157
|
-
this.emitSubscriverEvent(this.events.subscriberRemoved, message);
|
|
158
|
-
break;
|
|
159
|
-
default:
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
exports.default = InterApplicationBus;
|
|
166
|
-
class InterAppPayload {
|
|
167
|
-
}
|
|
168
|
-
exports.InterAppPayload = InterAppPayload;
|
|
169
|
-
function createKey(...toHash) {
|
|
170
|
-
return toHash
|
|
171
|
-
.map((item) => {
|
|
172
|
-
return Buffer.from(`${item}`).toString('base64');
|
|
173
|
-
})
|
|
174
|
-
.join('/');
|
|
175
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
import { Base } from '../base';
|
|
3
|
-
import { InteropBroker } from './InteropBroker';
|
|
4
|
-
import { InteropClient } from './InteropClient';
|
|
5
|
-
/**
|
|
6
|
-
* @PORTED
|
|
7
|
-
* @typedef { object } InteropConfig
|
|
8
|
-
* @summary Information relevant to the Interop Broker.
|
|
9
|
-
* @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
|
|
10
|
-
* @property {string} [providerId] When provided, automatically connects the client to the specified provider uuid
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
|
|
14
|
-
* @namespace
|
|
15
|
-
* @alias Interop
|
|
16
|
-
*/
|
|
17
|
-
export default class InteropModule extends Base {
|
|
18
|
-
/**
|
|
19
|
-
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
|
|
20
|
-
* @param { string } name - Name of the Interop Broker.
|
|
21
|
-
* @param { OverrideCallback<InteropBroker> } [override] - A callback function that can be used to extend or replace default Interop Broker behavior.
|
|
22
|
-
* @return {Promise.<InteropBroker>}
|
|
23
|
-
* @tutorial Interop.init
|
|
24
|
-
* @static
|
|
25
|
-
*/
|
|
26
|
-
init(name: string, override?: OpenFin.OverrideCallback<InteropBroker>): Promise<InteropBroker>;
|
|
27
|
-
/**
|
|
28
|
-
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
29
|
-
* @param { string } name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
|
|
30
|
-
* @param { InteropConfig } [interopConfig] - Information relevant to the Interop Broker. Typically a declaration of
|
|
31
|
-
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
|
|
32
|
-
* @return {InteropClient}
|
|
33
|
-
* @tutorial Interop.connectSync
|
|
34
|
-
* @static
|
|
35
|
-
*/
|
|
36
|
-
connectSync(name: string, interopConfig?: OpenFin.InteropConfig): InteropClient;
|
|
37
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lodash_1 = require("lodash");
|
|
4
|
-
const inaccessibleObject_1 = require("../../util/inaccessibleObject");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
-
const InteropBroker_1 = require("./InteropBroker");
|
|
7
|
-
const InteropClient_1 = require("./InteropClient");
|
|
8
|
-
const overrideCheck_1 = require("./fdc3/overrideCheck");
|
|
9
|
-
const defaultOverride = (Class) => new Class();
|
|
10
|
-
const BrokerParamAccessError = 'You have attempted to use or modify InteropBroker parameters, which is not allowed. You are likely using an older InteropBroker override scheme. Please consult our Interop docs for guidance on migrating to the new override scheme.';
|
|
11
|
-
/**
|
|
12
|
-
* @PORTED
|
|
13
|
-
* @typedef { object } InteropConfig
|
|
14
|
-
* @summary Information relevant to the Interop Broker.
|
|
15
|
-
* @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
|
|
16
|
-
* @property {string} [providerId] When provided, automatically connects the client to the specified provider uuid
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
|
|
20
|
-
* @namespace
|
|
21
|
-
* @alias Interop
|
|
22
|
-
*/
|
|
23
|
-
class InteropModule extends base_1.Base {
|
|
24
|
-
/**
|
|
25
|
-
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
|
|
26
|
-
* @param { string } name - Name of the Interop Broker.
|
|
27
|
-
* @param { OverrideCallback<InteropBroker> } [override] - A callback function that can be used to extend or replace default Interop Broker behavior.
|
|
28
|
-
* @return {Promise.<InteropBroker>}
|
|
29
|
-
* @tutorial Interop.init
|
|
30
|
-
* @static
|
|
31
|
-
*/
|
|
32
|
-
async init(name, override = defaultOverride) {
|
|
33
|
-
var _a;
|
|
34
|
-
this.wire.sendAction('interop-init').catch((e) => {
|
|
35
|
-
// don't expose, analytics-only call
|
|
36
|
-
});
|
|
37
|
-
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
38
|
-
const options = await this.fin.Application.getCurrentSync().getInfo();
|
|
39
|
-
const opts = (_a = options.initialOptions.interopBrokerConfiguration) !== null && _a !== void 0 ? _a : {};
|
|
40
|
-
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
41
|
-
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
|
|
42
|
-
let provider;
|
|
43
|
-
const getProvider = () => {
|
|
44
|
-
if (!provider) {
|
|
45
|
-
provider = this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
|
46
|
-
}
|
|
47
|
-
return provider;
|
|
48
|
-
};
|
|
49
|
-
const throwingGetProvider = async () => {
|
|
50
|
-
// eslint-disable-next-line no-console
|
|
51
|
-
throw new Error(BrokerParamAccessError);
|
|
52
|
-
};
|
|
53
|
-
const OverrideableBroker = InteropBroker_1.InteropBroker.createClosedConstructor(this.wire, getProvider, opts);
|
|
54
|
-
// We need to use these objects because removing them entirely would be a breaking change and we want an informative error
|
|
55
|
-
// @ts-expect-error
|
|
56
|
-
const broker = await override(OverrideableBroker, objectThatThrows, throwingGetProvider, warningOptsClone);
|
|
57
|
-
(0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
|
|
58
|
-
return broker;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
62
|
-
* @param { string } name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
|
|
63
|
-
* @param { InteropConfig } [interopConfig] - Information relevant to the Interop Broker. Typically a declaration of
|
|
64
|
-
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
|
|
65
|
-
* @return {InteropClient}
|
|
66
|
-
* @tutorial Interop.connectSync
|
|
67
|
-
* @static
|
|
68
|
-
*/
|
|
69
|
-
connectSync(name, interopConfig) {
|
|
70
|
-
this.wire.sendAction('interop-connect-sync').catch((e) => {
|
|
71
|
-
// don't expose, analytics-only call
|
|
72
|
-
});
|
|
73
|
-
return new InteropClient_1.InteropClient(this.wire, name, interopConfig);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.default = InteropModule;
|