@abtnode/core 1.16.13-beta-423a40b1 → 1.16.13-beta-a83ad86d
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/lib/blocklet/manager/disk.js +6 -2
- package/lib/states/node.js +15 -4
- package/lib/validators/util.js +2 -4
- package/package.json +19 -19
|
@@ -1397,8 +1397,12 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
1397
1397
|
|
|
1398
1398
|
const sessionConfig = cloneDeep(blocklet.settings.session || {});
|
|
1399
1399
|
|
|
1400
|
-
|
|
1401
|
-
|
|
1400
|
+
if (validateConfig.cacheTtl) {
|
|
1401
|
+
sessionConfig.cacheTtl = validateConfig.cacheTtl;
|
|
1402
|
+
}
|
|
1403
|
+
if (validateConfig.ttl) {
|
|
1404
|
+
sessionConfig.ttl = validateConfig.ttl;
|
|
1405
|
+
}
|
|
1402
1406
|
|
|
1403
1407
|
await states.blockletExtras.setSettings(blocklet.meta.did, { session: sessionConfig });
|
|
1404
1408
|
|
package/lib/states/node.js
CHANGED
|
@@ -204,12 +204,19 @@ class NodeState extends BaseState {
|
|
|
204
204
|
return updated;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
updateNftHolder(holder) {
|
|
207
|
+
async updateNftHolder(holder) {
|
|
208
208
|
if (!holder) {
|
|
209
209
|
throw new Error('NFT holder can not be empty');
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
const { ownerNft } = await this.read();
|
|
213
|
+
if (isEmpty(ownerNft)) {
|
|
214
|
+
throw new Error('ownerNft is empty');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
ownerNft.holder = holder;
|
|
218
|
+
|
|
219
|
+
return this.update({ $set: { ownerNft } });
|
|
213
220
|
}
|
|
214
221
|
|
|
215
222
|
async enterMode(mode) {
|
|
@@ -273,8 +280,12 @@ class NodeState extends BaseState {
|
|
|
273
280
|
}
|
|
274
281
|
|
|
275
282
|
async updateGateway(gateway) {
|
|
283
|
+
const { routing } = await this.read();
|
|
284
|
+
routing.requestLimit = gateway.requestLimit;
|
|
285
|
+
routing.cacheEnabled = gateway.cacheEnabled;
|
|
286
|
+
|
|
276
287
|
const doc = await this.update({
|
|
277
|
-
$set: {
|
|
288
|
+
$set: { routing },
|
|
278
289
|
});
|
|
279
290
|
|
|
280
291
|
this.emit(EVENTS.RELOAD_GATEWAY, doc);
|
|
@@ -296,7 +307,7 @@ class NodeState extends BaseState {
|
|
|
296
307
|
}
|
|
297
308
|
|
|
298
309
|
async update(updates) {
|
|
299
|
-
await this.read();
|
|
310
|
+
await this.read(); // CAUTION: 这一行不要删,当 node state 不存在时,read() 会插入新数据
|
|
300
311
|
const [, [updated]] = await super.update({ did: this.config.nodeDid }, updates);
|
|
301
312
|
return updated;
|
|
302
313
|
}
|
package/lib/validators/util.js
CHANGED
|
@@ -25,12 +25,10 @@ const createValidator = (schema) => (entity) => schema.validateAsync(entity);
|
|
|
25
25
|
const sessionConfigSchema = Joi.object({
|
|
26
26
|
cacheTtl: Joi.number()
|
|
27
27
|
.min(5 * 60) // 5min
|
|
28
|
-
.max(86400) // 1d
|
|
29
|
-
.default(10 * 60), // 10min
|
|
28
|
+
.max(86400), // 1d
|
|
30
29
|
ttl: Joi.number()
|
|
31
30
|
.min(86400) // 1d
|
|
32
|
-
.max(86400 * 30) // 30d
|
|
33
|
-
.default(86400 * 7), // 7d
|
|
31
|
+
.max(86400 * 30), // 30d
|
|
34
32
|
});
|
|
35
33
|
|
|
36
34
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.13-beta-
|
|
6
|
+
"version": "1.16.13-beta-a83ad86d",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,32 +19,32 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/auth": "1.16.13-beta-
|
|
23
|
-
"@abtnode/certificate-manager": "1.16.13-beta-
|
|
24
|
-
"@abtnode/constant": "1.16.13-beta-
|
|
25
|
-
"@abtnode/cron": "1.16.13-beta-
|
|
26
|
-
"@abtnode/logger": "1.16.13-beta-
|
|
27
|
-
"@abtnode/models": "1.16.13-beta-
|
|
28
|
-
"@abtnode/queue": "1.16.13-beta-
|
|
29
|
-
"@abtnode/rbac": "1.16.13-beta-
|
|
30
|
-
"@abtnode/router-provider": "1.16.13-beta-
|
|
31
|
-
"@abtnode/static-server": "1.16.13-beta-
|
|
32
|
-
"@abtnode/timemachine": "1.16.13-beta-
|
|
33
|
-
"@abtnode/util": "1.16.13-beta-
|
|
22
|
+
"@abtnode/auth": "1.16.13-beta-a83ad86d",
|
|
23
|
+
"@abtnode/certificate-manager": "1.16.13-beta-a83ad86d",
|
|
24
|
+
"@abtnode/constant": "1.16.13-beta-a83ad86d",
|
|
25
|
+
"@abtnode/cron": "1.16.13-beta-a83ad86d",
|
|
26
|
+
"@abtnode/logger": "1.16.13-beta-a83ad86d",
|
|
27
|
+
"@abtnode/models": "1.16.13-beta-a83ad86d",
|
|
28
|
+
"@abtnode/queue": "1.16.13-beta-a83ad86d",
|
|
29
|
+
"@abtnode/rbac": "1.16.13-beta-a83ad86d",
|
|
30
|
+
"@abtnode/router-provider": "1.16.13-beta-a83ad86d",
|
|
31
|
+
"@abtnode/static-server": "1.16.13-beta-a83ad86d",
|
|
32
|
+
"@abtnode/timemachine": "1.16.13-beta-a83ad86d",
|
|
33
|
+
"@abtnode/util": "1.16.13-beta-a83ad86d",
|
|
34
34
|
"@arcblock/did": "1.18.84",
|
|
35
35
|
"@arcblock/did-auth": "1.18.84",
|
|
36
36
|
"@arcblock/did-ext": "^1.18.84",
|
|
37
|
-
"@arcblock/did-motif": "^1.1.
|
|
37
|
+
"@arcblock/did-motif": "^1.1.12",
|
|
38
38
|
"@arcblock/did-util": "1.18.84",
|
|
39
39
|
"@arcblock/event-hub": "1.18.84",
|
|
40
40
|
"@arcblock/jwt": "^1.18.84",
|
|
41
41
|
"@arcblock/pm2-events": "^0.0.5",
|
|
42
42
|
"@arcblock/validator": "^1.18.84",
|
|
43
43
|
"@arcblock/vc": "1.18.84",
|
|
44
|
-
"@blocklet/constant": "1.16.13-beta-
|
|
45
|
-
"@blocklet/meta": "1.16.13-beta-
|
|
46
|
-
"@blocklet/resolver": "1.16.13-beta-
|
|
47
|
-
"@blocklet/sdk": "1.16.13-beta-
|
|
44
|
+
"@blocklet/constant": "1.16.13-beta-a83ad86d",
|
|
45
|
+
"@blocklet/meta": "1.16.13-beta-a83ad86d",
|
|
46
|
+
"@blocklet/resolver": "1.16.13-beta-a83ad86d",
|
|
47
|
+
"@blocklet/sdk": "1.16.13-beta-a83ad86d",
|
|
48
48
|
"@did-space/client": "^0.2.117",
|
|
49
49
|
"@fidm/x509": "^1.2.1",
|
|
50
50
|
"@ocap/mcrypto": "1.18.84",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"express": "^4.18.2",
|
|
98
98
|
"jest": "^27.5.1"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "dc2a4f7d5b55da109ebf873d8aa4d24f27a088c9"
|
|
101
101
|
}
|