{"id":15061600,"url":"https://github.com/qwiery/qwiery-cypher","last_synced_at":"2026-02-06T04:32:02.784Z","repository":{"id":213651946,"uuid":"734185660","full_name":"Qwiery/qwiery-cypher","owner":"Qwiery","description":"Qwiery adapter to property graphs.","archived":false,"fork":false,"pushed_at":"2024-01-17T08:50:04.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T06:03:24.969Z","etag":null,"topics":["cypher","graphdatabase","neo4j"],"latest_commit_sha":null,"homepage":"https://qwiery.com","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/Qwiery.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-21T04:36:10.000Z","updated_at":"2024-01-10T15:34:11.000Z","dependencies_parsed_at":"2024-11-14T14:21:46.923Z","dependency_job_id":"f39466d0-13be-4f2e-a241-b8888350e67a","html_url":"https://github.com/Qwiery/qwiery-cypher","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"59de61b2c0eb6a2a0a633740d7aeb29c210d78a2"},"previous_names":["qwiery/qwiery-cypher"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qwiery%2Fqwiery-cypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qwiery%2Fqwiery-cypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qwiery%2Fqwiery-cypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qwiery%2Fqwiery-cypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qwiery","download_url":"https://codeload.github.com/Qwiery/qwiery-cypher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243723170,"owners_count":20337325,"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":["cypher","graphdatabase","neo4j"],"created_at":"2024-09-24T23:22:17.891Z","updated_at":"2026-02-06T04:32:02.753Z","avatar_url":"https://github.com/Qwiery.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypher Adapter\n\nThis package wraps the essential CRUD (create,read, update, delete) operations for a Cypher backend. \nIt is also a plugin for the [Qwiery](https://qwiery.com) data access layer. \n\nIf you need to create a proof of concept (browser app) with a graph sitting in Neo4j, this is the package to use. It doesn;t depend on a particular UI framework and is straightforward to use.\n\nIf you use Qwiery, this adapter can be plugged in and replaces the default (lightweight) JSON implementation. \n\n## In a browser app\n\nWhether you use React, Angular, Vue or any other framework, you can use this adapter to connect to a Neo4j backend.\n\n\n\n```bash\nnpm install neo4j-driver\nnpm install @orbifold/cypher\n```\n\n```js\nimport {GraphAPI} from \"@orbifold/cypher\";\n\nconst n = await api.createNode({ name: \"John\" });\nlet john = await api.getNode(n.id);\nexpect(john.name).toEqual(\"John\");\njohn = await api.getNode({ name: \"John\" });\nexpect(john.name).toEqual(\"John\");\n```\n\nThe following defaults are used to connect:\n```js\nconst ConnectionDefaults = {\n\tprotocol: \"bolt\",\n\thost: \"localhost\",\n\tport: 7687,\n\tusername: \"neo4j\",\n\tpassword: \"123456789\",\n\tdefaultNodeLabel: \"Thing\",\n\tdefaultEdgeLabel: \"RelatedTo\",\n\tdatabase: \"neo4j\"\n};\n```\nyou can simply pass the options in the constructor:\n```js\nconst api = new GraphAPI({\n    password: \"my-pass\"\n});\n```\n\nSome remarks with respect to the API:\n\n- all methods return a promise\n- most methods are polymorphic, meaning that you can pass various types of arguments. For example, in the `getNode` example above you can pass a node id or a Mongo-like projection. \n- Neo4j does not allow multiple types/labels but the API does. The adapter will simply take the first given. The reason it's an array is because other Qwiery adapters do support multiple relationship labels (e.g. the [Qwiery SQL adapter](https://github.com/Qwiery/qwiery-sql).\n- some methods allow to pass separately the id, labels and data. At the same time, you can pass it as an object:\n```js\n// with an object\nconst n = await api.createNode({ name: \"John\", id:\"j\", labels:[\"Person\"] });\n// with separate arguments\nconst m = await api.createNode({ name: \"John\" },\"j\",[\"Person\"]);\n```\nIf you pass conflicting information, the parameters will have priority. For example, this will result in a node with id \"a\" and label \"Person\":\n\n```js\nconst m = await api.createNode({ name: \"John\", id:\"b\", labels:[\"P\"] },\"a\",[\"Person\"]);\n```\n\n## As a Qwiery plugin\n\nThis adapter implements all the Qwiery graph API methods. So, you only need to plug it in and your app will work with a Neo4j backend.\n\n```bash\nnpm install neo4j-driver\nnpm install @orbifold/cypher\n```\n\n```js\nimport {Qwiery} from \"@orbifold/dal\";\nimport {Cypher} from \"@orbifold/cypher\";\n// add the plugin to Qwiery\nQwiery.plugin(Cypher);\nconst q = new Qwiery({\n    // define which adapter to use (this replaces the default JSON adapter)\n    adapters: [\"cypher\"],\n    // optional: replace the defaults to connect\n    cypher: {\n        // the URL of the Cypher backend\n        url: \"bolt://localhost:7474\",\n        // the username\n        username: \"neo4j\",\n        // the password\n        password: \"neo4j\"\n    }\n});\n\n```\n\n## Building\n\nThis package is written in TypeScript and uses Vite with Vitest for testing. Vite makes it easy to build and configure the package:\n```bash\nnpm run build\n```\nThe adapter has an ES module and a CommonJS version. The ES module for the browser is defined in the `graphAPI.ts` file. The Qwiery adapter sits in the `cypherAdapter.ts` file. Both rewire methods to the `callbackAPI.ts` file which contains the actual implementation.\n\nThe Qwiery adapter can't be used in the browser because it depends on some NodeJs mechanics. The whole Qwiery data access layer is, in fact, only meaningful as a backend module.\n\nTo test the code use\n```bash\nnpm run test\n```\nNote that the Qwiery adapter necessarily depends on the DAL but if you are only interested in the browser API you can simply ignore the Qwiery mechanics. In fact, if you fork this project you can simply delete this portion without harming the client package.\n\n\n## Feedback\n\nThis component is part of the [Qwiery](https://qwiery.com) framework to help jump-start your graph visualizations. It's neither bug-free nor complete and  \nif you find something isn't as expected you [can report it](https://github.com/Qwiery/qwiery-nuxt/issues) or contact us:\n\n- [ X](https://twitter.com/theorbifold)\n- [Email](mailto:info@qwiery.com)\n- [Orbifold Consulting](https://GraphsAndNetworks.com)\n\n## Consulting and Custom Development\n\nYou can use any of the links above to contact us with respect to custom development and beyond. We have more than 20 years experience with everything graphs.\n\n## License\n\n**MIT License**\n\n_Copyright (c) 2024 Orbifold B.V._\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwiery%2Fqwiery-cypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqwiery%2Fqwiery-cypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqwiery%2Fqwiery-cypher/lists"}