@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.
package/dist/fdc3.umd.js CHANGED
@@ -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 promisePlus = (promise, timeoutMilliseconds, timeoutMessage) => {
4066
4063
  return new Promise((resolve, reject) => {
@@ -4974,7 +4971,7 @@
4974
4971
  });
4975
4972
  const v2DefinitionDecoder = object$1({
4976
4973
  appId: nonEmptyStringDecoder$1,
4977
- name: nonEmptyStringDecoder$1,
4974
+ name: optional$1(nonEmptyStringDecoder$1),
4978
4975
  type: v2TypeDecoder,
4979
4976
  details: v2DetailsDecoder,
4980
4977
  version: optional$1(nonEmptyStringDecoder$1),
@@ -5167,6 +5164,9 @@
5167
5164
  }
5168
5165
  mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
5169
5166
  let baseApplicationDefinition = baseAppData;
5167
+ if (hostManifestDefinition.customProperties) {
5168
+ baseApplicationDefinition.userProperties = { ...baseAppData.userProperties, ...hostManifestDefinition.customProperties };
5169
+ }
5170
5170
  if (hostManifestDefinition.details) {
5171
5171
  const details = { ...baseAppData.createOptions, ...hostManifestDefinition.details };
5172
5172
  baseApplicationDefinition.createOptions = details;
@@ -5266,13 +5266,20 @@
5266
5266
 
5267
5267
  const ioConnectFDC3SystemMethod = "FDC3.Collaborate";
5268
5268
  const PrivateChannelPrefix = "___privateFDC3Channel___";
5269
- var PrivateChannelEventMethods;
5270
- (function (PrivateChannelEventMethods) {
5271
- PrivateChannelEventMethods["ListenerAdded"] = "listenerAdded";
5272
- PrivateChannelEventMethods["OnAddContextListener"] = "onAddContextListener";
5273
- PrivateChannelEventMethods["OnUnsubscribe"] = "onUnsubscribe";
5274
- PrivateChannelEventMethods["OnDisconnect"] = "onDisconnect";
5275
- })(PrivateChannelEventMethods || (PrivateChannelEventMethods = {}));
5269
+ var LegacyPrivateChannelEventMethods;
5270
+ (function (LegacyPrivateChannelEventMethods) {
5271
+ LegacyPrivateChannelEventMethods["ListenerAdded"] = "listenerAdded";
5272
+ LegacyPrivateChannelEventMethods["OnAddContextListener"] = "onAddContextListener";
5273
+ LegacyPrivateChannelEventMethods["OnUnsubscribe"] = "onUnsubscribe";
5274
+ LegacyPrivateChannelEventMethods["OnDisconnect"] = "onDisconnect";
5275
+ })(LegacyPrivateChannelEventMethods || (LegacyPrivateChannelEventMethods = {}));
5276
+ var NewPrivateChannelEventMethods;
5277
+ (function (NewPrivateChannelEventMethods) {
5278
+ NewPrivateChannelEventMethods["ContextListenerAdded"] = "contextListenerAdded";
5279
+ NewPrivateChannelEventMethods["AddContextListener"] = "addContextListener";
5280
+ NewPrivateChannelEventMethods["Unsubscribe"] = "unsubscribe";
5281
+ NewPrivateChannelEventMethods["Disconnect"] = "disconnect";
5282
+ })(NewPrivateChannelEventMethods || (NewPrivateChannelEventMethods = {}));
5276
5283
 
5277
5284
  /**
5278
5285
  * Wraps values in an `Ok` type.
@@ -6120,6 +6127,9 @@
6120
6127
  object({
6121
6128
  channelId: optional(nonEmptyStringDecoder)
6122
6129
  });
6130
+ const privateChannelEventTypesDecoder = oneOf(constant("addContextListener"), constant("unsubscribe"), constant("disconnect"));
6131
+ const optionalPrivateChannelEventTypesDecoder = optional(privateChannelEventTypesDecoder);
6132
+ const optionalFdc3EventTypesDecoder = optional(constant("userChannelChanged"));
6123
6133
 
6124
6134
  class GlueController {
6125
6135
  channelsParser;
@@ -6128,7 +6138,6 @@
6128
6138
  glueInitPromise;
6129
6139
  resolveGluePromise;
6130
6140
  rejectGluePromise;
6131
- defaultGluePromiseTimeout = 120 * 1000;
6132
6141
  constructor(channelsParser) {
6133
6142
  this.channelsParser = channelsParser;
6134
6143
  }
@@ -6170,11 +6179,14 @@
6170
6179
  getApplication(name) {
6171
6180
  return this.glue.appManager.application(name);
6172
6181
  }
6182
+ getAllAppManagerInstances() {
6183
+ return this.glue.appManager.instances();
6184
+ }
6173
6185
  getApplicationInstances(appName) {
6174
- return this.glue.appManager.instances().filter(inst => inst.application.name === appName);
6186
+ return this.getAllAppManagerInstances().filter(inst => inst.application.name === appName);
6175
6187
  }
6176
6188
  getAppInstanceById(id) {
6177
- return this.glue.appManager.instances().find(inst => inst.id === id);
6189
+ return this.getAllAppManagerInstances().find(inst => inst.id === id);
6178
6190
  }
6179
6191
  async findIntents(intentFilter) {
6180
6192
  return this.glue.intents.find(intentFilter);
@@ -6207,11 +6219,11 @@
6207
6219
  }
6208
6220
  return myWin.getContext();
6209
6221
  }
6210
- addIntentListener(intent, handler) {
6211
- const registerMethodExists = this.glue.intents.register;
6212
- return registerMethodExists
6213
- ? this.glue.intents.register(intent, handler)
6214
- : this.glue.intents.addIntentListener(intent, handler);
6222
+ async addIntentListener(intent, handler) {
6223
+ if (typeof this.glue.intents.register === "function") {
6224
+ return await this.glue.intents.register(intent, handler);
6225
+ }
6226
+ return this.glue.intents.addIntentListener(intent, handler);
6215
6227
  }
6216
6228
  getAllContexts() {
6217
6229
  return this.glue.contexts.all();
@@ -6286,7 +6298,11 @@
6286
6298
  }
6287
6299
  getMyWindow() {
6288
6300
  const win = this.glue.windows.my();
6289
- return isValidNonEmptyObject(win) ? win : undefined;
6301
+ const isValidWindow = isValidNonEmptyObject(win);
6302
+ if (isValidWindow) {
6303
+ return win;
6304
+ }
6305
+ return this.glue.windows.findById(this.glue.interop.instance.instance);
6290
6306
  }
6291
6307
  getMyInteropInstance() {
6292
6308
  return this.glue.interop.instance;
@@ -6407,7 +6423,7 @@
6407
6423
  }
6408
6424
  return {
6409
6425
  source: {
6410
- appId: instanceServer.applicationName,
6426
+ appId: instanceServer.application ?? instanceServer.applicationName,
6411
6427
  instanceId: instanceServer.instance
6412
6428
  }
6413
6429
  };
@@ -6486,9 +6502,851 @@
6486
6502
 
6487
6503
  // To parse this data:
6488
6504
  //
6489
- // 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";
6505
+ // 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";
6506
+ //
6507
+ // const action = Convert.toAction(json);
6508
+ // const chart = Convert.toChart(json);
6509
+ // const chatInitSettings = Convert.toChatInitSettings(json);
6510
+ // const chatMessage = Convert.toChatMessage(json);
6511
+ // const chatRoom = Convert.toChatRoom(json);
6512
+ // const chatSearchCriteria = Convert.toChatSearchCriteria(json);
6513
+ // const contact = Convert.toContact(json);
6514
+ // const contactList = Convert.toContactList(json);
6515
+ // const context = Convert.toContext(json);
6516
+ // const country = Convert.toCountry(json);
6517
+ // const currency = Convert.toCurrency(json);
6518
+ // const email = Convert.toEmail(json);
6519
+ // const fileAttachment = Convert.toFileAttachment(json);
6520
+ // const instrument = Convert.toInstrument(json);
6521
+ // const instrumentList = Convert.toInstrumentList(json);
6522
+ // const interaction = Convert.toInteraction(json);
6523
+ // const message = Convert.toMessage(json);
6524
+ // const nothing = Convert.toNothing(json);
6525
+ // const order = Convert.toOrder(json);
6526
+ // const orderList = Convert.toOrderList(json);
6527
+ // const organization = Convert.toOrganization(json);
6528
+ // const portfolio = Convert.toPortfolio(json);
6529
+ // const position = Convert.toPosition(json);
6530
+ // const product = Convert.toProduct(json);
6531
+ // const timeRange = Convert.toTimeRange(json);
6532
+ // const trade = Convert.toTrade(json);
6533
+ // const tradeList = Convert.toTradeList(json);
6534
+ // const transactionResult = Convert.toTransactionResult(json);
6535
+ // const valuation = Convert.toValuation(json);
6536
+ //
6537
+ // These functions will throw an error if the JSON doesn't
6538
+ // match the expected interface, even if the JSON is valid.
6539
+ /**
6540
+ * Free text to be used for a keyword search
6541
+ *
6542
+ * `interactionType` SHOULD be one of `'Instant Message'`, `'Email'`, `'Call'`, or
6543
+ * `'Meeting'` although other string values are permitted.
6544
+ */
6545
+ // Converts JSON strings to/from your types
6546
+ // and asserts the results of JSON.parse at runtime
6547
+ function a$2(typ) {
6548
+ return { arrayItems: typ };
6549
+ }
6550
+ function u$2(...typs) {
6551
+ return { unionMembers: typs };
6552
+ }
6553
+ function o$2(props, additional) {
6554
+ return { props, additional };
6555
+ }
6556
+ function m$2(additional) {
6557
+ return { props: [], additional };
6558
+ }
6559
+ function r$2(name) {
6560
+ return { ref: name };
6561
+ }
6562
+ ({
6563
+ Action: o$2([
6564
+ { json: 'action', js: 'action', typ: u$2(undefined, r$2('ActionType')) },
6565
+ { json: 'app', js: 'app', typ: u$2(undefined, r$2('AppIdentifier')) },
6566
+ { json: 'channelId', js: 'channelId', typ: u$2(undefined, '') },
6567
+ { json: 'context', js: 'context', typ: r$2('ContextElement') },
6568
+ { json: 'intent', js: 'intent', typ: u$2(undefined, '') },
6569
+ { json: 'title', js: 'title', typ: '' },
6570
+ { json: 'type', js: 'type', typ: r$2('ActionTypeEnum') },
6571
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6572
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6573
+ ], 'any'),
6574
+ AppIdentifier: o$2([
6575
+ { json: 'appId', js: 'appId', typ: '' },
6576
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$2(undefined, '') },
6577
+ { json: 'instanceId', js: 'instanceId', typ: u$2(undefined, '') },
6578
+ ], 'any'),
6579
+ ContextElement: o$2([
6580
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6581
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6582
+ { json: 'type', js: 'type', typ: '' },
6583
+ ], 'any'),
6584
+ Chart: o$2([
6585
+ { json: 'instruments', js: 'instruments', typ: a$2(r$2('InstrumentElement')) },
6586
+ { json: 'otherConfig', js: 'otherConfig', typ: u$2(undefined, a$2(r$2('ContextElement'))) },
6587
+ { json: 'range', js: 'range', typ: u$2(undefined, r$2('TimeRangeObject')) },
6588
+ { json: 'style', js: 'style', typ: u$2(undefined, r$2('ChartStyle')) },
6589
+ { json: 'type', js: 'type', typ: r$2('ChartType') },
6590
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6591
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6592
+ ], 'any'),
6593
+ InstrumentElement: o$2([
6594
+ { json: 'id', js: 'id', typ: r$2('PurpleInstrumentIdentifiers') },
6595
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('OrganizationMarket')) },
6596
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6597
+ { json: 'type', js: 'type', typ: r$2('PurpleInteractionType') },
6598
+ ], 'any'),
6599
+ PurpleInstrumentIdentifiers: o$2([
6600
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6601
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6602
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6603
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6604
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6605
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6606
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6607
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6608
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6609
+ ], 'any'),
6610
+ OrganizationMarket: o$2([
6611
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6612
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6613
+ { json: 'MIC', js: 'MIC', typ: u$2(undefined, '') },
6614
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6615
+ ], 'any'),
6616
+ TimeRangeObject: o$2([
6617
+ { json: 'endTime', js: 'endTime', typ: u$2(undefined, Date) },
6618
+ { json: 'startTime', js: 'startTime', typ: u$2(undefined, Date) },
6619
+ { json: 'type', js: 'type', typ: r$2('TimeRangeType') },
6620
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6621
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6622
+ ], 'any'),
6623
+ ChatInitSettings: o$2([
6624
+ { json: 'chatName', js: 'chatName', typ: u$2(undefined, '') },
6625
+ { json: 'members', js: 'members', typ: u$2(undefined, r$2('ContactListObject')) },
6626
+ { json: 'message', js: 'message', typ: u$2(undefined, u$2(r$2('MessageObject'), '')) },
6627
+ { json: 'options', js: 'options', typ: u$2(undefined, r$2('ChatOptions')) },
6628
+ { json: 'type', js: 'type', typ: r$2('ChatInitSettingsType') },
6629
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6630
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6631
+ ], 'any'),
6632
+ ContactListObject: o$2([
6633
+ { json: 'contacts', js: 'contacts', typ: a$2(r$2('ContactElement')) },
6634
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6635
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6636
+ { json: 'type', js: 'type', typ: r$2('ContactListType') },
6637
+ ], 'any'),
6638
+ ContactElement: o$2([
6639
+ { json: 'id', js: 'id', typ: r$2('PurpleContactIdentifiers') },
6640
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6641
+ { json: 'type', js: 'type', typ: r$2('FluffyInteractionType') },
6642
+ ], 'any'),
6643
+ PurpleContactIdentifiers: o$2([
6644
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6645
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6646
+ ], 'any'),
6647
+ MessageObject: o$2([
6648
+ { json: 'entities', js: 'entities', typ: u$2(undefined, m$2(r$2('EntityValue'))) },
6649
+ { json: 'text', js: 'text', typ: u$2(undefined, r$2('PurpleMessageText')) },
6650
+ { json: 'type', js: 'type', typ: r$2('MessageType') },
6651
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6652
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6653
+ ], 'any'),
6654
+ EntityValue: o$2([
6655
+ { json: 'action', js: 'action', typ: u$2(undefined, r$2('ActionType')) },
6656
+ { json: 'app', js: 'app', typ: u$2(undefined, r$2('AppIdentifier')) },
6657
+ { json: 'channelId', js: 'channelId', typ: u$2(undefined, '') },
6658
+ { json: 'context', js: 'context', typ: u$2(undefined, r$2('ContextElement')) },
6659
+ { json: 'intent', js: 'intent', typ: u$2(undefined, '') },
6660
+ { json: 'title', js: 'title', typ: u$2(undefined, '') },
6661
+ { json: 'type', js: 'type', typ: r$2('EntityType') },
6662
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6663
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6664
+ { json: 'data', js: 'data', typ: u$2(undefined, r$2('EntityData')) },
6665
+ ], 'any'),
6666
+ PurpleMessageText: o$2([
6667
+ { json: 'text/markdown', js: 'text/markdown', typ: u$2(undefined, '') },
6668
+ { json: 'text/plain', js: 'text/plain', typ: u$2(undefined, '') },
6669
+ ], 'any'),
6670
+ ChatOptions: o$2([
6671
+ { json: 'allowAddUser', js: 'allowAddUser', typ: u$2(undefined, true) },
6672
+ { json: 'allowHistoryBrowsing', js: 'allowHistoryBrowsing', typ: u$2(undefined, true) },
6673
+ { json: 'allowMessageCopy', js: 'allowMessageCopy', typ: u$2(undefined, true) },
6674
+ { json: 'groupRecipients', js: 'groupRecipients', typ: u$2(undefined, true) },
6675
+ { json: 'isPublic', js: 'isPublic', typ: u$2(undefined, true) },
6676
+ ], 'any'),
6677
+ ChatMessage: o$2([
6678
+ { json: 'chatRoom', js: 'chatRoom', typ: r$2('ChatRoomObject') },
6679
+ { json: 'message', js: 'message', typ: r$2('MessageObject') },
6680
+ { json: 'type', js: 'type', typ: r$2('ChatMessageType') },
6681
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6682
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6683
+ ], 'any'),
6684
+ ChatRoomObject: o$2([
6685
+ { json: 'id', js: 'id', typ: m$2('') },
6686
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6687
+ { json: 'providerName', js: 'providerName', typ: '' },
6688
+ { json: 'type', js: 'type', typ: r$2('ChatRoomType') },
6689
+ { json: 'url', js: 'url', typ: u$2(undefined, '') },
6690
+ ], 'any'),
6691
+ ChatRoom: o$2([
6692
+ { json: 'id', js: 'id', typ: m$2('') },
6693
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6694
+ { json: 'providerName', js: 'providerName', typ: '' },
6695
+ { json: 'type', js: 'type', typ: r$2('ChatRoomType') },
6696
+ { json: 'url', js: 'url', typ: u$2(undefined, '') },
6697
+ ], 'any'),
6698
+ ChatSearchCriteria: o$2([
6699
+ { json: 'criteria', js: 'criteria', typ: a$2(u$2(r$2('OrganizationObject'), '')) },
6700
+ { json: 'type', js: 'type', typ: r$2('ChatSearchCriteriaType') },
6701
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6702
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6703
+ ], 'any'),
6704
+ OrganizationObject: o$2([
6705
+ { json: 'id', js: 'id', typ: r$2('Identifiers') },
6706
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('OrganizationMarket')) },
6707
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6708
+ { json: 'type', js: 'type', typ: r$2('TentacledInteractionType') },
6709
+ ], 'any'),
6710
+ Identifiers: o$2([
6711
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6712
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6713
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6714
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6715
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6716
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6717
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6718
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6719
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6720
+ { json: 'LEI', js: 'LEI', typ: u$2(undefined, '') },
6721
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6722
+ ], 'any'),
6723
+ Contact: o$2([
6724
+ { json: 'id', js: 'id', typ: r$2('FluffyContactIdentifiers') },
6725
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6726
+ { json: 'type', js: 'type', typ: r$2('FluffyInteractionType') },
6727
+ ], 'any'),
6728
+ FluffyContactIdentifiers: o$2([
6729
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6730
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6731
+ ], 'any'),
6732
+ ContactList: o$2([
6733
+ { json: 'contacts', js: 'contacts', typ: a$2(r$2('ContactElement')) },
6734
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6735
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6736
+ { json: 'type', js: 'type', typ: r$2('ContactListType') },
6737
+ ], 'any'),
6738
+ Context: o$2([
6739
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6740
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6741
+ { json: 'type', js: 'type', typ: '' },
6742
+ ], 'any'),
6743
+ Country: o$2([
6744
+ { json: 'id', js: 'id', typ: r$2('CountryID') },
6745
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6746
+ { json: 'type', js: 'type', typ: r$2('CountryType') },
6747
+ ], 'any'),
6748
+ CountryID: o$2([
6749
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6750
+ { json: 'COUNTRY_ISOALPHA3', js: 'COUNTRY_ISOALPHA3', typ: u$2(undefined, '') },
6751
+ { json: 'ISOALPHA2', js: 'ISOALPHA2', typ: u$2(undefined, '') },
6752
+ { json: 'ISOALPHA3', js: 'ISOALPHA3', typ: u$2(undefined, '') },
6753
+ ], 'any'),
6754
+ Currency: o$2([
6755
+ { json: 'id', js: 'id', typ: r$2('CurrencyID') },
6756
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6757
+ { json: 'type', js: 'type', typ: r$2('CurrencyType') },
6758
+ ], 'any'),
6759
+ CurrencyID: o$2([{ json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: u$2(undefined, '') }], 'any'),
6760
+ Email: o$2([
6761
+ { json: 'recipients', js: 'recipients', typ: r$2('EmailRecipients') },
6762
+ { json: 'subject', js: 'subject', typ: u$2(undefined, '') },
6763
+ { json: 'textBody', js: 'textBody', typ: u$2(undefined, '') },
6764
+ { json: 'type', js: 'type', typ: r$2('EmailType') },
6765
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6766
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6767
+ ], 'any'),
6768
+ EmailRecipients: o$2([
6769
+ { json: 'id', js: 'id', typ: u$2(undefined, r$2('ContactTIdentifiers')) },
6770
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6771
+ { json: 'type', js: 'type', typ: r$2('EmailRecipientsType') },
6772
+ { json: 'contacts', js: 'contacts', typ: u$2(undefined, a$2(r$2('ContactElement'))) },
6773
+ ], 'any'),
6774
+ ContactTIdentifiers: o$2([
6775
+ { json: 'email', js: 'email', typ: u$2(undefined, '') },
6776
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6777
+ ], 'any'),
6778
+ FileAttachment: o$2([
6779
+ { json: 'data', js: 'data', typ: r$2('FileAttachmentData') },
6780
+ { json: 'type', js: 'type', typ: r$2('FileAttachmentType') },
6781
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6782
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6783
+ ], 'any'),
6784
+ Instrument: o$2([
6785
+ { json: 'id', js: 'id', typ: r$2('FluffyInstrumentIdentifiers') },
6786
+ { json: 'market', js: 'market', typ: u$2(undefined, r$2('PurpleMarket')) },
6787
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6788
+ { json: 'type', js: 'type', typ: r$2('PurpleInteractionType') },
6789
+ ], 'any'),
6790
+ FluffyInstrumentIdentifiers: o$2([
6791
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6792
+ { json: 'CUSIP', js: 'CUSIP', typ: u$2(undefined, '') },
6793
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6794
+ { json: 'FIGI', js: 'FIGI', typ: u$2(undefined, '') },
6795
+ { json: 'ISIN', js: 'ISIN', typ: u$2(undefined, '') },
6796
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6797
+ { json: 'RIC', js: 'RIC', typ: u$2(undefined, '') },
6798
+ { json: 'SEDOL', js: 'SEDOL', typ: u$2(undefined, '') },
6799
+ { json: 'ticker', js: 'ticker', typ: u$2(undefined, '') },
6800
+ ], 'any'),
6801
+ PurpleMarket: o$2([
6802
+ { json: 'BBG', js: 'BBG', typ: u$2(undefined, '') },
6803
+ { json: 'COUNTRY_ISOALPHA2', js: 'COUNTRY_ISOALPHA2', typ: u$2(undefined, '') },
6804
+ { json: 'MIC', js: 'MIC', typ: u$2(undefined, '') },
6805
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6806
+ ], 'any'),
6807
+ InstrumentList: o$2([
6808
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6809
+ { json: 'instruments', js: 'instruments', typ: a$2(r$2('InstrumentElement')) },
6810
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6811
+ { json: 'type', js: 'type', typ: r$2('InstrumentListType') },
6812
+ ], 'any'),
6813
+ Interaction: o$2([
6814
+ { json: 'description', js: 'description', typ: '' },
6815
+ { json: 'id', js: 'id', typ: u$2(undefined, r$2('InteractionID')) },
6816
+ { json: 'initiator', js: 'initiator', typ: u$2(undefined, r$2('ContactElement')) },
6817
+ { json: 'interactionType', js: 'interactionType', typ: '' },
6818
+ { json: 'origin', js: 'origin', typ: u$2(undefined, '') },
6819
+ { json: 'participants', js: 'participants', typ: r$2('ContactListObject') },
6820
+ { json: 'timeRange', js: 'timeRange', typ: r$2('TimeRangeObject') },
6821
+ { json: 'type', js: 'type', typ: r$2('InteractionType') },
6822
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6823
+ ], 'any'),
6824
+ InteractionID: o$2([
6825
+ { json: 'SALESFORCE', js: 'SALESFORCE', typ: u$2(undefined, '') },
6826
+ { json: 'SINGLETRACK', js: 'SINGLETRACK', typ: u$2(undefined, '') },
6827
+ { json: 'URI', js: 'URI', typ: u$2(undefined, '') },
6828
+ ], 'any'),
6829
+ Message: o$2([
6830
+ { json: 'entities', js: 'entities', typ: u$2(undefined, m$2(r$2('EntityValue'))) },
6831
+ { json: 'text', js: 'text', typ: u$2(undefined, r$2('FluffyMessageText')) },
6832
+ { json: 'type', js: 'type', typ: r$2('MessageType') },
6833
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6834
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6835
+ ], 'any'),
6836
+ FluffyMessageText: o$2([
6837
+ { json: 'text/markdown', js: 'text/markdown', typ: u$2(undefined, '') },
6838
+ { json: 'text/plain', js: 'text/plain', typ: u$2(undefined, '') },
6839
+ ], 'any'),
6840
+ Nothing: o$2([
6841
+ { json: 'type', js: 'type', typ: r$2('NothingType') },
6842
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6843
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6844
+ ], 'any'),
6845
+ Order: o$2([
6846
+ { json: 'details', js: 'details', typ: u$2(undefined, r$2('PurpleOrderDetails')) },
6847
+ { json: 'id', js: 'id', typ: m$2('') },
6848
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6849
+ { json: 'type', js: 'type', typ: r$2('OrderType') },
6850
+ ], 'any'),
6851
+ PurpleOrderDetails: o$2([{ json: 'product', js: 'product', typ: u$2(undefined, r$2('ProductObject')) }], 'any'),
6852
+ ProductObject: o$2([
6853
+ { json: 'id', js: 'id', typ: m$2('') },
6854
+ { json: 'instrument', js: 'instrument', typ: u$2(undefined, r$2('InstrumentElement')) },
6855
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6856
+ { json: 'type', js: 'type', typ: r$2('ProductType') },
6857
+ ], 'any'),
6858
+ OrderList: o$2([
6859
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6860
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6861
+ { json: 'orders', js: 'orders', typ: a$2(r$2('OrderElement')) },
6862
+ { json: 'type', js: 'type', typ: r$2('OrderListType') },
6863
+ ], 'any'),
6864
+ OrderElement: o$2([
6865
+ { json: 'details', js: 'details', typ: u$2(undefined, r$2('FluffyOrderDetails')) },
6866
+ { json: 'id', js: 'id', typ: m$2('') },
6867
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6868
+ { json: 'type', js: 'type', typ: r$2('OrderType') },
6869
+ ], 'any'),
6870
+ FluffyOrderDetails: o$2([{ json: 'product', js: 'product', typ: u$2(undefined, r$2('ProductObject')) }], 'any'),
6871
+ Organization: o$2([
6872
+ { json: 'id', js: 'id', typ: r$2('OrganizationIdentifiers') },
6873
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6874
+ { json: 'type', js: 'type', typ: r$2('StickyInteractionType') },
6875
+ ], 'any'),
6876
+ OrganizationIdentifiers: o$2([
6877
+ { json: 'FDS_ID', js: 'FDS_ID', typ: u$2(undefined, '') },
6878
+ { json: 'LEI', js: 'LEI', typ: u$2(undefined, '') },
6879
+ { json: 'PERMID', js: 'PERMID', typ: u$2(undefined, '') },
6880
+ ], 'any'),
6881
+ Portfolio: o$2([
6882
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6883
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6884
+ { json: 'positions', js: 'positions', typ: a$2(r$2('PositionElement')) },
6885
+ { json: 'type', js: 'type', typ: r$2('PortfolioType') },
6886
+ ], 'any'),
6887
+ PositionElement: o$2([
6888
+ { json: 'holding', js: 'holding', typ: 3.14 },
6889
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6890
+ { json: 'instrument', js: 'instrument', typ: r$2('InstrumentElement') },
6891
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6892
+ { json: 'type', js: 'type', typ: r$2('PositionType') },
6893
+ ], 'any'),
6894
+ Position: o$2([
6895
+ { json: 'holding', js: 'holding', typ: 3.14 },
6896
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6897
+ { json: 'instrument', js: 'instrument', typ: r$2('InstrumentElement') },
6898
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6899
+ { json: 'type', js: 'type', typ: r$2('PositionType') },
6900
+ ], 'any'),
6901
+ Product: o$2([
6902
+ { json: 'id', js: 'id', typ: m$2('') },
6903
+ { json: 'instrument', js: 'instrument', typ: u$2(undefined, r$2('InstrumentElement')) },
6904
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6905
+ { json: 'type', js: 'type', typ: r$2('ProductType') },
6906
+ ], 'any'),
6907
+ TimeRange: o$2([
6908
+ { json: 'endTime', js: 'endTime', typ: u$2(undefined, Date) },
6909
+ { json: 'startTime', js: 'startTime', typ: u$2(undefined, Date) },
6910
+ { json: 'type', js: 'type', typ: r$2('TimeRangeType') },
6911
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6912
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6913
+ ], 'any'),
6914
+ Trade: o$2([
6915
+ { json: 'id', js: 'id', typ: m$2('') },
6916
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6917
+ { json: 'product', js: 'product', typ: r$2('ProductObject') },
6918
+ { json: 'type', js: 'type', typ: r$2('TradeType') },
6919
+ ], 'any'),
6920
+ TradeList: o$2([
6921
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('')) },
6922
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6923
+ { json: 'trades', js: 'trades', typ: a$2(r$2('TradeElement')) },
6924
+ { json: 'type', js: 'type', typ: r$2('TradeListType') },
6925
+ ], 'any'),
6926
+ TradeElement: o$2([
6927
+ { json: 'id', js: 'id', typ: m$2('') },
6928
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6929
+ { json: 'product', js: 'product', typ: r$2('ProductObject') },
6930
+ { json: 'type', js: 'type', typ: r$2('TradeType') },
6931
+ ], 'any'),
6932
+ TransactionResult: o$2([
6933
+ { json: 'context', js: 'context', typ: u$2(undefined, r$2('ContextElement')) },
6934
+ { json: 'message', js: 'message', typ: u$2(undefined, '') },
6935
+ { json: 'status', js: 'status', typ: r$2('TransactionStatus') },
6936
+ { json: 'type', js: 'type', typ: r$2('TransactionResultType') },
6937
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6938
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6939
+ ], 'any'),
6940
+ Valuation: o$2([
6941
+ { json: 'CURRENCY_ISOCODE', js: 'CURRENCY_ISOCODE', typ: '' },
6942
+ { json: 'expiryTime', js: 'expiryTime', typ: u$2(undefined, Date) },
6943
+ { json: 'price', js: 'price', typ: u$2(undefined, 3.14) },
6944
+ { json: 'type', js: 'type', typ: r$2('ValuationType') },
6945
+ { json: 'valuationTime', js: 'valuationTime', typ: u$2(undefined, Date) },
6946
+ { json: 'value', js: 'value', typ: 3.14 },
6947
+ { json: 'id', js: 'id', typ: u$2(undefined, m$2('any')) },
6948
+ { json: 'name', js: 'name', typ: u$2(undefined, '') },
6949
+ ], 'any')});
6950
+
6951
+ // To parse this data:
6952
+ //
6953
+ // 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";
6954
+ //
6955
+ // const webConnectionProtocol1Hello = Convert.toWebConnectionProtocol1Hello(json);
6956
+ // const webConnectionProtocol2LoadURL = Convert.toWebConnectionProtocol2LoadURL(json);
6957
+ // const webConnectionProtocol3Handshake = Convert.toWebConnectionProtocol3Handshake(json);
6958
+ // const webConnectionProtocol4ValidateAppIdentity = Convert.toWebConnectionProtocol4ValidateAppIdentity(json);
6959
+ // const webConnectionProtocol5ValidateAppIdentityFailedResponse = Convert.toWebConnectionProtocol5ValidateAppIdentityFailedResponse(json);
6960
+ // const webConnectionProtocol5ValidateAppIdentitySuccessResponse = Convert.toWebConnectionProtocol5ValidateAppIdentitySuccessResponse(json);
6961
+ // const webConnectionProtocol6Goodbye = Convert.toWebConnectionProtocol6Goodbye(json);
6962
+ // const webConnectionProtocolMessage = Convert.toWebConnectionProtocolMessage(json);
6963
+ // const addContextListenerRequest = Convert.toAddContextListenerRequest(json);
6964
+ // const addContextListenerResponse = Convert.toAddContextListenerResponse(json);
6965
+ // const addEventListenerRequest = Convert.toAddEventListenerRequest(json);
6966
+ // const addEventListenerResponse = Convert.toAddEventListenerResponse(json);
6967
+ // const addIntentListenerRequest = Convert.toAddIntentListenerRequest(json);
6968
+ // const addIntentListenerResponse = Convert.toAddIntentListenerResponse(json);
6969
+ // const agentEventMessage = Convert.toAgentEventMessage(json);
6970
+ // const agentResponseMessage = Convert.toAgentResponseMessage(json);
6971
+ // const appRequestMessage = Convert.toAppRequestMessage(json);
6972
+ // const broadcastEvent = Convert.toBroadcastEvent(json);
6973
+ // const broadcastRequest = Convert.toBroadcastRequest(json);
6974
+ // const broadcastResponse = Convert.toBroadcastResponse(json);
6975
+ // const channelChangedEvent = Convert.toChannelChangedEvent(json);
6976
+ // const contextListenerUnsubscribeRequest = Convert.toContextListenerUnsubscribeRequest(json);
6977
+ // const contextListenerUnsubscribeResponse = Convert.toContextListenerUnsubscribeResponse(json);
6978
+ // const createPrivateChannelRequest = Convert.toCreatePrivateChannelRequest(json);
6979
+ // const createPrivateChannelResponse = Convert.toCreatePrivateChannelResponse(json);
6980
+ // const eventListenerUnsubscribeRequest = Convert.toEventListenerUnsubscribeRequest(json);
6981
+ // const eventListenerUnsubscribeResponse = Convert.toEventListenerUnsubscribeResponse(json);
6982
+ // const fdc3UserInterfaceChannelSelected = Convert.toFdc3UserInterfaceChannelSelected(json);
6983
+ // const fdc3UserInterfaceChannels = Convert.toFdc3UserInterfaceChannels(json);
6984
+ // const fdc3UserInterfaceDrag = Convert.toFdc3UserInterfaceDrag(json);
6985
+ // const fdc3UserInterfaceHandshake = Convert.toFdc3UserInterfaceHandshake(json);
6986
+ // const fdc3UserInterfaceHello = Convert.toFdc3UserInterfaceHello(json);
6987
+ // const fdc3UserInterfaceMessage = Convert.toFdc3UserInterfaceMessage(json);
6988
+ // const fdc3UserInterfaceResolve = Convert.toFdc3UserInterfaceResolve(json);
6989
+ // const fdc3UserInterfaceResolveAction = Convert.toFdc3UserInterfaceResolveAction(json);
6990
+ // const fdc3UserInterfaceRestyle = Convert.toFdc3UserInterfaceRestyle(json);
6991
+ // const findInstancesRequest = Convert.toFindInstancesRequest(json);
6992
+ // const findInstancesResponse = Convert.toFindInstancesResponse(json);
6993
+ // const findIntentRequest = Convert.toFindIntentRequest(json);
6994
+ // const findIntentResponse = Convert.toFindIntentResponse(json);
6995
+ // const findIntentsByContextRequest = Convert.toFindIntentsByContextRequest(json);
6996
+ // const findIntentsByContextResponse = Convert.toFindIntentsByContextResponse(json);
6997
+ // const getAppMetadataRequest = Convert.toGetAppMetadataRequest(json);
6998
+ // const getAppMetadataResponse = Convert.toGetAppMetadataResponse(json);
6999
+ // const getCurrentChannelRequest = Convert.toGetCurrentChannelRequest(json);
7000
+ // const getCurrentChannelResponse = Convert.toGetCurrentChannelResponse(json);
7001
+ // const getCurrentContextRequest = Convert.toGetCurrentContextRequest(json);
7002
+ // const getCurrentContextResponse = Convert.toGetCurrentContextResponse(json);
7003
+ // const getInfoRequest = Convert.toGetInfoRequest(json);
7004
+ // const getInfoResponse = Convert.toGetInfoResponse(json);
7005
+ // const getOrCreateChannelRequest = Convert.toGetOrCreateChannelRequest(json);
7006
+ // const getOrCreateChannelResponse = Convert.toGetOrCreateChannelResponse(json);
7007
+ // const getUserChannelsRequest = Convert.toGetUserChannelsRequest(json);
7008
+ // const getUserChannelsResponse = Convert.toGetUserChannelsResponse(json);
7009
+ // const heartbeatAcknowledgementRequest = Convert.toHeartbeatAcknowledgementRequest(json);
7010
+ // const heartbeatEvent = Convert.toHeartbeatEvent(json);
7011
+ // const intentEvent = Convert.toIntentEvent(json);
7012
+ // const intentListenerUnsubscribeRequest = Convert.toIntentListenerUnsubscribeRequest(json);
7013
+ // const intentListenerUnsubscribeResponse = Convert.toIntentListenerUnsubscribeResponse(json);
7014
+ // const intentResultRequest = Convert.toIntentResultRequest(json);
7015
+ // const intentResultResponse = Convert.toIntentResultResponse(json);
7016
+ // const joinUserChannelRequest = Convert.toJoinUserChannelRequest(json);
7017
+ // const joinUserChannelResponse = Convert.toJoinUserChannelResponse(json);
7018
+ // const leaveCurrentChannelRequest = Convert.toLeaveCurrentChannelRequest(json);
7019
+ // const leaveCurrentChannelResponse = Convert.toLeaveCurrentChannelResponse(json);
7020
+ // const openRequest = Convert.toOpenRequest(json);
7021
+ // const openResponse = Convert.toOpenResponse(json);
7022
+ // const privateChannelAddEventListenerRequest = Convert.toPrivateChannelAddEventListenerRequest(json);
7023
+ // const privateChannelAddEventListenerResponse = Convert.toPrivateChannelAddEventListenerResponse(json);
7024
+ // const privateChannelDisconnectRequest = Convert.toPrivateChannelDisconnectRequest(json);
7025
+ // const privateChannelDisconnectResponse = Convert.toPrivateChannelDisconnectResponse(json);
7026
+ // const privateChannelOnAddContextListenerEvent = Convert.toPrivateChannelOnAddContextListenerEvent(json);
7027
+ // const privateChannelOnDisconnectEvent = Convert.toPrivateChannelOnDisconnectEvent(json);
7028
+ // const privateChannelOnUnsubscribeEvent = Convert.toPrivateChannelOnUnsubscribeEvent(json);
7029
+ // const privateChannelUnsubscribeEventListenerRequest = Convert.toPrivateChannelUnsubscribeEventListenerRequest(json);
7030
+ // const privateChannelUnsubscribeEventListenerResponse = Convert.toPrivateChannelUnsubscribeEventListenerResponse(json);
7031
+ // const raiseIntentForContextRequest = Convert.toRaiseIntentForContextRequest(json);
7032
+ // const raiseIntentForContextResponse = Convert.toRaiseIntentForContextResponse(json);
7033
+ // const raiseIntentRequest = Convert.toRaiseIntentRequest(json);
7034
+ // const raiseIntentResponse = Convert.toRaiseIntentResponse(json);
7035
+ // const raiseIntentResultResponse = Convert.toRaiseIntentResultResponse(json);
7036
+ //
7037
+ // These functions will throw an error if the JSON doesn't
7038
+ // match the expected interface, even if the JSON is valid.
7039
+ /**
7040
+ * Identifies the type of the message and it is typically set to the FDC3 function name that
7041
+ * the message relates to, e.g. 'findIntent', with 'Response' appended.
7042
+ */
7043
+ // Converts JSON strings to/from your types
7044
+ // and asserts the results of JSON.parse at runtime
7045
+ function a$1(typ) {
7046
+ return { arrayItems: typ };
7047
+ }
7048
+ function u$1(...typs) {
7049
+ return { unionMembers: typs };
7050
+ }
7051
+ function o$1(props, additional) {
7052
+ return { props, additional };
7053
+ }
7054
+ function m$1(additional) {
7055
+ return { props: [], additional };
7056
+ }
7057
+ function r$1(name) {
7058
+ return { ref: name };
7059
+ }
7060
+ ({
7061
+ WebConnectionProtocol1HelloPayload: o$1([
7062
+ { json: 'actualUrl', js: 'actualUrl', typ: '' },
7063
+ { json: 'channelSelector', js: 'channelSelector', typ: u$1(undefined, true) },
7064
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7065
+ { json: 'identityUrl', js: 'identityUrl', typ: '' },
7066
+ { json: 'intentResolver', js: 'intentResolver', typ: u$1(undefined, true) },
7067
+ ], 'any'),
7068
+ WebConnectionProtocol3HandshakePayload: o$1([
7069
+ { json: 'appLaunchTimeout', js: 'appLaunchTimeout', typ: u$1(undefined, 3.14) },
7070
+ { json: 'channelSelectorUrl', js: 'channelSelectorUrl', typ: u$1(true, '') },
7071
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7072
+ { json: 'intentResolverUrl', js: 'intentResolverUrl', typ: u$1(true, '') },
7073
+ { json: 'messageExchangeTimeout', js: 'messageExchangeTimeout', typ: u$1(undefined, 3.14) },
7074
+ ], false),
7075
+ WebConnectionProtocol4ValidateAppIdentityPayload: o$1([
7076
+ { json: 'actualUrl', js: 'actualUrl', typ: '' },
7077
+ { json: 'identityUrl', js: 'identityUrl', typ: '' },
7078
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7079
+ { json: 'instanceUuid', js: 'instanceUuid', typ: u$1(undefined, '') },
7080
+ ], false),
7081
+ WebConnectionProtocol5ValidateAppIdentityFailedResponsePayload: o$1([{ json: 'message', js: 'message', typ: u$1(undefined, '') }], false),
7082
+ ImplementationMetadata: o$1([
7083
+ { json: 'appMetadata', js: 'appMetadata', typ: r$1('AppMetadata') },
7084
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7085
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r$1('OptionalFeatures') },
7086
+ { json: 'provider', js: 'provider', typ: '' },
7087
+ { json: 'providerVersion', js: 'providerVersion', typ: u$1(undefined, '') },
7088
+ ], false),
7089
+ AppMetadata: o$1([
7090
+ { json: 'appId', js: 'appId', typ: '' },
7091
+ { json: 'description', js: 'description', typ: u$1(undefined, '') },
7092
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$1(undefined, '') },
7093
+ { json: 'icons', js: 'icons', typ: u$1(undefined, a$1(r$1('Icon'))) },
7094
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7095
+ { json: 'instanceMetadata', js: 'instanceMetadata', typ: u$1(undefined, m$1('any')) },
7096
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7097
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, u$1(null, '')) },
7098
+ { json: 'screenshots', js: 'screenshots', typ: u$1(undefined, a$1(r$1('Image'))) },
7099
+ { json: 'title', js: 'title', typ: u$1(undefined, '') },
7100
+ { json: 'tooltip', js: 'tooltip', typ: u$1(undefined, '') },
7101
+ { json: 'version', js: 'version', typ: u$1(undefined, '') },
7102
+ ], false),
7103
+ Icon: o$1([
7104
+ { json: 'size', js: 'size', typ: u$1(undefined, '') },
7105
+ { json: 'src', js: 'src', typ: '' },
7106
+ { json: 'type', js: 'type', typ: u$1(undefined, '') },
7107
+ ], false),
7108
+ Image: o$1([
7109
+ { json: 'label', js: 'label', typ: u$1(undefined, '') },
7110
+ { json: 'size', js: 'size', typ: u$1(undefined, '') },
7111
+ { json: 'src', js: 'src', typ: '' },
7112
+ { json: 'type', js: 'type', typ: u$1(undefined, '') },
7113
+ ], false),
7114
+ WebConnectionProtocolMessage: o$1([
7115
+ { json: 'meta', js: 'meta', typ: r$1('ConnectionStepMetadata') },
7116
+ { json: 'payload', js: 'payload', typ: u$1(undefined, m$1('any')) },
7117
+ { json: 'type', js: 'type', typ: r$1('ConnectionStepMessageType') },
7118
+ ], false),
7119
+ ConnectionStepMetadata: o$1([
7120
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7121
+ { json: 'connectionAttemptUuid', js: 'connectionAttemptUuid', typ: u$1(undefined, '') },
7122
+ ], false),
7123
+ AddContextListenerRequestMeta: o$1([
7124
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7125
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7126
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7127
+ ], false),
7128
+ AppIdentifier: o$1([
7129
+ { json: 'appId', js: 'appId', typ: '' },
7130
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u$1(undefined, '') },
7131
+ { json: 'instanceId', js: 'instanceId', typ: u$1(undefined, '') },
7132
+ ], 'any'),
7133
+ AddContextListenerRequestPayload: o$1([
7134
+ { json: 'channelId', js: 'channelId', typ: u$1(null, '') },
7135
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7136
+ ], false),
7137
+ AddContextListenerResponseMeta: o$1([
7138
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7139
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7140
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7141
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7142
+ ], false),
7143
+ AddContextListenerResponsePayload: o$1([
7144
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7145
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7146
+ ], false),
7147
+ AddEventListenerRequestPayload: o$1([{ json: 'type', js: 'type', typ: u$1(r$1('FDC3EventType'), null) }], false),
7148
+ AddEventListenerResponsePayload: o$1([
7149
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7150
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7151
+ ], false),
7152
+ PayloadObject: o$1([
7153
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FluffyError')) },
7154
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7155
+ ], 'any'),
7156
+ AgentResponseMessageMeta: o$1([
7157
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7158
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7159
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7160
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7161
+ ], false),
7162
+ AgentResponseMessageResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) }], 'any'),
7163
+ AppRequestMessageMeta: o$1([
7164
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7165
+ { json: 'source', js: 'source', typ: u$1(undefined, r$1('AppIdentifier')) },
7166
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7167
+ ], false),
7168
+ BroadcastEventPayload: o$1([
7169
+ { json: 'channelId', js: 'channelId', typ: u$1(null, '') },
7170
+ { json: 'context', js: 'context', typ: r$1('Context') },
7171
+ { json: 'originatingApp', js: 'originatingApp', typ: u$1(undefined, r$1('AppIdentifier')) },
7172
+ ], false),
7173
+ Context: o$1([
7174
+ { json: 'id', js: 'id', typ: u$1(undefined, m$1('any')) },
7175
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7176
+ { json: 'type', js: 'type', typ: '' },
7177
+ ], 'any'),
7178
+ BroadcastResponseResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) }], 'any'),
7179
+ ChannelChangedEventPayload: o$1([{ json: 'newChannelId', js: 'newChannelId', typ: u$1(null, '') }], false),
7180
+ CreatePrivateChannelResponsePayload: o$1([
7181
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7182
+ { json: 'privateChannel', js: 'privateChannel', typ: u$1(undefined, r$1('Channel')) },
7183
+ ], false),
7184
+ Channel: o$1([
7185
+ { json: 'displayMetadata', js: 'displayMetadata', typ: u$1(undefined, r$1('DisplayMetadata')) },
7186
+ { json: 'id', js: 'id', typ: '' },
7187
+ { json: 'type', js: 'type', typ: r$1('Type') },
7188
+ ], false),
7189
+ DisplayMetadata: o$1([
7190
+ { json: 'color', js: 'color', typ: u$1(undefined, '') },
7191
+ { json: 'glyph', js: 'glyph', typ: u$1(undefined, '') },
7192
+ { json: 'name', js: 'name', typ: u$1(undefined, '') },
7193
+ ], false),
7194
+ Fdc3UserInterfaceChannelSelectedPayload: o$1([{ json: 'selected', js: 'selected', typ: u$1(null, '') }], false),
7195
+ Fdc3UserInterfaceChannelsPayload: o$1([
7196
+ { json: 'selected', js: 'selected', typ: u$1(null, '') },
7197
+ { json: 'userChannels', js: 'userChannels', typ: a$1(r$1('Channel')) },
7198
+ ], false),
7199
+ InitialCSS: o$1([
7200
+ { json: 'bottom', js: 'bottom', typ: u$1(undefined, '') },
7201
+ { json: 'height', js: 'height', typ: u$1(undefined, '') },
7202
+ { json: 'left', js: 'left', typ: u$1(undefined, '') },
7203
+ { json: 'maxHeight', js: 'maxHeight', typ: u$1(undefined, '') },
7204
+ { json: 'maxWidth', js: 'maxWidth', typ: u$1(undefined, '') },
7205
+ { json: 'right', js: 'right', typ: u$1(undefined, '') },
7206
+ { json: 'top', js: 'top', typ: u$1(undefined, '') },
7207
+ { json: 'transition', js: 'transition', typ: u$1(undefined, '') },
7208
+ { json: 'width', js: 'width', typ: u$1(undefined, '') },
7209
+ { json: 'zIndex', js: 'zIndex', typ: u$1(undefined, '') },
7210
+ ], 'any'),
7211
+ Fdc3UserInterfaceMessage: o$1([
7212
+ { json: 'payload', js: 'payload', typ: u$1(undefined, m$1('any')) },
7213
+ { json: 'type', js: 'type', typ: r$1('Fdc3UserInterfaceMessageType') },
7214
+ ], false),
7215
+ IntentMetadata: o$1([
7216
+ { json: 'displayName', js: 'displayName', typ: u$1(undefined, '') },
7217
+ { json: 'name', js: 'name', typ: '' },
7218
+ ], false),
7219
+ Fdc3UserInterfaceResolveActionPayload: o$1([
7220
+ { json: 'action', js: 'action', typ: r$1('Action') },
7221
+ { json: 'appIdentifier', js: 'appIdentifier', typ: u$1(undefined, r$1('AppIdentifier')) },
7222
+ { json: 'intent', js: 'intent', typ: u$1(undefined, '') },
7223
+ ], false),
7224
+ UpdatedCSS: o$1([
7225
+ { json: 'bottom', js: 'bottom', typ: u$1(undefined, '') },
7226
+ { json: 'height', js: 'height', typ: u$1(undefined, '') },
7227
+ { json: 'left', js: 'left', typ: u$1(undefined, '') },
7228
+ { json: 'maxHeight', js: 'maxHeight', typ: u$1(undefined, '') },
7229
+ { json: 'maxWidth', js: 'maxWidth', typ: u$1(undefined, '') },
7230
+ { json: 'right', js: 'right', typ: u$1(undefined, '') },
7231
+ { json: 'top', js: 'top', typ: u$1(undefined, '') },
7232
+ { json: 'transition', js: 'transition', typ: u$1(undefined, '') },
7233
+ { json: 'width', js: 'width', typ: u$1(undefined, '') },
7234
+ { json: 'zIndex', js: 'zIndex', typ: u$1(undefined, '') },
7235
+ ], 'any'),
7236
+ FindInstancesResponsePayload: o$1([
7237
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7238
+ { json: 'appIdentifiers', js: 'appIdentifiers', typ: u$1(undefined, a$1(r$1('AppMetadata'))) },
7239
+ ], false),
7240
+ FindIntentRequestPayload: o$1([
7241
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7242
+ { json: 'intent', js: 'intent', typ: '' },
7243
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, '') },
7244
+ ], false),
7245
+ FindIntentResponsePayload: o$1([
7246
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7247
+ { json: 'appIntent', js: 'appIntent', typ: u$1(undefined, r$1('AppIntent')) },
7248
+ ], false),
7249
+ FindIntentsByContextRequestPayload: o$1([
7250
+ { json: 'context', js: 'context', typ: r$1('Context') },
7251
+ { json: 'resultType', js: 'resultType', typ: u$1(undefined, '') },
7252
+ ], false),
7253
+ FindIntentsByContextResponsePayload: o$1([
7254
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7255
+ { json: 'appIntents', js: 'appIntents', typ: u$1(undefined, a$1(r$1('AppIntent'))) },
7256
+ ], false),
7257
+ GetAppMetadataResponsePayload: o$1([
7258
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7259
+ { json: 'appMetadata', js: 'appMetadata', typ: u$1(undefined, r$1('AppMetadata')) },
7260
+ ], false),
7261
+ GetCurrentChannelResponsePayload: o$1([
7262
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7263
+ { json: 'channel', js: 'channel', typ: u$1(undefined, u$1(r$1('Channel'), null)) },
7264
+ ], false),
7265
+ GetCurrentContextRequestPayload: o$1([
7266
+ { json: 'channelId', js: 'channelId', typ: '' },
7267
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7268
+ ], false),
7269
+ GetCurrentContextResponsePayload: o$1([
7270
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7271
+ { json: 'context', js: 'context', typ: u$1(undefined, u$1(null, r$1('Context'))) },
7272
+ ], false),
7273
+ GetInfoResponsePayload: o$1([
7274
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7275
+ { json: 'implementationMetadata', js: 'implementationMetadata', typ: u$1(undefined, r$1('ImplementationMetadata')) },
7276
+ ], false),
7277
+ GetOrCreateChannelResponsePayload: o$1([
7278
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7279
+ { json: 'channel', js: 'channel', typ: u$1(undefined, r$1('Channel')) },
7280
+ ], false),
7281
+ GetUserChannelsResponsePayload: o$1([
7282
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7283
+ { json: 'userChannels', js: 'userChannels', typ: u$1(undefined, a$1(r$1('Channel'))) },
7284
+ ], false),
7285
+ IntentEventPayload: o$1([
7286
+ { json: 'context', js: 'context', typ: r$1('Context') },
7287
+ { json: 'intent', js: 'intent', typ: '' },
7288
+ { json: 'originatingApp', js: 'originatingApp', typ: u$1(undefined, r$1('AppIdentifier')) },
7289
+ { json: 'raiseIntentRequestUuid', js: 'raiseIntentRequestUuid', typ: '' },
7290
+ ], false),
7291
+ IntentResult: o$1([
7292
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7293
+ { json: 'channel', js: 'channel', typ: u$1(undefined, r$1('Channel')) },
7294
+ ], false),
7295
+ JoinUserChannelResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7296
+ LeaveCurrentChannelResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7297
+ OpenRequestPayload: o$1([
7298
+ { json: 'app', js: 'app', typ: r$1('AppIdentifier') },
7299
+ { json: 'context', js: 'context', typ: u$1(undefined, r$1('Context')) },
7300
+ ], false),
7301
+ OpenResponsePayload: o$1([
7302
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('OpenErrorResponsePayload')) },
7303
+ { json: 'appIdentifier', js: 'appIdentifier', typ: u$1(undefined, r$1('AppIdentifier')) },
7304
+ ], false),
7305
+ PrivateChannelAddEventListenerRequestPayload: o$1([
7306
+ { json: 'listenerType', js: 'listenerType', typ: u$1(r$1('PrivateChannelEventType'), null) },
7307
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7308
+ ], false),
7309
+ PrivateChannelAddEventListenerResponsePayload: o$1([
7310
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) },
7311
+ { json: 'listenerUUID', js: 'listenerUUID', typ: u$1(undefined, '') },
7312
+ ], false),
7313
+ PrivateChannelDisconnectResponsePayload: o$1([{ json: 'error', js: 'error', typ: u$1(undefined, r$1('PurpleError')) }], false),
7314
+ PrivateChannelOnAddContextListenerEventPayload: o$1([
7315
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7316
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7317
+ ], false),
7318
+ PrivateChannelOnUnsubscribeEventPayload: o$1([
7319
+ { json: 'contextType', js: 'contextType', typ: u$1(null, '') },
7320
+ { json: 'privateChannelId', js: 'privateChannelId', typ: '' },
7321
+ ], false),
7322
+ RaiseIntentForContextRequestPayload: o$1([
7323
+ { json: 'app', js: 'app', typ: u$1(undefined, r$1('AppIdentifier')) },
7324
+ { json: 'context', js: 'context', typ: r$1('Context') },
7325
+ ], false),
7326
+ RaiseIntentForContextResponsePayload: o$1([
7327
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7328
+ { json: 'intentResolution', js: 'intentResolution', typ: u$1(undefined, r$1('IntentResolution')) },
7329
+ { json: 'appIntents', js: 'appIntents', typ: u$1(undefined, a$1(r$1('AppIntent'))) },
7330
+ ], false),
7331
+ RaiseIntentRequestPayload: o$1([
7332
+ { json: 'app', js: 'app', typ: u$1(undefined, r$1('AppIdentifier')) },
7333
+ { json: 'context', js: 'context', typ: r$1('Context') },
7334
+ { json: 'intent', js: 'intent', typ: '' },
7335
+ ], false),
7336
+ RaiseIntentResponsePayload: o$1([
7337
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('FindInstancesErrors')) },
7338
+ { json: 'intentResolution', js: 'intentResolution', typ: u$1(undefined, r$1('IntentResolution')) },
7339
+ { json: 'appIntent', js: 'appIntent', typ: u$1(undefined, r$1('AppIntent')) },
7340
+ ], false),
7341
+ RaiseIntentResultResponsePayload: o$1([
7342
+ { json: 'error', js: 'error', typ: u$1(undefined, r$1('ResponsePayloadError')) },
7343
+ { json: 'intentResult', js: 'intentResult', typ: u$1(undefined, r$1('IntentResult')) },
7344
+ ], false)});
7345
+
7346
+ // To parse this data:
7347
+ //
7348
+ // 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";
6490
7349
  //
6491
- // const fDC3DesktopAgentAPISchema = Convert.toFDC3DesktopAgentAPISchema(json);
6492
7350
  // const agentErrorResponseMessage = Convert.toAgentErrorResponseMessage(json);
6493
7351
  // const agentRequestMessage = Convert.toAgentRequestMessage(json);
6494
7352
  // const agentResponseMessage = Convert.toAgentResponseMessage(json);
@@ -6497,7 +7355,7 @@
6497
7355
  // const bridgeResponseMessage = Convert.toBridgeResponseMessage(json);
6498
7356
  // const broadcastAgentRequest = Convert.toBroadcastAgentRequest(json);
6499
7357
  // const broadcastBridgeRequest = Convert.toBroadcastBridgeRequest(json);
6500
- // const bridgingCommons = Convert.toBridgingCommons(json);
7358
+ // const bridgeCommonDefinitions = Convert.toBridgeCommonDefinitions(json);
6501
7359
  // const connectionStepMessage = Convert.toConnectionStepMessage(json);
6502
7360
  // const connectionStep2Hello = Convert.toConnectionStep2Hello(json);
6503
7361
  // const connectionStep3Handshake = Convert.toConnectionStep3Handshake(json);
@@ -6555,17 +7413,439 @@
6555
7413
  // const raiseIntentResultAgentResponse = Convert.toRaiseIntentResultAgentResponse(json);
6556
7414
  // const raiseIntentResultBridgeErrorResponse = Convert.toRaiseIntentResultBridgeErrorResponse(json);
6557
7415
  // const raiseIntentResultBridgeResponse = Convert.toRaiseIntentResultBridgeResponse(json);
6558
- // const context = Convert.toContext(json);
6559
7416
  //
6560
7417
  // These functions will throw an error if the JSON doesn't
6561
7418
  // match the expected interface, even if the JSON is valid.
6562
7419
  // Converts JSON strings to/from your types
6563
7420
  // and asserts the results of JSON.parse at runtime
7421
+ function a(typ) {
7422
+ return { arrayItems: typ };
7423
+ }
7424
+ function u(...typs) {
7425
+ return { unionMembers: typs };
7426
+ }
7427
+ function o(props, additional) {
7428
+ return { props, additional };
7429
+ }
7430
+ function m(additional) {
7431
+ return { props: [], additional };
7432
+ }
7433
+ function r(name) {
7434
+ return { ref: name };
7435
+ }
7436
+ ({
7437
+ AgentRequestMetadata: o([
7438
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7439
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7440
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7441
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7442
+ ], false),
7443
+ BridgeParticipantIdentifier: o([
7444
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7445
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7446
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7447
+ ], 'any'),
7448
+ SourceIdentifier: o([
7449
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7450
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7451
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7452
+ ], 'any'),
7453
+ ResponseErrorMessagePayload: o([{ json: 'error', js: 'error', typ: u(undefined, r('ResponseErrorDetail')) }], 'any'),
7454
+ BridgeRequestMetadata: o([
7455
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7456
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7457
+ { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') },
7458
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7459
+ ], false),
7460
+ BridgeResponseMessageMeta: o([
7461
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7462
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7463
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7464
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7465
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7466
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7467
+ ], false),
7468
+ SourceObject: o([
7469
+ { json: 'appId', js: 'appId', typ: '' },
7470
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7471
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7472
+ ], 'any'),
7473
+ Context: o([
7474
+ { json: 'id', js: 'id', typ: u(undefined, m('any')) },
7475
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7476
+ { json: 'type', js: 'type', typ: '' },
7477
+ ], 'any'),
7478
+ MetaSource: o([
7479
+ { json: 'appId', js: 'appId', typ: '' },
7480
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7481
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7482
+ ], 'any'),
7483
+ ConnectionStepMetadata: o([
7484
+ { json: 'requestUuid', js: 'requestUuid', typ: u(undefined, '') },
7485
+ { json: 'responseUuid', js: 'responseUuid', typ: u(undefined, '') },
7486
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7487
+ ], false),
7488
+ ConnectionStep2HelloPayload: o([
7489
+ { json: 'authRequired', js: 'authRequired', typ: true },
7490
+ { json: 'authToken', js: 'authToken', typ: u(undefined, '') },
7491
+ { json: 'desktopAgentBridgeVersion', js: 'desktopAgentBridgeVersion', typ: '' },
7492
+ { json: 'supportedFDC3Versions', js: 'supportedFDC3Versions', typ: a('') },
7493
+ ], false),
7494
+ ConnectionStep3HandshakePayload: o([
7495
+ { json: 'authToken', js: 'authToken', typ: u(undefined, '') },
7496
+ { json: 'channelsState', js: 'channelsState', typ: m(a(r('Context'))) },
7497
+ { json: 'implementationMetadata', js: 'implementationMetadata', typ: r('ConnectingAgentImplementationMetadata') },
7498
+ { json: 'requestedName', js: 'requestedName', typ: '' },
7499
+ ], false),
7500
+ ConnectingAgentImplementationMetadata: o([
7501
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7502
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') },
7503
+ { json: 'provider', js: 'provider', typ: '' },
7504
+ { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') },
7505
+ ], false),
7506
+ ConnectionStep4AuthenticationFailedPayload: o([{ json: 'message', js: 'message', typ: u(undefined, '') }], false),
7507
+ ConnectionStep6ConnectedAgentsUpdatePayload: o([
7508
+ { json: 'addAgent', js: 'addAgent', typ: u(undefined, '') },
7509
+ { json: 'allAgents', js: 'allAgents', typ: a(r('DesktopAgentImplementationMetadata')) },
7510
+ { json: 'channelsState', js: 'channelsState', typ: u(undefined, m(a(r('Context')))) },
7511
+ { json: 'removeAgent', js: 'removeAgent', typ: u(undefined, '') },
7512
+ ], false),
7513
+ DesktopAgentImplementationMetadata: o([
7514
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7515
+ { json: 'fdc3Version', js: 'fdc3Version', typ: '' },
7516
+ { json: 'optionalFeatures', js: 'optionalFeatures', typ: r('OptionalFeatures') },
7517
+ { json: 'provider', js: 'provider', typ: '' },
7518
+ { json: 'providerVersion', js: 'providerVersion', typ: u(undefined, '') },
7519
+ ], false),
7520
+ FindInstancesAgentRequestMeta: o([
7521
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7522
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7523
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7524
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7525
+ ], false),
7526
+ DestinationObject: o([
7527
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7528
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7529
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7530
+ ], 'any'),
7531
+ AppIdentifier: o([
7532
+ { json: 'appId', js: 'appId', typ: '' },
7533
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7534
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7535
+ ], 'any'),
7536
+ AppMetadata: o([
7537
+ { json: 'appId', js: 'appId', typ: '' },
7538
+ { json: 'description', js: 'description', typ: u(undefined, '') },
7539
+ { json: 'desktopAgent', js: 'desktopAgent', typ: u(undefined, '') },
7540
+ { json: 'icons', js: 'icons', typ: u(undefined, a(r('Icon'))) },
7541
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7542
+ { json: 'instanceMetadata', js: 'instanceMetadata', typ: u(undefined, m('any')) },
7543
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7544
+ { json: 'resultType', js: 'resultType', typ: u(undefined, u(null, '')) },
7545
+ { json: 'screenshots', js: 'screenshots', typ: u(undefined, a(r('Image'))) },
7546
+ { json: 'title', js: 'title', typ: u(undefined, '') },
7547
+ { json: 'tooltip', js: 'tooltip', typ: u(undefined, '') },
7548
+ { json: 'version', js: 'version', typ: u(undefined, '') },
7549
+ ], false),
7550
+ Icon: o([
7551
+ { json: 'size', js: 'size', typ: u(undefined, '') },
7552
+ { json: 'src', js: 'src', typ: '' },
7553
+ { json: 'type', js: 'type', typ: u(undefined, '') },
7554
+ ], false),
7555
+ Image: o([
7556
+ { json: 'label', js: 'label', typ: u(undefined, '') },
7557
+ { json: 'size', js: 'size', typ: u(undefined, '') },
7558
+ { json: 'src', js: 'src', typ: '' },
7559
+ { json: 'type', js: 'type', typ: u(undefined, '') },
7560
+ ], false),
7561
+ FindInstancesBridgeRequestMeta: o([
7562
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7563
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7564
+ { json: 'source', js: 'source', typ: r('MetaSourceObject') },
7565
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7566
+ ], false),
7567
+ MetaSourceObject: o([
7568
+ { json: 'appId', js: 'appId', typ: u(undefined, '') },
7569
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7570
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7571
+ ], 'any'),
7572
+ FindIntentAgentRequestMeta: o([
7573
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7574
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7575
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7576
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7577
+ ], false),
7578
+ FindIntentAgentRequestPayload: o([
7579
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7580
+ { json: 'intent', js: 'intent', typ: '' },
7581
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7582
+ ], false),
7583
+ IntentMetadata: o([
7584
+ { json: 'displayName', js: 'displayName', typ: u(undefined, '') },
7585
+ { json: 'name', js: 'name', typ: '' },
7586
+ ], false),
7587
+ FindIntentBridgeRequestMeta: o([
7588
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7589
+ { json: 'source', js: 'source', typ: r('BridgeParticipantIdentifier') },
7590
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7591
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7592
+ ], false),
7593
+ FindIntentBridgeRequestPayload: o([
7594
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7595
+ { json: 'intent', js: 'intent', typ: '' },
7596
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7597
+ ], false),
7598
+ FindIntentBridgeResponseMeta: o([
7599
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7600
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7601
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7602
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7603
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7604
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7605
+ ], false),
7606
+ FindIntentsByContextAgentRequestMeta: o([
7607
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7608
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7609
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7610
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7611
+ ], false),
7612
+ FindIntentsByContextAgentRequestPayload: o([
7613
+ { json: 'context', js: 'context', typ: r('Context') },
7614
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7615
+ ], false),
7616
+ FindIntentsByContextBridgeRequestMeta: o([
7617
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7618
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7619
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7620
+ { json: 'destination', js: 'destination', typ: u(undefined, r('BridgeParticipantIdentifier')) },
7621
+ ], false),
7622
+ FindIntentsByContextBridgeRequestPayload: o([
7623
+ { json: 'context', js: 'context', typ: r('Context') },
7624
+ { json: 'resultType', js: 'resultType', typ: u(undefined, '') },
7625
+ ], false),
7626
+ FindIntentsByContextBridgeResponseMeta: o([
7627
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7628
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7629
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7630
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7631
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7632
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7633
+ ], false),
7634
+ GetAppMetadataAgentRequestMeta: o([
7635
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7636
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7637
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceIdentifier')) },
7638
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7639
+ ], false),
7640
+ AppObject: o([
7641
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7642
+ { json: 'appId', js: 'appId', typ: '' },
7643
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7644
+ ], 'any'),
7645
+ GetAppMetadataBridgeRequestMeta: o([
7646
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7647
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7648
+ { json: 'source', js: 'source', typ: r('MetaSourceObject') },
7649
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7650
+ ], false),
7651
+ GetAppMetadataBridgeResponseMeta: o([
7652
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7653
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7654
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7655
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7656
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7657
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7658
+ ], false),
7659
+ OpenAgentRequestMeta: o([
7660
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7661
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7662
+ { json: 'source', js: 'source', typ: r('SourceObject') },
7663
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7664
+ ], false),
7665
+ OpenAgentRequestPayload: o([
7666
+ { json: 'app', js: 'app', typ: r('AppToOpen') },
7667
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7668
+ ], false),
7669
+ AppToOpen: o([
7670
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7671
+ { json: 'appId', js: 'appId', typ: '' },
7672
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7673
+ ], 'any'),
7674
+ OpenBridgeRequestMeta: o([
7675
+ { json: 'destination', js: 'destination', typ: u(undefined, r('DestinationObject')) },
7676
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7677
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7678
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7679
+ ], false),
7680
+ OpenBridgeRequestPayload: o([
7681
+ { json: 'app', js: 'app', typ: r('AppToOpen') },
7682
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7683
+ ], false),
7684
+ OpenBridgeResponseMeta: o([
7685
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7686
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7687
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7688
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7689
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7690
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7691
+ ], false),
7692
+ PrivateChannelBroadcastAgentRequestMeta: o([
7693
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7694
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7695
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7696
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7697
+ ], false),
7698
+ MetaDestination: o([
7699
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7700
+ { json: 'appId', js: 'appId', typ: '' },
7701
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7702
+ ], 'any'),
7703
+ PrivateChannelBroadcastBridgeRequestMeta: o([
7704
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7705
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7706
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7707
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7708
+ ], false),
7709
+ PrivateChannelEventListenerAddedAgentRequestMeta: o([
7710
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7711
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7712
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7713
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7714
+ ], false),
7715
+ PrivateChannelEventListenerAddedBridgeRequestMeta: o([
7716
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7717
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7718
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7719
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7720
+ ], false),
7721
+ PrivateChannelEventListenerRemovedAgentRequestMeta: o([
7722
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7723
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7724
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7725
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7726
+ ], false),
7727
+ PrivateChannelEventListenerRemovedBridgeRequestMeta: o([
7728
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7729
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7730
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7731
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7732
+ ], false),
7733
+ PrivateChannelOnAddContextListenerAgentRequestMeta: o([
7734
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7735
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7736
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7737
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7738
+ ], false),
7739
+ PrivateChannelOnAddContextListenerAgentRequestPayload: o([
7740
+ { json: 'channelId', js: 'channelId', typ: '' },
7741
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7742
+ ], false),
7743
+ PrivateChannelOnAddContextListenerBridgeRequestMeta: o([
7744
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7745
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7746
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7747
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7748
+ ], false),
7749
+ PrivateChannelOnAddContextListenerBridgeRequestPayload: o([
7750
+ { json: 'channelId', js: 'channelId', typ: '' },
7751
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7752
+ ], false),
7753
+ PrivateChannelOnDisconnectAgentRequestMeta: o([
7754
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7755
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7756
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7757
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7758
+ ], false),
7759
+ PrivateChannelOnDisconnectBridgeRequestMeta: o([
7760
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7761
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7762
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7763
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7764
+ ], false),
7765
+ PrivateChannelOnUnsubscribeAgentRequestMeta: o([
7766
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7767
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7768
+ { json: 'source', js: 'source', typ: u(undefined, r('SourceObject')) },
7769
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7770
+ ], false),
7771
+ PrivateChannelOnUnsubscribeAgentRequestPayload: o([
7772
+ { json: 'channelId', js: 'channelId', typ: '' },
7773
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7774
+ ], false),
7775
+ ERequestMetadata: o([
7776
+ { json: 'destination', js: 'destination', typ: u(undefined, r('MetaDestination')) },
7777
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7778
+ { json: 'source', js: 'source', typ: r('MetaSource') },
7779
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7780
+ ], false),
7781
+ PrivateChannelOnUnsubscribeBridgeRequestPayload: o([
7782
+ { json: 'channelId', js: 'channelId', typ: '' },
7783
+ { json: 'contextType', js: 'contextType', typ: u(null, '') },
7784
+ ], false),
7785
+ AppDestinationIdentifier: o([
7786
+ { json: 'desktopAgent', js: 'desktopAgent', typ: '' },
7787
+ { json: 'appId', js: 'appId', typ: '' },
7788
+ { json: 'instanceId', js: 'instanceId', typ: u(undefined, '') },
7789
+ ], 'any'),
7790
+ RaiseIntentBridgeResponseMeta: o([
7791
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7792
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7793
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7794
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7795
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7796
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7797
+ ], false),
7798
+ IntentResult: o([
7799
+ { json: 'context', js: 'context', typ: u(undefined, r('Context')) },
7800
+ { json: 'channel', js: 'channel', typ: u(undefined, r('Channel')) },
7801
+ ], false),
7802
+ Channel: o([
7803
+ { json: 'displayMetadata', js: 'displayMetadata', typ: u(undefined, r('DisplayMetadata')) },
7804
+ { json: 'id', js: 'id', typ: '' },
7805
+ { json: 'type', js: 'type', typ: r('Type') },
7806
+ ], false),
7807
+ DisplayMetadata: o([
7808
+ { json: 'color', js: 'color', typ: u(undefined, '') },
7809
+ { json: 'glyph', js: 'glyph', typ: u(undefined, '') },
7810
+ { json: 'name', js: 'name', typ: u(undefined, '') },
7811
+ ], false),
7812
+ RaiseIntentResultBridgeResponseMeta: o([
7813
+ { json: 'errorDetails', js: 'errorDetails', typ: u(undefined, a(r('ResponseErrorDetail'))) },
7814
+ { json: 'errorSources', js: 'errorSources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7815
+ { json: 'requestUuid', js: 'requestUuid', typ: '' },
7816
+ { json: 'responseUuid', js: 'responseUuid', typ: '' },
7817
+ { json: 'sources', js: 'sources', typ: u(undefined, a(r('DesktopAgentIdentifier'))) },
7818
+ { json: 'timestamp', js: 'timestamp', typ: Date },
7819
+ ], false)});
6564
7820
 
6565
7821
  /**
6566
7822
  * SPDX-License-Identifier: Apache-2.0
6567
7823
  * Copyright FINOS FDC3 contributors - see NOTICE file
6568
7824
  */
7825
+ /**
7826
+ * Contains constants representing the errors that can be encountered when trying to connect to a web-based Desktop Agent with the getAgent function.
7827
+ */
7828
+ var AgentError;
7829
+ (function (AgentError) {
7830
+ /** Returned if no Desktop Agent was found by any means available or
7831
+ * if the Agent previously connected to is not contactable on a
7832
+ * subsequent connection attempt.*/
7833
+ AgentError["AgentNotFound"] = "AgentNotFound";
7834
+ /** Returned if validation of the app identity by the Desktop Agent
7835
+ * Failed or the app is not being allowed to connect to the Desktop Agent
7836
+ * for another reason. */
7837
+ AgentError["AccessDenied"] = "AccessDenied";
7838
+ /** Returned if an error or exception occurs while trying to set
7839
+ * up communication with a Desktop Agent. */
7840
+ AgentError["ErrorOnConnect"] = "ErrorOnConnect";
7841
+ /** Returned if the failover function is not a function, or it did not
7842
+ * resolve to one of the allowed types. */
7843
+ AgentError["InvalidFailover"] = "InvalidFailover";
7844
+ /** Returned if an API call rejects after a timeout. Used where an API call
7845
+ * is not aligned to another error enumeration.
7846
+ */
7847
+ AgentError["ApiTimeout"] = "ApiTimeout";
7848
+ })(AgentError || (AgentError = {}));
6569
7849
  /** Constants representing the errors that can be encountered when calling the `open` method on the DesktopAgent object (`fdc3`). */
6570
7850
  var OpenError;
6571
7851
  (function (OpenError) {
@@ -6581,6 +7861,8 @@
6581
7861
  OpenError["MalformedContext"] = "MalformedContext";
6582
7862
  /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/
6583
7863
  OpenError["DesktopAgentNotFound"] = "DesktopAgentNotFound";
7864
+ /** 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.*/
7865
+ OpenError["ApiTimeout"] = "ApiTimeout";
6584
7866
  })(OpenError || (OpenError = {}));
6585
7867
  /** Constants representing the errors that can be encountered when calling the `findIntent`, `findIntentsByContext`, `raiseIntent` or `raiseIntentForContext` methods on the DesktopAgent (`fdc3`). */
6586
7868
  var ResolveError;
@@ -6603,6 +7885,8 @@
6603
7885
  ResolveError["MalformedContext"] = "MalformedContext";
6604
7886
  /** @experimental Returned if the specified Desktop Agent is not found, via a connected Desktop Agent Bridge.*/
6605
7887
  ResolveError["DesktopAgentNotFound"] = "DesktopAgentNotFound";
7888
+ /** 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).*/
7889
+ ResolveError["ApiTimeout"] = "ApiTimeout";
6606
7890
  })(ResolveError || (ResolveError = {}));
6607
7891
  var ResultError;
6608
7892
  (function (ResultError) {
@@ -6610,6 +7894,8 @@
6610
7894
  ResultError["NoResultReturned"] = "NoResultReturned";
6611
7895
  /** Returned if the Intent handler function processing the raised intent throws an error or rejects the Promise it returned. */
6612
7896
  ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
7897
+ /** Returned if a timeout occurs before the getResult() API call is resolved.*/
7898
+ ResultError["ApiTimeout"] = "ApiTimeout";
6613
7899
  })(ResultError || (ResultError = {}));
6614
7900
  var ChannelError;
6615
7901
  (function (ChannelError) {
@@ -6621,6 +7907,8 @@
6621
7907
  ChannelError["CreationFailed"] = "CreationFailed";
6622
7908
  /** 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.*/
6623
7909
  ChannelError["MalformedContext"] = "MalformedContext";
7910
+ /** Returned if a timeout occurs before any Channel related API call is resolved.*/
7911
+ ChannelError["ApiTimeout"] = "ApiTimeout";
6624
7912
  })(ChannelError || (ChannelError = {}));
6625
7913
  var BridgingError;
6626
7914
  (function (BridgingError) {
@@ -6633,28 +7921,51 @@
6633
7921
  /** @experimental Returned if a message to a Bridge deviates from the schema for that message sufficiently that it could not be processed. */
6634
7922
  BridgingError["MalformedMessage"] = "MalformedMessage";
6635
7923
  })(BridgingError || (BridgingError = {}));
6636
-
6637
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
6638
- var e = new Error(message);
6639
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
6640
- };
7924
+
7925
+ /**
7926
+ * Type representing the different log-levels that can be set.
7927
+ */
7928
+ var LogLevel;
7929
+ (function (LogLevel) {
7930
+ LogLevel[LogLevel["NONE"] = 0] = "NONE";
7931
+ LogLevel[LogLevel["ERROR"] = 1] = "ERROR";
7932
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
7933
+ LogLevel[LogLevel["INFO"] = 3] = "INFO";
7934
+ LogLevel[LogLevel["DEBUG"] = 4] = "DEBUG";
7935
+ })(LogLevel || (LogLevel = {}));
7936
+ /** Enumeration of values used to describe types of web-based
7937
+ * Desktop Agent. Each 'type' refers to the means by which
7938
+ * a connection to the agent is made and/or an interface to it
7939
+ * received. */
7940
+ var WebDesktopAgentType;
7941
+ (function (WebDesktopAgentType) {
7942
+ /** Denotes Desktop Agents that inject the FDC3 interface
7943
+ * at `window.fdc3`. */
7944
+ WebDesktopAgentType["Preload"] = "PRELOAD";
7945
+ /** Denotes Desktop Agents that run (or provide an interface)
7946
+ * within a parent window or frame, a reference to which
7947
+ * will be found at `window.opener`, `window.parent`,
7948
+ * `window.parent.opener` etc. */
7949
+ WebDesktopAgentType["ProxyParent"] = "PROXY_PARENT";
7950
+ /** Denotes Desktop Agents that are connected to by loading a URL
7951
+ * into a hidden iframe whose URL was returned by a parent window
7952
+ * or frame. */
7953
+ WebDesktopAgentType["ProxyUrl"] = "PROXY_URL";
7954
+ /** Denotes a Desktop Agent that was returned by a failover
7955
+ * function that was passed by the application. */
7956
+ WebDesktopAgentType["Failover"] = "FAILOVER";
7957
+ })(WebDesktopAgentType || (WebDesktopAgentType = {}));
6641
7958
 
6642
7959
  /**
6643
7960
  * 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.
6644
7961
  */
6645
- var exhaustiveStringTuple = function () { return function () {
6646
- var tuple = [];
6647
- for (var _i = 0; _i < arguments.length; _i++) {
6648
- tuple[_i] = arguments[_i];
6649
- }
6650
- return tuple;
6651
- }; };
7962
+ const exhaustiveStringTuple = () => (...tuple) => tuple;
6652
7963
 
6653
- 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');
7964
+ 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');
6654
7965
  // used internally to check if a given intent/context is a standard one
6655
7966
  new Set(STANDARD_CONTEXT_TYPES);
6656
7967
 
6657
- var STANDARD_INTENTS = exhaustiveStringTuple()('CreateInteraction', 'SendChatMessage', 'StartCall', 'StartChat', 'StartEmail', 'ViewAnalysis', 'ViewChat', 'ViewChart', 'ViewContact', 'ViewHoldings', 'ViewInstrument', 'ViewInteractions', 'ViewMessages', 'ViewNews', 'ViewOrders', 'ViewProfile', 'ViewQuote', 'ViewResearch');
7968
+ const STANDARD_INTENTS = exhaustiveStringTuple()('CreateInteraction', 'CreateOrUpdateProfile', 'SendChatMessage', 'StartCall', 'StartChat', 'StartEmail', 'ViewAnalysis', 'ViewChat', 'ViewChart', 'ViewContact', 'ViewHoldings', 'ViewInstrument', 'ViewInteractions', 'ViewMessages', 'ViewNews', 'ViewOrders', 'ViewProfile', 'ViewQuote', 'ViewResearch');
6658
7969
  // used internally to check if a given intent/context is a standard one
6659
7970
  new Set(STANDARD_INTENTS);
6660
7971
 
@@ -6698,6 +8009,7 @@
6698
8009
  var Intents;
6699
8010
  (function (Intents) {
6700
8011
  Intents["CreateInteraction"] = "CreateInteraction";
8012
+ Intents["CreateOrUpdateProfile"] = "CreateOrUpdateProfile";
6701
8013
  Intents["SendChatMessage"] = "SendChatMessage";
6702
8014
  Intents["StartCall"] = "StartCall";
6703
8015
  Intents["StartChat"] = "StartChat";
@@ -6717,6 +8029,90 @@
6717
8029
  Intents["ViewResearch"] = "ViewResearch";
6718
8030
  })(Intents || (Intents = {}));
6719
8031
 
8032
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8033
+ //check if color is supported in (node) console;
8034
+ let noColor = true;
8035
+ //else only occurs in a browser and can't be tested in node
8036
+ /* istanbul ignore if */
8037
+ if (typeof process !== 'undefined') {
8038
+ const argv = process.argv || /* istanbul ignore next */ [];
8039
+ const env = process.env || /* istanbul ignore next */ {};
8040
+ noColor =
8041
+ (!!env.NO_COLOR || argv.includes('--no-color')) &&
8042
+ !(!!env.FORCE_COLOR ||
8043
+ argv.includes('--color') ||
8044
+ process.platform === 'win32' /* istanbul ignore next */ ||
8045
+ ((process.stdout || {}).isTTY && env.TERM !== 'dumb') ||
8046
+ /* istanbul ignore next */ !!env.CI);
8047
+ }
8048
+ class AbstractFDC3Logger {
8049
+ /** This should be overridden by sub-classes to set the prefix applied
8050
+ * to log messages. */
8051
+ /* istanbul ignore next */ static get prefix() {
8052
+ return '';
8053
+ }
8054
+ //sub-classes should override this default log level
8055
+ static logLevel = LogLevel.DEBUG;
8056
+ static setLogLevel(level) {
8057
+ if (level in LogLevel) {
8058
+ this.logLevel = level;
8059
+ }
8060
+ else {
8061
+ /* istanbul ignore next */
8062
+ this.error(`Ignoring unrecognized LogLevel '${level}'! Current log level: '${this.logLevel} (${LogLevel[this.logLevel]})'`);
8063
+ }
8064
+ }
8065
+ static debugColor(value) {
8066
+ return noColor ? /* istanbul ignore next */ value : '\x1b[30m\x1b[2m' + value + '\x1b[22m\x1b[39m';
8067
+ }
8068
+ static logColor(value) {
8069
+ return noColor ? /* istanbul ignore next */ value : '\x1b[32m\x1b[2m' + value + '\x1b[22m\x1b[39m';
8070
+ }
8071
+ static warnColor(value) {
8072
+ return noColor ? /* istanbul ignore next */ value : '\x1b[33m' + value + '\x1b[39m';
8073
+ }
8074
+ static errorColor(value) {
8075
+ return noColor ? /* istanbul ignore next */ value : '\x1b[31m' + value + '\x1b[39m';
8076
+ }
8077
+ static debug(...params) {
8078
+ if (this.logLevel >= LogLevel.DEBUG) {
8079
+ console.debug(...this.prefixAndColorize(this.prefix, params, this.debugColor));
8080
+ }
8081
+ }
8082
+ static log(...params) {
8083
+ if (this.logLevel >= LogLevel.INFO) {
8084
+ console.log(...this.prefixAndColorize(this.prefix, params, this.logColor));
8085
+ }
8086
+ }
8087
+ static warn(...params) {
8088
+ if (this.logLevel >= LogLevel.WARN) {
8089
+ console.warn(...this.prefixAndColorize(this.prefix, params, this.warnColor));
8090
+ }
8091
+ }
8092
+ static error(...params) {
8093
+ if (this.logLevel >= LogLevel.ERROR) {
8094
+ console.error(...this.prefixAndColorize(this.prefix, params, this.errorColor));
8095
+ }
8096
+ }
8097
+ static prefixAndColorize = (prefix, params, colorFn) => {
8098
+ const prefixed = [prefix, ...params];
8099
+ return prefixed.map(value => {
8100
+ if (typeof value === 'string') {
8101
+ //just color strings
8102
+ return colorFn(value);
8103
+ }
8104
+ else if (value && value.stack && value.message) {
8105
+ //probably an error
8106
+ return colorFn(value.stack);
8107
+ }
8108
+ else {
8109
+ //something else... lets hope it stringifies
8110
+ return colorFn(JSON.stringify(value, null, 2));
8111
+ }
8112
+ });
8113
+ };
8114
+ }
8115
+
6720
8116
  class DesktopAgent {
6721
8117
  intentsController;
6722
8118
  applicationController;
@@ -6730,6 +8126,7 @@
6730
8126
  const api = {
6731
8127
  getStartupContext: this.getStartupContext.bind(this),
6732
8128
  addContextListener: this.addContextListener.bind(this),
8129
+ addEventListener: this.addEventListener.bind(this),
6733
8130
  addIntentListener: this.addIntentListener.bind(this),
6734
8131
  broadcast: this.broadcast.bind(this),
6735
8132
  createPrivateChannel: this.createPrivateChannel.bind(this),
@@ -6871,6 +8268,13 @@
6871
8268
  async leaveCurrentChannels() {
6872
8269
  return this.channelsController.leave(generateCommandId());
6873
8270
  }
8271
+ async addEventListener(type, handler) {
8272
+ optionalFdc3EventTypesDecoder.runWithException(type);
8273
+ if (typeof handler !== "function") {
8274
+ throw new Error("Please provide the handler as a function!");
8275
+ }
8276
+ return this.channelsController.addEventListener({ commandId: generateCommandId(), type, handler });
8277
+ }
6874
8278
  }
6875
8279
 
6876
8280
  class AppChannel {
@@ -6988,13 +8392,13 @@
6988
8392
  async addContextListener(contextType, handler) {
6989
8393
  if (arguments.length === 1) {
6990
8394
  if (typeof contextType !== "function") {
6991
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof contextType}` };
8395
+ throw new Error(ChannelError.AccessDenied);
6992
8396
  }
6993
8397
  return this.channelsController.addContextListener({ commandId: generateCommandId(), handler: contextType, channelId: this.id });
6994
8398
  }
6995
8399
  const contextTypeDecoder = optionalNonEmptyStringDecoder.runWithException(contextType);
6996
8400
  if (typeof handler !== "function") {
6997
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
8401
+ throw new Error(ChannelError.AccessDenied);
6998
8402
  }
6999
8403
  return this.channelsController.addContextListener({ commandId: generateCommandId(), handler, contextType: contextTypeDecoder, channelId: this.id });
7000
8404
  }
@@ -7025,6 +8429,22 @@
7025
8429
  };
7026
8430
  return subHandler;
7027
8431
  };
8432
+ const parseHandlerToEventHandler = ({ handler, eventType, contextType }) => {
8433
+ const eventHandler = (event) => {
8434
+ const { type, details } = event;
8435
+ if (eventType && type !== eventType) {
8436
+ return;
8437
+ }
8438
+ if (contextType) {
8439
+ if (details.type === contextType) {
8440
+ handler(details, details.metadata);
8441
+ }
8442
+ return;
8443
+ }
8444
+ handler(details, details.metadata);
8445
+ };
8446
+ return eventHandler;
8447
+ };
7028
8448
 
7029
8449
  class IntentsController {
7030
8450
  glueController;
@@ -7062,11 +8482,11 @@
7062
8482
  this.logger?.info(`[${commandId}] - findIntent() invoked for intent ${intent} with contextType ${context?.type} and resultType ${resultType}`);
7063
8483
  const glueIntents = await this.glueController.findIntents({ name: intent });
7064
8484
  if (!glueIntents.length) {
7065
- throw { message: ResolveError.NoAppsFound, reason: `There are no apps handling the passed intent ${intent}` };
8485
+ throw new Error(ResolveError.NoAppsFound);
7066
8486
  }
7067
8487
  const searchedGlueIntent = glueIntents.find((glueIntent) => glueIntent.name === intent);
7068
8488
  if (!searchedGlueIntent) {
7069
- throw { message: ResolveError.NoAppsFound, reason: `There are no apps handling the passed intent ${intent}` };
8489
+ throw new Error(ResolveError.NoAppsFound);
7070
8490
  }
7071
8491
  if (!context && !resultType) {
7072
8492
  return this.convertGlue42IntentToFDC3Intent(searchedGlueIntent);
@@ -7074,7 +8494,7 @@
7074
8494
  const contextType = (context && context.type === fdc3NothingContextType) ? undefined : context?.type;
7075
8495
  const filteredIntent = this.getGlueIntentWithFilteredHandlers(searchedGlueIntent, { contextType, resultType });
7076
8496
  if (!filteredIntent.handlers.length) {
7077
- throw { message: ResolveError.NoAppsFound, reason: `No apps handling intent ${intent} with contextType ${context?.type} and resultType ${resultType}` };
8497
+ throw new Error(ResolveError.NoAppsFound);
7078
8498
  }
7079
8499
  return this.convertGlue42IntentToFDC3Intent(filteredIntent);
7080
8500
  }
@@ -7083,7 +8503,7 @@
7083
8503
  this.logger?.info(`[${commandId}] - findIntentsByContext() invoked for context type ${context.type} and resultType ${resultType}`);
7084
8504
  const glueIntents = await this.glueController.findIntents({ contextType: context.type, resultType });
7085
8505
  if (!glueIntents.length) {
7086
- throw { message: ResolveError.NoAppsFound, reason: `No apps registering intent with contextType ${context.type} ${resultType ? `and resultType ${resultType}` : ""}` };
8506
+ throw new Error(ResolveError.NoAppsFound);
7087
8507
  }
7088
8508
  this.logger?.info(`[${commandId}] - parsing glue intents to fdc3 intents and returning`);
7089
8509
  return glueIntents.map((glueIntent) => {
@@ -7093,11 +8513,12 @@
7093
8513
  }
7094
8514
  async raiseIntent({ commandId, intent, context, target }) {
7095
8515
  await this.glueController.gluePromise;
7096
- this.logger?.info(`[${commandId}] - raiseIntent() invoked for intent ${intent} with contextType: ${context.type} and target: ${target}`);
8516
+ this.logger?.info(`[${commandId}] - raiseIntent() invoked for intent ${intent} with contextType: ${context.type} and target: ${JSON.stringify(target)}`);
7097
8517
  const glueContext = { type: context.type, data: { ...context } };
7098
8518
  const searchedGlueIntent = (await this.glueController.findIntents({ name: intent })).find(glueIntent => glueIntent.name === intent);
8519
+ this.logger?.info(`[${commandId}] - searchedGlueIntent: ${JSON.stringify(searchedGlueIntent)}`);
7099
8520
  if (!searchedGlueIntent) {
7100
- throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
8521
+ throw new Error(ResolveError.NoAppsFound);
7101
8522
  }
7102
8523
  if (!target) {
7103
8524
  const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
@@ -7105,14 +8526,17 @@
7105
8526
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
7106
8527
  }
7107
8528
  if (target?.instanceId) {
7108
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
7109
- return this.invokeRaiseIntent(commandId, {
7110
- intent,
7111
- context: glueContext,
7112
- target: { instance: target.instanceId }
7113
- });
8529
+ return this.raiseIntentToInstanceTarget({ intent, context: glueContext, target: { instance: target.instanceId } }, searchedGlueIntent.handlers, target, commandId);
7114
8530
  }
7115
8531
  const targetAppName = typeof target === "string" ? target : target.appId;
8532
+ const appHandlersWithAppId = searchedGlueIntent.handlers.filter((handler) => handler.applicationName === targetAppName);
8533
+ if (!appHandlersWithAppId.length) {
8534
+ throw new Error(ResolveError.TargetAppUnavailable);
8535
+ }
8536
+ const appHandlersWithContextType = appHandlersWithAppId.filter((handler) => !handler.instanceId && handler.contextTypes?.includes(context.type));
8537
+ if (!appHandlersWithContextType.length) {
8538
+ throw new Error(ResolveError.NoAppsFound);
8539
+ }
7116
8540
  return this.invokeRaiseIntent(commandId, {
7117
8541
  intent,
7118
8542
  context: glueContext,
@@ -7162,7 +8586,23 @@
7162
8586
  await this.glueController.gluePromise;
7163
8587
  this.logger?.info(`[${commandId}] - addIntentListener() invoked for intent ${intent}`);
7164
8588
  const wrappedHandler = this.getWrappedIntentHandler(handler);
7165
- return this.glueController.addIntentListener(intent, wrappedHandler);
8589
+ const unsub = await this.glueController.addIntentListener(intent, wrappedHandler);
8590
+ return getListenerWithAsyncUnsubscribe(unsub.unsubscribe);
8591
+ }
8592
+ raiseIntentToInstanceTarget(request, glueHandlers, target, commandId) {
8593
+ this.logger?.info(`[${commandId}] - raising intent ${request.intent} with contextType ${request.context?.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
8594
+ const handlersWithSameAppName = glueHandlers.filter((handler) => handler.applicationName === target.appId);
8595
+ const handlersWithSameContext = this.getGlueIntentWithFilteredHandlers({ name: request.intent, handlers: handlersWithSameAppName }, { contextType: request.context?.type }).handlers;
8596
+ if (!handlersWithSameContext.length) {
8597
+ this.logger?.info(`[${commandId}] - No handlers found for intent ${request.intent} with appName ${target.appId} and contextType ${request.context?.type}`);
8598
+ throw new Error(ResolveError.NoAppsFound);
8599
+ }
8600
+ const isValidInstanceHandler = handlersWithSameContext.find((handler) => handler.instanceId === target.instanceId);
8601
+ if (!isValidInstanceHandler) {
8602
+ this.logger?.info(`[${commandId}] - There's no instance with id ${target.instanceId} of the passed app ${target.appId}`);
8603
+ throw new Error(ResolveError.TargetInstanceUnavailable);
8604
+ }
8605
+ return this.invokeRaiseIntent(commandId, request);
7166
8606
  }
7167
8607
  async checkForRememberedIntentHandlerForContext(contextType) {
7168
8608
  let prefs;
@@ -7205,12 +8645,12 @@
7205
8645
  const app = this.glueController.getApplication(appName);
7206
8646
  const serverInstances = this.serverInstanceAsIntentHandler(intent.name);
7207
8647
  if (!app && (typeof target === "string" || !target.instanceId || !serverInstances.length)) {
7208
- throw { message: ResolveError.TargetAppUnavailable, reason: `There's no app with appId ${appName}` };
8648
+ throw new Error(ResolveError.TargetAppUnavailable);
7209
8649
  }
7210
8650
  this.logger?.info(`[${commandId}] - target app ${appName} found. Filtering handlers by applicationName: ${appName}`);
7211
8651
  const validHandlersByApplicationName = intent.handlers.filter((handler) => handler.applicationName === appName);
7212
8652
  if (!validHandlersByApplicationName.length) {
7213
- throw { message: ResolveError.NoAppsFound, reason: `Intent ${intent.name} exists but there's no app with appId ${appName} registering it` };
8653
+ throw new Error(ResolveError.NoAppsFound);
7214
8654
  }
7215
8655
  if (!instanceId) {
7216
8656
  this.logger?.log(`[${commandId}] - returning all handlers for intent ${intent.name} and target: ${JSON.stringify(target)}`);
@@ -7220,12 +8660,12 @@
7220
8660
  ? app.instances.find((inst) => inst.id === instanceId)
7221
8661
  : serverInstances.find((inst) => inst.instance === instanceId);
7222
8662
  if (!isValidInstanceOfTheApp) {
7223
- throw { message: ResolveError.TargetInstanceUnavailable, reason: `There's no instance with id ${instanceId} of the passed app ${appName}` };
8663
+ throw new Error(ResolveError.TargetInstanceUnavailable);
7224
8664
  }
7225
8665
  this.logger?.info(`[${commandId}] - Filtering handlers by instanceId: ${instanceId}`);
7226
8666
  const validHandlersByInstanceId = validHandlersByApplicationName.filter((handler) => handler.instanceId === instanceId);
7227
8667
  if (!validHandlersByInstanceId.length) {
7228
- throw { message: ResolveError.IntentDeliveryFailed, reason: `There's no instance with id ${instanceId} of app ${appName} registering intent ${intent.name}` };
8668
+ throw new Error(ResolveError.IntentDeliveryFailed);
7229
8669
  }
7230
8670
  return { name: intent.name, handlers: validHandlersByInstanceId };
7231
8671
  }
@@ -7237,7 +8677,7 @@
7237
8677
  filterIntentHandlersByContext(intent, context) {
7238
8678
  const filteredGlueIntent = this.getGlueIntentWithFilteredHandlers(intent, { contextType: context.type });
7239
8679
  if (!filteredGlueIntent.handlers.length) {
7240
- throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent with the passed context type ${context.type}` };
8680
+ throw new Error(ResolveError.NoAppsFound);
7241
8681
  }
7242
8682
  return filteredGlueIntent;
7243
8683
  }
@@ -7289,15 +8729,17 @@
7289
8729
  apps: handlers.map((handler) => {
7290
8730
  const appName = handler.applicationName;
7291
8731
  const app = this.glueController.getApplication(appName);
8732
+ const icons = (handler.applicationIcon ? [handler.applicationIcon, ...(app?.userProperties.icons ?? [])] : (app?.userProperties.icons ?? [])).filter((icon) => !!icon).map((icon) => ({ src: icon }));
8733
+ const images = (app?.userProperties.images ?? []).filter((image) => !!image).map((image) => ({ src: image }));
7292
8734
  return {
7293
8735
  appId: appName,
7294
8736
  instanceId: handler.instanceId,
7295
8737
  name: appName,
7296
8738
  title: handler.applicationTitle || handler.instanceTitle || appName,
7297
- tooltip: app?.userProperties.tooltip || `${appName} (${handler.type})`,
8739
+ tooltip: app?.userProperties.tooltip ?? `${appName} (${handler.type})`,
7298
8740
  description: handler.applicationDescription,
7299
- icons: handler.applicationIcon ? [handler.applicationIcon, ...(app?.userProperties.icons || [])] : app?.userProperties.icons,
7300
- images: app?.userProperties.images,
8741
+ icons,
8742
+ images,
7301
8743
  resultType: handler.resultType
7302
8744
  };
7303
8745
  })
@@ -7359,8 +8801,9 @@
7359
8801
  return { name, handlers: filteredHandlers };
7360
8802
  }
7361
8803
  async invokeRaiseIntent(commandId, request) {
8804
+ const inBrowser = this.glueController.isRunningInBrowser();
7362
8805
  try {
7363
- const glueIntentResult = await this.glueController.raiseIntent({ ...request, timeout: RaiseTimeoutMs });
8806
+ const glueIntentResult = await this.glueController.raiseIntent({ ...request, timeout: RaiseTimeoutMs, options: { waitForAGMReady: !inBrowser } });
7364
8807
  return {
7365
8808
  source: {
7366
8809
  appId: glueIntentResult.handler.applicationName,
@@ -7371,7 +8814,7 @@
7371
8814
  };
7372
8815
  }
7373
8816
  catch (error) {
7374
- throw this.parseIoToFdc3Error(error);
8817
+ throw new Error(this.parseIoToFdc3Error(error).message);
7375
8818
  }
7376
8819
  }
7377
8820
  parseIoToFdc3Error(error) {
@@ -7385,10 +8828,7 @@
7385
8828
  this.logger?.info(`[${commandId}] - raiseIntentForContext() invoked with contextType ${context.type} and target ${target}`);
7386
8829
  const appIntents = await this.findIntentsByContext({ commandId, context });
7387
8830
  if (!appIntents || appIntents.length === 0) {
7388
- throw {
7389
- message: ResolveError.NoAppsFound,
7390
- reason: `No apps registering intent with contextType ${context.type} ${target ? `and target ${JSON.stringify(target)}` : ""}`
7391
- };
8831
+ throw new Error(ResolveError.NoAppsFound);
7392
8832
  }
7393
8833
  return this.raiseIntent({ commandId, intent: appIntents[0].intent.name, context, target });
7394
8834
  }
@@ -7413,50 +8853,51 @@
7413
8853
  }
7414
8854
  async open({ commandId, target, context }) {
7415
8855
  await this.glueController.gluePromise;
7416
- this.logger?.log(`[${commandId}] - open() invoked with target ${target} ${context ? `and contextType ${context.type}` : ""}`);
8856
+ this.logger?.log(`[${commandId}] - open() invoked with target ${JSON.stringify(target)} ${context ? `and contextType ${context.type}` : ""}`);
7417
8857
  const name = typeof target === "object" ? target.appId : target;
7418
8858
  const app = this.glueController.getApplication(name);
7419
8859
  if (!app) {
7420
- throw { message: OpenError.AppNotFound, reason: `Cannot find targeted ${name} application` };
8860
+ throw new Error(OpenError.AppNotFound);
7421
8861
  }
7422
8862
  if (context) {
7423
8863
  await this.glueEventsController.initializeCollaborateMethod();
7424
- this.logger?.info(`[${commandId}] - opening app ${app} with startup context`);
8864
+ this.logger?.info(`[${commandId}] - opening app '${app.name}' with startup context`);
7425
8865
  return this.openAppWithContext(app, context);
7426
8866
  }
7427
8867
  try {
7428
- this.logger?.info(`[${commandId}] - opening app ${app}`);
7429
- const glueInst = await app.start();
8868
+ this.logger?.info(`[${commandId}] - opening app '${app.name}' without context`);
8869
+ const inBrowser = this.glueController.isRunningInBrowser();
8870
+ const glueInst = await app.start(undefined, { waitForAGMReady: !inBrowser });
7430
8871
  this.logger?.info(`[${commandId}] - instance with id ${glueInst.id} started`);
7431
8872
  return this.parseGlueInstToAppIdentifier(glueInst);
7432
8873
  }
7433
8874
  catch (error) {
7434
- throw { message: OpenError.ErrorOnLaunch, reason: typeof error === "string" ? error : JSON.stringify(error) };
8875
+ throw new Error(OpenError.ErrorOnLaunch);
7435
8876
  }
7436
8877
  }
7437
8878
  async findInstances({ commandId, appIdentifier }) {
7438
8879
  await this.glueController.gluePromise;
7439
- this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${appIdentifier}`);
8880
+ this.logger?.info(`[${commandId}] - findInstances() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
7440
8881
  const { appId } = appIdentifier;
7441
8882
  const app = this.glueController.getApplication(appId);
7442
8883
  if (!app) {
7443
- throw { message: ResolveError.NoAppsFound, reason: `App with appId: ${appId} does not exist` };
8884
+ throw new Error(ResolveError.NoAppsFound);
7444
8885
  }
7445
8886
  const glueInstances = this.glueController.getApplicationInstances(appId);
7446
8887
  const fdc3Instances = glueInstances.map(glueInst => this.parseGlueInstToAppIdentifier(glueInst));
7447
- this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${appIdentifier}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
8888
+ this.logger?.info(`[${commandId}] - ids of opened instances for appIdentifier ${JSON.stringify(appIdentifier)}: ${JSON.stringify(fdc3Instances.map(inst => inst.instanceId))}`);
7448
8889
  return fdc3Instances;
7449
8890
  }
7450
8891
  async getAppMetadata({ commandId, appIdentifier }) {
7451
8892
  await this.glueController.gluePromise;
7452
- this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${appIdentifier}`);
8893
+ this.logger?.info(`[${commandId}] - getAppMetadata() invoked with appIdentifier ${JSON.stringify(appIdentifier)}`);
7453
8894
  const { appId, instanceId } = appIdentifier;
7454
8895
  const app = this.glueController.getApplication(appId);
7455
8896
  if (!app) {
7456
- throw { message: OpenError.AppNotFound, reason: `Cannot find application with appId: ${appId}` };
8897
+ throw new Error(OpenError.AppNotFound);
7457
8898
  }
7458
8899
  if (!instanceId) {
7459
- this.logger?.info(`[${commandId}] - no opened instances found. Parsing app ${app}`);
8900
+ this.logger?.info(`[${commandId}] - no opened instances found. Parsing app ${app.name}`);
7460
8901
  return this.parseGlueAppToAppMetadata(app);
7461
8902
  }
7462
8903
  const instance = this.glueController.getAppInstanceById(instanceId);
@@ -7484,10 +8925,13 @@
7484
8925
  }
7485
8926
  getCurrentAppMetadata() {
7486
8927
  const myInstance = this.glueController.interopInstance();
7487
- return {
7488
- appId: myInstance.applicationName,
7489
- instanceId: myInstance.instance
7490
- };
8928
+ const myInstanceApplicationName = myInstance.application ?? myInstance.applicationName;
8929
+ const myApp = this.glueController.getApplication(myInstanceApplicationName);
8930
+ if (myApp) {
8931
+ return { appId: myApp.name, instanceId: myInstance.instance };
8932
+ }
8933
+ this.logger?.info(`No application found with name ${myInstanceApplicationName} probably because it's an iframe.`);
8934
+ return { appId: myInstanceApplicationName, instanceId: myInstance.instance };
7491
8935
  }
7492
8936
  parseGlueInstToAppIdentifier(glueInst) {
7493
8937
  return {
@@ -7531,24 +8975,26 @@
7531
8975
  const startContext = this.buildStartContext(context, guid);
7532
8976
  const wrappedPromise = this.createContextListenerWrappedPromise(app);
7533
8977
  this.appsStateStore.addOpenAppPromise(guid, wrappedPromise);
8978
+ const inBrowser = this.glueController.isRunningInBrowser();
7534
8979
  try {
7535
- const glueInst = await app.start(startContext);
8980
+ const glueInst = await app.start(startContext, { waitForAGMReady: !inBrowser });
7536
8981
  await wrappedPromise.promise;
7537
8982
  this.appsStateStore.removeOpenAppPromise(guid);
7538
8983
  return this.parseGlueInstToAppIdentifier(glueInst);
7539
8984
  }
7540
8985
  catch (error) {
7541
8986
  this.appsStateStore.removeOpenAppPromise(guid);
7542
- throw { message: OpenError.AppTimeout, reason: typeof error === "string" ? error : JSON.stringify(error) };
8987
+ throw new Error(OpenError.AppTimeout);
7543
8988
  }
7544
8989
  }
7545
8990
  buildStartContext(fdc3Context, guid) {
7546
8991
  const myInteropInstance = this.glueController.getMyInteropInstance();
8992
+ const appId = myInteropInstance.application || myInteropInstance.applicationName || "";
7547
8993
  return {
7548
8994
  fdc3: {
7549
8995
  collaborationId: guid,
7550
8996
  openApp: {
7551
- appId: myInteropInstance.application || myInteropInstance.applicationName || "",
8997
+ appId,
7552
8998
  instanceId: myInteropInstance.instance
7553
8999
  },
7554
9000
  context: {
@@ -7782,7 +9228,8 @@
7782
9228
  this.isCreator = isCreator;
7783
9229
  this.id = channelId;
7784
9230
  const myServerInstance = this.channelsController.getMyServerInstance();
7785
- this.myAppMetadata = { source: { appId: myServerInstance.applicationName, instanceId: myServerInstance.instance } };
9231
+ const myAppId = myServerInstance.application || myServerInstance.applicationName;
9232
+ this.myAppMetadata = { source: { appId: myAppId, instanceId: myServerInstance.instance } };
7786
9233
  }
7787
9234
  toApi() {
7788
9235
  const api = {
@@ -7792,10 +9239,11 @@
7792
9239
  broadcast: this.broadcast.bind(this),
7793
9240
  getCurrentContext: this.getCurrentContext.bind(this),
7794
9241
  addContextListener: this.addContextListener.bind(this),
7795
- onAddContextListener: this.onAddContextListener.bind(this),
7796
- onUnsubscribe: this.onUnsubscribe.bind(this),
7797
- onDisconnect: this.onDisconnect.bind(this),
9242
+ onAddContextListener: this.legacyOnAddContextListener.bind(this),
9243
+ onUnsubscribe: this.legacyOnUnsubscribe.bind(this),
9244
+ onDisconnect: this.legacyOnDisconnect.bind(this),
7798
9245
  disconnect: this.disconnect.bind(this),
9246
+ addEventListener: this.addEventListener.bind(this),
7799
9247
  };
7800
9248
  return api;
7801
9249
  }
@@ -7811,54 +9259,62 @@
7811
9259
  }
7812
9260
  async handleCollaboratorJoin(collaborator, commandId) {
7813
9261
  this.setCollaborator(collaborator, commandId);
7814
- await Promise.all(this.myListenerTypesBeforeBound.map((contextType) => {
7815
- const listenerAddedArgs = {
7816
- action: "addedContextListenerOnPrivateChannel",
7817
- correlationId: this.id,
7818
- collaborationObject: {
7819
- channelId: this.id,
7820
- contextType: contextType || undefined
7821
- }
7822
- };
7823
- this.logger?.trace(`[${commandId}] - announcing ${"addedContextListenerOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7824
- return this.channelsController.invokeSystemMethod(listenerAddedArgs, this.collaborator?.instanceId);
7825
- })).catch((err) => this.logger?.error(err));
9262
+ await Promise.all(this.myListenerTypesBeforeBound.map((contextType) => this.sendCollaborateMessage({ action: "addedContextListenerOnPrivateChannel", contextType }))).catch((err) => this.logger?.error(err));
7826
9263
  }
7827
9264
  handleCollaboratorBroadcast(context, metadata, commandId) {
7828
9265
  this.logger?.trace(`[${commandId}] - heard context with type ${context.type} broadcasted on the channel`);
7829
9266
  this.lastBroadcastedContextType = context.type;
7830
9267
  this.broadcastedContexts[context.type] = { context, metadata };
7831
9268
  this.logger?.trace(`[${commandId}] - invoking all context listeners`);
7832
- this.registry.execute(PrivateChannelEventMethods.ListenerAdded, context, metadata);
9269
+ this.executeCollaboratorBroadcastEvents(context, metadata);
7833
9270
  }
7834
9271
  handleCollaboratorAddContextListener(contextType, commandId) {
7835
9272
  this.logger?.trace(`[${commandId}] - heard collaborator added context listener for type ${contextType}`);
7836
9273
  this.collaboratorListenerTypes.push(contextType);
7837
- this.registry.execute(PrivateChannelEventMethods.OnAddContextListener, contextType);
9274
+ this.executeCollaboratorAddContextListenerEvents(contextType);
7838
9275
  }
7839
9276
  handleCollaboratorRemovedListener(contextType, commandId) {
7840
9277
  this.logger?.trace(`[${commandId}] - heard collaborator removed context listener with type ${contextType}`);
7841
- const index = this.collaboratorListenerTypes.indexOf(contextType);
7842
- this.collaboratorListenerTypes.splice(index, 1);
7843
- this.registry.execute(PrivateChannelEventMethods.OnUnsubscribe, contextType);
9278
+ this.collaboratorListenerTypes.splice(this.collaboratorListenerTypes.indexOf(contextType), 1);
9279
+ this.executeCollaboratorUnsubscribeEvents(contextType);
7844
9280
  }
7845
9281
  handleCollaboratorDisconnect() {
7846
9282
  this.disconnected = true;
7847
- this.collaboratorListenerTypes.forEach((contextType) => this.registry.execute(PrivateChannelEventMethods.OnUnsubscribe, contextType));
7848
- this.registry.execute(PrivateChannelEventMethods.OnDisconnect);
9283
+ this.executeCollaboratorDisconnectEvents();
7849
9284
  }
7850
9285
  async announceJoin(targetInstance, commandId) {
7851
- const joinChannelArgs = {
7852
- action: "joinPrivateChannel",
7853
- correlationId: this.id,
7854
- collaborationObject: {
7855
- channelId: this.id
7856
- }
7857
- };
7858
- this.logger?.trace(`[${commandId}] - announcing ${"joinPrivateChannel"} to target instance with id ${JSON.stringify(targetInstance)}`);
7859
- await this.channelsController.invokeSystemMethod(joinChannelArgs, targetInstance);
9286
+ await this.sendCollaborateMessage({ action: "joinPrivateChannel" });
7860
9287
  this.logger?.trace(`[${commandId}] - collaborator received ${"joinPrivateChannel"} action`);
7861
9288
  }
9289
+ async addEventListener(type, handler) {
9290
+ const decodedType = optionalPrivateChannelEventTypesDecoder.run(type);
9291
+ if (!decodedType.ok) {
9292
+ this.logger?.error(`Expected first argument 'type' as one of ${Object.values(NewPrivateChannelEventMethods).join(", ")}, got ${type}`);
9293
+ throw new Error(ChannelError.AccessDenied);
9294
+ }
9295
+ if (typeof handler !== "function") {
9296
+ this.logger?.error(`Expected function as an argument, got ${typeof handler}`);
9297
+ throw new Error(ChannelError.AccessDenied);
9298
+ }
9299
+ const commandId = generateCommandId();
9300
+ this.ensureAlive(commandId);
9301
+ this.logger?.trace(`[${commandId}] - adding event listener for type ${type}`);
9302
+ return this.addEventListenerByEventType(type, handler);
9303
+ }
9304
+ addEventListenerByEventType(type, handler) {
9305
+ const replayArgs = type === "addContextListener"
9306
+ ? this.collaboratorListenerTypes.map((contextType) => ({ type: NewPrivateChannelEventMethods.AddContextListener, details: { contextType } }))
9307
+ : undefined;
9308
+ if (type) {
9309
+ const unsubscribe = this.registry.add(type, handler, replayArgs);
9310
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
9311
+ }
9312
+ const addContextListener = this.addEventListenerByEventType("addContextListener", handler);
9313
+ const unsubscribeListener = this.addEventListenerByEventType("unsubscribe", handler);
9314
+ const disconnectListener = this.addEventListenerByEventType("disconnect", handler);
9315
+ const unsubscribe = () => [addContextListener, unsubscribeListener, disconnectListener].forEach((listener) => listener.unsubscribe());
9316
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
9317
+ }
7862
9318
  async broadcast(context) {
7863
9319
  const contextDecoderResult = contextDecoder.run(context);
7864
9320
  if (!contextDecoderResult.ok) {
@@ -7869,17 +9325,7 @@
7869
9325
  this.ensureBound(commandId, "broadcast");
7870
9326
  this.lastBroadcastedContextType = context.type;
7871
9327
  this.broadcastedContexts[context.type] = { context, metadata: this.myAppMetadata };
7872
- const broadcastArgs = {
7873
- action: "publishOnPrivateChannel",
7874
- correlationId: this.id,
7875
- collaborationObject: {
7876
- channelId: this.id,
7877
- contextType: context.type,
7878
- payload: context
7879
- }
7880
- };
7881
- this.logger?.trace(`[${commandId}] - announcing ${"publishOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7882
- await this.channelsController.invokeSystemMethod(broadcastArgs, this.collaborator?.instanceId);
9328
+ this.sendCollaborateMessage({ action: "publishOnPrivateChannel", contextType: context.type, payload: context });
7883
9329
  this.logger?.trace(`[${commandId}] - collaborator received context for action ${"publishOnPrivateChannel"}`);
7884
9330
  }
7885
9331
  async getCurrentContext(contextType) {
@@ -7891,7 +9337,10 @@
7891
9337
  if (!contextType && !this.lastBroadcastedContextType) {
7892
9338
  return null;
7893
9339
  }
7894
- const searchedType = contextType || this.lastBroadcastedContextType;
9340
+ const searchedType = contextType ?? this.lastBroadcastedContextType;
9341
+ if (!searchedType) {
9342
+ throw new Error("No context type specified and no last broadcasted context available");
9343
+ }
7895
9344
  this.logger?.trace(`[${commandId}] - Returning context with type ${searchedType}`);
7896
9345
  return this.broadcastedContexts[searchedType].context;
7897
9346
  }
@@ -7900,51 +9349,42 @@
7900
9349
  this.ensureAlive(commandId);
7901
9350
  optionalNonEmptyStringDecoder.runWithException(contextType);
7902
9351
  if (typeof handler !== "function") {
7903
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof contextType}` };
9352
+ throw new Error(ChannelError.AccessDenied);
7904
9353
  }
7905
9354
  this.logger?.trace(`[${commandId}] - adding subscription for broadcasted contexts with type: ${contextType}`);
7906
- const subHandler = (data, metadata) => {
7907
- if (contextType) {
7908
- if (data.type === contextType) {
7909
- handler(data, metadata);
7910
- }
7911
- return;
7912
- }
7913
- handler(data, metadata);
7914
- };
7915
- const lastBroadcastedContextPerType = this.retrieveLatestBroadcastedContextPerType(contextType);
7916
- const replayArgs = lastBroadcastedContextPerType ? [[lastBroadcastedContextPerType.context, lastBroadcastedContextPerType.metadata]] : undefined;
7917
- const unsub = this.registry.add(PrivateChannelEventMethods.ListenerAdded, subHandler, replayArgs);
9355
+ const unsub = this.addContextListenerInRegistry(contextType, handler);
7918
9356
  if (!this.collaborator) {
7919
9357
  this.myListenerTypesBeforeBound.push(contextType);
7920
9358
  const unsubscribe = this.getAddContextListenerUnsub(unsub, contextType, commandId);
7921
- return AsyncListener(unsubscribe);
9359
+ return { unsubscribe };
7922
9360
  }
7923
- const listenerAddedArgs = {
7924
- action: "addedContextListenerOnPrivateChannel",
7925
- correlationId: this.id,
7926
- collaborationObject: {
7927
- channelId: this.id,
7928
- contextType: contextType || undefined
7929
- }
7930
- };
7931
- this.logger?.trace(`[${commandId}] - announcing ${"addedContextListenerOnPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
7932
- await this.channelsController.invokeSystemMethod(listenerAddedArgs, this.collaborator?.instanceId);
9361
+ await this.sendCollaborateMessage({ action: "addedContextListenerOnPrivateChannel", contextType });
7933
9362
  this.logger?.trace(`[${commandId}] - collaborator received action ${"addedContextListenerOnPrivateChannel"}`);
7934
9363
  const unsubscribe = this.getAddContextListenerUnsub(unsub, contextType, commandId);
7935
- return AsyncListener(unsubscribe);
9364
+ return { unsubscribe };
7936
9365
  }
9366
+ addContextListenerInRegistry = (contextType, handler) => {
9367
+ const legacySubHandler = parseContextHandler(handler, contextType);
9368
+ const lastBroadcastedContextPerType = this.retrieveLatestBroadcastedContextPerType(contextType);
9369
+ const legacyReplayArgs = lastBroadcastedContextPerType ? [[lastBroadcastedContextPerType.context, lastBroadcastedContextPerType.metadata]] : undefined;
9370
+ const legacyUnsub = this.registry.add(LegacyPrivateChannelEventMethods.ListenerAdded, legacySubHandler, legacyReplayArgs);
9371
+ const replayArgs = lastBroadcastedContextPerType ? [{ type: NewPrivateChannelEventMethods.ContextListenerAdded, details: { contextType: lastBroadcastedContextPerType.context.type, metadata: lastBroadcastedContextPerType.metadata } }] : undefined;
9372
+ const subHandler = parseHandlerToEventHandler({ handler, eventType: NewPrivateChannelEventMethods.ContextListenerAdded, contextType });
9373
+ const newUnsub = this.registry.add(NewPrivateChannelEventMethods.ContextListenerAdded, subHandler, replayArgs);
9374
+ const unsub = () => {
9375
+ legacyUnsub();
9376
+ newUnsub();
9377
+ };
9378
+ return unsub;
9379
+ };
7937
9380
  retrieveLatestBroadcastedContextPerType(contextType) {
7938
- if (!contextType && !this.lastBroadcastedContextType) {
7939
- return;
9381
+ if (contextType) {
9382
+ return this.broadcastedContexts[contextType];
7940
9383
  }
7941
- if (!contextType && this.lastBroadcastedContextType) {
7942
- return {
7943
- context: this.broadcastedContexts[this.lastBroadcastedContextType].context,
7944
- metadata: this.broadcastedContexts[this.lastBroadcastedContextType].metadata
7945
- };
9384
+ if (!this.lastBroadcastedContextType) {
9385
+ return;
7946
9386
  }
7947
- return this.broadcastedContexts[contextType];
9387
+ return this.broadcastedContexts[this.lastBroadcastedContextType];
7948
9388
  }
7949
9389
  getAddContextListenerUnsub(unsub, contextType, commandId) {
7950
9390
  return async () => {
@@ -7954,45 +9394,36 @@
7954
9394
  this.myListenerTypesBeforeBound.splice(index, 1);
7955
9395
  return;
7956
9396
  }
7957
- const unsubArgs = {
7958
- action: "removedContextListenerOnPrivateChannel",
7959
- correlationId: this.id,
7960
- collaborationObject: {
7961
- channelId: this.id,
7962
- contextType: contextType || undefined
7963
- }
7964
- };
7965
- this.logger?.trace(`[${commandId}] - announcing unsubscribe from context listener for type ${contextType}`);
7966
- await this.channelsController.invokeSystemMethod(unsubArgs, this.collaborator?.instanceId);
9397
+ await this.sendCollaborateMessage({ action: "removedContextListenerOnPrivateChannel", contextType });
7967
9398
  this.logger?.trace(`[${commandId}] - collaborator heard ${"removedContextListenerOnPrivateChannel"}`);
7968
9399
  };
7969
9400
  }
7970
- onAddContextListener(handler) {
9401
+ legacyOnAddContextListener(handler) {
7971
9402
  if (typeof handler !== "function") {
7972
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9403
+ throw new Error(ChannelError.AccessDenied);
7973
9404
  }
7974
9405
  const commandId = generateCommandId();
7975
9406
  this.ensureAlive(commandId);
7976
- const unsub = this.registry.add(PrivateChannelEventMethods.OnAddContextListener, handler, this.collaboratorListenerTypes);
7977
- return AsyncListener(unsub);
9407
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnAddContextListener, handler, this.collaboratorListenerTypes);
9408
+ return getListenerWithAsyncUnsubscribe(unsub);
7978
9409
  }
7979
- onUnsubscribe(handler) {
9410
+ legacyOnUnsubscribe(handler) {
7980
9411
  if (typeof handler !== "function") {
7981
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9412
+ throw new Error(ChannelError.AccessDenied);
7982
9413
  }
7983
9414
  const commandId = generateCommandId();
7984
9415
  this.ensureAlive(commandId);
7985
- const unsub = this.registry.add(PrivateChannelEventMethods.OnUnsubscribe, handler);
7986
- return AsyncListener(unsub);
9416
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnUnsubscribe, handler);
9417
+ return getListenerWithAsyncUnsubscribe(unsub);
7987
9418
  }
7988
- onDisconnect(handler) {
9419
+ legacyOnDisconnect(handler) {
7989
9420
  if (typeof handler !== "function") {
7990
- throw { message: ChannelError.AccessDenied, reason: `Expected function as an argument, got ${typeof handler}` };
9421
+ throw new Error(ChannelError.AccessDenied);
7991
9422
  }
7992
9423
  const commandId = generateCommandId();
7993
9424
  this.ensureAlive(commandId);
7994
- const unsub = this.registry.add(PrivateChannelEventMethods.OnDisconnect, handler);
7995
- return AsyncListener(unsub);
9425
+ const unsub = this.registry.add(LegacyPrivateChannelEventMethods.OnDisconnect, handler);
9426
+ return getListenerWithAsyncUnsubscribe(unsub);
7996
9427
  }
7997
9428
  async disconnect() {
7998
9429
  const commandId = generateCommandId();
@@ -8005,15 +9436,8 @@
8005
9436
  this.logger?.trace(`[${commandId}] - disconnect invoked`);
8006
9437
  this.disconnected = true;
8007
9438
  this.logger?.trace(`[${commandId}] - announcing ${"disconnectedFromPrivateChannel"} to collaborator ${JSON.stringify(this.collaborator)}`);
8008
- const disconnectArgs = {
8009
- action: "disconnectedFromPrivateChannel",
8010
- correlationId: this.id,
8011
- collaborationObject: {
8012
- channelId: this.id
8013
- }
8014
- };
8015
9439
  this.channelsController.removePrivateChannelFromStoreById(this.id);
8016
- await this.channelsController.invokeSystemMethod(disconnectArgs, this.collaborator?.instanceId);
9440
+ await this.sendCollaborateMessage({ action: "disconnectedFromPrivateChannel" });
8017
9441
  this.logger?.trace(`[${commandId}] - collaborator received action ${"disconnectedFromPrivateChannel"}`);
8018
9442
  if (this.unsubFromInstanceStopped) {
8019
9443
  this.unsubFromInstanceStopped();
@@ -8025,7 +9449,7 @@
8025
9449
  }
8026
9450
  const errorMsg = "Channel is disconnected - operation is no longer available";
8027
9451
  this.logger?.error(`[${commandId}] - ${errorMsg}`);
8028
- throw { message: ChannelError.AccessDenied, reason: errorMsg };
9452
+ throw new Error(ChannelError.AccessDenied);
8029
9453
  }
8030
9454
  ensureBound(commandId, operation) {
8031
9455
  if (this.collaborator) {
@@ -8033,7 +9457,7 @@
8033
9457
  }
8034
9458
  const errorMsg = `There's no collaborator on the other side of the channel - operation ${operation} is unavailable`;
8035
9459
  this.logger?.error(`[${commandId}] - ${errorMsg}`);
8036
- throw { message: ChannelError.AccessDenied, reason: errorMsg };
9460
+ throw new Error(ChannelError.AccessDenied);
8037
9461
  }
8038
9462
  subscribeForCollaboratorInstanceStop(commandId) {
8039
9463
  const handler = (instance) => {
@@ -8044,6 +9468,43 @@
8044
9468
  };
8045
9469
  this.unsubFromInstanceStopped = this.channelsController.subscribeOnInstanceStop(this.id, handler.bind(this), commandId);
8046
9470
  }
9471
+ async sendCollaborateMessage({ action, contextType, payload }) {
9472
+ const args = {
9473
+ action,
9474
+ correlationId: this.id,
9475
+ collaborationObject: {
9476
+ channelId: this.id,
9477
+ contextType,
9478
+ payload
9479
+ }
9480
+ };
9481
+ this.logger?.trace(`Sending '${action}' collaborate message ${JSON.stringify(args)} to collaborator ${JSON.stringify(this.collaborator)}`);
9482
+ await this.channelsController.invokeSystemMethod(args, this.collaborator?.instanceId);
9483
+ }
9484
+ executeCollaboratorAddContextListenerEvents(contextType) {
9485
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnAddContextListener, contextType);
9486
+ const event = { type: NewPrivateChannelEventMethods.AddContextListener, details: { contextType } };
9487
+ this.registry.execute(NewPrivateChannelEventMethods.AddContextListener, event);
9488
+ }
9489
+ executeCollaboratorBroadcastEvents(context, metadata) {
9490
+ this.registry.execute(LegacyPrivateChannelEventMethods.ListenerAdded, context, metadata);
9491
+ const event = {
9492
+ type: NewPrivateChannelEventMethods.ContextListenerAdded,
9493
+ details: { context, metadata }
9494
+ };
9495
+ this.registry.execute(NewPrivateChannelEventMethods.ContextListenerAdded, event);
9496
+ }
9497
+ executeCollaboratorUnsubscribeEvents(contextType) {
9498
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnUnsubscribe, contextType);
9499
+ const event = { type: NewPrivateChannelEventMethods.Unsubscribe, details: { contextType } };
9500
+ this.registry.execute(NewPrivateChannelEventMethods.Unsubscribe, event);
9501
+ }
9502
+ executeCollaboratorDisconnectEvents() {
9503
+ this.collaboratorListenerTypes.forEach((contextType) => this.executeCollaboratorUnsubscribeEvents(contextType));
9504
+ this.registry.execute(LegacyPrivateChannelEventMethods.OnDisconnect);
9505
+ const event = { type: NewPrivateChannelEventMethods.Disconnect, details: {} };
9506
+ this.registry.execute(NewPrivateChannelEventMethods.Disconnect, event);
9507
+ }
8047
9508
  }
8048
9509
 
8049
9510
  class ChannelsFactory {
@@ -8245,7 +9706,7 @@
8245
9706
  const subHandler = parseContextHandler(handler, contextType);
8246
9707
  if (!channelIdToSubscribeTo || onMultiChannels) {
8247
9708
  const unsubscribe = this.glueController.channelsSubscribe(subHandler, contextType);
8248
- return { unsubscribe };
9709
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8249
9710
  }
8250
9711
  return this.addContextListenerByChannelId({ commandId, handler: subHandler, invokedOnChannelModel: !!channelId, channelId: channelIdToSubscribeTo, contextType });
8251
9712
  }
@@ -8418,6 +9879,14 @@
8418
9879
  this.logger?.info(`[${commandId}] - leaving channel '${ioChannelToLeave.name}'`);
8419
9880
  return this.glueController.leaveChannel({ channel: ioChannelToLeave.name });
8420
9881
  }
9882
+ async addEventListener({ commandId, type, handler }) {
9883
+ await this.initDonePromise;
9884
+ this.logger?.info(`[${commandId}] - addEventListener() invoked for event type ${type}`);
9885
+ if (!type || type === "userChannelChanged") {
9886
+ return this.subscribeForChannelChangedEvent(handler);
9887
+ }
9888
+ throw new Error(`Received unknown event type: ${type}`);
9889
+ }
8421
9890
  get logger() {
8422
9891
  if (!this._logger) {
8423
9892
  this._logger = this.glueController.initSubLogger("fdc3.channels.controller");
@@ -8455,7 +9924,7 @@
8455
9924
  }
8456
9925
  async handleWindowContextOnOpening(commandId, handler, contextType) {
8457
9926
  const myWindow = this.glueController.getMyWindow();
8458
- if (!myWindow) {
9927
+ if (!myWindow || !Object.keys(myWindow).length) {
8459
9928
  this.logger?.trace(`[${commandId}] - Cannot get window context because this is not a Glue window, it's probably an iframe`);
8460
9929
  this.invokeContextHandlerWithStartupContext = false;
8461
9930
  return;
@@ -8536,12 +10005,10 @@
8536
10005
  if (channelType === ChannelTypes.App) {
8537
10006
  this.logger?.info(`[${commandId}] - subscribing for fdc3 app channel with id ${channelId} (underlying glue context with same name)`);
8538
10007
  const unsubscribe = await this.glueController.contextsSubscribe(channelId, subHandler);
8539
- return {
8540
- unsubscribe: () => {
8541
- this.logger?.info(`[${commandId}] - invoking unsubscribe for app channel with id ${channelId}`);
8542
- unsubscribe();
8543
- }
8544
- };
10008
+ return getListenerWithAsyncUnsubscribe(() => {
10009
+ this.logger?.info(`[${commandId}] - invoking unsubscribe for app channel with id ${channelId}`);
10010
+ unsubscribe();
10011
+ });
8545
10012
  }
8546
10013
  this.logger?.error("Cannot add a context listener on an invalid channel");
8547
10014
  throw new Error(ChannelError.AccessDenied);
@@ -8558,6 +10025,28 @@
8558
10025
  this.logger?.error(`Channel with id: ${channelId} does not exist`);
8559
10026
  throw new Error(ChannelError.NoChannelFound);
8560
10027
  }
10028
+ subscribeForChannelChangedEvent(handler) {
10029
+ const wrappedCallback = async (channelName) => {
10030
+ if (!channelName) {
10031
+ this.invokeChannelChangedEventHandler(null, handler);
10032
+ return;
10033
+ }
10034
+ const fdc3ChannelName = await this.glueController.getFDC3ChannelIdByIoChannelName(channelName);
10035
+ if (!fdc3ChannelName) {
10036
+ return;
10037
+ }
10038
+ this.invokeChannelChangedEventHandler(fdc3ChannelName, handler);
10039
+ };
10040
+ const unsubscribe = this.glueController.setOnChannelChanged(wrappedCallback);
10041
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
10042
+ }
10043
+ invokeChannelChangedEventHandler(channelId, handler) {
10044
+ const event = {
10045
+ type: "userChannelChanged",
10046
+ details: { currentChannelId: channelId }
10047
+ };
10048
+ handler(event);
10049
+ }
8561
10050
  }
8562
10051
 
8563
10052
  class LegacyDataWrappingChannelsController {
@@ -8595,7 +10084,7 @@
8595
10084
  if (!invokedOnChannelModel) {
8596
10085
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8597
10086
  const unsubscribe = this.glueController.legacyChannelsSubscribe(handler, contextType);
8598
- return { unsubscribe };
10087
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8599
10088
  }
8600
10089
  const ioChannelName = await this.glueController.getIoChannelNameByFDC3ChannelId(channelId);
8601
10090
  if (!ioChannelName) {
@@ -8605,7 +10094,7 @@
8605
10094
  const contextToSubscribeTo = this.parser.mapChannelNameToContextName(ioChannelName);
8606
10095
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8607
10096
  const unsubscribe = await this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
8608
- return { unsubscribe };
10097
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8609
10098
  }
8610
10099
  get logger() {
8611
10100
  if (!this._logger) {
@@ -8651,7 +10140,7 @@
8651
10140
  if (!invokedOnChannelModel) {
8652
10141
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8653
10142
  const unsubscribe = this.glueController.channelsSubscribe(handler, contextType);
8654
- return { unsubscribe };
10143
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8655
10144
  }
8656
10145
  const ioChannelName = await this.glueController.getIoChannelNameByFDC3ChannelId(channelId);
8657
10146
  if (!ioChannelName) {
@@ -8661,7 +10150,7 @@
8661
10150
  const contextToSubscribeTo = this.parser.mapChannelNameToContextName(ioChannelName);
8662
10151
  this.logger?.info(`[${commandId}] - subscribing for fdc3 user channel with id ${channelId}`);
8663
10152
  const unsubscribe = await this.glueController.contextsSubscribe(contextToSubscribeTo, handler);
8664
- return { unsubscribe };
10153
+ return getListenerWithAsyncUnsubscribe(unsubscribe);
8665
10154
  }
8666
10155
  get logger() {
8667
10156
  if (!this._logger) {
@@ -8857,13 +10346,13 @@
8857
10346
  return ioc.fdc3;
8858
10347
  };
8859
10348
 
8860
- var version = "2.5.2";
10349
+ var version = "2.6.1";
8861
10350
 
8862
10351
  const globalScope = typeof process !== "undefined" ? process : window;
8863
10352
  globalScope.fdc3Info = {
8864
10353
  provider: "io.Connect",
8865
10354
  providerVersion: version,
8866
- standardVersion: "2.1"
10355
+ standardVersion: "2.2"
8867
10356
  };
8868
10357
  let globalFdc3 = globalScope.fdc3;
8869
10358
  if (typeof globalFdc3 === "undefined") {