denotify-client 1.1.15 → 1.1.17
Sign up to get free protection for your applications and to get access to all the features.
- package/.env +1 -1
- package/.eslintrc +35 -16
- package/.lintstagedrc +2 -2
- package/.prettierrc +14 -14
- package/.stylelintrc +16 -16
- package/.vscode/settings.json +3 -1
- package/README.md +1 -1
- package/dist/denotify-client.cjs +4 -4
- package/dist/denotify-client.d.ts +101 -68
- package/dist/denotify-client.iife.js +4 -4
- package/dist/denotify-client.mjs +2119 -2050
- package/dts-bundle-generator.config.ts +12 -12
- package/index.html +10 -10
- package/package.json +57 -52
- package/tsconfig.json +3 -5
- package/types/alertbuilder.d.ts +95 -95
- package/types/client.d.ts +11 -11
- package/types/denotifyclient.d.ts +49 -49
- package/types/functionbuilder.d.ts +28 -28
- package/types/index.d.ts +6 -6
- package/types/notifications/index.d.ts +30 -30
- package/types/notifications/notification.d.ts +17 -17
- package/types/notifications/notify_discord_webhook.d.ts +25 -25
- package/types/triggers/handler_function_call.d.ts +53 -53
- package/types/triggers/handler_function_call_v2.d.ts +83 -83
- package/types/triggers/handler_onchain_event.d.ts +44 -44
- package/types/triggers/index.d.ts +54 -54
- package/types/triggers/trigger.d.ts +50 -50
- package/types/types/notification.d.ts +4 -4
- package/types/types/trigger.d.ts +17 -17
- package/types/types/types.d.ts +14 -14
- package/types/util/filter.d.ts +56 -56
@@ -1,64 +1,64 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
Network,
|
3
|
+
TriggerConfig,
|
4
|
+
TriggerTypeId,
|
5
|
+
TriggerUpdate,
|
6
|
+
TriggerTypeRawId,
|
7
|
+
TriggerOn,
|
8
|
+
HandlerRawConfig,
|
9
|
+
TriggerRawConfig,
|
10
|
+
Trigger
|
11
11
|
} from './trigger.js'
|
12
12
|
import {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
PollFunctionV2,
|
14
|
+
HandlerFunctionCallV2RawConfig,
|
15
|
+
HandlerFunctionCallV2Update,
|
16
|
+
HandlerFunctionCallV2RawResponse,
|
17
|
+
HandlerFunctionCallV2RawUpdate,
|
18
|
+
HandlerFunctionCallV2
|
19
19
|
} from './handler_function_call_v2.js'
|
20
20
|
import {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
PollFunctionV1,
|
22
|
+
HandlerFunctionCallRawConfig,
|
23
|
+
HandlerFunctionCallUpdate,
|
24
|
+
HandlerFunctionCallRawResponse,
|
25
|
+
HandlerFunctionCallRawUpdate,
|
26
|
+
HandlerFunctionCall
|
27
27
|
} from './handler_function_call.js'
|
28
28
|
import {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
OnchainEventV1,
|
30
|
+
HandlerOnchainEventRawConfig,
|
31
|
+
HandlerOnchainEventUpdate,
|
32
|
+
HandlerOnchainEventRawResponse,
|
33
|
+
HandlerOnchainEventRawUpdate,
|
34
|
+
HandlerOnchainEvent
|
35
35
|
} from './handler_onchain_event.js'
|
36
36
|
export {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
37
|
+
Network,
|
38
|
+
TriggerConfig,
|
39
|
+
TriggerTypeId,
|
40
|
+
TriggerUpdate,
|
41
|
+
TriggerTypeRawId,
|
42
|
+
TriggerOn,
|
43
|
+
HandlerRawConfig,
|
44
|
+
TriggerRawConfig,
|
45
|
+
Trigger,
|
46
|
+
PollFunctionV2,
|
47
|
+
HandlerFunctionCallV2RawConfig,
|
48
|
+
HandlerFunctionCallV2Update,
|
49
|
+
HandlerFunctionCallV2RawResponse,
|
50
|
+
HandlerFunctionCallV2RawUpdate,
|
51
|
+
HandlerFunctionCallV2,
|
52
|
+
PollFunctionV1,
|
53
|
+
HandlerFunctionCallRawConfig,
|
54
|
+
HandlerFunctionCallUpdate,
|
55
|
+
HandlerFunctionCallRawResponse,
|
56
|
+
HandlerFunctionCallRawUpdate,
|
57
|
+
HandlerFunctionCall,
|
58
|
+
OnchainEventV1,
|
59
|
+
HandlerOnchainEventRawConfig,
|
60
|
+
HandlerOnchainEventUpdate,
|
61
|
+
HandlerOnchainEventRawResponse,
|
62
|
+
HandlerOnchainEventRawUpdate,
|
63
|
+
HandlerOnchainEvent
|
64
64
|
}
|
@@ -1,70 +1,70 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
HandlerFunctionCallRawConfig,
|
3
|
+
HandlerFunctionCallRawResponse,
|
4
|
+
HandlerFunctionCallUpdate,
|
5
|
+
PollFunctionV1
|
6
6
|
} from './handler_function_call.js'
|
7
7
|
import {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
HandlerOnchainEventRawConfig,
|
9
|
+
HandlerOnchainEventRawResponse,
|
10
|
+
HandlerOnchainEventUpdate,
|
11
|
+
OnchainEventV1
|
12
12
|
} from './handler_onchain_event.js'
|
13
13
|
import {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
HandlerFunctionCallV2RawConfig,
|
15
|
+
HandlerFunctionCallV2RawResponse,
|
16
|
+
HandlerFunctionCallV2Update,
|
17
|
+
PollFunctionV2
|
18
18
|
} from './handler_function_call_v2.js'
|
19
19
|
export type Network = 'avalanche' | 'ethereum'
|
20
20
|
export type TriggerConfig = PollFunctionV2 | PollFunctionV1 | OnchainEventV1
|
21
21
|
export type TriggerTypeId =
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
| 'PollFunctionV2'
|
23
|
+
| 'OnchainEventV1'
|
24
|
+
| 'PollFunctionV1'
|
25
25
|
export type TriggerUpdate =
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
| HandlerFunctionCallV2Update
|
27
|
+
| HandlerFunctionCallUpdate
|
28
|
+
| HandlerOnchainEventUpdate
|
29
29
|
export type TriggerTypeRawId =
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
| 'handler_function_call'
|
31
|
+
| 'handler_onchain_event'
|
32
|
+
| 'handler_function_call_v2'
|
33
33
|
export type TriggerOn = 'event' | 'latch'
|
34
34
|
export type HandlerRawConfig =
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
| HandlerFunctionCallRawConfig
|
36
|
+
| HandlerOnchainEventRawConfig
|
37
|
+
| HandlerFunctionCallV2RawConfig
|
38
38
|
export type TriggerRawConfig = {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
nickname: string
|
40
|
+
type: TriggerTypeRawId
|
41
|
+
alertType: TriggerOn
|
42
|
+
network: Network
|
43
|
+
handler: HandlerRawConfig
|
44
44
|
}
|
45
45
|
export type HandlerRawResponse =
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
| HandlerFunctionCallV2RawResponse
|
47
|
+
| HandlerFunctionCallRawResponse
|
48
|
+
| HandlerOnchainEventRawResponse
|
49
49
|
export type TriggerRawResponse = {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
50
|
+
id: number
|
51
|
+
type: TriggerTypeRawId
|
52
|
+
triggered: boolean
|
53
|
+
lastBlock: number
|
54
|
+
alertType: 'event' | 'latch'
|
55
|
+
enabled: boolean
|
56
|
+
nickname: string
|
57
|
+
error: boolean
|
58
|
+
error_message: string | null
|
59
|
+
error_timestamp: number | null
|
60
|
+
network: Network
|
61
|
+
handler: HandlerRawResponse
|
62
62
|
}
|
63
63
|
export declare class Trigger {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
static SimpleToRaw(
|
65
|
+
name: string,
|
66
|
+
id: TriggerTypeId,
|
67
|
+
network: Network,
|
68
|
+
config: TriggerConfig
|
69
|
+
): TriggerRawConfig
|
70
70
|
}
|
package/types/types/trigger.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { FilterConfig } from '../util/filter'
|
2
2
|
export declare type FunctionCallerConfig = {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
address: string
|
4
|
+
bytecode: string
|
5
|
+
abiHash: string
|
6
|
+
function: string
|
7
7
|
}[]
|
8
8
|
export declare type TriggerTypeId =
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
| 'PollFunctionV2'
|
10
|
+
| 'OnchainEventV2'
|
11
|
+
| 'FunctionEventV2'
|
12
12
|
declare type TimeBase = 'blocks' | 'time'
|
13
13
|
/**
|
14
14
|
* @typedef PollFunction
|
@@ -17,16 +17,16 @@ declare type TimeBase = 'blocks' | 'time'
|
|
17
17
|
*
|
18
18
|
*/
|
19
19
|
export declare type PollFunction = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
20
|
+
timeBase: TimeBase
|
21
|
+
nBlocks?: number
|
22
|
+
timePeriod?: string | null
|
23
|
+
startTime?: number
|
24
|
+
debounceCount?: number
|
25
|
+
functions: FunctionCallerConfig
|
26
|
+
triggerOn: 'always' | 'filter'
|
27
|
+
latch?: boolean
|
28
|
+
filterVersion?: string
|
29
|
+
filter?: FilterConfig
|
30
30
|
}
|
31
31
|
export declare type TriggerType = PollFunction
|
32
32
|
export {}
|
package/types/types/types.d.ts
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
2
|
+
NotificationConfig,
|
3
|
+
NotificationTypeId
|
4
4
|
} from '../notifications/notification.js'
|
5
5
|
import { Network, TriggerConfig, TriggerTypeId } from '../triggers/trigger.js'
|
6
6
|
export type Condition = '>' | '>=' | '<' | '<=' | '=' | 'true'
|
7
7
|
export type TriggerOn = 'event' | 'latch'
|
8
8
|
export type DeNotifyOptions = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
email?: string
|
10
|
+
password?: string
|
11
|
+
projectId?: string
|
12
|
+
key?: string
|
13
|
+
url?: string
|
14
|
+
anonKey?: string
|
15
15
|
}
|
16
16
|
export type AlertConfig = {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
name: string
|
18
|
+
network: Network
|
19
|
+
triggerId: TriggerTypeId
|
20
|
+
trigger: TriggerConfig
|
21
|
+
notificationId: NotificationTypeId
|
22
|
+
notification: NotificationConfig
|
23
23
|
}
|
package/types/util/filter.d.ts
CHANGED
@@ -1,73 +1,73 @@
|
|
1
1
|
type Logic = 'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE'
|
2
2
|
type NumericOperation = 'eq' | '!eq' | 'gt' | 'gte' | 'lt' | 'lte'
|
3
3
|
type StringOperation =
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
| 'contains'
|
5
|
+
| '!contains'
|
6
|
+
| 'is'
|
7
|
+
| '!is'
|
8
|
+
| 'isEmpty'
|
9
|
+
| '!isEmpty'
|
10
10
|
type AddressOperation = 'is' | '!is' | 'isEmpty' | '!isEmpty'
|
11
11
|
type FilterDataTypes = 'String' | 'Address' | 'Number'
|
12
12
|
type FilterOpertationType =
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
| NumericOperation
|
14
|
+
| StringOperation
|
15
|
+
| AddressOperation
|
16
16
|
import * as yup from 'yup'
|
17
17
|
export type Condition = {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
logic?: Logic
|
19
|
+
key: string
|
20
|
+
type: FilterDataTypes
|
21
|
+
operation: FilterOpertationType
|
22
|
+
constant: string | number
|
23
23
|
}
|
24
24
|
export type ConditionGroup = {
|
25
|
-
|
26
|
-
|
25
|
+
logic: Logic
|
26
|
+
conditions: Condition[]
|
27
27
|
}
|
28
28
|
export type FilterConfig = ConditionGroup[]
|
29
29
|
export declare class Filter {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
static version(): string
|
31
|
+
static execute(record: any, groupsIn: FilterConfig, version?: string): boolean
|
32
|
+
private static process
|
33
|
+
private static execLogic
|
34
|
+
private static execCondition
|
35
35
|
}
|
36
36
|
export declare class FilterBuilder {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
37
|
+
private groups
|
38
|
+
constructor()
|
39
|
+
static version(): string
|
40
|
+
static new(): FilterBuilder
|
41
|
+
newGroup(logic: Logic): FilterBuilder
|
42
|
+
addCondition(
|
43
|
+
logic: Logic,
|
44
|
+
key: string,
|
45
|
+
type: FilterDataTypes,
|
46
|
+
operation: FilterOpertationType,
|
47
|
+
constant: string | number
|
48
|
+
): FilterBuilder
|
49
|
+
finalise(): ConditionGroup[]
|
50
|
+
static schema(): yup.ArraySchema<
|
51
|
+
| {
|
52
|
+
conditions?:
|
53
|
+
| {
|
54
|
+
operation?: string | undefined
|
55
|
+
constant?: {} | undefined
|
56
|
+
logic: NonNullable<
|
57
|
+
'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE' | undefined
|
58
|
+
>
|
59
|
+
key: string
|
60
|
+
type: NonNullable<'String' | 'Address' | 'Number' | undefined>
|
61
|
+
}[]
|
62
|
+
| undefined
|
63
|
+
logic: NonNullable<
|
64
|
+
'AND' | 'OR' | 'XOR' | 'NAND' | 'NOR' | 'WHERE' | undefined
|
65
|
+
>
|
66
|
+
}[]
|
67
|
+
| undefined,
|
68
|
+
yup.AnyObject,
|
69
|
+
'',
|
70
|
+
''
|
71
|
+
>
|
72
72
|
}
|
73
73
|
export {}
|