litegraphdb
v1.0.12
Published
JS API client generated by OpenAPI Generator
Readme
JavaScript SDK for LiteGraph
LiteGraph is a lightweight graph database with both relational and vector support, built using Sqlite, with support for exporting to GEXF. LiteGraph is intended to be a multi-modal database primarily for providing persistence and retrieval for knowledge and artificial intelligence applications.
Documentation
Full documentation is available at https://litegraph.readme.io/.
Features
- Multi-tenant support with tenant GUID management
- Graph management
- Node and edge operations
- Route finding between nodes
- Search capabilities for graphs, nodes, and edges
- GEXF format export support
- Built-in retry mechanism and error handling
- Comprehensive logging system
- Access key authentication support
Requirements
- Node.js v18.20.4
- npm
Dependencies
jest- for testingmsw- for mocking the apisuperagent- for making the api callsurl- for url parsingutil- for utility functionsuuid- for generating unique ids
Installation
Use the command below to install the package.
npm i litegraphdbQuick Start
import { LiteGraphSdk } from 'litegraphdb';
const sdk = new LiteGraphSdk(
'https://api.litegraphdb.com',
'your-tenant-guid',
'your-access-key'
);
const graphGuid = 'example-graph-guid';
// Create a new graph
sdk.Graph.create({name: 'MyGraph'}).then((graph) => {
console.log('Created graph:', graph);
});
const newMultipleNodes = [
{
"Name": "Active Directory",
"Labels": [
"test"
],
"Tags": {
"Type": "ActiveDirectory"
},
"Data": {
"Name": "Active Directory"
}
},
{
"Name": "Website",
"Labels": [
"test"
],
"Tags": {
"Type": "Website"
},
"Data": {
"Name": "Website"
}
}
]
//Create multiple Nodes
sdk.Node.create(graphGuid,newMultipleNodes).then((nodes) => {
console.log('Created Multiple Nodes:', nodes);
});
const searchNodes = async () => {
// Graph object to update
const searchRequest = {
GraphGUID: '00900db5-c9b7-4631-b250-c9e635a9036e',
Ordering: 'CreatedDescending',
Expr: {
Left: 'Hello',
Operator: 'Equals',
Right: 'World',
},
};
sdk.Node.search(searchRequest).then((response) => {
console.log('Search response:', response);
})API Endpoints Reference
Tenant Operations
| Method | Description | Parameters | Returns | Endpoint |
| ------------------------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------- |
| sdk.Tenant.readAll | Retrieves a list of all tenants. | cancellationToken (optional) - AbortController | Promise<TenantMetaData[]> - Array of tenants | GET /v1.0/tenants |
| sdk.Tenant.read | Retrieves a specific tenant by GUID. | tenantGuid (string) - The GUID of the tenant cancellationToken (optional) - AbortController | Promise<TenantMetaData> - The tenant | GET /v1.0/tenants/{tenantGuid} |
| sdk.Tenant.create | Creates a new tenant. | tenant (TenantMetaData) - The tenant object tenant.name (string) - Name of the tenant tenant.Active (boolean) - Active status cancellationToken (optional) - AbortController | Promise<TenantMetaData> - Created tenant | PUT /v1.0/tenants |
| sdk.Tenant.update | Updates an existing tenant. | tenant (TenantMetaData) - The tenant object tenant.name (string) - Name of the tenant tenant.Active (boolean) - Active status cancellationToken (optional) - AbortController | Promise<TenantMetaData> - Updated tenant | PUT /v1.0/tenants/{guid} |
| sdk.Tenant.delete | Deletes a tenant by GUID. | tenantGuid (string) - The GUID of the tenant cancellationToken (optional) - AbortController | Promise<boolean> | DELETE /v1.0/tenants/{tenantGuid} |
| sdk.Tenant.exists | Checks if a tenant exists by GUID. | tenantGuid (string) - The GUID of the tenant cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid} |
| sdk.Tenant.enumerate | Enumerates tenants. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<TenantMetaData>> - Array of tenants | GET /v2.0/tenants |
| sdk.Tenant.enumerateAndSearch | Enumerates and searches tenants. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<TenantMetaData>> - Array of tenants | POST /v2.0/tenants |
| sdk.Tenant.readStatistics | Retrieves statistics for a tenant. | cancellationToken (optional) - AbortController | Promise<TenantStatisticsResponse> | GET /v1.0/tenants/{tenantGuid}/stats |
| sdk.Tenant.readAllStatistics | Retrieves statistics for all tenants. | cancellationToken (optional) - AbortController | Promise<TenantStatisticsResponse[]> | GET /v1.0/tenants/stats |
| sdk.Tenant.readMany | Retrieves multiple tenants by GUID. | tenantGuids (string[]) - The GUIDs of the tenants cancellationToken (optional) - AbortController | Promise<TenantMetaData[]> - Array of tenants | GET /v1.0/tenants?guids={tenantGuid1},{tenantGuid2},{tenantGuid3} |
User Operations
| Method | Description | Parameters | Returns | Endpoint |
| ----------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
| sdk.User.readAll | Retrieves all users. | cancellationToken (optional) - AbortController | Promise<UserMetadata[]> | GET /v1.0/tenants/{tenantGuid}/users |
| sdk.User.read | Retrieves a specific user by GUID. | userGuid (string) - User GUID cancellationToken (optional) - AbortController | Promise<UserMetadata> | GET /v1.0/tenants/{tenantGuid}/users/{userGuid} |
| sdk.User.create | Creates a new user. | user (Object) - User object with FirstName, LastName, Active, Email, Password cancellationToken (optional) - AbortController | Promise<UserMetadata> | PUT /v1.0/tenants/{tenantGuid}/users |
| sdk.User.exists | Checks if a user exists by GUID. | guid (string) - User GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/users/{guid} |
| sdk.User.update | Updates an existing user. | user (Object) - User object with FirstName, LastName, Active, Email, Password guid (string) - User GUID cancellationToken (optional) - AbortController | Promise<UserMetadata> | PUT /v1.0/tenants/{tenantGuid}/users/{guid} |
| sdk.User.delete | Deletes a user by GUID. | guid (string) - User GUID cancellationToken (optional) - AbortController | Promise<boolean> | DELETE /v1.0/tenants/{tenantGuid}/users/{guid} |
| sdk.User.enumerate | Enumerates users. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<UserMetadata>> - Array of users | GET /v2.0/tenants/{tenantGuid}/users |
| sdk.User.enumerateAndSearch | Enumerates and searches users. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<UserMetadata>> - Array of users | POST /v2.0/tenants/{tenantGuid}/users |
| sdk.User.readMany | Retrieves multiple users by GUID. | userGuids (string[]) - The GUIDs of the users cancellationToken (optional) - AbortController | Promise<UserMetadata[]> - Array of users | GET /v1.0/tenants/{tenantGuid}/users?guids={userGuid1},{userGuid2},{userGuid3} |
Authorization Operations
| Method | Description | Parameters | Returns | Endpoint |
| -------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------------------------- |
| sdk.Authorization.generateToken | Generates an authentication token. | email (string) - User's email password (string) - User's password tenantId (string) - Tenant ID cancellationToken (optional) - AbortController | Promise<Token> | GET /v1.0/token |
| sdk.Authorization.getTokenDetails | Fetches details about an authentication token. | token (string) - Authentication token cancellationToken (optional) - AbortController | Promise<Object> | GET /v1.0/token/details |
| sdk.Authorization.getTenantsForEmail | Retrieves tenants associated with an email address. | email (string) - The email address to lookup tenants for. cancellationToken (optional) - AbortController | Promise<TenantMetaData[]> | GET /v1.0/token/tenants |
Credential Operations
| Method | Description | Parameters | Returns | Endpoint |
| ----------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| sdk.Credential.readAll | Retrieves all credentials. | cancellationToken (optional) - AbortController | Promise<CredentialMetadata[]> | GET /v1.0/tenants/{tenantGuid}/credentials |
| sdk.Credential.read | Retrieves a specific credential by GUID. | guid (string) - Credential GUID cancellationToken (optional) - AbortController | Promise<CredentialMetadata> | GET /v1.0/tenants/{tenantGuid}/credentials/{guid} |
| sdk.Credential.create | Creates a new credential. | credential (Object) - Credential object with Name, BearerToken, Active cancellationToken (optional) - AbortController | Promise<CredentialMetadata> | PUT /v1.0/tenants/{tenantGuid}/credentials |
| sdk.Credential.update | Updates an existing credential. | credential (Object) - Credential object with Name, BearerToken, Active cancellationToken (optional) - AbortController | Promise<CredentialMetadata> | PUT /v1.0/tenants/{tenantGuid}/credentials/{guid} |
| sdk.Credential.delete | Deletes a credential by GUID. | guid (string) - Credential GUID cancellationToken (optional) - AbortController | Promise<boolean> | DELETE /v1.0/tenants/{tenantGuid}/credentials/{guid} |
| sdk.Credential.exists | Checks if a credential exists by GUID. | guid (string) - Credential GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/credentials/{guid} |
| sdk.Credential.enumerate | Enumerates credentials. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<CredentialMetadata>> - Array of credentials | GET /v2.0/tenants/{tenantGuid}/credentials |
| sdk.Credential.enumerateAndSearch | Enumerates and searches credentials. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<CredentialMetadata>> - Array of credentials | POST /v2.0/tenants/{tenantGuid}/credentials |
| sdk.Credential.readMany | Retrieves multiple credentials by GUID. | credentialGuids (string[]) - The GUIDs of the credentials cancellationToken (optional) - AbortController | Promise<CredentialMetadata[]> - Array of credentials | GET /v1.0/tenants/{tenantGuid}/credentials?guids={credentialGuid1},{credentialGuid2},{credentialGuid3} |
Label Operations
| Method | Description | Parameters | Returns | Endpoint |
| ------------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| sdk.Label.readAll | Retrieves all labels. | cancellationToken (optional) - AbortController | Promise<LabelMetadata[]> | GET /v1.0/tenants/{tenantGuid}/labels |
| sdk.Label.read | Retrieves a specific label by GUID. | guid (string) - Label GUID cancellationToken (optional) - AbortController | Promise<LabelMetadata> | GET /v1.0/tenants/{tenantGuid}/labels/{guid} |
| sdk.Label.exists | Checks if a label exists by GUID. | guid (string) - Label GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/labels/{guid} |
| sdk.Label.create | Creates a new label. | label (Object) - Label object cancellationToken (optional) - AbortController | Promise<LabelMetadata> | PUT /v1.0/tenants/{tenantGuid}/labels |
| sdk.Label.createBulk | Creates multiple labels. | labels (Array) - List of label objects cancellationToken (optional) - AbortController | Promise<LabelMetadata[]> | PUT /v1.0/tenants/{tenantGuid}/labels/bulk |
| sdk.Label.update | Updates an existing label. | label (Object) - Label object guid (string) - Label GUID cancellationToken (optional) - AbortController | Promise<LabelMetadata> | PUT /v1.0/tenants/{tenantGuid}/labels/{guid} |
| sdk.Label.delete | Deletes a label by GUID. | guid (string) - Label GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/labels/{guid} |
| sdk.Label.deleteBulk | Deletes multiple labels. | guids (Array) - List of label GUIDs cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/labels/bulk |
| sdk.Label.enumerate | Enumerates labels. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<LabelMetadata>> - Array of labels | GET /v2.0/tenants/{tenantGuid}/labels |
| sdk.Label.enumerateAndSearch | Enumerates and searches labels. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<LabelMetadata>> - Array of labels | POST /v2.0/tenants/{tenantGuid}/labels |
| sdk.Label.readMany | Retrieves multiple labels by GUID. | labelGuids (string[]) - The GUIDs of the labels cancellationToken (optional) - AbortController | Promise<LabelMetadata[]> - Array of labels | GET /v1.0/tenants/{tenantGuid}/labels?guids={labelGuid1},{labelGuid2},{labelGuid3} |
Tag Operations
| Method | Description | Parameters | Returns | Endpoint |
| ---------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------- |
| sdk.Tag.readAll | Retrieves all tags. | cancellationToken (optional) - AbortController | Promise<TagMetaData[]> | GET /v1.0/tenants/{tenantGuid}/tags |
| sdk.Tag.read | Retrieves a specific tag by GUID. | guid (string) - Tag GUID cancellationToken (optional) - AbortController | Promise<TagMetaData> | GET /v1.0/tenants/{tenantGuid}/tags/{guid} |
| sdk.Tag.exists | Checks if a tag exists by GUID. | guid (string) - Tag GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/tags/{guid} |
| sdk.Tag.create | Creates a new tag. | tag (Object) - Tag object cancellationToken (optional) - AbortController | Promise<TagMetaData> | PUT /v1.0/tenants/{tenantGuid}/tags |
| sdk.Tag.createBulk | Creates multiple tags. | tags (Array) - List of tag objects cancellationToken (optional) - AbortController | Promise<TagMetaData[]> | PUT /v1.0/tenants/{tenantGuid}/tags/bulk |
| sdk.Tag.update | Updates an existing tag. | tag (Object) - Tag object guid (string) - Tag GUID cancellationToken (optional) - AbortController | Promise<TagMetaData> | PUT /v1.0/tenants/{tenantGuid}/tags/{guid} |
| sdk.Tag.delete | Deletes a tag by GUID. | guid (string) - Tag GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/tags/{guid} |
| sdk.Tag.deleteBulk | Deletes multiple tags. | guids (Array) - List of tag GUIDs cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/tags/bulk |
| sdk.Tag.enumerate | Enumerates tags. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<TagMetaData>> - Array of tags | GET /v2.0/tenants/{tenantGuid}/tags |
| sdk.Tag.enumerateAndSearch | Enumerates and searches tags. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<TagMetaData>> - Array of tags | POST /v2.0/tenants/{tenantGuid}/tags |
| sdk.Tag.readMany | Retrieves multiple tags by GUID. | tagGuids (string[]) - The GUIDs of the tags cancellationToken (optional) - AbortController | Promise<TagMetaData[]> - Array of tags | GET /v1.0/tenants/{tenantGuid}/tags?guids={tagGuid1},{tagGuid2},{tagGuid3} |
Vector Operations
| Method | Description | Parameters | Returns | Endpoint |
| ------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| sdk.Vector.readAll | Retrieves all vectors. | cancellationToken (optional) - AbortController | Promise<VectorMetadata[]> | GET /v1.0/tenants/{tenantGuid}/vectors |
| sdk.Vector.read | Retrieves a specific vector by GUID. | guid (string) - Vector GUID cancellationToken (optional) - AbortController | Promise<VectorMetadata> | GET /v1.0/tenants/{tenantGuid}/vectors/{guid} |
| sdk.Vector.exists | Checks if a vector exists by GUID. | guid (string) - Vector GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/vectors/{guid} |
| sdk.Vector.create | Creates a new vector. | vector (Object) - Vector object cancellationToken (optional) - AbortController | Promise<VectorMetadata> | PUT /v1.0/tenants/{tenantGuid}/vectors |
| sdk.Vector.createBulk | Creates multiple vectors. | vectors (Array) - List of vector objects cancellationToken (optional) - AbortController | Promise<VectorMetadata[]> | PUT /v1.0/tenants/{tenantGuid}/vectors/bulk |
| sdk.Vector.update | Updates an existing vector. | vector (Object) - Vector object cancellationToken (optional) - AbortController | Promise<VectorMetadata> | PUT /v1.0/tenants/{tenantGuid}/vectors/{guid} |
| sdk.Vector.delete | Deletes a vector by GUID. | guid (string) - Vector GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/vectors/{guid} |
| sdk.Vector.deleteBulk | Deletes multiple vectors. | guids (Array) - List of vector GUIDs cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/vectors/bulk |
| sdk.Vector.search | Searches vectors based on criteria. | searchReq (Object) - Search request with GraphGUID, Domain, SearchType, Labels cancellationToken (optional) - AbortController | Promise<VectorSearchResult> | POST /v1.0/tenants/{tenantGuid}/vectors |
| sdk.Vector.enumerate | Enumerates vectors. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<VectorMetadata>> - Array of vectors | GET /v2.0/tenants/{tenantGuid}/vectors |
| sdk.Vector.enumerateAndSearch | Enumerates and searches vectors. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<VectorMetadata>> - Array of vectors | POST /v2.0/tenants/{tenantGuid}/vectors |
| sdk.Vector.readMany | Retrieves multiple vectors by GUID. | vectorGuids (string[]) - The GUIDs of the vectors cancellationToken (optional) - AbortController | Promise<VectorMetadata[]> - Array of vectors | GET /v1.0/tenants/{tenantGuid}/vectors?guids={vectorGuid1},{vectorGuid2},{vectorGuid3} |
Graph Operations
| Method | Description | Parameters | Returns | Endpoint |
| ------------------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------ |
| sdk.Graph.exists | Checks if a graph exists by GUID. | guid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/graphs/{guid} |
| sdk.Graph.create | Creates a new graph. | guid (string) - Graph GUID name (string) - Name of the graph data (Object) - Graph metadata (optional) cancellationToken (optional) - AbortController | Promise<Graph> | PUT /v1.0/tenants/{tenantGuid}/graphs |
| sdk.Graph.readAll | Retrieves all graphs. | request (optional) - IncludeDataAndSubordinates cancellationToken (optional) - AbortController | Promise<Graph[]> | GET /v1.0/tenants/{tenantGuid}/graphs |
| sdk.Graph.search | Searches for graphs based on criteria. | searchReq (Object) - Search request with filters cancellationToken (optional) - AbortController | Promise<SearchResult> | POST /v1.0/tenants/{tenantGuid}/graphs/search |
| sdk.Graph.read | Retrieves a specific graph by GUID. | guid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<Graph> | GET /v1.0/tenants/{tenantGuid}/graphs/{guid} |
| sdk.Graph.update | Updates an existing graph. | graph (Object) - Graph object with GUID, name, metadata cancellationToken (optional) - AbortController | Promise<Graph> | PUT /v1.0/tenants/{tenantGuid}/graphs/{graph.GUID} |
| sdk.Graph.delete | Deletes a graph by GUID. | guid (string) - Graph GUID force (boolean) - Force recursive deletion of edges and nodes (optional) cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{guid}?force=true |
| sdk.Graph.exportToGexf | Exports a graph to GEXF format. | guid (string) - Graph GUID request (optional) - IncludeDataAndSubordinates cancellationToken (optional) - AbortController | Promise<string> | GET /v1.0/tenants/{tenantGuid}/graphs/{guid}/export/gexf |
| sdk.Graph.readFirst | Retrieves the first graph. | request (Object) - Read first request with Ordering, Labels, Tags, Expr cancellationToken (optional) - AbortController | Promise<Graph> | POST /v1.0/tenants/{tenantGuid}/graphs/first |
| sdk.Graph.enumerate | Enumerates graphs. | request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Graph>> - Array of graphs | GET /v2.0/tenants/{tenantGuid}/graphs |
| sdk.Graph.enumerateAndSearch | Enumerates and searches graphs. | request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Graph>> - Array of graphs | POST /v2.0/tenants/{tenantGuid}/graphs |
| sdk.Graph.readStatistics | Retrieves statistics for a graph. | cancellationToken (optional) - AbortController | Promise<GraphStatisticsResponse> | GET /v1.0/tenants/{tenantGuid}/graphs/stats |
| sdk.Graph.readStatistic | Retrieves statistics for a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<GraphStatistics> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/stats |
| sdk.Graph.readMany | Retrieves multiple graphs by GUID. | graphGuids (string[]) - The GUIDs of the graphs cancellationToken (optional) - AbortController | Promise<Graph[]> - Array of graphs | GET /v1.0/tenants/{tenantGuid}/graphs?guids={graphGuid1},{graphGuid2},{graphGuid3} |
| sdk.Graph.enableVectorIndex | Enables vector index for a graph. | graphGuid (string) - Graph GUID request (Object) - Vector index request with VectorIndexType, VectorIndexFile, VectorDimensionality, VectorIndexM, VectorIndexEf, VectorIndexEfConstruction, VectorIndexThreshold cancellationToken (optional) - AbortController | Promise<VectorIndexEnableResponse> | PUT /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/vectorindex/enable |
| sdk.Graph.rebuildVectorIndex | Rebuilds vector index for a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<boolean> | POST /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/vectorindex/rebuild |
| sdk.Graph.deleteVectorIndex | Deletes vector index for a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<boolean> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/vectorindex |
| sdk.Graph.readVectorIndexStats | Reads vector index stats for a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<VectorIndexStatsResponse> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/vectorindex/stats |
| sdk.Graph.readVectorIndexConfig | Reads vector index config for a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<VectorIndexEnableResponse> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/vectorindex/config |
Node Operations
| Method | Description | Parameters | Returns | Endpoint |
| ----------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| sdk.Node.exists | Checks if a node exists by GUID. | graphGuid (string) - Graph GUID guid (string) - Node GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{guid} |
| sdk.Node.createBulk | Creates multiple nodes. | graphGuid (string) - Graph GUID nodes (Array) - List of node objects cancellationToken (optional) - AbortController | Promise<Array<Object>> | PUT /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/bulk |
| sdk.Node.create | Creates a single node. | node (Object) - Node object with GUID, GraphGUID, name, data, CreatedUtc cancellationToken (optional) - AbortController | Promise<Node> | PUT /v1.0/tenants/{tenantGuid}/graphs/{node.GraphGUID}/nodes |
| sdk.Node.readAll | Retrieves all nodes in a graph. | graphGuid (string) - Graph GUID request (optional) - IncludeDataAndSubordinates cancellationToken (optional) - AbortController | Promise<Node[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes |
| sdk.Node.search | Searches for nodes based on criteria. | searchReq (Object) - Search request object with GraphGUID, Ordering, Expr cancellationToken (optional) - AbortController | Promise<SearchResult> | POST /v1.0/tenants/{tenantGuid}/graphs/{searchReq.GraphGUID}/nodes/search |
| sdk.Node.read | Retrieves a specific node by GUID. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortController | Promise<Node> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid} |
| sdk.Node.update | Updates an existing node. | node (Object) - Node object with GUID, GraphGUID, name, data, CreatedUtc cancellationToken (optional) - AbortController | Promise<Node> | PUT /v1.0/tenants/{tenantGuid}/graphs/{node.GraphGUID}/nodes/{node.GUID} |
| sdk.Node.delete | Deletes a node by GUID. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid} |
| sdk.Node.deleteAll | Deletes all nodes in a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/all |
| sdk.Node.deleteBulk | Deletes multiple nodes by GUIDs. | graphGuid (string) - Graph GUID nodeGuids (Array) - List of node GUIDs cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/bulk |
| sdk.Node.readFirst | Retrieves the first node in a graph. | graphGuid (string) - Graph GUID request (Object) - Read first request with Ordering, Labels, Tags, Expr cancellationToken (optional) - AbortController | Promise<Node> | POST /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/first |
| sdk.Node.enumerate | Enumerates nodes. | graphGuid (string) - Graph GUID request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Node>> - Array of nodes | GET /v2.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes |
| sdk.Node.enumerateAndSearch | Enumerates and searches nodes. | graphGuid (string) - Graph GUID request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Node>> - Array of nodes | POST /v2.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes |
| sdk.Node.readMany | Retrieves multiple nodes by GUID. | nodeGuids (string[]) - The GUIDs of the nodes cancellationToken (optional) - AbortController | Promise<Node[]> - Array of nodes | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes?guids={nodeGuid1},{nodeGuid2},{nodeGuid3} |
Edges Operations
| Method | Description | Parameters | Returns | Endpoint |
| ----------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| sdk.Edge.exists | Checks if an edge exists by GUID. | graphGuid (string) - Graph GUID guid (string) - Edge GUID cancellationToken (optional) - AbortController | Promise<boolean> | HEAD /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/{guid} |
| sdk.Edge.createBulk | Creates multiple edges. | graphGuid (string) - The GUID of the graph edges (Array) - List of edge objects cancellationToken (optional) - AbortController | Promise<Array<Object>> | PUT /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/bulk |
| sdk.Edge.create | Creates an edge. | edge (Object) - Edge object with GUID, GraphGUID, Name, From, To, Cost, CreatedUtc, Data cancellationToken (optional) - AbortController | Promise<Edge> | PUT /v1.0/tenants/{tenantGuid}/graphs/{edge.GraphGUID}/edges |
| sdk.Edge.readAll | Retrieves all edges in a graph. | graphGuid (string) - Graph GUID request (optional) - IncludeDataAndSubordinates cancellationToken (optional) - AbortController | Promise<Edge[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges |
| sdk.Edge.search | Searches for edges based on criteria. | searchReq (Object) - Search request object containing GraphGUID, Ordering, Expr cancellationToken (optional) - AbortController | Promise<SearchResult> | POST /v1.0/tenants/{tenantGuid}/graphs/{searchReq.GraphGUID}/edges/search |
| sdk.Edge.read | Retrieves an edge by GUID. | graphGuid (string) - Graph GUID edgeGuid (string) - Edge GUID cancellationToken (optional) - AbortController | Promise<Edge> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/{edgeGuid} |
| sdk.Edge.update | Updates an edge. | edge (Object) - Edge object with GUID, GraphGUID, Name, From, To, Cost, CreatedUtc, Data cancellationToken (optional) - AbortController | Promise<Edge> | PUT /v1.0/tenants/{tenantGuid}/graphs/{edge.GraphGUID}/edges/{edge.GUID} |
| sdk.Edge.delete | Deletes an edge by GUID. | graphGuid (string) - Graph GUID edgeGuid (string) - Edge GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/{edgeGuid} |
| sdk.Edge.deleteAll | Deletes all edges in a graph. | graphGuid (string) - Graph GUID cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/all |
| sdk.Edge.deleteBulk | Deletes multiple edges by GUIDs. | graphGuid (string) - Graph GUID edgeGuids (Array) - List of edge GUIDs cancellationToken (optional) - AbortController | Promise<void> | DELETE /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/bulk |
| sdk.Edge.readFirst | Retrieves the first edge in a graph. | graphGuid (string) - Graph GUID request (Object) - Read first request with Ordering, Labels, Tags, Expr cancellationToken (optional) - AbortController | Promise<Edge> | POST /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/first |
| sdk.Edge.enumerate | Enumerates edges. | graphGuid (string) - Graph GUID request (optional) - EnumerateRequest cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Edge>> - Array of edges | GET /v2.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges |
| sdk.Edge.enumerateAndSearch | Enumerates and searches edges. | graphGuid (string) - Graph GUID request (EnumerateAndSearchRequest) - The request object cancellationToken (optional) - AbortController | Promise<EnumerateResponse<Edge>> - Array of edges | POST /v2.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges |
| sdk.Edge.readMany | Retrieves multiple edges by GUID. | edgeGuids (string[]) - The GUIDs of the edges cancellationToken (optional) - AbortController | Promise<Edge[]> - Array of edges | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges?guids={edgeGuid1},{edgeGuid2},{edgeGuid3} |
Route Operations
| Method | Description | Parameters | Returns | Endpoint |
| ------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------- |
| sdk.Route.getEdgesFromNode | Retrieves edges from a given node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Edge[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/edges/from |
| sdk.Route.getEdgesToNode | Retrieves edges to a given node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Edge[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/edges/to |
| sdk.Route.getEdgesBetween | Retrieves edges from one node to another. | graphGuid (string) - Graph GUID fromNodeGuid (string) - From node GUID toNodeGuid (string) - To node GUID cancellationToken (optional) - AbortSignal | Promise<Edge[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/edges/between?from={fromNodeGuid}&to={toNodeGuid} |
| sdk.Route.getAllNodeEdges | Retrieves all edges to or from a node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Edge[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/edges |
| sdk.Route.getChildrenFromNode | Retrieves child nodes from a node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Node[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/children |
| sdk.Route.getParentsFromNode | Retrieves parent nodes from a node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Node[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/parents |
| sdk.Route.getNodeNeighbors | Retrieves neighboring nodes from a node. | graphGuid (string) - Graph GUID nodeGuid (string) - Node GUID cancellationToken (optional) - AbortSignal | Promise<Node[]> | GET /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/nodes/{nodeGuid}/neighbors |
| sdk.Route.getRoutes | Retrieves routes between two nodes. | graphGuid (string) - Graph GUID fromNodeGuid (string) - From node GUID toNodeGuid (string) - To node GUID cancellationToken (optional) - AbortSignal | Promise<RouteResult> | POST /v1.0/tenants/{tenantGuid}/graphs/{graphGuid}/routes |
Backup Operations
| Method | Description | Parameters | Returns | Endpoint |
| -------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------------- |
| sdk.Backup.readAll | Retrieves all backups. | cancellationToken (optional) - AbortSignal | Promise<BackupMetaData[]> | GET /v1.0/backups |
| sdk.Backup.read | Retrieves a specific backup with data. | filename (string) - Backup filename cancellationToken (optional) - AbortSignal | Promise<BackupMetaData> | GET /v1.0/backups/{filename} |
| sdk.Backup.create | Creates a new backup. | backup (Object) - Backup object with Filename, CreatedUtc, Size cancellationToken (optional) - AbortSignal | Promise<BackupMetaData> | PUT /v1.0/backups |
| sdk.Backup.delete | Deletes a backup. | filename (string) - Backup filename cancellationToken (optional) - AbortSignal | Promise<void> | DELETE /v1.0/backups/{filename} |
| sdk.Backup.exists | Checks if a backup exists. | filename (string) - Backup filename cancellationToken (optional) - AbortSignal | Promise<boolean> | HEAD /v1.0/backups/{filename} |
Admin SDK Operations
| Method | Description | Parameters | Returns | Endpoint |
| ----------------- | ------------------ | ---------------------------------------------- | ------------------ | ------------------ |
| sdk.Admin.flush | Flushes the cache. | cancellationToken (optional) - AbortSignal | Promise<boolean> | POST /v1.0/flush |
Core Components
Base Models
TenantMetaData: Represents a tenant in the systemGraph: Represents a graph containerNode: Represents a node in a graphEdge: Represents a connection between nodesRouteRequest: Used for finding routes between nodesRouteResult: Contains route finding resultsExistenceRequest: Used for checking the existence
API Resource Operations
Please refer to demo/index.ts[demo/index.ts] for the usage of the API.
Development
Linking the project locally (for development and testing)
To use the library locally without publishing to a remote npm registry, first install the dependencies with the command:
npm installThen, build the project with the command:
npm run buildNext, link it globally in local system's npm with the following command:
npm linkTo use the link you just defined in your project, switch to the directory you want to use your litegraphdb from, and run:
npm link litegraphdbDemo/Testing Environment
To streamline the process, you can use the following command to link the project locally and setup the demo environment to run the demo stored at demo/index.ts:
npm run demo:setupand to run the demo, use the following command:
npm run demoYou can then import the SDK with either import or require based on the ES Module (esm) or CommonJS (cjs) project, as shown below:
import { LiteGraphSdk } from 'litegraphdb';
//or
var { LiteGraphSdk } = require('litegraphdb');Setting up Pre-commit Hooks
The pre-commit hooks will run automatically on git commit. They help maintain:
- Code formatting (using ruff)
- Import sorting
- Code quality checks
- And other project-specific checks
Running Tests
The project uses jest for running tests in isolated environments. Make sure you have jest installed, which should automatically be there if you have installed dependencies via npm i command:
# Run only the tests
npm run test
# Run tests with coverage report
npm run test:coverage
Contributing
We welcome contributions! Please see our Contributing Guidelines for details
Feedback and Issues
Have feedback or found an issue? Please file an issue in our GitHub repository.
Version History
Please refer to CHANGELOG.md for a detailed version history.
