Registry / database / graphmind-sdk

graphmind-sdk

JSON →
library0.8.6jsnpmunverified

The `graphmind-sdk` is a TypeScript/Node.js client library designed to facilitate interaction with the Graphmind high-performance graph database, which natively supports OpenCypher. As of version 0.8.6, the SDK provides a comprehensive API for executing Cypher queries, managing graph schemas, performing health checks, and interacting with multi-tenant graph namespaces. It maintains a relatively active release cadence, frequently publishing patch versions. Key features include robust methods for standard query execution, schema introspection, query profiling, and an experimental natural language to Cypher (NLQ) translation capability. The SDK differentiates itself through its direct integration with Graphmind's performance optimizations and its support for distinct graph namespaces, enabling robust multi-tenancy scenarios.

npm install graphmind-sdk
INSTALL
IMPORT
SIG · GRAPHMIND-SDK
G
graphmind-sdk
databasejavascriptv0.8.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GraphmindClient
import { GraphmindClient } from 'graphmind-sdk';
const GraphmindClient = require('graphmind-sdk').GraphmindClient;
The SDK is primarily designed for ESM usage. Direct `require` calls for named exports might lead to issues in some environments or require specific Babel/TypeScript configurations.
GraphmindClientConfig
import type { GraphmindClientConfig } from 'graphmind-sdk';
import { GraphmindClientConfig } from 'graphmind-sdk';
While not explicitly shown in the README, the configuration object passed to `GraphmindClient` constructor is typed as `GraphmindClientConfig`. It's a type import, not a runtime value.

This quickstart initializes a Graphmind client, demonstrates creating and querying data using Cypher, fetches the database schema, and shows how to configure a client with an authentication token from environment variables.

import { GraphmindClient } from 'graphmind-sdk'; async function runExample() { const client = new GraphmindClient({ url: 'http://localhost:8080' }); try { // Create data (semicolons separate multiple statements) console.log('Creating initial data...'); await client.query(` CREATE (a:Person {name: "Alice", age: 30}); CREATE (b:Person {name: "Bob", age: 25}); MATCH (a:Person {name: "Alice"}), (b:Person {name: "Bob"}) CREATE (a)-[:KNOWS]->(b) `); console.log('Initial data created.'); // Or use shared variables (no semicolons needed) console.log('Creating more data...'); await client.query(` CREATE (c:Person {name: "Charlie", age: 35}) CREATE (d:Person {name: "Diana", age: 28}) CREATE (c)-[:KNOWS {since: 2023}]->(d) `); console.log('More data created.'); // Query existing data console.log('Querying all persons...'); const result = await client.query('MATCH (n:Person) RETURN n.name, n.age ORDER BY n.name'); console.log('Query Result:', result); // Get schema introspection console.log('Fetching database schema...'); const schema = await client.schema(); console.log('Database Schema:', JSON.stringify(schema, null, 2)); // Example with authentication using environment variable const authenticatedClient = new GraphmindClient({ url: 'http://localhost:8080', token: process.env.GRAPHMIND_TOKEN ?? '', // Ensure GRAPHMIND_TOKEN env var is set }); console.log('Checking authenticated client status...'); const status = await authenticatedClient.status(); console.log('Authenticated Client Status:', status); } catch (error) { console.error('An error occurred:', error.message); if (error.response) { console.error('Server response data:', error.response.data); } } } runExample().catch(console.error);
Debug
Known issues
breakingThe `graphmind-sdk` requires Node.js version 18 or newer. Older Node.js versions are not supported and will likely result in runtime errors or unexpected behavior.
fix
Upgrade your Node.js environment to version 18 or higher.
affects: <18.0.0
breakingMajor version changes from v0.6.x to v0.8.x likely introduce breaking API changes. The changelog indicates a significant jump (v0.6.5 to v0.8.0), suggesting refactoring or interface modifications. Users upgrading across this boundary should thoroughly review the full changelog on GitHub for specific breaking changes.
fix
Consult the official Graphmind SDK v0.8.0 changelog on GitHub for detailed breaking changes and migration steps.
affects: >=0.8.0
gotchaAuthentication tokens passed to `GraphmindClient` configuration should be securely managed, ideally through environment variables or a secure configuration management system, rather than hardcoding them directly in source code.
fix
Use `process.env.YOUR_TOKEN_VAR_NAME ?? ''` to retrieve authentication tokens, ensuring the environment variable is set in your deployment environment.
affects: >=0.1.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:8080
The Graphmind server is not running or is not accessible at the specified URL and port.
fix
Ensure the Graphmind server is running and listening on `http://localhost:8080`, or update the `url` in `GraphmindClient` configuration to the correct server address.
TypeError: GraphmindClient is not a constructor
This error often occurs when attempting to import a TypeScript ESM-first library using CommonJS `require()` syntax without proper transpilation or when the default export is expected but named export is provided.
fix
Ensure you are using `import { GraphmindClient } from 'graphmind-sdk';` in an ESM-enabled Node.js environment or TypeScript project. If using CommonJS, configure your build system to handle ESM imports correctly or explicitly use dynamic imports if available.
TypeError: client.query is not a function
This typically indicates a typo in the method name, or the `client` object was not correctly instantiated, or a Promise chain was not `await`ed, leading to an undefined object.
fix
Double-check the method name (e.g., `query` vs `Query`). Ensure `new GraphmindClient(...)` was successfully called and that you `await` any asynchronous operations before trying to access methods on the returned client instance.
Upgrade
Version history
0.8.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources