@onekeyfe/hwk-adapter-core 1.2.8-alpha.107 → 1.2.8-alpha.109

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.mjs CHANGED
@@ -565,6 +565,15 @@ function rehydrateConnectorError(error) {
565
565
  ...params ?? {}
566
566
  });
567
567
  }
568
+ function withChildConnectionType(event, data, connectionType) {
569
+ if (event !== "device-connect" && event !== "features") return data;
570
+ const { device } = data;
571
+ if (device.connectionType) return data;
572
+ return {
573
+ ...data,
574
+ device: { ...device, connectionType }
575
+ };
576
+ }
568
577
  function isDeviceUnavailableError(error) {
569
578
  const typed = error;
570
579
  if (typed.code === 10100 /* DeviceNotFound */ || typed.code === 10101 /* DeviceDisconnected */) {
@@ -763,7 +772,7 @@ function createCombinedConnector(connectors) {
763
772
  },
764
773
  on: (event, handler) => {
765
774
  const attached = connectors.map((child) => {
766
- const forward = (data) => handler(data);
775
+ const forward = (data) => handler(withChildConnectionType(event, data, child.connectionType));
767
776
  child.on(event, forward);
768
777
  return { child, handler: forward };
769
778
  });