open-index/open-npm huggingface dataset:
npm package: @solarfluxx/fold
Description: Fold is a React state management library.
Latest version: 1.1.3

# fold
Fold is a React state management library.

## Install
```
// npm
npm install @solarfluxx/fold

// yarn
yarn add @solarfluxx/fold
```

## Examples

### Counter
```tsx
import { atom } from '@solarfluxx/fold';

const countAtom = atom(0);

function Counter() {
  const count = countAtom.use();
  
  return (
    <div>
      <div>{ count }</div>
      <button onClick={() => countAtom.set(count => count + 1)}>Increment</button>
    </div>
  );
}
```
npm package: @solaria-labs/nestjs-grpc-service-factory
Description: Utility to simplify working with NestJS gRPC clients
Author: Solaria Labs
Latest version: 0.0.4

# nestjs-grpc-service-factory

This project contains a utility to simplify working with the NestJS gRPC client.

## Installation

```
$ npm install @solarialabs/nestjs-grpc-service-factory
```

## Overview

NestJS gRPC clients are instantiated based on a remote service's gRPC package, leaving it up to the user to fetch the
particular service that they are interested in in a separate step once the client has finished initializing. Take the
example given by the [NestJS gRPC documentation](https://docs.nestjs.com/microservices/grpc#client):

```ts
@Injectable()
export class AppService implements OnModuleInit {
  private heroesService: HeroesService;

  constructor(@Inject('HERO_PACKAGE') private client: ClientGrpc) {}

  onModuleInit() {
    this.heroesService = this.client.getService<HeroesService>('HeroesService');
  }

  getHero(): Observable<string> {
    return this.heroesService.findOne({ id: 1 });
  }
}
```

This first creates a client which can connect to the overall remote service, then in the `onModuleInit` method pulls out
the particular gRPC service that we'll be calling. While this is convenient for pulling multiple services from a single
gRPC client, it is often the case that a service will only expose a single gRPC service and so this is unecessarily
verbose. That's where the `GrpcServiceFactory` comes in; it can be used to both create the client and retrieve a service
in one step.

```ts
// server.module.ts
@Module({
  imports: [GrpcServiceFactory.create<GrpcServiceInterface>('GrpcService', grpcClientOptions)]
})
export class ServerModule {}

// server.service.ts
@Injectable()
export class ProductsService {
  constructor(
    @Inject('GrpcService') private readonly grpcService: GrpcServiceInterface
  ) {}
}
```