@interopio/fdc3 2.5.2 → 2.6.1

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.
@@ -525,7 +525,7 @@
525
525
  if ($isNaN(number) || number === 0) {
526
526
  return number;
527
527
  }
528
- return number < 0 ? -1 : +1;
528
+ return number < 0 ? -1 : 1;
529
529
  };
530
530
 
531
531
  var shams$1;
@@ -1104,7 +1104,7 @@
1104
1104
  if (!allowMissing) {
1105
1105
  throw new $TypeError$8('base intrinsic for ' + name + ' exists, but the property is not available.');
1106
1106
  }
1107
- return void undefined$1;
1107
+ return void 0;
1108
1108
  }
1109
1109
  if ($gOPD$1 && (i + 1) >= parts.length) {
1110
1110
  var desc = $gOPD$1(value, part);
@@ -1628,7 +1628,7 @@
1628
1628
  num === Infinity
1629
1629
  || num === -Infinity
1630
1630
  || num !== num
1631
- || (num && num > -1000 && num < 1000)
1631
+ || (num && num > -1e3 && num < 1000)
1632
1632
  || $test.call(/e/, str)
1633
1633
  ) {
1634
1634
  return str;
@@ -2154,7 +2154,7 @@
2154
2154
  /** @type {import('./list.d.ts').listGet} */
2155
2155
  var listGet = function (objects, key) {
2156
2156
  if (!objects) {
2157
- return void undefined;
2157
+ return void 0;
2158
2158
  }
2159
2159
  var node = listGetNode(objects, key);
2160
2160
  return node && node.value;
@@ -2207,7 +2207,7 @@
2207
2207
  var root = $o && $o.next;
2208
2208
  var deletedNode = listDelete($o, key);
2209
2209
  if (deletedNode && root && root === deletedNode) {
2210
- $o = void undefined;
2210
+ $o = void 0;
2211
2211
  }
2212
2212
  return !!deletedNode;
2213
2213
  },
@@ -2221,7 +2221,7 @@
2221
2221
  if (!$o) {
2222
2222
  // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
2223
2223
  $o = {
2224
- next: void undefined
2224
+ next: void 0
2225
2225
  };
2226
2226
  }
2227
2227
  // eslint-disable-next-line no-extra-parens
@@ -2286,7 +2286,7 @@
2286
2286
  if ($m) {
2287
2287
  var result = $mapDelete($m, key);
2288
2288
  if ($mapSize$1($m) === 0) {
2289
- $m = void undefined;
2289
+ $m = void 0;
2290
2290
  }
2291
2291
  return result;
2292
2292
  }
@@ -2529,7 +2529,7 @@
2529
2529
  }
2530
2530
  return {
2531
2531
  done: true,
2532
- value: void undefined
2532
+ value: void 0
2533
2533
  };
2534
2534
  }
2535
2535
  }
@@ -4032,11 +4032,12 @@
4032
4032
 
4033
4033
  var deepEqual$1 = /*@__PURE__*/getDefaultExportFromCjs(deepEqual);
4034
4034
 
4035
+ /* @ts-self-types="./index.d.ts" */
4035
4036
  let urlAlphabet =
4036
4037
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
4037
4038
  let nanoid = (size = 21) => {
4038
4039
  let id = '';
4039
- let i = size;
4040
+ let i = size | 0;
4040
4041
  while (i--) {
4041
4042
  id += urlAlphabet[(Math.random() * 64) | 0];
4042
4043
  }
@@ -4046,21 +4047,17 @@
4046
4047
  const isValidNonEmptyObject = (obj) => {
4047
4048
  return typeof obj === "object" && !Array.isArray(obj) && Object.keys(obj).length !== 0;
4048
4049
  };
4049
- const AsyncListener = (actualUnsub) => {
4050
- return {
4051
- unsubscribe() {
4052
- if (!actualUnsub) {
4053
- console.error("Failed to unsubscribe!");
4054
- return;
4055
- }
4056
- if (typeof actualUnsub === "function") {
4057
- actualUnsub();
4058
- }
4059
- else {
4060
- actualUnsub.then((unsubFunc) => unsubFunc()).catch(console.error);
4061
- }
4050
+ const getListenerWithAsyncUnsubscribe = (unsub) => {
4051
+ const asyncUnsub = () => new Promise((res, rej) => {
4052
+ try {
4053
+ unsub();
4054
+ res();
4062
4055
  }
4063
- };
4056
+ catch (err) {
4057
+ rej(err instanceof Error ? err : new Error(err));
4058
+ }
4059
+ });
4060
+ return { unsubscribe: asyncUnsub };
4064
4061
  };
4065
4062
  const checkIfInElectron = (globalFdc3) => {
4066
4063
  const hasGlue42electron = typeof window !== "undefined" && "glue42electron" in window;
@@ -4985,7 +4982,7 @@
4985
4982
  });
4986
4983
  const v2DefinitionDecoder = object$1({
4987
4984
  appId: nonEmptyStringDecoder$1,
4988
- name: nonEmptyStringDecoder$1,
4985
+ name: optional$1(nonEmptyStringDecoder$1),
4989
4986
  type: v2TypeDecoder,
4990
4987
  details: v2DetailsDecoder,
4991
4988
  version: optional$1(nonEmptyStringDecoder$1),
@@ -5178,6 +5175,9 @@
5178
5175
  }
5179
5176
  mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
5180
5177
  let baseApplicationDefinition = baseAppData;
5178
+ if (hostManifestDefinition.customProperties) {
5179
+ baseApplicationDefinition.userProperties = { ...baseAppData.userProperties, ...hostManifestDefinition.customProperties };
5180
+ }
5181
5181
  if (hostManifestDefinition.details) {
5182
5182
  const details = { ...baseAppData.createOptions, ...hostManifestDefinition.details };
5183
5183
  baseApplicationDefinition.createOptions = details;
@@ -5277,13 +5277,20 @@
5277
5277
 
5278
5278
  const ioConnectFDC3SystemMethod = "FDC3.Collaborate";
5279
5279
  const PrivateChannelPrefix = "___privateFDC3Channel___";
5280
- var PrivateChannelEventMethods;
5281
- (function (PrivateChannelEventMethods) {
5282
- PrivateChannelEventMethods["ListenerAdded"] = "listenerAdded";
5283
- PrivateChannelEventMethods["OnAddContextListener"] = "onAddContextListener";
5284
- PrivateChannelEventMethods["OnUnsubscribe"] = "onUnsubscribe";
5285
- PrivateChannelEventMethods["OnDisconnect"] = "onDisconnect";
5286
- })(PrivateChannelEventMethods || (PrivateChannelEventMethods = {}));
5280
+ var LegacyPrivateChannelEventMethods;
5281
+ (function (LegacyPrivateChannelEventMethods) {
5282
+ LegacyPrivateChannelEventMethods["ListenerAdded"] = "listenerAdded";
5283
+ LegacyPrivateChannelEventMethods["OnAddContextListener"] = "onAddContextListener";
5284
+ LegacyPrivateChannelEventMethods["OnUnsubscribe"] = "onUnsubscribe";
5285
+ LegacyPrivateChannelEventMethods["OnDisconnect"] = "onDisconnect";
5286
+ })(LegacyPrivateChannelEventMethods || (LegacyPrivateChannelEventMethods = {}));
5287
+ var NewPrivateChannelEventMethods;
5288
+ (function (NewPrivateChannelEventMethods) {
5289
+ NewPrivateChannelEventMethods["ContextListenerAdded"] = "contextListenerAdded";
5290
+ NewPrivateChannelEventMethods["AddContextListener"] = "addContextListener";
5291
+ NewPrivateChannelEventMethods["Unsubscribe"] = "unsubscribe";
5292
+ NewPrivateChannelEventMethods["Disconnect"] = "disconnect";
5293
+ })(NewPrivateChannelEventMethods || (NewPrivateChannelEventMethods = {}));
5287
5294
 
5288
5295
  /**
5289
5296
  * Wraps values in an `Ok` type.
@@ -6131,6 +6138,9 @@
6131
6138
  object({
6132
6139
  channelId: optional(nonEmptyStringDecoder)
6133
6140
  });
6141
+ const privateChannelEventTypesDecoder = oneOf(constant("addContextListener"), constant("unsubscribe"), constant("disconnect"));
6142
+ const optionalPrivateChannelEventTypesDecoder = optional(privateChannelEventTypesDecoder);
6143
+ const optionalFdc3EventTypesDecoder = optional(constant("userChannelChanged"));
6134
6144
 
6135
6145
  class GlueController {
6136
6146
  channelsParser;
@@ -6139,7 +6149,6 @@
6139
6149
  glueInitPromise;
6140
6150
  resolveGluePromise;
6141
6151
  rejectGluePromise;
6142
- defaultGluePromiseTimeout = 120 * 1000;
6143
6152
  constructor(channelsParser) {
6144
6153
  this.channelsParser = channelsParser;
6145
6154
  }
@@ -6181,11 +6190,14 @@
6181
6190
  getApplication(name) {
6182
6191
  return this.glue.appManager.application(name);
6183
6192
  }
6193
+ getAllAppManagerInstances() {
6194
+ return this.glue.appManager.instances();
6195
+ }
6184
6196
  getApplicationInstances(appName) {
6185
- return this.glue.appManager.instances().filter(inst => inst.application.name === appName);
6197
+ return this.getAllAppManagerInstances().filter(inst => inst.application.name === appName);
6186
6198
  }
6187
6199
  getAppInstanceById(id) {
6188
- return this.glue.appManager.instances().find(inst => inst.id === id);
6200
+ return this.getAllAppManagerInstances().find(inst => inst.id === id);
6189
6201
  }
6190
6202
  async findIntents(intentFilter) {
6191
6203
  return this.glue.intents.find(intentFilter);
@@ -6218,11 +6230,11 @@
6218
6230
  }
6219
6231
  return myWin.getContext();
6220
6232
  }
6221
- addIntentListener(intent, handler) {
6222
- const registerMethodExists = this.glue.intents.register;
6223
- return registerMethodExists
6224
- ? this.glue.intents.register(intent, handler)
6225
- : this.glue.intents.addIntentListener(intent, handler);
6233
+ async addIntentListener(intent, handler) {
6234
+ if (typeof this.glue.intents.register === "function") {
6235
+ return await this.glue.intents.register(intent, handler);
6236
+ }
6237
+ return this.glue.intents.addIntentListener(intent, handler);
6226
6238
  }
6227
6239
  getAllContexts() {
6228
6240
  return this.glue.contexts.all();
@@ -6297,7 +6309,11 @@
6297
6309
  }
6298
6310
  getMyWindow() {
6299
6311
  const win = this.glue.windows.my();
6300
- return isValidNonEmptyObject(win) ? win : undefined;
6312
+ const isValidWindow = isValidNonEmptyObject(win);
6313
+ if (isValidWindow) {
6314
+ return win;
6315
+ }
6316
+ return this.glue.windows.findById(this.glue.interop.instance.instance);
6301
6317
  }
6302
6318
  getMyInteropInstance() {
6303
6319
  return this.glue.interop.instance;
@@ -6418,7 +6434,7 @@
6418
6434
  }
6419
6435
  return {
6420
6436
  source: {
6421
- appId: instanceServer.applicationName,
6437
+ appId: instanceServer.application ?? instanceServer.applicationName,
6422
6438
  instanceId: instanceServer.instance
6423
6439
  }
6424
6440
  };
@@ -6497,9 +6513,851 @@
6497
6513
 
6498
6514
  // To parse this data:
6499
6515
  //
6500
- // import { Convert, AgentErrorResponseMessage, AgentRequestMessage, AgentResponseMessage, BridgeErrorResponseMessage, BridgeRequestMessage, BridgeResponseMessage, BroadcastAgentRequest, BroadcastBridgeRequest, ConnectionStepMessage, ConnectionStep2Hello, ConnectionStep3Handshake, ConnectionStep4AuthenticationFailed, ConnectionStep6ConnectedAgentsUpdate, FindInstancesAgentErrorResponse, FindInstancesAgentRequest, FindInstancesAgentResponse, FindInstancesBridgeErrorResponse, FindInstancesBridgeRequest, FindInstancesBridgeResponse, FindIntentAgentErrorResponse, FindIntentAgentRequest, FindIntentAgentResponse, FindIntentBridgeErrorResponse, FindIntentBridgeRequest, FindIntentBridgeResponse, FindIntentsByContextAgentErrorResponse, FindIntentsByContextAgentRequest, FindIntentsByContextAgentResponse, FindIntentsByContextBridgeErrorResponse, FindIntentsByContextBridgeRequest, FindIntentsByContextBridgeResponse, GetAppMetadataAgentErrorResponse, GetAppMetadataAgentRequest, GetAppMetadataAgentResponse, GetAppMetadataBridgeErrorResponse, GetAppMetadataBridgeRequest, GetAppMetadataBridgeResponse, OpenAgentErrorResponse, OpenAgentRequest, OpenAgentResponse, OpenBridgeErrorResponse, OpenBridgeRequest, OpenBridgeResponse, PrivateChannelBroadcastAgentRequest, PrivateChannelBroadcastBridgeRequest, PrivateChannelEventListenerAddedAgentRequest, PrivateChannelEventListenerAddedBridgeRequest, PrivateChannelEventListenerRemovedAgentRequest, PrivateChannelEventListenerRemovedBridgeRequest, PrivateChannelOnAddContextListenerAgentRequest, PrivateChannelOnAddContextListenerBridgeRequest, PrivateChannelOnDisconnectAgentRequest, PrivateChannelOnDisconnectBridgeRequest, PrivateChannelOnUnsubscribeAgentRequest, PrivateChannelOnUnsubscribeBridgeRequest, RaiseIntentAgentErrorResponse, RaiseIntentAgentRequest, RaiseIntentAgentResponse, RaiseIntentBridgeErrorResponse, RaiseIntentBridgeRequest, RaiseIntentBridgeResponse, RaiseIntentResultAgentErrorResponse, RaiseIntentResultAgentResponse, RaiseIntentResultBridgeErrorResponse, RaiseIntentResultBridgeResponse, Context } from "./file";
6516
+ // import { Convert, Action, Chart, ChatInitSettings, ChatMessage, ChatRoom, ChatSearchCriteria, Contact, ContactList, Context, Country, Currency, Email, FileAttachment, Instrument, InstrumentList, Interaction, Message, Nothing, Order, OrderList, Organization, Portfolio, Position, Product, TimeRange, Trade, TradeList, TransactionResult, Valuation } from "./file";
6517
+ //
6518
+ // const action = Convert.toAction(json);
6519
+ // const chart = Convert.toChart(json);
6520
+ // const chatInitSettings = Convert.toChatInitSettings(json);
6521
+ // const chatMessage = Convert.toChatMessage(json);
6522
+ // const chatRoom = Convert.toChatRoom(json);
6523
+ // const chatSearchCriteria = Convert.toChatSearchCriteria(json);
6524
+ // const contact = Convert.toContact(json);
6525
+ // const contactList = Convert.toContactList(json);
6526
+ // const context = Convert.toContext(json);
6527
+ // const country = Convert.toCountry(json);
6528
+ // const currency = Convert.toCurrency(json);
6529
+ // const email = Convert.toEmail(json);
6530
+ // const fileAttachment = Convert.toFileAttachment(json);
6531
+ // const instrument = Convert.toInstrument(json);
6532
+ // const instrumentList = Convert.toInstrumentList(json);
6533
+ // const interaction = Convert.toInteraction(json);
6534
+ // const message = Convert.toMessage(json);
6535
+ // const nothing = Convert.toNothing(json);
6536
+ // const order = Convert.toOrder(json);
6537
+ // const orderList = Convert.toOrderList(json);
6538
+ // const organization = Convert.toOrganization(json);
6539
+ // const portfolio = Convert.toPortfolio(json);
6540
+ // const position = Convert.toPosition(json);
6541
+ // const product = Convert.toProduct(json);
6542
+ // const timeRange = Convert.toTimeRange(json);
6543
+ // const trade = Convert.toTrade(json);
6544
+ // const tradeList = Convert.toTradeList(json);
6545
+ // const transactionResult = Convert.toTransactionResult(json);
6546
+ // const valuation = Convert.toValuation(json);
6547
+ //
6548
+ // These functions will throw an error if the JSON doesn't
6549
+ // match the expected interface, even if the JSON is valid.
6550
+ /**
6551
+ * Free text to be used for a keyword search
6552
+ *
6553
+ * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or
6554
+ * `'Meeting'` although other string values are permitted.
6555
+ */
6556
+ // Converts JSON strings to/from your types
6557
+ // and asserts the results of JSON.parse at runtime
6558
+ function a$2(typ) {
6559
+ return { arrayItems: typ };
6560
+ }
6561
+ function u$2(...typs) {
6562
+ return { unionMembers: typs };
6563
+ }
6564
+ function o$2(props, additional) {
6565
+ return { props, additional };
6566
+ }
6567
+ function m$2(additional) {
6568
+ return { props: [], additional };
6569
+ }
6570
+ function r$2(name) {
6571
+ return { ref: name };
6572
+ }
6573
+ ({
6574
+ Action: o$2([
6575
+ { json: 'action', js: 'action', typ: u$2(undefined, r$2('ActionType')) },
6576
+ { json: 'app', js: 'app', typ: u$2(undefined, r$2('AppIdentifier')) },
6577
+ { json: 'channelId', js: 'channelId', typ: u$2(undefined, '') },
6578
+ { json: 'context', js: 'context', typ: r$2('ContextElement') },
6579
+ { json: 'intent', js: 'intent', typ: u$2(undefined, '') },
6580
+ { json: 'title', js: 'title', typ: '' },
6581
+ { json: 'type', js: 'type', typ: r$2('ActionTypeEnum') },
6582
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6583
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6584
+ ], 'any'),
6585
+ AppIdentifier: o$2([
6586
+ { json: 'appId', js: 'appId', typ: '' },
6587
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$2(undefined, '') },
6588
+ { json: 'instanceId', js: 'instanceId', typ: u$2(undefined, '') },
6589
+ ], 'any'),
6590
+ ContextElement: o$2([
6591
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6592
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6593
+ { json: 'type', js: 'type', typ: '' },
6594
+ ], 'any'),
6595
+ Chart: o$2([
6596
+ { json: 'instruments', js: 'instruments', typ: a$2(r$2('InstrumentElement')) },
6597
+ { json: 'otherConfig', js: 'otherConfig', typ: u$2(undefined, a$2(r$2('ContextElement'))) },
6598
+ { json: 'range', js: 'range', typ: u$2(undefined, r$2('TimeRangeObject')) },
6599
+ { json: 'style', js: 'style', typ: u$2(undefined, r$2('ChartStyle')) },
6600
+ { json: 'type', js: 'type', typ: r$2('ChartType') },
6601
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6602
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6603
+ ], 'any'),
6604
+ InstrumentElement: o$2([
6605
+ { json: 'id', js: 'id', typ: r$2('PurpleInstrumentIdentifiers') },
6606
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('OrganizationMarket')) },
6607
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6608
+ { json: 'type', js: 'type', typ: r$2('PurpleInteractionType') },
6609
+ ], 'any'),
6610
+ PurpleInstrumentIdentifiers: o$2([
6611
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6612
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6613
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6614
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6615
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6616
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6617
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6618
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6619
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6620
+ ], 'any'),
6621
+ OrganizationMarket: o$2([
6622
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6623
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6624
+ { json: 'MIC', js: 'MIC', typ: u$2(undefined, '') },
6625
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6626
+ ], 'any'),
6627
+ TimeRangeObject: o$2([
6628
+ { json: 'endTime', js: 'endTime', typ: u$2(undefined, Date) },
6629
+ { json: 'startTime', js: 'startTime', typ: u$2(undefined, Date) },
6630
+ { json: 'type', js: 'type', typ: r$2('TimeRangeType') },
6631
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6632
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6633
+ ], 'any'),
6634
+ ChatInitSettings: o$2([
6635
+ { json: 'chatName', js: 'chatName', typ: u$2(undefined, '') },
6636
+ { json: 'members', js: 'members', typ: u$2(undefined, r$2('ContactListObject')) },
6637
+ { json: 'message', js: 'message', typ: u$2(undefined, u$2(r$2('MessageObject'), '')) },
6638
+ { json: 'options', js: 'options', typ: u$2(undefined, r$2('ChatOptions')) },
6639
+ { json: 'type', js: 'type', typ: r$2('ChatInitSettingsType') },
6640
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6641
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6642
+ ], 'any'),
6643
+ ContactListObject: o$2([
6644
+ { json: 'contacts', js: 'contacts', typ: a$2(r$2('ContactElement')) },
6645
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6646
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6647
+ { json: 'type', js: 'type', typ: r$2('ContactListType') },
6648
+ ], 'any'),
6649
+ ContactElement: o$2([
6650
+ { json: 'id', js: 'id', typ: r$2('PurpleContactIdentifiers') },
6651
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6652
+ { json: 'type', js: 'type', typ: r$2('FluffyInteractionType') },
6653
+ ], 'any'),
6654
+ PurpleContactIdentifiers: o$2([
6655
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6656
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6657
+ ], 'any'),
6658
+ MessageObject: o$2([
6659
+ { json: 'entities', js: 'entities', typ: u$2(undefined, m$2(r$2('EntityValue'))) },
6660
+ { json: 'text', js: 'text', typ: u$2(undefined, r$2('PurpleMessageText')) },
6661
+ { json: 'type', js: 'type', typ: r$2('MessageType') },
6662
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6663
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6664
+ ], 'any'),
6665
+ EntityValue: o$2([
6666
+ { json: 'action', js: 'action', typ: u$2(undefined, r$2('ActionType')) },
6667
+ { json: 'app', js: 'app', typ: u$2(undefined, r$2('AppIdentifier')) },
6668
+ { json: 'channelId', js: 'channelId', typ: u$2(undefined, '') },
6669
+ { json: 'context', js: 'context', typ: u$2(undefined, r$2('ContextElement')) },
6670
+ { json: 'intent', js: 'intent', typ: u$2(undefined, '') },
6671
+ { json: 'title', js: 'title', typ: u$2(undefined, '') },
6672
+ { json: 'type', js: 'type', typ: r$2('EntityType') },
6673
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6674
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6675
+ { json: 'data', js: 'data', typ: u$2(undefined, r$2('EntityData')) },
6676
+ ], 'any'),
6677
+ PurpleMessageText: o$2([
6678
+ { json: 'text/markdown', js: 'text/markdown', typ: u$2(undefined, '') },
6679
+ { json: 'text/plain', js: 'text/plain', typ: u$2(undefined, '') },
6680
+ ], 'any'),
6681
+ ChatOptions: o$2([
6682
+ { json: 'allowAddUser', js: 'allowAddUser', typ: u$2(undefined, true) },
6683
+ { json: 'allowHistoryBrowsing', js: 'allowHistoryBrowsing', typ: u$2(undefined, true) },
6684
+ { json: 'allowMessageCopy', js: 'allowMessageCopy', typ: u$2(undefined, true) },
6685
+ { json: 'groupRecipients', js: 'groupRecipients', typ: u$2(undefined, true) },
6686
+ { json: 'isPublic', js: 'isPublic', typ: u$2(undefined, true) },
6687
+ ], 'any'),
6688
+ ChatMessage: o$2([
6689
+ { json: 'chatRoom', js: 'chatRoom', typ: r$2('ChatRoomObject') },
6690
+ { json: 'message', js: 'message', typ: r$2('MessageObject') },
6691
+ { json: 'type', js: 'type', typ: r$2('ChatMessageType') },
6692
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6693
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6694
+ ], 'any'),
6695
+ ChatRoomObject: o$2([
6696
+ { json: 'id', js: 'id', typ: m$2('') },
6697
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6698
+ { json: 'providerName', js: 'providerName', typ: '' },
6699
+ { json: 'type', js: 'type', typ: r$2('ChatRoomType') },
6700
+ { json: 'url', js: 'url', typ: u$2(undefined, '') },
6701
+ ], 'any'),
6702
+ ChatRoom: o$2([
6703
+ { json: 'id', js: 'id', typ: m$2('') },
6704
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6705
+ { json: 'providerName', js: 'providerName', typ: '' },
6706
+ { json: 'type', js: 'type', typ: r$2('ChatRoomType') },
6707
+ { json: 'url', js: 'url', typ: u$2(undefined, '') },
6708
+ ], 'any'),
6709
+ ChatSearchCriteria: o$2([
6710
+ { json: 'criteria', js: 'criteria', typ: a$2(u$2(r$2('OrganizationObject'), '')) },
6711
+ { json: 'type', js: 'type', typ: r$2('ChatSearchCriteriaType') },
6712
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6713
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6714
+ ], 'any'),
6715
+ OrganizationObject: o$2([
6716
+ { json: 'id', js: 'id', typ: r$2('Identifiers') },
6717
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('OrganizationMarket')) },
6718
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6719
+ { json: 'type', js: 'type', typ: r$2('TentacledInteractionType') },
6720
+ ], 'any'),
6721
+ Identifiers: o$2([
6722
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6723
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6724
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6725
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6726
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6727
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6728
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6729
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6730
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6731
+ { json: 'LEI', js: 'LEI', typ: u$2(undefined, '') },
6732
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6733
+ ], 'any'),
6734
+ Contact: o$2([
6735
+ { json: 'id', js: 'id', typ: r$2('FluffyContactIdentifiers') },
6736
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6737
+ { json: 'type', js: 'type', typ: r$2('FluffyInteractionType') },
6738
+ ], 'any'),
6739
+ FluffyContactIdentifiers: o$2([
6740
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6741
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6742
+ ], 'any'),
6743
+ ContactList: o$2([
6744
+ { json: 'contacts', js: 'contacts', typ: a$2(r$2('ContactElement')) },
6745
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6746
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6747
+ { json: 'type', js: 'type', typ: r$2('ContactListType') },
6748
+ ], 'any'),
6749
+ Context: o$2([
6750
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6751
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6752
+ { json: 'type', js: 'type', typ: '' },
6753
+ ], 'any'),
6754
+ Country: o$2([
6755
+ { json: 'id', js: 'id', typ: r$2('CountryID') },
6756
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6757
+ { json: 'type', js: 'type', typ: r$2('CountryType') },
6758
+ ], 'any'),
6759
+ CountryID: o$2([
6760
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6761
+ { json: 'COUNTRY_ISOALPHA3', js: 'COUNTRY_ISOALPHA3', typ: u$2(undefined, '') },
6762
+ { json: 'ISOALPHA2', js: 'ISOALPHA2', typ: u$2(undefined, '') },
6763
+ { json: 'ISOALPHA3', js: 'ISOALPHA3', typ: u$2(undefined, '') },
6764
+ ], 'any'),
6765
+ Currency: o$2([
6766
+ { json: 'id', js: 'id', typ: r$2('CurrencyID') },
6767
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6768
+ { json: 'type', js: 'type', typ: r$2('CurrencyType') },
6769
+ ], 'any'),
6770
+ CurrencyID: o$2([{ json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: u$2(undefined, '') }], 'any'),
6771
+ Email: o$2([
6772
+ { json: 'recipients', js: 'recipients', typ: r$2('EmailRecipients') },
6773
+ { json: 'subject', js: 'subject', typ: u$2(undefined, '') },
6774
+ { json: 'textBody', js: 'textBody', typ: u$2(undefined, '') },
6775
+ { json: 'type', js: 'type', typ: r$2('EmailType') },
6776
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6777
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6778
+ ], 'any'),
6779
+ EmailRecipients: o$2([
6780
+ { json: 'id', js: 'id', typ: u$2(undefined, r$2('ContactTIdentifiers')) },
6781
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6782
+ { json: 'type', js: 'type', typ: r$2('EmailRecipientsType') },
6783
+ { json: 'contacts', js: 'contacts', typ: u$2(undefined, a$2(r$2('ContactElement'))) },
6784
+ ], 'any'),
6785
+ ContactTIdentifiers: o$2([
6786
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6787
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6788
+ ], 'any'),
6789
+ FileAttachment: o$2([
6790
+ { json: 'data', js: 'data', typ: r$2('FileAttachmentData') },
6791
+ { json: 'type', js: 'type', typ: r$2('FileAttachmentType') },
6792
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6793
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6794
+ ], 'any'),
6795
+ Instrument: o$2([
6796
+ { json: 'id', js: 'id', typ: r$2('FluffyInstrumentIdentifiers') },
6797
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('PurpleMarket')) },
6798
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6799
+ { json: 'type', js: 'type', typ: r$2('PurpleInteractionType') },
6800
+ ], 'any'),
6801
+ FluffyInstrumentIdentifiers: o$2([
6802
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6803
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6804
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6805
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6806
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6807
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6808
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6809
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6810
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6811
+ ], 'any'),
6812
+ PurpleMarket: o$2([
6813
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6814
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6815
+ { json: 'MIC', js: 'MIC', typ: u$2(undefined, '') },
6816
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6817
+ ], 'any'),
6818
+ InstrumentList: o$2([
6819
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6820
+ { json: 'instruments', js: 'instruments', typ: a$2(r$2('InstrumentElement')) },
6821
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6822
+ { json: 'type', js: 'type', typ: r$2('InstrumentListType') },
6823
+ ], 'any'),
6824
+ Interaction: o$2([
6825
+ { json: 'description', js: 'description', typ: '' },
6826
+ { json: 'id', js: 'id', typ: u$2(undefined, r$2('InteractionID')) },
6827
+ { json: 'initiator', js: 'initiator', typ: u$2(undefined, r$2('ContactElement')) },
6828
+ { json: 'interactionType', js: 'interactionType', typ: '' },
6829
+ { json: 'origin', js: 'origin', typ: u$2(undefined, '') },
6830
+ { json: 'participants', js: 'participants', typ: r$2('ContactListObject') },
6831
+ { json: 'timeRange', js: 'timeRange', typ: r$2('TimeRangeObject') },
6832
+ { json: 'type', js: 'type', typ: r$2('InteractionType') },
6833
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6834
+ ], 'any'),
6835
+ InteractionID: o$2([
6836
+ { json: 'SALESFORCE', js: 'SALESFORCE', typ: u$2(undefined, '') },
6837
+ { json: 'SINGLETRACK', js: 'SINGLETRACK', typ: u$2(undefined, '') },
6838
+ { json: 'URI', js: 'URI', typ: u$2(undefined, '') },
6839
+ ], 'any'),
6840
+ Message: o$2([
6841
+ { json: 'entities', js: 'entities', typ: u$2(undefined, m$2(r$2('EntityValue'))) },
6842
+ { json: 'text', js: 'text', typ: u$2(undefined, r$2('FluffyMessageText')) },
6843
+ { json: 'type', js: 'type', typ: r$2('MessageType') },
6844
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6845
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6846
+ ], 'any'),
6847
+ FluffyMessageText: o$2([
6848
+ { json: 'text/markdown', js: 'text/markdown', typ: u$2(undefined, '') },
6849
+ { json: 'text/plain', js: 'text/plain', typ: u$2(undefined, '') },
6850
+ ], 'any'),
6851
+ Nothing: o$2([
6852
+ { json: 'type', js: 'type', typ: r$2('NothingType') },
6853
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6854
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6855
+ ], 'any'),
6856
+ Order: o$2([
6857
+ { json: 'details', js: 'details', typ: u$2(undefined, r$2('PurpleOrderDetails')) },
6858
+ { json: 'id', js: 'id', typ: m$2('') },
6859
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6860
+ { json: 'type', js: 'type', typ: r$2('OrderType') },
6861
+ ], 'any'),
6862
+ PurpleOrderDetails: o$2([{ json: 'product', js: 'product', typ: u$2(undefined, r$2('ProductObject')) }], 'any'),
6863
+ ProductObject: o$2([
6864
+ { json: 'id', js: 'id', typ: m$2('') },
6865
+ { json: 'instrument', js: 'instrument', typ: u$2(undefined, r$2('InstrumentElement')) },
6866
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6867
+ { json: 'type', js: 'type', typ: r$2('ProductType') },
6868
+ ], 'any'),
6869
+ OrderList: o$2([
6870
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6871
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6872
+ { json: 'orders', js: 'orders', typ: a$2(r$2('OrderElement')) },
6873
+ { json: 'type', js: 'type', typ: r$2('OrderListType') },
6874
+ ], 'any'),
6875
+ OrderElement: o$2([
6876
+ { json: 'details', js: 'details', typ: u$2(undefined, r$2('FluffyOrderDetails')) },
6877
+ { json: 'id', js: 'id', typ: m$2('') },
6878
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6879
+ { json: 'type', js: 'type', typ: r$2('OrderType') },
6880
+ ], 'any'),
6881
+ FluffyOrderDetails: o$2([{ json: 'product', js: 'product', typ: u$2(undefined, r$2('ProductObject')) }], 'any'),
6882
+ Organization: o$2([
6883
+ { json: 'id', js: 'id', typ: r$2('OrganizationIdentifiers') },
6884
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6885
+ { json: 'type', js: 'type', typ: r$2('StickyInteractionType') },
6886
+ ], 'any'),
6887
+ OrganizationIdentifiers: o$2([
6888
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6889
+ { json: 'LEI', js: 'LEI', typ: u$2(undefined, '') },
6890
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6891
+ ], 'any'),
6892
+ Portfolio: o$2([
6893
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6894
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6895
+ { json: 'positions', js: 'positions', typ: a$2(r$2('PositionElement')) },
6896
+ { json: 'type', js: 'type', typ: r$2('PortfolioType') },
6897
+ ], 'any'),
6898
+ PositionElement: o$2([
6899
+ { json: 'holding', js: 'holding', typ: 3.14 },
6900
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6901
+ { json: 'instrument', js: 'instrument', typ: r$2('InstrumentElement') },
6902
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6903
+ { json: 'type', js: 'type', typ: r$2('PositionType') },
6904
+ ], 'any'),
6905
+ Position: o$2([
6906
+ { json: 'holding', js: 'holding', typ: 3.14 },
6907
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6908
+ { json: 'instrument', js: 'instrument', typ: r$2('InstrumentElement') },
6909
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6910
+ { json: 'type', js: 'type', typ: r$2('PositionType') },
6911
+ ], 'any'),
6912
+ Product: o$2([
6913
+ { json: 'id', js: 'id', typ: m$2('') },
6914
+ { json: 'instrument', js: 'instrument', typ: u$2(undefined, r$2('InstrumentElement')) },
6915
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6916
+ { json: 'type', js: 'type', typ: r$2('ProductType') },
6917
+ ], 'any'),
6918
+ TimeRange: o$2([
6919
+ { json: 'endTime', js: 'endTime', typ: u$2(undefined, Date) },
6920
+ { json: 'startTime', js: 'startTime', typ: u$2(undefined, Date) },
6921
+ { json: 'type', js: 'type', typ: r$2('TimeRangeType') },
6922
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6923
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6924
+ ], 'any'),
6925
+ Trade: o$2([
6926
+ { json: 'id', js: 'id', typ: m$2('') },
6927
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6928
+ { json: 'product', js: 'product', typ: r$2('ProductObject') },
6929
+ { json: 'type', js: 'type', typ: r$2('TradeType') },
6930
+ ], 'any'),
6931
+ TradeList: o$2([
6932
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6933
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6934
+ { json: 'trades', js: 'trades', typ: a$2(r$2('TradeElement')) },
6935
+ { json: 'type', js: 'type', typ: r$2('TradeListType') },
6936
+ ], 'any'),
6937
+ TradeElement: o$2([
6938
+ { json: 'id', js: 'id', typ: m$2('') },
6939
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6940
+ { json: 'product', js: 'product', typ: r$2('ProductObject') },
6941
+ { json: 'type', js: 'type', typ: r$2('TradeType') },
6942
+ ], 'any'),
6943
+ TransactionResult: o$2([
6944
+ { json: 'context', js: 'context', typ: u$2(undefined, r$2('ContextElement')) },
6945
+ { json: 'message', js: 'message', typ: u$2(undefined, '') },
6946
+ { json: 'status', js: 'status', typ: r$2('TransactionStatus') },
6947
+ { json: 'type', js: 'type', typ: r$2('TransactionResultType') },
6948
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6949
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6950
+ ], 'any'),
6951
+ Valuation: o$2([
6952
+ { json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: '' },
6953
+ { json: 'expiryTime', js: 'expiryTime', typ: u$2(undefined, Date) },
6954
+ { json: 'price', js: 'price', typ: u$2(undefined, 3.14) },
6955
+ { json: 'type', js: 'type', typ: r$2('ValuationType') },
6956
+ { json: 'valuationTime', js: 'valuationTime', typ: u$2(undefined, Date) },
6957
+ { json: 'value', js: 'value', typ: 3.14 },
6958
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6959
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6960
+ ], 'any')});
6961
+
6962
+ // To parse this data:
6963
+ //
6964
+ // import { Convert, WebConnectionProtocol1Hello, WebConnectionProtocol2LoadURL, WebConnectionProtocol3Handshake, WebConnectionProtocol4ValidateAppIdentity, WebConnectionProtocol5ValidateAppIdentityFailedResponse, WebConnectionProtocol5ValidateAppIdentitySuccessResponse, WebConnectionProtocol6Goodbye, WebConnectionProtocolMessage, AddContextListenerRequest, AddContextListenerResponse, AddEventListenerRequest, AddEventListenerResponse, AddIntentListenerRequest, AddIntentListenerResponse, AgentEventMessage, AgentResponseMessage, AppRequestMessage, BroadcastEvent, BroadcastRequest, BroadcastResponse, ChannelChangedEvent, ContextListenerUnsubscribeRequest, ContextListenerUnsubscribeResponse, CreatePrivateChannelRequest, CreatePrivateChannelResponse, EventListenerUnsubscribeRequest, EventListenerUnsubscribeResponse, Fdc3UserInterfaceChannelSelected, Fdc3UserInterfaceChannels, Fdc3UserInterfaceDrag, Fdc3UserInterfaceHandshake, Fdc3UserInterfaceHello, Fdc3UserInterfaceMessage, Fdc3UserInterfaceResolve, Fdc3UserInterfaceResolveAction, Fdc3UserInterfaceRestyle, FindInstancesRequest, FindInstancesResponse, FindIntentRequest, FindIntentResponse, FindIntentsByContextRequest, FindIntentsByContextResponse, GetAppMetadataRequest, GetAppMetadataResponse, GetCurrentChannelRequest, GetCurrentChannelResponse, GetCurrentContextRequest, GetCurrentContextResponse, GetInfoRequest, GetInfoResponse, GetOrCreateChannelRequest, GetOrCreateChannelResponse, GetUserChannelsRequest, GetUserChannelsResponse, HeartbeatAcknowledgementRequest, HeartbeatEvent, IntentEvent, IntentListenerUnsubscribeRequest, IntentListenerUnsubscribeResponse, IntentResultRequest, IntentResultResponse, JoinUserChannelRequest, JoinUserChannelResponse, LeaveCurrentChannelRequest, LeaveCurrentChannelResponse, OpenRequest, OpenResponse, PrivateChannelAddEventListenerRequest, PrivateChannelAddEventListenerResponse, PrivateChannelDisconnectRequest, PrivateChannelDisconnectResponse, PrivateChannelOnAddContextListenerEvent, PrivateChannelOnDisconnectEvent, PrivateChannelOnUnsubscribeEvent, PrivateChannelUnsubscribeEventListenerRequest, PrivateChannelUnsubscribeEventListenerResponse, RaiseIntentForContextRequest, RaiseIntentForContextResponse, RaiseIntentRequest, RaiseIntentResponse, RaiseIntentResultResponse } from "./file";
6965
+ //
6966
+ // const webConnectionProtocol1Hello = Convert.toWebConnectionProtocol1Hello(json);
6967
+ // const webConnectionProtocol2LoadURL = Convert.toWebConnectionProtocol2LoadURL(json);
6968
+ // const webConnectionProtocol3Handshake = Convert.toWebConnectionProtocol3Handshake(json);
6969
+ // const webConnectionProtocol4ValidateAppIdentity = Convert.toWebConnectionProtocol4ValidateAppIdentity(json);
6970
+ // const webConnectionProtocol5ValidateAppIdentityFailedResponse = Convert.toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json);
6971
+ // const webConnectionProtocol5ValidateAppIdentitySuccessResponse = Convert.toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json);
6972
+ // const webConnectionProtocol6Goodbye = Convert.toWebConnectionProtocol6Goodbye(json);
6973
+ // const webConnectionProtocolMessage = Convert.toWebConnectionProtocolMessage(json);
6974
+ // const addContextListenerRequest = Convert.toAddContextListenerRequest(json);
6975
+ // const addContextListenerResponse = Convert.toAddContextListenerResponse(json);
6976
+ // const addEventListenerRequest = Convert.toAddEventListenerRequest(json);
6977
+ // const addEventListenerResponse = Convert.toAddEventListenerResponse(json);
6978
+ // const addIntentListenerRequest = Convert.toAddIntentListenerRequest(json);
6979
+ // const addIntentListenerResponse = Convert.toAddIntentListenerResponse(json);
6980
+ // const agentEventMessage = Convert.toAgentEventMessage(json);
6981
+ // const agentResponseMessage = Convert.toAgentResponseMessage(json);
6982
+ // const appRequestMessage = Convert.toAppRequestMessage(json);
6983
+ // const broadcastEvent = Convert.toBroadcastEvent(json);
6984
+ // const broadcastRequest = Convert.toBroadcastRequest(json);
6985
+ // const broadcastResponse = Convert.toBroadcastResponse(json);
6986
+ // const channelChangedEvent = Convert.toChannelChangedEvent(json);
6987
+ // const contextListenerUnsubscribeRequest = Convert.toContextListenerUnsubscribeRequest(json);
6988
+ // const contextListenerUnsubscribeResponse = Convert.toContextListenerUnsubscribeResponse(json);
6989
+ // const createPrivateChannelRequest = Convert.toCreatePrivateChannelRequest(json);
6990
+ // const createPrivateChannelResponse = Convert.toCreatePrivateChannelResponse(json);
6991
+ // const eventListenerUnsubscribeRequest = Convert.toEventListenerUnsubscribeRequest(json);
6992
+ // const eventListenerUnsubscribeResponse = Convert.toEventListenerUnsubscribeResponse(json);
6993
+ // const fdc3UserInterfaceChannelSelected = Convert.toFdc3UserInterfaceChannelSelected(json);
6994
+ // const fdc3UserInterfaceChannels = Convert.toFdc3UserInterfaceChannels(json);
6995
+ // const fdc3UserInterfaceDrag = Convert.toFdc3UserInterfaceDrag(json);
6996
+ // const fdc3UserInterfaceHandshake = Convert.toFdc3UserInterfaceHandshake(json);
6997
+ // const fdc3UserInterfaceHello = Convert.toFdc3UserInterfaceHello(json);
6998
+ // const fdc3UserInterfaceMessage = Convert.toFdc3UserInterfaceMessage(json);
6999
+ // const fdc3UserInterfaceResolve = Convert.toFdc3UserInterfaceResolve(json);
7000
+ // const fdc3UserInterfaceResolveAction = Convert.toFdc3UserInterfaceResolveAction(json);
7001
+ // const fdc3UserInterfaceRestyle = Convert.toFdc3UserInterfaceRestyle(json);
7002
+ // const findInstancesRequest = Convert.toFindInstancesRequest(json);
7003
+ // const findInstancesResponse = Convert.toFindInstancesResponse(json);
7004
+ // const findIntentRequest = Convert.toFindIntentRequest(json);
7005
+ // const findIntentResponse = Convert.toFindIntentResponse(json);
7006
+ // const findIntentsByContextRequest = Convert.toFindIntentsByContextRequest(json);
7007
+ // const findIntentsByContextResponse = Convert.toFindIntentsByContextResponse(json);
7008
+ // const getAppMetadataRequest = Convert.toGetAppMetadataRequest(json);
7009
+ // const getAppMetadataResponse = Convert.toGetAppMetadataResponse(json);
7010
+ // const getCurrentChannelRequest = Convert.toGetCurrentChannelRequest(json);
7011
+ // const getCurrentChannelResponse = Convert.toGetCurrentChannelResponse(json);
7012
+ // const getCurrentContextRequest = Convert.toGetCurrentContextRequest(json);
7013
+ // const getCurrentContextResponse = Convert.toGetCurrentContextResponse(json);
7014
+ // const getInfoRequest = Convert.toGetInfoRequest(json);
7015
+ // const getInfoResponse = Convert.toGetInfoResponse(json);
7016
+ // const getOrCreateChannelRequest = Convert.toGetOrCreateChannelRequest(json);
7017
+ // const getOrCreateChannelResponse = Convert.toGetOrCreateChannelResponse(json);
7018
+ // const getUserChannelsRequest = Convert.toGetUserChannelsRequest(json);
7019
+ // const getUserChannelsResponse = Convert.toGetUserChannelsResponse(json);
7020
+ // const heartbeatAcknowledgementRequest = Convert.toHeartbeatAcknowledgementRequest(json);
7021
+ // const heartbeatEvent = Convert.toHeartbeatEvent(json);
7022
+ // const intentEvent = Convert.toIntentEvent(json);
7023
+ // const intentListenerUnsubscribeRequest = Convert.toIntentListenerUnsubscribeRequest(json);
7024
+ // const intentListenerUnsubscribeResponse = Convert.toIntentListenerUnsubscribeResponse(json);
7025
+ // const intentResultRequest = Convert.toIntentResultRequest(json);
7026
+ // const intentResultResponse = Convert.toIntentResultResponse(json);
7027
+ // const joinUserChannelRequest = Convert.toJoinUserChannelRequest(json);
7028
+ // const joinUserChannelResponse = Convert.toJoinUserChannelResponse(json);
7029
+ // const leaveCurrentChannelRequest = Convert.toLeaveCurrentChannelRequest(json);
7030
+ // const leaveCurrentChannelResponse = Convert.toLeaveCurrentChannelResponse(json);
7031
+ // const openRequest = Convert.toOpenRequest(json);
7032
+ // const openResponse = Convert.toOpenResponse(json);
7033
+ // const privateChannelAddEventListenerRequest = Convert.toPrivateChannelAddEventListenerRequest(json);
7034
+ // const privateChannelAddEventListenerResponse = Convert.toPrivateChannelAddEventListenerResponse(json);
7035
+ // const privateChannelDisconnectRequest = Convert.toPrivateChannelDisconnectRequest(json);
7036
+ // const privateChannelDisconnectResponse = Convert.toPrivateChannelDisconnectResponse(json);
7037
+ // const privateChannelOnAddContextListenerEvent = Convert.toPrivateChannelOnAddContextListenerEvent(json);
7038
+ // const privateChannelOnDisconnectEvent = Convert.toPrivateChannelOnDisconnectEvent(json);
7039
+ // const privateChannelOnUnsubscribeEvent = Convert.toPrivateChannelOnUnsubscribeEvent(json);
7040
+ // const privateChannelUnsubscribeEventListenerRequest = Convert.toPrivateChannelUnsubscribeEventListenerRequest(json);
7041
+ // const privateChannelUnsubscribeEventListenerResponse = Convert.toPrivateChannelUnsubscribeEventListenerResponse(json);
7042
+ // const raiseIntentForContextRequest = Convert.toRaiseIntentForContextRequest(json);
7043
+ // const raiseIntentForContextResponse = Convert.toRaiseIntentForContextResponse(json);
7044
+ // const raiseIntentRequest = Convert.toRaiseIntentRequest(json);
7045
+ // const raiseIntentResponse = Convert.toRaiseIntentResponse(json);
7046
+ // const raiseIntentResultResponse = Convert.toRaiseIntentResultResponse(json);
7047
+ //
7048
+ // These functions will throw an error if the JSON doesn't
7049
+ // match the expected interface, even if the JSON is valid.
7050
+ /**
7051
+ * Identifies the type of the message and it is typically set to the FDC3 function name that
7052
+ * the message relates to, e.g. 'findIntent', with 'Response' appended.
7053
+ */
7054
+ // Converts JSON strings to/from your types
7055
+ // and asserts the results of JSON.parse at runtime
7056
+ function a$1(typ) {
7057
+ return { arrayItems: typ };
7058
+ }
7059
+ function u$1(...typs) {
7060
+ return { unionMembers: typs };
7061
+ }
7062
+ function o$1(props, additional) {
7063
+ return { props, additional };
7064
+ }
7065
+ function m$1(additional) {
7066
+ return { props: [], additional };
7067
+ }
7068
+ function r$1(name) {
7069
+ return { ref: name };
7070
+ }
7071
+ ({
7072
+ WebConnectionProtocol1HelloPayload: o$1([
7073
+ { json: 'actualUrl', js: 'actualUrl', typ: '' },
7074
+ { json: 'channelSelector', js: 'channelSelector', typ: u$1(undefined, true) },
7075
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7076
+ { json: 'identityUrl', js: 'identityUrl', typ: '' },
7077
+ { json: 'intentResolver', js: 'intentResolver', typ: u$1(undefined, true) },
7078
+ ], 'any'),
7079
+ WebConnectionProtocol3HandshakePayload: o$1([
7080
+ { json: 'appLaunchTimeout', js: 'appLaunchTimeout', typ: u$1(undefined, 3.14) },
7081
+ { json: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u$1(true, '') },
7082
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7083
+ { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u$1(true, '') },
7084
+ { json: 'messageExchangeTimeout', js: 'messageExchangeTimeout', typ: u$1(undefined, 3.14) },
7085
+ ], false),
7086
+ WebConnectionProtocol4ValidateAppIdentityPayload: o$1([
7087
+ { json: 'actualUrl', js: 'actualUrl', typ: '' },
7088
+ { json: 'identityUrl', js: 'identityUrl', typ: '' },
7089
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7090
+ { json: 'instanceUuid', js: 'instanceUuid', typ: u$1(undefined, '') },
7091
+ ], false),
7092
+ WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload: o$1([{ json: 'message', js: 'message', typ: u$1(undefined, '') }], false),
7093
+ ImplementationMetadata: o$1([
7094
+ { json: 'appMetadata', js: 'appMetadata', typ: r$1('AppMetadata') },
7095
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7096
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r$1('OptionalFeatures') },
7097
+ { json: 'provider', js: 'provider', typ: '' },
7098
+ { json: 'providerVersion', js: 'providerVersion', typ: u$1(undefined, '') },
7099
+ ], false),
7100
+ AppMetadata: o$1([
7101
+ { json: 'appId', js: 'appId', typ: '' },
7102
+ { json: 'description', js: 'description', typ: u$1(undefined, '') },
7103
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$1(undefined, '') },
7104
+ { json: 'icons', js: 'icons', typ: u$1(undefined, a$1(r$1('Icon'))) },
7105
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7106
+ { json: 'instanceMetadata', js: 'instanceMetadata', typ: u$1(undefined, m$1('any')) },
7107
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7108
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, u$1(null, '')) },
7109
+ { json: 'screenshots', js: 'screenshots', typ: u$1(undefined, a$1(r$1('Image'))) },
7110
+ { json: 'title', js: 'title', typ: u$1(undefined, '') },
7111
+ { json: 'tooltip', js: 'tooltip', typ: u$1(undefined, '') },
7112
+ { json: 'version', js: 'version', typ: u$1(undefined, '') },
7113
+ ], false),
7114
+ Icon: o$1([
7115
+ { json: 'size', js: 'size', typ: u$1(undefined, '') },
7116
+ { json: 'src', js: 'src', typ: '' },
7117
+ { json: 'type', js: 'type', typ: u$1(undefined, '') },
7118
+ ], false),
7119
+ Image: o$1([
7120
+ { json: 'label', js: 'label', typ: u$1(undefined, '') },
7121
+ { json: 'size', js: 'size', typ: u$1(undefined, '') },
7122
+ { json: 'src', js: 'src', typ: '' },
7123
+ { json: 'type', js: 'type', typ: u$1(undefined, '') },
7124
+ ], false),
7125
+ WebConnectionProtocolMessage: o$1([
7126
+ { json: 'meta', js: 'meta', typ: r$1('ConnectionStepMetadata') },
7127
+ { json: 'payload', js: 'payload', typ: u$1(undefined, m$1('any')) },
7128
+ { json: 'type', js: 'type', typ: r$1('ConnectionStepMessageType') },
7129
+ ], false),
7130
+ ConnectionStepMetadata: o$1([
7131
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7132
+ { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: u$1(undefined, '') },
7133
+ ], false),
7134
+ AddContextListenerRequestMeta: o$1([
7135
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7136
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7137
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7138
+ ], false),
7139
+ AppIdentifier: o$1([
7140
+ { json: 'appId', js: 'appId', typ: '' },
7141
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$1(undefined, '') },
7142
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7143
+ ], 'any'),
7144
+ AddContextListenerRequestPayload: o$1([
7145
+ { json: 'channelId', js: 'channelId', typ: u$1(null, '') },
7146
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7147
+ ], false),
7148
+ AddContextListenerResponseMeta: o$1([
7149
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7150
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7151
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7152
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7153
+ ], false),
7154
+ AddContextListenerResponsePayload: o$1([
7155
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7156
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7157
+ ], false),
7158
+ AddEventListenerRequestPayload: o$1([{ json: 'type', js: 'type', typ: u$1(r$1('FDC3EventType'), null) }], false),
7159
+ AddEventListenerResponsePayload: o$1([
7160
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7161
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7162
+ ], false),
7163
+ PayloadObject: o$1([
7164
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FluffyError')) },
7165
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7166
+ ], 'any'),
7167
+ AgentResponseMessageMeta: o$1([
7168
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7169
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7170
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7171
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7172
+ ], false),
7173
+ AgentResponseMessageResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) }], 'any'),
7174
+ AppRequestMessageMeta: o$1([
7175
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7176
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7177
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7178
+ ], false),
7179
+ BroadcastEventPayload: o$1([
7180
+ { json: 'channelId', js: 'channelId', typ: u$1(null, '') },
7181
+ { json: 'context', js: 'context', typ: r$1('Context') },
7182
+ { json: 'originatingApp', js: 'originatingApp', typ: u$1(undefined, r$1('AppIdentifier')) },
7183
+ ], false),
7184
+ Context: o$1([
7185
+ { json: 'id', js: 'id', typ: u$1(undefined, m$1('any')) },
7186
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7187
+ { json: 'type', js: 'type', typ: '' },
7188
+ ], 'any'),
7189
+ BroadcastResponseResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) }], 'any'),
7190
+ ChannelChangedEventPayload: o$1([{ json: 'newChannelId', js: 'newChannelId', typ: u$1(null, '') }], false),
7191
+ CreatePrivateChannelResponsePayload: o$1([
7192
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7193
+ { json: 'privateChannel', js: 'privateChannel', typ: u$1(undefined, r$1('Channel')) },
7194
+ ], false),
7195
+ Channel: o$1([
7196
+ { json: 'displayMetadata', js: 'displayMetadata', typ: u$1(undefined, r$1('DisplayMetadata')) },
7197
+ { json: 'id', js: 'id', typ: '' },
7198
+ { json: 'type', js: 'type', typ: r$1('Type') },
7199
+ ], false),
7200
+ DisplayMetadata: o$1([
7201
+ { json: 'color', js: 'color', typ: u$1(undefined, '') },
7202
+ { json: 'glyph', js: 'glyph', typ: u$1(undefined, '') },
7203
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7204
+ ], false),
7205
+ Fdc3UserInterfaceChannelSelectedPayload: o$1([{ json: 'selected', js: 'selected', typ: u$1(null, '') }], false),
7206
+ Fdc3UserInterfaceChannelsPayload: o$1([
7207
+ { json: 'selected', js: 'selected', typ: u$1(null, '') },
7208
+ { json: 'userChannels', js: 'userChannels', typ: a$1(r$1('Channel')) },
7209
+ ], false),
7210
+ InitialCSS: o$1([
7211
+ { json: 'bottom', js: 'bottom', typ: u$1(undefined, '') },
7212
+ { json: 'height', js: 'height', typ: u$1(undefined, '') },
7213
+ { json: 'left', js: 'left', typ: u$1(undefined, '') },
7214
+ { json: 'maxHeight', js: 'maxHeight', typ: u$1(undefined, '') },
7215
+ { json: 'maxWidth', js: 'maxWidth', typ: u$1(undefined, '') },
7216
+ { json: 'right', js: 'right', typ: u$1(undefined, '') },
7217
+ { json: 'top', js: 'top', typ: u$1(undefined, '') },
7218
+ { json: 'transition', js: 'transition', typ: u$1(undefined, '') },
7219
+ { json: 'width', js: 'width', typ: u$1(undefined, '') },
7220
+ { json: 'zIndex', js: 'zIndex', typ: u$1(undefined, '') },
7221
+ ], 'any'),
7222
+ Fdc3UserInterfaceMessage: o$1([
7223
+ { json: 'payload', js: 'payload', typ: u$1(undefined, m$1('any')) },
7224
+ { json: 'type', js: 'type', typ: r$1('Fdc3UserInterfaceMessageType') },
7225
+ ], false),
7226
+ IntentMetadata: o$1([
7227
+ { json: 'displayName', js: 'displayName', typ: u$1(undefined, '') },
7228
+ { json: 'name', js: 'name', typ: '' },
7229
+ ], false),
7230
+ Fdc3UserInterfaceResolveActionPayload: o$1([
7231
+ { json: 'action', js: 'action', typ: r$1('Action') },
7232
+ { json: 'appIdentifier', js: 'appIdentifier', typ: u$1(undefined, r$1('AppIdentifier')) },
7233
+ { json: 'intent', js: 'intent', typ: u$1(undefined, '') },
7234
+ ], false),
7235
+ UpdatedCSS: o$1([
7236
+ { json: 'bottom', js: 'bottom', typ: u$1(undefined, '') },
7237
+ { json: 'height', js: 'height', typ: u$1(undefined, '') },
7238
+ { json: 'left', js: 'left', typ: u$1(undefined, '') },
7239
+ { json: 'maxHeight', js: 'maxHeight', typ: u$1(undefined, '') },
7240
+ { json: 'maxWidth', js: 'maxWidth', typ: u$1(undefined, '') },
7241
+ { json: 'right', js: 'right', typ: u$1(undefined, '') },
7242
+ { json: 'top', js: 'top', typ: u$1(undefined, '') },
7243
+ { json: 'transition', js: 'transition', typ: u$1(undefined, '') },
7244
+ { json: 'width', js: 'width', typ: u$1(undefined, '') },
7245
+ { json: 'zIndex', js: 'zIndex', typ: u$1(undefined, '') },
7246
+ ], 'any'),
7247
+ FindInstancesResponsePayload: o$1([
7248
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7249
+ { json: 'appIdentifiers', js: 'appIdentifiers', typ: u$1(undefined, a$1(r$1('AppMetadata'))) },
7250
+ ], false),
7251
+ FindIntentRequestPayload: o$1([
7252
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7253
+ { json: 'intent', js: 'intent', typ: '' },
7254
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, '') },
7255
+ ], false),
7256
+ FindIntentResponsePayload: o$1([
7257
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7258
+ { json: 'appIntent', js: 'appIntent', typ: u$1(undefined, r$1('AppIntent')) },
7259
+ ], false),
7260
+ FindIntentsByContextRequestPayload: o$1([
7261
+ { json: 'context', js: 'context', typ: r$1('Context') },
7262
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, '') },
7263
+ ], false),
7264
+ FindIntentsByContextResponsePayload: o$1([
7265
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7266
+ { json: 'appIntents', js: 'appIntents', typ: u$1(undefined, a$1(r$1('AppIntent'))) },
7267
+ ], false),
7268
+ GetAppMetadataResponsePayload: o$1([
7269
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7270
+ { json: 'appMetadata', js: 'appMetadata', typ: u$1(undefined, r$1('AppMetadata')) },
7271
+ ], false),
7272
+ GetCurrentChannelResponsePayload: o$1([
7273
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7274
+ { json: 'channel', js: 'channel', typ: u$1(undefined, u$1(r$1('Channel'), null)) },
7275
+ ], false),
7276
+ GetCurrentContextRequestPayload: o$1([
7277
+ { json: 'channelId', js: 'channelId', typ: '' },
7278
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7279
+ ], false),
7280
+ GetCurrentContextResponsePayload: o$1([
7281
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7282
+ { json: 'context', js: 'context', typ: u$1(undefined, u$1(null, r$1('Context'))) },
7283
+ ], false),
7284
+ GetInfoResponsePayload: o$1([
7285
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7286
+ { json: 'implementationMetadata', js: 'implementationMetadata', typ: u$1(undefined, r$1('ImplementationMetadata')) },
7287
+ ], false),
7288
+ GetOrCreateChannelResponsePayload: o$1([
7289
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7290
+ { json: 'channel', js: 'channel', typ: u$1(undefined, r$1('Channel')) },
7291
+ ], false),
7292
+ GetUserChannelsResponsePayload: o$1([
7293
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7294
+ { json: 'userChannels', js: 'userChannels', typ: u$1(undefined, a$1(r$1('Channel'))) },
7295
+ ], false),
7296
+ IntentEventPayload: o$1([
7297
+ { json: 'context', js: 'context', typ: r$1('Context') },
7298
+ { json: 'intent', js: 'intent', typ: '' },
7299
+ { json: 'originatingApp', js: 'originatingApp', typ: u$1(undefined, r$1('AppIdentifier')) },
7300
+ { json: 'raiseIntentRequestUuid', js: 'raiseIntentRequestUuid', typ: '' },
7301
+ ], false),
7302
+ IntentResult: o$1([
7303
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7304
+ { json: 'channel', js: 'channel', typ: u$1(undefined, r$1('Channel')) },
7305
+ ], false),
7306
+ JoinUserChannelResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7307
+ LeaveCurrentChannelResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7308
+ OpenRequestPayload: o$1([
7309
+ { json: 'app', js: 'app', typ: r$1('AppIdentifier') },
7310
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7311
+ ], false),
7312
+ OpenResponsePayload: o$1([
7313
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('OpenErrorResponsePayload')) },
7314
+ { json: 'appIdentifier', js: 'appIdentifier', typ: u$1(undefined, r$1('AppIdentifier')) },
7315
+ ], false),
7316
+ PrivateChannelAddEventListenerRequestPayload: o$1([
7317
+ { json: 'listenerType', js: 'listenerType', typ: u$1(r$1('PrivateChannelEventType'), null) },
7318
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7319
+ ], false),
7320
+ PrivateChannelAddEventListenerResponsePayload: o$1([
7321
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7322
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7323
+ ], false),
7324
+ PrivateChannelDisconnectResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7325
+ PrivateChannelOnAddContextListenerEventPayload: o$1([
7326
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7327
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7328
+ ], false),
7329
+ PrivateChannelOnUnsubscribeEventPayload: o$1([
7330
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7331
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7332
+ ], false),
7333
+ RaiseIntentForContextRequestPayload: o$1([
7334
+ { json: 'app', js: 'app', typ: u$1(undefined, r$1('AppIdentifier')) },
7335
+ { json: 'context', js: 'context', typ: r$1('Context') },
7336
+ ], false),
7337
+ RaiseIntentForContextResponsePayload: o$1([
7338
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7339
+ { json: 'intentResolution', js: 'intentResolution', typ: u$1(undefined, r$1('IntentResolution')) },
7340
+ { json: 'appIntents', js: 'appIntents', typ: u$1(undefined, a$1(r$1('AppIntent'))) },
7341
+ ], false),
7342
+ RaiseIntentRequestPayload: o$1([
7343
+ { json: 'app', js: 'app', typ: u$1(undefined, r$1('AppIdentifier')) },
7344
+ { json: 'context', js: 'context', typ: r$1('Context') },
7345
+ { json: 'intent', js: 'intent', typ: '' },
7346
+ ], false),
7347
+ RaiseIntentResponsePayload: o$1([
7348
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7349
+ { json: 'intentResolution', js: 'intentResolution', typ: u$1(undefined, r$1('IntentResolution')) },
7350
+ { json: 'appIntent', js: 'appIntent', typ: u$1(undefined, r$1('AppIntent')) },
7351
+ ], false),
7352
+ RaiseIntentResultResponsePayload: o$1([
7353
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7354
+ { json: 'intentResult', js: 'intentResult', typ: u$1(undefined, r$1('IntentResult')) },
7355
+ ], false)});
7356
+
7357
+ // To parse this data:
7358
+ //
7359
+ // import { Convert, AgentErrorResponseMessage, AgentRequestMessage, AgentResponseMessage, BridgeErrorResponseMessage, BridgeRequestMessage, BridgeResponseMessage, BroadcastAgentRequest, BroadcastBridgeRequest, ConnectionStepMessage, ConnectionStep2Hello, ConnectionStep3Handshake, ConnectionStep4AuthenticationFailed, ConnectionStep6ConnectedAgentsUpdate, FindInstancesAgentErrorResponse, FindInstancesAgentRequest, FindInstancesAgentResponse, FindInstancesBridgeErrorResponse, FindInstancesBridgeRequest, FindInstancesBridgeResponse, FindIntentAgentErrorResponse, FindIntentAgentRequest, FindIntentAgentResponse, FindIntentBridgeErrorResponse, FindIntentBridgeRequest, FindIntentBridgeResponse, FindIntentsByContextAgentErrorResponse, FindIntentsByContextAgentRequest, FindIntentsByContextAgentResponse, FindIntentsByContextBridgeErrorResponse, FindIntentsByContextBridgeRequest, FindIntentsByContextBridgeResponse, GetAppMetadataAgentErrorResponse, GetAppMetadataAgentRequest, GetAppMetadataAgentResponse, GetAppMetadataBridgeErrorResponse, GetAppMetadataBridgeRequest, GetAppMetadataBridgeResponse, OpenAgentErrorResponse, OpenAgentRequest, OpenAgentResponse, OpenBridgeErrorResponse, OpenBridgeRequest, OpenBridgeResponse, PrivateChannelBroadcastAgentRequest, PrivateChannelBroadcastBridgeRequest, PrivateChannelEventListenerAddedAgentRequest, PrivateChannelEventListenerAddedBridgeRequest, PrivateChannelEventListenerRemovedAgentRequest, PrivateChannelEventListenerRemovedBridgeRequest, PrivateChannelOnAddContextListenerAgentRequest, PrivateChannelOnAddContextListenerBridgeRequest, PrivateChannelOnDisconnectAgentRequest, PrivateChannelOnDisconnectBridgeRequest, PrivateChannelOnUnsubscribeAgentRequest, PrivateChannelOnUnsubscribeBridgeRequest, RaiseIntentAgentErrorResponse, RaiseIntentAgentRequest, RaiseIntentAgentResponse, RaiseIntentBridgeErrorResponse, RaiseIntentBridgeRequest, RaiseIntentBridgeResponse, RaiseIntentResultAgentErrorResponse, RaiseIntentResultAgentResponse, RaiseIntentResultBridgeErrorResponse, RaiseIntentResultBridgeResponse } from "./file";
6501
7360
  //
6502
- // const fDC3DesktopAgentAPISchema = Convert.toFDC3DesktopAgentAPISchema(json);
6503
7361
  // const agentErrorResponseMessage = Convert.toAgentErrorResponseMessage(json);
6504
7362
  // const agentRequestMessage = Convert.toAgentRequestMessage(json);
6505
7363
  // const agentResponseMessage = Convert.toAgentResponseMessage(json);
@@ -6508,7 +7366,7 @@
6508
7366
  // const bridgeResponseMessage = Convert.toBridgeResponseMessage(json);
6509
7367
  // const broadcastAgentRequest = Convert.toBroadcastAgentRequest(json);
6510
7368
  // const broadcastBridgeRequest = Convert.toBroadcastBridgeRequest(json);
6511
- // const bridgingCommons = Convert.toBridgingCommons(json);
7369
+ // const bridgeCommonDefinitions = Convert.toBridgeCommonDefinitions(json);
6512
7370
  // const connectionStepMessage = Convert.toConnectionStepMessage(json);
6513
7371
  // const connectionStep2Hello = Convert.toConnectionStep2Hello(json);
6514
7372
  // const connectionStep3Handshake = Convert.toConnectionStep3Handshake(json);
@@ -6566,17 +7424,439 @@
6566
7424
  // const raiseIntentResultAgentResponse = Convert.toRaiseIntentResultAgentResponse(json);
6567
7425
  // const raiseIntentResultBridgeErrorResponse = Convert.toRaiseIntentResultBridgeErrorResponse(json);
6568
7426
  // const raiseIntentResultBridgeResponse = Convert.toRaiseIntentResultBridgeResponse(json);
6569
- // const context = Convert.toContext(json);
6570
7427
  //
6571
7428
  // These functions will throw an error if the JSON doesn't
6572
7429
  // match the expected interface, even if the JSON is valid.
6573
7430
  // Converts JSON strings to/from your types
6574
7431
  // and asserts the results of JSON.parse at runtime
7432
+ function a(typ) {
7433
+ return { arrayItems: typ };
7434
+ }
7435
+ function u(...typs) {
7436
+ return { unionMembers: typs };
7437
+ }
7438
+ function o(props, additional) {
7439
+ return { props, additional };
7440
+ }
7441
+ function m(additional) {
7442
+ return { props: [], additional };
7443
+ }
7444
+ function r(name) {
7445
+ return { ref: name };
7446
+ }
7447
+ ({
7448
+ AgentRequestMetadata: o([
7449
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7450
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7451
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7452
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7453
+ ], false),
7454
+ BridgeParticipantIdentifier: o([
7455
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7456
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7457
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7458
+ ], 'any'),
7459
+ SourceIdentifier: o([
7460
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7461
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7462
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7463
+ ], 'any'),
7464
+ ResponseErrorMessagePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('ResponseErrorDetail')) }], 'any'),
7465
+ BridgeRequestMetadata: o([
7466
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7467
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7468
+ { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') },
7469
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7470
+ ], false),
7471
+ BridgeResponseMessageMeta: o([
7472
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7473
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7474
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7475
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7476
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7477
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7478
+ ], false),
7479
+ SourceObject: o([
7480
+ { json: 'appId', js: 'appId', typ: '' },
7481
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7482
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7483
+ ], 'any'),
7484
+ Context: o([
7485
+ { json: 'id', js: 'id', typ: u(undefined, m('any')) },
7486
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7487
+ { json: 'type', js: 'type', typ: '' },
7488
+ ], 'any'),
7489
+ MetaSource: o([
7490
+ { json: 'appId', js: 'appId', typ: '' },
7491
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7492
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7493
+ ], 'any'),
7494
+ ConnectionStepMetadata: o([
7495
+ { json: 'requestUuid', js: 'requestUuid', typ: u(undefined, '') },
7496
+ { json: 'responseUuid', js: 'responseUuid', typ: u(undefined, '') },
7497
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7498
+ ], false),
7499
+ ConnectionStep2HelloPayload: o([
7500
+ { json: 'authRequired', js: 'authRequired', typ: true },
7501
+ { json: 'authToken', js: 'authToken', typ: u(undefined, '') },
7502
+ { json: 'desktopAgentBridgeVersion', js: 'desktopAgentBridgeVersion', typ: '' },
7503
+ { json: 'supportedFDC3Versions', js: 'supportedFDC3Versions', typ: a('') },
7504
+ ], false),
7505
+ ConnectionStep3HandshakePayload: o([
7506
+ { json: 'authToken', js: 'authToken', typ: u(undefined, '') },
7507
+ { json: 'channelsState', js: 'channelsState', typ: m(a(r('Context'))) },
7508
+ { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ConnectingAgentImplementationMetadata') },
7509
+ { json: 'requestedName', js: 'requestedName', typ: '' },
7510
+ ], false),
7511
+ ConnectingAgentImplementationMetadata: o([
7512
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7513
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') },
7514
+ { json: 'provider', js: 'provider', typ: '' },
7515
+ { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') },
7516
+ ], false),
7517
+ ConnectionStep4AuthenticationFailedPayload: o([{ json: 'message', js: 'message', typ: u(undefined, '') }], false),
7518
+ ConnectionStep6ConnectedAgentsUpdatePayload: o([
7519
+ { json: 'addAgent', js: 'addAgent', typ: u(undefined, '') },
7520
+ { json: 'allAgents', js: 'allAgents', typ: a(r('DesktopAgentImplementationMetadata')) },
7521
+ { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('Context')))) },
7522
+ { json: 'removeAgent', js: 'removeAgent', typ: u(undefined, '') },
7523
+ ], false),
7524
+ DesktopAgentImplementationMetadata: o([
7525
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7526
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7527
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') },
7528
+ { json: 'provider', js: 'provider', typ: '' },
7529
+ { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') },
7530
+ ], false),
7531
+ FindInstancesAgentRequestMeta: o([
7532
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7533
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7534
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7535
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7536
+ ], false),
7537
+ DestinationObject: o([
7538
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7539
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7540
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7541
+ ], 'any'),
7542
+ AppIdentifier: o([
7543
+ { json: 'appId', js: 'appId', typ: '' },
7544
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7545
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7546
+ ], 'any'),
7547
+ AppMetadata: o([
7548
+ { json: 'appId', js: 'appId', typ: '' },
7549
+ { json: 'description', js: 'description', typ: u(undefined, '') },
7550
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7551
+ { json: 'icons', js: 'icons', typ: u(undefined, a(r('Icon'))) },
7552
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7553
+ { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) },
7554
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7555
+ { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) },
7556
+ { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('Image'))) },
7557
+ { json: 'title', js: 'title', typ: u(undefined, '') },
7558
+ { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') },
7559
+ { json: 'version', js: 'version', typ: u(undefined, '') },
7560
+ ], false),
7561
+ Icon: o([
7562
+ { json: 'size', js: 'size', typ: u(undefined, '') },
7563
+ { json: 'src', js: 'src', typ: '' },
7564
+ { json: 'type', js: 'type', typ: u(undefined, '') },
7565
+ ], false),
7566
+ Image: o([
7567
+ { json: 'label', js: 'label', typ: u(undefined, '') },
7568
+ { json: 'size', js: 'size', typ: u(undefined, '') },
7569
+ { json: 'src', js: 'src', typ: '' },
7570
+ { json: 'type', js: 'type', typ: u(undefined, '') },
7571
+ ], false),
7572
+ FindInstancesBridgeRequestMeta: o([
7573
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7574
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7575
+ { json: 'source', js: 'source', typ: r('MetaSourceObject') },
7576
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7577
+ ], false),
7578
+ MetaSourceObject: o([
7579
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7580
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7581
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7582
+ ], 'any'),
7583
+ FindIntentAgentRequestMeta: o([
7584
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7585
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7586
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7587
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7588
+ ], false),
7589
+ FindIntentAgentRequestPayload: o([
7590
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7591
+ { json: 'intent', js: 'intent', typ: '' },
7592
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7593
+ ], false),
7594
+ IntentMetadata: o([
7595
+ { json: 'displayName', js: 'displayName', typ: u(undefined, '') },
7596
+ { json: 'name', js: 'name', typ: '' },
7597
+ ], false),
7598
+ FindIntentBridgeRequestMeta: o([
7599
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7600
+ { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') },
7601
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7602
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7603
+ ], false),
7604
+ FindIntentBridgeRequestPayload: o([
7605
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7606
+ { json: 'intent', js: 'intent', typ: '' },
7607
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7608
+ ], false),
7609
+ FindIntentBridgeResponseMeta: o([
7610
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7611
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7612
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7613
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7614
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7615
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7616
+ ], false),
7617
+ FindIntentsByContextAgentRequestMeta: o([
7618
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7619
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7620
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7621
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7622
+ ], false),
7623
+ FindIntentsByContextAgentRequestPayload: o([
7624
+ { json: 'context', js: 'context', typ: r('Context') },
7625
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7626
+ ], false),
7627
+ FindIntentsByContextBridgeRequestMeta: o([
7628
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7629
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7630
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7631
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7632
+ ], false),
7633
+ FindIntentsByContextBridgeRequestPayload: o([
7634
+ { json: 'context', js: 'context', typ: r('Context') },
7635
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7636
+ ], false),
7637
+ FindIntentsByContextBridgeResponseMeta: o([
7638
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7639
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7640
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7641
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7642
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7643
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7644
+ ], false),
7645
+ GetAppMetadataAgentRequestMeta: o([
7646
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7647
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7648
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7649
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7650
+ ], false),
7651
+ AppObject: o([
7652
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7653
+ { json: 'appId', js: 'appId', typ: '' },
7654
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7655
+ ], 'any'),
7656
+ GetAppMetadataBridgeRequestMeta: o([
7657
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7658
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7659
+ { json: 'source', js: 'source', typ: r('MetaSourceObject') },
7660
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7661
+ ], false),
7662
+ GetAppMetadataBridgeResponseMeta: o([
7663
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7664
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7665
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7666
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7667
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7668
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7669
+ ], false),
7670
+ OpenAgentRequestMeta: o([
7671
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7672
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7673
+ { json: 'source', js: 'source', typ: r('SourceObject') },
7674
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7675
+ ], false),
7676
+ OpenAgentRequestPayload: o([
7677
+ { json: 'app', js: 'app', typ: r('AppToOpen') },
7678
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7679
+ ], false),
7680
+ AppToOpen: o([
7681
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7682
+ { json: 'appId', js: 'appId', typ: '' },
7683
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7684
+ ], 'any'),
7685
+ OpenBridgeRequestMeta: o([
7686
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7687
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7688
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7689
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7690
+ ], false),
7691
+ OpenBridgeRequestPayload: o([
7692
+ { json: 'app', js: 'app', typ: r('AppToOpen') },
7693
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7694
+ ], false),
7695
+ OpenBridgeResponseMeta: o([
7696
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7697
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7698
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7699
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7700
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7701
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7702
+ ], false),
7703
+ PrivateChannelBroadcastAgentRequestMeta: o([
7704
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7705
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7706
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7707
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7708
+ ], false),
7709
+ MetaDestination: o([
7710
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7711
+ { json: 'appId', js: 'appId', typ: '' },
7712
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7713
+ ], 'any'),
7714
+ PrivateChannelBroadcastBridgeRequestMeta: o([
7715
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7716
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7717
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7718
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7719
+ ], false),
7720
+ PrivateChannelEventListenerAddedAgentRequestMeta: o([
7721
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7722
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7723
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7724
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7725
+ ], false),
7726
+ PrivateChannelEventListenerAddedBridgeRequestMeta: o([
7727
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7728
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7729
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7730
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7731
+ ], false),
7732
+ PrivateChannelEventListenerRemovedAgentRequestMeta: o([
7733
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7734
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7735
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7736
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7737
+ ], false),
7738
+ PrivateChannelEventListenerRemovedBridgeRequestMeta: o([
7739
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7740
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7741
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7742
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7743
+ ], false),
7744
+ PrivateChannelOnAddContextListenerAgentRequestMeta: o([
7745
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7746
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7747
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7748
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7749
+ ], false),
7750
+ PrivateChannelOnAddContextListenerAgentRequestPayload: o([
7751
+ { json: 'channelId', js: 'channelId', typ: '' },
7752
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7753
+ ], false),
7754
+ PrivateChannelOnAddContextListenerBridgeRequestMeta: o([
7755
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7756
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7757
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7758
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7759
+ ], false),
7760
+ PrivateChannelOnAddContextListenerBridgeRequestPayload: o([
7761
+ { json: 'channelId', js: 'channelId', typ: '' },
7762
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7763
+ ], false),
7764
+ PrivateChannelOnDisconnectAgentRequestMeta: o([
7765
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7766
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7767
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7768
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7769
+ ], false),
7770
+ PrivateChannelOnDisconnectBridgeRequestMeta: o([
7771
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7772
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7773
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7774
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7775
+ ], false),
7776
+ PrivateChannelOnUnsubscribeAgentRequestMeta: o([
7777
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7778
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7779
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7780
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7781
+ ], false),
7782
+ PrivateChannelOnUnsubscribeAgentRequestPayload: o([
7783
+ { json: 'channelId', js: 'channelId', typ: '' },
7784
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7785
+ ], false),
7786
+ ERequestMetadata: o([
7787
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7788
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7789
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7790
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7791
+ ], false),
7792
+ PrivateChannelOnUnsubscribeBridgeRequestPayload: o([
7793
+ { json: 'channelId', js: 'channelId', typ: '' },
7794
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7795
+ ], false),
7796
+ AppDestinationIdentifier: o([
7797
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7798
+ { json: 'appId', js: 'appId', typ: '' },
7799
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7800
+ ], 'any'),
7801
+ RaiseIntentBridgeResponseMeta: o([
7802
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7803
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7804
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7805
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7806
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7807
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7808
+ ], false),
7809
+ IntentResult: o([
7810
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7811
+ { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) },
7812
+ ], false),
7813
+ Channel: o([
7814
+ { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadata')) },
7815
+ { json: 'id', js: 'id', typ: '' },
7816
+ { json: 'type', js: 'type', typ: r('Type') },
7817
+ ], false),
7818
+ DisplayMetadata: o([
7819
+ { json: 'color', js: 'color', typ: u(undefined, '') },
7820
+ { json: 'glyph', js: 'glyph', typ: u(undefined, '') },
7821
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7822
+ ], false),
7823
+ RaiseIntentResultBridgeResponseMeta: o([
7824
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7825
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7826
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7827
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7828
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7829
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7830
+ ], false)});
6575
7831
 
6576
7832
  /**
6577
7833
  * SPDX-License-Identifier: Apache-2.0
6578
7834
  * Copyright FINOS FDC3 contributors - see NOTICE file
6579
7835
  */
7836
+ /**
7837
+ * Contains constants representing the errors that can be encountered when trying to connect to a web-based Desktop Agent with the getAgent function.
7838
+ */
7839
+ var AgentError;
7840
+ (function (AgentError) {
7841
+ /** Returned if no Desktop Agent was found by any means available or
7842
+ * if the Agent previously connected to is not contactable on a
7843
+ * subsequent connection attempt.*/
7844
+ AgentError["AgentNotFound"] = "AgentNotFound";
7845
+ /** Returned if validation of the app identity by the Desktop Agent
7846
+ * Failed or the app is not being allowed to connect to the Desktop Agent
7847
+ * for another reason. */
7848
+ AgentError["AccessDenied"] = "AccessDenied";
7849
+ /** Returned if an error or exception occurs while trying to set
7850
+ * up communication with a Desktop Agent. */
7851
+ AgentError["ErrorOnConnect"] = "ErrorOnConnect";
7852
+ /** Returned if the failover function is not a function, or it did not
7853
+ * resolve to one of the allowed types. */
7854
+ AgentError["InvalidFailover"] = "InvalidFailover";
7855
+ /** Returned if an API call rejects after a timeout. Used where an API call
7856
+ * is not aligned to another error enumeration.
7857
+ */
7858
+ AgentError["ApiTimeout"] = "ApiTimeout";
7859
+ })(AgentError || (AgentError = {}));
6580
7860
  /** Constants representing the errors that can be encountered when calling the `open` method on the DesktopAgent object (`fdc3`). */
6581
7861
  var OpenError;
6582
7862
  (function (OpenError) {
@@ -6592,6 +7872,8 @@
6592
7872
  OpenError["MalformedContext"] = "MalformedContext";
6593
7873
  /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/
6594
7874
  OpenError["DesktopAgentNotFound"] = "DesktopAgentNotFound";
7875
+ /** Returned if a timeout occurs before a call to open is resolved for any reason other than the not adding its context listener in time.*/
7876
+ OpenError["ApiTimeout"] = "ApiTimeout";
6595
7877
  })(OpenError || (OpenError = {}));
6596
7878
  /** Constants representing the errors that can be encountered when calling the `findIntent`, `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */
6597
7879
  var ResolveError;
@@ -6614,6 +7896,8 @@
6614
7896
  ResolveError["MalformedContext"] = "MalformedContext";
6615
7897
  /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/
6616
7898
  ResolveError["DesktopAgentNotFound"] = "DesktopAgentNotFound";
7899
+ /** Returned if a timeout occurs before the API call is resolved for any reason other than the resolver timing out (use ResolverTimeout) or an app launched by a raiseIntent function doesn't add its intent listener in time (use IntentDeliveryFailed).*/
7900
+ ResolveError["ApiTimeout"] = "ApiTimeout";
6617
7901
  })(ResolveError || (ResolveError = {}));
6618
7902
  var ResultError;
6619
7903
  (function (ResultError) {
@@ -6621,6 +7905,8 @@
6621
7905
  ResultError["NoResultReturned"] = "NoResultReturned";
6622
7906
  /** Returned if the Intent handler function processing the raised intent throws an error or rejects the Promise it returned. */
6623
7907
  ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
7908
+ /** Returned if a timeout occurs before the getResult() API call is resolved.*/
7909
+ ResultError["ApiTimeout"] = "ApiTimeout";
6624
7910
  })(ResultError || (ResultError = {}));
6625
7911
  var ChannelError;
6626
7912
  (function (ChannelError) {
@@ -6632,6 +7918,8 @@
6632
7918
  ChannelError["CreationFailed"] = "CreationFailed";
6633
7919
  /** Returned if a call to the `broadcast` functions is made with an invalid context argument. Contexts should be Objects with at least a `type` field that has a `string` value.*/
6634
7920
  ChannelError["MalformedContext"] = "MalformedContext";
7921
+ /** Returned if a timeout occurs before any Channel related API call is resolved.*/
7922
+ ChannelError["ApiTimeout"] = "ApiTimeout";
6635
7923
  })(ChannelError || (ChannelError = {}));
6636
7924
  var BridgingError;
6637
7925
  (function (BridgingError) {
@@ -6644,28 +7932,51 @@
6644
7932
  /** @experimental Returned if a message to a Bridge deviates from the schema for that message sufficiently that it could not be processed. */
6645
7933
  BridgingError["MalformedMessage"] = "MalformedMessage";
6646
7934
  })(BridgingError || (BridgingError = {}));
6647
-
6648
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
6649
- var e = new Error(message);
6650
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
6651
- };
7935
+
7936
+ /**
7937
+ * Type representing the different log-levels that can be set.
7938
+ */
7939
+ var LogLevel;
7940
+ (function (LogLevel) {
7941
+ LogLevel[LogLevel["NONE"] = 0] = "NONE";
7942
+ LogLevel[LogLevel["ERROR"] = 1] = "ERROR";
7943
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
7944
+ LogLevel[LogLevel["INFO"] = 3] = "INFO";
7945
+ LogLevel[LogLevel["DEBUG"] = 4] = "DEBUG";
7946
+ })(LogLevel || (LogLevel = {}));
7947
+ /** Enumeration of values used to describe types of web-based
7948
+ * Desktop Agent. Each 'type' refers to the means by which
7949
+ * a connection to the agent is made and/or an interface to it
7950
+ * received. */
7951
+ var WebDesktopAgentType;
7952
+ (function (WebDesktopAgentType) {
7953
+ /** Denotes Desktop Agents that inject the FDC3 interface
7954
+ * at `window.fdc3`. */
7955
+ WebDesktopAgentType["Preload"] = "PRELOAD";
7956
+ /** Denotes Desktop Agents that run (or provide an interface)
7957
+ * within a parent window or frame, a reference to which
7958
+ * will be found at `window.opener`, `window.parent`,
7959
+ * `window.parent.opener` etc. */
7960
+ WebDesktopAgentType["ProxyParent"] = "PROXY_PARENT";
7961
+ /** Denotes Desktop Agents that are connected to by loading a URL
7962
+ * into a hidden iframe whose URL was returned by a parent window
7963
+ * or frame. */
7964
+ WebDesktopAgentType["ProxyUrl"] = "PROXY_URL";
7965
+ /** Denotes a Desktop Agent that was returned by a failover
7966
+ * function that was passed by the application. */
7967
+ WebDesktopAgentType["Failover"] = "FAILOVER";
7968
+ })(WebDesktopAgentType || (WebDesktopAgentType = {}));
6652
7969
 
6653
7970
  /**
6654
7971
  * Ensures at compile time that the given string tuple is exhaustive on a given union type, i.e. contains ALL possible values of the given UNION_TYPE.
6655
7972
  */
6656
- var exhaustiveStringTuple = function () { return function () {
6657
- var tuple = [];
6658
- for (var _i = 0; _i < arguments.length; _i++) {
6659
- tuple[_i] = arguments[_i];
6660
- }
6661
- return tuple;
6662
- }; };
7973
+ const exhaustiveStringTuple = () => (...tuple) => tuple;
6663
7974
 
6664
- var STANDARD_CONTEXT_TYPES = exhaustiveStringTuple()('fdc3.action', 'fdc3.chart', 'fdc3.chat.initSettings', 'fdc3.chat.message', 'fdc3.chat.room', 'fdc3.chat.searchCriteria', 'fdc3.contact', 'fdc3.contactList', 'fdc3.country', 'fdc3.currency', 'fdc3.email', 'fdc3.instrument', 'fdc3.instrumentList', 'fdc3.interaction', 'fdc3.message', 'fdc3.organization', 'fdc3.portfolio', 'fdc3.position', 'fdc3.nothing', 'fdc3.timeRange', 'fdc3.transactionResult', 'fdc3.valuation');
7975
+ const STANDARD_CONTEXT_TYPES = exhaustiveStringTuple()('fdc3.action', 'fdc3.chart', 'fdc3.chat.initSettings', 'fdc3.chat.message', 'fdc3.chat.room', 'fdc3.chat.searchCriteria', 'fdc3.contact', 'fdc3.contactList', 'fdc3.country', 'fdc3.currency', 'fdc3.email', 'fdc3.instrument', 'fdc3.instrumentList', 'fdc3.interaction', 'fdc3.message', 'fdc3.organization', 'fdc3.portfolio', 'fdc3.position', 'fdc3.nothing', 'fdc3.timeRange', 'fdc3.transactionResult', 'fdc3.valuation');
6665
7976
  // used internally to check if a given intent/context is a standard one
6666
7977
  new Set(STANDARD_CONTEXT_TYPES);
6667
7978
 
6668
- var STANDARD_INTENTS = exhaustiveStringTuple()('CreateInteraction', 'SendChatMessage', 'StartCall', 'StartChat', 'StartEmail', 'ViewAnalysis', 'ViewChat', 'ViewChart', 'ViewContact', 'ViewHoldings', 'ViewInstrument', 'ViewInteractions', 'ViewMessages', 'ViewNews', 'ViewOrders', 'ViewProfile', 'ViewQuote', 'ViewResearch');
7979
+ const STANDARD_INTENTS = exhaustiveStringTuple()('CreateInteraction', 'CreateOrUpdateProfile', 'SendChatMessage', 'StartCall', 'StartChat', 'StartEmail', 'ViewAnalysis', 'ViewChat', 'ViewChart', 'ViewContact', 'ViewHoldings', 'ViewInstrument', 'ViewInteractions', 'ViewMessages', 'ViewNews', 'ViewOrders', 'ViewProfile', 'ViewQuote', 'ViewResearch');
6669
7980
  // used internally to check if a given intent/context is a standard one
6670
7981
  new Set(STANDARD_INTENTS);
6671
7982
 
@@ -6709,6 +8020,7 @@
6709
8020
  var Intents;
6710
8021
  (function (Intents) {
6711
8022
  Intents["CreateInteraction"] = "CreateInteraction";
8023
+ Intents["CreateOrUpdateProfile"] = "CreateOrUpdateProfile";
6712
8024
  Intents["SendChatMessage"] = "SendChatMessage";
6713
8025
  Intents["StartCall"] = "StartCall";
6714
8026
  Intents["StartChat"] = "StartChat";
@@ -6728,6 +8040,90 @@
6728
8040
  Intents["ViewResearch"] = "ViewResearch";
6729
8041
  })(Intents || (Intents = {}));
6730
8042
 
8043
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8044
+ //check if color is supported in (node) console;
8045
+ let noColor = true;
8046
+ //else only occurs in a browser and can't be tested in node
8047
+ /* istanbul ignore if */
8048
+ if (typeof process !== 'undefined') {
8049
+ const argv = process.argv || /* istanbul ignore next */ [];
8050
+ const env = process.env || /* istanbul ignore next */ {};
8051
+ noColor =
8052
+ (!!env.NO_COLOR || argv.includes('--no-color')) &&
8053
+ !(!!env.FORCE_COLOR ||
8054
+ argv.includes('--color') ||
8055
+ process.platform === 'win32' /* istanbul ignore next */ ||
8056
+ ((process.stdout || {}).isTTY && env.TERM !== 'dumb') ||
8057
+ /* istanbul ignore next */ !!env.CI);
8058
+ }
8059
+ class AbstractFDC3Logger {
8060
+ /** This should be overridden by sub-classes to set the prefix applied
8061
+ * to log messages. */
8062
+ /* istanbul ignore next */ static get prefix() {
8063
+ return '';
8064
+ }
8065
+ //sub-classes should override this default log level
8066
+ static logLevel = LogLevel.DEBUG;
8067
+ static setLogLevel(level) {
8068
+ if (level in LogLevel) {
8069
+ this.logLevel = level;
8070
+ }
8071
+ else {
8072
+ /* istanbul ignore next */
8073
+ this.error(`Ignoring unrecognized LogLevel '${level}'! Current log level: '${this.logLevel} (${LogLevel[this.logLevel]})'`);
8074
+ }
8075
+ }
8076
+ static debugColor(value) {
8077
+ return noColor ? /* istanbul ignore next */ value : '\x1b[30m\x1b[2m' + value + '\x1b[22m\x1b[39m';
8078
+ }
8079
+ static logColor(value) {
8080
+ return noColor ? /* istanbul ignore next */ value : '\x1b[32m\x1b[2m' + value + '\x1b[22m\x1b[39m';
8081
+ }
8082
+ static warnColor(value) {
8083
+ return noColor ? /* istanbul ignore next */ value : '\x1b[33m' + value + '\x1b[39m';
8084
+ }
8085
+ static errorColor(value) {
8086
+ return noColor ? /* istanbul ignore next */ value : '\x1b[31m' + value + '\x1b[39m';
8087
+ }
8088
+ static debug(...params) {
8089
+ if (this.logLevel >= LogLevel.DEBUG) {
8090
+ console.debug(...this.prefixAndColorize(this.prefix, params, this.debugColor));
8091
+ }
8092
+ }
8093
+ static log(...params) {
8094
+ if (this.logLevel >= LogLevel.INFO) {
8095
+ console.log(...this.prefixAndColorize(this.prefix, params, this.logColor));
8096
+ }
8097
+ }
8098
+ static warn(...params) {
8099
+ if (this.logLevel >= LogLevel.WARN) {
8100
+ console.warn(...this.prefixAndColorize(this.prefix, params, this.warnColor));
8101
+ }
8102
+ }
8103
+ static error(...params) {
8104
+ if (this.logLevel >= LogLevel.ERROR) {
8105
+ console.error(...this.prefixAndColorize(this.prefix, params, this.errorColor));
8106
+ }
8107
+ }
8108
+ static prefixAndColorize = (prefix, params, colorFn) => {
8109
+ const prefixed = [prefix, ...params];
8110
+ return prefixed.map(value => {
8111
+ if (typeof value === 'string') {
8112
+ //just color strings
8113
+ return colorFn(value);
8114
+ }
8115
+ else if (value && value.stack && value.message) {
8116
+ //probably an error
8117
+ return colorFn(value.stack);
8118
+ }
8119
+ else {
8120
+ //something else... lets hope it stringifies
8121
+ return colorFn(JSON.stringify(value, null, 2));
8122
+ }
8123
+ });
8124
+ };
8125
+ }
8126
+
6731
8127
  class DesktopAgent {
6732
8128
  intentsController;
6733
8129
  applicationController;
@@ -6741,6 +8137,7 @@
6741
8137
  const api = {
6742
8138
  getStartupContext: this.getStartupContext.bind(this),
6743
8139
  addContextListener: this.addContextListener.bind(this),
8140
+ addEventListener: this.addEventListener.bind(this),
6744
8141
  addIntentListener: this.addIntentListener.bind(this),
6745
8142
  broadcast: this.broadcast.bind(this),
6746
8143
  createPrivateChannel: this.createPrivateChannel.bind(this),
@@ -6882,6 +8279,13 @@
6882
8279
  async leaveCurrentChannels() {
6883
8280
  return this.channelsController.leave(generateCommandId());
6884
8281
  }
8282
+ async addEventListener(type, handler) {
8283
+ optionalFdc3EventTypesDecoder.runWithException(type);
8284
+ if (typeof handler !== "function") {
8285
+ throw new Error("Please provide the handler as a function!");
8286
+ }
8287
+ return this.channelsController.addEventListener({ commandId: generateCommandId(), type, handler });
8288
+ }
6885
8289
  }
6886
8290
 
6887
8291
  class AppChannel {
@@ -6999,13 +8403,13 @@
6999
8403
  async addContextListener(contextType, handler) {
7000
8404
  if (arguments.length === 1) {
7001
8405
  if (typeof contextType !== "function") {
7002
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof contextType}` };
8406
+ throw new Error(ChannelError.AccessDenied);
7003
8407
  }
7004
8408
  return this.channelsController.addContextListener({ commandId: generateCommandId(), handler: contextType, channelId: this.id });
7005
8409
  }
7006
8410
  const contextTypeDecoder = optionalNonEmptyStringDecoder.runWithException(contextType);
7007
8411
  if (typeof handler !== "function") {
7008
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
8412
+ throw new Error(ChannelError.AccessDenied);
7009
8413
  }
7010
8414
  return this.channelsController.addContextListener({ commandId: generateCommandId(), handler, contextType: contextTypeDecoder, channelId: this.id });
7011
8415
  }
@@ -7036,6 +8440,22 @@
7036
8440
  };
7037
8441
  return subHandler;
7038
8442
  };
8443
+ const parseHandlerToEventHandler = ({ handler, eventType, contextType }) => {
8444
+ const eventHandler = (event) => {
8445
+ const { type, details } = event;
8446
+ if (eventType && type !== eventType) {
8447
+ return;
8448
+ }
8449
+ if (contextType) {
8450
+ if (details.type === contextType) {
8451
+ handler(details, details.metadata);
8452
+ }
8453
+ return;
8454
+ }
8455
+ handler(details, details.metadata);
8456
+ };
8457
+ return eventHandler;
8458
+ };
7039
8459
 
7040
8460
  class IntentsController {
7041
8461
  glueController;
@@ -7073,11 +8493,11 @@
7073
8493
  this.logger?.info(`[${commandId}] - findIntent() invoked for intent ${intent} with contextType ${context?.type} and resultType ${resultType}`);
7074
8494
  const glueIntents = await this.glueController.findIntents({ name: intent });
7075
8495
  if (!glueIntents.length) {
7076
- throw { message: ResolveError.NoAppsFound, reason: `There are no apps handling the passed intent ${intent}` };
8496
+ throw new Error(ResolveError.NoAppsFound);
7077
8497
  }
7078
8498
  const searchedGlueIntent = glueIntents.find((glueIntent) => glueIntent.name === intent);
7079
8499
  if (!searchedGlueIntent) {
7080
- throw { message: ResolveError.NoAppsFound, reason: `There are no apps handling the passed intent ${intent}` };
8500
+ throw new Error(ResolveError.NoAppsFound);
7081
8501
  }
7082
8502
  if (!context && !resultType) {
7083
8503
  return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
@@ -7085,7 +8505,7 @@
7085
8505
  const contextType = (context && context.type === fdc3NothingContextType) ? undefined : context?.type;
7086
8506
  const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
7087
8507
  if (!filteredIntent.handlers.length) {
7088
- throw { message: ResolveError.NoAppsFound, reason: `No apps handling intent ${intent} with contextType ${context?.type} and resultType ${resultType}` };
8508
+ throw new Error(ResolveError.NoAppsFound);
7089
8509
  }
7090
8510
  return this.convertGlue42IntentToFDC3Intent(filteredIntent);
7091
8511
  }
@@ -7094,7 +8514,7 @@
7094
8514
  this.logger?.info(`[${commandId}] - findIntentsByContext() invoked for context type ${context.type} and resultType ${resultType}`);
7095
8515
  const glueIntents = await this.glueController.findIntents({ contextType: context.type, resultType });
7096
8516
  if (!glueIntents.length) {
7097
- throw { message: ResolveError.NoAppsFound, reason: `No apps registering intent with contextType ${context.type} ${resultType ? `and resultType ${resultType}` : ""}` };
8517
+ throw new Error(ResolveError.NoAppsFound);
7098
8518
  }
7099
8519
  this.logger?.info(`[${commandId}] - parsing glue intents to fdc3 intents and returning`);
7100
8520
  return glueIntents.map((glueIntent) => {
@@ -7104,11 +8524,12 @@
7104
8524
  }
7105
8525
  async raiseIntent({ commandId, intent, context, target }) {
7106
8526
  await this.glueController.gluePromise;
7107
- this.logger?.info(`[${commandId}] - raiseIntent() invoked for intent ${intent} with contextType: ${context.type} and target: ${target}`);
8527
+ this.logger?.info(`[${commandId}] - raiseIntent() invoked for intent ${intent} with contextType: ${context.type} and target: ${JSON.stringify(target)}`);
7108
8528
  const glueContext = { type: context.type, data: { ...context } };
7109
8529
  const searchedGlueIntent = (await this.glueController.findIntents({ name: intent })).find(glueIntent => glueIntent.name === intent);
8530
+ this.logger?.info(`[${commandId}] - searchedGlueIntent: ${JSON.stringify(searchedGlueIntent)}`);
7110
8531
  if (!searchedGlueIntent) {
7111
- throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
8532
+ throw new Error(ResolveError.NoAppsFound);
7112
8533
  }
7113
8534
  if (!target) {
7114
8535
  const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
@@ -7116,14 +8537,17 @@
7116
8537
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
7117
8538
  }
7118
8539
  if (target?.instanceId) {
7119
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
7120
- return this.invokeRaiseIntent(commandId, {
7121
- intent,
7122
- context: glueContext,
7123
- target: { instance: target.instanceId }
7124
- });
8540
+ return this.raiseIntentToInstanceTarget({ intent, context: glueContext, target: { instance: target.instanceId } }, searchedGlueIntent.handlers, target, commandId);
7125
8541
  }
7126
8542
  const targetAppName = typeof target === "string" ? target : target.appId;
8543
+ const appHandlersWithAppId = searchedGlueIntent.handlers.filter((handler) => handler.applicationName === targetAppName);
8544
+ if (!appHandlersWithAppId.length) {
8545
+ throw new Error(ResolveError.TargetAppUnavailable);
8546
+ }
8547
+ const appHandlersWithContextType = appHandlersWithAppId.filter((handler) => !handler.instanceId && handler.contextTypes?.includes(context.type));
8548
+ if (!appHandlersWithContextType.length) {
8549
+ throw new Error(ResolveError.NoAppsFound);
8550
+ }
7127
8551
  return this.invokeRaiseIntent(commandId, {
7128
8552
  intent,
7129
8553
  context: glueContext,
@@ -7173,7 +8597,23 @@
7173
8597
  await this.glueController.gluePromise;
7174
8598
  this.logger?.info(`[${commandId}] - addIntentListener() invoked for intent ${intent}`);
7175
8599
  const wrappedHandler = this.getWrappedIntentHandler(handler);
7176
- return this.glueController.addIntentListener(intent, wrappedHandler);
8600
+ const unsub = await this.glueController.addIntentListener(intent, wrappedHandler);
8601
+ return getListenerWithAsyncUnsubscribe(unsub.unsubscribe);
8602
+ }
8603
+ raiseIntentToInstanceTarget(request, glueHandlers, target, commandId) {
8604
+ this.logger?.info(`[${commandId}] - raising intent ${request.intent} with contextType ${request.context?.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
8605
+ const handlersWithSameAppName = glueHandlers.filter((handler) => handler.applicationName === target.appId);
8606
+ const handlersWithSameContext = this.getGlueIntentWithFilteredHandlers({ name: request.intent, handlers: handlersWithSameAppName }, { contextType: request.context?.type }).handlers;
8607
+ if (!handlersWithSameContext.length) {
8608
+ this.logger?.info(`[${commandId}] - No handlers found for intent ${request.intent} with appName ${target.appId} and contextType ${request.context?.type}`);
8609
+ throw new Error(ResolveError.NoAppsFound);
8610
+ }
8611
+ const isValidInstanceHandler = handlersWithSameContext.find((handler) => handler.instanceId === target.instanceId);
8612
+ if (!isValidInstanceHandler) {
8613
+ this.logger?.info(`[${commandId}] - There's no instance with id ${target.instanceId} of the passed app ${target.appId}`);
8614
+ throw new Error(ResolveError.TargetInstanceUnavailable);
8615
+ }
8616
+ return this.invokeRaiseIntent(commandId, request);
7177
8617
  }
7178
8618
  async checkForRememberedIntentHandlerForContext(contextType) {
7179
8619
  let prefs;
@@ -7216,12 +8656,12 @@
7216
8656
  const app = this.glueController.getApplication(appName);
7217
8657
  const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
7218
8658
  if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
7219
- throw { message: ResolveError.TargetAppUnavailable, reason: `There's no app with appId ${appName}` };
8659
+ throw new Error(ResolveError.TargetAppUnavailable);
7220
8660
  }
7221
8661
  this.logger?.info(`[${commandId}] - target app ${appName} found. Filtering handlers by applicationName: ${appName}`);
7222
8662
  const validHandlersByApplicationName = intent.handlers.filter((handler) => handler.applicationName === appName);
7223
8663
  if (!validHandlersByApplicationName.length) {
7224
- throw { message: ResolveError.NoAppsFound, reason: `Intent ${intent.name} exists but there's no app with appId ${appName} registering it` };
8664
+ throw new Error(ResolveError.NoAppsFound);
7225
8665
  }
7226
8666
  if (!instanceId) {
7227
8667
  this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
@@ -7231,12 +8671,12 @@
7231
8671
  ? app.instances.find((inst) => inst.id === instanceId)
7232
8672
  : serverInstances.find((inst) => inst.instance === instanceId);
7233
8673
  if (!isValidInstanceOfTheApp) {
7234
- throw { message: ResolveError.TargetInstanceUnavailable, reason: `There's no instance with id ${instanceId} of the passed app ${appName}` };
8674
+ throw new Error(ResolveError.TargetInstanceUnavailable);
7235
8675
  }
7236
8676
  this.logger?.info(`[${commandId}] - Filtering handlers by instanceId: ${instanceId}`);
7237
8677
  const validHandlersByInstanceId = validHandlersByApplicationName.filter((handler) => handler.instanceId === instanceId);
7238
8678
  if (!validHandlersByInstanceId.length) {
7239
- throw { message: ResolveError.IntentDeliveryFailed, reason: `There's no instance with id ${instanceId} of app ${appName} registering intent ${intent.name}` };
8679
+ throw new Error(ResolveError.IntentDeliveryFailed);
7240
8680
  }
7241
8681
  return { name: intent.name, handlers: validHandlersByInstanceId };
7242
8682
  }
@@ -7248,7 +8688,7 @@
7248
8688
  filterIntentHandlersByContext(intent, context) {
7249
8689
  const filteredGlueIntent = this.getGlueIntentWithFilteredHandlers(intent, { contextType: context.type });
7250
8690
  if (!filteredGlueIntent.handlers.length) {
7251
- throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent with the passed context type ${context.type}` };
8691
+ throw new Error(ResolveError.NoAppsFound);
7252
8692
  }
7253
8693
  return filteredGlueIntent;
7254
8694
  }
@@ -7300,15 +8740,17 @@
7300
8740
  apps: handlers.map((handler) => {
7301
8741
  const appName = handler.applicationName;
7302
8742
  const app = this.glueController.getApplication(appName);
8743
+ const icons = (handler.applicationIcon ? [handler.applicationIcon, ...(app?.userProperties.icons ?? [])] : (app?.userProperties.icons ?? [])).filter((icon) => !!icon).map((icon) => ({ src: icon }));
8744
+ const images = (app?.userProperties.images ?? []).filter((image) => !!image).map((image) => ({ src: image }));
7303
8745
  return {
7304
8746
  appId: appName,
7305
8747
  instanceId: handler.instanceId,
7306
8748
  name: appName,
7307
8749
  title: handler.applicationTitle || handler.instanceTitle || appName,
7308
- tooltip: app?.userProperties.tooltip || `${appName} (${handler.type})`,
8750
+ tooltip: app?.userProperties.tooltip ?? `${appName} (${handler.type})`,
7309
8751
  description: handler.applicationDescription,
7310
- icons: handler.applicationIcon ? [handler.applicationIcon, ...(app?.userProperties.icons || [])] : app?.userProperties.icons,
7311
- images: app?.userProperties.images,
8752
+ icons,
8753
+ images,
7312
8754
  resultType: handler.resultType
7313
8755
  };
7314
8756
  })
@@ -7370,8 +8812,9 @@
7370
8812
  return { name, handlers: filteredHandlers };
7371
8813
  }
7372
8814
  async invokeRaiseIntent(commandId, request) {
8815
+ const inBrowser = this.glueController.isRunningInBrowser();
7373
8816
  try {
7374
- const glueIntentResult = await this.glueController.raiseIntent({ ...request, timeout: RaiseTimeoutMs });
8817
+ const glueIntentResult = await this.glueController.raiseIntent({ ...request, timeout: RaiseTimeoutMs, options: { waitForAGMReady: !inBrowser } });
7375
8818
  return {
7376
8819
  source: {
7377
8820
  appId: glueIntentResult.handler.applicationName,
@@ -7382,7 +8825,7 @@
7382
8825
  };
7383
8826
  }
7384
8827
  catch (error) {
7385
- throw this.parseIoToFdc3Error(error);
8828
+ throw new Error(this.parseIoToFdc3Error(error).message);
7386
8829
  }
7387
8830
  }
7388
8831
  parseIoToFdc3Error(error) {
@@ -7396,10 +8839,7 @@
7396
8839
  this.logger?.info(`[${commandId}] - raiseIntentForContext() invoked with contextType ${context.type} and target ${target}`);
7397
8840
  const appIntents = await this.findIntentsByContext({ commandId, context });
7398
8841
  if (!appIntents || appIntents.length === 0) {
7399
- throw {
7400
- message: ResolveError.NoAppsFound,
7401
- reason: `No apps registering intent with contextType ${context.type} ${target ? `and target ${JSON.stringify(target)}` : ""}`
7402
- };
8842
+ throw new Error(ResolveError.NoAppsFound);
7403
8843
  }
7404
8844
  return this.raiseIntent({ commandId, intent: appIntents[0].intent.name, context, target });
7405
8845
  }
@@ -7424,50 +8864,51 @@
7424
8864
  }
7425
8865
  async open({ commandId, target, context }) {
7426
8866
  await this.glueController.gluePromise;
7427
- this.logger?.log(`[${commandId}] - open() invoked with target ${target} ${context ? `and contextType ${context.type}` : ""}`);
8867
+ this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
7428
8868
  const name = typeof target === "object" ? target.appId : target;
7429
8869
  const app = this.glueController.getApplication(name);
7430
8870
  if (!app) {
7431
- throw { message: OpenError.AppNotFound, reason: `Cannot find targeted ${name} application` };
8871
+ throw new Error(OpenError.AppNotFound);
7432
8872
  }
7433
8873
  if (context) {
7434
8874
  await this.glueEventsController.initializeCollaborateMethod();
7435
- this.logger?.info(`[${commandId}] - opening app ${app} with startup context`);
8875
+ this.logger?.info(`[${commandId}] - opening app '${app.name}' with startup context`);
7436
8876
  return this.openAppWithContext(app, context);
7437
8877
  }
7438
8878
  try {
7439
- this.logger?.info(`[${commandId}] - opening app ${app}`);
7440
- const glueInst = await app.start();
8879
+ this.logger?.info(`[${commandId}] - opening app '${app.name}' without context`);
8880
+ const inBrowser = this.glueController.isRunningInBrowser();
8881
+ const glueInst = await app.start(undefined, { waitForAGMReady: !inBrowser });
7441
8882
  this.logger?.info(`[${commandId}] - instance with id ${glueInst.id} started`);
7442
8883
  return this.parseGlueInstToAppIdentifier(glueInst);
7443
8884
  }
7444
8885
  catch (error) {
7445
- throw { message: OpenError.ErrorOnLaunch, reason: typeof error === "string" ? error : JSON.stringify(error) };
8886
+ throw new Error(OpenError.ErrorOnLaunch);
7446
8887
  }
7447
8888
  }
7448
8889
  async findInstances({ commandId, appIdentifier }) {
7449
8890
  await this.glueController.gluePromise;
7450
- this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${appIdentifier}`);
8891
+ this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
7451
8892
  const { appId } = appIdentifier;
7452
8893
  const app = this.glueController.getApplication(appId);
7453
8894
  if (!app) {
7454
- throw { message: ResolveError.NoAppsFound, reason: `App with appId: ${appId} does not exist` };
8895
+ throw new Error(ResolveError.NoAppsFound);
7455
8896
  }
7456
8897
  const glueInstances = this.glueController.getApplicationInstances(appId);
7457
8898
  const fdc3Instances = glueInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
7458
- this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${appIdentifier}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
8899
+ this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
7459
8900
  return fdc3Instances;
7460
8901
  }
7461
8902
  async getAppMetadata({ commandId, appIdentifier }) {
7462
8903
  await this.glueController.gluePromise;
7463
- this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${appIdentifier}`);
8904
+ this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
7464
8905
  const { appId, instanceId } = appIdentifier;
7465
8906
  const app = this.glueController.getApplication(appId);
7466
8907
  if (!app) {
7467
- throw { message: OpenError.AppNotFound, reason: `Cannot find application with appId: ${appId}` };
8908
+ throw new Error(OpenError.AppNotFound);
7468
8909
  }
7469
8910
  if (!instanceId) {
7470
- this.logger?.info(`[${commandId}] - no opened instances found. Parsing app ${app}`);
8911
+ this.logger?.info(`[${commandId}] - no opened instances found. Parsing app ${app.name}`);
7471
8912
  return this.parseGlueAppToAppMetadata(app);
7472
8913
  }
7473
8914
  const instance = this.glueController.getAppInstanceById(instanceId);
@@ -7495,10 +8936,13 @@
7495
8936
  }
7496
8937
  getCurrentAppMetadata() {
7497
8938
  const myInstance = this.glueController.interopInstance();
7498
- return {
7499
- appId: myInstance.applicationName,
7500
- instanceId: myInstance.instance
7501
- };
8939
+ const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
8940
+ const myApp = this.glueController.getApplication(myInstanceApplicationName);
8941
+ if (myApp) {
8942
+ return { appId: myApp.name, instanceId: myInstance.instance };
8943
+ }
8944
+ this.logger?.info(`No application found with name ${myInstanceApplicationName} probably because it's an iframe.`);
8945
+ return { appId: myInstanceApplicationName, instanceId: myInstance.instance };
7502
8946
  }
7503
8947
  parseGlueInstToAppIdentifier(glueInst) {
7504
8948
  return {
@@ -7542,24 +8986,26 @@
7542
8986
  const startContext = this.buildStartContext(context, guid);
7543
8987
  const wrappedPromise = this.createContextListenerWrappedPromise(app);
7544
8988
  this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
8989
+ const inBrowser = this.glueController.isRunningInBrowser();
7545
8990
  try {
7546
- const glueInst = await app.start(startContext);
8991
+ const glueInst = await app.start(startContext, { waitForAGMReady: !inBrowser });
7547
8992
  await wrappedPromise.promise;
7548
8993
  this.appsStateStore.removeOpenAppPromise(guid);
7549
8994
  return this.parseGlueInstToAppIdentifier(glueInst);
7550
8995
  }
7551
8996
  catch (error) {
7552
8997
  this.appsStateStore.removeOpenAppPromise(guid);
7553
- throw { message: OpenError.AppTimeout, reason: typeof error === "string" ? error : JSON.stringify(error) };
8998
+ throw new Error(OpenError.AppTimeout);
7554
8999
  }
7555
9000
  }
7556
9001
  buildStartContext(fdc3Context, guid) {
7557
9002
  const myInteropInstance = this.glueController.getMyInteropInstance();
9003
+ const appId = myInteropInstance.application || myInteropInstance.applicationName || "";
7558
9004
  return {
7559
9005
  fdc3: {
7560
9006
  collaborationId: guid,
7561
9007
  openApp: {
7562
- appId: myInteropInstance.application || myInteropInstance.applicationName || "",
9008
+ appId,
7563
9009
  instanceId: myInteropInstance.instance
7564
9010
  },
7565
9011
  context: {
@@ -7793,7 +9239,8 @@
7793
9239
  this.isCreator = isCreator;
7794
9240
  this.id = channelId;
7795
9241
  const myServerInstance = this.channelsController.getMyServerInstance();
7796
- this.myAppMetadata = { source: { appId: myServerInstance.applicationName, instanceId: myServerInstance.instance } };
9242
+ const myAppId = myServerInstance.application || myServerInstance.applicationName;
9243
+ this.myAppMetadata = { source: { appId: myAppId, instanceId: myServerInstance.instance } };
7797
9244
  }
7798
9245
  toApi() {
7799
9246
  const api = {
@@ -7803,10 +9250,11 @@
7803
9250
  broadcast: this.broadcast.bind(this),
7804
9251
  getCurrentContext: this.getCurrentContext.bind(this),
7805
9252
  addContextListener: this.addContextListener.bind(this),
7806
- onAddContextListener: this.onAddContextListener.bind(this),
7807
- onUnsubscribe: this.onUnsubscribe.bind(this),
7808
- onDisconnect: this.onDisconnect.bind(this),
9253
+ onAddContextListener: this.legacyOnAddContextListener.bind(this),
9254
+ onUnsubscribe: this.legacyOnUnsubscribe.bind(this),
9255
+ onDisconnect: this.legacyOnDisconnect.bind(this),
7809
9256
  disconnect: this.disconnect.bind(this),
9257
+ addEventListener: this.addEventListener.bind(this),
7810
9258
  };
7811
9259
  return api;
7812
9260
  }
@@ -7822,54 +9270,62 @@
7822
9270
  }
7823
9271
  async handleCollaboratorJoin(collaborator, commandId) {
7824
9272
  this.setCollaborator(collaborator, commandId);
7825
- await Promise.all(this.myListenerTypesBeforeBound.map((contextType) => {
7826
- const listenerAddedArgs = {
7827
- action: "addedContextListenerOnPrivateChannel",
7828
- correlationId: this.id,
7829
- collaborationObject: {
7830
- channelId: this.id,
7831
- contextType: contextType || undefined
7832
- }
7833
- };
7834
- this.logger?.trace(`[${commandId}] - announcing ${"addedContextListenerOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7835
- return this.channelsController.invokeSystemMethod(listenerAddedArgs, this.collaborator?.instanceId);
7836
- })).catch((err) => this.logger?.error(err));
9273
+ await Promise.all(this.myListenerTypesBeforeBound.map((contextType) => this.sendCollaborateMessage({ action: "addedContextListenerOnPrivateChannel", contextType }))).catch((err) => this.logger?.error(err));
7837
9274
  }
7838
9275
  handleCollaboratorBroadcast(context, metadata, commandId) {
7839
9276
  this.logger?.trace(`[${commandId}] - heard context with type ${context.type} broadcasted on the channel`);
7840
9277
  this.lastBroadcastedContextType = context.type;
7841
9278
  this.broadcastedContexts[context.type] = { context, metadata };
7842
9279
  this.logger?.trace(`[${commandId}] - invoking all context listeners`);
7843
- this.registry.execute(PrivateChannelEventMethods.ListenerAdded, context, metadata);
9280
+ this.executeCollaboratorBroadcastEvents(context, metadata);
7844
9281
  }
7845
9282
  handleCollaboratorAddContextListener(contextType, commandId) {
7846
9283
  this.logger?.trace(`[${commandId}] - heard collaborator added context listener for type ${contextType}`);
7847
9284
  this.collaboratorListenerTypes.push(contextType);
7848
- this.registry.execute(PrivateChannelEventMethods.OnAddContextListener, contextType);
9285
+ this.executeCollaboratorAddContextListenerEvents(contextType);
7849
9286
  }
7850
9287
  handleCollaboratorRemovedListener(contextType, commandId) {
7851
9288
  this.logger?.trace(`[${commandId}] - heard collaborator removed context listener with type ${contextType}`);
7852
- const index = this.collaboratorListenerTypes.indexOf(contextType);
7853
- this.collaboratorListenerTypes.splice(index, 1);
7854
- this.registry.execute(PrivateChannelEventMethods.OnUnsubscribe, contextType);
9289
+ this.collaboratorListenerTypes.splice(this.collaboratorListenerTypes.indexOf(contextType), 1);
9290
+ this.executeCollaboratorUnsubscribeEvents(contextType);
7855
9291
  }
7856
9292
  handleCollaboratorDisconnect() {
7857
9293
  this.disconnected = true;
7858
- this.collaboratorListenerTypes.forEach((contextType) => this.registry.execute(PrivateChannelEventMethods.OnUnsubscribe, contextType));
7859
- this.registry.execute(PrivateChannelEventMethods.OnDisconnect);
9294
+ this.executeCollaboratorDisconnectEvents();
7860
9295
  }
7861
9296
  async announceJoin(targetInstance, commandId) {
7862
- const joinChannelArgs = {
7863
- action: "joinPrivateChannel",
7864
- correlationId: this.id,
7865
- collaborationObject: {
7866
- channelId: this.id
7867
- }
7868
- };
7869
- this.logger?.trace(`[${commandId}] - announcing ${"joinPrivateChannel"} to target instance with id ${JSON.stringify(targetInstance)}`);
7870
- await this.channelsController.invokeSystemMethod(joinChannelArgs, targetInstance);
9297
+ await this.sendCollaborateMessage({ action: "joinPrivateChannel" });
7871
9298
  this.logger?.trace(`[${commandId}] - collaborator received ${"joinPrivateChannel"} action`);
7872
9299
  }
9300
+ async addEventListener(type, handler) {
9301
+ const decodedType = optionalPrivateChannelEventTypesDecoder.run(type);
9302
+ if (!decodedType.ok) {
9303
+ this.logger?.error(`Expected first argument 'type' as one of ${Object.values(NewPrivateChannelEventMethods).join(", ")}, got ${type}`);
9304
+ throw new Error(ChannelError.AccessDenied);
9305
+ }
9306
+ if (typeof handler !== "function") {
9307
+ this.logger?.error(`Expected function as an argument, got ${typeof handler}`);
9308
+ throw new Error(ChannelError.AccessDenied);
9309
+ }
9310
+ const commandId = generateCommandId();
9311
+ this.ensureAlive(commandId);
9312
+ this.logger?.trace(`[${commandId}] - adding event listener for type ${type}`);
9313
+ return this.addEventListenerByEventType(type, handler);
9314
+ }
9315
+ addEventListenerByEventType(type, handler) {
9316
+ const replayArgs = type === "addContextListener"
9317
+ ? this.collaboratorListenerTypes.map((contextType) => ({ type: NewPrivateChannelEventMethods.AddContextListener, details: { contextType } }))
9318
+ : undefined;
9319
+ if (type) {
9320
+ const unsubscribe = this.registry.add(type, handler, replayArgs);
9321
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
9322
+ }
9323
+ const addContextListener = this.addEventListenerByEventType("addContextListener", handler);
9324
+ const unsubscribeListener = this.addEventListenerByEventType("unsubscribe", handler);
9325
+ const disconnectListener = this.addEventListenerByEventType("disconnect", handler);
9326
+ const unsubscribe = () => [addContextListener, unsubscribeListener, disconnectListener].forEach((listener) => listener.unsubscribe());
9327
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
9328
+ }
7873
9329
  async broadcast(context) {
7874
9330
  const contextDecoderResult = contextDecoder.run(context);
7875
9331
  if (!contextDecoderResult.ok) {
@@ -7880,17 +9336,7 @@
7880
9336
  this.ensureBound(commandId, "broadcast");
7881
9337
  this.lastBroadcastedContextType = context.type;
7882
9338
  this.broadcastedContexts[context.type] = { context, metadata: this.myAppMetadata };
7883
- const broadcastArgs = {
7884
- action: "publishOnPrivateChannel",
7885
- correlationId: this.id,
7886
- collaborationObject: {
7887
- channelId: this.id,
7888
- contextType: context.type,
7889
- payload: context
7890
- }
7891
- };
7892
- this.logger?.trace(`[${commandId}] - announcing ${"publishOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7893
- await this.channelsController.invokeSystemMethod(broadcastArgs, this.collaborator?.instanceId);
9339
+ this.sendCollaborateMessage({ action: "publishOnPrivateChannel", contextType: context.type, payload: context });
7894
9340
  this.logger?.trace(`[${commandId}] - collaborator received context for action ${"publishOnPrivateChannel"}`);
7895
9341
  }
7896
9342
  async getCurrentContext(contextType) {
@@ -7902,7 +9348,10 @@
7902
9348
  if (!contextType && !this.lastBroadcastedContextType) {
7903
9349
  return null;
7904
9350
  }
7905
- const searchedType = contextType || this.lastBroadcastedContextType;
9351
+ const searchedType = contextType ?? this.lastBroadcastedContextType;
9352
+ if (!searchedType) {
9353
+ throw new Error("No context type specified and no last broadcasted context available");
9354
+ }
7906
9355
  this.logger?.trace(`[${commandId}] - Returning context with type ${searchedType}`);
7907
9356
  return this.broadcastedContexts[searchedType].context;
7908
9357
  }
@@ -7911,51 +9360,42 @@
7911
9360
  this.ensureAlive(commandId);
7912
9361
  optionalNonEmptyStringDecoder.runWithException(contextType);
7913
9362
  if (typeof handler !== "function") {
7914
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof contextType}` };
9363
+ throw new Error(ChannelError.AccessDenied);
7915
9364
  }
7916
9365
  this.logger?.trace(`[${commandId}] - adding subscription for broadcasted contexts with type: ${contextType}`);
7917
- const subHandler = (data, metadata) => {
7918
- if (contextType) {
7919
- if (data.type === contextType) {
7920
- handler(data, metadata);
7921
- }
7922
- return;
7923
- }
7924
- handler(data, metadata);
7925
- };
7926
- const lastBroadcastedContextPerType = this.retrieveLatestBroadcastedContextPerType(contextType);
7927
- const replayArgs = lastBroadcastedContextPerType ? [[lastBroadcastedContextPerType.context, lastBroadcastedContextPerType.metadata]] : undefined;
7928
- const unsub = this.registry.add(PrivateChannelEventMethods.ListenerAdded, subHandler, replayArgs);
9366
+ const unsub = this.addContextListenerInRegistry(contextType, handler);
7929
9367
  if (!this.collaborator) {
7930
9368
  this.myListenerTypesBeforeBound.push(contextType);
7931
9369
  const unsubscribe = this.getAddContextListenerUnsub(unsub, contextType, commandId);
7932
- return AsyncListener(unsubscribe);
9370
+ return { unsubscribe };
7933
9371
  }
7934
- const listenerAddedArgs = {
7935
- action: "addedContextListenerOnPrivateChannel",
7936
- correlationId: this.id,
7937
- collaborationObject: {
7938
- channelId: this.id,
7939
- contextType: contextType || undefined
7940
- }
7941
- };
7942
- this.logger?.trace(`[${commandId}] - announcing ${"addedContextListenerOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7943
- await this.channelsController.invokeSystemMethod(listenerAddedArgs, this.collaborator?.instanceId);
9372
+ await this.sendCollaborateMessage({ action: "addedContextListenerOnPrivateChannel", contextType });
7944
9373
  this.logger?.trace(`[${commandId}] - collaborator received action ${"addedContextListenerOnPrivateChannel"}`);
7945
9374
  const unsubscribe = this.getAddContextListenerUnsub(unsub, contextType, commandId);
7946
- return AsyncListener(unsubscribe);
9375
+ return { unsubscribe };
7947
9376
  }
9377
+ addContextListenerInRegistry = (contextType, handler) => {
9378
+ const legacySubHandler = parseContextHandler(handler, contextType);
9379
+ const lastBroadcastedContextPerType = this.retrieveLatestBroadcastedContextPerType(contextType);
9380
+ const legacyReplayArgs = lastBroadcastedContextPerType ? [[lastBroadcastedContextPerType.context, lastBroadcastedContextPerType.metadata]] : undefined;
9381
+ const legacyUnsub = this.registry.add(LegacyPrivateChannelEventMethods.ListenerAdded, legacySubHandler, legacyReplayArgs);
9382
+ const replayArgs = lastBroadcastedContextPerType ? [{ type: NewPrivateChannelEventMethods.ContextListenerAdded, details: { contextType: lastBroadcastedContextPerType.context.type, metadata: lastBroadcastedContextPerType.metadata } }] : undefined;
9383
+ const subHandler = parseHandlerToEventHandler({ handler, eventType: NewPrivateChannelEventMethods.ContextListenerAdded, contextType });
9384
+ const newUnsub = this.registry.add(NewPrivateChannelEventMethods.ContextListenerAdded, subHandler, replayArgs);
9385
+ const unsub = () => {
9386
+ legacyUnsub();
9387
+ newUnsub();
9388
+ };
9389
+ return unsub;
9390
+ };
7948
9391
  retrieveLatestBroadcastedContextPerType(contextType) {
7949
- if (!contextType && !this.lastBroadcastedContextType) {
7950
- return;
9392
+ if (contextType) {
9393
+ return this.broadcastedContexts[contextType];
7951
9394
  }
7952
- if (!contextType && this.lastBroadcastedContextType) {
7953
- return {
7954
- context: this.broadcastedContexts[this.lastBroadcastedContextType].context,
7955
- metadata: this.broadcastedContexts[this.lastBroadcastedContextType].metadata
7956
- };
9395
+ if (!this.lastBroadcastedContextType) {
9396
+ return;
7957
9397
  }
7958
- return this.broadcastedContexts[contextType];
9398
+ return this.broadcastedContexts[this.lastBroadcastedContextType];
7959
9399
  }
7960
9400
  getAddContextListenerUnsub(unsub, contextType, commandId) {
7961
9401
  return async () => {
@@ -7965,45 +9405,36 @@
7965
9405
  this.myListenerTypesBeforeBound.splice(index, 1);
7966
9406
  return;
7967
9407
  }
7968
- const unsubArgs = {
7969
- action: "removedContextListenerOnPrivateChannel",
7970
- correlationId: this.id,
7971
- collaborationObject: {
7972
- channelId: this.id,
7973
- contextType: contextType || undefined
7974
- }
7975
- };
7976
- this.logger?.trace(`[${commandId}] - announcing unsubscribe from context listener for type ${contextType}`);
7977
- await this.channelsController.invokeSystemMethod(unsubArgs, this.collaborator?.instanceId);
9408
+ await this.sendCollaborateMessage({ action: "removedContextListenerOnPrivateChannel", contextType });
7978
9409
  this.logger?.trace(`[${commandId}] - collaborator heard ${"removedContextListenerOnPrivateChannel"}`);
7979
9410
  };
7980
9411
  }
7981
- onAddContextListener(handler) {
9412
+ legacyOnAddContextListener(handler) {
7982
9413
  if (typeof handler !== "function") {
7983
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9414
+ throw new Error(ChannelError.AccessDenied);
7984
9415
  }
7985
9416
  const commandId = generateCommandId();
7986
9417
  this.ensureAlive(commandId);
7987
- const unsub = this.registry.add(PrivateChannelEventMethods.OnAddContextListener, handler, this.collaboratorListenerTypes);
7988
- return AsyncListener(unsub);
9418
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnAddContextListener, handler, this.collaboratorListenerTypes);
9419
+ return getListenerWithAsyncUnsubscribe(unsub);
7989
9420
  }
7990
- onUnsubscribe(handler) {
9421
+ legacyOnUnsubscribe(handler) {
7991
9422
  if (typeof handler !== "function") {
7992
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9423
+ throw new Error(ChannelError.AccessDenied);
7993
9424
  }
7994
9425
  const commandId = generateCommandId();
7995
9426
  this.ensureAlive(commandId);
7996
- const unsub = this.registry.add(PrivateChannelEventMethods.OnUnsubscribe, handler);
7997
- return AsyncListener(unsub);
9427
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnUnsubscribe, handler);
9428
+ return getListenerWithAsyncUnsubscribe(unsub);
7998
9429
  }
7999
- onDisconnect(handler) {
9430
+ legacyOnDisconnect(handler) {
8000
9431
  if (typeof handler !== "function") {
8001
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9432
+ throw new Error(ChannelError.AccessDenied);
8002
9433
  }
8003
9434
  const commandId = generateCommandId();
8004
9435
  this.ensureAlive(commandId);
8005
- const unsub = this.registry.add(PrivateChannelEventMethods.OnDisconnect, handler);
8006
- return AsyncListener(unsub);
9436
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnDisconnect, handler);
9437
+ return getListenerWithAsyncUnsubscribe(unsub);
8007
9438
  }
8008
9439
  async disconnect() {
8009
9440
  const commandId = generateCommandId();
@@ -8016,15 +9447,8 @@
8016
9447
  this.logger?.trace(`[${commandId}] - disconnect invoked`);
8017
9448
  this.disconnected = true;
8018
9449
  this.logger?.trace(`[${commandId}] - announcing ${"disconnectedFromPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
8019
- const disconnectArgs = {
8020
- action: "disconnectedFromPrivateChannel",
8021
- correlationId: this.id,
8022
- collaborationObject: {
8023
- channelId: this.id
8024
- }
8025
- };
8026
9450
  this.channelsController.removePrivateChannelFromStoreById(this.id);
8027
- await this.channelsController.invokeSystemMethod(disconnectArgs, this.collaborator?.instanceId);
9451
+ await this.sendCollaborateMessage({ action: "disconnectedFromPrivateChannel" });
8028
9452
  this.logger?.trace(`[${commandId}] - collaborator received action ${"disconnectedFromPrivateChannel"}`);
8029
9453
  if (this.unsubFromInstanceStopped) {
8030
9454
  this.unsubFromInstanceStopped();
@@ -8036,7 +9460,7 @@
8036
9460
  }
8037
9461
  const errorMsg = "Channel is disconnected - operation is no longer available";
8038
9462
  this.logger?.error(`[${commandId}] - ${errorMsg}`);
8039
- throw { message: ChannelError.AccessDenied, reason: errorMsg };
9463
+ throw new Error(ChannelError.AccessDenied);
8040
9464
  }
8041
9465
  ensureBound(commandId, operation) {
8042
9466
  if (this.collaborator) {
@@ -8044,7 +9468,7 @@
8044
9468
  }
8045
9469
  const errorMsg = `There's no collaborator on the other side of the channel - operation ${operation} is unavailable`;
8046
9470
  this.logger?.error(`[${commandId}] - ${errorMsg}`);
8047
- throw { message: ChannelError.AccessDenied, reason: errorMsg };
9471
+ throw new Error(ChannelError.AccessDenied);
8048
9472
  }
8049
9473
  subscribeForCollaboratorInstanceStop(commandId) {
8050
9474
  const handler = (instance) => {
@@ -8055,6 +9479,43 @@
8055
9479
  };
8056
9480
  this.unsubFromInstanceStopped = this.channelsController.subscribeOnInstanceStop(this.id, handler.bind(this), commandId);
8057
9481
  }
9482
+ async sendCollaborateMessage({ action, contextType, payload }) {
9483
+ const args = {
9484
+ action,
9485
+ correlationId: this.id,
9486
+ collaborationObject: {
9487
+ channelId: this.id,
9488
+ contextType,
9489
+ payload
9490
+ }
9491
+ };
9492
+ this.logger?.trace(`Sending '${action}' collaborate message ${JSON.stringify(args)} to collaborator ${JSON.stringify(this.collaborator)}`);
9493
+ await this.channelsController.invokeSystemMethod(args, this.collaborator?.instanceId);
9494
+ }
9495
+ executeCollaboratorAddContextListenerEvents(contextType) {
9496
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnAddContextListener, contextType);
9497
+ const event = { type: NewPrivateChannelEventMethods.AddContextListener, details: { contextType } };
9498
+ this.registry.execute(NewPrivateChannelEventMethods.AddContextListener, event);
9499
+ }
9500
+ executeCollaboratorBroadcastEvents(context, metadata) {
9501
+ this.registry.execute(LegacyPrivateChannelEventMethods.ListenerAdded, context, metadata);
9502
+ const event = {
9503
+ type: NewPrivateChannelEventMethods.ContextListenerAdded,
9504
+ details: { context, metadata }
9505
+ };
9506
+ this.registry.execute(NewPrivateChannelEventMethods.ContextListenerAdded, event);
9507
+ }
9508
+ executeCollaboratorUnsubscribeEvents(contextType) {
9509
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnUnsubscribe, contextType);
9510
+ const event = { type: NewPrivateChannelEventMethods.Unsubscribe, details: { contextType } };
9511
+ this.registry.execute(NewPrivateChannelEventMethods.Unsubscribe, event);
9512
+ }
9513
+ executeCollaboratorDisconnectEvents() {
9514
+ this.collaboratorListenerTypes.forEach((contextType) => this.executeCollaboratorUnsubscribeEvents(contextType));
9515
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnDisconnect);
9516
+ const event = { type: NewPrivateChannelEventMethods.Disconnect, details: {} };
9517
+ this.registry.execute(NewPrivateChannelEventMethods.Disconnect, event);
9518
+ }
8058
9519
  }
8059
9520
 
8060
9521
  class ChannelsFactory {
@@ -8256,7 +9717,7 @@
8256
9717
  const subHandler = parseContextHandler(handler, contextType);
8257
9718
  if (!channelIdToSubscribeTo || onMultiChannels) {
8258
9719
  const unsubscribe = this.glueController.channelsSubscribe(subHandler, contextType);
8259
- return { unsubscribe };
9720
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8260
9721
  }
8261
9722
  return this.addContextListenerByChannelId({ commandId, handler: subHandler, invokedOnChannelModel: !!channelId, channelId: channelIdToSubscribeTo, contextType });
8262
9723
  }
@@ -8429,6 +9890,14 @@
8429
9890
  this.logger?.info(`[${commandId}] - leaving channel '${ioChannelToLeave.name}'`);
8430
9891
  return this.glueController.leaveChannel({ channel: ioChannelToLeave.name });
8431
9892
  }
9893
+ async addEventListener({ commandId, type, handler }) {
9894
+ await this.initDonePromise;
9895
+ this.logger?.info(`[${commandId}] - addEventListener() invoked for event type ${type}`);
9896
+ if (!type || type === "userChannelChanged") {
9897
+ return this.subscribeForChannelChangedEvent(handler);
9898
+ }
9899
+ throw new Error(`Received unknown event type: ${type}`);
9900
+ }
8432
9901
  get logger() {
8433
9902
  if (!this._logger) {
8434
9903
  this._logger = this.glueController.initSubLogger("fdc3.channels.controller");
@@ -8466,7 +9935,7 @@
8466
9935
  }
8467
9936
  async handleWindowContextOnOpening(commandId, handler, contextType) {
8468
9937
  const myWindow = this.glueController.getMyWindow();
8469
- if (!myWindow) {
9938
+ if (!myWindow || !Object.keys(myWindow).length) {
8470
9939
  this.logger?.trace(`[${commandId}] - Cannot get window context because this is not a Glue window, it's probably an iframe`);
8471
9940
  this.invokeContextHandlerWithStartupContext = false;
8472
9941
  return;
@@ -8547,12 +10016,10 @@
8547
10016
  if (channelType === ChannelTypes.App) {
8548
10017
  this.logger?.info(`[${commandId}] - subscribing for fdc3 app channel with id ${channelId} (underlying glue context with same name)`);
8549
10018
  const unsubscribe = await this.glueController.contextsSubscribe(channelId, subHandler);
8550
- return {
8551
- unsubscribe: () => {
8552
- this.logger?.info(`[${commandId}] - invoking unsubscribe for app channel with id ${channelId}`);
8553
- unsubscribe();
8554
- }
8555
- };
10019
+ return getListenerWithAsyncUnsubscribe(() => {
10020
+ this.logger?.info(`[${commandId}] - invoking unsubscribe for app channel with id ${channelId}`);
10021
+ unsubscribe();
10022
+ });
8556
10023
  }
8557
10024
  this.logger?.error("Cannot add a context listener on an invalid channel");
8558
10025
  throw new Error(ChannelError.AccessDenied);
@@ -8569,6 +10036,28 @@
8569
10036
  this.logger?.error(`Channel with id: ${channelId} does not exist`);
8570
10037
  throw new Error(ChannelError.NoChannelFound);
8571
10038
  }
10039
+ subscribeForChannelChangedEvent(handler) {
10040
+ const wrappedCallback = async (channelName) => {
10041
+ if (!channelName) {
10042
+ this.invokeChannelChangedEventHandler(null, handler);
10043
+ return;
10044
+ }
10045
+ const fdc3ChannelName = await this.glueController.getFDC3ChannelIdByIoChannelName(channelName);
10046
+ if (!fdc3ChannelName) {
10047
+ return;
10048
+ }
10049
+ this.invokeChannelChangedEventHandler(fdc3ChannelName, handler);
10050
+ };
10051
+ const unsubscribe = this.glueController.setOnChannelChanged(wrappedCallback);
10052
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
10053
+ }
10054
+ invokeChannelChangedEventHandler(channelId, handler) {
10055
+ const event = {
10056
+ type: "userChannelChanged",
10057
+ details: { currentChannelId: channelId }
10058
+ };
10059
+ handler(event);
10060
+ }
8572
10061
  }
8573
10062
 
8574
10063
  class LegacyDataWrappingChannelsController {
@@ -8606,7 +10095,7 @@
8606
10095
  if (!invokedOnChannelModel) {
8607
10096
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8608
10097
  const unsubscribe = this.glueController.legacyChannelsSubscribe(handler, contextType);
8609
- return { unsubscribe };
10098
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8610
10099
  }
8611
10100
  const ioChannelName = await this.glueController.getIoChannelNameByFDC3ChannelId(channelId);
8612
10101
  if (!ioChannelName) {
@@ -8616,7 +10105,7 @@
8616
10105
  const contextToSubscribeTo = this.parser.mapChannelNameToContextName(ioChannelName);
8617
10106
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8618
10107
  const unsubscribe = await this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
8619
- return { unsubscribe };
10108
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8620
10109
  }
8621
10110
  get logger() {
8622
10111
  if (!this._logger) {
@@ -8662,7 +10151,7 @@
8662
10151
  if (!invokedOnChannelModel) {
8663
10152
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8664
10153
  const unsubscribe = this.glueController.channelsSubscribe(handler, contextType);
8665
- return { unsubscribe };
10154
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8666
10155
  }
8667
10156
  const ioChannelName = await this.glueController.getIoChannelNameByFDC3ChannelId(channelId);
8668
10157
  if (!ioChannelName) {
@@ -8672,7 +10161,7 @@
8672
10161
  const contextToSubscribeTo = this.parser.mapChannelNameToContextName(ioChannelName);
8673
10162
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8674
10163
  const unsubscribe = await this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
8675
- return { unsubscribe };
10164
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8676
10165
  }
8677
10166
  get logger() {
8678
10167
  if (!this._logger) {
@@ -8868,13 +10357,13 @@
8868
10357
  return ioc.fdc3;
8869
10358
  };
8870
10359
 
8871
- var version = "2.5.2";
10360
+ var version = "2.6.1";
8872
10361
 
8873
10362
  const globalScope = typeof process !== "undefined" ? process : window;
8874
10363
  globalScope.fdc3Info = {
8875
10364
  provider: "io.Connect",
8876
10365
  providerVersion: version,
8877
- standardVersion: "2.1"
10366
+ standardVersion: "2.2"
8878
10367
  };
8879
10368
  let globalFdc3 = globalScope.fdc3;
8880
10369
  if (typeof globalFdc3 === "undefined") {