@abtnode/core 1.16.44-beta-20250516-225119-c0b5ec8d → 1.16.44-beta-20250520-004606-6cd8a0d3

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.
@@ -1595,8 +1595,9 @@ class DiskBlockletManager extends BaseBlockletManager {
1595
1595
  }
1596
1596
 
1597
1597
  // Get blocklet by blockletDid or appDid
1598
- detail(
1598
+ async detail(
1599
1599
  {
1600
+ domain,
1600
1601
  did,
1601
1602
  attachConfig = true,
1602
1603
  attachRuntimeInfo = false,
@@ -1606,23 +1607,32 @@ class DiskBlockletManager extends BaseBlockletManager {
1606
1607
  },
1607
1608
  context
1608
1609
  ) {
1609
- if (!did) {
1610
+ let targetDid = did;
1611
+ if (domain) {
1612
+ const aliasDomainSite = await states.site.findByDomainAlias(domain);
1613
+ if (!aliasDomainSite) {
1614
+ return null;
1615
+ }
1616
+ targetDid = (aliasDomainSite.domain || '').replace('.blocklet-domain-group', '');
1617
+ }
1618
+
1619
+ if (!targetDid) {
1610
1620
  throw new Error('did should not be empty');
1611
1621
  }
1612
1622
 
1613
1623
  if (!attachConfig) {
1614
- return states.blocklet.getBlocklet(did);
1624
+ return states.blocklet.getBlocklet(targetDid);
1615
1625
  }
1616
1626
 
1617
1627
  if (attachRuntimeInfo) {
1618
- return this._attachRuntimeInfo({ did, diskInfo: !!attachDiskInfo, context, getOptionalComponents });
1628
+ return this._attachRuntimeInfo({ did: targetDid, diskInfo: !!attachDiskInfo, context, getOptionalComponents });
1619
1629
  }
1620
1630
 
1621
1631
  try {
1622
- return this.getBlocklet(did, { throwOnNotExist: false, getOptionalComponents, useCache });
1632
+ return this.getBlocklet(targetDid, { throwOnNotExist: false, getOptionalComponents, useCache });
1623
1633
  } catch (e) {
1624
1634
  logger.error('get blocklet detail error', { error: e });
1625
- return states.blocklet.getBlocklet(did);
1635
+ return states.blocklet.getBlocklet(targetDid);
1626
1636
  }
1627
1637
  }
1628
1638
 
@@ -38744,7 +38744,7 @@ module.exports = require("zlib");
38744
38744
  /***/ ((module) => {
38745
38745
 
38746
38746
  "use strict";
38747
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.43","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.43","@abtnode/auth":"1.16.43","@abtnode/certificate-manager":"1.16.43","@abtnode/client":"1.16.43","@abtnode/constant":"1.16.43","@abtnode/cron":"1.16.43","@abtnode/docker-utils":"1.16.43","@abtnode/logger":"1.16.43","@abtnode/models":"1.16.43","@abtnode/queue":"1.16.43","@abtnode/rbac":"1.16.43","@abtnode/router-provider":"1.16.43","@abtnode/static-server":"1.16.43","@abtnode/timemachine":"1.16.43","@abtnode/util":"1.16.43","@arcblock/did":"1.20.11","@arcblock/did-auth":"1.20.11","@arcblock/did-ext":"1.20.11","@arcblock/did-motif":"^1.1.13","@arcblock/did-util":"1.20.11","@arcblock/event-hub":"1.20.11","@arcblock/jwt":"1.20.11","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.20.11","@arcblock/vc":"1.20.11","@blocklet/constant":"1.16.43","@blocklet/did-space-js":"^1.0.53","@blocklet/env":"1.16.43","@blocklet/error":"^0.2.4","@blocklet/meta":"1.16.43","@blocklet/resolver":"1.16.43","@blocklet/sdk":"1.16.43","@blocklet/store":"1.16.43","@blocklet/theme":"^2.13.37","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.20.11","@ocap/util":"1.20.11","@ocap/wallet":"1.20.11","@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","lru-cache":"^11.0.2","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":"^9.0.1","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"}');
38747
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.43","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.43","@abtnode/auth":"1.16.43","@abtnode/certificate-manager":"1.16.43","@abtnode/client":"1.16.43","@abtnode/constant":"1.16.43","@abtnode/cron":"1.16.43","@abtnode/docker-utils":"1.16.43","@abtnode/logger":"1.16.43","@abtnode/models":"1.16.43","@abtnode/queue":"1.16.43","@abtnode/rbac":"1.16.43","@abtnode/router-provider":"1.16.43","@abtnode/static-server":"1.16.43","@abtnode/timemachine":"1.16.43","@abtnode/util":"1.16.43","@arcblock/did":"1.20.11","@arcblock/did-auth":"1.20.11","@arcblock/did-ext":"1.20.11","@arcblock/did-motif":"^1.1.13","@arcblock/did-util":"1.20.11","@arcblock/event-hub":"1.20.11","@arcblock/jwt":"1.20.11","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.20.11","@arcblock/vc":"1.20.11","@blocklet/constant":"1.16.43","@blocklet/did-space-js":"^1.0.53","@blocklet/env":"1.16.43","@blocklet/error":"^0.2.4","@blocklet/meta":"1.16.43","@blocklet/resolver":"1.16.43","@blocklet/sdk":"1.16.43","@blocklet/store":"1.16.43","@blocklet/theme":"^2.13.39","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.20.11","@ocap/util":"1.20.11","@ocap/wallet":"1.20.11","@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","lru-cache":"^11.0.2","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":"^9.0.1","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"}');
38748
38748
 
38749
38749
  /***/ }),
38750
38750
 
@@ -80,6 +80,8 @@ const connectByStudio = ({
80
80
  componentDid,
81
81
  messageId,
82
82
  createdBy: context.user.did,
83
+ autoUpload: true,
84
+ possibleSameStore: true,
83
85
  connectedStores: [nextStore],
84
86
  });
85
87
  } catch (error) {
@@ -87,7 +87,7 @@ const createPackRelease = async ({
87
87
  throw new Error('release not found');
88
88
  }
89
89
  if (release.status !== 'draft') {
90
- throw new Error('Can not update a published release');
90
+ throw new Error(`Can not update a published release: ${releaseId}`);
91
91
  }
92
92
  }
93
93
 
@@ -170,9 +170,31 @@ const checkUploadExists = async (projectDir, action, releaseId, uploadedResource
170
170
  throw new Error('Only zip or gz archives are supported as resources.');
171
171
  }
172
172
 
173
- const files = ['index.html', 'index.htm'];
174
- if (files.every((file) => fs.existsSync(path.join(resourceDir, file)) === false)) {
175
- throw new Error('The uploaded resource does not contain an index.html file in the root directory of the archive');
173
+ const hasHtmlFile = (dir) => {
174
+ const files = ['index.html', 'index.htm'];
175
+ return files.some((file) => fs.existsSync(path.join(dir, file)));
176
+ };
177
+
178
+ if (!hasHtmlFile(resourceDir)) {
179
+ const entries = fs.readdirSync(resourceDir, { withFileTypes: true });
180
+ const dirs = entries.filter((e) => e.isDirectory());
181
+ const files = entries.filter((e) => e.isFile());
182
+
183
+ // 如果只有一个文件夹,并且没有文件, 并且文件夹内有 index.html,则使用子文件夹作为根目录
184
+ if (dirs.length === 1 && files.length === 0) {
185
+ const subDir = path.join(resourceDir, dirs[0].name);
186
+ if (hasHtmlFile(subDir)) {
187
+ fs.copySync(subDir, resourceDir, { overwrite: true });
188
+ fs.rmSync(subDir, { recursive: true });
189
+ }
190
+ }
191
+ }
192
+
193
+ // 最终再次检查是否有 index.html
194
+ if (!hasHtmlFile(resourceDir)) {
195
+ throw new Error(
196
+ 'The uploaded resource does not contain an index.html file in the root directory or its only subdirectory'
197
+ );
176
198
  }
177
199
  };
178
200
 
@@ -18,9 +18,11 @@ class Project extends BaseState {
18
18
  connectedStores,
19
19
  createdBy,
20
20
  messageId,
21
+ autoUpload,
22
+ possibleSameStore,
21
23
  connectedEndpoints,
22
24
  }) {
23
- const doc = { id: blockletDid, type, blockletDid, blockletTitle, createdBy };
25
+ const doc = { id: blockletDid, type, blockletDid, blockletTitle, createdBy, autoUpload, possibleSameStore };
24
26
  if (componentDid) {
25
27
  doc.componentDid = componentDid;
26
28
  }
@@ -229,8 +229,9 @@ class TeamManager extends EventEmitter {
229
229
  });
230
230
 
231
231
  const validUsers = queryUsers.filter((user) => {
232
- const { passports } = user;
233
- if (passports.length && passports.some((x) => !this.isPassportExpired(x))) {
232
+ const { passports = [] } = user;
233
+ // 如果用户没有 passport,或者 有一个 passport 没有过期,则返回 true
234
+ if (!passports.length || passports.some((x) => !this.isPassportExpired(x))) {
234
235
  return true;
235
236
  }
236
237
  logger.warn(`user's passports are all expired: ${user.did}`);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.44-beta-20250516-225119-c0b5ec8d",
6
+ "version": "1.16.44-beta-20250520-004606-6cd8a0d3",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,21 +19,21 @@
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.44-beta-20250516-225119-c0b5ec8d",
23
- "@abtnode/auth": "1.16.44-beta-20250516-225119-c0b5ec8d",
24
- "@abtnode/certificate-manager": "1.16.44-beta-20250516-225119-c0b5ec8d",
25
- "@abtnode/client": "1.16.44-beta-20250516-225119-c0b5ec8d",
26
- "@abtnode/constant": "1.16.44-beta-20250516-225119-c0b5ec8d",
27
- "@abtnode/cron": "1.16.44-beta-20250516-225119-c0b5ec8d",
28
- "@abtnode/docker-utils": "1.16.44-beta-20250516-225119-c0b5ec8d",
29
- "@abtnode/logger": "1.16.44-beta-20250516-225119-c0b5ec8d",
30
- "@abtnode/models": "1.16.44-beta-20250516-225119-c0b5ec8d",
31
- "@abtnode/queue": "1.16.44-beta-20250516-225119-c0b5ec8d",
32
- "@abtnode/rbac": "1.16.44-beta-20250516-225119-c0b5ec8d",
33
- "@abtnode/router-provider": "1.16.44-beta-20250516-225119-c0b5ec8d",
34
- "@abtnode/static-server": "1.16.44-beta-20250516-225119-c0b5ec8d",
35
- "@abtnode/timemachine": "1.16.44-beta-20250516-225119-c0b5ec8d",
36
- "@abtnode/util": "1.16.44-beta-20250516-225119-c0b5ec8d",
22
+ "@abtnode/analytics": "1.16.44-beta-20250520-004606-6cd8a0d3",
23
+ "@abtnode/auth": "1.16.44-beta-20250520-004606-6cd8a0d3",
24
+ "@abtnode/certificate-manager": "1.16.44-beta-20250520-004606-6cd8a0d3",
25
+ "@abtnode/client": "1.16.44-beta-20250520-004606-6cd8a0d3",
26
+ "@abtnode/constant": "1.16.44-beta-20250520-004606-6cd8a0d3",
27
+ "@abtnode/cron": "1.16.44-beta-20250520-004606-6cd8a0d3",
28
+ "@abtnode/docker-utils": "1.16.44-beta-20250520-004606-6cd8a0d3",
29
+ "@abtnode/logger": "1.16.44-beta-20250520-004606-6cd8a0d3",
30
+ "@abtnode/models": "1.16.44-beta-20250520-004606-6cd8a0d3",
31
+ "@abtnode/queue": "1.16.44-beta-20250520-004606-6cd8a0d3",
32
+ "@abtnode/rbac": "1.16.44-beta-20250520-004606-6cd8a0d3",
33
+ "@abtnode/router-provider": "1.16.44-beta-20250520-004606-6cd8a0d3",
34
+ "@abtnode/static-server": "1.16.44-beta-20250520-004606-6cd8a0d3",
35
+ "@abtnode/timemachine": "1.16.44-beta-20250520-004606-6cd8a0d3",
36
+ "@abtnode/util": "1.16.44-beta-20250520-004606-6cd8a0d3",
37
37
  "@arcblock/did": "1.20.11",
38
38
  "@arcblock/did-auth": "1.20.11",
39
39
  "@arcblock/did-ext": "1.20.11",
@@ -44,15 +44,15 @@
44
44
  "@arcblock/pm2-events": "^0.0.5",
45
45
  "@arcblock/validator": "1.20.11",
46
46
  "@arcblock/vc": "1.20.11",
47
- "@blocklet/constant": "1.16.44-beta-20250516-225119-c0b5ec8d",
47
+ "@blocklet/constant": "1.16.44-beta-20250520-004606-6cd8a0d3",
48
48
  "@blocklet/did-space-js": "^1.0.53",
49
- "@blocklet/env": "1.16.44-beta-20250516-225119-c0b5ec8d",
49
+ "@blocklet/env": "1.16.44-beta-20250520-004606-6cd8a0d3",
50
50
  "@blocklet/error": "^0.2.4",
51
- "@blocklet/meta": "1.16.44-beta-20250516-225119-c0b5ec8d",
52
- "@blocklet/resolver": "1.16.44-beta-20250516-225119-c0b5ec8d",
53
- "@blocklet/sdk": "1.16.44-beta-20250516-225119-c0b5ec8d",
54
- "@blocklet/store": "1.16.44-beta-20250516-225119-c0b5ec8d",
55
- "@blocklet/theme": "^2.13.37",
51
+ "@blocklet/meta": "1.16.44-beta-20250520-004606-6cd8a0d3",
52
+ "@blocklet/resolver": "1.16.44-beta-20250520-004606-6cd8a0d3",
53
+ "@blocklet/sdk": "1.16.44-beta-20250520-004606-6cd8a0d3",
54
+ "@blocklet/store": "1.16.44-beta-20250520-004606-6cd8a0d3",
55
+ "@blocklet/theme": "^2.13.39",
56
56
  "@fidm/x509": "^1.2.1",
57
57
  "@ocap/mcrypto": "1.20.11",
58
58
  "@ocap/util": "1.20.11",
@@ -116,5 +116,5 @@
116
116
  "jest": "^29.7.0",
117
117
  "unzipper": "^0.10.11"
118
118
  },
119
- "gitHead": "eb15dee761c0ea273981c848992e5f29b94a69dc"
119
+ "gitHead": "105e9a3d56958052180da541acbf8b8739ddbd01"
120
120
  }