@openfin/core 25.68.26
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/LICENSE +13 -0
- package/NOTICE +16 -0
- package/OpenFin.d.ts +1340 -0
- package/README.md +41 -0
- package/docs.README(OLD).md +82 -0
- package/fin.d.ts +4 -0
- package/package.json +33 -0
- package/resources/win/OpenFinRVM.exe +0 -0
- package/src/api/application/Factory.d.ts +145 -0
- package/src/api/application/Factory.js +229 -0
- package/src/api/application/Instance.d.ts +302 -0
- package/src/api/application/Instance.js +412 -0
- package/src/api/application/index.d.ts +3 -0
- package/src/api/application/index.js +15 -0
- package/src/api/base.d.ts +43 -0
- package/src/api/base.js +177 -0
- package/src/api/clipboard/index.d.ts +69 -0
- package/src/api/clipboard/index.js +88 -0
- 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 -0
- package/src/api/events/channel.js +2 -0
- package/src/api/events/emitterMap.d.ts +11 -0
- package/src/api/events/emitterMap.js +35 -0
- package/src/api/events/eventAggregator.d.ts +5 -0
- package/src/api/events/eventAggregator.js +43 -0
- 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 +169 -0
- package/src/api/events/window.js +2 -0
- package/src/api/external-application/Factory.d.ts +26 -0
- package/src/api/external-application/Factory.js +40 -0
- package/src/api/external-application/Instance.d.ts +102 -0
- package/src/api/external-application/Instance.js +109 -0
- package/src/api/external-application/index.d.ts +3 -0
- package/src/api/external-application/index.js +15 -0
- package/src/api/fin.d.ts +49 -0
- package/src/api/fin.js +43 -0
- package/src/api/frame/Factory.d.ts +36 -0
- package/src/api/frame/Factory.js +69 -0
- package/src/api/frame/Instance.d.ts +121 -0
- package/src/api/frame/Instance.js +130 -0
- package/src/api/frame/index.d.ts +3 -0
- package/src/api/frame/index.js +15 -0
- package/src/api/global-hotkey/index.d.ts +38 -0
- package/src/api/global-hotkey/index.js +58 -0
- package/src/api/interappbus/channel/channel.d.ts +26 -0
- package/src/api/interappbus/channel/channel.js +77 -0
- package/src/api/interappbus/channel/channels-docs.d.ts +318 -0
- package/src/api/interappbus/channel/channels-docs.js +376 -0
- package/src/api/interappbus/channel/client.d.ts +22 -0
- package/src/api/interappbus/channel/client.js +84 -0
- package/src/api/interappbus/channel/connection-manager.d.ts +28 -0
- package/src/api/interappbus/channel/connection-manager.js +244 -0
- package/src/api/interappbus/channel/index.d.ts +22 -0
- package/src/api/interappbus/channel/index.js +121 -0
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -0
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -0
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -0
- package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -0
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -0
- package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -0
- package/src/api/interappbus/channel/protocols/index.d.ts +44 -0
- package/src/api/interappbus/channel/protocols/index.js +2 -0
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -0
- package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -0
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -0
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -0
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -0
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -0
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -0
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -0
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -0
- package/src/api/interappbus/channel/protocols/strategy-types.js +2 -0
- package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -0
- package/src/api/interappbus/channel/protocols/strategy.js +2 -0
- package/src/api/interappbus/channel/provider.d.ts +31 -0
- package/src/api/interappbus/channel/provider.js +165 -0
- package/src/api/interappbus/index.d.ts +85 -0
- package/src/api/interappbus/index.js +175 -0
- package/src/api/interop/Factory.d.ts +37 -0
- package/src/api/interop/Factory.js +54 -0
- package/src/api/interop/InteropBroker.d.ts +363 -0
- package/src/api/interop/InteropBroker.js +914 -0
- package/src/api/interop/InteropClient.d.ts +268 -0
- package/src/api/interop/InteropClient.js +450 -0
- package/src/api/interop/SessionContextGroupBroker.d.ts +26 -0
- package/src/api/interop/SessionContextGroupBroker.js +107 -0
- package/src/api/interop/SessionContextGroupClient.d.ts +20 -0
- package/src/api/interop/SessionContextGroupClient.js +85 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -0
- package/src/api/interop/fdc3/fdc3-1.2.js +385 -0
- package/src/api/interop/fdc3/fdc3.js +17 -0
- package/src/api/interop/fdc3/utils.d.ts +6 -0
- package/src/api/interop/fdc3/utils.js +17 -0
- package/src/api/interop/index.d.ts +4 -0
- package/src/api/interop/index.js +16 -0
- package/src/api/interop/utils.d.ts +11 -0
- package/src/api/interop/utils.js +36 -0
- package/src/api/me.d.ts +35 -0
- package/src/api/me.js +60 -0
- package/src/api/platform/Factory.d.ts +109 -0
- package/src/api/platform/Factory.js +188 -0
- package/src/api/platform/Instance.d.ts +122 -0
- package/src/api/platform/Instance.js +299 -0
- package/src/api/platform/common-utils.d.ts +6 -0
- package/src/api/platform/common-utils.js +16 -0
- package/src/api/platform/index.d.ts +3 -0
- package/src/api/platform/index.js +15 -0
- package/src/api/platform/layout/Factory.d.ts +108 -0
- package/src/api/platform/layout/Factory.js +189 -0
- package/src/api/platform/layout/Instance.d.ts +48 -0
- package/src/api/platform/layout/Instance.js +99 -0
- package/src/api/platform/layout/index.d.ts +3 -0
- package/src/api/platform/layout/index.js +15 -0
- package/src/api/platform/layout/shapes.d.ts +11 -0
- package/src/api/platform/layout/shapes.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +36 -0
- package/src/api/snapshot-source/Factory.js +65 -0
- package/src/api/snapshot-source/Instance.d.ts +30 -0
- package/src/api/snapshot-source/Instance.js +134 -0
- package/src/api/snapshot-source/index.d.ts +3 -0
- package/src/api/snapshot-source/index.js +15 -0
- package/src/api/snapshot-source/utils.d.ts +1 -0
- package/src/api/snapshot-source/utils.js +5 -0
- package/src/api/system/application.d.ts +6 -0
- package/src/api/system/application.js +2 -0
- package/src/api/system/entity.d.ts +11 -0
- package/src/api/system/entity.js +2 -0
- package/src/api/system/index.d.ts +957 -0
- package/src/api/system/index.js +1241 -0
- package/src/api/system/installedApps.d.ts +6 -0
- package/src/api/system/installedApps.js +2 -0
- package/src/api/system/log.d.ts +11 -0
- package/src/api/system/log.js +2 -0
- package/src/api/system/process.d.ts +15 -0
- package/src/api/system/process.js +2 -0
- package/src/api/system/proxy.d.ts +15 -0
- package/src/api/system/proxy.js +2 -0
- package/src/api/system/queryPermissionTypes.d.ts +1 -0
- package/src/api/system/queryPermissionTypes.js +2 -0
- package/src/api/system/registry-info.d.ts +7 -0
- package/src/api/system/registry-info.js +2 -0
- package/src/api/system/window.d.ts +16 -0
- package/src/api/system/window.js +2 -0
- package/src/api/view/Factory.d.ts +49 -0
- package/src/api/view/Factory.js +103 -0
- package/src/api/view/Instance.d.ts +379 -0
- package/src/api/view/Instance.js +415 -0
- package/src/api/view/index.d.ts +3 -0
- package/src/api/view/index.js +15 -0
- package/src/api/webcontents/main.d.ts +36 -0
- package/src/api/webcontents/main.js +82 -0
- package/src/api/window/Factory.d.ts +44 -0
- package/src/api/window/Factory.js +91 -0
- package/src/api/window/Instance.d.ts +966 -0
- package/src/api/window/Instance.js +1202 -0
- package/src/api/window/bounds-changed.d.ts +10 -0
- package/src/api/window/bounds-changed.js +6 -0
- package/src/api/window/index.d.ts +5 -0
- package/src/api/window/index.js +17 -0
- package/src/api/window/shapes.d.ts +13 -0
- package/src/api/window/shapes.js +2 -0
- package/src/environment/environment.d.ts +28 -0
- package/src/environment/environment.js +4 -0
- package/src/environment/node-env.d.ts +25 -0
- package/src/environment/node-env.js +64 -0
- package/src/environment/openfin-env.d.ts +29 -0
- package/src/environment/openfin-env.js +105 -0
- package/src/mock.d.ts +4 -0
- package/src/mock.js +91 -0
- package/src/shapes/ERROR_BOX_TYPES.d.ts +6 -0
- package/src/shapes/ERROR_BOX_TYPES.js +10 -0
- package/src/shapes/EntityType.d.ts +1 -0
- package/src/shapes/EntityType.js +2 -0
- package/src/shapes/LayoutPresetType.d.ts +1 -0
- package/src/shapes/LayoutPresetType.js +2 -0
- package/src/shapes/Platform.d.ts +112 -0
- package/src/shapes/Platform.js +16 -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 -0
- package/src/transport/fin_store.js +16 -0
- package/src/transport/transport-errors.d.ts +17 -0
- package/src/transport/transport-errors.js +39 -0
- package/src/transport/transport.d.ts +57 -0
- package/src/transport/transport.js +195 -0
- package/src/transport/wire.d.ts +76 -0
- package/src/transport/wire.js +39 -0
- package/src/util/asyncFilter.d.ts +1 -0
- package/src/util/asyncFilter.js +7 -0
- package/src/util/errors.d.ts +9 -0
- package/src/util/errors.js +14 -0
- package/src/util/exhaustive.d.ts +1 -0
- package/src/util/exhaustive.js +7 -0
- package/src/util/http.d.ts +11 -0
- package/src/util/http.js +83 -0
- package/src/util/normalize-config.d.ts +3 -0
- package/src/util/normalize-config.js +47 -0
- package/src/util/promises.d.ts +5 -0
- package/src/util/promises.js +27 -0
- package/src/util/ref-counter.d.ts +7 -0
- package/src/util/ref-counter.js +51 -0
- package/src/util/runtimeVersioning.d.ts +3 -0
- package/src/util/runtimeVersioning.js +25 -0
- package/src/util/utilTypes.d.ts +8 -0
- package/src/util/utilTypes.js +2 -0
- package/src/util/validate.d.ts +3 -0
- package/src/util/validate.js +11 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
3
|
+
if (!privateMap.has(receiver)) {
|
|
4
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
5
|
+
}
|
|
6
|
+
return privateMap.get(receiver);
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
9
|
+
if (!privateMap.has(receiver)) {
|
|
10
|
+
throw new TypeError("attempted to set private field on non-instance");
|
|
11
|
+
}
|
|
12
|
+
privateMap.set(receiver, value);
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
var _processAction, _rtcEndpointMap, _connected;
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.RTCInfo = exports.RTCStrategy = void 0;
|
|
18
|
+
const endpoint_1 = require("./endpoint");
|
|
19
|
+
/*
|
|
20
|
+
This is used to abstract out rtc messaging from the channels implementation using RTCEndpoints.
|
|
21
|
+
*/
|
|
22
|
+
class RTCStrategy {
|
|
23
|
+
constructor() {
|
|
24
|
+
_processAction.set(this, null);
|
|
25
|
+
_rtcEndpointMap.set(this, new Map());
|
|
26
|
+
_connected.set(this, true);
|
|
27
|
+
this.send = async (endpointId, action, payload) => {
|
|
28
|
+
return this.getEndpointById(endpointId).send(action, payload);
|
|
29
|
+
};
|
|
30
|
+
this.close = async () => {
|
|
31
|
+
if (__classPrivateFieldGet(this, _connected)) {
|
|
32
|
+
__classPrivateFieldGet(this, _rtcEndpointMap).forEach((rtcEndpoint) => rtcEndpoint.close());
|
|
33
|
+
__classPrivateFieldSet(this, _rtcEndpointMap, new Map());
|
|
34
|
+
}
|
|
35
|
+
__classPrivateFieldSet(this, _connected, false);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
onEndpointDisconnect(endpointId, listener) {
|
|
39
|
+
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
40
|
+
}
|
|
41
|
+
receive(listener) {
|
|
42
|
+
if (__classPrivateFieldGet(this, _processAction)) {
|
|
43
|
+
throw new Error('You have already set a listener for this RTC Strategy');
|
|
44
|
+
}
|
|
45
|
+
__classPrivateFieldSet(this, _processAction, listener);
|
|
46
|
+
__classPrivateFieldGet(this, _rtcEndpointMap).forEach((rtcEndpoint) => rtcEndpoint.receive(__classPrivateFieldGet(this, _processAction)));
|
|
47
|
+
}
|
|
48
|
+
getEndpointById(endpointId) {
|
|
49
|
+
const endpoint = __classPrivateFieldGet(this, _rtcEndpointMap).get(endpointId);
|
|
50
|
+
if (!endpoint) {
|
|
51
|
+
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
52
|
+
}
|
|
53
|
+
return endpoint;
|
|
54
|
+
}
|
|
55
|
+
get connected() {
|
|
56
|
+
return __classPrivateFieldGet(this, _connected);
|
|
57
|
+
}
|
|
58
|
+
isEndpointConnected(endpointId) {
|
|
59
|
+
return __classPrivateFieldGet(this, _rtcEndpointMap).has(endpointId);
|
|
60
|
+
}
|
|
61
|
+
addEndpoint(endpointId, payload) {
|
|
62
|
+
if (!__classPrivateFieldGet(this, _connected)) {
|
|
63
|
+
console.warn('Adding endpoint to disconnected RTC Strategy');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const clientStrat = new endpoint_1.RTCEndpoint(payload.rtc, payload.endpointIdentity);
|
|
67
|
+
if (__classPrivateFieldGet(this, _processAction)) {
|
|
68
|
+
clientStrat.receive(__classPrivateFieldGet(this, _processAction));
|
|
69
|
+
}
|
|
70
|
+
__classPrivateFieldGet(this, _rtcEndpointMap).set(endpointId, clientStrat);
|
|
71
|
+
}
|
|
72
|
+
async closeEndpoint(endpointId) {
|
|
73
|
+
__classPrivateFieldGet(this, _rtcEndpointMap).delete(endpointId);
|
|
74
|
+
}
|
|
75
|
+
isValidEndpointPayload(payload) {
|
|
76
|
+
const isObject = (x) => {
|
|
77
|
+
return typeof x === 'object' && x !== null;
|
|
78
|
+
};
|
|
79
|
+
return (isObject(payload) &&
|
|
80
|
+
isObject(payload.endpointIdentity) &&
|
|
81
|
+
isObject(payload.rtc) &&
|
|
82
|
+
typeof payload.endpointIdentity.endpointId === 'string');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.RTCStrategy = RTCStrategy;
|
|
86
|
+
_processAction = new WeakMap(), _rtcEndpointMap = new WeakMap(), _connected = new WeakMap();
|
|
87
|
+
exports.RTCInfo = { version: 1, minimumVersion: 0, type: 'rtc' };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MessagingProtocols } from '.';
|
|
2
|
+
import { ClassicStrategy } from './classic/strategy';
|
|
3
|
+
import CombinedStrategy from './combined/strategy';
|
|
4
|
+
import { RTCStrategy } from './rtc/strategy';
|
|
5
|
+
import { ChannelStrategy } from './strategy';
|
|
6
|
+
declare type StrategyMap = {
|
|
7
|
+
rtc: RTCStrategy;
|
|
8
|
+
classic: ClassicStrategy;
|
|
9
|
+
};
|
|
10
|
+
export declare type StrategyByProtocol<T extends MessagingProtocols> = StrategyMap[T];
|
|
11
|
+
export declare type PayloadTypeByStrategy<T extends ChannelStrategy<unknown>> = T extends ChannelStrategy<infer U> ? U : never;
|
|
12
|
+
export declare type AnyStrategy = ClassicStrategy | RTCStrategy | CombinedStrategy<PayloadTypeByStrategy<RTCStrategy>, PayloadTypeByStrategy<ClassicStrategy>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
2
|
+
export interface ChannelStrategy<T extends unknown> {
|
|
3
|
+
onEndpointDisconnect(endpointId: string, listener: () => void): void;
|
|
4
|
+
receive(listener: (action: string, payload: any, identity: any) => Promise<any>): void;
|
|
5
|
+
send(endpointId: string, action: string, payload: any): Promise<any>;
|
|
6
|
+
closeEndpoint(endpointId: string): Promise<void>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
isEndpointConnected(endpointId: string): boolean;
|
|
9
|
+
addEndpoint(endpointId: string, payload: T): void;
|
|
10
|
+
isValidEndpointPayload(payload: unknown): payload is T;
|
|
11
|
+
}
|
|
12
|
+
export declare type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity;
|
|
13
|
+
export declare type EndpointPayload = {
|
|
14
|
+
endpointIdentity: EndpointIdentity;
|
|
15
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ChannelBase } from './channel';
|
|
2
|
+
import Transport from '../../../transport/transport';
|
|
3
|
+
import { AnyStrategy } from './protocols/strategy-types';
|
|
4
|
+
import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
5
|
+
import ClientIdentity = OpenFin.ClientIdentity;
|
|
6
|
+
export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => any;
|
|
7
|
+
export declare type DisconnectionListener = (identity: ClientIdentity) => any;
|
|
8
|
+
export declare class ChannelProvider extends ChannelBase {
|
|
9
|
+
#private;
|
|
10
|
+
private static removalMap;
|
|
11
|
+
private connectListener;
|
|
12
|
+
private disconnectListener;
|
|
13
|
+
get connections(): OpenFin.ClientIdentity[];
|
|
14
|
+
static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
|
|
15
|
+
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
16
|
+
constructor(providerIdentity: ProviderIdentity, wire: Transport, strategy: AnyStrategy);
|
|
17
|
+
dispatch(to: OpenFin.ClientIdentity | OpenFin.Identity, action: string, payload?: any): Promise<any>;
|
|
18
|
+
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime) => Promise<any>;
|
|
19
|
+
processConnection(senderId: OpenFin.ClientIdentity, payload: any): Promise<any>;
|
|
20
|
+
publish(action: string, payload: any): Promise<any>[];
|
|
21
|
+
onConnection(listener: ConnectionListener): void;
|
|
22
|
+
onDisconnection(listener: DisconnectionListener): void;
|
|
23
|
+
destroy(): Promise<void>;
|
|
24
|
+
private checkForClientConnection;
|
|
25
|
+
private isClientConnected;
|
|
26
|
+
private isLegacyClientConnected;
|
|
27
|
+
private handleMultiRuntimeLegacyClient;
|
|
28
|
+
private getEndpointIdForOpenFinId;
|
|
29
|
+
private static clientIdentityIncludesEndpointId;
|
|
30
|
+
private static clientIsMultiRuntime;
|
|
31
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ChannelProvider = void 0;
|
|
17
|
+
const channel_1 = require("./channel");
|
|
18
|
+
const runtimeVersioning_1 = require("../../../util/runtimeVersioning");
|
|
19
|
+
let ChannelProvider = /** @class */ (() => {
|
|
20
|
+
var _connections, _protectedObj, _strategy, _removeEndpoint, _close;
|
|
21
|
+
class ChannelProvider extends channel_1.ChannelBase {
|
|
22
|
+
constructor(providerIdentity, wire, strategy) {
|
|
23
|
+
super();
|
|
24
|
+
_connections.set(this, void 0);
|
|
25
|
+
_protectedObj.set(this, void 0);
|
|
26
|
+
_strategy.set(this, void 0);
|
|
27
|
+
_removeEndpoint.set(this, (identity) => {
|
|
28
|
+
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
|
29
|
+
__classPrivateFieldGet(this, _strategy).closeEndpoint(identity.endpointId);
|
|
30
|
+
__classPrivateFieldSet(this, _connections, remainingConnections);
|
|
31
|
+
});
|
|
32
|
+
// Must be bound.
|
|
33
|
+
this.processAction = async (action, payload, senderIdentity) => {
|
|
34
|
+
if (ChannelProvider.clientIsMultiRuntime(senderIdentity) &&
|
|
35
|
+
!runtimeVersioning_1.runtimeUuidMeetsMinimumRuntimeVersion(senderIdentity.runtimeUuid, '18.87.56.0')) {
|
|
36
|
+
this.handleMultiRuntimeLegacyClient(senderIdentity);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.checkForClientConnection(senderIdentity);
|
|
40
|
+
}
|
|
41
|
+
return super.processAction(action, payload, senderIdentity);
|
|
42
|
+
};
|
|
43
|
+
_close.set(this, () => {
|
|
44
|
+
__classPrivateFieldGet(this, _strategy).close();
|
|
45
|
+
const remove = ChannelProvider.removalMap.get(this);
|
|
46
|
+
if (remove) {
|
|
47
|
+
remove();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
__classPrivateFieldSet(this, _protectedObj, new channel_1.ProtectedItems(providerIdentity, wire));
|
|
51
|
+
this.connectListener = () => undefined;
|
|
52
|
+
this.disconnectListener = () => undefined;
|
|
53
|
+
__classPrivateFieldSet(this, _connections, []);
|
|
54
|
+
__classPrivateFieldSet(this, _strategy, strategy);
|
|
55
|
+
strategy.receive(this.processAction);
|
|
56
|
+
}
|
|
57
|
+
get connections() {
|
|
58
|
+
return [...__classPrivateFieldGet(this, _connections)];
|
|
59
|
+
}
|
|
60
|
+
static handleClientDisconnection(channel, payload) {
|
|
61
|
+
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
|
62
|
+
if (removeById) {
|
|
63
|
+
__classPrivateFieldGet(channel, _removeEndpoint).call(channel, removeById);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const multipleRemoves = channel.connections.filter((identity) => {
|
|
67
|
+
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
68
|
+
});
|
|
69
|
+
multipleRemoves.forEach(__classPrivateFieldGet(channel, _removeEndpoint));
|
|
70
|
+
}
|
|
71
|
+
channel.disconnectListener(payload);
|
|
72
|
+
}
|
|
73
|
+
static setProviderRemoval(provider, remove) {
|
|
74
|
+
ChannelProvider.removalMap.set(provider, remove);
|
|
75
|
+
}
|
|
76
|
+
dispatch(to, action, payload) {
|
|
77
|
+
var _a;
|
|
78
|
+
const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
|
|
79
|
+
if (endpointId && __classPrivateFieldGet(this, _strategy).isEndpointConnected(endpointId)) {
|
|
80
|
+
return __classPrivateFieldGet(this, _strategy).send(endpointId, action, payload);
|
|
81
|
+
}
|
|
82
|
+
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
|
83
|
+
}
|
|
84
|
+
async processConnection(senderId, payload) {
|
|
85
|
+
__classPrivateFieldGet(this, _connections).push(senderId);
|
|
86
|
+
return this.connectListener(senderId, payload);
|
|
87
|
+
}
|
|
88
|
+
publish(action, payload) {
|
|
89
|
+
return this.connections.map((to) => __classPrivateFieldGet(this, _strategy).send(to.endpointId, action, payload));
|
|
90
|
+
}
|
|
91
|
+
onConnection(listener) {
|
|
92
|
+
this.connectListener = listener;
|
|
93
|
+
}
|
|
94
|
+
onDisconnection(listener) {
|
|
95
|
+
this.disconnectListener = listener;
|
|
96
|
+
}
|
|
97
|
+
async destroy() {
|
|
98
|
+
const protectedObj = __classPrivateFieldGet(this, _protectedObj);
|
|
99
|
+
const { channelName } = protectedObj.providerIdentity;
|
|
100
|
+
__classPrivateFieldSet(this, _connections, []);
|
|
101
|
+
await protectedObj.wire.sendAction('destroy-channel', { channelName });
|
|
102
|
+
__classPrivateFieldGet(this, _close).call(this);
|
|
103
|
+
}
|
|
104
|
+
checkForClientConnection(clientIdentity) {
|
|
105
|
+
if (!this.isClientConnected(clientIdentity)) {
|
|
106
|
+
throw new Error(`This action was sent from a client that is not connected to the provider.
|
|
107
|
+
Client Identity: {uuid: ${clientIdentity.uuid}, name: ${clientIdentity.name}, endpointId: ${clientIdentity.endpointId}}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
isClientConnected(clientIdentity) {
|
|
111
|
+
if (ChannelProvider.clientIdentityIncludesEndpointId(clientIdentity)) {
|
|
112
|
+
return this.connections.some((identity) => {
|
|
113
|
+
return (
|
|
114
|
+
// Might be redundant to check for uuid and name here after we get an endpointId match, but just in case
|
|
115
|
+
identity.endpointId === clientIdentity.endpointId &&
|
|
116
|
+
identity.uuid === clientIdentity.uuid &&
|
|
117
|
+
identity.name === clientIdentity.name);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return this.isLegacyClientConnected(clientIdentity);
|
|
121
|
+
}
|
|
122
|
+
isLegacyClientConnected(clientIdentity) {
|
|
123
|
+
return this.connections.some((identity) => {
|
|
124
|
+
return identity.uuid === clientIdentity.uuid && identity.name === clientIdentity.name;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
handleMultiRuntimeLegacyClient(senderIdentity) {
|
|
128
|
+
if (!this.isLegacyClientConnected(senderIdentity)) {
|
|
129
|
+
throw new Error(`This action was sent from a client that is not connected to the provider. Client Identity:
|
|
130
|
+
{uuid: ${senderIdentity.uuid}, name: ${senderIdentity.name}, endpointId: ${senderIdentity.endpointId}}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
134
|
+
var _a;
|
|
135
|
+
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
136
|
+
if (matchingConnections.length >= 2) {
|
|
137
|
+
const protectedObj = __classPrivateFieldGet(this, _protectedObj);
|
|
138
|
+
const { uuid, name } = clientIdentity;
|
|
139
|
+
const providerUuid = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.uuid;
|
|
140
|
+
const providerName = protectedObj === null || protectedObj === void 0 ? void 0 : protectedObj.providerIdentity.name;
|
|
141
|
+
// eslint-disable-next-line no-console
|
|
142
|
+
console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
|
|
143
|
+
"endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
|
|
144
|
+
has multiple channelClients for this channel. Your dispatched action: (${action}) from the provider:
|
|
145
|
+
({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
|
|
146
|
+
}
|
|
147
|
+
// Pop to return the most recently created endpointId.
|
|
148
|
+
return (_a = matchingConnections.pop()) === null || _a === void 0 ? void 0 : _a.endpointId;
|
|
149
|
+
}
|
|
150
|
+
// eslint-disable-next-line class-methods-use-this
|
|
151
|
+
static clientIdentityIncludesEndpointId(subscriptionIdentity) {
|
|
152
|
+
return subscriptionIdentity.endpointId !== undefined;
|
|
153
|
+
}
|
|
154
|
+
// eslint-disable-next-line class-methods-use-this
|
|
155
|
+
static clientIsMultiRuntime(subscriptionIdentity) {
|
|
156
|
+
return subscriptionIdentity.runtimeUuid !== undefined;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
_connections = new WeakMap(), _protectedObj = new WeakMap(), _strategy = new WeakMap(), _removeEndpoint = new WeakMap(), _close = new WeakMap();
|
|
160
|
+
// The following line should be changed following a typescript update.
|
|
161
|
+
// static #removalMap = new WeakMap<ChannelProvider, Function>();
|
|
162
|
+
ChannelProvider.removalMap = new WeakMap();
|
|
163
|
+
return ChannelProvider;
|
|
164
|
+
})();
|
|
165
|
+
exports.ChannelProvider = ChannelProvider;
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
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.default();
|
|
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 = 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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Base } from '../base';
|
|
2
|
+
import { InteropBroker } from './InteropBroker';
|
|
3
|
+
import { InteropClient } from './InteropClient';
|
|
4
|
+
/**
|
|
5
|
+
* @typedef { object } InteropConfig
|
|
6
|
+
* @summary Information relevant to the Interop Broker.
|
|
7
|
+
* @property {string} [currentContextGroup] Context Group for the client. (green, yellow, red, etc.)
|
|
8
|
+
* @property {string} [providerId] When provided, automatically connects the client to the specified provider uuid
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Manages creation of Interop Brokers and Interop Clients. These APIs are called under-the-hood in Platforms.
|
|
12
|
+
* @namespace
|
|
13
|
+
* @alias Interop
|
|
14
|
+
*/
|
|
15
|
+
export default class InteropModule extends Base {
|
|
16
|
+
/**
|
|
17
|
+
* Initializes an Interop Broker. This is called under-the-hood for Platforms.
|
|
18
|
+
* @param { string } name - Name of the Interop Broker.
|
|
19
|
+
* @param { OverrideCallback<InteropBroker> } [override] - A callback function that can be used to extend or replace default Interop Broker behavior.
|
|
20
|
+
* @return {Promise.<InteropBroker>}
|
|
21
|
+
* @tutorial Interop.init
|
|
22
|
+
* @experimental
|
|
23
|
+
* @static
|
|
24
|
+
*/
|
|
25
|
+
init(name: string, override?: OpenFin.OverrideCallback<InteropBroker>): Promise<InteropBroker>;
|
|
26
|
+
/**
|
|
27
|
+
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
28
|
+
* @param { string } name - The name of the Interop Broker to connect to. For Platforms, this will default to the uuid of the Platform.
|
|
29
|
+
* @param { InteropConfig } [interopConfig] - Information relevant to the Interop Broker. Typically a declaration of
|
|
30
|
+
* what context(s) the entity wants to subscribe to, and the current Context Group of the entity.
|
|
31
|
+
* @return {InteropClient}
|
|
32
|
+
* @tutorial Interop.connectSync
|
|
33
|
+
* @experimental
|
|
34
|
+
* @static
|
|
35
|
+
*/
|
|
36
|
+
connectSync(name: string, interopConfig: OpenFin.InteropConfig): InteropClient;
|
|
37
|
+
}
|