{"id":44593983,"url":"https://github.com/brakebein/neo4j-request","last_synced_at":"2026-02-14T08:00:36.933Z","repository":{"id":57309866,"uuid":"263064379","full_name":"Brakebein/neo4j-request","owner":"Brakebein","description":"Wrapper for neo4j-driver to simplify requests","archived":false,"fork":false,"pushed_at":"2023-07-19T03:35:57.000Z","size":144,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T02:36:34.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Brakebein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T14:21:11.000Z","updated_at":"2022-11-14T15:49:50.000Z","dependencies_parsed_at":"2023-01-22T04:08:18.100Z","dependency_job_id":null,"html_url":"https://github.com/Brakebein/neo4j-request","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Brakebein/neo4j-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brakebein%2Fneo4j-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brakebein%2Fneo4j-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brakebein%2Fneo4j-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brakebein%2Fneo4j-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Brakebein","download_url":"https://codeload.github.com/Brakebein/neo4j-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Brakebein%2Fneo4j-request/sbom","scorecard":{"id":24142,"data":{"date":"2025-08-11","repo":{"name":"github.com/Brakebein/neo4j-request","commit":"f8b5419889803e0dfaace485316dcc8d440e2770"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T17:27:56.551Z","repository_id":57309866,"created_at":"2025-08-14T17:27:56.551Z","updated_at":"2025-08-14T17:27:56.551Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29439820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T07:24:13.446Z","status":"ssl_error","status_checked_at":"2026-02-14T07:23:58.969Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-14T08:00:17.639Z","updated_at":"2026-02-14T08:00:36.924Z","avatar_url":"https://github.com/Brakebein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neo4j-request\n\nA wrapper for the official [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver) that simplifies the execution of cypher queries by encapsulating session opening and closing as well as transaction handling in respective methods.\nThe queried records are extracted to a simplified format, non-standard properties (e.g. dates) are converted.\n\nCurrently, this package only makes use of the Promise API of neo4j-driver.\nFeatures like the Streaming API or bookmarks are not yet implemented.\n\n## Installation\n\nVia npm:\n\n    npm install neo4j-request\n\n## Usage\n\nImport:\n\n```javascript\nconst neo4j = require('neo4j-request');\n// or\nimport * as neo4j from 'neo4j-request';\n```\n\n### init\n\nBefore doing any transaction, the neo4j-driver needs to be initialized once.\nThe driver instance is set globally, such that you can import `neo4j-request` in any other module without the need to initialize again.\nIf the node application closes, the driver gets closed as well.\n\nIf the Neo4j instance is unavailable, connection is not possible.\nDriver instantiation will be re-invoked a few times before throwing an error (useful in cases like server startup when node application is live earlier than the Neo4j database instance).\n\nFor detailed `options` refer to [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver).\n\n```javascript\nneo4j.init(url, user, password, database = 'neo4j', options = {disableLosslessIntegers: true});\n```\n\n|Param|Details|\n|---|---|\n|`url`|_Type:_ `string` \u003cbr\u003e Usually something like  `neo4j://localhost`.|\n|`user`|_Type:_ `string`|\n|`password`|_Type:_ `string`|\n|`database` \u003cbr\u003e _(optional)_|_Type:_ `string` \u003cbr\u003e _Default: `neo4j`_ \u003cbr\u003e If using Neo4j 3.x, this information gets ignored.|\n|`options` \u003cbr\u003e _(optional)_|_Type:_ `Object` \u003cbr\u003e For details refer to [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver).\n\nReturns `Promise\u003cServerInfo\u003e`.\n\n### readTransaction\n\nA very simple read transaction that expects a cypher statement and (optionally) query parameters.\n\n|Param|Details|\n|---|---|\n|`query`|_Type:_ `string`|\n|`params` \u003cbr\u003e _(optional)_|_Type:_ `Object\u003cstring, any\u003e`|\n\nReturns `Promise\u003cObject[]\u003e`: an array of objects, where the object's property names correlate with identifiers within the `RETURN` clause.\n\n```javascript\nconst query = `\n  MATCH (p:Person {name: $name})-[:HAS_ADDRESS]-\u003e(add:Address)\n  RETURN p.name AS name, add AS address\n`;\n\nconst params = {\n  name: 'Alex'\n};\n\ntry {\n  \n  const results = await neo4j.readTransaction(query, params);\n  console.log(results);\n  \n} catch (e) {\n  \n  // handle error\n  \n}\n\n// console.log(results)\n// [\n//   {\n//     name: 'Alex',\n//     address: {\n//       ZIP: '10178',\n//       number: '1',\n//       town: 'Berlin',\n//       street: 'Alexanderplatz'\n//     }\n//   }\n// ]\n```\n\n### writeTransaction\n\nVery similar to `readTransaction` (see for details) except that it expects a cypher statement that modifies the database.\n\n### multipleStatements\n\nExecute multiple cypher queries within one transaction.\nA fail of one statement will lead to the rollback of the whole transaction.\n\n|Param|Details|\n|---|---|\n|`statements`|_Type:_ `Array\u003c{statement: string, parameters: Object\u003cstring, any\u003e}\u003e`|\n\nReturns `Promise\u003cObject[][]\u003e`: an array of arrays similar to `readTransaction`.\n\n```javascript\n\nconst statements = [{\n  statement: `CREATE ...`,\n  parameters: {}\n}, {\n  statement: `MATCH ... CREATE (n:Node $map) ...`,\n  parameters: { map: { value: 'foo' } }\n}];\n\ntry {\n  \n  const results = await neo4j.multipleStatements(statements);\n  // handle results\n  \n} catch (e) {\n  \n  // handle error\n  \n}\n```\n\n### getDriver\n\nGet the driver instance to access full API of [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver).\n\n```javascript\nconst driver = neo4j.getDriver();\n```\n\n### session\n\nAcquire a session to execute, e.g., [explicit transactions](https://github.com/neo4j/neo4j-javascript-driver#explicit-transactions).\n\n```javascript\nconst session = neo4j.session();\nconst txc = session.beginTransaction();\n\n// ...\n\nawait session.close();\n```\n\n### extractRecords\n\nUsed internally to extract and convert the returned records by neo4j-driver to a more simplified format.\nIt converts non-standard values, like date, time, etc., to strings as well as Neo4j integers, if they are outside of the safe range.\n\nTakes an array of records `Record[]` and returns an array of objects `Object[]`.\n\n```javascript\nconst query = `\n  MATCH (p:Person {name: \"Alex\"})-[:HAS_ADDRESS]-\u003e(add:Address)\n  RETURN p.name AS name, add AS address\n`;\n\n// query results returned by neo4j-driver\n// {\n//   records: [\n//     Record {\n//       keys: [ 'name', 'address' ],\n//       length: 2,\n//       _fields: [\n//         'Alex',\n//         Node {\n//           identity: 1,\n//           labels: [ 'Address' ],\n//           properties: {\n//             ZIP: '10178',\n//             number: '1',\n//             town: 'Berlin',\n//             street: 'Alexanderplatz'\n//           }\n//         }\n//       ]\n//       _fieldLookup: { name: 0, address: 1 }\n//     }\n//   ],\n//   summary: ResultSummary {...}\n// }\n\nextractRecords(queryResults.records);\n\n// simplified records returned by neo4j-request\n// {\n//   name: 'Alex',\n//   address: {\n//     ZIP: '10178',\n//     number: '1',\n//     town: 'Berlin',\n//     street: 'Alexanderplatz'\n//   }\n// }\n```\n\n### removeEmptyArrays\n\nLook for empty arrays returned by Neo4j and clean them, if there is `null` inside.\n\nSometimes, if the cypher query contains `OPTIONAL MATCH node` in combination with  `collect({key: node.value}) AS values`, the resulting array may be filled with one object with `null` values: `[{key: null}]`. This method reduces the array to `[]` by calling `removeEmptyArrays(data, 'values', 'key')`.\n\n|Param|Details|\n|---|---|\n|`data`|_Type:_ `any[]`|\n|`arrayKey`|_Type:_ `string` \u003cbr\u003e Property key of the array to check.|\n|`checkKey`|_Type:_ `string` \u003cbr\u003e Property key of first array element to check against `null`.|\n\nReturns cleaned data array.\n\n```javascript\nconst query = `\n  MATCH (p:Person {name: \"Alex\"})-[:HAS_ADDRESS]-\u003e(add:Address)\n  OPTIONAL MATCH (p)-[:HAS_FRIEND]-\u003e(f:Person)-[:HAS_ADDRESS]-\u003e(fAddr:Address)\n  RETURN p.name AS name,\n         add AS address,\n         collect({name: f.name, address: fAddr}) AS friends\n`;\n\nconst results = await neo4j.readTransaction(query);\nconsole.log(results);\n\n// [\n//   {\n//     name: 'Alex',\n//     address: {\n//       ZIP: '10178',\n//       number: '1',\n//       town: 'Berlin',\n//       street: 'Alexanderplatz'\n//     },\n//     friends: [ { address: null, name: null } ]\n//   }\n// ]\n\nconst resultsCleaned = neo4j.removeEmptyArrays(results, 'friends', 'name');\nconsole.log(resultsCleaned);\n\n// [\n//   {\n//     name: 'Alex',\n//     address: {\n//       ZIP: '10178',\n//       number: '1',\n//       town: 'Berlin',\n//       street: 'Alexanderplatz'\n//     },\n//     friends: []\n//   }\n// ]\n```\n\n## Testing\n\nCopy `test/config-sample.js` to `test/config.js` and change the values according to the settings of your Neo4j instance. Then, run test command:\n\n    npm test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrakebein%2Fneo4j-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrakebein%2Fneo4j-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrakebein%2Fneo4j-request/lists"}