@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.
- package/README.architecture.md +1352 -0
- package/README.blog.md +9 -1
- package/README.contributors.md +47 -13
- package/README.md +78 -11
- package/README.public.md +600 -7
- package/README.trouble.md +50 -0
- package/dist/README.architecture.md +1352 -0
- package/dist/README.blog.md +9 -1
- package/dist/README.contributors.md +47 -13
- package/dist/README.md +78 -11
- package/dist/README.public.md +600 -7
- package/dist/README.trouble.md +50 -0
- package/dist/client.d.ts +75 -3
- package/dist/index.d.ts +6 -0
- package/dist/logger.d.ts +115 -0
- package/dist/server.d.ts +148 -7
- package/dist/server.js +858 -118
- package/dist/socket-bundle.d.ts +16 -0
- package/package.json +17 -17
package/dist/README.blog.md
CHANGED
|
@@ -8,4 +8,12 @@ found in the LICENSE file in the root of this package.
|
|
|
8
8
|
|
|
9
9
|
# Blog
|
|
10
10
|
|
|
11
|
-
Add
|
|
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
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
11
|
+
- [Prerequisites](#prerequisites)
|
|
12
|
+
- [Setup](#setup)
|
|
13
|
+
- [Everyday development](#everyday-development)
|
|
14
|
+
- [Publishing](#publishing)
|
|
15
|
+
- [More docs](#more-docs)
|
|
15
16
|
|
|
16
|
-
##
|
|
17
|
+
## Prerequisites
|
|
17
18
|
|
|
18
|
-
|
|
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
|
-
|
|
25
|
+
```sh
|
|
26
|
+
pnpm install
|
|
27
|
+
```
|
|
23
28
|
|
|
24
|
-
|
|
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
|
-
##
|
|
31
|
+
## Everyday development
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
- Run tests + lint (default CI path):
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
```sh
|
|
36
|
+
pnpm test
|
|
37
|
+
```
|
|
31
38
|
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
##
|
|
21
|
+
## Quick start
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.
|