@interopio/fdc3 2.5.2 → 2.6.1

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