@interopio/desktop 6.10.1 → 6.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2944,7 +2944,7 @@
2944
2944
  }
2945
2945
  };
2946
2946
 
2947
- var version$1 = "6.5.2-fmr-beta";
2947
+ var version$1 = "6.5.2";
2948
2948
 
2949
2949
  function prepareConfig$1 (configuration, ext, glue42gd) {
2950
2950
  let nodeStartingContext;
@@ -5664,10 +5664,7 @@
5664
5664
  this._contextIdToName = {};
5665
5665
  delete this._protocolVersion;
5666
5666
  this._contextsTempCache = Object.keys(this._contextNameToData).reduce((cacheSoFar, ctxName) => {
5667
- const contextData = this._contextNameToData[ctxName];
5668
- if (contextData.isAnnounced && (contextData.activityId || contextData.sentExplicitSubscription)) {
5669
- cacheSoFar[ctxName] = this._contextNameToData[ctxName].context;
5670
- }
5667
+ cacheSoFar[ctxName] = this._contextNameToData[ctxName].context;
5671
5668
  return cacheSoFar;
5672
5669
  }, {});
5673
5670
  this._contextNameToData = {};
@@ -11596,6 +11593,164 @@
11596
11593
  }
11597
11594
  }
11598
11595
 
11596
+ const INTEROP_METHOD_RESPONSE_TIMEOUT_MS = 90000;
11597
+ const INTEROP_METHOD_WAIT_TIMEOUT_MS = 90000;
11598
+
11599
+ // This alphabet uses `A-Za-z0-9_-` symbols.
11600
+ // The order of characters is optimized for better gzip and brotli compression.
11601
+ // References to the same file (works both for gzip and brotli):
11602
+ // `'use`, `andom`, and `rict'`
11603
+ // References to the brotli default dictionary:
11604
+ // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
11605
+ let urlAlphabet =
11606
+ 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
11607
+
11608
+ let nanoid = (size = 21) => {
11609
+ let id = '';
11610
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
11611
+ let i = size | 0;
11612
+ while (i--) {
11613
+ // `| 0` is more compact and faster than `Math.floor()`.
11614
+ id += urlAlphabet[(Math.random() * 64) | 0];
11615
+ }
11616
+ return id
11617
+ };
11618
+
11619
+ class Utils {
11620
+ static getGDMajorVersion() {
11621
+ if (typeof window === "undefined") {
11622
+ return -1;
11623
+ }
11624
+ if (!window.glueDesktop) {
11625
+ return -1;
11626
+ }
11627
+ if (!window.glueDesktop.version) {
11628
+ return -1;
11629
+ }
11630
+ const parsed = window.glueDesktop.version.split(".");
11631
+ const major = Number(parsed[0]);
11632
+ return isNaN(major) ? -1 : major;
11633
+ }
11634
+ static typedError(error) {
11635
+ let err;
11636
+ if (error instanceof Error) {
11637
+ err = error;
11638
+ }
11639
+ else if (typeof error === "string") {
11640
+ err = new Error(error);
11641
+ }
11642
+ else if ("message" in error && typeof error.message === "string" && error.message.length > 0) {
11643
+ err = new Error(error.message);
11644
+ }
11645
+ else if ("returned" in error
11646
+ && typeof error.returned === "object"
11647
+ && "errorMsg" in error.returned
11648
+ && typeof error.returned.errorMsg === "string"
11649
+ && error.returned.errorMsg.length > 0) {
11650
+ err = new Error(error.returned.errorMsg);
11651
+ }
11652
+ else {
11653
+ err = new Error("Unknown error");
11654
+ }
11655
+ return err;
11656
+ }
11657
+ static async callbackifyPromise(action, successCallback, errorCallback) {
11658
+ const success = (result) => {
11659
+ if (typeof successCallback === "function") {
11660
+ successCallback(result);
11661
+ }
11662
+ return Promise.resolve(result);
11663
+ };
11664
+ const fail = (error) => {
11665
+ const err = Utils.typedError(error);
11666
+ if (typeof errorCallback === "function") {
11667
+ errorCallback(err.message);
11668
+ return;
11669
+ }
11670
+ return Promise.reject(err);
11671
+ };
11672
+ try {
11673
+ const result = await action();
11674
+ return success(result);
11675
+ }
11676
+ catch (error) {
11677
+ return fail(error);
11678
+ }
11679
+ }
11680
+ static getMonitor(bounds, displays) {
11681
+ const monitorsSortedByOverlap = displays.map((m) => {
11682
+ const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
11683
+ const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
11684
+ return {
11685
+ monitor: m,
11686
+ totalOverlap: overlap
11687
+ };
11688
+ }).sort((a, b) => b.totalOverlap - a.totalOverlap);
11689
+ return monitorsSortedByOverlap[0].monitor;
11690
+ }
11691
+ static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
11692
+ const physicalWidth = a.width / currentDisplay.scaleFactor;
11693
+ const physicalHeight = a.height / currentDisplay.scaleFactor;
11694
+ const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
11695
+ const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
11696
+ const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
11697
+ const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
11698
+ const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
11699
+ const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
11700
+ const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
11701
+ const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
11702
+ const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
11703
+ const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
11704
+ return {
11705
+ left,
11706
+ top,
11707
+ width: a.width,
11708
+ height: a.height
11709
+ };
11710
+ }
11711
+ static isNode() {
11712
+ if (typeof Utils._isNode !== "undefined") {
11713
+ return Utils._isNode;
11714
+ }
11715
+ if (typeof window !== "undefined") {
11716
+ Utils._isNode = false;
11717
+ return false;
11718
+ }
11719
+ try {
11720
+ Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
11721
+ }
11722
+ catch (e) {
11723
+ Utils._isNode = false;
11724
+ }
11725
+ return Utils._isNode;
11726
+ }
11727
+ static generateId() {
11728
+ return nanoid(10);
11729
+ }
11730
+ static isPromise(value) {
11731
+ return Boolean(value && typeof value.then === 'function');
11732
+ }
11733
+ static isAsyncFunction(value) {
11734
+ return value && {}.toString.call(value) === '[object AsyncFunction]';
11735
+ }
11736
+ static isNullOrUndefined(value) {
11737
+ return value === null || value === undefined;
11738
+ }
11739
+ static calculateTotalOverlap(r1, r2) {
11740
+ const r1x = r1.left;
11741
+ const r1y = r1.top;
11742
+ const r1xMax = r1x + r1.width;
11743
+ const r1yMax = r1y + r1.height;
11744
+ const r2x = r2.left;
11745
+ const r2y = r2.top;
11746
+ const r2xMax = r2x + r2.width;
11747
+ const r2yMax = r2y + r2.height;
11748
+ const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
11749
+ const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
11750
+ return xOverlap * yOverlap;
11751
+ }
11752
+ }
11753
+
11599
11754
  class ApplicationImpl {
11600
11755
  constructor(_appManager, _name, _agm, _logger, _configuration) {
11601
11756
  this._appManager = _appManager;
@@ -11725,7 +11880,10 @@
11725
11880
  return "flat";
11726
11881
  }
11727
11882
  async getConfiguration() {
11728
- const result = await this._agm.invoke(GetApplicationsMethodName, { v2: { apps: [this._name] } });
11883
+ const result = await this._agm.invoke(GetApplicationsMethodName, { v2: { apps: [this._name] } }, "best", {
11884
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
11885
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
11886
+ });
11729
11887
  const config = result.returned.applications[0];
11730
11888
  return config;
11731
11889
  }
@@ -11739,7 +11897,7 @@
11739
11897
  }
11740
11898
  start(context, options) {
11741
11899
  return new Promise(async (resolve, reject) => {
11742
- var _a, _b, _c, _d, _e;
11900
+ var _a, _b, _c, _d;
11743
11901
  if (isUndefinedOrNull(context)) {
11744
11902
  context = {};
11745
11903
  }
@@ -11783,7 +11941,13 @@
11783
11941
  resolve(i);
11784
11942
  };
11785
11943
  if (waitForAGMInstance) {
11786
- unsub = this._appManager.onInstanceAgmServerReady(waitFunc);
11944
+ const instance = this._appManager.instances().find((i) => i.id === id);
11945
+ if (instance) {
11946
+ unsub = instance.onAgmReady(waitFunc);
11947
+ }
11948
+ else {
11949
+ unsub = this._appManager.onInstanceAgmServerReady(waitFunc);
11950
+ }
11787
11951
  }
11788
11952
  else {
11789
11953
  unsub = this._appManager.onInstanceStarted(waitFunc);
@@ -11796,7 +11960,8 @@
11796
11960
  Context: context,
11797
11961
  Options: options
11798
11962
  }, "best", {
11799
- methodResponseTimeoutMs: startTimeout
11963
+ methodResponseTimeoutMs: startTimeout,
11964
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
11800
11965
  });
11801
11966
  const acsResult = result.returned;
11802
11967
  if (typeof acsResult.timeout !== "undefined" && typeof options.timeout === "undefined") {
@@ -11827,7 +11992,8 @@
11827
11992
  }
11828
11993
  }
11829
11994
  catch (error) {
11830
- reject((_e = error.message) !== null && _e !== void 0 ? _e : error);
11995
+ const err = Utils.typedError(error);
11996
+ reject(err);
11831
11997
  }
11832
11998
  });
11833
11999
  }
@@ -12029,6 +12195,9 @@
12029
12195
  this._agm.invoke(StopApplicationMethodName, {
12030
12196
  Name: this._appName,
12031
12197
  Id: this._id
12198
+ }, "best", {
12199
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12200
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12032
12201
  })
12033
12202
  .then(() => {
12034
12203
  if (this._appManager.mode === "startOnly") {
@@ -12043,7 +12212,10 @@
12043
12212
  });
12044
12213
  }
12045
12214
  activate() {
12046
- return this._agm.invoke(ActivateApplicationMethodName, { Name: this._appName, Id: this._id });
12215
+ return this._agm.invoke(ActivateApplicationMethodName, { Name: this._appName, Id: this._id }, "best", {
12216
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12217
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12218
+ });
12047
12219
  }
12048
12220
  done() {
12049
12221
  this._registry.clear();
@@ -12054,7 +12226,10 @@
12054
12226
  return Promise.resolve(this.context);
12055
12227
  }
12056
12228
  async startedBy() {
12057
- const result = await this._agm.invoke(ACSExecute, { command: "getStartedBy", Name: this._appName, Id: this._id });
12229
+ const result = await this._agm.invoke(ACSExecute, { command: "getStartedBy", Name: this._appName, Id: this._id }, "best", {
12230
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12231
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12232
+ });
12058
12233
  return result.returned;
12059
12234
  }
12060
12235
  }
@@ -12082,7 +12257,10 @@
12082
12257
  apps
12083
12258
  };
12084
12259
  }
12085
- const result = await this._agm.invoke(GetApplicationsMethodName, args);
12260
+ const result = await this._agm.invoke(GetApplicationsMethodName, args, "best", {
12261
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12262
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12263
+ });
12086
12264
  return result.returned.applications;
12087
12265
  };
12088
12266
  this.application = (name) => {
@@ -12399,7 +12577,10 @@
12399
12577
  args = args || {};
12400
12578
  return new Promise((resolve, reject) => {
12401
12579
  const errHandler = (error) => reject(error);
12402
- this._agm.invoke(method, args)
12580
+ this._agm.invoke(method, args, "best", {
12581
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12582
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12583
+ })
12403
12584
  .then((result) => {
12404
12585
  if (!transformFunction) {
12405
12586
  transformFunction = (d) => d.returned;
@@ -12428,7 +12609,10 @@
12428
12609
 
12429
12610
  function snapshot(interop, appManager) {
12430
12611
  return new Promise((resolve, reject) => {
12431
- interop.invoke(GetApplicationsMethodName, { skipIcon: true })
12612
+ interop.invoke(GetApplicationsMethodName, { skipIcon: true }, "best", {
12613
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12614
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12615
+ })
12432
12616
  .then((response) => {
12433
12617
  var _a;
12434
12618
  const data = response.returned;
@@ -12443,7 +12627,7 @@
12443
12627
  objectValues(applications).map((item) => appManager.handleAppAdded(item));
12444
12628
  resolve(configuration);
12445
12629
  })
12446
- .catch((err) => reject(`Error getting application snapshot: ${err.message}`));
12630
+ .catch((err) => reject(new Error(`Error getting application snapshot: ${err.message}`)));
12447
12631
  });
12448
12632
  }
12449
12633
 
@@ -12553,10 +12737,10 @@
12553
12737
  }
12554
12738
  import(apps, mode) {
12555
12739
  if (!apps || !Array.isArray(apps)) {
12556
- return Promise.reject("invalid apps argument - should be an array of application definitions");
12740
+ return Promise.reject(new Error("invalid apps argument - should be an array of application definitions"));
12557
12741
  }
12558
12742
  if (mode && mode !== "replace" && mode !== "merge") {
12559
- return Promise.reject("invalid mode argument - should be 'replace' or 'merge'");
12743
+ return Promise.reject(new Error("invalid mode argument - should be 'replace' or 'merge'"));
12560
12744
  }
12561
12745
  mode = mode !== null && mode !== void 0 ? mode : "replace";
12562
12746
  const command = {
@@ -12566,16 +12750,22 @@
12566
12750
  mode
12567
12751
  }
12568
12752
  };
12569
- return this.interop.invoke(InMemoryStoreCommandMethodName, command)
12753
+ return this.interop.invoke(InMemoryStoreCommandMethodName, command, "best", {
12754
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12755
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12756
+ })
12570
12757
  .then((r) => r.returned);
12571
12758
  }
12572
12759
  export() {
12573
- return this.interop.invoke(InMemoryStoreCommandMethodName, { command: "export" })
12760
+ return this.interop.invoke(InMemoryStoreCommandMethodName, { command: "export" }, "best", {
12761
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12762
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12763
+ })
12574
12764
  .then((r) => r.returned.apps);
12575
12765
  }
12576
12766
  remove(app) {
12577
12767
  if (!app || typeof app !== "string") {
12578
- return Promise.reject("invalid app name, should be a string value");
12768
+ return Promise.reject(new Error("invalid app name, should be a string value"));
12579
12769
  }
12580
12770
  const command = {
12581
12771
  command: "remove",
@@ -12583,13 +12773,19 @@
12583
12773
  apps: [app]
12584
12774
  }
12585
12775
  };
12586
- return this.interop.invoke(InMemoryStoreCommandMethodName, command).then((r) => r.returned);
12776
+ return this.interop.invoke(InMemoryStoreCommandMethodName, command, "best", {
12777
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12778
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12779
+ }).then((r) => r.returned);
12587
12780
  }
12588
12781
  clear() {
12589
12782
  const command = {
12590
12783
  command: "clear"
12591
12784
  };
12592
- return this.interop.invoke(InMemoryStoreCommandMethodName, command).then((r) => r.returned);
12785
+ return this.interop.invoke(InMemoryStoreCommandMethodName, command, "best", {
12786
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
12787
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
12788
+ }).then((r) => r.returned);
12593
12789
  }
12594
12790
  createAppDef(name, url) {
12595
12791
  if (!url) {
@@ -12675,157 +12871,6 @@
12675
12871
  return api;
12676
12872
  };
12677
12873
 
12678
- // This alphabet uses `A-Za-z0-9_-` symbols.
12679
- // The order of characters is optimized for better gzip and brotli compression.
12680
- // References to the same file (works both for gzip and brotli):
12681
- // `'use`, `andom`, and `rict'`
12682
- // References to the brotli default dictionary:
12683
- // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
12684
- let urlAlphabet =
12685
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
12686
-
12687
- let nanoid = (size = 21) => {
12688
- let id = '';
12689
- // A compact alternative for `for (var i = 0; i < step; i++)`.
12690
- let i = size | 0;
12691
- while (i--) {
12692
- // `| 0` is more compact and faster than `Math.floor()`.
12693
- id += urlAlphabet[(Math.random() * 64) | 0];
12694
- }
12695
- return id
12696
- };
12697
-
12698
- class Utils {
12699
- static getGDMajorVersion() {
12700
- if (typeof window === "undefined") {
12701
- return -1;
12702
- }
12703
- if (!window.glueDesktop) {
12704
- return -1;
12705
- }
12706
- if (!window.glueDesktop.version) {
12707
- return -1;
12708
- }
12709
- const parsed = window.glueDesktop.version.split(".");
12710
- const major = Number(parsed[0]);
12711
- return isNaN(major) ? -1 : major;
12712
- }
12713
- static async callbackifyPromise(action, successCallback, errorCallback) {
12714
- const success = (result) => {
12715
- if (typeof successCallback === "function") {
12716
- successCallback(result);
12717
- }
12718
- return Promise.resolve(result);
12719
- };
12720
- const fail = (error) => {
12721
- let err;
12722
- if (error instanceof Error) {
12723
- err = error;
12724
- }
12725
- else if (typeof error === "string") {
12726
- err = new Error(error);
12727
- }
12728
- else if ("message" in error && typeof error.message === "string" && error.message.length > 0) {
12729
- err = new Error(error.message);
12730
- }
12731
- else if ("returned" in error
12732
- && typeof error.returned === "object"
12733
- && "errorMsg" in error.returned
12734
- && typeof error.returned.errorMsg === "string"
12735
- && error.returned.errorMsg.length > 0) {
12736
- err = new Error(error.returned.errorMsg);
12737
- }
12738
- else {
12739
- err = new Error("Unknown error");
12740
- }
12741
- if (typeof errorCallback === "function") {
12742
- errorCallback(err.message);
12743
- return;
12744
- }
12745
- return Promise.reject(err);
12746
- };
12747
- try {
12748
- const result = await action();
12749
- return success(result);
12750
- }
12751
- catch (error) {
12752
- return fail(error);
12753
- }
12754
- }
12755
- static getMonitor(bounds, displays) {
12756
- const monitorsSortedByOverlap = displays.map((m) => {
12757
- const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
12758
- const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
12759
- return {
12760
- monitor: m,
12761
- totalOverlap: overlap
12762
- };
12763
- }).sort((a, b) => b.totalOverlap - a.totalOverlap);
12764
- return monitorsSortedByOverlap[0].monitor;
12765
- }
12766
- static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
12767
- const physicalWidth = a.width / currentDisplay.scaleFactor;
12768
- const physicalHeight = a.height / currentDisplay.scaleFactor;
12769
- const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
12770
- const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
12771
- const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
12772
- const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
12773
- const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
12774
- const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
12775
- const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
12776
- const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
12777
- const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
12778
- const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
12779
- return {
12780
- left,
12781
- top,
12782
- width: a.width,
12783
- height: a.height
12784
- };
12785
- }
12786
- static isNode() {
12787
- if (typeof Utils._isNode !== "undefined") {
12788
- return Utils._isNode;
12789
- }
12790
- if (typeof window !== "undefined") {
12791
- Utils._isNode = false;
12792
- return false;
12793
- }
12794
- try {
12795
- Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
12796
- }
12797
- catch (e) {
12798
- Utils._isNode = false;
12799
- }
12800
- return Utils._isNode;
12801
- }
12802
- static generateId() {
12803
- return nanoid(10);
12804
- }
12805
- static isPromise(value) {
12806
- return Boolean(value && typeof value.then === 'function');
12807
- }
12808
- static isAsyncFunction(value) {
12809
- return value && {}.toString.call(value) === '[object AsyncFunction]';
12810
- }
12811
- static isNullOrUndefined(value) {
12812
- return value === null || value === undefined;
12813
- }
12814
- static calculateTotalOverlap(r1, r2) {
12815
- const r1x = r1.left;
12816
- const r1y = r1.top;
12817
- const r1xMax = r1x + r1.width;
12818
- const r1yMax = r1y + r1.height;
12819
- const r2x = r2.left;
12820
- const r2y = r2.top;
12821
- const r2xMax = r2x + r2.width;
12822
- const r2yMax = r2y + r2.height;
12823
- const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
12824
- const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
12825
- return xOverlap * yOverlap;
12826
- }
12827
- }
12828
-
12829
12874
  const T42JumpListAction = "T42.JumpList.Action";
12830
12875
  class JumpListManager {
12831
12876
  constructor() {
@@ -14707,7 +14752,10 @@
14707
14752
  finishedResolve = resolve;
14708
14753
  });
14709
14754
  try {
14710
- const result = await this.agm.invoke("T42.Wnd.Create", options, this.agmTarget);
14755
+ const result = await this.agm.invoke("T42.Wnd.Create", options, this.agmTarget, {
14756
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
14757
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS
14758
+ });
14711
14759
  if (result.returned === undefined) {
14712
14760
  throw new Error("failed to execute T42.Wnd.Create - unknown reason");
14713
14761
  }
@@ -15297,7 +15345,7 @@
15297
15345
  const data = args.data;
15298
15346
  if ("status" in data) {
15299
15347
  if (data.status === "failed") {
15300
- rej(data.message);
15348
+ rej(new Error(data.message));
15301
15349
  }
15302
15350
  else if (data.status === "successful") {
15303
15351
  res(data.result);
@@ -15503,7 +15551,10 @@
15503
15551
  });
15504
15552
  });
15505
15553
  const action = new Promise((resolve, reject) => {
15506
- this.agm.invoke("T42.Wnd.Execute", params, this.agmTarget)
15554
+ this.agm.invoke("T42.Wnd.Execute", params, this.agmTarget, {
15555
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
15556
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS
15557
+ })
15507
15558
  .then((i) => {
15508
15559
  if (i.returned && i.returned.errorMsg) {
15509
15560
  reject(i);
@@ -15557,17 +15608,30 @@
15557
15608
  });
15558
15609
  const execute = new Promise((resolve, reject) => {
15559
15610
  options.token = token;
15611
+ if (!invocationOptions) {
15612
+ invocationOptions = {
15613
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
15614
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS
15615
+ };
15616
+ }
15617
+ else if (!invocationOptions.methodResponseTimeoutMs) {
15618
+ invocationOptions.methodResponseTimeoutMs = INTEROP_METHOD_RESPONSE_TIMEOUT_MS;
15619
+ }
15620
+ else if (!invocationOptions.waitTimeoutMs) {
15621
+ invocationOptions.waitTimeoutMs = INTEROP_METHOD_WAIT_TIMEOUT_MS;
15622
+ }
15560
15623
  this.agm.invoke(methodName, options, this.agmTarget, invocationOptions)
15561
15624
  .then((i) => {
15562
15625
  if (i.returned && i.returned.errorMsg) {
15563
- reject(i);
15626
+ reject(new Error(i.returned.errorMsg));
15564
15627
  }
15565
15628
  else {
15566
15629
  resolve(i.returned);
15567
15630
  }
15568
15631
  })
15569
- .catch((i) => {
15570
- reject(i);
15632
+ .catch((e) => {
15633
+ const error = Utils.typedError(e);
15634
+ reject(error);
15571
15635
  });
15572
15636
  });
15573
15637
  const result = await Promise.all([execute, event]);
@@ -15720,13 +15784,6 @@
15720
15784
  myGroup() {
15721
15785
  return this._groupId;
15722
15786
  }
15723
- execute(command, windowId, options) {
15724
- return this._agm.invoke("T42.Wnd.Execute", {
15725
- command,
15726
- options,
15727
- windowId,
15728
- });
15729
- }
15730
15787
  onCompositionChanged(callback) {
15731
15788
  return this._registry.add("composition-changed", callback);
15732
15789
  }
@@ -17404,7 +17461,7 @@
17404
17461
  updateAppContextInCurrent(context) {
17405
17462
  return new Promise((resolve, reject) => {
17406
17463
  if (context && typeof context !== "object") {
17407
- return reject(new Error("context must be an object"));
17464
+ return reject(new Error("Context must be an object"));
17408
17465
  }
17409
17466
  context = context !== null && context !== void 0 ? context : {};
17410
17467
  const request = {
@@ -17416,7 +17473,7 @@
17416
17473
  updateDefaultContext(context) {
17417
17474
  return new Promise((resolve, reject) => {
17418
17475
  if (context && typeof context !== "object") {
17419
- return reject(new Error("context must be an object"));
17476
+ return reject(new Error("Context must be an object"));
17420
17477
  }
17421
17478
  context = context !== null && context !== void 0 ? context : {};
17422
17479
  const request = {
@@ -17503,6 +17560,13 @@
17503
17560
  .catch((err) => reject(err));
17504
17561
  }
17505
17562
  async invokeMethodCore(methodName, args, target, options) {
17563
+ options = options !== null && options !== void 0 ? options : {};
17564
+ if (typeof options.methodResponseTimeoutMs === "undefined") {
17565
+ options.methodResponseTimeoutMs = INTEROP_METHOD_WAIT_TIMEOUT_MS;
17566
+ }
17567
+ if (typeof options.waitTimeoutMs === "undefined") {
17568
+ options.waitTimeoutMs = INTEROP_METHOD_WAIT_TIMEOUT_MS;
17569
+ }
17506
17570
  if (this.isCommandMethodPresent()) {
17507
17571
  return await this.config.agm.invoke(LayoutsCommandMethod, { command: methodName, data: args }, target, options);
17508
17572
  }
@@ -17683,16 +17747,6 @@
17683
17747
  }
17684
17748
  }
17685
17749
 
17686
- function streamNull () {
17687
- return {
17688
- ready: Promise.resolve(undefined),
17689
- subscribe: () => { },
17690
- onEvent: (callback) => () => { },
17691
- waitFor: (token, timeout) => Promise.resolve(undefined),
17692
- gotSnapshot: Promise.resolve(undefined),
17693
- };
17694
- }
17695
-
17696
17750
  function LayoutsFactory (config) {
17697
17751
  if (!config.agm) {
17698
17752
  throw Error("config.agm is required");
@@ -17707,9 +17761,6 @@
17707
17761
  if (config.mode === "full" || "fullWaitSnapshot") {
17708
17762
  acsStream = new ACSStream(config.agm, callbacks);
17709
17763
  }
17710
- else {
17711
- acsStream = streamNull();
17712
- }
17713
17764
  return new LayoutsAPIImpl(config, acsStream, callbacks, logger);
17714
17765
  }
17715
17766
 
@@ -17746,7 +17797,10 @@
17746
17797
  return point;
17747
17798
  };
17748
17799
  this.callGD = async (command, options) => {
17749
- const invocationResult = await this._agm.invoke(T42DisplayCommand, { options: { ...options }, command });
17800
+ const invocationResult = await this._agm.invoke(T42DisplayCommand, { options: { ...options }, command }, "best", {
17801
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
17802
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
17803
+ });
17750
17804
  return invocationResult.returned.data;
17751
17805
  };
17752
17806
  this.decorateDisplay = (original) => {
@@ -17941,61 +17995,42 @@
17941
17995
  }
17942
17996
  throw new Error(`unknown command ${command}`);
17943
17997
  });
17944
- const result = await interop.invoke(T42_ANNOUNCE_METHOD_NAME, { swId: windowId, instance: interop.instance.instance });
17998
+ const result = await interop.invoke(T42_ANNOUNCE_METHOD_NAME, { swId: windowId, instance: interop.instance.instance }, "best", {
17999
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
18000
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS
18001
+ });
17945
18002
  if ((_a = result.returned) === null || _a === void 0 ? void 0 : _a.restrictions) {
17946
18003
  channels.handleRestrictionsChanged((_b = result.returned) === null || _b === void 0 ? void 0 : _b.restrictions, windowId);
17947
18004
  }
17948
18005
  }
17949
18006
  async function sendLeaveChannel(channel, winId) {
17950
- await interop.invoke(T42_ANNOUNCE_METHOD_NAME, {
17951
- swId: winId !== null && winId !== void 0 ? winId : windowId,
17952
- command: "leaveChannel",
17953
- data: { channel }
17954
- });
18007
+ await invoke("leaveChannel", { channel }, winId !== null && winId !== void 0 ? winId : windowId);
17955
18008
  }
17956
18009
  async function sendSwitchChannelUI(channel, winId) {
17957
- await interop.invoke(T42_ANNOUNCE_METHOD_NAME, {
17958
- swId: winId !== null && winId !== void 0 ? winId : windowId,
17959
- command: "switchChannel",
17960
- data: { newChannel: channel }
17961
- });
18010
+ await invoke("switchChannel", { newChannel: channel }, winId !== null && winId !== void 0 ? winId : windowId);
17962
18011
  }
17963
18012
  async function setRestrictions(restrictions) {
17964
18013
  var _a;
17965
- await interop.invoke(T42_ANNOUNCE_METHOD_NAME, {
17966
- swId: (_a = restrictions.windowId) !== null && _a !== void 0 ? _a : windowId,
17967
- command: "restrict",
17968
- data: restrictions
17969
- });
17970
- return;
18014
+ await invoke("restrict", restrictions, (_a = restrictions.windowId) !== null && _a !== void 0 ? _a : windowId);
17971
18015
  }
17972
18016
  async function getRestrictionsByWindow(id) {
17973
18017
  try {
17974
- const result = await interop.invoke(T42_ANNOUNCE_METHOD_NAME, {
17975
- swId: id !== null && id !== void 0 ? id : windowId,
17976
- command: "getRestrictions"
17977
- });
18018
+ const result = await invoke("getRestrictions", {}, id !== null && id !== void 0 ? id : windowId);
17978
18019
  return result.returned;
17979
18020
  }
17980
18021
  catch (e) {
17981
- return;
17982
18022
  }
17983
18023
  }
17984
18024
  async function setRestrictionsForAllChannels(restrictions) {
17985
18025
  var _a;
17986
- await interop.invoke(T42_ANNOUNCE_METHOD_NAME, {
17987
- swId: (_a = restrictions.windowId) !== null && _a !== void 0 ? _a : windowId,
17988
- command: "restrictAll",
17989
- data: restrictions
17990
- });
17991
- return;
18026
+ await invoke("restrictAll", restrictions, (_a = restrictions.windowId) !== null && _a !== void 0 ? _a : windowId);
17992
18027
  }
17993
18028
  async function getWindowsWithChannels(filter) {
17994
- const result = await interop.invoke(T42_ANNOUNCE_METHOD_NAME, { command: "getChannelsInfo", data: { filter } });
18029
+ const result = await invoke("getChannelsInfo", { filter });
17995
18030
  return result.returned;
17996
18031
  }
17997
18032
  async function addOrRemoveChannel(command, id, color, label) {
17998
- await interop.invoke(T42_ANNOUNCE_METHOD_NAME, { command, data: { id, color, label } });
18033
+ await invoke(command, { id, color, label });
17999
18034
  }
18000
18035
  async function getChannelsMode(config, i) {
18001
18036
  if (typeof config.operationMode !== "boolean" && typeof config.operationMode === "string") {
@@ -18003,7 +18038,10 @@
18003
18038
  return config.operationMode;
18004
18039
  }
18005
18040
  try {
18006
- const result = await i.invoke(T42_ANNOUNCE_METHOD_NAME, { command: "getChannelsMode" });
18041
+ const result = await i.invoke(T42_ANNOUNCE_METHOD_NAME, { command: "getChannelsMode" }, "best", {
18042
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
18043
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS,
18044
+ });
18007
18045
  if (result.returned.mode === "single") {
18008
18046
  return "single";
18009
18047
  }
@@ -18018,6 +18056,16 @@
18018
18056
  return "single";
18019
18057
  }
18020
18058
  }
18059
+ function invoke(command, data, swId) {
18060
+ const args = { command, data };
18061
+ if (swId) {
18062
+ args.swId = swId;
18063
+ }
18064
+ return interop.invoke(T42_ANNOUNCE_METHOD_NAME, args, "best", {
18065
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
18066
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS,
18067
+ });
18068
+ }
18021
18069
  function validateMode(mode) {
18022
18070
  if (mode !== "single" && mode !== "multi") {
18023
18071
  throw new Error(`Invalid mode: ${mode}`);
@@ -18987,7 +19035,10 @@
18987
19035
  await this.registerInvokeAGMMethod();
18988
19036
  }
18989
19037
  this.registry.add(hkToLower, callback);
18990
- await this.agm.invoke(CommandMethod, { command: RegisterCommand, hotkey: hkToLower, description: info.description });
19038
+ await this.agm.invoke(CommandMethod, { command: RegisterCommand, hotkey: hkToLower, description: info.description }, "best", {
19039
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19040
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19041
+ });
18991
19042
  this.hotkeys.set(hkToLower, info);
18992
19043
  }
18993
19044
  async unregister(hotkey) {
@@ -18998,12 +19049,18 @@
18998
19049
  throw new Error("hotkey parameter must be string");
18999
19050
  }
19000
19051
  const hkToLower = this.formatHotkey(hotkey);
19001
- await this.agm.invoke(CommandMethod, { command: UnregisterCommand, hotkey: hkToLower });
19052
+ await this.agm.invoke(CommandMethod, { command: UnregisterCommand, hotkey: hkToLower }, "best", {
19053
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19054
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19055
+ });
19002
19056
  this.hotkeys.delete(hkToLower);
19003
19057
  this.registry.clearKey(hkToLower);
19004
19058
  }
19005
19059
  async unregisterAll() {
19006
- await this.agm.invoke(CommandMethod, { command: UnregisterAllCommand });
19060
+ await this.agm.invoke(CommandMethod, { command: UnregisterAllCommand }, "best", {
19061
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19062
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19063
+ });
19007
19064
  this.hotkeys.clear();
19008
19065
  this.registry.clear();
19009
19066
  }
@@ -19036,7 +19093,7 @@
19036
19093
  };
19037
19094
  }
19038
19095
 
19039
- var version = "6.10.1";
19096
+ var version = "6.11.0";
19040
19097
 
19041
19098
  var prepareConfig = (options) => {
19042
19099
  function getLibConfig(value, defaultMode, trueMode) {
@@ -19154,16 +19211,25 @@
19154
19211
  return this.onStreamEvent("on-panel-visibility-changed", callback);
19155
19212
  }
19156
19213
  toggle() {
19157
- return this.interop.invoke("T42.Notifications.Show");
19214
+ return this.interop.invoke("T42.Notifications.Show", undefined, "best", {
19215
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19216
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19217
+ });
19158
19218
  }
19159
19219
  show() {
19160
- return this.interop.invoke("T42.Notifications.Show", { show: true });
19220
+ return this.interop.invoke("T42.Notifications.Show", { show: true }, "best", {
19221
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19222
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19223
+ });
19161
19224
  }
19162
19225
  hide() {
19163
19226
  return this.interop.invoke("T42.Notifications.Hide");
19164
19227
  }
19165
19228
  async isVisible() {
19166
- const interopResult = await this.interop.invoke("T42.Notifications.Execute", { command: "isPanelVisible" });
19229
+ const interopResult = await this.interop.invoke("T42.Notifications.Execute", { command: "isPanelVisible" }, "best", {
19230
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19231
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19232
+ });
19167
19233
  return interopResult.returned.panelVisible;
19168
19234
  }
19169
19235
  toAPI() {
@@ -19185,6 +19251,7 @@
19185
19251
  this.NotificationsCounterStream = "T42.Notifications.Counter";
19186
19252
  this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
19187
19253
  this.NotificationsExecuteMethod = "T42.Notifications.Execute";
19254
+ this.NotificationFilterMethodName = "T42.Notifications.Filter";
19188
19255
  this.methodsRegistered = false;
19189
19256
  this.NOTIFICATIONS_CONFIGURE_METHOD_NAME = "T42.Notifications.Configure";
19190
19257
  this.methodNameRoot = "T42.Notifications.Handler-" + Utils.generateId();
@@ -19212,7 +19279,10 @@
19212
19279
  const g42notification = new Glue42Notification(options);
19213
19280
  this.notifications[notification.id] = g42notification;
19214
19281
  try {
19215
- const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
19282
+ const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification }, "best", {
19283
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19284
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19285
+ });
19216
19286
  g42notification.id = (_a = invocationResult.returned) === null || _a === void 0 ? void 0 : _a.id;
19217
19287
  }
19218
19288
  catch (err) {
@@ -19224,11 +19294,17 @@
19224
19294
  return g42notification;
19225
19295
  }
19226
19296
  async setFilter(filter) {
19227
- const result = await this.interop.invoke("T42.Notifications.Filter", filter);
19297
+ const result = await this.interop.invoke(this.NotificationFilterMethodName, filter, "best", {
19298
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19299
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19300
+ });
19228
19301
  return result.returned;
19229
19302
  }
19230
19303
  async getFilter() {
19231
- const result = await this.interop.invoke("T42.Notifications.Filter");
19304
+ const result = await this.interop.invoke(this.NotificationFilterMethodName, undefined, "best", {
19305
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19306
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19307
+ });
19232
19308
  return result.returned;
19233
19309
  }
19234
19310
  async configure(options) {
@@ -19278,15 +19354,27 @@
19278
19354
  if (typeof options.closeNotificationOnClick !== "undefined" && typeof options.closeNotificationOnClick !== "boolean") {
19279
19355
  throw new Error("Expected type of closeNotificationOnClick - boolean.");
19280
19356
  }
19281
- const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
19357
+ const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options, "best", {
19358
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19359
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19360
+ });
19282
19361
  return result.returned;
19283
19362
  }
19284
19363
  async getConfiguration() {
19285
- const result = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "getConfiguration" });
19364
+ const result = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "getConfiguration" }, "best", {
19365
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19366
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19367
+ });
19286
19368
  return result.returned;
19287
19369
  }
19288
19370
  async list() {
19289
- const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list", data: { statesVersion2: true } });
19371
+ const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, {
19372
+ command: "list",
19373
+ data: { statesVersion2: true }
19374
+ }, "best", {
19375
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19376
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19377
+ });
19290
19378
  return interopResult.returned.notifications;
19291
19379
  }
19292
19380
  async updateData(id, data) {
@@ -19297,7 +19385,10 @@
19297
19385
  stringValue: JSON.stringify(data, replacer)
19298
19386
  }
19299
19387
  };
19300
- const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "create-or-update-attribute", data: { id, attribute } });
19388
+ const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "create-or-update-attribute", data: { id, attribute } }, "best", {
19389
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19390
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19391
+ });
19301
19392
  return interopResult.returned;
19302
19393
  }
19303
19394
  onRaised(callback) {
@@ -19343,10 +19434,16 @@
19343
19434
  };
19344
19435
  }
19345
19436
  async clearAll() {
19346
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
19437
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" }, "best", {
19438
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19439
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19440
+ });
19347
19441
  }
19348
19442
  async clearOld() {
19349
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAllOld", data: { statesVersion2: true } });
19443
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAllOld", data: { statesVersion2: true } }, "best", {
19444
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19445
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19446
+ });
19350
19447
  }
19351
19448
  async clear(id) {
19352
19449
  if (!id) {
@@ -19355,17 +19452,29 @@
19355
19452
  if (typeof (id) !== "string") {
19356
19453
  throw new Error("The 'id' argument must be a string");
19357
19454
  }
19358
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clear", data: { id } });
19455
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clear", data: { id } }, "best", {
19456
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19457
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19458
+ });
19359
19459
  }
19360
19460
  async clearMany(notifications) {
19361
19461
  this.validateNotificationsArr(notifications);
19362
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearMany", data: { notifications } });
19462
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearMany", data: { notifications } }, "best", {
19463
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19464
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19465
+ });
19363
19466
  }
19364
19467
  async click(id, action, options) {
19365
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "click", data: { id, action, options } });
19468
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "click", data: { id, action, options } }, "best", {
19469
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19470
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19471
+ });
19366
19472
  }
19367
19473
  async snooze(id, duration) {
19368
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "snooze", data: { id, duration } });
19474
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "snooze", data: { id, duration } }, "best", {
19475
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19476
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19477
+ });
19369
19478
  }
19370
19479
  async snoozeMany(notifications, duration) {
19371
19480
  if (!duration) {
@@ -19375,7 +19484,10 @@
19375
19484
  throw new Error("The 'duration' argument must be a valid number");
19376
19485
  }
19377
19486
  this.validateNotificationsArr(notifications);
19378
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "snoozeMany", data: { notifications, duration } });
19487
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "snoozeMany", data: { notifications, duration } }, "best", {
19488
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19489
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19490
+ });
19379
19491
  }
19380
19492
  async setState(id, state) {
19381
19493
  if (!id) {
@@ -19388,7 +19500,10 @@
19388
19500
  throw new Error("The 'state' argument cannot be null or undefined");
19389
19501
  }
19390
19502
  this.validateState(state);
19391
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
19503
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } }, "best", {
19504
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19505
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19506
+ });
19392
19507
  }
19393
19508
  async setStates(notifications, state) {
19394
19509
  if (!state) {
@@ -19398,7 +19513,10 @@
19398
19513
  throw new Error("The 'state' argument must be a valid string");
19399
19514
  }
19400
19515
  this.validateNotificationsArr(notifications);
19401
- await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateStates", data: { notifications, state } });
19516
+ await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateStates", data: { notifications, state } }, "best", {
19517
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19518
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19519
+ });
19402
19520
  }
19403
19521
  toAPI() {
19404
19522
  return {
@@ -19434,7 +19552,10 @@
19434
19552
  throw new Error("Notifications argument must be a valid array with notification options");
19435
19553
  }
19436
19554
  const notificationsToImport = await Promise.all(notifications.map((notificationOptions) => this.createNotification(notificationOptions, true)));
19437
- const invocationResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "importNotifications", data: { notificationSettings: notificationsToImport } });
19555
+ const invocationResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "importNotifications", data: { notificationSettings: notificationsToImport } }, "best", {
19556
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
19557
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
19558
+ });
19438
19559
  return invocationResult.returned.notifications;
19439
19560
  }
19440
19561
  async createNotification(options, imported) {
@@ -21402,7 +21523,10 @@
21402
21523
  await Promise.all(this.unregisterIntentPromises);
21403
21524
  let apps;
21404
21525
  try {
21405
- const result = await this.interop.invoke("T42.ACS.GetApplications", { withIntentsInfo: true });
21526
+ const result = await this.interop.invoke("T42.ACS.GetApplications", { withIntentsInfo: true }, "best", {
21527
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
21528
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
21529
+ });
21406
21530
  apps = result.returned.applications;
21407
21531
  }
21408
21532
  catch (e) {
@@ -21441,7 +21565,10 @@
21441
21565
  let windowsInfos;
21442
21566
  if (isT42WndGetInfoMethodRegistered) {
21443
21567
  try {
21444
- const result = await this.interop.invoke(T42WndGetInfo, { ids: serverWindowIds });
21568
+ const result = await this.interop.invoke(T42WndGetInfo, { ids: serverWindowIds }, "best", {
21569
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
21570
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
21571
+ });
21445
21572
  windowsInfos = result.returned.windows;
21446
21573
  }
21447
21574
  catch (e) {
@@ -21892,7 +22019,10 @@
21892
22019
  this.intentsResolverResponsePromises[instanceId] = { intent, resolve, reject, promise, methodName: responseMethodName };
21893
22020
  }
21894
22021
  async invokeStartApp(application, context, options) {
21895
- const result = await this.interop.invoke("T42.ACS.StartApplication", { Name: application, options: { ...options, startedByIntentAPI: true } });
22022
+ const result = await this.interop.invoke("T42.ACS.StartApplication", { Name: application, options: { ...options, startedByIntentAPI: true } }, "best", {
22023
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22024
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22025
+ });
21896
22026
  return result.returned.Id;
21897
22027
  }
21898
22028
  subscribeOnInstanceStopped(instance, method) {
@@ -21978,10 +22108,10 @@
21978
22108
  return handlers.length > 1;
21979
22109
  }
21980
22110
  if (request.target === "reuse") {
21981
- return handlers.filter((handler) => handler.type === "instance" && handler.instanceId).length > 1 || intent.handlers.filter((handler) => handler.type === "app").length > 1;
22111
+ return handlers.filter(handler => handler.type === "instance" && handler.instanceId).length > 1 || intent.handlers.filter(handler => handler.type === "app").length > 1;
21982
22112
  }
21983
22113
  if (request.target === "startNew") {
21984
- return handlers.filter((handler) => handler.type === "app").length > 1;
22114
+ return handlers.filter(handler => handler.type === "app").length > 1;
21985
22115
  }
21986
22116
  if (request.target.instance) {
21987
22117
  return false;
@@ -22223,13 +22353,19 @@
22223
22353
  this.interopMethodRegistered = false;
22224
22354
  }
22225
22355
  async get(app) {
22226
- const data = (await this.interop.invoke("T42.Prefs.Get", { app: app !== null && app !== void 0 ? app : this.appName }));
22356
+ const data = (await this.interop.invoke(Prefs.T42GetPrefsMethodName, { app: app !== null && app !== void 0 ? app : this.appName }, "best", {
22357
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22358
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22359
+ }));
22227
22360
  return data.returned;
22228
22361
  }
22229
22362
  async set(data, options) {
22230
22363
  var _a;
22231
22364
  this.verifyDataObject(data);
22232
- await this.interop.invoke("T42.Prefs.Set", { app: (_a = options === null || options === void 0 ? void 0 : options.app) !== null && _a !== void 0 ? _a : this.appName, data, merge: false });
22365
+ await this.interop.invoke(Prefs.T42SetPrefsMethodName, { app: (_a = options === null || options === void 0 ? void 0 : options.app) !== null && _a !== void 0 ? _a : this.appName, data, merge: false }, "best", {
22366
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22367
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22368
+ });
22233
22369
  }
22234
22370
  async setFor(app, data) {
22235
22371
  this.verifyApp(app);
@@ -22239,7 +22375,10 @@
22239
22375
  async update(data, options) {
22240
22376
  var _a;
22241
22377
  this.verifyDataObject(data);
22242
- await this.interop.invoke("T42.Prefs.Set", { app: (_a = options === null || options === void 0 ? void 0 : options.app) !== null && _a !== void 0 ? _a : this.appName, data, merge: true });
22378
+ await this.interop.invoke(Prefs.T42SetPrefsMethodName, { app: (_a = options === null || options === void 0 ? void 0 : options.app) !== null && _a !== void 0 ? _a : this.appName, data, merge: true }, "best", {
22379
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22380
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22381
+ });
22243
22382
  }
22244
22383
  async updateFor(app, data) {
22245
22384
  this.verifyApp(app);
@@ -22247,18 +22386,30 @@
22247
22386
  return this.update(data, { app });
22248
22387
  }
22249
22388
  async clear(app) {
22250
- await this.interop.invoke("T42.Prefs.Set", { app: app !== null && app !== void 0 ? app : this.appName, clear: true });
22389
+ await this.interop.invoke(Prefs.T42SetPrefsMethodName, { app: app !== null && app !== void 0 ? app : this.appName, clear: true }, "best", {
22390
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22391
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22392
+ });
22251
22393
  }
22252
22394
  async clearFor(app) {
22253
22395
  this.verifyApp(app);
22254
- await this.interop.invoke("T42.Prefs.Set", { app, clear: true });
22396
+ await this.interop.invoke(Prefs.T42SetPrefsMethodName, { app, clear: true }, "best", {
22397
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22398
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22399
+ });
22255
22400
  }
22256
22401
  async getAll() {
22257
- const data = (await this.interop.invoke("T42.Prefs.Get"));
22402
+ const data = (await this.interop.invoke(Prefs.T42GetPrefsMethodName, undefined, "best", {
22403
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22404
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22405
+ }));
22258
22406
  return data.returned;
22259
22407
  }
22260
22408
  async clearAll() {
22261
- await this.interop.invoke("T42.Prefs.Set", { clear: true });
22409
+ await this.interop.invoke(Prefs.T42SetPrefsMethodName, { clear: true }, "best", {
22410
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22411
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22412
+ });
22262
22413
  }
22263
22414
  subscribe(callback) {
22264
22415
  this.verifyCallback(callback);
@@ -22270,7 +22421,10 @@
22270
22421
  const unsubscribeFn = this.registry.add(app, callback);
22271
22422
  this.registerInteropIfNeeded()
22272
22423
  .then(() => {
22273
- this.interop.invoke("T42.Prefs.Get", { app, subscribe: true });
22424
+ this.interop.invoke(Prefs.T42GetPrefsMethodName, { app, subscribe: true }, "best", {
22425
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22426
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22427
+ });
22274
22428
  });
22275
22429
  return () => {
22276
22430
  unsubscribeFn();
@@ -22281,7 +22435,7 @@
22281
22435
  return;
22282
22436
  }
22283
22437
  this.interopMethodRegistered = true;
22284
- await this.interop.register("T42.Prefs.Update", (args) => {
22438
+ await this.interop.register(Prefs.T42UpdatePrefsMethodName, (args) => {
22285
22439
  this.registry.execute(args.app, args);
22286
22440
  });
22287
22441
  }
@@ -22307,6 +22461,9 @@
22307
22461
  }
22308
22462
  }
22309
22463
  }
22464
+ Prefs.T42UpdatePrefsMethodName = "T42.Prefs.Update";
22465
+ Prefs.T42GetPrefsMethodName = "T42.Prefs.Get";
22466
+ Prefs.T42SetPrefsMethodName = "T42.Prefs.Set";
22310
22467
 
22311
22468
  class Cookies {
22312
22469
  constructor(methodName, interop) {
@@ -22331,7 +22488,10 @@
22331
22488
  await this.invoke("remove-cookie", { url, name });
22332
22489
  }
22333
22490
  invoke(command, data) {
22334
- return this.interop.invoke(this.methodName, { command, args: data });
22491
+ return this.interop.invoke(this.methodName, { command, args: data }, "best", {
22492
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22493
+ methodResponseTimeoutMs: INTEROP_METHOD_RESPONSE_TIMEOUT_MS,
22494
+ });
22335
22495
  }
22336
22496
  verifyCookieObject(cookie) {
22337
22497
  if (!cookie) {
@@ -22479,6 +22639,9 @@
22479
22639
  await this.interop.invoke(this.InterceptorMethodName, {
22480
22640
  command: "register",
22481
22641
  interceptions
22642
+ }, "best", {
22643
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22644
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22482
22645
  });
22483
22646
  await this.registerMethodIfNotRegistered();
22484
22647
  }
@@ -22499,6 +22662,9 @@
22499
22662
  await this.interop.invoke(this.InterceptorMethodName, {
22500
22663
  command: "unregister",
22501
22664
  interceptions
22665
+ }, "best", {
22666
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22667
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22502
22668
  });
22503
22669
  this.interceptions = this.interceptions.filter((config) => {
22504
22670
  return !interceptions.some((interception) => {
@@ -22526,7 +22692,10 @@
22526
22692
  operation,
22527
22693
  phase
22528
22694
  }]
22529
- }, 'best', { methodResponseTimeoutMs: 60 * 1000 });
22695
+ }, 'best', {
22696
+ waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
22697
+ methodResponseTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS
22698
+ });
22530
22699
  return result.returned;
22531
22700
  }
22532
22701
  static createProxyObject(apiToIntercept, domain, interception) {