@onekeyfe/hd-ble-sdk 1.2.0-alpha.20 → 1.2.0-alpha.22
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/__tests__/device-state-events.test.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/package.json +5 -5
- package/src/index.ts +4 -7
|
@@ -6,7 +6,7 @@ describe('hd-ble-sdk device state events', () => {
|
|
|
6
6
|
const source = readFileSync(resolve(__dirname, '../src/index.ts'), 'utf8');
|
|
7
7
|
const deviceEventHandler = source.slice(
|
|
8
8
|
source.indexOf('case DEVICE_EVENT:'),
|
|
9
|
-
source.indexOf('case IFRAME.CALLBACK:')
|
|
9
|
+
source.indexOf('case IFRAME.CALLBACK:')
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
expect(deviceEventHandler).toContain('DEVICE.STATE');
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AASpD,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;CAAO,CAAC;AAuJpE,QAAA,MAAM,cAAc,qCASlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -539,9 +539,6 @@ const cancel = (connectId) => {
|
|
|
539
539
|
return;
|
|
540
540
|
_core.handleMessage({ event: HardwareSdk.IFRAME.CANCEL, type: HardwareSdk.IFRAME.CANCEL, payload: { connectId } });
|
|
541
541
|
};
|
|
542
|
-
const cancelOperation = (operationId) => {
|
|
543
|
-
_core === null || _core === void 0 ? void 0 : _core.cancelOperation(operationId);
|
|
544
|
-
};
|
|
545
542
|
function handleMessage(message) {
|
|
546
543
|
var _a;
|
|
547
544
|
const { event, type } = message;
|
|
@@ -624,11 +621,12 @@ const init = (settings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
624
621
|
});
|
|
625
622
|
const call = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
626
623
|
var _a, _b, _c;
|
|
627
|
-
|
|
624
|
+
const blockLog = HardwareSdk.getLogBlockLabel(params);
|
|
625
|
+
Log.debug('call: ', blockLog !== null && blockLog !== void 0 ? blockLog : params);
|
|
628
626
|
try {
|
|
629
627
|
const response = yield postMessage({ event: HardwareSdk.IFRAME.CALL, type: HardwareSdk.IFRAME.CALL, payload: params });
|
|
630
628
|
if (response) {
|
|
631
|
-
Log.debug('response: ', response);
|
|
629
|
+
Log.debug('response: ', blockLog ? '[REDACTED]' : response);
|
|
632
630
|
if (!response.success) {
|
|
633
631
|
if (((_a = response.payload) === null || _a === void 0 ? void 0 : _a.code) === hdShared.HardwareErrorCode.BlePermissionError) {
|
|
634
632
|
postMessage(HardwareSdk.createUiMessage(HardwareSdk.UI_REQUEST.BLUETOOTH_PERMISSION), false);
|
|
@@ -656,7 +654,6 @@ const HardwareBleSdk = HardwareSdk__default["default"]({
|
|
|
656
654
|
init,
|
|
657
655
|
call,
|
|
658
656
|
cancel,
|
|
659
|
-
cancelOperation,
|
|
660
657
|
dispose,
|
|
661
658
|
uiResponse,
|
|
662
659
|
updateSettings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-ble-sdk",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.22",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "ISC",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"lint:fix": "eslint . --fix"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@onekeyfe/hd-core": "1.2.0-alpha.
|
|
24
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
25
|
-
"@onekeyfe/hd-transport-react-native": "1.2.0-alpha.
|
|
23
|
+
"@onekeyfe/hd-core": "1.2.0-alpha.22",
|
|
24
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.22",
|
|
25
|
+
"@onekeyfe/hd-transport-react-native": "1.2.0-alpha.22"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "ce94a5ebbe141b0c15db7c68d08085ca1ddb0166"
|
|
28
28
|
}
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import HardwareSdk, {
|
|
|
14
14
|
enableLog,
|
|
15
15
|
executeCallback,
|
|
16
16
|
getLogger,
|
|
17
|
+
getLogBlockLabel,
|
|
17
18
|
initCore,
|
|
18
19
|
parseConnectSettings,
|
|
19
20
|
setLoggerPostMessage,
|
|
@@ -50,10 +51,6 @@ const cancel = (connectId?: string) => {
|
|
|
50
51
|
_core.handleMessage({ event: IFRAME.CANCEL, type: IFRAME.CANCEL, payload: { connectId } });
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
const cancelOperation = (operationId: string) => {
|
|
54
|
-
_core?.cancelOperation(operationId);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
54
|
function handleMessage(message: CoreMessage) {
|
|
58
55
|
const { event, type } = message;
|
|
59
56
|
if (!_core) {
|
|
@@ -148,12 +145,13 @@ const init = async (settings: Partial<ConnectSettings>) => {
|
|
|
148
145
|
};
|
|
149
146
|
|
|
150
147
|
const call = async (params: any) => {
|
|
151
|
-
|
|
148
|
+
const blockLog = getLogBlockLabel(params);
|
|
149
|
+
Log.debug('call: ', blockLog ?? params);
|
|
152
150
|
|
|
153
151
|
try {
|
|
154
152
|
const response = await postMessage({ event: IFRAME.CALL, type: IFRAME.CALL, payload: params });
|
|
155
153
|
if (response) {
|
|
156
|
-
Log.debug('response: ', response);
|
|
154
|
+
Log.debug('response: ', blockLog ? '[REDACTED]' : response);
|
|
157
155
|
|
|
158
156
|
if (!response.success) {
|
|
159
157
|
if (response.payload?.code === HardwareErrorCode.BlePermissionError) {
|
|
@@ -189,7 +187,6 @@ const HardwareBleSdk = HardwareSdk({
|
|
|
189
187
|
init,
|
|
190
188
|
call,
|
|
191
189
|
cancel,
|
|
192
|
-
cancelOperation,
|
|
193
190
|
dispose,
|
|
194
191
|
uiResponse,
|
|
195
192
|
updateSettings,
|