@onekeyfe/hwk-adapter-core 1.2.11-alpha.3 → 1.2.11-alpha.5
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/{chunk-Z574MVAT.mjs → chunk-5AIX6YY5.mjs} +2 -2
- package/dist/{chunk-UFNTICCX.js → chunk-EJIHCWWH.js} +9 -2
- package/dist/chunk-EJIHCWWH.js.map +1 -0
- package/dist/{chunk-P7RDL34T.js → chunk-MVP46CIZ.js} +3 -3
- package/dist/{chunk-P7RDL34T.js.map → chunk-MVP46CIZ.js.map} +1 -1
- package/dist/{chunk-V2OHL2JS.mjs → chunk-VKP46GTC.mjs} +8 -1
- package/dist/chunk-VKP46GTC.mjs.map +1 -0
- package/dist/{errors-DednD9bG.d.mts → errors-Cl6Q5lqG.d.mts} +10 -8
- package/dist/{errors-DednD9bG.d.ts → errors-Cl6Q5lqG.d.ts} +10 -8
- package/dist/errors.d.mts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +78 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -3
- package/dist/index.mjs.map +1 -1
- package/dist/ui-events.js +3 -3
- package/dist/ui-events.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-UFNTICCX.js.map +0 -1
- package/dist/chunk-V2OHL2JS.mjs.map +0 -1
- /package/dist/{chunk-Z574MVAT.mjs.map → chunk-5AIX6YY5.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -10,16 +10,17 @@ import {
|
|
|
10
10
|
UI_REQUEST_TIMEOUT_TAG,
|
|
11
11
|
UI_RESPONSE,
|
|
12
12
|
UiRequestRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5AIX6YY5.mjs";
|
|
14
14
|
import {
|
|
15
15
|
HardwareErrorCode,
|
|
16
16
|
ORPHAN_ELIGIBLE_ERROR_CODES,
|
|
17
17
|
createHwkError,
|
|
18
18
|
defaultOriginForCode,
|
|
19
19
|
defaultRecoveryForCode,
|
|
20
|
+
isHardwareErrorCode,
|
|
20
21
|
isHwkRecoveryHint,
|
|
21
22
|
operationMayHaveCompletedParams
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VKP46GTC.mjs";
|
|
23
24
|
|
|
24
25
|
// src/types/response.ts
|
|
25
26
|
function success(payload) {
|
|
@@ -673,7 +674,9 @@ function createCombinedConnector(connectors) {
|
|
|
673
674
|
});
|
|
674
675
|
perConnector.sort((a, b) => a.index - b.index);
|
|
675
676
|
for (const [id, owner] of deviceOwner) {
|
|
676
|
-
if (onTransport(owner, options.transportType))
|
|
677
|
+
if (owner.connectionType !== "ble" && onTransport(owner, options.transportType)) {
|
|
678
|
+
deviceOwner.delete(id);
|
|
679
|
+
}
|
|
677
680
|
}
|
|
678
681
|
const merged = [];
|
|
679
682
|
perConnector.forEach(({ index, devices }) => {
|
|
@@ -846,6 +849,46 @@ var TypedEventEmitter = class {
|
|
|
846
849
|
}
|
|
847
850
|
};
|
|
848
851
|
|
|
852
|
+
// src/types/electronBle.ts
|
|
853
|
+
var isSerializedError = (value) => typeof value === "object" && value !== null && !(value instanceof Error) && typeof value.message === "string";
|
|
854
|
+
var restoreHostError = ({ message, code, params }) => isHardwareErrorCode(code) ? createHwkError({ code, message, ...params ? { params } : {} }) : new Error(message);
|
|
855
|
+
function rehydrateElectronBleErrors(bridge) {
|
|
856
|
+
const wrapped = Object.create(bridge);
|
|
857
|
+
const invoke = (method, args) => {
|
|
858
|
+
const result = method.apply(bridge, args);
|
|
859
|
+
if (typeof result?.then !== "function") return result;
|
|
860
|
+
return Promise.resolve(result).catch((error) => {
|
|
861
|
+
throw isSerializedError(error) ? restoreHostError(error) : error;
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
const descriptors = /* @__PURE__ */ new Map();
|
|
865
|
+
for (let source = bridge; source && source !== Object.prototype; source = Object.getPrototypeOf(source)) {
|
|
866
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
867
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
868
|
+
if (key !== "constructor" && descriptor && !descriptors.has(key))
|
|
869
|
+
descriptors.set(key, descriptor);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
for (const [key, descriptor] of descriptors) {
|
|
873
|
+
if (typeof descriptor.value === "function") {
|
|
874
|
+
Object.defineProperty(wrapped, key, {
|
|
875
|
+
value: (...args) => invoke(bridge[key], args)
|
|
876
|
+
});
|
|
877
|
+
} else if (descriptor.get || descriptor.set) {
|
|
878
|
+
Object.defineProperty(wrapped, key, {
|
|
879
|
+
get: descriptor.get ? () => {
|
|
880
|
+
const value = Reflect.get(bridge, key, bridge);
|
|
881
|
+
return typeof value === "function" ? (...args) => invoke(value, args) : value;
|
|
882
|
+
} : void 0,
|
|
883
|
+
set: descriptor.set ? (value) => {
|
|
884
|
+
Reflect.set(bridge, key, value, bridge);
|
|
885
|
+
} : void 0
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return wrapped;
|
|
890
|
+
}
|
|
891
|
+
|
|
849
892
|
// src/utils/requestSaveDeviceBinding.ts
|
|
850
893
|
function emitDeviceBindingStatus(emitter, selectionRequestId, status) {
|
|
851
894
|
emitter.emit(UI_REQUEST.DEVICE_BINDING_STATUS, {
|
|
@@ -1759,6 +1802,7 @@ export {
|
|
|
1759
1802
|
hexToBytes,
|
|
1760
1803
|
isAllNetworkMethodName,
|
|
1761
1804
|
isConnectionLost,
|
|
1805
|
+
isHardwareErrorCode,
|
|
1762
1806
|
isHardwareOperationId,
|
|
1763
1807
|
isHwkRecoveryHint,
|
|
1764
1808
|
isKnownNonTargetHardwareVendor,
|
|
@@ -1772,6 +1816,7 @@ export {
|
|
|
1772
1816
|
pickConnectionContext,
|
|
1773
1817
|
prepareSolanaOffchainMessageV1,
|
|
1774
1818
|
rehydrateConnectorError,
|
|
1819
|
+
rehydrateElectronBleErrors,
|
|
1775
1820
|
requestBleDeviceSelection,
|
|
1776
1821
|
requestSaveDeviceBinding,
|
|
1777
1822
|
resolveHardwareOperationTarget,
|