@abtnode/constant 1.8.31 → 1.8.32

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.
Files changed (2) hide show
  1. package/index.js +61 -19
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -14,54 +14,81 @@ const ROLES = Object.freeze({
14
14
  GUEST: 'guest',
15
15
  });
16
16
 
17
+ const SERVER_ROLES = Object.freeze({
18
+ ...ROLES,
19
+ CI: 'ci',
20
+ CERTIFICATE: 'certificate',
21
+ BLOCKLET: 'blocklet',
22
+ EXTERNAL_BLOCKLET_CONTROLLER: 'external-blocklet-controller',
23
+ EXTERNAL_BLOCKLETS_MANAGER: 'external-blocklets-manager',
24
+ });
25
+
26
+ const AUTH_CERT_TYPE = {
27
+ USER: 'user',
28
+ OWNERSHIP_NFT: 'ownership_nft',
29
+ BLOCKLET: 'blocklet',
30
+ BLOCKLET_CONTROLLER: 'blocklet_controller',
31
+ };
32
+
17
33
  const RBAC_CONFIG = {
18
34
  roles: Object.freeze([
19
35
  {
20
- name: ROLES.OWNER,
36
+ name: SERVER_ROLES.OWNER,
21
37
  title: 'Owner',
22
38
  description: 'Has full administrative access to the Blocklet Server',
23
39
  passport: true,
24
40
  },
25
41
  {
26
- name: ROLES.ADMIN,
42
+ name: SERVER_ROLES.ADMIN,
27
43
  title: 'Admin',
28
44
  description:
29
45
  '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',
30
46
  passport: true,
31
47
  },
32
48
  {
33
- name: ROLES.MEMBER,
49
+ name: SERVER_ROLES.MEMBER,
34
50
  title: 'Member',
35
51
  description:
36
52
  'Has permissions to manage blocklets, such as install/remove/start/stop blocklet, manage blocklet URL mapping and certificates',
37
53
  passport: true,
38
54
  },
39
55
  {
40
- name: ROLES.GUEST,
56
+ name: SERVER_ROLES.GUEST,
41
57
  title: 'Guest',
42
58
  description: 'Has all read permissions on Blocklet Server',
43
59
  passport: true,
44
60
  },
45
61
  {
46
- name: 'ci',
62
+ name: SERVER_ROLES.CI,
47
63
  title: 'CI',
48
64
  description: 'Deploy blocklet to Blocklet Server',
49
65
  passport: true,
50
- ci: true,
66
+ noHuman: true,
51
67
  },
52
68
  {
53
- name: 'certificate',
69
+ name: SERVER_ROLES.CERTIFICATE,
54
70
  title: 'Certificate',
55
71
  description: 'Manage https certificates for blocklets on the Blocklet Server',
56
72
  passport: true,
57
- ci: true,
73
+ noHuman: true,
58
74
  },
59
75
  {
60
- name: 'blocklet',
76
+ name: SERVER_ROLES.BLOCKLET,
61
77
  title: 'Blocklet',
62
78
  // passport: true, // TODO enable this when we support access key for manage single blocklet
63
- ci: true, // do not issue this passport to human
64
79
  },
80
+ {
81
+ name: SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER,
82
+ title: 'External Blocklet Controller',
83
+ },
84
+ {
85
+ name: SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER,
86
+ title: 'External Blocklets Manager',
87
+ description: 'Manage external blocklets in the Blocklet Server',
88
+ passport: true,
89
+ noHuman: true,
90
+ },
91
+ // for backward compatibility
65
92
  {
66
93
  name: NODE_SERVICES.AUTH_SERVICE,
67
94
  title: 'Auth Service',
@@ -147,7 +174,7 @@ const RBAC_CONFIG = {
147
174
  },
148
175
  ]),
149
176
  grants: Object.freeze({
150
- [ROLES.GUEST]: [
177
+ [SERVER_ROLES.GUEST]: [
151
178
  'query_blocklet',
152
179
  'query_router',
153
180
  'query_webhook',
@@ -157,20 +184,30 @@ const RBAC_CONFIG = {
157
184
  'query_node',
158
185
  'query_session',
159
186
  ],
160
- [ROLES.MEMBER]: [ROLES.GUEST, 'mutate_blocklet', 'mutate_router', 'mutate_notification', 'mutate_session'],
161
- [ROLES.ADMIN]: [
162
- ROLES.MEMBER,
187
+ [SERVER_ROLES.MEMBER]: [
188
+ SERVER_ROLES.GUEST,
189
+ 'mutate_blocklet',
190
+ 'mutate_router',
191
+ 'mutate_notification',
192
+ 'mutate_session',
193
+ ],
194
+ [SERVER_ROLES.ADMIN]: [
195
+ SERVER_ROLES.MEMBER,
163
196
  'mutate_team',
164
197
  'mutate_webhook',
165
198
  'mutate_accessKey',
166
199
  'mutate_node',
167
200
  'mutate_certificate',
168
201
  ],
169
- [ROLES.OWNER]: [ROLES.ADMIN],
170
- '@abtnode/auth-service': ['query_team', 'mutate_team'],
171
- ci: ['query_blocklet', 'mutate_blocklet'],
172
- certificate: ['query_certificate', 'mutate_certificate'],
173
- blocklet: ['query_team', 'mutate_team', 'manage_blocklet'],
202
+ [SERVER_ROLES.OWNER]: [ROLES.ADMIN],
203
+ [SERVER_ROLES.CI]: ['query_blocklet', 'mutate_blocklet'],
204
+ [SERVER_ROLES.CERTIFICATE]: ['query_certificate', 'mutate_certificate'],
205
+ [SERVER_ROLES.BLOCKLET]: ['query_team', 'mutate_team', 'manage_blocklet'],
206
+ [SERVER_ROLES.EXTERNAL_BLOCKLET_CONTROLLER]: ['query_blocklet', 'mutate_blocklet'],
207
+ [SERVER_ROLES.EXTERNAL_BLOCKLETS_MANAGER]: ['query_blocklet', 'mutate_blocklet'],
208
+
209
+ // for backwards compatibility
210
+ [NODE_SERVICES.AUTH_SERVICE]: ['query_team', 'mutate_team'],
174
211
  }),
175
212
  };
176
213
 
@@ -223,6 +260,7 @@ module.exports = Object.freeze({
223
260
  VC_TYPE_NODE_PASSPORT: 'ABTNodePassport',
224
261
  VC_TYPE_GENERAL_PASSPORT: 'NFTPassport',
225
262
 
263
+ VC_TYPE_SERVER_SHARE: 'BlockletServerShareCertificate',
226
264
  NFT_TYPE_SERVER_OWNERSHIP: 'BlockletServerOwnershipNFT',
227
265
 
228
266
  NODE_PACKAGE_NAME: '@abtnode/cli', // deprecated in 1.6.0
@@ -316,6 +354,8 @@ module.exports = Object.freeze({
316
354
 
317
355
  // Team
318
356
  ROLES,
357
+ SERVER_ROLES,
358
+ AUTH_CERT_TYPE,
319
359
  RBAC_CONFIG,
320
360
  genPermissionName: (resource, action = 'access') => `${action}_${resource.replace('_', '-')}`, // resource cannot include '_'
321
361
  PASSPORT_STATUS: {
@@ -341,4 +381,6 @@ module.exports = Object.freeze({
341
381
 
342
382
  // Store
343
383
  STORE_DETAIL_PAGE_PATH_PREFIX: '/blocklets',
384
+
385
+ MAX_USER_PAGE_SIZE: 100,
344
386
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.31",
6
+ "version": "1.8.32",
7
7
  "description": "ABT Node constants",
8
8
  "main": "index.js",
9
9
  "files": [
@@ -20,5 +20,5 @@
20
20
  "devDependencies": {
21
21
  "jest": "^27.5.1"
22
22
  },
23
- "gitHead": "f3cc8becdca1b8c5e645eb8cf751fa780cf09cfe"
23
+ "gitHead": "8502244aeda5926b3433c1dd9142e63233e3c23c"
24
24
  }