denotify-client 1.1.32 → 1.1.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,14 +37,27 @@ export type Telegram = {
37
37
  content: string;
38
38
  };
39
39
  export type NotifyTelegramRawId = "notify_telegram";
40
- export type NotificationTypeId = "Discord" | "Telegram" | "Email";
41
- export type NotificationConfig = DiscordWebhook | Telegram | Email;
40
+ export type Webhook = {
41
+ url: string;
42
+ params?: {
43
+ [key: string]: string;
44
+ } | null;
45
+ pathname?: string | null;
46
+ access_token?: string | null;
47
+ headers?: {
48
+ [key: string]: string;
49
+ } | null;
50
+ method?: "get" | "post" | "put" | "delete" | "patch";
51
+ };
52
+ export type NotifyWebhookRawId = "notify_webhook";
53
+ export type NotificationTypeId = "Discord" | "Telegram" | "Email" | "Webhook";
54
+ export type NotificationConfig = DiscordWebhook | Telegram | Email | Webhook;
42
55
  export type Notification = NotificationConfig & {
43
56
  error?: boolean;
44
57
  error_message?: string | null;
45
58
  error_timestamp?: number | null;
46
59
  };
47
- export type NotifyRawId = NotifyDiscordWebhookRawId | NotifyTelegramRawId | NotifyEmailRawId;
60
+ export type NotifyRawId = NotifyDiscordWebhookRawId | NotifyTelegramRawId | NotifyEmailRawId | NotifyWebhookRawId;
48
61
  export type PollFunctionV1 = {
49
62
  nBlocks: number;
50
63
  address: string;
@@ -225,6 +238,13 @@ export declare class DeNotifyClient {
225
238
  getAlert(id: number): Promise<Alert>;
226
239
  getAlerts(): Promise<Alert[]>;
227
240
  createAlert(config: Alert): Promise<number>;
241
+ notificationTest(config: {
242
+ trigger: any;
243
+ triggered: boolean;
244
+ block: number;
245
+ data: any;
246
+ id: number;
247
+ }): Promise<number>;
228
248
  private updateRawTrigger;
229
249
  updateAlert(id: number, update: AlertUpdate): Promise<Alert>;
230
250
  deleteAlert(id: number): Promise<any>;
@@ -261,7 +281,7 @@ export declare class AlertBuilder {
261
281
  * @returns self for piping
262
282
  */
263
283
  withTrigger<TTriggerTypeId extends TriggerTypeId>(id: TTriggerTypeId, options: TTriggerTypeId extends "PollFunctionV2" ? Partial<PollFunctionV2> : TTriggerTypeId extends "OnchainEventV2" ? Partial<OnchainEventV2> : TTriggerTypeId extends "PollFunctionV1" ? Partial<PollFunctionV1> : TTriggerTypeId extends "OnchainEventV1" ? OnchainEventV1 : never): AlertBuilder;
264
- withNotification<TNotificationTypeId extends NotificationTypeId>(id: TNotificationTypeId, options: TNotificationTypeId extends "Discord" ? DiscordWebhook : TNotificationTypeId extends "Telegram" ? Telegram : TNotificationTypeId extends "Email" ? Email : never): AlertBuilder;
284
+ withNotification<TNotificationTypeId extends NotificationTypeId>(id: TNotificationTypeId, options: TNotificationTypeId extends "Discord" ? DiscordWebhook : TNotificationTypeId extends "Telegram" ? Telegram : TNotificationTypeId extends "Email" ? Email : TNotificationTypeId extends "Webhook" ? Webhook : never): AlertBuilder;
265
285
  config(): Promise<Alert>;
266
286
  }
267
287