@yydb/yydb-client 0.0.2 → 0.0.4

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 +22 -42
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
1
  # `@yydb/yydb-client`
2
2
 
3
- **Lightweight TypeScript client for the YY wire protocol (WebSocket or TCP).**
4
-
5
- Use this when you already run `yydb serve` (from [`@yydb/yydb`](../yydb) CLI or another host) and only need the client
6
- surface — browser, WebUI, Electron renderer, or a thin Node process.
3
+ TypeScript client for the YY wire protocol over WebSocket or TCP. Use when `yydb serve` already runs (from [
4
+ `@yydb/yydb`](https://www.npmjs.com/package/@yydb/yydb) CLI or another host) and you only need the client surface —
5
+ browser, WebUI, Electron renderer, or a thin Node process.
7
6
 
8
7
  [![npm](https://img.shields.io/npm/v/@yydb/yydb-client)](https://www.npmjs.com/package/@yydb/yydb-client)
9
8
  [![Node.js](https://img.shields.io/node/v/@yydb/yydb-client)](https://www.npmjs.com/package/@yydb/yydb-client)
10
- [![Check Rust](https://github.com/yy-database/yydb/actions/workflows/check-rust.yml/badge.svg?branch=dev)](https://github.com/yy-database/yydb/actions/workflows/check-rust.yml)
11
- [![Check TypeScript](https://github.com/yy-database/yydb/actions/workflows/check-typescript.yml/badge.svg?branch=dev)](https://github.com/yy-database/yydb/actions/workflows/check-typescript.yml)
12
9
 
13
- ## Install
10
+ ## Exports
14
11
 
15
- ```bash
16
- npm install @yydb/yydb-client
17
- ```
12
+ | Import | Transport | Typical use |
13
+ |--------------------------|-------------------|--------------------|
14
+ | `@yydb/yydb-client` | WebSocket `/wire` | Browsers and WebUI |
15
+ | `@yydb/yydb-client/node` | TCP or WebSocket | Node and Electron |
16
+
17
+ Frame helpers (`encodeFrame`, `MsgType`, …) are exported for tools and tests.
18
18
 
19
- ## Browser or WebSocket
19
+ ## Example
20
20
 
21
- Start a local host first:
21
+ Start a host (from `@yydb/yydb` or the `yydb` CLI):
22
22
 
23
23
  ```text
24
24
  yydb serve app.yydb --bind 127.0.0.1:7700
25
25
  ```
26
26
 
27
- Then connect from browser-compatible code:
27
+ **Browser / WebSocket**
28
28
 
29
29
  ```ts
30
30
  import {Client} from "@yydb/yydb-client";
@@ -36,9 +36,7 @@ console.log(await db.get("theme"));
36
36
  db.close();
37
37
  ```
38
38
 
39
- ## Node TCP
40
-
41
- The `/node` entry point supports a TCP endpoint and `ws://` URLs:
39
+ **Node TCP**
42
40
 
43
41
  ```ts
44
42
  import {connect} from "@yydb/yydb-client/node";
@@ -48,32 +46,14 @@ console.log(await db.info());
48
46
  db.close();
49
47
  ```
50
48
 
51
- If a Node application only needs to open a local `.yydb` file, use
52
- [`@yydb/yydb`](https://www.npmjs.com/package/@yydb/yydb). It manages the local engine for you; this package is for an
53
- existing host or a custom transport integration.
54
-
55
- ## Exports
56
-
57
- | Import | Transport | Typical use |
58
- |--------------------------|-------------------|--------------------|
59
- | `@yydb/yydb-client` | WebSocket `/wire` | Browsers and WebUI |
60
- | `@yydb/yydb-client/node` | TCP or WebSocket | Node and Electron |
61
-
62
- The high-level client includes `info`, schema ensure/get, key/value get/put, server version, and close operations. Frame
63
- helpers such as `encodeFrame` and
64
- `MsgType` are exported for tools and tests.
65
-
66
- ## Compatibility and security
67
-
68
- The client accepts hosts that announce either `YYDB` or `YYDS` on the shared wire. The reference `yydb serve` endpoint
69
- has no authentication, so connect only to a host you control, normally `127.0.0.1` or `localhost`.
49
+ To open a local `.yydb` file without managing a server, use [`@yydb/yydb`](https://www.npmjs.com/package/@yydb/yydb)
50
+ instead.
70
51
 
71
- Protocol details for implementers are in the
72
- [`yydb-serve-protocol` skill](../yydb-skills/skills/yydb-serve-protocol/SKILL.md) (`@yydb/yydb-skills`).
52
+ The client accepts hosts that announce `YYDB` or `YYDS` on the shared wire. Connect only to hosts you control — normally
53
+ `127.0.0.1` or `localhost`.
73
54
 
74
- ## Links
55
+ Protocol details: [
56
+ `yydb-serve-protocol`](https://github.com/yy-database/yydb.rs/tree/dev/projects/packages/yydb-skills/skills/yydb-serve-protocol/SKILL.md)
57
+ in [`@yydb/yydb-skills`](https://www.npmjs.com/package/@yydb/yydb-skills).
75
58
 
76
- - [Node file API](https://www.npmjs.com/package/@yydb/yydb)
77
- - [Local WebUI](https://github.com/yy-database/yydb.rs/tree/dev/projects/packages/yydb-webui)
78
- - [YYDB user guides](https://github.com/yy-database/yydb.rs/tree/dev/projects/packages/homepage/documentation/zh-hans)
79
- - [License](https://github.com/yy-database/yydb.rs/blob/dev/License.md)
59
+ [YYDB overview](https://github.com/yy-database/yydb.rs) · [User guides](https://github.com/yy-database/yydb.rs/tree/dev/projects/packages/homepage/documentation/zh-hans)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yydb/yydb-client",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "TypeScript client for the YYDB WebSocket and TCP wire protocol",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",