@openfin/core 46.100.64 → 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/mock-alpha.d.ts +152 -16
- package/out/mock-beta.d.ts +152 -16
- package/out/mock-public.d.ts +152 -16
- package/out/stub.d.ts +152 -16
- package/out/stub.js +192 -99
- package/out/stub.mjs +191 -100
- package/package.json +1 -1
package/out/stub.mjs
CHANGED
|
@@ -465,6 +465,26 @@ class EmitterBase extends Base {
|
|
|
465
465
|
}
|
|
466
466
|
_EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
|
|
467
467
|
|
|
468
|
+
const V8Error = Error;
|
|
469
|
+
function isCallSiteArray(stack) {
|
|
470
|
+
if (!Array.isArray(stack) || stack.length === 0) {
|
|
471
|
+
return Array.isArray(stack);
|
|
472
|
+
}
|
|
473
|
+
const first = stack[0];
|
|
474
|
+
return typeof first === 'object' && first !== null && typeof first.getFileName === 'function';
|
|
475
|
+
}
|
|
476
|
+
function isStackFrameLine(line) {
|
|
477
|
+
return /^\s*at\s/.test(line) || line.includes('@');
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Split a native `error.stack` string into frames and drop the dummy Error header plus `framesToRemove` frames.
|
|
481
|
+
* Safari/Firefox ignore V8's Error.prepareStackTrace, so `.stack` stays a string and `.slice(n)` would cut characters.
|
|
482
|
+
*/
|
|
483
|
+
function stackStringToFrames(stack, framesToRemove) {
|
|
484
|
+
const lines = stack.split('\n').filter((line) => line.length > 0);
|
|
485
|
+
const start = lines[0] !== undefined && !isStackFrameLine(lines[0]) ? 1 : 0;
|
|
486
|
+
return lines.slice(start + framesToRemove);
|
|
487
|
+
}
|
|
468
488
|
class UnexpectedActionError extends Error {
|
|
469
489
|
}
|
|
470
490
|
class DuplicateCorrelationError extends Error {
|
|
@@ -493,17 +513,17 @@ class DeserializedError extends Error {
|
|
|
493
513
|
class RuntimeError extends Error {
|
|
494
514
|
static trimEndCallSites(err, takeUntilRegex) {
|
|
495
515
|
// save original props
|
|
496
|
-
const length =
|
|
516
|
+
const length = V8Error.stackTraceLimit;
|
|
497
517
|
// eslint-disable-next-line no-underscore-dangle
|
|
498
|
-
const _prepareStackTrace =
|
|
518
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
499
519
|
// This will be called when we access the `stack` property
|
|
500
|
-
|
|
520
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
501
521
|
// in channel errors, the error was already serialized so we need to handle both string and CallSite[]
|
|
502
522
|
const isString = typeof err.stack === 'string';
|
|
503
523
|
const stack = (isString ? err.stack?.split('\n') : err.stack) ?? [];
|
|
504
524
|
// restore original props
|
|
505
|
-
|
|
506
|
-
|
|
525
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
526
|
+
V8Error.stackTraceLimit = length;
|
|
507
527
|
// stack is optional in non chromium contexts
|
|
508
528
|
if (stack.length) {
|
|
509
529
|
const newStack = [];
|
|
@@ -525,31 +545,47 @@ class RuntimeError extends Error {
|
|
|
525
545
|
}
|
|
526
546
|
}
|
|
527
547
|
static getCallSite(callsToRemove = 0) {
|
|
528
|
-
const length =
|
|
548
|
+
const length = V8Error.stackTraceLimit;
|
|
529
549
|
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
530
|
-
|
|
550
|
+
const limit = typeof length === 'number' && Number.isFinite(length) ? length : 10;
|
|
531
551
|
// eslint-disable-next-line no-underscore-dangle
|
|
532
|
-
const _prepareStackTrace =
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
552
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
553
|
+
try {
|
|
554
|
+
V8Error.stackTraceLimit = limit + realCallsToRemove;
|
|
555
|
+
// V8 only: accessing `.stack` invokes this and returns CallSite[]. Safari/Firefox ignore it.
|
|
556
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
557
|
+
const rawStack = new Error().stack;
|
|
558
|
+
if (Array.isArray(rawStack)) {
|
|
559
|
+
return rawStack.slice(realCallsToRemove);
|
|
560
|
+
}
|
|
561
|
+
if (typeof rawStack === 'string' && rawStack.length > 0) {
|
|
562
|
+
return stackStringToFrames(rawStack, realCallsToRemove);
|
|
563
|
+
}
|
|
564
|
+
return [];
|
|
565
|
+
}
|
|
566
|
+
finally {
|
|
567
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
568
|
+
V8Error.stackTraceLimit = length;
|
|
569
|
+
}
|
|
540
570
|
}
|
|
541
571
|
static prepareStackTrace(err, callSites) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
572
|
+
const header = `${err.name || 'Error'}: ${err.message || ''}`;
|
|
573
|
+
const frames = typeof callSites === 'string' ? stackStringToFrames(callSites, 0) : callSites;
|
|
574
|
+
if (!Array.isArray(frames) || frames.length === 0) {
|
|
575
|
+
return header;
|
|
576
|
+
}
|
|
577
|
+
if (isCallSiteArray(frames)) {
|
|
578
|
+
const prepare = V8Error.prepareStackTrace;
|
|
579
|
+
// Only V8 CallSite[] may be passed to a user-supplied Error.prepareStackTrace.
|
|
580
|
+
if (typeof prepare === 'function') {
|
|
581
|
+
return prepare(err, frames);
|
|
582
|
+
}
|
|
583
|
+
// TODO: this is just a first iteration, we can make this "nicer" at some point
|
|
584
|
+
// const EXCLUSIONS = ['IpcRenderer', 'Object.onMessage', 'Transport.onmessage', 'MessageReceiver.onmessage'];
|
|
585
|
+
return `${header}\n${frames.map((line) => ` at ${line}`).join('\n')}`;
|
|
586
|
+
}
|
|
587
|
+
// Native Safari/Firefox frames already include their engine's format (`func@file:line:col`).
|
|
588
|
+
return `${header}\n${frames.join('\n')}`;
|
|
553
589
|
}
|
|
554
590
|
/*
|
|
555
591
|
|
|
@@ -13044,6 +13080,45 @@ class PrivateChannelProvider {
|
|
|
13044
13080
|
}
|
|
13045
13081
|
}
|
|
13046
13082
|
|
|
13083
|
+
/**
|
|
13084
|
+
* The default FDC3 user channels advertised by the Interop Broker.
|
|
13085
|
+
*/
|
|
13086
|
+
const defaultColorChannels = {
|
|
13087
|
+
'fdc3.channel.1': { name: 'Channel 1', color: 'red', glyph: '1' },
|
|
13088
|
+
'fdc3.channel.2': { name: 'Channel 2', color: 'orange', glyph: '2' },
|
|
13089
|
+
'fdc3.channel.3': { name: 'Channel 3', color: 'yellow', glyph: '3' },
|
|
13090
|
+
'fdc3.channel.4': { name: 'Channel 4', color: 'green', glyph: '4' },
|
|
13091
|
+
'fdc3.channel.5': { name: 'Channel 5', color: 'cyan', glyph: '5' },
|
|
13092
|
+
'fdc3.channel.6': { name: 'Channel 6', color: 'blue', glyph: '6' },
|
|
13093
|
+
'fdc3.channel.7': { name: 'Channel 7', color: 'magenta', glyph: '7' },
|
|
13094
|
+
'fdc3.channel.8': { name: 'Channel 8', color: 'purple', glyph: '8' }
|
|
13095
|
+
};
|
|
13096
|
+
const legacyColorChannelIds = {
|
|
13097
|
+
red: 'fdc3.channel.1',
|
|
13098
|
+
orange: 'fdc3.channel.2',
|
|
13099
|
+
yellow: 'fdc3.channel.3',
|
|
13100
|
+
green: 'fdc3.channel.4',
|
|
13101
|
+
teal: 'fdc3.channel.5',
|
|
13102
|
+
blue: 'fdc3.channel.6',
|
|
13103
|
+
pink: 'fdc3.channel.7',
|
|
13104
|
+
// Legacy indigo (workspace) and purple (core) intentionally converge on the same FDC3 purple channel.
|
|
13105
|
+
indigo: 'fdc3.channel.8',
|
|
13106
|
+
purple: 'fdc3.channel.8'
|
|
13107
|
+
};
|
|
13108
|
+
/**
|
|
13109
|
+
* Converts a legacy color-named channel ID to its canonical FDC3 user-channel ID.
|
|
13110
|
+
* The removed legacy gray channel resolves to no channel.
|
|
13111
|
+
*/
|
|
13112
|
+
function normalizeColorChannelId(colorChannelId) {
|
|
13113
|
+
if (colorChannelId === 'gray') {
|
|
13114
|
+
return undefined;
|
|
13115
|
+
}
|
|
13116
|
+
if (Object.prototype.hasOwnProperty.call(legacyColorChannelIds, colorChannelId)) {
|
|
13117
|
+
return legacyColorChannelIds[colorChannelId];
|
|
13118
|
+
}
|
|
13119
|
+
return colorChannelId;
|
|
13120
|
+
}
|
|
13121
|
+
|
|
13047
13122
|
var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13048
13123
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13049
13124
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13056,50 +13131,7 @@ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
13056
13131
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13057
13132
|
};
|
|
13058
13133
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
13059
|
-
const defaultContextGroups = [
|
|
13060
|
-
{
|
|
13061
|
-
id: 'green',
|
|
13062
|
-
displayMetadata: {
|
|
13063
|
-
color: '#00CC88',
|
|
13064
|
-
name: 'green'
|
|
13065
|
-
}
|
|
13066
|
-
},
|
|
13067
|
-
{
|
|
13068
|
-
id: 'purple',
|
|
13069
|
-
displayMetadata: {
|
|
13070
|
-
color: '#8C61FF',
|
|
13071
|
-
name: 'purple'
|
|
13072
|
-
}
|
|
13073
|
-
},
|
|
13074
|
-
{
|
|
13075
|
-
id: 'orange',
|
|
13076
|
-
displayMetadata: {
|
|
13077
|
-
color: '#FF8C4C',
|
|
13078
|
-
name: 'orange'
|
|
13079
|
-
}
|
|
13080
|
-
},
|
|
13081
|
-
{
|
|
13082
|
-
id: 'red',
|
|
13083
|
-
displayMetadata: {
|
|
13084
|
-
color: '#FF5E60',
|
|
13085
|
-
name: 'red'
|
|
13086
|
-
}
|
|
13087
|
-
},
|
|
13088
|
-
{
|
|
13089
|
-
id: 'pink',
|
|
13090
|
-
displayMetadata: {
|
|
13091
|
-
color: '#FF8FB8',
|
|
13092
|
-
name: 'pink'
|
|
13093
|
-
}
|
|
13094
|
-
},
|
|
13095
|
-
{
|
|
13096
|
-
id: 'yellow',
|
|
13097
|
-
displayMetadata: {
|
|
13098
|
-
color: '#E9FF8F',
|
|
13099
|
-
name: 'yellow'
|
|
13100
|
-
}
|
|
13101
|
-
}
|
|
13102
|
-
];
|
|
13134
|
+
const defaultContextGroups = Object.entries(defaultColorChannels).map(([id, displayMetadata]) => ({ id, displayMetadata }));
|
|
13103
13135
|
/**
|
|
13104
13136
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
13105
13137
|
*
|
|
@@ -13129,17 +13161,19 @@ const defaultContextGroups = [
|
|
|
13129
13161
|
* "interopBrokerConfiguration": {
|
|
13130
13162
|
* "contextGroups": [
|
|
13131
13163
|
* {
|
|
13132
|
-
* "id": "
|
|
13164
|
+
* "id": "fdc3.channel.4",
|
|
13133
13165
|
* "displayMetadata": {
|
|
13134
|
-
* "color": "
|
|
13135
|
-
* "name": "
|
|
13166
|
+
* "color": "green",
|
|
13167
|
+
* "name": "Channel 4",
|
|
13168
|
+
* "glyph": "4"
|
|
13136
13169
|
* }
|
|
13137
13170
|
* },
|
|
13138
13171
|
* {
|
|
13139
|
-
* "id": "
|
|
13172
|
+
* "id": "fdc3.channel.8",
|
|
13140
13173
|
* "displayMetadata": {
|
|
13141
|
-
* "color": "
|
|
13142
|
-
* "name": "
|
|
13174
|
+
* "color": "purple",
|
|
13175
|
+
* "name": "Channel 8",
|
|
13176
|
+
* "glyph": "8"
|
|
13143
13177
|
* }
|
|
13144
13178
|
* },
|
|
13145
13179
|
* ]
|
|
@@ -13302,9 +13336,13 @@ class InteropBroker extends Base {
|
|
|
13302
13336
|
this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
|
|
13303
13337
|
// don't expose, analytics-only call
|
|
13304
13338
|
});
|
|
13305
|
-
const
|
|
13339
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13340
|
+
if (normalizedContextGroupId === undefined) {
|
|
13341
|
+
return;
|
|
13342
|
+
}
|
|
13343
|
+
const contextGroupState = this.contextGroupsById.get(normalizedContextGroupId);
|
|
13306
13344
|
if (!contextGroupState) {
|
|
13307
|
-
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${
|
|
13345
|
+
throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${normalizedContextGroupId}.`);
|
|
13308
13346
|
}
|
|
13309
13347
|
const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
|
|
13310
13348
|
if (contextIntegrityCheckResult.isValid === false) {
|
|
@@ -13312,8 +13350,8 @@ class InteropBroker extends Base {
|
|
|
13312
13350
|
}
|
|
13313
13351
|
const broadcastedContextType = context.type;
|
|
13314
13352
|
contextGroupState.set(broadcastedContextType, context);
|
|
13315
|
-
this.lastContextMap.set(
|
|
13316
|
-
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId ===
|
|
13353
|
+
this.lastContextMap.set(normalizedContextGroupId, broadcastedContextType);
|
|
13354
|
+
const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId);
|
|
13317
13355
|
clientsInSameContextGroup.forEach((client) => {
|
|
13318
13356
|
for (const [, handlerInfo] of client.contextHandlers) {
|
|
13319
13357
|
if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
|
|
@@ -13359,10 +13397,20 @@ class InteropBroker extends Base {
|
|
|
13359
13397
|
* @param joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
|
|
13360
13398
|
* @param senderIdentity - Identity of the client sender.
|
|
13361
13399
|
*/
|
|
13362
|
-
async joinContextGroup({ contextGroupId, target }, senderIdentity) {
|
|
13400
|
+
async joinContextGroup({ contextGroupId: requestedContextGroupId, target }, senderIdentity) {
|
|
13363
13401
|
this.wire.sendAction('interop-broker-join-context-group').catch((e) => {
|
|
13364
13402
|
// don't expose, analytics-only call
|
|
13365
13403
|
});
|
|
13404
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
13405
|
+
if (contextGroupId === undefined) {
|
|
13406
|
+
if (target) {
|
|
13407
|
+
await this.removeFromContextGroup({ target }, senderIdentity);
|
|
13408
|
+
}
|
|
13409
|
+
else {
|
|
13410
|
+
await this.removeClientFromContextGroup(senderIdentity);
|
|
13411
|
+
}
|
|
13412
|
+
return;
|
|
13413
|
+
}
|
|
13366
13414
|
if (this.sessionContextGroupMap.has(contextGroupId)) {
|
|
13367
13415
|
throw new Error(BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup);
|
|
13368
13416
|
}
|
|
@@ -13404,10 +13452,15 @@ class InteropBroker extends Base {
|
|
|
13404
13452
|
* @param addClientToContextGroupOptions - Contains the contextGroupId
|
|
13405
13453
|
* @param clientIdentity - Identity of the client sender.
|
|
13406
13454
|
*/
|
|
13407
|
-
async addClientToContextGroup({ contextGroupId }, clientIdentity) {
|
|
13455
|
+
async addClientToContextGroup({ contextGroupId: requestedContextGroupId }, clientIdentity) {
|
|
13408
13456
|
this.wire.sendAction('interop-broker-add-client-to-context-group').catch((e) => {
|
|
13409
13457
|
// don't expose, analytics-only call
|
|
13410
13458
|
});
|
|
13459
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
13460
|
+
if (contextGroupId === undefined) {
|
|
13461
|
+
await this.removeClientFromContextGroup(clientIdentity);
|
|
13462
|
+
return;
|
|
13463
|
+
}
|
|
13411
13464
|
const clientSubscriptionState = this.getClientState(clientIdentity);
|
|
13412
13465
|
if (!clientSubscriptionState) {
|
|
13413
13466
|
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
|
|
@@ -13506,6 +13559,9 @@ class InteropBroker extends Base {
|
|
|
13506
13559
|
clientState.contextGroupId = undefined;
|
|
13507
13560
|
}
|
|
13508
13561
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
|
|
13562
|
+
if (previousContextGroupId === undefined) {
|
|
13563
|
+
return;
|
|
13564
|
+
}
|
|
13509
13565
|
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
13510
13566
|
// result in the operation hanging.
|
|
13511
13567
|
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
@@ -13543,7 +13599,11 @@ class InteropBroker extends Base {
|
|
|
13543
13599
|
this.wire.sendAction('interop-broker-get-info-for-context-group').catch((e) => {
|
|
13544
13600
|
// don't expose, analytics-only call
|
|
13545
13601
|
});
|
|
13546
|
-
|
|
13602
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13603
|
+
if (normalizedContextGroupId === undefined) {
|
|
13604
|
+
return undefined;
|
|
13605
|
+
}
|
|
13606
|
+
return this.getContextGroups().find((contextGroup) => contextGroup.id === normalizedContextGroupId);
|
|
13547
13607
|
}
|
|
13548
13608
|
// Used by platform windows to get all clients for a context group.
|
|
13549
13609
|
/**
|
|
@@ -13559,8 +13619,12 @@ class InteropBroker extends Base {
|
|
|
13559
13619
|
this.wire.sendAction('interop-broker-get-all-clients-in-context-group').catch((e) => {
|
|
13560
13620
|
// don't expose, analytics-only call
|
|
13561
13621
|
});
|
|
13622
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13623
|
+
if (normalizedContextGroupId === undefined) {
|
|
13624
|
+
return [];
|
|
13625
|
+
}
|
|
13562
13626
|
const clientsInContextGroup = Array.from(this.interopClients.values())
|
|
13563
|
-
.filter((connectedClient) => connectedClient.contextGroupId ===
|
|
13627
|
+
.filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId)
|
|
13564
13628
|
.map((subscriptionState) => {
|
|
13565
13629
|
return subscriptionState.clientIdentity;
|
|
13566
13630
|
});
|
|
@@ -14007,8 +14071,9 @@ class InteropBroker extends Base {
|
|
|
14007
14071
|
}
|
|
14008
14072
|
// Used to restore interop broker state in snapshots.
|
|
14009
14073
|
applySnapshot(snapshot, options) {
|
|
14010
|
-
const
|
|
14011
|
-
if (
|
|
14074
|
+
const incomingContextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
|
|
14075
|
+
if (incomingContextGroupStates) {
|
|
14076
|
+
const contextGroupStates = this.normalizeContextGroupStates(incomingContextGroupStates);
|
|
14012
14077
|
if (!options?.closeExistingWindows) {
|
|
14013
14078
|
this.updateExistingClients(contextGroupStates);
|
|
14014
14079
|
}
|
|
@@ -14153,6 +14218,23 @@ class InteropBroker extends Base {
|
|
|
14153
14218
|
});
|
|
14154
14219
|
return newObject;
|
|
14155
14220
|
}
|
|
14221
|
+
normalizeContextGroupStates(incomingContextGroupStates) {
|
|
14222
|
+
const normalizedContextGroupStates = {};
|
|
14223
|
+
for (const [contextGroupId, contexts] of Object.entries(incomingContextGroupStates)) {
|
|
14224
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
14225
|
+
if (normalizedContextGroupId !== undefined) {
|
|
14226
|
+
normalizedContextGroupStates[normalizedContextGroupId] = {
|
|
14227
|
+
...normalizedContextGroupStates[normalizedContextGroupId],
|
|
14228
|
+
...contexts
|
|
14229
|
+
};
|
|
14230
|
+
}
|
|
14231
|
+
}
|
|
14232
|
+
return normalizedContextGroupStates;
|
|
14233
|
+
}
|
|
14234
|
+
normalizeContextGroupId(contextGroupId) {
|
|
14235
|
+
const usesDefaultColorChannels = Object.keys(defaultColorChannels).every((defaultContextGroupId) => this.contextGroupsById.has(defaultContextGroupId));
|
|
14236
|
+
return usesDefaultColorChannels ? normalizeColorChannelId(contextGroupId) : contextGroupId;
|
|
14237
|
+
}
|
|
14156
14238
|
// Util to check a client identity.
|
|
14157
14239
|
static hasEndpointId(target) {
|
|
14158
14240
|
return target.endpointId !== undefined;
|
|
@@ -14216,8 +14298,14 @@ class InteropBroker extends Base {
|
|
|
14216
14298
|
clientIdentity
|
|
14217
14299
|
};
|
|
14218
14300
|
// Only allow the client to join a contextGroup that actually exists.
|
|
14219
|
-
|
|
14220
|
-
|
|
14301
|
+
const currentContextGroup = payload?.currentContextGroup
|
|
14302
|
+
? this.normalizeContextGroupId(payload.currentContextGroup)
|
|
14303
|
+
: undefined;
|
|
14304
|
+
if (currentContextGroup && this.contextGroupsById.has(currentContextGroup)) {
|
|
14305
|
+
clientSubscriptionState.contextGroupId = currentContextGroup;
|
|
14306
|
+
if (currentContextGroup !== payload.currentContextGroup) {
|
|
14307
|
+
await this.setCurrentContextGroupInClientOptions(clientIdentity, currentContextGroup);
|
|
14308
|
+
}
|
|
14221
14309
|
}
|
|
14222
14310
|
this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
14223
14311
|
});
|
|
@@ -14787,7 +14875,7 @@ class InteropClient extends Base {
|
|
|
14787
14875
|
*
|
|
14788
14876
|
* getLastFocusedView()
|
|
14789
14877
|
* .then(lastFocusedViewIdentity => {
|
|
14790
|
-
* joinViewToContextGroup('
|
|
14878
|
+
* joinViewToContextGroup('fdc3.channel.1', lastFocusedViewIdentity)
|
|
14791
14879
|
* })
|
|
14792
14880
|
* ```
|
|
14793
14881
|
*/
|
|
@@ -14837,7 +14925,7 @@ class InteropClient extends Base {
|
|
|
14837
14925
|
*
|
|
14838
14926
|
* @example
|
|
14839
14927
|
* ```js
|
|
14840
|
-
* fin.me.interop.getAllClientsInContextGroup('
|
|
14928
|
+
* fin.me.interop.getAllClientsInContextGroup('fdc3.channel.1')
|
|
14841
14929
|
* .then(clientsInContextGroup => {
|
|
14842
14930
|
* console.log(clientsInContextGroup)
|
|
14843
14931
|
* })
|
|
@@ -14861,7 +14949,7 @@ class InteropClient extends Base {
|
|
|
14861
14949
|
*
|
|
14862
14950
|
* @example
|
|
14863
14951
|
* ```js
|
|
14864
|
-
* fin.me.interop.getInfoForContextGroup('
|
|
14952
|
+
* fin.me.interop.getInfoForContextGroup('fdc3.channel.1')
|
|
14865
14953
|
* .then(contextGroupInfo => {
|
|
14866
14954
|
* console.log(contextGroupInfo.displayMetadata.name)
|
|
14867
14955
|
* console.log(contextGroupInfo.displayMetadata.color)
|
|
@@ -14950,12 +15038,12 @@ class InteropClient extends Base {
|
|
|
14950
15038
|
*
|
|
14951
15039
|
* @example
|
|
14952
15040
|
* ```js
|
|
14953
|
-
* await fin.me.interop.joinContextGroup('
|
|
15041
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14954
15042
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
14955
15043
|
* const currentContext = await fin.me.interop.getCurrentContext();
|
|
14956
15044
|
*
|
|
14957
15045
|
* // with a specific context
|
|
14958
|
-
* await fin.me.interop.joinContextGroup('
|
|
15046
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14959
15047
|
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
|
14960
15048
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
14961
15049
|
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
|
@@ -15617,15 +15705,18 @@ class FDC3ModuleBase {
|
|
|
15617
15705
|
async joinChannel(channelId) {
|
|
15618
15706
|
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15619
15707
|
try {
|
|
15708
|
+
const contextGroup = await this.client.getInfoForContextGroup(channelId);
|
|
15709
|
+
if (!contextGroup) {
|
|
15710
|
+
console.error(`No User Channel was found with the ID "${channelId}". If this is an App Channel, use getOrCreateChannel instead.`);
|
|
15711
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15712
|
+
}
|
|
15620
15713
|
return await this.client.joinContextGroup(channelId);
|
|
15621
15714
|
}
|
|
15622
15715
|
catch (error) {
|
|
15623
|
-
if (error.message ===
|
|
15624
|
-
|
|
15625
|
-
}
|
|
15626
|
-
else {
|
|
15627
|
-
console.error(error.message);
|
|
15716
|
+
if (error.message === ChannelError.NoChannelFound) {
|
|
15717
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15628
15718
|
}
|
|
15719
|
+
console.error(error.message);
|
|
15629
15720
|
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
15630
15721
|
throw new Error(ChannelError.NoChannelFound);
|
|
15631
15722
|
}
|
|
@@ -16305,7 +16396,7 @@ class InteropModule extends Base {
|
|
|
16305
16396
|
* @example
|
|
16306
16397
|
* ```js
|
|
16307
16398
|
* const interopConfig = {
|
|
16308
|
-
* currentContextGroup: '
|
|
16399
|
+
* currentContextGroup: 'fdc3.channel.4'
|
|
16309
16400
|
* }
|
|
16310
16401
|
*
|
|
16311
16402
|
* const interopBroker = await fin.Interop.init('openfin');
|
|
@@ -17310,4 +17401,4 @@ const fin$1 = ((typeof window !== 'undefined' && window?.fin) ||
|
|
|
17310
17401
|
return new Fin(transport);
|
|
17311
17402
|
})());
|
|
17312
17403
|
|
|
17313
|
-
export { OpenFin, OpenFin as default, fin$1 as fin };
|
|
17404
|
+
export { OpenFin, OpenFin as default, defaultColorChannels, fin$1 as fin, normalizeColorChannelId };
|