@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.js
CHANGED
|
@@ -469,6 +469,26 @@ class EmitterBase extends Base {
|
|
|
469
469
|
}
|
|
470
470
|
_EmitterBase_emitterAccessor = new WeakMap(), _EmitterBase_deregisterOnceListeners = new WeakMap();
|
|
471
471
|
|
|
472
|
+
const V8Error = Error;
|
|
473
|
+
function isCallSiteArray(stack) {
|
|
474
|
+
if (!Array.isArray(stack) || stack.length === 0) {
|
|
475
|
+
return Array.isArray(stack);
|
|
476
|
+
}
|
|
477
|
+
const first = stack[0];
|
|
478
|
+
return typeof first === 'object' && first !== null && typeof first.getFileName === 'function';
|
|
479
|
+
}
|
|
480
|
+
function isStackFrameLine(line) {
|
|
481
|
+
return /^\s*at\s/.test(line) || line.includes('@');
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Split a native `error.stack` string into frames and drop the dummy Error header plus `framesToRemove` frames.
|
|
485
|
+
* Safari/Firefox ignore V8's Error.prepareStackTrace, so `.stack` stays a string and `.slice(n)` would cut characters.
|
|
486
|
+
*/
|
|
487
|
+
function stackStringToFrames(stack, framesToRemove) {
|
|
488
|
+
const lines = stack.split('\n').filter((line) => line.length > 0);
|
|
489
|
+
const start = lines[0] !== undefined && !isStackFrameLine(lines[0]) ? 1 : 0;
|
|
490
|
+
return lines.slice(start + framesToRemove);
|
|
491
|
+
}
|
|
472
492
|
class UnexpectedActionError extends Error {
|
|
473
493
|
}
|
|
474
494
|
class DuplicateCorrelationError extends Error {
|
|
@@ -497,17 +517,17 @@ class DeserializedError extends Error {
|
|
|
497
517
|
class RuntimeError extends Error {
|
|
498
518
|
static trimEndCallSites(err, takeUntilRegex) {
|
|
499
519
|
// save original props
|
|
500
|
-
const length =
|
|
520
|
+
const length = V8Error.stackTraceLimit;
|
|
501
521
|
// eslint-disable-next-line no-underscore-dangle
|
|
502
|
-
const _prepareStackTrace =
|
|
522
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
503
523
|
// This will be called when we access the `stack` property
|
|
504
|
-
|
|
524
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
505
525
|
// in channel errors, the error was already serialized so we need to handle both string and CallSite[]
|
|
506
526
|
const isString = typeof err.stack === 'string';
|
|
507
527
|
const stack = (isString ? err.stack?.split('\n') : err.stack) ?? [];
|
|
508
528
|
// restore original props
|
|
509
|
-
|
|
510
|
-
|
|
529
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
530
|
+
V8Error.stackTraceLimit = length;
|
|
511
531
|
// stack is optional in non chromium contexts
|
|
512
532
|
if (stack.length) {
|
|
513
533
|
const newStack = [];
|
|
@@ -529,31 +549,47 @@ class RuntimeError extends Error {
|
|
|
529
549
|
}
|
|
530
550
|
}
|
|
531
551
|
static getCallSite(callsToRemove = 0) {
|
|
532
|
-
const length =
|
|
552
|
+
const length = V8Error.stackTraceLimit;
|
|
533
553
|
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
534
|
-
|
|
554
|
+
const limit = typeof length === 'number' && Number.isFinite(length) ? length : 10;
|
|
535
555
|
// eslint-disable-next-line no-underscore-dangle
|
|
536
|
-
const _prepareStackTrace =
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
556
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
557
|
+
try {
|
|
558
|
+
V8Error.stackTraceLimit = limit + realCallsToRemove;
|
|
559
|
+
// V8 only: accessing `.stack` invokes this and returns CallSite[]. Safari/Firefox ignore it.
|
|
560
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
561
|
+
const rawStack = new Error().stack;
|
|
562
|
+
if (Array.isArray(rawStack)) {
|
|
563
|
+
return rawStack.slice(realCallsToRemove);
|
|
564
|
+
}
|
|
565
|
+
if (typeof rawStack === 'string' && rawStack.length > 0) {
|
|
566
|
+
return stackStringToFrames(rawStack, realCallsToRemove);
|
|
567
|
+
}
|
|
568
|
+
return [];
|
|
569
|
+
}
|
|
570
|
+
finally {
|
|
571
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
572
|
+
V8Error.stackTraceLimit = length;
|
|
573
|
+
}
|
|
544
574
|
}
|
|
545
575
|
static prepareStackTrace(err, callSites) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
576
|
+
const header = `${err.name || 'Error'}: ${err.message || ''}`;
|
|
577
|
+
const frames = typeof callSites === 'string' ? stackStringToFrames(callSites, 0) : callSites;
|
|
578
|
+
if (!Array.isArray(frames) || frames.length === 0) {
|
|
579
|
+
return header;
|
|
580
|
+
}
|
|
581
|
+
if (isCallSiteArray(frames)) {
|
|
582
|
+
const prepare = V8Error.prepareStackTrace;
|
|
583
|
+
// Only V8 CallSite[] may be passed to a user-supplied Error.prepareStackTrace.
|
|
584
|
+
if (typeof prepare === 'function') {
|
|
585
|
+
return prepare(err, frames);
|
|
586
|
+
}
|
|
587
|
+
// TODO: this is just a first iteration, we can make this "nicer" at some point
|
|
588
|
+
// const EXCLUSIONS = ['IpcRenderer', 'Object.onMessage', 'Transport.onmessage', 'MessageReceiver.onmessage'];
|
|
589
|
+
return `${header}\n${frames.map((line) => ` at ${line}`).join('\n')}`;
|
|
590
|
+
}
|
|
591
|
+
// Native Safari/Firefox frames already include their engine's format (`func@file:line:col`).
|
|
592
|
+
return `${header}\n${frames.join('\n')}`;
|
|
557
593
|
}
|
|
558
594
|
/*
|
|
559
595
|
|
|
@@ -13048,6 +13084,45 @@ class PrivateChannelProvider {
|
|
|
13048
13084
|
}
|
|
13049
13085
|
}
|
|
13050
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
|
+
|
|
13051
13126
|
var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13052
13127
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13053
13128
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13060,50 +13135,7 @@ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
13060
13135
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13061
13136
|
};
|
|
13062
13137
|
var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
|
|
13063
|
-
const defaultContextGroups = [
|
|
13064
|
-
{
|
|
13065
|
-
id: 'green',
|
|
13066
|
-
displayMetadata: {
|
|
13067
|
-
color: '#00CC88',
|
|
13068
|
-
name: 'green'
|
|
13069
|
-
}
|
|
13070
|
-
},
|
|
13071
|
-
{
|
|
13072
|
-
id: 'purple',
|
|
13073
|
-
displayMetadata: {
|
|
13074
|
-
color: '#8C61FF',
|
|
13075
|
-
name: 'purple'
|
|
13076
|
-
}
|
|
13077
|
-
},
|
|
13078
|
-
{
|
|
13079
|
-
id: 'orange',
|
|
13080
|
-
displayMetadata: {
|
|
13081
|
-
color: '#FF8C4C',
|
|
13082
|
-
name: 'orange'
|
|
13083
|
-
}
|
|
13084
|
-
},
|
|
13085
|
-
{
|
|
13086
|
-
id: 'red',
|
|
13087
|
-
displayMetadata: {
|
|
13088
|
-
color: '#FF5E60',
|
|
13089
|
-
name: 'red'
|
|
13090
|
-
}
|
|
13091
|
-
},
|
|
13092
|
-
{
|
|
13093
|
-
id: 'pink',
|
|
13094
|
-
displayMetadata: {
|
|
13095
|
-
color: '#FF8FB8',
|
|
13096
|
-
name: 'pink'
|
|
13097
|
-
}
|
|
13098
|
-
},
|
|
13099
|
-
{
|
|
13100
|
-
id: 'yellow',
|
|
13101
|
-
displayMetadata: {
|
|
13102
|
-
color: '#E9FF8F',
|
|
13103
|
-
name: 'yellow'
|
|
13104
|
-
}
|
|
13105
|
-
}
|
|
13106
|
-
];
|
|
13138
|
+
const defaultContextGroups = Object.entries(defaultColorChannels).map(([id, displayMetadata]) => ({ id, displayMetadata }));
|
|
13107
13139
|
/**
|
|
13108
13140
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
13109
13141
|
*
|
|
@@ -13133,17 +13165,19 @@ const defaultContextGroups = [
|
|
|
13133
13165
|
* "interopBrokerConfiguration": {
|
|
13134
13166
|
* "contextGroups": [
|
|
13135
13167
|
* {
|
|
13136
|
-
* "id": "
|
|
13168
|
+
* "id": "fdc3.channel.4",
|
|
13137
13169
|
* "displayMetadata": {
|
|
13138
|
-
* "color": "
|
|
13139
|
-
* "name": "
|
|
13170
|
+
* "color": "green",
|
|
13171
|
+
* "name": "Channel 4",
|
|
13172
|
+
* "glyph": "4"
|
|
13140
13173
|
* }
|
|
13141
13174
|
* },
|
|
13142
13175
|
* {
|
|
13143
|
-
* "id": "
|
|
13176
|
+
* "id": "fdc3.channel.8",
|
|
13144
13177
|
* "displayMetadata": {
|
|
13145
|
-
* "color": "
|
|
13146
|
-
* "name": "
|
|
13178
|
+
* "color": "purple",
|
|
13179
|
+
* "name": "Channel 8",
|
|
13180
|
+
* "glyph": "8"
|
|
13147
13181
|
* }
|
|
13148
13182
|
* },
|
|
13149
13183
|
* ]
|
|
@@ -13306,9 +13340,13 @@ class InteropBroker extends Base {
|
|
|
13306
13340
|
this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
|
|
13307
13341
|
// don't expose, analytics-only call
|
|
13308
13342
|
});
|
|
13309
|
-
const
|
|
13343
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13344
|
+
if (normalizedContextGroupId === undefined) {
|
|
13345
|
+
return;
|
|
13346
|
+
}
|
|
13347
|
+
const contextGroupState = this.contextGroupsById.get(normalizedContextGroupId);
|
|
13310
13348
|
if (!contextGroupState) {
|
|
13311
|
-
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}.`);
|
|
13312
13350
|
}
|
|
13313
13351
|
const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
|
|
13314
13352
|
if (contextIntegrityCheckResult.isValid === false) {
|
|
@@ -13316,8 +13354,8 @@ class InteropBroker extends Base {
|
|
|
13316
13354
|
}
|
|
13317
13355
|
const broadcastedContextType = context.type;
|
|
13318
13356
|
contextGroupState.set(broadcastedContextType, context);
|
|
13319
|
-
this.lastContextMap.set(
|
|
13320
|
-
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);
|
|
13321
13359
|
clientsInSameContextGroup.forEach((client) => {
|
|
13322
13360
|
for (const [, handlerInfo] of client.contextHandlers) {
|
|
13323
13361
|
if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
|
|
@@ -13363,10 +13401,20 @@ class InteropBroker extends Base {
|
|
|
13363
13401
|
* @param joinContextGroupOptions - Id of the Context Group and identity of the entity to join to the group.
|
|
13364
13402
|
* @param senderIdentity - Identity of the client sender.
|
|
13365
13403
|
*/
|
|
13366
|
-
async joinContextGroup({ contextGroupId, target }, senderIdentity) {
|
|
13404
|
+
async joinContextGroup({ contextGroupId: requestedContextGroupId, target }, senderIdentity) {
|
|
13367
13405
|
this.wire.sendAction('interop-broker-join-context-group').catch((e) => {
|
|
13368
13406
|
// don't expose, analytics-only call
|
|
13369
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
|
+
}
|
|
13370
13418
|
if (this.sessionContextGroupMap.has(contextGroupId)) {
|
|
13371
13419
|
throw new Error(BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup);
|
|
13372
13420
|
}
|
|
@@ -13408,10 +13456,15 @@ class InteropBroker extends Base {
|
|
|
13408
13456
|
* @param addClientToContextGroupOptions - Contains the contextGroupId
|
|
13409
13457
|
* @param clientIdentity - Identity of the client sender.
|
|
13410
13458
|
*/
|
|
13411
|
-
async addClientToContextGroup({ contextGroupId }, clientIdentity) {
|
|
13459
|
+
async addClientToContextGroup({ contextGroupId: requestedContextGroupId }, clientIdentity) {
|
|
13412
13460
|
this.wire.sendAction('interop-broker-add-client-to-context-group').catch((e) => {
|
|
13413
13461
|
// don't expose, analytics-only call
|
|
13414
13462
|
});
|
|
13463
|
+
const contextGroupId = this.normalizeContextGroupId(requestedContextGroupId);
|
|
13464
|
+
if (contextGroupId === undefined) {
|
|
13465
|
+
await this.removeClientFromContextGroup(clientIdentity);
|
|
13466
|
+
return;
|
|
13467
|
+
}
|
|
13415
13468
|
const clientSubscriptionState = this.getClientState(clientIdentity);
|
|
13416
13469
|
if (!clientSubscriptionState) {
|
|
13417
13470
|
throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
|
|
@@ -13510,6 +13563,9 @@ class InteropBroker extends Base {
|
|
|
13510
13563
|
clientState.contextGroupId = undefined;
|
|
13511
13564
|
}
|
|
13512
13565
|
await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
|
|
13566
|
+
if (previousContextGroupId === undefined) {
|
|
13567
|
+
return;
|
|
13568
|
+
}
|
|
13513
13569
|
// All settled will suppress uncaught exceptions. We don't want to await this because it could
|
|
13514
13570
|
// result in the operation hanging.
|
|
13515
13571
|
Promise.allSettled(this.channel.publish('client-changed-context-group', {
|
|
@@ -13547,7 +13603,11 @@ class InteropBroker extends Base {
|
|
|
13547
13603
|
this.wire.sendAction('interop-broker-get-info-for-context-group').catch((e) => {
|
|
13548
13604
|
// don't expose, analytics-only call
|
|
13549
13605
|
});
|
|
13550
|
-
|
|
13606
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13607
|
+
if (normalizedContextGroupId === undefined) {
|
|
13608
|
+
return undefined;
|
|
13609
|
+
}
|
|
13610
|
+
return this.getContextGroups().find((contextGroup) => contextGroup.id === normalizedContextGroupId);
|
|
13551
13611
|
}
|
|
13552
13612
|
// Used by platform windows to get all clients for a context group.
|
|
13553
13613
|
/**
|
|
@@ -13563,8 +13623,12 @@ class InteropBroker extends Base {
|
|
|
13563
13623
|
this.wire.sendAction('interop-broker-get-all-clients-in-context-group').catch((e) => {
|
|
13564
13624
|
// don't expose, analytics-only call
|
|
13565
13625
|
});
|
|
13626
|
+
const normalizedContextGroupId = this.normalizeContextGroupId(contextGroupId);
|
|
13627
|
+
if (normalizedContextGroupId === undefined) {
|
|
13628
|
+
return [];
|
|
13629
|
+
}
|
|
13566
13630
|
const clientsInContextGroup = Array.from(this.interopClients.values())
|
|
13567
|
-
.filter((connectedClient) => connectedClient.contextGroupId ===
|
|
13631
|
+
.filter((connectedClient) => connectedClient.contextGroupId === normalizedContextGroupId)
|
|
13568
13632
|
.map((subscriptionState) => {
|
|
13569
13633
|
return subscriptionState.clientIdentity;
|
|
13570
13634
|
});
|
|
@@ -14011,8 +14075,9 @@ class InteropBroker extends Base {
|
|
|
14011
14075
|
}
|
|
14012
14076
|
// Used to restore interop broker state in snapshots.
|
|
14013
14077
|
applySnapshot(snapshot, options) {
|
|
14014
|
-
const
|
|
14015
|
-
if (
|
|
14078
|
+
const incomingContextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
|
|
14079
|
+
if (incomingContextGroupStates) {
|
|
14080
|
+
const contextGroupStates = this.normalizeContextGroupStates(incomingContextGroupStates);
|
|
14016
14081
|
if (!options?.closeExistingWindows) {
|
|
14017
14082
|
this.updateExistingClients(contextGroupStates);
|
|
14018
14083
|
}
|
|
@@ -14157,6 +14222,23 @@ class InteropBroker extends Base {
|
|
|
14157
14222
|
});
|
|
14158
14223
|
return newObject;
|
|
14159
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
|
+
}
|
|
14160
14242
|
// Util to check a client identity.
|
|
14161
14243
|
static hasEndpointId(target) {
|
|
14162
14244
|
return target.endpointId !== undefined;
|
|
@@ -14220,8 +14302,14 @@ class InteropBroker extends Base {
|
|
|
14220
14302
|
clientIdentity
|
|
14221
14303
|
};
|
|
14222
14304
|
// Only allow the client to join a contextGroup that actually exists.
|
|
14223
|
-
|
|
14224
|
-
|
|
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
|
+
}
|
|
14225
14313
|
}
|
|
14226
14314
|
this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
14227
14315
|
});
|
|
@@ -14791,7 +14879,7 @@ class InteropClient extends Base {
|
|
|
14791
14879
|
*
|
|
14792
14880
|
* getLastFocusedView()
|
|
14793
14881
|
* .then(lastFocusedViewIdentity => {
|
|
14794
|
-
* joinViewToContextGroup('
|
|
14882
|
+
* joinViewToContextGroup('fdc3.channel.1', lastFocusedViewIdentity)
|
|
14795
14883
|
* })
|
|
14796
14884
|
* ```
|
|
14797
14885
|
*/
|
|
@@ -14841,7 +14929,7 @@ class InteropClient extends Base {
|
|
|
14841
14929
|
*
|
|
14842
14930
|
* @example
|
|
14843
14931
|
* ```js
|
|
14844
|
-
* fin.me.interop.getAllClientsInContextGroup('
|
|
14932
|
+
* fin.me.interop.getAllClientsInContextGroup('fdc3.channel.1')
|
|
14845
14933
|
* .then(clientsInContextGroup => {
|
|
14846
14934
|
* console.log(clientsInContextGroup)
|
|
14847
14935
|
* })
|
|
@@ -14865,7 +14953,7 @@ class InteropClient extends Base {
|
|
|
14865
14953
|
*
|
|
14866
14954
|
* @example
|
|
14867
14955
|
* ```js
|
|
14868
|
-
* fin.me.interop.getInfoForContextGroup('
|
|
14956
|
+
* fin.me.interop.getInfoForContextGroup('fdc3.channel.1')
|
|
14869
14957
|
* .then(contextGroupInfo => {
|
|
14870
14958
|
* console.log(contextGroupInfo.displayMetadata.name)
|
|
14871
14959
|
* console.log(contextGroupInfo.displayMetadata.color)
|
|
@@ -14954,12 +15042,12 @@ class InteropClient extends Base {
|
|
|
14954
15042
|
*
|
|
14955
15043
|
* @example
|
|
14956
15044
|
* ```js
|
|
14957
|
-
* await fin.me.interop.joinContextGroup('
|
|
15045
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14958
15046
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
14959
15047
|
* const currentContext = await fin.me.interop.getCurrentContext();
|
|
14960
15048
|
*
|
|
14961
15049
|
* // with a specific context
|
|
14962
|
-
* await fin.me.interop.joinContextGroup('
|
|
15050
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
14963
15051
|
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
|
14964
15052
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
14965
15053
|
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
|
@@ -15621,15 +15709,18 @@ class FDC3ModuleBase {
|
|
|
15621
15709
|
async joinChannel(channelId) {
|
|
15622
15710
|
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15623
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
|
+
}
|
|
15624
15717
|
return await this.client.joinContextGroup(channelId);
|
|
15625
15718
|
}
|
|
15626
15719
|
catch (error) {
|
|
15627
|
-
if (error.message ===
|
|
15628
|
-
|
|
15629
|
-
}
|
|
15630
|
-
else {
|
|
15631
|
-
console.error(error.message);
|
|
15720
|
+
if (error.message === ChannelError.NoChannelFound) {
|
|
15721
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15632
15722
|
}
|
|
15723
|
+
console.error(error.message);
|
|
15633
15724
|
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
15634
15725
|
throw new Error(ChannelError.NoChannelFound);
|
|
15635
15726
|
}
|
|
@@ -16309,7 +16400,7 @@ class InteropModule extends Base {
|
|
|
16309
16400
|
* @example
|
|
16310
16401
|
* ```js
|
|
16311
16402
|
* const interopConfig = {
|
|
16312
|
-
* currentContextGroup: '
|
|
16403
|
+
* currentContextGroup: 'fdc3.channel.4'
|
|
16313
16404
|
* }
|
|
16314
16405
|
*
|
|
16315
16406
|
* const interopBroker = await fin.Interop.init('openfin');
|
|
@@ -17316,4 +17407,6 @@ const fin$1 = ((typeof window !== 'undefined' && window?.fin) ||
|
|
|
17316
17407
|
|
|
17317
17408
|
exports.OpenFin = OpenFin;
|
|
17318
17409
|
exports.default = OpenFin;
|
|
17410
|
+
exports.defaultColorChannels = defaultColorChannels;
|
|
17319
17411
|
exports.fin = fin$1;
|
|
17412
|
+
exports.normalizeColorChannelId = normalizeColorChannelId;
|