@robotical/webapp-types 3.23.20 → 3.23.22

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.23.20",
3
+ "version": "3.23.22",
4
4
  "private": true,
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -16,7 +16,7 @@
16
16
  "@robotical/cog-shooter-game": "^0.1.27",
17
17
  "@robotical/jumping-game": "^0.1.29",
18
18
  "@robotical/martyblocks": "^4.0.75",
19
- "@robotical/martyblocksjr": "^4.5.4",
19
+ "@robotical/martyblocksjr": "^4.5.5",
20
20
  "@robotical/maze": "^0.1.22",
21
21
  "@robotical/rc-sequencer": "^1.1.15",
22
22
  "@robotical/ricjs-robotical-addons": "^1.2.8",
@@ -39,6 +39,12 @@ import Logger from "../../../services/logger/Logger";
39
39
  import { RIC_WHOAMI_TYPE_CODE_ADDON_COLOUR } from "@robotical/ricjs-robotical-addons/dist/RICRoboticalAddOns";
40
40
  var SHOW_LOGS = true;
41
41
  var TAG = "MartyAddonsManager";
42
+ var isConfiguredAddOn = function (value) {
43
+ return !!value &&
44
+ typeof value === "object" &&
45
+ typeof value.SN === "string" &&
46
+ typeof value.name === "string";
47
+ };
42
48
  var MartyAddonsManager = /** @class */ (function () {
43
49
  function MartyAddonsManager(marty) {
44
50
  this.marty = marty;
@@ -125,14 +131,43 @@ var MartyAddonsManager = /** @class */ (function () {
125
131
  };
126
132
  MartyAddonsManager.prototype.getAddOnConfigs = function () {
127
133
  return __awaiter(this, void 0, void 0, function () {
128
- var addOnList, error_2;
134
+ var response, addOnList, responseRecord, error_2;
129
135
  return __generator(this, function (_a) {
130
136
  switch (_a.label) {
131
137
  case 0:
132
138
  _a.trys.push([0, 2, , 3]);
133
139
  return [4 /*yield*/, this.marty.sendRestMessage("addon/list")];
134
140
  case 1:
135
- addOnList = _a.sent();
141
+ response = _a.sent();
142
+ addOnList = new RICConfiguredAddOns();
143
+ if (!response || typeof response !== "object") {
144
+ Logger.warn(SHOW_LOGS, TAG, "Invalid add-on configuration response", {
145
+ responseType: response === null ? "null" : typeof response,
146
+ reason: "response_not_object",
147
+ });
148
+ return [2 /*return*/, addOnList];
149
+ }
150
+ responseRecord = response;
151
+ if (typeof responseRecord.req === "string")
152
+ addOnList.req = responseRecord.req;
153
+ if (typeof responseRecord.rslt === "string")
154
+ addOnList.rslt = responseRecord.rslt;
155
+ if (!Array.isArray(responseRecord.addons)) {
156
+ Logger.warn(SHOW_LOGS, TAG, "Invalid add-on configuration response", {
157
+ responseType: "object",
158
+ result: addOnList.rslt,
159
+ addonsType: responseRecord.addons === null ? "null" : typeof responseRecord.addons,
160
+ reason: "addons_not_array",
161
+ });
162
+ return [2 /*return*/, addOnList];
163
+ }
164
+ addOnList.addons = responseRecord.addons.filter(isConfiguredAddOn);
165
+ if (addOnList.addons.length !== responseRecord.addons.length) {
166
+ Logger.warn(SHOW_LOGS, TAG, "Discarded invalid add-on configuration entries", {
167
+ entryCount: responseRecord.addons.length,
168
+ validEntryCount: addOnList.addons.length,
169
+ });
170
+ }
136
171
  Logger.info(SHOW_LOGS, TAG, "getAddOnConfigs returned " + JSON.stringify(addOnList));
137
172
  return [2 /*return*/, addOnList];
138
173
  case 2:
@@ -125,6 +125,16 @@ var ConnectorFactory = /** @class */ (function () {
125
125
  case "Axiom":
126
126
  throw new Error("Axiom not supported yet");
127
127
  default:
128
+ Logger.warn(SHOW_LOGS, TAG, "Unable to classify connected RAFT", {
129
+ connectionMethod: connectionMethod,
130
+ reportedSystemName: typeof raftType === "string" && raftType.length > 0
131
+ ? raftType
132
+ : "missing",
133
+ systemInfoAvailable: !!systemInfo,
134
+ systemInfoFields: systemInfo && typeof systemInfo === "object"
135
+ ? Object.keys(systemInfo).sort()
136
+ : [],
137
+ });
128
138
  throw new Error("Unknown RAFT type");
129
139
  }
130
140
  return connector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/webapp-types",
3
- "version": "3.23.20",
3
+ "version": "3.23.22",
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",