@abtnode/constant 1.15.17 → 1.16.0-beta-b16cb035
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/index.js +265 -48
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const NODE_SERVICES = Object.freeze({
|
|
2
|
-
|
|
2
|
+
AUTH: 'auth',
|
|
3
|
+
AUTH_SERVICE: '@abtnode/auth-service', // deprecated
|
|
3
4
|
});
|
|
4
5
|
|
|
5
6
|
const NODE_SERVICES_PREFIX = Object.freeze({
|
|
6
|
-
AUTH_SERVICE: `/.service/${NODE_SERVICES.AUTH_SERVICE}`,
|
|
7
|
+
AUTH_SERVICE: `/.service/${NODE_SERVICES.AUTH_SERVICE}`, // deprecated
|
|
7
8
|
});
|
|
8
9
|
|
|
9
10
|
const ROLES = Object.freeze({
|
|
@@ -13,48 +14,108 @@ const ROLES = Object.freeze({
|
|
|
13
14
|
GUEST: 'guest',
|
|
14
15
|
});
|
|
15
16
|
|
|
17
|
+
const SERVER_ROLES = Object.freeze({
|
|
18
|
+
...ROLES,
|
|
19
|
+
CI: 'ci',
|
|
20
|
+
CERTIFICATE: 'certificate',
|
|
21
|
+
|
|
22
|
+
// blocklet user or sdk. must start with 'blocklet-
|
|
23
|
+
BLOCKLET_OWNER: 'blocklet-owner',
|
|
24
|
+
BLOCKLET_ADMIN: 'blocklet-admin',
|
|
25
|
+
BLOCKLET_MEMBER: 'blocklet-member',
|
|
26
|
+
BLOCKLET_SDK: 'blocklet-sdk',
|
|
27
|
+
|
|
28
|
+
// external user
|
|
29
|
+
EXTERNAL_BLOCKLET_CONTROLLER: 'external-blocklet-controller',
|
|
30
|
+
EXTERNAL_BLOCKLETS_MANAGER: 'external-blocklets-manager',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const BLOCKLET_ROLES = [
|
|
34
|
+
SERVER_ROLES.BLOCKLET_OWNER,
|
|
35
|
+
SERVER_ROLES.BLOCKLET_ADMIN,
|
|
36
|
+
SERVER_ROLES.BLOCKLET_MEMBER,
|
|
37
|
+
SERVER_ROLES.BLOCKLET_SDK,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const isBlockletRole = (role) => role && BLOCKLET_ROLES.includes(role);
|
|
41
|
+
|
|
42
|
+
const AUTH_CERT_TYPE = {
|
|
43
|
+
USER: 'user',
|
|
44
|
+
OWNERSHIP_NFT: 'ownership_nft',
|
|
45
|
+
BLOCKLET_USER: 'blocklet_user',
|
|
46
|
+
BLOCKLET_CONTROLLER: 'blocklet_controller',
|
|
47
|
+
};
|
|
48
|
+
|
|
16
49
|
const RBAC_CONFIG = {
|
|
17
50
|
roles: Object.freeze([
|
|
18
51
|
{
|
|
19
|
-
name:
|
|
52
|
+
name: SERVER_ROLES.OWNER,
|
|
20
53
|
title: 'Owner',
|
|
21
54
|
description: 'Has full administrative access to the Blocklet Server',
|
|
22
55
|
passport: true,
|
|
23
56
|
},
|
|
24
57
|
{
|
|
25
|
-
name:
|
|
58
|
+
name: SERVER_ROLES.ADMIN,
|
|
26
59
|
title: 'Admin',
|
|
27
60
|
description:
|
|
28
61
|
'Has full permissions to manage blocklet and Blocklet Server such as install/remove/start/stop blocklet, manage blocklet URL mapping and certificates, manage blocklet team, manage node integrations and access keys, upgrade node to a new version',
|
|
29
62
|
passport: true,
|
|
30
63
|
},
|
|
31
64
|
{
|
|
32
|
-
name:
|
|
65
|
+
name: SERVER_ROLES.MEMBER,
|
|
33
66
|
title: 'Member',
|
|
34
67
|
description:
|
|
35
68
|
'Has permissions to manage blocklets, such as install/remove/start/stop blocklet, manage blocklet URL mapping and certificates',
|
|
36
69
|
passport: true,
|
|
37
70
|
},
|
|
38
71
|
{
|
|
39
|
-
name:
|
|
72
|
+
name: SERVER_ROLES.GUEST,
|
|
40
73
|
title: 'Guest',
|
|
41
74
|
description: 'Has all read permissions on Blocklet Server',
|
|
42
75
|
passport: true,
|
|
43
76
|
},
|
|
44
77
|
{
|
|
45
|
-
name:
|
|
78
|
+
name: SERVER_ROLES.CI,
|
|
46
79
|
title: 'CI',
|
|
47
80
|
description: 'Deploy blocklet to Blocklet Server',
|
|
48
81
|
passport: true,
|
|
49
|
-
|
|
82
|
+
noHuman: true,
|
|
50
83
|
},
|
|
51
84
|
{
|
|
52
|
-
name:
|
|
85
|
+
name: SERVER_ROLES.CERTIFICATE,
|
|
53
86
|
title: 'Certificate',
|
|
54
87
|
description: 'Manage https certificates for blocklets on the Blocklet Server',
|
|
55
88
|
passport: true,
|
|
56
|
-
|
|
89
|
+
noHuman: true,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: SERVER_ROLES.BLOCKLET_OWNER,
|
|
93
|
+
title: 'Blocklet Owner',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: SERVER_ROLES.BLOCKLET_ADMIN,
|
|
97
|
+
title: 'Blocklet Admin',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: SERVER_ROLES.BLOCKLET_MEMBER,
|
|
101
|
+
title: 'Blocklet Member',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: SERVER_ROLES.BLOCKLET_SDK,
|
|
105
|
+
title: 'Blocklet SDK',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER,
|
|
109
|
+
title: 'External Blocklet Controller',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER,
|
|
113
|
+
title: 'External Blocklets Manager',
|
|
114
|
+
description: 'Manage external blocklets in the Blocklet Server',
|
|
115
|
+
passport: true,
|
|
116
|
+
noHuman: true,
|
|
57
117
|
},
|
|
118
|
+
// for backward compatibility
|
|
58
119
|
{
|
|
59
120
|
name: NODE_SERVICES.AUTH_SERVICE,
|
|
60
121
|
title: 'Auth Service',
|
|
@@ -95,11 +156,11 @@ const RBAC_CONFIG = {
|
|
|
95
156
|
description: 'Manage team data(members/roles/permissions) for Blocklet Server and blocklets',
|
|
96
157
|
},
|
|
97
158
|
{
|
|
98
|
-
name: '
|
|
99
|
-
description: 'View
|
|
159
|
+
name: 'query_blocklets',
|
|
160
|
+
description: 'View store and installed blocklets, including blocklet runtime configuration, domains and urls',
|
|
100
161
|
},
|
|
101
162
|
{
|
|
102
|
-
name: '
|
|
163
|
+
name: 'mutate_blocklets',
|
|
103
164
|
description: 'Perform state changing actions on blocklets, such as install/upgrade/config/start/stop/remove',
|
|
104
165
|
},
|
|
105
166
|
{
|
|
@@ -134,10 +195,19 @@ const RBAC_CONFIG = {
|
|
|
134
195
|
name: 'mutate_webhook',
|
|
135
196
|
description: 'Manage integrations',
|
|
136
197
|
},
|
|
198
|
+
// query_blocklet, mutate_blocklet are only for blocklet members
|
|
199
|
+
{
|
|
200
|
+
name: 'query_blocklet',
|
|
201
|
+
description: 'View a blocklet, including blocklet runtime configuration, domains and urls',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'mutate_blocklet',
|
|
205
|
+
description: 'Perform state changing actions on a blocklet, such as upgrade/config/start/stop',
|
|
206
|
+
},
|
|
137
207
|
]),
|
|
138
208
|
grants: Object.freeze({
|
|
139
|
-
[
|
|
140
|
-
'
|
|
209
|
+
[SERVER_ROLES.GUEST]: [
|
|
210
|
+
'query_blocklets',
|
|
141
211
|
'query_router',
|
|
142
212
|
'query_webhook',
|
|
143
213
|
'query_notification',
|
|
@@ -146,65 +216,152 @@ const RBAC_CONFIG = {
|
|
|
146
216
|
'query_node',
|
|
147
217
|
'query_session',
|
|
148
218
|
],
|
|
149
|
-
[
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
219
|
+
[SERVER_ROLES.MEMBER]: [
|
|
220
|
+
SERVER_ROLES.GUEST,
|
|
221
|
+
'mutate_blocklets',
|
|
222
|
+
'mutate_router',
|
|
223
|
+
'mutate_notification',
|
|
224
|
+
'mutate_session',
|
|
225
|
+
],
|
|
226
|
+
[SERVER_ROLES.ADMIN]: [
|
|
227
|
+
SERVER_ROLES.MEMBER,
|
|
228
|
+
'mutate_team',
|
|
229
|
+
'mutate_webhook',
|
|
230
|
+
'mutate_accessKey',
|
|
231
|
+
'mutate_node',
|
|
232
|
+
'mutate_certificate',
|
|
233
|
+
],
|
|
234
|
+
[SERVER_ROLES.OWNER]: [ROLES.ADMIN],
|
|
235
|
+
[SERVER_ROLES.CI]: ['query_blocklets', 'mutate_blocklets'],
|
|
236
|
+
[SERVER_ROLES.CERTIFICATE]: ['query_certificate', 'mutate_certificate'],
|
|
237
|
+
|
|
238
|
+
// blocklet app or blocklet user
|
|
239
|
+
[SERVER_ROLES.BLOCKLET_SDK]: ['query_team', 'mutate_team'],
|
|
240
|
+
[SERVER_ROLES.BLOCKLET_OWNER]: [SERVER_ROLES.BLOCKLET_ADMIN],
|
|
241
|
+
[SERVER_ROLES.BLOCKLET_ADMIN]: [SERVER_ROLES.BLOCKLET_MEMBER, 'mutate_team', 'mutate_blocklet'],
|
|
242
|
+
[SERVER_ROLES.BLOCKLET_MEMBER]: ['query_team', 'query_blocklet'],
|
|
243
|
+
|
|
244
|
+
// external user
|
|
245
|
+
[SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER]: ['query_blocklets', 'mutate_blocklets'],
|
|
246
|
+
[SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER]: ['query_blocklets', 'mutate_blocklets'],
|
|
155
247
|
}),
|
|
156
248
|
};
|
|
157
249
|
|
|
158
250
|
const DAY_IN_MS = 24 * 60 * 60 * 1000;
|
|
159
251
|
|
|
252
|
+
const EVENTS = {
|
|
253
|
+
NOTIFICATION_CREATE: 'notification.create',
|
|
254
|
+
ROUTING_UPDATED: 'routing.updated',
|
|
255
|
+
NODE_UPDATED: 'node.updated',
|
|
256
|
+
NODE_MAINTAIN_PROGRESS: 'node.upgrade.progress',
|
|
257
|
+
NODE_STARTED: 'node.started',
|
|
258
|
+
NODE_STOPPED: 'node.stopped',
|
|
259
|
+
NODE_ADDED_OWNER: 'node.addedOwner',
|
|
260
|
+
NODE_RUNTIME_INFO: 'node.runtimeInfo',
|
|
261
|
+
BLOCKLETS_RUNTIME_INFO: 'node.blockletsRuntimeInfo',
|
|
262
|
+
DOMAIN_STATUS: 'domain.status',
|
|
263
|
+
USER_ADDED: 'user.added',
|
|
264
|
+
USER_REMOVED: 'user.removed',
|
|
265
|
+
USER_UPDATED: 'user.updated',
|
|
266
|
+
CERT_ADDED: 'cert.added',
|
|
267
|
+
CERT_ISSUED: 'cert.issued',
|
|
268
|
+
CERT_UPDATED: 'cert.updated',
|
|
269
|
+
CERT_REMOVED: 'cert.removed',
|
|
270
|
+
CERT_ERROR: 'cert.error',
|
|
271
|
+
RELOAD_GATEWAY: 'gateway.reload',
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const WHO_CAN_ACCESS = {
|
|
275
|
+
OWNER: 'owner',
|
|
276
|
+
INVITED: 'invited',
|
|
277
|
+
ALL: 'all',
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const BLOCKLET_STORE_URL = 'https://store.blocklet.dev';
|
|
281
|
+
const BLOCKLET_STORE_URL_DEV = 'https://dev.store.blocklet.dev';
|
|
282
|
+
const MAIN_CHAIN_ENDPOINT = 'https://main.abtnetwork.io/api/';
|
|
283
|
+
|
|
160
284
|
module.exports = Object.freeze({
|
|
161
285
|
// Blocklet Server
|
|
162
286
|
NODE_MODES: Object.freeze({
|
|
163
287
|
PRODUCTION: 'production',
|
|
164
288
|
DEBUG: 'debug',
|
|
165
289
|
MAINTENANCE: 'maintenance',
|
|
166
|
-
|
|
290
|
+
SERVERLESS: 'serverless',
|
|
167
291
|
}),
|
|
168
292
|
|
|
169
293
|
DEFAULT_DESCRIPTION: 'Web Interface to manage your Blocklet Server',
|
|
170
294
|
|
|
171
|
-
|
|
295
|
+
NODE_MAINTAIN_PROGRESS: Object.freeze({
|
|
172
296
|
SETUP: 'setup', // backup
|
|
173
297
|
INSTALLING: 'installing',
|
|
298
|
+
VERIFYING: 'verifying',
|
|
174
299
|
RESTARTING: 'restarting',
|
|
175
300
|
CLEANUP: 'cleanup',
|
|
176
301
|
COMPLETE: 'complete',
|
|
177
302
|
ROLLBACK: 'rollback',
|
|
178
303
|
}),
|
|
179
304
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
305
|
+
VC_TYPE_BLOCKLET_PURCHASE: 'BlockletPurchaseCredential',
|
|
306
|
+
VC_TYPE_NODE_PASSPORT: 'ABTNodePassport',
|
|
307
|
+
VC_TYPE_GENERAL_PASSPORT: 'NFTPassport',
|
|
308
|
+
|
|
309
|
+
NFT_TYPE_SERVER_OWNERSHIP: 'BlockletServerOwnershipNFT',
|
|
310
|
+
NFT_TYPE_SERVERLESS: 'BlockletServerServerlessNFT',
|
|
184
311
|
|
|
185
|
-
NODE_PACKAGE_NAME: '@abtnode/cli',
|
|
186
|
-
NODE_COMMAND_NAME: 'abtnode',
|
|
312
|
+
NODE_PACKAGE_NAME: '@abtnode/cli', // deprecated in 1.6.0
|
|
313
|
+
NODE_COMMAND_NAME: 'abtnode', // deprecated in 1.6.0
|
|
314
|
+
NODE_DATA_DIR_NAME: '_abtnode',
|
|
315
|
+
USER_AVATAR_DIR: '/.assets/avatar',
|
|
316
|
+
USER_AVATAR_URL_PREFIX: 'bn://avatar',
|
|
317
|
+
USER_AVATAR_PATH_PREFIX: '/user/avatar',
|
|
187
318
|
|
|
188
319
|
PROCESS_NAME_DAEMON: 'abt-node-daemon',
|
|
189
320
|
PROCESS_NAME_PROXY: 'abt-node-db-hub',
|
|
190
321
|
PROCESS_NAME_UPDATER: 'abt-node-updater',
|
|
191
322
|
PROCESS_NAME_SERVICE: 'abt-node-service',
|
|
323
|
+
PROCESS_NAME_ROUTER: 'abt-node-router',
|
|
192
324
|
PROCESS_NAME_LOG_ROTATE: 'abt-node-log-rotate',
|
|
193
325
|
PROCESS_NAME_EVENT_HUB: 'abt-node-event-hub',
|
|
194
326
|
|
|
195
|
-
NODE_REGISTER_URL: 'https://install.arcblock.io/',
|
|
327
|
+
NODE_REGISTER_URL: 'https://install.arcblock.io/',
|
|
196
328
|
WEB_WALLET_URL: 'https://web.abtwallet.io',
|
|
197
|
-
BLOCKLET_STORE_URL
|
|
198
|
-
BLOCKLET_STORE_URL_DEV
|
|
329
|
+
BLOCKLET_STORE_URL,
|
|
330
|
+
BLOCKLET_STORE_URL_DEV,
|
|
199
331
|
BLOCKLET_STORE_API_PREFIX: '/api',
|
|
332
|
+
BLOCKLET_STORE_API_BLOCKLET_PREFIX: '/api/blocklets',
|
|
333
|
+
BLOCKLET_STORE_META_PATH: '/api/store.json',
|
|
334
|
+
BLOCKLET_STORE: {
|
|
335
|
+
name: 'Official Store',
|
|
336
|
+
description: 'ArcBlock official blocklet registry',
|
|
337
|
+
url: BLOCKLET_STORE_URL,
|
|
338
|
+
logoUrl: '/logo.png',
|
|
339
|
+
maintainer: 'arcblock',
|
|
340
|
+
},
|
|
341
|
+
BLOCKLET_STORE_DEV: {
|
|
342
|
+
name: 'Dev Store',
|
|
343
|
+
description: 'ArcBlock dev registry that contains demo and example blocklets',
|
|
344
|
+
url: BLOCKLET_STORE_URL_DEV,
|
|
345
|
+
maintainer: 'arcblock',
|
|
346
|
+
logoUrl: '/logo.png',
|
|
347
|
+
},
|
|
200
348
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
DEFAULT_DASHBOARD_CERT_DOWN_ADDR: 'https://cert.abtnet.io/open/download/certificates/ip_abtnet_io',
|
|
349
|
+
// application is a container, components have no hierarchy and are tiled in application
|
|
350
|
+
APP_STRUCT_VERSION: '2',
|
|
204
351
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
352
|
+
DEFAULT_DID_REGISTRY: 'https://registry.abtnet.io',
|
|
353
|
+
DEFAULT_DID_DOMAIN: 'did.abtnet.io',
|
|
354
|
+
DEFAULT_IP_DOMAIN: '*.ip.abtnet.io',
|
|
355
|
+
DEFAULT_IP_DOMAIN_SUFFIX: 'ip.abtnet.io',
|
|
356
|
+
DEFAULT_WILDCARD_CERT_HOST: 'https://releases.arcblock.io/',
|
|
357
|
+
|
|
358
|
+
DEFAULT_CERTIFICATE_EMAIL: 'certs@arcblock.io',
|
|
359
|
+
|
|
360
|
+
CONFIG_FILENAME: 'config.yml',
|
|
361
|
+
CONFIG_FILENAME_OLD: 'abtnode.yml',
|
|
362
|
+
CONFIG_FOLDER_NAME: '.blocklet-server',
|
|
363
|
+
CONFIG_FOLDER_NAME_OLD: '.abtnode',
|
|
364
|
+
EXPORTED_FOLDER_NAME: 'exported_blocklet_server',
|
|
208
365
|
|
|
209
366
|
StatusCode: Object.freeze({
|
|
210
367
|
ok: 0,
|
|
@@ -218,14 +375,20 @@ module.exports = Object.freeze({
|
|
|
218
375
|
}),
|
|
219
376
|
|
|
220
377
|
// Service Gateway
|
|
221
|
-
|
|
378
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
379
|
+
IP: new RegExp('-(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\-(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'),
|
|
222
380
|
DOMAIN_FOR_IP_SITE: '',
|
|
223
381
|
DOMAIN_FOR_IP_SITE_REGEXP: `~^\\d+.\\d+.\\d+.\\d+$`, // eslint-disable-line
|
|
224
382
|
DOMAIN_FOR_DEFAULT_SITE: '*',
|
|
225
383
|
DOMAIN_FOR_INTERNAL_SITE: '127.0.0.1',
|
|
226
384
|
NAME_FOR_WELLKNOWN_SITE: 'wellknown',
|
|
227
385
|
WELLKNOWN_PATH_PREFIX: '/.well-known',
|
|
228
|
-
|
|
386
|
+
WELLKNOWN_ACME_CHALLENGE_PREFIX: '/.well-known/acme-challenge',
|
|
387
|
+
WELLKNOWN_DID_RESOLVER_PREFIX: '/.well-known/did.json',
|
|
388
|
+
WELLKNOWN_PING_PREFIX: '/.well-known/ping',
|
|
389
|
+
WELLKNOWN_SERVICE_PATH_PREFIX: '/.well-known/service',
|
|
390
|
+
WELLKNOWN_BLOCKLET_ADMIN_PATH: '/.well-known/service/admin',
|
|
391
|
+
WELLKNOWN_BLOCKLET_LOGO_PATH: '/.well-known/service/blocklet/logo',
|
|
229
392
|
SLOT_FOR_IP_DNS_SITE: '888-888-888-888',
|
|
230
393
|
|
|
231
394
|
DEFAULT_ADMIN_PATH: '/admin',
|
|
@@ -234,17 +397,17 @@ module.exports = Object.freeze({
|
|
|
234
397
|
DEFAULT_HTTPS_PORT: 443,
|
|
235
398
|
MAX_UPLOAD_FILE_SIZE: 500, // unit: MB
|
|
236
399
|
DEFAULT_DAEMON_PORT: 8089,
|
|
400
|
+
MAX_NGINX_WORKER_CONNECTIONS: 10240,
|
|
237
401
|
|
|
238
402
|
BLOCKLET_PROXY_PATH_PREFIX: '/.blocklet/proxy',
|
|
239
403
|
BLOCKLET_SITE_GROUP_SUFFIX: '.blocklet-domain-group',
|
|
240
404
|
|
|
241
405
|
// Time and dates
|
|
242
406
|
DAY_IN_MS,
|
|
243
|
-
DAEMON_MAX_MEM_LIMIT_IN_MB:
|
|
244
|
-
PROXY_MAX_MEM_LIMIT_IN_MB:
|
|
245
|
-
BLOCKLET_MAX_MEM_LIMIT_IN_MB:
|
|
246
|
-
CERTIFICATE_EXPIRES_OFFSET:
|
|
247
|
-
CERTIFICATE_EXPIRES_WARNING_OFFSET: 7 * DAY_IN_MS,
|
|
407
|
+
DAEMON_MAX_MEM_LIMIT_IN_MB: 800,
|
|
408
|
+
PROXY_MAX_MEM_LIMIT_IN_MB: 800,
|
|
409
|
+
BLOCKLET_MAX_MEM_LIMIT_IN_MB: 800,
|
|
410
|
+
CERTIFICATE_EXPIRES_OFFSET: 10 * DAY_IN_MS,
|
|
248
411
|
ROUTING_RULE_TYPES: Object.freeze({
|
|
249
412
|
NONE: 'none',
|
|
250
413
|
DAEMON: 'daemon',
|
|
@@ -252,15 +415,17 @@ module.exports = Object.freeze({
|
|
|
252
415
|
BLOCKLET: 'blocklet',
|
|
253
416
|
REDIRECT: 'redirect',
|
|
254
417
|
GENERAL_PROXY: 'general_proxy',
|
|
418
|
+
DIRECT_RESPONSE: 'direct_response',
|
|
255
419
|
}),
|
|
256
420
|
|
|
257
421
|
// Team
|
|
258
422
|
ROLES,
|
|
423
|
+
SERVER_ROLES,
|
|
424
|
+
BLOCKLET_ROLES,
|
|
425
|
+
isBlockletRole,
|
|
426
|
+
AUTH_CERT_TYPE,
|
|
259
427
|
RBAC_CONFIG,
|
|
260
428
|
genPermissionName: (resource, action = 'access') => `${action}_${resource.replace('_', '-')}`, // resource cannot include '_'
|
|
261
|
-
NFT_TYPE_NODE_PASSPORT: 'ABTNodePassport',
|
|
262
|
-
NFT_TYPE_GENERAL_PASSPORT: 'NFTPassport',
|
|
263
|
-
NFT_TYPE_GENERAL_PASSPORT_OLD: 'PassportVerificationCredential', // backward compatible
|
|
264
429
|
PASSPORT_STATUS: {
|
|
265
430
|
VALID: 'valid',
|
|
266
431
|
REVOKED: 'revoked',
|
|
@@ -271,4 +436,56 @@ module.exports = Object.freeze({
|
|
|
271
436
|
NODE_SERVICES_PREFIX,
|
|
272
437
|
|
|
273
438
|
DISK_ALERT_THRESHOLD_PERCENT: 80,
|
|
439
|
+
|
|
440
|
+
// EVENTS
|
|
441
|
+
EVENTS,
|
|
442
|
+
|
|
443
|
+
WHO_CAN_ACCESS,
|
|
444
|
+
WHO_CAN_ACCESS_PREFIX_ROLES: 'roles:',
|
|
445
|
+
|
|
446
|
+
GATEWAY_REQ_LIMIT: Object.freeze({
|
|
447
|
+
min: 10,
|
|
448
|
+
max: 100,
|
|
449
|
+
}),
|
|
450
|
+
|
|
451
|
+
// Store
|
|
452
|
+
STORE_DETAIL_PAGE_PATH_PREFIX: '/blocklets',
|
|
453
|
+
|
|
454
|
+
MAX_USER_PAGE_SIZE: 100,
|
|
455
|
+
|
|
456
|
+
SERVER_STATUS: {
|
|
457
|
+
RUNNING: 1,
|
|
458
|
+
STOPPED: 2,
|
|
459
|
+
START_FROM_CRASH: 3,
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
LOG_RETAIN_IN_DAYS: 60,
|
|
463
|
+
EXPIRED_BLOCKLET_DATA_RETENTION_DAYS: 7,
|
|
464
|
+
|
|
465
|
+
BLOCKLET_INSTALL_TYPE: {
|
|
466
|
+
STORE: 'store',
|
|
467
|
+
URL: 'url',
|
|
468
|
+
DEV: 'dev',
|
|
469
|
+
CREATE: 'create',
|
|
470
|
+
RESTORE: 'restore',
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
// @link https://docs.nginx.com/nginx/admin-guide/content-cache/content-caching/
|
|
474
|
+
// @link https://www.sheshbabu.com/posts/nginx-caching-proxy/
|
|
475
|
+
// @link https://www.nginx.com/blog/nginx-caching-guide/
|
|
476
|
+
ROUTER_CACHE_GROUPS: {
|
|
477
|
+
blockletProxy: {
|
|
478
|
+
minSize: '8m',
|
|
479
|
+
maxSize: '2g',
|
|
480
|
+
period: '30d',
|
|
481
|
+
},
|
|
482
|
+
// TODO: disabled because we can not bust nginx cache effectively for now
|
|
483
|
+
// blockletJs: {
|
|
484
|
+
// minSize: '8m',
|
|
485
|
+
// maxSize: '64m',
|
|
486
|
+
// period: '5m',
|
|
487
|
+
// },
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
MAIN_CHAIN_ENDPOINT,
|
|
274
491
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.16.0-beta-b16cb035",
|
|
7
7
|
"description": "ABT Node constants",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"jest": "^27.
|
|
21
|
+
"jest": "^27.5.1"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "138bd91aee5a35b28c2de4e1e924c44932efaf3a"
|
|
24
24
|
}
|