@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.
@@ -1218,6 +1218,13 @@ class WS {
1218
1218
  }
1219
1219
  seen.add(value);
1220
1220
  }
1221
+ if (value instanceof Error) {
1222
+ return {
1223
+ message: value.message,
1224
+ name: value.name,
1225
+ stack: value.stack
1226
+ };
1227
+ }
1221
1228
  return value;
1222
1229
  };
1223
1230
  reason = JSON.stringify(err, replacer);
@@ -1462,6 +1469,7 @@ class WebPlatformTransport {
1462
1469
  this.notifyStatusChanged(true);
1463
1470
  }
1464
1471
  close() {
1472
+ this.logger.debug(`closing connection - clientId: ${this.myClientId}, windowId: ${this.identity?.windowId || "unknown"}, client connected: ${this.iAmConnected}`);
1465
1473
  const message = {
1466
1474
  glue42core: {
1467
1475
  type: this.messages.gatewayDisconnect.name,
@@ -1534,7 +1542,7 @@ class WebPlatformTransport {
1534
1542
  selfAssignedWindowId: this.selfAssignedWindowId
1535
1543
  }
1536
1544
  };
1537
- this.logger.debug("sending connection request");
1545
+ this.logger.debug(`sending connection request - clientId: ${this.myClientId}`);
1538
1546
  if (this.extContentConnecting) {
1539
1547
  request.glue42core.clientType = "child";
1540
1548
  request.glue42core.bridgeInstanceId = this.myClientId;
@@ -1561,6 +1569,7 @@ class WebPlatformTransport {
1561
1569
  this.logger.debug("skipping generic message listener, because this is an internal client");
1562
1570
  return;
1563
1571
  }
1572
+ this.logger.debug("setting up window message listener");
1564
1573
  window.addEventListener("message", (event) => {
1565
1574
  const data = event.data?.glue42core;
1566
1575
  if (!data || this.rejected) {
@@ -1585,6 +1594,7 @@ class WebPlatformTransport {
1585
1594
  this.logger.debug("skipping unload event listener, because this is an internal client");
1586
1595
  return;
1587
1596
  }
1597
+ this.logger.debug("setting up unload event listeners");
1588
1598
  window.addEventListener("beforeunload", () => {
1589
1599
  if (this._connectionProtocolVersion) {
1590
1600
  return;
@@ -1602,6 +1612,7 @@ class WebPlatformTransport {
1602
1612
  if (this.extContentConnected) {
1603
1613
  return;
1604
1614
  }
1615
+ this.logger.debug(`signaling client disappearing for clientId: ${this.myClientId}`);
1605
1616
  const message = {
1606
1617
  glue42core: {
1607
1618
  type: this.messages.clientUnload.name,
@@ -1736,6 +1747,7 @@ class WebPlatformTransport {
1736
1747
  source.postMessage(message, event.origin);
1737
1748
  }
1738
1749
  setupPlatformUnloadListener() {
1750
+ this.logger.debug("setting up platform unload listener");
1739
1751
  this.onMessage((msg) => {
1740
1752
  if (msg.type === "platformUnload") {
1741
1753
  this.logger.debug("detected a web platform unload");
@@ -1745,6 +1757,7 @@ class WebPlatformTransport {
1745
1757
  });
1746
1758
  }
1747
1759
  handleManualUnload() {
1760
+ this.logger.debug("handling manual unload");
1748
1761
  const message = {
1749
1762
  glue42core: {
1750
1763
  type: this.messages.clientUnload.name,
@@ -1763,6 +1776,7 @@ class WebPlatformTransport {
1763
1776
  return;
1764
1777
  }
1765
1778
  notifyStatusChanged(status, reason) {
1779
+ this.logger.debug(`status changed - connected: ${status}, reason: ${reason || "none"}`);
1766
1780
  this.iAmConnected = status;
1767
1781
  this.registry.execute("onConnectedChanged", status, reason);
1768
1782
  }
@@ -2732,7 +2746,7 @@ class Connection {
2732
2746
  return authentication;
2733
2747
  }
2734
2748
  async logoutCore() {
2735
- this.logger.debug("logging out...");
2749
+ this.logger.debug("core logging out...");
2736
2750
  this.shouldTryLogin = false;
2737
2751
  if (this.pingTimer) {
2738
2752
  clearTimeout(this.pingTimer);
@@ -2963,7 +2977,7 @@ const ContextMessageReplaySpec = {
2963
2977
  }
2964
2978
  };
2965
2979
 
2966
- var version$1 = "6.7.3";
2980
+ var version$1 = "6.8.1";
2967
2981
 
2968
2982
  function prepareConfig$1 (configuration, ext, glue42gd) {
2969
2983
  let nodeStartingContext;
@@ -6746,7 +6760,6 @@ const functionCheck = (input, propDescription) => {
6746
6760
  };
6747
6761
  const nonEmptyStringDecoder$1 = string$1().where((s) => s.length > 0, "Expected a non-empty string");
6748
6762
  const nonNegativeNumberDecoder$1 = number$1().where((num) => num >= 0, "Expected a non-negative number or 0");
6749
- const positiveNumberDecoder = number$1().where((num) => num > 0, "Expected a positive number");
6750
6763
  const methodDefinitionDecoder = object$1({
6751
6764
  name: nonEmptyStringDecoder$1,
6752
6765
  objectTypes: optional$1(array$1(nonEmptyStringDecoder$1)),
@@ -6779,8 +6792,8 @@ const instanceDecoder = object$1({
6779
6792
  });
6780
6793
  const targetDecoder = union(constant$1("best"), constant$1("all"), constant$1("skipMine"), instanceDecoder, array$1(instanceDecoder));
6781
6794
  const invokeOptionsDecoder = object$1({
6782
- waitTimeoutMs: optional$1(positiveNumberDecoder),
6783
- methodResponseTimeoutMs: optional$1(positiveNumberDecoder)
6795
+ waitTimeoutMs: optional$1(nonNegativeNumberDecoder$1),
6796
+ methodResponseTimeoutMs: optional$1(nonNegativeNumberDecoder$1)
6784
6797
  });
6785
6798
 
6786
6799
  var InvokeStatus;
@@ -20461,7 +20474,7 @@ class Platform {
20461
20474
  }
20462
20475
  }
20463
20476
 
20464
- var version = "6.17.0";
20477
+ var version = "6.18.0";
20465
20478
 
20466
20479
  var prepareConfig = (options) => {
20467
20480
  function getLibConfig(value, defaultMode, trueMode) {
@@ -24432,9 +24445,10 @@ class InMemoryStoreImpl {
24432
24445
  };
24433
24446
  }
24434
24447
  catch (error) {
24435
- const msg = `Failed to import app definitions: ${error.message}`;
24448
+ const errorMessage = error instanceof Error ? error.message : String(error);
24449
+ const msg = `Failed to import app definitions: ${errorMessage}`;
24436
24450
  this.logger.error(msg, error);
24437
- throw new Error(msg);
24451
+ throw new Error(msg, { cause: error });
24438
24452
  }
24439
24453
  }
24440
24454
  async has(name) {
@@ -24445,18 +24459,40 @@ class InMemoryStoreImpl {
24445
24459
  return result.returned.result !== undefined ? result.returned.result : false;
24446
24460
  }
24447
24461
  async remove(options) {
24448
- if (!(options === null || options === void 0 ? void 0 : options.name)) {
24462
+ if ((options === null || options === void 0 ? void 0 : options.name) === undefined) {
24449
24463
  throw new Error("App name is required for removal");
24450
24464
  }
24451
- this.logger.debug(`Removing app definition: ${options.name}`);
24465
+ const names = Array.isArray(options.name) ? options.name : [options.name];
24466
+ if (names.length === 0) {
24467
+ throw new Error("At least one app name is required for removal");
24468
+ }
24469
+ const invalidEntries = [];
24470
+ names.forEach((entry, index) => {
24471
+ if (typeof entry !== 'string') {
24472
+ invalidEntries.push(`index ${index}: expected string, got ${typeof entry}`);
24473
+ }
24474
+ else if (entry.trim() === '') {
24475
+ invalidEntries.push(`index ${index}: empty or whitespace-only string`);
24476
+ }
24477
+ });
24478
+ if (invalidEntries.length > 0) {
24479
+ throw new Error(`Invalid app name(s) for removal: ${invalidEntries.join('; ')}`);
24480
+ }
24481
+ const maxSampleSize = 10;
24482
+ const sampleNames = names.slice(0, maxSampleSize);
24483
+ const displayNames = Array.isArray(options.name)
24484
+ ? `[${sampleNames.join(", ")}${names.length > maxSampleSize ? ", ..." : ""}] (total ${names.length})`
24485
+ : options.name;
24486
+ this.logger.debug(`Removing app definition(s): ${displayNames}`);
24452
24487
  try {
24453
24488
  await invokeAppsCommand(this.interop, "in-memory-remove", options);
24454
- this.logger.debug(`Removed app definition: ${options.name}`);
24489
+ this.logger.debug(`Removed app definition(s): ${displayNames}`);
24455
24490
  }
24456
24491
  catch (error) {
24457
- const msg = `Failed to remove app definition: ${options.name}`;
24492
+ const errorMessage = error instanceof Error ? error.message : String(error);
24493
+ const msg = `Failed to remove app definition(s): ${displayNames}. ${errorMessage}`;
24458
24494
  this.logger.error(msg, error);
24459
- throw new Error(msg);
24495
+ throw new Error(msg, { cause: error });
24460
24496
  }
24461
24497
  }
24462
24498
  async clear(options) {
@@ -24465,9 +24501,10 @@ class InMemoryStoreImpl {
24465
24501
  await invokeAppsCommand(this.interop, "in-memory-clear", options);
24466
24502
  }
24467
24503
  catch (error) {
24468
- const msg = `Failed to clear in-memory app definitions: ${error.message}`;
24504
+ const errorMessage = error instanceof Error ? error.message : String(error);
24505
+ const msg = `Failed to clear in-memory app definitions: ${errorMessage}`;
24469
24506
  this.logger.error(msg, error);
24470
- throw new Error(msg);
24507
+ throw new Error(msg, { cause: error });
24471
24508
  }
24472
24509
  }
24473
24510
  }