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.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* HoloSphere ESM Bundle v1.1.
|
|
2
|
+
* HoloSphere ESM Bundle v1.1.18
|
|
3
3
|
* ES6 Module version with all dependencies bundled
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* import HoloSphere from 'https://unpkg.com/holosphere@1.1.
|
|
6
|
+
* import HoloSphere from 'https://unpkg.com/holosphere@1.1.18/holosphere-bundle.esm.js';
|
|
7
7
|
* const hs = new HoloSphere('myapp');
|
|
8
8
|
*/
|
|
9
9
|
var __create = Object.create;
|
|
@@ -30412,16 +30412,14 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30412
30412
|
result.messages.push(`No federation found for ${holon} or no notification targets available.`);
|
|
30413
30413
|
}
|
|
30414
30414
|
if (propagateToParents) {
|
|
30415
|
-
console.log(`[Federation] Starting parent propagation for holon: ${holon}`);
|
|
30416
30415
|
try {
|
|
30417
30416
|
let holonResolution;
|
|
30418
30417
|
let isValidH3 = false;
|
|
30419
|
-
if (typeof holon === "string" && holon
|
|
30418
|
+
if (typeof holon === "string" && /^[8][0-9A-Fa-f]+$/.test(holon) && holon.length >= 15) {
|
|
30420
30419
|
try {
|
|
30421
30420
|
holonResolution = getResolution(holon);
|
|
30422
30421
|
if (holonResolution >= 0 && holonResolution <= 15) {
|
|
30423
30422
|
isValidH3 = true;
|
|
30424
|
-
console.log(`[Federation] Holon ${holon} is valid H3 hexagon with resolution: ${holonResolution}`);
|
|
30425
30423
|
} else {
|
|
30426
30424
|
console.log(`[Federation] Holon ${holon} has invalid resolution: ${holonResolution}`);
|
|
30427
30425
|
}
|
|
@@ -30429,10 +30427,8 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30429
30427
|
console.log(`[Federation] Holon ${holon} failed H3 validation: ${error.message}`);
|
|
30430
30428
|
}
|
|
30431
30429
|
} else {
|
|
30432
|
-
console.log(`[Federation] Holon ${holon} is not a valid H3 hexagon: does not start with '8' or too short`);
|
|
30433
30430
|
}
|
|
30434
30431
|
if (!isValidH3) {
|
|
30435
|
-
console.log(`[Federation] Skipping parent propagation for non-H3 holon: ${holon}`);
|
|
30436
30432
|
result.parentPropagation.messages.push(`Holon ${holon} is not a valid H3 hexagon. Skipping parent propagation.`);
|
|
30437
30433
|
result.parentPropagation.skipped++;
|
|
30438
30434
|
}
|
|
@@ -30441,12 +30437,10 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30441
30437
|
let currentHolon = holon;
|
|
30442
30438
|
let currentRes = holonResolution;
|
|
30443
30439
|
let levelsProcessed = 0;
|
|
30444
|
-
console.log(`[Federation] Getting parent hexagons for ${holon} (resolution ${holonResolution}) up to ${maxParentLevels} levels`);
|
|
30445
30440
|
while (currentRes > 0 && levelsProcessed < maxParentLevels) {
|
|
30446
30441
|
try {
|
|
30447
30442
|
const parent = cellToParent(currentHolon, currentRes - 1);
|
|
30448
30443
|
parentHexagons.push(parent);
|
|
30449
|
-
console.log(`[Federation] Found parent hexagon: ${parent} (resolution ${currentRes - 1})`);
|
|
30450
30444
|
currentHolon = parent;
|
|
30451
30445
|
currentRes--;
|
|
30452
30446
|
levelsProcessed++;
|
|
@@ -30458,13 +30452,10 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30458
30452
|
}
|
|
30459
30453
|
}
|
|
30460
30454
|
if (parentHexagons.length > 0) {
|
|
30461
|
-
console.log(`[Federation] Found ${parentHexagons.length} parent hexagons to propagate to: ${parentHexagons.join(", ")}`);
|
|
30462
30455
|
result.parentPropagation.messages.push(`Found ${parentHexagons.length} parent hexagons to propagate to: ${parentHexagons.join(", ")}`);
|
|
30463
30456
|
const isAlreadyHologram = holosphere.isHologram(data);
|
|
30464
|
-
console.log(`[Federation] Data is already hologram: ${isAlreadyHologram}`);
|
|
30465
30457
|
const parentPropagatePromises = parentHexagons.map(async (parentHexagon) => {
|
|
30466
30458
|
try {
|
|
30467
|
-
console.log(`[Federation] Propagating to parent hexagon: ${parentHexagon}`);
|
|
30468
30459
|
let payloadToPut;
|
|
30469
30460
|
const parentFederationMeta = {
|
|
30470
30461
|
origin: holon,
|
|
@@ -30480,7 +30471,6 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30480
30471
|
};
|
|
30481
30472
|
if (useHolograms && !isAlreadyHologram) {
|
|
30482
30473
|
const newHologram = holosphere.createHologram(holon, lens, data);
|
|
30483
|
-
console.log(`[Federation] Created hologram for parent propagation:`, newHologram);
|
|
30484
30474
|
payloadToPut = {
|
|
30485
30475
|
...newHologram,
|
|
30486
30476
|
// This will be { id: data.id, soul: 'path/to/original' }
|
|
@@ -30497,7 +30487,6 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30497
30487
|
}
|
|
30498
30488
|
};
|
|
30499
30489
|
}
|
|
30500
|
-
console.log(`[Federation] Storing in parent hexagon ${parentHexagon} with payload:`, payloadToPut);
|
|
30501
30490
|
await holosphere.put(parentHexagon, lens, payloadToPut, null, {
|
|
30502
30491
|
disableHologramRedirection: true,
|
|
30503
30492
|
autoPropagate: false
|
|
@@ -30514,7 +30503,6 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30514
30503
|
});
|
|
30515
30504
|
await Promise.all(parentPropagatePromises);
|
|
30516
30505
|
} else {
|
|
30517
|
-
console.log(`[Federation] No parent hexagons found for ${holon} (already at resolution 0 or max levels reached)`);
|
|
30518
30506
|
result.parentPropagation.messages.push(`No parent hexagons found for ${holon} (already at resolution 0 or max levels reached)`);
|
|
30519
30507
|
result.parentPropagation.skipped++;
|
|
30520
30508
|
}
|
|
@@ -30524,8 +30512,6 @@ async function propagate(holosphere, holon, lens, data, options = {}) {
|
|
|
30524
30512
|
result.parentPropagation.errors++;
|
|
30525
30513
|
result.parentPropagation.messages.push(`Error during parent propagation: ${error.message}`);
|
|
30526
30514
|
}
|
|
30527
|
-
} else {
|
|
30528
|
-
console.log(`[Federation] Parent propagation disabled for holon: ${holon}`);
|
|
30529
30515
|
}
|
|
30530
30516
|
result.propagated = result.success > 0 || result.parentPropagation.success > 0;
|
|
30531
30517
|
return result;
|
|
@@ -30769,7 +30755,6 @@ async function put(holoInstance, holon, lens, data, password = null, options = {
|
|
|
30769
30755
|
if (soulInfo.appname !== holoInstance.appname) {
|
|
30770
30756
|
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.`);
|
|
30771
30757
|
}
|
|
30772
|
-
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}.`);
|
|
30773
30758
|
targetHolon = soulInfo.holon;
|
|
30774
30759
|
targetLens = soulInfo.lens;
|
|
30775
30760
|
targetKey = soulInfo.key;
|
|
@@ -30860,7 +30845,6 @@ async function put(holoInstance, holon, lens, data, password = null, options = {
|
|
|
30860
30845
|
const targetNodeRef = holoInstance.getNodeRef(data.soul);
|
|
30861
30846
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${targetHolon}/${targetLens}/${targetKey}`;
|
|
30862
30847
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
30863
|
-
console.log(`Data (ID: ${data.id}) being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${data.soul}'s _holograms set.`);
|
|
30864
30848
|
} else {
|
|
30865
30849
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${data.soul} for tracking.`);
|
|
30866
30850
|
}
|
|
@@ -30881,7 +30865,6 @@ async function put(holoInstance, holon, lens, data, password = null, options = {
|
|
|
30881
30865
|
// Only active holograms (deleted ones are null/removed)
|
|
30882
30866
|
);
|
|
30883
30867
|
if (hologramSouls.length > 0) {
|
|
30884
|
-
console.log(`Updating ${hologramSouls.length} active holograms for data ${data.id}`);
|
|
30885
30868
|
const updatePromises = hologramSouls.map(async (hologramSoul) => {
|
|
30886
30869
|
try {
|
|
30887
30870
|
const hologramSoulInfo = holoInstance.parseSoulPath(hologramSoul);
|
|
@@ -30912,7 +30895,6 @@ async function put(holoInstance, holon, lens, data, password = null, options = {
|
|
|
30912
30895
|
// Prevent recursive hologram updates
|
|
30913
30896
|
}
|
|
30914
30897
|
);
|
|
30915
|
-
console.log(`Updated hologram at ${hologramSoul} with timestamp`);
|
|
30916
30898
|
updatedHolograms.push({
|
|
30917
30899
|
soul: hologramSoul,
|
|
30918
30900
|
holon: hologramSoulInfo.holon,
|
|
@@ -31037,16 +31019,22 @@ async function get(holoInstance, holon, lens, key, password = null, options = {}
|
|
|
31037
31019
|
if (resolveHolograms && holoInstance.isHologram(parsed)) {
|
|
31038
31020
|
const resolvedValue = await holoInstance.resolveHologram(parsed, {
|
|
31039
31021
|
followHolograms: resolveHolograms,
|
|
31040
|
-
visited
|
|
31022
|
+
visited,
|
|
31023
|
+
maxDepth: options.maxDepth || 10,
|
|
31024
|
+
currentDepth: options.currentDepth || 0
|
|
31041
31025
|
});
|
|
31042
|
-
console.log(`### get/handleData received resolved value:`, resolvedValue);
|
|
31043
31026
|
if (resolvedValue === null) {
|
|
31044
|
-
console.warn(`
|
|
31027
|
+
console.warn(`Broken hologram detected at ${holon}/${lens}/${key}. Removing it...`);
|
|
31028
|
+
try {
|
|
31029
|
+
await holoInstance.delete(holon, lens, key, password);
|
|
31030
|
+
console.log(`Successfully removed broken hologram from ${holon}/${lens}/${key}`);
|
|
31031
|
+
} catch (cleanupError) {
|
|
31032
|
+
console.error(`Failed to remove broken hologram at ${holon}/${lens}/${key}:`, cleanupError);
|
|
31033
|
+
}
|
|
31045
31034
|
resolve(null);
|
|
31046
31035
|
return;
|
|
31047
31036
|
}
|
|
31048
31037
|
if (resolvedValue !== parsed) {
|
|
31049
|
-
console.log(`### get/handleData using resolved data:`, resolvedValue);
|
|
31050
31038
|
parsed = resolvedValue;
|
|
31051
31039
|
}
|
|
31052
31040
|
}
|
|
@@ -31138,18 +31126,35 @@ async function getAll(holoInstance, holon, lens, password = null) {
|
|
|
31138
31126
|
const parsed = await holoInstance.parse(data);
|
|
31139
31127
|
if (!parsed || !parsed.id) return;
|
|
31140
31128
|
if (holoInstance.isHologram(parsed)) {
|
|
31141
|
-
|
|
31142
|
-
|
|
31143
|
-
|
|
31144
|
-
|
|
31145
|
-
|
|
31146
|
-
|
|
31147
|
-
|
|
31129
|
+
try {
|
|
31130
|
+
const resolved = await holoInstance.resolveHologram(parsed, {
|
|
31131
|
+
followHolograms: true,
|
|
31132
|
+
maxDepth: 10,
|
|
31133
|
+
currentDepth: 0
|
|
31134
|
+
});
|
|
31135
|
+
if (resolved === null) {
|
|
31136
|
+
console.warn(`Broken hologram detected in getAll for key ${key}. Removing it...`);
|
|
31137
|
+
try {
|
|
31138
|
+
await holoInstance.delete(holon, lens, key, password);
|
|
31139
|
+
console.log(`Successfully removed broken hologram from ${holon}/${lens}/${key}`);
|
|
31140
|
+
} catch (cleanupError) {
|
|
31141
|
+
console.error(`Failed to remove broken hologram at ${holon}/${lens}/${key}:`, cleanupError);
|
|
31142
|
+
}
|
|
31143
|
+
return;
|
|
31144
|
+
}
|
|
31145
|
+
if (resolved && resolved !== parsed) {
|
|
31146
|
+
if (schema) {
|
|
31147
|
+
const valid = holoInstance.validator.validate(schema, resolved);
|
|
31148
|
+
if (valid || !holoInstance.strict) {
|
|
31149
|
+
output.set(resolved.id, resolved);
|
|
31150
|
+
}
|
|
31151
|
+
} else {
|
|
31148
31152
|
output.set(resolved.id, resolved);
|
|
31149
31153
|
}
|
|
31150
|
-
|
|
31151
|
-
output.set(resolved.id, resolved);
|
|
31154
|
+
return;
|
|
31152
31155
|
}
|
|
31156
|
+
} catch (hologramError) {
|
|
31157
|
+
console.error(`Error resolving hologram for key ${key}:`, hologramError);
|
|
31153
31158
|
return;
|
|
31154
31159
|
}
|
|
31155
31160
|
}
|
|
@@ -31212,16 +31217,38 @@ async function parse(holoInstance, rawData) {
|
|
|
31212
31217
|
console.warn("Parsing raw Gun object with metadata (_) - attempting cleanup:", rawData);
|
|
31213
31218
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
31214
31219
|
if (k !== "_") {
|
|
31215
|
-
|
|
31220
|
+
if (rawData[k] && typeof rawData[k] === "object" && rawData[k]._) {
|
|
31221
|
+
const parsedNested = parse(holoInstance, rawData[k]);
|
|
31222
|
+
if (parsedNested !== null) {
|
|
31223
|
+
acc[k] = parsedNested;
|
|
31224
|
+
}
|
|
31225
|
+
} else if (rawData[k] !== null) {
|
|
31226
|
+
acc[k] = rawData[k];
|
|
31227
|
+
}
|
|
31216
31228
|
}
|
|
31217
31229
|
return acc;
|
|
31218
31230
|
}, {});
|
|
31219
31231
|
if (Object.keys(potentialData).length === 0) {
|
|
31220
|
-
console.warn("Raw Gun object had only metadata (_), returning null.");
|
|
31232
|
+
console.warn("Raw Gun object had only metadata (_) or null values, returning null.");
|
|
31233
|
+
return null;
|
|
31234
|
+
}
|
|
31235
|
+
const hasValidData = Object.values(potentialData).some(
|
|
31236
|
+
(value) => value !== null && value !== void 0 && (typeof value !== "object" || Object.keys(value).length > 0)
|
|
31237
|
+
);
|
|
31238
|
+
if (!hasValidData) {
|
|
31239
|
+
console.warn("Cleaned Gun object has no valid data, returning null.");
|
|
31221
31240
|
return null;
|
|
31222
31241
|
}
|
|
31223
31242
|
return potentialData;
|
|
31224
31243
|
} else {
|
|
31244
|
+
if (Array.isArray(rawData)) {
|
|
31245
|
+
const cleanedArray = rawData.map((item) => parse(holoInstance, item)).filter((item) => item !== null);
|
|
31246
|
+
if (cleanedArray.length === 0) {
|
|
31247
|
+
console.warn("Array contained only invalid/raw GunDB nodes, returning null.");
|
|
31248
|
+
return null;
|
|
31249
|
+
}
|
|
31250
|
+
return cleanedArray;
|
|
31251
|
+
}
|
|
31225
31252
|
return rawData;
|
|
31226
31253
|
}
|
|
31227
31254
|
}
|
|
@@ -31300,7 +31327,6 @@ async function deleteFunc(holoInstance, holon, lens, key, password = null) {
|
|
|
31300
31327
|
if (ack.err) {
|
|
31301
31328
|
console.warn(`[deleteFunc] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31302
31329
|
}
|
|
31303
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31304
31330
|
resolveTrack();
|
|
31305
31331
|
});
|
|
31306
31332
|
});
|
|
@@ -31412,7 +31438,6 @@ async function deleteAll(holoInstance, holon, lens, password = null) {
|
|
|
31412
31438
|
if (ack.err) {
|
|
31413
31439
|
console.warn(`[deleteAll] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31414
31440
|
}
|
|
31415
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31416
31441
|
resolveTrack();
|
|
31417
31442
|
});
|
|
31418
31443
|
});
|
|
@@ -31477,7 +31502,6 @@ async function putNode(holoInstance, holon, lens, data) {
|
|
|
31477
31502
|
const targetNodeRef = holoInstance.getNodeRef(data.value.soul);
|
|
31478
31503
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${holon}/${lens}/value`;
|
|
31479
31504
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31480
|
-
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.`);
|
|
31481
31505
|
} else {
|
|
31482
31506
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${data.value.soul} for tracking.`);
|
|
31483
31507
|
}
|
|
@@ -31584,7 +31608,6 @@ async function deleteNode(holoInstance, holon, lens, key) {
|
|
|
31584
31608
|
if (ack.err) {
|
|
31585
31609
|
console.warn(`[deleteNode] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
31586
31610
|
}
|
|
31587
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
31588
31611
|
resolveTrack();
|
|
31589
31612
|
});
|
|
31590
31613
|
});
|
|
@@ -31682,7 +31705,6 @@ async function putGlobal(holoInstance, tableName, data, password = null) {
|
|
|
31682
31705
|
const targetNodeRef = holoInstance.getNodeRef(dataToStore.soul);
|
|
31683
31706
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${tableName}/${data.id}`;
|
|
31684
31707
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31685
|
-
console.log(`Data (ID: ${data.id}) being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${dataToStore.soul}'s _holograms set.`);
|
|
31686
31708
|
} else {
|
|
31687
31709
|
console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${dataToStore.soul} for tracking.`);
|
|
31688
31710
|
}
|
|
@@ -31705,7 +31727,6 @@ async function putGlobal(holoInstance, tableName, data, password = null) {
|
|
|
31705
31727
|
const targetNodeRef = holoInstance.getNodeRef(dataToStore.soul);
|
|
31706
31728
|
const storedHologramInstanceSoul = `${holoInstance.appname}/${tableName}`;
|
|
31707
31729
|
targetNodeRef.get("_holograms").get(storedHologramInstanceSoul).put(true);
|
|
31708
|
-
console.log(`Data being put is a hologram. Added its instance soul ${storedHologramInstanceSoul} to its target ${dataToStore.soul}'s _holograms set.`);
|
|
31709
31730
|
} else {
|
|
31710
31731
|
console.warn(`Data being put is a hologram, but could not parse its soul ${dataToStore.soul} for tracking.`);
|
|
31711
31732
|
}
|
|
@@ -31789,7 +31810,6 @@ async function getGlobal(holoInstance, tableName, key, password = null) {
|
|
|
31789
31810
|
// Always follow holograms
|
|
31790
31811
|
});
|
|
31791
31812
|
if (resolved === null) {
|
|
31792
|
-
console.log(`Hologram at ${tableName}/${key} points to non-existent data. Deleting hologram.`);
|
|
31793
31813
|
try {
|
|
31794
31814
|
await holoInstance.deleteGlobal(tableName, key, password);
|
|
31795
31815
|
} catch (deleteError) {
|
|
@@ -31899,7 +31919,6 @@ async function getAllGlobal(holoInstance, tableName, password = null) {
|
|
|
31899
31919
|
// Always follow holograms
|
|
31900
31920
|
});
|
|
31901
31921
|
if (resolved === null) {
|
|
31902
|
-
console.log(`Hologram at ${tableName}/${key} points to non-existent data. Deleting hologram.`);
|
|
31903
31922
|
try {
|
|
31904
31923
|
await holoInstance.deleteGlobal(tableName, key, password);
|
|
31905
31924
|
} catch (deleteError) {
|
|
@@ -32013,7 +32032,6 @@ async function deleteGlobal(holoInstance, tableName, key, password = null) {
|
|
|
32013
32032
|
if (ack.err) {
|
|
32014
32033
|
console.warn(`[deleteGlobal] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
32015
32034
|
}
|
|
32016
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
32017
32035
|
resolveTrack();
|
|
32018
32036
|
});
|
|
32019
32037
|
});
|
|
@@ -32132,7 +32150,6 @@ async function deleteAllGlobal(holoInstance, tableName, password = null) {
|
|
|
32132
32150
|
if (ack.err) {
|
|
32133
32151
|
console.warn(`[deleteAllGlobal] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
|
|
32134
32152
|
}
|
|
32135
|
-
console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
|
|
32136
32153
|
resolveTrack();
|
|
32137
32154
|
});
|
|
32138
32155
|
});
|
|
@@ -32184,7 +32201,6 @@ async function deleteAllGlobal(holoInstance, tableName, password = null) {
|
|
|
32184
32201
|
// hologram.js
|
|
32185
32202
|
function createHologram(holoInstance, holon, lens, data) {
|
|
32186
32203
|
if (isHologram(data)) {
|
|
32187
|
-
console.warn("createHologram called with data that is already a hologram. Reusing existing soul:", data.soul);
|
|
32188
32204
|
return {
|
|
32189
32205
|
id: data.id,
|
|
32190
32206
|
soul: data.soul
|
|
@@ -32226,57 +32242,69 @@ async function resolveHologram(holoInstance, hologram, options = {}) {
|
|
|
32226
32242
|
if (!isHologram(hologram)) {
|
|
32227
32243
|
return hologram;
|
|
32228
32244
|
}
|
|
32229
|
-
const {
|
|
32245
|
+
const {
|
|
32246
|
+
followHolograms = true,
|
|
32247
|
+
visited = /* @__PURE__ */ new Set(),
|
|
32248
|
+
maxDepth = 10,
|
|
32249
|
+
currentDepth = 0
|
|
32250
|
+
} = options;
|
|
32251
|
+
if (currentDepth >= maxDepth) {
|
|
32252
|
+
console.warn(`!!! Maximum resolution depth (${maxDepth}) reached for soul: ${hologram.soul}. Stopping resolution.`);
|
|
32253
|
+
return null;
|
|
32254
|
+
}
|
|
32230
32255
|
if (hologram.soul && visited.has(hologram.soul)) {
|
|
32231
|
-
console.warn(`!!! CIRCULAR hologram detected for soul: ${hologram.soul}.
|
|
32232
|
-
|
|
32233
|
-
}
|
|
32234
|
-
|
|
32235
|
-
|
|
32236
|
-
|
|
32237
|
-
|
|
32238
|
-
|
|
32239
|
-
|
|
32240
|
-
|
|
32241
|
-
|
|
32242
|
-
|
|
32243
|
-
|
|
32244
|
-
|
|
32245
|
-
|
|
32246
|
-
|
|
32247
|
-
|
|
32248
|
-
|
|
32249
|
-
|
|
32250
|
-
|
|
32251
|
-
|
|
32252
|
-
|
|
32253
|
-
);
|
|
32254
|
-
console.log("### resolveHologram received originalData:", originalData);
|
|
32255
|
-
if (originalData) {
|
|
32256
|
-
console.log(`### Returning RESOLVED data for soul: ${hologram.soul}`);
|
|
32257
|
-
return {
|
|
32258
|
-
...originalData,
|
|
32259
|
-
_meta: {
|
|
32260
|
-
...originalData._meta || {},
|
|
32261
|
-
// Preserve original _meta
|
|
32262
|
-
resolvedFromHologram: true,
|
|
32263
|
-
// This is now the primary indicator
|
|
32264
|
-
hologramSoul: hologram.soul
|
|
32265
|
-
// Clarified meta field
|
|
32266
|
-
}
|
|
32267
|
-
};
|
|
32268
|
-
} else {
|
|
32269
|
-
console.warn(`!!! Original data NOT FOUND for soul: ${hologram.soul}. Returning null.`);
|
|
32270
|
-
return null;
|
|
32256
|
+
console.warn(`!!! CIRCULAR hologram detected for soul: ${hologram.soul}. Breaking loop.`);
|
|
32257
|
+
return null;
|
|
32258
|
+
}
|
|
32259
|
+
try {
|
|
32260
|
+
if (hologram.soul) {
|
|
32261
|
+
const soulInfo = parseSoulPath(hologram.soul);
|
|
32262
|
+
if (!soulInfo) {
|
|
32263
|
+
console.warn(`Invalid soul format: ${hologram.soul}`);
|
|
32264
|
+
return null;
|
|
32265
|
+
}
|
|
32266
|
+
const nextVisited = new Set(visited);
|
|
32267
|
+
nextVisited.add(hologram.soul);
|
|
32268
|
+
const originalData = await holoInstance.get(
|
|
32269
|
+
soulInfo.holon,
|
|
32270
|
+
soulInfo.lens,
|
|
32271
|
+
soulInfo.key,
|
|
32272
|
+
null,
|
|
32273
|
+
{
|
|
32274
|
+
resolveHolograms: followHolograms,
|
|
32275
|
+
visited: nextVisited,
|
|
32276
|
+
maxDepth,
|
|
32277
|
+
currentDepth: currentDepth + 1
|
|
32271
32278
|
}
|
|
32279
|
+
);
|
|
32280
|
+
if (originalData && !originalData._invalidHologram) {
|
|
32281
|
+
return {
|
|
32282
|
+
...originalData,
|
|
32283
|
+
_meta: {
|
|
32284
|
+
...originalData._meta || {},
|
|
32285
|
+
// Preserve original _meta
|
|
32286
|
+
resolvedFromHologram: true,
|
|
32287
|
+
// This is now the primary indicator
|
|
32288
|
+
hologramSoul: hologram.soul,
|
|
32289
|
+
// Clarified meta field
|
|
32290
|
+
resolutionDepth: currentDepth
|
|
32291
|
+
}
|
|
32292
|
+
};
|
|
32272
32293
|
} else {
|
|
32273
|
-
console.warn(
|
|
32274
|
-
return
|
|
32294
|
+
console.warn(`!!! Original data NOT FOUND for soul: ${hologram.soul}. Removing broken hologram.`);
|
|
32295
|
+
return null;
|
|
32275
32296
|
}
|
|
32276
|
-
}
|
|
32277
|
-
console.
|
|
32278
|
-
return
|
|
32297
|
+
} else {
|
|
32298
|
+
console.warn("!!! resolveHologram called with object missing soul:", hologram);
|
|
32299
|
+
return null;
|
|
32279
32300
|
}
|
|
32301
|
+
} catch (error) {
|
|
32302
|
+
if (error.message?.startsWith("CIRCULAR_REFERENCE")) {
|
|
32303
|
+
console.warn(`!!! Circular reference detected during hologram resolution: ${error.message}`);
|
|
32304
|
+
return null;
|
|
32305
|
+
}
|
|
32306
|
+
console.error(`!!! Error resolving hologram: ${error.message}`, error);
|
|
32307
|
+
return null;
|
|
32280
32308
|
}
|
|
32281
32309
|
}
|
|
32282
32310
|
|
|
@@ -32650,7 +32678,7 @@ function userName(holoInstance, holonId) {
|
|
|
32650
32678
|
}
|
|
32651
32679
|
|
|
32652
32680
|
// holosphere.js
|
|
32653
|
-
var HOLOSPHERE_VERSION = "1.1.
|
|
32681
|
+
var HOLOSPHERE_VERSION = "1.1.18";
|
|
32654
32682
|
var HoloSphere = class {
|
|
32655
32683
|
/**
|
|
32656
32684
|
* Initializes a new instance of the HoloSphere class.
|
|
@@ -32672,7 +32700,8 @@ var HoloSphere = class {
|
|
|
32672
32700
|
});
|
|
32673
32701
|
const defaultGunOptions = {
|
|
32674
32702
|
peers: ["https://gun.holons.io/gun", "https://59.src.eco/gun"],
|
|
32675
|
-
axe: false
|
|
32703
|
+
axe: false,
|
|
32704
|
+
localStorage: false
|
|
32676
32705
|
// Add other potential defaults here if needed
|
|
32677
32706
|
};
|
|
32678
32707
|
const finalGunOptions = { ...defaultGunOptions, ...gunOptions };
|
|
@@ -32765,6 +32794,24 @@ var HoloSphere = class {
|
|
|
32765
32794
|
async parse(rawData) {
|
|
32766
32795
|
return parse(this, rawData);
|
|
32767
32796
|
}
|
|
32797
|
+
/**
|
|
32798
|
+
* Filters an array of data, removing raw GunDB nodes and invalid entries.
|
|
32799
|
+
* @param {Array} dataArray - Array of data that might contain raw GunDB nodes
|
|
32800
|
+
* @returns {Promise<Array>} - Filtered array with only valid data
|
|
32801
|
+
*/
|
|
32802
|
+
async filterValidData(dataArray) {
|
|
32803
|
+
if (!Array.isArray(dataArray)) {
|
|
32804
|
+
return [];
|
|
32805
|
+
}
|
|
32806
|
+
const validData = [];
|
|
32807
|
+
for (const item of dataArray) {
|
|
32808
|
+
const parsed = await this.parse(item);
|
|
32809
|
+
if (parsed !== null) {
|
|
32810
|
+
validData.push(parsed);
|
|
32811
|
+
}
|
|
32812
|
+
}
|
|
32813
|
+
return validData;
|
|
32814
|
+
}
|
|
32768
32815
|
/**
|
|
32769
32816
|
* Deletes a specific key from a given holon and lens.
|
|
32770
32817
|
* @param {string} holon - The holon identifier.
|
|
@@ -33193,7 +33240,7 @@ export {
|
|
|
33193
33240
|
};
|
|
33194
33241
|
/**
|
|
33195
33242
|
* @module holosphere
|
|
33196
|
-
* @version 1.1.
|
|
33243
|
+
* @version 1.1.18
|
|
33197
33244
|
* @description Holonic Geospatial Communication Infrastructure
|
|
33198
33245
|
* @author Roberto Valenti
|
|
33199
33246
|
* @license GPL-3.0-or-later
|