{"_id":"@alevettih/ngx-graphql-client","_rev":"8-c78e98ef57aec6349eff116d73761cf9","name":"@alevettih/ngx-graphql-client","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"@alevettih/ngx-graphql-client","version":"0.0.1","_id":"@alevettih/ngx-graphql-client@0.0.1","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"dist":{"shasum":"973a2dfbbc6d3c99529b8690daf803f13b92ea75","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.1.tgz","fileCount":6,"integrity":"sha512-pKHAi6c+P8RTLaJmy+blMDpAqq3LW6yfoXiJ5I1SqhVgnXa5k0Yl40dhtYa74Tcx6enN4m2gG0KDFfbzSISlXw==","signatures":[{"sig":"MEQCICKKZYWv+TxdNp7/U5LV/MzCphe4AqARikq+TyF+crGeAiBrQJDvSVpEEXRSBfMy+KmUn4i3CzhyYUXK+HElAsw4GQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31249},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"018efe3096b7bc8c9427cc1c854ac0ea550c6ca2","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"_npmVersion":"11.6.2","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.1_1762637658153_0.508700400240107","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@alevettih/ngx-graphql-client","version":"0.0.2","_id":"@alevettih/ngx-graphql-client@0.0.2","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"dist":{"shasum":"bbe0f2f39516d45bc1870a03423bc7ba92b04f53","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.2.tgz","fileCount":50,"integrity":"sha512-CfsY2mpm/NxRCiQSy0KsFJrMjfBQaJoxcwCxiOqWYo2sD1x+CtTx+vrgxlVpP18rCJI9ZRQG+Kv5y7whj7VwmQ==","signatures":[{"sig":"MEUCIDhKVbvkz6i/bdyW++N6RG8KWBoh3Qsvto2t74VU9f5nAiEAkpJVIJ85TcxUK73JAyKBQKTHfP1r4ZJmlkh09Wu20lg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":63238},"engines":{"npm":">=11.0.0","node":">=24.0.0"},"gitHead":"f629b5c36cedf02772ce6eb004ff211d8fd39018","scripts":{"ng":"ng","lint":"ng lint","test":"ng test","build":"ng build","watch":"ng build --watch --configuration development","format":"prettier --write \"**/*.{ts,html,scss,css,json,md}\"","prepare":"husky","lint:fix":"ng lint --fix","format:check":"prettier --check \"**/*.{ts,html,scss,css,json,md}\""},"_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications that makes it easy to work with GraphQL APIs using full TypeScript support.","directories":{},"lint-staged":{"*.{ts,html}":["eslint --fix","prettier --write"],"*.{json,md,scss,css}":["prettier --write"]},"_nodeVersion":"24.11.0","dependencies":{"rxjs":"~7.8.0","tslib":"^2.3.0","graphql":"^16.12.0","es-toolkit":"^1.41.0","@angular/core":"^20.3.0","@angular/forms":"^20.3.0","@angular/common":"^20.3.0","@angular/router":"^20.3.0","@angular/compiler":"^20.3.0","@angular/platform-browser":"^20.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.0","eslint":"^8.57.0","zone.js":"0.15.1","prettier":"^3.3.0","ng-packagr":"^20.3.0","typescript":"~5.9.2","@types/jest":"^30.0.0","lint-staged":"^15.2.0","@angular/cli":"^20.3.9","@angular/build":"^20.3.9","jest-preset-angular":"^14.6.0","eslint-plugin-import":"^2.31.0","@angular/compiler-cli":"^20.3.0","@angular-builders/jest":"^20.0.0","eslint-config-prettier":"^9.1.0","@angular-eslint/builder":"^20.3.0","@typescript-eslint/parser":"^8.0.0","eslint-plugin-prefer-arrow":"^1.2.3","@angular-eslint/eslint-plugin":"^20.3.0","@angular-eslint/template-parser":"^20.3.0","@typescript-eslint/eslint-plugin":"^8.0.0","@angular-eslint/eslint-plugin-template":"^20.3.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.2_1762679479026_0.6601556045834585","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@alevettih/ngx-graphql-client","version":"0.0.3","keywords":["graphql","angular"],"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","_id":"@alevettih/ngx-graphql-client@0.0.3","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"homepage":"https://github.com/Alevettih/ngx-graphql-client","bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"dist":{"shasum":"2f202a05a4295c38de24c7f9e60675b89a5e6114","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.3.tgz","fileCount":6,"integrity":"sha512-TR53uy8UYxF3OufOE5MM8ls0ox4RcvpVbYjL+H1EP2GBQZMPaCNSzZITrbBap+Oo30SUriJKdn6vxke3eIgGCw==","signatures":[{"sig":"MEUCIE/ln7Ux10yaFqQ72eNDWKPypnIgbgYGn8p02A3W4/a4AiEAo+QZ8dXY2P1zxlR5Jd/AUs7mDgFxxbOcvtnvnfdS7JA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31758},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"16eaee9e2800449b6669f4dde304d66c41502e36","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"repository":{"url":"git+https://github.com/Alevettih/ngx-graphql-client.git","type":"github"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.3_1762680090627_0.7076131999944855","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@alevettih/ngx-graphql-client","version":"0.0.4","keywords":["graphql","angular"],"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","_id":"@alevettih/ngx-graphql-client@0.0.4","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"homepage":"https://github.com/Alevettih/ngx-graphql-client","bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"dist":{"shasum":"317aadd03d865dd9e2abb520d63615087fd326ec","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.4.tgz","fileCount":6,"integrity":"sha512-Ua6cXMFJLkM8Y+7DJRLG6FOfiENTSG0bEwniVlpnNMWl6itECQka3aNIw223jubB8dFeWF3t42iDT6S45FybeA==","signatures":[{"sig":"MEUCIF2TBTDvOy21P7reNO1vbZsWvQx1Bc0hW+7niB0XKt+qAiEAzvt364NDcA+qvf18RchmmP4YvbMPEejjXok93u4fZsE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32267},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"4c324997559eb66e74581acdc80eef40efdc5f1c","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"repository":{"url":"git+https://github.com/Alevettih/ngx-graphql-client.git","type":"github"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0","@graphql-typed-document-node/core":"^3.2.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.4_1762692125152_0.9546607502065705","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@alevettih/ngx-graphql-client","version":"0.0.5","keywords":["graphql","angular"],"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","_id":"@alevettih/ngx-graphql-client@0.0.5","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"homepage":"https://github.com/Alevettih/ngx-graphql-client","bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"dist":{"shasum":"bef73675eadbfccfd52616b87b3e22516d8fc9b2","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.5.tgz","fileCount":6,"integrity":"sha512-XqmkZv3TJWD7pIUdBzBpayhH/iAyLrsEedMRhZuZAhzXrH/H75BjHbeyCevvITcxueOgPMkVWA/8apT9ZhfbQw==","signatures":[{"sig":"MEQCID1GTO+iAlRQ1UmiWunuFyh1IkWyZutgYfQ0hvYu7IkLAiBUUUXR7RFvnL+2UdsEVa8rr4UCtBcMJjWAsqKqCpP00g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32153},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"0ab58914d80f85dbcde2c7516f5e55abbc2ac980","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"repository":{"url":"git+https://github.com/Alevettih/ngx-graphql-client.git","type":"github"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0","@graphql-typed-document-node/core":"^3.2.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.5_1762693590888_0.008890781868169162","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"@alevettih/ngx-graphql-client","version":"0.0.6","keywords":["graphql","angular"],"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","_id":"@alevettih/ngx-graphql-client@0.0.6","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"homepage":"https://github.com/Alevettih/ngx-graphql-client","bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"dist":{"shasum":"bdca50277a846eb987a4a976bf51bd8bc9aa328b","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.6.tgz","fileCount":6,"integrity":"sha512-OV0U+VAO0sZC+/f0yFKrJrjcQkw+R4mMoyJ+Ga8qZg95rRvoq0X89sAhuPxVbx0cntxbSa54q/3H0U5ybM4WbQ==","signatures":[{"sig":"MEUCIQCJQS3Uf7pSEUhiol9o+la8HoXqj+VELDKGdOr6SS9hiAIgLyPw+qT5zgMtqMK57T/r4B52TFj44KT7MIlbMaP0hwY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34324},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"5cf4ee8eb507902623a3e4a6a5fe93b7aa0acce9","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"repository":{"url":"git+https://github.com/Alevettih/ngx-graphql-client.git","type":"github"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0","@graphql-typed-document-node/core":"^3.2.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.6_1762724304075_0.6591854598024565","host":"s3://npm-registry-packages-npm-production"}},"0.0.7":{"name":"@alevettih/ngx-graphql-client","version":"0.0.7","keywords":["graphql","angular","typescript"],"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","_id":"@alevettih/ngx-graphql-client@0.0.7","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"homepage":"https://github.com/Alevettih/ngx-graphql-client","bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"dist":{"shasum":"f25156672da06457036d861852dce1280acb986b","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-0.0.7.tgz","fileCount":6,"integrity":"sha512-Gndh+onZT9LNyEvL8GeXzLA0soy7CwZhz3oH2dA30u1LuwFuVGmWZ5x4+VTSVDU15oWMQuPEqeR/PK8D7FddDA==","signatures":[{"sig":"MEYCIQC8094Nke/g7Gjm1gkizDjt9V7Yld7bT7DcGRIO3JHocwIhAJQ25p6YtbeuTYVIQG9bO78e3mjEVDDFEp/Ph3piaHlU","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35219},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","exports":{".":{"types":"./index.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"985b6da6150f1250ec7c600495421989f8c8f79a","typings":"index.d.ts","_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"repository":{"url":"git+https://github.com/Alevettih/ngx-graphql-client.git","type":"github"},"_npmVersion":"11.6.1","description":"A typed GraphQL client for Angular applications with full TypeScript support.","directories":{},"sideEffects":false,"_nodeVersion":"24.11.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"graphql":"^16.0.0","es-toolkit":"^1.41.0","@angular/core":"^18.0.0 || ^19.0.0 || ^20.0.0","@angular/common":"^18.0.0 || ^19.0.0 || ^20.0.0","@graphql-typed-document-node/core":"^3.2.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-graphql-client_0.0.7_1762804803218_0.27233060286589805","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@alevettih/ngx-graphql-client","description":"A typed GraphQL client for Angular applications with full TypeScript support.","version":"1.0.0","homepage":"https://github.com/Alevettih/ngx-graphql-client","author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"peerDependencies":{"@angular/common":">=18.0.0","@angular/core":">=18.0.0","@graphql-typed-document-node/core":"^3.2.0","es-toolkit":"^1.41.0","graphql":"^16.0.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"license":"MIT","keywords":["graphql","angular","typescript"],"repository":{"type":"github","url":"git+https://github.com/Alevettih/ngx-graphql-client.git"},"bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"module":"fesm2022/alevettih-ngx-graphql-client.mjs","typings":"types/alevettih-ngx-graphql-client.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./types/alevettih-ngx-graphql-client.d.ts","default":"./fesm2022/alevettih-ngx-graphql-client.mjs"}},"gitHead":"b37a5671cc83114c48e5610b8e847ab4140ee7c7","_id":"@alevettih/ngx-graphql-client@1.0.0","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-jHD2+dVIGJy+CEEtta8Ardlu61B6qtfClBsLA/lxOr9YxIPiSUQHH/fs9xRmYGaO+0ckegZx5O5BKWG9l5g/rQ==","shasum":"77029086aceabae2b190484868732907b13abe44","tarball":"https://registry.npmjs.org/@alevettih/ngx-graphql-client/-/ngx-graphql-client-1.0.0.tgz","fileCount":6,"unpackedSize":35232,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAl9XqnUbStvdLoS7VjMTUWWbeRtPydaGu2V+JjyloURAiEAlGNQ1jLaEXW41Nf3hk5tQE0V2JTk5hchlhL0WG1Dszw="}]},"_npmUser":{"name":"alevet","email":"alevettih@ya.ru"},"directories":{},"maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ngx-graphql-client_1.0.0_1764067850961_0.6474633906014045"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-08T21:34:18.072Z","modified":"2025-11-25T10:50:51.352Z","0.0.1":"2025-11-08T21:34:18.341Z","0.0.2":"2025-11-09T09:11:19.198Z","0.0.3":"2025-11-09T09:21:30.858Z","0.0.4":"2025-11-09T12:42:05.354Z","0.0.5":"2025-11-09T13:06:31.097Z","0.0.6":"2025-11-09T21:38:24.291Z","0.0.7":"2025-11-10T20:00:03.436Z","1.0.0":"2025-11-25T10:50:51.157Z"},"bugs":{"url":"https://github.com/Alevettih/ngx-graphql-client/issues"},"author":{"name":"Alexandr Tikhonenko","email":"alevettih@ya.ru"},"license":"MIT","homepage":"https://github.com/Alevettih/ngx-graphql-client","keywords":["graphql","angular","typescript"],"repository":{"type":"github","url":"git+https://github.com/Alevettih/ngx-graphql-client.git"},"description":"A typed GraphQL client for Angular applications with full TypeScript support.","maintainers":[{"name":"alevet","email":"alevettih@ya.ru"}],"readme":"# @alevettih/ngx-graphql-client\n\nA typed GraphQL client for Angular applications with full TypeScript support.\n\n## Installation\n\n```bash\nnpm install @alevettih/ngx-graphql-client\n```\n\n### Requirements\n\n- Angular 18.0.0 or later\n- GraphQL 16.0.0 or later\n- RxJS 7.8.0 or later\n- es-toolkit 1.41.0 or later\n\n## Features\n\n- ✅ Full TypeScript support for GraphQL operations\n- ✅ Support for queries, mutations, and batch operations\n- ✅ Custom error handlers per request\n- ✅ Automatically throws when a GraphQL response includes errors (via the built-in HTTP interceptor)\n- ✅ Seamless integration with Angular HttpClient, including support for all `HttpClient.post` options in every client method\n\n## Quick Start\n\n### 1. Provide the Client\n\nImport `provideGraphQLClient` in your `app.config.ts` or `main.ts`:\n\n```typescript\nimport { ApplicationConfig } from '@angular/core';\nimport { provideGraphQLClient } from '@alevettih/ngx-graphql-client';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideGraphQLClient({\n      url: 'https://api.example.com/graphql', // URL of your GraphQL API\n    }),\n    // ... other providers\n  ],\n};\n```\n\n> **Note:** `provideGraphQLClient` registers Angular HttpClient together with the built-in GraphQL error interceptor. If you already call `provideHttpClient` in your application, place your configuration before `provideGraphQLClient` so the interceptors run in the expected order.\n\n### 2. Use in Components and Services\n\n```typescript\nimport { Component, OnInit, inject, signal } from '@angular/core';\nimport {\n  GraphQLClient,\n  TypedGraphQLDocumentNode,\n} from '@alevettih/ngx-graphql-client';\nimport { gql } from 'graphql-tag';\n\n// Define a typed GraphQL operation\nconst GET_USERS = gql`\n  query GetUsers($limit: Int!) {\n    users(limit: $limit) {\n      id\n      name\n      email\n    }\n  }\n` as TypedGraphQLDocumentNode<\n  { users: Array<{ id: string; name: string; email: string }> },\n  { limit: number }\n>;\n\n@Component({\n  selector: 'app-users',\n  template: `\n    @for (user of users(); track user.id) {\n      <div>{{ user.name }} - {{ user.email }}</div>\n    }\n  `,\n})\nexport class UsersComponent implements OnInit {\n  private readonly graphql = inject(GraphQLClient);\n  readonly users = signal<Array<{ id: string; name: string; email: string }>>(\n    [],\n  );\n\n  ngOnInit(): void {\n    this.graphql.query(GET_USERS, { limit: 10 }).subscribe((data) => {\n      this.users.set(data.users);\n    });\n  }\n}\n```\n\n> **Note:** The examples use `graphql-tag` for the `gql` template literal. Install it if needed: `npm install graphql-tag`.\n\n## API\n\n### GraphQLClient\n\nPrimary service for executing GraphQL operations.\n\n#### Methods\n\n##### `query<Operation, Variables>(document, variables, options?)`\n\nExecutes a GraphQL query operation.\n\n| Parameter   | Type                                             | Description                                       |\n| ----------- | ------------------------------------------------ | ------------------------------------------------- |\n| `document`  | `TypedGraphQLDocumentNode<Operation, Variables>` | Typed GraphQL operation definition                |\n| `variables` | `Variables`                                      | Variables required by the operation               |\n| `options?`  | `RequestOptions`                                 | Optional HTTP options passed to `HttpClient.post` |\n\n| Returns                 | Description                                    |\n| ----------------------- | ---------------------------------------------- |\n| `Observable<Operation>` | Emits the typed response for the GraphQL query |\n\n##### `mutate<Operation, Variables>(document, variables, options?)`\n\nExecutes a GraphQL mutation.\n\n| Parameter   | Type                                             | Description                                       |\n| ----------- | ------------------------------------------------ | ------------------------------------------------- |\n| `document`  | `TypedGraphQLDocumentNode<Operation, Variables>` | Typed GraphQL mutation definition                 |\n| `variables` | `Variables`                                      | Variables required by the mutation                |\n| `options?`  | `RequestOptions`                                 | Optional HTTP options passed to `HttpClient.post` |\n\n| Returns                 | Description                                       |\n| ----------------------- | ------------------------------------------------- |\n| `Observable<Operation>` | Emits the typed response for the GraphQL mutation |\n\n##### `batch<Data, ResponseData>(requests, options?)`\n\nExecutes multiple GraphQL operations in a single HTTP request (batch request).\n\n| Parameter  | Type             | Description                                                      |\n| ---------- | ---------------- | ---------------------------------------------------------------- |\n| `requests` | `BatchData[]`    | Collection of typed operations and variables to execute together |\n| `options?` | `RequestOptions` | Optional HTTP options passed to `HttpClient.post`                |\n\n| Returns                                         | Description                                                |\n| ----------------------------------------------- | ---------------------------------------------------------- |\n| `Observable<UnionToIntersection<ResponseData>>` | Emits the merged typed responses of all batched operations |\n\n### Configuration\n\n#### GraphQLClientConfig\n\n| Field | Type     | Description                             | Default          |\n| ----- | -------- | --------------------------------------- | ---------------- |\n| `url` | `string` | GraphQL endpoint URL used by the client | `'/api/graphql'` |\n\n### Data Models\n\n#### BatchData\n\n| Field       | Type                                             | Description                         |\n| ----------- | ------------------------------------------------ | ----------------------------------- |\n| `document`  | `TypedGraphQLDocumentNode<Operation, Variables>` | Typed GraphQL operation definition  |\n| `variables` | `Variables`                                      | Variables required by the operation |\n\n#### GraphQLErrorResponse\n\nExtended `HttpErrorResponse` with additional error details:\n\n| Field      | Type                                         | Description                                       |\n| ---------- | -------------------------------------------- | ------------------------------------------------- |\n| `response` | `HttpResponse<unknown> \\| HttpErrorResponse` | Original HTTP response received from the server   |\n| `request`  | `HttpRequest<unknown>`                       | HTTP request that triggered the GraphQL error     |\n| `error`    | `ExecutionResult<Data>`                      | GraphQL execution result containing error details |\n\n#### RequestOptions\n\n`RequestOptions` maps directly to the third argument of `HttpClient.post`. Use it to pass headers, context values, withCredentials, and other Angular HTTP options.\n\n```typescript\ntype RequestOptions = Parameters<HttpClient['post']>[2];\n```\n\n## Error Handling\n\nThe library automatically processes GraphQL errors via an HTTP interceptor. If a GraphQL response contains errors, they are converted into a `GraphQLErrorResponse` and thrown.\n\nBy default, the interceptor logs the error and rethrows it. This default behaviour is implemented through an internal request-level error handler token. You can override the handler for individual requests by supplying your own function via the `NGX_GRAPHQL_CLIENT_REQUEST_ERROR_HANDLER` `HttpContext` token:\n\n```typescript\nimport { HttpContext } from '@angular/common/http';\nimport {\n  GraphQLErrorResponse,\n  NGX_GRAPHQL_CLIENT_REQUEST_ERROR_HANDLER,\n} from '@alevettih/ngx-graphql-client';\n\nconst context = new HttpContext().set(\n  NGX_GRAPHQL_CLIENT_REQUEST_ERROR_HANDLER,\n  (error: GraphQLErrorResponse): never => {\n    // Perform custom logging, telemetry, or user notification\n    console.warn('Custom GraphQL error handler', error.error.errors);\n    throw error; // Decide whether to rethrow or return a fallback value\n  },\n);\n\nthis.graphql.query(GET_USER, { id: '123' }, { context }).subscribe();\n```\n\n## Type Safety\n\nThe library fully supports typed GraphQL operations via the exported `TypedGraphQLDocumentNode`, which accepts both `TypedDocumentNode` (from `@graphql-typed-document-node/core`) and `TypedQueryDocumentNode` (from `graphql`). This gives you:\n\n- Autocomplete for operation variables\n- Type safety for operation results\n- Compile-time type checks\n\nWe recommend using schema-based type generation tools such as:\n\n- [GraphQL Code Generator](https://the-guild.dev/graphql/codegen)\n- [Apollo Codegen](https://www.apollographql.com/docs/devtools/cli/)\n\n## Compatibility\n\n- **Angular:** 18.0.0+\n- **GraphQL:** 16.0.0+\n- **TypeScript:** Use the version supported by your Angular release (Angular 18+ currently requires TypeScript 5.4 or newer)\n- **RxJS:** 7.8+\n\n## License\n\nThis library is distributed under the [MIT](LICENSE) license.\n\n## Support\n\nIf you have questions or run into issues, please open an issue in the project repository.\n","readmeFilename":"README.md"}