holosphere 1.1.17 → 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/content.js +41 -2
- package/holosphere-bundle.esm.js +48 -7
- package/holosphere-bundle.js +48 -7
- package/holosphere-bundle.min.js +14 -14
- package/holosphere.js +25 -3
- package/package.json +1 -1
package/content.js
CHANGED
|
@@ -639,18 +639,57 @@ 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
|
|
642
644
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
643
645
|
if (k !== '_') {
|
|
644
|
-
|
|
646
|
+
// Handle nested raw GunDB nodes
|
|
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
|
+
}
|
|
645
657
|
}
|
|
646
658
|
return acc;
|
|
647
659
|
}, {});
|
|
660
|
+
|
|
648
661
|
if (Object.keys(potentialData).length === 0) {
|
|
649
|
-
console.warn('Raw Gun object had only metadata (_), returning null.');
|
|
662
|
+
console.warn('Raw Gun object had only metadata (_) or null values, returning null.');
|
|
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.');
|
|
650
674
|
return null;
|
|
651
675
|
}
|
|
676
|
+
|
|
652
677
|
return potentialData; // Return cleaned-up object
|
|
653
678
|
} 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
|
+
|
|
654
693
|
// Assume it's a regular plain object
|
|
655
694
|
return rawData;
|
|
656
695
|
}
|
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;
|
|
@@ -31217,16 +31217,38 @@ async function parse(holoInstance, rawData) {
|
|
|
31217
31217
|
console.warn("Parsing raw Gun object with metadata (_) - attempting cleanup:", rawData);
|
|
31218
31218
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
31219
31219
|
if (k !== "_") {
|
|
31220
|
-
|
|
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
|
+
}
|
|
31221
31228
|
}
|
|
31222
31229
|
return acc;
|
|
31223
31230
|
}, {});
|
|
31224
31231
|
if (Object.keys(potentialData).length === 0) {
|
|
31225
|
-
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.");
|
|
31226
31240
|
return null;
|
|
31227
31241
|
}
|
|
31228
31242
|
return potentialData;
|
|
31229
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
|
+
}
|
|
31230
31252
|
return rawData;
|
|
31231
31253
|
}
|
|
31232
31254
|
}
|
|
@@ -32656,7 +32678,7 @@ function userName(holoInstance, holonId) {
|
|
|
32656
32678
|
}
|
|
32657
32679
|
|
|
32658
32680
|
// holosphere.js
|
|
32659
|
-
var HOLOSPHERE_VERSION = "1.1.
|
|
32681
|
+
var HOLOSPHERE_VERSION = "1.1.18";
|
|
32660
32682
|
var HoloSphere = class {
|
|
32661
32683
|
/**
|
|
32662
32684
|
* Initializes a new instance of the HoloSphere class.
|
|
@@ -32678,7 +32700,8 @@ var HoloSphere = class {
|
|
|
32678
32700
|
});
|
|
32679
32701
|
const defaultGunOptions = {
|
|
32680
32702
|
peers: ["https://gun.holons.io/gun", "https://59.src.eco/gun"],
|
|
32681
|
-
axe: false
|
|
32703
|
+
axe: false,
|
|
32704
|
+
localStorage: false
|
|
32682
32705
|
// Add other potential defaults here if needed
|
|
32683
32706
|
};
|
|
32684
32707
|
const finalGunOptions = { ...defaultGunOptions, ...gunOptions };
|
|
@@ -32771,6 +32794,24 @@ var HoloSphere = class {
|
|
|
32771
32794
|
async parse(rawData) {
|
|
32772
32795
|
return parse(this, rawData);
|
|
32773
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
|
+
}
|
|
32774
32815
|
/**
|
|
32775
32816
|
* Deletes a specific key from a given holon and lens.
|
|
32776
32817
|
* @param {string} holon - The holon identifier.
|
|
@@ -33199,7 +33240,7 @@ export {
|
|
|
33199
33240
|
};
|
|
33200
33241
|
/**
|
|
33201
33242
|
* @module holosphere
|
|
33202
|
-
* @version 1.1.
|
|
33243
|
+
* @version 1.1.18
|
|
33203
33244
|
* @description Holonic Geospatial Communication Infrastructure
|
|
33204
33245
|
* @author Roberto Valenti
|
|
33205
33246
|
* @license GPL-3.0-or-later
|
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>
|
|
@@ -31240,16 +31240,38 @@ ${str(snapshot)}`);
|
|
|
31240
31240
|
console.warn("Parsing raw Gun object with metadata (_) - attempting cleanup:", rawData);
|
|
31241
31241
|
const potentialData = Object.keys(rawData).reduce((acc, k) => {
|
|
31242
31242
|
if (k !== "_") {
|
|
31243
|
-
|
|
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
|
+
}
|
|
31244
31251
|
}
|
|
31245
31252
|
return acc;
|
|
31246
31253
|
}, {});
|
|
31247
31254
|
if (Object.keys(potentialData).length === 0) {
|
|
31248
|
-
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.");
|
|
31249
31263
|
return null;
|
|
31250
31264
|
}
|
|
31251
31265
|
return potentialData;
|
|
31252
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
|
+
}
|
|
31253
31275
|
return rawData;
|
|
31254
31276
|
}
|
|
31255
31277
|
}
|
|
@@ -32679,7 +32701,7 @@ ${str(snapshot)}`);
|
|
|
32679
32701
|
}
|
|
32680
32702
|
|
|
32681
32703
|
// holosphere.js
|
|
32682
|
-
var HOLOSPHERE_VERSION = "1.1.
|
|
32704
|
+
var HOLOSPHERE_VERSION = "1.1.18";
|
|
32683
32705
|
var HoloSphere = class {
|
|
32684
32706
|
/**
|
|
32685
32707
|
* Initializes a new instance of the HoloSphere class.
|
|
@@ -32701,7 +32723,8 @@ ${str(snapshot)}`);
|
|
|
32701
32723
|
});
|
|
32702
32724
|
const defaultGunOptions = {
|
|
32703
32725
|
peers: ["https://gun.holons.io/gun", "https://59.src.eco/gun"],
|
|
32704
|
-
axe: false
|
|
32726
|
+
axe: false,
|
|
32727
|
+
localStorage: false
|
|
32705
32728
|
// Add other potential defaults here if needed
|
|
32706
32729
|
};
|
|
32707
32730
|
const finalGunOptions = { ...defaultGunOptions, ...gunOptions };
|
|
@@ -32794,6 +32817,24 @@ ${str(snapshot)}`);
|
|
|
32794
32817
|
async parse(rawData) {
|
|
32795
32818
|
return parse(this, rawData);
|
|
32796
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
|
+
}
|
|
32797
32838
|
/**
|
|
32798
32839
|
* Deletes a specific key from a given holon and lens.
|
|
32799
32840
|
* @param {string} holon - The holon identifier.
|
|
@@ -33221,7 +33262,7 @@ ${str(snapshot)}`);
|
|
|
33221
33262
|
})();
|
|
33222
33263
|
/**
|
|
33223
33264
|
* @module holosphere
|
|
33224
|
-
* @version 1.1.
|
|
33265
|
+
* @version 1.1.18
|
|
33225
33266
|
* @description Holonic Geospatial Communication Infrastructure
|
|
33226
33267
|
* @author Roberto Valenti
|
|
33227
33268
|
* @license GPL-3.0-or-later
|