@onekeyfe/hd-transport 1.2.0-alpha.98 → 1.2.0
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/README.md +1 -1
- package/__tests__/messages.test.js +25 -0
- package/__tests__/protocol-v2-link-manager.test.js +126 -0
- package/__tests__/protocol-v2-usb-transport-base.test.js +6 -4
- package/__tests__/protocol-v2.test.js +309 -27
- package/dist/index.d.ts +131 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -15
- package/dist/protocols/index.d.ts +12 -0
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/errors.d.ts +8 -0
- package/dist/protocols/v2/errors.d.ts.map +1 -1
- package/dist/protocols/v2/link-manager.d.ts +2 -0
- package/dist/protocols/v2/link-manager.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +13 -1
- 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/types/messages.d.ts +50 -7
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/types/transport.d.ts.map +1 -1
- package/messages-protocol-v2.json +140 -13
- package/package.json +2 -2
- package/src/protocols/index.ts +91 -0
- package/src/protocols/v2/errors.ts +29 -0
- package/src/protocols/v2/link-manager.ts +57 -5
- package/src/protocols/v2/session.ts +133 -4
- package/src/protocols/v2/usb-transport-base.ts +13 -0
- package/src/types/messages.ts +61 -7
- package/src/types/transport.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -525,6 +525,18 @@ class ProtocolV2LinkError extends Error {
|
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
const isProtocolV2LinkError = (error) => error instanceof ProtocolV2LinkError;
|
|
528
|
+
const createProtocolV2LinkDisabledError = (failureCode, firmwareMessage) => Object.assign(new Error(firmwareMessage), {
|
|
529
|
+
name: 'ProtocolV2LinkDisabledError',
|
|
530
|
+
failureCode,
|
|
531
|
+
firmwareMessage,
|
|
532
|
+
});
|
|
533
|
+
const isProtocolV2LinkDisabledError = (error) => error instanceof Error &&
|
|
534
|
+
error.name === 'ProtocolV2LinkDisabledError' &&
|
|
535
|
+
'failureCode' in error &&
|
|
536
|
+
'firmwareMessage' in error;
|
|
537
|
+
const isProtocolV2LinkDisabledFailure = (failureCode, firmwareMessage) => (failureCode === 'Failure_ProcessError' || failureCode === 5) &&
|
|
538
|
+
typeof firmwareMessage === 'string' &&
|
|
539
|
+
firmwareMessage.trim().toLowerCase() === 'link disabled';
|
|
528
540
|
|
|
529
541
|
function concatUint8Arrays(arrays) {
|
|
530
542
|
const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
|
|
@@ -661,12 +673,90 @@ var protocolV2Codec = /*#__PURE__*/Object.freeze({
|
|
|
661
673
|
decodeFrame: decodeFrame,
|
|
662
674
|
ProtocolV2LinkError: ProtocolV2LinkError,
|
|
663
675
|
isProtocolV2LinkError: isProtocolV2LinkError,
|
|
676
|
+
createProtocolV2LinkDisabledError: createProtocolV2LinkDisabledError,
|
|
677
|
+
isProtocolV2LinkDisabledError: isProtocolV2LinkDisabledError,
|
|
678
|
+
isProtocolV2LinkDisabledFailure: isProtocolV2LinkDisabledFailure,
|
|
664
679
|
concatUint8Arrays: concatUint8Arrays,
|
|
665
680
|
ProtocolV2FrameAssembler: ProtocolV2FrameAssembler,
|
|
666
681
|
writeProtocolV2BleFrame: writeProtocolV2BleFrame
|
|
667
682
|
});
|
|
668
683
|
|
|
669
684
|
const PROTOCOL_V2_SYS_MESSAGE_THRESHOLD = 60000;
|
|
685
|
+
const LEGACY_PROTOCOL_V2_PROTOCOL_INFO = protobuf.Type.fromJSON('LegacyProtocolInfo', {
|
|
686
|
+
fields: {
|
|
687
|
+
version: {
|
|
688
|
+
rule: 'required',
|
|
689
|
+
type: 'uint32',
|
|
690
|
+
id: 1,
|
|
691
|
+
},
|
|
692
|
+
supported_messages: {
|
|
693
|
+
rule: 'repeated',
|
|
694
|
+
type: 'uint32',
|
|
695
|
+
id: 2,
|
|
696
|
+
options: {
|
|
697
|
+
packed: false,
|
|
698
|
+
},
|
|
699
|
+
},
|
|
700
|
+
protobuf_definition: {
|
|
701
|
+
type: 'string',
|
|
702
|
+
id: 3,
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
});
|
|
706
|
+
const decodeLegacyProtocolV2ProtocolInfo = (pbPayload) => {
|
|
707
|
+
var _a;
|
|
708
|
+
const byteBuffer = ByteBuffer__default["default"].wrap(Buffer.from(pbPayload));
|
|
709
|
+
const legacy = decode(LEGACY_PROTOCOL_V2_PROTOCOL_INFO, byteBuffer);
|
|
710
|
+
return {
|
|
711
|
+
version: legacy.version,
|
|
712
|
+
build_fingerprint: '',
|
|
713
|
+
supported_messages: (_a = legacy.supported_messages) !== null && _a !== void 0 ? _a : [],
|
|
714
|
+
protobuf_definition: null,
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
const isLegacyProtocolV2ProtocolInfoWireLayout = (pbPayload) => {
|
|
718
|
+
const reader = protobuf.Reader.create(pbPayload);
|
|
719
|
+
let hasVersion = false;
|
|
720
|
+
try {
|
|
721
|
+
while (reader.pos < reader.len) {
|
|
722
|
+
const tag = reader.uint32();
|
|
723
|
+
const fieldNumber = tag >>> 3;
|
|
724
|
+
const wireType = tag & 0x07;
|
|
725
|
+
if (fieldNumber === 1) {
|
|
726
|
+
if (wireType !== 0)
|
|
727
|
+
return false;
|
|
728
|
+
hasVersion = true;
|
|
729
|
+
}
|
|
730
|
+
else if (fieldNumber === 2) {
|
|
731
|
+
if (wireType !== 0)
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
else if (fieldNumber === 3) {
|
|
735
|
+
if (wireType !== 2)
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
reader.skipType(wireType);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
catch (_a) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
return hasVersion;
|
|
748
|
+
};
|
|
749
|
+
const tryDecodeLegacyProtocolV2ProtocolInfo = (messageName, pbPayload) => {
|
|
750
|
+
if (messageName !== 'ProtocolInfo' || !isLegacyProtocolV2ProtocolInfoWireLayout(pbPayload)) {
|
|
751
|
+
return undefined;
|
|
752
|
+
}
|
|
753
|
+
try {
|
|
754
|
+
return decodeLegacyProtocolV2ProtocolInfo(pbPayload);
|
|
755
|
+
}
|
|
756
|
+
catch (_a) {
|
|
757
|
+
return undefined;
|
|
758
|
+
}
|
|
759
|
+
};
|
|
670
760
|
const resolveProtocolV2EncodeSchema = (name, schemas) => {
|
|
671
761
|
try {
|
|
672
762
|
schemas.protocolV2.lookupType(name);
|
|
@@ -745,6 +835,17 @@ const ProtocolV2 = {
|
|
|
745
835
|
message = decode(Message, rxByteBuffer);
|
|
746
836
|
}
|
|
747
837
|
catch (cause) {
|
|
838
|
+
const legacyProtocolInfo = tryDecodeLegacyProtocolV2ProtocolInfo(messageName, pbPayload);
|
|
839
|
+
if (legacyProtocolInfo) {
|
|
840
|
+
return {
|
|
841
|
+
message: legacyProtocolInfo,
|
|
842
|
+
messageName,
|
|
843
|
+
messageTypeId,
|
|
844
|
+
pbPayload,
|
|
845
|
+
seq,
|
|
846
|
+
type: messageName,
|
|
847
|
+
};
|
|
848
|
+
}
|
|
748
849
|
const error = new Error(`Protocol V2 protobuf decode failed for "${messageName}" ` +
|
|
749
850
|
`(${messageTypeId}, ${pbPayload.length}-byte payload); ` +
|
|
750
851
|
'the payload is malformed or incompatible with the active SDK schema.');
|
|
@@ -894,6 +995,25 @@ function hexToBytes(hex) {
|
|
|
894
995
|
}
|
|
895
996
|
return bytes;
|
|
896
997
|
}
|
|
998
|
+
function detectProtocolV2LinkDisabledError({ schemas, assembler, bytes, }) {
|
|
999
|
+
var _a, _b;
|
|
1000
|
+
try {
|
|
1001
|
+
for (const frame of assembler.drain(bytes)) {
|
|
1002
|
+
const response = call(ProtocolV2.decodeFrame(schemas, frame));
|
|
1003
|
+
if (response.type === 'Failure') {
|
|
1004
|
+
const failureCode = (_a = response.message) === null || _a === void 0 ? void 0 : _a.code;
|
|
1005
|
+
const firmwareMessage = (_b = response.message) === null || _b === void 0 ? void 0 : _b.message;
|
|
1006
|
+
if (isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
1007
|
+
return createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
catch (_c) {
|
|
1013
|
+
assembler.reset();
|
|
1014
|
+
}
|
|
1015
|
+
return undefined;
|
|
1016
|
+
}
|
|
897
1017
|
function bytesToHex(bytes) {
|
|
898
1018
|
return Array.from(bytes)
|
|
899
1019
|
.map(b => b.toString(16).padStart(2, '0'))
|
|
@@ -991,6 +1111,7 @@ class ProtocolV2Session {
|
|
|
991
1111
|
constructor(options) {
|
|
992
1112
|
var _a;
|
|
993
1113
|
this.pendingCall = Promise.resolve();
|
|
1114
|
+
this.pendingWrite = Promise.resolve();
|
|
994
1115
|
this.options = options;
|
|
995
1116
|
this.sequenceCursor = (_a = options.sequenceCursor) !== null && _a !== void 0 ? _a : new ProtocolV2SequenceCursor();
|
|
996
1117
|
}
|
|
@@ -1000,6 +1121,34 @@ class ProtocolV2Session {
|
|
|
1000
1121
|
this.pendingCall = result.catch(() => undefined);
|
|
1001
1122
|
return result;
|
|
1002
1123
|
}
|
|
1124
|
+
sendFlowControl(name, data) {
|
|
1125
|
+
const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, writeFrame, generation = 0, } = this.options;
|
|
1126
|
+
const abortController = new AbortController();
|
|
1127
|
+
const context = {
|
|
1128
|
+
messageName: name,
|
|
1129
|
+
highThroughput: false,
|
|
1130
|
+
generation,
|
|
1131
|
+
signal: abortController.signal,
|
|
1132
|
+
};
|
|
1133
|
+
const protoSeq = this.sequenceCursor.next();
|
|
1134
|
+
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
1135
|
+
packetSrc,
|
|
1136
|
+
router,
|
|
1137
|
+
seq: protoSeq,
|
|
1138
|
+
});
|
|
1139
|
+
if (maxFrameBytes !== undefined && frame.length > maxFrameBytes) {
|
|
1140
|
+
return Promise.reject(new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`));
|
|
1141
|
+
}
|
|
1142
|
+
return this.serializeWrite(() => writeFrame(frame, context)).then(() => ({
|
|
1143
|
+
type: 'WriteCompleted',
|
|
1144
|
+
message: {},
|
|
1145
|
+
}));
|
|
1146
|
+
}
|
|
1147
|
+
serializeWrite(write) {
|
|
1148
|
+
const result = this.pendingWrite.then(write, write);
|
|
1149
|
+
this.pendingWrite = result.catch(() => undefined);
|
|
1150
|
+
return result;
|
|
1151
|
+
}
|
|
1003
1152
|
executeCall(name, data, callOptions) {
|
|
1004
1153
|
const { schemas, router, packetSrc = PROTOCOL_V2_PACKET_SRC_COMMAND, maxFrameBytes, prepareCall, writeFrame, readFrame, logger, logPrefix = 'ProtocolV2', createTimeoutError, generation = 0, } = this.options;
|
|
1005
1154
|
const timeoutMs = callOptions.timeoutMs && callOptions.timeoutMs > 0
|
|
@@ -1011,8 +1160,10 @@ class ProtocolV2Session {
|
|
|
1011
1160
|
? {}
|
|
1012
1161
|
: { writeWithResponse: callOptions.writeWithResponse })), { generation, signal: abortController.signal });
|
|
1013
1162
|
const runCall = () => __awaiter(this, void 0, void 0, function* () {
|
|
1014
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1015
|
-
|
|
1163
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1164
|
+
if (!this.pendingResponseAfterWrite) {
|
|
1165
|
+
yield (prepareCall === null || prepareCall === void 0 ? void 0 : prepareCall(baseCallContext));
|
|
1166
|
+
}
|
|
1016
1167
|
const protoSeq = this.sequenceCursor.next();
|
|
1017
1168
|
const frame = ProtocolV2.encodeFrame(schemas, name, data, {
|
|
1018
1169
|
packetSrc,
|
|
@@ -1023,7 +1174,7 @@ class ProtocolV2Session {
|
|
|
1023
1174
|
throw new Error(`Protocol V2 frame too large for transport: ${frame.length} > ${maxFrameBytes}`);
|
|
1024
1175
|
}
|
|
1025
1176
|
const writeStartedAt = Date.now();
|
|
1026
|
-
yield writeFrame(frame, baseCallContext);
|
|
1177
|
+
yield this.serializeWrite(() => writeFrame(frame, baseCallContext));
|
|
1027
1178
|
try {
|
|
1028
1179
|
(_a = callOptions.onWriteCompleted) === null || _a === void 0 ? void 0 : _a.call(callOptions, {
|
|
1029
1180
|
elapsedMs: Math.max(Date.now() - writeStartedAt, 0),
|
|
@@ -1033,6 +1184,15 @@ class ProtocolV2Session {
|
|
|
1033
1184
|
catch (error) {
|
|
1034
1185
|
(_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, `${logPrefix} write metrics callback failed: ${String(error)}`);
|
|
1035
1186
|
}
|
|
1187
|
+
if (callOptions.returnAfterWrite) {
|
|
1188
|
+
if ((_c = callOptions.expectedTypes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
1189
|
+
this.pendingResponseAfterWrite = {
|
|
1190
|
+
expectedTypes: new Set(callOptions.expectedTypes),
|
|
1191
|
+
onResponse: callOptions.onResponseAfterWrite,
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
return { type: 'WriteCompleted', message: {} };
|
|
1195
|
+
}
|
|
1036
1196
|
while (!abortController.signal.aborted) {
|
|
1037
1197
|
const rxFrame = yield readFrame(baseCallContext);
|
|
1038
1198
|
if (abortController.signal.aborted)
|
|
@@ -1075,14 +1235,31 @@ class ProtocolV2Session {
|
|
|
1075
1235
|
}
|
|
1076
1236
|
this.lastResponseSequence = decoded.seq;
|
|
1077
1237
|
const response = call(decoded);
|
|
1078
|
-
|
|
1079
|
-
|
|
1238
|
+
const { pendingResponseAfterWrite } = this;
|
|
1239
|
+
let belongsToWriteOnlyCall = false;
|
|
1240
|
+
if (pendingResponseAfterWrite) {
|
|
1241
|
+
belongsToWriteOnlyCall = pendingResponseAfterWrite.expectedTypes.has(response.type);
|
|
1242
|
+
if (belongsToWriteOnlyCall || COMMON_TERMINAL_RESPONSE_TYPES.has(response.type)) {
|
|
1243
|
+
this.pendingResponseAfterWrite = undefined;
|
|
1244
|
+
if (belongsToWriteOnlyCall) {
|
|
1245
|
+
try {
|
|
1246
|
+
(_d = pendingResponseAfterWrite.onResponse) === null || _d === void 0 ? void 0 : _d.call(pendingResponseAfterWrite, response);
|
|
1247
|
+
}
|
|
1248
|
+
catch (error) {
|
|
1249
|
+
(_e = logger === null || logger === void 0 ? void 0 : logger.error) === null || _e === void 0 ? void 0 : _e.call(logger, `${logPrefix} delayed response callback failed: ${String(error)}`);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
if (belongsToWriteOnlyCall) ;
|
|
1255
|
+
else if ((_f = callOptions.intermediateTypes) === null || _f === void 0 ? void 0 : _f.includes(response.type)) {
|
|
1256
|
+
(_g = callOptions.onIntermediateResponse) === null || _g === void 0 ? void 0 : _g.call(callOptions, response);
|
|
1080
1257
|
}
|
|
1081
1258
|
else if (isExpectedTerminalResponse(response, callOptions.expectedTypes)) {
|
|
1082
1259
|
return response;
|
|
1083
1260
|
}
|
|
1084
1261
|
else if (!shouldReduceDebug) {
|
|
1085
|
-
(
|
|
1262
|
+
(_h = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _h === void 0 ? void 0 : _h.call(logger, `[${logPrefix}] skip unexpected response for ${name}: expected=${(_j = callOptions.expectedTypes) === null || _j === void 0 ? void 0 : _j.join('|')} got=${response.type}`);
|
|
1086
1263
|
}
|
|
1087
1264
|
}
|
|
1088
1265
|
}
|
|
@@ -1095,8 +1272,8 @@ class ProtocolV2Session {
|
|
|
1095
1272
|
});
|
|
1096
1273
|
}
|
|
1097
1274
|
}
|
|
1098
|
-
function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, }) {
|
|
1099
|
-
var _a;
|
|
1275
|
+
function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', onBeforeProbe, onProbeFailed, shouldRethrow, }) {
|
|
1276
|
+
var _a, _b, _c;
|
|
1100
1277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1101
1278
|
let probeError;
|
|
1102
1279
|
try {
|
|
@@ -1108,12 +1285,22 @@ function probeProtocolV2({ call, timeoutMs, logger, logPrefix = 'ProtocolV2', on
|
|
|
1108
1285
|
if (response.type === 'Success') {
|
|
1109
1286
|
return true;
|
|
1110
1287
|
}
|
|
1288
|
+
if (response.type === 'Failure') {
|
|
1289
|
+
const failureCode = (_a = response.message) === null || _a === void 0 ? void 0 : _a.code;
|
|
1290
|
+
const firmwareMessage = (_b = response.message) === null || _b === void 0 ? void 0 : _b.message;
|
|
1291
|
+
if (isProtocolV2LinkDisabledFailure(failureCode, firmwareMessage)) {
|
|
1292
|
+
throw createProtocolV2LinkDisabledError(failureCode, firmwareMessage);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1111
1295
|
probeError = new Error(`unexpected response type ${response.type}`);
|
|
1112
1296
|
}
|
|
1113
1297
|
catch (error) {
|
|
1298
|
+
if (isProtocolV2LinkDisabledError(error) || (shouldRethrow === null || shouldRethrow === void 0 ? void 0 : shouldRethrow(error))) {
|
|
1299
|
+
throw error;
|
|
1300
|
+
}
|
|
1114
1301
|
probeError = error;
|
|
1115
1302
|
}
|
|
1116
|
-
(
|
|
1303
|
+
(_c = logger === null || logger === void 0 ? void 0 : logger.debug) === null || _c === void 0 ? void 0 : _c.call(logger, `[${logPrefix}] Protocol V2 probe failed:`, getErrorMessage(probeError));
|
|
1117
1304
|
yield (onProbeFailed === null || onProbeFailed === void 0 ? void 0 : onProbeFailed(probeError));
|
|
1118
1305
|
return false;
|
|
1119
1306
|
});
|
|
@@ -1130,21 +1317,53 @@ class ProtocolV2LinkManager {
|
|
|
1130
1317
|
this.options = options;
|
|
1131
1318
|
}
|
|
1132
1319
|
call(key, createAdapter, name, data, options) {
|
|
1133
|
-
var _a
|
|
1320
|
+
var _a;
|
|
1134
1321
|
const generation = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
|
|
1322
|
+
const previousQueue = this.callQueues.get(key);
|
|
1323
|
+
const timeoutMs = (options === null || options === void 0 ? void 0 : options.timeoutMs) && options.timeoutMs > 0
|
|
1324
|
+
? options.timeoutMs
|
|
1325
|
+
: PROTOCOL_V2_DEFAULT_RESPONSE_TIMEOUT_MS;
|
|
1326
|
+
const queuedAt = Date.now();
|
|
1327
|
+
let queueTimeout;
|
|
1328
|
+
let queueTimeoutError;
|
|
1329
|
+
const timeoutWhileQueued = new Promise((_, reject) => {
|
|
1330
|
+
queueTimeout = setTimeout(() => {
|
|
1331
|
+
queueTimeout = undefined;
|
|
1332
|
+
queueTimeoutError = this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
1333
|
+
reject(queueTimeoutError);
|
|
1334
|
+
}, timeoutMs);
|
|
1335
|
+
});
|
|
1135
1336
|
const run = () => {
|
|
1337
|
+
if (queueTimeout) {
|
|
1338
|
+
clearTimeout(queueTimeout);
|
|
1339
|
+
queueTimeout = undefined;
|
|
1340
|
+
}
|
|
1341
|
+
if (queueTimeoutError) {
|
|
1342
|
+
throw queueTimeoutError;
|
|
1343
|
+
}
|
|
1136
1344
|
this.assertCallGeneration(key, generation);
|
|
1137
|
-
|
|
1345
|
+
const remainingTimeoutMs = previousQueue ? timeoutMs - (Date.now() - queuedAt) : timeoutMs;
|
|
1346
|
+
if (remainingTimeoutMs <= 0) {
|
|
1347
|
+
throw this.createQueuedCallTimeoutError(key, name, timeoutMs);
|
|
1348
|
+
}
|
|
1349
|
+
return this.executeCall(key, createAdapter, name, data, Object.assign(Object.assign({}, options), { timeoutMs: remainingTimeoutMs }));
|
|
1138
1350
|
};
|
|
1139
|
-
const previous =
|
|
1140
|
-
const
|
|
1141
|
-
const
|
|
1351
|
+
const previous = previousQueue !== null && previousQueue !== void 0 ? previousQueue : Promise.resolve();
|
|
1352
|
+
const execution = previous.then(run, run);
|
|
1353
|
+
const result = Promise.race([execution, timeoutWhileQueued]);
|
|
1354
|
+
const queue = execution.catch(() => undefined);
|
|
1142
1355
|
this.callQueues.set(key, queue);
|
|
1143
|
-
|
|
1356
|
+
execution
|
|
1144
1357
|
.then(() => this.clearSettledCallQueue(key, queue), () => this.clearSettledCallQueue(key, queue))
|
|
1145
1358
|
.catch(() => undefined);
|
|
1146
1359
|
return result;
|
|
1147
1360
|
}
|
|
1361
|
+
sendFlowControl(key, createAdapter, name, data) {
|
|
1362
|
+
var _a;
|
|
1363
|
+
const generation = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
|
|
1364
|
+
this.assertCallGeneration(key, generation);
|
|
1365
|
+
return this.getOrCreateLink(key, createAdapter).session.sendFlowControl(name, data);
|
|
1366
|
+
}
|
|
1148
1367
|
invalidateLink(key, reason) {
|
|
1149
1368
|
var _a;
|
|
1150
1369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1259,6 +1478,13 @@ class ProtocolV2LinkManager {
|
|
|
1259
1478
|
this.callQueues.delete(key);
|
|
1260
1479
|
}
|
|
1261
1480
|
}
|
|
1481
|
+
createQueuedCallTimeoutError(key, name, timeoutMs) {
|
|
1482
|
+
var _a;
|
|
1483
|
+
const adapterTimeoutError = (_a = this.links.get(key)) === null || _a === void 0 ? void 0 : _a.adapter.createTimeoutError;
|
|
1484
|
+
return adapterTimeoutError
|
|
1485
|
+
? adapterTimeoutError(name, timeoutMs)
|
|
1486
|
+
: new ProtocolV2LinkError('response-timeout', `Protocol V2 call timeout after ${timeoutMs}ms while queued for ${name}`);
|
|
1487
|
+
}
|
|
1262
1488
|
assertCallGeneration(key, generation) {
|
|
1263
1489
|
var _a;
|
|
1264
1490
|
const currentGeneration = (_a = this.generations.get(key)) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -1305,6 +1531,9 @@ class ProtocolV2UsbTransportBase {
|
|
|
1305
1531
|
callProtocolV2Usb(key, name, data, options) {
|
|
1306
1532
|
return this.protocolV2UsbLinks.call(key, () => this.createProtocolV2UsbAdapter(key), name, data, options);
|
|
1307
1533
|
}
|
|
1534
|
+
sendProtocolV2UsbFlowControl(key, name, data) {
|
|
1535
|
+
return this.protocolV2UsbLinks.sendFlowControl(key, () => this.createProtocolV2UsbAdapter(key), name, data);
|
|
1536
|
+
}
|
|
1308
1537
|
invalidateProtocolV2UsbLink(key, reason) {
|
|
1309
1538
|
return this.protocolV2UsbLinks.invalidateLink(key, reason);
|
|
1310
1539
|
}
|
|
@@ -1953,6 +2182,12 @@ exports.DeviceFirmwareUpdateTaskStatus = void 0;
|
|
|
1953
2182
|
DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY"] = 9] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY";
|
|
1954
2183
|
DeviceFirmwareUpdateTaskStatus[DeviceFirmwareUpdateTaskStatus["FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS"] = 10] = "FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS";
|
|
1955
2184
|
})(exports.DeviceFirmwareUpdateTaskStatus || (exports.DeviceFirmwareUpdateTaskStatus = {}));
|
|
2185
|
+
exports.DeviceFirmwareUpdatePhase = void 0;
|
|
2186
|
+
(function (DeviceFirmwareUpdatePhase) {
|
|
2187
|
+
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_PREPARE"] = 0] = "FW_MGMT_UPDATER_PHASE_PREPARE";
|
|
2188
|
+
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_INSTALL"] = 1] = "FW_MGMT_UPDATER_PHASE_INSTALL";
|
|
2189
|
+
DeviceFirmwareUpdatePhase[DeviceFirmwareUpdatePhase["FW_MGMT_UPDATER_PHASE_VERIFY"] = 2] = "FW_MGMT_UPDATER_PHASE_VERIFY";
|
|
2190
|
+
})(exports.DeviceFirmwareUpdatePhase || (exports.DeviceFirmwareUpdatePhase = {}));
|
|
1956
2191
|
exports.DeviceType = void 0;
|
|
1957
2192
|
(function (DeviceType) {
|
|
1958
2193
|
DeviceType[DeviceType["CLASSIC1"] = 0] = "CLASSIC1";
|
|
@@ -2160,6 +2395,7 @@ var messages = /*#__PURE__*/Object.freeze({
|
|
|
2160
2395
|
get DeviceFactoryAck () { return exports.DeviceFactoryAck; },
|
|
2161
2396
|
get DeviceFirmwareTargetType () { return exports.DeviceFirmwareTargetType; },
|
|
2162
2397
|
get DeviceFirmwareUpdateTaskStatus () { return exports.DeviceFirmwareUpdateTaskStatus; },
|
|
2398
|
+
get DeviceFirmwareUpdatePhase () { return exports.DeviceFirmwareUpdatePhase; },
|
|
2163
2399
|
get DeviceType () { return exports.DeviceType; },
|
|
2164
2400
|
get DeviceSeType () { return exports.DeviceSeType; },
|
|
2165
2401
|
get DeviceSEState () { return exports.DeviceSEState; },
|
|
@@ -2317,12 +2553,16 @@ exports.ProtocolV2UsbTransportBase = ProtocolV2UsbTransportBase;
|
|
|
2317
2553
|
exports.TRANSPORT_EVENT = TRANSPORT_EVENT;
|
|
2318
2554
|
exports.bytesToHex = bytesToHex;
|
|
2319
2555
|
exports.concatUint8Arrays = concatUint8Arrays;
|
|
2556
|
+
exports.createProtocolV2LinkDisabledError = createProtocolV2LinkDisabledError;
|
|
2320
2557
|
exports.createTransportCallLog = createTransportCallLog;
|
|
2321
2558
|
exports["default"] = index;
|
|
2559
|
+
exports.detectProtocolV2LinkDisabledError = detectProtocolV2LinkDisabledError;
|
|
2322
2560
|
exports.getErrorMessage = getErrorMessage;
|
|
2323
2561
|
exports.getSafeTransportLogPayload = getSafeTransportLogPayload;
|
|
2324
2562
|
exports.hexToBytes = hexToBytes;
|
|
2325
2563
|
exports.isProtocolV2HighThroughputCall = isProtocolV2HighThroughputCall;
|
|
2564
|
+
exports.isProtocolV2LinkDisabledError = isProtocolV2LinkDisabledError;
|
|
2565
|
+
exports.isProtocolV2LinkDisabledFailure = isProtocolV2LinkDisabledFailure;
|
|
2326
2566
|
exports.isProtocolV2LinkError = isProtocolV2LinkError;
|
|
2327
2567
|
exports.probeProtocolV2 = probeProtocolV2;
|
|
2328
2568
|
exports.protocolV1 = index$1;
|
|
@@ -40,6 +40,18 @@ export declare const ProtocolV2: {
|
|
|
40
40
|
};
|
|
41
41
|
encodeFrame(schemas: ProtocolV2Schemas, name: string, data: Record<string, unknown>, options?: ProtocolV2FrameOptions): Uint8Array;
|
|
42
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
|
+
} | {
|
|
43
55
|
message: {
|
|
44
56
|
[key: string]: any;
|
|
45
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"}
|
|
@@ -5,4 +5,12 @@ export declare class ProtocolV2LinkError extends Error {
|
|
|
5
5
|
constructor(code: ProtocolV2LinkErrorCode, message: string, cause?: unknown);
|
|
6
6
|
}
|
|
7
7
|
export declare const isProtocolV2LinkError: (error: unknown) => error is ProtocolV2LinkError;
|
|
8
|
+
export type ProtocolV2LinkDisabledError = Error & {
|
|
9
|
+
name: 'ProtocolV2LinkDisabledError';
|
|
10
|
+
failureCode: string | number;
|
|
11
|
+
firmwareMessage: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const createProtocolV2LinkDisabledError: (failureCode: string | number, firmwareMessage: string) => ProtocolV2LinkDisabledError;
|
|
14
|
+
export declare const isProtocolV2LinkDisabledError: (error: unknown) => error is ProtocolV2LinkDisabledError;
|
|
15
|
+
export declare const isProtocolV2LinkDisabledFailure: (failureCode: unknown, firmwareMessage: unknown) => boolean;
|
|
8
16
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +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
|
+
{"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;AAEvC,MAAM,MAAM,2BAA2B,GAAG,KAAK,GAAG;IAChD,IAAI,EAAE,6BAA6B,CAAC;IACpC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iCAAiC,gBAC/B,MAAM,GAAG,MAAM,mBACX,MAAM,KACtB,2BAKC,CAAC;AAEL,eAAO,MAAM,6BAA6B,UACjC,OAAO,yCAKY,CAAC;AAE7B,eAAO,MAAM,+BAA+B,gBAAiB,OAAO,mBAAmB,OAAO,YAGpC,CAAC"}
|
|
@@ -28,12 +28,14 @@ export declare class ProtocolV2LinkManager<Key> {
|
|
|
28
28
|
private readonly options;
|
|
29
29
|
constructor(options: ProtocolV2LinkManagerOptions<Key>);
|
|
30
30
|
call(key: Key, createAdapter: () => ProtocolV2LinkAdapter, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<MessageFromOneKey>;
|
|
31
|
+
sendFlowControl(key: Key, createAdapter: () => ProtocolV2LinkAdapter, name: string, data: Record<string, unknown>): Promise<MessageFromOneKey>;
|
|
31
32
|
invalidateLink(key: Key, reason: string): Promise<void>;
|
|
32
33
|
invalidateAllLinks(reason: string): Promise<void>;
|
|
33
34
|
dispose(reason: string): Promise<void>;
|
|
34
35
|
private getOrCreateLink;
|
|
35
36
|
private executeCall;
|
|
36
37
|
private clearSettledCallQueue;
|
|
38
|
+
private createQueuedCallTimeoutError;
|
|
37
39
|
private assertCallGeneration;
|
|
38
40
|
}
|
|
39
41
|
//# 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":"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,YAAY,GAAG,aA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AE/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;IAiD7B,eAAe,CACb,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,qBAAqB,EAC1C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC;IAMvB,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,4BAA4B;IAUpC,OAAO,CAAC,oBAAoB;CAW7B"}
|
|
@@ -39,11 +39,18 @@ export type ProtocolV2CallOptions = {
|
|
|
39
39
|
intermediateTypes?: string[];
|
|
40
40
|
onIntermediateResponse?: (response: MessageFromOneKey) => void;
|
|
41
41
|
onWriteCompleted?: (metrics: TransportWriteMetrics) => void;
|
|
42
|
+
returnAfterWrite?: boolean;
|
|
43
|
+
onResponseAfterWrite?: (response: MessageFromOneKey) => void;
|
|
42
44
|
writeWithResponse?: boolean;
|
|
43
45
|
};
|
|
44
46
|
export { concatUint8Arrays, ProtocolV2FrameAssembler };
|
|
45
47
|
export { ProtocolV2SequenceCursor };
|
|
46
48
|
export declare function hexToBytes(hex: string): Uint8Array;
|
|
49
|
+
export declare function detectProtocolV2LinkDisabledError({ schemas, assembler, bytes, }: {
|
|
50
|
+
schemas: ProtocolV2Schemas;
|
|
51
|
+
assembler: ProtocolV2FrameAssembler;
|
|
52
|
+
bytes: Uint8Array;
|
|
53
|
+
}): import("./errors").ProtocolV2LinkDisabledError | undefined;
|
|
47
54
|
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
48
55
|
export declare function isProtocolV2HighThroughputCall(name: string): boolean;
|
|
49
56
|
export declare function getErrorMessage(error: unknown): string;
|
|
@@ -52,17 +59,22 @@ export declare class ProtocolV2Session {
|
|
|
52
59
|
private readonly options;
|
|
53
60
|
private readonly sequenceCursor;
|
|
54
61
|
private pendingCall;
|
|
62
|
+
private pendingWrite;
|
|
63
|
+
private pendingResponseAfterWrite?;
|
|
55
64
|
private lastResponseSequence?;
|
|
56
65
|
constructor(options: ProtocolV2SessionOptions);
|
|
57
66
|
call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
|
|
67
|
+
sendFlowControl(name: string, data: Record<string, unknown>): Promise<MessageFromOneKey>;
|
|
68
|
+
private serializeWrite;
|
|
58
69
|
private executeCall;
|
|
59
70
|
}
|
|
60
|
-
export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, }: {
|
|
71
|
+
export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, shouldRethrow, }: {
|
|
61
72
|
call: (name: string, data: Record<string, unknown>, options?: ProtocolV2CallOptions) => Promise<MessageFromOneKey>;
|
|
62
73
|
timeoutMs: number;
|
|
63
74
|
logger?: ProtocolLogger;
|
|
64
75
|
logPrefix?: string;
|
|
65
76
|
onBeforeProbe?: () => Promise<void> | void;
|
|
66
77
|
onProbeFailed?: (error: unknown) => Promise<void> | void;
|
|
78
|
+
shouldRethrow?: (error: unknown) => boolean;
|
|
67
79
|
}): Promise<boolean>;
|
|
68
80
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAW7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,cAAc,UAAU,CAAC;AAEzB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAC;I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CAAC,WAAW;CAiMpB;AAED,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAwB,EACxB,aAAa,EACb,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;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7C,oBAiCA"}
|
|
@@ -21,6 +21,7 @@ export declare abstract class ProtocolV2UsbTransportBase<Key> {
|
|
|
21
21
|
protected onProtocolV2UsbLinkInvalidated(_key: Key, _reason: string): Promise<void> | void;
|
|
22
22
|
protected rotateProtocolV2UsbGeneration(key: Key, reason: string): Promise<number>;
|
|
23
23
|
protected callProtocolV2Usb(key: Key, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<MessageFromOneKey>;
|
|
24
|
+
protected sendProtocolV2UsbFlowControl(key: Key, name: string, data: Record<string, unknown>): Promise<MessageFromOneKey>;
|
|
24
25
|
protected invalidateProtocolV2UsbLink(key: Key, reason: string): Promise<void>;
|
|
25
26
|
protected invalidateAllProtocolV2UsbLinks(reason: string): Promise<void>;
|
|
26
27
|
protected disposeProtocolV2UsbLinks(reason: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usb-transport-base.d.ts","sourceR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