@blocklet/sdk 1.16.4 → 1.16.5

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/did.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  import toBlockletDid from '@blocklet/meta/lib/did';
2
- import { getAliasAccountFromUser, getAliasDidFromUser, getMainDidFromUser, getWalletAccountFromUser, getWalletDidFromUser } from '@blocklet/meta/lib/did-utils';
3
- export { toBlockletDid, getAliasAccountFromUser, getAliasDidFromUser, getMainDidFromUser, getWalletAccountFromUser, getWalletDidFromUser, };
2
+ import { getConnectedAccounts, getConnectedDids, getPermanentDid, getWallet, getWalletDid } from '@blocklet/meta/lib/did-utils';
3
+ import AuthService from './service/auth';
4
+ declare function getUserInfo(userDid: string, { authClient }?: {
5
+ authClient?: AuthService;
6
+ }): Promise<import("@abtnode/client").UserInfo>;
7
+ export { getUserInfo, toBlockletDid, getConnectedAccounts, getConnectedDids, getPermanentDid, getWallet, getWalletDid };
package/lib/did.js CHANGED
@@ -3,12 +3,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getWalletDidFromUser = exports.getWalletAccountFromUser = exports.getMainDidFromUser = exports.getAliasDidFromUser = exports.getAliasAccountFromUser = exports.toBlockletDid = void 0;
6
+ exports.getWalletDid = exports.getWallet = exports.getPermanentDid = exports.getConnectedDids = exports.getConnectedAccounts = exports.toBlockletDid = exports.getUserInfo = void 0;
7
7
  const did_1 = __importDefault(require("@blocklet/meta/lib/did"));
8
8
  exports.toBlockletDid = did_1.default;
9
9
  const did_utils_1 = require("@blocklet/meta/lib/did-utils");
10
- Object.defineProperty(exports, "getAliasAccountFromUser", { enumerable: true, get: function () { return did_utils_1.getAliasAccountFromUser; } });
11
- Object.defineProperty(exports, "getAliasDidFromUser", { enumerable: true, get: function () { return did_utils_1.getAliasDidFromUser; } });
12
- Object.defineProperty(exports, "getMainDidFromUser", { enumerable: true, get: function () { return did_utils_1.getMainDidFromUser; } });
13
- Object.defineProperty(exports, "getWalletAccountFromUser", { enumerable: true, get: function () { return did_utils_1.getWalletAccountFromUser; } });
14
- Object.defineProperty(exports, "getWalletDidFromUser", { enumerable: true, get: function () { return did_utils_1.getWalletDidFromUser; } });
10
+ Object.defineProperty(exports, "getConnectedAccounts", { enumerable: true, get: function () { return did_utils_1.getConnectedAccounts; } });
11
+ Object.defineProperty(exports, "getConnectedDids", { enumerable: true, get: function () { return did_utils_1.getConnectedDids; } });
12
+ Object.defineProperty(exports, "getPermanentDid", { enumerable: true, get: function () { return did_utils_1.getPermanentDid; } });
13
+ Object.defineProperty(exports, "getWallet", { enumerable: true, get: function () { return did_utils_1.getWallet; } });
14
+ Object.defineProperty(exports, "getWalletDid", { enumerable: true, get: function () { return did_utils_1.getWalletDid; } });
15
+ const auth_1 = __importDefault(require("./service/auth"));
16
+ async function getUserInfo(userDid, { authClient = undefined } = {}) {
17
+ if (!authClient) {
18
+ // eslint-disable-next-line no-param-reassign
19
+ authClient = new auth_1.default();
20
+ }
21
+ let { user } = await authClient.getUser(userDid);
22
+ if (!user) {
23
+ const { users } = await authClient.getUsers({
24
+ query: {
25
+ connectedDid: userDid,
26
+ },
27
+ });
28
+ if (users.length > 1) {
29
+ throw new Error('User is invalid');
30
+ }
31
+ [user] = users;
32
+ }
33
+ else if (user.extraConfigs?.bindDid) {
34
+ ({ user } = await authClient.getUser(user.extraConfigs.bindDid));
35
+ }
36
+ return user;
37
+ }
38
+ exports.getUserInfo = getUserInfo;
package/lib/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare const version = "1.16.4";
1
+ declare const version = "1.16.5";
2
2
  export { version };
3
3
  declare const _default: {
4
4
  version: string;
package/lib/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- const version = '1.16.4';
4
+ const version = '1.16.5';
5
5
  exports.version = version;
6
6
  exports.default = { version };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.4",
6
+ "version": "1.16.5",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
@@ -26,20 +26,20 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.16.4",
30
- "@abtnode/constant": "1.16.4",
31
- "@arcblock/did": "1.18.67",
32
- "@arcblock/did-auth": "1.18.67",
33
- "@arcblock/jwt": "1.18.67",
34
- "@arcblock/ws": "1.18.67",
35
- "@blocklet/constant": "1.16.4",
36
- "@blocklet/env": "1.16.4",
37
- "@blocklet/meta": "1.16.4",
38
- "@did-connect/authenticator": "^2.1.49",
39
- "@did-connect/handler": "^2.1.49",
29
+ "@abtnode/client": "1.16.5",
30
+ "@abtnode/constant": "1.16.5",
31
+ "@arcblock/did": "1.18.68",
32
+ "@arcblock/did-auth": "1.18.68",
33
+ "@arcblock/jwt": "1.18.68",
34
+ "@arcblock/ws": "1.18.68",
35
+ "@blocklet/constant": "1.16.5",
36
+ "@blocklet/env": "1.16.5",
37
+ "@blocklet/meta": "1.16.5",
38
+ "@did-connect/authenticator": "^2.1.50",
39
+ "@did-connect/handler": "^2.1.50",
40
40
  "@nedb/core": "^2.1.5",
41
- "@ocap/mcrypto": "1.18.67",
42
- "@ocap/wallet": "1.18.67",
41
+ "@ocap/mcrypto": "1.18.68",
42
+ "@ocap/wallet": "1.18.68",
43
43
  "axios": "^0.27.2",
44
44
  "cheerio": "^1.0.0-rc.12",
45
45
  "fs-extra": "^10.1.0",
@@ -72,5 +72,5 @@
72
72
  "ts-node": "^10.9.1",
73
73
  "typescript": "^4.8.4"
74
74
  },
75
- "gitHead": "8d1062af0f4e4f491b6a7205c9d6542328ca6b20"
75
+ "gitHead": "229effc24ce7e12a0dbe551b2cc57825c3803745"
76
76
  }