@openfin/remote-adapter 43.100.91 → 43.100.93

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$n = 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$3 = lazy;
879
879
  const defaultContextGroups = [
@@ -1072,7 +1072,7 @@ class InteropBroker extends base_1$n.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);
@@ -7602,7 +7602,7 @@ var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateF
7602
7602
  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");
7603
7603
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7604
7604
  };
7605
- var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
7605
+ var __importDefault$6 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
7606
7606
  return (mod && mod.__esModule) ? mod : { "default": mod };
7607
7607
  };
7608
7608
  var _Transport_wire, _Transport_fin;
@@ -7611,7 +7611,7 @@ var Transport_1 = transport.Transport = void 0;
7611
7611
  const events_1$5 = require$$0;
7612
7612
  const wire_1 = wire;
7613
7613
  const transport_errors_1$6 = transportErrors;
7614
- const eventAggregator_1 = __importDefault$5(eventAggregator);
7614
+ const eventAggregator_1 = __importDefault$6(eventAggregator);
7615
7615
  const me_1$1 = me;
7616
7616
  const errors_1$2 = errors;
7617
7617
  class Transport extends events_1$5.EventEmitter {
@@ -11486,7 +11486,7 @@ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateF
11486
11486
  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");
11487
11487
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11488
11488
  };
11489
- var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
11489
+ var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
11490
11490
  return (mod && mod.__esModule) ? mod : { "default": mod };
11491
11491
  };
11492
11492
  var _ConnectionManager_messageReceiver, _ConnectionManager_rtcConnectionManager;
@@ -11500,7 +11500,7 @@ const ice_manager_1 = iceManager;
11500
11500
  const provider_1$1 = provider;
11501
11501
  const message_receiver_1 = messageReceiver;
11502
11502
  const protocol_manager_1 = protocolManager;
11503
- const strategy_3 = __importDefault$4(strategy);
11503
+ const strategy_3 = __importDefault$5(strategy);
11504
11504
  class ConnectionManager extends base_1$e.Base {
11505
11505
  static getProtocolOptionsFromStrings(protocols) {
11506
11506
  return protocols.map((protocol) => {
@@ -15325,14 +15325,14 @@ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
15325
15325
  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");
15326
15326
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15327
15327
  };
15328
- var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15328
+ var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15329
15329
  return (mod && mod.__esModule) ? mod : { "default": mod };
15330
15330
  };
15331
15331
  var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
15332
15332
  Object.defineProperty(InteropClient$1, "__esModule", { value: true });
15333
15333
  InteropClient$1.InteropClient = void 0;
15334
15334
  const base_1$4 = base;
15335
- const SessionContextGroupClient_1 = __importDefault$3(SessionContextGroupClient$1);
15335
+ const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
15336
15336
  const utils_1$5 = utils$3;
15337
15337
  /**
15338
15338
  * The Interop Client API is broken up into two groups:
@@ -16037,15 +16037,86 @@ class PrivateChannelClient {
16037
16037
  }
16038
16038
  PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16039
16039
 
16040
+ var fdc3Channels2_0 = {};
16041
+
16042
+ var fdc3Channels1_2 = {};
16043
+
16044
+ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
16045
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16046
+ };
16047
+ Object.defineProperty(fdc3Channels1_2, "__esModule", { value: true });
16048
+ fdc3Channels1_2.createV1Channel = void 0;
16049
+ const isEqual_1$1 = __importDefault$3(require$$3);
16050
+ const createV1Channel = (sessionContextGroup) => {
16051
+ return {
16052
+ id: sessionContextGroup.id,
16053
+ type: 'app',
16054
+ broadcast: sessionContextGroup.setContext,
16055
+ getCurrentContext: async (contextType) => {
16056
+ const context = await sessionContextGroup.getCurrentContext(contextType);
16057
+ return context === undefined ? null : context;
16058
+ },
16059
+ // @ts-expect-error TODO [CORE-1524]
16060
+ addContextListener: (contextType, handler) => {
16061
+ let realHandler;
16062
+ let realType;
16063
+ if (typeof contextType === 'function') {
16064
+ console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
16065
+ realHandler = contextType;
16066
+ }
16067
+ else {
16068
+ realHandler = handler;
16069
+ if (typeof contextType === 'string') {
16070
+ realType = contextType;
16071
+ }
16072
+ }
16073
+ const listener = (async () => {
16074
+ let first = true;
16075
+ const currentContext = await sessionContextGroup.getCurrentContext(realType);
16076
+ const wrappedHandler = (context, contextMetadata) => {
16077
+ if (first) {
16078
+ first = false;
16079
+ if ((0, isEqual_1$1.default)(currentContext, context)) {
16080
+ return;
16081
+ }
16082
+ }
16083
+ // eslint-disable-next-line consistent-return
16084
+ return realHandler(context, contextMetadata);
16085
+ };
16086
+ return sessionContextGroup.addContextHandler(wrappedHandler, realType);
16087
+ })();
16088
+ return {
16089
+ ...listener,
16090
+ unsubscribe: () => listener.then((l) => l.unsubscribe())
16091
+ };
16092
+ }
16093
+ };
16094
+ };
16095
+ fdc3Channels1_2.createV1Channel = createV1Channel;
16096
+
16097
+ Object.defineProperty(fdc3Channels2_0, "__esModule", { value: true });
16098
+ fdc3Channels2_0.createV2Channel = void 0;
16099
+ const fdc3_channels_1_2_1$1 = fdc3Channels1_2;
16100
+ const createV2Channel = (sessionContextGroup) => {
16101
+ const channel = (0, fdc3_channels_1_2_1$1.createV1Channel)(sessionContextGroup);
16102
+ return {
16103
+ ...channel,
16104
+ // @ts-expect-error Type incompatibility on signature.
16105
+ addContextListener: async (...args) => channel.addContextListener(...args)
16106
+ };
16107
+ };
16108
+ fdc3Channels2_0.createV2Channel = createV2Channel;
16109
+
16040
16110
  (function (exports) {
16041
16111
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
16042
16112
  return (mod && mod.__esModule) ? mod : { "default": mod };
16043
16113
  };
16044
16114
  Object.defineProperty(exports, "__esModule", { value: true });
16045
- exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
16115
+ exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
16046
16116
  const utils_1 = utils$3;
16047
16117
  const PrivateChannelClient_1 = PrivateChannelClient$1;
16048
- const isEqual_1 = __importDefault(require$$3);
16118
+ __importDefault(require$$3);
16119
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
16049
16120
  const getUnsupportedChannelApis = (channelType) => {
16050
16121
  return {
16051
16122
  addContextListener: () => {
@@ -16144,52 +16215,6 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16144
16215
  };
16145
16216
  };
16146
16217
  exports.buildPrivateChannelObject = buildPrivateChannelObject;
16147
- const buildAppChannelObject = (sessionContextGroup) => {
16148
- return {
16149
- id: sessionContextGroup.id,
16150
- type: 'app',
16151
- broadcast: sessionContextGroup.setContext,
16152
- getCurrentContext: async (contextType) => {
16153
- const context = await sessionContextGroup.getCurrentContext(contextType);
16154
- return context === undefined ? null : context;
16155
- },
16156
- // @ts-expect-error TODO [CORE-1524]
16157
- addContextListener: (contextType, handler) => {
16158
- let realHandler;
16159
- let realType;
16160
- if (typeof contextType === 'function') {
16161
- console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
16162
- realHandler = contextType;
16163
- }
16164
- else {
16165
- realHandler = handler;
16166
- if (typeof contextType === 'string') {
16167
- realType = contextType;
16168
- }
16169
- }
16170
- const listener = (async () => {
16171
- let first = true;
16172
- const currentContext = await sessionContextGroup.getCurrentContext(realType);
16173
- const wrappedHandler = (context, contextMetadata) => {
16174
- if (first) {
16175
- first = false;
16176
- if ((0, isEqual_1.default)(currentContext, context)) {
16177
- return;
16178
- }
16179
- }
16180
- // eslint-disable-next-line consistent-return
16181
- return realHandler(context, contextMetadata);
16182
- };
16183
- return sessionContextGroup.addContextHandler(wrappedHandler, realType);
16184
- })();
16185
- return {
16186
- ...listener,
16187
- unsubscribe: () => listener.then((l) => l.unsubscribe())
16188
- };
16189
- }
16190
- };
16191
- };
16192
- exports.buildAppChannelObject = buildAppChannelObject;
16193
16218
  const connectPrivateChannel = async (channelId) => {
16194
16219
  try {
16195
16220
  const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
@@ -16221,6 +16246,10 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16221
16246
  // Generate an ID to make a session context group with. We will pass that ID to the Broker.
16222
16247
  // The broker will then setContext on that session context group later with our Intent Result,
16223
16248
  const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
16249
+ let isPromiseSettled = false;
16250
+ // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16251
+ const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16252
+ const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16224
16253
  // Promise we'll use in getResult
16225
16254
  const getResultPromise = new Promise((resolve, reject) => {
16226
16255
  fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
@@ -16233,13 +16262,24 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16233
16262
  reject(new Error('getResult is not supported in this environment'));
16234
16263
  });
16235
16264
  });
16236
- // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
16237
- const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
16238
- const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
16265
+ getResultPromise
16266
+ .then(() => {
16267
+ isPromiseSettled = true;
16268
+ })
16269
+ .catch(() => {
16270
+ isPromiseSettled = true;
16271
+ });
16239
16272
  // Set up the getResult call.
16240
16273
  const getResult = async () => {
16274
+ // All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
16275
+ if (!isPromiseSettled) {
16276
+ return undefined;
16277
+ }
16241
16278
  let intentResult = await getResultPromise;
16242
- if (!intentResult || typeof intentResult !== 'object') {
16279
+ if (isPromiseSettled && !intentResult) {
16280
+ return undefined;
16281
+ }
16282
+ if (typeof intentResult !== 'object') {
16243
16283
  throw new Error(ResultError.NoResultReturned);
16244
16284
  }
16245
16285
  const { error } = intentResult;
@@ -16255,7 +16295,7 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
16255
16295
  }
16256
16296
  case 'app': {
16257
16297
  const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
16258
- intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
16298
+ intentResult = (0, fdc3_channels_2_0_1.createV2Channel)(sessionContextGroup);
16259
16299
  break;
16260
16300
  }
16261
16301
  }
@@ -16365,7 +16405,7 @@ class FDC3ModuleBase {
16365
16405
  *
16366
16406
  * @tutorial fdc3.getOrCreateChannel
16367
16407
  */
16368
- async getOrCreateChannel(channelId) {
16408
+ async getOrCreateChannel(channelId, fdc3Factory) {
16369
16409
  this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
16370
16410
  // we do not want to expose this error, just continue if this analytics-only call fails
16371
16411
  });
@@ -16382,7 +16422,7 @@ class FDC3ModuleBase {
16382
16422
  }
16383
16423
  try {
16384
16424
  const sessionContextGroup = await this.client.joinSessionContextGroup(channelId);
16385
- return (0, utils_1$4.buildAppChannelObject)(sessionContextGroup);
16425
+ return fdc3Factory(sessionContextGroup);
16386
16426
  }
16387
16427
  catch (error) {
16388
16428
  console.error(error.message);
@@ -16532,6 +16572,7 @@ Object.defineProperty(fdc31_2, "__esModule", { value: true });
16532
16572
  fdc31_2.Fdc3Module = void 0;
16533
16573
  const utils_1$3 = utils$3;
16534
16574
  const fdc3_common_1$1 = fdc3Common;
16575
+ const fdc3_channels_1_2_1 = fdc3Channels1_2;
16535
16576
  /**
16536
16577
  * @version 1.2
16537
16578
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -16714,7 +16755,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16714
16755
  * @tutorial fdc3.getOrCreateChannel
16715
16756
  */
16716
16757
  async getOrCreateChannel(channelId) {
16717
- return super.getOrCreateChannel(channelId);
16758
+ return super.getOrCreateChannel(channelId, fdc3_channels_1_2_1.createV1Channel);
16718
16759
  }
16719
16760
  /**
16720
16761
  * 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.
@@ -16744,6 +16785,7 @@ const utils_1$2 = utils$3;
16744
16785
  const InteropClient_1$1 = InteropClient$1;
16745
16786
  const utils_2 = utils$2;
16746
16787
  const PrivateChannelClient_1 = PrivateChannelClient$1;
16788
+ const fdc3_channels_2_0_1 = fdc3Channels2_0;
16747
16789
  /**
16748
16790
  * @version 2.0
16749
16791
  * The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
@@ -16995,7 +17037,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16995
17037
  * @tutorial fdc3.getOrCreateChannel
16996
17038
  */
16997
17039
  async getOrCreateChannel(channelId) {
16998
- return super.getOrCreateChannel(channelId);
17040
+ return super.getOrCreateChannel(channelId, fdc3_channels_2_0_1.createV2Channel);
16999
17041
  }
17000
17042
  /**
17001
17043
  * 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": "43.100.91",
3
+ "version": "43.100.93",
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": "43.100.91"
23
+ "@openfin/core": "43.100.93"
24
24
  }
25
25
  }