mushroomdb-client 0.7.1 → 0.7.2
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 +21 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,11 +3,20 @@
|
|
|
3
3
|
TypeScript client for the [mushroomdb](https://github.com/MatthewSherlin/mushroomdb) graph database.
|
|
4
4
|
Wraps the HTTP and WebSocket API exposed by `mushroomdb serve`.
|
|
5
5
|
|
|
6
|
+
The methods at a glance, and the routes the client leaves to `fetch`, are on the
|
|
7
|
+
[documentation site](https://matthewsherlin.github.io/mushroomdb/docs/typescript.html).
|
|
8
|
+
|
|
6
9
|
> Published to npm as [`mushroomdb-client`](https://www.npmjs.com/package/mushroomdb-client) on every release. Installing from the repo path (see below) is for working against an unreleased server.
|
|
7
10
|
|
|
8
11
|
---
|
|
9
12
|
|
|
10
|
-
## Installation
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install mushroomdb-client
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
To use a checkout instead, while working on the client itself:
|
|
11
20
|
|
|
12
21
|
```sh
|
|
13
22
|
npm install /path/to/graph-db/clients/typescript
|
|
@@ -167,6 +176,16 @@ Wires `GET /explain?a=&b=`. Returns rule-derived edges between two node keys.
|
|
|
167
176
|
|
|
168
177
|
Wires `POST /rules` with a `RuleDef` JSON body.
|
|
169
178
|
|
|
179
|
+
### `client.renameNode(oldKey, newKey) → Promise<void>`
|
|
180
|
+
|
|
181
|
+
Wires `POST /nodes/{key}/rename`. Changes a node's key. Throws when the old key does not exist
|
|
182
|
+
(the server answers 404) or the new one is taken (409).
|
|
183
|
+
|
|
184
|
+
### `client.upsertEdge(edgeType, src, dst, placeholderLabel) → Promise<{ nodes_created, edge_inserted }>`
|
|
185
|
+
|
|
186
|
+
Wires `POST /edges/upsert`. Creates the edge, and creates whichever endpoint is missing as a node
|
|
187
|
+
of `placeholderLabel`.
|
|
188
|
+
|
|
170
189
|
### `client.node(key) → Promise<NodeInfo | null>`
|
|
171
190
|
|
|
172
191
|
Wires `GET /node/{key}`. Returns `null` for an unknown key (HTTP 404).
|
|
@@ -254,7 +273,7 @@ await client.query("CREATE (n:Widget {id: 'w1', name: 'Sprocket'})");
|
|
|
254
273
|
|
|
255
274
|
| Feature | Browser | Node 18+ |
|
|
256
275
|
|---------|---------|----------|
|
|
257
|
-
| `query`, `ingest`, `stats`, `suggest`, `algo`, `explain`, `createRule`, `node`, `neighborhood` | Yes (uses `fetch`) | Yes |
|
|
276
|
+
| `query`, `ingest`, `stats`, `suggest`, `algo`, `explain`, `createRule`, `renameNode`, `upsertEdge`, `node`, `neighborhood` | Yes (uses `fetch`) | Yes |
|
|
258
277
|
| `subscribe` | Yes (uses global `WebSocket`) | Requires `wsConstructor` option + `ws` package |
|
|
259
278
|
|
|
260
279
|
---
|