@abtnode/core 1.16.44-beta-20250516-225119-c0b5ec8d → 1.16.44-beta-20250518-020443-77ba168f

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.
@@ -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-20250518-020443-77ba168f",
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-20250518-020443-77ba168f",
23
+ "@abtnode/auth": "1.16.44-beta-20250518-020443-77ba168f",
24
+ "@abtnode/certificate-manager": "1.16.44-beta-20250518-020443-77ba168f",
25
+ "@abtnode/client": "1.16.44-beta-20250518-020443-77ba168f",
26
+ "@abtnode/constant": "1.16.44-beta-20250518-020443-77ba168f",
27
+ "@abtnode/cron": "1.16.44-beta-20250518-020443-77ba168f",
28
+ "@abtnode/docker-utils": "1.16.44-beta-20250518-020443-77ba168f",
29
+ "@abtnode/logger": "1.16.44-beta-20250518-020443-77ba168f",
30
+ "@abtnode/models": "1.16.44-beta-20250518-020443-77ba168f",
31
+ "@abtnode/queue": "1.16.44-beta-20250518-020443-77ba168f",
32
+ "@abtnode/rbac": "1.16.44-beta-20250518-020443-77ba168f",
33
+ "@abtnode/router-provider": "1.16.44-beta-20250518-020443-77ba168f",
34
+ "@abtnode/static-server": "1.16.44-beta-20250518-020443-77ba168f",
35
+ "@abtnode/timemachine": "1.16.44-beta-20250518-020443-77ba168f",
36
+ "@abtnode/util": "1.16.44-beta-20250518-020443-77ba168f",
37
37
  "@arcblock/did": "1.20.11",
38
38
  "@arcblock/did-auth": "1.20.11",
39
39
  "@arcblock/did-ext": "1.20.11",
@@ -44,14 +44,14 @@
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-20250518-020443-77ba168f",
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-20250518-020443-77ba168f",
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",
51
+ "@blocklet/meta": "1.16.44-beta-20250518-020443-77ba168f",
52
+ "@blocklet/resolver": "1.16.44-beta-20250518-020443-77ba168f",
53
+ "@blocklet/sdk": "1.16.44-beta-20250518-020443-77ba168f",
54
+ "@blocklet/store": "1.16.44-beta-20250518-020443-77ba168f",
55
55
  "@blocklet/theme": "^2.13.37",
56
56
  "@fidm/x509": "^1.2.1",
57
57
  "@ocap/mcrypto": "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": "8464d53e8d44b255afa6032e37d8d4ab7be76e67"
120
120
  }