graphmind-sdk 0.7.0 → 0.8.0-beta

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.
@@ -32,9 +32,9 @@ export declare class GraphmindClient {
32
32
  */
33
33
  static connectHttp(url?: string): GraphmindClient;
34
34
  /** Execute a read-write Cypher query */
35
- query(cypher: string, graph?: string): Promise<QueryResult>;
35
+ query(cypher: string, graph?: string, params?: Record<string, unknown>): Promise<QueryResult>;
36
36
  /** Execute a read-only Cypher query */
37
- queryReadonly(cypher: string, graph?: string): Promise<QueryResult>;
37
+ queryReadonly(cypher: string, graph?: string, params?: Record<string, unknown>): Promise<QueryResult>;
38
38
  /**
39
39
  * Return the EXPLAIN plan for a Cypher query without executing it.
40
40
  * Returns the plan as text rows in the QueryResult records.
@@ -41,12 +41,12 @@ export class GraphmindClient {
41
41
  return new GraphmindClient({ url });
42
42
  }
43
43
  /** Execute a read-write Cypher query */
44
- async query(cypher, graph = "default") {
45
- return this.http.query(cypher, graph);
44
+ async query(cypher, graph = "default", params) {
45
+ return this.http.query(cypher, graph, params);
46
46
  }
47
47
  /** Execute a read-only Cypher query */
48
- async queryReadonly(cypher, graph = "default") {
49
- return this.http.query(cypher, graph);
48
+ async queryReadonly(cypher, graph = "default", params) {
49
+ return this.http.query(cypher, graph, params);
50
50
  }
51
51
  /**
52
52
  * Return the EXPLAIN plan for a Cypher query without executing it.
@@ -8,7 +8,7 @@ export declare class HttpTransport {
8
8
  private extraHeaders;
9
9
  constructor(baseUrl: string, extraHeaders?: Record<string, string>);
10
10
  /** Execute a Cypher query via POST /api/query */
11
- query(cypher: string, graph?: string): Promise<QueryResult>;
11
+ query(cypher: string, graph?: string, params?: Record<string, unknown>): Promise<QueryResult>;
12
12
  /** Get server status via GET /api/status */
13
13
  status(graph?: string): Promise<ServerStatus>;
14
14
  /** Get graph schema via GET /api/schema */
@@ -8,11 +8,15 @@ export class HttpTransport {
8
8
  this.extraHeaders = extraHeaders;
9
9
  }
10
10
  /** Execute a Cypher query via POST /api/query */
11
- async query(cypher, graph = "default") {
11
+ async query(cypher, graph = "default", params) {
12
+ const body = { query: cypher, graph };
13
+ if (params && Object.keys(params).length > 0) {
14
+ body.params = params;
15
+ }
12
16
  const response = await fetch(`${this.baseUrl}/api/query`, {
13
17
  method: "POST",
14
18
  headers: { "Content-Type": "application/json", ...this.extraHeaders },
15
- body: JSON.stringify({ query: cypher, graph }),
19
+ body: JSON.stringify(body),
16
20
  });
17
21
  if (!response.ok) {
18
22
  const body = (await response.json().catch(() => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphmind-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.8.0-beta",
4
4
  "description": "TypeScript SDK for the Graphmind Graph Database",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",