open-index/open-npm huggingface dataset:
npm package: @jagota-brothers/common
Description: Error handling shared common library
Author: Sayantan Das
Latest version: 0.1.1

# Node Micro-Services Common Code
For ease of code sharing between different projects

---

### Install
```shell
$ npm i @jagota-brothers/common
```

### Usage Example:

```javascript
// Other imports
import { notFoundError, currentUser } from '@jagota-brothers/common';

const app = express();

app.get('/', currentUser, (req, res) => {
    // if user is logged in, this would be defined
    const userInfo = req.user;
    // Rest of stuffs
});

// Other routes

// route for 404
app.all('*', async () => {
    throw new NotFoundError();
})
```

## Custom Errors available
`authorizationError` **:** 401, Can use for unauthorized request.

`badRequestError` **:** 400, expects a `string` as parameter.

`databaseError` **:** 500, Failed to connect to DB.

`notFoundError` **:** 404, Not Found.

`requestValidationError` **:** 400, For failed validation (express-validator) requests.

## Custom Middlewares
`currentUser` **:**
- Checks cookie in request to see if user JWT is sent along with request.
- Attaches data in JWT to request as `req.user`.


`authorize` **:** fn
- Should only be used after `currentUser` middleware.
- Takes an optional array of roles (string) as parameter.
- Checks if that role is present in req.user.

`errorHandler` **:** 
- Global catch block.
- Use as last middleware for the App.

`validateRequest` **:** fn
- Accepts validation Schema (from express-validator) as parameter
- Validates incoming data in request against schema & throws error if data is invalid

---
### The middlewares marked as `fn` should be used as a function.

Example:
```javascript
const validRolesToCreateArticle = ['author', 'admin'];

app.post('/article', currentUser, authorize(validRolesToCreateArticle), (req, res) => {
    // Implementation for this route    
})
```

---
## License
This package is created & published under [MIT License](https://opensource.org/licenses/MIT).
npm package: @jagota/interfaces
Description: Interfaces for the Jagota Brothers project
Author: Narendra Gupta
Latest version: 1.7.82

# @jagota/interfaces

## Overview

**@jagota/interfaces** is a Node.js/TypeScript package that provides a set of predefined interfaces to standardize data structures across the application. These interfaces help ensure consistent and type-safe code, making development process more efficient and reliable.

## Installation

To install the package, use npm:

```bash
npm i @jagota/interfaces
```

## License

This package is created & published under the [MIT License](https://opensource.org/license/MIT).
npm package: @jagretz/eslint-config-base
Description: Base eslint config
Author: jason gretz
Latest version: 0.2.0-snapshot.0

Configuration for javascript projects.

# eslint-config-base

Disregards _\*most_ linter settings that touch code format.

\* = Linters are intended to catch problem areas in a codebase. Occasionally,
formatting lint rules are added which do not change the affect of the code, but
may cause confusion for new developers and frustration for more experienced
developers.

Not all formatting rules provided by linters are disabaled, but this
configuration does limit the number of formatting rules that do come enabled.

**Dependencies**

- [babel-eslint](https://github.com/babel/babel-eslint)
- [eslint-config-airbnb-base](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base)
- [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
- [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import)
- [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc/)
npm package: @jagretz/eslint-config-react
Description: Eslint config for reactjs projects
Author: jason gretz
Latest version: 0.2.0-snapshot.0

Configuration for react.js projects.

# eslint-config-react

Disregards any setting that touch code format (format is up to you).

**Dependencies**

- [@jagretz/eslint-config-base](https://github.com/jagretz/web-tooling-config/tree/master/packages/eslint-config-base)
- [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react)
- [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y)
npm package: @jagretz/stylelint-config-base
Description: Base stylelint config
Author: jason gretz
Latest version: 0.2.0-snapshot.0

Configuration for projects that use CSS and/or SCSS/SASS.

# stylelint-config

**Dependencies**

- [stylelint-scss](https://github.com/kristerkari/stylelint-scss)
- [stylelint-config-recommended-scss](https://github.com/kristerkari/stylelint-config-recommended-scss)
npm package: @jagruti-perpetualny/dai_components_library
Description: StoryBook Components Library For DAI
Author: jagruti-perpetualny
Latest version: 0.1.16

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component
Description: Ant Design Components Library
Author: jagruti-perpetualny
Latest version: 1.0.0

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component1
Description: Ant Design Components Library
Author: jagruti-perpetualny
Latest version: 1.0.2

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component2
Description: Ant Design Components Library
Author: jagruti-perpetualny
Latest version: 1.0.2

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component3
Description: Ant Design Components Library
Author: jagruti-perpetualny
Latest version: 1.0.3

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component4
Description: Ant Design Components Library
Author: jagruti-perpetualny
Latest version: 1.0.7

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).
npm package: @jagrutigourcuelogic/storybook_component5
Description: StoryBook Components Library For DAI
Author: jagruti-perpetualny
Latest version: 1.0.44

## 🤝 Contributing

We welcome contributions to InMarketUI!

Read our [contributing guide](https://github.com/InMarketltd/anv-ui-components/blob/development/CONTRIBUTING.md) and help us build or improve our components.

## 📝 License

This project is offered under [MIT License](https://github.com/InMarketltd/anv-ui-components/blob/development/LICENSE).