@openfin/node-adapter 44.101.5 → 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/node-adapter.js +40 -17
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
|
@@ -8117,9 +8117,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
8117
8117
|
return [...__classPrivateFieldGet$e(this, _ChannelProvider_connections, "f")];
|
|
8118
8118
|
}
|
|
8119
8119
|
static handleClientDisconnection(channel, payload) {
|
|
8120
|
-
if (payload
|
|
8121
|
-
|
|
8122
|
-
__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8120
|
+
if (payload.endpointId) {
|
|
8121
|
+
__classPrivateFieldGet$e(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
8123
8122
|
}
|
|
8124
8123
|
else {
|
|
8125
8124
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -8289,7 +8288,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
8289
8288
|
* ```
|
|
8290
8289
|
*/
|
|
8291
8290
|
onDisconnection(listener) {
|
|
8292
|
-
this.disconnectListener =
|
|
8291
|
+
this.disconnectListener = (identity) => {
|
|
8292
|
+
listener(identity);
|
|
8293
|
+
};
|
|
8293
8294
|
}
|
|
8294
8295
|
/**
|
|
8295
8296
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -8306,7 +8307,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
8306
8307
|
*/
|
|
8307
8308
|
async destroy() {
|
|
8308
8309
|
const protectedObj = __classPrivateFieldGet$e(this, _ChannelProvider_protectedObj, "f");
|
|
8309
|
-
protectedObj.providerIdentity;
|
|
8310
8310
|
__classPrivateFieldSet$d(this, _ChannelProvider_connections, [], "f");
|
|
8311
8311
|
await protectedObj.close();
|
|
8312
8312
|
__classPrivateFieldGet$e(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -8603,6 +8603,13 @@ class ConnectionManager extends Base {
|
|
|
8603
8603
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
8604
8604
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
8605
8605
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
8606
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8607
|
+
if (providerEntry) {
|
|
8608
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
8609
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
8610
|
+
this.providerChannelIdByName.delete(channelName);
|
|
8611
|
+
}
|
|
8612
|
+
}
|
|
8606
8613
|
this.providerMap.delete(channelId);
|
|
8607
8614
|
};
|
|
8608
8615
|
this.onmessage = (msg) => {
|
|
@@ -8613,6 +8620,7 @@ class ConnectionManager extends Base {
|
|
|
8613
8620
|
return false;
|
|
8614
8621
|
};
|
|
8615
8622
|
this.providerMap = new Map();
|
|
8623
|
+
this.providerChannelIdByName = new Map();
|
|
8616
8624
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8617
8625
|
__classPrivateFieldSet$c(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
8618
8626
|
__classPrivateFieldSet$c(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -8649,10 +8657,12 @@ class ConnectionManager extends Base {
|
|
|
8649
8657
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
8650
8658
|
const key = providerIdentity.channelId;
|
|
8651
8659
|
this.providerMap.set(key, {
|
|
8660
|
+
providerIdentity,
|
|
8652
8661
|
provider: channel,
|
|
8653
8662
|
strategy,
|
|
8654
8663
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
8655
8664
|
});
|
|
8665
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
8656
8666
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
8657
8667
|
return channel;
|
|
8658
8668
|
}
|
|
@@ -8727,6 +8737,16 @@ class ConnectionManager extends Base {
|
|
|
8727
8737
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
8728
8738
|
return strategy;
|
|
8729
8739
|
}
|
|
8740
|
+
handleClientDisconnection(eventPayload) {
|
|
8741
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
8742
|
+
if (!channelId) {
|
|
8743
|
+
return;
|
|
8744
|
+
}
|
|
8745
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8746
|
+
if (providerEntry) {
|
|
8747
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
8748
|
+
}
|
|
8749
|
+
}
|
|
8730
8750
|
async processChannelConnection(msg) {
|
|
8731
8751
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
8732
8752
|
if (!clientIdentity.endpointId) {
|
|
@@ -8826,7 +8846,7 @@ var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
8826
8846
|
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");
|
|
8827
8847
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8828
8848
|
};
|
|
8829
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
8849
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
8830
8850
|
function retryDelay(count) {
|
|
8831
8851
|
const interval = 500; // base delay
|
|
8832
8852
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -8862,9 +8882,19 @@ class Channel extends EmitterBase {
|
|
|
8862
8882
|
super(wire, 'channel');
|
|
8863
8883
|
_Channel_connectionManager.set(this, void 0);
|
|
8864
8884
|
_Channel_internalEmitter.set(this, new events.EventEmitter());
|
|
8885
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
8886
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
8887
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
8888
|
+
// TODO: fix typing (internal)
|
|
8889
|
+
// @ts-expect-error
|
|
8890
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
8891
|
+
__classPrivateFieldGet$c(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
8892
|
+
});
|
|
8893
|
+
}));
|
|
8865
8894
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
8866
8895
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
8867
8896
|
await Promise.all([
|
|
8897
|
+
__classPrivateFieldGet$c(this, _Channel_readyForProvider, "f").getValue(),
|
|
8868
8898
|
this.on('disconnected', (eventPayload) => {
|
|
8869
8899
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
8870
8900
|
}),
|
|
@@ -9121,22 +9151,15 @@ class Channel extends EmitterBase {
|
|
|
9121
9151
|
* ```
|
|
9122
9152
|
*/
|
|
9123
9153
|
async create(channelName, options) {
|
|
9154
|
+
await __classPrivateFieldGet$c(this, _Channel_readyForProvider, "f").getValue();
|
|
9124
9155
|
if (!channelName) {
|
|
9125
9156
|
throw new Error('Please provide a channelName to create a channel');
|
|
9126
9157
|
}
|
|
9127
9158
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9128
|
-
|
|
9129
|
-
// TODO: fix typing (internal)
|
|
9130
|
-
// @ts-expect-error
|
|
9131
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
9132
|
-
if (eventPayload.channelName === channelName) {
|
|
9133
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
9134
|
-
}
|
|
9135
|
-
});
|
|
9136
|
-
return channel;
|
|
9159
|
+
return __classPrivateFieldGet$c(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9137
9160
|
}
|
|
9138
9161
|
}
|
|
9139
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9162
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9140
9163
|
|
|
9141
9164
|
/**
|
|
9142
9165
|
* Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
|
|
@@ -17158,7 +17181,7 @@ class NodeEnvironment extends BaseEnvironment {
|
|
|
17158
17181
|
};
|
|
17159
17182
|
}
|
|
17160
17183
|
getAdapterVersionSync() {
|
|
17161
|
-
return "44.101.
|
|
17184
|
+
return "44.101.6";
|
|
17162
17185
|
}
|
|
17163
17186
|
observeBounds(element, onChange) {
|
|
17164
17187
|
throw new Error('Method not implemented.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/node-adapter",
|
|
3
|
-
"version": "44.101.
|
|
3
|
+
"version": "44.101.6",
|
|
4
4
|
"description": "See README.md",
|
|
5
5
|
"main": "out/node-adapter.js",
|
|
6
6
|
"types": "out/node-adapter.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"es-toolkit": "^1.39.3",
|
|
21
21
|
"ws": "^7.5.10",
|
|
22
22
|
"tslib": "2.8.1",
|
|
23
|
-
"@openfin/core": "44.101.
|
|
23
|
+
"@openfin/core": "44.101.6"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"prebuild": "rimraf ./out",
|