Skip to content

Commit

Permalink
feat(notify): add notify package
Browse files Browse the repository at this point in the history
  • Loading branch information
isuvorov committed May 29, 2024
1 parent 44338e6 commit faa2054
Show file tree
Hide file tree
Showing 11 changed files with 2,501 additions and 1,388 deletions.
179 changes: 179 additions & 0 deletions libs/notify/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [4.23.2](https://github.com/lskjs/lskjs/compare/v4.23.1...v4.23.2) (2024-02-09)


### Bug Fixes

* **cache:** paramIndex check and error catching ([21d9c98](https://github.com/lskjs/lskjs/commit/21d9c9843697d91880fdfdc3c827f77c6d96d78a))





# [4.21.0](https://github.com/lskjs/lskjs/compare/v4.20.0...v4.21.0) (2024-01-30)

**Note:** Version bump only for package @nestlib/cache





## [4.18.2](https://github.com/lskjs/lskjs/compare/v4.18.1...v4.18.2) (2024-01-16)


### Bug Fixes

* **mutex:** may be fix esm import ([ce609be](https://github.com/lskjs/lskjs/commit/ce609bed198c433ad7f567d991f834099b146a37))





## [4.16.1](https://github.com/lskjs/lskjs/compare/v4.16.0...v4.16.1) (2024-01-13)

**Note:** Version bump only for package @nestlib/cache





# [4.16.0](https://github.com/lskjs/lskjs/compare/v4.15.0...v4.16.0) (2024-01-10)


### Bug Fixes

* **cache,mutex:** proper usage of async-lock ([b0c1d42](https://github.com/lskjs/lskjs/commit/b0c1d425cc62e2f22d03b80c23c06daef65f0f49))


### Features

* **cache:** lock in mutex ([a2241c7](https://github.com/lskjs/lskjs/commit/a2241c72970a6494361f066f2cb4c604cd3c7c0c))





# [4.6.0](https://github.com/lskjs/lskjs/compare/v4.5.0...v4.6.0) (2023-12-21)


### Bug Fixes

* **cache:** change add error log ([c13b1ae](https://github.com/lskjs/lskjs/commit/c13b1ae8fddaa1337a12496cd2834a1a9059ba0c))


### Features

* **cache:** add new Cache & IgnoreCache decorators ([2ef4e06](https://github.com/lskjs/lskjs/commit/2ef4e06b298cf8461814d23a84a6a64e2ce592b7))





# [4.5.0](https://github.com/lskjs/lskjs/compare/v4.4.1...v4.5.0) (2023-12-15)

**Note:** Version bump only for package @nestlib/cache





# [4.4.0](https://github.com/lskjs/lskjs/compare/v4.3.0...v4.4.0) (2023-12-14)

**Note:** Version bump only for package @nestlib/cache





# [4.1.0](https://github.com/lskjs/lskjs/compare/v3.19.0...v4.1.0) (2023-12-05)


### Bug Fixes

* @lskjs/nest-* -> @nestlib/* and [@lskjs](https://github.com/lskjs) -> [@lsk4](https://github.com/lsk4) ([b55869a](https://github.com/lskjs/lskjs/commit/b55869ae94f21c466efc3a6c1ce642ab552489ef))
* cjs import ([5ff0aed](https://github.com/lskjs/lskjs/commit/5ff0aed8e8a60ac4b89453489abd9c6943d0b275))





# [3.19.0](https://github.com/lskjs/lskjs/compare/v3.17.0...v3.19.0) (2023-11-08)


### Features

* **nest-cache:** improve caching ([37c6e36](https://github.com/lskjs/lskjs/commit/37c6e36afeb916230a5a349d200c775cdba42bf1))





# [3.17.0](https://github.com/lskjs/lskjs/compare/v3.16.3...v3.17.0) (2023-11-06)

**Note:** Version bump only for package @lskjs/nest-cache





## [3.16.4](https://github.com/lskjs/lskjs/compare/v3.16.3...v3.16.4) (2023-11-06)

**Note:** Version bump only for package @lskjs/nest-cache





## [3.16.2](https://github.com/lskjs/lskjs/compare/v3.16.1...v3.16.2) (2023-11-06)

**Note:** Version bump only for package @lskjs/nest-cache





## [3.15.1](https://github.com/lskjs/lskjs/compare/v3.15.0...v3.15.1) (2023-10-11)

**Note:** Version bump only for package @lskjs/nest-cache





## [3.11.1](https://github.com/lskjs/lskjs/compare/v3.11.0...v3.11.1) (2023-08-05)

**Note:** Version bump only for package @lskjs/nest-cache





# [3.11.0](https://github.com/lskjs/lskjs/compare/v3.10.0...v3.11.0) (2023-08-03)

**Note:** Version bump only for package @lskjs/nest-cache





# [3.9.0](https://github.com/lskjs/lskjs/compare/v3.8.1...v3.9.0) (2023-07-26)


### Bug Fixes

* **nest-cache:** type fixes ([b2f6a49](https://github.com/lskjs/lskjs/commit/b2f6a4958fa617fc5b4b330ab06f59cfef4ffe81))





## [3.8.1](https://github.com/lskjs/lskjs/compare/v3.8.0...v3.8.1) (2023-07-25)


### Bug Fixes

* **nest-auth:** eslint error ([f982bca](https://github.com/lskjs/lskjs/commit/f982bcae6bc91dd228f67889963def417fe8b808))
76 changes: 76 additions & 0 deletions libs/notify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# LSK.js – utils

> @lskjs/utils – LSK.js – utils – helpers and functions
[![LSK logo](https://badgen.net/badge/icon/MADE%20BY%20LSK?icon=zeit\&label\&color=red\&labelColor=red)](https://github.com/lskjs)
[![NPM version](https://badgen.net/npm/v/@lskjs/utils)](https://www.npmjs.com/package/@lskjs/utils)
[![NPM downloads](https://badgen.net/npm/dt/@lskjs/utils)](https://www.npmjs.com/package/@lskjs/utils)
[![NPM Dependency count](https://badgen.net/bundlephobia/dependency-count/@lskjs/utils)](https://bundlephobia.com/result?p=@lskjs/utils)
[![Have TypeScript types](https://badgen.net/npm/types/@lskjs/utils)](https://www.npmjs.com/package/@lskjs/utils)
[![Have tree shaking](https://badgen.net/bundlephobia/tree-shaking/@lskjs/utils)](https://bundlephobia.com/result?p=@lskjs/utils)
[![NPM Package size](https://badgen.net/bundlephobia/minzip/@lskjs/utils)](https://bundlephobia.com/result?p=@lskjs/utils)
[![Package size](https://badgen.net//github/license/lskjs/lskjs)](https://github.com/lskjs/lskjs/blob/master/LICENSE)
[![Ask us in Telegram](https://img.shields.io/badge/Ask%20us%20in-Telegram-brightblue.svg)](https://t.me/lskjschat)

<!-- template file="scripts/templates/preview.md" start -->

<!-- template end -->

***

<!-- # 📒 Table of contents -->

# Table of contents

* [⌨️ Install](#️-install)
* [📖 License](#-license)
* [👥 Contributors](#-contributors)
* [👏 Contributing](#-contributing)
* [📮 Any questions? Always welcome :)](#-any-questions-always-welcome-)

# ⌨️ Install

```sh
# yarn
yarn i @lskjs/utils

# npm
npm i @lskjs/utils
```

***

# 📖 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

# 👥 Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<!-- prettier-ignore-start -->

<!-- markdownlint-disable -->

<table>
<tr>
<td align="center"><a href="https://isuvorov.com"><img src="https://avatars2.githubusercontent.com/u/1056977?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Igor Suvorov</b></sub></a><br /><a href="lskjs/lskjs///commits?author=isuvorov" title="Code">💻</a> <a href="#design-isuvorov" title="Design">🎨</a> <a href="#ideas-isuvorov" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

# 👏 Contributing

1. Fork it (<https://github.com/yourname/yourproject/fork>)
2. Create your feature branch (`git checkout -b features/fooBar`)
3. Commit your changes (`git commit -am 'feat(image): Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request

# 📮 Any questions? Always welcome :)

* [Email](mailto:hi@isuvorov.com)
* [LSK.news – Telegram channel](https://t.me/lskjs)
* [Спроси нас в телеграме ;)](https://t.me/lskjschat)
66 changes: 66 additions & 0 deletions libs/notify/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@nestlib/notify",
"version": "4.23.2",
"description": "LSK.js – nest notify sender – use telegram, slack or emails",
"author": "Igor Suvorov <hi@isuvorov.com> (https://github.com/isuvorov)",
"private": false,
"scripts": {
"dev": " ycmd dev",
"build": " ycmd build",
"test": " ycmd test",
"prepack": " ycmd prepack",
"release": " ycmd release"
},
"dependencies": {
"@lsk4/rlog": "^4.21.0"
},
"devDependencies": {
"@nestjs/common": "^10.3.0",
"@nestjs/core": "^10.3.0"
},
"peerDependencies": {
"@nestjs/common": "*",
"@nestjs/core": "*"
},
"//": "///////////========================/////////========================/////////========================//////////",
"prettier": "@lsk4/eslint-config/prettier",
"eslintConfig": {
"extends": "@lsk4/eslint-config"
},
"files": [
"lib",
"cjs",
"README.md",
"LICENCE"
],
"main": "cjs/index.js",
"types": "cjs/index.d.ts",
"exports": {
".": {
"import": "./lib/index.js",
"types": "./cjs/index.d.ts",
"default": "./cjs/index.js"
},
"./*": {
"import": "./lib/*.js",
"types": "./cjs/*.d.ts",
"default": "./cjs/*.js"
}
},
"_size-limit": [
{
"path": "lib/index.js",
"limit": "10kb"
}
],
"///": "//////////========================/////////========================/////////========================/////////",
"repository": "https://github.com/lskjs/lskjs/tree/master//libs-nest/nest-cache",
"homepage": "https://github.com/lskjs/lskjs/tree/master//libs/nest-cache",
"bugs": "https://github.com/lskjs/lskjs/issues",
"license": "MIT",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"////": "/////////========================/////////========================/////////========================/////////"
}
25 changes: 25 additions & 0 deletions libs/notify/src/Notify.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DynamicModule, Module } from '@nestjs/common';

import { NotifyService } from './Notify.service.js';
import { NOTIFY_MODULE_OPTIONS_TOKEN } from './tokens.js';
import { NotifyModuleOptions } from './types.js';

@Module({
providers: [NotifyService],
exports: [NotifyService],
})
export class NotifyModule {
static forRoot(options: NotifyModuleOptions): DynamicModule {
return {
module: NotifyModule,
providers: [
{
provide: NOTIFY_MODULE_OPTIONS_TOKEN,
useValue: options,
},
NotifyService,
],
exports: [NotifyService],
};
}
}
35 changes: 35 additions & 0 deletions libs/notify/src/Notify.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { RlogSendData, RlogSendOptions } from '@lsk4/rlog';
import { Rlog } from '@lsk4/rlog';
import { Inject, Injectable } from '@nestjs/common';

import { NOTIFY_MODULE_OPTIONS_TOKEN } from './tokens';
import { NotifyModuleOptions } from './types';

@Injectable()
export class NotifyService {
private client: Rlog;
constructor(@Inject(NOTIFY_MODULE_OPTIONS_TOKEN) private readonly options: NotifyModuleOptions) {
this.client = new Rlog(this.options);
}
send(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.send(data, options);
}
trace(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.trace(data, options);
}
debug(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.debug(data, options);
}
info(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.info(data, options);
}
warn(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.warn(data, options);
}
error(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.error(data, options);
}
fatal(data: RlogSendData, options: RlogSendOptions = {}) {
return this.client.fatal(data, options);
}
}
4 changes: 4 additions & 0 deletions libs/notify/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './types.js';
export * from './tokens.js';
export * from './Notify.module.js';
export * from './Notify.service.js';
Loading

0 comments on commit faa2054

Please sign in to comment.