holosphere 1.1.18 → 1.1.20
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/content.js +2 -41
- package/holosphere-bundle.esm.js +18910 -18901
- package/holosphere-bundle.js +18910 -18901
- package/holosphere-bundle.min.js +18 -18
- package/holosphere.d.ts +31 -0
- package/holosphere.js +60 -28
- package/package.json +1 -1
package/content.js
CHANGED
|
@@ -639,57 +639,18 @@ export async function parse(holoInstance, rawData) {
|
|
|
639
639
|
} else if (rawData._) {
|
|
640
640
|
// Handle potential GunDB metadata remnants (attempt cleanup)
|
|
641
641
|
console.warn('Parsing raw Gun object with metadata (_) - attempting cleanup:', rawData);
|
|
642
|
-
|
|
643
|
-
// Enhanced cleanup for complex GunDB structures
|
|
644
642
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
645
643
|
if (k !== '_') {
|
|
646
|
-
|
|
647
|
-
if (rawData[k] && typeof rawData[k] === 'object' && rawData[k]._) {
|
|
648
|
-
// Recursively parse nested raw nodes
|
|
649
|
-
const parsedNested = parse(holoInstance, rawData[k]);
|
|
650
|
-
if (parsedNested !== null) {
|
|
651
|
-
acc[k] = parsedNested;
|
|
652
|
-
}
|
|
653
|
-
} else if (rawData[k] !== null) {
|
|
654
|
-
// Only include non-null values
|
|
655
|
-
acc[k] = rawData[k];
|
|
656
|
-
}
|
|
644
|
+
acc[k] = rawData[k];
|
|
657
645
|
}
|
|
658
646
|
return acc;
|
|
659
647
|
}, {});
|
|
660
|
-
|
|
661
648
|
if (Object.keys(potentialData).length === 0) {
|
|
662
|
-
console.warn('Raw Gun object had only metadata (_)
|
|
663
|
-
return null;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// Additional validation: check if the cleaned object has meaningful data
|
|
667
|
-
const hasValidData = Object.values(potentialData).some(value =>
|
|
668
|
-
value !== null && value !== undefined &&
|
|
669
|
-
(typeof value !== 'object' || Object.keys(value).length > 0)
|
|
670
|
-
);
|
|
671
|
-
|
|
672
|
-
if (!hasValidData) {
|
|
673
|
-
console.warn('Cleaned Gun object has no valid data, returning null.');
|
|
649
|
+
console.warn('Raw Gun object had only metadata (_), returning null.');
|
|
674
650
|
return null;
|
|
675
651
|
}
|
|
676
|
-
|
|
677
652
|
return potentialData; // Return cleaned-up object
|
|
678
653
|
} else {
|
|
679
|
-
// Check for objects that might be arrays of raw GunDB nodes
|
|
680
|
-
if (Array.isArray(rawData)) {
|
|
681
|
-
const cleanedArray = rawData
|
|
682
|
-
.map(item => parse(holoInstance, item))
|
|
683
|
-
.filter(item => item !== null);
|
|
684
|
-
|
|
685
|
-
if (cleanedArray.length === 0) {
|
|
686
|
-
console.warn('Array contained only invalid/raw GunDB nodes, returning null.');
|
|
687
|
-
return null;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
return cleanedArray;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
654
|
// Assume it's a regular plain object
|
|
694
655
|
return rawData;
|
|
695
656
|
}
|