@openfin/core 46.100.65 → 46.100.67
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/mock-alpha.d.ts +142 -29
- package/out/mock-beta.d.ts +142 -29
- package/out/mock-public.d.ts +142 -29
- package/out/stub.d.ts +142 -29
- package/out/stub.js +130 -73
- package/out/stub.mjs +129 -74
- package/package.json +1 -1
package/out/stub.js
CHANGED
|
@@ -13084,6 +13084,45 @@ class PrivateChannelProvider {
|
|
|
13084
13084
|
}
|
|
13085
13085
|
}
|
|
13086
13086
|
|
|
13087
|
+
/**
|
|
13088
|
+
* The default FDC3 user channels advertised by the Interop Broker.
|
|
13089
|
+
*/
|
|
13090
|
+
const defaultColorChannels = {
|
|
13091
|
+
'fdc3.channel.1': { name: 'Channel 1', color: 'red', glyph: '1' },
|
|
13092
|
+
'fdc3.channel.2': { name: 'Channel 2', color: 'orange', glyph: '2' },
|
|
13093
|
+
'fdc3.channel.3': { name: 'Channel 3', color: 'yellow', glyph: '3' },
|
|
13094
|
+
'fdc3.channel.4': { name: 'Channel 4', color: 'green', glyph: '4' },
|
|
13095
|
+
'fdc3.channel.5': { name: 'Channel 5', color: 'cyan', glyph: '5' },
|
|
13096
|
+
'fdc3.channel.6': { name: 'Channel 6', color: 'blue', glyph: '6' },
|
|
13097
|
+
'fdc3.channel.7': { name: 'Channel 7', color: 'magenta', glyph: '7' },
|
|
13098
|
+
'fdc3.channel.8': { name: 'Channel 8', color: 'purple', glyph: '8' }
|
|
13099
|
+
};
|
|
13100
|
+
const legacyColorChannelIds = {
|
|
13101
|
+
red: 'fdc3.channel.1',
|
|
13102
|
+
orange: 'fdc3.channel.2',
|
|
13103
|
+
yellow: 'fdc3.channel.3',
|
|
13104
|
+
green: 'fdc3.channel.4',
|
|
13105
|
+
teal: 'fdc3.channel.5',
|
|
13106
|
+
blue: 'fdc3.channel.6',
|
|
13107
|
+
pink: 'fdc3.channel.7',
|
|
13108
|
+
// Legacy indigo (workspace) and purple (core) intentionally converge on the same FDC3 purple channel.
|
|
13109
|
+
indigo: 'fdc3.channel.8',
|
|
13110
|
+
purple: 'fdc3.channel.8'
|
|
13111
|
+
};
|
|
13112
|
+
/**
|
|
13113
|
+
* Converts a legacy color-named channel ID to its canonical FDC3 user-channel ID.
|
|
13114
|
+
* The removed legacy gray channel resolves to no channel.
|
|
13115
|
+
*/
|
|
13116
|
+
function normalizeColorChannelId(colorChannelId) {
|
|
13117
|
+
if (colorChannelId === 'gray') {
|
|
13118
|
+
return undefined;
|
|
13119
|
+
}
|
|
13120
|
+
if (Object.prototype.hasOwnProperty.call(legacyColorChannelIds, colorChannelId)) {
|
|
13121
|
+
return legacyColorChannelIds[colorChannelId];
|
|
13122
|
+
}
|
|
13123
|
+
return colorChannelId;
|
|
13124
|
+
}
|
|
13125
|
+
|
|
13087
13126
|
var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13088
13127
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13089
13128
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13096,50 +13135,7 @@ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
13096
13135
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13097
13136
|
};
|
|
13098
13137
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
13099
|
-
const defaultContextGroups = [
|
|
13100
|
-
{
|
|
13101
|
-
id: 'green',
|
|
13102
|
-
displayMetadata: {
|
|
13103
|
-
color: '#00CC88',
|
|
13104
|
-
name: 'green'
|
|
13105
|
-
}
|
|
13106
|
-
},
|
|
13107
|
-
{
|
|
13108
|
-
id: 'purple',
|
|
13109
|
-
displayMetadata: {
|
|
13110
|
-
color: '#8C61FF',
|
|
13111
|
-
name: 'purple'
|
|
13112
|
-
}
|
|
13113
|
-
},
|
|
13114
|
-
{
|
|
13115
|
-
id: 'orange',
|
|
13116
|
-
displayMetadata: {
|
|
13117
|
-
color: '#FF8C4C',
|
|
13118
|
-
name: 'orange'
|
|
13119
|
-
}
|
|
13120
|
-
},
|
|
13121
|
-
{
|
|
13122
|
-
id: 'red',
|
|
13123
|
-
displayMetadata: {
|
|
13124
|
-
color: '#FF5E60',
|
|
13125
|
-
name: 'red'
|
|
13126
|
-
}
|
|
13127
|
-
},
|
|
13128
|
-
{
|
|
13129
|
-
id: 'pink',
|
|
13130
|
-
displayMetadata: {
|
|
13131
|
-
color: '#FF8FB8',
|
|
13132
|
-
name: 'pink'
|
|
13133
|
-
}
|
|
13134
|
-
},
|
|
13135
|
-
{
|
|
13136
|
-
id: 'yellow',
|
|
13137
|
-
displayMetadata: {
|
|
13138
|
-
color: '#E9FF8F',
|
|
13139
|
-
name: 'yellow'
|
|
13140
|
-
}
|
|
13141
|
-
}
|
|
13142
|
-
];
|
|
13138
|
+
const defaultContextGroups = Object.entries(defaultColorChannels).map(([id, displayMetadata]) => ({ id, displayMetadata }));
|
|
13143
13139
|
/**
|
|
13144
13140
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
13145
13141
|
*
|
|
@@ -13169,17 +13165,19 @@ const defaultContextGroups = [
|
|
|
13169
13165
|
* "interopBrokerConfiguration": {
|
|
13170
13166
|
* "contextGroups": [
|
|
13171
13167
|
* {
|
|
13172
|
-
* "id": "
|
|
13168
|
+
* "id": "fdc3.channel.4",
|
|
13173
13169
|
* "displayMetadata": {
|
|
13174
|
-
* "color": "
|
|
13175
|
-
* "name": "
|
|
13170
|
+
* "color": "green",
|
|
13171
|
+
* "name": "Channel 4",
|
|
13172
|
+
* "glyph": "4"
|
|
13176
13173
|
* }
|
|
13177
13174
|
* },
|
|
13178
13175
|
* {
|
|
13179
|
-
* "id": "
|
|
13176
|
+
* "id": "fdc3.channel.8",
|
|
13180
13177
|
* "displayMetadata": {
|
|
13181
|
-
* "color": "
|
|
13182
|
-
* "name": "
|
|
13178
|
+
* "color": "purple",
|
|
13179
|
+
* "name": "Channel 8",
|
|
13180
|
+
* "glyph": "8"
|
|
13183
13181
|
* }
|
|
13184
13182
|
* },
|
|
13185
13183
|
* ]
|
|
@@ -13342,9 +13340,13 @@ class InteropBroker extends Base {
|
|
|
13342
13340
|
this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
|
|
13343
13341
|
// don't expose, analytics-only call
|
|
13344
13342
|
});
|
|
13345
|
-
const
|
|
13343
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13344
|
+
if (normalizedContextGroupId === undefined) {
|
|
13345
|
+
return;
|
|
13346
|
+
}
|
|
13347
|
+
const contextGroupState = this.contextGroupsById.get(normalizedContextGroupId);
|
|
13346
13348
|
if (!contextGroupState) {
|
|
13347
|
-
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${
|
|
13349
|
+
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${normalizedContextGroupId}.`);
|
|
13348
13350
|
}
|
|
13349
13351
|
const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
|
|
13350
13352
|
if (contextIntegrityCheckResult.isValid === false) {
|
|
@@ -13352,8 +13354,8 @@ class InteropBroker extends Base {
|
|
|
13352
13354
|
}
|
|
13353
13355
|
const broadcastedContextType = context.type;
|
|
13354
13356
|
contextGroupState.set(broadcastedContextType, context);
|
|
13355
|
-
this.lastContextMap.set(
|
|
13356
|
-
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId ===
|
|
13357
|
+
this.lastContextMap.set(normalizedContextGroupId, broadcastedContextType);
|
|
13358
|
+
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId);
|
|
13357
13359
|
clientsInSameContextGroup.forEach((client) => {
|
|
13358
13360
|
for (const [, handlerInfo] of client.contextHandlers) {
|
|
13359
13361
|
if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
|
|
@@ -13399,10 +13401,20 @@ class InteropBroker extends Base {
|
|
|
13399
13401
|
* @param joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
|
|
13400
13402
|
* @param senderIdentity - Identity of the client sender.
|
|
13401
13403
|
*/
|
|
13402
|
-
async joinContextGroup({ contextGroupId, target }, senderIdentity) {
|
|
13404
|
+
async joinContextGroup({ contextGroupId: requestedContextGroupId, target }, senderIdentity) {
|
|
13403
13405
|
this.wire.sendAction('interop-broker-join-context-group').catch((e) => {
|
|
13404
13406
|
// don't expose, analytics-only call
|
|
13405
13407
|
});
|
|
13408
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
13409
|
+
if (contextGroupId === undefined) {
|
|
13410
|
+
if (target) {
|
|
13411
|
+
await this.removeFromContextGroup({ target }, senderIdentity);
|
|
13412
|
+
}
|
|
13413
|
+
else {
|
|
13414
|
+
await this.removeClientFromContextGroup(senderIdentity);
|
|
13415
|
+
}
|
|
13416
|
+
return;
|
|
13417
|
+
}
|
|
13406
13418
|
if (this.sessionContextGroupMap.has(contextGroupId)) {
|
|
13407
13419
|
throw new Error(BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup);
|
|
13408
13420
|
}
|
|
@@ -13444,10 +13456,15 @@ class InteropBroker extends Base {
|
|
|
13444
13456
|
* @param addClientToContextGroupOptions - Contains the contextGroupId
|
|
13445
13457
|
* @param clientIdentity - Identity of the client sender.
|
|
13446
13458
|
*/
|
|
13447
|
-
async addClientToContextGroup({ contextGroupId }, clientIdentity) {
|
|
13459
|
+
async addClientToContextGroup({ contextGroupId: requestedContextGroupId }, clientIdentity) {
|
|
13448
13460
|
this.wire.sendAction('interop-broker-add-client-to-context-group').catch((e) => {
|
|
13449
13461
|
// don't expose, analytics-only call
|
|
13450
13462
|
});
|
|
13463
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
13464
|
+
if (contextGroupId === undefined) {
|
|
13465
|
+
await this.removeClientFromContextGroup(clientIdentity);
|
|
13466
|
+
return;
|
|
13467
|
+
}
|
|
13451
13468
|
const clientSubscriptionState = this.getClientState(clientIdentity);
|
|
13452
13469
|
if (!clientSubscriptionState) {
|
|
13453
13470
|
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
|
|
@@ -13546,6 +13563,9 @@ class InteropBroker extends Base {
|
|
|
13546
13563
|
clientState.contextGroupId = undefined;
|
|
13547
13564
|
}
|
|
13548
13565
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
|
|
13566
|
+
if (previousContextGroupId === undefined) {
|
|
13567
|
+
return;
|
|
13568
|
+
}
|
|
13549
13569
|
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
13550
13570
|
// result in the operation hanging.
|
|
13551
13571
|
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
@@ -13583,7 +13603,11 @@ class InteropBroker extends Base {
|
|
|
13583
13603
|
this.wire.sendAction('interop-broker-get-info-for-context-group').catch((e) => {
|
|
13584
13604
|
// don't expose, analytics-only call
|
|
13585
13605
|
});
|
|
13586
|
-
|
|
13606
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13607
|
+
if (normalizedContextGroupId === undefined) {
|
|
13608
|
+
return undefined;
|
|
13609
|
+
}
|
|
13610
|
+
return this.getContextGroups().find((contextGroup) => contextGroup.id === normalizedContextGroupId);
|
|
13587
13611
|
}
|
|
13588
13612
|
// Used by platform windows to get all clients for a context group.
|
|
13589
13613
|
/**
|
|
@@ -13599,8 +13623,12 @@ class InteropBroker extends Base {
|
|
|
13599
13623
|
this.wire.sendAction('interop-broker-get-all-clients-in-context-group').catch((e) => {
|
|
13600
13624
|
// don't expose, analytics-only call
|
|
13601
13625
|
});
|
|
13626
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13627
|
+
if (normalizedContextGroupId === undefined) {
|
|
13628
|
+
return [];
|
|
13629
|
+
}
|
|
13602
13630
|
const clientsInContextGroup = Array.from(this.interopClients.values())
|
|
13603
|
-
.filter((connectedClient) => connectedClient.contextGroupId ===
|
|
13631
|
+
.filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId)
|
|
13604
13632
|
.map((subscriptionState) => {
|
|
13605
13633
|
return subscriptionState.clientIdentity;
|
|
13606
13634
|
});
|
|
@@ -14047,8 +14075,9 @@ class InteropBroker extends Base {
|
|
|
14047
14075
|
}
|
|
14048
14076
|
// Used to restore interop broker state in snapshots.
|
|
14049
14077
|
applySnapshot(snapshot, options) {
|
|
14050
|
-
const
|
|
14051
|
-
if (
|
|
14078
|
+
const incomingContextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
|
|
14079
|
+
if (incomingContextGroupStates) {
|
|
14080
|
+
const contextGroupStates = this.normalizeContextGroupStates(incomingContextGroupStates);
|
|
14052
14081
|
if (!options?.closeExistingWindows) {
|
|
14053
14082
|
this.updateExistingClients(contextGroupStates);
|
|
14054
14083
|
}
|
|
@@ -14193,6 +14222,23 @@ class InteropBroker extends Base {
|
|
|
14193
14222
|
});
|
|
14194
14223
|
return newObject;
|
|
14195
14224
|
}
|
|
14225
|
+
normalizeContextGroupStates(incomingContextGroupStates) {
|
|
14226
|
+
const normalizedContextGroupStates = {};
|
|
14227
|
+
for (const [contextGroupId, contexts] of Object.entries(incomingContextGroupStates)) {
|
|
14228
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
14229
|
+
if (normalizedContextGroupId !== undefined) {
|
|
14230
|
+
normalizedContextGroupStates[normalizedContextGroupId] = {
|
|
14231
|
+
...normalizedContextGroupStates[normalizedContextGroupId],
|
|
14232
|
+
...contexts
|
|
14233
|
+
};
|
|
14234
|
+
}
|
|
14235
|
+
}
|
|
14236
|
+
return normalizedContextGroupStates;
|
|
14237
|
+
}
|
|
14238
|
+
normalizeContextGroupId(contextGroupId) {
|
|
14239
|
+
const usesDefaultColorChannels = Object.keys(defaultColorChannels).every((defaultContextGroupId) => this.contextGroupsById.has(defaultContextGroupId));
|
|
14240
|
+
return usesDefaultColorChannels ? normalizeColorChannelId(contextGroupId) : contextGroupId;
|
|
14241
|
+
}
|
|
14196
14242
|
// Util to check a client identity.
|
|
14197
14243
|
static hasEndpointId(target) {
|
|
14198
14244
|
return target.endpointId !== undefined;
|
|
@@ -14256,8 +14302,14 @@ class InteropBroker extends Base {
|
|
|
14256
14302
|
clientIdentity
|
|
14257
14303
|
};
|
|
14258
14304
|
// Only allow the client to join a contextGroup that actually exists.
|
|
14259
|
-
|
|
14260
|
-
|
|
14305
|
+
const currentContextGroup = payload?.currentContextGroup
|
|
14306
|
+
? this.normalizeContextGroupId(payload.currentContextGroup)
|
|
14307
|
+
: undefined;
|
|
14308
|
+
if (currentContextGroup && this.contextGroupsById.has(currentContextGroup)) {
|
|
14309
|
+
clientSubscriptionState.contextGroupId = currentContextGroup;
|
|
14310
|
+
if (currentContextGroup !== payload.currentContextGroup) {
|
|
14311
|
+
await this.setCurrentContextGroupInClientOptions(clientIdentity, currentContextGroup);
|
|
14312
|
+
}
|
|
14261
14313
|
}
|
|
14262
14314
|
this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
14263
14315
|
});
|
|
@@ -14827,7 +14879,7 @@ class InteropClient extends Base {
|
|
|
14827
14879
|
*
|
|
14828
14880
|
* getLastFocusedView()
|
|
14829
14881
|
* .then(lastFocusedViewIdentity => {
|
|
14830
|
-
* joinViewToContextGroup('
|
|
14882
|
+
* joinViewToContextGroup('fdc3.channel.1', lastFocusedViewIdentity)
|
|
14831
14883
|
* })
|
|
14832
14884
|
* ```
|
|
14833
14885
|
*/
|
|
@@ -14877,7 +14929,7 @@ class InteropClient extends Base {
|
|
|
14877
14929
|
*
|
|
14878
14930
|
* @example
|
|
14879
14931
|
* ```js
|
|
14880
|
-
* fin.me.interop.getAllClientsInContextGroup('
|
|
14932
|
+
* fin.me.interop.getAllClientsInContextGroup('fdc3.channel.1')
|
|
14881
14933
|
* .then(clientsInContextGroup => {
|
|
14882
14934
|
* console.log(clientsInContextGroup)
|
|
14883
14935
|
* })
|
|
@@ -14901,7 +14953,7 @@ class InteropClient extends Base {
|
|
|
14901
14953
|
*
|
|
14902
14954
|
* @example
|
|
14903
14955
|
* ```js
|
|
14904
|
-
* fin.me.interop.getInfoForContextGroup('
|
|
14956
|
+
* fin.me.interop.getInfoForContextGroup('fdc3.channel.1')
|
|
14905
14957
|
* .then(contextGroupInfo => {
|
|
14906
14958
|
* console.log(contextGroupInfo.displayMetadata.name)
|
|
14907
14959
|
* console.log(contextGroupInfo.displayMetadata.color)
|
|
@@ -14990,12 +15042,12 @@ class InteropClient extends Base {
|
|
|
14990
15042
|
*
|
|
14991
15043
|
* @example
|
|
14992
15044
|
* ```js
|
|
14993
|
-
* await fin.me.interop.joinContextGroup('
|
|
15045
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14994
15046
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
14995
15047
|
* const currentContext = await fin.me.interop.getCurrentContext();
|
|
14996
15048
|
*
|
|
14997
15049
|
* // with a specific context
|
|
14998
|
-
* await fin.me.interop.joinContextGroup('
|
|
15050
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14999
15051
|
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
|
15000
15052
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
15001
15053
|
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
|
@@ -15657,15 +15709,18 @@ class FDC3ModuleBase {
|
|
|
15657
15709
|
async joinChannel(channelId) {
|
|
15658
15710
|
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15659
15711
|
try {
|
|
15712
|
+
const contextGroup = await this.client.getInfoForContextGroup(channelId);
|
|
15713
|
+
if (!contextGroup) {
|
|
15714
|
+
console.error(`No User Channel was found with the ID "${channelId}". If this is an App Channel, use getOrCreateChannel instead.`);
|
|
15715
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15716
|
+
}
|
|
15660
15717
|
return await this.client.joinContextGroup(channelId);
|
|
15661
15718
|
}
|
|
15662
15719
|
catch (error) {
|
|
15663
|
-
if (error.message ===
|
|
15664
|
-
|
|
15665
|
-
}
|
|
15666
|
-
else {
|
|
15667
|
-
console.error(error.message);
|
|
15720
|
+
if (error.message === ChannelError.NoChannelFound) {
|
|
15721
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15668
15722
|
}
|
|
15723
|
+
console.error(error.message);
|
|
15669
15724
|
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
15670
15725
|
throw new Error(ChannelError.NoChannelFound);
|
|
15671
15726
|
}
|
|
@@ -16345,7 +16400,7 @@ class InteropModule extends Base {
|
|
|
16345
16400
|
* @example
|
|
16346
16401
|
* ```js
|
|
16347
16402
|
* const interopConfig = {
|
|
16348
|
-
* currentContextGroup: '
|
|
16403
|
+
* currentContextGroup: 'fdc3.channel.4'
|
|
16349
16404
|
* }
|
|
16350
16405
|
*
|
|
16351
16406
|
* const interopBroker = await fin.Interop.init('openfin');
|
|
@@ -17352,4 +17407,6 @@ const fin$1 = ((typeof window !== 'undefined' && window?.fin) ||
|
|
|
17352
17407
|
|
|
17353
17408
|
exports.OpenFin = OpenFin;
|
|
17354
17409
|
exports.default = OpenFin;
|
|
17410
|
+
exports.defaultColorChannels = defaultColorChannels;
|
|
17355
17411
|
exports.fin = fin$1;
|
|
17412
|
+
exports.normalizeColorChannelId = normalizeColorChannelId;
|