@openfin/remote-adapter 45.100.81 → 45.100.83
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/out/remote-adapter.js +39 -16
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -10696,9 +10696,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
10696
10696
|
return [...__classPrivateFieldGet$e(this, _ChannelProvider_connections, "f")];
|
|
10697
10697
|
}
|
|
10698
10698
|
static handleClientDisconnection(channel, payload) {
|
|
10699
|
-
if (payload
|
|
10700
|
-
|
|
10701
|
-
__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
10699
|
+
if (payload.endpointId) {
|
|
10700
|
+
__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
10702
10701
|
}
|
|
10703
10702
|
else {
|
|
10704
10703
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -10868,7 +10867,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
10868
10867
|
* ```
|
|
10869
10868
|
*/
|
|
10870
10869
|
onDisconnection(listener) {
|
|
10871
|
-
this.disconnectListener =
|
|
10870
|
+
this.disconnectListener = (identity) => {
|
|
10871
|
+
listener(identity);
|
|
10872
|
+
};
|
|
10872
10873
|
}
|
|
10873
10874
|
/**
|
|
10874
10875
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -10885,7 +10886,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
10885
10886
|
*/
|
|
10886
10887
|
async destroy() {
|
|
10887
10888
|
const protectedObj = __classPrivateFieldGet$e(this, _ChannelProvider_protectedObj, "f");
|
|
10888
|
-
protectedObj.providerIdentity;
|
|
10889
10889
|
__classPrivateFieldSet$d(this, _ChannelProvider_connections, [], "f");
|
|
10890
10890
|
await protectedObj.close();
|
|
10891
10891
|
__classPrivateFieldGet$e(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -11182,6 +11182,13 @@ class ConnectionManager extends Base {
|
|
|
11182
11182
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
11183
11183
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
11184
11184
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
11185
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
11186
|
+
if (providerEntry) {
|
|
11187
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
11188
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
11189
|
+
this.providerChannelIdByName.delete(channelName);
|
|
11190
|
+
}
|
|
11191
|
+
}
|
|
11185
11192
|
this.providerMap.delete(channelId);
|
|
11186
11193
|
};
|
|
11187
11194
|
this.onmessage = (msg) => {
|
|
@@ -11192,6 +11199,7 @@ class ConnectionManager extends Base {
|
|
|
11192
11199
|
return false;
|
|
11193
11200
|
};
|
|
11194
11201
|
this.providerMap = new Map();
|
|
11202
|
+
this.providerChannelIdByName = new Map();
|
|
11195
11203
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
11196
11204
|
__classPrivateFieldSet$c(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
11197
11205
|
__classPrivateFieldSet$c(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -11228,10 +11236,12 @@ class ConnectionManager extends Base {
|
|
|
11228
11236
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
11229
11237
|
const key = providerIdentity.channelId;
|
|
11230
11238
|
this.providerMap.set(key, {
|
|
11239
|
+
providerIdentity,
|
|
11231
11240
|
provider: channel,
|
|
11232
11241
|
strategy,
|
|
11233
11242
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
11234
11243
|
});
|
|
11244
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
11235
11245
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
11236
11246
|
return channel;
|
|
11237
11247
|
}
|
|
@@ -11306,6 +11316,16 @@ class ConnectionManager extends Base {
|
|
|
11306
11316
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
11307
11317
|
return strategy;
|
|
11308
11318
|
}
|
|
11319
|
+
handleClientDisconnection(eventPayload) {
|
|
11320
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
11321
|
+
if (!channelId) {
|
|
11322
|
+
return;
|
|
11323
|
+
}
|
|
11324
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
11325
|
+
if (providerEntry) {
|
|
11326
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11309
11329
|
async processChannelConnection(msg) {
|
|
11310
11330
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
11311
11331
|
if (!clientIdentity.endpointId) {
|
|
@@ -11405,7 +11425,7 @@ var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
11405
11425
|
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");
|
|
11406
11426
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11407
11427
|
};
|
|
11408
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
11428
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
11409
11429
|
function retryDelay(count) {
|
|
11410
11430
|
const interval = 500; // base delay
|
|
11411
11431
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -11441,9 +11461,19 @@ class Channel extends EmitterBase {
|
|
|
11441
11461
|
super(wire, 'channel');
|
|
11442
11462
|
_Channel_connectionManager.set(this, void 0);
|
|
11443
11463
|
_Channel_internalEmitter.set(this, new events.EventEmitter());
|
|
11464
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
11465
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
11466
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
11467
|
+
// TODO: fix typing (internal)
|
|
11468
|
+
// @ts-expect-error
|
|
11469
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
11470
|
+
__classPrivateFieldGet$c(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
11471
|
+
});
|
|
11472
|
+
}));
|
|
11444
11473
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
11445
11474
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
11446
11475
|
await Promise.all([
|
|
11476
|
+
__classPrivateFieldGet$c(this, _Channel_readyForProvider, "f").getValue(),
|
|
11447
11477
|
this.on('disconnected', (eventPayload) => {
|
|
11448
11478
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
11449
11479
|
}),
|
|
@@ -11700,22 +11730,15 @@ class Channel extends EmitterBase {
|
|
|
11700
11730
|
* ```
|
|
11701
11731
|
*/
|
|
11702
11732
|
async create(channelName, options) {
|
|
11733
|
+
await __classPrivateFieldGet$c(this, _Channel_readyForProvider, "f").getValue();
|
|
11703
11734
|
if (!channelName) {
|
|
11704
11735
|
throw new Error('Please provide a channelName to create a channel');
|
|
11705
11736
|
}
|
|
11706
11737
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
11707
|
-
|
|
11708
|
-
// TODO: fix typing (internal)
|
|
11709
|
-
// @ts-expect-error
|
|
11710
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
11711
|
-
if (eventPayload.channelName === channelName) {
|
|
11712
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
11713
|
-
}
|
|
11714
|
-
});
|
|
11715
|
-
return channel;
|
|
11738
|
+
return __classPrivateFieldGet$c(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
11716
11739
|
}
|
|
11717
11740
|
}
|
|
11718
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
11741
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
11719
11742
|
|
|
11720
11743
|
/**
|
|
11721
11744
|
* Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/remote-adapter",
|
|
3
|
-
"version": "45.100.
|
|
3
|
+
"version": "45.100.83",
|
|
4
4
|
"description": "Establish intermachine runtime connections using webRTC.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"private": false,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"es-toolkit": "^1.39.3",
|
|
18
18
|
"tslib": "2.8.1",
|
|
19
|
-
"@openfin/core": "45.100.
|
|
19
|
+
"@openfin/core": "45.100.83"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"prebuild": "rimraf ./out",
|