@blocklet/sdk 1.16.13-beta-118c3420 → 1.16.13-beta-a83ad86d
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/component/index.js +3 -5
- package/lib/config.js +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/service/notification.js +6 -0
- package/package.json +7 -7
package/lib/component/index.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.getParentWebEndpoint = exports.getChildWebEndpoint = exports.getComponen
|
|
|
7
7
|
const util_1 = require("@blocklet/meta/lib/util");
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
10
11
|
const url_join_1 = __importDefault(require("url-join"));
|
|
11
12
|
const constant_1 = require("@blocklet/constant");
|
|
12
13
|
const config_1 = require("../config");
|
|
@@ -25,16 +26,13 @@ const doCall = async ({ url, ...options }) => {
|
|
|
25
26
|
return resp;
|
|
26
27
|
}
|
|
27
28
|
catch (error) {
|
|
28
|
-
delete error.config;
|
|
29
|
-
delete error.request;
|
|
30
|
-
delete error.response;
|
|
31
29
|
config_1.logger.error(`call ${url} api failed`, {
|
|
32
30
|
url,
|
|
33
31
|
responseStatus: (0, get_1.default)(error, 'response.status'),
|
|
34
32
|
responseData: (0, get_1.default)(error, 'response.data'),
|
|
35
|
-
error,
|
|
33
|
+
error: (0, omit_1.default)(error, 'response'),
|
|
36
34
|
});
|
|
37
|
-
throw
|
|
35
|
+
throw error;
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
const parsePorts = () => JSON.parse(process.env.BLOCKLET_WEB_PORTS);
|
package/lib/config.js
CHANGED
|
@@ -84,7 +84,7 @@ const handleConfigUpdate = (data) => {
|
|
|
84
84
|
};
|
|
85
85
|
exports.handleConfigUpdate = handleConfigUpdate;
|
|
86
86
|
const inRuntimeEnv = !!process.env.BLOCKLET_APP_SK;
|
|
87
|
-
if (inRuntimeEnv) {
|
|
87
|
+
if (inRuntimeEnv && !process.env.BLOCKLET_HOOK_NAME) {
|
|
88
88
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentsUpdated, handleComponentUpdate);
|
|
89
89
|
notification_1.default.on(constant_1.BlockletInternalEvents.appConfigChanged, handleConfigUpdate);
|
|
90
90
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -43,10 +43,15 @@ declare global {
|
|
|
43
43
|
isComponent: boolean;
|
|
44
44
|
prefix: string;
|
|
45
45
|
groupPrefix: string;
|
|
46
|
+
pageGroup: string;
|
|
46
47
|
version: string;
|
|
47
48
|
theme: TTheme;
|
|
48
49
|
navigation: TNavigation[];
|
|
49
|
-
preferences: any
|
|
50
|
+
preferences: Record<string, any>;
|
|
51
|
+
languages: {
|
|
52
|
+
code: string;
|
|
53
|
+
name: string;
|
|
54
|
+
}[];
|
|
50
55
|
componentMountPoints: MountPoint[];
|
|
51
56
|
alsoKnownAs: string[];
|
|
52
57
|
trustedFactories: string[];
|
|
@@ -85,15 +85,21 @@ const broadcast = async (notification, options = {}) => {
|
|
|
85
85
|
return (0, send_notification_1.sendToAppChannel)(channel, event, notification, sender, process.env.ABT_NODE_SERVICE_PORT, options);
|
|
86
86
|
};
|
|
87
87
|
exports.broadcast = broadcast;
|
|
88
|
+
const noop = () => { };
|
|
88
89
|
const emitter = new events_1.default();
|
|
89
90
|
const messageEmitter = new events_1.default();
|
|
90
91
|
const emitError = (error) => {
|
|
91
92
|
messageEmitter.emit('error', error);
|
|
92
93
|
emitter.emit('error', error);
|
|
93
94
|
};
|
|
95
|
+
const ensureErrorListener = () => {
|
|
96
|
+
emitter.on('error', noop);
|
|
97
|
+
messageEmitter.on('error', noop);
|
|
98
|
+
};
|
|
94
99
|
let client = null;
|
|
95
100
|
const initClient = () => {
|
|
96
101
|
if (!client) {
|
|
102
|
+
ensureErrorListener();
|
|
97
103
|
const wallet = (0, wallet_1.getPermanentWallet)();
|
|
98
104
|
const { address: did, publicKey: pk, secretKey: sk } = wallet;
|
|
99
105
|
const url = `ws://127.0.0.1:${process.env.ABT_NODE_SERVICE_PORT}${constants_1.SERVICE_PREFIX}`;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.13-beta-
|
|
6
|
+
"version": "1.16.13-beta-a83ad86d",
|
|
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,15 +26,15 @@
|
|
|
26
26
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@abtnode/client": "1.16.13-beta-
|
|
30
|
-
"@abtnode/constant": "1.16.13-beta-
|
|
29
|
+
"@abtnode/client": "1.16.13-beta-a83ad86d",
|
|
30
|
+
"@abtnode/constant": "1.16.13-beta-a83ad86d",
|
|
31
31
|
"@arcblock/did": "1.18.84",
|
|
32
32
|
"@arcblock/did-auth": "1.18.84",
|
|
33
33
|
"@arcblock/jwt": "1.18.84",
|
|
34
34
|
"@arcblock/ws": "1.18.84",
|
|
35
|
-
"@blocklet/constant": "1.16.13-beta-
|
|
36
|
-
"@blocklet/env": "1.16.13-beta-
|
|
37
|
-
"@blocklet/meta": "1.16.13-beta-
|
|
35
|
+
"@blocklet/constant": "1.16.13-beta-a83ad86d",
|
|
36
|
+
"@blocklet/env": "1.16.13-beta-a83ad86d",
|
|
37
|
+
"@blocklet/meta": "1.16.13-beta-a83ad86d",
|
|
38
38
|
"@did-connect/authenticator": "^2.1.59",
|
|
39
39
|
"@did-connect/handler": "^2.1.59",
|
|
40
40
|
"@nedb/core": "^2.1.5",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"ts-node": "^10.9.1",
|
|
74
74
|
"typescript": "^5.0.4"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "dc2a4f7d5b55da109ebf873d8aa4d24f27a088c9"
|
|
77
77
|
}
|