roboto-js 1.9.13 → 1.9.15
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.
- package/.last-build +1 -1
- package/dist/cjs/rbt_api.cjs +33 -2
- package/dist/cjs/rbt_object.cjs +13 -1
- package/dist/cjs/version.cjs +2 -2
- package/dist/esm/rbt_api.js +33 -2
- package/dist/esm/rbt_object.js +13 -1
- package/dist/esm/version.js +2 -2
- package/dist/rbt_api.js +47 -86
- package/dist/rbt_object.js +8 -7
- package/dist/version.js +2 -2
- package/package.json +1 -1
- package/src/rbt_api.js +33 -33
- package/src/rbt_object.js +8 -8
- package/src/version.js +2 -2
package/dist/rbt_api.js
CHANGED
|
@@ -42,13 +42,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
42
42
|
_ref$withCredentials = _ref.withCredentials,
|
|
43
43
|
withCredentials = _ref$withCredentials === void 0 ? true : _ref$withCredentials;
|
|
44
44
|
_classCallCheck(this, RbtApi);
|
|
45
|
-
console.log('[RbtApi] constructor received:', {
|
|
46
|
-
|
|
47
|
-
accesskey: accesskey,
|
|
48
|
-
authtoken: authtoken,
|
|
49
|
-
apikey: apikey,
|
|
50
|
-
withCredentials: withCredentials
|
|
51
|
-
});
|
|
45
|
+
//console.log('[RbtApi] constructor received:', { baseUrl, accesskey, authtoken, apikey, withCredentials });
|
|
46
|
+
|
|
52
47
|
this.websocketClient = null;
|
|
53
48
|
|
|
54
49
|
// Object cache for sharing instances across multiple load() calls
|
|
@@ -106,7 +101,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
106
101
|
if (apikey) {
|
|
107
102
|
this.apikey = apikey;
|
|
108
103
|
this.axios.defaults.headers.common['apikey'] = this.apikey;
|
|
109
|
-
console.log('[RbtApi] Set apikey header:', this.axios.defaults.headers.common['apikey']);
|
|
104
|
+
//console.log('[RbtApi] Set apikey header:', this.axios.defaults.headers.common['apikey']); // ADD THIS LINE
|
|
110
105
|
}
|
|
111
106
|
this.initApiKey(apikey);
|
|
112
107
|
}
|
|
@@ -171,7 +166,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
171
166
|
if (token) {
|
|
172
167
|
this.authtoken = token;
|
|
173
168
|
this.axios.defaults.headers.common['authtoken'] = token;
|
|
174
|
-
console.log('[RbtApi] Loaded authtoken from storage adaptor');
|
|
169
|
+
//console.log('[RbtApi] Loaded authtoken from storage adaptor');
|
|
175
170
|
}
|
|
176
171
|
_context.n = 11;
|
|
177
172
|
break;
|
|
@@ -192,7 +187,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
192
187
|
id: parsed.id
|
|
193
188
|
}, this.axios);
|
|
194
189
|
this.currentUser.setData(parsed);
|
|
195
|
-
console.log('[RbtApi] Loaded user from storage adaptor');
|
|
190
|
+
//console.log('[RbtApi] Loaded user from storage adaptor');
|
|
196
191
|
}
|
|
197
192
|
}
|
|
198
193
|
_context.n = 14;
|
|
@@ -221,7 +216,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
221
216
|
var baseUrl = this.axios.defaults.baseURL;
|
|
222
217
|
var wsProtocol = baseUrl.startsWith('https') ? 'wss://' : 'ws://';
|
|
223
218
|
var wsUrl = baseUrl.replace(/^https?:\/\//, wsProtocol);
|
|
224
|
-
|
|
219
|
+
|
|
220
|
+
//console.log('[RbtApi] Creating new WebSocket connection to:', wsUrl + '/realtime');
|
|
225
221
|
this.websocketClient = new WebSocket("".concat(wsUrl, "/realtime"));
|
|
226
222
|
this._setupWebSocketHandlers(this.websocketClient);
|
|
227
223
|
return this.websocketClient;
|
|
@@ -231,7 +227,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
231
227
|
value: function _setupWebSocketHandlers(ws) {
|
|
232
228
|
var _this = this;
|
|
233
229
|
ws.onopen = function () {
|
|
234
|
-
console.log('[RbtApi] WebSocket connected.');
|
|
230
|
+
//console.log('[RbtApi] WebSocket connected.');
|
|
235
231
|
_this._wsReconnectAttempts = 0;
|
|
236
232
|
_this._wsConnected = true;
|
|
237
233
|
|
|
@@ -261,7 +257,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
261
257
|
// Attempt reconnection with exponential backoff
|
|
262
258
|
if (!_this._wsManualClose && _this._wsReconnectAttempts < 5) {
|
|
263
259
|
var delay = Math.min(1000 * Math.pow(2, _this._wsReconnectAttempts), 30000);
|
|
264
|
-
console.log(
|
|
260
|
+
//console.log(`[RbtApi] Attempting reconnection in ${delay}ms (attempt ${this._wsReconnectAttempts + 1}/5)`);
|
|
261
|
+
|
|
265
262
|
setTimeout(function () {
|
|
266
263
|
_this._wsReconnectAttempts++;
|
|
267
264
|
_this.websocketClient = null; // Clear the old connection
|
|
@@ -847,14 +844,12 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
847
844
|
_context13.n = 2;
|
|
848
845
|
break;
|
|
849
846
|
}
|
|
850
|
-
console.log('[RbtApi] Returning cached currentOrganization:', this.currentOrganization.get('name'));
|
|
851
847
|
return _context13.a(2, this.currentOrganization);
|
|
852
848
|
case 2:
|
|
853
849
|
if (!this._loadCurrentOrgPromise) {
|
|
854
850
|
_context13.n = 3;
|
|
855
851
|
break;
|
|
856
852
|
}
|
|
857
|
-
console.log('[RbtApi] Organization load already in progress');
|
|
858
853
|
return _context13.a(2, this._loadCurrentOrgPromise);
|
|
859
854
|
case 3:
|
|
860
855
|
this._loadCurrentOrgPromise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
@@ -871,7 +866,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
871
866
|
_context12.n = 2;
|
|
872
867
|
break;
|
|
873
868
|
}
|
|
874
|
-
console.log('[RbtApi] No current user, cannot load organization');
|
|
875
869
|
return _context12.a(2, null);
|
|
876
870
|
case 2:
|
|
877
871
|
// Get organization ID from user preferences or first org
|
|
@@ -882,7 +876,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
882
876
|
_context12.n = 3;
|
|
883
877
|
break;
|
|
884
878
|
}
|
|
885
|
-
console.log('[RbtApi] User has no organizations');
|
|
886
879
|
return _context12.a(2, null);
|
|
887
880
|
case 3:
|
|
888
881
|
console.log('[RbtApi] Resolved organization ID:', orgId, 'from:', {
|
|
@@ -903,8 +896,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
903
896
|
console.log('[RbtApi] Organization changed from cache:', cachedOrgId, '→', orgId);
|
|
904
897
|
}
|
|
905
898
|
case 5:
|
|
906
|
-
// Load the organization object
|
|
907
|
-
console.log('[RbtApi] Loading organization:', orgId);
|
|
908
899
|
_context12.n = 6;
|
|
909
900
|
return _this4.get('<@iac.organization>', orgId);
|
|
910
901
|
case 6:
|
|
@@ -914,7 +905,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
914
905
|
break;
|
|
915
906
|
}
|
|
916
907
|
_this4.currentOrganization = org; // Already an RbtObject
|
|
917
|
-
console.log('[RbtApi] Current organization loaded:', org.get('name'));
|
|
908
|
+
//console.log('[RbtApi] Current organization loaded:', org.get('name'));
|
|
918
909
|
|
|
919
910
|
// Cache in storage if available
|
|
920
911
|
if (!_this4.localStorageAdaptor) {
|
|
@@ -981,9 +972,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
981
972
|
}
|
|
982
973
|
throw new Error('Must be logged in to switch organization');
|
|
983
974
|
case 1:
|
|
984
|
-
console.log('[RbtApi] Switching to organization:', orgId);
|
|
985
|
-
|
|
986
|
-
// Load the new organization
|
|
987
975
|
_context14.n = 2;
|
|
988
976
|
return this.get('<@iac.organization>', orgId);
|
|
989
977
|
case 2:
|
|
@@ -1013,7 +1001,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1013
1001
|
_context14.n = 7;
|
|
1014
1002
|
return this.localStorageAdaptor.setItem('currentOrgId', orgId);
|
|
1015
1003
|
case 7:
|
|
1016
|
-
console.log('[RbtApi] Switched to organization:', org.get('name'));
|
|
1017
1004
|
_context14.n = 9;
|
|
1018
1005
|
break;
|
|
1019
1006
|
case 8:
|
|
@@ -1078,7 +1065,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1078
1065
|
_context15.n = 3;
|
|
1079
1066
|
break;
|
|
1080
1067
|
}
|
|
1081
|
-
console.log('[RbtApi] Loading current user for organization selection...');
|
|
1082
1068
|
_context15.n = 2;
|
|
1083
1069
|
return this.loadCurrentUser();
|
|
1084
1070
|
case 2:
|
|
@@ -1088,9 +1074,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1088
1074
|
}
|
|
1089
1075
|
throw new Error('Must be logged in to select organization');
|
|
1090
1076
|
case 3:
|
|
1091
|
-
console.log('[RbtApi] Selecting organization:', orgId);
|
|
1092
|
-
|
|
1093
|
-
// Load the organization to verify access
|
|
1094
1077
|
_context15.n = 4;
|
|
1095
1078
|
return this.get('<@iac.organization>', orgId);
|
|
1096
1079
|
case 4:
|
|
@@ -1111,22 +1094,21 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1111
1094
|
}
|
|
1112
1095
|
throw new Error('Failed to load user object');
|
|
1113
1096
|
case 7:
|
|
1114
|
-
console.log('[RbtApi] User loaded:', user.id);
|
|
1115
|
-
|
|
1097
|
+
//console.log('[RbtApi] User loaded:', user.id);
|
|
1116
1098
|
// Update user's organizations array
|
|
1117
1099
|
userOrgs = user.get('organizations') || [];
|
|
1118
1100
|
orgExists = userOrgs.some(function (o) {
|
|
1119
1101
|
return (o === null || o === void 0 ? void 0 : o.id) === orgId;
|
|
1120
1102
|
});
|
|
1121
1103
|
if (!orgExists) {
|
|
1122
|
-
console.log('[RbtApi] Adding organization to user organizations array');
|
|
1104
|
+
//console.log('[RbtApi] Adding organization to user organizations array');
|
|
1123
1105
|
userOrgs.unshift({
|
|
1124
1106
|
id: orgId,
|
|
1125
1107
|
roles: [role]
|
|
1126
1108
|
});
|
|
1127
1109
|
user.set('organizations', userOrgs);
|
|
1128
1110
|
} else {
|
|
1129
|
-
console.log('[RbtApi] Organization already in user organizations array');
|
|
1111
|
+
//console.log('[RbtApi] Organization already in user organizations array');
|
|
1130
1112
|
}
|
|
1131
1113
|
|
|
1132
1114
|
// Set as current organization preference - handle both nested path formats
|
|
@@ -1135,11 +1117,11 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1135
1117
|
user.set('mod', modData);
|
|
1136
1118
|
|
|
1137
1119
|
// Save user record
|
|
1138
|
-
console.log('[RbtApi] Saving user with organization:', orgId);
|
|
1120
|
+
//console.log('[RbtApi] Saving user with organization:', orgId);
|
|
1139
1121
|
_context15.n = 8;
|
|
1140
1122
|
return user.save();
|
|
1141
1123
|
case 8:
|
|
1142
|
-
console.log('[RbtApi] User saved successfully');
|
|
1124
|
+
//console.log('[RbtApi] User saved successfully');
|
|
1143
1125
|
|
|
1144
1126
|
// Clear cached organization to force reload
|
|
1145
1127
|
this.currentOrganization = null;
|
|
@@ -1158,7 +1140,6 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1158
1140
|
_context15.n = 9;
|
|
1159
1141
|
return this.localStorageAdaptor.setItem('currentOrgId', orgId);
|
|
1160
1142
|
case 9:
|
|
1161
|
-
console.log('[RbtApi] Selected organization:', org.get('name'));
|
|
1162
1143
|
return _context15.a(2, org);
|
|
1163
1144
|
case 10:
|
|
1164
1145
|
_context15.p = 10;
|
|
@@ -1520,6 +1501,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1520
1501
|
* Excludes the specified paths and all their subpaths.
|
|
1521
1502
|
* - resolveReferences: An array of attribute names whose references should be resolved in the returned objects.
|
|
1522
1503
|
* - timeout: A numerical value in milliseconds to set a maximum time limit for the query execution.
|
|
1504
|
+
* - cache: Boolean. When true, enables a 10-second response cache for identical queries. Default: false (no caching).
|
|
1523
1505
|
*
|
|
1524
1506
|
* Example usage:
|
|
1525
1507
|
* query("<@testuser>", {
|
|
@@ -1528,7 +1510,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1528
1510
|
* limit: { offset: 0, results: 50 },
|
|
1529
1511
|
* requestAttrs: ['id', 'configs.title'],
|
|
1530
1512
|
* excludeAttrs: ['details.log'],
|
|
1531
|
-
* resolveReferences: ['translatableContent']
|
|
1513
|
+
* resolveReferences: ['translatableContent'],
|
|
1514
|
+
* cache: true // opt-in to 10s response caching
|
|
1532
1515
|
* });
|
|
1533
1516
|
*
|
|
1534
1517
|
* Note: A default orderBy is applied if none is provided, ordering items by 'timeCreated' in descending order.
|
|
@@ -1543,6 +1526,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1543
1526
|
paramsKey,
|
|
1544
1527
|
validParams,
|
|
1545
1528
|
invalidParams,
|
|
1529
|
+
useCache,
|
|
1546
1530
|
defaultOrderBy,
|
|
1547
1531
|
defaultLimit,
|
|
1548
1532
|
mergedParams,
|
|
@@ -1559,7 +1543,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1559
1543
|
_context24.p = 1;
|
|
1560
1544
|
//console.log('RBTAPI.query INIT', type, params);
|
|
1561
1545
|
// Validate parameters - reject invalid parameter names
|
|
1562
|
-
validParams = ['type', 'where', 'orderBy', 'limit', 'resolveReferences', 'requestAttrs', 'excludeAttrs', 'timeout', 'enableRealtime'];
|
|
1546
|
+
validParams = ['type', 'where', 'orderBy', 'limit', 'resolveReferences', 'requestAttrs', 'excludeAttrs', 'timeout', 'enableRealtime', 'cache'];
|
|
1563
1547
|
invalidParams = Object.keys(params).filter(function (key) {
|
|
1564
1548
|
return !validParams.includes(key);
|
|
1565
1549
|
});
|
|
@@ -1573,6 +1557,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1573
1557
|
if (params.enableRealtime) {
|
|
1574
1558
|
console.warn('[roboto-js] enableRealtime should not be passed to query(), only to load(). This parameter will be ignored.');
|
|
1575
1559
|
}
|
|
1560
|
+
useCache = params.cache === true;
|
|
1561
|
+
delete params.cache;
|
|
1576
1562
|
params.type = type;
|
|
1577
1563
|
|
|
1578
1564
|
// Default ordering and pagination
|
|
@@ -1588,9 +1574,13 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1588
1574
|
results: 50
|
|
1589
1575
|
}
|
|
1590
1576
|
}; // Merge defaults with provided params
|
|
1591
|
-
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params); // Check cache for an existing request
|
|
1577
|
+
mergedParams = _objectSpread(_objectSpread(_objectSpread({}, defaultOrderBy), defaultLimit), params); // Check cache for an existing request (only when explicitly opted in)
|
|
1592
1578
|
currentTime = Date.now();
|
|
1593
1579
|
paramsKey = JSON.stringify(mergedParams);
|
|
1580
|
+
if (!useCache) {
|
|
1581
|
+
_context24.n = 3;
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1594
1584
|
cacheEntry = this.requestCache[paramsKey];
|
|
1595
1585
|
if (!(cacheEntry && currentTime - cacheEntry.time < 10000)) {
|
|
1596
1586
|
_context24.n = 3;
|
|
@@ -1604,13 +1594,14 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1604
1594
|
return _this7._processResponseData(response, params);
|
|
1605
1595
|
})["catch"](function (e) {
|
|
1606
1596
|
delete _this7.requestCache[paramsKey]; // Ensure cache cleanup on failure
|
|
1607
|
-
//console.log('RBTAPI.query ERROR (Processing)', paramsKey, e);
|
|
1608
1597
|
return _this7._handleError(e);
|
|
1609
|
-
});
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1598
|
+
});
|
|
1599
|
+
if (useCache) {
|
|
1600
|
+
this.requestCache[paramsKey] = {
|
|
1601
|
+
val: processingPromise,
|
|
1602
|
+
time: currentTime
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1614
1605
|
|
|
1615
1606
|
// Await the processing promise for this call to get processed data
|
|
1616
1607
|
_context24.n = 4;
|
|
@@ -1736,21 +1727,13 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1736
1727
|
// Only log cache hits once per object to reduce spam
|
|
1737
1728
|
hitLogKey = "hit:".concat(_cacheKey);
|
|
1738
1729
|
if (!this._loggedCacheEvents.has(hitLogKey)) {
|
|
1739
|
-
console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', {
|
|
1740
|
-
type: type,
|
|
1741
|
-
id: id,
|
|
1742
|
-
hasRealtime: !!cached._realtime,
|
|
1743
|
-
requestedRealtime: !!params.enableRealtime
|
|
1744
|
-
});
|
|
1730
|
+
//console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', { type, id, hasRealtime: !!cached._realtime, requestedRealtime: !!params.enableRealtime });
|
|
1745
1731
|
this._loggedCacheEvents.add(hitLogKey);
|
|
1746
1732
|
}
|
|
1747
1733
|
|
|
1748
1734
|
// If realtime is requested but cached object doesn't have it, upgrade it
|
|
1749
1735
|
if (params.enableRealtime && !cached._realtime) {
|
|
1750
|
-
console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', {
|
|
1751
|
-
type: type,
|
|
1752
|
-
id: id
|
|
1753
|
-
});
|
|
1736
|
+
//console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id });
|
|
1754
1737
|
cached._initRealtime();
|
|
1755
1738
|
}
|
|
1756
1739
|
cachedObjects.push(cached);
|
|
@@ -1773,10 +1756,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1773
1756
|
// Only log bulk cache miss once
|
|
1774
1757
|
bulkMissLogKey = "bulk-miss:".concat(type, ":").concat(missingIds.join(','));
|
|
1775
1758
|
if (!this._loggedCacheEvents.has(bulkMissLogKey)) {
|
|
1776
|
-
console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', {
|
|
1777
|
-
type: type,
|
|
1778
|
-
ids: missingIds
|
|
1779
|
-
});
|
|
1759
|
+
//console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, ids: missingIds });
|
|
1780
1760
|
this._loggedCacheEvents.add(bulkMissLogKey);
|
|
1781
1761
|
}
|
|
1782
1762
|
|
|
@@ -1800,10 +1780,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1800
1780
|
// Only log cache set once per object to reduce spam
|
|
1801
1781
|
setLogKey = "set:".concat(cacheKey);
|
|
1802
1782
|
if (!this._loggedCacheEvents.has(setLogKey)) {
|
|
1803
|
-
console.log('[AgentProviderSync] 💾 roboto.load cached object:', {
|
|
1804
|
-
type: type,
|
|
1805
|
-
id: obj.id
|
|
1806
|
-
});
|
|
1783
|
+
//console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: obj.id });
|
|
1807
1784
|
this._loggedCacheEvents.add(setLogKey);
|
|
1808
1785
|
}
|
|
1809
1786
|
}
|
|
@@ -1856,10 +1833,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1856
1833
|
|
|
1857
1834
|
// If realtime is requested but cached object doesn't have it, upgrade it
|
|
1858
1835
|
if (params.enableRealtime && !_cached._realtime) {
|
|
1859
|
-
console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', {
|
|
1860
|
-
type: type,
|
|
1861
|
-
id: ids
|
|
1862
|
-
});
|
|
1836
|
+
//console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id: ids });
|
|
1863
1837
|
_cached._initRealtime();
|
|
1864
1838
|
}
|
|
1865
1839
|
return _context26.a(2, _cached);
|
|
@@ -1878,10 +1852,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1878
1852
|
// Only log cache miss once per object to reduce spam
|
|
1879
1853
|
missLogKey = "miss:".concat(_cacheKey3);
|
|
1880
1854
|
if (!this._loggedCacheEvents.has(missLogKey)) {
|
|
1881
|
-
console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', {
|
|
1882
|
-
type: type,
|
|
1883
|
-
id: ids
|
|
1884
|
-
});
|
|
1855
|
+
//console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, id: ids });
|
|
1885
1856
|
this._loggedCacheEvents.add(missLogKey);
|
|
1886
1857
|
}
|
|
1887
1858
|
|
|
@@ -1909,10 +1880,7 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1909
1880
|
// Only log cache set once per object to reduce spam
|
|
1910
1881
|
_setLogKey = "set:".concat(_cacheKey3);
|
|
1911
1882
|
if (!_this9._loggedCacheEvents.has(_setLogKey)) {
|
|
1912
|
-
console.log('[AgentProviderSync] 💾 roboto.load cached object:', {
|
|
1913
|
-
type: type,
|
|
1914
|
-
id: ids
|
|
1915
|
-
});
|
|
1883
|
+
//console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: ids });
|
|
1916
1884
|
_this9._loggedCacheEvents.add(_setLogKey);
|
|
1917
1885
|
}
|
|
1918
1886
|
}
|
|
@@ -1969,11 +1937,8 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
1969
1937
|
this._loggedCacheEvents["delete"]("hit:".concat(cacheKey));
|
|
1970
1938
|
this._loggedCacheEvents["delete"]("miss:".concat(cacheKey));
|
|
1971
1939
|
this._loggedCacheEvents["delete"]("set:".concat(cacheKey));
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
id: id,
|
|
1975
|
-
removed: removed
|
|
1976
|
-
});
|
|
1940
|
+
|
|
1941
|
+
//console.log('[AgentProviderSync] 🗑️ roboto.clearCache specific object:', { type, id, removed });
|
|
1977
1942
|
} else if (type) {
|
|
1978
1943
|
// Clear all objects of a specific type
|
|
1979
1944
|
var removedCount = 0;
|
|
@@ -2004,24 +1969,20 @@ var RbtApi = /*#__PURE__*/function () {
|
|
|
2004
1969
|
this._loggedCacheEvents["delete"](logKey);
|
|
2005
1970
|
}
|
|
2006
1971
|
}
|
|
1972
|
+
|
|
1973
|
+
//console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', { type, removedCount });
|
|
2007
1974
|
} catch (err) {
|
|
2008
1975
|
_iterator7.e(err);
|
|
2009
1976
|
} finally {
|
|
2010
1977
|
_iterator7.f();
|
|
2011
1978
|
}
|
|
2012
|
-
console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', {
|
|
2013
|
-
type: type,
|
|
2014
|
-
removedCount: removedCount
|
|
2015
|
-
});
|
|
2016
1979
|
} else {
|
|
2017
1980
|
// Clear all cached objects
|
|
2018
1981
|
var size = this._objectCache.size;
|
|
2019
1982
|
this._objectCache.clear();
|
|
2020
1983
|
this._loggedCacheEvents.clear();
|
|
2021
1984
|
this._pendingLoads.clear();
|
|
2022
|
-
console.log('[AgentProviderSync] 🗑️ roboto.clearCache all objects:', {
|
|
2023
|
-
clearedCount: size
|
|
2024
|
-
});
|
|
1985
|
+
//console.log('[AgentProviderSync] 🗑️ roboto.clearCache all objects:', { clearedCount: size });
|
|
2025
1986
|
}
|
|
2026
1987
|
}
|
|
2027
1988
|
|
package/dist/rbt_object.js
CHANGED
|
@@ -1035,7 +1035,7 @@ var RbtObject = /*#__PURE__*/function () {
|
|
|
1035
1035
|
});
|
|
1036
1036
|
_this3._trigger('change', changeData);
|
|
1037
1037
|
if (msg.isStateSync) {
|
|
1038
|
-
console.log('[RbtObject] Applied state sync:', msg.delta.path, '=', msg.delta.value);
|
|
1038
|
+
//console.log('[RbtObject] Applied state sync:', msg.delta.path, '=', msg.delta.value);
|
|
1039
1039
|
}
|
|
1040
1040
|
} else {
|
|
1041
1041
|
console.warn('[RbtObject] Received update message without valid delta:', msg);
|
|
@@ -1057,14 +1057,14 @@ var RbtObject = /*#__PURE__*/function () {
|
|
|
1057
1057
|
this._eventHandlers.change.push(cb);
|
|
1058
1058
|
|
|
1059
1059
|
// Log registration with stack trace to identify duplicates
|
|
1060
|
-
console.log(
|
|
1060
|
+
//console.log(`[AgentProviderSync] 📝 onChange handler registered #${handlerCount + 1}`);
|
|
1061
1061
|
|
|
1062
1062
|
// Get stack trace to see who registered this handler
|
|
1063
1063
|
var stack = new Error().stack;
|
|
1064
1064
|
var stackLines = stack.split('\n');
|
|
1065
1065
|
// Skip the first 3 lines (Error, onChange, and the immediate caller)
|
|
1066
1066
|
var relevantStack = stackLines.slice(3, 8).join('\n');
|
|
1067
|
-
console.log('[AgentProviderSync] Registration stack:', relevantStack);
|
|
1067
|
+
//console.log('[AgentProviderSync] Registration stack:', relevantStack);
|
|
1068
1068
|
|
|
1069
1069
|
// Auto-initialize realtime if this object has WebSocket capability
|
|
1070
1070
|
if (this._ws && !this._realtime) {
|
|
@@ -1079,7 +1079,7 @@ var RbtObject = /*#__PURE__*/function () {
|
|
|
1079
1079
|
var index = this._eventHandlers.change.indexOf(cb);
|
|
1080
1080
|
if (index > -1) {
|
|
1081
1081
|
this._eventHandlers.change.splice(index, 1);
|
|
1082
|
-
console.log(
|
|
1082
|
+
//console.log(`[AgentProviderSync] 🗑️ onChange handler removed. Remaining:`, this._eventHandlers.change.length);
|
|
1083
1083
|
return true;
|
|
1084
1084
|
} else {
|
|
1085
1085
|
console.warn("[AgentProviderSync] \u26A0\uFE0F Attempted to remove handler that was not registered");
|
|
@@ -1110,13 +1110,14 @@ var RbtObject = /*#__PURE__*/function () {
|
|
|
1110
1110
|
key: "_trigger",
|
|
1111
1111
|
value: function _trigger(type, data) {
|
|
1112
1112
|
var handlers = this._eventHandlers[type] || [];
|
|
1113
|
-
console.log('[AgentProviderSync] _trigger called:', type, 'handlers:', handlers.length, 'data:', data)
|
|
1113
|
+
//console.log('[AgentProviderSync] _trigger called:', type, 'handlers:', handlers.length, 'data:', data)
|
|
1114
|
+
|
|
1114
1115
|
for (var i = 0; i < handlers.length; i++) {
|
|
1115
1116
|
var fn = handlers[i];
|
|
1116
1117
|
try {
|
|
1117
|
-
console.log(
|
|
1118
|
+
//console.log(`[AgentProviderSync] 🔄 Calling handler ${i+1}/${handlers.length}`);
|
|
1118
1119
|
fn(data);
|
|
1119
|
-
console.log(
|
|
1120
|
+
//console.log(`[AgentProviderSync] ✅ Handler ${i+1} succeeded`);
|
|
1120
1121
|
} catch (error) {
|
|
1121
1122
|
console.error("[AgentProviderSync] \u274C Handler ".concat(i + 1, "/").concat(handlers.length, " threw error:"), error);
|
|
1122
1123
|
console.error('[AgentProviderSync] Error stack:', error.stack);
|
package/dist/version.js
CHANGED