@openfin/core 30.73.6 → 30.73.7
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 -1729
- package/fin.d.ts +3 -4
- package/package.json +1 -1
- package/src/GlobalOpenFin.d.ts +4 -0
- package/src/OpenFin.d.ts +2938 -0
- package/src/OpenFin.js +4 -0
- package/src/api/application/Factory.d.ts +2 -0
- package/src/api/application/Factory.js +4 -3
- package/src/api/application/Instance.d.ts +3 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/application/index.js +7 -3
- package/src/api/base.d.ts +19 -15
- package/src/api/base.js +20 -22
- package/src/api/clipboard/index.d.ts +2 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/application.d.ts +66 -56
- package/src/api/events/base.d.ts +33 -15
- package/src/api/events/channel.d.ts +13 -8
- package/src/api/events/eventAggregator.js +1 -9
- package/src/api/events/externalApplication.d.ts +10 -5
- package/src/api/events/frame.d.ts +13 -7
- package/src/api/events/globalHotkey.d.ts +11 -10
- package/src/api/events/platform.d.ts +10 -16
- package/src/api/events/system.d.ts +48 -18
- package/src/api/events/typedEventEmitter.d.ts +20 -0
- package/src/api/events/typedEventEmitter.js +2 -0
- package/src/api/events/view.d.ts +38 -54
- package/src/api/events/webcontents.d.ts +55 -28
- package/src/api/events/window.d.ts +148 -134
- package/src/api/external-application/Factory.d.ts +1 -0
- package/src/api/external-application/Instance.d.ts +2 -1
- package/src/api/external-application/index.js +7 -3
- package/src/api/fin.d.ts +3 -1
- package/src/api/fin.js +2 -2
- package/src/api/frame/Factory.d.ts +1 -0
- package/src/api/frame/Factory.js +2 -2
- package/src/api/frame/Instance.d.ts +3 -1
- package/src/api/frame/index.js +7 -3
- package/src/api/global-hotkey/index.d.ts +2 -2
- package/src/api/global-hotkey/index.js +6 -0
- package/src/api/interappbus/channel/channel.d.ts +6 -4
- package/src/api/interappbus/channel/channels-docs.d.ts +22 -0
- package/src/api/interappbus/channel/channels-docs.js +22 -0
- package/src/api/interappbus/channel/client.d.ts +2 -1
- package/src/api/interappbus/channel/client.js +24 -26
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
- package/src/api/interappbus/channel/connection-manager.js +30 -28
- package/src/api/interappbus/channel/index.d.ts +6 -4
- package/src/api/interappbus/channel/index.js +34 -19
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
- package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +25 -27
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
- package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/provider.d.ts +8 -4
- package/src/api/interappbus/channel/provider.js +140 -139
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/Factory.d.ts +2 -0
- package/src/api/interop/Factory.js +20 -2
- package/src/api/interop/InteropBroker.d.ts +62 -39
- package/src/api/interop/InteropBroker.js +114 -55
- package/src/api/interop/InteropClient.d.ts +9 -0
- package/src/api/interop/InteropClient.js +46 -40
- package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
- package/src/api/interop/SessionContextGroupClient.js +22 -24
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +9 -7
- package/src/api/interop/fdc3/PrivateChannelClient.js +6 -6
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
- package/src/api/interop/fdc3/fdc3-1.2.js +3 -14
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
- package/src/api/interop/fdc3/fdc3-2.0.js +27 -27
- package/src/api/interop/fdc3/fdc3.d.ts +12 -0
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +53 -0
- package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +75 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
- package/src/api/interop/fdc3/utils.d.ts +15 -5
- package/src/api/interop/fdc3/utils.js +29 -11
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/interop/index.js +7 -3
- package/src/api/interop/utils.d.ts +2 -0
- package/src/api/interop/utils.js +29 -15
- package/src/api/me.d.ts +3 -1
- package/src/api/platform/Factory.d.ts +6 -0
- package/src/api/platform/Factory.js +14 -5
- package/src/api/platform/Instance.d.ts +18 -3
- package/src/api/platform/Instance.js +30 -13
- package/src/api/platform/common-utils.d.ts +2 -1
- package/src/api/platform/index.js +7 -3
- package/src/api/platform/layout/Factory.d.ts +7 -1
- package/src/api/platform/layout/Factory.js +22 -20
- package/src/api/platform/layout/Instance.d.ts +6 -4
- package/src/api/platform/layout/Instance.js +2 -3
- package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
- package/src/api/platform/layout/controllers/tab-drag-controller.js +1 -1
- package/src/api/platform/layout/index.js +7 -3
- package/src/api/platform/layout/shapes.d.ts +3 -1
- package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
- package/src/api/platform/layout/utils/bounds-observer.js +7 -5
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +2 -0
- package/src/api/snapshot-source/Factory.js +2 -1
- package/src/api/snapshot-source/Instance.d.ts +1 -0
- package/src/api/snapshot-source/Instance.js +33 -35
- package/src/api/snapshot-source/index.js +7 -3
- package/src/api/snapshot-source/utils.d.ts +1 -0
- package/src/api/snapshot-source/utils.js +2 -1
- package/src/api/system/index.d.ts +76 -16
- package/src/api/system/index.js +127 -3
- package/src/api/view/Factory.d.ts +1 -0
- package/src/api/view/Factory.js +2 -2
- package/src/api/view/Instance.d.ts +17 -3
- package/src/api/view/Instance.js +20 -0
- package/src/api/view/index.js +7 -3
- package/src/api/webcontents/main.d.ts +20 -5
- package/src/api/webcontents/main.js +10 -0
- package/src/api/window/Factory.d.ts +1 -0
- package/src/api/window/Factory.js +2 -2
- package/src/api/window/Instance.d.ts +26 -3
- package/src/api/window/Instance.js +26 -1
- package/src/api/window/index.js +7 -3
- package/src/browser.d.ts +4 -4
- package/src/environment/browser.d.ts +3 -1
- package/src/environment/environment.d.ts +3 -1
- package/src/environment/node-env.d.ts +3 -1
- package/src/environment/node-env.js +2 -2
- package/src/environment/openfin-env.d.ts +3 -1
- package/src/environment/openfin-env.js +15 -17
- package/src/fdc3.d.ts +3 -0
- package/src/fdc3.js +1 -1
- package/src/mock.d.ts +2 -2
- package/src/mock.js +3 -3
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/shapes/WebOptions.d.ts +1 -0
- package/src/shapes/WindowOptions.d.ts +1 -0
- package/src/shapes/protocol.d.ts +34 -26
- package/src/transport/transport.d.ts +6 -5
- package/src/transport/transport.js +26 -28
- package/src/transport/wire.d.ts +9 -7
- package/src/util/http.d.ts +1 -1
- package/src/util/http.js +16 -11
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/normalize-config.js +5 -5
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _Channel_connectionManager;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.Channel = void 0;
|
|
18
16
|
/* eslint-disable no-console */
|
|
@@ -25,8 +23,8 @@ const noop = () => { };
|
|
|
25
23
|
class Channel extends base_1.EmitterBase {
|
|
26
24
|
constructor(wire) {
|
|
27
25
|
super(wire, 'channel');
|
|
28
|
-
|
|
29
|
-
__classPrivateFieldSet(this,
|
|
26
|
+
_Channel_connectionManager.set(this, void 0);
|
|
27
|
+
__classPrivateFieldSet(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
|
30
28
|
}
|
|
31
29
|
async getAllChannels() {
|
|
32
30
|
return this.wire.sendAction('get-all-channels').then(({ payload }) => payload.data);
|
|
@@ -55,15 +53,30 @@ class Channel extends base_1.EmitterBase {
|
|
|
55
53
|
this.on('connected', listener);
|
|
56
54
|
});
|
|
57
55
|
try {
|
|
58
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this,
|
|
59
|
-
|
|
56
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
57
|
+
let connectionUrl;
|
|
58
|
+
const entityType = this.wire.environment.getCurrentEntityType();
|
|
59
|
+
if (entityType === 'iframe') {
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
// TODO: type this correctly (frame types are broken)
|
|
62
|
+
const frame = (await this.fin.me.getInfo()).url;
|
|
63
|
+
}
|
|
64
|
+
else if (entityType === 'window' || entityType === 'view') {
|
|
65
|
+
connectionUrl = (await this.fin.me.getInfo()).url;
|
|
66
|
+
}
|
|
67
|
+
const res = await this.wire.sendAction('connect-to-channel', {
|
|
68
|
+
channelName,
|
|
69
|
+
...opts,
|
|
70
|
+
offer,
|
|
71
|
+
connectionUrl
|
|
72
|
+
});
|
|
60
73
|
const { payload: { data: routingInfo } } = res;
|
|
61
74
|
// If there isn't a matching channel, the above sendAction call will error out and go to catch, skipping the logic below.
|
|
62
75
|
if (resolver) {
|
|
63
76
|
resolver();
|
|
64
77
|
}
|
|
65
78
|
this.removeListener('connected', listener);
|
|
66
|
-
const strategy = await __classPrivateFieldGet(this,
|
|
79
|
+
const strategy = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
|
67
80
|
const channel = new client_1.default(routingInfo, this.wire, strategy);
|
|
68
81
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
|
69
82
|
// If the endpoint dies, the client will force a disconnection through the core.
|
|
@@ -106,7 +119,9 @@ class Channel extends base_1.EmitterBase {
|
|
|
106
119
|
throw new Error('Please provide a channelName to create a channel');
|
|
107
120
|
}
|
|
108
121
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
109
|
-
const channel = __classPrivateFieldGet(this,
|
|
122
|
+
const channel = __classPrivateFieldGet(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
123
|
+
// TODO: fix typing (internal)
|
|
124
|
+
// @ts-expect-error
|
|
110
125
|
this.on('client-disconnected', (eventPayload) => {
|
|
111
126
|
if (eventPayload.channelName === channelName) {
|
|
112
127
|
provider_1.ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
@@ -116,4 +131,4 @@ class Channel extends base_1.EmitterBase {
|
|
|
116
131
|
}
|
|
117
132
|
}
|
|
118
133
|
exports.Channel = Channel;
|
|
119
|
-
|
|
134
|
+
_Channel_connectionManager = new WeakMap();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../../../OpenFin';
|
|
1
2
|
import Transport from '../../../../../transport/transport';
|
|
2
3
|
import { MessageReceiver } from './message-receiver';
|
|
3
4
|
import { ChannelStrategy, EndpointPayload } from '../strategy';
|
|
4
5
|
import { LocalSupportedProtocol } from '..';
|
|
5
|
-
|
|
6
|
+
declare type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
6
7
|
export declare class ClassicStrategy implements ChannelStrategy<EndpointPayload> {
|
|
7
8
|
#private;
|
|
8
9
|
private messageReceiver;
|
|
@@ -20,3 +21,4 @@ export declare class ClassicStrategy implements ChannelStrategy<EndpointPayload>
|
|
|
20
21
|
isValidEndpointPayload(payload: any): payload is EndpointPayload;
|
|
21
22
|
}
|
|
22
23
|
export declare const ClassicInfo: LocalSupportedProtocol;
|
|
24
|
+
export {};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _ClassicStrategy_wire, _ClassicStrategy_endpointIdentityMap;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.ClassicInfo = exports.ClassicStrategy = void 0;
|
|
18
16
|
/*
|
|
@@ -24,12 +22,12 @@ class ClassicStrategy {
|
|
|
24
22
|
this.messageReceiver = messageReceiver;
|
|
25
23
|
this.endpointId = endpointId;
|
|
26
24
|
this.providerIdentity = providerIdentity;
|
|
27
|
-
|
|
25
|
+
_ClassicStrategy_wire.set(this, void 0);
|
|
28
26
|
// Store full endpointIdentity by endpointId of all known endpoints for this strategy instance.
|
|
29
27
|
// (clients will only have 1: the provider, the provider will have all clients)
|
|
30
|
-
|
|
28
|
+
_ClassicStrategy_endpointIdentityMap.set(this, new Map());
|
|
31
29
|
this.send = async (endpointId, action, payload) => {
|
|
32
|
-
const to = __classPrivateFieldGet(this,
|
|
30
|
+
const to = __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
33
31
|
if (!to) {
|
|
34
32
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
35
33
|
}
|
|
@@ -40,7 +38,8 @@ class ClassicStrategy {
|
|
|
40
38
|
delete cleanId.endpointId;
|
|
41
39
|
}
|
|
42
40
|
delete cleanId.isLocalEndpointId;
|
|
43
|
-
const raw = await __classPrivateFieldGet(this,
|
|
41
|
+
const raw = await __classPrivateFieldGet(this, _ClassicStrategy_wire, "f")
|
|
42
|
+
.sendAction('send-channel-message', {
|
|
44
43
|
...cleanId,
|
|
45
44
|
providerIdentity: this.providerIdentity,
|
|
46
45
|
action,
|
|
@@ -53,9 +52,9 @@ class ClassicStrategy {
|
|
|
53
52
|
};
|
|
54
53
|
this.close = async () => {
|
|
55
54
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
|
56
|
-
__classPrivateFieldSet(this,
|
|
55
|
+
__classPrivateFieldSet(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
|
57
56
|
};
|
|
58
|
-
__classPrivateFieldSet(this,
|
|
57
|
+
__classPrivateFieldSet(this, _ClassicStrategy_wire, wire, "f");
|
|
59
58
|
}
|
|
60
59
|
onEndpointDisconnect(endpointId, listener) {
|
|
61
60
|
// Never fires for 'classic'.
|
|
@@ -64,13 +63,13 @@ class ClassicStrategy {
|
|
|
64
63
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
|
65
64
|
}
|
|
66
65
|
async closeEndpoint(endpointId) {
|
|
67
|
-
__classPrivateFieldGet(this,
|
|
66
|
+
__classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
68
67
|
}
|
|
69
68
|
isEndpointConnected(endpointId) {
|
|
70
|
-
return __classPrivateFieldGet(this,
|
|
69
|
+
return __classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
|
71
70
|
}
|
|
72
71
|
addEndpoint(endpointId, payload) {
|
|
73
|
-
__classPrivateFieldGet(this,
|
|
72
|
+
__classPrivateFieldGet(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
|
74
73
|
}
|
|
75
74
|
isValidEndpointPayload(payload) {
|
|
76
75
|
var _a, _b;
|
|
@@ -79,6 +78,6 @@ class ClassicStrategy {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
exports.ClassicStrategy = ClassicStrategy;
|
|
82
|
-
|
|
81
|
+
_ClassicStrategy_wire = new WeakMap(), _ClassicStrategy_endpointIdentityMap = new WeakMap();
|
|
83
82
|
// Arbitrarily starting at 5 to leave the door open to backfilling pre endpointId etc.
|
|
84
83
|
exports.ClassicInfo = { version: 5, minimumVersion: 0, type: 'classic' };
|
|
@@ -15,6 +15,9 @@ export interface RTCProtocolOffer extends ProtocolPacketBase {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
export declare type ProtocolOffer = ClassicProtocolOffer | RTCProtocolOffer;
|
|
18
|
+
/**
|
|
19
|
+
* Protocol values for determining channel messaging strategy.
|
|
20
|
+
*/
|
|
18
21
|
export declare type MessagingProtocols = ProtocolOffer['type'];
|
|
19
22
|
export declare type LocalSupportedProtocol = {
|
|
20
23
|
type: MessagingProtocols;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExternalClientOffer, LocalSupportedProtocol, MessagingProtocols, ProtocolOffer } from '.';
|
|
2
2
|
export declare class ProtocolManager {
|
|
3
3
|
private ProtocolsInPreferenceOrder;
|
|
4
4
|
DefaultClientProtocols: ['classic'];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as OpenFin from '../../../../../OpenFin';
|
|
2
|
+
declare type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
2
3
|
export interface RTCEndpointChannels {
|
|
3
4
|
request: RTCDataChannel;
|
|
4
5
|
response: RTCDataChannel;
|
|
@@ -21,3 +22,4 @@ export declare class RTCEndpoint {
|
|
|
21
22
|
close: () => void;
|
|
22
23
|
get connected(): boolean;
|
|
23
24
|
}
|
|
25
|
+
export {};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (!
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
return privateMap.get(receiver);
|
|
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);
|
|
8
6
|
};
|
|
9
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return value;
|
|
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;
|
|
15
12
|
};
|
|
16
|
-
var
|
|
13
|
+
var _RTCEndpoint_processAction, _RTCEndpoint_disconnectListener;
|
|
17
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
15
|
exports.RTCEndpoint = void 0;
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19
17
|
const errors_1 = require("../../../../../util/errors");
|
|
20
18
|
/*
|
|
21
19
|
This handles sending RTC messages between RTC connections over the request and response data channels.
|
|
@@ -25,14 +23,14 @@ class RTCEndpoint {
|
|
|
25
23
|
this.rtc = rtc;
|
|
26
24
|
this.endpointIdentity = endpointIdentity;
|
|
27
25
|
this.responseMap = new Map();
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
_RTCEndpoint_processAction.set(this, null);
|
|
27
|
+
_RTCEndpoint_disconnectListener.set(this, void 0);
|
|
30
28
|
this.connectionStateChangeHandler = (event) => {
|
|
31
29
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
32
30
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
33
31
|
this.close();
|
|
34
|
-
if (__classPrivateFieldGet(this,
|
|
35
|
-
__classPrivateFieldGet(this,
|
|
32
|
+
if (__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
33
|
+
__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
};
|
|
@@ -71,9 +69,9 @@ class RTCEndpoint {
|
|
|
71
69
|
});
|
|
72
70
|
this.rtc.channels.request.addEventListener('message', async (e) => {
|
|
73
71
|
const { messageId, action, payload } = JSON.parse(e.data);
|
|
74
|
-
if (__classPrivateFieldGet(this,
|
|
72
|
+
if (__classPrivateFieldGet(this, _RTCEndpoint_processAction, "f")) {
|
|
75
73
|
try {
|
|
76
|
-
const res = await __classPrivateFieldGet(this,
|
|
74
|
+
const res = await __classPrivateFieldGet(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
|
77
75
|
this.rtc.channels.response.send(JSON.stringify({
|
|
78
76
|
messageId,
|
|
79
77
|
payload: res,
|
|
@@ -86,7 +84,7 @@ class RTCEndpoint {
|
|
|
86
84
|
if (this.rtc.channels.response.readyState === 'open') {
|
|
87
85
|
this.rtc.channels.response.send(JSON.stringify({
|
|
88
86
|
messageId,
|
|
89
|
-
error: errors_1.errorToPOJO(error),
|
|
87
|
+
error: (0, errors_1.errorToPOJO)(error),
|
|
90
88
|
success: false
|
|
91
89
|
}));
|
|
92
90
|
}
|
|
@@ -107,29 +105,29 @@ class RTCEndpoint {
|
|
|
107
105
|
datachannel.onclose = (e) => {
|
|
108
106
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
109
107
|
this.close();
|
|
110
|
-
if (__classPrivateFieldGet(this,
|
|
111
|
-
__classPrivateFieldGet(this,
|
|
108
|
+
if (__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
109
|
+
__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
|
112
110
|
}
|
|
113
111
|
};
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
114
|
onDisconnect(listener) {
|
|
117
|
-
if (!__classPrivateFieldGet(this,
|
|
118
|
-
__classPrivateFieldSet(this,
|
|
115
|
+
if (!__classPrivateFieldGet(this, _RTCEndpoint_disconnectListener, "f")) {
|
|
116
|
+
__classPrivateFieldSet(this, _RTCEndpoint_disconnectListener, listener, "f");
|
|
119
117
|
}
|
|
120
118
|
else {
|
|
121
119
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
receive(listener) {
|
|
125
|
-
if (__classPrivateFieldGet(this,
|
|
123
|
+
if (__classPrivateFieldGet(this, _RTCEndpoint_processAction, "f")) {
|
|
126
124
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
127
125
|
}
|
|
128
|
-
__classPrivateFieldSet(this,
|
|
126
|
+
__classPrivateFieldSet(this, _RTCEndpoint_processAction, listener, "f");
|
|
129
127
|
}
|
|
130
128
|
get connected() {
|
|
131
129
|
return this.rtc.rtcClient.connectionState === 'connected';
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
132
|
exports.RTCEndpoint = RTCEndpoint;
|
|
135
|
-
|
|
133
|
+
_RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = new WeakMap();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../../../OpenFin';
|
|
1
2
|
import { ChannelStrategy } from '../strategy';
|
|
2
3
|
import { RTCPacket } from './endpoint';
|
|
3
4
|
import { LocalSupportedProtocol } from '..';
|
|
4
|
-
|
|
5
|
+
declare type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
5
6
|
export interface RTCStrategyEndpointPayload {
|
|
6
7
|
endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity;
|
|
7
8
|
rtc: RTCPacket;
|
|
@@ -20,3 +21,4 @@ export declare class RTCStrategy implements ChannelStrategy<RTCStrategyEndpointP
|
|
|
20
21
|
isValidEndpointPayload(payload: any): payload is RTCStrategyEndpointPayload;
|
|
21
22
|
}
|
|
22
23
|
export declare const RTCInfo: LocalSupportedProtocol;
|
|
24
|
+
export {};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
3
|
-
if (!
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return privateMap.get(receiver);
|
|
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);
|
|
7
6
|
};
|
|
8
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return value;
|
|
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;
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _RTCStrategy_processAction, _RTCStrategy_rtcEndpointMap, _RTCStrategy_connected;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.RTCInfo = exports.RTCStrategy = void 0;
|
|
18
16
|
const endpoint_1 = require("./endpoint");
|
|
@@ -21,56 +19,56 @@ This is used to abstract out rtc messaging from the channels implementation usin
|
|
|
21
19
|
*/
|
|
22
20
|
class RTCStrategy {
|
|
23
21
|
constructor() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
_RTCStrategy_processAction.set(this, null);
|
|
23
|
+
_RTCStrategy_rtcEndpointMap.set(this, new Map());
|
|
24
|
+
_RTCStrategy_connected.set(this, true);
|
|
27
25
|
this.send = async (endpointId, action, payload) => {
|
|
28
26
|
return this.getEndpointById(endpointId).send(action, payload);
|
|
29
27
|
};
|
|
30
28
|
this.close = async () => {
|
|
31
|
-
if (__classPrivateFieldGet(this,
|
|
32
|
-
__classPrivateFieldGet(this,
|
|
33
|
-
__classPrivateFieldSet(this,
|
|
29
|
+
if (__classPrivateFieldGet(this, _RTCStrategy_connected, "f")) {
|
|
30
|
+
__classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").forEach((rtcEndpoint) => rtcEndpoint.close());
|
|
31
|
+
__classPrivateFieldSet(this, _RTCStrategy_rtcEndpointMap, new Map(), "f");
|
|
34
32
|
}
|
|
35
|
-
__classPrivateFieldSet(this,
|
|
33
|
+
__classPrivateFieldSet(this, _RTCStrategy_connected, false, "f");
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
36
|
onEndpointDisconnect(endpointId, listener) {
|
|
39
37
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
|
40
38
|
}
|
|
41
39
|
receive(listener) {
|
|
42
|
-
if (__classPrivateFieldGet(this,
|
|
40
|
+
if (__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")) {
|
|
43
41
|
throw new Error('You have already set a listener for this RTC Strategy');
|
|
44
42
|
}
|
|
45
|
-
__classPrivateFieldSet(this,
|
|
46
|
-
__classPrivateFieldGet(this,
|
|
43
|
+
__classPrivateFieldSet(this, _RTCStrategy_processAction, listener, "f");
|
|
44
|
+
__classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").forEach((rtcEndpoint) => rtcEndpoint.receive(__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")));
|
|
47
45
|
}
|
|
48
46
|
getEndpointById(endpointId) {
|
|
49
|
-
const endpoint = __classPrivateFieldGet(this,
|
|
47
|
+
const endpoint = __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").get(endpointId);
|
|
50
48
|
if (!endpoint) {
|
|
51
49
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
|
52
50
|
}
|
|
53
51
|
return endpoint;
|
|
54
52
|
}
|
|
55
53
|
get connected() {
|
|
56
|
-
return __classPrivateFieldGet(this,
|
|
54
|
+
return __classPrivateFieldGet(this, _RTCStrategy_connected, "f");
|
|
57
55
|
}
|
|
58
56
|
isEndpointConnected(endpointId) {
|
|
59
|
-
return __classPrivateFieldGet(this,
|
|
57
|
+
return __classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").has(endpointId);
|
|
60
58
|
}
|
|
61
59
|
addEndpoint(endpointId, payload) {
|
|
62
|
-
if (!__classPrivateFieldGet(this,
|
|
60
|
+
if (!__classPrivateFieldGet(this, _RTCStrategy_connected, "f")) {
|
|
63
61
|
console.warn('Adding endpoint to disconnected RTC Strategy');
|
|
64
62
|
return;
|
|
65
63
|
}
|
|
66
64
|
const clientStrat = new endpoint_1.RTCEndpoint(payload.rtc, payload.endpointIdentity);
|
|
67
|
-
if (__classPrivateFieldGet(this,
|
|
68
|
-
clientStrat.receive(__classPrivateFieldGet(this,
|
|
65
|
+
if (__classPrivateFieldGet(this, _RTCStrategy_processAction, "f")) {
|
|
66
|
+
clientStrat.receive(__classPrivateFieldGet(this, _RTCStrategy_processAction, "f"));
|
|
69
67
|
}
|
|
70
|
-
__classPrivateFieldGet(this,
|
|
68
|
+
__classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").set(endpointId, clientStrat);
|
|
71
69
|
}
|
|
72
70
|
async closeEndpoint(endpointId) {
|
|
73
|
-
__classPrivateFieldGet(this,
|
|
71
|
+
__classPrivateFieldGet(this, _RTCStrategy_rtcEndpointMap, "f").delete(endpointId);
|
|
74
72
|
}
|
|
75
73
|
isValidEndpointPayload(payload) {
|
|
76
74
|
const isObject = (x) => {
|
|
@@ -83,5 +81,5 @@ class RTCStrategy {
|
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
exports.RTCStrategy = RTCStrategy;
|
|
86
|
-
|
|
84
|
+
_RTCStrategy_processAction = new WeakMap(), _RTCStrategy_rtcEndpointMap = new WeakMap(), _RTCStrategy_connected = new WeakMap();
|
|
87
85
|
exports.RTCInfo = { version: 1, minimumVersion: 0, type: 'rtc' };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
+
declare type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
2
3
|
export interface ChannelStrategy<T extends unknown> {
|
|
3
4
|
onEndpointDisconnect(endpointId: string, listener: () => void): void;
|
|
4
5
|
receive(listener: (action: string, payload: any, identity: any) => Promise<any>): void;
|
|
@@ -13,3 +14,4 @@ export declare type EndpointIdentity = OpenFin.ClientIdentity | ProviderIdentity
|
|
|
13
14
|
export declare type EndpointPayload = {
|
|
14
15
|
endpointIdentity: EndpointIdentity;
|
|
15
16
|
};
|
|
17
|
+
export {};
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../OpenFin';
|
|
1
2
|
import { ChannelBase } from './channel';
|
|
2
3
|
import Transport from '../../../transport/transport';
|
|
3
4
|
import { AnyStrategy } from './protocols/strategy-types';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
declare type ProviderIdentity = OpenFin.ProviderIdentity;
|
|
6
|
+
declare type ClientIdentity = OpenFin.ClientIdentity;
|
|
6
7
|
export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
|
|
7
8
|
export declare type DisconnectionListener = (identity: ClientIdentity) => any;
|
|
9
|
+
declare type ClientConnectionPayload = OpenFin.ClientIdentity & OpenFin.ClientInfo;
|
|
8
10
|
export declare class ChannelProvider extends ChannelBase {
|
|
9
11
|
#private;
|
|
10
12
|
private static removalMap;
|
|
11
13
|
private connectListener;
|
|
12
14
|
private disconnectListener;
|
|
13
|
-
get connections():
|
|
15
|
+
get connections(): ClientConnectionPayload[];
|
|
14
16
|
static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
|
|
15
17
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
16
18
|
constructor(providerIdentity: ProviderIdentity, wire: Transport, strategy: AnyStrategy);
|
|
17
19
|
dispatch(to: OpenFin.ClientIdentity | OpenFin.Identity, action: string, payload?: any): Promise<any>;
|
|
18
20
|
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime) => Promise<any>;
|
|
19
|
-
processConnection(senderId:
|
|
21
|
+
processConnection(senderId: ClientConnectionPayload, payload: any): Promise<any>;
|
|
20
22
|
publish(action: string, payload: any): Promise<any>[];
|
|
21
23
|
onConnection(listener: ConnectionListener): void;
|
|
22
24
|
onDisconnection(listener: DisconnectionListener): void;
|
|
23
25
|
destroy(): Promise<void>;
|
|
26
|
+
getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
|
|
24
27
|
private checkForClientConnection;
|
|
25
28
|
private isClientConnected;
|
|
26
29
|
private isLegacyClientConnected;
|
|
@@ -29,3 +32,4 @@ export declare class ChannelProvider extends ChannelBase {
|
|
|
29
32
|
private static clientIdentityIncludesEndpointId;
|
|
30
33
|
private static clientIsMultiRuntime;
|
|
31
34
|
}
|
|
35
|
+
export {};
|