denotify-client 1.1.13 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -7790,7 +7790,7 @@ class ds {
7790
7790
  };
7791
7791
  }
7792
7792
  static validateCreate(e) {
7793
- const t = /^(https?|ftp):\/\/(-\.)?([^\s/?\.#]+\.?)+([^\s\.?#]+)?(\?\S*)?$/;
7793
+ const t = /^(https?|ftp):\/\/(-\.)?([^\s/?.#]+\.?)+([^\s.?#]+)?(\?\S*)?$/;
7794
7794
  return et({
7795
7795
  url: j().matches(t, "url is not a valid url").required(),
7796
7796
  username: j(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "denotify-client",
3
3
  "private": false,
4
- "version": "1.1.13",
4
+ "version": "1.1.15",
5
5
  "main": "./dist/denotify-client.cjs",
6
6
  "module": "./dist/denotify-client.mjs",
7
7
  "types": "./dist/denotify-client.d.ts",
package/tsconfig.json CHANGED
@@ -1,22 +1,34 @@
1
- {
2
- "compilerOptions": {
3
- "rootDir": "./src",
4
- "target": "ESNext",
5
- "useDefineForClassFields": true,
6
- "module": "ESNext",
7
- "lib": ["ESNext", "DOM"],
8
- "moduleResolution": "nodenext",
9
- "strict": true,
10
- "sourceMap": true,
11
- "resolveJsonModule": true,
12
- "esModuleInterop": true,
13
- "noEmit": true,
14
- "noUnusedLocals": true,
15
- "noUnusedParameters": true,
16
- "noImplicitReturns": true,
17
- "forceConsistentCasingInFileNames": true,
18
- "types": ["vite/client", "node", "jest"]
19
- },
20
- "include": ["src"],
21
- "exclude": ["**/*.test.ts", "node_modules", "test/**", ".history/**"]
1
+ {
2
+ "ts-node": {
3
+ "esm": true,
4
+ "transpileOnly": true,
5
+ "compilerOptions": {
6
+ "module": "ES6",
7
+ "sourceMap": true,
8
+ "esModuleInterop": true,
9
+ },
10
+ "include": [
11
+ "test/**/*"
12
+ ]
13
+ },
14
+ "compilerOptions": {
15
+ "rootDir": "./src",
16
+ "target": "ESNext",
17
+ "useDefineForClassFields": true,
18
+ "module": "ESNext",
19
+ "lib": ["ESNext", "DOM"],
20
+ "moduleResolution": "nodenext",
21
+ "strict": true,
22
+ "sourceMap": true,
23
+ "resolveJsonModule": true,
24
+ "esModuleInterop": true,
25
+ "noEmit": true,
26
+ "noUnusedLocals": true,
27
+ "noUnusedParameters": true,
28
+ "noImplicitReturns": true,
29
+ "forceConsistentCasingInFileNames": true,
30
+ "types": ["vite/client", "node", "jest"]
31
+ },
32
+ "include": ["src"],
33
+ "exclude": ["**/*.test.ts", "node_modules", "test/**", ".history/**"]
22
34
  }
@@ -1,71 +1,101 @@
1
- import { NotificationConfig, NotificationTypeId } from "./notifications/notification.js";
2
- import { Network, TriggerTypeId } from "./triggers/trigger.js";
3
- import { AlertConfig } from "./types/types.js";
1
+ import {
2
+ NotificationConfig,
3
+ NotificationTypeId
4
+ } from './notifications/notification.js'
5
+ import { Network, TriggerTypeId } from './triggers/trigger.js'
6
+ import { AlertConfig } from './types/types.js'
4
7
  export declare class AlertBuilder {
5
- private name;
6
- private network?;
7
- private triggerId?;
8
- private trigger?;
9
- private notificationId?;
10
- private notification?;
11
- private constructor();
12
- static create(name: string): AlertBuilder;
13
- onNetwork(network: Network): AlertBuilder;
14
- /**
15
- * Call withTrigger with one of the TriggerConfig types:
16
- * PollFunctionV2 | PollFunctionV1 | OnchainEventV1
17
- * @param id Simple ID
18
- * @param options Desired trigger configuration
19
- * @returns self for piping
20
- */
21
- withTrigger<T>(id: TriggerTypeId, options: T): AlertBuilder;
22
- withNotification<T = NotificationConfig>(id: NotificationTypeId, options: T): AlertBuilder;
23
- validate(): Promise<{
24
- condition?: string | undefined;
25
- constant?: number | undefined;
26
- paramsIndex?: number | undefined;
27
- paramsDecimals?: number | undefined;
28
- address: string;
29
- event: string;
30
- abi: any[];
31
- } | {
32
- condition?: string | undefined;
33
- constant?: number | undefined;
34
- nBlocks?: number | undefined;
35
- responseArgIndex?: number | undefined;
36
- responseArgDecimals?: number | undefined;
37
- address: string;
38
- abi: any[];
39
- } | {
40
- nBlocks?: number | undefined;
41
- timePeriod?: string | undefined;
42
- debounceCount?: number | undefined;
43
- functions?: {
44
- function: string;
45
- address: string;
46
- bytecode: string;
47
- abiHash: string;
48
- }[] | undefined;
49
- filter?: {
50
- conditions?: {
51
- constant?: {} | undefined;
52
- operation?: string | undefined;
53
- logic: NonNullable<"AND" | "OR" | "XOR" | "NAND" | "NOR" | "WHERE" | undefined>;
54
- key: string;
55
- type: NonNullable<"String" | "Address" | "Number" | undefined>;
56
- }[] | undefined;
57
- logic: NonNullable<"AND" | "OR" | "XOR" | "NAND" | "NOR" | "WHERE" | undefined>;
58
- }[] | undefined;
59
- filterVersion?: string | undefined;
60
- timeBase: NonNullable<"blocks" | "time" | undefined>;
61
- startTime: number;
62
- triggerOn: "always" | "filter";
63
- latch: boolean;
64
- } | {
65
- username?: string | undefined;
66
- avatar_url?: string | undefined;
67
- message: string;
68
- url: string;
69
- } | undefined>;
70
- config(): Promise<AlertConfig>;
8
+ private name
9
+ private network?
10
+ private triggerId?
11
+ private trigger?
12
+ private notificationId?
13
+ private notification?
14
+ private constructor()
15
+ static create(name: string): AlertBuilder
16
+ onNetwork(network: Network): AlertBuilder
17
+ /**
18
+ * Call withTrigger with one of the TriggerConfig types:
19
+ * PollFunctionV2 | PollFunctionV1 | OnchainEventV1
20
+ * @param id Simple ID
21
+ * @param options Desired trigger configuration
22
+ * @returns self for piping
23
+ */
24
+ withTrigger<T>(id: TriggerTypeId, options: T): AlertBuilder
25
+ withNotification<T = NotificationConfig>(
26
+ id: NotificationTypeId,
27
+ options: T
28
+ ): AlertBuilder
29
+ validate(): Promise<
30
+ | {
31
+ condition?: string | undefined
32
+ constant?: number | undefined
33
+ paramsIndex?: number | undefined
34
+ paramsDecimals?: number | undefined
35
+ address: string
36
+ event: string
37
+ abi: any[]
38
+ }
39
+ | {
40
+ condition?: string | undefined
41
+ constant?: number | undefined
42
+ nBlocks?: number | undefined
43
+ responseArgIndex?: number | undefined
44
+ responseArgDecimals?: number | undefined
45
+ address: string
46
+ abi: any[]
47
+ }
48
+ | {
49
+ nBlocks?: number | undefined
50
+ timePeriod?: string | undefined
51
+ debounceCount?: number | undefined
52
+ functions?:
53
+ | {
54
+ function: string
55
+ address: string
56
+ bytecode: string
57
+ abiHash: string
58
+ }[]
59
+ | undefined
60
+ filter?:
61
+ | {
62
+ conditions?:
63
+ | {
64
+ constant?: {} | undefined
65
+ operation?: string | undefined
66
+ logic: NonNullable<
67
+ | 'AND'
68
+ | 'OR'
69
+ | 'XOR'
70
+ | 'NAND'
71
+ | 'NOR'
72
+ | 'WHERE'
73
+ | undefined
74
+ >
75
+ key: string
76
+ type: NonNullable<
77
+ 'String' | 'Address' | 'Number' | undefined
78
+ >
79
+ }[]
80
+ | undefined
81
+ logic: NonNullable<
82
+ 'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE' | undefined
83
+ >
84
+ }[]
85
+ | undefined
86
+ filterVersion?: string | undefined
87
+ timeBase: NonNullable<'blocks' | 'time' | undefined>
88
+ startTime: number
89
+ triggerOn: 'always' | 'filter'
90
+ latch: boolean
91
+ }
92
+ | {
93
+ username?: string | undefined
94
+ avatar_url?: string | undefined
95
+ message: string
96
+ url: string
97
+ }
98
+ | undefined
99
+ >
100
+ config(): Promise<AlertConfig>
71
101
  }
package/types/client.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { DeNotifyOptions } from "./types/types";
1
+ import { DeNotifyOptions } from './types/types'
2
2
  export declare class DeNotifyClient {
3
- private url;
4
- private token;
5
- private headers;
6
- private constructor();
7
- static create(options: DeNotifyOptions): Promise<DeNotifyClient>;
8
- getAlert(id: number): Promise<any>;
9
- getAlerts(): Promise<any>;
10
- createAlert(): Promise<void>;
11
- deleteAlert(id: number): Promise<any>;
12
- private request;
13
- getAbiHash(abi: any): Promise<any>;
3
+ private url
4
+ private token
5
+ private headers
6
+ private constructor()
7
+ static create(options: DeNotifyOptions): Promise<DeNotifyClient>
8
+ getAlert(id: number): Promise<any>
9
+ getAlerts(): Promise<any>
10
+ createAlert(): Promise<void>
11
+ deleteAlert(id: number): Promise<any>
12
+ private request
13
+ getAbiHash(abi: any): Promise<any>
14
14
  }
@@ -1,52 +1,65 @@
1
- import { NotificationRawResponse, NotifyRawId } from "./notifications/notification.js";
2
- import { AlertConfig, DeNotifyOptions } from "./types/types.js";
3
- import { TriggerRawResponse, TriggerTypeRawId, TriggerUpdate } from "./triggers/trigger.js";
1
+ import {
2
+ NotificationRawResponse,
3
+ NotifyRawId
4
+ } from './notifications/notification.js'
5
+ import { AlertConfig, DeNotifyOptions } from './types/types.js'
6
+ import {
7
+ TriggerRawResponse,
8
+ TriggerTypeRawId,
9
+ TriggerUpdate
10
+ } from './triggers/trigger.js'
4
11
  type Pagination = {
5
- page?: number;
6
- size?: number;
7
- };
12
+ page?: number
13
+ size?: number
14
+ }
8
15
  type HistoryParams = {
9
- id?: number;
10
- page?: number;
11
- size?: number;
12
- };
16
+ id?: number
17
+ page?: number
18
+ size?: number
19
+ }
13
20
  type AlertHistory = {
14
- type: 'trigger' | 'notification';
15
- set: boolean;
16
- alert_id: number;
17
- block: number;
18
- metadata: any;
19
- subtype: TriggerTypeRawId | NotifyRawId;
20
- };
21
+ type: 'trigger' | 'notification'
22
+ set: boolean
23
+ alert_id: number
24
+ block: number
25
+ metadata: any
26
+ subtype: TriggerTypeRawId | NotifyRawId
27
+ }
21
28
  type AlertRawResponse = {
22
- alertId: number;
23
- trigger: TriggerRawResponse;
24
- notification: NotificationRawResponse;
25
- };
29
+ alertId: number
30
+ trigger: TriggerRawResponse
31
+ notification: NotificationRawResponse
32
+ }
26
33
  export declare class DeNotifyClient {
27
- private url;
28
- private token;
29
- private headers;
30
- private constructor();
31
- static create(options: DeNotifyOptions): Promise<DeNotifyClient>;
32
- alertHistory(id?: number | null, pagination?: Pagination): Promise<{
33
- params: HistoryParams;
34
- history: AlertHistory[];
35
- }>;
36
- getAlert(id: number): Promise<AlertRawResponse>;
37
- getAlerts(): Promise<AlertRawResponse[]>;
38
- createAlert(config: AlertConfig): Promise<any>;
39
- deleteAlert(id: number): Promise<any>;
40
- private request;
41
- getAbi(network: string, address: string): Promise<{
42
- abi: any[];
43
- proxy?: string;
44
- }>;
45
- getAbiHash(abi: any): Promise<any>;
46
- setAlertName(triggerId: number, name: string): Promise<void>;
47
- enableAlert(triggerId: number): Promise<void>;
48
- disableAlert(triggerId: number): Promise<void>;
49
- updateNotification(triggerId: number): Promise<void>;
50
- updateTrigger(triggerId: number, update: TriggerUpdate): Promise<any>;
34
+ private url
35
+ private token
36
+ private headers
37
+ private constructor()
38
+ static create(options: DeNotifyOptions): Promise<DeNotifyClient>
39
+ alertHistory(
40
+ id?: number | null,
41
+ pagination?: Pagination
42
+ ): Promise<{
43
+ params: HistoryParams
44
+ history: AlertHistory[]
45
+ }>
46
+ getAlert(id: number): Promise<AlertRawResponse>
47
+ getAlerts(): Promise<AlertRawResponse[]>
48
+ createAlert(config: AlertConfig): Promise<any>
49
+ deleteAlert(id: number): Promise<any>
50
+ private request
51
+ getAbi(
52
+ network: string,
53
+ address: string
54
+ ): Promise<{
55
+ abi: any[]
56
+ proxy?: string
57
+ }>
58
+ getAbiHash(abi: any): Promise<any>
59
+ setAlertName(triggerId: number, name: string): Promise<void>
60
+ enableAlert(triggerId: number): Promise<void>
61
+ disableAlert(triggerId: number): Promise<void>
62
+ updateNotification(triggerId: number): Promise<void>
63
+ updateTrigger(triggerId: number, update: TriggerUpdate): Promise<any>
51
64
  }
52
- export {};
65
+ export {}
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -1,23 +1,34 @@
1
- import { DeNotifyClient } from "./denotifyclient.js";
2
- import * as yup from 'yup';
1
+ import { DeNotifyClient } from './denotifyclient.js'
2
+ import * as yup from 'yup'
3
3
  export type FunctionCallerConfig = {
4
- address: string;
5
- bytecode: string;
6
- abiHash: string;
7
- function: string;
8
- }[];
4
+ address: string
5
+ bytecode: string
6
+ abiHash: string
7
+ function: string
8
+ }[]
9
9
  export declare class FunctionBuilder {
10
- private api?;
11
- private data;
12
- private constructor();
13
- static create(api?: DeNotifyClient): FunctionBuilder;
14
- getAbiHash(abi: any): Promise<string>;
15
- addFunction<T = any>(address: string, func: string, args: T[], abi: any): Promise<this>;
16
- get(): FunctionCallerConfig;
17
- static schema(): yup.ArraySchema<{
18
- function: string;
19
- address: string;
20
- bytecode: string;
21
- abiHash: string;
22
- }[] | undefined, yup.AnyObject, "", "">;
10
+ private api?
11
+ private data
12
+ private constructor()
13
+ static create(api?: DeNotifyClient): FunctionBuilder
14
+ getAbiHash(abi: any): Promise<string>
15
+ addFunction<T = any>(
16
+ address: string,
17
+ func: string,
18
+ args: T[],
19
+ abi: any
20
+ ): Promise<this>
21
+ get(): FunctionCallerConfig
22
+ static schema(): yup.ArraySchema<
23
+ | {
24
+ function: string
25
+ address: string
26
+ bytecode: string
27
+ abiHash: string
28
+ }[]
29
+ | undefined,
30
+ yup.AnyObject,
31
+ '',
32
+ ''
33
+ >
23
34
  }
package/types/index.d.ts CHANGED
@@ -1,7 +1,14 @@
1
- import { DeNotifyClient } from "./denotifyclient.js";
2
- import { AlertBuilder } from "./alertbuilder.js";
3
- import { FunctionBuilder } from "./functionbuilder.js";
4
- import { FilterBuilder } from "./util/filter.js";
5
- import * as Trigger from "./triggers/index.js";
6
- import * as Notification from "./notifications/index.js";
7
- export { DeNotifyClient, AlertBuilder, FilterBuilder, FunctionBuilder, Trigger, Notification, };
1
+ import { DeNotifyClient } from './denotifyclient.js'
2
+ import { AlertBuilder } from './alertbuilder.js'
3
+ import { FunctionBuilder } from './functionbuilder.js'
4
+ import { FilterBuilder } from './util/filter.js'
5
+ import * as Trigger from './triggers/index.js'
6
+ import * as Notification from './notifications/index.js'
7
+ export {
8
+ DeNotifyClient,
9
+ AlertBuilder,
10
+ FilterBuilder,
11
+ FunctionBuilder,
12
+ Trigger,
13
+ Notification
14
+ }
@@ -1,3 +1,36 @@
1
- import { NotificationTypeId, NotificationConfig, NotifyRawId, NotifyRawConfig, NotifyRawResponse, NotifyRawUpdate, NotificationRawConfig, Notification } from "./notification.js";
2
- import { DiscordWebhook, NotifyDiscordWebhookRawId, NOTIFY_DISCORD_WEBHOOK_RAW_ID, NotifyDiscordWebhookRawConfig, NotifyDiscordWebhookRawResponse, NotifyDiscordWebhookRawUpdate, NotifyDiscordWebhook } from "./notify_discord_webhook.js";
3
- export { DiscordWebhook, NotifyDiscordWebhookRawId, NOTIFY_DISCORD_WEBHOOK_RAW_ID, NotifyDiscordWebhookRawConfig, NotifyDiscordWebhookRawResponse, NotifyDiscordWebhookRawUpdate, NotifyDiscordWebhook, NotificationTypeId, NotificationConfig, NotifyRawId, NotifyRawConfig, NotifyRawResponse, NotifyRawUpdate, NotificationRawConfig, Notification, };
1
+ import {
2
+ NotificationTypeId,
3
+ NotificationConfig,
4
+ NotifyRawId,
5
+ NotifyRawConfig,
6
+ NotifyRawResponse,
7
+ NotifyRawUpdate,
8
+ NotificationRawConfig,
9
+ Notification
10
+ } from './notification.js'
11
+ import {
12
+ DiscordWebhook,
13
+ NotifyDiscordWebhookRawId,
14
+ NOTIFY_DISCORD_WEBHOOK_RAW_ID,
15
+ NotifyDiscordWebhookRawConfig,
16
+ NotifyDiscordWebhookRawResponse,
17
+ NotifyDiscordWebhookRawUpdate,
18
+ NotifyDiscordWebhook
19
+ } from './notify_discord_webhook.js'
20
+ export {
21
+ DiscordWebhook,
22
+ NotifyDiscordWebhookRawId,
23
+ NOTIFY_DISCORD_WEBHOOK_RAW_ID,
24
+ NotifyDiscordWebhookRawConfig,
25
+ NotifyDiscordWebhookRawResponse,
26
+ NotifyDiscordWebhookRawUpdate,
27
+ NotifyDiscordWebhook,
28
+ NotificationTypeId,
29
+ NotificationConfig,
30
+ NotifyRawId,
31
+ NotifyRawConfig,
32
+ NotifyRawResponse,
33
+ NotifyRawUpdate,
34
+ NotificationRawConfig,
35
+ Notification
36
+ }
@@ -1,22 +1,31 @@
1
- import { DiscordWebhook, NotifyDiscordWebhookRawConfig, NotifyDiscordWebhookRawId, NotifyDiscordWebhookRawResponse, NotifyDiscordWebhookRawUpdate } from "./notify_discord_webhook.js";
2
- export type NotificationTypeId = 'Discord';
3
- export type NotificationConfig = DiscordWebhook;
4
- export type NotifyRawId = NotifyDiscordWebhookRawId;
5
- export type NotifyRawConfig = NotifyDiscordWebhookRawConfig;
6
- export type NotifyRawResponse = NotifyDiscordWebhookRawResponse;
7
- export type NotifyRawUpdate = NotifyDiscordWebhookRawUpdate;
1
+ import {
2
+ DiscordWebhook,
3
+ NotifyDiscordWebhookRawConfig,
4
+ NotifyDiscordWebhookRawId,
5
+ NotifyDiscordWebhookRawResponse,
6
+ NotifyDiscordWebhookRawUpdate
7
+ } from './notify_discord_webhook.js'
8
+ export type NotificationTypeId = 'Discord'
9
+ export type NotificationConfig = DiscordWebhook
10
+ export type NotifyRawId = NotifyDiscordWebhookRawId
11
+ export type NotifyRawConfig = NotifyDiscordWebhookRawConfig
12
+ export type NotifyRawResponse = NotifyDiscordWebhookRawResponse
13
+ export type NotifyRawUpdate = NotifyDiscordWebhookRawUpdate
8
14
  export type NotificationRawConfig = {
9
- name: string;
10
- notify_type: NotifyRawId;
11
- notify: NotifyRawConfig;
12
- };
15
+ name: string
16
+ notify_type: NotifyRawId
17
+ notify: NotifyRawConfig
18
+ }
13
19
  export type NotificationRawResponse = {
14
- notify_type: NotifyRawId;
15
- notify: NotifyRawResponse;
16
- error: boolean;
17
- error_message: string | null;
18
- error_timestamp: number | null;
19
- };
20
+ notify_type: NotifyRawId
21
+ notify: NotifyRawResponse
22
+ error: boolean
23
+ error_message: string | null
24
+ error_timestamp: number | null
25
+ }
20
26
  export declare class Notification {
21
- static SimpleToRaw(id: NotificationTypeId, config: NotificationConfig): NotificationRawConfig;
27
+ static SimpleToRaw(
28
+ id: NotificationTypeId,
29
+ config: NotificationConfig
30
+ ): NotificationRawConfig
22
31
  }
@@ -1,38 +1,38 @@
1
- import { NotificationRawConfig } from "./notification.js";
1
+ import { NotificationRawConfig } from './notification.js'
2
2
  export type DiscordWebhook = {
3
- url: string;
4
- username?: string;
5
- avatar_url?: string;
6
- message: string;
7
- };
8
- export type NotifyDiscordWebhookRawId = 'notify_discord_webhook';
9
- export declare const NOTIFY_DISCORD_WEBHOOK_RAW_ID = "notify_discord_webhook";
3
+ url: string
4
+ username?: string
5
+ avatar_url?: string
6
+ message: string
7
+ }
8
+ export type NotifyDiscordWebhookRawId = 'notify_discord_webhook'
9
+ export declare const NOTIFY_DISCORD_WEBHOOK_RAW_ID = 'notify_discord_webhook'
10
10
  export type NotifyDiscordWebhookRawConfig = {
11
- url: string;
12
- username?: string;
13
- avatar_url?: string;
14
- message: string;
15
- };
11
+ url: string
12
+ username?: string
13
+ avatar_url?: string
14
+ message: string
15
+ }
16
16
  export type NotifyDiscordWebhookRawResponse = {
17
- id: number;
18
- created_at: string;
19
- url: string;
20
- username: string;
21
- avatar_url: string;
22
- message: string;
23
- };
17
+ id: number
18
+ created_at: string
19
+ url: string
20
+ username: string
21
+ avatar_url: string
22
+ message: string
23
+ }
24
24
  export type NotifyDiscordWebhookRawUpdate = {
25
- url?: string;
26
- username?: string;
27
- avatar_url?: string;
28
- message?: string;
29
- };
25
+ url?: string
26
+ username?: string
27
+ avatar_url?: string
28
+ message?: string
29
+ }
30
30
  export declare class NotifyDiscordWebhook {
31
- static SimpleToRaw(config: DiscordWebhook): NotificationRawConfig;
32
- static validateCreate(options: any): Promise<{
33
- username?: string | undefined;
34
- avatar_url?: string | undefined;
35
- message: string;
36
- url: string;
37
- }>;
31
+ static SimpleToRaw(config: DiscordWebhook): NotificationRawConfig
32
+ static validateCreate(options: any): Promise<{
33
+ username?: string | undefined
34
+ avatar_url?: string | undefined
35
+ message: string
36
+ url: string
37
+ }>
38
38
  }
package/types/temp.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {}