@abraca/dabra 2.3.0 → 2.5.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.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @abraca/dabra
2
+
3
+ The TypeScript/JavaScript client SDK for the [Abracadabra](https://github.com/iojanis/abracadabra) collaboration server.
4
+
5
+ `@abraca/dabra` pairs a Yjs `Y.Doc` with a WebSocket CRDT sync provider, a REST client, an offline-first IndexedDB layer, optional end-to-end encryption, RPC v1, live queries, and an optional WebRTC peer-to-peer stack.
6
+
7
+ ```typescript
8
+ import * as Y from "yjs";
9
+ import { AbracadabraClient, AbracadabraProvider } from "@abraca/dabra";
10
+
11
+ const client = new AbracadabraClient({ url: "https://my-server.example.com" });
12
+ await client.login("alice", "secret");
13
+
14
+ const doc = new Y.Doc();
15
+ const provider = new AbracadabraProvider({ name: docId, document: doc, client });
16
+ await provider.ready; // cached state OR first sync (5s cap)
17
+
18
+ doc.getText("content").insert(0, "Hello!"); // syncs to server + all clients
19
+ ```
20
+
21
+ ## Documentation
22
+
23
+ Full, code-derived documentation lives in [`docs/`](docs/) — a numbered Nuxt-Content
24
+ site covering the provider, WebSocket/sync, REST client, offline-first, the document
25
+ ORM, auth & crypto, end-to-end encryption, messaging/RPC/queries, WebRTC, and a
26
+ reference of every event, close code, and gotcha. It is the source of truth; this
27
+ README is the elevator pitch.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pnpm add @abraca/dabra yjs y-protocols
33
+ ```
34
+
35
+ `yjs` and `y-protocols` are **peer dependencies**.
36
+
37
+ ## Highlights
38
+
39
+ - **Offline-first** — the Y.Doc is hydrated from IndexedDB before any server contact; `await provider.ready`, then check `provider.hasCachedContent`.
40
+ - **One socket, many docs** — Hocuspocus V2 binary protocol multiplexed by document name, with exponential-backoff reconnect and cross-tab `BroadcastChannel` sync.
41
+ - **Permission-aware** — viewer/observer local edits persist locally but are never sent; gate UI on `provider.canWrite`.
42
+ - **E2E** — `E2EAbracadabraProvider`, `DocKeyManager`, `EncryptedY`, encrypted chat (Ed25519 identity → X25519 ECDH → AES-256-GCM).
43
+ - **RPC v1 & live queries** — `provider.rpc` and `provider.subscribeQuery`, lazily wired per document.
44
+ - **WebRTC (optional)** — P2P data channels, per-peer E2EE, and device pairing.
45
+
46
+ See [`docs/8.reference/`](docs/8.reference) for the non-obvious behaviours (deferred `synced`, `serverError` vs `stateless`, the five IndexedDB databases, RPC registry replay).
47
+
48
+ ## License
49
+
50
+ MIT.