@openfin/remote-adapter 46.100.65 → 46.100.66
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 +128 -73
- package/package.json +2 -2
package/out/remote-adapter.js
CHANGED
|
@@ -758,6 +758,45 @@ class AsyncRetryableLazy {
|
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
760
|
|
|
761
|
+
/**
|
|
762
|
+
* The default FDC3 user channels advertised by the Interop Broker.
|
|
763
|
+
*/
|
|
764
|
+
const defaultColorChannels = {
|
|
765
|
+
'fdc3.channel.1': { name: 'Channel 1', color: 'red', glyph: '1' },
|
|
766
|
+
'fdc3.channel.2': { name: 'Channel 2', color: 'orange', glyph: '2' },
|
|
767
|
+
'fdc3.channel.3': { name: 'Channel 3', color: 'yellow', glyph: '3' },
|
|
768
|
+
'fdc3.channel.4': { name: 'Channel 4', color: 'green', glyph: '4' },
|
|
769
|
+
'fdc3.channel.5': { name: 'Channel 5', color: 'cyan', glyph: '5' },
|
|
770
|
+
'fdc3.channel.6': { name: 'Channel 6', color: 'blue', glyph: '6' },
|
|
771
|
+
'fdc3.channel.7': { name: 'Channel 7', color: 'magenta', glyph: '7' },
|
|
772
|
+
'fdc3.channel.8': { name: 'Channel 8', color: 'purple', glyph: '8' }
|
|
773
|
+
};
|
|
774
|
+
const legacyColorChannelIds = {
|
|
775
|
+
red: 'fdc3.channel.1',
|
|
776
|
+
orange: 'fdc3.channel.2',
|
|
777
|
+
yellow: 'fdc3.channel.3',
|
|
778
|
+
green: 'fdc3.channel.4',
|
|
779
|
+
teal: 'fdc3.channel.5',
|
|
780
|
+
blue: 'fdc3.channel.6',
|
|
781
|
+
pink: 'fdc3.channel.7',
|
|
782
|
+
// Legacy indigo (workspace) and purple (core) intentionally converge on the same FDC3 purple channel.
|
|
783
|
+
indigo: 'fdc3.channel.8',
|
|
784
|
+
purple: 'fdc3.channel.8'
|
|
785
|
+
};
|
|
786
|
+
/**
|
|
787
|
+
* Converts a legacy color-named channel ID to its canonical FDC3 user-channel ID.
|
|
788
|
+
* The removed legacy gray channel resolves to no channel.
|
|
789
|
+
*/
|
|
790
|
+
function normalizeColorChannelId(colorChannelId) {
|
|
791
|
+
if (colorChannelId === 'gray') {
|
|
792
|
+
return undefined;
|
|
793
|
+
}
|
|
794
|
+
if (Object.prototype.hasOwnProperty.call(legacyColorChannelIds, colorChannelId)) {
|
|
795
|
+
return legacyColorChannelIds[colorChannelId];
|
|
796
|
+
}
|
|
797
|
+
return colorChannelId;
|
|
798
|
+
}
|
|
799
|
+
|
|
761
800
|
var __classPrivateFieldSet$k = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
762
801
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
763
802
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -770,50 +809,7 @@ var __classPrivateFieldGet$l = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
770
809
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
771
810
|
};
|
|
772
811
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
773
|
-
const defaultContextGroups = [
|
|
774
|
-
{
|
|
775
|
-
id: 'green',
|
|
776
|
-
displayMetadata: {
|
|
777
|
-
color: '#00CC88',
|
|
778
|
-
name: 'green'
|
|
779
|
-
}
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
id: 'purple',
|
|
783
|
-
displayMetadata: {
|
|
784
|
-
color: '#8C61FF',
|
|
785
|
-
name: 'purple'
|
|
786
|
-
}
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
id: 'orange',
|
|
790
|
-
displayMetadata: {
|
|
791
|
-
color: '#FF8C4C',
|
|
792
|
-
name: 'orange'
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
|
-
{
|
|
796
|
-
id: 'red',
|
|
797
|
-
displayMetadata: {
|
|
798
|
-
color: '#FF5E60',
|
|
799
|
-
name: 'red'
|
|
800
|
-
}
|
|
801
|
-
},
|
|
802
|
-
{
|
|
803
|
-
id: 'pink',
|
|
804
|
-
displayMetadata: {
|
|
805
|
-
color: '#FF8FB8',
|
|
806
|
-
name: 'pink'
|
|
807
|
-
}
|
|
808
|
-
},
|
|
809
|
-
{
|
|
810
|
-
id: 'yellow',
|
|
811
|
-
displayMetadata: {
|
|
812
|
-
color: '#E9FF8F',
|
|
813
|
-
name: 'yellow'
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
];
|
|
812
|
+
const defaultContextGroups = Object.entries(defaultColorChannels).map(([id, displayMetadata]) => ({ id, displayMetadata }));
|
|
817
813
|
/**
|
|
818
814
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
819
815
|
*
|
|
@@ -843,17 +839,19 @@ const defaultContextGroups = [
|
|
|
843
839
|
* "interopBrokerConfiguration": {
|
|
844
840
|
* "contextGroups": [
|
|
845
841
|
* {
|
|
846
|
-
* "id": "
|
|
842
|
+
* "id": "fdc3.channel.4",
|
|
847
843
|
* "displayMetadata": {
|
|
848
|
-
* "color": "
|
|
849
|
-
* "name": "
|
|
844
|
+
* "color": "green",
|
|
845
|
+
* "name": "Channel 4",
|
|
846
|
+
* "glyph": "4"
|
|
850
847
|
* }
|
|
851
848
|
* },
|
|
852
849
|
* {
|
|
853
|
-
* "id": "
|
|
850
|
+
* "id": "fdc3.channel.8",
|
|
854
851
|
* "displayMetadata": {
|
|
855
|
-
* "color": "
|
|
856
|
-
* "name": "
|
|
852
|
+
* "color": "purple",
|
|
853
|
+
* "name": "Channel 8",
|
|
854
|
+
* "glyph": "8"
|
|
857
855
|
* }
|
|
858
856
|
* },
|
|
859
857
|
* ]
|
|
@@ -1016,9 +1014,13 @@ class InteropBroker extends Base {
|
|
|
1016
1014
|
this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
|
|
1017
1015
|
// don't expose, analytics-only call
|
|
1018
1016
|
});
|
|
1019
|
-
const
|
|
1017
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
1018
|
+
if (normalizedContextGroupId === undefined) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
const contextGroupState = this.contextGroupsById.get(normalizedContextGroupId);
|
|
1020
1022
|
if (!contextGroupState) {
|
|
1021
|
-
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${
|
|
1023
|
+
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${normalizedContextGroupId}.`);
|
|
1022
1024
|
}
|
|
1023
1025
|
const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
|
|
1024
1026
|
if (contextIntegrityCheckResult.isValid === false) {
|
|
@@ -1026,8 +1028,8 @@ class InteropBroker extends Base {
|
|
|
1026
1028
|
}
|
|
1027
1029
|
const broadcastedContextType = context.type;
|
|
1028
1030
|
contextGroupState.set(broadcastedContextType, context);
|
|
1029
|
-
this.lastContextMap.set(
|
|
1030
|
-
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId ===
|
|
1031
|
+
this.lastContextMap.set(normalizedContextGroupId, broadcastedContextType);
|
|
1032
|
+
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId);
|
|
1031
1033
|
clientsInSameContextGroup.forEach((client) => {
|
|
1032
1034
|
for (const [, handlerInfo] of client.contextHandlers) {
|
|
1033
1035
|
if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
|
|
@@ -1073,10 +1075,20 @@ class InteropBroker extends Base {
|
|
|
1073
1075
|
* @param joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
|
|
1074
1076
|
* @param senderIdentity - Identity of the client sender.
|
|
1075
1077
|
*/
|
|
1076
|
-
async joinContextGroup({ contextGroupId, target }, senderIdentity) {
|
|
1078
|
+
async joinContextGroup({ contextGroupId: requestedContextGroupId, target }, senderIdentity) {
|
|
1077
1079
|
this.wire.sendAction('interop-broker-join-context-group').catch((e) => {
|
|
1078
1080
|
// don't expose, analytics-only call
|
|
1079
1081
|
});
|
|
1082
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
1083
|
+
if (contextGroupId === undefined) {
|
|
1084
|
+
if (target) {
|
|
1085
|
+
await this.removeFromContextGroup({ target }, senderIdentity);
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
await this.removeClientFromContextGroup(senderIdentity);
|
|
1089
|
+
}
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1080
1092
|
if (this.sessionContextGroupMap.has(contextGroupId)) {
|
|
1081
1093
|
throw new Error(BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup);
|
|
1082
1094
|
}
|
|
@@ -1118,10 +1130,15 @@ class InteropBroker extends Base {
|
|
|
1118
1130
|
* @param addClientToContextGroupOptions - Contains the contextGroupId
|
|
1119
1131
|
* @param clientIdentity - Identity of the client sender.
|
|
1120
1132
|
*/
|
|
1121
|
-
async addClientToContextGroup({ contextGroupId }, clientIdentity) {
|
|
1133
|
+
async addClientToContextGroup({ contextGroupId: requestedContextGroupId }, clientIdentity) {
|
|
1122
1134
|
this.wire.sendAction('interop-broker-add-client-to-context-group').catch((e) => {
|
|
1123
1135
|
// don't expose, analytics-only call
|
|
1124
1136
|
});
|
|
1137
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
1138
|
+
if (contextGroupId === undefined) {
|
|
1139
|
+
await this.removeClientFromContextGroup(clientIdentity);
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1125
1142
|
const clientSubscriptionState = this.getClientState(clientIdentity);
|
|
1126
1143
|
if (!clientSubscriptionState) {
|
|
1127
1144
|
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
|
|
@@ -1220,6 +1237,9 @@ class InteropBroker extends Base {
|
|
|
1220
1237
|
clientState.contextGroupId = undefined;
|
|
1221
1238
|
}
|
|
1222
1239
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
|
|
1240
|
+
if (previousContextGroupId === undefined) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1223
1243
|
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
1224
1244
|
// result in the operation hanging.
|
|
1225
1245
|
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
@@ -1257,7 +1277,11 @@ class InteropBroker extends Base {
|
|
|
1257
1277
|
this.wire.sendAction('interop-broker-get-info-for-context-group').catch((e) => {
|
|
1258
1278
|
// don't expose, analytics-only call
|
|
1259
1279
|
});
|
|
1260
|
-
|
|
1280
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
1281
|
+
if (normalizedContextGroupId === undefined) {
|
|
1282
|
+
return undefined;
|
|
1283
|
+
}
|
|
1284
|
+
return this.getContextGroups().find((contextGroup) => contextGroup.id === normalizedContextGroupId);
|
|
1261
1285
|
}
|
|
1262
1286
|
// Used by platform windows to get all clients for a context group.
|
|
1263
1287
|
/**
|
|
@@ -1273,8 +1297,12 @@ class InteropBroker extends Base {
|
|
|
1273
1297
|
this.wire.sendAction('interop-broker-get-all-clients-in-context-group').catch((e) => {
|
|
1274
1298
|
// don't expose, analytics-only call
|
|
1275
1299
|
});
|
|
1300
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
1301
|
+
if (normalizedContextGroupId === undefined) {
|
|
1302
|
+
return [];
|
|
1303
|
+
}
|
|
1276
1304
|
const clientsInContextGroup = Array.from(this.interopClients.values())
|
|
1277
|
-
.filter((connectedClient) => connectedClient.contextGroupId ===
|
|
1305
|
+
.filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId)
|
|
1278
1306
|
.map((subscriptionState) => {
|
|
1279
1307
|
return subscriptionState.clientIdentity;
|
|
1280
1308
|
});
|
|
@@ -1721,8 +1749,9 @@ class InteropBroker extends Base {
|
|
|
1721
1749
|
}
|
|
1722
1750
|
// Used to restore interop broker state in snapshots.
|
|
1723
1751
|
applySnapshot(snapshot, options) {
|
|
1724
|
-
const
|
|
1725
|
-
if (
|
|
1752
|
+
const incomingContextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
|
|
1753
|
+
if (incomingContextGroupStates) {
|
|
1754
|
+
const contextGroupStates = this.normalizeContextGroupStates(incomingContextGroupStates);
|
|
1726
1755
|
if (!options?.closeExistingWindows) {
|
|
1727
1756
|
this.updateExistingClients(contextGroupStates);
|
|
1728
1757
|
}
|
|
@@ -1867,6 +1896,23 @@ class InteropBroker extends Base {
|
|
|
1867
1896
|
});
|
|
1868
1897
|
return newObject;
|
|
1869
1898
|
}
|
|
1899
|
+
normalizeContextGroupStates(incomingContextGroupStates) {
|
|
1900
|
+
const normalizedContextGroupStates = {};
|
|
1901
|
+
for (const [contextGroupId, contexts] of Object.entries(incomingContextGroupStates)) {
|
|
1902
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
1903
|
+
if (normalizedContextGroupId !== undefined) {
|
|
1904
|
+
normalizedContextGroupStates[normalizedContextGroupId] = {
|
|
1905
|
+
...normalizedContextGroupStates[normalizedContextGroupId],
|
|
1906
|
+
...contexts
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
return normalizedContextGroupStates;
|
|
1911
|
+
}
|
|
1912
|
+
normalizeContextGroupId(contextGroupId) {
|
|
1913
|
+
const usesDefaultColorChannels = Object.keys(defaultColorChannels).every((defaultContextGroupId) => this.contextGroupsById.has(defaultContextGroupId));
|
|
1914
|
+
return usesDefaultColorChannels ? normalizeColorChannelId(contextGroupId) : contextGroupId;
|
|
1915
|
+
}
|
|
1870
1916
|
// Util to check a client identity.
|
|
1871
1917
|
static hasEndpointId(target) {
|
|
1872
1918
|
return target.endpointId !== undefined;
|
|
@@ -1930,8 +1976,14 @@ class InteropBroker extends Base {
|
|
|
1930
1976
|
clientIdentity
|
|
1931
1977
|
};
|
|
1932
1978
|
// Only allow the client to join a contextGroup that actually exists.
|
|
1933
|
-
|
|
1934
|
-
|
|
1979
|
+
const currentContextGroup = payload?.currentContextGroup
|
|
1980
|
+
? this.normalizeContextGroupId(payload.currentContextGroup)
|
|
1981
|
+
: undefined;
|
|
1982
|
+
if (currentContextGroup && this.contextGroupsById.has(currentContextGroup)) {
|
|
1983
|
+
clientSubscriptionState.contextGroupId = currentContextGroup;
|
|
1984
|
+
if (currentContextGroup !== payload.currentContextGroup) {
|
|
1985
|
+
await this.setCurrentContextGroupInClientOptions(clientIdentity, currentContextGroup);
|
|
1986
|
+
}
|
|
1935
1987
|
}
|
|
1936
1988
|
this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
1937
1989
|
});
|
|
@@ -15149,7 +15201,7 @@ class InteropClient extends Base {
|
|
|
15149
15201
|
*
|
|
15150
15202
|
* getLastFocusedView()
|
|
15151
15203
|
* .then(lastFocusedViewIdentity => {
|
|
15152
|
-
* joinViewToContextGroup('
|
|
15204
|
+
* joinViewToContextGroup('fdc3.channel.1', lastFocusedViewIdentity)
|
|
15153
15205
|
* })
|
|
15154
15206
|
* ```
|
|
15155
15207
|
*/
|
|
@@ -15199,7 +15251,7 @@ class InteropClient extends Base {
|
|
|
15199
15251
|
*
|
|
15200
15252
|
* @example
|
|
15201
15253
|
* ```js
|
|
15202
|
-
* fin.me.interop.getAllClientsInContextGroup('
|
|
15254
|
+
* fin.me.interop.getAllClientsInContextGroup('fdc3.channel.1')
|
|
15203
15255
|
* .then(clientsInContextGroup => {
|
|
15204
15256
|
* console.log(clientsInContextGroup)
|
|
15205
15257
|
* })
|
|
@@ -15223,7 +15275,7 @@ class InteropClient extends Base {
|
|
|
15223
15275
|
*
|
|
15224
15276
|
* @example
|
|
15225
15277
|
* ```js
|
|
15226
|
-
* fin.me.interop.getInfoForContextGroup('
|
|
15278
|
+
* fin.me.interop.getInfoForContextGroup('fdc3.channel.1')
|
|
15227
15279
|
* .then(contextGroupInfo => {
|
|
15228
15280
|
* console.log(contextGroupInfo.displayMetadata.name)
|
|
15229
15281
|
* console.log(contextGroupInfo.displayMetadata.color)
|
|
@@ -15312,12 +15364,12 @@ class InteropClient extends Base {
|
|
|
15312
15364
|
*
|
|
15313
15365
|
* @example
|
|
15314
15366
|
* ```js
|
|
15315
|
-
* await fin.me.interop.joinContextGroup('
|
|
15367
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
15316
15368
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
15317
15369
|
* const currentContext = await fin.me.interop.getCurrentContext();
|
|
15318
15370
|
*
|
|
15319
15371
|
* // with a specific context
|
|
15320
|
-
* await fin.me.interop.joinContextGroup('
|
|
15372
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
15321
15373
|
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
|
15322
15374
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
15323
15375
|
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
|
@@ -15954,15 +16006,18 @@ class FDC3ModuleBase {
|
|
|
15954
16006
|
async joinChannel(channelId) {
|
|
15955
16007
|
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15956
16008
|
try {
|
|
16009
|
+
const contextGroup = await this.client.getInfoForContextGroup(channelId);
|
|
16010
|
+
if (!contextGroup) {
|
|
16011
|
+
console.error(`No User Channel was found with the ID "${channelId}". If this is an App Channel, use getOrCreateChannel instead.`);
|
|
16012
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
16013
|
+
}
|
|
15957
16014
|
return await this.client.joinContextGroup(channelId);
|
|
15958
16015
|
}
|
|
15959
16016
|
catch (error) {
|
|
15960
|
-
if (error.message ===
|
|
15961
|
-
|
|
15962
|
-
}
|
|
15963
|
-
else {
|
|
15964
|
-
console.error(error.message);
|
|
16017
|
+
if (error.message === ChannelError.NoChannelFound) {
|
|
16018
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15965
16019
|
}
|
|
16020
|
+
console.error(error.message);
|
|
15966
16021
|
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
15967
16022
|
throw new Error(ChannelError.NoChannelFound);
|
|
15968
16023
|
}
|
|
@@ -16642,7 +16697,7 @@ class InteropModule extends Base {
|
|
|
16642
16697
|
* @example
|
|
16643
16698
|
* ```js
|
|
16644
16699
|
* const interopConfig = {
|
|
16645
|
-
* currentContextGroup: '
|
|
16700
|
+
* currentContextGroup: 'fdc3.channel.4'
|
|
16646
16701
|
* }
|
|
16647
16702
|
*
|
|
16648
16703
|
* const interopBroker = await fin.Interop.init('openfin');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/remote-adapter",
|
|
3
|
-
"version": "46.100.
|
|
3
|
+
"version": "46.100.66",
|
|
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": "46.100.
|
|
19
|
+
"@openfin/core": "46.100.66"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"prebuild": "rimraf ./out",
|