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/src/rbt_api.js CHANGED
@@ -10,7 +10,7 @@ export default class RbtApi {
10
10
 
11
11
  constructor({ baseUrl, accesskey, authtoken=null, apikey=null, localStorageAdaptor=null, withCredentials=true }) {
12
12
 
13
- console.log('[RbtApi] constructor received:', { baseUrl, accesskey, authtoken, apikey, withCredentials });
13
+ //console.log('[RbtApi] constructor received:', { baseUrl, accesskey, authtoken, apikey, withCredentials });
14
14
 
15
15
  this.websocketClient = null;
16
16
 
@@ -68,7 +68,7 @@ export default class RbtApi {
68
68
  if (apikey) {
69
69
  this.apikey = apikey;
70
70
  this.axios.defaults.headers.common['apikey'] = this.apikey;
71
- console.log('[RbtApi] Set apikey header:', this.axios.defaults.headers.common['apikey']); // ADD THIS LINE
71
+ //console.log('[RbtApi] Set apikey header:', this.axios.defaults.headers.common['apikey']); // ADD THIS LINE
72
72
  }
73
73
  this.initApiKey(apikey);
74
74
 
@@ -99,7 +99,7 @@ export default class RbtApi {
99
99
  if (token) {
100
100
  this.authtoken = token;
101
101
  this.axios.defaults.headers.common['authtoken'] = token;
102
- console.log('[RbtApi] Loaded authtoken from storage adaptor');
102
+ //console.log('[RbtApi] Loaded authtoken from storage adaptor');
103
103
  }
104
104
  } catch (e) {
105
105
  console.warn('[RbtApi] Failed to load authtoken from storage adaptor:', e);
@@ -113,7 +113,7 @@ export default class RbtApi {
113
113
  if (parsed && parsed.id) {
114
114
  this.currentUser = new RbtUser({ id: parsed.id }, this.axios);
115
115
  this.currentUser.setData(parsed);
116
- console.log('[RbtApi] Loaded user from storage adaptor');
116
+ //console.log('[RbtApi] Loaded user from storage adaptor');
117
117
  }
118
118
  }
119
119
  } catch (e) {
@@ -133,7 +133,7 @@ export default class RbtApi {
133
133
  const wsProtocol = baseUrl.startsWith('https') ? 'wss://' : 'ws://';
134
134
  const wsUrl = baseUrl.replace(/^https?:\/\//, wsProtocol);
135
135
 
136
- console.log('[RbtApi] Creating new WebSocket connection to:', wsUrl + '/realtime');
136
+ //console.log('[RbtApi] Creating new WebSocket connection to:', wsUrl + '/realtime');
137
137
  this.websocketClient = new WebSocket(`${wsUrl}/realtime`);
138
138
  this._setupWebSocketHandlers(this.websocketClient);
139
139
 
@@ -142,7 +142,7 @@ export default class RbtApi {
142
142
 
143
143
  _setupWebSocketHandlers(ws) {
144
144
  ws.onopen = () => {
145
- console.log('[RbtApi] WebSocket connected.');
145
+ //console.log('[RbtApi] WebSocket connected.');
146
146
  this._wsReconnectAttempts = 0;
147
147
  this._wsConnected = true;
148
148
 
@@ -161,7 +161,7 @@ export default class RbtApi {
161
161
  // Attempt reconnection with exponential backoff
162
162
  if (!this._wsManualClose && this._wsReconnectAttempts < 5) {
163
163
  const delay = Math.min(1000 * Math.pow(2, this._wsReconnectAttempts), 30000);
164
- console.log(`[RbtApi] Attempting reconnection in ${delay}ms (attempt ${this._wsReconnectAttempts + 1}/5)`);
164
+ //console.log(`[RbtApi] Attempting reconnection in ${delay}ms (attempt ${this._wsReconnectAttempts + 1}/5)`);
165
165
 
166
166
  setTimeout(() => {
167
167
  this._wsReconnectAttempts++;
@@ -529,13 +529,13 @@ export default class RbtApi {
529
529
  try {
530
530
  // Return cached if available and not forcing reload
531
531
  if (this.currentOrganization && !forceReload) {
532
- console.log('[RbtApi] Returning cached currentOrganization:', this.currentOrganization.get('name'));
532
+ //console.log('[RbtApi] Returning cached currentOrganization:', this.currentOrganization.get('name'));
533
533
  return this.currentOrganization;
534
534
  }
535
535
 
536
536
  // Prevent duplicate concurrent loads
537
537
  if (this._loadCurrentOrgPromise) {
538
- console.log('[RbtApi] Organization load already in progress');
538
+ //console.log('[RbtApi] Organization load already in progress');
539
539
  return this._loadCurrentOrgPromise;
540
540
  }
541
541
 
@@ -544,7 +544,7 @@ export default class RbtApi {
544
544
  // Ensure user is loaded first
545
545
  const user = await this.loadCurrentUser();
546
546
  if (!user) {
547
- console.log('[RbtApi] No current user, cannot load organization');
547
+ //console.log('[RbtApi] No current user, cannot load organization');
548
548
  return null;
549
549
  }
550
550
 
@@ -555,7 +555,7 @@ export default class RbtApi {
555
555
  const orgId = userData.mod?.currentOrgId || (typeof firstOrg === 'object' ? firstOrg?.id : firstOrg);
556
556
 
557
557
  if (!orgId) {
558
- console.log('[RbtApi] User has no organizations');
558
+ //console.log('[RbtApi] User has no organizations');
559
559
  return null;
560
560
  }
561
561
 
@@ -573,12 +573,12 @@ export default class RbtApi {
573
573
  }
574
574
 
575
575
  // Load the organization object
576
- console.log('[RbtApi] Loading organization:', orgId);
576
+ //console.log('[RbtApi] Loading organization:', orgId);
577
577
  const org = await this.get('<@iac.organization>', orgId);
578
578
 
579
579
  if (org) {
580
580
  this.currentOrganization = org; // Already an RbtObject
581
- console.log('[RbtApi] Current organization loaded:', org.get('name'));
581
+ //console.log('[RbtApi] Current organization loaded:', org.get('name'));
582
582
 
583
583
  // Cache in storage if available
584
584
  if (this.localStorageAdaptor) {
@@ -618,7 +618,7 @@ export default class RbtApi {
618
618
  throw new Error('Must be logged in to switch organization');
619
619
  }
620
620
 
621
- console.log('[RbtApi] Switching to organization:', orgId);
621
+ //console.log('[RbtApi] Switching to organization:', orgId);
622
622
 
623
623
  // Load the new organization
624
624
  const org = await this.get('<@iac.organization>', orgId);
@@ -639,7 +639,7 @@ export default class RbtApi {
639
639
  await this.localStorageAdaptor.setItem('currentOrgId', orgId);
640
640
  }
641
641
 
642
- console.log('[RbtApi] Switched to organization:', org.get('name'));
642
+ //console.log('[RbtApi] Switched to organization:', org.get('name'));
643
643
  } catch (error) {
644
644
  console.warn('[RbtApi] Failed to save organization preference:', error);
645
645
  // Don't throw - switch succeeded even if preference save failed
@@ -674,14 +674,14 @@ export default class RbtApi {
674
674
  try {
675
675
  // Ensure we have a current user
676
676
  if (!this.currentUser) {
677
- console.log('[RbtApi] Loading current user for organization selection...');
677
+ //console.log('[RbtApi] Loading current user for organization selection...');
678
678
  await this.loadCurrentUser();
679
679
  if (!this.currentUser) {
680
680
  throw new Error('Must be logged in to select organization');
681
681
  }
682
682
  }
683
683
 
684
- console.log('[RbtApi] Selecting organization:', orgId);
684
+ //console.log('[RbtApi] Selecting organization:', orgId);
685
685
 
686
686
  // Load the organization to verify access
687
687
  const org = await this.get('<@iac.organization>', orgId);
@@ -695,18 +695,18 @@ export default class RbtApi {
695
695
  throw new Error('Failed to load user object');
696
696
  }
697
697
 
698
- console.log('[RbtApi] User loaded:', user.id);
698
+ //console.log('[RbtApi] User loaded:', user.id);
699
699
 
700
700
  // Update user's organizations array
701
701
  const userOrgs = user.get('organizations') || [];
702
702
  const orgExists = userOrgs.some(o => o?.id === orgId);
703
703
 
704
704
  if (!orgExists) {
705
- console.log('[RbtApi] Adding organization to user organizations array');
705
+ //console.log('[RbtApi] Adding organization to user organizations array');
706
706
  userOrgs.unshift({ id: orgId, roles: [role] });
707
707
  user.set('organizations', userOrgs);
708
708
  } else {
709
- console.log('[RbtApi] Organization already in user organizations array');
709
+ //console.log('[RbtApi] Organization already in user organizations array');
710
710
  }
711
711
 
712
712
  // Set as current organization preference - handle both nested path formats
@@ -715,9 +715,9 @@ export default class RbtApi {
715
715
  user.set('mod', modData);
716
716
 
717
717
  // Save user record
718
- console.log('[RbtApi] Saving user with organization:', orgId);
718
+ //console.log('[RbtApi] Saving user with organization:', orgId);
719
719
  await user.save();
720
- console.log('[RbtApi] User saved successfully');
720
+ //console.log('[RbtApi] User saved successfully');
721
721
 
722
722
  // Clear cached organization to force reload
723
723
  this.currentOrganization = null;
@@ -733,7 +733,7 @@ export default class RbtApi {
733
733
  await this.localStorageAdaptor.setItem('currentOrgId', orgId);
734
734
  }
735
735
 
736
- console.log('[RbtApi] Selected organization:', org.get('name'));
736
+ //console.log('[RbtApi] Selected organization:', org.get('name'));
737
737
 
738
738
  return org;
739
739
  } catch (error) {
@@ -1100,13 +1100,13 @@ export default class RbtApi {
1100
1100
  // Only log cache hits once per object to reduce spam
1101
1101
  const hitLogKey = `hit:${cacheKey}`;
1102
1102
  if (!this._loggedCacheEvents.has(hitLogKey)) {
1103
- console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', { type, id, hasRealtime: !!cached._realtime, requestedRealtime: !!params.enableRealtime });
1103
+ //console.log('[AgentProviderSync] 🎯 roboto.load cache HIT:', { type, id, hasRealtime: !!cached._realtime, requestedRealtime: !!params.enableRealtime });
1104
1104
  this._loggedCacheEvents.add(hitLogKey);
1105
1105
  }
1106
1106
 
1107
1107
  // If realtime is requested but cached object doesn't have it, upgrade it
1108
1108
  if (params.enableRealtime && !cached._realtime) {
1109
- console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id });
1109
+ //console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id });
1110
1110
  cached._initRealtime();
1111
1111
  }
1112
1112
 
@@ -1122,7 +1122,7 @@ export default class RbtApi {
1122
1122
  // Only log bulk cache miss once
1123
1123
  const bulkMissLogKey = `bulk-miss:${type}:${missingIds.join(',')}`;
1124
1124
  if (!this._loggedCacheEvents.has(bulkMissLogKey)) {
1125
- console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, ids: missingIds });
1125
+ //console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, ids: missingIds });
1126
1126
  this._loggedCacheEvents.add(bulkMissLogKey);
1127
1127
  }
1128
1128
 
@@ -1139,7 +1139,7 @@ export default class RbtApi {
1139
1139
  // Only log cache set once per object to reduce spam
1140
1140
  const setLogKey = `set:${cacheKey}`;
1141
1141
  if (!this._loggedCacheEvents.has(setLogKey)) {
1142
- console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: obj.id });
1142
+ //console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: obj.id });
1143
1143
  this._loggedCacheEvents.add(setLogKey);
1144
1144
  }
1145
1145
  }
@@ -1174,7 +1174,7 @@ export default class RbtApi {
1174
1174
 
1175
1175
  // If realtime is requested but cached object doesn't have it, upgrade it
1176
1176
  if (params.enableRealtime && !cached._realtime) {
1177
- console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id: ids });
1177
+ //console.log('[AgentProviderSync] 🔄 Upgrading cached object to realtime:', { type, id: ids });
1178
1178
  cached._initRealtime();
1179
1179
  }
1180
1180
 
@@ -1191,7 +1191,7 @@ export default class RbtApi {
1191
1191
  // Only log cache miss once per object to reduce spam
1192
1192
  const missLogKey = `miss:${cacheKey}`;
1193
1193
  if (!this._loggedCacheEvents.has(missLogKey)) {
1194
- console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, id: ids });
1194
+ //console.log('[AgentProviderSync] 📦 roboto.load cache MISS, loading:', { type, id: ids });
1195
1195
  this._loggedCacheEvents.add(missLogKey);
1196
1196
  }
1197
1197
 
@@ -1211,7 +1211,7 @@ export default class RbtApi {
1211
1211
  // Only log cache set once per object to reduce spam
1212
1212
  const setLogKey = `set:${cacheKey}`;
1213
1213
  if (!this._loggedCacheEvents.has(setLogKey)) {
1214
- console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: ids });
1214
+ //console.log('[AgentProviderSync] 💾 roboto.load cached object:', { type, id: ids });
1215
1215
  this._loggedCacheEvents.add(setLogKey);
1216
1216
  }
1217
1217
  }
@@ -1251,7 +1251,7 @@ export default class RbtApi {
1251
1251
  this._loggedCacheEvents.delete(`miss:${cacheKey}`);
1252
1252
  this._loggedCacheEvents.delete(`set:${cacheKey}`);
1253
1253
 
1254
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache specific object:', { type, id, removed });
1254
+ //console.log('[AgentProviderSync] 🗑️ roboto.clearCache specific object:', { type, id, removed });
1255
1255
  } else if (type) {
1256
1256
  // Clear all objects of a specific type
1257
1257
  let removedCount = 0;
@@ -1269,14 +1269,14 @@ export default class RbtApi {
1269
1269
  }
1270
1270
  }
1271
1271
 
1272
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', { type, removedCount });
1272
+ //console.log('[AgentProviderSync] 🗑️ roboto.clearCache by type:', { type, removedCount });
1273
1273
  } else {
1274
1274
  // Clear all cached objects
1275
1275
  const size = this._objectCache.size;
1276
1276
  this._objectCache.clear();
1277
1277
  this._loggedCacheEvents.clear();
1278
1278
  this._pendingLoads.clear();
1279
- console.log('[AgentProviderSync] 🗑️ roboto.clearCache all objects:', { clearedCount: size });
1279
+ //console.log('[AgentProviderSync] 🗑️ roboto.clearCache all objects:', { clearedCount: size });
1280
1280
  }
1281
1281
  }
1282
1282
 
package/src/rbt_object.js CHANGED
@@ -760,7 +760,7 @@ export default class RbtObject{
760
760
  this._trigger('change', changeData);
761
761
 
762
762
  if (msg.isStateSync) {
763
- console.log('[RbtObject] Applied state sync:', msg.delta.path, '=', msg.delta.value);
763
+ //console.log('[RbtObject] Applied state sync:', msg.delta.path, '=', msg.delta.value);
764
764
  }
765
765
  } else {
766
766
  console.warn('[RbtObject] Received update message without valid delta:', msg);
@@ -780,14 +780,14 @@ export default class RbtObject{
780
780
  this._eventHandlers.change.push(cb);
781
781
 
782
782
  // Log registration with stack trace to identify duplicates
783
- console.log(`[AgentProviderSync] 📝 onChange handler registered #${handlerCount + 1}`);
783
+ //console.log(`[AgentProviderSync] 📝 onChange handler registered #${handlerCount + 1}`);
784
784
 
785
785
  // Get stack trace to see who registered this handler
786
786
  const stack = new Error().stack;
787
787
  const stackLines = stack.split('\n');
788
788
  // Skip the first 3 lines (Error, onChange, and the immediate caller)
789
789
  const relevantStack = stackLines.slice(3, 8).join('\n');
790
- console.log('[AgentProviderSync] Registration stack:', relevantStack);
790
+ //console.log('[AgentProviderSync] Registration stack:', relevantStack);
791
791
 
792
792
  // Auto-initialize realtime if this object has WebSocket capability
793
793
  if (this._ws && !this._realtime) {
@@ -800,7 +800,7 @@ export default class RbtObject{
800
800
  const index = this._eventHandlers.change.indexOf(cb);
801
801
  if (index > -1) {
802
802
  this._eventHandlers.change.splice(index, 1);
803
- console.log(`[AgentProviderSync] 🗑️ onChange handler removed. Remaining:`, this._eventHandlers.change.length);
803
+ //console.log(`[AgentProviderSync] 🗑️ onChange handler removed. Remaining:`, this._eventHandlers.change.length);
804
804
  return true;
805
805
  } else {
806
806
  console.warn(`[AgentProviderSync] ⚠️ Attempted to remove handler that was not registered`);
@@ -826,14 +826,14 @@ export default class RbtObject{
826
826
 
827
827
  _trigger(type, data) {
828
828
  const handlers = this._eventHandlers[type] || [];
829
- console.log('[AgentProviderSync] _trigger called:', type, 'handlers:', handlers.length, 'data:', data)
829
+ //console.log('[AgentProviderSync] _trigger called:', type, 'handlers:', handlers.length, 'data:', data)
830
830
 
831
831
  for (let i = 0; i < handlers.length; i++) {
832
832
  const fn = handlers[i];
833
833
  try {
834
- console.log(`[AgentProviderSync] 🔄 Calling handler ${i+1}/${handlers.length}`);
834
+ //console.log(`[AgentProviderSync] 🔄 Calling handler ${i+1}/${handlers.length}`);
835
835
  fn(data);
836
- console.log(`[AgentProviderSync] ✅ Handler ${i+1} succeeded`);
836
+ //console.log(`[AgentProviderSync] ✅ Handler ${i+1} succeeded`);
837
837
  } catch (error) {
838
838
  console.error(`[AgentProviderSync] ❌ Handler ${i+1}/${handlers.length} threw error:`, error);
839
839
  console.error('[AgentProviderSync] Error stack:', error.stack);
@@ -841,7 +841,7 @@ export default class RbtObject{
841
841
  }
842
842
  }
843
843
 
844
- console.log(`[AgentProviderSync] ✓ Completed calling ${handlers.length} handlers`);
844
+ // ✓ Completed calling ${handlers.length} handlers`);
845
845
  }
846
846
 
847
847
  _broadcastChange(path, value) {
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Auto-generated version file
2
2
  // DO NOT EDIT - This file is automatically updated from package.json
3
- // Version: 1.9.13
4
- export const version = '1.9.13';
3
+ // Version: 1.9.15
4
+ export const version = '1.9.15';