@onekeyfe/hd-transport-web-device 1.2.0-alpha.107 → 1.2.0-alpha.108
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.
|
@@ -148,7 +148,7 @@ describe('WebUsbTransport Protocol V2 timeout recovery', () => {
|
|
|
148
148
|
expect(webusb.deviceProtocol.get(path)).toBe('V2');
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
test('reports a
|
|
151
|
+
test('reports a device initialization failure only after the bounded retry is exhausted', async () => {
|
|
152
152
|
const webusb = new WebUsbTransport() as any;
|
|
153
153
|
const path = 'pro2-webusb';
|
|
154
154
|
webusb.probeProtocolV1 = jest.fn();
|
|
@@ -156,9 +156,10 @@ describe('WebUsbTransport Protocol V2 timeout recovery', () => {
|
|
|
156
156
|
webusb.resetConnectionAfterProbe = jest.fn().mockResolvedValue(undefined);
|
|
157
157
|
webusb.closeConnectionAfterProbe = jest.fn().mockResolvedValue(undefined);
|
|
158
158
|
|
|
159
|
-
await expect(webusb.detectProtocol(path, 'V2')).rejects.
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
await expect(webusb.detectProtocol(path, 'V2')).rejects.toMatchObject({
|
|
160
|
+
errorCode: HardwareErrorCode.DeviceInitializeFailed,
|
|
161
|
+
message: 'Protocol V2 probe timeout after 2 attempts',
|
|
162
|
+
});
|
|
162
163
|
|
|
163
164
|
expect(webusb.probeProtocolV2).toHaveBeenCalledTimes(2);
|
|
164
165
|
expect(webusb.probeProtocolV1).not.toHaveBeenCalled();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"electron-ble-transport.d.ts","sourceRoot":"","sources":["../src/electron-ble-transport.ts"],"names":[],"mappings":";AAsBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,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oB;YAuBlB,cAAc;YAqFd,cAAc;IA0B5B,OAAO,CAAC,uBAAuB;IAyC/B,OAAO,CAAC,6BAA6B;IA4CrC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
|
package/dist/index.js
CHANGED
|
@@ -177,7 +177,7 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
|
|
|
177
177
|
return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol mismatch: expected ${expected}, but device did not respond to expected protocol`);
|
|
178
178
|
}
|
|
179
179
|
createProtocolProbeTimeoutError(expected, attempts) {
|
|
180
|
-
return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.
|
|
180
|
+
return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Protocol ${expected} probe timeout after ${attempts} attempts`);
|
|
181
181
|
}
|
|
182
182
|
createProtocolDetectionError() {
|
|
183
183
|
return hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound);
|
|
@@ -603,9 +603,6 @@ class WebUsbTransport extends transport.ProtocolV2UsbTransportBase {
|
|
|
603
603
|
if (!protocol) {
|
|
604
604
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol has not been detected for ${path}`);
|
|
605
605
|
}
|
|
606
|
-
if (!transport.shouldSuppressHighVolumeCallLog(name)) {
|
|
607
|
-
this.Log.debug('transport call', transport.createTransportCallLog(name, protocol, data));
|
|
608
|
-
}
|
|
609
606
|
if (protocol === 'V2') {
|
|
610
607
|
return this.callProtocolV2(path, name, data, options);
|
|
611
608
|
}
|
|
@@ -1362,7 +1359,6 @@ class ElectronBleTransport {
|
|
|
1362
1359
|
}
|
|
1363
1360
|
}
|
|
1364
1361
|
call(uuid, name, data, options) {
|
|
1365
|
-
var _a;
|
|
1366
1362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1367
1363
|
if (!this._messages) {
|
|
1368
1364
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured);
|
|
@@ -1374,9 +1370,6 @@ class ElectronBleTransport {
|
|
|
1374
1370
|
if (!protocol) {
|
|
1375
1371
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol has not been detected for ${uuid}`);
|
|
1376
1372
|
}
|
|
1377
|
-
if (!transport.shouldSuppressHighVolumeCallLog(name)) {
|
|
1378
|
-
(_a = this.Log) === null || _a === void 0 ? void 0 : _a.debug('transport call', transport.createTransportCallLog(name, protocol, data));
|
|
1379
|
-
}
|
|
1380
1373
|
if (protocol === 'V2') {
|
|
1381
1374
|
return this.callProtocolV2(uuid, name, data, options);
|
|
1382
1375
|
}
|
package/dist/webusb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webusb.d.ts","sourceRoot":"","sources":["../src/webusb.ts"],"names":[],"mappings":";AACA,OAAO,SAAS,EAAE,EAQhB,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"webusb.d.ts","sourceRoot":"","sources":["../src/webusb.ts"],"names":[],"mappings":";AACA,OAAO,SAAS,EAAE,EAQhB,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;AAUhC,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AA0BhC,MAAM,WAAW,UAAW,SAAQ,oBAAoB;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAaD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,0BAA0B,CAAC,MAAM,CAAC;IAC7E,QAAQ,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IAGlE,U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,mBAAmB;YA2CnB,cAAc;YAWd,yBAAyB;YAKzB,yBAAyB;YAMzB,uBAAuB;YA0CvB,eAAe;YAoBf,eAAe;IAgBvB,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB;YA0BlB,cAAc;YAkCd,cAAc;IAYtB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAgD5C,OAAO,CAAC,IAAI,EAAE,MAAM;IAQ1B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB;IAUtD,SAAS,CAAC,sBAAsB;cAIhB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;cAIA,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,UAAU,CAAC;cASN,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F,SAAS,CAAC,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKrE,SAAS,CAAC,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK;IAWjF,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;CAGxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-web-device",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.108",
|
|
4
4
|
"author": "OneKey",
|
|
5
5
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"lint:fix": "eslint . --fix"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
25
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
24
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.108",
|
|
25
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.108"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@onekeyfe/hd-transport-electron": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-transport-electron": "1.2.0-alpha.108",
|
|
29
29
|
"@types/w3c-web-usb": "^1.0.6",
|
|
30
30
|
"@types/web-bluetooth": "^0.0.17"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "de8bd1fdc7c46f5ff978c47fde70c3098bf8e230"
|
|
33
33
|
}
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
isHeaderChunk,
|
|
19
19
|
} from '@onekeyfe/hd-shared';
|
|
20
20
|
|
|
21
|
-
import { createTransportCallLog, shouldSuppressHighVolumeCallLog } from './transportLog';
|
|
22
21
|
import { resolveBlePacketCapacity } from './ble-packet-capacity';
|
|
23
22
|
|
|
24
23
|
import type { Deferred } from '@onekeyfe/hd-shared';
|
|
@@ -806,10 +805,6 @@ export default class ElectronBleTransport {
|
|
|
806
805
|
`Device protocol has not been detected for ${uuid}`
|
|
807
806
|
);
|
|
808
807
|
}
|
|
809
|
-
if (!shouldSuppressHighVolumeCallLog(name)) {
|
|
810
|
-
this.Log?.debug('transport call', createTransportCallLog(name, protocol, data));
|
|
811
|
-
}
|
|
812
|
-
|
|
813
808
|
if (protocol === 'V2') {
|
|
814
809
|
return this.callProtocolV2(uuid, name, data, options);
|
|
815
810
|
}
|
package/src/webusb.ts
CHANGED
|
@@ -19,8 +19,6 @@ import {
|
|
|
19
19
|
} from '@onekeyfe/hd-shared';
|
|
20
20
|
import ByteBuffer from 'bytebuffer';
|
|
21
21
|
|
|
22
|
-
import { createTransportCallLog, shouldSuppressHighVolumeCallLog } from './transportLog';
|
|
23
|
-
|
|
24
22
|
import type {
|
|
25
23
|
AcquireInput,
|
|
26
24
|
OneKeyDeviceInfoBase,
|
|
@@ -266,7 +264,7 @@ export default class WebUsbTransport extends ProtocolV2UsbTransportBase<string>
|
|
|
266
264
|
|
|
267
265
|
private createProtocolProbeTimeoutError(expected: ProtocolType, attempts: number) {
|
|
268
266
|
return ERRORS.TypedError(
|
|
269
|
-
HardwareErrorCode.
|
|
267
|
+
HardwareErrorCode.DeviceInitializeFailed,
|
|
270
268
|
`Protocol ${expected} probe timeout after ${attempts} attempts`
|
|
271
269
|
);
|
|
272
270
|
}
|
|
@@ -767,10 +765,6 @@ export default class WebUsbTransport extends ProtocolV2UsbTransportBase<string>
|
|
|
767
765
|
);
|
|
768
766
|
}
|
|
769
767
|
|
|
770
|
-
if (!shouldSuppressHighVolumeCallLog(name)) {
|
|
771
|
-
this.Log.debug('transport call', createTransportCallLog(name, protocol, data));
|
|
772
|
-
}
|
|
773
|
-
|
|
774
768
|
if (protocol === 'V2') {
|
|
775
769
|
return this.callProtocolV2(path, name, data, options);
|
|
776
770
|
}
|