@rljson/server 0.0.4 → 0.0.6

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.
@@ -8,4 +8,12 @@ found in the LICENSE file in the root of this package.
8
8
 
9
9
  # Blog
10
10
 
11
- Add latest posts at the end.
11
+ Add posts as Markdown entries in this file (newest last). Keep each post small and link to source code or PRs when helpful. Template:
12
+
13
+ ```md
14
+ ## YYYY-MM-DD — Title
15
+
16
+ - What changed (1–3 bullets)
17
+ - Why it matters
18
+ - Links: PRs, docs, demos
19
+ ```
@@ -8,25 +8,59 @@ found in the LICENSE file in the root of this package.
8
8
 
9
9
  # Contributors Guide
10
10
 
11
- - [Prepare](#prepare)
12
- - [Develop](#develop)
13
- - [Administrate](#administrate)
14
- - [Fast Coding](#fast-coding)
11
+ - [Prerequisites](#prerequisites)
12
+ - [Setup](#setup)
13
+ - [Everyday development](#everyday-development)
14
+ - [Publishing](#publishing)
15
+ - [More docs](#more-docs)
15
16
 
16
- ## Prepare
17
+ ## Prerequisites
17
18
 
18
- Read [prepare.md](doc/prepare.md)
19
+ - Node.js v22.14.0+
20
+ - pnpm v10 (see [install-node-mac.md](doc/install-node-mac.md) or [install-node-win.md](doc/install-node-win.md))
21
+ - Optional: sibling repos `rljson-io`, `rljson-bs`, `rljson-db`, `rljson` if you prefer linking for local development
19
22
 
20
- <!-- ........................................................................-->
23
+ ## Setup
21
24
 
22
- ## Develop
25
+ ```sh
26
+ pnpm install
27
+ ```
23
28
 
24
- Read [develop.md](doc/develop.md)
29
+ By default we consume published npm versions. If you want to work against local packages instead, `pnpm link` them in sibling folders and add temporary overrides as needed.
25
30
 
26
- ## Administrate
31
+ ## Everyday development
27
32
 
28
- Read [create-new-repo.md](doc/create-new-repo.md)
33
+ - Run tests + lint (default CI path):
29
34
 
30
- ## Fast Coding
35
+ ```sh
36
+ pnpm test
37
+ ```
31
38
 
32
- Read [fast-coding-guide.md](doc/fast-coding-guide.md)
39
+ - Lint only:
40
+
41
+ ```sh
42
+ pnpm lint
43
+ ```
44
+
45
+ - Build the package (emits dist, copies README):
46
+
47
+ ```sh
48
+ pnpm build
49
+ ```
50
+
51
+ - Update goldens for snapshot-like tests:
52
+
53
+ ```sh
54
+ pnpm updateGoldens
55
+ ```
56
+
57
+ ## Publishing
58
+
59
+ `pnpm build` runs `pnpm test` via `prebuild`. `pnpm publish` (or npm publish) will trigger `prepublishOnly` and uses the built `dist` folder. Keep the changelog and versioning in sync with repo guidelines.
60
+
61
+ ## More docs
62
+
63
+ - [doc/prepare.md](doc/prepare.md)
64
+ - [doc/develop.md](doc/develop.md)
65
+ - [doc/create-new-repo.md](doc/create-new-repo.md)
66
+ - [doc/fast-coding-guide.md](doc/fast-coding-guide.md)
package/dist/README.md CHANGED
@@ -8,17 +8,84 @@ found in the LICENSE file in the root of this package.
8
8
 
9
9
  # @rljson/server
10
10
 
11
- ## Users
11
+ Local-first, pull-by-reference server layer for Rljson. Clients keep writes local, pull data on demand through multis, and let the server proxy references without duplicating client data.
12
12
 
13
- | File | Purpose |
14
- | ------------------------------------ | --------------------------- |
15
- | [README.public.md](README.public.md) | Install and use the package |
13
+ - Writes stay local; reads cascade: local ➜ server ➜ peers
14
+ - References (hashes) flow; data is pulled on demand
15
+ - Server aggregates sockets and multicasts refs, but only stores what you explicitly import
16
+ - Graceful lifecycle: `tearDown()` for both Server and Client, automatic disconnect cleanup, `removeSocket()` for manual removal
17
+ - Configurable production defaults: ref eviction interval, peer init timeout (server and client)
18
+ - Structured logging via injectable `ServerLogger` (NoopLogger default, ConsoleLogger, BufferedLogger, FilteredLogger included)
19
+ - **Sync protocol**: Optional ACK aggregation, causal ordering with gap-fill, enriched payload forwarding via `SyncConfig`
16
20
 
17
- ## Contributors
21
+ ## Quick start
18
22
 
19
- | File | Purpose |
20
- | ------------------------------------------------ | ----------------------------- |
21
- | [README.contributors.md](README.contributors.md) | Run, debug, build and publish |
22
- | [README.architecture.md](README.architecture.md) | Software architecture guide |
23
- | [README.trouble.md](README.trouble.md) | Errors & solutions |
24
- | [README.blog.md](README.blog.md) | Blog |
23
+ Install:
24
+
25
+ ```sh
26
+ pnpm add @rljson/server
27
+ ```
28
+
29
+ Minimal server:
30
+
31
+ ```ts
32
+ import { BsMem } from '@rljson/bs';
33
+ import { IoMem } from '@rljson/io';
34
+ import { Route } from '@rljson/rljson';
35
+ import { Server, SocketIoBridge } from '@rljson/server';
36
+
37
+ const route = Route.fromFlat('my.app');
38
+ const serverIo = new IoMem();
39
+ await serverIo.init();
40
+ await serverIo.isReady();
41
+
42
+ const server = new Server(route, serverIo, new BsMem());
43
+ await server.init();
44
+
45
+ // When your runtime yields sockets, wrap them:
46
+ // await server.addSocket(new SocketIoBridge(serverSocket));
47
+ ```
48
+
49
+ Minimal client:
50
+
51
+ ```ts
52
+ import { BsMem } from '@rljson/bs';
53
+ import { IoMem } from '@rljson/io';
54
+ import { Client, SocketIoBridge } from '@rljson/server';
55
+
56
+ // Pass the same route as the server to get Db and Connector automatically
57
+ const route = Route.fromFlat('my.app');
58
+ const client = new Client(new SocketIoBridge(clientSocket), new IoMem(), new BsMem(), route);
59
+ await client.init();
60
+
61
+ const io = client.io; // IoMulti merged interface
62
+ const bs = client.bs; // BsMulti merged interface
63
+ const db = client.db; // Db (available when route provided)
64
+ const connector = client.connector; // Connector (available when route provided)
65
+ ```
66
+
67
+ Run tests and lint:
68
+
69
+ ```sh
70
+ pnpm test
71
+ ```
72
+
73
+ Build distribution:
74
+
75
+ ```sh
76
+ pnpm build
77
+ ```
78
+
79
+ ## Documentation map
80
+
81
+ | Audience | File | Highlights |
82
+ | --------------- | ------------------------------------------------ | ------------------------------------------------- |
83
+ | Users | [README.public.md](README.public.md) | Install, usage, networking model, examples |
84
+ | Contributors | [README.contributors.md](README.contributors.md) | Setup, dev workflow, publishing, fast coding tips |
85
+ | Architecture | [README.architecture.md](README.architecture.md) | Deep dive into multis, peer bridges, data flows |
86
+ | Troubleshooting | [README.trouble.md](README.trouble.md) | Known issues and fixes |
87
+ | Blog | [README.blog.md](README.blog.md) | Writing and collecting project blog entries |
88
+
89
+ ## Example code
90
+
91
+ See [src/example.ts](src/example.ts) for a runnable end-to-end demo and [test/server.spec.ts](test/server.spec.ts) for broader integration cases.