@noy-db/by-peer 0.7.0-pre.9 → 0.7.1-pre.0

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.
Files changed (2) hide show
  1. package/README.md +13 -2
  2. package/package.json +4 -5
package/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @noy-db/by-peer
2
2
 
3
+ <!-- prose-preamble
4
+ // Bindings the illustrative blocks below elide. Typed on purpose (#1310).
5
+ import { servePeerStore, peerStore, type PeerChannel } from '@noy-db/by-peer'
6
+ import type { NoydbStore } from '@noy-db/hub'
7
+ declare const channel: PeerChannel
8
+ declare const local: NoydbStore
9
+ declare const inviteToken: string
10
+ -->
11
+
3
12
  WebRTC peer-to-peer transport for [noy-db](https://github.com/vLannaAi/noy-db) — no server in the middle.
4
13
 
5
14
  > First member of the `by-*` family of session-share transports. See [`docs/packages/by-transports.md`](https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/packages/by-transports.md) for the family contract and roster.
@@ -20,7 +29,7 @@ Classic cloud sync routes every envelope through a central store. `@noy-db/by-pe
20
29
 
21
30
  ```ts
22
31
  import { createNoydb } from '@noy-db/hub'
23
- import { to } from '@noy-db/to-browser-idb'
32
+ import { toBrowserIdb } from '@noy-db/to-browser-idb'
24
33
  import { peerStore, createOffer, acceptOffer } from '@noy-db/by-peer'
25
34
 
26
35
  // Peer A — initiator
@@ -30,7 +39,9 @@ await initiator.accept(await receiveAnswer())
30
39
  const channel = await initiator.channel
31
40
 
32
41
  const db = await createNoydb({
33
- store: to(),
42
+ store: toBrowserIdb(),
43
+ user: 'alice',
44
+ secret: userSecret,
34
45
  syncStrategy: withSync(), // required — sync is opt-in
35
46
  sync: { store: peerStore({ channel, token: inviteToken }), role: 'sync-peer' },
36
47
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noy-db/by-peer",
3
- "version": "0.7.0-pre.9",
3
+ "version": "0.7.1-pre.0",
4
4
  "description": "WebRTC peer-to-peer transport for noy-db — direct browser-to-browser channel with signaling-agnostic handshake",
5
5
  "license": "MIT",
6
6
  "author": "vLannaAi <vicio@lanna.ai>",
@@ -32,12 +32,11 @@
32
32
  "node": ">=22.0.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@noy-db/hub": "^0.7.0-pre.9"
35
+ "@noy-db/hub": "^0.7.1-pre.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@noy-db/to-memory": "0.7.0-pre.9",
39
- "@noy-db/test-mesh-conformance": "0.7.0-pre.9",
40
- "@noy-db/hub": "0.7.0-pre.9"
38
+ "@noy-db/hub": "0.7.1-pre.0",
39
+ "@noy-db/test-mesh-conformance": "0.7.1-pre.0"
41
40
  },
42
41
  "keywords": [
43
42
  "noy-db",