@openfin/remote-adapter 41.102.8 → 41.103.3

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.
Files changed (2) hide show
  1. package/out/remote-adapter.js +109 -67
  2. package/package.json +2 -2
@@ -864,16 +864,16 @@ var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateF
864
864
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
865
865
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
866
866
  };
867
- var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
867
+ var __importDefault$7 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
868
868
  return (mod && mod.__esModule) ? mod : { "default": mod };
869
869
  };
870
870
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
871
871
  Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
872
872
  InteropBroker$1.InteropBroker = void 0;
873
873
  const base_1$m = base;
874
- const SessionContextGroupBroker_1 = __importDefault$6(SessionContextGroupBroker$1);
874
+ const SessionContextGroupBroker_1 = __importDefault$7(SessionContextGroupBroker$1);
875
875
  const utils_1$7 = utils$3;
876
- const isEqual_1$1 = __importDefault$6(require$$3);
876
+ const isEqual_1$2 = __importDefault$7(require$$3);
877
877
  const PrivateChannelProvider_1 = PrivateChannelProvider$1;
878
878
  const lazy_1$2 = lazy;
879
879
  const defaultContextGroups = [
@@ -1072,7 +1072,7 @@ class InteropBroker extends base_1$m.Base {
1072
1072
  constructor(...unused) {
1073
1073
  if (unused.length) {
1074
1074
  const [_ignore1, ignore2, opts] = unused;
1075
- if (opts && typeof opts === 'object' && !(0, isEqual_1$1.default)(opts, args[2])) {
1075
+ if (opts && typeof opts === 'object' && !(0, isEqual_1$2.default)(opts, args[2])) {
1076
1076
  // eslint-disable-next-line no-console
1077
1077
  console.warn('You have modified the parameters of the InteropOverride constructor. This behavior is deprecated and will be removed in a future version. You can modify these options in your manifest. Please consult our Interop docs for guidance on migrating to the new override scheme.');
1078
1078
  super(args[0], args[1], opts);
@@ -7599,7 +7599,7 @@ var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateF
7599
7599
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7600
7600
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7601
7601
  };
7602
- var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
7602
+ var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
7603
7603
  return (mod && mod.__esModule) ? mod : { "default": mod };
7604
7604
  };
7605
7605
  var _Transport_wire, _Transport_fin;
@@ -7608,7 +7608,7 @@ var Transport_1 = transport.Transport = void 0;
7608
7608
  const events_1$5 = require$$0;
7609
7609
  const wire_1 = wire;
7610
7610
  const transport_errors_1$6 = transportErrors;
7611
- const eventAggregator_1 = __importDefault$5(eventAggregator);
7611
+ const eventAggregator_1 = __importDefault$6(eventAggregator);
7612
7612
  const me_1$1 = me;
7613
7613
  const errors_1$2 = errors;
7614
7614
  class Transport extends events_1$5.EventEmitter {
@@ -11476,7 +11476,7 @@ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateF
11476
11476
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11477
11477
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11478
11478
  };
11479
- var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
11479
+ var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
11480
11480
  return (mod && mod.__esModule) ? mod : { "default": mod };
11481
11481
  };
11482
11482
  var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
@@ -11490,7 +11490,7 @@ const ice_manager_1 = iceManager;
11490
11490
  const provider_1$1 = provider;
11491
11491
  const message_receiver_1 = messageReceiver;
11492
11492
  const protocol_manager_1 = protocolManager;
11493
- const strategy_3 = __importDefault$4(strategy);
11493
+ const strategy_3 = __importDefault$5(strategy);
11494
11494
  class ConnectionManager extends base_1$d.Base {
11495
11495
  static getProtocolOptionsFromStrings(protocols) {
11496
11496
  return protocols.map((protocol) => {
@@ -15348,14 +15348,14 @@ var __classPrivateFieldGet$2 = (commonjsGlobal && commonjsGlobal.__classPrivateF
15348
15348
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
15349
15349
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15350
15350
  };
15351
- var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15351
+ var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15352
15352
  return (mod && mod.__esModule) ? mod : { "default": mod };
15353
15353
  };
15354
15354
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
15355
15355
  Object.defineProperty(InteropClient$1, "__esModule", { value: true });
15356
15356
  InteropClient$1.InteropClient = void 0;
15357
15357
  const base_1$3 = base;
15358
- const SessionContextGroupClient_1 = __importDefault$3(SessionContextGroupClient$1);
15358
+ const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
15359
15359
  const utils_1$5 = utils$3;
15360
15360
  /**
15361
15361
  * The Interop Client API is broken up into two groups:
@@ -16060,15 +16060,86 @@ class PrivateChannelClient {
16060
16060
  }
16061
16061
  PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16062
16062
 
16063
+ var fdc3Channels2_0 = {};
16064
+
16065
+ var fdc3Channels1_2 = {};
16066
+
16067
+ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
16068
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16069
+ };
16070
+ Object.defineProperty(fdc3Channels1_2, "__esModule", { value: true });
16071
+ fdc3Channels1_2.createV1Channel = void 0;
16072
+ const isEqual_1$1 = __importDefault$3(require$$3);
16073
+ const createV1Channel = (sessionContextGroup) => {
16074
+ return {
16075
+ id: sessionContextGroup.id,
16076
+ type: 'app',
16077
+ broadcast: sessionContextGroup.setContext,
16078
+ getCurrentContext: async (contextType) => {
16079
+ const context = await sessionContextGroup.getCurrentContext(contextType);
16080
+ return context === undefined ? null : context;
16081
+ },
16082
+ // @ts-expect-error TODO [CORE-1524]
16083
+ addContextListener: (contextType, handler) => {
16084
+ let realHandler;
16085
+ let realType;
16086
+ if (typeof contextType === 'function') {
16087
+ console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
16088
+ realHandler = contextType;
16089
+ }
16090
+ else {
16091
+ realHandler = handler;
16092
+ if (typeof contextType === 'string') {
16093
+ realType = contextType;
16094
+ }
16095
+ }
16096
+ const listener = (async () => {
16097
+ let first = true;
16098
+ const currentContext = await sessionContextGroup.getCurrentContext(realType);
16099
+ const wrappedHandler = (context, contextMetadata) => {
16100
+ if (first) {
16101
+ first = false;
16102
+ if ((0, isEqual_1$1.default)(currentContext, context)) {
16103
+ return;
16104
+ }
16105
+ }
16106
+ // eslint-disable-next-line consistent-return
16107
+ return realHandler(context, contextMetadata);
16108
+ };
16109
+ return sessionContextGroup.addContextHandler(wrappedHandler, realType);
16110
+ })();
16111
+ return {
16112
+ ...listener,
16113
+ unsubscribe: () => listener.then((l) => l.unsubscribe())
16114
+ };
16115
+ }
16116
+ };
16117
+ };
16118
+ fdc3Channels1_2.createV1Channel = createV1Channel;
16119
+
16120
+ Object.defineProperty(fdc3Channels2_0, "__esModule", { value: true });
16121
+ fdc3Channels2_0.createV2Channel = void 0;
16122
+ const fdc3_channels_1_2_1$1 = fdc3Channels1_2;
16123
+ const createV2Channel = (sessionContextGroup) => {
16124
+ const channel = (0, fdc3_channels_1_2_1$1.createV1Channel)(sessionContextGroup);
16125
+ return {
16126
+ ...channel,
16127
+ // @ts-expect-error Type incompatibility on signature.
16128
+ addContextListener: async (...args) => channel.addContextListener(...args)
16129
+ };
16130
+ };
16131
+ fdc3Channels2_0.createV2Channel = createV2Channel;
16132
+
16063
16133
  (function (exports) {
16064
16134
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
16065
16135
  return (mod && mod.__esModule) ? mod : { "default": mod };
16066
16136
  };
16067
16137
  Object.defineProperty(exports, "__esModule", { value: true });
16068
- exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
16138
+ exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
16069
16139
  const utils_1 = utils$3;
16070
16140
  const PrivateChannelClient_1 = PrivateChannelClient$1;
16071
- const isEqual_1 = __importDefault(require$$3);
16141
+ __importDefault(require$$3);
16142
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
16072
16143
  const getUnsupportedChannelApis = (channelType) => {
16073
16144
  return {
16074
16145
  addContextListener: () => {
@@ -16167,52 +16238,6 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16167
16238
  };
16168
16239
  };
16169
16240
  exports.buildPrivateChannelObject = buildPrivateChannelObject;
16170
- const buildAppChannelObject = (sessionContextGroup) => {
16171
- return {
16172
- id: sessionContextGroup.id,
16173
- type: 'app',
16174
- broadcast: sessionContextGroup.setContext,
16175
- getCurrentContext: async (contextType) => {
16176
- const context = await sessionContextGroup.getCurrentContext(contextType);
16177
- return context === undefined ? null : context;
16178
- },
16179
- // @ts-expect-error TODO [CORE-1524]
16180
- addContextListener: (contextType, handler) => {
16181
- let realHandler;
16182
- let realType;
16183
- if (typeof contextType === 'function') {
16184
- console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
16185
- realHandler = contextType;
16186
- }
16187
- else {
16188
- realHandler = handler;
16189
- if (typeof contextType === 'string') {
16190
- realType = contextType;
16191
- }
16192
- }
16193
- const listener = (async () => {
16194
- let first = true;
16195
- const currentContext = await sessionContextGroup.getCurrentContext(realType);
16196
- const wrappedHandler = (context, contextMetadata) => {
16197
- if (first) {
16198
- first = false;
16199
- if ((0, isEqual_1.default)(currentContext, context)) {
16200
- return;
16201
- }
16202
- }
16203
- // eslint-disable-next-line consistent-return
16204
- return realHandler(context, contextMetadata);
16205
- };
16206
- return sessionContextGroup.addContextHandler(wrappedHandler, realType);
16207
- })();
16208
- return {
16209
- ...listener,
16210
- unsubscribe: () => listener.then((l) => l.unsubscribe())
16211
- };
16212
- }
16213
- };
16214
- };
16215
- exports.buildAppChannelObject = buildAppChannelObject;
16216
16241
  const connectPrivateChannel = async (channelId) => {
16217
16242
  try {
16218
16243
  const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
@@ -16244,6 +16269,10 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16244
16269
  // Generate an ID to make a session context group with. We will pass that ID to the Broker.
16245
16270
  // The broker will then setContext on that session context group later with our Intent Result,
16246
16271
  const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
16272
+ let isPromiseSettled = false;
16273
+ // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16274
+ const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16275
+ const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16247
16276
  // Promise we'll use in getResult
16248
16277
  const getResultPromise = new Promise((resolve, reject) => {
16249
16278
  fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
@@ -16256,13 +16285,24 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16256
16285
  reject(new Error('getResult is not supported in this environment'));
16257
16286
  });
16258
16287
  });
16259
- // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16260
- const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16261
- const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16288
+ getResultPromise
16289
+ .then(() => {
16290
+ isPromiseSettled = true;
16291
+ })
16292
+ .catch(() => {
16293
+ isPromiseSettled = true;
16294
+ });
16262
16295
  // Set up the getResult call.
16263
16296
  const getResult = async () => {
16297
+ // All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
16298
+ if (!isPromiseSettled) {
16299
+ return undefined;
16300
+ }
16264
16301
  let intentResult = await getResultPromise;
16265
- if (!intentResult || typeof intentResult !== 'object') {
16302
+ if (isPromiseSettled && !intentResult) {
16303
+ return undefined;
16304
+ }
16305
+ if (typeof intentResult !== 'object') {
16266
16306
  throw new Error(ResultError.NoResultReturned);
16267
16307
  }
16268
16308
  const { error } = intentResult;
@@ -16278,7 +16318,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16278
16318
  }
16279
16319
  case 'app': {
16280
16320
  const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
16281
- intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
16321
+ intentResult = (0, fdc3_channels_2_0_1.createV2Channel)(sessionContextGroup);
16282
16322
  break;
16283
16323
  }
16284
16324
  }
@@ -16388,7 +16428,7 @@ class FDC3ModuleBase {
16388
16428
  *
16389
16429
  * @tutorial fdc3.getOrCreateChannel
16390
16430
  */
16391
- async getOrCreateChannel(channelId) {
16431
+ async getOrCreateChannel(channelId, fdc3Factory) {
16392
16432
  this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
16393
16433
  // we do not want to expose this error, just continue if this analytics-only call fails
16394
16434
  });
@@ -16405,7 +16445,7 @@ class FDC3ModuleBase {
16405
16445
  }
16406
16446
  try {
16407
16447
  const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
16408
- return (0, utils_1$4.buildAppChannelObject)(sessionContextGroup);
16448
+ return fdc3Factory(sessionContextGroup);
16409
16449
  }
16410
16450
  catch (error) {
16411
16451
  console.error(error.message);
@@ -16555,6 +16595,7 @@ Object.defineProperty(fdc31_2, "__esModule", { value: true });
16555
16595
  fdc31_2.Fdc3Module = void 0;
16556
16596
  const utils_1$3 = utils$3;
16557
16597
  const fdc3_common_1$1 = fdc3Common;
16598
+ const fdc3_channels_1_2_1 = fdc3Channels1_2;
16558
16599
  /**
16559
16600
  * @version 1.2
16560
16601
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -16737,7 +16778,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16737
16778
  * @tutorial fdc3.getOrCreateChannel
16738
16779
  */
16739
16780
  async getOrCreateChannel(channelId) {
16740
- return super.getOrCreateChannel(channelId);
16781
+ return super.getOrCreateChannel(channelId, fdc3_channels_1_2_1.createV1Channel);
16741
16782
  }
16742
16783
  /**
16743
16784
  * Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
@@ -16767,6 +16808,7 @@ const utils_1$2 = utils$3;
16767
16808
  const InteropClient_1$1 = InteropClient$1;
16768
16809
  const utils_2 = utils$2;
16769
16810
  const PrivateChannelClient_1 = PrivateChannelClient$1;
16811
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
16770
16812
  /**
16771
16813
  * @version 2.0
16772
16814
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -17018,7 +17060,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
17018
17060
  * @tutorial fdc3.getOrCreateChannel
17019
17061
  */
17020
17062
  async getOrCreateChannel(channelId) {
17021
- return super.getOrCreateChannel(channelId);
17063
+ return super.getOrCreateChannel(channelId, fdc3_channels_2_0_1.createV2Channel);
17022
17064
  }
17023
17065
  /**
17024
17066
  * Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/remote-adapter",
3
- "version": "41.102.8",
3
+ "version": "41.103.3",
4
4
  "description": "Establish intermachine runtime connections using webRTC.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "private": false,
@@ -20,6 +20,6 @@
20
20
  "author": "OpenFin",
21
21
  "dependencies": {
22
22
  "lodash": "^4.17.21",
23
- "@openfin/core": "41.102.8"
23
+ "@openfin/core": "41.103.3"
24
24
  }
25
25
  }