@blocklet/sdk 1.8.21 → 1.8.23

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.
@@ -7,11 +7,23 @@ const { getParentComponentName } = require('@blocklet/meta/lib/util');
7
7
  const getWallet = require('../wallet');
8
8
  const config = require('../config');
9
9
 
10
- const parseMountPoints = () => JSON.parse(process.env.BLOCKLET_MOUNT_POINTS);
10
+ const parseMountPoints = () => {
11
+ const mountPoints = JSON.parse(process.env.BLOCKLET_MOUNT_POINTS) || [];
12
+
13
+ mountPoints.forEach((x) => {
14
+ if (x.port) {
15
+ x.webEndpoint = `http://127.0.0.1:${x.port}`;
16
+ }
17
+ });
18
+
19
+ return mountPoints;
20
+ };
21
+
11
22
  const parsePorts = () => JSON.parse(process.env.BLOCKLET_WEB_PORTS);
12
23
 
13
24
  const call = async ({ name, path: _path, data }) => {
14
25
  const baseURL = name ? getChildWebEndpoint(name) : getParentWebEndpoint();
26
+
15
27
  const url = joinURL(baseURL, _path);
16
28
 
17
29
  return doCall({ url, data });
@@ -41,8 +53,10 @@ const getComponentMountPoint = (s) => {
41
53
  return item ? item.mountPoint : '';
42
54
  };
43
55
 
44
- const getComponentMountPoints = () => {
45
- return parseMountPoints();
56
+ const getComponentWebEndpoint = (s) => {
57
+ const mountPoints = parseMountPoints();
58
+ const item = mountPoints.find((x) => [x.title, x.name, x.did].includes(s));
59
+ return item ? item.webEndpoint : '';
46
60
  };
47
61
 
48
62
  const sign = (data) => {
@@ -72,8 +86,7 @@ const doCall = async ({ url, data }) => {
72
86
  module.exports = {
73
87
  call,
74
88
  getComponentMountPoint,
75
- getComponentMountPoints,
76
- getWebEndpoint,
89
+ getComponentWebEndpoint,
77
90
  getChildWebEndpoint,
78
91
  getParentWebEndpoint,
79
92
  };
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- const AuthService = require('./service/auth');
2
- const NotificationService = require('./service/notification');
1
+ const Auth = require('./service/auth');
2
+ const Notification = require('./service/notification');
3
3
  const WalletAuthenticator = require('./wallet-authenticator');
4
4
  const WalletHandlers = require('./wallet-handler');
5
5
  const BlockletAuthenticator = require('./connect/authenticator');
@@ -8,12 +8,20 @@ const Database = require('./database');
8
8
  const env = require('./env');
9
9
  const middlewares = require('./middlewares');
10
10
  const getWallet = require('./wallet');
11
- const component = require('./component');
11
+ const Component = require('./component');
12
12
  const config = require('./config');
13
13
 
14
14
  module.exports = {
15
- AuthService,
16
- NotificationService,
15
+ /**
16
+ * @deprecated ES6: use `Auth` instead
17
+ */
18
+ AuthService: Auth,
19
+ Auth,
20
+ /**
21
+ * @deprecated ES6: use `Notification` instead
22
+ */
23
+ NotificationService: Notification,
24
+ Notification,
17
25
  WalletHandlers,
18
26
  WalletAuthenticator,
19
27
  BlockletAuthenticator,
@@ -22,6 +30,10 @@ module.exports = {
22
30
  getWallet,
23
31
  env,
24
32
  middlewares,
25
- component,
33
+ /**
34
+ * @deprecated ES6: use `Component` instead
35
+ */
36
+ component: Component,
37
+ Component,
26
38
  config,
27
39
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.21",
6
+ "version": "1.8.23",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,14 +19,14 @@
19
19
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/client": "1.8.21",
23
- "@abtnode/constant": "1.8.21",
22
+ "@abtnode/client": "1.8.23",
23
+ "@abtnode/constant": "1.8.23",
24
24
  "@arcblock/did-auth": "1.17.19",
25
25
  "@arcblock/jwt": "1.17.19",
26
26
  "@arcblock/ws": "1.17.19",
27
- "@blocklet/meta": "1.8.21",
28
- "@did-connect/authenticator": "^2.1.13",
29
- "@did-connect/handler": "^2.1.13",
27
+ "@blocklet/meta": "1.8.23",
28
+ "@did-connect/authenticator": "^2.1.14",
29
+ "@did-connect/handler": "^2.1.14",
30
30
  "@nedb/core": "^2.0.4",
31
31
  "@ocap/mcrypto": "1.17.19",
32
32
  "@ocap/wallet": "1.17.19",
@@ -45,5 +45,5 @@
45
45
  "detect-port": "^1.3.0",
46
46
  "jest": "^27.5.1"
47
47
  },
48
- "gitHead": "f990cddd5ef18ece7ada5d7573b8e0652d74abdc"
48
+ "gitHead": "539a32437cf0d01d4cf12afd0dd8276716467527"
49
49
  }