open-index/open-npm huggingface dataset:
npm package: @pagopa/ts-commons
Description: Shared TypeScript code for the IO project
Author: https://www.pagopa.gov.it
Latest version: 14.0.0

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fteamdigitale%2Fitalia-ts-commons.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fteamdigitale%2Fitalia-ts-commons?ref=badge_shield)

# TypeScript Commons

This module provides code shared by the projects of the
[IO App](https://github.com/pagopa/io)
initiative.

Documentation is available [here](https://pagopa.github.io/io-ts-commons/)

## Contributing

In the following there are instructions to build the app in your computer for development purposes.

### Pre-requisites

We built a script for helping setting up the laptop, you can find it [here](https://github.com/pagopa/developer-laptop)

Otherwise, please follow the following steps:

#### Install NodeJS
To run the project you need to install a properly version of NodeJS.

On macOS and Linux we recommend the use of a virtual environment, such as nodenv for managing multiple versions of NodeJS.
The node version used in this project is stored in .node-version.

If you already have nodenv installed and configured on your system, the correct version node will be set when you access the app directory.

To install, follow the steps described below.

#### Install brew

If you do not have it already, install brew following the installation instructions in the [home page](https://brew.sh/).

#### Install nodenv

```
brew install nodenv
```

#### Install yarn

For the management of javascript dependencies we use Yarn.

Yarn is a node application. IF you have already installed in your system version of node compatible with yarn, you can install it as a global command with:

```
npm install -g yarn
```

### Install dependencies

Install the libraries used by the project:

```
$ yarn install --frozen-lockfile
```

### Run Tests

#### Run Unit Tests 

```
$ yarn test
```
#### Run Lint Check

```
$ yarn lint
```

### Updating/publishing online docs

```
$ yarn docs
```


### Releasing a version

Release has been automatized by using Azure Pipelines.

To release a new version please go to [io-ts-commons project on Azure](https://dev.azure.com/pagopaspa/pagopa-packages-projects/_build) and manually run _pagopa.io-ts-commons.deploy_ the pipeline.
Be aware to choose the right release version between major|minor|patch
npm package: @pagopa/winston-ts
Description: fp-ts wrapper for logging with winston logger
Author: https://pagopa.gov.it
Latest version: 2.2.0

# @pagopa/winston-ts

fp-ts wrapper to use [winston](https://github.com/winstonjs/winston) logging library inside a pipe.

## Quick Start
The [index](./src/index.ts) define an object for each supported fp-ts monad (Option, Either, ...) implementing the relative log functions (log, tarce, info, warn and error).
A log function could be used directly in the pipe, without output changes. 

### Example
```javascript
import { pipe } from "fp-ts/lib/function";
import * as TE from "fp-ts/TaskEither";
import * as L from "@pagopa/winston-ts";

L.useWinston(L.withConsole());  // configure the default winston tranport

pipe(
  { name: "Bob" },
  TE.right,
  L.taskEither.info("INFO!"),   // log an info if the taskEither is right
  L.taskEither.debug(i => `DEBUG ${i.name}`), // log a debug if the taskEither is right using data conteined in the monad (rigth)
  TE.chain(i => TE.left(Error(i.name))),
  L.taskEither.debugLeft(i => `DEBUG ${i}`) // log a debug if the taskEither is left using data contained in the monad (left)
);
```

## About Side-Effect
A winston logger is backed by a node stream. Each log call will be an asynchronous 'fire and forget': no further error will be throw by winston transport.

## About Azure
This logger could be used in an Azure context using the [AzureContextTransport](https://github.com/pagopa/io-functions-commons/blob/master/src/utils/logging.ts).
NB: if you use a Function App, the transport logging level must be set to [FINEST_LEVEL](./src/utils/config.ts). The final logging level will be the one set in the function host.json.

```javascript
export const run = (context: Context) => { 
...
  L.useWinston(new AzureContextTransport(() => context.log, { level: FINEST_LEVEL }));  // configure the default winston tranport
...
}
```
npm package: @pagoru/redux-middleware
Description: ![Build status](https://pagoru.visualstudio.com/redux-middleware/_apis/build/status/redux-middleware-CI) # @pagoru/redux-middleware Simple redux middleware library, to create your own middleware.
Author: @pagoru
Latest version: 20.97.1

![Build status](https://pagoru.visualstudio.com/redux-middleware/_apis/build/status/redux-middleware-CI)
# @pagoru/redux-middleware
Simple redux middleware library, to create your own middleware.

## Usage
```js
import { createStore } from 'redux'
import { middleware, middlewareHandler } from 'redux-middleware'

// Create as many you need.
middlewareHandler(  
    (action, getState) => {  
	    // you can modify your action here
		console.log('will', action, getState());  
		return action;  
  }, (action, getState) => {  
        console.log('did', action, getState());  
  }  
);

const initialStore = {}
// Add the middleware to the createStore.
const store = createStore(rootReducer, initialStore, applyMiddleware(middleware));

```