@onekeyfe/hd-transport-react-native 1.2.4-alpha.1 → 1.2.4-alpha.2

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/dist/index.d.ts CHANGED
@@ -228,6 +228,11 @@ declare class ReactNativeBleTransport {
228
228
  * connect is re-read as an invalid bond when that signal belongs to the same attempt.
229
229
  */
230
230
  private resolveAndroidBondInvalid;
231
+ /**
232
+ * iOS says why a link ended only on the operation it interrupted, so the native codes are read
233
+ * and logged here. Codes only: the reason text is localized and cannot be matched or searched.
234
+ */
235
+ private noteIosLinkError;
231
236
  /**
232
237
  * iPhones that do not report a lost bond only show the device ending each new link. One such
233
238
  * attempt keeps its error so Core retries; the second in a row is the stale bond.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAGL,UAAU,IAAI,aAAa,EAG5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAChB,KAAK,oBAAoB,EAIzB,KAAK,YAAY,EAKjB,KAAK,oBAAoB,EAI1B,MAAM,wBAAwB,CAAC;AA6ChC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAI1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGjE,KAAK,8BAA8B,GAAG,eAAe,GAAG;IAMtD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAkBF,KAAK,4BAA4B,GAAG,WAAW,CAAC;AAChD,KAAK,0BAA0B,GAAG;IAChC,mBAAmB,EAAE,cAAc,CAAC;IACpC,oBAAoB,EAAE,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gC;IAoB9C,OAAO,CAAC,uBAAuB;IAmD/B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
package/dist/index.js CHANGED
@@ -1692,7 +1692,7 @@ class ReactNativeBleTransport {
1692
1692
  const isCurrentMonitor = this.monitorTokens.get(uuid) === monitorToken;
1693
1693
  if (error) {
1694
1694
  if (isCurrentMonitor)
1695
- this.iosPeerTermination.note(uuid, error);
1695
+ this.noteIosLinkError(uuid, 'notify', error);
1696
1696
  Log === null || Log === void 0 ? void 0 : Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
1697
1697
  if (this.firmwareUploadWriteRecoveryIds.has(uuid)) {
1698
1698
  Log === null || Log === void 0 ? void 0 : Log.debug('notify error ignored during FirmwareUpload write recovery: ', uuid);
@@ -1911,6 +1911,22 @@ class ReactNativeBleTransport {
1911
1911
  });
1912
1912
  });
1913
1913
  }
1914
+ noteIosLinkError(uuid, stage, error) {
1915
+ if (reactNative.Platform.OS !== 'ios')
1916
+ return;
1917
+ this.iosPeerTermination.note(uuid, error);
1918
+ if (stage !== 'gatt-setup' && !isNativeBleDisconnectError(error))
1919
+ return;
1920
+ const native = (error !== null && error !== void 0 ? error : {});
1921
+ const code = (value) => typeof value === 'number' || typeof value === 'string' ? value : undefined;
1922
+ Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] iOS operation failed', {
1923
+ connectIdSuffix: uuid.slice(-8),
1924
+ stage,
1925
+ errorCode: code(native.errorCode),
1926
+ iosErrorCode: code(native.iosErrorCode),
1927
+ attErrorCode: code(native.attErrorCode),
1928
+ });
1929
+ }
1914
1930
  resolveIosBondInvalid(input, error) {
1915
1931
  if (reactNative.Platform.OS !== 'ios')
1916
1932
  return error;
@@ -2471,7 +2487,7 @@ class ReactNativeBleTransport {
2471
2487
  return result;
2472
2488
  }
2473
2489
  catch (error) {
2474
- this.iosPeerTermination.note(uuid, error);
2490
+ this.noteIosLinkError(uuid, 'gatt-setup', error);
2475
2491
  if (reactNative.Platform.OS === 'ios' && isNativeBleStaleBondError(error)) {
2476
2492
  throw toBleStaleBondHardwareError(error);
2477
2493
  }
@@ -2553,7 +2569,7 @@ class ReactNativeBleTransport {
2553
2569
  this.writeTimeoutCounts.delete(uuid);
2554
2570
  }
2555
2571
  catch (error) {
2556
- this.iosPeerTermination.note(uuid, error);
2572
+ this.noteIosLinkError(uuid, 'write', error);
2557
2573
  if (timedOut) {
2558
2574
  if (isCurrentOwner && !isCurrentOwner()) {
2559
2575
  Log === null || Log === void 0 ? void 0 : Log.debug('[ReactNativeBleTransport] stale BLE write timed out, link kept:', uuid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-react-native",
3
- "version": "1.2.4-alpha.1",
3
+ "version": "1.2.4-alpha.2",
4
4
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,11 +20,11 @@
20
20
  "lint:fix": "eslint . --fix"
21
21
  },
22
22
  "dependencies": {
23
- "@onekeyfe/hd-core": "1.2.4-alpha.1",
24
- "@onekeyfe/hd-shared": "1.2.4-alpha.1",
25
- "@onekeyfe/hd-transport": "1.2.4-alpha.1",
23
+ "@onekeyfe/hd-core": "1.2.4-alpha.2",
24
+ "@onekeyfe/hd-shared": "1.2.4-alpha.2",
25
+ "@onekeyfe/hd-transport": "1.2.4-alpha.2",
26
26
  "@onekeyfe/react-native-ble-utils": "0.1.9",
27
27
  "react-native-ble-plx": "3.5.1"
28
28
  },
29
- "gitHead": "711c2e0c33c1316257fce02bc01e7c9bbdd8ce48"
29
+ "gitHead": "691b0ef5e3f0015108b3d64b948f2b9ee9734734"
30
30
  }
@@ -102,12 +102,10 @@ function createHarness() {
102
102
  }),
103
103
  state: jest.fn(() => Promise.resolve('PoweredOn')),
104
104
  };
105
- transport.init(
106
- { debug: jest.fn(), error: jest.fn(), warn: jest.fn() } as any,
107
- new EventEmitter()
108
- );
105
+ const logger = { debug: jest.fn(), error: jest.fn(), warn: jest.fn() };
106
+ transport.init(logger as any, new EventEmitter());
109
107
  transport.configure(protocolV1Schema);
110
- return { transport, device, writeCharacteristic, notifyCharacteristic };
108
+ return { transport, device, writeCharacteristic, notifyCharacteristic, logger };
111
109
  }
112
110
 
113
111
  type Outcome = { code?: unknown; params?: unknown; native?: unknown };
@@ -248,6 +246,23 @@ describe('iOS link ended by the device right after connecting', () => {
248
246
  await expect(acquire(transport)).resolves.toEqual({ native: 7 });
249
247
  });
250
248
 
249
+ test('logs the native codes of the failed operation, which iOS reports nowhere else', async () => {
250
+ const { transport, device, logger } = createHarness();
251
+ device.discoverAllServicesAndCharacteristics.mockImplementation(() =>
252
+ Promise.reject(peerEndedLink())
253
+ );
254
+
255
+ await acquire(transport);
256
+
257
+ expect(logger.debug).toHaveBeenCalledWith('[ReactNativeBleTransport] iOS operation failed', {
258
+ connectIdSuffix: UUID.slice(-8),
259
+ stage: 'gatt-setup',
260
+ errorCode: 201,
261
+ iosErrorCode: 7,
262
+ attErrorCode: undefined,
263
+ });
264
+ });
265
+
251
266
  test('reports a lost bond that iOS names during GATT setup', async () => {
252
267
  const { transport, device } = createHarness();
253
268
  device.discoverAllServicesAndCharacteristics.mockImplementation(() =>
package/src/index.ts CHANGED
@@ -1530,7 +1530,7 @@ export default class ReactNativeBleTransport {
1530
1530
  const subscription = characteristic.monitor((error, c) => {
1531
1531
  const isCurrentMonitor = this.monitorTokens.get(uuid) === monitorToken;
1532
1532
  if (error) {
1533
- if (isCurrentMonitor) this.iosPeerTermination.note(uuid, error);
1533
+ if (isCurrentMonitor) this.noteIosLinkError(uuid, 'notify', error);
1534
1534
  Log?.debug(
1535
1535
  `error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${
1536
1536
  error as unknown as string
@@ -1817,6 +1817,31 @@ export default class ReactNativeBleTransport {
1817
1817
  });
1818
1818
  }
1819
1819
 
1820
+ /**
1821
+ * iOS says why a link ended only on the operation it interrupted, so the native codes are read
1822
+ * and logged here. Codes only: the reason text is localized and cannot be matched or searched.
1823
+ */
1824
+ private noteIosLinkError(uuid: string, stage: 'gatt-setup' | 'notify' | 'write', error: unknown) {
1825
+ if (Platform.OS !== 'ios') return;
1826
+ this.iosPeerTermination.note(uuid, error);
1827
+ // Writes and notifications also fail for reasons that say nothing about the link.
1828
+ if (stage !== 'gatt-setup' && !isNativeBleDisconnectError(error)) return;
1829
+ const native = (error ?? {}) as {
1830
+ errorCode?: unknown;
1831
+ iosErrorCode?: unknown;
1832
+ attErrorCode?: unknown;
1833
+ };
1834
+ const code = (value: unknown) =>
1835
+ typeof value === 'number' || typeof value === 'string' ? value : undefined;
1836
+ Log?.debug('[ReactNativeBleTransport] iOS operation failed', {
1837
+ connectIdSuffix: uuid.slice(-8),
1838
+ stage,
1839
+ errorCode: code(native.errorCode),
1840
+ iosErrorCode: code(native.iosErrorCode),
1841
+ attErrorCode: code(native.attErrorCode),
1842
+ });
1843
+ }
1844
+
1820
1845
  /**
1821
1846
  * iPhones that do not report a lost bond only show the device ending each new link. One such
1822
1847
  * attempt keeps its error so Core retries; the second in a row is the stale bond.
@@ -2513,7 +2538,7 @@ export default class ReactNativeBleTransport {
2513
2538
  succeeded = true;
2514
2539
  return result;
2515
2540
  } catch (error) {
2516
- this.iosPeerTermination.note(uuid, error);
2541
+ this.noteIosLinkError(uuid, 'gatt-setup', error);
2517
2542
  if (Platform.OS === 'ios' && isNativeBleStaleBondError(error)) {
2518
2543
  // iOS can report the lost bond on the first request instead of on the connect.
2519
2544
  throw toBleStaleBondHardwareError(error);
@@ -2635,7 +2660,7 @@ export default class ReactNativeBleTransport {
2635
2660
  ]);
2636
2661
  this.writeTimeoutCounts.delete(uuid);
2637
2662
  } catch (error) {
2638
- this.iosPeerTermination.note(uuid, error);
2663
+ this.noteIosLinkError(uuid, 'write', error);
2639
2664
  if (timedOut) {
2640
2665
  // A superseded call's late write must not tear down the link the current
2641
2666
  // call is using; only the owner of the transport may declare it dead.