diff --git a/lib/bootstrap/webhook.channel.ts b/lib/bootstrap/webhook.channel.ts index 0834311..ed0ec2b 100644 --- a/lib/bootstrap/webhook.channel.ts +++ b/lib/bootstrap/webhook.channel.ts @@ -1,11 +1,11 @@ import { Injectable, InternalServerErrorException } from '@nestjs/common'; import { HttpService } from '@nestjs/axios'; -import { INestjsNotifyChannel } from '@sinuos/nestjs-notification'; +import { INestjsNotificationChannel } from '@sinuos/nestjs-notification'; import { AxiosResponse } from 'axios'; import { IWebhookChannel } from './webhook.interface'; @Injectable() -export class WebhookChannel implements INestjsNotifyChannel { +export class WebhookChannel implements INestjsNotificationChannel { /** * @constructor * @param {HttpService} http diff --git a/lib/bootstrap/webhook.interface.ts b/lib/bootstrap/webhook.interface.ts index 44367d2..5c30b2c 100644 --- a/lib/bootstrap/webhook.interface.ts +++ b/lib/bootstrap/webhook.interface.ts @@ -1,15 +1,15 @@ -import { NestJsNotify } from '@sinuos/nestjs-notification'; +import { NestJsNotification } from '@sinuos/nestjs-notification'; /** * Webhook channel model * @interface IWebhookChannel - * @extends NestJsNotify + * @extends NestJsNotification */ -export interface IWebhookChannel extends NestJsNotify { +export interface IWebhookChannel extends NestJsNotification { /** * Get the Http representation of the notification. * @property * @returns {any} http payload data */ - toWebhook(): any; + toWebhook?(): any; } diff --git a/lib/webhook-channel.module.ts b/lib/webhook-channel.module.ts index 5df8e79..c0ab09c 100644 --- a/lib/webhook-channel.module.ts +++ b/lib/webhook-channel.module.ts @@ -1,12 +1,18 @@ import { Global, Module } from '@nestjs/common'; import { HttpModule } from '@nestjs/axios'; -import { NestjsNotifyModule } from '@sinuos/nestjs-notification'; +import { + NestjsNotificationModule, + NestjsNotificationModuleOptions, +} from '@sinuos/nestjs-notification'; import { WebhookChannelService } from './webhook-channel.service'; import { WebhookChannel } from './bootstrap'; @Global() @Module({ - imports: [NestjsNotifyModule.register({}), HttpModule], + imports: [ + NestjsNotificationModule.register({}), + HttpModule, + ], providers: [WebhookChannelService, WebhookChannel], exports: [WebhookChannelService, HttpModule], }) diff --git a/lib/webhook-channel.service.ts b/lib/webhook-channel.service.ts index 108f1a3..6e92c7c 100644 --- a/lib/webhook-channel.service.ts +++ b/lib/webhook-channel.service.ts @@ -1,19 +1,22 @@ import { Injectable } from '@nestjs/common'; -import { NestJsNotify, NestjsNotifyService } from '@sinuos/nestjs-notification'; +import { + NestJsNotification, + NestjsNotificationService, +} from '@sinuos/nestjs-notification'; @Injectable() export class WebhookChannelService { /** * @constructor - * @param notifications + * @param {NestjsNotificationService} notifications */ - constructor(private readonly notifications: NestjsNotifyService) {} + constructor(private readonly notifications: NestjsNotificationService) {} /** - * Notify notification. - * @param notification + * Notify. + * @param {NestJsNotification} notification */ - async notify(notification: NestJsNotify): Promise { + async notify(notification: NestJsNotification): Promise { return this.notifications.send(notification); } } diff --git a/package-lock.json b/package-lock.json index dd2c395..1a09f89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@nestjs-notification-channels/webhook", - "version": "0.0.0", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1459,9 +1459,9 @@ } }, "@sinuos/nestjs-notification": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@sinuos/nestjs-notification/-/nestjs-notification-1.0.1.tgz", - "integrity": "sha512-au0GBhyCwx4rgMxeaixt5D7Ui2pioPXhTwBT9h29gnvE2BME9Zk0MSkSUt6Q8OT2BIKCWh+1xRvy8moaz2a47A==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinuos/nestjs-notification/-/nestjs-notification-2.0.0.tgz", + "integrity": "sha512-My++g6R7NZf3TAqwYxyiK5hJeeI9uFFGIdvQ5j8tWh+NA8YJgyuFeCYLjjMVtYr9TZOQY7Dq3ZNSPjBtDYKrnQ==" }, "@tootallnate/once": { "version": "1.1.2", @@ -8495,9 +8495,9 @@ } }, "pretty-quick": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.2.tgz", - "integrity": "sha512-T+fpTJrDjTzewql4p3lKrRA7z3MrNyjBK1MKeaBm5PpKwATgVm885TpY7TgY8KFt5Q1Qn3QDseRQcyX9AKTKkA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-3.1.3.tgz", + "integrity": "sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA==", "dev": true, "requires": { "chalk": "^3.0.0", diff --git a/package.json b/package.json index fc98fd9..6b2a513 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@nestjs/axios": "0.0.3", - "@sinuos/nestjs-notification": "^1.0.1" + "@sinuos/nestjs-notification": "^2.0.0" }, "devDependencies": { "@commitlint/cli": "15.0.0", @@ -60,7 +60,7 @@ "jest": "^27.4.4", "lint-staged": "12.1.2", "prettier": "2.5.1", - "pretty-quick": "^3.1.2", + "pretty-quick": "^3.1.3", "reflect-metadata": "0.1.13", "rimraf": "3.0.2", "rxjs": "7.4.0",