holosphere 1.1.10 → 1.1.12

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,115 +1,109 @@
1
1
  /**
2
- * Organization Federation Example for HoloSphere
2
+ * Organization Federation Example for HoloSphere (Updated API)
3
3
  *
4
4
  * This example demonstrates a real-world use case where a tech team creates tasks
5
- * that are federated to the parent organization for visibility.
5
+ * that are automatically federated to the parent organization for visibility using
6
+ * the latest HoloSphere federation features.
6
7
  */
7
8
 
8
- import HoloSphere from './holosphere.js';
9
+ import HoloSphere from '../holosphere.js';
9
10
 
10
11
  async function organizationFederationExample() {
11
- const holoSphere = new HoloSphere('organization-example');
12
+ const holoSphere = new HoloSphere('organization-example-updated');
12
13
 
13
14
  try {
14
- console.log('Starting Organization Federation Example...');
15
+ console.log('Starting Organization Federation Example (Updated API)...');
15
16
 
16
- // Define our spaces/holons
17
- const orgHolon = 'acme-organization';
18
- const techTeamHolon = 'acme-tech-team';
17
+ // Define unique names for this run to avoid conflicts
18
+ const runId = Date.now();
19
+ const orgHolon = `acme-org-${runId}`;
20
+ const techTeamHolon = `acme-tech-${runId}`;
19
21
 
20
- // Step 1: Create federation relationship between tech team and organization
22
+ // Step 1: Create federation relationship (bidirectional by default)
21
23
  console.log('\nStep 1: Creating federation relationship...');
22
-
23
- await holoSphere.federate(techTeamHolon, orgHolon);
24
- console.log('Federation created between tech team and organization');
25
-
26
- // Step 2: Set up bidirectional notification settings (critical!)
27
- console.log('\nStep 2: Setting up bidirectional notification...');
28
-
29
- // First set up tech team to notify organization
30
- const techTeamFedSettings = await holoSphere.getGlobal('federation', techTeamHolon);
31
- if (techTeamFedSettings) {
32
- techTeamFedSettings.notify = techTeamFedSettings.notify || [];
33
- if (!techTeamFedSettings.notify.includes(orgHolon)) {
34
- techTeamFedSettings.notify.push(orgHolon);
35
- await holoSphere.putGlobal('federation', techTeamFedSettings);
36
- console.log('Tech team set to notify organization');
37
- }
38
- }
39
-
40
- // Then set up organization to notify tech team (if needed)
41
- const orgFedSettings = await holoSphere.getGlobal('federation', orgHolon);
42
- if (orgFedSettings) {
43
- orgFedSettings.notify = orgFedSettings.notify || [];
44
- if (!orgFedSettings.notify.includes(techTeamHolon)) {
45
- orgFedSettings.notify.push(techTeamHolon);
46
- await holoSphere.putGlobal('federation', orgFedSettings);
47
- console.log('Organization set to notify tech team');
48
- }
24
+ // The `federate` method automatically sets up bidirectional notifications when `bidirectional` is true (default).
25
+ const federateResult = await holoSphere.federate(techTeamHolon, orgHolon);
26
+ if (!federateResult) {
27
+ throw new Error('Federation setup failed.');
49
28
  }
29
+ console.log(`Federation created between ${techTeamHolon} and ${orgHolon}`);
50
30
 
51
- // Step 3: Verify federation is set up properly
52
- console.log('\nStep 3: Verifying federation setup...');
53
-
31
+ // Allow a moment for GunDB propagation of federation settings
32
+ await new Promise(resolve => setTimeout(resolve, 1500));
33
+
34
+ // Step 2: Verify federation is set up properly
35
+ console.log('\nStep 2: Verifying federation setup...');
54
36
  const techTeamFedInfo = await holoSphere.getFederation(techTeamHolon);
55
- console.log('Tech team federation info:', techTeamFedInfo);
37
+ console.log(`Tech team (${techTeamHolon}) federation info:`, techTeamFedInfo);
38
+ if (!techTeamFedInfo?.federation?.includes(orgHolon)) {
39
+ console.warn('Warning: Organization holon not found in tech team federation list.');
40
+ }
56
41
 
57
- // Step 4: Create a task in the tech team holon
58
- console.log('\nStep 4: Creating a task in the tech team holon...');
42
+ const orgFedInfo = await holoSphere.getFederation(orgHolon);
43
+ console.log(`Organization (${orgHolon}) federation info:`, orgFedInfo);
44
+ if (!orgFedInfo?.notify?.includes(techTeamHolon)) {
45
+ console.warn('Warning: Tech team holon not found in organization notify list.');
46
+ }
47
+
48
+ // Step 3: Create a task in the tech team holon
49
+ // The `put` method automatically propagates data to federated holons by default (`autoPropagate: true`).
50
+ console.log('\nStep 3: Creating a task in the tech team holon (will auto-propagate)...');
59
51
 
60
52
  const task = {
61
- id: 'task-123',
53
+ id: `task-${runId}-123`,
62
54
  title: 'Implement new authentication system',
63
55
  description: 'Replace the current auth system with OAuth2',
64
56
  assignee: 'dev@example.com',
65
57
  status: 'in_progress',
66
58
  priority: 'high',
67
- dueDate: '2023-12-31',
59
+ dueDate: '2024-12-31',
68
60
  createdAt: new Date().toISOString(),
69
61
  tags: ['security', 'infrastructure']
70
62
  };
71
63
 
72
- // Store the task in the tech team holon
73
- await holoSphere.put(techTeamHolon, 'tasks', task);
74
- console.log('Task created in tech team holon:', task.id);
75
-
76
- // Step 5: Propagate the task to the organization holon
77
- console.log('\nStep 5: Propagating task to organization holon...');
78
-
79
- await holoSphere.propagate(techTeamHolon, 'tasks', task);
80
- console.log('Task propagated to organization holon');
81
-
82
- // Step 6: Allow time for propagation
83
- console.log('\nStep 6: Waiting for propagation to complete...');
84
- await new Promise(resolve => setTimeout(resolve, 1000));
64
+ // Store the task - it will be automatically propagated to orgHolon due to federation
65
+ const putResult = await holoSphere.put(techTeamHolon, 'tasks', task);
66
+ console.log(`Task created in ${techTeamHolon}: ${task.id}. Propagation result:`, putResult.propagationResult);
67
+ if (putResult.propagationResult?.errors > 0) {
68
+ console.warn('Warning: Auto-propagation reported errors.');
69
+ }
70
+
71
+ // Step 4: Allow time for propagation via put
72
+ console.log('\nStep 4: Waiting for auto-propagation to complete...');
73
+ await new Promise(resolve => setTimeout(resolve, 1500));
85
74
 
86
- // Step 7: Verify task in both holons
87
- console.log('\nStep 7: Verifying task is in both holons...');
75
+ // Step 5: Verify task in both holons
76
+ console.log('\nStep 5: Verifying task is in both holons...');
88
77
 
89
- // Check tech team holon directly
90
- const techTeamTask = await holoSphere.get(techTeamHolon, 'tasks', 'task-123');
91
- console.log('Task in tech team holon:', techTeamTask ? 'Found' : 'Not found');
78
+ // Check tech team holon directly (original data)
79
+ const techTeamTask = await holoSphere.get(techTeamHolon, 'tasks', task.id);
80
+ console.log(`Task in tech team holon (${techTeamHolon}):`, techTeamTask ? 'Found' : 'Not found');
92
81
  if (techTeamTask) console.log('Tech team task status:', techTeamTask.status);
93
82
 
94
- // Check organization holon directly
95
- const orgTask = await holoSphere.get(orgHolon, 'tasks', 'task-123');
96
- console.log('Task in organization holon:', orgTask ? 'Found' : 'Not found');
83
+ // Check organization holon directly (should have a resolved reference)
84
+ const orgTask = await holoSphere.get(orgHolon, 'tasks', task.id);
85
+ console.log(`Task in organization holon (${orgHolon}):`, orgTask ? 'Found' : 'Not found');
97
86
  if (orgTask) {
98
87
  console.log('Organization task status:', orgTask.status);
99
- console.log('Federation metadata:', orgTask.federation);
88
+ // Check if it's a resolved reference
89
+ console.log('Is resolved reference:', !!orgTask._federation?.resolved);
90
+ } else {
91
+ console.warn(`Task ${task.id} not found in organization holon ${orgHolon}. Propagation might have failed or is slow.`);
100
92
  }
101
93
 
102
- // Step 8: Use getFederated to view all tasks across holons
103
- console.log('\nStep 8: Using getFederated to view all tasks...');
94
+ // Step 6: Use getFederated to view all tasks from the organization's perspective
95
+ console.log('\nStep 6: Using getFederated to view all tasks...');
104
96
 
105
97
  const allOrgTasks = await holoSphere.getFederated(orgHolon, 'tasks');
106
- console.log(`Organization holon has access to ${allOrgTasks.length} tasks`);
98
+ console.log(`Organization holon (${orgHolon}) has access to ${allOrgTasks.length} tasks (via getFederated):`);
99
+ // console.log(allOrgTasks); // Uncomment to see the full list
107
100
 
108
101
  const allTechTasks = await holoSphere.getFederated(techTeamHolon, 'tasks');
109
- console.log(`Tech team holon has access to ${allTechTasks.length} tasks`);
110
-
111
- // Step 9: Update the task in tech team and propagate the change
112
- console.log('\nStep 9: Updating task in tech team holon...');
102
+ console.log(`Tech team holon (${techTeamHolon}) has access to ${allTechTasks.length} tasks (via getFederated):`);
103
+ // console.log(allTechTasks); // Uncomment to see the full list
104
+
105
+ // Step 7: Update the task in tech team holon (will also auto-propagate)
106
+ console.log('\nStep 7: Updating task in tech team holon (will auto-propagate)...');
113
107
 
114
108
  const updatedTask = {
115
109
  ...task,
@@ -117,30 +111,44 @@ async function organizationFederationExample() {
117
111
  completedAt: new Date().toISOString()
118
112
  };
119
113
 
120
- await holoSphere.put(techTeamHolon, 'tasks', updatedTask);
121
- await holoSphere.propagate(techTeamHolon, 'tasks', updatedTask);
122
- console.log('Task updated and propagated');
123
-
124
- // Step 10: Allow time for propagation
125
- console.log('\nStep 10: Waiting for propagation to complete...');
126
- await new Promise(resolve => setTimeout(resolve, 1000));
127
-
128
- // Step 11: Verify updates in both holons
129
- console.log('\nStep 11: Verifying updated task in both holons...');
114
+ // Update the task - the change will be automatically propagated
115
+ const updateResult = await holoSphere.put(techTeamHolon, 'tasks', updatedTask);
116
+ console.log(`Task updated in ${techTeamHolon}. Propagation result:`, updateResult.propagationResult);
117
+ if (updateResult.propagationResult?.errors > 0) {
118
+ console.warn('Warning: Auto-propagation of update reported errors.');
119
+ }
130
120
 
131
- const updatedTechTeamTask = await holoSphere.get(techTeamHolon, 'tasks', 'task-123');
132
- console.log('Updated task in tech team holon status:', updatedTechTeamTask?.status);
121
+ // Step 8: Allow time for update propagation
122
+ console.log('\nStep 8: Waiting for update propagation...');
123
+ await new Promise(resolve => setTimeout(resolve, 1500));
133
124
 
134
- const updatedOrgTask = await holoSphere.get(orgHolon, 'tasks', 'task-123');
135
- console.log('Updated task in organization holon status:', updatedOrgTask?.status);
125
+ // Step 9: Verify updates in both holons
126
+ console.log('\nStep 9: Verifying updated task in both holons...');
136
127
 
137
- // Step 12: Clean up - remove federation
138
- console.log('\nStep 12: Cleaning up - removing federation...');
128
+ const updatedTechTeamTask = await holoSphere.get(techTeamHolon, 'tasks', task.id);
129
+ console.log(`Updated task status in tech team holon (${techTeamHolon}):`, updatedTechTeamTask?.status);
139
130
 
131
+ // Get the potentially updated reference in the organization holon
132
+ const updatedOrgTask = await holoSphere.get(orgHolon, 'tasks', task.id);
133
+ console.log(`Updated task status in organization holon (${orgHolon}):`, updatedOrgTask?.status);
134
+ if (!updatedOrgTask || updatedOrgTask.status !== 'completed') {
135
+ console.warn(`Updated task status not reflected in organization holon ${orgHolon}. Propagation might have failed or is slow.`);
136
+ }
137
+
138
+ // Step 10: Clean up - remove federation
139
+ console.log('\nStep 10: Cleaning up - removing federation...');
140
140
  await holoSphere.unfederate(techTeamHolon, orgHolon);
141
- console.log('Federation removed between tech team and organization');
141
+ console.log(`Federation removed between ${techTeamHolon} and ${orgHolon}`);
142
+
143
+ // Optional: Clean up data (can be slow and sometimes unreliable in Gun)
144
+ // console.log('Cleaning up task data...');
145
+ // await holoSphere.delete(techTeamHolon, 'tasks', task.id);
146
+ // await holoSphere.delete(orgHolon, 'tasks', task.id); // Delete the reference
147
+ // await holoSphere.deleteGlobal('federation', techTeamHolon);
148
+ // await holoSphere.deleteGlobal('federation', orgHolon);
142
149
 
143
150
  console.log('\nOrganization federation example completed successfully!');
151
+
144
152
  } catch (error) {
145
153
  console.error('Error in organization federation example:', error);
146
154
  } finally {
@@ -0,0 +1,106 @@
1
+ // hologram-updates-example.js
2
+ // Example showing how to use the returned list of updated holograms from put()
3
+
4
+ import HoloSphere from '../holosphere.js';
5
+
6
+ async function exampleUsage() {
7
+ const holosphere = new HoloSphere('example-app', false);
8
+
9
+ try {
10
+ // 1. Create some original data
11
+ const originalData = {
12
+ id: 'product-123',
13
+ name: 'Widget',
14
+ price: 19.99,
15
+ inventory: 100
16
+ };
17
+
18
+ console.log('Step 1: Storing original data...');
19
+ await holosphere.put('store', 'products', originalData);
20
+
21
+ // 2. Create holograms in different locations (maybe for different displays/views)
22
+ console.log('Step 2: Creating holograms...');
23
+ const hologram1 = holosphere.createHologram('store', 'products', originalData);
24
+ const hologram2 = holosphere.createHologram('store', 'products', originalData);
25
+
26
+ await holosphere.put('storefront', 'display', { id: 'featured-product', soul: hologram1.soul });
27
+ await holosphere.put('warehouse', 'inventory', { id: 'stock-item', soul: hologram2.soul });
28
+
29
+ // Wait for Gun to propagate
30
+ await new Promise(resolve => setTimeout(resolve, 500));
31
+
32
+ // 3. Update the original data and get the list of updated holograms
33
+ console.log('Step 3: Updating original data...');
34
+ const updatedData = {
35
+ ...originalData,
36
+ price: 17.99, // Price reduction!
37
+ inventory: 95, // Some sold
38
+ lastUpdated: Date.now()
39
+ };
40
+
41
+ const result = await holosphere.put('store', 'products', updatedData);
42
+
43
+ console.log('PUT Result:', {
44
+ success: result.success,
45
+ pathInfo: {
46
+ holon: result.pathHolon,
47
+ lens: result.pathLens,
48
+ key: result.pathKey
49
+ },
50
+ updatedHologramsCount: result.updatedHolograms.length
51
+ });
52
+
53
+ // 4. Process the updated holograms
54
+ console.log('Step 4: Processing updated holograms...');
55
+ if (result.updatedHolograms.length > 0) {
56
+ console.log(`Updated ${result.updatedHolograms.length} holograms:`);
57
+
58
+ for (const hologram of result.updatedHolograms) {
59
+ console.log(` - Hologram at ${hologram.holon}/${hologram.lens}/${hologram.key}`);
60
+ console.log(` Soul: ${hologram.soul}`);
61
+ console.log(` Updated at: ${new Date(hologram.timestamp).toISOString()}`);
62
+
63
+ // Example post-processing:
64
+ // You could trigger UI updates, send notifications, update caches, etc.
65
+
66
+ if (hologram.holon === 'storefront') {
67
+ console.log(' -> Triggering storefront display refresh');
68
+ // triggerStorefrontRefresh(hologram.key);
69
+ }
70
+
71
+ if (hologram.holon === 'warehouse') {
72
+ console.log(' -> Updating warehouse inventory system');
73
+ // updateWarehouseInventory(hologram.key);
74
+ }
75
+ }
76
+ } else {
77
+ console.log('No holograms were updated.');
78
+ }
79
+
80
+ // 5. Verify the holograms have the updated timestamp
81
+ console.log('Step 5: Verifying hologram updates...');
82
+ const storefrontHologram = await holosphere.get('storefront', 'display', 'featured-product', null, { resolveHolograms: false });
83
+ const warehouseHologram = await holosphere.get('warehouse', 'inventory', 'stock-item', null, { resolveHolograms: false });
84
+
85
+ console.log('Storefront hologram updated field:', storefrontHologram?.updated);
86
+ console.log('Warehouse hologram updated field:', warehouseHologram?.updated);
87
+
88
+ } catch (error) {
89
+ console.error('Error in example:', error);
90
+ } finally {
91
+ await holosphere.close();
92
+ }
93
+ }
94
+
95
+ // Example usage scenarios:
96
+ console.log('=== Hologram Updates Return Value Example ===');
97
+ console.log('This example demonstrates how to use the updatedHolograms return value from put()');
98
+ console.log('to perform post-processing tasks when original data changes.\n');
99
+
100
+ exampleUsage().then(() => {
101
+ console.log('\n=== Example completed ===');
102
+ process.exit(0);
103
+ }).catch(error => {
104
+ console.error('Example failed:', error);
105
+ process.exit(1);
106
+ });
@@ -1,12 +1,12 @@
1
- import HoloSphere from './holosphere.js';
1
+ import HoloSphere from '../holosphere.js';
2
2
 
3
- async function testReferenceFederation() {
4
- console.log('Starting reference federation test...');
5
- const holoSphere = new HoloSphere('test-references');
3
+ async function testHologramFederation() {
4
+ console.log('Starting hologram federation test...');
5
+ const holoSphere = new HoloSphere('test-holograms');
6
6
 
7
7
  try {
8
- const space1 = 'ref-test-space1';
9
- const space2 = 'ref-test-space2';
8
+ const space1 = 'holo-test-space1';
9
+ const space2 = 'holo-test-space2';
10
10
 
11
11
  // Step 1: Create federation with bidirectional notify settings
12
12
  console.log('Step 1: Creating federation between spaces...');
@@ -25,19 +25,19 @@ async function testReferenceFederation() {
25
25
  // Step 3: Create test data
26
26
  console.log('Step 3: Creating test data...');
27
27
  const testData = {
28
- id: 'ref-test-item',
29
- title: 'Reference Test',
28
+ id: 'holo-test-item',
29
+ title: 'Hologram Test',
30
30
  value: 200,
31
- tags: ['test', 'reference']
31
+ tags: ['test', 'hologram']
32
32
  };
33
33
 
34
34
  // Store data in space1
35
35
  await holoSphere.put(space1, 'items', testData);
36
36
 
37
- // Step 4: Propagate using references
38
- console.log('Step 4: Propagating with soul references...');
37
+ // Step 4: Propagate using holograms
38
+ console.log('Step 4: Propagating with soul holograms...');
39
39
  const propResult = await holoSphere.propagate(space1, 'items', testData, {
40
- useReferences: true
40
+ useHolograms: true
41
41
  });
42
42
  console.log('Propagation result:', propResult);
43
43
 
@@ -45,17 +45,17 @@ async function testReferenceFederation() {
45
45
  console.log('Waiting for propagation...');
46
46
  await new Promise(resolve => setTimeout(resolve, 1000));
47
47
 
48
- // Step 5: Verify that the data in space2 is a soul reference
49
- console.log('Step 5: Verifying soul reference was created...');
50
- const rawRef = await holoSphere.get(space2, 'items', 'ref-test-item', null, {
51
- resolveReferences: false
48
+ // Step 5: Verify that the data in space2 is a soul hologram
49
+ console.log('Step 5: Verifying soul hologram was created...');
50
+ const rawHolo = await holoSphere.get(space2, 'items', 'holo-test-item', null, {
51
+ resolveHolograms: false
52
52
  });
53
53
 
54
- console.log('Raw reference data:', rawRef);
55
- console.log('Is soul reference:', !!rawRef?.soul);
54
+ console.log('Raw hologram data:', rawHolo);
55
+ console.log('Is soul hologram:', holoSphere.isHologram(rawHolo));
56
56
 
57
- if (rawRef?.soul) {
58
- const soulParts = rawRef.soul.split('/');
57
+ if (rawHolo?.soul) {
58
+ const soulParts = rawHolo.soul.split('/');
59
59
  console.log('Soul parts:', soulParts);
60
60
  console.log('Soul refers to:', {
61
61
  app: soulParts[0],
@@ -65,9 +65,9 @@ async function testReferenceFederation() {
65
65
  });
66
66
  }
67
67
 
68
- // Step 6: Verify reference resolution works
69
- console.log('Step 6: Verifying reference resolution...');
70
- const resolvedData = await holoSphere.get(space2, 'items', 'ref-test-item');
68
+ // Step 6: Verify hologram resolution works
69
+ console.log('Step 6: Verifying hologram resolution...');
70
+ const resolvedData = await holoSphere.get(space2, 'items', 'holo-test-item');
71
71
  console.log('Resolved data:', resolvedData);
72
72
 
73
73
  // Step 7: Update the original data
@@ -84,14 +84,14 @@ async function testReferenceFederation() {
84
84
  console.log('Waiting for update...');
85
85
  await new Promise(resolve => setTimeout(resolve, 500));
86
86
 
87
- // Step 8: Verify update is reflected through the reference
88
- console.log('Step 8: Verifying update is reflected in reference...');
89
- const reResolvedData = await holoSphere.get(space2, 'items', 'ref-test-item');
87
+ // Step 8: Verify update is reflected through the hologram
88
+ console.log('Step 8: Verifying update is reflected in hologram...');
89
+ const reResolvedData = await holoSphere.get(space2, 'items', 'holo-test-item');
90
90
  console.log('Re-resolved data after update:', reResolvedData);
91
91
 
92
92
  // Step 9: Update directly through origin holon
93
93
  console.log('Step 9: Updating through the origin holon...');
94
- const originData = await holoSphere.get(space1, 'items', 'ref-test-item');
94
+ const originData = await holoSphere.get(space1, 'items', 'holo-test-item');
95
95
 
96
96
  const finalUpdate = {
97
97
  ...originData,
@@ -102,27 +102,24 @@ async function testReferenceFederation() {
102
102
  await holoSphere.put(space1, 'items', finalUpdate);
103
103
 
104
104
  // Allow time for update to propagate
105
- console.log('Waiting for update to propagate...');
105
+ console.log('Waiting for final update...');
106
106
  await new Promise(resolve => setTimeout(resolve, 500));
107
107
 
108
- // Step 10: Verify update is visible through the reference
109
- console.log('Step 10: Verifying update is visible through the reference...');
110
- const originalAfterUpdate = await holoSphere.get(space1, 'items', 'ref-test-item');
111
- console.log('Original data after update:', originalAfterUpdate);
108
+ // Step 10: Verify final update through the hologram in space2
109
+ console.log('Step 10: Verifying final update is reflected...');
110
+ const finalResolvedData = await holoSphere.get(space2, 'items', 'holo-test-item');
111
+ console.log('Final resolved data:', finalResolvedData);
112
112
 
113
- const refAfterUpdate = await holoSphere.get(space2, 'items', 'ref-test-item');
114
- console.log('Reference resolved data after update:', refAfterUpdate);
115
-
116
- // Step 11: Test manual soul reference resolution
117
- console.log('Step 11: Testing manual soul reference resolution...');
113
+ // Step 11: Test manual soul hologram resolution
114
+ console.log('Step 11: Testing manual soul hologram resolution...');
118
115
 
119
116
  // Check what getAll returns
120
- console.log('Raw references from getAll in space2:');
117
+ console.log('Raw holograms from getAll in space2:');
121
118
  const allItems = await holoSphere.getAll(space2, 'items');
122
119
  console.log('getAll results:', allItems);
123
120
 
124
121
  if (allItems.length > 0 && allItems[0].soul) {
125
- console.log('Found a soul reference, resolving it manually:');
122
+ console.log('Found a soul hologram, resolving it manually:');
126
123
  const soulParts = allItems[0].soul.split('/');
127
124
 
128
125
  const originHolon = soulParts[1];
@@ -136,29 +133,29 @@ async function testReferenceFederation() {
136
133
  originLens,
137
134
  originKey,
138
135
  null,
139
- { resolveReferences: false }
136
+ { resolveHolograms: false }
140
137
  );
141
- console.log('Manually resolved reference data:', originalData);
138
+ console.log('Manually resolved hologram data:', originalData);
142
139
  }
143
140
 
144
- // Test getFederated with soul references
145
- console.log('\nTesting getFederated with soul references:');
141
+ // Test getFederated with holograms
142
+ console.log('\nTesting getFederated with holograms:');
146
143
  const federatedData = await holoSphere.getFederated(space2, 'items', {
147
- resolveReferences: true,
144
+ resolveHolograms: true,
148
145
  idField: 'id'
149
146
  });
150
147
 
151
148
  console.log('getFederated results length:', federatedData.length);
152
149
 
153
150
  // Find the item by ID
154
- const federatedItem = federatedData.find(item => item.id === 'ref-test-item');
151
+ const federatedItem = federatedData.find(item => item.id === 'holo-test-item');
155
152
  console.log('Found federated item by ID:', federatedItem);
156
153
 
157
- // Check if federated data correctly resolves soul references
154
+ // Check if federated data correctly resolves soul holograms
158
155
  if (federatedItem && federatedItem.value === 400 && federatedItem.finalUpdate) {
159
- console.log('SUCCESS: getFederated correctly resolved the soul reference!');
156
+ console.log('SUCCESS: getFederated correctly resolved the soul hologram!');
160
157
  } else {
161
- console.log('WARNING: getFederated may not be resolving soul references properly');
158
+ console.log('WARNING: getFederated may not be resolving soul holograms properly');
162
159
  }
163
160
 
164
161
  // Step 12: Clean up
@@ -166,12 +163,13 @@ async function testReferenceFederation() {
166
163
  await holoSphere.unfederate(space1, space2);
167
164
  await holoSphere.unfederate(space2, space1);
168
165
 
169
- console.log('Test completed successfully!');
166
+ console.log('Hologram federation test completed successfully!');
170
167
  } catch (error) {
171
- console.error('Error in test:', error);
168
+ console.error('Hologram federation test failed:', error);
172
169
  } finally {
173
170
  await holoSphere.close();
171
+ console.log('HoloSphere connection closed.');
174
172
  }
175
173
  }
176
174
 
177
- testReferenceFederation().catch(console.error);
175
+ testHologramFederation();