samyama-sdk 1.9.0 → 1.10.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.
Files changed (2) hide show
  1. package/README.md +96 -0
  2. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # samyama-sdk — TypeScript SDK for the Samyama Graph Database
2
+
3
+ A typed HTTP client for [Samyama](https://github.com/samyama-ai/samyama-graph),
4
+ a property-graph database with a Cypher query engine.
5
+
6
+ This package is **remote only**: it talks to a running Samyama server over
7
+ HTTP. There is no embedded mode in TypeScript — for in-process use, see the
8
+ Python or Rust SDK.
9
+
10
+ > The npm package `samyama-sdk` and the Rust crate `samyama-sdk` share a name.
11
+ > They are separate artifacts from the same repository.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install samyama-sdk
17
+ ```
18
+
19
+ ESM only. Needs Node 18+ (it uses the global `fetch`, `AbortSignal.timeout`
20
+ and `AbortSignal.any`).
21
+
22
+ ## Connect
23
+
24
+ ```ts
25
+ import { SamyamaClient } from "samyama-sdk";
26
+
27
+ const client = new SamyamaClient({
28
+ url: "http://localhost:8080", // default
29
+ timeoutMs: 30000, // whole-request deadline, default 30000
30
+ maxRetries: 2, // retries on timeout/connection failure
31
+ retryBaseDelayMs: 100, // doubled each attempt
32
+ });
33
+ ```
34
+
35
+ Or the factory, when the URL is all you need:
36
+
37
+ ```ts
38
+ const client = SamyamaClient.connectHttp("http://localhost:8080");
39
+ ```
40
+
41
+ ## First query
42
+
43
+ ```ts
44
+ import { SamyamaClient } from "samyama-sdk";
45
+
46
+ const client = SamyamaClient.connectHttp("http://localhost:8080");
47
+
48
+ await client.query('CREATE (:Person {name: "Alice"})-[:KNOWS]->(:Person {name: "Bob"})');
49
+
50
+ const result = await client.queryReadonly(
51
+ "MATCH (a:Person)-[:KNOWS]->(b:Person) RETURN a.name, b.name",
52
+ );
53
+
54
+ console.log(result.columns); // ["a.name", "b.name"]
55
+ for (const row of result.records) {
56
+ console.log(row); // ["Alice", "Bob"]
57
+ }
58
+ ```
59
+
60
+ `query` is read-write, `queryReadonly` is read-only. Both take an optional
61
+ second argument `graph`, which defaults to `"default"`.
62
+
63
+ A `QueryResult` is `{ nodes, edges, columns, records }`.
64
+
65
+ ## Other methods
66
+
67
+ | Method | Returns |
68
+ |---|---|
69
+ | `explain(cypher, graph?)` | the plan, as text rows in `records` |
70
+ | `profile(cypher, graph?)` | the executed plan with timings |
71
+ | `status()` | `ServerStatus` |
72
+ | `healthy()` | `boolean` |
73
+ | `ping()` | `string` |
74
+ | `schema()` | `GraphSchema` — node types, edge types, indexes, constraints |
75
+ | `sample(options?)` | a sample subgraph |
76
+ | `listGraphs()` | `string[]` |
77
+ | `deleteGraph(graph?)` | `void` |
78
+ | `importCsv(...)` / `importJson(...)` | import results |
79
+
80
+ `HttpTransport` is exported too, for callers that want the raw request layer
81
+ with their own `AbortSignal`.
82
+
83
+ ## Build from source
84
+
85
+ ```bash
86
+ npm install && npm run build && npm test
87
+ ```
88
+
89
+ ## More
90
+
91
+ - [`docs/SDK_API_CLI_ARCHITECTURE.md`](https://github.com/samyama-ai/samyama-graph/blob/main/docs/SDK_API_CLI_ARCHITECTURE.md)
92
+ — how the SDKs, the HTTP API and the CLI fit together.
93
+ - [`sdk/README.md`](https://github.com/samyama-ai/samyama-graph/blob/main/sdk/README.md)
94
+ — the other two SDKs (Python, Rust).
95
+
96
+ Apache-2.0.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samyama-sdk",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "TypeScript SDK for the Samyama Graph Database",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -8,7 +8,8 @@
8
8
  "types": "dist/src/index.d.ts",
9
9
  "files": [
10
10
  "dist/src/**/*.js",
11
- "dist/src/**/*.d.ts"
11
+ "dist/src/**/*.d.ts",
12
+ "README.md"
12
13
  ],
13
14
  "scripts": {
14
15
  "build": "tsc",