@robotical/webapp-types 3.21.7 → 3.21.9

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marty-web-app",
3
- "version": "3.21.7",
3
+ "version": "3.21.9",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "@radix-ui/react-dropdown-menu": "^2.1.2",
@@ -12,7 +12,7 @@
12
12
  "@robotical/codewheel": "^0.1.10",
13
13
  "@robotical/cog-shooter-game": "^0.1.27",
14
14
  "@robotical/jumping-game": "^0.1.29",
15
- "@robotical/martyblocks": "^4.0.66",
15
+ "@robotical/martyblocks": "^4.0.67",
16
16
  "@robotical/martyblocksjr": "^4.2.14",
17
17
  "@robotical/maze": "^0.1.21",
18
18
  "@robotical/rc-sequencer": "^1.1.15",
@@ -294,9 +294,21 @@ var Marty = /** @class */ (function (_super) {
294
294
  */
295
295
  Marty.prototype.msgEventHandler = function (eventEnum, eventName, data) {
296
296
  return __awaiter(this, void 0, void 0, function () {
297
+ var error_2;
297
298
  return __generator(this, function (_a) {
298
- this.ricNotificationManager.reportNofication(data);
299
- return [2 /*return*/];
299
+ switch (_a.label) {
300
+ case 0:
301
+ _a.trys.push([0, 2, , 3]);
302
+ return [4 /*yield*/, this.ricNotificationManager.reportNofication(data)];
303
+ case 1:
304
+ _a.sent();
305
+ return [3 /*break*/, 3];
306
+ case 2:
307
+ error_2 = _a.sent();
308
+ Logger.error(SHOW_LOGS, TAG, "Failed to process Marty notification", error_2 instanceof Error ? error_2 : getSafeErrorMetadata(error_2));
309
+ return [3 /*break*/, 3];
310
+ case 3: return [2 /*return*/];
311
+ }
300
312
  });
301
313
  });
302
314
  };
@@ -86,6 +86,11 @@ var LastReportedCache = /** @class */ (function () {
86
86
  };
87
87
  return LastReportedCache;
88
88
  }());
89
+ var isCompressedHardwareElementList = function (value) {
90
+ return value !== null &&
91
+ typeof value === "object" &&
92
+ Array.isArray(value.hw);
93
+ };
89
94
  var RICNotificationsManager = /** @class */ (function () {
90
95
  function RICNotificationsManager(marty) {
91
96
  this.marty = marty;
@@ -123,7 +128,7 @@ var RICNotificationsManager = /** @class */ (function () {
123
128
  // REPORT notifications are messages generated by RIC in response to certain events, including raw i2c events and motor safeties
124
129
  RICNotificationsManager.prototype.reportNofication = function (report) {
125
130
  return __awaiter(this, void 0, void 0, function () {
126
- var hwElemsCached_str, hwElems, hwElems_str;
131
+ var hwElemsCached_str, hwElems, hwElemsResponse, hwElems_str;
127
132
  return __generator(this, function (_a) {
128
133
  switch (_a.label) {
129
134
  case 0:
@@ -137,7 +142,17 @@ var RICNotificationsManager = /** @class */ (function () {
137
142
  Logger.info(SHOW_LOGS, TAG, "getting hw elems from rest");
138
143
  return [4 /*yield*/, this.marty.sendRestMessage("hwstatus/strstat")];
139
144
  case 2:
140
- hwElems_str = _a.sent();
145
+ hwElemsResponse = _a.sent();
146
+ if (!isCompressedHardwareElementList(hwElemsResponse)) {
147
+ Logger.error(SHOW_LOGS, TAG, "Invalid hardware status response", {
148
+ responseType: hwElemsResponse === null ? "null" : typeof hwElemsResponse,
149
+ hasHardwareElements: hwElemsResponse !== null &&
150
+ typeof hwElemsResponse === "object" &&
151
+ "hw" in hwElemsResponse,
152
+ });
153
+ return [2 /*return*/];
154
+ }
155
+ hwElems_str = hwElemsResponse;
141
156
  CacheManager.getInstance(CacheManager.HW_ELEMS_KEY, 30000).setLastReported(hwElems_str);
142
157
  hwElems = RICHWElemList_Str.expand(hwElems_str);
143
158
  _a.label = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.21.7",
3
+ "version": "3.21.9",
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",