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/holosphere.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module holosphere
3
- * @version 1.1.12
3
+ * @version 1.1.18
4
4
  * @description Holonic Geospatial Communication Infrastructure
5
5
  * @author Roberto Valenti
6
6
  * @license GPL-3.0-or-later
@@ -20,7 +20,7 @@ import * as ComputeOps from './compute.js';
20
20
  import * as Utils from './utils.js';
21
21
 
22
22
  // Define the version constant
23
- const HOLOSPHERE_VERSION = '1.1.16';
23
+ const HOLOSPHERE_VERSION = '1.1.18';
24
24
 
25
25
  class HoloSphere {
26
26
  /**
@@ -44,7 +44,8 @@ class HoloSphere {
44
44
  // Define default Gun options
45
45
  const defaultGunOptions = {
46
46
  peers: ['https://gun.holons.io/gun','https://59.src.eco/gun'],
47
- axe: false
47
+ axe: false,
48
+ localStorage: false
48
49
  // Add other potential defaults here if needed
49
50
  };
50
51
 
@@ -165,6 +166,27 @@ class HoloSphere {
165
166
  return ContentOps.parse(this, rawData);
166
167
  }
167
168
 
169
+ /**
170
+ * Filters an array of data, removing raw GunDB nodes and invalid entries.
171
+ * @param {Array} dataArray - Array of data that might contain raw GunDB nodes
172
+ * @returns {Promise<Array>} - Filtered array with only valid data
173
+ */
174
+ async filterValidData(dataArray) {
175
+ if (!Array.isArray(dataArray)) {
176
+ return [];
177
+ }
178
+
179
+ const validData = [];
180
+ for (const item of dataArray) {
181
+ const parsed = await this.parse(item);
182
+ if (parsed !== null) {
183
+ validData.push(parsed);
184
+ }
185
+ }
186
+
187
+ return validData;
188
+ }
189
+
168
190
  /**
169
191
  * Deletes a specific key from a given holon and lens.
170
192
  * @param {string} holon - The holon identifier.
package/node.js CHANGED
@@ -39,10 +39,8 @@ export async function putNode(holoInstance, holon, lens, data) {
39
39
  // Soul of the hologram that was *actually stored* at holon/lens/value
40
40
  const storedHologramInstanceSoul = `${holoInstance.appname}/${holon}/${lens}/value`;
41
41
 
42
- targetNodeRef.get('_holograms').get(storedHologramInstanceSoul).put(true);
43
-
44
- 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.`);
45
- } else {
42
+ targetNodeRef.get('_holograms').get(storedHologramInstanceSoul).put(true);
43
+ } else {
46
44
  console.warn(`Data (ID: ${data.id}) being put is a hologram, but could not parse its soul ${data.value.soul} for tracking.`);
47
45
  }
48
46
  } catch (trackingError) {
@@ -204,9 +202,8 @@ export async function deleteNode(holoInstance, holon, lens, key) {
204
202
  targetNodeRef.get('_holograms').get(deletedHologramSoul).put(null, (ack) => { // Remove the hologram entry completely
205
203
  if (ack.err) {
206
204
  console.warn(`[deleteNode] Error removing hologram ${deletedHologramSoul} from target ${targetSoul}:`, ack.err);
207
- }
208
- console.log(`Removed hologram ${deletedHologramSoul} from target ${targetSoul}'s _holograms list`);
209
- resolveTrack(); // Resolve regardless of ack error to not block main delete
205
+ }
206
+ resolveTrack(); // Resolve regardless of ack error to not block main delete
210
207
  });
211
208
  });
212
209
  } else {
@@ -237,7 +234,7 @@ export async function deleteNode(holoInstance, holon, lens, key) {
237
234
  console.error('Error in deleteNode:', error);
238
235
  throw error;
239
236
  }
240
- }
237
+ }
241
238
 
242
239
  // Export all node operations as default
243
240
  export default {
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "holosphere",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Holonic Geospatial Communication Infrastructure",
5
- "main": "./holosphere.js",
6
- "module": "./holosphere.js",
7
- "types": "./holosphere.d.ts",
5
+ "main": "holosphere.js",
6
+ "module": "holosphere.js",
7
+ "types": "holosphere.d.ts",
8
8
  "type": "module",
9
- "sideEffects": false,
10
9
  "scripts": {
11
10
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12
- "build": "node build.js",
11
+ "build": "npm run build:browser",
12
+ "prepare": "npm run build",
13
13
  "build:browser": "node build.js",
14
14
  "build:bundle": "node build.js",
15
- "prepublishOnly": "node build.js",
15
+ "prepublishOnly": "npm run build",
16
16
  "publish:cdn": "npm publish && echo 'Package published to npm and will be available on CDNs within minutes'",
17
- "publish:force": "npm publish --force && echo 'Package force published to npm and will be available on CDNs within minutes'"
17
+ "publish:force": "npm publish --force && echo 'Package force published to npm and will be available on CDNs within minutes'",
18
+ "prepublish:skip-tests": "npm run build"
18
19
  },
19
20
  "author": "Roberto Valenti",
20
21
  "license": "GPL-3.0-or-later",
@@ -58,7 +59,6 @@
58
59
  ],
59
60
  "exports": {
60
61
  ".": {
61
- "types": "./holosphere.d.ts",
62
62
  "import": "./holosphere.js",
63
63
  "require": "./holosphere.js",
64
64
  "default": "./holosphere.js"
package/schema.js CHANGED
@@ -129,7 +129,7 @@ export function clearSchemaCache(holoInstance, lens = null) {
129
129
  holoInstance.schemaCache.clear();
130
130
  return true;
131
131
  }
132
- }
132
+ }
133
133
 
134
134
  // Export all schema operations as default
135
135
  export default {
package/utils.js CHANGED
@@ -287,7 +287,7 @@ export async function close(holoInstance) {
287
287
  export function userName(holoInstance, holonId) {
288
288
  if (!holonId) return null;
289
289
  return `${holoInstance.appname}:${holonId}`;
290
- }
290
+ }
291
291
 
292
292
  // Export all utility operations as default
293
293
  export default {