@abtnode/core 1.16.30 → 1.16.31-beta-52250475

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.
@@ -206,17 +206,19 @@ class User extends ExtendBase {
206
206
  }
207
207
  }
208
208
 
209
+ const replacements = {};
210
+
209
211
  if (role && role !== '$all' && !where.did) {
212
+ replacements.status = PASSPORT_STATUS.VALID;
210
213
  if (role === '$none') {
211
214
  where.did = {
212
- [Op.notIn]: Sequelize.literal(
213
- `(SELECT DISTINCT userDid FROM passports WHERE status = '${PASSPORT_STATUS.VALID}')`
214
- ),
215
+ [Op.notIn]: Sequelize.literal('(SELECT DISTINCT userDid FROM passports WHERE status = :status)'),
215
216
  };
216
217
  } else {
218
+ replacements.role = role;
217
219
  where.did = {
218
220
  [Op.in]: Sequelize.literal(
219
- `(SELECT DISTINCT userDid FROM passports WHERE name = '${role}' AND status = '${PASSPORT_STATUS.VALID}')`
221
+ '(SELECT DISTINCT userDid FROM passports WHERE name = :role AND status = :status)'
220
222
  ),
221
223
  };
222
224
  }
@@ -246,7 +248,8 @@ class User extends ExtendBase {
246
248
  required: false,
247
249
  });
248
250
  }
249
- const result = await this.paginate({ where, include }, sorting, paging);
251
+
252
+ const result = await this.paginate({ where, include, replacements }, sorting, paging);
250
253
  return result;
251
254
  }
252
255
 
@@ -287,11 +290,10 @@ class User extends ExtendBase {
287
290
  return this.count({
288
291
  where: {
289
292
  did: {
290
- [Op.notIn]: Sequelize.literal(
291
- `(SELECT DISTINCT userDid FROM passports WHERE status = '${PASSPORT_STATUS.VALID}')`
292
- ),
293
+ [Op.notIn]: Sequelize.literal('(SELECT DISTINCT userDid FROM passports WHERE status = :status)'),
293
294
  },
294
295
  },
296
+ replacements: { status: PASSPORT_STATUS.VALID },
295
297
  });
296
298
  }
297
299
 
@@ -305,10 +307,11 @@ class User extends ExtendBase {
305
307
  where: {
306
308
  did: {
307
309
  [Op.in]: Sequelize.literal(
308
- `(SELECT DISTINCT userDid FROM passports WHERE name = '${name}' AND status = '${status}')`
310
+ '(SELECT DISTINCT userDid FROM passports WHERE name = :name AND status = :status)'
309
311
  ),
310
312
  },
311
313
  },
314
+ replacements: { name, status },
312
315
  });
313
316
  }
314
317
 
package/lib/util/index.js CHANGED
@@ -354,7 +354,7 @@ const getStateCrons = (states) => [
354
354
  options: { runOnInit: false },
355
355
  fn: async () => {
356
356
  const removed = await states.auditLog.remove({
357
- createdAt: { $lt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 90) },
357
+ createdAt: { $lt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 365) },
358
358
  });
359
359
  logger.info(`Removed ${removed} audit logs`);
360
360
  },
@@ -311,7 +311,7 @@ const setupAppOwner = async ({ node, sessionId, justCreate = false, context }) =
311
311
  logger.info('Create owner for blocklet', { appDid, ownerDid, sessionId });
312
312
 
313
313
  // create owner login token that can be used to login on blocklet site
314
- const appSecret = Hasher.SHA3.hash256(Buffer.concat([wallet.secretKey, wallet.address].map(Buffer.from)));
314
+ const appSecret = Hasher.SHA3.hash256(Buffer.concat([wallet.secretKey, wallet.address].map((v) => Buffer.from(v))));
315
315
  const setupToken = createAuthToken({
316
316
  did: ownerDid,
317
317
  passport,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.30",
6
+ "version": "1.16.31-beta-52250475",
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.30",
23
- "@abtnode/auth": "1.16.30",
24
- "@abtnode/certificate-manager": "1.16.30",
25
- "@abtnode/constant": "1.16.30",
26
- "@abtnode/cron": "1.16.30",
27
- "@abtnode/logger": "1.16.30",
28
- "@abtnode/models": "1.16.30",
29
- "@abtnode/queue": "1.16.30",
30
- "@abtnode/rbac": "1.16.30",
31
- "@abtnode/router-provider": "1.16.30",
32
- "@abtnode/static-server": "1.16.30",
33
- "@abtnode/timemachine": "1.16.30",
34
- "@abtnode/util": "1.16.30",
22
+ "@abtnode/analytics": "1.16.31-beta-52250475",
23
+ "@abtnode/auth": "1.16.31-beta-52250475",
24
+ "@abtnode/certificate-manager": "1.16.31-beta-52250475",
25
+ "@abtnode/constant": "1.16.31-beta-52250475",
26
+ "@abtnode/cron": "1.16.31-beta-52250475",
27
+ "@abtnode/logger": "1.16.31-beta-52250475",
28
+ "@abtnode/models": "1.16.31-beta-52250475",
29
+ "@abtnode/queue": "1.16.31-beta-52250475",
30
+ "@abtnode/rbac": "1.16.31-beta-52250475",
31
+ "@abtnode/router-provider": "1.16.31-beta-52250475",
32
+ "@abtnode/static-server": "1.16.31-beta-52250475",
33
+ "@abtnode/timemachine": "1.16.31-beta-52250475",
34
+ "@abtnode/util": "1.16.31-beta-52250475",
35
35
  "@arcblock/did": "1.18.132",
36
36
  "@arcblock/did-auth": "1.18.132",
37
37
  "@arcblock/did-ext": "^1.18.132",
@@ -42,12 +42,12 @@
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
43
  "@arcblock/validator": "^1.18.132",
44
44
  "@arcblock/vc": "1.18.132",
45
- "@blocklet/constant": "1.16.30",
46
- "@blocklet/env": "1.16.30",
47
- "@blocklet/meta": "1.16.30",
48
- "@blocklet/resolver": "1.16.30",
49
- "@blocklet/sdk": "1.16.30",
50
- "@blocklet/store": "1.16.30",
45
+ "@blocklet/constant": "1.16.31-beta-52250475",
46
+ "@blocklet/env": "1.16.31-beta-52250475",
47
+ "@blocklet/meta": "1.16.31-beta-52250475",
48
+ "@blocklet/resolver": "1.16.31-beta-52250475",
49
+ "@blocklet/sdk": "1.16.31-beta-52250475",
50
+ "@blocklet/store": "1.16.31-beta-52250475",
51
51
  "@did-space/client": "^0.5.28",
52
52
  "@fidm/x509": "^1.2.1",
53
53
  "@ocap/mcrypto": "1.18.132",
@@ -103,5 +103,5 @@
103
103
  "jest": "^29.7.0",
104
104
  "unzipper": "^0.10.11"
105
105
  },
106
- "gitHead": "18420639259c736016b19152229183d9fc1c1656"
106
+ "gitHead": "26155b86f103f9e64fd8a23b7fffdb279c71209c"
107
107
  }