open-index/open-npm huggingface dataset:
npm package: @roisusi/shared-cmp
Description: This project uses Storybook 8 for developing and testing React components in isolation. Storybook provides a powerful environment for creating and documenting UI components, making it easier to build and maintain a component library.
Latest version: 0.0.3

# Project Name

This project uses Storybook 8 for developing and testing React components in isolation. Storybook provides a powerful environment for creating and documenting UI components, making it easier to build and maintain a component library.

## Table of Contents

- [Introduction](#introduction)
- [Setup](#setup)
- [Usage](#usage)
- [Project Structure](#project-structure)
- [Writing Stories](#writing-stories)
- [Running Tests](#running-tests)
- [Configuration](#configuration)

## Introduction

Storybook is an open-source tool for developing UI components in isolation for React, Vue, Angular, and more. It makes building stunning UIs organized and efficient.

This project uses Storybook 8 to:

- Develop components in isolation.
- Create a visual component library.
- Test components visually and interactively.
- Document components and their usage.

## Setup

To set up the project, follow these steps:

1. Clone the repository:

   ```sh
   git clone https://github.com/lev-bekker/shared-components.git
   cd shared-components
   ```

2. Install the dependencies:

   ```sh
   npm install
   ```

3. Start Storybook:

   ```sh
   npm run storybook
   ```

Storybook will start on `http://localhost:6006`.
npm package: @roisusi/shared-utl
Description: This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Latest version: 0.0.1

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
  // other rules...
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
    project: ['./tsconfig.json', './tsconfig.node.json'],
    tsconfigRootDir: __dirname,
  },
}
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
npm package: @roit/integration-models
Description: Lib para armazenar os models e o conector do Integration Log
Author: Author
Latest version: 0.0.20

# Integration Log Models
Lib para armazenar os models e o conector do Integration Log

## Como usar:

```typescript
import { IntegrationLog, IntegrationLogService } from "@roit/integration-models"


constructor (
    private readonly integrationLogService: IntegrationLogService
) {}

const myFileName = 'notafiscal.xml'
const integrationLog: IntegrationLog = await this.integrationLogService.findByFileName(myFileName)
```

O `IntegrationLogService` utiliza o módulo HTTP do próprio Nestjs, portanto, no `AppModule` devem ser injetadas as seguintes classes:
```typescript

@Module({
    imports: [HttpModule],
    providers: [
        IntegrationLogService
    ]
})
export class AppModule { }
```

Arquitetura da utilização da LIB
![Architecture](architecture.png)
npm package: @roit/roit-company-interfaces
Description: This library contains all interfaces related to ROIT Company & Integrations squad.
Author: ROIT Innovation
Latest version: 4.15.0

# ROIT Company Interfaces 🚀
This library contains all interfaces related to ROIT Company & Integrations squad.

### Install the library
```shell
$ npm install @roit/roit-company-interfaces
```

### Usage

#### Interfaces
```typescript
import { Master, Client } from '@roit/roit-company-interfaces'

const client: Client = await this.findClientById(clientId);

async findMasterById(id: string): Promise<Master> {...};
```
npm package: @roit/roit-company-models
Description: This library contains all models related to ROIT Company & Integrations squad.
Author: ROIT Innovation
Latest version: 4.1.0

# ROIT Company Models 🚀
This library contains all models related to ROIT Company & Integrations squad.

### Install the library
```shell
$ npm install @roit/roit-company-models
```

### Usage

#### Models
```typescript
import { Master, Client } from '@roit/roit-company-models'

const client: Client = await this.findClientById(clientId);

async findMasterById(id: string): Promise<Master> {...};
```
npm package: @roit/roit-components
Description: ![N|Solid](https://sandbox.auth.roit.ai/img/logo.de8e3ae8.jpg)
Latest version: 0.2.0


![N|Solid](https://sandbox.auth.roit.ai/img/logo.de8e3ae8.jpg)

# Roit Library

### Dependencias

* [PrimeVue] - Biblioteca principal e base para os componentes;
* [Element] - Biblioteca secundária e base para alguns componentes;
* [Bootstrap] - Grid System;
* [i18n] - Internacionalização;
* [Vue] - Framework base;

### Uso

Após a instalação é necessário importar corretamente os componentes...

```sh
$ import { Button } from 'roit-components-library';
$ import 'roit-components-library/dist/roit-components-library.css';
```

### Instalação

Instalação em outros projetos...

```sh
$ yarn add roit-components-library
```

#### Rodando em desenvolvimento
Para gerar a build da lib:
```sh
$ yarn webpack:build
```
Testar...

```sh
$ yarn test:unit
```

Para gerar a build do storybook:
```sh
$ yarn storybook:build
```

Para testar local storybook:
```sh
$ yarn storybook:serve
```
npm package: @roit/roit-date
Description: ### Usage
Author: ROIT Innovation
Latest version: 1.10.5

# ROIT Date Format

### Usage

    > npm i @roit/roit-date

### Manipulating the date

```typescript
import { formatDate, retrieveDate, Timezone } from '@roit/roit-date'

const date1 = '12/01/2021'
const date2 = '12/01/2021 00:00'
const date3 = '2021/01/12'
const date4 = '2021-01-12: 00:00'
const date5 = '2021-01-12T03:00:00.000Z'

// Timezone by default is 'America/Sao_Paulo'
formatDate(date1, { timezone: Timezone.AMERICA_SAO_PAULO }) // 2021-01-12T03:00:00.000Z
formatDate(date2) // 2021-01-12T03:00:00.000Z
formatDate(date3) // 2021-01-12T03:00:00.000Z
formatDate(date4) // 2021-01-12T03:00:00.000Z
formatDate(date5) // 2021-01-12T03:00:00.000Z

// Timezone by default is 'America/Sao_Paulo'
retrieveDate(date1, { timezone: Timezone.AMERICA_SAO_PAULO }) // 2021-01-12T00:00:00.000Z
retrieveDate(date2) // 2021-01-12T00:00:00.000Z
retrieveDate(date3) // 2021-01-12T00:00:00.000Z
retrieveDate(date4) // 2021-01-12T00:00:00.000Z
retrieveDate(date5) // 2021-01-12T00:00:00.000Z
```

### Showing the date

```typescript
import { showDateToUser, formatCompetence, Timezone } from '@roit/roit-date'

const date1 = '2021-02-12T03:00:00.000Z'
const date2 = '2021-02-01T00:00:00.000Z'

// Timezone by default is 'America/Sao_Paulo'
showDateToUser(date, { timezone: Timezone.AMERICA_SAO_PAULO }) // 12/02/2021
showDateToUser(date1, { hours: true }) // 12/02/2021 03:00
showDateToUser(date2) // 31/01/2021    -> Based on the timezone it will convert back to UTC -3 which is Sao Paulo

// Timezone by default is 'America/Sao_Paulo'
formatCompetence(date, { timezone: Timezone.AMERICA_SAO_PAULO }) // 02/2021
formatCompetence(date1) // 02/2021
formatCompetence(date2) // 01/2021     -> Based on the timezone it will convert back to UTC -3 which is Sao Paulo
```

### New Date

```typescript
import { newDate } from '@roit/roit-date'

newDate() // if actual date in America/Sao_Paulo is 2021-05-31T22:06:00.786Z the output will be 2021-06-01T01:06:00.786Z
```

### Diff of two dates

```typescript
import { diffDays } from '@roit/roit-date'

diffDays('2021/01/12', '13/01/2021') // outputs 1
```

### ValidateDateFormat

```typescript
import { validateDateFormat } from '@roit/roit-date'

validateDateFormat('invalid-date') // false
validateDateFormat('12/12/2021') // true
```
npm package: @roit/roit-environment
Description: Facilitate environment management in node applications
Author: Jeremias Silva
Latest version: 1.2.1

# ROIT environment lib
Facilitate environment management in node applications

## Usage
-----------

### Declaring variables in a file:

```
root-path/env.yaml
```

```yaml

serviceName: Service A
serviceInfo:
  version: '1.0'

# Development-specific settings. 
dev:
  port: 3000
  dropDatabase: true
  credential: config/dev/foobar.json
  credentialLevel{3}: foobar.json
  pg:
    host: 172.1.2.208
    user: myuserpg
    pass:
      inner: mysafepass
# Homologation-specific settings. 
hom:
  port: 9001
  dropDatabase: false
  credential: config/hom/foobar.json
# Production-specific settings. 
prod:
  port: 80
  dropDatabase: false
  credential: config/prod/foobar.json
```
### Example for importing and invoking method:

```javascript

import { Environment, Env } from '@roit/roit-environment';

Environment.getProperty("port") // output: 3000

// Verify env is accepted
Environment.acceptedEnv(Env.HOM) // output: false
Environment.acceptedEnv(Env.DEV) // output: true

Environment.currentEnv() // return enum Env

// Relative path example
root
  -config
   --dev
    ---foobar.json
// Param 1: subs level number (3)
// Param 2: key property
Environment.getRelativePath(3, 'credential') // output: ../../../config/dev/foobar.json

// Childrens property 
Environment.getProperty("pg.host") // output: 172.1.2.208
Environment.getProperty("pg.pass.inner") // output: mysafepass
process.env.PG_HOST // output: 172.1.2.208
process.env.PG_PASS_INNER // output: mysafepass

```
### Env Options:

```javascript

// Attributes:
// manuallyEnv: set manual env
// fileYamlName: especify file name for internal loading

import { Environment } from '@roit/roit-environment';

Environment.envOptions({ manuallyEnv: Env.PROD, fileYamlName: 'foo.yaml' })

Environment.getProperty("port") // output: 80 (port from env prod)
process.env.PORT // output: 80 (port from env prod)

```

## Activate environment

Node param

```
ENV=dev node index.js
```

Google function example (--set-env-vars)

```shell
# hom example
gcloud functions deploy FUNCTION_NAME --runtime RUNTIME_PARAM --trigger-http --project PROJECT --set-env-vars ENV=hom
# prod example
gcloud functions deploy FUNCTION_NAME --runtime RUNTIME_PARAM --trigger-http --project PROJECT --set-env-vars ENV=prod
```
npm package: @roit/roit-queues
Description: ### Usage for Pub/Sub
Author: ROIT INNOVATION
Latest version: 1.0.4

# ROIT Queues

### Usage for Pub/Sub

In the `env.yaml` file add the `pubSubCredential{}` and `projectId` attributes, with the number of folders inside the {}:

```yaml
dev:
    pubSubCredential{5}: my-credential.json
    projectId: my-project-id
```

Note: if you use `glcloud auth application-default login`, you don't need to set `pubSubCredential` at env file!

Inject in your desired class:
```typescript
import { PubSubHandler } from '@roit/roit-queues'

constructor( 
    private readonly pubSubHandler: PubSubHandler
) {}
```

Use the `publish` method:
```typescript
const myObject = {
    // properties
}

const messageId = await this.pubSubHandler.publish(myObject, 'myTopic')
console.log(messageId) // outputs 234786275
```

### Usage for Cloud Tasks

In the `env.yaml` file add the `cloudTaskCredencial{}` and `projectId` attributes, with the number of folders inside the {}:

```yaml
dev:
    cloudTaskCredential{5}: my-credential.json
    projectId: my-project-id
```

Inject in your desired class:
```typescript
import { CloudTaskProvider } from '@roit/roit-queues'

constructor( 
    private readonly cloudTaskProvider: CloudTaskProvider
) {}
```

Schedule Time params:
```typescript
scheduleTime: {
    seconds?: number
    nanos?: number
    dateExecute?: string // Use moment formats: https://www.npmjs.com/package/moment
    executeAt?: string // Use ms formats: https://www.npmjs.com/package/ms
}
```


Use the `createTask` method:
```typescript
import { TaskConfiguration } from '@roit/roit-queues'

const myTask: TaskConfiguration = {
    url: 'https://endpoint.com',
    httpMethod: 'POST',
    region: 'us-central1',
    queue: 'my-queue',
    scheduleTime: {
        seconds: 3600   
    },
    headers: MyHeadersObject,
    body: MyPayloadObject
}

const taskResponse = await this.cloudTaskProvider.createTask(myTask)
console.log(taskResponse)
```
npm package: @roit/roit-secret-manager
Description: ### Installation
Author: ROIT Innovation
Latest version: 2.7.2

# ROIT Secret Manager

### Installation

    > npm i @roit/roit-secret-manager

### Permission

We need to grant permissions to the service account to be able to access Secret Manager

### Usage

In the `env.yaml` file add the `secretManager.projectId` attribute, with the name do project gcp:

```yaml
dev:
  secretManager:
    projectId: project-gcp
```

```Example
import { getSecretVersion } from "@roit/roit-secret-manager";

const secret = await createAndAccessSecret('secret-id', 'data')
const secret = await addSecretVersion('secret-id', 'data')
const secret = await getSecretVersion('secret-id', '1')
const secret = await disableSecretVersion('secret-id', '1')

```

## Functions

| Name                    | Description                              |
| ----------------------- | ---------------------------------------- |
| `createAndAccessSecret` | create secret and version                |
| `getSecretVersion`      | returns data of the informed version     |
| `disableSecretVersion`  | disable version of the given secret      |
| `addSecretVersion`      | add a new version to the existing secret |
npm package: @roit/roit-sql-builder
Description: ## Usage
Author: ROIT Innovation
Latest version: 0.0.7

# ROIT SQL Builder

## Usage

Project structure must be like this:

```
root
│   README.md
└───src/
└───sql/
```
Create a class that mirrors your table:

```typescript
export class Person {
    name: string
    age: number
}
```

Create you SQL file with the parameters with @ in front of the name: 
```sql 
SELECT * FROM person p WHERE p.name = @name AND p.age = @age
```

Import the method and use it:

```typescript
import { buildQueryString } from '@roit/roit-sql-builder'

const person = new Person()
person.name = 'Keanu Reeves'
person.age = 46

const query = buildQueryString<Person>('sql-file-name.sql', person)
console.log(query)
// Output: 
// SELECT * FROM person p WHERE p.name = Keanu Reeves AND p.age = 46
npm package: @roit/roit-storage
Description: ### Usage for Google Cloud Storage
Author: ROIT Innovation
Latest version: 0.0.9

# ROIT Storage

### Usage for Google Cloud Storage

In the `env.yaml` file add the `googleStorageCredential{}` attribute, with the number of folders inside the {}:

```yaml
dev:
    googleStorageCredential{5}: my-credential.json
```

Inject in your desired class:
```typescript
import { GoogleCloudHandler } from '@roit/roit-storage'

constructor( 
    private readonly googleCloudHandler: GoogleCloudHandler
) {}
```

To use the `retrieveFromStorage` method:
```typescript
const filePath = 'path/from/my/file'
const bucketName = 'my-files-bucket'

const url = await this.googleCloudHandler.retrieveFromStorage(filePath, bucketName)
console.log(url) // outputs https://storage.googleapis.com/...
```

To use the `getSignedUrl` method:
```typescript
const filePath = 'path/from/my/file'
const bucketName = 'my-files-bucket'

const url = await this.googleCloudHandler.getSignedUrl(filePath, bucketName)
console.log(url) 
```

The `getSignedUrl` method returns a URL from Google that you need to perform a HTTP POST with the binary encoded file you want to upload, here is a example in Insomnia:

![insomnia-example](./insomnia-example.png)

### Nestjs Usage

In Nestjs, don't forget to add the `GoogleCloudHandler` on the `AppModule` as a provider:
```typescript
@Module({
  imports: [],
  controllers: [],
  providers: [
    GoogleCloudHandler
  ],
})
export class AppModule { }
```
npm package: @roit/roit-utils
Description: ### V1 - Normalize string method - Create md5 hash (no dependencies)
Author: Author
Latest version: 1.0.2

# ROIT Utils

### V1
- Normalize string method
- Create md5 hash (no dependencies)


### Usage
`npm install @roit/roit-utils`

- Creating md5 hash

```ts
import {md5} from '@roit/roit-utils'

md5('any_name')
// 13a55449ce38a9d14343d79fdbb8860b

```

- Normalizing strings
```ts
import {normalizeString} from '@roit/roit-utils'

normalizeString('são paulo') // default use Canonical Decomposition.  (remove all accents from string and normalize it)
//SAO PAULO

//also you can use an explicit type ("NFC" | "NFD" | "NFKC" | "NFKD")
normalizeString('any_text', 'NFC')
//check normalize method for details: 
//https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
```