@openfin/remote-adapter 44.101.3 → 44.101.6
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
|
@@ -10667,9 +10667,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
10667
10667
|
return [...__classPrivateFieldGet$c(this, _ChannelProvider_connections, "f")];
|
|
10668
10668
|
}
|
|
10669
10669
|
static handleClientDisconnection(channel, payload) {
|
|
10670
|
-
if (payload
|
|
10671
|
-
|
|
10672
|
-
__classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
10670
|
+
if (payload.endpointId) {
|
|
10671
|
+
__classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
10673
10672
|
}
|
|
10674
10673
|
else {
|
|
10675
10674
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -10839,7 +10838,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
10839
10838
|
* ```
|
|
10840
10839
|
*/
|
|
10841
10840
|
onDisconnection(listener) {
|
|
10842
|
-
this.disconnectListener =
|
|
10841
|
+
this.disconnectListener = (identity) => {
|
|
10842
|
+
listener(identity);
|
|
10843
|
+
};
|
|
10843
10844
|
}
|
|
10844
10845
|
/**
|
|
10845
10846
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -10856,7 +10857,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
10856
10857
|
*/
|
|
10857
10858
|
async destroy() {
|
|
10858
10859
|
const protectedObj = __classPrivateFieldGet$c(this, _ChannelProvider_protectedObj, "f");
|
|
10859
|
-
protectedObj.providerIdentity;
|
|
10860
10860
|
__classPrivateFieldSet$b(this, _ChannelProvider_connections, [], "f");
|
|
10861
10861
|
await protectedObj.close();
|
|
10862
10862
|
__classPrivateFieldGet$c(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -11153,6 +11153,13 @@ class ConnectionManager extends Base {
|
|
|
11153
11153
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
11154
11154
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
11155
11155
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
11156
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
11157
|
+
if (providerEntry) {
|
|
11158
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
11159
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
11160
|
+
this.providerChannelIdByName.delete(channelName);
|
|
11161
|
+
}
|
|
11162
|
+
}
|
|
11156
11163
|
this.providerMap.delete(channelId);
|
|
11157
11164
|
};
|
|
11158
11165
|
this.onmessage = (msg) => {
|
|
@@ -11163,6 +11170,7 @@ class ConnectionManager extends Base {
|
|
|
11163
11170
|
return false;
|
|
11164
11171
|
};
|
|
11165
11172
|
this.providerMap = new Map();
|
|
11173
|
+
this.providerChannelIdByName = new Map();
|
|
11166
11174
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
11167
11175
|
__classPrivateFieldSet$a(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
11168
11176
|
__classPrivateFieldSet$a(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -11199,10 +11207,12 @@ class ConnectionManager extends Base {
|
|
|
11199
11207
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
11200
11208
|
const key = providerIdentity.channelId;
|
|
11201
11209
|
this.providerMap.set(key, {
|
|
11210
|
+
providerIdentity,
|
|
11202
11211
|
provider: channel,
|
|
11203
11212
|
strategy,
|
|
11204
11213
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
11205
11214
|
});
|
|
11215
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
11206
11216
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
11207
11217
|
return channel;
|
|
11208
11218
|
}
|
|
@@ -11277,6 +11287,16 @@ class ConnectionManager extends Base {
|
|
|
11277
11287
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
11278
11288
|
return strategy;
|
|
11279
11289
|
}
|
|
11290
|
+
handleClientDisconnection(eventPayload) {
|
|
11291
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
11292
|
+
if (!channelId) {
|
|
11293
|
+
return;
|
|
11294
|
+
}
|
|
11295
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
11296
|
+
if (providerEntry) {
|
|
11297
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
11298
|
+
}
|
|
11299
|
+
}
|
|
11280
11300
|
async processChannelConnection(msg) {
|
|
11281
11301
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
11282
11302
|
if (!clientIdentity.endpointId) {
|
|
@@ -11376,7 +11396,7 @@ var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
11376
11396
|
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");
|
|
11377
11397
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11378
11398
|
};
|
|
11379
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
11399
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
11380
11400
|
function retryDelay(count) {
|
|
11381
11401
|
const interval = 500; // base delay
|
|
11382
11402
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -11412,9 +11432,19 @@ class Channel extends EmitterBase {
|
|
|
11412
11432
|
super(wire, 'channel');
|
|
11413
11433
|
_Channel_connectionManager.set(this, void 0);
|
|
11414
11434
|
_Channel_internalEmitter.set(this, new events.EventEmitter());
|
|
11435
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
11436
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
11437
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
11438
|
+
// TODO: fix typing (internal)
|
|
11439
|
+
// @ts-expect-error
|
|
11440
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
11441
|
+
__classPrivateFieldGet$a(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
11442
|
+
});
|
|
11443
|
+
}));
|
|
11415
11444
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
11416
11445
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
11417
11446
|
await Promise.all([
|
|
11447
|
+
__classPrivateFieldGet$a(this, _Channel_readyForProvider, "f").getValue(),
|
|
11418
11448
|
this.on('disconnected', (eventPayload) => {
|
|
11419
11449
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
11420
11450
|
}),
|
|
@@ -11671,22 +11701,15 @@ class Channel extends EmitterBase {
|
|
|
11671
11701
|
* ```
|
|
11672
11702
|
*/
|
|
11673
11703
|
async create(channelName, options) {
|
|
11704
|
+
await __classPrivateFieldGet$a(this, _Channel_readyForProvider, "f").getValue();
|
|
11674
11705
|
if (!channelName) {
|
|
11675
11706
|
throw new Error('Please provide a channelName to create a channel');
|
|
11676
11707
|
}
|
|
11677
11708
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
11678
|
-
|
|
11679
|
-
// TODO: fix typing (internal)
|
|
11680
|
-
// @ts-expect-error
|
|
11681
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
11682
|
-
if (eventPayload.channelName === channelName) {
|
|
11683
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
11684
|
-
}
|
|
11685
|
-
});
|
|
11686
|
-
return channel;
|
|
11709
|
+
return __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
11687
11710
|
}
|
|
11688
11711
|
}
|
|
11689
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
11712
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
11690
11713
|
|
|
11691
11714
|
/**
|
|
11692
11715
|
* 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": "44.101.
|
|
3
|
+
"version": "44.101.6",
|
|
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": "44.101.
|
|
19
|
+
"@openfin/core": "44.101.6"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"prebuild": "rimraf ./out",
|