roboto-js 1.8.5 → 1.8.6

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.
@@ -84,7 +84,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
84
84
  // Asynchronous browser hydration: set auth header and in-memory user
85
85
  // Use storage adaptor if available, otherwise fallback to localStorage
86
86
  this._initializeFromStorage()["catch"](function (e) {
87
- return console.warn('[RbtApi] Storage initialization failed:', e);
87
+ return void 0;
88
88
  });
89
89
  this.localDb = null;
90
90
  this.iac_session = null;
@@ -100,6 +100,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
100
100
  if (apikey) {
101
101
  this.apikey = apikey;
102
102
  this.axios.defaults.headers.common['apikey'] = this.apikey;
103
+ // ADD THIS LINE
103
104
  }
104
105
  this.initApiKey(apikey);
105
106
  }
@@ -164,19 +165,17 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
164
165
  if (token) {
165
166
  this.authtoken = token;
166
167
  this.axios.defaults.headers.common['authtoken'] = token;
167
- console.log('[RbtApi] Loaded authtoken from storage adaptor');
168
168
  }
169
- _context.next = 33;
169
+ _context.next = 32;
170
170
  break;
171
171
  case 30:
172
172
  _context.prev = 30;
173
173
  _context.t1 = _context["catch"](2);
174
- console.warn('[RbtApi] Failed to load authtoken from storage adaptor:', _context.t1);
175
- case 33:
176
- _context.prev = 33;
177
- _context.next = 36;
174
+ case 32:
175
+ _context.prev = 32;
176
+ _context.next = 35;
178
177
  return this.localStorageAdaptor.getItem('rbtUser');
179
- case 36:
178
+ case 35:
180
179
  cachedUser = _context.sent;
181
180
  if (cachedUser) {
182
181
  parsed = typeof cachedUser === 'string' ? JSON.parse(cachedUser) : cachedUser;
@@ -185,20 +184,18 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
185
184
  id: parsed.id
186
185
  }, this.axios);
187
186
  this.currentUser.setData(parsed);
188
- console.log('[RbtApi] Loaded user from storage adaptor');
189
187
  }
190
188
  }
191
- _context.next = 43;
189
+ _context.next = 41;
192
190
  break;
193
- case 40:
194
- _context.prev = 40;
195
- _context.t2 = _context["catch"](33);
196
- console.warn('[RbtApi] Failed to load user from storage adaptor:', _context.t2);
197
- case 43:
191
+ case 39:
192
+ _context.prev = 39;
193
+ _context.t2 = _context["catch"](32);
194
+ case 41:
198
195
  case "end":
199
196
  return _context.stop();
200
197
  }
201
- }, _callee, this, [[2, 30], [9, 21, 24, 27], [33, 40]]);
198
+ }, _callee, this, [[2, 30], [9, 21, 24, 27], [32, 39]]);
202
199
  }));
203
200
  function _initializeFromStorage() {
204
201
  return _initializeFromStorage2.apply(this, arguments);
@@ -215,7 +212,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
215
212
  var baseUrl = this.axios.defaults.baseURL;
216
213
  var wsProtocol = baseUrl.startsWith('https') ? 'wss://' : 'ws://';
217
214
  var wsUrl = baseUrl.replace(/^https?:\/\//, wsProtocol);
218
- console.log('[RbtApi] Creating new WebSocket connection to:', wsUrl + '/realtime');
219
215
  this.websocketClient = new WebSocket("".concat(wsUrl, "/realtime"));
220
216
  this._setupWebSocketHandlers(this.websocketClient);
221
217
  return this.websocketClient;
@@ -225,7 +221,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
225
221
  value: function _setupWebSocketHandlers(ws) {
226
222
  var _this = this;
227
223
  ws.onopen = function () {
228
- console.log('[RbtApi] WebSocket connected.');
229
224
  _this._wsReconnectAttempts = 0;
230
225
  _this._wsConnected = true;
231
226
 
@@ -249,13 +244,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
249
244
  }
250
245
  };
251
246
  ws.onclose = function (event) {
252
- console.warn('[RbtApi] WebSocket closed:', event.code, event.reason);
253
247
  _this._wsConnected = false;
254
248
 
255
249
  // Attempt reconnection with exponential backoff
256
250
  if (!_this._wsManualClose && _this._wsReconnectAttempts < 5) {
257
251
  var delay = Math.min(1000 * Math.pow(2, _this._wsReconnectAttempts), 30000);
258
- console.log("[RbtApi] Attempting reconnection in ".concat(delay, "ms (attempt ").concat(_this._wsReconnectAttempts + 1, "/5)"));
259
252
  setTimeout(function () {
260
253
  _this._wsReconnectAttempts++;
261
254
  _this.websocketClient = null; // Clear the old connection
@@ -889,28 +882,27 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
889
882
  while (1) switch (_context16.prev = _context16.next) {
890
883
  case 0:
891
884
  if (this.appServiceHost) {
892
- _context16.next = 3;
885
+ _context16.next = 2;
893
886
  break;
894
887
  }
895
- console.warn('RBTTOK not initialized');
896
888
  return _context16.abrupt("return", false);
897
- case 3:
889
+ case 2:
898
890
  if (!this.requestCache[authtoken]) {
899
- _context16.next = 5;
891
+ _context16.next = 4;
900
892
  break;
901
893
  }
902
894
  return _context16.abrupt("return", this.requestCache[authtoken]);
903
- case 5:
904
- _context16.prev = 5;
895
+ case 4:
896
+ _context16.prev = 4;
905
897
  //console.log('RBTTOK Req', authtoken);
906
898
  // Create a new promise for the token refresh and store it in the cache
907
899
  promise = this.axios.post('/user_service/refreshAuthToken', [authtoken]);
908
900
  this.requestCache[authtoken] = promise;
909
901
 
910
902
  // Await the promise to get the response
911
- _context16.next = 10;
903
+ _context16.next = 9;
912
904
  return promise;
913
- case 10:
905
+ case 9:
914
906
  response = _context16.sent;
915
907
  //console.log('RBTTOK Response ',response);
916
908
  // Once the promise resolves, delete it from the cache to allow future refreshes
@@ -918,17 +910,17 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
918
910
 
919
911
  // Return the response data
920
912
  return _context16.abrupt("return", response.data);
921
- case 15:
922
- _context16.prev = 15;
923
- _context16.t0 = _context16["catch"](5);
913
+ case 14:
914
+ _context16.prev = 14;
915
+ _context16.t0 = _context16["catch"](4);
924
916
  // On error, remove the cached promise to allow retries
925
917
  delete this.requestCache[authtoken];
926
918
  this._handleError(_context16.t0);
927
- case 19:
919
+ case 18:
928
920
  case "end":
929
921
  return _context16.stop();
930
922
  }
931
- }, _callee16, this, [[5, 15]]);
923
+ }, _callee16, this, [[4, 14]]);
932
924
  }));
933
925
  function refreshAuthToken(_x8) {
934
926
  return _refreshAuthToken.apply(this, arguments);
@@ -1229,9 +1221,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1229
1221
  throw new Error("Invalid query parameter(s): ".concat(invalidParams.join(', '), ". Valid parameters are: ").concat(validParams.join(', ')));
1230
1222
  case 6:
1231
1223
  // Warn if enableRealtime is passed to query() - it should only be used by load()
1232
- if (params.enableRealtime) {
1233
- console.warn('[roboto-js] enableRealtime should not be passed to query(), only to load(). This parameter will be ignored.');
1234
- }
1224
+ if (params.enableRealtime) {}
1235
1225
  params.type = type;
1236
1226
 
1237
1227
  // Default ordering and pagination
@@ -1307,14 +1297,8 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1307
1297
  // Ensure WebSocket client is available if realtime is requested
1308
1298
  var websocketClient = this.websocketClient;
1309
1299
  if (options.enableRealtime && !websocketClient) {
1310
- console.log('[AgentProviderSync] Creating WebSocket client for realtime objects');
1311
1300
  websocketClient = this.getWebSocketClient();
1312
1301
  }
1313
- console.log('[AgentProviderSync] _processResponseData creating objects with:', {
1314
- enableRealtime: options.enableRealtime || false,
1315
- hasWebSocketClient: !!websocketClient,
1316
- itemCount: response.data.items.length
1317
- });
1318
1302
  response.data.items = response.data.items.map(function (record) {
1319
1303
  return new _rbt_object["default"](record, _this7.axios, {
1320
1304
  websocketClient: websocketClient,
@@ -1397,21 +1381,11 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1397
1381
  // Only log cache hits once per object to reduce spam
1398
1382
  hitLogKey = "hit:".concat(_cacheKey);
1399
1383
  if (!this._loggedCacheEvents.has(hitLogKey)) {
1400
- console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', {
1401
- type: type,
1402
- id: id,
1403
- hasRealtime: !!cached._realtime,
1404
- requestedRealtime: !!params.enableRealtime
1405
- });
1406
1384
  this._loggedCacheEvents.add(hitLogKey);
1407
1385
  }
1408
1386
 
1409
1387
  // If realtime is requested but cached object doesn't have it, upgrade it
1410
1388
  if (params.enableRealtime && !cached._realtime) {
1411
- console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', {
1412
- type: type,
1413
- id: id
1414
- });
1415
1389
  cached._initRealtime();
1416
1390
  }
1417
1391
  cachedObjects.push(cached);
@@ -1434,10 +1408,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1434
1408
  // Only log bulk cache miss once
1435
1409
  bulkMissLogKey = "bulk-miss:".concat(type, ":").concat(missingIds.join(','));
1436
1410
  if (!this._loggedCacheEvents.has(bulkMissLogKey)) {
1437
- console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', {
1438
- type: type,
1439
- ids: missingIds
1440
- });
1441
1411
  this._loggedCacheEvents.add(bulkMissLogKey);
1442
1412
  }
1443
1413
 
@@ -1461,10 +1431,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1461
1431
  // Only log cache set once per object to reduce spam
1462
1432
  setLogKey = "set:".concat(cacheKey);
1463
1433
  if (!this._loggedCacheEvents.has(setLogKey)) {
1464
- console.log('[AgentProviderSync] 💾 roboto.load cached object:', {
1465
- type: type,
1466
- id: obj.id
1467
- });
1468
1434
  this._loggedCacheEvents.add(setLogKey);
1469
1435
  }
1470
1436
  }
@@ -1506,21 +1472,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1506
1472
  }
1507
1473
  // Only log cache hits once per object to reduce spam
1508
1474
  _hitLogKey = "hit:".concat(_cacheKey3);
1509
- if (!this._loggedCacheEvents.has(_hitLogKey) || console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', {
1510
- type: type,
1511
- id: ids,
1512
- hasRealtime: !!_cached._realtime,
1513
- requestedRealtime: !!params.enableRealtime
1514
- })) {
1475
+ if (!this._loggedCacheEvents.has(_hitLogKey) || void 0) {
1515
1476
  this._loggedCacheEvents.add(_hitLogKey);
1516
1477
  }
1517
1478
 
1518
1479
  // If realtime is requested but cached object doesn't have it, upgrade it
1519
1480
  if (params.enableRealtime && !_cached._realtime) {
1520
- console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', {
1521
- type: type,
1522
- id: ids
1523
- });
1524
1481
  _cached._initRealtime();
1525
1482
  }
1526
1483
  return _context24.abrupt("return", _cached);
@@ -1539,10 +1496,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1539
1496
  // Only log cache miss once per object to reduce spam
1540
1497
  missLogKey = "miss:".concat(_cacheKey3);
1541
1498
  if (!this._loggedCacheEvents.has(missLogKey)) {
1542
- console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', {
1543
- type: type,
1544
- id: ids
1545
- });
1546
1499
  this._loggedCacheEvents.add(missLogKey);
1547
1500
  }
1548
1501
 
@@ -1570,10 +1523,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1570
1523
  // Only log cache set once per object to reduce spam
1571
1524
  _setLogKey = "set:".concat(_cacheKey3);
1572
1525
  if (!_this8._loggedCacheEvents.has(_setLogKey)) {
1573
- console.log('[AgentProviderSync] 💾 roboto.load cached object:', {
1574
- type: type,
1575
- id: ids
1576
- });
1577
1526
  _this8._loggedCacheEvents.add(_setLogKey);
1578
1527
  }
1579
1528
  }
@@ -1632,11 +1581,6 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1632
1581
  this._loggedCacheEvents["delete"]("hit:".concat(cacheKey));
1633
1582
  this._loggedCacheEvents["delete"]("miss:".concat(cacheKey));
1634
1583
  this._loggedCacheEvents["delete"]("set:".concat(cacheKey));
1635
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache specific object:', {
1636
- type: type,
1637
- id: id,
1638
- removed: removed
1639
- });
1640
1584
  } else if (type) {
1641
1585
  // Clear all objects of a specific type
1642
1586
  var removedCount = 0;
@@ -1672,19 +1616,12 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
1672
1616
  } finally {
1673
1617
  _iterator7.f();
1674
1618
  }
1675
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', {
1676
- type: type,
1677
- removedCount: removedCount
1678
- });
1679
1619
  } else {
1680
1620
  // Clear all cached objects
1681
1621
  var size = this._objectCache.size;
1682
1622
  this._objectCache.clear();
1683
1623
  this._loggedCacheEvents.clear();
1684
1624
  this._pendingLoads.clear();
1685
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache all objects:', {
1686
- clearedCount: size
1687
- });
1688
1625
  }
1689
1626
  }
1690
1627
 
@@ -2128,13 +2065,7 @@ var RbtApi = exports["default"] = /*#__PURE__*/function () {
2128
2065
  if (res) return;
2129
2066
  }
2130
2067
  if (_lodash["default"].isObject(err) && _lodash["default"].get(err, 'response')) {
2131
- if (err.response) {
2132
- console.log('Error response:', {
2133
- data: err.response.data,
2134
- status: err.response.status,
2135
- headers: err.response.headers
2136
- });
2137
- }
2068
+ if (err.response) {}
2138
2069
  var msg = _lodash["default"].get(err, 'response.data.message', 'Error in API response');
2139
2070
  if (msg.key) {
2140
2071
  //throw new Error(msg.key);
@@ -357,7 +357,7 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
357
357
  key: "save",
358
358
  value: function () {
359
359
  var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
360
- var _response$data, _response$data2, record, response, _e$response;
360
+ var _response$data, _response$data2, record, response;
361
361
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
362
362
  while (1) switch (_context3.prev = _context3.next) {
363
363
  case 0:
@@ -402,11 +402,10 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
402
402
  case 20:
403
403
  _context3.prev = 20;
404
404
  _context3.t0 = _context3["catch"](2);
405
- console.log('RbtObject.save.error:', _context3.t0 === null || _context3.t0 === void 0 || (_e$response = _context3.t0.response) === null || _e$response === void 0 ? void 0 : _e$response.data);
406
405
  this._error = _context3.t0;
407
406
  //console.log(e.response.data);
408
407
  throw _context3.t0;
409
- case 25:
408
+ case 24:
410
409
  case "end":
411
410
  return _context3.stop();
412
411
  }
@@ -908,10 +907,8 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
908
907
  case 13:
909
908
  _context8.prev = 13;
910
909
  _context8.t0 = _context8["catch"](2);
911
- console.log('RbtObject.delete.error:');
912
- console.log(_context8.t0.response.data);
913
910
  throw _context8.t0;
914
- case 18:
911
+ case 16:
915
912
  case "end":
916
913
  return _context8.stop();
917
914
  }
@@ -1009,12 +1006,8 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
1009
1006
  userId: msg.userId || msg.delta.userId || null
1010
1007
  });
1011
1008
  _this3._trigger('change', changeData);
1012
- if (msg.isStateSync) {
1013
- console.log('[RbtObject] Applied state sync:', msg.delta.path, '=', msg.delta.value);
1014
- }
1015
- } else {
1016
- console.warn('[RbtObject] Received update message without valid delta:', msg);
1017
- }
1009
+ if (msg.isStateSync) {}
1010
+ } else {}
1018
1011
  } else if (msg.type === 'save') {
1019
1012
  _this3._trigger('save', msg.revision || {});
1020
1013
  }
@@ -1045,8 +1038,6 @@ var RbtObject = exports["default"] = /*#__PURE__*/function () {
1045
1038
  }, {
1046
1039
  key: "_trigger",
1047
1040
  value: function _trigger(type, data) {
1048
- var _this$_eventHandlers$;
1049
- console.log('[AgentProviderSync] _trigger called:', type, 'handlers:', (_this$_eventHandlers$ = this._eventHandlers[type]) === null || _this$_eventHandlers$ === void 0 ? void 0 : _this$_eventHandlers$.length, 'data:', data);
1050
1041
  var _iterator = _createForOfIteratorHelper(this._eventHandlers[type] || []),
1051
1042
  _step;
1052
1043
  try {
@@ -176,10 +176,8 @@ var RbtUser = exports["default"] = /*#__PURE__*/function () {
176
176
  case 17:
177
177
  _context.prev = 17;
178
178
  _context.t0 = _context["catch"](0);
179
- console.log('RbtUser.save.error:', _context.t0);
180
- //console.log(e.response.data);
181
179
  throw _context.t0;
182
- case 21:
180
+ case 20:
183
181
  case "end":
184
182
  return _context.stop();
185
183
  }