@onekeyfe/hd-ble-sdk 1.1.34-alpha.3 → 1.1.34-alpha.4

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.
@@ -1 +1 @@
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;AA8JpE,QAAA,MAAM,cAAc,qCAUlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,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;AAgJpE,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;
@@ -574,13 +571,7 @@ function handleMessage(message) {
574
571
  eventEmitter.emit(message.event, message);
575
572
  break;
576
573
  case HardwareSdk.DEVICE_EVENT:
577
- if ([
578
- HardwareSdk.DEVICE.CONNECT,
579
- HardwareSdk.DEVICE.DISCONNECT,
580
- HardwareSdk.DEVICE.FEATURES,
581
- HardwareSdk.DEVICE.STATE,
582
- HardwareSdk.DEVICE.SUPPORT_FEATURES,
583
- ].includes(message.type)) {
574
+ if ([HardwareSdk.DEVICE.CONNECT, HardwareSdk.DEVICE.DISCONNECT, HardwareSdk.DEVICE.FEATURES, HardwareSdk.DEVICE.SUPPORT_FEATURES].includes(message.type)) {
584
575
  eventEmitter.emit(message.type, message.payload);
585
576
  }
586
577
  break;
@@ -624,12 +615,11 @@ const init = (settings) => __awaiter(void 0, void 0, void 0, function* () {
624
615
  });
625
616
  const call = (params) => __awaiter(void 0, void 0, void 0, function* () {
626
617
  var _a, _b, _c;
627
- const logBlockLabel = HardwareSdk.getLogBlockLabel(params);
628
- Log.debug('call: ', logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : params);
618
+ Log.debug('call: ', params);
629
619
  try {
630
620
  const response = yield postMessage({ event: HardwareSdk.IFRAME.CALL, type: HardwareSdk.IFRAME.CALL, payload: params });
631
621
  if (response) {
632
- Log.debug('response: ', logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : response);
622
+ Log.debug('response: ', response);
633
623
  if (!response.success) {
634
624
  if (((_a = response.payload) === null || _a === void 0 ? void 0 : _a.code) === hdShared.HardwareErrorCode.BlePermissionError) {
635
625
  postMessage(HardwareSdk.createUiMessage(HardwareSdk.UI_REQUEST.BLUETOOTH_PERMISSION), false);
@@ -657,7 +647,6 @@ const HardwareBleSdk = HardwareSdk__default["default"]({
657
647
  init,
658
648
  call,
659
649
  cancel,
660
- cancelOperation,
661
650
  dispose,
662
651
  uiResponse,
663
652
  updateSettings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-ble-sdk",
3
- "version": "1.1.34-alpha.3",
3
+ "version": "1.1.34-alpha.4",
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.1.34-alpha.3",
24
- "@onekeyfe/hd-shared": "1.1.34-alpha.3",
25
- "@onekeyfe/hd-transport-react-native": "1.1.34-alpha.3"
23
+ "@onekeyfe/hd-core": "1.1.34-alpha.4",
24
+ "@onekeyfe/hd-shared": "1.1.34-alpha.4",
25
+ "@onekeyfe/hd-transport-react-native": "1.1.34-alpha.4"
26
26
  },
27
- "gitHead": "3688bc8495eeb2ffd5616270d13fa29e8967623a"
27
+ "gitHead": "d546bc55410990351d34009230aefea77725d0d6"
28
28
  }
package/src/index.ts CHANGED
@@ -13,7 +13,6 @@ import HardwareSdk, {
13
13
  createUiMessage,
14
14
  enableLog,
15
15
  executeCallback,
16
- getLogBlockLabel,
17
16
  getLogger,
18
17
  initCore,
19
18
  parseConnectSettings,
@@ -51,10 +50,6 @@ const cancel = (connectId?: string) => {
51
50
  _core.handleMessage({ event: IFRAME.CANCEL, type: IFRAME.CANCEL, payload: { connectId } });
52
51
  };
53
52
 
54
- const cancelOperation = (operationId: string) => {
55
- _core?.cancelOperation(operationId);
56
- };
57
-
58
53
  function handleMessage(message: CoreMessage) {
59
54
  const { event, type } = message;
60
55
  if (!_core) {
@@ -89,13 +84,7 @@ function handleMessage(message: CoreMessage) {
89
84
  case DEVICE_EVENT:
90
85
  if (
91
86
  (
92
- [
93
- DEVICE.CONNECT,
94
- DEVICE.DISCONNECT,
95
- DEVICE.FEATURES,
96
- DEVICE.STATE,
97
- DEVICE.SUPPORT_FEATURES,
98
- ] as string[]
87
+ [DEVICE.CONNECT, DEVICE.DISCONNECT, DEVICE.FEATURES, DEVICE.SUPPORT_FEATURES] as string[]
99
88
  ).includes(message.type)
100
89
  ) {
101
90
  eventEmitter.emit(message.type, message.payload);
@@ -149,16 +138,12 @@ const init = async (settings: Partial<ConnectSettings>) => {
149
138
  };
150
139
 
151
140
  const call = async (params: any) => {
152
- const logBlockLabel = getLogBlockLabel(params);
153
- Log.debug('call: ', logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : params);
141
+ Log.debug('call: ', params);
154
142
 
155
143
  try {
156
144
  const response = await postMessage({ event: IFRAME.CALL, type: IFRAME.CALL, payload: params });
157
145
  if (response) {
158
- Log.debug(
159
- 'response: ',
160
- logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : response
161
- );
146
+ Log.debug('response: ', response);
162
147
 
163
148
  if (!response.success) {
164
149
  if (response.payload?.code === HardwareErrorCode.BlePermissionError) {
@@ -194,7 +179,6 @@ const HardwareBleSdk = HardwareSdk({
194
179
  init,
195
180
  call,
196
181
  cancel,
197
- cancelOperation,
198
182
  dispose,
199
183
  uiResponse,
200
184
  updateSettings,
@@ -1,15 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { resolve } from 'path';
3
-
4
- describe('hd-ble-sdk device state events', () => {
5
- test('forwards DEVICE.STATE to React Native SDK consumers', () => {
6
- const source = readFileSync(resolve(__dirname, '../src/index.ts'), 'utf8');
7
- const deviceEventHandler = source.slice(
8
- source.indexOf('case DEVICE_EVENT:'),
9
- source.indexOf('case IFRAME.CALLBACK:')
10
- );
11
-
12
- expect(deviceEventHandler).toContain('DEVICE.STATE');
13
- expect(deviceEventHandler).toContain('eventEmitter.emit(message.type, message.payload)');
14
- });
15
- });