# @webezy-io/commons

> Webezy commons modules

Latest version **0.0.4** (published 2022-09-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install @webezy-io/commons
pnpm add @webezy-io/commons
yarn add @webezy-io/commons
bun add @webezy-io/commons
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-09-12 |
| First published | 2022-09-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 49.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Amit Shmulevitch |
| Maintainers | webezyio |
| Keywords | gRPC, Webezy.io |

## Links

- npm: https://www.npmjs.com/package/@webezy-io/commons
- npm.io page: https://npm.io/package/@webezy-io/commons

## Dependencies (2)

- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [winston](https://npm.io/package/winston.md) ^3.8.2

## Recent versions

- 0.0.4 (latest) — 2022-09-12
- 0.0.3 — 2022-09-12
- 0.0.2 — 2022-09-12
- 0.0.1 — 2022-09-12

## README

[npm](https://badgen.net/npm/v/@webezy-io/commons)

# webezy-io/commons

This is commons modules to be used with [Webezy.io](https://www.webezy.io) project written in TS / JS

# Install

Install the package via npm:
```sh
npm i --save @webezy-io/commons
```

# Usage

@webezy-io/commons is used for common method on Webezy.io projects including with client or server side TS / JS code.

## Validators

This is sample use case if a validator is attached to one of your incoming messages.
It will validate input against the calidator logic, and will fail the request before sending it to server.

```ts
import { utils } from  '@webezy-io/commons';

class project() {
    public SampleRPC(params: SampleMsg, metadata: Metadata = this.metadata): Promise<SampleMsg> {
        utils.validators._min_validator(params.SampleInt, 10.0)
        return promisify<SampleMsg, Metadata, SampleMsg>(this.SampleService_client.sampleRPC.bind(this.SampleService_client))(params, metadata);
    }    
}
```

See [Docs](https://www.webezy.io/docs/validators) on how to attach validators in Webezy.io project.

Use to generate message with extandable fields.
```sh
wz generate --message --field-extension
```


### Available validators

1. webezy.commons.v1.Validators.Email - Email string validator
2. webezy.commons.v1.Validators.RegEx - A custom regular expression validation
3. webezy.commons.v1.Validators.MaxLength - Maximum length of a String or Array
4. webezy.commons.v1.Validators.Max - Minimum value
5. webezy.commons.v1.Validators.Max - Maximum value

---
_Source: https://npm.io/package/@webezy-io/commons · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
