@onekeyfe/hd-transport 1.2.0-alpha.12 → 1.2.0-alpha.121
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/__tests__/messages.test.js +165 -13
- package/__tests__/protocol-v2-ble-frame-writer.test.js +119 -0
- package/__tests__/protocol-v2-link-manager.test.js +120 -9
- package/__tests__/protocol-v2-usb-transport-base.test.js +36 -2
- package/__tests__/protocol-v2.test.js +566 -69
- package/__tests__/transport-log.test.js +79 -0
- package/dist/constants.d.ts +3 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +696 -221
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +662 -130
- package/dist/protocols/index.d.ts +24 -1
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/ble-frame-writer.d.ts +15 -0
- package/dist/protocols/v2/ble-frame-writer.d.ts.map +1 -0
- package/dist/protocols/v2/decode.d.ts +11 -0
- package/dist/protocols/v2/decode.d.ts.map +1 -1
- package/dist/protocols/v2/errors.d.ts +8 -0
- package/dist/protocols/v2/errors.d.ts.map +1 -0
- package/dist/protocols/v2/frame-assembler.d.ts.map +1 -1
- package/dist/protocols/v2/index.d.ts +2 -0
- package/dist/protocols/v2/index.d.ts.map +1 -1
- package/dist/protocols/v2/link-manager.d.ts +4 -0
- package/dist/protocols/v2/link-manager.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +11 -4
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/protocols/v2/usb-transport-base.d.ts +1 -0
- package/dist/protocols/v2/usb-transport-base.d.ts.map +1 -1
- package/dist/serialization/protobuf/decode.d.ts.map +1 -1
- package/dist/serialization/protobuf/encode.d.ts.map +1 -1
- package/dist/types/messages.d.ts +345 -158
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +21 -3
- package/dist/types/transport.d.ts.map +1 -1
- package/dist/utils/transportLog.d.ts +9 -0
- package/dist/utils/transportLog.d.ts.map +1 -0
- package/messages-protocol-v2.json +1057 -577
- package/package.json +3 -3
- package/scripts/protobuf-build.sh +85 -217
- package/scripts/protobuf-patches/index.js +1 -0
- package/scripts/protobuf-types.js +19 -1
- package/src/constants.ts +30 -16
- package/src/index.ts +5 -1
- package/src/protocols/index.ts +127 -4
- package/src/protocols/v2/ble-frame-writer.ts +77 -0
- package/src/protocols/v2/crc8.ts +1 -1
- package/src/protocols/v2/decode.ts +49 -12
- package/src/protocols/v2/encode.ts +1 -1
- package/src/protocols/v2/errors.ts +25 -0
- package/src/protocols/v2/frame-assembler.ts +6 -4
- package/src/protocols/v2/index.ts +2 -0
- package/src/protocols/v2/link-manager.ts +54 -5
- package/src/protocols/v2/session.ts +166 -59
- package/src/protocols/v2/usb-transport-base.ts +29 -10
- package/src/serialization/protobuf/decode.ts +4 -1
- package/src/serialization/protobuf/encode.ts +5 -1
- package/src/types/messages.ts +421 -201
- package/src/types/transport.ts +30 -3
- package/src/utils/transportLog.ts +102 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import ByteBuffer from 'bytebuffer';
|
|
3
3
|
import { encodeEnvelopeMessage } from './v1/packets';
|
|
4
4
|
import { decodeMessage as decodeV1Message } from './v1/receive';
|
|
5
|
-
import { isAckFrame } from './v2';
|
|
5
|
+
import { inspectFrameHeader, isAckFrame } from './v2';
|
|
6
6
|
import type { Root } from 'protobufjs/light';
|
|
7
7
|
export declare const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
8
8
|
type ProtocolV2Schemas = {
|
|
@@ -27,8 +27,31 @@ export declare const ProtocolV1: {
|
|
|
27
27
|
};
|
|
28
28
|
export declare const ProtocolV2: {
|
|
29
29
|
isAckFrame: typeof isAckFrame;
|
|
30
|
+
inspectFrameHeader: typeof inspectFrameHeader;
|
|
31
|
+
inspectFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
32
|
+
messageName: string;
|
|
33
|
+
messageTypeId: number;
|
|
34
|
+
pbPayload: Uint8Array;
|
|
35
|
+
seq: number;
|
|
36
|
+
router: number;
|
|
37
|
+
packetSrc: number;
|
|
38
|
+
dataType: number;
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
30
41
|
encodeFrame(schemas: ProtocolV2Schemas, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
31
42
|
decodeFrame(schemas: ProtocolV2Schemas, frame: Uint8Array): {
|
|
43
|
+
message: {
|
|
44
|
+
version: any;
|
|
45
|
+
build_fingerprint: string;
|
|
46
|
+
supported_messages: any;
|
|
47
|
+
protobuf_definition: null;
|
|
48
|
+
};
|
|
49
|
+
messageName: string;
|
|
50
|
+
messageTypeId: number;
|
|
51
|
+
pbPayload: Uint8Array;
|
|
52
|
+
seq: number;
|
|
53
|
+
type: string;
|
|
54
|
+
} | {
|
|
32
55
|
message: {
|
|
33
56
|
[key: string]: any;
|
|
34
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,EAGL,kBAAkB,EAClB,UAAU,EACX,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAqHF,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAC;AAEF,eAAO,MAAM,UAAU;;;0BAIC,iBAAiB,SAAS,UAAU;;;;;;;;;;yBAgB/C,iBAAiB,QACpB,MAAM,QACN,OAAO,MAAM,EAAE,OAAO,CAAC,YACpB,sBAAsB;yBAkBZ,iBAAiB,SAAS,UAAU;;;;;;;;;;;;;;;;;;;;;;CAqC1D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ProtocolV2BleFrameWriterOptions = {
|
|
2
|
+
frame: Uint8Array;
|
|
3
|
+
packetCapacity: number;
|
|
4
|
+
writePacket: (packet: Uint8Array, packetIndex: number) => Promise<void>;
|
|
5
|
+
assertActive?: () => void;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
abortMessage?: string;
|
|
8
|
+
initialDelayMs?: number;
|
|
9
|
+
burstSize?: number;
|
|
10
|
+
burstPauseMs?: number;
|
|
11
|
+
flushDelayMs?: number;
|
|
12
|
+
wait?: (timeoutMs: number) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare function writeProtocolV2BleFrame({ frame, packetCapacity, writePacket, assertActive, signal, abortMessage, initialDelayMs, burstSize, burstPauseMs, flushDelayMs, wait, }: ProtocolV2BleFrameWriterOptions): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=ble-frame-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ble-frame-writer.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/ble-frame-writer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,UAAU,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAOF,wBAAsB,uBAAuB,CAAC,EAC5C,KAAK,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,MAAM,EACN,YAA8C,EAC9C,cAAkB,EAClB,SAAS,EACT,YAAgB,EAChB,YAAgB,EAChB,IAAkB,GACnB,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CjD"}
|
|
@@ -2,7 +2,18 @@ export interface ProtoV2Frame {
|
|
|
2
2
|
messageTypeId: number;
|
|
3
3
|
pbPayload: Uint8Array;
|
|
4
4
|
seq: number;
|
|
5
|
+
router: number;
|
|
6
|
+
packetSrc: number;
|
|
7
|
+
dataType: number;
|
|
5
8
|
}
|
|
9
|
+
export type ProtoV2FrameHeader = {
|
|
10
|
+
frameLen: number;
|
|
11
|
+
router: number;
|
|
12
|
+
packetSrc: number;
|
|
13
|
+
dataType: number;
|
|
14
|
+
seq: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function inspectFrameHeader(data: Uint8Array): ProtoV2FrameHeader;
|
|
6
17
|
export declare function isAckFrame(data: Uint8Array): boolean;
|
|
7
18
|
export declare function decodeFrame(data: Uint8Array): ProtoV2Frame;
|
|
8
19
|
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/decode.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAE3B,aAAa,EAAE,MAAM,CAAC;IAEtB,SAAS,EAAE,UAAU,CAAC;IAEtB,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,CAqDvE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWpD;AAYD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAgB1D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ProtocolV2LinkErrorCode = 'response-timeout' | 'io' | 'generation' | 'router' | 'packet-source' | 'ack-sequence' | 'response-sequence' | 'frame';
|
|
2
|
+
export declare class ProtocolV2LinkError extends Error {
|
|
3
|
+
readonly code: ProtocolV2LinkErrorCode;
|
|
4
|
+
readonly cause?: unknown;
|
|
5
|
+
constructor(code: ProtocolV2LinkErrorCode, message: string, cause?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare const isProtocolV2LinkError: (error: unknown) => error is ProtocolV2LinkError;
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,IAAI,GACJ,YAAY,GACZ,QAAQ,GACR,eAAe,GACf,cAAc,GACd,mBAAmB,GACnB,OAAO,CAAC;AAEZ,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IAEvC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAEb,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM5E;AAED,eAAO,MAAM,qBAAqB,UAAW,OAAO,iCACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-assembler.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/frame-assembler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frame-assembler.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/frame-assembler.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CASlE;AAED,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAqB;IAEnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,aAAa,SAA8B;IAIvD,KAAK;IAIL,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS;IAU/C,KAAK,CAAC,KAAK,GAAE,UAA8B,GAAG,UAAU,EAAE;IAW1D,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,YAAY;CA2CrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
@@ -22,6 +22,9 @@ export declare class ProtocolV2LinkManager<Key> {
|
|
|
22
22
|
private readonly links;
|
|
23
23
|
private readonly sequences;
|
|
24
24
|
private readonly callQueues;
|
|
25
|
+
private readonly generations;
|
|
26
|
+
private readonly invalidationReasons;
|
|
27
|
+
private readonly invalidations;
|
|
25
28
|
private readonly options;
|
|
26
29
|
constructor(options: ProtocolV2LinkManagerOptions<Key>);
|
|
27
30
|
call(key: Key, createAdapter: () => ProtocolV2LinkAdapter, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<MessageFromOneKey>;
|
|
@@ -31,5 +34,6 @@ export declare class ProtocolV2LinkManager<Key> {
|
|
|
31
34
|
private getOrCreateLink;
|
|
32
35
|
private executeCall;
|
|
33
36
|
private clearSettledCallQueue;
|
|
37
|
+
private assertCallGeneration;
|
|
34
38
|
}
|
|
35
39
|
//# sourceMappingURL=link-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-manager.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/link-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link-manager.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/link-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,MAAM,iCAAiC,GA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AC,aAAa,CAAiC;IAE/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;gBAEhD,OAAO,EAAE,4BAA4B,CAAC,GAAG,CAAC;IAItD,IAAI,CACF,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,qBAAqB,EAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IAmBvB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BvD,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5C,OAAO,CAAC,eAAe;YA+CT,WAAW;IAkBzB,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,oBAAoB;CAW7B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ProtocolV2FrameAssembler, concatUint8Arrays } from './frame-assembler';
|
|
2
2
|
import { ProtocolV2SequenceCursor } from './sequence-cursor';
|
|
3
3
|
import type { Root } from 'protobufjs/light';
|
|
4
|
-
import type { MessageFromOneKey } from '../../types';
|
|
4
|
+
import type { MessageFromOneKey, TransportWriteMetrics } from '../../types';
|
|
5
|
+
export * from './errors';
|
|
5
6
|
export type ProtocolV2Schemas = {
|
|
6
7
|
protocolV1: Root;
|
|
7
8
|
protocolV2: Root;
|
|
@@ -9,8 +10,10 @@ export type ProtocolV2Schemas = {
|
|
|
9
10
|
export type ProtocolV2CallContext = {
|
|
10
11
|
messageName: string;
|
|
11
12
|
timeoutMs?: number;
|
|
12
|
-
|
|
13
|
+
highThroughput: boolean;
|
|
14
|
+
writeWithResponse?: boolean;
|
|
13
15
|
generation: number;
|
|
16
|
+
signal: AbortSignal;
|
|
14
17
|
};
|
|
15
18
|
type ProtocolLogger = {
|
|
16
19
|
debug?: (...args: any[]) => void;
|
|
@@ -35,18 +38,22 @@ export type ProtocolV2CallOptions = {
|
|
|
35
38
|
expectedTypes?: string[];
|
|
36
39
|
intermediateTypes?: string[];
|
|
37
40
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
41
|
+
onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
|
|
42
|
+
returnAfterWrite?: boolean;
|
|
43
|
+
writeWithResponse?: boolean;
|
|
38
44
|
};
|
|
39
45
|
export { concatUint8Arrays, ProtocolV2FrameAssembler };
|
|
40
46
|
export { ProtocolV2SequenceCursor };
|
|
41
47
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
42
48
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
49
|
+
export declare function isProtocolV2HighThroughputCall(name: string): boolean;
|
|
43
50
|
export declare function getErrorMessage(error: unknown): string;
|
|
44
|
-
export declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void): Promise<T>;
|
|
45
|
-
export declare const PROTOCOL_V2_WRITE_WATCHDOG_TIMEOUT_MS = 0;
|
|
51
|
+
export declare function withProtocolTimeout<T>(promise: Promise<T>, timeoutMs: number | undefined, createTimeoutError: () => Error, onTimeout?: () => void, abortSignal?: AbortSignal): Promise<T>;
|
|
46
52
|
export declare class ProtocolV2Session {
|
|
47
53
|
private readonly options;
|
|
48
54
|
private readonly sequenceCursor;
|
|
49
55
|
private pendingCall;
|
|
56
|
+
private lastResponseSequence?;
|
|
50
57
|
constructor(options: ProtocolV2SessionOptions);
|
|
51
58
|
call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
|
|
52
59
|
private executeCall;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"m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AAM,KAAK,EAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,CAAC,CAAC,CAqCZ;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;IAI1D,OAAO,CAAC,WAAW,CAAuC;IAE1D,OAAO,CAAC,oBAAoB,CAAC,CAAS;gBAE1B,OAAO,EAAE,wBAAwB;IAK7C,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,GAAE,qBAA0B,GACtC,OAAO,CAAC,iBAAiB,CAAC;IAS7B,OAAO,CAAC,WAAW;CAoKpB;AAED,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAwB,EACxB,aAAa,EACb,aAAa,GACd,EAAE;IACD,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D,oBAuBA"}
|
|
@@ -27,5 +27,6 @@ export declare abstract class ProtocolV2UsbTransportBase<Key> {
|
|
|
27
27
|
private createProtocolV2UsbAdapter;
|
|
28
28
|
private getProtocolV2UsbAssembler;
|
|
29
29
|
private createProtocolV2UsbCancellation;
|
|
30
|
+
private createProtocolV2UsbIoError;
|
|
30
31
|
}
|
|
31
32
|
//# sourceMappingURL=usb-transport-base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usb-transport-base.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/usb-transport-base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usb-transport-base.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/usb-transport-base.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAEpG,MAAM,MAAM,iCAAiC,GAAG;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AASF,8BAAsB,0BAA0B,CAAC,GAAG;IAClD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAEhE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA4C;IAEpF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA0B;IAEnE,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA6C;IAExF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAoC;IAEzE,SAAS,aAAa,OAAO,EAAE,iCAAiC;IAahE,SAAS,CAAC,QAAQ,CAAC,uBAAuB,IAAI,iBAAiB;IAE/D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,IAAI,wBAAwB,CAAC,QAAQ,CAAC;IAE/E,SAAS,CAAC,QAAQ,CAAC,wBAAwB,CACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,uBAAuB,C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AIpC,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/decode.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,KAAK,EAAkB,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAgF7D,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,UAAU;;CAsBrD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/encode.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/encode.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAKpC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAmB7C,wBAAgB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OA+ChD;AAED,eAAO,MAAM,MAAM,YAAa,IAAI,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,eASlE,CAAC"}
|