@optimystic/db-p2p-storage-rn 1.0.0-beta.2 → 1.0.0-beta.3

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 CHANGED
@@ -56,6 +56,22 @@ const libp2p = await createLibp2pNode({
56
56
  Use the Node-free `/rn` entry point of `@optimystic/db-p2p` so the Node-only
57
57
  TCP transport doesn't get bundled into the React Native app.
58
58
 
59
+ ## Debug logging
60
+
61
+ `DEBUG=` does not work in React Native, and without it every `optimystic:*`
62
+ log channel is silently off — so an empty device capture proves nothing.
63
+ Turn logging on in code, early in your app's entry point:
64
+
65
+ ```ts
66
+ import { enableOptimysticLogging } from '@optimystic/db-core';
67
+
68
+ enableOptimysticLogging('optimystic:*');
69
+ ```
70
+
71
+ It prints one `optimystic logging on: …` confirmation line; look for that
72
+ first. See `docs/debugging.md` § "Turning logging on" in the repository for
73
+ the `log` option, libp2p's separate switch, and the cost on device.
74
+
59
75
  ## Related packages
60
76
 
61
77
  - **[@optimystic/db-p2p](../db-p2p)** — the distributed layer this backend
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAEjE"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAEjE"}
@@ -1,5 +1,8 @@
1
1
  import debug from 'debug';
2
+ import { registerDebugModule } from '@optimystic/db-core';
2
3
  const BASE_NAMESPACE = 'optimystic:db-p2p-storage-rn';
4
+ // So `enableOptimysticLogging` reaches this package's copy of `debug`, which may be no one else's.
5
+ registerDebugModule('db-p2p-storage-rn', debug);
3
6
  export function createLogger(subNamespace) {
4
7
  return debug(`${BASE_NAMESPACE}:${subNamespace}`);
5
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,MAAM,UAAU,YAAY,CAAC,YAAoB;IAChD,OAAO,KAAK,CAAC,GAAG,cAAc,IAAI,YAAY,EAAE,CAAC,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,mGAAmG;AACnG,mBAAmB,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAEhD,MAAM,UAAU,YAAY,CAAC,YAAoB;IAChD,OAAO,KAAK,CAAC,GAAG,cAAc,IAAI,YAAY,EAAE,CAAC,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimystic/db-p2p-storage-rn",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "type": "module",
5
5
  "description": "React Native LevelDB storage backend for @optimystic/db-p2p",
6
6
  "main": "dist/src/index.js",
@@ -54,8 +54,8 @@
54
54
  "typescript": "^5.9.3"
55
55
  },
56
56
  "dependencies": {
57
- "@optimystic/db-core": "^1.0.0-beta.2",
58
- "@optimystic/db-p2p": "^1.0.0-beta.2",
57
+ "@optimystic/db-core": "^1.0.0-beta.3",
58
+ "@optimystic/db-p2p": "^1.0.0-beta.3",
59
59
  "debug": "^4.4.3"
60
60
  },
61
61
  "peerDependencies": {
package/src/logger.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import debug from 'debug';
2
+ import { registerDebugModule } from '@optimystic/db-core';
2
3
 
3
4
  const BASE_NAMESPACE = 'optimystic:db-p2p-storage-rn';
4
5
 
6
+ // So `enableOptimysticLogging` reaches this package's copy of `debug`, which may be no one else's.
7
+ registerDebugModule('db-p2p-storage-rn', debug);
8
+
5
9
  export function createLogger(subNamespace: string): debug.Debugger {
6
10
  return debug(`${BASE_NAMESPACE}:${subNamespace}`);
7
11
  }