@beblurt/blurt-nodes-checker 1.1.2 → 2.0.1
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/LICENSE +674 -674
- package/README.md +143 -321
- package/dist/cjs/index.d.ts +21 -0
- package/dist/cjs/index.js +275 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/rpc.d.ts +10 -0
- package/dist/cjs/rpc.js +65 -0
- package/dist/cjs/rpc.js.map +1 -0
- package/dist/cjs/subject.d.ts +8 -0
- package/dist/cjs/subject.js +24 -0
- package/dist/cjs/subject.js.map +1 -0
- package/dist/cjs/test.d.ts +9 -0
- package/dist/cjs/test.js +133 -0
- package/dist/cjs/test.js.map +1 -0
- package/dist/cjs/types.d.ts +48 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/lib/index.d.ts +8 -31
- package/lib/index.js +201 -285
- package/lib/index.js.map +1 -1
- package/lib/rpc.d.ts +10 -0
- package/lib/rpc.js +61 -0
- package/lib/rpc.js.map +1 -0
- package/lib/subject.d.ts +8 -0
- package/lib/subject.js +20 -0
- package/lib/subject.js.map +1 -0
- package/lib/test.d.ts +6 -21
- package/lib/test.js +58 -91
- package/lib/test.js.map +1 -1
- package/lib/types.d.ts +48 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/package.json +74 -61
- package/dist/blurt-nodes-checker.min.js +0 -97
- package/lib/helpers/index.d.ts +0 -66
- package/lib/helpers/index.js +0 -22
- package/lib/helpers/index.js.map +0 -1
package/lib/rpc.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export class RpcClient {
|
|
2
|
+
url;
|
|
3
|
+
timeout;
|
|
4
|
+
maxRetries;
|
|
5
|
+
retryDelay;
|
|
6
|
+
debug;
|
|
7
|
+
constructor(url, timeout = 3000, maxRetries = 3, retryDelay = 500, debug = false) {
|
|
8
|
+
this.url = url;
|
|
9
|
+
this.timeout = timeout;
|
|
10
|
+
this.maxRetries = maxRetries;
|
|
11
|
+
this.retryDelay = retryDelay;
|
|
12
|
+
this.debug = debug;
|
|
13
|
+
}
|
|
14
|
+
async sleep(ms) {
|
|
15
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
16
|
+
}
|
|
17
|
+
async call(method, params = []) {
|
|
18
|
+
let attempt = 0;
|
|
19
|
+
while (attempt < this.maxRetries) {
|
|
20
|
+
const controller = new AbortController();
|
|
21
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(this.url, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: {
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
jsonrpc: "2.0",
|
|
30
|
+
id: 1,
|
|
31
|
+
method,
|
|
32
|
+
params,
|
|
33
|
+
}),
|
|
34
|
+
signal: controller.signal,
|
|
35
|
+
});
|
|
36
|
+
clearTimeout(timeoutId);
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
39
|
+
}
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
if (data.error) {
|
|
42
|
+
throw new Error(data.error.message || JSON.stringify(data.error));
|
|
43
|
+
}
|
|
44
|
+
return data.result;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
clearTimeout(timeoutId);
|
|
48
|
+
if (this.debug) {
|
|
49
|
+
console.warn(`[RpcClient] Call failed on ${this.url} (${method}) - Attempt ${attempt + 1}/${this.maxRetries}. Error: ${error.message}`);
|
|
50
|
+
}
|
|
51
|
+
attempt++;
|
|
52
|
+
if (attempt >= this.maxRetries) {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
// Exponential backoff
|
|
56
|
+
await this.sleep(this.retryDelay * Math.pow(2, attempt - 1));
|
|
57
|
+
}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 @@
|
|
|
1
|
+
export class Subject {
|
|
2
|
+
observers = [];
|
|
3
|
+
subscribe(callback) {
|
|
4
|
+
this.observers.push(callback);
|
|
5
|
+
return {
|
|
6
|
+
unsubscribe: () => {
|
|
7
|
+
this.observers = this.observers.filter((obs) => obs !== callback);
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
next(value) {
|
|
12
|
+
for (const observer of this.observers) {
|
|
13
|
+
observer(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
error(err) {
|
|
17
|
+
console.error(err);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=subject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subject.js","sourceRoot":"","sources":["../src/subject.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,OAAO;IACV,SAAS,GAA8B,EAAE,CAAC;IAElD,SAAS,CAAC,QAA4B;QACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,OAAO;YACL,WAAW,EAAE,GAAG,EAAE;gBAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;YACpE,CAAC;SACF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAQ;QACX,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAQ;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;CACF"}
|
package/lib/test.d.ts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
|
+
import { FULL_TEST } from "./types.js";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @description Testing the different RPC nodes of the Blurt blockchain
|
|
5
|
-
* @author BeBlurt <https://beblurt.com/@beblurt>
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright (C) 2022 IMT ASE Co., LTD
|
|
3
|
+
* Creates the default suite of tests for ranking the blurt nodes.
|
|
4
|
+
* Validates responses using structural typing instead of Dblurt classes, keeping the package zero-dependency.
|
|
8
5
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
-
* (at your option) any later version.
|
|
13
|
-
*
|
|
14
|
-
* This program is distributed in the hope that it will be useful,
|
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
* GNU General Public License for more details.
|
|
18
|
-
*
|
|
19
|
-
* You should have received a copy of the GNU General Public License
|
|
20
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
* @param account An existing account string (default "beblurt")
|
|
7
|
+
* @param permlink An existing permlink string to test discussions (default a known post)
|
|
21
8
|
*/
|
|
22
|
-
|
|
23
|
-
import { FULL_TEST } from "./helpers/index.js";
|
|
24
|
-
export declare const testList: (block: number, account: string, permlink: string) => FULL_TEST[];
|
|
9
|
+
export declare const createDefaultTests: (account?: string, permlink?: string) => FULL_TEST[];
|
package/lib/test.js
CHANGED
|
@@ -1,161 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @description Testing the different RPC nodes of the Blurt blockchain
|
|
5
|
-
* @author BeBlurt <https://beblurt.com/@beblurt>
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright (C) 2022 IMT ASE Co., LTD
|
|
2
|
+
* Creates the default suite of tests for ranking the blurt nodes.
|
|
3
|
+
* Validates responses using structural typing instead of Dblurt classes, keeping the package zero-dependency.
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
-
* (at your option) any later version.
|
|
13
|
-
*
|
|
14
|
-
* This program is distributed in the hope that it will be useful,
|
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
* GNU General Public License for more details.
|
|
18
|
-
*
|
|
19
|
-
* You should have received a copy of the GNU General Public License
|
|
20
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
5
|
+
* @param account An existing account string (default "beblurt")
|
|
6
|
+
* @param permlink An existing permlink string to test discussions (default a known post)
|
|
21
7
|
*/
|
|
22
|
-
export const
|
|
8
|
+
export const createDefaultTests = (account = "beblurt", permlink = "communities-have-arrived-on-the-blurt-blockchain-and-beblurt-app-1685887788620") => {
|
|
23
9
|
return [
|
|
24
10
|
{
|
|
25
|
-
name: "Nexus | account_notifications
|
|
11
|
+
name: "Nexus | account_notifications",
|
|
26
12
|
description: "Get account notifications",
|
|
27
|
-
nexus: true,
|
|
28
13
|
method: "bridge.account_notifications",
|
|
29
14
|
params: { account, min_score: 25, last_id: null, limit: 10 },
|
|
30
|
-
|
|
15
|
+
weight: 5,
|
|
16
|
+
critical: false,
|
|
17
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
31
18
|
},
|
|
32
19
|
{
|
|
33
|
-
name: "Nexus | get_account_posts
|
|
34
|
-
description: "Blog, feed, replies
|
|
35
|
-
nexus: true,
|
|
20
|
+
name: "Nexus | get_account_posts",
|
|
21
|
+
description: "Blog, feed, replies lists of an account",
|
|
36
22
|
method: "bridge.get_account_posts",
|
|
37
|
-
params: { sort:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
23
|
+
params: { sort: "feed", account, limit: 10 },
|
|
24
|
+
weight: 10,
|
|
25
|
+
critical: true,
|
|
26
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
41
27
|
},
|
|
42
28
|
{
|
|
43
29
|
name: "Nexus | get_discussion",
|
|
44
30
|
description: "Gives a flattened discussion tree",
|
|
45
|
-
nexus: true,
|
|
46
31
|
method: "bridge.get_discussion",
|
|
47
32
|
params: { author: account, permlink },
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
weight: 5,
|
|
34
|
+
critical: false,
|
|
35
|
+
validator: (result) => typeof result === "object" && result !== null && Object.keys(result).length > 0,
|
|
51
36
|
},
|
|
52
37
|
{
|
|
53
|
-
name: "Nexus | get_payout_stats
|
|
38
|
+
name: "Nexus | get_payout_stats",
|
|
54
39
|
description: "Get payout stats",
|
|
55
|
-
nexus: true,
|
|
56
40
|
method: "bridge.get_payout_stats",
|
|
57
41
|
params: { limit: 5 },
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
weight: 2,
|
|
43
|
+
critical: false,
|
|
44
|
+
validator: (result) => result && result.items !== undefined,
|
|
61
45
|
},
|
|
62
46
|
{
|
|
63
|
-
name: "Nexus | get_profile
|
|
47
|
+
name: "Nexus | get_profile",
|
|
64
48
|
description: "Resume of a profile",
|
|
65
|
-
nexus: true,
|
|
66
49
|
method: "bridge.get_profile",
|
|
67
50
|
params: { account, observer: null },
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
51
|
+
weight: 5,
|
|
52
|
+
critical: false,
|
|
53
|
+
validator: (result) => result && result.name !== undefined,
|
|
71
54
|
},
|
|
72
55
|
{
|
|
73
|
-
name: "Nexus | get_ranked_posts
|
|
74
|
-
description: "Get ranked posts (Hot, Trending, Created
|
|
75
|
-
nexus: true,
|
|
56
|
+
name: "Nexus | get_ranked_posts",
|
|
57
|
+
description: "Get ranked posts (Hot, Trending, Created)",
|
|
76
58
|
method: "bridge.get_ranked_posts",
|
|
77
|
-
params: { sort:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
params: { sort: "created", limit: 10, tag: "blurt-101010", observer: account },
|
|
60
|
+
weight: 10,
|
|
61
|
+
critical: false,
|
|
62
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
81
63
|
},
|
|
82
64
|
{
|
|
83
|
-
name: "Nexus | list_communities
|
|
65
|
+
name: "Nexus | list_communities",
|
|
84
66
|
description: "List of communities",
|
|
85
|
-
nexus: true,
|
|
86
67
|
method: "bridge.list_communities",
|
|
87
|
-
params: { last: null, limit: 10, query: null, sort:
|
|
88
|
-
|
|
68
|
+
params: { last: null, limit: 10, query: null, sort: "rank", observer: account },
|
|
69
|
+
weight: 2,
|
|
70
|
+
critical: false,
|
|
71
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
89
72
|
},
|
|
90
73
|
{
|
|
91
|
-
name: "Condenser |
|
|
74
|
+
name: "Condenser | Get Account History",
|
|
92
75
|
description: "History of operations for a given account",
|
|
93
|
-
nexus: false,
|
|
94
76
|
method: "condenser_api.get_account_history",
|
|
95
77
|
params: [account, -1, 10],
|
|
96
|
-
|
|
78
|
+
weight: 10,
|
|
79
|
+
critical: true,
|
|
80
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
97
81
|
},
|
|
98
82
|
{
|
|
99
|
-
name: "Condenser |
|
|
83
|
+
name: "Condenser | Get Accounts",
|
|
100
84
|
description: "Retrieve an account details",
|
|
101
|
-
nexus: false,
|
|
102
85
|
method: "condenser_api.get_accounts",
|
|
103
86
|
params: [[account]],
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
name: "Condenser | Get Block",
|
|
108
|
-
description: "Get Block",
|
|
109
|
-
nexus: false,
|
|
110
|
-
method: "condenser_api.get_block",
|
|
111
|
-
params: [block],
|
|
112
|
-
validator: (result) => {
|
|
113
|
-
return result.witness ? true : false;
|
|
114
|
-
}
|
|
87
|
+
weight: 10,
|
|
88
|
+
critical: true,
|
|
89
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
115
90
|
},
|
|
116
91
|
{
|
|
117
92
|
name: "Condenser | Get Blog Entries",
|
|
118
93
|
description: "Retrieve the list of blog entries for an account",
|
|
119
|
-
nexus: false,
|
|
120
94
|
method: "condenser_api.get_blog_entries",
|
|
121
95
|
params: [account, 0, 25],
|
|
122
|
-
|
|
96
|
+
weight: 5,
|
|
97
|
+
critical: false,
|
|
98
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
123
99
|
},
|
|
124
100
|
{
|
|
125
101
|
name: "Condenser | Get Content",
|
|
126
102
|
description: "Retrieve the content (post or comment)",
|
|
127
|
-
nexus: false,
|
|
128
103
|
method: "condenser_api.get_content",
|
|
129
104
|
params: [account, permlink],
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: "Condenser | Get Dynamic Global Propertie",
|
|
136
|
-
description: "Check chain global properties",
|
|
137
|
-
nexus: false,
|
|
138
|
-
method: "condenser_api.get_dynamic_global_properties",
|
|
139
|
-
params: [],
|
|
140
|
-
validator: (result) => {
|
|
141
|
-
return "head_block_number" in result && "last_irreversible_block_num" in result ? true : false;
|
|
142
|
-
}
|
|
105
|
+
weight: 10,
|
|
106
|
+
critical: true,
|
|
107
|
+
validator: (result) => result && result.author === account,
|
|
143
108
|
},
|
|
144
109
|
{
|
|
145
110
|
name: "Condenser | Get Disccusion By Blog",
|
|
146
111
|
description: "Retrieve a list of discussions by blog",
|
|
147
|
-
nexus: false,
|
|
148
112
|
method: "condenser_api.get_discussions_by_blog",
|
|
149
113
|
params: [{ tag: account, limit: 5, truncate_body: 1 }],
|
|
150
|
-
|
|
114
|
+
weight: 5,
|
|
115
|
+
critical: false,
|
|
116
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
151
117
|
},
|
|
152
118
|
{
|
|
153
|
-
name: "Condenser | Lookup
|
|
119
|
+
name: "Condenser | Lookup Accounts",
|
|
154
120
|
description: "Looks up accounts starting with name",
|
|
155
|
-
nexus: false,
|
|
156
121
|
method: "condenser_api.lookup_accounts",
|
|
157
122
|
params: ["nale", 10],
|
|
158
|
-
|
|
123
|
+
weight: 2,
|
|
124
|
+
critical: false,
|
|
125
|
+
validator: (result) => Array.isArray(result) && result.length > 0,
|
|
159
126
|
},
|
|
160
127
|
];
|
|
161
128
|
};
|
package/lib/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,UAAkB,SAAS,EAC3B,WAAmB,gFAAgF,EACtF,EAAE;IACf,OAAO;QACL;YACE,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,2BAA2B;YACxC,MAAM,EAAE,8BAA8B;YACtC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAC5D,MAAM,EAAE,CAAC;YACT,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;SAClE;QACD;YACE,IAAI,EAAE,2BAA2B;YACjC,WAAW,EAAE,yCAAyC;YACtD,MAAM,EAAE,0BAA0B;YAClC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;YAC5C,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;SAClE;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EAAE,mCAAmC;YAChD,MAAM,EAAE,uB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val?: number;
|
|
5
|
+
maxRetries?: number;
|
|
6
|
+
retryDelay?: number;
|
|
7
|
+
staleThreshold?: number;
|
|
8
|
+
tests?: FULL_TEST[];
|
|
9
|
+
};
|
|
10
|
+
export declare type TEST_RPC_NODE = {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
method: string;
|
|
14
|
+
success: boolean;
|
|
15
|
+
duration: number;
|
|
16
|
+
error?: string;
|
|
17
|
+
last_check: number;
|
|
18
|
+
weight: number;
|
|
19
|
+
critical: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare type RPC_NODE = {
|
|
22
|
+
url: string;
|
|
23
|
+
nb_ok: number;
|
|
24
|
+
nb_error: number;
|
|
25
|
+
nb_degraded: number;
|
|
26
|
+
error?: string;
|
|
27
|
+
last_check: number;
|
|
28
|
+
status: "unknown" | "online" | "degraded" | "error" | "stale" | "forked" | "outdated";
|
|
29
|
+
duration?: number;
|
|
30
|
+
latency_avg?: number;
|
|
31
|
+
reliability?: number;
|
|
32
|
+
version?: string;
|
|
33
|
+
deactivated?: boolean;
|
|
34
|
+
score: number;
|
|
35
|
+
block_number?: number;
|
|
36
|
+
block_id?: string;
|
|
37
|
+
lag?: number;
|
|
38
|
+
test_result: Array<TEST_RPC_NODE>;
|
|
39
|
+
};
|
|
40
|
+
export declare type FULL_TEST = {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
method: string;
|
|
44
|
+
params: unknown;
|
|
45
|
+
weight: number;
|
|
46
|
+
critical: boolean;
|
|
47
|
+
validator: (result: any) => boolean;
|
|
48
|
+
};
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,61 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@beblurt/blurt-nodes-checker",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "BLURT blockchain RPC nodes servers checker (latency, availability, methods)",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"node": ">=14.16",
|
|
7
|
-
"exports":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
},
|
|
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
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@beblurt/blurt-nodes-checker",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "BLURT blockchain RPC nodes servers checker (latency, availability, methods)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"node": ">=14.16",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"require": {
|
|
14
|
+
"types": "./dist/cjs/index.d.ts",
|
|
15
|
+
"default": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/cjs/index.js",
|
|
20
|
+
"module": "./lib/index.js",
|
|
21
|
+
"typings": "./lib/index.d.ts",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/*",
|
|
25
|
+
"lib/*"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build:esm": "tsc -p tsconfig.json",
|
|
29
|
+
"build:cjs": "tsc -p tsconfig.cjs.json && tsc-alias -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
30
|
+
"build": "npm run build:esm && npm run build:cjs",
|
|
31
|
+
"prepare": "husky install",
|
|
32
|
+
"release": "changeset publish"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://gitlab.com/beblurt/blurt-nodes-checker.git"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"blurt",
|
|
43
|
+
"blurt checker",
|
|
44
|
+
"blurt nodes checker",
|
|
45
|
+
"blurt rpc nodes",
|
|
46
|
+
"blurt rpc",
|
|
47
|
+
"blurt blockchain"
|
|
48
|
+
],
|
|
49
|
+
"author": "@beblurt (https://beblurt.com/@beblurt)",
|
|
50
|
+
"license": "GPL-3.0-or-later",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://gitlab.com/beblurt/blurt-nodes-checker/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://gitlab.com/beblurt/blurt-nodes-checker#readme",
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@changesets/cli": "^2.30.0",
|
|
57
|
+
"@types/node": "^20.5.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
59
|
+
"@typescript-eslint/parser": "^8.58.1",
|
|
60
|
+
"eslint": "^10.2.0",
|
|
61
|
+
"husky": "^9.1.7",
|
|
62
|
+
"prettier": "^3.0.1",
|
|
63
|
+
"tsc-alias": "^1.8.16",
|
|
64
|
+
"typescript": "^5.1.6"
|
|
65
|
+
},
|
|
66
|
+
"contributors": [
|
|
67
|
+
"@beblurt (https://blurt.blog/@beblurt)"
|
|
68
|
+
],
|
|
69
|
+
"config": {
|
|
70
|
+
"commitizen": {
|
|
71
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|