{"_id":"@byndyusoft/grpc-timeouts","_rev":"4-e09848a89578db46b5fbb8bba091612e","name":"@byndyusoft/grpc-timeouts","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@byndyusoft/grpc-timeouts","version":"1.0.1","keywords":["byndyusoft","grpc","grpc-timeouts","circuit-breaker","fail-fast","timeout","TypeScript"],"author":{"name":"Byndyusoft"},"license":"ISC","_id":"@byndyusoft/grpc-timeouts@1.0.1","maintainers":[{"name":"alexanderbyndyu","email":"alexander.byndyu@gmail.com"},{"name":"sadcitizen","email":"sadcitizen@yandex.ru"},{"name":"dmitriy.litichevskiy","email":"litichevskiydv@gmail.com"},{"name":"razonrus","email":"iruslansafin@gmail.com"}],"contributors":[{"name":"Dmitry221060","email":"ya.dima42103ya@yandex.ru"}],"homepage":"https://github.com/Byndyusoft/grpc-timeouts#readme","bugs":{"url":"https://github.com/Byndyusoft/grpc-timeouts/issues"},"dist":{"shasum":"58cd5403427be03d116886f975bc59476d67d610","tarball":"https://registry.npmjs.org/@byndyusoft/grpc-timeouts/-/grpc-timeouts-1.0.1.tgz","fileCount":12,"integrity":"sha512-JumRMy4H/kaYhC2s73DNKHHdHQKHpUkM6TlNzuw6vON74BdrMFr6nllL+WNVF7F6wI12kEM743O4C4VdQhc+8A==","signatures":[{"sig":"MEYCIQCAZPwYS12Ap5o5ssnwE35UZxX8GKMlmJ6oogVNA4nsmAIhAOHUCICIrUkE2CTmWc/Ssf09O8eQ7EF2SRr5eV5FLLGA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7DpZCRA9TVsSAnZWagAA+0gP/ifFgvK2custqC/mJkie\nbOlKxvmxa6Wv/N2peE03QyrekVfw+9weKCkEumUDX4WtQbEfInZjpvC1z7Ma\n54EOJdHMX/us/ZWfgacjtK5iVCeg3AOXAkdYXWkcbYk8ZxNGGbzZzytjREKU\nu/18PVXrt9zC+jw4Cs15368JstsgCwEuZI1QrFUaV7Jh9REwCMEubjMFgMFr\nQf6FQ7r5g4h4/Rphv0fJ9hunaxdd7mR/IZyHCzH549VSl4fH+hn1a8eFaohp\nmFgYJi4in/Y1UX0qPNpZP/aYbIm8rXSobJjLU6OvYvdh7/iehd4a9uPuhTVb\nKpHEE91lWwYUdpHB5AlwWAJkoEORT3SXxP+MsIv14kAvBjnfcDL1xVOsKZxp\nLwqUNjQXV3xKCjcjKCAuj4szhGdFwbDh0t5Kk6gpCu0jIK8NLkH7jTk6CWKi\nNzPuwGhoHgRT/K82VMA3zpvpSBQU+iQp707gG5auSVram0jQC1lM+MtSUuPQ\nxE2IcqCj8cEWPgrLBjFdcDJda/6W17CVvNrfhlycEHKmJ65fBv22xd6z6TpF\nVJbtxMQgMASzLe+HFyBJ2gJ9NpDgLMz2ZjVfk1H1XwkUtU++e92kUDPNifmM\nVduFUL0dCPKkbu5pyhhU0w9nCX9zAMWNL8DQ2kuA9s7tkCvuG5w13uI+r5or\n9M2U\r\n=A5y6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10.0.0"},"gitHead":"89eb3ab1eac3fdcbc445a5807a5fb6a750975ea3","scripts":{"lint":"eslint ./src","test":"npm run lint","build":"tsc","clean":"rimraf dist","lint:fix":"eslint ./src --fix","prebuild":"npm ci","version:upd":"npm version patch","prepublishOnly":"npm run build"},"_npmUser":{"name":"alexanderbyndyu","email":"alexander.byndyu@gmail.com"},"repository":{"url":"git+https://github.com/Byndyusoft/grpc-timeouts.git","type":"git"},"_npmVersion":"6.14.8","description":"A library for customizable gRPC timeouts","directories":{},"_nodeVersion":"14.15.1","dependencies":{"grpc":"^1.24.4","camelcase":"^6.2.0","processing-context":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^7.16.0","rimraf":"^3.0.2","typescript":"^4.0.5","@byndyusoft/eslint-config":"^0.3.0","@typescript-eslint/parser":"^4.8.1","@typescript-eslint/eslint-plugin":"^4.8.1"},"_npmOperationalInternal":{"tmp":"tmp/grpc-timeouts_1.0.1_1609316953021_0.7068571034357378","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@byndyusoft/grpc-timeouts","version":"1.0.2","keywords":["byndyusoft","grpc","grpc-timeouts","circuit-breaker","fail-fast","timeout","TypeScript"],"author":{"name":"Byndyusoft"},"license":"ISC","_id":"@byndyusoft/grpc-timeouts@1.0.2","maintainers":[{"name":"alexanderbyndyu","email":"alexander.byndyu@gmail.com"},{"name":"sadcitizen","email":"sadcitizen@yandex.ru"},{"name":"dmitriy.litichevskiy","email":"litichevskiydv@gmail.com"},{"name":"razonrus","email":"iruslansafin@gmail.com"}],"contributors":[{"name":"Dmitry221060","email":"ya.dima42103ya@yandex.ru"}],"homepage":"https://github.com/Byndyusoft/grpc-timeouts#readme","bugs":{"url":"https://github.com/Byndyusoft/grpc-timeouts/issues"},"dist":{"shasum":"42f2b4ccc69fcd8b985814fbc128619754f8d2e1","tarball":"https://registry.npmjs.org/@byndyusoft/grpc-timeouts/-/grpc-timeouts-1.0.2.tgz","fileCount":15,"integrity":"sha512-BhjK/GYeSf3ddHaGkqJCq/1Jxaud7Mx/FnUALtuoILCsKe+qxg987wIBmqxXUf4xt7zhgxEj+t4+YcJgSyjlQw==","signatures":[{"sig":"MEUCIQDzAxmUXxq1bMDQuWPCjdNSRnvlNwD4kLK9F1a2+Sq0iAIgTDznAyVmSLUgtoexLR5AEgzul3yxVOG2R/TGRMkTcWc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgQJFECRA9TVsSAnZWagAAXp0P/i4s0p105l3axS5l5/oo\n4eBFlgg/fraP72sKcvmgPQCz06vTpThiOGWkXqs9SmebdNGeMhljg1rRbBJ3\nQPp6eUE4uDjeexNoGc3z0f/wFhNgb9h1tHBG3m7wyzrCBwDru5qM5D2ii+HU\n4gNZJ86nKpFKYm/7Qk7nZoHKOhLH6bBMok1YV4xmiA1SMarmhL9KEECE2Z08\n4E5bn2Mz8CuGLWh1gKV9tKYJYEMMGXZ483prffz7GuOdlMGCnoxWO1vIiU3x\n79W28Qh6xQ8uKQw7g0XEnmn7exAwIeMGGoLUEvrAR43oZrU3RKTCuI2V6Q7k\nNc8YsUU05DCQ2WEckez8nkhuIIHqVMdaecy2RXvV7n7uTBH6HIcBxMR66HU+\nt+lsh0j0sXVcUmyEObZk3yE/wheKWbq8HeKw9Oweq6LNo0WEoOBLEotMjP1J\nsvCskkKMT4uCEp5Cv2Xqr0pjQDoFoHBNmVbTkACxIdSIRErT5NfBNNDyJv4j\nMtoYGE/IHkuiWLBO+q/2wI6JKOqigg5XeR2ebD9tX7bA4LzSBXfc63dhKk7I\nH9TLpIZUEu4cJjXiu2VZ5WXu67DtlZPrIuq8UdrWA0iFqfR9RmkiPxP1g73K\nt6Tg8nLp8akbNEbYCA4iTsl4MwxGJaZXrC+BZa2Ef58wi7VQkDXbY/aiHain\nDXGw\r\n=gnu3\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"rootDir":"src","testRegex":".spec.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["js","ts"]},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10.0.0"},"gitHead":"e8f278e24dc3c5f9dfe98d100a0475c2154b3d16","scripts":{"jest":"jest","lint":"eslint ./src","test":"npm run lint && npm run jest","build":"tsc","clean":"rimraf dist","lint:fix":"eslint ./src --fix"},"_npmUser":{"name":"alexanderbyndyu","email":"alexander.byndyu@gmail.com"},"repository":{"url":"git+https://github.com/Byndyusoft/grpc-timeouts.git","type":"git"},"_npmVersion":"6.14.11","description":"A library for customizable gRPC timeouts","directories":{},"_nodeVersion":"14.15.5","dependencies":{"grpc":"^1.24.4","camelcase":"^6.2.0","processing-context":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"26.2.2","eslint":"^7.16.0","rimraf":"^3.0.2","ts-jest":"^26.4.4","typescript":"^4.0.5","@types/jest":"26.0.9","eslint-plugin-jest":"^24.1.3","jest-mock-extended":"^1.0.10","@byndyusoft/eslint-config":"^0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/grpc-timeouts_1.0.2_1614844227933_0.6954397402204049","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-12-30T08:29:12.797Z","modified":"2026-10-02T16:10:03.126Z","1.0.1":"2020-12-30T08:29:13.151Z","1.0.2":"2021-03-04T07:50:28.096Z"},"bugs":{"url":"https://github.com/Byndyusoft/grpc-timeouts/issues"},"author":{"name":"Byndyusoft"},"license":"ISC","homepage":"https://github.com/Byndyusoft/grpc-timeouts#readme","keywords":["byndyusoft","grpc","grpc-timeouts","circuit-breaker","fail-fast","timeout","TypeScript"],"repository":{"url":"git+https://github.com/Byndyusoft/grpc-timeouts.git","type":"git"},"description":"A library for customizable gRPC timeouts","contributors":[{"name":"Dmitry221060","email":"ya.dima42103ya@yandex.ru"}],"maintainers":[{"email":"alexander.byndyu@yandex.ru","name":"alexanderbyndyu"},{"email":"sadcitizen@yandex.ru","name":"sadcitizen"},{"email":"iruslansafin@gmail.com","name":"razonrus"}],"readme":"# grpc-timeouts\n\n[![npm version](https://img.shields.io/npm/v/@byndyusoft/grpc-timeouts)](https://www.npmjs.com/package/@byndyusoft/grpc-timeouts)\n[![npm downloads](https://img.shields.io/npm/dt/@byndyusoft/grpc-timeouts)](https://www.npmjs.com/package/@byndyusoft/grpc-timeouts)\n[![dependencies](https://img.shields.io/david/Byndyusoft/grpc-timeouts)](https://www.npmjs.com/package/@byndyusoft/grpc-timeouts)\n[![dev dependencies](https://img.shields.io/david/dev/Byndyusoft/grpc-timeouts)](https://www.npmjs.com/package/@byndyusoft/grpc-timeouts)\n[![Build Status](https://img.shields.io/github/workflow/status/Byndyusoft/grpc-timeouts/test%20workflow/master)](https://github.com/Byndyusoft/grpc-timeouts/actions?query=workflow%3A%22test+workflow%22)\n\n## Table of contents\n- [About](#about)\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](#api)\n  - [CircuitBreaker](#circuitbreaker)\n    - [serverInterceptor](#serverinterceptor)\n    - [clientInterceptor](#clientinterceptor)\n- [Type Definitions](#typedefinitions)\n  - [ICircuitBreakerOptions](#icircuitbreakeroptions)\n  - [ITimeouts](#itimeouts)\n  - [IServerInterceptor](#iserverinterceptor)\n  - [IClientInterceptor](#iclientinterceptor)\n- [Related](#related)\n- [Maintainers](#maintainers)\n\n## About\n`grpc-timeouts` is a small library that makes it easy to add customizable timeouts to your services. The library implements a circuit breaker pattern, which means that if the request exceeds the deadline, no further requests will be sent. If the deadline for a received request has expired, the request will not be processed and service instantly answers with code 4 (Deadline exceeded).\n\n## Release New version\n\nFor new version use https://github.com/semantic-release/semantic-release description.\nWe must set commit message fix(pencil): New feature in release\n\n## Installation\n\n`npm i @byndyusoft/grpc-timeouts`\n\n## Usage\n**:warning: Make sure that CircuitBreaker interceptors is the last added interceptor, because it will interrupt further processing of the request!**\n```js\nconst grpc = require(\"grpc\")\nconst { CircuitBreaker } = require(\"@byndyusoft/grpc-timeouts\");\nconst circuitBreaker = new CircuitBreaker();\n\n/*...*/\n\n// Client interceptor:\nconst client = new grpc.Client(address, credentials, {\n  interceptors: [circuitBreaker.clientInterceptor]\n});\n\n// Server interceptor: (with grpc-host-builder)\nconst server = new GrpcHostBuilder()\n  .addInterceptor(circuitBreaker.serverInterceptor)\n  .addService(myService)\n  .bind(grpcBind)\n  .build()\n```\n\n## API\n### CircuitBreaker\n`constructor([options: ICircuitBreakerOptions])`\n\nOptions is an optional object with timeouts for methods (default timeout is 10 seconds).\n\n#### serverInterceptor\n`IServerInterceptor`\n\nServer interceptor function.\n\n#### clientInterceptor\n`IClientInterceptor`\n\nClient interceptor function.\n\n## Type Definitions\n### ICircuitBreakerOptions\nAn object with following keys:\n- `[timeouts: ITimeouts]` - The longest time for the methods to respond\n- `[minResponseTimeouts: ITimeouts]` - The shortest time to wait for a response from the services\n```js\n{\n  timeouts: {\n    createOrder: 3000,\n    updateOrder: 500,\n    deleteOrder: 500,\n    getOrder: 300,\n    default: 5000 //default was 10000\n  },\n  minResponseTimeouts: {\n    createOrder: 280,\n    default: 50 //default was 0\n  }\n}\n```\n### ITimeouts\nAn object which keys is camelCased method names and values is milliseconds. \\\nThis object also have `default` field that can be reassigned.\n\n### IServerInterceptor\n`(call: Object, methodDefinition: Object, next: Function) => Promise<Object>` \\\nA function that can be used as server interceptor.\n\n### IClientInterceptor\n`(options: Object, next: Function) => grpc.InterceptingCall` \\\nA function that can be used as client interceptor.\n\n## Related\n[grpc-host-builder](https://www.npmjs.com/package/grpc-host-builder)\n\n## Maintainers\n@Byndyusoft/owners: https://github.com/orgs/Byndyusoft/teams/owners, github.maintain@byndyusoft.com\n","readmeFilename":"README.md"}