holosphere 1.1.19 → 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/README.md +2 -173
- package/content.js +3 -45
- package/holosphere-bundle.esm.js +12 -1305
- package/holosphere-bundle.js +12 -1305
- package/holosphere-bundle.min.js +20 -30
- package/holosphere.d.ts +16 -19
- package/holosphere.js +16 -36
- package/package.json +3 -3
package/holosphere.d.ts
CHANGED
|
@@ -552,7 +552,19 @@ declare class HoloSphere {
|
|
|
552
552
|
*/
|
|
553
553
|
resetFederation(holonId: string, password?: string | null): Promise<boolean>;
|
|
554
554
|
|
|
555
|
-
// ================================
|
|
555
|
+
// ================================ UTILITY FUNCTIONS ================================
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Generates a unique ID for data items
|
|
559
|
+
* @returns {string} A unique ID
|
|
560
|
+
*/
|
|
561
|
+
generateId(): string;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Closes the HoloSphere instance and cleans up resources.
|
|
565
|
+
* @returns {Promise<void>}
|
|
566
|
+
*/
|
|
567
|
+
close(): Promise<void>;
|
|
556
568
|
|
|
557
569
|
/**
|
|
558
570
|
* Configures radisk storage options for GunDB.
|
|
@@ -566,7 +578,7 @@ declare class HoloSphere {
|
|
|
566
578
|
configureRadisk(options?: {
|
|
567
579
|
file?: string;
|
|
568
580
|
radisk?: boolean;
|
|
569
|
-
until?: number;
|
|
581
|
+
until?: number | null;
|
|
570
582
|
retry?: number;
|
|
571
583
|
timeout?: number;
|
|
572
584
|
}): void;
|
|
@@ -581,24 +593,9 @@ declare class HoloSphere {
|
|
|
581
593
|
retry: number;
|
|
582
594
|
timeout: number;
|
|
583
595
|
until: number | null;
|
|
584
|
-
peers:
|
|
596
|
+
peers: any[];
|
|
585
597
|
localStorage: boolean;
|
|
586
|
-
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
// ================================ UTILITY FUNCTIONS ================================
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Generates a unique ID for data items
|
|
593
|
-
* @returns {string} A unique ID
|
|
594
|
-
*/
|
|
595
|
-
generateId(): string;
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Closes the HoloSphere instance and cleans up resources.
|
|
599
|
-
* @returns {Promise<void>}
|
|
600
|
-
*/
|
|
601
|
-
close(): Promise<void>;
|
|
598
|
+
} | { error: string };
|
|
602
599
|
}
|
|
603
600
|
|
|
604
601
|
export default HoloSphere;
|
package/holosphere.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module holosphere
|
|
3
|
-
* @version 1.1.
|
|
3
|
+
* @version 1.1.17
|
|
4
4
|
* @description Holonic Geospatial Communication Infrastructure
|
|
5
5
|
* @author Roberto Valenti
|
|
6
6
|
* @license GPL-3.0-or-later
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import OpenAI from 'openai';
|
|
10
|
-
import Gun from 'gun'
|
|
11
|
-
import 'gun/lib/radisk.js';
|
|
10
|
+
import Gun from 'gun'
|
|
12
11
|
import Ajv2019 from 'ajv/dist/2019.js'
|
|
13
12
|
import * as Federation from './federation.js';
|
|
14
13
|
import * as SchemaOps from './schema.js';
|
|
@@ -20,7 +19,7 @@ import * as ComputeOps from './compute.js';
|
|
|
20
19
|
import * as Utils from './utils.js';
|
|
21
20
|
|
|
22
21
|
// Define the version constant
|
|
23
|
-
const HOLOSPHERE_VERSION = '1.1.
|
|
22
|
+
const HOLOSPHERE_VERSION = '1.1.20';
|
|
24
23
|
|
|
25
24
|
class HoloSphere {
|
|
26
25
|
/**
|
|
@@ -41,16 +40,19 @@ class HoloSphere {
|
|
|
41
40
|
});
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
// Define default Gun options
|
|
43
|
+
// Define default Gun options with radisk enabled
|
|
45
44
|
const defaultGunOptions = {
|
|
46
45
|
peers: ['https://gun.holons.io/gun'],
|
|
47
46
|
axe: false,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
file: './holosphere.db' // Default directory for radisk storage
|
|
51
|
-
// Add other potential defaults here if needed
|
|
47
|
+
radisk: true, // Enable radisk storage by default
|
|
48
|
+
file: './holosphere' // Default directory for radisk storage
|
|
52
49
|
};
|
|
53
50
|
|
|
51
|
+
// In browser environment, disable localStorage when radisk is enabled
|
|
52
|
+
if (typeof window !== 'undefined' && (gunOptions.radisk !== false)) {
|
|
53
|
+
defaultGunOptions.localStorage = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
54
56
|
// Merge provided options with defaults
|
|
55
57
|
const finalGunOptions = { ...defaultGunOptions, ...gunOptions };
|
|
56
58
|
console.log("Initializing Gun with options:", finalGunOptions);
|
|
@@ -168,27 +170,6 @@ class HoloSphere {
|
|
|
168
170
|
return ContentOps.parse(this, rawData);
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
/**
|
|
172
|
-
* Filters an array of data, removing raw GunDB nodes and invalid entries.
|
|
173
|
-
* @param {Array} dataArray - Array of data that might contain raw GunDB nodes
|
|
174
|
-
* @returns {Promise<Array>} - Filtered array with only valid data
|
|
175
|
-
*/
|
|
176
|
-
async filterValidData(dataArray) {
|
|
177
|
-
if (!Array.isArray(dataArray)) {
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const validData = [];
|
|
182
|
-
for (const item of dataArray) {
|
|
183
|
-
const parsed = await this.parse(item);
|
|
184
|
-
if (parsed !== null) {
|
|
185
|
-
validData.push(parsed);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return validData;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
173
|
/**
|
|
193
174
|
* Deletes a specific key from a given holon and lens.
|
|
194
175
|
* @param {string} holon - The holon identifier.
|
|
@@ -702,15 +683,14 @@ class HoloSphere {
|
|
|
702
683
|
retry: 3,
|
|
703
684
|
timeout: 5000
|
|
704
685
|
};
|
|
705
|
-
|
|
686
|
+
|
|
706
687
|
const radiskOptions = { ...defaultOptions, ...options };
|
|
707
688
|
|
|
708
|
-
// Update Gun instance with new radisk options
|
|
709
689
|
if (this.gun && this.gun._.opt) {
|
|
710
690
|
Object.assign(this.gun._.opt, radiskOptions);
|
|
711
|
-
console.log(
|
|
691
|
+
console.log("Radisk configuration updated:", radiskOptions);
|
|
712
692
|
} else {
|
|
713
|
-
console.warn(
|
|
693
|
+
console.warn("Gun instance not available for radisk configuration");
|
|
714
694
|
}
|
|
715
695
|
}
|
|
716
696
|
|
|
@@ -720,9 +700,9 @@ class HoloSphere {
|
|
|
720
700
|
*/
|
|
721
701
|
getRadiskStats() {
|
|
722
702
|
if (!this.gun || !this.gun._.opt) {
|
|
723
|
-
return { error:
|
|
703
|
+
return { error: "Gun instance not available" };
|
|
724
704
|
}
|
|
725
|
-
|
|
705
|
+
|
|
726
706
|
const options = this.gun._.opt;
|
|
727
707
|
return {
|
|
728
708
|
enabled: options.radisk || false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "holosphere",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20",
|
|
4
4
|
"description": "Holonic Geospatial Communication Infrastructure",
|
|
5
5
|
"main": "holosphere.js",
|
|
6
6
|
"module": "holosphere.js",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"webrtc"
|
|
90
90
|
],
|
|
91
91
|
"bugs": {
|
|
92
|
-
"url": "https://github.com/
|
|
92
|
+
"url": "https://github.com/rvalenti/holosphere/issues"
|
|
93
93
|
},
|
|
94
|
-
"homepage": "https://github.com/
|
|
94
|
+
"homepage": "https://github.com/rvalenti/holosphere#readme",
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"gun": "^0.2020.1240",
|
|
97
97
|
"h3-js": "^4.1.0"
|