denotify-client 1.1.0 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -4478
- package/package.json +5 -4
- package/types/functionbuilder.d.ts +1 -1
- package/types/notifications/notification.d.ts +7 -7
- package/types/notifications/notify_discord_webhook.d.ts +5 -5
- package/types/triggers/handler_function_call.d.ts +5 -5
- package/types/triggers/handler_function_call_v2.d.ts +6 -6
- package/types/triggers/handler_onchain_event.d.ts +5 -5
- package/types/triggers/trigger.d.ts +8 -8
- package/types/types/types.d.ts +4 -4
- package/types/util/filter.d.ts +9 -9
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.1.
|
2
|
+
"version": "1.1.3",
|
3
3
|
"name": "denotify-client",
|
4
4
|
"umd:name": "denotify-client",
|
5
5
|
"repository": "robo-labs/denotify-client",
|
@@ -52,13 +52,14 @@
|
|
52
52
|
"rollup-plugin-terser": "7.0.2",
|
53
53
|
"rollup-plugin-typescript2": "0.27.1",
|
54
54
|
"tsm": "2.2.1",
|
55
|
-
"
|
56
|
-
"
|
55
|
+
"uvu": "0.5.3",
|
56
|
+
"typescript": "^4.9.5"
|
57
57
|
},
|
58
58
|
"dependencies": {
|
59
59
|
"@supabase/supabase-js": "^2.10.0",
|
60
60
|
"@types/axios": "^0.14.0",
|
61
61
|
"axois": "^0.0.1-security",
|
62
|
-
"ethers": "^6.0.8"
|
62
|
+
"ethers": "^6.0.8",
|
63
|
+
"typescript": "^4.9.5"
|
63
64
|
}
|
64
65
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { DiscordWebhook, NotifyDiscordWebhookRawConfig, NotifyDiscordWebhookRawId, NotifyDiscordWebhookRawResponse, NotifyDiscordWebhookRawUpdate } from "./notify_discord_webhook.js";
|
2
|
-
export
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export
|
8
|
-
export
|
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;
|
8
|
+
export type NotificationRawConfig = {
|
9
9
|
name: string;
|
10
10
|
notify_type: NotifyRawId;
|
11
11
|
notify: NotifyRawConfig;
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { NotificationRawConfig } from "./notification.js";
|
2
|
-
export
|
2
|
+
export type DiscordWebhook = {
|
3
3
|
url: string;
|
4
4
|
username?: string;
|
5
5
|
avatar_url?: string;
|
6
6
|
message: string;
|
7
7
|
};
|
8
|
-
export
|
8
|
+
export type NotifyDiscordWebhookRawId = 'notify_discord_webhook';
|
9
9
|
export declare const NOTIFY_DISCORD_WEBHOOK_RAW_ID = "notify_discord_webhook";
|
10
|
-
export
|
10
|
+
export type NotifyDiscordWebhookRawConfig = {
|
11
11
|
url: string;
|
12
12
|
username?: string;
|
13
13
|
avatar_url?: string;
|
14
14
|
message: string;
|
15
15
|
};
|
16
|
-
export
|
16
|
+
export type NotifyDiscordWebhookRawResponse = {
|
17
17
|
id: number;
|
18
18
|
created_at: string;
|
19
19
|
url: string;
|
@@ -21,7 +21,7 @@ export declare type NotifyDiscordWebhookRawResponse = {
|
|
21
21
|
avatar_url: string;
|
22
22
|
message: string;
|
23
23
|
};
|
24
|
-
export
|
24
|
+
export type NotifyDiscordWebhookRawUpdate = {
|
25
25
|
url?: string;
|
26
26
|
username?: string;
|
27
27
|
avatar_url?: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Condition } from "../types/types.js";
|
2
2
|
import { Network, TriggerRawConfig } from "./trigger.js";
|
3
|
-
export
|
3
|
+
export type PollFunctionV1 = {
|
4
4
|
nBlocks: number;
|
5
5
|
address: string;
|
6
6
|
abi: any;
|
@@ -11,7 +11,7 @@ export declare type PollFunctionV1 = {
|
|
11
11
|
responseArgDecimals?: number;
|
12
12
|
constant?: number;
|
13
13
|
};
|
14
|
-
export
|
14
|
+
export type HandlerFunctionCallRawConfig = {
|
15
15
|
nBlocks: number;
|
16
16
|
address: string;
|
17
17
|
abi: any;
|
@@ -22,8 +22,8 @@ export declare type HandlerFunctionCallRawConfig = {
|
|
22
22
|
responseArgDecimals?: number;
|
23
23
|
constant?: number;
|
24
24
|
};
|
25
|
-
export
|
26
|
-
export
|
25
|
+
export type HandlerFunctionCallUpdate = Partial<HandlerFunctionCallRawConfig>;
|
26
|
+
export type HandlerFunctionCallRawResponse = {
|
27
27
|
id: number;
|
28
28
|
created_at: string;
|
29
29
|
nBlocks: number;
|
@@ -37,7 +37,7 @@ export declare type HandlerFunctionCallRawResponse = {
|
|
37
37
|
abi: string[];
|
38
38
|
version: number;
|
39
39
|
};
|
40
|
-
export
|
40
|
+
export type HandlerFunctionCallRawUpdate = {
|
41
41
|
address?: string;
|
42
42
|
function?: string;
|
43
43
|
abi?: any;
|
@@ -2,14 +2,14 @@ import { FunctionCallerConfig } from "../functionbuilder.js";
|
|
2
2
|
import { Condition } from "../types/types.js";
|
3
3
|
import { FilterConfig } from "../util/filter.js";
|
4
4
|
import { Network, TriggerRawConfig } from "./trigger.js";
|
5
|
-
|
5
|
+
type TimeBase = 'blocks' | 'time';
|
6
6
|
/**
|
7
7
|
* @typedef PollFunction
|
8
8
|
* @param {TimeBase} timeBase - Supports two poll period types. 'block' will test the trigger ever nBlocks blocks, 'time' will test the trigger as specified by timePeriod
|
9
9
|
* @param {number} nBlocks -
|
10
10
|
*
|
11
11
|
*/
|
12
|
-
export
|
12
|
+
export type PollFunctionV2 = {
|
13
13
|
timeBase: TimeBase;
|
14
14
|
nBlocks?: number;
|
15
15
|
timePeriod?: string | null;
|
@@ -21,7 +21,7 @@ export declare type PollFunctionV2 = {
|
|
21
21
|
filterVersion?: string;
|
22
22
|
filter?: FilterConfig;
|
23
23
|
};
|
24
|
-
export
|
24
|
+
export type HandlerFunctionCallV2RawConfig = {
|
25
25
|
timeBase: TimeBase;
|
26
26
|
nBlocks?: number;
|
27
27
|
timePeriod?: string | null;
|
@@ -33,8 +33,8 @@ export declare type HandlerFunctionCallV2RawConfig = {
|
|
33
33
|
filterVersion?: string;
|
34
34
|
filter?: FilterConfig;
|
35
35
|
};
|
36
|
-
export
|
37
|
-
export
|
36
|
+
export type HandlerFunctionCallV2Update = Partial<HandlerFunctionCallV2RawConfig>;
|
37
|
+
export type HandlerFunctionCallV2RawResponse = {
|
38
38
|
id: number;
|
39
39
|
created_at: string;
|
40
40
|
nBlocks: number;
|
@@ -48,7 +48,7 @@ export declare type HandlerFunctionCallV2RawResponse = {
|
|
48
48
|
abi: string[];
|
49
49
|
version: number;
|
50
50
|
};
|
51
|
-
export
|
51
|
+
export type HandlerFunctionCallV2RawUpdate = {
|
52
52
|
address?: string;
|
53
53
|
function?: string;
|
54
54
|
abi?: any;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Condition } from "../util/filter.js";
|
2
2
|
import { Network, TriggerRawConfig } from "./trigger.js";
|
3
|
-
export
|
3
|
+
export type OnchainEventV1 = {
|
4
4
|
address: string;
|
5
5
|
event: string;
|
6
6
|
abi: any;
|
@@ -9,7 +9,7 @@ export declare type OnchainEventV1 = {
|
|
9
9
|
paramsDecimals?: number;
|
10
10
|
constant?: number;
|
11
11
|
};
|
12
|
-
export
|
12
|
+
export type HandlerOnchainEventRawConfig = {
|
13
13
|
address: string;
|
14
14
|
event: string;
|
15
15
|
abi: any;
|
@@ -18,8 +18,8 @@ export declare type HandlerOnchainEventRawConfig = {
|
|
18
18
|
paramsDecimals?: number;
|
19
19
|
constant?: number;
|
20
20
|
};
|
21
|
-
export
|
22
|
-
export
|
21
|
+
export type HandlerOnchainEventUpdate = Partial<HandlerOnchainEventRawConfig>;
|
22
|
+
export type HandlerOnchainEventRawResponse = {
|
23
23
|
id: number;
|
24
24
|
created_at: string;
|
25
25
|
address: string;
|
@@ -30,7 +30,7 @@ export declare type HandlerOnchainEventRawResponse = {
|
|
30
30
|
condition: Condition;
|
31
31
|
constant: number;
|
32
32
|
};
|
33
|
-
export
|
33
|
+
export type HandlerOnchainEventRawUpdate = {
|
34
34
|
address?: string;
|
35
35
|
event?: string;
|
36
36
|
abi?: any;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { HandlerFunctionCallRawConfig, HandlerFunctionCallUpdate, PollFunctionV1 } from "./handler_function_call.js";
|
2
2
|
import { HandlerOnchainEventRawConfig, HandlerOnchainEventUpdate, OnchainEventV1 } from "./handler_onchain_event.js";
|
3
3
|
import { HandlerFunctionCallV2RawConfig, HandlerFunctionCallV2Update, PollFunctionV2 } from "./handler_function_call_v2.js";
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export
|
8
|
-
export
|
9
|
-
export
|
10
|
-
export
|
11
|
-
export
|
4
|
+
export type Network = 'avalanche' | 'ethereum';
|
5
|
+
export type TriggerConfig = PollFunctionV2 | PollFunctionV1 | OnchainEventV1;
|
6
|
+
export type TriggerTypeId = 'PollFunctionV2' | 'OnchainEventV2' | 'PollFunctionV1';
|
7
|
+
export type TriggerUpdate = HandlerFunctionCallV2Update | HandlerFunctionCallUpdate | HandlerOnchainEventUpdate;
|
8
|
+
export type TriggerTypeRawId = 'handler_function_call' | 'handler_onchain_event' | 'handler_function_call_v2';
|
9
|
+
export type TriggerOn = 'event' | 'latch';
|
10
|
+
export type HandlerRawConfig = HandlerFunctionCallRawConfig | HandlerOnchainEventRawConfig | HandlerFunctionCallV2RawConfig;
|
11
|
+
export type TriggerRawConfig = {
|
12
12
|
nickname: string;
|
13
13
|
type: TriggerTypeRawId;
|
14
14
|
alertType: TriggerOn;
|
package/types/types/types.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { NotificationConfig, NotificationTypeId } from "../notifications/notification.js";
|
2
2
|
import { Network, TriggerConfig, TriggerTypeId } from "../triggers/trigger.js";
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
3
|
+
export type Condition = '>' | '>=' | '<' | '<=' | '=' | 'true';
|
4
|
+
export type TriggerOn = 'event' | 'latch';
|
5
|
+
export type DeNotifyOptions = {
|
6
6
|
email?: string;
|
7
7
|
password?: string;
|
8
8
|
projectId?: string;
|
@@ -10,7 +10,7 @@ export declare type DeNotifyOptions = {
|
|
10
10
|
url?: string;
|
11
11
|
anonKey?: string;
|
12
12
|
};
|
13
|
-
export
|
13
|
+
export type AlertConfig = {
|
14
14
|
name: string;
|
15
15
|
network: Network;
|
16
16
|
triggerId: TriggerTypeId;
|
package/types/util/filter.d.ts
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
export
|
1
|
+
type Logic = 'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE';
|
2
|
+
type NumericOperation = 'eq' | '!eq' | 'gt' | 'gte' | 'lt' | 'lte';
|
3
|
+
type StringOperation = 'contains' | '!contains' | 'is' | '!is' | 'isEmpty' | '!isEmpty';
|
4
|
+
type AddressOperation = 'is' | '!is' | 'isEmpty' | '!isEmpty';
|
5
|
+
type FilterDataTypes = 'String' | 'Address' | 'Number';
|
6
|
+
type FilterOpertationType = NumericOperation | StringOperation | AddressOperation;
|
7
|
+
export type Condition = {
|
8
8
|
logic?: Logic;
|
9
9
|
key: string;
|
10
10
|
type: FilterDataTypes;
|
11
11
|
operation: FilterOpertationType;
|
12
12
|
constant: string | number;
|
13
13
|
};
|
14
|
-
export
|
14
|
+
export type ConditionGroup = {
|
15
15
|
logic: Logic;
|
16
16
|
conditions: Condition[];
|
17
17
|
};
|
18
|
-
export
|
18
|
+
export type FilterConfig = ConditionGroup[];
|
19
19
|
export declare class Filter {
|
20
20
|
static version(): string;
|
21
21
|
static execute(record: any, groupsIn: FilterConfig, version?: string): boolean;
|