{"id":13724985,"url":"https://github.com/michaeldgraham/cypher-tag","last_synced_at":"2025-05-12T16:33:46.750Z","repository":{"id":119469793,"uuid":"354587007","full_name":"michaeldgraham/cypher-tag","owner":"michaeldgraham","description":"A template literal tag for Cypher in GraphQL.","archived":false,"fork":false,"pushed_at":"2021-04-07T22:12:25.000Z","size":412,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T00:38:39.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/michaeldgraham.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":"2021-04-04T16:04:38.000Z","updated_at":"2023-02-02T18:11:28.000Z","dependencies_parsed_at":"2023-04-17T12:46:23.486Z","dependency_job_id":null,"html_url":"https://github.com/michaeldgraham/cypher-tag","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"9c606bc7e592857fb92ff3ec407e8b664e3c58a1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeldgraham%2Fcypher-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeldgraham%2Fcypher-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeldgraham%2Fcypher-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeldgraham%2Fcypher-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaeldgraham","download_url":"https://codeload.github.com/michaeldgraham/cypher-tag/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253777373,"owners_count":21962677,"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":[],"created_at":"2024-08-03T01:02:08.823Z","updated_at":"2025-05-12T16:33:46.721Z","avatar_url":"https://github.com/michaeldgraham.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## [cypher-tag](https://www.npmjs.com/package/cypher-tag)\n\nA JavaScript template literal tag for Cypher in GraphQL.\n## Motivation\nThe [neo4j-graphql-js](https://www.npmjs.com/package/neo4j-graphql-js) and [@neo4j/graphql](https://www.npmjs.com/package/@neo4j/graphql) libraries define a [@cypher](https://grandstack.io/docs/graphql-custom-logic) directive used for statically embedding Cypher statements on fields. This allows for writing custom operations that translate GraphQL to Cypher, on top of the default translation logic.\n\n```graphql\ndirective @cypher(statement: String!) on FIELD_DEFINITION ...\n```\n\nBut there is no syntax highlighting for Cypher within GraphQL and attempting to define a `cypher` or `cql` tag must handle for nested composition. \n## Syntax Highlighting\nIf you install the [Cypher Query Language Tools for Neo4j](https://marketplace.visualstudio.com/items?itemName=AnthonyJGatlin.vscode-cypher-query-language-tools) VSCode extension, then syntax highlighting will be supported when using the `cql` template literal tag.\n\n#### Not Highlighted\n\n![Not Highlighted](https://github.com/michaeldgraham/cypher-tag/blob/main/no-highlight.png?raw=true)\n\nWhen using `cql`, the tagged template literal is wrapped with a GraphQL [Block String](https://spec.graphql.org/June2018/#sec-String-Value) when compiled.\n\nSo instead of writing:\n\n```graphql\ntype Type {\n  field: OutputType @cypher(statement: \" ... \")\n}\n```\nOr writing: \n```graphql\ntype Type {\n  field: OutputType @cypher(statement: \"\"\"\n    ...\n  \"\"\")\n}\n```\n\nYou can write:\n```graphql\ntype Type {\n  field: OutputType @cypher(statement: ${cql`\n    ... \n  `})\n}\n```\n\n#### Highlighted\n\n![Highlighted](https://github.com/michaeldgraham/cypher-tag/blob/main/highlighted.png?raw=true)\n# Composition\nYou can use the `cql` tag to compose the Cypher of another `cql` tag. This enables composition and reuse of Cypher template variables, perhaps while using imperative tooling, making your `@cypher` directives [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself). One caveat with the VSCode extension is that syntax highlighting breaks when `cql` is used on a variable but has a space behind it.\n\n![Composition](https://github.com/michaeldgraham/cypher-tag/blob/main/composition.png?raw=true)\n\n## Roadmap\n  * Static validation of Cypher in string literals tagged with `cql`\n  * Corresponding VSCode extension\n    * Improved syntax highlighting\n    * IntelliSense integration with GraphQL schema\n    * Activity bar tab with directory navigation for only files containing `cql`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeldgraham%2Fcypher-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeldgraham%2Fcypher-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeldgraham%2Fcypher-tag/lists"}