holosphere 1.1.16 → 1.1.18
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/compute.js +1 -1
- package/content.js +92 -35
- package/federation.js +3 -18
- package/global.js +7 -15
- package/hologram.js +39 -20
- package/holosphere-bundle.esm.js +143 -96
- package/holosphere-bundle.js +143 -96
- package/holosphere-bundle.min.js +18 -18
- package/holosphere.js +25 -3
- package/node.js +5 -8
- package/package.json +9 -9
- package/schema.js +1 -1
- package/utils.js +1 -1
package/holosphere-bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HoloSphere Bundle v1.1.
|
|
2
|
+
* HoloSphere Bundle v1.1.18
|
|
3
3
|
* Holonic Geospatial Communication Infrastructure
|
|
4
4
|
*
|
|
5
5
|
* Includes:
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Ajv (JSON schema validation)
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
|
-
* <script src="https://unpkg.com/holosphere@1.1.
|
|
12
|
+
* <script src="https://unpkg.com/holosphere@1.1.18/holosphere-bundle.js"></script>
|
|
13
13
|
* <script>
|
|
14
14
|
* const hs = new HoloSphere('myapp');
|
|
15
15
|
* </script>
|
|
@@ -30435,16 +30435,14 @@ ${str(snapshot)}`);
|
|
|
30435
30435
|
result.messages.push(`No federation found for ${holon} or no notification targets available.`);
|
|
30436
30436
|
}
|
|
30437
30437
|
if (propagateToParents) {
|
|
30438
|
-
console.log(`[Federation] Starting parent propagation for holon: ${holon}`);
|
|
30439
30438
|
try {
|
|
30440
30439
|
let holonResolution;
|
|
30441
30440
|
let isValidH3 = false;
|
|
30442
|
-
if (typeof holon === "string" && holon
|
|
30441
|
+
if (typeof holon === "string" && /^[8][0-9A-Fa-f]+$/.test(holon) && holon.length >= 15) {
|
|
30443
30442
|
try {
|
|
30444
30443
|
holonResolution = getResolution(holon);
|
|
30445
30444
|
if (holonResolution >= 0 && holonResolution <= 15) {
|
|
30446
30445
|
isValidH3 = true;
|
|
30447
|
-
console.log(`[Federation] Holon ${holon} is valid H3 hexagon with resolution: ${holonResolution}`);
|
|
30448
30446
|
} else {
|
|
30449
30447
|
console.log(`[Federation] Holon ${holon} has invalid resolution: ${holonResolution}`);
|
|
30450
30448
|
}
|
|
@@ -30452,10 +30450,8 @@ ${str(snapshot)}`);
|
|
|
30452
30450
|
console.log(`[Federation] Holon ${holon} failed H3 validation: ${error.message}`);
|
|
30453
30451
|
}
|
|
30454
30452
|
} else {
|
|
30455
|
-
console.log(`[Federation] Holon ${holon} is not a valid H3 hexagon: does not start with '8' or too short`);
|
|
30456
30453
|
}
|
|
30457
30454
|
if (!isValidH3) {
|
|
30458
|
-
console.log(`[Federation] Skipping parent propagation for non-H3 holon: ${holon}`);
|
|
30459
30455
|
result.parentPropagation.messages.push(`Holon ${holon} is not a valid H3 hexagon. Skipping parent propagation.`);
|
|
30460
30456
|
result.parentPropagation.skipped++;
|
|
30461
30457
|
}
|
|
@@ -30464,12 +30460,10 @@ ${str(snapshot)}`);
|
|
|
30464
30460
|
let currentHolon = holon;
|
|
30465
30461
|
let currentRes = holonResolution;
|
|
30466
30462
|
let levelsProcessed = 0;
|
|
30467
|
-
console.log(`[Federation] Getting parent hexagons for ${holon} (resolution ${holonResolution}) up to ${maxParentLevels} levels`);
|
|
30468
30463
|
while (currentRes > 0 && levelsProcessed < maxParentLevels) {
|
|
30469
30464
|
try {
|
|
30470
30465
|
const parent = cellToParent(currentHolon, currentRes - 1);
|
|
30471
30466
|
parentHexagons.push(parent);
|
|
30472
|
-
console.log(`[Federation] Found parent hexagon: ${parent} (resolution ${currentRes - 1})`);
|
|
30473
30467
|
currentHolon = parent;
|
|
30474
30468
|
currentRes--;
|
|
30475
30469
|
levelsProcessed++;
|
|
@@ -30481,13 +30475,10 @@ ${str(snapshot)}`);
|
|
|
30481
30475
|
}
|
|
30482
30476
|
}
|
|
30483
30477
|
if (parentHexagons.length > 0) {
|
|
30484
|
-
console.log(`[Federation] Found ${parentHexagons.length} parent hexagons to propagate to: ${parentHexagons.join(", ")}`);
|
|
30485
30478
|
result.parentPropagation.messages.push(`Found ${parentHexagons.length} parent hexagons to propagate to: ${parentHexagons.join(", ")}`);
|
|
30486
30479
|
const isAlreadyHologram = holosphere.isHologram(data);
|
|
30487
|
-
console.log(`[Federation] Data is already hologram: ${isAlreadyHologram}`);
|
|
30488
30480
|
const parentPropagatePromises = parentHexagons.map(async (parentHexagon) => {
|
|
30489
30481
|
try {
|
|
30490
|
-
console.log(`[Federation] Propagating to parent hexagon: ${parentHexagon}`);
|
|
30491
30482
|
let payloadToPut;
|
|
30492
30483
|
const parentFederationMeta = {
|
|
30493
30484
|
origin: holon,
|
|
@@ -30503,7 +30494,6 @@ ${str(snapshot)}`);
|
|
|
30503
30494
|
};
|
|
30504
30495
|
if (useHolograms && !isAlreadyHologram) {
|
|
30505
30496
|
const newHologram = holosphere.createHologram(holon, lens, data);
|
|
30506
|
-
console.log(`[Federation] Created hologram for parent propagation:`, newHologram);
|
|
30507
30497
|
payloadToPut = {
|
|
30508
30498
|
...newHologram,
|
|
30509
30499
|
// This will be { id: data.id, soul: 'path/to/original' }
|
|
@@ -30520,7 +30510,6 @@ ${str(snapshot)}`);
|
|
|
30520
30510
|
}
|
|
30521
30511
|
};
|
|
30522
30512
|
}
|
|
30523
|
-
console.log(`[Federation] Storing in parent hexagon ${parentHexagon} with payload:`, payloadToPut);
|
|
30524
30513
|
await holosphere.put(parentHexagon, lens, payloadToPut, null, {
|
|
30525
30514
|
disableHologramRedirection: true,
|
|
30526
30515
|
autoPropagate: false
|
|
@@ -30537,7 +30526,6 @@ ${str(snapshot)}`);
|
|
|
30537
30526
|
});
|
|
30538
30527
|
await Promise.all(parentPropagatePromises);
|
|
30539
30528
|
} else {
|
|
30540
|
-
console.log(`[Federation] No parent hexagons found for ${holon} (already at resolution 0 or max levels reached)`);
|
|
30541
30529
|
result.parentPropagation.messages.push(`No parent hexagons found for ${holon} (already at resolution 0 or max levels reached)`);
|
|
30542
30530
|
result.parentPropagation.skipped++;
|
|
30543
30531
|
}
|
|
@@ -30547,8 +30535,6 @@ ${str(snapshot)}`);
|
|
|
30547
30535
|
result.parentPropagation.errors++;
|
|
30548
30536
|
result.parentPropagation.messages.push(`Error during parent propagation: ${error.message}`);
|
|
30549
30537
|
}
|
|
30550
|
-
} else {
|
|
30551
|
-
console.log(`[Federation] Parent propagation disabled for holon: ${holon}`);
|
|
30552
30538
|
}
|
|
30553
30539
|
result.propagated = result.success > 0 || result.parentPropagation.success > 0;
|
|
30554
30540
|
return result;
|
|
@@ -30792,7 +30778,6 @@ ${str(snapshot)}`);
|
|
|
30792
30778
|
if (soulInfo.appname !== holoInstance.appname) {
|
|
30793
30779
|
console.warn(`Existing hologram at ${targetHolon}/${targetLens}/${targetKey} has appname (${soulInfo.appname}) in its soul ${existingItemAtPath.soul} which does not match current HoloSphere instance appname (${holoInstance.appname}). Redirecting put to soul's holon/lens within this instance.`);
|
|
30794
30780
|
}
|
|
30795
|
-
console.log(`Redirecting put for data (ID: ${data.id}). Original target ${targetHolon}/${targetLens}/${targetKey} contained hologram (ID: ${existingItemAtPath.id}, Soul: ${existingItemAtPath.soul}). New target is ${soulInfo.holon}/${soulInfo.lens}/${soulInfo.key}.`);
|
|
30796
30781
|
targetHolon = soulInfo.holon;
|
|
30797
30782
|
targetLens = soulInfo.lens;
|
|
30798
30783
|
targetKey = soulInfo.key;
|
|
@@ -30883,7 +30868,6 @@ ${str(snapshot)}`);
|
|
|
30883
30868
|
const targetNodeRef = holoInstance.getNodeRef(data.soul);
|
|
30884
30869
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${targetHolon}/${targetLens}/${targetKey}`;
|
|
30885
30870
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
30886
|
-
console.log(`Data (ID: ${data.id}) being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${data.soul}'s _holograms set.`);
|
|
30887
30871
|
} else {
|
|
30888
30872
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${data.soul} for tracking.`);
|
|
30889
30873
|
}
|
|
@@ -30904,7 +30888,6 @@ ${str(snapshot)}`);
|
|
|
30904
30888
|
// Only active holograms (deleted ones are null/removed)
|
|
30905
30889
|
);
|
|
30906
30890
|
if (hologramSouls.length > 0) {
|
|
30907
|
-
console.log(`Updating ${hologramSouls.length} active holograms for data ${data.id}`);
|
|
30908
30891
|
const updatePromises = hologramSouls.map(async (hologramSoul) => {
|
|
30909
30892
|
try {
|
|
30910
30893
|
const hologramSoulInfo = holoInstance.parseSoulPath(hologramSoul);
|
|
@@ -30935,7 +30918,6 @@ ${str(snapshot)}`);
|
|
|
30935
30918
|
// Prevent recursive hologram updates
|
|
30936
30919
|
}
|
|
30937
30920
|
);
|
|
30938
|
-
console.log(`Updated hologram at ${hologramSoul} with timestamp`);
|
|
30939
30921
|
updatedHolograms.push({
|
|
30940
30922
|
soul: hologramSoul,
|
|
30941
30923
|
holon: hologramSoulInfo.holon,
|
|
@@ -31060,16 +31042,22 @@ ${str(snapshot)}`);
|
|
|
31060
31042
|
if (resolveHolograms && holoInstance.isHologram(parsed)) {
|
|
31061
31043
|
const resolvedValue = await holoInstance.resolveHologram(parsed, {
|
|
31062
31044
|
followHolograms: resolveHolograms,
|
|
31063
|
-
visited
|
|
31045
|
+
visited,
|
|
31046
|
+
maxDepth: options.maxDepth || 10,
|
|
31047
|
+
currentDepth: options.currentDepth || 0
|
|
31064
31048
|
});
|
|
31065
|
-
console.log(`### get/handleData received resolved value:`, resolvedValue);
|
|
31066
31049
|
if (resolvedValue === null) {
|
|
31067
|
-
console.warn(`
|
|
31050
|
+
console.warn(`Broken hologram detected at ${holon}/${lens}/${key}. Removing it...`);
|
|
31051
|
+
try {
|
|
31052
|
+
await holoInstance.delete(holon, lens, key, password);
|
|
31053
|
+
console.log(`Successfully removed broken hologram from ${holon}/${lens}/${key}`);
|
|
31054
|
+
} catch (cleanupError) {
|
|
31055
|
+
console.error(`Failed to remove broken hologram at ${holon}/${lens}/${key}:`, cleanupError);
|
|
31056
|
+
}
|
|
31068
31057
|
resolve(null);
|
|
31069
31058
|
return;
|
|
31070
31059
|
}
|
|
31071
31060
|
if (resolvedValue !== parsed) {
|
|
31072
|
-
console.log(`### get/handleData using resolved data:`, resolvedValue);
|
|
31073
31061
|
parsed = resolvedValue;
|
|
31074
31062
|
}
|
|
31075
31063
|
}
|
|
@@ -31161,18 +31149,35 @@ ${str(snapshot)}`);
|
|
|
31161
31149
|
const parsed = await holoInstance.parse(data);
|
|
31162
31150
|
if (!parsed || !parsed.id) return;
|
|
31163
31151
|
if (holoInstance.isHologram(parsed)) {
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
|
|
31170
|
-
|
|
31152
|
+
try {
|
|
31153
|
+
const resolved = await holoInstance.resolveHologram(parsed, {
|
|
31154
|
+
followHolograms: true,
|
|
31155
|
+
maxDepth: 10,
|
|
31156
|
+
currentDepth: 0
|
|
31157
|
+
});
|
|
31158
|
+
if (resolved === null) {
|
|
31159
|
+
console.warn(`Broken hologram detected in getAll for key ${key}. Removing it...`);
|
|
31160
|
+
try {
|
|
31161
|
+
await holoInstance.delete(holon, lens, key, password);
|
|
31162
|
+
console.log(`Successfully removed broken hologram from ${holon}/${lens}/${key}`);
|
|
31163
|
+
} catch (cleanupError) {
|
|
31164
|
+
console.error(`Failed to remove broken hologram at ${holon}/${lens}/${key}:`, cleanupError);
|
|
31165
|
+
}
|
|
31166
|
+
return;
|
|
31167
|
+
}
|
|
31168
|
+
if (resolved && resolved !== parsed) {
|
|
31169
|
+
if (schema) {
|
|
31170
|
+
const valid = holoInstance.validator.validate(schema, resolved);
|
|
31171
|
+
if (valid || !holoInstance.strict) {
|
|
31172
|
+
output.set(resolved.id, resolved);
|
|
31173
|
+
}
|
|
31174
|
+
} else {
|
|
31171
31175
|
output.set(resolved.id, resolved);
|
|
31172
31176
|
}
|
|
31173
|
-
|
|
31174
|
-
output.set(resolved.id, resolved);
|
|
31177
|
+
return;
|
|
31175
31178
|
}
|
|
31179
|
+
} catch (hologramError) {
|
|
31180
|
+
console.error(`Error resolving hologram for key ${key}:`, hologramError);
|
|
31176
31181
|
return;
|
|
31177
31182
|
}
|
|
31178
31183
|
}
|
|
@@ -31235,16 +31240,38 @@ ${str(snapshot)}`);
|
|
|
31235
31240
|
console.warn("Parsing raw Gun object with metadata (_) - attempting cleanup:", rawData);
|
|
31236
31241
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
31237
31242
|
if (k !== "_") {
|
|
31238
|
-
|
|
31243
|
+
if (rawData[k] && typeof rawData[k] === "object" && rawData[k]._) {
|
|
31244
|
+
const parsedNested = parse(holoInstance, rawData[k]);
|
|
31245
|
+
if (parsedNested !== null) {
|
|
31246
|
+
acc[k] = parsedNested;
|
|
31247
|
+
}
|
|
31248
|
+
} else if (rawData[k] !== null) {
|
|
31249
|
+
acc[k] = rawData[k];
|
|
31250
|
+
}
|
|
31239
31251
|
}
|
|
31240
31252
|
return acc;
|
|
31241
31253
|
}, {});
|
|
31242
31254
|
if (Object.keys(potentialData).length === 0) {
|
|
31243
|
-
console.warn("Raw Gun object had only metadata (_), returning null.");
|
|
31255
|
+
console.warn("Raw Gun object had only metadata (_) or null values, returning null.");
|
|
31256
|
+
return null;
|
|
31257
|
+
}
|
|
31258
|
+
const hasValidData = Object.values(potentialData).some(
|
|
31259
|
+
(value) => value !== null && value !== void 0 && (typeof value !== "object" || Object.keys(value).length > 0)
|
|
31260
|
+
);
|
|
31261
|
+
if (!hasValidData) {
|
|
31262
|
+
console.warn("Cleaned Gun object has no valid data, returning null.");
|
|
31244
31263
|
return null;
|
|
31245
31264
|
}
|
|
31246
31265
|
return potentialData;
|
|
31247
31266
|
} else {
|
|
31267
|
+
if (Array.isArray(rawData)) {
|
|
31268
|
+
const cleanedArray = rawData.map((item) => parse(holoInstance, item)).filter((item) => item !== null);
|
|
31269
|
+
if (cleanedArray.length === 0) {
|
|
31270
|
+
console.warn("Array contained only invalid/raw GunDB nodes, returning null.");
|
|
31271
|
+
return null;
|
|
31272
|
+
}
|
|
31273
|
+
return cleanedArray;
|
|
31274
|
+
}
|
|
31248
31275
|
return rawData;
|
|
31249
31276
|
}
|
|
31250
31277
|
}
|
|
@@ -31323,7 +31350,6 @@ ${str(snapshot)}`);
|
|
|
31323
31350
|
if (ack.err) {
|
|
31324
31351
|
console.warn(`[deleteFunc] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31325
31352
|
}
|
|
31326
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31327
31353
|
resolveTrack();
|
|
31328
31354
|
});
|
|
31329
31355
|
});
|
|
@@ -31435,7 +31461,6 @@ ${str(snapshot)}`);
|
|
|
31435
31461
|
if (ack.err) {
|
|
31436
31462
|
console.warn(`[deleteAll] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31437
31463
|
}
|
|
31438
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31439
31464
|
resolveTrack();
|
|
31440
31465
|
});
|
|
31441
31466
|
});
|
|
@@ -31500,7 +31525,6 @@ ${str(snapshot)}`);
|
|
|
31500
31525
|
const targetNodeRef = holoInstance.getNodeRef(data.value.soul);
|
|
31501
31526
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${holon}/${lens}/value`;
|
|
31502
31527
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31503
|
-
console.log(`Data (ID: ${data.id}) being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${data.value.soul}'s _holograms set.`);
|
|
31504
31528
|
} else {
|
|
31505
31529
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${data.value.soul} for tracking.`);
|
|
31506
31530
|
}
|
|
@@ -31607,7 +31631,6 @@ ${str(snapshot)}`);
|
|
|
31607
31631
|
if (ack.err) {
|
|
31608
31632
|
console.warn(`[deleteNode] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31609
31633
|
}
|
|
31610
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31611
31634
|
resolveTrack();
|
|
31612
31635
|
});
|
|
31613
31636
|
});
|
|
@@ -31705,7 +31728,6 @@ ${str(snapshot)}`);
|
|
|
31705
31728
|
const targetNodeRef = holoInstance.getNodeRef(dataToStore.soul);
|
|
31706
31729
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${tableName}/${data.id}`;
|
|
31707
31730
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31708
|
-
console.log(`Data (ID: ${data.id}) being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${dataToStore.soul}'s _holograms set.`);
|
|
31709
31731
|
} else {
|
|
31710
31732
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${dataToStore.soul} for tracking.`);
|
|
31711
31733
|
}
|
|
@@ -31728,7 +31750,6 @@ ${str(snapshot)}`);
|
|
|
31728
31750
|
const targetNodeRef = holoInstance.getNodeRef(dataToStore.soul);
|
|
31729
31751
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${tableName}`;
|
|
31730
31752
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31731
|
-
console.log(`Data being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${dataToStore.soul}'s _holograms set.`);
|
|
31732
31753
|
} else {
|
|
31733
31754
|
console.warn(`Data being put is a hologram, but could not parse its soul ${dataToStore.soul} for tracking.`);
|
|
31734
31755
|
}
|
|
@@ -31812,7 +31833,6 @@ ${str(snapshot)}`);
|
|
|
31812
31833
|
// Always follow holograms
|
|
31813
31834
|
});
|
|
31814
31835
|
if (resolved === null) {
|
|
31815
|
-
console.log(`Hologram at ${tableName}/${key} points to non-existent data. Deleting hologram.`);
|
|
31816
31836
|
try {
|
|
31817
31837
|
await holoInstance.deleteGlobal(tableName, key, password);
|
|
31818
31838
|
} catch (deleteError) {
|
|
@@ -31922,7 +31942,6 @@ ${str(snapshot)}`);
|
|
|
31922
31942
|
// Always follow holograms
|
|
31923
31943
|
});
|
|
31924
31944
|
if (resolved === null) {
|
|
31925
|
-
console.log(`Hologram at ${tableName}/${key} points to non-existent data. Deleting hologram.`);
|
|
31926
31945
|
try {
|
|
31927
31946
|
await holoInstance.deleteGlobal(tableName, key, password);
|
|
31928
31947
|
} catch (deleteError) {
|
|
@@ -32036,7 +32055,6 @@ ${str(snapshot)}`);
|
|
|
32036
32055
|
if (ack.err) {
|
|
32037
32056
|
console.warn(`[deleteGlobal] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
32038
32057
|
}
|
|
32039
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
32040
32058
|
resolveTrack();
|
|
32041
32059
|
});
|
|
32042
32060
|
});
|
|
@@ -32155,7 +32173,6 @@ ${str(snapshot)}`);
|
|
|
32155
32173
|
if (ack.err) {
|
|
32156
32174
|
console.warn(`[deleteAllGlobal] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
32157
32175
|
}
|
|
32158
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
32159
32176
|
resolveTrack();
|
|
32160
32177
|
});
|
|
32161
32178
|
});
|
|
@@ -32207,7 +32224,6 @@ ${str(snapshot)}`);
|
|
|
32207
32224
|
// hologram.js
|
|
32208
32225
|
function createHologram(holoInstance, holon, lens, data) {
|
|
32209
32226
|
if (isHologram(data)) {
|
|
32210
|
-
console.warn("createHologram called with data that is already a hologram. Reusing existing soul:", data.soul);
|
|
32211
32227
|
return {
|
|
32212
32228
|
id: data.id,
|
|
32213
32229
|
soul: data.soul
|
|
@@ -32249,57 +32265,69 @@ ${str(snapshot)}`);
|
|
|
32249
32265
|
if (!isHologram(hologram)) {
|
|
32250
32266
|
return hologram;
|
|
32251
32267
|
}
|
|
32252
|
-
const {
|
|
32268
|
+
const {
|
|
32269
|
+
followHolograms = true,
|
|
32270
|
+
visited = /* @__PURE__ */ new Set(),
|
|
32271
|
+
maxDepth = 10,
|
|
32272
|
+
currentDepth = 0
|
|
32273
|
+
} = options;
|
|
32274
|
+
if (currentDepth >= maxDepth) {
|
|
32275
|
+
console.warn(`!!! Maximum resolution depth (${maxDepth}) reached for soul: ${hologram.soul}. Stopping resolution.`);
|
|
32276
|
+
return null;
|
|
32277
|
+
}
|
|
32253
32278
|
if (hologram.soul && visited.has(hologram.soul)) {
|
|
32254
|
-
console.warn(`!!! CIRCULAR hologram detected for soul: ${hologram.soul}.
|
|
32255
|
-
|
|
32256
|
-
}
|
|
32257
|
-
|
|
32258
|
-
|
|
32259
|
-
|
|
32260
|
-
|
|
32261
|
-
|
|
32262
|
-
|
|
32263
|
-
|
|
32264
|
-
|
|
32265
|
-
|
|
32266
|
-
|
|
32267
|
-
|
|
32268
|
-
|
|
32269
|
-
|
|
32270
|
-
|
|
32271
|
-
|
|
32272
|
-
|
|
32273
|
-
|
|
32274
|
-
|
|
32275
|
-
|
|
32276
|
-
);
|
|
32277
|
-
console.log("### resolveHologram received originalData:", originalData);
|
|
32278
|
-
if (originalData) {
|
|
32279
|
-
console.log(`### Returning RESOLVED data for soul: ${hologram.soul}`);
|
|
32280
|
-
return {
|
|
32281
|
-
...originalData,
|
|
32282
|
-
_meta: {
|
|
32283
|
-
...originalData._meta || {},
|
|
32284
|
-
// Preserve original _meta
|
|
32285
|
-
resolvedFromHologram: true,
|
|
32286
|
-
// This is now the primary indicator
|
|
32287
|
-
hologramSoul: hologram.soul
|
|
32288
|
-
// Clarified meta field
|
|
32289
|
-
}
|
|
32290
|
-
};
|
|
32291
|
-
} else {
|
|
32292
|
-
console.warn(`!!! Original data NOT FOUND for soul: ${hologram.soul}. Returning null.`);
|
|
32293
|
-
return null;
|
|
32279
|
+
console.warn(`!!! CIRCULAR hologram detected for soul: ${hologram.soul}. Breaking loop.`);
|
|
32280
|
+
return null;
|
|
32281
|
+
}
|
|
32282
|
+
try {
|
|
32283
|
+
if (hologram.soul) {
|
|
32284
|
+
const soulInfo = parseSoulPath(hologram.soul);
|
|
32285
|
+
if (!soulInfo) {
|
|
32286
|
+
console.warn(`Invalid soul format: ${hologram.soul}`);
|
|
32287
|
+
return null;
|
|
32288
|
+
}
|
|
32289
|
+
const nextVisited = new Set(visited);
|
|
32290
|
+
nextVisited.add(hologram.soul);
|
|
32291
|
+
const originalData = await holoInstance.get(
|
|
32292
|
+
soulInfo.holon,
|
|
32293
|
+
soulInfo.lens,
|
|
32294
|
+
soulInfo.key,
|
|
32295
|
+
null,
|
|
32296
|
+
{
|
|
32297
|
+
resolveHolograms: followHolograms,
|
|
32298
|
+
visited: nextVisited,
|
|
32299
|
+
maxDepth,
|
|
32300
|
+
currentDepth: currentDepth + 1
|
|
32294
32301
|
}
|
|
32302
|
+
);
|
|
32303
|
+
if (originalData && !originalData._invalidHologram) {
|
|
32304
|
+
return {
|
|
32305
|
+
...originalData,
|
|
32306
|
+
_meta: {
|
|
32307
|
+
...originalData._meta || {},
|
|
32308
|
+
// Preserve original _meta
|
|
32309
|
+
resolvedFromHologram: true,
|
|
32310
|
+
// This is now the primary indicator
|
|
32311
|
+
hologramSoul: hologram.soul,
|
|
32312
|
+
// Clarified meta field
|
|
32313
|
+
resolutionDepth: currentDepth
|
|
32314
|
+
}
|
|
32315
|
+
};
|
|
32295
32316
|
} else {
|
|
32296
|
-
console.warn(
|
|
32297
|
-
return
|
|
32317
|
+
console.warn(`!!! Original data NOT FOUND for soul: ${hologram.soul}. Removing broken hologram.`);
|
|
32318
|
+
return null;
|
|
32298
32319
|
}
|
|
32299
|
-
}
|
|
32300
|
-
console.
|
|
32301
|
-
return
|
|
32320
|
+
} else {
|
|
32321
|
+
console.warn("!!! resolveHologram called with object missing soul:", hologram);
|
|
32322
|
+
return null;
|
|
32302
32323
|
}
|
|
32324
|
+
} catch (error) {
|
|
32325
|
+
if (error.message?.startsWith("CIRCULAR_REFERENCE")) {
|
|
32326
|
+
console.warn(`!!! Circular reference detected during hologram resolution: ${error.message}`);
|
|
32327
|
+
return null;
|
|
32328
|
+
}
|
|
32329
|
+
console.error(`!!! Error resolving hologram: ${error.message}`, error);
|
|
32330
|
+
return null;
|
|
32303
32331
|
}
|
|
32304
32332
|
}
|
|
32305
32333
|
|
|
@@ -32673,7 +32701,7 @@ ${str(snapshot)}`);
|
|
|
32673
32701
|
}
|
|
32674
32702
|
|
|
32675
32703
|
// holosphere.js
|
|
32676
|
-
var HOLOSPHERE_VERSION = "1.1.
|
|
32704
|
+
var HOLOSPHERE_VERSION = "1.1.18";
|
|
32677
32705
|
var HoloSphere = class {
|
|
32678
32706
|
/**
|
|
32679
32707
|
* Initializes a new instance of the HoloSphere class.
|
|
@@ -32695,7 +32723,8 @@ ${str(snapshot)}`);
|
|
|
32695
32723
|
});
|
|
32696
32724
|
const defaultGunOptions = {
|
|
32697
32725
|
peers: ["https://gun.holons.io/gun", "https://59.src.eco/gun"],
|
|
32698
|
-
axe: false
|
|
32726
|
+
axe: false,
|
|
32727
|
+
localStorage: false
|
|
32699
32728
|
// Add other potential defaults here if needed
|
|
32700
32729
|
};
|
|
32701
32730
|
const finalGunOptions = { ...defaultGunOptions, ...gunOptions };
|
|
@@ -32788,6 +32817,24 @@ ${str(snapshot)}`);
|
|
|
32788
32817
|
async parse(rawData) {
|
|
32789
32818
|
return parse(this, rawData);
|
|
32790
32819
|
}
|
|
32820
|
+
/**
|
|
32821
|
+
* Filters an array of data, removing raw GunDB nodes and invalid entries.
|
|
32822
|
+
* @param {Array} dataArray - Array of data that might contain raw GunDB nodes
|
|
32823
|
+
* @returns {Promise<Array>} - Filtered array with only valid data
|
|
32824
|
+
*/
|
|
32825
|
+
async filterValidData(dataArray) {
|
|
32826
|
+
if (!Array.isArray(dataArray)) {
|
|
32827
|
+
return [];
|
|
32828
|
+
}
|
|
32829
|
+
const validData = [];
|
|
32830
|
+
for (const item of dataArray) {
|
|
32831
|
+
const parsed = await this.parse(item);
|
|
32832
|
+
if (parsed !== null) {
|
|
32833
|
+
validData.push(parsed);
|
|
32834
|
+
}
|
|
32835
|
+
}
|
|
32836
|
+
return validData;
|
|
32837
|
+
}
|
|
32791
32838
|
/**
|
|
32792
32839
|
* Deletes a specific key from a given holon and lens.
|
|
32793
32840
|
* @param {string} holon - The holon identifier.
|
|
@@ -33215,7 +33262,7 @@ ${str(snapshot)}`);
|
|
|
33215
33262
|
})();
|
|
33216
33263
|
/**
|
|
33217
33264
|
* @module holosphere
|
|
33218
|
-
* @version 1.1.
|
|
33265
|
+
* @version 1.1.18
|
|
33219
33266
|
* @description Holonic Geospatial Communication Infrastructure
|
|
33220
33267
|
* @author Roberto Valenti
|
|
33221
33268
|
* @license GPL-3.0-or-later
|