@hive-p2p/browser 1.0.33 → 1.0.35

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/index.mjs CHANGED
@@ -1,18 +1,29 @@
1
1
  import { Node, createNode } from "./core/node.mjs";
2
2
  import { CryptoCodex } from "./core/crypto-codex.mjs";
3
+ import { CLOCK } from "./services/clock.mjs";
3
4
  import CONFIG from "./core/config.mjs";
4
5
 
6
+ function mergeHiveConfig(target, source) {
7
+ for (const key in source)
8
+ if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
9
+ target[key] = target[key] || {};
10
+ mergeHiveConfig(target[key], source[key]);
11
+ } else target[key] = source[key];
12
+ }
13
+
5
14
  /**
6
15
  * @typedef {Object} HiveP2PNamespace
16
+ * @property {typeof CLOCK} CLOCK
17
+ * @property {typeof CONFIG} CONFIG
18
+ * @property {typeof mergeHiveConfig} mergeHiveConfig
7
19
  * @property {typeof Node} Node
8
20
  * @property {typeof createNode} createNode
9
21
  * @property {typeof CryptoCodex} CryptoCodex
10
- * @property {typeof CONFIG} CONFIG
11
22
  */
12
23
 
13
24
  /** @type {HiveP2PNamespace} */
14
- const HiveP2P = { Node, createNode, CryptoCodex, CONFIG };
15
- export { Node, createNode, CryptoCodex, CONFIG };
25
+ const HiveP2P = { CLOCK, CONFIG, mergeHiveConfig, Node, createNode, CryptoCodex };
26
+ export { CLOCK, CONFIG, mergeHiveConfig, Node, createNode, CryptoCodex };
16
27
  export default HiveP2P;
17
28
 
18
29
  if (typeof window !== 'undefined') window.HiveP2P = HiveP2P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hive-p2p/browser",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -126,7 +126,7 @@ export class Clock {
126
126
  } catch (error) { if (this.verbose) console.warn('[Clock] Background refine failed:', error); }
127
127
  }
128
128
  }
129
-
129
+ export const CLOCK = Clock.instance; // Singleton instance
130
130
 
131
131
  export async function CLOCK_TEST() { // DEBUG TEST WHILE RUNNING AS STANDALONE
132
132
  const startTime = Date.now();