{"id":28700751,"url":"https://github.com/nebula-contrib/nebula-node","last_synced_at":"2025-07-01T14:03:41.319Z","repository":{"id":37813259,"uuid":"317171789","full_name":"nebula-contrib/nebula-node","owner":"nebula-contrib","description":"Nebula Graph Client for Node.js","archived":false,"fork":false,"pushed_at":"2024-01-04T09:41:23.000Z","size":1283,"stargazers_count":31,"open_issues_count":3,"forks_count":10,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-24T16:23:37.149Z","etag":null,"topics":["graphdatabase","hacktoberfest","nebula-graph","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nebula-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-30T09:23:49.000Z","updated_at":"2025-05-17T14:50:27.000Z","dependencies_parsed_at":"2024-01-04T10:37:45.447Z","dependency_job_id":"23fabeff-7bfc-4fe4-a58a-4f9944de86d2","html_url":"https://github.com/nebula-contrib/nebula-node","commit_stats":{"total_commits":12,"total_committers":6,"mean_commits":2.0,"dds":0.6666666666666667,"last_synced_commit":"2b04b5ed3eebab31a5c2e87361d563f6a784856a"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nebula-contrib/nebula-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebula-contrib%2Fnebula-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebula-contrib%2Fnebula-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebula-contrib%2Fnebula-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebula-contrib%2Fnebula-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nebula-contrib","download_url":"https://codeload.github.com/nebula-contrib/nebula-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebula-contrib%2Fnebula-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259810961,"owners_count":22915134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphdatabase","hacktoberfest","nebula-graph","nodejs"],"created_at":"2025-06-14T11:40:44.310Z","updated_at":"2025-06-14T11:40:45.083Z","avatar_url":"https://github.com/nebula-contrib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nebula Nodejs SDK\n\nThis repository provides Nebula client API in Nodejs.\n\n## Features\n\n- Muti-Server Support\n- Auto-reconnection support\n\n  Client will try to reconnect forever, until the server is available again.  \n\n- Connection pool support\n- Disconnection detection\n\n  A heartbeat mechanism is implemented, client will send ping to server each `pingInterval` ms for detect connective\n\n- Thrift enhancement\n\n  fix auto reconnect issue[#2407](https://github.com/apache/thrift/pull/2407)  \n\n  fix performance issue in huge data scene[#2483](https://github.com/apache/thrift/pull/2483)\n\n## API\n\n### Connection Options\n\n| parameter      | type     | description                                                                     |\n| -------------- | -------- | ------------------------------------------------------------------------------- |\n| servers        | string[] | nebula servers                                                                  |\n| userName       | string   | username for login                                                              |\n| password       | string   | password for login                                                              |\n| space          | string   | space name in nebula server                                                     |\n| poolSize       | number   | Pool size for each server(Optional, default：5)                                 |\n| bufferSize     | number   | Command cache in offline or before established connect (Optional, defaul: 2000) |\n| executeTimeout | number   | Command executing timeout in ms (Optional, default：10000)                      |\n| pingInterval   | number   | for keepalive, ping duration in ms, (Optional, default：60000）                 |\n\n### How To\n\n#### Install\n\nFor compiling C++ native module, `node-gyp` is required, you can install `node-gyp` by `npm install -g node-gyp`\n\n```shell\nnpm install @nebula-contrib/nebula-nodejs --save --unsafe-perm\n```\n\n#### Simple and convenient API\n\n```typescript\n// ESM\nimport { createClient } from '@nebula-contrib/nebula-nodejs'\n\n// CommonJS\n// const { createClient } = require('@nebula-contrib/nebula-nodejs')\n\n// Connection Options\nconst options = {\n  servers: ['ip-1:port','ip-2:port'],\n  userName: 'xxx',\n  password: 'xxx',\n  space: 'space name',\n  poolSize: 5,\n  bufferSize: 2000,\n  executeTimeout: 15000,\n  pingInterval: 60000\n}\n\n// Create client\nconst client = createClient(options)\n\n// Execute command\n// 1. return parsed data (recommend)\nconst response = await client.execute('GET SUBGRAPH 3 STEPS FROM -7897618527020261406')\n// 2. return nebula original data\nconst responseOriginal = await client.execute('GET SUBGRAPH 3 STEPS FROM -7897618527020261406', true)\n\n```\n\n#### Events\n\n| parameter         | description                                  |\n| ----------------- | -------------------------------------------- |\n| sender            | the individual connection in connection pool |\n| error             | Nebula Error                                 |\n| retryInfo         | Retry information                            |\n| retryInfo.delay   | delay time                                   |\n| retryInfo.attempt | total attempts                               |\n\n```javascript\nconst client = createClient(options)\n\n// connection is ready for executing command\nclient.on('ready', ({sender}) =\u003e {\n\n})\n\n// error occurs\nclient.on('error', ({ sender, error }) =\u003e {\n\n})\n\n// connected event\nclient.on('connected', ({ sender }) =\u003e {\n\n})\n\n// authorized successfully\nclient.on('authorized', ({ sender }) =\u003e {\n\n})\n\n// reconnecting\nclient.on('reconnecting', ({ sender, retryInfo }) =\u003e {\n\n})\n\n// closed\nclient.on('close', { sender }) =\u003e {\n\n}\n```\n\n### About hash64 function\n\n`nebula-nodejs` exports `hash64` function for converting `string` to `string[]`, it's based on `MurmurHash3`.\n\n```javascript\n// ESM\nimport { hash64 } from '@nebula-contrib/nebula-nodejs'\n\n// CommonJS\n// const { hash64 } = require('@nebula-contrib/nebula-nodejs')\n\nconst results = hash64('f10011b64aa4e7503cd45a7fdc24387b')\n\nconsole.log(results)\n\n// Output:\n// ['2852836996923339651', '-6853534673140605817']\n```\n\n### About Int64\n\nnodejs cannot repreent `Int64`, so we convert `Int64` bytes to `string`\n\n```javascript\n// ESM\nimport { bytesToLongLongString } from '@nebula-contrib/nebula-nodejs'\n\n// CommonJS\n// const { bytesToLongLongString } = require('@nebula-contrib/nebula-nodejs')\n\nconst s = '-7897618527020261406'\n\nconst buffer = [146, 102, 5, 203, 5, 105, 223, 226]\nconst result = bytesToLongLongString(buffer)\n\n// result equals s\n```\n\n## Development\n\n### Build\n\n```shell\ngit clone https://github.com/nebula-contrib/nebula-node.git\ncd nebula-node\nnpm install --unsafe-perm\nnpm run build\n```\n\n### Unit Test\n\n```shell\nnpm run build\nnpm run test\n```\n\n### Unit Test Coverage\n\n```shell\nnpm run coverage\n```\n\n### Publish\n\n```shell\nnpm run build\ncd dist\nnpm publish\n```\n\n## TODO\n\nNot implemented data type for auto parser\n\n| Data Type | property name in nebula response |\n| --------- | -------------------------------- |\n| DataSet   | gVal                             |\n| Geography | ggVal                            |\n| Duration  | duVal                            |\n\n## Released Versions in npmjs.com\n\n| NodeJS Client Version | Nebula Graph Version  |\n| --------------------- | --------------------- |\n| [2.6.2](https://www.npmjs.com/package/@nebula-contrib/nebula-nodejs/v/2.6.2)                 | 2.6.x                 |\n| [3.0.3](https://www.npmjs.com/package/@nebula-contrib/nebula-nodejs/v/3.0.3)                 | 3.x           |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebula-contrib%2Fnebula-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnebula-contrib%2Fnebula-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebula-contrib%2Fnebula-node/lists"}