1.0.0 • Published 4 years ago

@edirect/alert v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

@edirect/auth

The EDirectInsure Alert module.

Installation

$ npm i --save @edirect/**alert**

Usage

Import and register AlertModule in AppModule (app.module.ts):

imports: [

  AlertModule.registerAsync({
    imports: [ConfigModule],
    useFactory: async (configService: ConfigService) => ({
      alertServiceUrl: configService.get<string>(Variables.ALERT_URL),
      service: 'Susbcription Service',
      cluster: configService.get<string>(Variables.NAMESPACE),
      defaults: {
        timeout: 300000,
        channels: ['SLACK'],
        channelConfigs: {
          slack_channel: configService.get<string>(Variables.SLACK_CHANNEL)
        }
      },
    }),
    inject: [ConfigService],
  }),

  ...
]

Use the public methods in the code, where applicable:

async sendTransient(level: AlertLevel, message: string, payload?: string, config?: CreateTransientConfig): Promise<string>

async sendPersistent(level: AlertLevel, message: string, payload?: string, config?: CreatePersistentConfig): Promise<string>

async openCycle(level: AlertLevel, message: string, payload?: string, config?: CreateCycleConfig): Promise<string>

async resolvePersistent(sid: string): Promise<string>

async updateCycle(sidOrCorrelationId: string, milestone: CycleMilestone): Promise<string>

async resolveCycle(sidOrCorrelationId: string, milestone?: CycleMilestone): Promise<string>