holosphere 1.1.9 → 1.1.11
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/.cursor/rules/futura.mdc +55 -0
- package/FEDERATION.md +17 -17
- package/compute.js +289 -0
- package/content.js +797 -0
- package/examples/federation.js +98 -90
- package/examples/{references.js → holograms.js} +49 -51
- package/federation.js +307 -197
- package/global.js +560 -0
- package/hologram.js +156 -0
- package/holosphere.d.ts +94 -7
- package/holosphere.js +211 -1464
- package/node.js +155 -0
- package/package.json +2 -5
- package/schema.js +132 -0
- package/test/auth.test.js +85 -51
- package/test/delete.test.js +15 -11
- package/test/federation.test.js +179 -0
- package/test/hologram.test.js +316 -0
- package/test/holosphere.test.js +189 -5
- package/test/subscription.test.js +364 -0
- package/utils.js +290 -0
package/examples/federation.js
CHANGED
|
@@ -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 '
|
|
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
|
|
17
|
-
const
|
|
18
|
-
const
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
52
|
-
|
|
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(
|
|
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
|
-
|
|
58
|
-
console.log(
|
|
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:
|
|
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: '
|
|
59
|
+
dueDate: '2024-12-31',
|
|
68
60
|
createdAt: new Date().toISOString(),
|
|
69
61
|
tags: ['security', 'infrastructure']
|
|
70
62
|
};
|
|
71
63
|
|
|
72
|
-
// Store the task
|
|
73
|
-
await holoSphere.put(techTeamHolon, 'tasks', task);
|
|
74
|
-
console.log(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
console.log('
|
|
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
|
|
87
|
-
console.log('\nStep
|
|
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',
|
|
91
|
-
console.log(
|
|
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',
|
|
96
|
-
console.log(
|
|
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
|
-
|
|
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
|
|
103
|
-
console.log('\nStep
|
|
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
|
-
|
|
112
|
-
|
|
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
|
-
|
|
121
|
-
await holoSphere.
|
|
122
|
-
console.log(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
132
|
-
console.log('
|
|
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
|
-
|
|
135
|
-
console.log('
|
|
125
|
+
// Step 9: Verify updates in both holons
|
|
126
|
+
console.log('\nStep 9: Verifying updated task in both holons...');
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
console.log(
|
|
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(
|
|
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 {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import HoloSphere from '
|
|
1
|
+
import HoloSphere from '../holosphere.js';
|
|
2
2
|
|
|
3
|
-
async function
|
|
4
|
-
console.log('Starting
|
|
5
|
-
const holoSphere = new HoloSphere('test-
|
|
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 = '
|
|
9
|
-
const 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: '
|
|
29
|
-
title: '
|
|
28
|
+
id: 'holo-test-item',
|
|
29
|
+
title: 'Hologram Test',
|
|
30
30
|
value: 200,
|
|
31
|
-
tags: ['test', '
|
|
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
|
|
38
|
-
console.log('Step 4: Propagating with soul
|
|
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
|
-
|
|
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
|
|
49
|
-
console.log('Step 5: Verifying soul
|
|
50
|
-
const
|
|
51
|
-
|
|
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
|
|
55
|
-
console.log('Is soul
|
|
54
|
+
console.log('Raw hologram data:', rawHolo);
|
|
55
|
+
console.log('Is soul hologram:', holoSphere.isHologram(rawHolo));
|
|
56
56
|
|
|
57
|
-
if (
|
|
58
|
-
const soulParts =
|
|
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
|
|
69
|
-
console.log('Step 6: Verifying
|
|
70
|
-
const resolvedData = await holoSphere.get(space2, 'items', '
|
|
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
|
|
88
|
-
console.log('Step 8: Verifying update is reflected in
|
|
89
|
-
const reResolvedData = await holoSphere.get(space2, 'items', '
|
|
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', '
|
|
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
|
|
105
|
+
console.log('Waiting for final update...');
|
|
106
106
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
107
107
|
|
|
108
|
-
// Step 10: Verify update
|
|
109
|
-
console.log('Step 10: Verifying update is
|
|
110
|
-
const
|
|
111
|
-
console.log('
|
|
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
|
-
|
|
114
|
-
console.log('
|
|
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
|
|
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
|
|
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
|
-
{
|
|
136
|
+
{ resolveHolograms: false }
|
|
140
137
|
);
|
|
141
|
-
console.log('Manually resolved
|
|
138
|
+
console.log('Manually resolved hologram data:', originalData);
|
|
142
139
|
}
|
|
143
140
|
|
|
144
|
-
// Test getFederated with
|
|
145
|
-
console.log('\nTesting getFederated with
|
|
141
|
+
// Test getFederated with holograms
|
|
142
|
+
console.log('\nTesting getFederated with holograms:');
|
|
146
143
|
const federatedData = await holoSphere.getFederated(space2, 'items', {
|
|
147
|
-
|
|
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 === '
|
|
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
|
|
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
|
|
156
|
+
console.log('SUCCESS: getFederated correctly resolved the soul hologram!');
|
|
160
157
|
} else {
|
|
161
|
-
console.log('WARNING: getFederated may not be resolving soul
|
|
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('
|
|
166
|
+
console.log('Hologram federation test completed successfully!');
|
|
170
167
|
} catch (error) {
|
|
171
|
-
console.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
|
-
|
|
175
|
+
testHologramFederation();
|