{"id":21396420,"url":"https://github.com/baslr/sgq","last_synced_at":"2025-03-16T14:42:27.885Z","repository":{"id":57357494,"uuid":"96765109","full_name":"baslr/sgq","owner":"baslr","description":"schema graphql query – query GraphQL with only a GraphQL IDL schema","archived":false,"fork":false,"pushed_at":"2017-07-11T16:08:23.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T14:19:56.076Z","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/baslr.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}},"created_at":"2017-07-10T10:26:29.000Z","updated_at":"2017-12-05T22:26:17.000Z","dependencies_parsed_at":"2022-09-26T16:33:13.533Z","dependency_job_id":null,"html_url":"https://github.com/baslr/sgq","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fsgq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fsgq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fsgq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fsgq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baslr","download_url":"https://codeload.github.com/baslr/sgq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885887,"owners_count":20363644,"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-11-22T14:26:59.719Z","updated_at":"2025-03-16T14:42:27.863Z","avatar_url":"https://github.com/baslr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sgq\nschema graphql query – query GraphQL with only a GraphQL IDL schema.\n\nAre you tired of writing GraphQL.js schema files?\n\nThen try `sgq`. `sgq` needs only a GraphQL IDL file and generates the GraphQL.js schema automatically.\n\n\n\n# Example\n\n\n```es6\n'use strict';\n\nconst graphql = require('graphql-sync').graphql;\nconst sgq = require('sgq');\n\n\nlet typeDefs = [`\n  type BlogEntry {\n    _key: String!\n    authorKey: String!\n\n    author: Author @aql(exec: \"FOR author in Author filter author._key == @current.authorKey return author\")\n  }\n\n  type Author {\n    _key: String!\n    name: String\n  }\n\n  type Query {\n    blogEntry(_key: String!): BlogEntry\n  }\n`]\n\nconst schema = sgq(typeDefs);\n\nconst query = `\n{\n  blogEntry(_key: \"1\") {\n    _key\n    authorKey\n    author {\n      name\n     }\n  }\n}`;\n\nconst result = graphql(schema, query);\nprint(result);\n/*\n{\n  \"data\" : {\n    \"blogEntry\" : {\n      \"_key\" : \"1\",\n      \"authorKey\" : \"2\",\n      \"author\" : {\n        \"name\" : \"Plumbum\"\n      }\n    }\n  }\n}\n*/`\n```\nIn this example two types and a query are defined. `BlogEntry` and `Author`. BlogEntry has a sub attribute Author which is fetched with a @aql directive. The query returns a BlogEntry with the corresponding Author depending on the BlogEntries _key.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fsgq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaslr%2Fsgq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fsgq/lists"}