@openfin/remote-adapter 45.100.113 → 45.100.115
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 +231 -99
- 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
|
});
|
|
@@ -2179,6 +2231,26 @@ function isNewConnectConfig(config) {
|
|
|
2179
2231
|
return hasUuid(config) && hasRuntimeVersion(config);
|
|
2180
2232
|
}
|
|
2181
2233
|
|
|
2234
|
+
const V8Error = Error;
|
|
2235
|
+
function isCallSiteArray(stack) {
|
|
2236
|
+
if (!Array.isArray(stack) || stack.length === 0) {
|
|
2237
|
+
return Array.isArray(stack);
|
|
2238
|
+
}
|
|
2239
|
+
const first = stack[0];
|
|
2240
|
+
return typeof first === 'object' && first !== null && typeof first.getFileName === 'function';
|
|
2241
|
+
}
|
|
2242
|
+
function isStackFrameLine(line) {
|
|
2243
|
+
return /^\s*at\s/.test(line) || line.includes('@');
|
|
2244
|
+
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Split a native `error.stack` string into frames and drop the dummy Error header plus `framesToRemove` frames.
|
|
2247
|
+
* Safari/Firefox ignore V8's Error.prepareStackTrace, so `.stack` stays a string and `.slice(n)` would cut characters.
|
|
2248
|
+
*/
|
|
2249
|
+
function stackStringToFrames(stack, framesToRemove) {
|
|
2250
|
+
const lines = stack.split('\n').filter((line) => line.length > 0);
|
|
2251
|
+
const start = lines[0] !== undefined && !isStackFrameLine(lines[0]) ? 1 : 0;
|
|
2252
|
+
return lines.slice(start + framesToRemove);
|
|
2253
|
+
}
|
|
2182
2254
|
class DisconnectedError extends Error {
|
|
2183
2255
|
constructor(readyState) {
|
|
2184
2256
|
super(`Expected websocket state OPEN but found ${readyState}`);
|
|
@@ -2215,17 +2287,17 @@ class DeserializedError extends Error {
|
|
|
2215
2287
|
class RuntimeError extends Error {
|
|
2216
2288
|
static trimEndCallSites(err, takeUntilRegex) {
|
|
2217
2289
|
// save original props
|
|
2218
|
-
const length =
|
|
2290
|
+
const length = V8Error.stackTraceLimit;
|
|
2219
2291
|
// eslint-disable-next-line no-underscore-dangle
|
|
2220
|
-
const _prepareStackTrace =
|
|
2292
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
2221
2293
|
// This will be called when we access the `stack` property
|
|
2222
|
-
|
|
2294
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
2223
2295
|
// in channel errors, the error was already serialized so we need to handle both string and CallSite[]
|
|
2224
2296
|
const isString = typeof err.stack === 'string';
|
|
2225
2297
|
const stack = (isString ? err.stack?.split('\n') : err.stack) ?? [];
|
|
2226
2298
|
// restore original props
|
|
2227
|
-
|
|
2228
|
-
|
|
2299
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
2300
|
+
V8Error.stackTraceLimit = length;
|
|
2229
2301
|
// stack is optional in non chromium contexts
|
|
2230
2302
|
if (stack.length) {
|
|
2231
2303
|
const newStack = [];
|
|
@@ -2247,31 +2319,47 @@ class RuntimeError extends Error {
|
|
|
2247
2319
|
}
|
|
2248
2320
|
}
|
|
2249
2321
|
static getCallSite(callsToRemove = 0) {
|
|
2250
|
-
const length =
|
|
2322
|
+
const length = V8Error.stackTraceLimit;
|
|
2251
2323
|
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
2252
|
-
|
|
2324
|
+
const limit = typeof length === 'number' && Number.isFinite(length) ? length : 10;
|
|
2253
2325
|
// eslint-disable-next-line no-underscore-dangle
|
|
2254
|
-
const _prepareStackTrace =
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2326
|
+
const _prepareStackTrace = V8Error.prepareStackTrace;
|
|
2327
|
+
try {
|
|
2328
|
+
V8Error.stackTraceLimit = limit + realCallsToRemove;
|
|
2329
|
+
// V8 only: accessing `.stack` invokes this and returns CallSite[]. Safari/Firefox ignore it.
|
|
2330
|
+
V8Error.prepareStackTrace = (_, stack) => stack;
|
|
2331
|
+
const rawStack = new Error().stack;
|
|
2332
|
+
if (Array.isArray(rawStack)) {
|
|
2333
|
+
return rawStack.slice(realCallsToRemove);
|
|
2334
|
+
}
|
|
2335
|
+
if (typeof rawStack === 'string' && rawStack.length > 0) {
|
|
2336
|
+
return stackStringToFrames(rawStack, realCallsToRemove);
|
|
2337
|
+
}
|
|
2338
|
+
return [];
|
|
2339
|
+
}
|
|
2340
|
+
finally {
|
|
2341
|
+
V8Error.prepareStackTrace = _prepareStackTrace;
|
|
2342
|
+
V8Error.stackTraceLimit = length;
|
|
2343
|
+
}
|
|
2262
2344
|
}
|
|
2263
2345
|
static prepareStackTrace(err, callSites) {
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2346
|
+
const header = `${err.name || 'Error'}: ${err.message || ''}`;
|
|
2347
|
+
const frames = typeof callSites === 'string' ? stackStringToFrames(callSites, 0) : callSites;
|
|
2348
|
+
if (!Array.isArray(frames) || frames.length === 0) {
|
|
2349
|
+
return header;
|
|
2350
|
+
}
|
|
2351
|
+
if (isCallSiteArray(frames)) {
|
|
2352
|
+
const prepare = V8Error.prepareStackTrace;
|
|
2353
|
+
// Only V8 CallSite[] may be passed to a user-supplied Error.prepareStackTrace.
|
|
2354
|
+
if (typeof prepare === 'function') {
|
|
2355
|
+
return prepare(err, frames);
|
|
2356
|
+
}
|
|
2357
|
+
// TODO: this is just a first iteration, we can make this "nicer" at some point
|
|
2358
|
+
// const EXCLUSIONS = ['IpcRenderer', 'Object.onMessage', 'Transport.onmessage', 'MessageReceiver.onmessage'];
|
|
2359
|
+
return `${header}\n${frames.map((line) => ` at ${line}`).join('\n')}`;
|
|
2360
|
+
}
|
|
2361
|
+
// Native Safari/Firefox frames already include their engine's format (`func@file:line:col`).
|
|
2362
|
+
return `${header}\n${frames.join('\n')}`;
|
|
2275
2363
|
}
|
|
2276
2364
|
/*
|
|
2277
2365
|
|
|
@@ -3678,6 +3766,47 @@ class Application extends EmitterBase {
|
|
|
3678
3766
|
constructor(wire, identity) {
|
|
3679
3767
|
super(wire, 'application', identity.uuid);
|
|
3680
3768
|
this.identity = identity;
|
|
3769
|
+
/**
|
|
3770
|
+
* @experimental
|
|
3771
|
+
* Retrieves a performance snapshot for all Windows, Views and Frames in the Application.
|
|
3772
|
+
*
|
|
3773
|
+
* By default, all custom marks and measures are collected, along with navigation/paint entries
|
|
3774
|
+
* and resource timing (`resources` defaults to `true`). Pass `include` to restrict custom
|
|
3775
|
+
* marks/measures to matching names (string substring or RegExp). Pass `browser: true` to also
|
|
3776
|
+
* include hereio internal runtime metrics.
|
|
3777
|
+
*
|
|
3778
|
+
* See also [MDN | Performance Mark API](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark)
|
|
3779
|
+
*
|
|
3780
|
+
* Note - only currently running WebContents will be captured, and performance entries can only be
|
|
3781
|
+
* captured for the current navigation of each.
|
|
3782
|
+
*/
|
|
3783
|
+
this.getPerformanceStats = async (options = {}) => {
|
|
3784
|
+
/**
|
|
3785
|
+
* Returns a filter object compatible with JSON.stringify (regexs stringify to `{}`).
|
|
3786
|
+
* @param include Array of strings or regexps.
|
|
3787
|
+
*/
|
|
3788
|
+
const getSerializableFilterObject = (include) => {
|
|
3789
|
+
return include.map((filter) => {
|
|
3790
|
+
if (filter instanceof RegExp) {
|
|
3791
|
+
return {
|
|
3792
|
+
type: 'regex',
|
|
3793
|
+
expression: filter.source,
|
|
3794
|
+
flags: filter.flags
|
|
3795
|
+
};
|
|
3796
|
+
}
|
|
3797
|
+
return filter;
|
|
3798
|
+
});
|
|
3799
|
+
};
|
|
3800
|
+
const { include, resources = true, browser = false } = options;
|
|
3801
|
+
const result = await this.wire.sendAction('get-application-performance-stats', {
|
|
3802
|
+
...this.identity,
|
|
3803
|
+
// Omit `include` when unspecified so the runtime collects all custom marks/measures.
|
|
3804
|
+
...(include !== undefined ? { include: getSerializableFilterObject(include) } : {}),
|
|
3805
|
+
resources,
|
|
3806
|
+
browser
|
|
3807
|
+
});
|
|
3808
|
+
return result.payload.data;
|
|
3809
|
+
};
|
|
3681
3810
|
this.window = new _Window(this.wire, {
|
|
3682
3811
|
uuid: this.identity.uuid,
|
|
3683
3812
|
name: this.identity.uuid
|
|
@@ -15114,7 +15243,7 @@ class InteropClient extends Base {
|
|
|
15114
15243
|
*
|
|
15115
15244
|
* getLastFocusedView()
|
|
15116
15245
|
* .then(lastFocusedViewIdentity => {
|
|
15117
|
-
* joinViewToContextGroup('
|
|
15246
|
+
* joinViewToContextGroup('fdc3.channel.1', lastFocusedViewIdentity)
|
|
15118
15247
|
* })
|
|
15119
15248
|
* ```
|
|
15120
15249
|
*/
|
|
@@ -15164,7 +15293,7 @@ class InteropClient extends Base {
|
|
|
15164
15293
|
*
|
|
15165
15294
|
* @example
|
|
15166
15295
|
* ```js
|
|
15167
|
-
* fin.me.interop.getAllClientsInContextGroup('
|
|
15296
|
+
* fin.me.interop.getAllClientsInContextGroup('fdc3.channel.1')
|
|
15168
15297
|
* .then(clientsInContextGroup => {
|
|
15169
15298
|
* console.log(clientsInContextGroup)
|
|
15170
15299
|
* })
|
|
@@ -15188,7 +15317,7 @@ class InteropClient extends Base {
|
|
|
15188
15317
|
*
|
|
15189
15318
|
* @example
|
|
15190
15319
|
* ```js
|
|
15191
|
-
* fin.me.interop.getInfoForContextGroup('
|
|
15320
|
+
* fin.me.interop.getInfoForContextGroup('fdc3.channel.1')
|
|
15192
15321
|
* .then(contextGroupInfo => {
|
|
15193
15322
|
* console.log(contextGroupInfo.displayMetadata.name)
|
|
15194
15323
|
* console.log(contextGroupInfo.displayMetadata.color)
|
|
@@ -15277,12 +15406,12 @@ class InteropClient extends Base {
|
|
|
15277
15406
|
*
|
|
15278
15407
|
* @example
|
|
15279
15408
|
* ```js
|
|
15280
|
-
* await fin.me.interop.joinContextGroup('
|
|
15409
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
15281
15410
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
15282
15411
|
* const currentContext = await fin.me.interop.getCurrentContext();
|
|
15283
15412
|
*
|
|
15284
15413
|
* // with a specific context
|
|
15285
|
-
* await fin.me.interop.joinContextGroup('
|
|
15414
|
+
* await fin.me.interop.joinContextGroup('fdc3.channel.3');
|
|
15286
15415
|
* await fin.me.interop.setContext({ type: 'country', id: { ISOALPHA3: 'US' }});
|
|
15287
15416
|
* await fin.me.interop.setContext({ type: 'instrument', id: { ticker: 'FOO' }});
|
|
15288
15417
|
* const currentContext = await fin.me.interop.getCurrentContext('country');
|
|
@@ -15919,15 +16048,18 @@ class FDC3ModuleBase {
|
|
|
15919
16048
|
async joinChannel(channelId) {
|
|
15920
16049
|
this.wire.recordAnalytic('fdc3-join-channel');
|
|
15921
16050
|
try {
|
|
16051
|
+
const contextGroup = await this.client.getInfoForContextGroup(channelId);
|
|
16052
|
+
if (!contextGroup) {
|
|
16053
|
+
console.error(`No User Channel was found with the ID "${channelId}". If this is an App Channel, use getOrCreateChannel instead.`);
|
|
16054
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
16055
|
+
}
|
|
15922
16056
|
return await this.client.joinContextGroup(channelId);
|
|
15923
16057
|
}
|
|
15924
16058
|
catch (error) {
|
|
15925
|
-
if (error.message ===
|
|
15926
|
-
|
|
15927
|
-
}
|
|
15928
|
-
else {
|
|
15929
|
-
console.error(error.message);
|
|
16059
|
+
if (error.message === ChannelError.NoChannelFound) {
|
|
16060
|
+
throw new Error(ChannelError.NoChannelFound);
|
|
15930
16061
|
}
|
|
16062
|
+
console.error(error.message);
|
|
15931
16063
|
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
15932
16064
|
throw new Error(ChannelError.NoChannelFound);
|
|
15933
16065
|
}
|
|
@@ -16607,7 +16739,7 @@ class InteropModule extends Base {
|
|
|
16607
16739
|
* @example
|
|
16608
16740
|
* ```js
|
|
16609
16741
|
* const interopConfig = {
|
|
16610
|
-
* currentContextGroup: '
|
|
16742
|
+
* currentContextGroup: 'fdc3.channel.4'
|
|
16611
16743
|
* }
|
|
16612
16744
|
*
|
|
16613
16745
|
* 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": "45.100.
|
|
3
|
+
"version": "45.100.115",
|
|
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": "45.100.
|
|
19
|
+
"@openfin/core": "45.100.115"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"prebuild": "rimraf ./out",
|