{"_id":"@alpha018/nestjs-unleash-client","_rev":"3-d193234f68e71aefa42a0655179e6862","name":"@alpha018/nestjs-unleash-client","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@alpha018/nestjs-unleash-client","version":"1.0.0","keywords":["nestjs","unleash","unleash-client","unleash-api","guard","feature-flag","feature"],"author":{"name":"Tomás Alegre","email":"tomas.sa467@gmail.com"},"license":"MIT","_id":"@alpha018/nestjs-unleash-client@1.0.0","maintainers":[{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"}],"homepage":"https://github.com/Alpha018/nestjs-unleash-client#readme","bugs":{"url":"https://github.com/Alpha018/nestjs-unleash-client/issues"},"dist":{"shasum":"b616041f3b2130cd1c241b16db7deecf3a22e252","tarball":"https://registry.npmjs.org/@alpha018/nestjs-unleash-client/-/nestjs-unleash-client-1.0.0.tgz","fileCount":38,"integrity":"sha512-7Ffkv4+FaBg7qIO/g7eqW0h6a+foOFw1Zkj3WOHRwW/ienKY3UEX0ZmwZRsG51KPx725UxKhxIccpRLFtLUmNg==","signatures":[{"sig":"MEYCIQCCPGoYtHoqEV1F+K69rZgw91KW+L1Y8zBhxhjrMn8smAIhAPL7zSdwywRYuAePR+U4LCALiOA6T9B6qicZO4kscnV6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":215628},"jest":{"rootDir":"src","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","coverageDirectory":"../coverage","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=20"},"gitHead":"5acd202ed44ac981e97127b92ab893dbfa80f856","scripts":{"lint":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix","test":"jest","build":"nest build","start":"nest start","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky || exit 0","test:cov":"jest --coverage","test:e2e":"jest --config ./test/jest-e2e.json","start:dev":"nest start --watch","start:prod":"node dist/main","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:watch":"jest --watch","start:debug":"nest start --debug --watch"},"_npmUser":{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"},"repository":{"url":"git+https://github.com/Alpha018/nestjs-unleash-client.git","type":"git"},"_npmVersion":"10.9.4","description":"A NestJS module for Unleash, providing feature flagging with decorators and a Guard.","directories":{},"_nodeVersion":"20.19.5","dependencies":{"rxjs":"^7.8.2","@nestjs/core":"^11.1.6","@nestjs/common":"^11.1.6","unleash-client":"^6.7.0","reflect-metadata":"^0.2.2","@nestjs/platform-express":"^11.1.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.37.0","ts-jest":"^29.4.4","ts-node":"^10.9.2","prettier":"^3.6.2","supertest":"^7.1.4","ts-loader":"^9.5.4","@eslint/js":"^9.37.0","jest-junit":"^16.0.0","typescript":"^5.9.3","@nestjs/cli":"^11.0.10","@types/jest":"^30.0.0","@types/node":"^24.6.2","@types/express":"^5.0.3","tsconfig-paths":"^4.2.0","@commitlint/cli":"^20.1.0","@nestjs/testing":"^11.1.6","@types/supertest":"^6.0.3","typescript-eslint":"^8.45.0","@golevelup/ts-jest":"^0.7.0","@nestjs/schematics":"^11.0.8","source-map-support":"^0.5.21","@types/passport-jwt":"^4.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.2","eslint-plugin-sonarjs":"^3.0.5","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-security":"^3.0.1","@semantic-release/github":"^11.0.6","@stylistic/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^8.45.0","@semantic-release/changelog":"^6.0.3","eslint-plugin-perfectionist":"^4.15.1","@commitlint/config-conventional":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.45.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/release-notes-generator":"^14.1.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-unleash-client_1.0.0_1759809231201_0.2087374031370559","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alpha018/nestjs-unleash-client","version":"1.0.1","keywords":["nestjs","unleash","unleash-client","unleash-api","guard","feature-flag","feature"],"author":{"name":"Tomás Alegre","email":"tomas.sa467@gmail.com"},"license":"MIT","_id":"@alpha018/nestjs-unleash-client@1.0.1","maintainers":[{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"}],"homepage":"https://github.com/Alpha018/nestjs-unleash-client#readme","bugs":{"url":"https://github.com/Alpha018/nestjs-unleash-client/issues"},"dist":{"shasum":"55d8fbcce6a7764f5be707c2653f9c770f8cb7c1","tarball":"https://registry.npmjs.org/@alpha018/nestjs-unleash-client/-/nestjs-unleash-client-1.0.1.tgz","fileCount":47,"integrity":"sha512-CmndKTObwKzQZPzxdqqTwQreQxFOCvxKVMXgShEFKo530AvVZ10s3uA1NNCNQb77iij17yRPtgbROA5pcUFqwQ==","signatures":[{"sig":"MEQCIFX4iTZULMolL9zgLItME0Zgkdw4UO3GvOIHebqgjQnmAiAzLjfLC4N2250PDgtXfTnhrCxv9R5ZGSVWKGxU1J0/SA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":221996},"jest":{"rootDir":"src","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","coverageDirectory":"../coverage","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"gitHead":"c307046263fe06a5349156af36ad41b53d0f4011","scripts":{"lint":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix","test":"jest","build":"nest build","start":"nest start","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","prepare":"husky || exit 0","test:cov":"jest --coverage","test:e2e":"jest --config ./test/jest-e2e.json","start:dev":"nest start --watch","start:prod":"node dist/main","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:watch":"jest --watch","start:debug":"nest start --debug --watch"},"_npmUser":{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"},"repository":{"url":"git+https://github.com/Alpha018/nestjs-unleash-client.git","type":"git"},"_npmVersion":"10.9.4","description":"A NestJS module for Unleash, providing feature flagging with decorators and a Guard.","directories":{},"_nodeVersion":"20.19.5","dependencies":{"rxjs":"^7.8.2","@nestjs/core":"^11.1.6","@nestjs/common":"^11.1.6","unleash-client":"^6.7.0","reflect-metadata":"^0.2.2","@nestjs/platform-express":"^11.1.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","husky":"^9.1.7","eslint":"^9.37.0","ts-jest":"^29.4.5","ts-node":"^10.9.2","prettier":"^3.6.2","supertest":"^7.1.4","ts-loader":"^9.5.4","@eslint/js":"^9.37.0","jest-junit":"^16.0.0","typescript":"^5.9.3","@nestjs/cli":"^11.0.10","@types/jest":"^30.0.0","@types/node":"^24.7.1","@types/express":"^5.0.3","tsconfig-paths":"^4.2.0","@commitlint/cli":"^20.1.0","@nestjs/testing":"^11.1.6","@types/supertest":"^6.0.3","typescript-eslint":"^8.46.0","@golevelup/ts-jest":"^0.7.0","@nestjs/schematics":"^11.0.9","source-map-support":"^0.5.21","@types/passport-jwt":"^4.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^12.0.2","eslint-plugin-sonarjs":"^3.0.5","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-security":"^3.0.1","@semantic-release/github":"^11.0.6","@stylistic/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^8.46.0","@semantic-release/changelog":"^6.0.3","eslint-plugin-perfectionist":"^4.15.1","@commitlint/config-conventional":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/release-notes-generator":"^14.1.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-unleash-client_1.0.1_1760118069700_0.5943425215229892","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@alpha018/nestjs-unleash-client","version":"1.0.2","description":"A NestJS module for Unleash, providing feature flagging with decorators and a Guard.","author":{"name":"Tomás Alegre","email":"tomas.sa467@gmail.com"},"main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","engines":{"node":">=20"},"scripts":{"build":"nest build","format":"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"","start":"nest start","start:dev":"nest start --watch","start:debug":"nest start --debug --watch","start:prod":"node dist/main","lint":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:e2e":"jest --config ./test/jest-e2e.json","prepare":"husky || exit 0"},"dependencies":{"@nestjs/common":"^11.1.9","@nestjs/core":"^11.1.9","@nestjs/platform-express":"^11.1.9","reflect-metadata":"^0.2.2","rxjs":"^7.8.2","unleash-client":"^6.8.0"},"devDependencies":{"@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@eslint/js":"^9.39.1","@golevelup/ts-jest":"^0.7.0","@nestjs/cli":"^11.0.14","@nestjs/schematics":"^11.0.9","@nestjs/testing":"^11.1.9","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@stylistic/eslint-plugin":"^5.6.1","@types/express":"^5.0.5","@types/jest":"^30.0.0","@types/node":"^24.10.1","@types/passport-jwt":"^4.0.1","@types/supertest":"^6.0.3","@typescript-eslint/eslint-plugin":"^8.48.0","@typescript-eslint/parser":"^8.48.0","eslint":"^9.39.1","eslint-config-prettier":"^10.1.8","eslint-plugin-perfectionist":"^4.15.1","eslint-plugin-prettier":"^5.5.4","eslint-plugin-security":"^3.0.1","eslint-plugin-sonarjs":"^3.0.5","husky":"^9.1.7","jest":"^30.2.0","jest-junit":"^16.0.0","prettier":"^3.7.1","source-map-support":"^0.5.21","supertest":"^7.1.4","ts-jest":"^29.4.5","ts-loader":"^9.5.4","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","typescript":"^5.9.3","typescript-eslint":"^8.48.0"},"keywords":["nestjs","unleash","unleash-client","unleash-api","guard","feature-flag","feature"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Alpha018/nestjs-unleash-client.git"},"bugs":{"url":"https://github.com/Alpha018/nestjs-unleash-client/issues"},"homepage":"https://github.com/Alpha018/nestjs-unleash-client#readme","jest":{"moduleFileExtensions":["js","json","ts"],"rootDir":"src","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"collectCoverageFrom":["**/*.(t|j)s"],"coverageDirectory":"../coverage","testEnvironment":"node"},"gitHead":"dcdda6067f9981b73d6cad7e2552af43eb8e4b2e","_id":"@alpha018/nestjs-unleash-client@1.0.2","_nodeVersion":"24.11.1","_npmVersion":"11.6.4","dist":{"integrity":"sha512-SRK8/cto0sOHpJIAJSLvY6q/3fIvMJfIat5TWRR3lF9aKceus4eRV4BUzifjYEuFq2eyt8AV4ZkWNUstPr+UYg==","shasum":"16368a768d82e3460dae7583ea58b40a6de940f6","tarball":"https://registry.npmjs.org/@alpha018/nestjs-unleash-client/-/nestjs-unleash-client-1.0.2.tgz","fileCount":47,"unpackedSize":222045,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDm+dUNA7VkpC/qPOfXtreHDJIXtlJd0UEELupiATFL8AIhAJUvQGuFNrd9dudg8SrBhBzOu3a6zdQ9DYS3poxnk7EH"}]},"_npmUser":{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"},"directories":{},"maintainers":[{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-unleash-client_1.0.2_1764356227484_0.08614052387559568"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-07T03:53:51.106Z","modified":"2025-11-28T18:57:07.868Z","1.0.0":"2025-10-07T03:53:51.410Z","1.0.1":"2025-10-10T17:41:09.917Z","1.0.2":"2025-11-28T18:57:07.691Z"},"bugs":{"url":"https://github.com/Alpha018/nestjs-unleash-client/issues"},"author":{"name":"Tomás Alegre","email":"tomas.sa467@gmail.com"},"license":"MIT","homepage":"https://github.com/Alpha018/nestjs-unleash-client#readme","keywords":["nestjs","unleash","unleash-client","unleash-api","guard","feature-flag","feature"],"repository":{"type":"git","url":"git+https://github.com/Alpha018/nestjs-unleash-client.git"},"description":"A NestJS module for Unleash, providing feature flagging with decorators and a Guard.","maintainers":[{"name":"alpha018","email":"gentle.koala1662@alphacode.cl"}],"readme":"# NestJS Unleash Client\n\n<div align=\"center\">\n  <a href=\"http://nestjs.com/\" target=\"_blank\">\n    <img src=\"https://nestjs.com/img/logo_text.svg\" width=\"150\" alt=\"Nest Logo\" />\n  </a>\n</div>\n\n<h3 align=\"center\">A NestJS module for Unleash, providing feature flagging with a global Guard and decorators.</h3>\n\n<div align=\"center\">\n  <a href=\"https://nestjs.com\" target=\"_blank\">\n    <img src=\"https://img.shields.io/badge/built%20with-NestJs-red.svg\" alt=\"Built with NestJS\">\n  </a>\n</div>\n\n## Table of Contents\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Import the Module](#import-the-module)\n  - [Parameter Options](#parameter-options)\n  - [Protecting a Route with a Feature Toggle](#protecting-a-route-with-a-feature-toggle)\n  - [Injecting the Unleash Client](#injecting-the-unleash-client)\n- [Resources](#resources)\n- [Stay in touch](#stay-in-touch)\n- [License](#license)\n\n> **⚠️ Important:** Starting from this version, the minimum required Node.js version is **20**.\n\n## Installation\n```bash\n$ npm i @alpha018/nestjs-unleash-client\n```\n\n## Usage\n\n### Import The Module\nTo use the Unleash client in your application, import the module into your main module. The module registers a global guard that will automatically protect routes decorated with `@UnleashToggle`.\n\n#### Static Registration\n```ts\nimport { UnleashClientModule } from '@alpha018/nestjs-unleash-client';\n\n@Module({\n  imports: [\n    // ...\n    UnleashClientModule.forRoot({\n      config: {\n        url: 'http://unleash.herokuapp.com/api/',\n        appName: 'my-nestjs-app',\n      },\n      isGlobal: true, // Make the module and its providers global\n    }),\n    // ...\n  ],\n})\nexport class AppModule {}\n```\n\n#### Async Registration\n```ts\nimport { UnleashClientModule } from '@alpha018/nestjs-unleash-client';\nimport { ConfigModule, ConfigService } from '@nestjs/config';\n\n@Module({\n  imports: [\n    // ...\n    UnleashClientModule.forRootAsync({\n      imports: [ConfigModule],\n      useFactory: (configService: ConfigService) => ({\n        config: {\n          url: configService.get('UNLEASH_URL'),\n          appName: configService.get('UNLEASH_APP_NAME'),\n          customHeaders: { Authorization: configService.get('UNLEASH_API_TOKEN') },\n        }\n      }),\n      inject: [ConfigService],\n      isGlobal: true, // Make the module and its providers global\n    }),\n    // ...\n  ],\n})\nexport class AppModule {}\n```\n\n## Parameter Options\n\nOptions for `forRoot` and `forRootAsync`:\n\n| Parameter | Type              | Required | Description                                                                    |\n|-----------|-------------------|----------|--------------------------------------------------------------------------------|\n| `config`  | `UnleashConfig`   | Yes      | The configuration object for the `unleash-client`. See options below.          |\n| `isGlobal`  | `boolean`         | No       | If `true`, the module will be registered as a global module. Defaults to `false`. |\n\nThe `config` object is passed directly to the `unleash-client`. The most common options are:\n\n| `config` Parameter | Type     | Required | Description                                                                                                |\n|--------------------|----------|----------|------------------------------------------------------------------------------------------------------------|\n| `url`              | `string` | Yes      | The URL of your Unleash server API.                                                                        |\n| `appName`          | `string` | Yes      | The name of your application.                                                                              |\n| `customHeaders`    | `object` | No       | Custom headers to be sent to the Unleash API. Use `Authorization` for the API key generated by the Unleash panel. |\n| `...`              | `any`    | No       | Any other valid option from the [official unleash-client-node documentation](https://docs.getunleash.io/reference/sdks/node). |\n\n### Protecting a Route with a Feature Toggle\nTo protect an endpoint with a feature toggle, use the `@UnleashToggle` decorator. The global `UnleashGuard` will automatically deny access if the feature is disabled.\n\n```ts\nimport { Controller, Get } from '@nestjs/common';\nimport { UnleashToggle } from '@alpha018/nestjs-unleash-client';\n\n@Controller()\nexport class AppController {\n  @Get('hello')\n  @UnleashToggle('my-feature-toggle')\n  getHello(): string {\n    // This route is only accessible if 'my-feature-toggle' is enabled in Unleash\n    return 'Hello World!';\n  }\n\n  @Get('unprotected')\n  getUnprotectedHello(): string {\n    // This route is always accessible as it does not have the @UnleashToggle decorator\n    return 'This is an unprotected route.';\n  }\n}\n```\n\n### Injecting the Unleash Client\nIf you need to check a feature toggle directly in your code, you can inject the `UnleashClientProvider`.\n\n```ts\nimport { Controller, Get } from '@nestjs/common';\nimport { UnleashClientProvider } from '@alpha018/nestjs-unleash-client';\n\n@Controller()\nexport class AppController {\n  constructor(private readonly unleashProvider: UnleashClientProvider) {}\n\n  @Get('check')\n  checkFeature() {\n    if (this.unleashProvider.isEnabled('my-other-feature')) {\n      // Logic for when the feature is enabled\n      return 'Feature is enabled!';\n    } else {\n      // Logic for when the feature is disabled\n      return 'Feature is disabled!';\n    }\n  }\n}\n```\n\n## Resources\n\nCheck out a few resources that may come in handy when working with NestJS:\n\n- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.\n- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).\n\n\n## Stay in touch\n\n- Author - [Tomás Alegre](https://github.com/Alpha018)\n\n## License\n\nThis project is [MIT licensed](LICENSE).\n","readmeFilename":"README.md"}