{"id":13726313,"url":"https://github.com/tahnik/graphqlx","last_synced_at":"2025-08-03T06:44:44.550Z","repository":{"id":57253746,"uuid":"129164132","full_name":"tahnik/graphqlx","owner":"tahnik","description":"A GraphQL client written in OCaml and JavaScript","archived":false,"fork":false,"pushed_at":"2018-08-06T11:18:28.000Z","size":649,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T07:51:42.049Z","etag":null,"topics":["bucklescript","graphql","javascript","ocaml"],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/tahnik.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":"2018-04-11T23:03:58.000Z","updated_at":"2019-09-10T19:28:46.000Z","dependencies_parsed_at":"2022-08-31T22:12:01.287Z","dependency_job_id":null,"html_url":"https://github.com/tahnik/graphqlx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahnik%2Fgraphqlx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahnik%2Fgraphqlx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahnik%2Fgraphqlx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahnik%2Fgraphqlx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tahnik","download_url":"https://codeload.github.com/tahnik/graphqlx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910379,"owners_count":20367537,"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":["bucklescript","graphql","javascript","ocaml"],"created_at":"2024-08-03T01:02:58.962Z","updated_at":"2025-03-18T06:31:08.628Z","avatar_url":"https://github.com/tahnik.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# GraphQLx - A JavaScript Client Library for GraphQL\n***\nThis JavaScript library uses a unique combination OCaml and JavaScript in order to achieve better performance and maintainance. \n\nThe tools used to build is library are:\n  * ocamllex\n  * menhir\n  * ocamlbuild\n  * bucklescript\n  * webpack\n\n## How to use\nThe package is available as npm package. To install the package, run the following command:\n```\nnpm install --save graphqlx\n```\n\nthen import in your JavaScript file;\n```\n// es6\nimport { fetch, parse, validate } from 'graphqlx';\n\n// commonJS\nconst { fetch, parse, validate } = require('graphqlx');\n```\n\nThe library exposes 3 different functions:\n\n  * `fetch(endpoint: string, query: string, headers: object)`\n  * `parse(query: string, pretty_print: boolean)`\n  * `validate(query: string)` \n\nHere are some examples:\n### fetch\n```\nlet query = `{\n  me {\n    name\n  }\n}`;\n\nlet endpoint = \"https://api.example.com\";\n\nfetch(endpoint, query);\n```\n\nIf need to add a header to the request:\n\n```\nlet query = `{\n  me {\n    name\n  }\n}`;\n\nlet endpoint = \"https://api.example.com\";\n\nlet config = { Authorization: \"bearer SOME_TOKEN\" };\n\nfetch(endpoint, query, config);\n```\n\n### parse\nThis function parses the query.\n```\nlet query = `{\n  me {\n    name\n  }\n}`;\n\nparse(query);\n```\nYou can add a optional boolean argument in `parse()` to print out the AST tree.\n\n```\nlet query = `{\n  me {\n    name\n  }\n}`;\n\nparse(query, true);\n```\n\n### validate\nThis function parses and validates the query.\n```\nlet query = `{\n  me {\n    name\n  }\n}`;\n\nvalidate(query);\n```\n\n## Contribute\n\nThis project can only be developed in linux. Here are the instructions for debian based distros:\n\n### Prerequisite\n\n```\nsudo apt install build-essentials\n```\n\n### Dependencies\n\n* ocaml: `sudo apt install ocaml`\n* opam: `sudo apt install opam`\n* menhir: `opam install menhir`\n* nodejs: Follow the instruction from NodeJS website.\n\nOnce you have everything installed, make a pull request and I will have a look :)\n\n## LICENSE\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahnik%2Fgraphqlx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftahnik%2Fgraphqlx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahnik%2Fgraphqlx/lists"}