@abtnode/core 1.16.24-beta-6975c2c0 → 1.16.24-beta-30f58f8d
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/states/user.js
CHANGED
|
@@ -188,7 +188,7 @@ class User extends ExtendBase {
|
|
|
188
188
|
// eslint-disable-next-line require-await
|
|
189
189
|
async getUsers({ query, sort, paging } = {}) {
|
|
190
190
|
const where = {};
|
|
191
|
-
const { approved, role, search, tags, includeTags } = query || {};
|
|
191
|
+
const { approved, role, search, tags, includeTags, includePassports } = query || {};
|
|
192
192
|
const shouldIncludeTag = (tags && tags.length) || includeTags;
|
|
193
193
|
|
|
194
194
|
if (isNullOrUndefined(approved) === false) {
|
|
@@ -224,18 +224,39 @@ class User extends ExtendBase {
|
|
|
224
224
|
if (!Object.keys(sorting).length) {
|
|
225
225
|
sorting.createdAt = -1;
|
|
226
226
|
}
|
|
227
|
+
const include = [];
|
|
228
|
+
if (shouldIncludeTag) {
|
|
229
|
+
include.push(this.getTagInclude(tags));
|
|
230
|
+
}
|
|
231
|
+
if (includePassports) {
|
|
232
|
+
include.push({
|
|
233
|
+
model: this.models.Passport,
|
|
234
|
+
as: 'passports',
|
|
235
|
+
});
|
|
236
|
+
}
|
|
227
237
|
|
|
228
|
-
return this.paginate({ where, include
|
|
238
|
+
return this.paginate({ where, include }, sorting, paging);
|
|
229
239
|
}
|
|
230
240
|
|
|
231
241
|
// eslint-disable-next-line require-await
|
|
232
242
|
async getUsersByDids({ dids, query }) {
|
|
233
|
-
const { approved, includeTags } = query || {};
|
|
243
|
+
const { approved, includeTags, includePassports } = query || {};
|
|
234
244
|
const condition = { did: dids };
|
|
235
245
|
if (isNullOrUndefined(approved) === false) {
|
|
236
246
|
condition.approved = !!approved;
|
|
237
247
|
}
|
|
238
|
-
|
|
248
|
+
const include = [];
|
|
249
|
+
if (includeTags) {
|
|
250
|
+
include.push(this.getTagInclude());
|
|
251
|
+
}
|
|
252
|
+
if (includePassports) {
|
|
253
|
+
include.push({
|
|
254
|
+
model: this.models.Passport,
|
|
255
|
+
as: 'passports',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return this.find({ where: condition, include });
|
|
239
260
|
}
|
|
240
261
|
|
|
241
262
|
// eslint-disable-next-line require-await
|
package/lib/util/blocklet.js
CHANGED
|
@@ -106,6 +106,7 @@ const { validate: validateEngine, get: getEngine } = require('../blocklet/manage
|
|
|
106
106
|
const isRequirementsSatisfied = require('./requirement');
|
|
107
107
|
const { getDidDomainForBlocklet } = require('./get-domain-for-blocklet');
|
|
108
108
|
const { expandBundle, findInterfacePortByName, prettyURL, templateReplace, getServerDidDomain } = require('./index');
|
|
109
|
+
const { installExternalDependencies } = require('./install-external-dependencies');
|
|
109
110
|
|
|
110
111
|
/**
|
|
111
112
|
* get blocklet engine info, default is node
|
|
@@ -564,6 +565,9 @@ const startBlockletProcess = async (
|
|
|
564
565
|
const env = getRuntimeEnvironments(b, nodeEnvironments, ancestors);
|
|
565
566
|
const startedAt = Date.now();
|
|
566
567
|
|
|
568
|
+
// install external dependencies
|
|
569
|
+
await Promise.resolve(installExternalDependencies(b, { env }));
|
|
570
|
+
|
|
567
571
|
// run hook
|
|
568
572
|
await preFlight(b, { env });
|
|
569
573
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function installExternalDependencies(blocklet, { env }) {
|
|
6
|
+
if (!env.BLOCKLET_APP_DIR) {
|
|
7
|
+
throw new Error('BLOCKLET_APP_DIR is required');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 读取 BLOCKLET_APP_DIR 的 package.json
|
|
11
|
+
const packageJsonPath = path.resolve(env.BLOCKLET_APP_DIR, 'package.json');
|
|
12
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const packageJson = fs.readJsonSync(packageJsonPath);
|
|
17
|
+
|
|
18
|
+
if (!packageJson.externalManager) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const result = spawnSync(packageJson.externalManager, ['install'], {
|
|
23
|
+
cwd: env.BLOCKLET_APP_DIR,
|
|
24
|
+
stdio: 'pipe',
|
|
25
|
+
shell: true,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (result.status !== 0 && result.stderr && result.stderr.toString().trim()) {
|
|
29
|
+
throw new Error(result.stderr.toString());
|
|
30
|
+
}
|
|
31
|
+
if (result.error) {
|
|
32
|
+
throw result.error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
module.exports = { installExternalDependencies };
|
|
@@ -11,6 +11,7 @@ class WalletSender extends BaseSender {
|
|
|
11
11
|
const sender = {
|
|
12
12
|
appDid: nodeInfo.did,
|
|
13
13
|
appSk: nodeInfo.sk,
|
|
14
|
+
type: 'server',
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const message = {
|
|
@@ -18,7 +19,11 @@ class WalletSender extends BaseSender {
|
|
|
18
19
|
body: description,
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
const { users } = await node.getUsers({
|
|
22
|
+
const { users } = await node.getUsers({
|
|
23
|
+
teamDid: nodeInfo.did,
|
|
24
|
+
paging: { pageSize: 100 },
|
|
25
|
+
query: { includePassports: true },
|
|
26
|
+
});
|
|
22
27
|
const adminUsers = users
|
|
23
28
|
.filter(
|
|
24
29
|
(x) =>
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.24-beta-
|
|
6
|
+
"version": "1.16.24-beta-30f58f8d",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
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.24-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.24-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.24-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.24-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.24-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.24-beta-
|
|
28
|
-
"@abtnode/models": "1.16.24-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.24-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.24-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.24-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.24-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.24-beta-
|
|
34
|
-
"@abtnode/util": "1.16.24-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.24-beta-30f58f8d",
|
|
23
|
+
"@abtnode/auth": "1.16.24-beta-30f58f8d",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.24-beta-30f58f8d",
|
|
25
|
+
"@abtnode/constant": "1.16.24-beta-30f58f8d",
|
|
26
|
+
"@abtnode/cron": "1.16.24-beta-30f58f8d",
|
|
27
|
+
"@abtnode/logger": "1.16.24-beta-30f58f8d",
|
|
28
|
+
"@abtnode/models": "1.16.24-beta-30f58f8d",
|
|
29
|
+
"@abtnode/queue": "1.16.24-beta-30f58f8d",
|
|
30
|
+
"@abtnode/rbac": "1.16.24-beta-30f58f8d",
|
|
31
|
+
"@abtnode/router-provider": "1.16.24-beta-30f58f8d",
|
|
32
|
+
"@abtnode/static-server": "1.16.24-beta-30f58f8d",
|
|
33
|
+
"@abtnode/timemachine": "1.16.24-beta-30f58f8d",
|
|
34
|
+
"@abtnode/util": "1.16.24-beta-30f58f8d",
|
|
35
35
|
"@arcblock/did": "1.18.110",
|
|
36
36
|
"@arcblock/did-auth": "1.18.110",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.110",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.110",
|
|
44
44
|
"@arcblock/vc": "1.18.110",
|
|
45
|
-
"@blocklet/constant": "1.16.24-beta-
|
|
46
|
-
"@blocklet/env": "1.16.24-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.24-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.24-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.24-beta-
|
|
50
|
-
"@did-space/client": "^0.3.
|
|
45
|
+
"@blocklet/constant": "1.16.24-beta-30f58f8d",
|
|
46
|
+
"@blocklet/env": "1.16.24-beta-30f58f8d",
|
|
47
|
+
"@blocklet/meta": "1.16.24-beta-30f58f8d",
|
|
48
|
+
"@blocklet/resolver": "1.16.24-beta-30f58f8d",
|
|
49
|
+
"@blocklet/sdk": "1.16.24-beta-30f58f8d",
|
|
50
|
+
"@did-space/client": "^0.3.64",
|
|
51
51
|
"@fidm/x509": "^1.2.1",
|
|
52
52
|
"@ocap/mcrypto": "1.18.110",
|
|
53
53
|
"@ocap/util": "1.18.110",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"jest": "^29.7.0",
|
|
103
103
|
"unzipper": "^0.10.11"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "95f8e79898d7901f0665f3883e3c014c36f16668"
|
|
106
106
|
}
|