Skip to content

Commit

Permalink
feat!: rename FeatureClient decorator to OpenFeatureClient (#949)
Browse files Browse the repository at this point in the history
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

As discussed here
[#750](#750 (comment)),
renames `@FeatureClient` to `@OpenFeatureClient` which is possible since
we merged #918.

Signed-off-by: Lukas Reining <[email protected]>
  • Loading branch information
lukas-reining authored May 19, 2024
1 parent e9d3ebc commit a531238
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/nest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ It is also possible to inject the default or domain scoped OpenFeature clients i

```ts
import { Injectable } from '@nestjs/common';
import { FeatureClient, Client } from '@openfeature/nestjs-sdk';
import { OpenFeatureClient, Client } from '@openfeature/nestjs-sdk';

@Injectable()
export class OpenFeatureTestService {
constructor(
@FeatureClient() private defaultClient: Client,
@FeatureClient({ domain: 'my-domain' }) private scopedClient: Client,
@OpenFeatureClient() private defaultClient: Client,
@OpenFeatureClient({ domain: 'my-domain' }) private scopedClient: Client,
) {}

public async getBoolean() {
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0",
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0",
"rxjs": "^6.0.0 || ^7.0.0 || 8.0.0",
"@openfeature/server-sdk": ">=1.7.5"
"@openfeature/server-sdk": ">=1.14.0"
},
"devDependencies": {
"@nestjs/common": "^10.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/feature.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface FeatureClientProps {
* @param {FeatureClientProps} [props] The options for injecting the client.
* @returns {PropertyDecorator & ParameterDecorator} The decorator function.
*/
export const FeatureClient = (props?: FeatureClientProps) => Inject(getOpenFeatureClientToken(props?.domain));
export const OpenFeatureClient = (props?: FeatureClientProps) => Inject(getOpenFeatureClientToken(props?.domain));

/**
* Options for injecting a feature flag into a route handler.
Expand Down
6 changes: 3 additions & 3 deletions packages/nest/test/test-app.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Controller, Get, Injectable, UseInterceptors } from '@nestjs/common';
import { Observable, map } from 'rxjs';
import { BooleanFeatureFlag, ObjectFeatureFlag, NumberFeatureFlag, FeatureClient, StringFeatureFlag } from '../src';
import { BooleanFeatureFlag, ObjectFeatureFlag, NumberFeatureFlag, OpenFeatureClient, StringFeatureFlag } from '../src';
import { Client, EvaluationDetails, FlagValue } from '@openfeature/server-sdk';
import { EvaluationContextInterceptor } from '../src';

@Injectable()
export class OpenFeatureTestService {
constructor(
@FeatureClient() public defaultClient: Client,
@FeatureClient({ domain: 'domainScopedClient' }) public domainScopedClient: Client,
@OpenFeatureClient() public defaultClient: Client,
@OpenFeatureClient({ domain: 'domainScopedClient' }) public domainScopedClient: Client,
) {}

public async serviceMethod(flag: EvaluationDetails<FlagValue>) {
Expand Down

0 comments on commit a531238

Please sign in to comment.