@interopio/fdc3 2.5.2 → 2.6.0

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