@discordjs/voice 0.19.1-dev.1765454516-df0c28afc → 0.19.1-dev.1765584117-c4fc79a3c
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +27 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -614,9 +614,9 @@ declare class DAVESession extends EventEmitter {
|
|
|
614
614
|
*/
|
|
615
615
|
lastTransitionId?: number | undefined;
|
|
616
616
|
/**
|
|
617
|
-
* The pending
|
|
617
|
+
* The pending transitions, mapped by their ID and the protocol version.
|
|
618
618
|
*/
|
|
619
|
-
private
|
|
619
|
+
private pendingTransitions;
|
|
620
620
|
/**
|
|
621
621
|
* Whether this session was downgraded previously.
|
|
622
622
|
*/
|
|
@@ -670,7 +670,7 @@ declare class DAVESession extends EventEmitter {
|
|
|
670
670
|
*
|
|
671
671
|
* @param transitionId - The transition id to execute on
|
|
672
672
|
*/
|
|
673
|
-
executeTransition(transitionId: number): boolean
|
|
673
|
+
executeTransition(transitionId: number): boolean;
|
|
674
674
|
/**
|
|
675
675
|
* Prepare for a new epoch.
|
|
676
676
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -614,9 +614,9 @@ declare class DAVESession extends EventEmitter {
|
|
|
614
614
|
*/
|
|
615
615
|
lastTransitionId?: number | undefined;
|
|
616
616
|
/**
|
|
617
|
-
* The pending
|
|
617
|
+
* The pending transitions, mapped by their ID and the protocol version.
|
|
618
618
|
*/
|
|
619
|
-
private
|
|
619
|
+
private pendingTransitions;
|
|
620
620
|
/**
|
|
621
621
|
* Whether this session was downgraded previously.
|
|
622
622
|
*/
|
|
@@ -670,7 +670,7 @@ declare class DAVESession extends EventEmitter {
|
|
|
670
670
|
*
|
|
671
671
|
* @param transitionId - The transition id to execute on
|
|
672
672
|
*/
|
|
673
|
-
executeTransition(transitionId: number): boolean
|
|
673
|
+
executeTransition(transitionId: number): boolean;
|
|
674
674
|
/**
|
|
675
675
|
* Prepare for a new epoch.
|
|
676
676
|
*
|
package/dist/index.js
CHANGED
|
@@ -718,9 +718,9 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
718
718
|
*/
|
|
719
719
|
lastTransitionId;
|
|
720
720
|
/**
|
|
721
|
-
* The pending
|
|
721
|
+
* The pending transitions, mapped by their ID and the protocol version.
|
|
722
722
|
*/
|
|
723
|
-
|
|
723
|
+
pendingTransitions = /* @__PURE__ */ new Map();
|
|
724
724
|
/**
|
|
725
725
|
* Whether this session was downgraded previously.
|
|
726
726
|
*/
|
|
@@ -809,7 +809,7 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
809
809
|
*/
|
|
810
810
|
prepareTransition(data) {
|
|
811
811
|
this.emit("debug", `Preparing for transition (${data.transition_id}, v${data.protocol_version})`);
|
|
812
|
-
this.
|
|
812
|
+
this.pendingTransitions.set(data.transition_id, data.protocol_version);
|
|
813
813
|
if (data.transition_id === 0) {
|
|
814
814
|
this.executeTransition(data.transition_id);
|
|
815
815
|
} else {
|
|
@@ -825,34 +825,25 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
825
825
|
*/
|
|
826
826
|
executeTransition(transitionId) {
|
|
827
827
|
this.emit("debug", `Executing transition (${transitionId})`);
|
|
828
|
-
if (!this.
|
|
828
|
+
if (!this.pendingTransitions.has(transitionId)) {
|
|
829
829
|
this.emit("debug", `Received execute transition, but we don't have a pending transition for ${transitionId}`);
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
let transitioned = false;
|
|
833
|
-
if (transitionId === this.pendingTransition.transition_id) {
|
|
834
|
-
const oldVersion = this.protocolVersion;
|
|
835
|
-
this.protocolVersion = this.pendingTransition.protocol_version;
|
|
836
|
-
if (oldVersion !== this.protocolVersion && this.protocolVersion === 0) {
|
|
837
|
-
this.downgraded = true;
|
|
838
|
-
this.emit("debug", "Session downgraded");
|
|
839
|
-
} else if (transitionId > 0 && this.downgraded) {
|
|
840
|
-
this.downgraded = false;
|
|
841
|
-
this.session?.setPassthroughMode(true, TRANSITION_EXPIRY);
|
|
842
|
-
this.emit("debug", "Session upgraded");
|
|
843
|
-
}
|
|
844
|
-
transitioned = true;
|
|
845
|
-
this.reinitializing = false;
|
|
846
|
-
this.lastTransitionId = transitionId;
|
|
847
|
-
this.emit("debug", `Transition executed (v${oldVersion} -> v${this.protocolVersion}, id: ${transitionId})`);
|
|
848
|
-
} else {
|
|
849
|
-
this.emit(
|
|
850
|
-
"debug",
|
|
851
|
-
`Received execute transition for an unexpected transition id (expected: ${this.pendingTransition.transition_id}, actual: ${transitionId})`
|
|
852
|
-
);
|
|
830
|
+
return false;
|
|
853
831
|
}
|
|
854
|
-
|
|
855
|
-
|
|
832
|
+
const oldVersion = this.protocolVersion;
|
|
833
|
+
this.protocolVersion = this.pendingTransitions.get(transitionId);
|
|
834
|
+
if (oldVersion !== this.protocolVersion && this.protocolVersion === 0) {
|
|
835
|
+
this.downgraded = true;
|
|
836
|
+
this.emit("debug", "Session downgraded");
|
|
837
|
+
} else if (transitionId > 0 && this.downgraded) {
|
|
838
|
+
this.downgraded = false;
|
|
839
|
+
this.session?.setPassthroughMode(true, TRANSITION_EXPIRY);
|
|
840
|
+
this.emit("debug", "Session upgraded");
|
|
841
|
+
}
|
|
842
|
+
this.reinitializing = false;
|
|
843
|
+
this.lastTransitionId = transitionId;
|
|
844
|
+
this.emit("debug", `Transition executed (v${oldVersion} -> v${this.protocolVersion}, id: ${transitionId})`);
|
|
845
|
+
this.pendingTransitions.delete(transitionId);
|
|
846
|
+
return true;
|
|
856
847
|
}
|
|
857
848
|
/**
|
|
858
849
|
* Prepare for a new epoch.
|
|
@@ -913,7 +904,7 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
913
904
|
this.reinitializing = false;
|
|
914
905
|
this.lastTransitionId = transitionId;
|
|
915
906
|
} else {
|
|
916
|
-
this.
|
|
907
|
+
this.pendingTransitions.set(transitionId, this.protocolVersion);
|
|
917
908
|
}
|
|
918
909
|
this.emit("debug", `MLS commit processed (transition id: ${transitionId})`);
|
|
919
910
|
return { transitionId, success: true };
|
|
@@ -938,7 +929,7 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
938
929
|
this.reinitializing = false;
|
|
939
930
|
this.lastTransitionId = transitionId;
|
|
940
931
|
} else {
|
|
941
|
-
this.
|
|
932
|
+
this.pendingTransitions.set(transitionId, this.protocolVersion);
|
|
942
933
|
}
|
|
943
934
|
this.emit("debug", `MLS welcome processed (transition id: ${transitionId})`);
|
|
944
935
|
return { transitionId, success: true };
|
|
@@ -972,7 +963,7 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
972
963
|
this.consecutiveFailures = 0;
|
|
973
964
|
return buffer;
|
|
974
965
|
} catch (error) {
|
|
975
|
-
if (!this.reinitializing &&
|
|
966
|
+
if (!this.reinitializing && this.pendingTransitions.size === 0) {
|
|
976
967
|
this.consecutiveFailures++;
|
|
977
968
|
this.emit("debug", `Failed to decrypt a packet (${this.consecutiveFailures} consecutive fails)`);
|
|
978
969
|
if (this.consecutiveFailures > this.failureTolerance) {
|
|
@@ -981,11 +972,8 @@ var DAVESession = class extends import_node_events2.EventEmitter {
|
|
|
981
972
|
}
|
|
982
973
|
} else if (this.reinitializing) {
|
|
983
974
|
this.emit("debug", "Failed to decrypt a packet (reinitializing session)");
|
|
984
|
-
} else if (this.
|
|
985
|
-
this.emit(
|
|
986
|
-
"debug",
|
|
987
|
-
`Failed to decrypt a packet (pending transition ${this.pendingTransition.transition_id} to v${this.pendingTransition.protocol_version})`
|
|
988
|
-
);
|
|
975
|
+
} else if (this.pendingTransitions.size > 0) {
|
|
976
|
+
this.emit("debug", `Failed to decrypt a packet (${this.pendingTransitions.size} pending transition[s])`);
|
|
989
977
|
}
|
|
990
978
|
}
|
|
991
979
|
return null;
|
|
@@ -3063,7 +3051,7 @@ __name(findPackageJSON, "findPackageJSON");
|
|
|
3063
3051
|
function version(name) {
|
|
3064
3052
|
try {
|
|
3065
3053
|
if (name === "@discordjs/voice") {
|
|
3066
|
-
return "0.19.1-dev.
|
|
3054
|
+
return "0.19.1-dev.1765584117-c4fc79a3c";
|
|
3067
3055
|
}
|
|
3068
3056
|
const pkg = findPackageJSON((0, import_node_path.dirname)(require.resolve(name)), name, 3);
|
|
3069
3057
|
return pkg?.version ?? "not found";
|
|
@@ -3211,7 +3199,7 @@ async function demuxProbe(stream, probeSize = 1024, validator = validateDiscordO
|
|
|
3211
3199
|
__name(demuxProbe, "demuxProbe");
|
|
3212
3200
|
|
|
3213
3201
|
// src/index.ts
|
|
3214
|
-
var version2 = "0.19.1-dev.
|
|
3202
|
+
var version2 = "0.19.1-dev.1765584117-c4fc79a3c";
|
|
3215
3203
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3216
3204
|
0 && (module.exports = {
|
|
3217
3205
|
AudioPlayer,
|