@abtnode/core 1.16.47-beta-20250729-133234-77359596 → 1.16.47-beta-20250731-014139-e860268f

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.
@@ -1147,6 +1147,11 @@ class DiskBlockletManager extends BaseBlockletManager {
1147
1147
  try {
1148
1148
  const blocklet = await this.getBlocklet(input.appPid);
1149
1149
  if (blocklet) {
1150
+ this.emit(BlockletEvents.restoreProgress, {
1151
+ appDid: input.appDid,
1152
+ meta: { did: input.appPid },
1153
+ status: RESTORE_PROGRESS_STATUS.waiting,
1154
+ });
1150
1155
  await this.delete({ did: input.appPid, keepData: false, keepLogsDir: false, keepConfigs: false }, context);
1151
1156
  }
1152
1157
  } catch (error) {
@@ -38918,7 +38918,7 @@ module.exports = require("zlib");
38918
38918
  /***/ ((module) => {
38919
38919
 
38920
38920
  "use strict";
38921
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.46","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.46","@abtnode/auth":"1.16.46","@abtnode/certificate-manager":"1.16.46","@abtnode/client":"1.16.46","@abtnode/constant":"1.16.46","@abtnode/cron":"1.16.46","@abtnode/db-cache":"1.16.46","@abtnode/docker-utils":"1.16.46","@abtnode/logger":"1.16.46","@abtnode/models":"1.16.46","@abtnode/queue":"1.16.46","@abtnode/rbac":"1.16.46","@abtnode/router-provider":"1.16.46","@abtnode/static-server":"1.16.46","@abtnode/timemachine":"1.16.46","@abtnode/util":"1.16.46","@aigne/aigne-hub":"^0.2.2","@arcblock/did":"1.21.0","@arcblock/did-auth":"1.21.0","@arcblock/did-ext":"1.21.0","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"1.21.0","@arcblock/event-hub":"1.21.0","@arcblock/jwt":"1.21.0","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.21.0","@arcblock/vc":"1.21.0","@blocklet/constant":"1.16.46","@blocklet/did-space-js":"^1.1.10","@blocklet/env":"1.16.46","@blocklet/error":"^0.2.5","@blocklet/meta":"1.16.46","@blocklet/resolver":"1.16.46","@blocklet/sdk":"1.16.46","@blocklet/store":"1.16.46","@blocklet/theme":"^3.0.35","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.21.0","@ocap/util":"1.21.0","@ocap/wallet":"1.21.0","@slack/webhook":"^5.0.4","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"expand-tilde":"^2.0.2","express":"^4.18.2","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
38921
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.46","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.46","@abtnode/auth":"1.16.46","@abtnode/certificate-manager":"1.16.46","@abtnode/client":"1.16.46","@abtnode/constant":"1.16.46","@abtnode/cron":"1.16.46","@abtnode/db-cache":"1.16.46","@abtnode/docker-utils":"1.16.46","@abtnode/logger":"1.16.46","@abtnode/models":"1.16.46","@abtnode/queue":"1.16.46","@abtnode/rbac":"1.16.46","@abtnode/router-provider":"1.16.46","@abtnode/static-server":"1.16.46","@abtnode/timemachine":"1.16.46","@abtnode/util":"1.16.46","@aigne/aigne-hub":"^0.2.2","@arcblock/did":"1.21.0","@arcblock/did-auth":"1.21.0","@arcblock/did-ext":"1.21.0","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"1.21.0","@arcblock/event-hub":"1.21.0","@arcblock/jwt":"1.21.0","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.21.0","@arcblock/vc":"1.21.0","@blocklet/constant":"1.16.46","@blocklet/did-space-js":"^1.1.10","@blocklet/env":"1.16.46","@blocklet/error":"^0.2.5","@blocklet/meta":"1.16.46","@blocklet/resolver":"1.16.46","@blocklet/sdk":"1.16.46","@blocklet/store":"1.16.46","@blocklet/theme":"^3.0.36","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.21.0","@ocap/util":"1.21.0","@ocap/wallet":"1.21.0","@slack/webhook":"^5.0.4","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"expand-tilde":"^2.0.2","express":"^4.18.2","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
38922
38922
 
38923
38923
  /***/ }),
38924
38924
 
@@ -69,16 +69,26 @@ async function addBlockletSecurityRule({ teamManager }, { did, data }) {
69
69
  this.emit(BlockletEvents.securityConfigUpdated, { did });
70
70
  return result;
71
71
  }
72
- // HACK: 由于需要使用 this.emit,所以这里不能使用箭头函数(尝试过传入 emit,会报错,目前只能这样)
73
- async function updateBlockletSecurityRule({ teamManager }, { did, data }) {
74
- const { securityRuleState } = await teamManager.getSecurityState(did);
72
+
73
+ function parseUpdateBlockletSecurityRule(data) {
75
74
  const { value, error } = securityRuleSchema
76
75
  .concat(
77
76
  Joi.object({
78
77
  id: Joi.string().required(),
78
+ componentDid: Joi.when('id', {
79
+ is: 'default',
80
+ then: Joi.optional().strip(), // 当 id 为 'default' 时删除 componentDid 字段
81
+ otherwise: securityRuleSchema.extract('componentDid'),
82
+ }),
79
83
  })
80
84
  )
81
85
  .validate(data);
86
+ return { value, error };
87
+ }
88
+ // HACK: 由于需要使用 this.emit,所以这里不能使用箭头函数(尝试过传入 emit,会报错,目前只能这样)
89
+ async function updateBlockletSecurityRule({ teamManager }, { did, data }) {
90
+ const { securityRuleState } = await teamManager.getSecurityState(did);
91
+ const { value, error } = parseUpdateBlockletSecurityRule(data);
82
92
  if (error) {
83
93
  logger.error('Failed to update blocklet security rule', {
84
94
  error,
@@ -124,4 +134,5 @@ module.exports = {
124
134
  updateBlockletSecurityRule,
125
135
  deleteBlockletSecurityRule,
126
136
  initializeDefaultData,
137
+ parseUpdateBlockletSecurityRule,
127
138
  };
@@ -249,7 +249,12 @@ class BlockletState extends BaseState {
249
249
  try {
250
250
  fixPerson(meta);
251
251
  fixInterfaces(meta);
252
- let sanitized = validateBlockletMeta(meta);
252
+ const { requirements, ...rest } = meta;
253
+ let sanitized = validateBlockletMeta(rest);
254
+ // 补充传入的 requirements.aigne 字段
255
+ if (sanitized.requirements && requirements) {
256
+ sanitized.requirements.aigne = requirements.aigne || false;
257
+ }
253
258
  // bundle info
254
259
  sanitized = ensureMeta(sanitized);
255
260
  sanitized = omit(sanitized, ['htmlAst']);
@@ -265,13 +265,13 @@ class NotificationState extends BaseState {
265
265
  const sourceOrComponentDid = [];
266
266
  sourceOrComponentDid.push('n.source IN (:source)');
267
267
  if (componentDid && componentDid.length) {
268
- sourceOrComponentDid.push('n.componentDid IN (:componentDid)');
268
+ sourceOrComponentDid.push('n."componentDid" IN (:componentDid)');
269
269
  replacements.componentDid = componentDid;
270
270
  }
271
271
  conditions.push(`(${sourceOrComponentDid.join(' OR ')})`);
272
272
  replacements.source = source;
273
273
  } else if (componentDid && componentDid.length) {
274
- conditions.push('n.componentDid IN (:componentDid)');
274
+ conditions.push('n."componentDid" IN (:componentDid)');
275
275
  replacements.componentDid = componentDid;
276
276
  }
277
277
 
@@ -893,13 +893,13 @@ class NotificationState extends BaseState {
893
893
  const sourceOrComponentDid = [];
894
894
  sourceOrComponentDid.push('n.source IN (:source)');
895
895
  if (componentDid && componentDid.length) {
896
- sourceOrComponentDid.push('n.componentDid IN (:componentDid)');
896
+ sourceOrComponentDid.push('n."componentDid" IN (:componentDid)');
897
897
  replacements.componentDid = componentDid;
898
898
  }
899
899
  conditions.push(`(${sourceOrComponentDid.join(' OR ')})`);
900
900
  replacements.source = source;
901
901
  } else if (componentDid && componentDid.length) {
902
- conditions.push('n.componentDid IN (:componentDid)');
902
+ conditions.push('n."componentDid" IN (:componentDid)');
903
903
  replacements.componentDid = componentDid;
904
904
  }
905
905
 
@@ -261,11 +261,6 @@ class User extends ExtendBase {
261
261
  where.approved = approved;
262
262
  }
263
263
 
264
- const sorting = pickBy(sort, (x) => !isNullOrUndefined(x));
265
- if (!Object.keys(sorting).length) {
266
- sorting.createdAt = -1;
267
- }
268
-
269
264
  if (search) {
270
265
  if (search.length > 50) {
271
266
  throw new CustomError(400, 'the length of search text should not more than 50');
@@ -385,6 +380,28 @@ SELECT did,inviter,generation FROM UserTree`.trim();
385
380
  include.push(this.getConnectedInclude());
386
381
  }
387
382
 
383
+ const dialect = this.model.sequelize.getDialect();
384
+ const isPostgres = dialect === 'postgres';
385
+
386
+ const sorting = [];
387
+ const cleanedSort = pickBy(sort, (x) => !isNullOrUndefined(x));
388
+ if (cleanedSort.lastLoginAt) {
389
+ const direction = cleanedSort.lastLoginAt === -1 ? 'DESC' : 'ASC';
390
+ if (isPostgres) {
391
+ sorting.push(Sequelize.literal(`"lastLoginAt" ${direction} NULLS LAST`));
392
+ } else {
393
+ sorting.push(['lastLoginAt', direction]); // SQLite 等不支持 NULLS LAST 语法,DESC 默认就是 NULLS LAST
394
+ }
395
+ } else if (Object.keys(cleanedSort).length) {
396
+ for (const [key, dir] of Object.entries(cleanedSort)) {
397
+ if (key !== 'lastLoginAt') {
398
+ sorting.push([key, dir === -1 ? 'DESC' : 'ASC']);
399
+ }
400
+ }
401
+ } else {
402
+ sorting.push(['createdAt', 'DESC']);
403
+ }
404
+
388
405
  const result = await this.paginate({ where, include, replacements }, sorting, paging);
389
406
  return { list: result.list, paging: { ...result.paging, total: total || result.paging.total } };
390
407
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.47-beta-20250729-133234-77359596",
6
+ "version": "1.16.47-beta-20250731-014139-e860268f",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,22 +19,22 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "Apache-2.0",
21
21
  "dependencies": {
22
- "@abtnode/analytics": "1.16.47-beta-20250729-133234-77359596",
23
- "@abtnode/auth": "1.16.47-beta-20250729-133234-77359596",
24
- "@abtnode/certificate-manager": "1.16.47-beta-20250729-133234-77359596",
25
- "@abtnode/client": "1.16.47-beta-20250729-133234-77359596",
26
- "@abtnode/constant": "1.16.47-beta-20250729-133234-77359596",
27
- "@abtnode/cron": "1.16.47-beta-20250729-133234-77359596",
28
- "@abtnode/db-cache": "1.16.47-beta-20250729-133234-77359596",
29
- "@abtnode/docker-utils": "1.16.47-beta-20250729-133234-77359596",
30
- "@abtnode/logger": "1.16.47-beta-20250729-133234-77359596",
31
- "@abtnode/models": "1.16.47-beta-20250729-133234-77359596",
32
- "@abtnode/queue": "1.16.47-beta-20250729-133234-77359596",
33
- "@abtnode/rbac": "1.16.47-beta-20250729-133234-77359596",
34
- "@abtnode/router-provider": "1.16.47-beta-20250729-133234-77359596",
35
- "@abtnode/static-server": "1.16.47-beta-20250729-133234-77359596",
36
- "@abtnode/timemachine": "1.16.47-beta-20250729-133234-77359596",
37
- "@abtnode/util": "1.16.47-beta-20250729-133234-77359596",
22
+ "@abtnode/analytics": "1.16.47-beta-20250731-014139-e860268f",
23
+ "@abtnode/auth": "1.16.47-beta-20250731-014139-e860268f",
24
+ "@abtnode/certificate-manager": "1.16.47-beta-20250731-014139-e860268f",
25
+ "@abtnode/client": "1.16.47-beta-20250731-014139-e860268f",
26
+ "@abtnode/constant": "1.16.47-beta-20250731-014139-e860268f",
27
+ "@abtnode/cron": "1.16.47-beta-20250731-014139-e860268f",
28
+ "@abtnode/db-cache": "1.16.47-beta-20250731-014139-e860268f",
29
+ "@abtnode/docker-utils": "1.16.47-beta-20250731-014139-e860268f",
30
+ "@abtnode/logger": "1.16.47-beta-20250731-014139-e860268f",
31
+ "@abtnode/models": "1.16.47-beta-20250731-014139-e860268f",
32
+ "@abtnode/queue": "1.16.47-beta-20250731-014139-e860268f",
33
+ "@abtnode/rbac": "1.16.47-beta-20250731-014139-e860268f",
34
+ "@abtnode/router-provider": "1.16.47-beta-20250731-014139-e860268f",
35
+ "@abtnode/static-server": "1.16.47-beta-20250731-014139-e860268f",
36
+ "@abtnode/timemachine": "1.16.47-beta-20250731-014139-e860268f",
37
+ "@abtnode/util": "1.16.47-beta-20250731-014139-e860268f",
38
38
  "@aigne/aigne-hub": "^0.2.2",
39
39
  "@arcblock/did": "1.21.0",
40
40
  "@arcblock/did-auth": "1.21.0",
@@ -46,15 +46,15 @@
46
46
  "@arcblock/pm2-events": "^0.0.5",
47
47
  "@arcblock/validator": "1.21.0",
48
48
  "@arcblock/vc": "1.21.0",
49
- "@blocklet/constant": "1.16.47-beta-20250729-133234-77359596",
49
+ "@blocklet/constant": "1.16.47-beta-20250731-014139-e860268f",
50
50
  "@blocklet/did-space-js": "^1.1.10",
51
- "@blocklet/env": "1.16.47-beta-20250729-133234-77359596",
51
+ "@blocklet/env": "1.16.47-beta-20250731-014139-e860268f",
52
52
  "@blocklet/error": "^0.2.5",
53
- "@blocklet/meta": "1.16.47-beta-20250729-133234-77359596",
54
- "@blocklet/resolver": "1.16.47-beta-20250729-133234-77359596",
55
- "@blocklet/sdk": "1.16.47-beta-20250729-133234-77359596",
56
- "@blocklet/store": "1.16.47-beta-20250729-133234-77359596",
57
- "@blocklet/theme": "^3.0.35",
53
+ "@blocklet/meta": "1.16.47-beta-20250731-014139-e860268f",
54
+ "@blocklet/resolver": "1.16.47-beta-20250731-014139-e860268f",
55
+ "@blocklet/sdk": "1.16.47-beta-20250731-014139-e860268f",
56
+ "@blocklet/store": "1.16.47-beta-20250731-014139-e860268f",
57
+ "@blocklet/theme": "^3.0.36",
58
58
  "@fidm/x509": "^1.2.1",
59
59
  "@ocap/mcrypto": "1.21.0",
60
60
  "@ocap/util": "1.21.0",
@@ -117,5 +117,5 @@
117
117
  "jest": "^29.7.0",
118
118
  "unzipper": "^0.10.11"
119
119
  },
120
- "gitHead": "d5471eebcaa862d418d48b373ddd37b8150ba571"
120
+ "gitHead": "85b5870be6b7a531cd7a86bd132112d68547fde1"
121
121
  }