@openfin/node-adapter 45.100.81 → 45.100.84
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
|
@@ -8146,9 +8146,8 @@ class ChannelProvider extends ChannelBase {
|
|
|
8146
8146
|
return [...__classPrivateFieldGet$g(this, _ChannelProvider_connections, "f")];
|
|
8147
8147
|
}
|
|
8148
8148
|
static handleClientDisconnection(channel, payload) {
|
|
8149
|
-
if (payload
|
|
8150
|
-
|
|
8151
|
-
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
|
|
8149
|
+
if (payload.endpointId) {
|
|
8150
|
+
__classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
|
|
8152
8151
|
}
|
|
8153
8152
|
else {
|
|
8154
8153
|
// this is here to support older runtimes that did not have endpointId
|
|
@@ -8318,7 +8317,9 @@ class ChannelProvider extends ChannelBase {
|
|
|
8318
8317
|
* ```
|
|
8319
8318
|
*/
|
|
8320
8319
|
onDisconnection(listener) {
|
|
8321
|
-
this.disconnectListener =
|
|
8320
|
+
this.disconnectListener = (identity) => {
|
|
8321
|
+
listener(identity);
|
|
8322
|
+
};
|
|
8322
8323
|
}
|
|
8323
8324
|
/**
|
|
8324
8325
|
* Destroy the channel, raises `disconnected` events on all connected channel clients.
|
|
@@ -8335,7 +8336,6 @@ class ChannelProvider extends ChannelBase {
|
|
|
8335
8336
|
*/
|
|
8336
8337
|
async destroy() {
|
|
8337
8338
|
const protectedObj = __classPrivateFieldGet$g(this, _ChannelProvider_protectedObj, "f");
|
|
8338
|
-
protectedObj.providerIdentity;
|
|
8339
8339
|
__classPrivateFieldSet$f(this, _ChannelProvider_connections, [], "f");
|
|
8340
8340
|
await protectedObj.close();
|
|
8341
8341
|
__classPrivateFieldGet$g(this, _ChannelProvider_close, "f").call(this);
|
|
@@ -8632,6 +8632,13 @@ class ConnectionManager extends Base {
|
|
|
8632
8632
|
_ConnectionManager_messageReceiver.set(this, void 0);
|
|
8633
8633
|
_ConnectionManager_rtcConnectionManager.set(this, void 0);
|
|
8634
8634
|
this.removeChannelFromProviderMap = (channelId) => {
|
|
8635
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8636
|
+
if (providerEntry) {
|
|
8637
|
+
const { channelName } = providerEntry.providerIdentity;
|
|
8638
|
+
if (this.providerChannelIdByName.get(channelName) === channelId) {
|
|
8639
|
+
this.providerChannelIdByName.delete(channelName);
|
|
8640
|
+
}
|
|
8641
|
+
}
|
|
8635
8642
|
this.providerMap.delete(channelId);
|
|
8636
8643
|
};
|
|
8637
8644
|
this.onmessage = (msg) => {
|
|
@@ -8642,6 +8649,7 @@ class ConnectionManager extends Base {
|
|
|
8642
8649
|
return false;
|
|
8643
8650
|
};
|
|
8644
8651
|
this.providerMap = new Map();
|
|
8652
|
+
this.providerChannelIdByName = new Map();
|
|
8645
8653
|
this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
|
8646
8654
|
__classPrivateFieldSet$e(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
|
|
8647
8655
|
__classPrivateFieldSet$e(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
|
|
@@ -8678,10 +8686,12 @@ class ConnectionManager extends Base {
|
|
|
8678
8686
|
const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
|
|
8679
8687
|
const key = providerIdentity.channelId;
|
|
8680
8688
|
this.providerMap.set(key, {
|
|
8689
|
+
providerIdentity,
|
|
8681
8690
|
provider: channel,
|
|
8682
8691
|
strategy,
|
|
8683
8692
|
supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
|
|
8684
8693
|
});
|
|
8694
|
+
this.providerChannelIdByName.set(providerIdentity.channelName, key);
|
|
8685
8695
|
ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
|
|
8686
8696
|
return channel;
|
|
8687
8697
|
}
|
|
@@ -8756,6 +8766,16 @@ class ConnectionManager extends Base {
|
|
|
8756
8766
|
strategy.addEndpoint(routingInfo.channelId, endpointPayload);
|
|
8757
8767
|
return strategy;
|
|
8758
8768
|
}
|
|
8769
|
+
handleClientDisconnection(eventPayload) {
|
|
8770
|
+
const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
|
|
8771
|
+
if (!channelId) {
|
|
8772
|
+
return;
|
|
8773
|
+
}
|
|
8774
|
+
const providerEntry = this.providerMap.get(channelId);
|
|
8775
|
+
if (providerEntry) {
|
|
8776
|
+
ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
|
|
8777
|
+
}
|
|
8778
|
+
}
|
|
8759
8779
|
async processChannelConnection(msg) {
|
|
8760
8780
|
const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
|
|
8761
8781
|
if (!clientIdentity.endpointId) {
|
|
@@ -8855,7 +8875,7 @@ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
8855
8875
|
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");
|
|
8856
8876
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8857
8877
|
};
|
|
8858
|
-
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
|
|
8878
|
+
var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
|
|
8859
8879
|
function retryDelay(count) {
|
|
8860
8880
|
const interval = 500; // base delay
|
|
8861
8881
|
const steps = 10; // How many retries to do before incrementing the delay
|
|
@@ -8891,9 +8911,19 @@ class Channel extends EmitterBase {
|
|
|
8891
8911
|
super(wire, 'channel');
|
|
8892
8912
|
_Channel_connectionManager.set(this, void 0);
|
|
8893
8913
|
_Channel_internalEmitter.set(this, new events.EventEmitter());
|
|
8914
|
+
// Provider-side disconnect routing setup. This must exist before first create()
|
|
8915
|
+
// so provider onDisconnection callbacks are wired even if connect() is never called.
|
|
8916
|
+
_Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
|
|
8917
|
+
// TODO: fix typing (internal)
|
|
8918
|
+
// @ts-expect-error
|
|
8919
|
+
await this.on('client-disconnected', (eventPayload) => {
|
|
8920
|
+
__classPrivateFieldGet$e(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
|
|
8921
|
+
});
|
|
8922
|
+
}));
|
|
8894
8923
|
// OpenFin API has not been injected at construction time, *must* wait for API to be ready.
|
|
8895
8924
|
_Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
|
|
8896
8925
|
await Promise.all([
|
|
8926
|
+
__classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue(),
|
|
8897
8927
|
this.on('disconnected', (eventPayload) => {
|
|
8898
8928
|
ChannelClient.handleProviderDisconnect(eventPayload);
|
|
8899
8929
|
}),
|
|
@@ -9150,22 +9180,15 @@ class Channel extends EmitterBase {
|
|
|
9150
9180
|
* ```
|
|
9151
9181
|
*/
|
|
9152
9182
|
async create(channelName, options) {
|
|
9183
|
+
await __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue();
|
|
9153
9184
|
if (!channelName) {
|
|
9154
9185
|
throw new Error('Please provide a channelName to create a channel');
|
|
9155
9186
|
}
|
|
9156
9187
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
|
9157
|
-
|
|
9158
|
-
// TODO: fix typing (internal)
|
|
9159
|
-
// @ts-expect-error
|
|
9160
|
-
this.on('client-disconnected', (eventPayload) => {
|
|
9161
|
-
if (eventPayload.channelName === channelName) {
|
|
9162
|
-
ChannelProvider.handleClientDisconnection(channel, eventPayload);
|
|
9163
|
-
}
|
|
9164
|
-
});
|
|
9165
|
-
return channel;
|
|
9188
|
+
return __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
|
9166
9189
|
}
|
|
9167
9190
|
}
|
|
9168
|
-
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9191
|
+
_Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
|
|
9169
9192
|
|
|
9170
9193
|
/**
|
|
9171
9194
|
* Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
|
|
@@ -17315,7 +17338,7 @@ class NodeEnvironment extends BaseEnvironment {
|
|
|
17315
17338
|
};
|
|
17316
17339
|
}
|
|
17317
17340
|
getAdapterVersionSync() {
|
|
17318
|
-
return "45.100.
|
|
17341
|
+
return "45.100.84";
|
|
17319
17342
|
}
|
|
17320
17343
|
observeBounds(element, onChange) {
|
|
17321
17344
|
throw new Error('Method not implemented.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/node-adapter",
|
|
3
|
-
"version": "45.100.
|
|
3
|
+
"version": "45.100.84",
|
|
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": "45.100.
|
|
23
|
+
"@openfin/core": "45.100.84"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"prebuild": "rimraf ./out",
|