graphmind-sdk 0.6.2 → 0.6.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.
- package/README.md +77 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Graphmind SDK for TypeScript/Node.js
|
|
2
|
+
|
|
3
|
+
TypeScript/Node.js client SDK for [Graphmind](https://github.com/fab679/graphmind) — a high-performance graph database with OpenCypher support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install graphmind-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { GraphmindClient } from 'graphmind-sdk';
|
|
15
|
+
|
|
16
|
+
const client = new GraphmindClient({ url: 'http://localhost:8080' });
|
|
17
|
+
|
|
18
|
+
// Create data (semicolons separate multiple statements)
|
|
19
|
+
await client.query(`
|
|
20
|
+
CREATE (a:Person {name: "Alice", age: 30});
|
|
21
|
+
CREATE (b:Person {name: "Bob", age: 25});
|
|
22
|
+
MATCH (a:Person {name: "Alice"}), (b:Person {name: "Bob"})
|
|
23
|
+
CREATE (a)-[:KNOWS]->(b)
|
|
24
|
+
`);
|
|
25
|
+
|
|
26
|
+
// Query
|
|
27
|
+
const result = await client.query('MATCH (n:Person) RETURN n.name, n.age');
|
|
28
|
+
console.log(result);
|
|
29
|
+
|
|
30
|
+
// Schema
|
|
31
|
+
const schema = await client.schema();
|
|
32
|
+
console.log(schema);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Authentication
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const client = new GraphmindClient({
|
|
39
|
+
url: 'http://localhost:8080',
|
|
40
|
+
token: 'my-secret-token',
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
| Method | Description |
|
|
47
|
+
|--------|-------------|
|
|
48
|
+
| `query(cypher, graph?)` | Execute Cypher query (read or write) |
|
|
49
|
+
| `schema(graph?)` | Get schema introspection |
|
|
50
|
+
| `explain(cypher, graph?)` | Show execution plan |
|
|
51
|
+
| `profile(cypher, graph?)` | Execute with profiling |
|
|
52
|
+
| `executeScript(script, graph?)` | Multi-statement execution |
|
|
53
|
+
| `nlq(question, graph?)` | Natural language to Cypher |
|
|
54
|
+
| `status()` | Server health check |
|
|
55
|
+
| `ping()` | Connectivity test |
|
|
56
|
+
| `listGraphs()` | List all graph namespaces |
|
|
57
|
+
| `deleteGraph(name)` | Delete a graph namespace |
|
|
58
|
+
|
|
59
|
+
## Multi-Tenancy
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Queries target isolated graph namespaces
|
|
63
|
+
await client.query('CREATE (n:User {name: "Alice"})', 'production');
|
|
64
|
+
await client.query('CREATE (n:User {name: "Test"})', 'staging');
|
|
65
|
+
|
|
66
|
+
const graphs = await client.listGraphs();
|
|
67
|
+
// ['default', 'production', 'staging']
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Requirements
|
|
71
|
+
|
|
72
|
+
- Node.js 18+
|
|
73
|
+
- A running Graphmind server
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Apache-2.0 — see [LICENSE](../../LICENSE)
|