{"id":17815793,"url":"https://github.com/cuongndc9/hera","last_synced_at":"2026-02-11T20:10:46.350Z","repository":{"id":54760526,"uuid":"221253854","full_name":"cuongndc9/hera","owner":"cuongndc9","description":"👩🏼‍💻 Simple and lightweight GraphQL client.","archived":false,"fork":false,"pushed_at":"2025-03-22T15:53:35.000Z","size":147,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T15:33:31.277Z","etag":null,"topics":["103cuong","apollo","apollo-client","graphql","graphql-client","graphql-request","hera","hera-js"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hera-js","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/cuongndc9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-12T15:46:00.000Z","updated_at":"2025-03-22T15:53:39.000Z","dependencies_parsed_at":"2022-08-14T02:00:50.449Z","dependency_job_id":null,"html_url":"https://github.com/cuongndc9/hera","commit_stats":null,"previous_names":["103cuong/hera","cuonginspire/hera","cuongnd9/hera","cuongndc/hera","cuongndc9/hera"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cuongndc9/hera","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongndc9%2Fhera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongndc9%2Fhera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongndc9%2Fhera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongndc9%2Fhera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuongndc9","download_url":"https://codeload.github.com/cuongndc9/hera/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongndc9%2Fhera/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29343683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T18:58:20.535Z","status":"ssl_error","status_checked_at":"2026-02-11T18:56:44.814Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["103cuong","apollo","apollo-client","graphql","graphql-client","graphql-request","hera","hera-js"],"created_at":"2024-10-27T16:23:22.011Z","updated_at":"2026-02-11T20:10:46.345Z","avatar_url":"https://github.com/cuongndc9.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hera\n\n👩🏼‍💻 Simple and lightweight GraphQL client.\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg)](#contributors)\n[![Build Status](https://travis-ci.com/103cuong/hera.svg?branch=main)](https://travis-ci.com/103cuong/hera)\n![npm](https://img.shields.io/npm/v/hera-js.svg)\n![david](https://img.shields.io/david/103cuong/hera.svg)\n[![Hits-of-Code](https://hitsofcode.com/github/103cuong/hera)](https://hitsofcode.com/view/github/103cuong/hera)\n[![GitHub](https://img.shields.io/github/license/103cuong/hera.svg)](https://github.com/103cuong/hera/blob/master/LICENSE)\n\n## 🧰 installation\n\n```sh\nyarn add hera-js\n```\n\n## 🌳 usage\n\n```ts\nimport { hera } from 'hera-js';\n\nconst { data } = await hera({\n  options: {\n    url: 'https://example.com'\n  },\n  query: `\n    query {\n      user(id: $id) {\n        id\n        name\n        age\n      }\n    }\n  `,\n  variables: {\n    id: 1\n  }\n});\n```\n\n**👻 passing parameters as objects**\n\n```ts\nconst { data } = await hera({\n  options: {\n    url: 'https://example.com',\n  },\n  query: `\n    mutation {\n      createUser(info: $info) {\n        id\n        name\n        age\n        address\n        job\n      }\n    }\n  `,\n  variables: {\n    info: {\n      name: 'Cuong Tran',\n      age: 22,\n      address: 'Tam Ky - Sai Gon / Vietnam',\n      job: 'software engineer',\n    },\n  },\n});\n```\n\n**🐛 error handling**\n\n```ts\nconst { data, errors } = await hera({\n  options: {\n    url: 'https://example.com',\n  },\n  query: `\n    query {\n      user(id: $id) {\n        id\n        name\n        age\n      }\n    }\n  `,\n  variables: {\n    id: 1,\n  },\n});\n```\n\n**🌏 global options**\n\n\u003e You can specify config defaults that will be applied to every request.\n\n```ts\nimport { hera, globalOptions } from 'hera-js';\n\nglobalOptions.url = 'https://example.com';\n// globalOptions.headers = \u003cyour headers\u003e\n\nconst { data } = await hera({\n  query: `\n    mutation {\n      createUser(info: $info) {\n        id\n        name\n        age\n        address\n        job\n      }\n    }\n  `,\n  variables: {\n    info: {\n      name: 'Cuong Tran',\n      age: 22,\n      address: 'Sai Gon / Vietnam',\n      job: 'software engineer',\n    },\n  },\n});\n```\n\n**💩 enums**\n\n```ts\nconst { data } = await hera({\n  query: `\n    mutation {\n      createUser(info: $info) {\n        id\n        name\n        age\n        address\n        job\n        sex\n      }\n    }\n  `,\n  variables: {\n    info: {\n      name: 'Cuong Tran',\n      age: 22,\n      address: 'Sai Gon / Vietnam',\n      job: 'software engineer',\n      sex: 'MALE',\n    },\n  },\n  options: {\n    enums: ['sex'],\n  },\n});\n```\n\n## 🚀 API\n\n```ts\ninterface Options {\n  url?: string;\n  headers?: any;\n  timeout?: number;\n  enums?: string[];\n}\n\nhera({\n  query: string;\n  variables?: any;\n  options?: Options;\n}) : Promise\u003c{ data: any; errors: any[] }\u003e\n```\n\n### 📝 options\n\n```ts\n{\n  // `url` is the server URL that will be used for the request\n  url: '/example',\n  // `headers` are custom headers to be sent\n  headers: {\n    token: 'Fv0761DZcunUr0dKBc4oo5k55jJchwqu',\n    'Content-Type': 'application/json'\n  },\n}\n```\n\n### 📒 query\n\n\u003e `query` is query or mutation in Graphql\n\n**graphql's query**\n\n```ts\nquery: `\n  query {\n    user(id: $id) {\n      id\n      name\n      age\n    }\n  }\n`\n```\n\n**graphql's mutation**\n\n```ts\nquery: `\n  mutation {\n    createUser(info: $info) {\n      id\n      name\n      age\n      address\n      job\n    }\n  }\n`\n```\n\n### 💉 variables\n\n\u003e variables is used to pass values to query's variables\n\n```ts\nquery: `\n  mutation {\n    createUser(info: $info) {\n      id\n      name\n      age\n      address\n      job\n    }\n  }\n`,\nvariables: {\n  info: {\n    name: 'Cuong Tran',\n    age: 22,\n    address: 'Sai Gon / Vietnam',\n    job: 'software engineer',\n  },\n}\n```\n\n## 🤝 contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://103cuong.me\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/34389409?v=4\" width=\"100px;\" alt=\"Cuong Duy Nguyen\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eCuong Duy Nguyen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/103cuong/hera/commits?author=103cuong\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/103cuong/hera/commits?author=103cuong\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"https://github.com/103cuong/hera/commits?author=103cuong\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#review-103cuong\" title=\"Reviewed Pull Requests\"\u003e👀\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## 📜 license\n\nMIT © [Cuong Tran](https://github.com/103cuong)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuongndc9%2Fhera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuongndc9%2Fhera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuongndc9%2Fhera/lists"}