@robotical/webapp-types 3.20.0 → 3.21.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.
@@ -46,6 +46,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
46
46
  import { WrapperSentMessage } from "../types/communication-between-apps/wrapper-communication";
47
47
  import { RaftConnectionMethod, } from "../types/raft";
48
48
  import Logger from "../services/logger/Logger";
49
+ import { getSafeErrorMetadata } from "../services/observability/sanitizeTelemetry";
49
50
  import { RaftConnEvent } from "@robdobsn/raftjs";
50
51
  import { ConnManager } from "@robotical/roboticaljs";
51
52
  import ConnectorFactory from "./connectors/ConnectorFactory";
@@ -165,13 +166,13 @@ var WrapperAppManager = /** @class */ (function () {
165
166
  return [3 /*break*/, 4];
166
167
  case 3:
167
168
  error_2 = _a.sent();
168
- Logger.warn(SHOW_LOGS, TAG, "Failed late WebSocket cleanup: ".concat(error_2));
169
+ Logger.warn(SHOW_LOGS, TAG, "Failed late WebSocket cleanup", getSafeErrorMetadata(error_2));
169
170
  return [3 /*break*/, 4];
170
171
  case 4: return [2 /*return*/];
171
172
  }
172
173
  });
173
174
  }); }).catch(function (error) {
174
- Logger.warn(SHOW_LOGS, TAG, "WebSocket connection settled after timeout: ".concat(error));
175
+ Logger.warn(SHOW_LOGS, TAG, "WebSocket connection settled after timeout", getSafeErrorMetadata(error));
175
176
  });
176
177
  Logger.warn(SHOW_LOGS, TAG, "WebSocket connection timed out after ".concat(WEBSOCKET_CONNECT_TIMEOUT_MS, "ms"));
177
178
  return [2 /*return*/, { success: false, reason: "failed" }];
@@ -229,7 +230,7 @@ var WrapperAppManager = /** @class */ (function () {
229
230
  case 12:
230
231
  if (!setupResult) {
231
232
  void connectorConnectionPromise.catch(function (error) {
232
- Logger.warn(SHOW_LOGS, TAG, "WebSocket setup settled after timeout: ".concat(error));
233
+ Logger.warn(SHOW_LOGS, TAG, "WebSocket setup settled after timeout", getSafeErrorMetadata(error));
233
234
  });
234
235
  Logger.warn(SHOW_LOGS, TAG, "WebSocket setup timed out after ".concat(WEBSOCKET_CONNECT_TIMEOUT_MS, "ms"));
235
236
  return [2 /*return*/, { success: false, reason: "failed" }];
@@ -242,18 +243,18 @@ var WrapperAppManager = /** @class */ (function () {
242
243
  _a.label = 15;
243
244
  case 15:
244
245
  if (!connectionResults.success) {
245
- Logger.warn(SHOW_LOGS, TAG, "Failed to connect to RAFT with id: ".concat(connector.id, " and type: ").concat(connector.type));
246
+ Logger.warn(SHOW_LOGS, TAG, "Failed to connect to RAFT", { raftId: connector.id, raftType: connector.type });
246
247
  return [2 /*return*/, connectionResults];
247
248
  }
248
249
  if (this._pageUnloadStarted ||
249
250
  disconnectedBeforeCommit ||
250
251
  !connector.connManager.isConnected()) {
251
- Logger.warn(SHOW_LOGS, TAG, "RAFT disconnected before setup completed: ".concat(connector.id));
252
+ Logger.warn(SHOW_LOGS, TAG, "RAFT disconnected before setup completed", { raftId: connector.id });
252
253
  return [2 /*return*/, { success: false, reason: "failed" }];
253
254
  }
254
255
  existingConnector = this.connectors[connector.id];
255
256
  if (existingConnector && existingConnector !== connector) {
256
- Logger.warn(SHOW_LOGS, TAG, "Refusing to replace active RAFT connector with id: ".concat(connector.id));
257
+ Logger.warn(SHOW_LOGS, TAG, "Refusing to replace active RAFT connector", { raftId: connector.id });
257
258
  return [2 /*return*/, { success: false, reason: "failed" }];
258
259
  }
259
260
  raftSystemUtils = connector.connManager.getConnector().getRaftSystemUtils();
@@ -286,7 +287,7 @@ var WrapperAppManager = /** @class */ (function () {
286
287
  return [3 /*break*/, 20];
287
288
  case 19:
288
289
  error_1 = _a.sent();
289
- Logger.warn(SHOW_LOGS, TAG, "Failed to clean up uncommitted connector ".concat(connector.id, ": ").concat(error_1));
290
+ Logger.warn(SHOW_LOGS, TAG, "Failed to clean up uncommitted connector", { raftId: connector.id }, error_1);
290
291
  return [3 /*break*/, 20];
291
292
  case 20: return [3 /*break*/, 22];
292
293
  case 21:
@@ -344,7 +345,7 @@ var WrapperAppManager = /** @class */ (function () {
344
345
  return true;
345
346
  }
346
347
  catch (error) {
347
- Logger.error(SHOW_LOGS, TAG, "Failed to save file on device: ".concat(error));
348
+ Logger.error(SHOW_LOGS, TAG, "Failed to save file on device", error);
348
349
  return false;
349
350
  }
350
351
  };
@@ -355,7 +356,7 @@ var WrapperAppManager = /** @class */ (function () {
355
356
  return true;
356
357
  }
357
358
  catch (error) {
358
- Logger.error(SHOW_LOGS, TAG, "Failed to delete file: ".concat(error));
359
+ Logger.error(SHOW_LOGS, TAG, "Failed to delete file", error);
359
360
  return false;
360
361
  }
361
362
  };
@@ -369,7 +370,7 @@ var WrapperAppManager = /** @class */ (function () {
369
370
  return false;
370
371
  }
371
372
  catch (error) {
372
- Logger.error(SHOW_LOGS, TAG, "Failed to load file: ".concat(error));
373
+ Logger.error(SHOW_LOGS, TAG, "Failed to load file", error);
373
374
  return false;
374
375
  }
375
376
  };
@@ -393,7 +394,7 @@ var WrapperAppManager = /** @class */ (function () {
393
394
  switch (_a.label) {
394
395
  case 0:
395
396
  if (!this.connectors[raftId]) {
396
- Logger.warn(SHOW_LOGS, TAG, "confirmVerifiedRaft: No connector found for raftId: ".concat(raftId));
397
+ Logger.warn(SHOW_LOGS, TAG, "No connector found while confirming RAFT", { raftId: raftId });
397
398
  return [2 /*return*/, false];
398
399
  }
399
400
  connector = this.connectors[raftId];
@@ -463,7 +464,7 @@ var WrapperAppManager = /** @class */ (function () {
463
464
  */
464
465
  WrapperAppManager.prototype.verifyRaft = function (ledLcdColours, raftId) {
465
466
  if (!this.connectors[raftId]) {
466
- Logger.warn(SHOW_LOGS, TAG, "verifyRaft: No connector found for raftId: ".concat(raftId));
467
+ Logger.warn(SHOW_LOGS, TAG, "No connector found while verifying RAFT", { raftId: raftId });
467
468
  return false;
468
469
  }
469
470
  return this.connectors[raftId].verifyRaft(ledLcdColours);
@@ -522,7 +523,7 @@ var WrapperAppManager = /** @class */ (function () {
522
523
  connector.disconnectForPageUnload();
523
524
  }
524
525
  catch (error) {
525
- Logger.warn(SHOW_LOGS, TAG, "Failed page-unload cleanup for connector ".concat(connector.id, ": ").concat(error));
526
+ Logger.warn(SHOW_LOGS, TAG, "Failed page-unload connector cleanup", { raftId: connector.id }, error);
526
527
  }
527
528
  }
528
529
  };
@@ -536,7 +537,7 @@ var WrapperAppManager = /** @class */ (function () {
536
537
  connManager.getConnector().disconnectForPageUnload();
537
538
  }
538
539
  catch (error) {
539
- Logger.warn(SHOW_LOGS, TAG, "Failed pending page-unload cleanup: ".concat(error));
540
+ Logger.warn(SHOW_LOGS, TAG, "Failed pending page-unload cleanup", getSafeErrorMetadata(error));
540
541
  }
541
542
  };
542
543
  WrapperAppManager.prototype.isConnected = function (raftId) {
@@ -628,7 +629,7 @@ var WrapperAppManager = /** @class */ (function () {
628
629
  case 3:
629
630
  isConnected = _a.sent();
630
631
  if (!isConnected) {
631
- Logger.warn(SHOW_LOGS, TAG, "Failed to connect to device: ".concat(device_1.name));
632
+ Logger.warn(SHOW_LOGS, TAG, "Failed to connect to device", { deviceName: device_1.name });
632
633
  return [2 /*return*/, existingDevices];
633
634
  }
634
635
  connector = warrantyConnManager.getConnector();
@@ -643,12 +644,12 @@ var WrapperAppManager = /** @class */ (function () {
643
644
  Logger.info(SHOW_LOGS, TAG, "".concat(device_1.name, " added to the list of robots."));
644
645
  return [2 /*return*/, existingDevices];
645
646
  case 5:
646
- Logger.warn(SHOW_LOGS, TAG, "".concat(device_1.name, " is already in the list of robots."));
647
+ Logger.warn(SHOW_LOGS, TAG, "Device is already in the list of robots", { deviceName: device_1.name });
647
648
  _a.label = 6;
648
649
  case 6: return [3 /*break*/, 14];
649
650
  case 7:
650
651
  error_3 = _a.sent();
651
- Logger.error(SHOW_LOGS, TAG, JSON.stringify(error_3));
652
+ Logger.error(SHOW_LOGS, TAG, "Failed to discover warranty device", getSafeErrorMetadata(error_3));
652
653
  return [2 /*return*/, existingDevices];
653
654
  case 8:
654
655
  if (!ownsTemporaryConnection) return [3 /*break*/, 13];
@@ -661,7 +662,7 @@ var WrapperAppManager = /** @class */ (function () {
661
662
  return [3 /*break*/, 13];
662
663
  case 11:
663
664
  error_4 = _a.sent();
664
- Logger.warn(SHOW_LOGS, TAG, "Failed warranty connection cleanup: ".concat(error_4));
665
+ Logger.warn(SHOW_LOGS, TAG, "Failed warranty connection cleanup", getSafeErrorMetadata(error_4));
665
666
  return [3 /*break*/, 13];
666
667
  case 12:
667
668
  this._pendingConnManagers.delete(warrantyConnManager);
@@ -694,11 +695,11 @@ var WrapperAppManager = /** @class */ (function () {
694
695
  return [2 /*return*/, true];
695
696
  case 3:
696
697
  error_5 = _a.sent();
697
- Logger.error(SHOW_LOGS, TAG, "Failed to send atomic read operation to Marty: ".concat(error_5));
698
+ Logger.error(SHOW_LOGS, TAG, "Failed to send atomic read operation to Marty", getSafeErrorMetadata(error_5));
698
699
  return [3 /*break*/, 4];
699
700
  case 4: return [3 /*break*/, 6];
700
701
  case 5:
701
- Logger.warn(SHOW_LOGS, TAG, "No connector found for raftId: ".concat(raftId));
702
+ Logger.warn(SHOW_LOGS, TAG, "No connector found for RAFT", { raftId: raftId });
702
703
  _a.label = 6;
703
704
  case 6: return [2 /*return*/, false];
704
705
  }
@@ -39,6 +39,7 @@ import randomHashGenerator from "../../utils/helpers/randomHashGenerator";
39
39
  import CogConnector from "./CogConnector/CogConnector";
40
40
  import MartyConnector from "./MartyConnector/MartyConnector";
41
41
  import Logger from "../../services/logger/Logger";
42
+ import { getSafeErrorMetadata } from "../../services/observability/sanitizeTelemetry";
42
43
  var SHOW_LOGS = true;
43
44
  var TAG = "ConnectorFactory";
44
45
  var ConnectorFactory = /** @class */ (function () {
@@ -102,7 +103,7 @@ var ConnectorFactory = /** @class */ (function () {
102
103
  return [3 /*break*/, 7];
103
104
  case 6:
104
105
  error_1 = _a.sent();
105
- Logger.warn(SHOW_LOGS, TAG, "Failed to clean up uncommitted RAFT connection: ".concat(error_1));
106
+ Logger.warn(SHOW_LOGS, TAG, "Failed to clean up uncommitted RAFT connection", getSafeErrorMetadata(error_1));
106
107
  return [3 /*break*/, 7];
107
108
  case 7: return [7 /*endfinally*/];
108
109
  case 8: return [2 /*return*/];
@@ -8,7 +8,7 @@ export function saveItemOnDevice(itemName, base64) {
8
8
  return true;
9
9
  }
10
10
  catch (error) {
11
- Logger.error(SHOW_LOGS, TAG, "Failed to save item on device: ".concat(error));
11
+ Logger.error(SHOW_LOGS, TAG, "Failed to save item on device", error);
12
12
  return false;
13
13
  }
14
14
  }
@@ -19,7 +19,7 @@ export function deleteItem(itemName) {
19
19
  return true;
20
20
  }
21
21
  catch (error) {
22
- Logger.error(SHOW_LOGS, TAG, "Failed to delete item: ".concat(error));
22
+ Logger.error(SHOW_LOGS, TAG, "Failed to delete item", error);
23
23
  return false;
24
24
  }
25
25
  }
@@ -33,7 +33,7 @@ export function loadItem(itemName) {
33
33
  return false;
34
34
  }
35
35
  catch (error) {
36
- Logger.error(SHOW_LOGS, TAG, "Failed to load item: ".concat(error));
36
+ Logger.error(SHOW_LOGS, TAG, "Failed to load item", error);
37
37
  return false;
38
38
  }
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Type definitions for the Application Manager",
5
5
  "main": "dist/application-manager.d.ts",
6
6
  "types": "dist/application-manager.d.ts",