@interopio/desktop 6.17.0 → 6.18.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.
@@ -1224,6 +1224,13 @@
1224
1224
  }
1225
1225
  seen.add(value);
1226
1226
  }
1227
+ if (value instanceof Error) {
1228
+ return {
1229
+ message: value.message,
1230
+ name: value.name,
1231
+ stack: value.stack
1232
+ };
1233
+ }
1227
1234
  return value;
1228
1235
  };
1229
1236
  reason = JSON.stringify(err, replacer);
@@ -1468,6 +1475,7 @@
1468
1475
  this.notifyStatusChanged(true);
1469
1476
  }
1470
1477
  close() {
1478
+ this.logger.debug(`closing connection - clientId: ${this.myClientId}, windowId: ${this.identity?.windowId || "unknown"}, client connected: ${this.iAmConnected}`);
1471
1479
  const message = {
1472
1480
  glue42core: {
1473
1481
  type: this.messages.gatewayDisconnect.name,
@@ -1540,7 +1548,7 @@
1540
1548
  selfAssignedWindowId: this.selfAssignedWindowId
1541
1549
  }
1542
1550
  };
1543
- this.logger.debug("sending connection request");
1551
+ this.logger.debug(`sending connection request - clientId: ${this.myClientId}`);
1544
1552
  if (this.extContentConnecting) {
1545
1553
  request.glue42core.clientType = "child";
1546
1554
  request.glue42core.bridgeInstanceId = this.myClientId;
@@ -1567,6 +1575,7 @@
1567
1575
  this.logger.debug("skipping generic message listener, because this is an internal client");
1568
1576
  return;
1569
1577
  }
1578
+ this.logger.debug("setting up window message listener");
1570
1579
  window.addEventListener("message", (event) => {
1571
1580
  const data = event.data?.glue42core;
1572
1581
  if (!data || this.rejected) {
@@ -1591,6 +1600,7 @@
1591
1600
  this.logger.debug("skipping unload event listener, because this is an internal client");
1592
1601
  return;
1593
1602
  }
1603
+ this.logger.debug("setting up unload event listeners");
1594
1604
  window.addEventListener("beforeunload", () => {
1595
1605
  if (this._connectionProtocolVersion) {
1596
1606
  return;
@@ -1608,6 +1618,7 @@
1608
1618
  if (this.extContentConnected) {
1609
1619
  return;
1610
1620
  }
1621
+ this.logger.debug(`signaling client disappearing for clientId: ${this.myClientId}`);
1611
1622
  const message = {
1612
1623
  glue42core: {
1613
1624
  type: this.messages.clientUnload.name,
@@ -1742,6 +1753,7 @@
1742
1753
  source.postMessage(message, event.origin);
1743
1754
  }
1744
1755
  setupPlatformUnloadListener() {
1756
+ this.logger.debug("setting up platform unload listener");
1745
1757
  this.onMessage((msg) => {
1746
1758
  if (msg.type === "platformUnload") {
1747
1759
  this.logger.debug("detected a web platform unload");
@@ -1751,6 +1763,7 @@
1751
1763
  });
1752
1764
  }
1753
1765
  handleManualUnload() {
1766
+ this.logger.debug("handling manual unload");
1754
1767
  const message = {
1755
1768
  glue42core: {
1756
1769
  type: this.messages.clientUnload.name,
@@ -1769,6 +1782,7 @@
1769
1782
  return;
1770
1783
  }
1771
1784
  notifyStatusChanged(status, reason) {
1785
+ this.logger.debug(`status changed - connected: ${status}, reason: ${reason || "none"}`);
1772
1786
  this.iAmConnected = status;
1773
1787
  this.registry.execute("onConnectedChanged", status, reason);
1774
1788
  }
@@ -2738,7 +2752,7 @@
2738
2752
  return authentication;
2739
2753
  }
2740
2754
  async logoutCore() {
2741
- this.logger.debug("logging out...");
2755
+ this.logger.debug("core logging out...");
2742
2756
  this.shouldTryLogin = false;
2743
2757
  if (this.pingTimer) {
2744
2758
  clearTimeout(this.pingTimer);
@@ -2969,7 +2983,7 @@
2969
2983
  }
2970
2984
  };
2971
2985
 
2972
- var version$1 = "6.7.3";
2986
+ var version$1 = "6.8.1";
2973
2987
 
2974
2988
  function prepareConfig$1 (configuration, ext, glue42gd) {
2975
2989
  let nodeStartingContext;
@@ -6752,7 +6766,6 @@
6752
6766
  };
6753
6767
  const nonEmptyStringDecoder$1 = string$1().where((s) => s.length > 0, "Expected a non-empty string");
6754
6768
  const nonNegativeNumberDecoder$1 = number$1().where((num) => num >= 0, "Expected a non-negative number or 0");
6755
- const positiveNumberDecoder = number$1().where((num) => num > 0, "Expected a positive number");
6756
6769
  const methodDefinitionDecoder = object$1({
6757
6770
  name: nonEmptyStringDecoder$1,
6758
6771
  objectTypes: optional$1(array$1(nonEmptyStringDecoder$1)),
@@ -6785,8 +6798,8 @@
6785
6798
  });
6786
6799
  const targetDecoder = union(constant$1("best"), constant$1("all"), constant$1("skipMine"), instanceDecoder, array$1(instanceDecoder));
6787
6800
  const invokeOptionsDecoder = object$1({
6788
- waitTimeoutMs: optional$1(positiveNumberDecoder),
6789
- methodResponseTimeoutMs: optional$1(positiveNumberDecoder)
6801
+ waitTimeoutMs: optional$1(nonNegativeNumberDecoder$1),
6802
+ methodResponseTimeoutMs: optional$1(nonNegativeNumberDecoder$1)
6790
6803
  });
6791
6804
 
6792
6805
  var InvokeStatus;
@@ -20467,7 +20480,7 @@
20467
20480
  }
20468
20481
  }
20469
20482
 
20470
- var version = "6.17.0";
20483
+ var version = "6.18.0";
20471
20484
 
20472
20485
  var prepareConfig = (options) => {
20473
20486
  function getLibConfig(value, defaultMode, trueMode) {
@@ -24438,9 +24451,10 @@
24438
24451
  };
24439
24452
  }
24440
24453
  catch (error) {
24441
- const msg = `Failed to import app definitions: ${error.message}`;
24454
+ const errorMessage = error instanceof Error ? error.message : String(error);
24455
+ const msg = `Failed to import app definitions: ${errorMessage}`;
24442
24456
  this.logger.error(msg, error);
24443
- throw new Error(msg);
24457
+ throw new Error(msg, { cause: error });
24444
24458
  }
24445
24459
  }
24446
24460
  async has(name) {
@@ -24451,18 +24465,40 @@
24451
24465
  return result.returned.result !== undefined ? result.returned.result : false;
24452
24466
  }
24453
24467
  async remove(options) {
24454
- if (!(options === null || options === void 0 ? void 0 : options.name)) {
24468
+ if ((options === null || options === void 0 ? void 0 : options.name) === undefined) {
24455
24469
  throw new Error("App name is required for removal");
24456
24470
  }
24457
- this.logger.debug(`Removing app definition: ${options.name}`);
24471
+ const names = Array.isArray(options.name) ? options.name : [options.name];
24472
+ if (names.length === 0) {
24473
+ throw new Error("At least one app name is required for removal");
24474
+ }
24475
+ const invalidEntries = [];
24476
+ names.forEach((entry, index) => {
24477
+ if (typeof entry !== 'string') {
24478
+ invalidEntries.push(`index ${index}: expected string, got ${typeof entry}`);
24479
+ }
24480
+ else if (entry.trim() === '') {
24481
+ invalidEntries.push(`index ${index}: empty or whitespace-only string`);
24482
+ }
24483
+ });
24484
+ if (invalidEntries.length > 0) {
24485
+ throw new Error(`Invalid app name(s) for removal: ${invalidEntries.join('; ')}`);
24486
+ }
24487
+ const maxSampleSize = 10;
24488
+ const sampleNames = names.slice(0, maxSampleSize);
24489
+ const displayNames = Array.isArray(options.name)
24490
+ ? `[${sampleNames.join(", ")}${names.length > maxSampleSize ? ", ..." : ""}] (total ${names.length})`
24491
+ : options.name;
24492
+ this.logger.debug(`Removing app definition(s): ${displayNames}`);
24458
24493
  try {
24459
24494
  await invokeAppsCommand(this.interop, "in-memory-remove", options);
24460
- this.logger.debug(`Removed app definition: ${options.name}`);
24495
+ this.logger.debug(`Removed app definition(s): ${displayNames}`);
24461
24496
  }
24462
24497
  catch (error) {
24463
- const msg = `Failed to remove app definition: ${options.name}`;
24498
+ const errorMessage = error instanceof Error ? error.message : String(error);
24499
+ const msg = `Failed to remove app definition(s): ${displayNames}. ${errorMessage}`;
24464
24500
  this.logger.error(msg, error);
24465
- throw new Error(msg);
24501
+ throw new Error(msg, { cause: error });
24466
24502
  }
24467
24503
  }
24468
24504
  async clear(options) {
@@ -24471,9 +24507,10 @@
24471
24507
  await invokeAppsCommand(this.interop, "in-memory-clear", options);
24472
24508
  }
24473
24509
  catch (error) {
24474
- const msg = `Failed to clear in-memory app definitions: ${error.message}`;
24510
+ const errorMessage = error instanceof Error ? error.message : String(error);
24511
+ const msg = `Failed to clear in-memory app definitions: ${errorMessage}`;
24475
24512
  this.logger.error(msg, error);
24476
- throw new Error(msg);
24513
+ throw new Error(msg, { cause: error });
24477
24514
  }
24478
24515
  }
24479
24516
  }