@certik/skynet 0.13.1 → 0.14.0
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/.eslintignore +1 -0
- package/CHANGELOG.md +5 -0
- package/abi.d.ts +11 -11
- package/api.d.ts +8 -10
- package/app.d.ts +129 -123
- package/availability.d.ts +16 -9
- package/bun.lockb +0 -0
- package/const.d.ts +36 -35
- package/const.js +2 -5
- package/deploy.d.ts +37 -29
- package/dynamodb.d.ts +47 -51
- package/dynamodb.js +14 -4
- package/env.d.ts +7 -2
- package/indexer.d.ts +16 -14
- package/kafka.d.ts +16 -24
- package/log.d.ts +5 -2
- package/monitor.d.ts +13 -13
- package/opensearch.d.ts +4 -4
- package/opsgenie.d.ts +7 -7
- package/package.json +3 -3
- package/proxy.d.ts +7 -7
- package/s3.d.ts +31 -11
- package/selector.d.ts +13 -13
- package/slack.d.ts +8 -8
- package/snowflake.d.ts +1 -1
- package/sqs.d.ts +2 -2
- package/util.d.ts +1 -1
- package/web3.d.ts +16 -14
package/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.d.ts
|
package/CHANGELOG.md
CHANGED
package/abi.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
type ContractIO = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
internalType: string | undefined;
|
|
5
|
+
components: ContractIO[];
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
type ABI = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
constant: boolean;
|
|
10
|
+
inputs: ContractIO[];
|
|
11
|
+
name: string;
|
|
12
|
+
outputs: ContractIO[];
|
|
13
|
+
payable: boolean;
|
|
14
|
+
stateMutability: string;
|
|
15
|
+
type: string;
|
|
16
16
|
}[];
|
|
17
17
|
|
|
18
18
|
export const ERC20: ABI;
|
package/api.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Selector } from "./selector";
|
|
2
|
+
import { Route, Serve } from "./app";
|
|
3
|
+
import express from "express";
|
|
2
4
|
|
|
3
5
|
export function startApiApp(params: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
apiKey: string;
|
|
11
|
-
prefix: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
beforeListen: () => void;
|
|
6
|
+
binaryName: string;
|
|
7
|
+
name: string;
|
|
8
|
+
selector?: Selector;
|
|
9
|
+
routes: Route[];
|
|
10
|
+
serve: Serve;
|
|
11
|
+
beforeListen: (args: { app: ReturnType<typeof express> }) => void;
|
|
14
12
|
}): void;
|
package/app.d.ts
CHANGED
|
@@ -1,168 +1,174 @@
|
|
|
1
1
|
import { ERROR_LEVEL } from "./monitor";
|
|
2
2
|
import { Selector } from "./selector";
|
|
3
|
+
import express from "express";
|
|
3
4
|
|
|
4
5
|
export type Env = {
|
|
5
|
-
|
|
6
|
-
}
|
|
6
|
+
[key: string]: string | null;
|
|
7
|
+
};
|
|
7
8
|
|
|
8
9
|
export type Route = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
method?: "get" | "post" | "put" | "delete" | "patch";
|
|
11
|
+
path: string;
|
|
12
|
+
middlewares?: ((req: express.Request, res: express.Response, next: express.NextFunction) => Promise<void>)[];
|
|
13
|
+
handler: (args: { req: express.Request; res: express.Response; [key: string]: any }) => Promise<void>;
|
|
14
|
+
protected?: boolean;
|
|
15
|
+
};
|
|
14
16
|
|
|
15
17
|
export type Serve = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
18
|
+
prefix: string;
|
|
19
|
+
port: number;
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
killTimeout?: string;
|
|
22
|
+
cpu: number;
|
|
23
|
+
mem: number;
|
|
24
|
+
instances?: number;
|
|
25
|
+
};
|
|
24
26
|
|
|
25
27
|
export type Consume = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
killTimeout: string;
|
|
34
|
-
cpu: number;
|
|
35
|
-
mem: number;
|
|
36
|
-
}
|
|
28
|
+
func: ({ protocol, messages, verbose }: { protocol: string; messages: any; verbose: boolean }) => Promise<void>;
|
|
29
|
+
topic: ({ protocol }: { protocol: string }) => string;
|
|
30
|
+
maxRetry?: number;
|
|
31
|
+
killTimeout?: string;
|
|
32
|
+
cpu: number;
|
|
33
|
+
mem: number;
|
|
34
|
+
};
|
|
37
35
|
|
|
38
36
|
export type State = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
37
|
+
type: string;
|
|
38
|
+
updateInterval: ({ protocol }: { protocol: string }) => number;
|
|
39
|
+
getMinId: () => Promise<number>;
|
|
40
|
+
getMaxId: ({ protocol }: { protocol: string }) => Promise<number>;
|
|
41
|
+
};
|
|
44
42
|
|
|
45
43
|
export type Produce = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
44
|
+
func: ({
|
|
45
|
+
protocol,
|
|
46
|
+
from,
|
|
47
|
+
to,
|
|
48
|
+
verbose,
|
|
49
|
+
send,
|
|
50
|
+
}: {
|
|
51
|
+
protocol: string;
|
|
52
|
+
from: number;
|
|
53
|
+
to: number;
|
|
54
|
+
verbose: boolean;
|
|
55
|
+
send: (items: { id: string; name: string }[]) => Promise<void>;
|
|
56
|
+
}) => Promise<void>;
|
|
57
|
+
topic: ({ protocol }) => string;
|
|
58
|
+
deadLetterTopic: ({ protocol }) => string;
|
|
59
|
+
batchSize: number;
|
|
60
|
+
maxRetry?: number;
|
|
61
|
+
killTimeout?: string;
|
|
62
|
+
cpu: number;
|
|
63
|
+
mem: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type Schedule = string | ((jobName: string) => string);
|
|
61
67
|
|
|
62
68
|
export type Check = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
func: ({ protocol, state, verbose }: { protocol: string; state: string; verbose: boolean }) => {
|
|
70
|
+
type: string;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
schedule: Schedule;
|
|
74
|
+
slackChannel: string;
|
|
75
|
+
killTimeout?: string;
|
|
76
|
+
cpu: number;
|
|
77
|
+
mem: number;
|
|
78
|
+
};
|
|
71
79
|
|
|
72
80
|
export type Build = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
+
func: ({ protocol, from, to, verbose }: { protocol: string; from: number; to: number; verbose: boolean }) => void;
|
|
82
|
+
batchSize: number;
|
|
83
|
+
schedule: Schedule;
|
|
84
|
+
killTimeout?: string;
|
|
85
|
+
cpu: number;
|
|
86
|
+
mem: number;
|
|
87
|
+
};
|
|
81
88
|
|
|
82
89
|
export type Restart = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
90
|
+
attempts: number | undefined;
|
|
91
|
+
mode: string | undefined;
|
|
92
|
+
interval: string | undefined;
|
|
93
|
+
delay: string | undefined;
|
|
94
|
+
};
|
|
88
95
|
|
|
89
96
|
export type Validate = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
func: ({ protocol, from, to, verbose }: { protocol: string; from: number; to: number; verbose: boolean }) => void;
|
|
98
|
+
batchSize: number;
|
|
99
|
+
schedule: Schedule;
|
|
100
|
+
killTimeout?: string;
|
|
101
|
+
cpu: number;
|
|
102
|
+
mem: number;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
type BuildWithRestart = Build & { restart: Restart | undefined };
|
|
98
106
|
|
|
99
|
-
type BuildWithConcurrency = Build
|
|
107
|
+
type BuildWithConcurrency = Build & { concurrency: number | undefined };
|
|
100
108
|
|
|
101
|
-
type ValidateWithConcurrency = Validate
|
|
109
|
+
type ValidateWithConcurrency = Validate & { concurrency: number | undefined };
|
|
102
110
|
|
|
103
111
|
export const SENSITIVE_VALUE: null;
|
|
104
112
|
|
|
105
113
|
export { ERROR_LEVEL };
|
|
106
114
|
|
|
107
115
|
export function every(n: number | undefined): {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
116
|
+
second: string;
|
|
117
|
+
seconds: string;
|
|
118
|
+
minute: string;
|
|
119
|
+
minutes: string;
|
|
120
|
+
hour: string;
|
|
121
|
+
hours: string;
|
|
122
|
+
day: string;
|
|
123
|
+
days: string;
|
|
124
|
+
week: string;
|
|
125
|
+
weeks: string;
|
|
126
|
+
};
|
|
119
127
|
|
|
120
128
|
export function api(apiParams: {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
name: string;
|
|
130
|
+
routes: Route[];
|
|
131
|
+
serve: Serve;
|
|
132
|
+
env: Env | undefined;
|
|
133
|
+
region: string | undefined;
|
|
134
|
+
beforeListen: (args: { app: ReturnType<typeof express> }) => void;
|
|
127
135
|
}): () => void;
|
|
128
136
|
|
|
129
137
|
export function consumer(consumerParams: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
name: string;
|
|
139
|
+
selector?: Selector;
|
|
140
|
+
consume: Consume;
|
|
141
|
+
check?: Check;
|
|
142
|
+
env: Env | undefined;
|
|
143
|
+
region: string | undefined;
|
|
136
144
|
}): () => void;
|
|
137
145
|
|
|
138
146
|
export function producer(producerParams: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
name: string;
|
|
148
|
+
selector?: Selector;
|
|
149
|
+
produce: Produce;
|
|
150
|
+
check?: Check;
|
|
151
|
+
state: State;
|
|
152
|
+
env?: Env;
|
|
153
|
+
region?: string;
|
|
146
154
|
}): () => void;
|
|
147
155
|
|
|
148
156
|
export function indexer(indexerParams: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
env: Env | undefined;
|
|
156
|
-
region: string | undefined;
|
|
157
|
+
name: string;
|
|
158
|
+
selector?: Selector;
|
|
159
|
+
build: BuildWithRestart;
|
|
160
|
+
check?: Check;
|
|
161
|
+
env?: Env;
|
|
162
|
+
region?: string;
|
|
157
163
|
}): () => void;
|
|
158
164
|
|
|
159
165
|
export function modeIndexer(modeIndexerParams: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
name: string;
|
|
167
|
+
selector?: Selector;
|
|
168
|
+
state: State;
|
|
169
|
+
build: BuildWithConcurrency;
|
|
170
|
+
validate?: ValidateWithConcurrency;
|
|
171
|
+
check?: Check;
|
|
172
|
+
env?: Env;
|
|
173
|
+
region?: string;
|
|
168
174
|
}): () => void;
|
package/availability.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
export function wait(time: number
|
|
1
|
+
export function wait(time: number): Promise<void>;
|
|
2
2
|
export function retry(times: number, verbose: boolean, func: Function): Promise<void>;
|
|
3
|
-
export function exponentialRetry<T>(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export function exponentialRetry<T>(
|
|
4
|
+
func: () => Promise<T>,
|
|
5
|
+
{
|
|
6
|
+
maxRetry,
|
|
7
|
+
initialDuration,
|
|
8
|
+
growFactor,
|
|
9
|
+
test,
|
|
10
|
+
verbose,
|
|
11
|
+
}: {
|
|
12
|
+
maxRetry: number;
|
|
13
|
+
initialDuration?: number;
|
|
14
|
+
growFactor?: number;
|
|
15
|
+
test: (result: T) => boolean;
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
},
|
|
11
18
|
): Promise<T>;
|
package/bun.lockb
CHANGED
|
Binary file
|
package/const.d.ts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
type Protocol = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
2
|
+
nativeTokenName: string;
|
|
3
|
+
nativeTokenSymbol: string;
|
|
4
|
+
nativeTokenDecimals: number;
|
|
5
|
+
nativeTokenAddress: string;
|
|
6
|
+
nativeTokenLogo: string;
|
|
7
|
+
nativeTokenCoinGeckoId: string;
|
|
8
|
+
nativeTokenCmcId: number;
|
|
9
|
+
endpoint: string;
|
|
10
|
+
backupEndpoint?: string;
|
|
11
|
+
archiveEndpoint?: string;
|
|
12
|
+
tokenStandard: string;
|
|
13
|
+
scanApi?: {
|
|
14
|
+
endpoint: string;
|
|
15
|
+
key: string;
|
|
16
|
+
};
|
|
17
|
+
multiCallProvider?: string;
|
|
18
|
+
scanUrl?: string;
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
type TimeIntervals = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
SECOND: number;
|
|
23
|
+
MINUTE: number;
|
|
24
|
+
HOUR: number;
|
|
25
|
+
DAY: number;
|
|
26
|
+
WEEK: number;
|
|
27
|
+
YEAR: number;
|
|
28
|
+
};
|
|
28
29
|
|
|
29
30
|
export const SKYNET_API_PREFIX: string;
|
|
30
31
|
export const PROTOCOLS: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
32
|
+
eth: Protocol;
|
|
33
|
+
bsc: Protocol;
|
|
34
|
+
polygon: Protocol;
|
|
35
|
+
heco: Protocol;
|
|
36
|
+
avax: Protocol;
|
|
37
|
+
ftm: Protocol;
|
|
38
|
+
algo: Protocol;
|
|
39
|
+
};
|
|
39
40
|
export const TIME: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
41
|
+
BY_MS: TimeIntervals;
|
|
42
|
+
BY_S: TimeIntervals;
|
|
43
|
+
};
|
package/const.js
CHANGED
|
@@ -129,6 +129,7 @@ const TIME = {
|
|
|
129
129
|
YEAR: 1000 * 60 * 60 * 24 * 365,
|
|
130
130
|
},
|
|
131
131
|
BY_S: {
|
|
132
|
+
SECOND: 1,
|
|
132
133
|
MINUTE: 60,
|
|
133
134
|
HOUR: 60 * 60,
|
|
134
135
|
DAY: 60 * 60 * 24,
|
|
@@ -137,8 +138,4 @@ const TIME = {
|
|
|
137
138
|
},
|
|
138
139
|
};
|
|
139
140
|
|
|
140
|
-
export {
|
|
141
|
-
SKYNET_API_PREFIX,
|
|
142
|
-
PROTOCOLS,
|
|
143
|
-
TIME,
|
|
144
|
-
};
|
|
141
|
+
export { SKYNET_API_PREFIX, PROTOCOLS, TIME };
|
package/deploy.d.ts
CHANGED
|
@@ -4,40 +4,48 @@ import { Env, Selector, Check, Restart } from "./app";
|
|
|
4
4
|
type Service = {
|
|
5
5
|
prefix: string;
|
|
6
6
|
port: number;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
|
|
9
9
|
type CreateDeployBaseParams = {
|
|
10
|
-
binaryName: string
|
|
11
|
-
name: string
|
|
12
|
-
workingDirectory: string
|
|
13
|
-
bin
|
|
14
|
-
selector
|
|
15
|
-
env
|
|
16
|
-
region
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
check: Check,
|
|
20
|
-
}
|
|
10
|
+
binaryName: string;
|
|
11
|
+
name: string;
|
|
12
|
+
workingDirectory: string;
|
|
13
|
+
bin?: string;
|
|
14
|
+
selector?: Selector;
|
|
15
|
+
env?: Env;
|
|
16
|
+
region?: string;
|
|
17
|
+
check?: Check;
|
|
18
|
+
};
|
|
21
19
|
|
|
22
20
|
export { getJobName };
|
|
23
21
|
|
|
24
22
|
export function getNomadAddr(isProduction: boolean): Promise<string | undefined>;
|
|
25
23
|
|
|
26
|
-
export function createModeDeploy(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
export function createModeDeploy(
|
|
25
|
+
createModeDeployParams: CreateDeployBaseParams & {
|
|
26
|
+
deltaSchedule: string;
|
|
27
|
+
validateSchedule: string;
|
|
28
|
+
deltaKillTimeout?: number;
|
|
29
|
+
deltaCpu: number;
|
|
30
|
+
deltaMem: number;
|
|
31
|
+
rebuildKillTimeout?: number;
|
|
32
|
+
rebuildCpu: number;
|
|
33
|
+
rebuildMem: number;
|
|
34
|
+
validateKillTimeout?: number;
|
|
35
|
+
validateCpu?: number;
|
|
36
|
+
validateMem?: number;
|
|
37
|
+
},
|
|
38
|
+
): { deploy: () => void };
|
|
36
39
|
|
|
37
|
-
export function createDeploy(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
export function createDeploy(
|
|
41
|
+
createDeployParams: CreateDeployBaseParams & {
|
|
42
|
+
type?: string;
|
|
43
|
+
count?: number;
|
|
44
|
+
schedule: string;
|
|
45
|
+
restart?: Restart;
|
|
46
|
+
cpu: number;
|
|
47
|
+
mem: number;
|
|
48
|
+
killTimeout?: number;
|
|
49
|
+
service: Service;
|
|
50
|
+
},
|
|
51
|
+
): { deploy: () => void };
|
package/dynamodb.d.ts
CHANGED
|
@@ -1,67 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ScanCommandInput, PutCommandOutput, UpdateCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { CreateTableInput, CreateTableOutput } from "@aws-sdk/client-dynamodb";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export function getDocClient(forceNew?: boolean): DynamoDBDocumentClient;
|
|
6
6
|
|
|
7
|
-
export function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Items: any[];
|
|
12
|
-
Count: number;
|
|
13
|
-
ScannedCount: number;
|
|
7
|
+
export function scanWholeTable<T>(options: ScanCommandInput): Promise<{
|
|
8
|
+
Items: T[];
|
|
9
|
+
Count: number;
|
|
10
|
+
ScannedCount: number;
|
|
14
11
|
}>;
|
|
15
12
|
|
|
16
|
-
export function batchCreateRecords(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
export function batchCreateRecords<T>(
|
|
14
|
+
tableName: string,
|
|
15
|
+
records: T[],
|
|
16
|
+
maxWritingCapacity: number,
|
|
17
|
+
verbose?: boolean,
|
|
21
18
|
): Promise<void>;
|
|
22
19
|
|
|
23
|
-
export function createRecord(
|
|
24
|
-
tableName: string,
|
|
25
|
-
fields: Fields,
|
|
26
|
-
verbose: boolean | undefined
|
|
27
|
-
): Promise<void>;
|
|
20
|
+
export function createRecord<T>(tableName: string, fields: T, verbose?: boolean): Promise<PutCommandOutput>;
|
|
28
21
|
|
|
29
|
-
export function getRecordsByKey(
|
|
30
|
-
tableName: string,
|
|
31
|
-
keys: Keys,
|
|
32
|
-
indexName: string
|
|
33
|
-
): Promise<DynamoDB.DocumentClient.ItemList | null | undefined>;
|
|
22
|
+
export function getRecordsByKey<TReturn, TKey>(tableName: string, keys: TKey, indexName: string): Promise<TReturn[]>;
|
|
34
23
|
|
|
35
|
-
export function getRecordByKey(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
): Promise<
|
|
24
|
+
export function getRecordByKey<TReturn, TKey>(
|
|
25
|
+
tableName: string,
|
|
26
|
+
keys: TKey,
|
|
27
|
+
indexName: string,
|
|
28
|
+
): Promise<TReturn | null>;
|
|
40
29
|
|
|
41
|
-
export function updateRecordByKey(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
): Promise<
|
|
30
|
+
export function updateRecordByKey<TKey, TField>(
|
|
31
|
+
tableName: string,
|
|
32
|
+
idKey: TKey,
|
|
33
|
+
fields: TField,
|
|
34
|
+
conditionExpressions?: string,
|
|
35
|
+
verbose?: boolean,
|
|
36
|
+
): Promise<UpdateCommandOutput["Attributes"] | false>;
|
|
48
37
|
|
|
49
|
-
export function batchDeleteRecords(
|
|
50
|
-
tableName: string,
|
|
51
|
-
keys: Keys
|
|
52
|
-
): Promise<void>;
|
|
38
|
+
export function batchDeleteRecords<T>(tableName: string, keys: T): Promise<void>;
|
|
53
39
|
|
|
54
40
|
export function deleteRecordsByHashKey(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
tableName: string,
|
|
42
|
+
indexName?: string,
|
|
43
|
+
hashKeyValue: string,
|
|
44
|
+
verbose?: boolean,
|
|
59
45
|
): Promise<number>;
|
|
60
46
|
|
|
61
47
|
export function createTableIfNotExist(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
): Promise<
|
|
48
|
+
tableName: string,
|
|
49
|
+
attributeDefinitions: CreateTableInput["AttributeDefinitions"],
|
|
50
|
+
keySchema: CreateTableInput["KeySchema"],
|
|
51
|
+
options?: Partial<CreateTableInput>,
|
|
52
|
+
verbose?: boolean,
|
|
53
|
+
): Promise<CreateTableOutput>;
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
DynamoDBDocumentClient,
|
|
57
|
+
ScanCommand,
|
|
58
|
+
BatchWriteCommand,
|
|
59
|
+
GetCommand,
|
|
60
|
+
PutCommand,
|
|
61
|
+
QueryCommand,
|
|
62
|
+
UpdateCommand,
|
|
63
|
+
} from "@aws-sdk/lib-dynamodb";
|
package/dynamodb.js
CHANGED
|
@@ -11,12 +11,22 @@ import { DynamoDBClient, DescribeTableCommand } from "@aws-sdk/client-dynamodb";
|
|
|
11
11
|
import { getAWSSDKConfig } from "./env.js";
|
|
12
12
|
import { wait } from "./availability.js";
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let _dynamoDB;
|
|
15
|
+
|
|
16
|
+
let _docClient;
|
|
17
|
+
|
|
18
|
+
function getDynamoDB(forceNew = false) {
|
|
19
|
+
if (!_dynamoDB || forceNew) {
|
|
20
|
+
_dynamoDB = new DynamoDBClient(getAWSSDKConfig());
|
|
21
|
+
}
|
|
22
|
+
return _dynamoDB;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
|
-
function getDocClient() {
|
|
19
|
-
|
|
25
|
+
function getDocClient(forceNew = false) {
|
|
26
|
+
if (!_docClient || forceNew) {
|
|
27
|
+
_docClient = DynamoDBDocumentClient.from(getDynamoDB());
|
|
28
|
+
}
|
|
29
|
+
return _docClient;
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
function mergeQueries(q1, q2) {
|
package/env.d.ts
CHANGED
|
@@ -2,10 +2,15 @@ export function ensureAndGet<T>(envName: string, defaultValue: T): string | T;
|
|
|
2
2
|
export function getEnvOrThrow(envName: string): string;
|
|
3
3
|
export function getAWSAccessKeyId(): string | undefined;
|
|
4
4
|
export function getAWSSecretAccessKey(): string | undefined;
|
|
5
|
+
export function getAWSSDKConfig(): {
|
|
6
|
+
region: string;
|
|
7
|
+
credentials?: {
|
|
8
|
+
accessKeyId: string;
|
|
9
|
+
secretAccessKey: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
5
12
|
export function getAWSRegion(): string;
|
|
6
13
|
export function getEnvironment(): string;
|
|
7
|
-
export function getGetBlockApiKey(): string | undefined;
|
|
8
|
-
export function getAlchemyApiKey(identifier: string): string | undefined;
|
|
9
14
|
export function getNodeRealApiKey(identifier: string): string | undefined;
|
|
10
15
|
export function isProduction(): boolean;
|
|
11
16
|
export function isDev(): boolean;
|
package/indexer.d.ts
CHANGED
|
@@ -5,21 +5,23 @@ import { Build, State, Validate } from "./app";
|
|
|
5
5
|
import { SelectorFlags, Selector } from "./selector";
|
|
6
6
|
|
|
7
7
|
type CreateIndexerAppBaseParams = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
binaryName: string;
|
|
9
|
+
name: string;
|
|
10
|
+
selector?: Selector;
|
|
11
|
+
build: Build;
|
|
12
|
+
maxRetry?: number;
|
|
13
|
+
};
|
|
14
14
|
|
|
15
|
-
export function createModeIndexerApp(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export function createModeIndexerApp(
|
|
16
|
+
createModeIndexerAppParams: {
|
|
17
|
+
buildBatchSize?: number;
|
|
18
|
+
buildConcurrency?: number;
|
|
19
|
+
validate?: Validate;
|
|
20
|
+
validateBatchSize?: number;
|
|
21
|
+
validateConcurrency?: number;
|
|
22
|
+
state: State;
|
|
23
|
+
} & CreateIndexerAppBaseParams,
|
|
24
|
+
): { run: () => void };
|
|
23
25
|
|
|
24
26
|
export function createIndexerApp(createModeIndexerAppParams: CreateIndexerAppBaseParams): { run: () => void };
|
|
25
27
|
|
package/kafka.d.ts
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
import { KafkaMessage } from "kafkajs";
|
|
2
|
-
import {
|
|
2
|
+
import { Produce, Consume, State } from "./app";
|
|
3
3
|
import { SelectorFlags, Selector } from "./selector";
|
|
4
4
|
|
|
5
5
|
export function createProducerApp(createProducerAppParams: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
binaryName: string;
|
|
7
|
+
name: string;
|
|
8
|
+
selector?: Selector;
|
|
9
|
+
producer: Produce;
|
|
10
|
+
state: State;
|
|
11
11
|
}): { run: () => Promise<void> };
|
|
12
12
|
|
|
13
13
|
export function createConsumerApp(createConsumerAppParams: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
binaryName: string;
|
|
15
|
+
name: string;
|
|
16
|
+
selector?: Selector;
|
|
17
|
+
consumer: Consume;
|
|
18
18
|
}): { run: () => Promise<void> };
|
|
19
19
|
|
|
20
20
|
export function produceMessages(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
send: (topic: any, messages: any) => Promise<void>
|
|
24
|
-
) => Promise<void>
|
|
21
|
+
producerId: string,
|
|
22
|
+
callback: (send: <T>(topic: string, messages: T) => Promise<void>) => Promise<void>,
|
|
25
23
|
): Promise<void>;
|
|
26
24
|
|
|
27
25
|
export function consumeMessages(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
message: KafkaMessage,
|
|
32
|
-
stopConsumeMessages: () => Promise<void>
|
|
33
|
-
) => Promise<void>
|
|
26
|
+
consumerId: string,
|
|
27
|
+
topic: string | RegExp,
|
|
28
|
+
callback: (message: KafkaMessage, stopConsumeMessages: () => Promise<void>) => Promise<void>,
|
|
34
29
|
): Promise<() => Promise<void>>;
|
|
35
30
|
|
|
36
|
-
export function getProducerLatestId(
|
|
37
|
-
name: string,
|
|
38
|
-
selectorFlags: SelectorFlags
|
|
39
|
-
): Promise<number>;
|
|
31
|
+
export function getProducerLatestId(name: string, selectorFlags: SelectorFlags): Promise<number>;
|
package/log.d.ts
CHANGED
package/monitor.d.ts
CHANGED
|
@@ -2,23 +2,23 @@ import { Check } from "./app";
|
|
|
2
2
|
import { SelectorFlags, Selector } from "./selector";
|
|
3
3
|
|
|
4
4
|
export const ERROR_LEVEL: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
INFO: string;
|
|
6
|
+
CRITICAL: string;
|
|
7
|
+
WARNING: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const LEVEL_EMOJI: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
Info: string;
|
|
12
|
+
Critical: string;
|
|
13
|
+
Warning: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export function createMonitor(createMonitorParams: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
binaryName: string;
|
|
18
|
+
name: string;
|
|
19
|
+
getState?: (name: string, selectorFlags: SelectorFlags) => Promise<void>;
|
|
20
|
+
mode?: boolean;
|
|
21
|
+
selector?: Selector;
|
|
22
|
+
check?: Check;
|
|
23
|
+
maxRetry?: number;
|
|
24
24
|
}): { monitor: () => void };
|
package/opensearch.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export declare function newOpensearchClient(
|
|
|
4
4
|
endpoint: string,
|
|
5
5
|
key: string,
|
|
6
6
|
secret: string,
|
|
7
|
-
options?: ClientOptions
|
|
7
|
+
options?: ClientOptions,
|
|
8
8
|
): Client;
|
|
9
9
|
|
|
10
|
-
export declare async function sendToOpensearch(
|
|
10
|
+
export declare async function sendToOpensearch<T>(
|
|
11
11
|
client: Client,
|
|
12
12
|
appName: string,
|
|
13
13
|
index: string,
|
|
14
14
|
record: string,
|
|
15
|
-
indexSuffixes?: string[]
|
|
16
|
-
): Promise<{ status: string; result:
|
|
15
|
+
indexSuffixes?: string[],
|
|
16
|
+
): Promise<{ status: string; result: T }>;
|
package/opsgenie.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function postGenieMessage(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
): Promise<{ result:
|
|
1
|
+
export function postGenieMessage<T>(
|
|
2
|
+
body: {
|
|
3
|
+
alias?: string;
|
|
4
|
+
message: string;
|
|
5
|
+
},
|
|
6
|
+
verbose?: boolean,
|
|
7
|
+
): Promise<{ result: T }>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certik/skynet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Skynet Shared JS library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"lint": "eslint *.js test",
|
|
10
10
|
"test": "doppler run -- ava --timeout=1m",
|
|
11
|
-
"format": "prettier --write '*.js' '**/*.js'",
|
|
11
|
+
"format": "prettier --write '*.js' '**/*.js' '*.d.ts' '**/*.d.ts'",
|
|
12
12
|
"pub": "npm publish --access public"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|
package/proxy.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type Options = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
verbose: boolean;
|
|
3
|
+
timeout: number;
|
|
4
|
+
headers: {
|
|
5
|
+
[header: string]: string;
|
|
6
|
+
};
|
|
7
|
+
} & RequestInit;
|
|
8
8
|
|
|
9
|
-
export default function proxyFetch(url: string, options
|
|
9
|
+
export default function proxyFetch(url: string, options?: Partial<Options>): Promise<Response>;
|
package/s3.d.ts
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
S3Client,
|
|
3
|
+
GetObjectCommand,
|
|
4
|
+
HeadObjectCommand,
|
|
5
|
+
PutObjectCommand,
|
|
6
|
+
DeleteObjectCommand,
|
|
7
|
+
ListObjectsV2Command,
|
|
8
|
+
NotFound,
|
|
9
|
+
} from "@aws-sdk/client-s3";
|
|
2
10
|
|
|
3
11
|
type WriteOptions = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
verbose: boolean;
|
|
13
|
+
acl: string;
|
|
14
|
+
skipIfExists: boolean;
|
|
15
|
+
contentType: string;
|
|
16
|
+
};
|
|
8
17
|
|
|
9
|
-
export function getS3():
|
|
10
|
-
export function readFile(bucketName: string, key: string, verbose
|
|
18
|
+
export function getS3(): S3Client;
|
|
19
|
+
export function readFile(bucketName: string, key: string, verbose?: boolean): Promise<string | null>;
|
|
11
20
|
export function hasFile(bucketName: string, key: string): Promise<boolean>;
|
|
12
|
-
export function
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
export function getFileSize(bucketName: string, key: string): Promise<number>;
|
|
22
|
+
export function writeFile(
|
|
23
|
+
bucketName: string,
|
|
24
|
+
key: string,
|
|
25
|
+
body: string,
|
|
26
|
+
options?: Partial<WriteOptions>,
|
|
27
|
+
): Promise<void>;
|
|
28
|
+
export function deleteFile(bucketName: string, key: string, verbose?: boolean): Promise<void>;
|
|
29
|
+
export function listKeys(
|
|
30
|
+
bucketname: string,
|
|
31
|
+
prefix: string,
|
|
32
|
+
continuationToken?: string,
|
|
33
|
+
): Promise<{
|
|
34
|
+
keys: string[];
|
|
35
|
+
continuationToken: string | null;
|
|
16
36
|
} | null>;
|
package/selector.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export type SelectorFlags = {
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
[flag: string]: string;
|
|
3
|
+
};
|
|
4
4
|
|
|
5
5
|
export type Selector = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
6
|
+
[key: string]: {
|
|
7
|
+
type?: "string" | "number" | "boolean" | string;
|
|
8
|
+
description?: string;
|
|
9
|
+
desc?: string;
|
|
10
|
+
alias?: string;
|
|
11
|
+
isRequired?: boolean;
|
|
12
|
+
default?: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
export function getJobName(name: string, selectorFlags: SelectorFlags, mode
|
|
16
|
+
export function getJobName(name: string, selectorFlags: SelectorFlags, mode?: string): string;
|
|
17
17
|
export function getSelectorDesc(selector: Selector): string;
|
|
18
18
|
export function getSelectorFlags(selector: Selector): SelectorFlags;
|
|
19
|
-
export function toSelectorString(selectorFlags: SelectorFlags, delim
|
|
19
|
+
export function toSelectorString(selectorFlags: SelectorFlags, delim?: string): string;
|
package/slack.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatPostMessageArguments } from "@slack/web-api";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface PostMessageParams {
|
|
4
|
+
conversationId: string;
|
|
5
|
+
message: string | Partial<ChatPostMessageArguments>;
|
|
6
|
+
token: string;
|
|
7
|
+
verbose?: boolean;
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
export function findConversation(client: WebClient, name: string): Promise<string | null>;
|
|
10
|
-
export function postMessage(channel: string | ChannelConfig, message: any, verbose: boolean): Promise<void>;
|
|
10
|
+
async function postMessageToConversation(params: PostMessageParams): Promise<void>;
|
package/snowflake.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ConnectionOptions, Connection, Binds } from "snowflake-sdk";
|
|
2
2
|
|
|
3
3
|
export function getConnection(options: ConnectionOptions): Promise<Connection>;
|
|
4
|
-
export function executeSql(options: ConnectionOptions, sql: string, binds
|
|
4
|
+
export function executeSql<T>(options: ConnectionOptions, sql: string, binds?: Binds): Promise<T[]>;
|
package/sqs.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SQSClient } from "@aws-sdk/client-sqs";
|
|
2
2
|
|
|
3
|
-
export function getSQS():
|
|
3
|
+
export function getSQS(): SQSClient;
|
package/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function arrayGroup<T>(array:T[], groupSize: number): T[][];
|
|
1
|
+
export function arrayGroup<T>(array: T[], groupSize: number): T[][];
|
|
2
2
|
export function partition(startAt: number, endAt: number, numGroups: number): [number, number][];
|
|
3
3
|
export function range(startAt: number, endAt: number, step: number): [number, number][];
|
|
4
4
|
export function fillRange(startAt: number, endAt: number): number[];
|
package/web3.d.ts
CHANGED
|
@@ -2,22 +2,24 @@ import Bottleneck from "bottleneck";
|
|
|
2
2
|
import Web3 from "web3";
|
|
3
3
|
import { ABI } from "./abi";
|
|
4
4
|
|
|
5
|
-
type Call =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
type Call =
|
|
6
|
+
| {
|
|
7
|
+
params: any | any[];
|
|
8
|
+
functionName?: string;
|
|
9
|
+
target?: string;
|
|
10
|
+
}
|
|
11
|
+
| any[];
|
|
10
12
|
|
|
11
|
-
export function newWeb3ByProtocol(protocol: string): Web3
|
|
13
|
+
export function newWeb3ByProtocol(protocol: string): Web3;
|
|
12
14
|
export function singleCall(protocol: string, abi: ABI, target: string, params: any[]): Promise<any>;
|
|
13
15
|
export function multiCall(multiCallParams: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
protocol: string;
|
|
17
|
+
limiter?: Bottleneck;
|
|
18
|
+
target: string;
|
|
19
|
+
abi: ABI;
|
|
20
|
+
calls: Call[];
|
|
19
21
|
}): Promise<{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
callCount: number;
|
|
23
|
+
actualCallCount?: number;
|
|
24
|
+
output: any[];
|
|
23
25
|
}>;
|