livekit-client 0.17.4 → 0.17.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.
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  import Long from "long";
3
- import _m0 from "protobufjs/minimal";
3
+ import * as _m0 from "protobufjs/minimal";
4
4
  import {
5
5
  TrackType,
6
6
  TrackSource,
@@ -334,7 +334,22 @@ export interface SimulateScenario {
334
334
  serverLeave: boolean | undefined;
335
335
  }
336
336
 
337
- const baseSignalRequest: object = {};
337
+ function createBaseSignalRequest(): SignalRequest {
338
+ return {
339
+ offer: undefined,
340
+ answer: undefined,
341
+ trickle: undefined,
342
+ addTrack: undefined,
343
+ mute: undefined,
344
+ subscription: undefined,
345
+ trackSetting: undefined,
346
+ leave: undefined,
347
+ updateLayers: undefined,
348
+ subscriptionPermission: undefined,
349
+ syncState: undefined,
350
+ simulate: undefined,
351
+ };
352
+ }
338
353
 
339
354
  export const SignalRequest = {
340
355
  encode(
@@ -407,7 +422,7 @@ export const SignalRequest = {
407
422
  decode(input: _m0.Reader | Uint8Array, length?: number): SignalRequest {
408
423
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
409
424
  let end = length === undefined ? reader.len : reader.pos + length;
410
- const message = { ...baseSignalRequest } as SignalRequest;
425
+ const message = createBaseSignalRequest();
411
426
  while (reader.pos < end) {
412
427
  const tag = reader.uint32();
413
428
  switch (tag >>> 3) {
@@ -468,73 +483,44 @@ export const SignalRequest = {
468
483
  },
469
484
 
470
485
  fromJSON(object: any): SignalRequest {
471
- const message = { ...baseSignalRequest } as SignalRequest;
472
- if (object.offer !== undefined && object.offer !== null) {
473
- message.offer = SessionDescription.fromJSON(object.offer);
474
- } else {
475
- message.offer = undefined;
476
- }
477
- if (object.answer !== undefined && object.answer !== null) {
478
- message.answer = SessionDescription.fromJSON(object.answer);
479
- } else {
480
- message.answer = undefined;
481
- }
482
- if (object.trickle !== undefined && object.trickle !== null) {
483
- message.trickle = TrickleRequest.fromJSON(object.trickle);
484
- } else {
485
- message.trickle = undefined;
486
- }
487
- if (object.addTrack !== undefined && object.addTrack !== null) {
488
- message.addTrack = AddTrackRequest.fromJSON(object.addTrack);
489
- } else {
490
- message.addTrack = undefined;
491
- }
492
- if (object.mute !== undefined && object.mute !== null) {
493
- message.mute = MuteTrackRequest.fromJSON(object.mute);
494
- } else {
495
- message.mute = undefined;
496
- }
497
- if (object.subscription !== undefined && object.subscription !== null) {
498
- message.subscription = UpdateSubscription.fromJSON(object.subscription);
499
- } else {
500
- message.subscription = undefined;
501
- }
502
- if (object.trackSetting !== undefined && object.trackSetting !== null) {
503
- message.trackSetting = UpdateTrackSettings.fromJSON(object.trackSetting);
504
- } else {
505
- message.trackSetting = undefined;
506
- }
507
- if (object.leave !== undefined && object.leave !== null) {
508
- message.leave = LeaveRequest.fromJSON(object.leave);
509
- } else {
510
- message.leave = undefined;
511
- }
512
- if (object.updateLayers !== undefined && object.updateLayers !== null) {
513
- message.updateLayers = UpdateVideoLayers.fromJSON(object.updateLayers);
514
- } else {
515
- message.updateLayers = undefined;
516
- }
517
- if (
518
- object.subscriptionPermission !== undefined &&
519
- object.subscriptionPermission !== null
520
- ) {
521
- message.subscriptionPermission = SubscriptionPermission.fromJSON(
522
- object.subscriptionPermission
523
- );
524
- } else {
525
- message.subscriptionPermission = undefined;
526
- }
527
- if (object.syncState !== undefined && object.syncState !== null) {
528
- message.syncState = SyncState.fromJSON(object.syncState);
529
- } else {
530
- message.syncState = undefined;
531
- }
532
- if (object.simulate !== undefined && object.simulate !== null) {
533
- message.simulate = SimulateScenario.fromJSON(object.simulate);
534
- } else {
535
- message.simulate = undefined;
536
- }
537
- return message;
486
+ return {
487
+ offer: isSet(object.offer)
488
+ ? SessionDescription.fromJSON(object.offer)
489
+ : undefined,
490
+ answer: isSet(object.answer)
491
+ ? SessionDescription.fromJSON(object.answer)
492
+ : undefined,
493
+ trickle: isSet(object.trickle)
494
+ ? TrickleRequest.fromJSON(object.trickle)
495
+ : undefined,
496
+ addTrack: isSet(object.addTrack)
497
+ ? AddTrackRequest.fromJSON(object.addTrack)
498
+ : undefined,
499
+ mute: isSet(object.mute)
500
+ ? MuteTrackRequest.fromJSON(object.mute)
501
+ : undefined,
502
+ subscription: isSet(object.subscription)
503
+ ? UpdateSubscription.fromJSON(object.subscription)
504
+ : undefined,
505
+ trackSetting: isSet(object.trackSetting)
506
+ ? UpdateTrackSettings.fromJSON(object.trackSetting)
507
+ : undefined,
508
+ leave: isSet(object.leave)
509
+ ? LeaveRequest.fromJSON(object.leave)
510
+ : undefined,
511
+ updateLayers: isSet(object.updateLayers)
512
+ ? UpdateVideoLayers.fromJSON(object.updateLayers)
513
+ : undefined,
514
+ subscriptionPermission: isSet(object.subscriptionPermission)
515
+ ? SubscriptionPermission.fromJSON(object.subscriptionPermission)
516
+ : undefined,
517
+ syncState: isSet(object.syncState)
518
+ ? SyncState.fromJSON(object.syncState)
519
+ : undefined,
520
+ simulate: isSet(object.simulate)
521
+ ? SimulateScenario.fromJSON(object.simulate)
522
+ : undefined,
523
+ };
538
524
  },
539
525
 
540
526
  toJSON(message: SignalRequest): unknown {
@@ -590,82 +576,83 @@ export const SignalRequest = {
590
576
  return obj;
591
577
  },
592
578
 
593
- fromPartial(object: DeepPartial<SignalRequest>): SignalRequest {
594
- const message = { ...baseSignalRequest } as SignalRequest;
595
- if (object.offer !== undefined && object.offer !== null) {
596
- message.offer = SessionDescription.fromPartial(object.offer);
597
- } else {
598
- message.offer = undefined;
599
- }
600
- if (object.answer !== undefined && object.answer !== null) {
601
- message.answer = SessionDescription.fromPartial(object.answer);
602
- } else {
603
- message.answer = undefined;
604
- }
605
- if (object.trickle !== undefined && object.trickle !== null) {
606
- message.trickle = TrickleRequest.fromPartial(object.trickle);
607
- } else {
608
- message.trickle = undefined;
609
- }
610
- if (object.addTrack !== undefined && object.addTrack !== null) {
611
- message.addTrack = AddTrackRequest.fromPartial(object.addTrack);
612
- } else {
613
- message.addTrack = undefined;
614
- }
615
- if (object.mute !== undefined && object.mute !== null) {
616
- message.mute = MuteTrackRequest.fromPartial(object.mute);
617
- } else {
618
- message.mute = undefined;
619
- }
620
- if (object.subscription !== undefined && object.subscription !== null) {
621
- message.subscription = UpdateSubscription.fromPartial(
622
- object.subscription
623
- );
624
- } else {
625
- message.subscription = undefined;
626
- }
627
- if (object.trackSetting !== undefined && object.trackSetting !== null) {
628
- message.trackSetting = UpdateTrackSettings.fromPartial(
629
- object.trackSetting
630
- );
631
- } else {
632
- message.trackSetting = undefined;
633
- }
634
- if (object.leave !== undefined && object.leave !== null) {
635
- message.leave = LeaveRequest.fromPartial(object.leave);
636
- } else {
637
- message.leave = undefined;
638
- }
639
- if (object.updateLayers !== undefined && object.updateLayers !== null) {
640
- message.updateLayers = UpdateVideoLayers.fromPartial(object.updateLayers);
641
- } else {
642
- message.updateLayers = undefined;
643
- }
644
- if (
579
+ fromPartial<I extends Exact<DeepPartial<SignalRequest>, I>>(
580
+ object: I
581
+ ): SignalRequest {
582
+ const message = createBaseSignalRequest();
583
+ message.offer =
584
+ object.offer !== undefined && object.offer !== null
585
+ ? SessionDescription.fromPartial(object.offer)
586
+ : undefined;
587
+ message.answer =
588
+ object.answer !== undefined && object.answer !== null
589
+ ? SessionDescription.fromPartial(object.answer)
590
+ : undefined;
591
+ message.trickle =
592
+ object.trickle !== undefined && object.trickle !== null
593
+ ? TrickleRequest.fromPartial(object.trickle)
594
+ : undefined;
595
+ message.addTrack =
596
+ object.addTrack !== undefined && object.addTrack !== null
597
+ ? AddTrackRequest.fromPartial(object.addTrack)
598
+ : undefined;
599
+ message.mute =
600
+ object.mute !== undefined && object.mute !== null
601
+ ? MuteTrackRequest.fromPartial(object.mute)
602
+ : undefined;
603
+ message.subscription =
604
+ object.subscription !== undefined && object.subscription !== null
605
+ ? UpdateSubscription.fromPartial(object.subscription)
606
+ : undefined;
607
+ message.trackSetting =
608
+ object.trackSetting !== undefined && object.trackSetting !== null
609
+ ? UpdateTrackSettings.fromPartial(object.trackSetting)
610
+ : undefined;
611
+ message.leave =
612
+ object.leave !== undefined && object.leave !== null
613
+ ? LeaveRequest.fromPartial(object.leave)
614
+ : undefined;
615
+ message.updateLayers =
616
+ object.updateLayers !== undefined && object.updateLayers !== null
617
+ ? UpdateVideoLayers.fromPartial(object.updateLayers)
618
+ : undefined;
619
+ message.subscriptionPermission =
645
620
  object.subscriptionPermission !== undefined &&
646
621
  object.subscriptionPermission !== null
647
- ) {
648
- message.subscriptionPermission = SubscriptionPermission.fromPartial(
649
- object.subscriptionPermission
650
- );
651
- } else {
652
- message.subscriptionPermission = undefined;
653
- }
654
- if (object.syncState !== undefined && object.syncState !== null) {
655
- message.syncState = SyncState.fromPartial(object.syncState);
656
- } else {
657
- message.syncState = undefined;
658
- }
659
- if (object.simulate !== undefined && object.simulate !== null) {
660
- message.simulate = SimulateScenario.fromPartial(object.simulate);
661
- } else {
662
- message.simulate = undefined;
663
- }
622
+ ? SubscriptionPermission.fromPartial(object.subscriptionPermission)
623
+ : undefined;
624
+ message.syncState =
625
+ object.syncState !== undefined && object.syncState !== null
626
+ ? SyncState.fromPartial(object.syncState)
627
+ : undefined;
628
+ message.simulate =
629
+ object.simulate !== undefined && object.simulate !== null
630
+ ? SimulateScenario.fromPartial(object.simulate)
631
+ : undefined;
664
632
  return message;
665
633
  },
666
634
  };
667
635
 
668
- const baseSignalResponse: object = {};
636
+ function createBaseSignalResponse(): SignalResponse {
637
+ return {
638
+ join: undefined,
639
+ answer: undefined,
640
+ offer: undefined,
641
+ trickle: undefined,
642
+ update: undefined,
643
+ trackPublished: undefined,
644
+ leave: undefined,
645
+ mute: undefined,
646
+ speakersChanged: undefined,
647
+ roomUpdate: undefined,
648
+ connectionQuality: undefined,
649
+ streamStateUpdate: undefined,
650
+ subscribedQualityUpdate: undefined,
651
+ subscriptionPermissionUpdate: undefined,
652
+ refreshToken: undefined,
653
+ trackUnpublished: undefined,
654
+ };
655
+ }
669
656
 
670
657
  export const SignalResponse = {
671
658
  encode(
@@ -756,7 +743,7 @@ export const SignalResponse = {
756
743
  decode(input: _m0.Reader | Uint8Array, length?: number): SignalResponse {
757
744
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
758
745
  let end = length === undefined ? reader.len : reader.pos + length;
759
- const message = { ...baseSignalResponse } as SignalResponse;
746
+ const message = createBaseSignalResponse();
760
747
  while (reader.pos < end) {
761
748
  const tag = reader.uint32();
762
749
  switch (tag >>> 3) {
@@ -836,121 +823,56 @@ export const SignalResponse = {
836
823
  },
837
824
 
838
825
  fromJSON(object: any): SignalResponse {
839
- const message = { ...baseSignalResponse } as SignalResponse;
840
- if (object.join !== undefined && object.join !== null) {
841
- message.join = JoinResponse.fromJSON(object.join);
842
- } else {
843
- message.join = undefined;
844
- }
845
- if (object.answer !== undefined && object.answer !== null) {
846
- message.answer = SessionDescription.fromJSON(object.answer);
847
- } else {
848
- message.answer = undefined;
849
- }
850
- if (object.offer !== undefined && object.offer !== null) {
851
- message.offer = SessionDescription.fromJSON(object.offer);
852
- } else {
853
- message.offer = undefined;
854
- }
855
- if (object.trickle !== undefined && object.trickle !== null) {
856
- message.trickle = TrickleRequest.fromJSON(object.trickle);
857
- } else {
858
- message.trickle = undefined;
859
- }
860
- if (object.update !== undefined && object.update !== null) {
861
- message.update = ParticipantUpdate.fromJSON(object.update);
862
- } else {
863
- message.update = undefined;
864
- }
865
- if (object.trackPublished !== undefined && object.trackPublished !== null) {
866
- message.trackPublished = TrackPublishedResponse.fromJSON(
867
- object.trackPublished
868
- );
869
- } else {
870
- message.trackPublished = undefined;
871
- }
872
- if (object.leave !== undefined && object.leave !== null) {
873
- message.leave = LeaveRequest.fromJSON(object.leave);
874
- } else {
875
- message.leave = undefined;
876
- }
877
- if (object.mute !== undefined && object.mute !== null) {
878
- message.mute = MuteTrackRequest.fromJSON(object.mute);
879
- } else {
880
- message.mute = undefined;
881
- }
882
- if (
883
- object.speakersChanged !== undefined &&
884
- object.speakersChanged !== null
885
- ) {
886
- message.speakersChanged = SpeakersChanged.fromJSON(
887
- object.speakersChanged
888
- );
889
- } else {
890
- message.speakersChanged = undefined;
891
- }
892
- if (object.roomUpdate !== undefined && object.roomUpdate !== null) {
893
- message.roomUpdate = RoomUpdate.fromJSON(object.roomUpdate);
894
- } else {
895
- message.roomUpdate = undefined;
896
- }
897
- if (
898
- object.connectionQuality !== undefined &&
899
- object.connectionQuality !== null
900
- ) {
901
- message.connectionQuality = ConnectionQualityUpdate.fromJSON(
902
- object.connectionQuality
903
- );
904
- } else {
905
- message.connectionQuality = undefined;
906
- }
907
- if (
908
- object.streamStateUpdate !== undefined &&
909
- object.streamStateUpdate !== null
910
- ) {
911
- message.streamStateUpdate = StreamStateUpdate.fromJSON(
912
- object.streamStateUpdate
913
- );
914
- } else {
915
- message.streamStateUpdate = undefined;
916
- }
917
- if (
918
- object.subscribedQualityUpdate !== undefined &&
919
- object.subscribedQualityUpdate !== null
920
- ) {
921
- message.subscribedQualityUpdate = SubscribedQualityUpdate.fromJSON(
922
- object.subscribedQualityUpdate
923
- );
924
- } else {
925
- message.subscribedQualityUpdate = undefined;
926
- }
927
- if (
928
- object.subscriptionPermissionUpdate !== undefined &&
929
- object.subscriptionPermissionUpdate !== null
930
- ) {
931
- message.subscriptionPermissionUpdate =
932
- SubscriptionPermissionUpdate.fromJSON(
933
- object.subscriptionPermissionUpdate
934
- );
935
- } else {
936
- message.subscriptionPermissionUpdate = undefined;
937
- }
938
- if (object.refreshToken !== undefined && object.refreshToken !== null) {
939
- message.refreshToken = String(object.refreshToken);
940
- } else {
941
- message.refreshToken = undefined;
942
- }
943
- if (
944
- object.trackUnpublished !== undefined &&
945
- object.trackUnpublished !== null
946
- ) {
947
- message.trackUnpublished = TrackUnpublishedResponse.fromJSON(
948
- object.trackUnpublished
949
- );
950
- } else {
951
- message.trackUnpublished = undefined;
952
- }
953
- return message;
826
+ return {
827
+ join: isSet(object.join) ? JoinResponse.fromJSON(object.join) : undefined,
828
+ answer: isSet(object.answer)
829
+ ? SessionDescription.fromJSON(object.answer)
830
+ : undefined,
831
+ offer: isSet(object.offer)
832
+ ? SessionDescription.fromJSON(object.offer)
833
+ : undefined,
834
+ trickle: isSet(object.trickle)
835
+ ? TrickleRequest.fromJSON(object.trickle)
836
+ : undefined,
837
+ update: isSet(object.update)
838
+ ? ParticipantUpdate.fromJSON(object.update)
839
+ : undefined,
840
+ trackPublished: isSet(object.trackPublished)
841
+ ? TrackPublishedResponse.fromJSON(object.trackPublished)
842
+ : undefined,
843
+ leave: isSet(object.leave)
844
+ ? LeaveRequest.fromJSON(object.leave)
845
+ : undefined,
846
+ mute: isSet(object.mute)
847
+ ? MuteTrackRequest.fromJSON(object.mute)
848
+ : undefined,
849
+ speakersChanged: isSet(object.speakersChanged)
850
+ ? SpeakersChanged.fromJSON(object.speakersChanged)
851
+ : undefined,
852
+ roomUpdate: isSet(object.roomUpdate)
853
+ ? RoomUpdate.fromJSON(object.roomUpdate)
854
+ : undefined,
855
+ connectionQuality: isSet(object.connectionQuality)
856
+ ? ConnectionQualityUpdate.fromJSON(object.connectionQuality)
857
+ : undefined,
858
+ streamStateUpdate: isSet(object.streamStateUpdate)
859
+ ? StreamStateUpdate.fromJSON(object.streamStateUpdate)
860
+ : undefined,
861
+ subscribedQualityUpdate: isSet(object.subscribedQualityUpdate)
862
+ ? SubscribedQualityUpdate.fromJSON(object.subscribedQualityUpdate)
863
+ : undefined,
864
+ subscriptionPermissionUpdate: isSet(object.subscriptionPermissionUpdate)
865
+ ? SubscriptionPermissionUpdate.fromJSON(
866
+ object.subscriptionPermissionUpdate
867
+ )
868
+ : undefined,
869
+ refreshToken: isSet(object.refreshToken)
870
+ ? String(object.refreshToken)
871
+ : undefined,
872
+ trackUnpublished: isSet(object.trackUnpublished)
873
+ ? TrackUnpublishedResponse.fromJSON(object.trackUnpublished)
874
+ : undefined,
875
+ };
954
876
  },
955
877
 
956
878
  toJSON(message: SignalResponse): unknown {
@@ -1020,131 +942,94 @@ export const SignalResponse = {
1020
942
  return obj;
1021
943
  },
1022
944
 
1023
- fromPartial(object: DeepPartial<SignalResponse>): SignalResponse {
1024
- const message = { ...baseSignalResponse } as SignalResponse;
1025
- if (object.join !== undefined && object.join !== null) {
1026
- message.join = JoinResponse.fromPartial(object.join);
1027
- } else {
1028
- message.join = undefined;
1029
- }
1030
- if (object.answer !== undefined && object.answer !== null) {
1031
- message.answer = SessionDescription.fromPartial(object.answer);
1032
- } else {
1033
- message.answer = undefined;
1034
- }
1035
- if (object.offer !== undefined && object.offer !== null) {
1036
- message.offer = SessionDescription.fromPartial(object.offer);
1037
- } else {
1038
- message.offer = undefined;
1039
- }
1040
- if (object.trickle !== undefined && object.trickle !== null) {
1041
- message.trickle = TrickleRequest.fromPartial(object.trickle);
1042
- } else {
1043
- message.trickle = undefined;
1044
- }
1045
- if (object.update !== undefined && object.update !== null) {
1046
- message.update = ParticipantUpdate.fromPartial(object.update);
1047
- } else {
1048
- message.update = undefined;
1049
- }
1050
- if (object.trackPublished !== undefined && object.trackPublished !== null) {
1051
- message.trackPublished = TrackPublishedResponse.fromPartial(
1052
- object.trackPublished
1053
- );
1054
- } else {
1055
- message.trackPublished = undefined;
1056
- }
1057
- if (object.leave !== undefined && object.leave !== null) {
1058
- message.leave = LeaveRequest.fromPartial(object.leave);
1059
- } else {
1060
- message.leave = undefined;
1061
- }
1062
- if (object.mute !== undefined && object.mute !== null) {
1063
- message.mute = MuteTrackRequest.fromPartial(object.mute);
1064
- } else {
1065
- message.mute = undefined;
1066
- }
1067
- if (
1068
- object.speakersChanged !== undefined &&
1069
- object.speakersChanged !== null
1070
- ) {
1071
- message.speakersChanged = SpeakersChanged.fromPartial(
1072
- object.speakersChanged
1073
- );
1074
- } else {
1075
- message.speakersChanged = undefined;
1076
- }
1077
- if (object.roomUpdate !== undefined && object.roomUpdate !== null) {
1078
- message.roomUpdate = RoomUpdate.fromPartial(object.roomUpdate);
1079
- } else {
1080
- message.roomUpdate = undefined;
1081
- }
1082
- if (
945
+ fromPartial<I extends Exact<DeepPartial<SignalResponse>, I>>(
946
+ object: I
947
+ ): SignalResponse {
948
+ const message = createBaseSignalResponse();
949
+ message.join =
950
+ object.join !== undefined && object.join !== null
951
+ ? JoinResponse.fromPartial(object.join)
952
+ : undefined;
953
+ message.answer =
954
+ object.answer !== undefined && object.answer !== null
955
+ ? SessionDescription.fromPartial(object.answer)
956
+ : undefined;
957
+ message.offer =
958
+ object.offer !== undefined && object.offer !== null
959
+ ? SessionDescription.fromPartial(object.offer)
960
+ : undefined;
961
+ message.trickle =
962
+ object.trickle !== undefined && object.trickle !== null
963
+ ? TrickleRequest.fromPartial(object.trickle)
964
+ : undefined;
965
+ message.update =
966
+ object.update !== undefined && object.update !== null
967
+ ? ParticipantUpdate.fromPartial(object.update)
968
+ : undefined;
969
+ message.trackPublished =
970
+ object.trackPublished !== undefined && object.trackPublished !== null
971
+ ? TrackPublishedResponse.fromPartial(object.trackPublished)
972
+ : undefined;
973
+ message.leave =
974
+ object.leave !== undefined && object.leave !== null
975
+ ? LeaveRequest.fromPartial(object.leave)
976
+ : undefined;
977
+ message.mute =
978
+ object.mute !== undefined && object.mute !== null
979
+ ? MuteTrackRequest.fromPartial(object.mute)
980
+ : undefined;
981
+ message.speakersChanged =
982
+ object.speakersChanged !== undefined && object.speakersChanged !== null
983
+ ? SpeakersChanged.fromPartial(object.speakersChanged)
984
+ : undefined;
985
+ message.roomUpdate =
986
+ object.roomUpdate !== undefined && object.roomUpdate !== null
987
+ ? RoomUpdate.fromPartial(object.roomUpdate)
988
+ : undefined;
989
+ message.connectionQuality =
1083
990
  object.connectionQuality !== undefined &&
1084
991
  object.connectionQuality !== null
1085
- ) {
1086
- message.connectionQuality = ConnectionQualityUpdate.fromPartial(
1087
- object.connectionQuality
1088
- );
1089
- } else {
1090
- message.connectionQuality = undefined;
1091
- }
1092
- if (
992
+ ? ConnectionQualityUpdate.fromPartial(object.connectionQuality)
993
+ : undefined;
994
+ message.streamStateUpdate =
1093
995
  object.streamStateUpdate !== undefined &&
1094
996
  object.streamStateUpdate !== null
1095
- ) {
1096
- message.streamStateUpdate = StreamStateUpdate.fromPartial(
1097
- object.streamStateUpdate
1098
- );
1099
- } else {
1100
- message.streamStateUpdate = undefined;
1101
- }
1102
- if (
997
+ ? StreamStateUpdate.fromPartial(object.streamStateUpdate)
998
+ : undefined;
999
+ message.subscribedQualityUpdate =
1103
1000
  object.subscribedQualityUpdate !== undefined &&
1104
1001
  object.subscribedQualityUpdate !== null
1105
- ) {
1106
- message.subscribedQualityUpdate = SubscribedQualityUpdate.fromPartial(
1107
- object.subscribedQualityUpdate
1108
- );
1109
- } else {
1110
- message.subscribedQualityUpdate = undefined;
1111
- }
1112
- if (
1002
+ ? SubscribedQualityUpdate.fromPartial(object.subscribedQualityUpdate)
1003
+ : undefined;
1004
+ message.subscriptionPermissionUpdate =
1113
1005
  object.subscriptionPermissionUpdate !== undefined &&
1114
1006
  object.subscriptionPermissionUpdate !== null
1115
- ) {
1116
- message.subscriptionPermissionUpdate =
1117
- SubscriptionPermissionUpdate.fromPartial(
1118
- object.subscriptionPermissionUpdate
1119
- );
1120
- } else {
1121
- message.subscriptionPermissionUpdate = undefined;
1122
- }
1007
+ ? SubscriptionPermissionUpdate.fromPartial(
1008
+ object.subscriptionPermissionUpdate
1009
+ )
1010
+ : undefined;
1123
1011
  message.refreshToken = object.refreshToken ?? undefined;
1124
- if (
1125
- object.trackUnpublished !== undefined &&
1126
- object.trackUnpublished !== null
1127
- ) {
1128
- message.trackUnpublished = TrackUnpublishedResponse.fromPartial(
1129
- object.trackUnpublished
1130
- );
1131
- } else {
1132
- message.trackUnpublished = undefined;
1133
- }
1012
+ message.trackUnpublished =
1013
+ object.trackUnpublished !== undefined && object.trackUnpublished !== null
1014
+ ? TrackUnpublishedResponse.fromPartial(object.trackUnpublished)
1015
+ : undefined;
1134
1016
  return message;
1135
1017
  },
1136
1018
  };
1137
1019
 
1138
- const baseAddTrackRequest: object = {
1139
- cid: "",
1140
- name: "",
1141
- type: 0,
1142
- width: 0,
1143
- height: 0,
1144
- muted: false,
1145
- disableDtx: false,
1146
- source: 0,
1147
- };
1020
+ function createBaseAddTrackRequest(): AddTrackRequest {
1021
+ return {
1022
+ cid: "",
1023
+ name: "",
1024
+ type: 0,
1025
+ width: 0,
1026
+ height: 0,
1027
+ muted: false,
1028
+ disableDtx: false,
1029
+ source: 0,
1030
+ layers: [],
1031
+ };
1032
+ }
1148
1033
 
1149
1034
  export const AddTrackRequest = {
1150
1035
  encode(
@@ -1184,8 +1069,7 @@ export const AddTrackRequest = {
1184
1069
  decode(input: _m0.Reader | Uint8Array, length?: number): AddTrackRequest {
1185
1070
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1186
1071
  let end = length === undefined ? reader.len : reader.pos + length;
1187
- const message = { ...baseAddTrackRequest } as AddTrackRequest;
1188
- message.layers = [];
1072
+ const message = createBaseAddTrackRequest();
1189
1073
  while (reader.pos < end) {
1190
1074
  const tag = reader.uint32();
1191
1075
  switch (tag >>> 3) {
@@ -1225,54 +1109,19 @@ export const AddTrackRequest = {
1225
1109
  },
1226
1110
 
1227
1111
  fromJSON(object: any): AddTrackRequest {
1228
- const message = { ...baseAddTrackRequest } as AddTrackRequest;
1229
- message.layers = [];
1230
- if (object.cid !== undefined && object.cid !== null) {
1231
- message.cid = String(object.cid);
1232
- } else {
1233
- message.cid = "";
1234
- }
1235
- if (object.name !== undefined && object.name !== null) {
1236
- message.name = String(object.name);
1237
- } else {
1238
- message.name = "";
1239
- }
1240
- if (object.type !== undefined && object.type !== null) {
1241
- message.type = trackTypeFromJSON(object.type);
1242
- } else {
1243
- message.type = 0;
1244
- }
1245
- if (object.width !== undefined && object.width !== null) {
1246
- message.width = Number(object.width);
1247
- } else {
1248
- message.width = 0;
1249
- }
1250
- if (object.height !== undefined && object.height !== null) {
1251
- message.height = Number(object.height);
1252
- } else {
1253
- message.height = 0;
1254
- }
1255
- if (object.muted !== undefined && object.muted !== null) {
1256
- message.muted = Boolean(object.muted);
1257
- } else {
1258
- message.muted = false;
1259
- }
1260
- if (object.disableDtx !== undefined && object.disableDtx !== null) {
1261
- message.disableDtx = Boolean(object.disableDtx);
1262
- } else {
1263
- message.disableDtx = false;
1264
- }
1265
- if (object.source !== undefined && object.source !== null) {
1266
- message.source = trackSourceFromJSON(object.source);
1267
- } else {
1268
- message.source = 0;
1269
- }
1270
- if (object.layers !== undefined && object.layers !== null) {
1271
- for (const e of object.layers) {
1272
- message.layers.push(VideoLayer.fromJSON(e));
1273
- }
1274
- }
1275
- return message;
1112
+ return {
1113
+ cid: isSet(object.cid) ? String(object.cid) : "",
1114
+ name: isSet(object.name) ? String(object.name) : "",
1115
+ type: isSet(object.type) ? trackTypeFromJSON(object.type) : 0,
1116
+ width: isSet(object.width) ? Number(object.width) : 0,
1117
+ height: isSet(object.height) ? Number(object.height) : 0,
1118
+ muted: isSet(object.muted) ? Boolean(object.muted) : false,
1119
+ disableDtx: isSet(object.disableDtx) ? Boolean(object.disableDtx) : false,
1120
+ source: isSet(object.source) ? trackSourceFromJSON(object.source) : 0,
1121
+ layers: Array.isArray(object?.layers)
1122
+ ? object.layers.map((e: any) => VideoLayer.fromJSON(e))
1123
+ : [],
1124
+ };
1276
1125
  },
1277
1126
 
1278
1127
  toJSON(message: AddTrackRequest): unknown {
@@ -1280,8 +1129,8 @@ export const AddTrackRequest = {
1280
1129
  message.cid !== undefined && (obj.cid = message.cid);
1281
1130
  message.name !== undefined && (obj.name = message.name);
1282
1131
  message.type !== undefined && (obj.type = trackTypeToJSON(message.type));
1283
- message.width !== undefined && (obj.width = message.width);
1284
- message.height !== undefined && (obj.height = message.height);
1132
+ message.width !== undefined && (obj.width = Math.round(message.width));
1133
+ message.height !== undefined && (obj.height = Math.round(message.height));
1285
1134
  message.muted !== undefined && (obj.muted = message.muted);
1286
1135
  message.disableDtx !== undefined && (obj.disableDtx = message.disableDtx);
1287
1136
  message.source !== undefined &&
@@ -1296,8 +1145,10 @@ export const AddTrackRequest = {
1296
1145
  return obj;
1297
1146
  },
1298
1147
 
1299
- fromPartial(object: DeepPartial<AddTrackRequest>): AddTrackRequest {
1300
- const message = { ...baseAddTrackRequest } as AddTrackRequest;
1148
+ fromPartial<I extends Exact<DeepPartial<AddTrackRequest>, I>>(
1149
+ object: I
1150
+ ): AddTrackRequest {
1151
+ const message = createBaseAddTrackRequest();
1301
1152
  message.cid = object.cid ?? "";
1302
1153
  message.name = object.name ?? "";
1303
1154
  message.type = object.type ?? 0;
@@ -1306,17 +1157,14 @@ export const AddTrackRequest = {
1306
1157
  message.muted = object.muted ?? false;
1307
1158
  message.disableDtx = object.disableDtx ?? false;
1308
1159
  message.source = object.source ?? 0;
1309
- message.layers = [];
1310
- if (object.layers !== undefined && object.layers !== null) {
1311
- for (const e of object.layers) {
1312
- message.layers.push(VideoLayer.fromPartial(e));
1313
- }
1314
- }
1160
+ message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
1315
1161
  return message;
1316
1162
  },
1317
1163
  };
1318
1164
 
1319
- const baseTrickleRequest: object = { candidateInit: "", target: 0 };
1165
+ function createBaseTrickleRequest(): TrickleRequest {
1166
+ return { candidateInit: "", target: 0 };
1167
+ }
1320
1168
 
1321
1169
  export const TrickleRequest = {
1322
1170
  encode(
@@ -1335,7 +1183,7 @@ export const TrickleRequest = {
1335
1183
  decode(input: _m0.Reader | Uint8Array, length?: number): TrickleRequest {
1336
1184
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1337
1185
  let end = length === undefined ? reader.len : reader.pos + length;
1338
- const message = { ...baseTrickleRequest } as TrickleRequest;
1186
+ const message = createBaseTrickleRequest();
1339
1187
  while (reader.pos < end) {
1340
1188
  const tag = reader.uint32();
1341
1189
  switch (tag >>> 3) {
@@ -1354,18 +1202,12 @@ export const TrickleRequest = {
1354
1202
  },
1355
1203
 
1356
1204
  fromJSON(object: any): TrickleRequest {
1357
- const message = { ...baseTrickleRequest } as TrickleRequest;
1358
- if (object.candidateInit !== undefined && object.candidateInit !== null) {
1359
- message.candidateInit = String(object.candidateInit);
1360
- } else {
1361
- message.candidateInit = "";
1362
- }
1363
- if (object.target !== undefined && object.target !== null) {
1364
- message.target = signalTargetFromJSON(object.target);
1365
- } else {
1366
- message.target = 0;
1367
- }
1368
- return message;
1205
+ return {
1206
+ candidateInit: isSet(object.candidateInit)
1207
+ ? String(object.candidateInit)
1208
+ : "",
1209
+ target: isSet(object.target) ? signalTargetFromJSON(object.target) : 0,
1210
+ };
1369
1211
  },
1370
1212
 
1371
1213
  toJSON(message: TrickleRequest): unknown {
@@ -1377,15 +1219,19 @@ export const TrickleRequest = {
1377
1219
  return obj;
1378
1220
  },
1379
1221
 
1380
- fromPartial(object: DeepPartial<TrickleRequest>): TrickleRequest {
1381
- const message = { ...baseTrickleRequest } as TrickleRequest;
1222
+ fromPartial<I extends Exact<DeepPartial<TrickleRequest>, I>>(
1223
+ object: I
1224
+ ): TrickleRequest {
1225
+ const message = createBaseTrickleRequest();
1382
1226
  message.candidateInit = object.candidateInit ?? "";
1383
1227
  message.target = object.target ?? 0;
1384
1228
  return message;
1385
1229
  },
1386
1230
  };
1387
1231
 
1388
- const baseMuteTrackRequest: object = { sid: "", muted: false };
1232
+ function createBaseMuteTrackRequest(): MuteTrackRequest {
1233
+ return { sid: "", muted: false };
1234
+ }
1389
1235
 
1390
1236
  export const MuteTrackRequest = {
1391
1237
  encode(
@@ -1404,7 +1250,7 @@ export const MuteTrackRequest = {
1404
1250
  decode(input: _m0.Reader | Uint8Array, length?: number): MuteTrackRequest {
1405
1251
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1406
1252
  let end = length === undefined ? reader.len : reader.pos + length;
1407
- const message = { ...baseMuteTrackRequest } as MuteTrackRequest;
1253
+ const message = createBaseMuteTrackRequest();
1408
1254
  while (reader.pos < end) {
1409
1255
  const tag = reader.uint32();
1410
1256
  switch (tag >>> 3) {
@@ -1423,18 +1269,10 @@ export const MuteTrackRequest = {
1423
1269
  },
1424
1270
 
1425
1271
  fromJSON(object: any): MuteTrackRequest {
1426
- const message = { ...baseMuteTrackRequest } as MuteTrackRequest;
1427
- if (object.sid !== undefined && object.sid !== null) {
1428
- message.sid = String(object.sid);
1429
- } else {
1430
- message.sid = "";
1431
- }
1432
- if (object.muted !== undefined && object.muted !== null) {
1433
- message.muted = Boolean(object.muted);
1434
- } else {
1435
- message.muted = false;
1436
- }
1437
- return message;
1272
+ return {
1273
+ sid: isSet(object.sid) ? String(object.sid) : "",
1274
+ muted: isSet(object.muted) ? Boolean(object.muted) : false,
1275
+ };
1438
1276
  },
1439
1277
 
1440
1278
  toJSON(message: MuteTrackRequest): unknown {
@@ -1444,20 +1282,29 @@ export const MuteTrackRequest = {
1444
1282
  return obj;
1445
1283
  },
1446
1284
 
1447
- fromPartial(object: DeepPartial<MuteTrackRequest>): MuteTrackRequest {
1448
- const message = { ...baseMuteTrackRequest } as MuteTrackRequest;
1285
+ fromPartial<I extends Exact<DeepPartial<MuteTrackRequest>, I>>(
1286
+ object: I
1287
+ ): MuteTrackRequest {
1288
+ const message = createBaseMuteTrackRequest();
1449
1289
  message.sid = object.sid ?? "";
1450
1290
  message.muted = object.muted ?? false;
1451
1291
  return message;
1452
1292
  },
1453
1293
  };
1454
1294
 
1455
- const baseJoinResponse: object = {
1456
- serverVersion: "",
1457
- subscriberPrimary: false,
1458
- alternativeUrl: "",
1459
- serverRegion: "",
1460
- };
1295
+ function createBaseJoinResponse(): JoinResponse {
1296
+ return {
1297
+ room: undefined,
1298
+ participant: undefined,
1299
+ otherParticipants: [],
1300
+ serverVersion: "",
1301
+ iceServers: [],
1302
+ subscriberPrimary: false,
1303
+ alternativeUrl: "",
1304
+ clientConfiguration: undefined,
1305
+ serverRegion: "",
1306
+ };
1307
+ }
1461
1308
 
1462
1309
  export const JoinResponse = {
1463
1310
  encode(
@@ -1503,9 +1350,7 @@ export const JoinResponse = {
1503
1350
  decode(input: _m0.Reader | Uint8Array, length?: number): JoinResponse {
1504
1351
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1505
1352
  let end = length === undefined ? reader.len : reader.pos + length;
1506
- const message = { ...baseJoinResponse } as JoinResponse;
1507
- message.otherParticipants = [];
1508
- message.iceServers = [];
1353
+ const message = createBaseJoinResponse();
1509
1354
  while (reader.pos < end) {
1510
1355
  const tag = reader.uint32();
1511
1356
  switch (tag >>> 3) {
@@ -1550,66 +1395,33 @@ export const JoinResponse = {
1550
1395
  },
1551
1396
 
1552
1397
  fromJSON(object: any): JoinResponse {
1553
- const message = { ...baseJoinResponse } as JoinResponse;
1554
- message.otherParticipants = [];
1555
- message.iceServers = [];
1556
- if (object.room !== undefined && object.room !== null) {
1557
- message.room = Room.fromJSON(object.room);
1558
- } else {
1559
- message.room = undefined;
1560
- }
1561
- if (object.participant !== undefined && object.participant !== null) {
1562
- message.participant = ParticipantInfo.fromJSON(object.participant);
1563
- } else {
1564
- message.participant = undefined;
1565
- }
1566
- if (
1567
- object.otherParticipants !== undefined &&
1568
- object.otherParticipants !== null
1569
- ) {
1570
- for (const e of object.otherParticipants) {
1571
- message.otherParticipants.push(ParticipantInfo.fromJSON(e));
1572
- }
1573
- }
1574
- if (object.serverVersion !== undefined && object.serverVersion !== null) {
1575
- message.serverVersion = String(object.serverVersion);
1576
- } else {
1577
- message.serverVersion = "";
1578
- }
1579
- if (object.iceServers !== undefined && object.iceServers !== null) {
1580
- for (const e of object.iceServers) {
1581
- message.iceServers.push(ICEServer.fromJSON(e));
1582
- }
1583
- }
1584
- if (
1585
- object.subscriberPrimary !== undefined &&
1586
- object.subscriberPrimary !== null
1587
- ) {
1588
- message.subscriberPrimary = Boolean(object.subscriberPrimary);
1589
- } else {
1590
- message.subscriberPrimary = false;
1591
- }
1592
- if (object.alternativeUrl !== undefined && object.alternativeUrl !== null) {
1593
- message.alternativeUrl = String(object.alternativeUrl);
1594
- } else {
1595
- message.alternativeUrl = "";
1596
- }
1597
- if (
1598
- object.clientConfiguration !== undefined &&
1599
- object.clientConfiguration !== null
1600
- ) {
1601
- message.clientConfiguration = ClientConfiguration.fromJSON(
1602
- object.clientConfiguration
1603
- );
1604
- } else {
1605
- message.clientConfiguration = undefined;
1606
- }
1607
- if (object.serverRegion !== undefined && object.serverRegion !== null) {
1608
- message.serverRegion = String(object.serverRegion);
1609
- } else {
1610
- message.serverRegion = "";
1611
- }
1612
- return message;
1398
+ return {
1399
+ room: isSet(object.room) ? Room.fromJSON(object.room) : undefined,
1400
+ participant: isSet(object.participant)
1401
+ ? ParticipantInfo.fromJSON(object.participant)
1402
+ : undefined,
1403
+ otherParticipants: Array.isArray(object?.otherParticipants)
1404
+ ? object.otherParticipants.map((e: any) => ParticipantInfo.fromJSON(e))
1405
+ : [],
1406
+ serverVersion: isSet(object.serverVersion)
1407
+ ? String(object.serverVersion)
1408
+ : "",
1409
+ iceServers: Array.isArray(object?.iceServers)
1410
+ ? object.iceServers.map((e: any) => ICEServer.fromJSON(e))
1411
+ : [],
1412
+ subscriberPrimary: isSet(object.subscriberPrimary)
1413
+ ? Boolean(object.subscriberPrimary)
1414
+ : false,
1415
+ alternativeUrl: isSet(object.alternativeUrl)
1416
+ ? String(object.alternativeUrl)
1417
+ : "",
1418
+ clientConfiguration: isSet(object.clientConfiguration)
1419
+ ? ClientConfiguration.fromJSON(object.clientConfiguration)
1420
+ : undefined,
1421
+ serverRegion: isSet(object.serverRegion)
1422
+ ? String(object.serverRegion)
1423
+ : "",
1424
+ };
1613
1425
  },
1614
1426
 
1615
1427
  toJSON(message: JoinResponse): unknown {
@@ -1649,52 +1461,39 @@ export const JoinResponse = {
1649
1461
  return obj;
1650
1462
  },
1651
1463
 
1652
- fromPartial(object: DeepPartial<JoinResponse>): JoinResponse {
1653
- const message = { ...baseJoinResponse } as JoinResponse;
1654
- if (object.room !== undefined && object.room !== null) {
1655
- message.room = Room.fromPartial(object.room);
1656
- } else {
1657
- message.room = undefined;
1658
- }
1659
- if (object.participant !== undefined && object.participant !== null) {
1660
- message.participant = ParticipantInfo.fromPartial(object.participant);
1661
- } else {
1662
- message.participant = undefined;
1663
- }
1664
- message.otherParticipants = [];
1665
- if (
1666
- object.otherParticipants !== undefined &&
1667
- object.otherParticipants !== null
1668
- ) {
1669
- for (const e of object.otherParticipants) {
1670
- message.otherParticipants.push(ParticipantInfo.fromPartial(e));
1671
- }
1672
- }
1464
+ fromPartial<I extends Exact<DeepPartial<JoinResponse>, I>>(
1465
+ object: I
1466
+ ): JoinResponse {
1467
+ const message = createBaseJoinResponse();
1468
+ message.room =
1469
+ object.room !== undefined && object.room !== null
1470
+ ? Room.fromPartial(object.room)
1471
+ : undefined;
1472
+ message.participant =
1473
+ object.participant !== undefined && object.participant !== null
1474
+ ? ParticipantInfo.fromPartial(object.participant)
1475
+ : undefined;
1476
+ message.otherParticipants =
1477
+ object.otherParticipants?.map((e) => ParticipantInfo.fromPartial(e)) ||
1478
+ [];
1673
1479
  message.serverVersion = object.serverVersion ?? "";
1674
- message.iceServers = [];
1675
- if (object.iceServers !== undefined && object.iceServers !== null) {
1676
- for (const e of object.iceServers) {
1677
- message.iceServers.push(ICEServer.fromPartial(e));
1678
- }
1679
- }
1480
+ message.iceServers =
1481
+ object.iceServers?.map((e) => ICEServer.fromPartial(e)) || [];
1680
1482
  message.subscriberPrimary = object.subscriberPrimary ?? false;
1681
1483
  message.alternativeUrl = object.alternativeUrl ?? "";
1682
- if (
1484
+ message.clientConfiguration =
1683
1485
  object.clientConfiguration !== undefined &&
1684
1486
  object.clientConfiguration !== null
1685
- ) {
1686
- message.clientConfiguration = ClientConfiguration.fromPartial(
1687
- object.clientConfiguration
1688
- );
1689
- } else {
1690
- message.clientConfiguration = undefined;
1691
- }
1487
+ ? ClientConfiguration.fromPartial(object.clientConfiguration)
1488
+ : undefined;
1692
1489
  message.serverRegion = object.serverRegion ?? "";
1693
1490
  return message;
1694
1491
  },
1695
1492
  };
1696
1493
 
1697
- const baseTrackPublishedResponse: object = { cid: "" };
1494
+ function createBaseTrackPublishedResponse(): TrackPublishedResponse {
1495
+ return { cid: "", track: undefined };
1496
+ }
1698
1497
 
1699
1498
  export const TrackPublishedResponse = {
1700
1499
  encode(
@@ -1716,7 +1515,7 @@ export const TrackPublishedResponse = {
1716
1515
  ): TrackPublishedResponse {
1717
1516
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1718
1517
  let end = length === undefined ? reader.len : reader.pos + length;
1719
- const message = { ...baseTrackPublishedResponse } as TrackPublishedResponse;
1518
+ const message = createBaseTrackPublishedResponse();
1720
1519
  while (reader.pos < end) {
1721
1520
  const tag = reader.uint32();
1722
1521
  switch (tag >>> 3) {
@@ -1735,18 +1534,10 @@ export const TrackPublishedResponse = {
1735
1534
  },
1736
1535
 
1737
1536
  fromJSON(object: any): TrackPublishedResponse {
1738
- const message = { ...baseTrackPublishedResponse } as TrackPublishedResponse;
1739
- if (object.cid !== undefined && object.cid !== null) {
1740
- message.cid = String(object.cid);
1741
- } else {
1742
- message.cid = "";
1743
- }
1744
- if (object.track !== undefined && object.track !== null) {
1745
- message.track = TrackInfo.fromJSON(object.track);
1746
- } else {
1747
- message.track = undefined;
1748
- }
1749
- return message;
1537
+ return {
1538
+ cid: isSet(object.cid) ? String(object.cid) : "",
1539
+ track: isSet(object.track) ? TrackInfo.fromJSON(object.track) : undefined,
1540
+ };
1750
1541
  },
1751
1542
 
1752
1543
  toJSON(message: TrackPublishedResponse): unknown {
@@ -1757,21 +1548,22 @@ export const TrackPublishedResponse = {
1757
1548
  return obj;
1758
1549
  },
1759
1550
 
1760
- fromPartial(
1761
- object: DeepPartial<TrackPublishedResponse>
1551
+ fromPartial<I extends Exact<DeepPartial<TrackPublishedResponse>, I>>(
1552
+ object: I
1762
1553
  ): TrackPublishedResponse {
1763
- const message = { ...baseTrackPublishedResponse } as TrackPublishedResponse;
1554
+ const message = createBaseTrackPublishedResponse();
1764
1555
  message.cid = object.cid ?? "";
1765
- if (object.track !== undefined && object.track !== null) {
1766
- message.track = TrackInfo.fromPartial(object.track);
1767
- } else {
1768
- message.track = undefined;
1769
- }
1556
+ message.track =
1557
+ object.track !== undefined && object.track !== null
1558
+ ? TrackInfo.fromPartial(object.track)
1559
+ : undefined;
1770
1560
  return message;
1771
1561
  },
1772
1562
  };
1773
1563
 
1774
- const baseTrackUnpublishedResponse: object = { trackSid: "" };
1564
+ function createBaseTrackUnpublishedResponse(): TrackUnpublishedResponse {
1565
+ return { trackSid: "" };
1566
+ }
1775
1567
 
1776
1568
  export const TrackUnpublishedResponse = {
1777
1569
  encode(
@@ -1790,9 +1582,7 @@ export const TrackUnpublishedResponse = {
1790
1582
  ): TrackUnpublishedResponse {
1791
1583
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1792
1584
  let end = length === undefined ? reader.len : reader.pos + length;
1793
- const message = {
1794
- ...baseTrackUnpublishedResponse,
1795
- } as TrackUnpublishedResponse;
1585
+ const message = createBaseTrackUnpublishedResponse();
1796
1586
  while (reader.pos < end) {
1797
1587
  const tag = reader.uint32();
1798
1588
  switch (tag >>> 3) {
@@ -1808,15 +1598,9 @@ export const TrackUnpublishedResponse = {
1808
1598
  },
1809
1599
 
1810
1600
  fromJSON(object: any): TrackUnpublishedResponse {
1811
- const message = {
1812
- ...baseTrackUnpublishedResponse,
1813
- } as TrackUnpublishedResponse;
1814
- if (object.trackSid !== undefined && object.trackSid !== null) {
1815
- message.trackSid = String(object.trackSid);
1816
- } else {
1817
- message.trackSid = "";
1818
- }
1819
- return message;
1601
+ return {
1602
+ trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
1603
+ };
1820
1604
  },
1821
1605
 
1822
1606
  toJSON(message: TrackUnpublishedResponse): unknown {
@@ -1825,18 +1609,18 @@ export const TrackUnpublishedResponse = {
1825
1609
  return obj;
1826
1610
  },
1827
1611
 
1828
- fromPartial(
1829
- object: DeepPartial<TrackUnpublishedResponse>
1612
+ fromPartial<I extends Exact<DeepPartial<TrackUnpublishedResponse>, I>>(
1613
+ object: I
1830
1614
  ): TrackUnpublishedResponse {
1831
- const message = {
1832
- ...baseTrackUnpublishedResponse,
1833
- } as TrackUnpublishedResponse;
1615
+ const message = createBaseTrackUnpublishedResponse();
1834
1616
  message.trackSid = object.trackSid ?? "";
1835
1617
  return message;
1836
1618
  },
1837
1619
  };
1838
1620
 
1839
- const baseSessionDescription: object = { type: "", sdp: "" };
1621
+ function createBaseSessionDescription(): SessionDescription {
1622
+ return { type: "", sdp: "" };
1623
+ }
1840
1624
 
1841
1625
  export const SessionDescription = {
1842
1626
  encode(
@@ -1855,7 +1639,7 @@ export const SessionDescription = {
1855
1639
  decode(input: _m0.Reader | Uint8Array, length?: number): SessionDescription {
1856
1640
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1857
1641
  let end = length === undefined ? reader.len : reader.pos + length;
1858
- const message = { ...baseSessionDescription } as SessionDescription;
1642
+ const message = createBaseSessionDescription();
1859
1643
  while (reader.pos < end) {
1860
1644
  const tag = reader.uint32();
1861
1645
  switch (tag >>> 3) {
@@ -1874,18 +1658,10 @@ export const SessionDescription = {
1874
1658
  },
1875
1659
 
1876
1660
  fromJSON(object: any): SessionDescription {
1877
- const message = { ...baseSessionDescription } as SessionDescription;
1878
- if (object.type !== undefined && object.type !== null) {
1879
- message.type = String(object.type);
1880
- } else {
1881
- message.type = "";
1882
- }
1883
- if (object.sdp !== undefined && object.sdp !== null) {
1884
- message.sdp = String(object.sdp);
1885
- } else {
1886
- message.sdp = "";
1887
- }
1888
- return message;
1661
+ return {
1662
+ type: isSet(object.type) ? String(object.type) : "",
1663
+ sdp: isSet(object.sdp) ? String(object.sdp) : "",
1664
+ };
1889
1665
  },
1890
1666
 
1891
1667
  toJSON(message: SessionDescription): unknown {
@@ -1895,15 +1671,19 @@ export const SessionDescription = {
1895
1671
  return obj;
1896
1672
  },
1897
1673
 
1898
- fromPartial(object: DeepPartial<SessionDescription>): SessionDescription {
1899
- const message = { ...baseSessionDescription } as SessionDescription;
1674
+ fromPartial<I extends Exact<DeepPartial<SessionDescription>, I>>(
1675
+ object: I
1676
+ ): SessionDescription {
1677
+ const message = createBaseSessionDescription();
1900
1678
  message.type = object.type ?? "";
1901
1679
  message.sdp = object.sdp ?? "";
1902
1680
  return message;
1903
1681
  },
1904
1682
  };
1905
1683
 
1906
- const baseParticipantUpdate: object = {};
1684
+ function createBaseParticipantUpdate(): ParticipantUpdate {
1685
+ return { participants: [] };
1686
+ }
1907
1687
 
1908
1688
  export const ParticipantUpdate = {
1909
1689
  encode(
@@ -1919,8 +1699,7 @@ export const ParticipantUpdate = {
1919
1699
  decode(input: _m0.Reader | Uint8Array, length?: number): ParticipantUpdate {
1920
1700
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1921
1701
  let end = length === undefined ? reader.len : reader.pos + length;
1922
- const message = { ...baseParticipantUpdate } as ParticipantUpdate;
1923
- message.participants = [];
1702
+ const message = createBaseParticipantUpdate();
1924
1703
  while (reader.pos < end) {
1925
1704
  const tag = reader.uint32();
1926
1705
  switch (tag >>> 3) {
@@ -1938,14 +1717,11 @@ export const ParticipantUpdate = {
1938
1717
  },
1939
1718
 
1940
1719
  fromJSON(object: any): ParticipantUpdate {
1941
- const message = { ...baseParticipantUpdate } as ParticipantUpdate;
1942
- message.participants = [];
1943
- if (object.participants !== undefined && object.participants !== null) {
1944
- for (const e of object.participants) {
1945
- message.participants.push(ParticipantInfo.fromJSON(e));
1946
- }
1947
- }
1948
- return message;
1720
+ return {
1721
+ participants: Array.isArray(object?.participants)
1722
+ ? object.participants.map((e: any) => ParticipantInfo.fromJSON(e))
1723
+ : [],
1724
+ };
1949
1725
  },
1950
1726
 
1951
1727
  toJSON(message: ParticipantUpdate): unknown {
@@ -1960,19 +1736,19 @@ export const ParticipantUpdate = {
1960
1736
  return obj;
1961
1737
  },
1962
1738
 
1963
- fromPartial(object: DeepPartial<ParticipantUpdate>): ParticipantUpdate {
1964
- const message = { ...baseParticipantUpdate } as ParticipantUpdate;
1965
- message.participants = [];
1966
- if (object.participants !== undefined && object.participants !== null) {
1967
- for (const e of object.participants) {
1968
- message.participants.push(ParticipantInfo.fromPartial(e));
1969
- }
1970
- }
1739
+ fromPartial<I extends Exact<DeepPartial<ParticipantUpdate>, I>>(
1740
+ object: I
1741
+ ): ParticipantUpdate {
1742
+ const message = createBaseParticipantUpdate();
1743
+ message.participants =
1744
+ object.participants?.map((e) => ParticipantInfo.fromPartial(e)) || [];
1971
1745
  return message;
1972
1746
  },
1973
1747
  };
1974
1748
 
1975
- const baseUpdateSubscription: object = { trackSids: "", subscribe: false };
1749
+ function createBaseUpdateSubscription(): UpdateSubscription {
1750
+ return { trackSids: [], subscribe: false, participantTracks: [] };
1751
+ }
1976
1752
 
1977
1753
  export const UpdateSubscription = {
1978
1754
  encode(
@@ -1994,9 +1770,7 @@ export const UpdateSubscription = {
1994
1770
  decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSubscription {
1995
1771
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1996
1772
  let end = length === undefined ? reader.len : reader.pos + length;
1997
- const message = { ...baseUpdateSubscription } as UpdateSubscription;
1998
- message.trackSids = [];
1999
- message.participantTracks = [];
1773
+ const message = createBaseUpdateSubscription();
2000
1774
  while (reader.pos < end) {
2001
1775
  const tag = reader.uint32();
2002
1776
  switch (tag >>> 3) {
@@ -2020,28 +1794,17 @@ export const UpdateSubscription = {
2020
1794
  },
2021
1795
 
2022
1796
  fromJSON(object: any): UpdateSubscription {
2023
- const message = { ...baseUpdateSubscription } as UpdateSubscription;
2024
- message.trackSids = [];
2025
- message.participantTracks = [];
2026
- if (object.trackSids !== undefined && object.trackSids !== null) {
2027
- for (const e of object.trackSids) {
2028
- message.trackSids.push(String(e));
2029
- }
2030
- }
2031
- if (object.subscribe !== undefined && object.subscribe !== null) {
2032
- message.subscribe = Boolean(object.subscribe);
2033
- } else {
2034
- message.subscribe = false;
2035
- }
2036
- if (
2037
- object.participantTracks !== undefined &&
2038
- object.participantTracks !== null
2039
- ) {
2040
- for (const e of object.participantTracks) {
2041
- message.participantTracks.push(ParticipantTracks.fromJSON(e));
2042
- }
2043
- }
2044
- return message;
1797
+ return {
1798
+ trackSids: Array.isArray(object?.trackSids)
1799
+ ? object.trackSids.map((e: any) => String(e))
1800
+ : [],
1801
+ subscribe: isSet(object.subscribe) ? Boolean(object.subscribe) : false,
1802
+ participantTracks: Array.isArray(object?.participantTracks)
1803
+ ? object.participantTracks.map((e: any) =>
1804
+ ParticipantTracks.fromJSON(e)
1805
+ )
1806
+ : [],
1807
+ };
2045
1808
  },
2046
1809
 
2047
1810
  toJSON(message: UpdateSubscription): unknown {
@@ -2062,35 +1825,22 @@ export const UpdateSubscription = {
2062
1825
  return obj;
2063
1826
  },
2064
1827
 
2065
- fromPartial(object: DeepPartial<UpdateSubscription>): UpdateSubscription {
2066
- const message = { ...baseUpdateSubscription } as UpdateSubscription;
2067
- message.trackSids = [];
2068
- if (object.trackSids !== undefined && object.trackSids !== null) {
2069
- for (const e of object.trackSids) {
2070
- message.trackSids.push(e);
2071
- }
2072
- }
1828
+ fromPartial<I extends Exact<DeepPartial<UpdateSubscription>, I>>(
1829
+ object: I
1830
+ ): UpdateSubscription {
1831
+ const message = createBaseUpdateSubscription();
1832
+ message.trackSids = object.trackSids?.map((e) => e) || [];
2073
1833
  message.subscribe = object.subscribe ?? false;
2074
- message.participantTracks = [];
2075
- if (
2076
- object.participantTracks !== undefined &&
2077
- object.participantTracks !== null
2078
- ) {
2079
- for (const e of object.participantTracks) {
2080
- message.participantTracks.push(ParticipantTracks.fromPartial(e));
2081
- }
2082
- }
1834
+ message.participantTracks =
1835
+ object.participantTracks?.map((e) => ParticipantTracks.fromPartial(e)) ||
1836
+ [];
2083
1837
  return message;
2084
1838
  },
2085
1839
  };
2086
1840
 
2087
- const baseUpdateTrackSettings: object = {
2088
- trackSids: "",
2089
- disabled: false,
2090
- quality: 0,
2091
- width: 0,
2092
- height: 0,
2093
- };
1841
+ function createBaseUpdateTrackSettings(): UpdateTrackSettings {
1842
+ return { trackSids: [], disabled: false, quality: 0, width: 0, height: 0 };
1843
+ }
2094
1844
 
2095
1845
  export const UpdateTrackSettings = {
2096
1846
  encode(
@@ -2118,8 +1868,7 @@ export const UpdateTrackSettings = {
2118
1868
  decode(input: _m0.Reader | Uint8Array, length?: number): UpdateTrackSettings {
2119
1869
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2120
1870
  let end = length === undefined ? reader.len : reader.pos + length;
2121
- const message = { ...baseUpdateTrackSettings } as UpdateTrackSettings;
2122
- message.trackSids = [];
1871
+ const message = createBaseUpdateTrackSettings();
2123
1872
  while (reader.pos < end) {
2124
1873
  const tag = reader.uint32();
2125
1874
  switch (tag >>> 3) {
@@ -2147,34 +1896,15 @@ export const UpdateTrackSettings = {
2147
1896
  },
2148
1897
 
2149
1898
  fromJSON(object: any): UpdateTrackSettings {
2150
- const message = { ...baseUpdateTrackSettings } as UpdateTrackSettings;
2151
- message.trackSids = [];
2152
- if (object.trackSids !== undefined && object.trackSids !== null) {
2153
- for (const e of object.trackSids) {
2154
- message.trackSids.push(String(e));
2155
- }
2156
- }
2157
- if (object.disabled !== undefined && object.disabled !== null) {
2158
- message.disabled = Boolean(object.disabled);
2159
- } else {
2160
- message.disabled = false;
2161
- }
2162
- if (object.quality !== undefined && object.quality !== null) {
2163
- message.quality = videoQualityFromJSON(object.quality);
2164
- } else {
2165
- message.quality = 0;
2166
- }
2167
- if (object.width !== undefined && object.width !== null) {
2168
- message.width = Number(object.width);
2169
- } else {
2170
- message.width = 0;
2171
- }
2172
- if (object.height !== undefined && object.height !== null) {
2173
- message.height = Number(object.height);
2174
- } else {
2175
- message.height = 0;
2176
- }
2177
- return message;
1899
+ return {
1900
+ trackSids: Array.isArray(object?.trackSids)
1901
+ ? object.trackSids.map((e: any) => String(e))
1902
+ : [],
1903
+ disabled: isSet(object.disabled) ? Boolean(object.disabled) : false,
1904
+ quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
1905
+ width: isSet(object.width) ? Number(object.width) : 0,
1906
+ height: isSet(object.height) ? Number(object.height) : 0,
1907
+ };
2178
1908
  },
2179
1909
 
2180
1910
  toJSON(message: UpdateTrackSettings): unknown {
@@ -2187,19 +1917,16 @@ export const UpdateTrackSettings = {
2187
1917
  message.disabled !== undefined && (obj.disabled = message.disabled);
2188
1918
  message.quality !== undefined &&
2189
1919
  (obj.quality = videoQualityToJSON(message.quality));
2190
- message.width !== undefined && (obj.width = message.width);
2191
- message.height !== undefined && (obj.height = message.height);
1920
+ message.width !== undefined && (obj.width = Math.round(message.width));
1921
+ message.height !== undefined && (obj.height = Math.round(message.height));
2192
1922
  return obj;
2193
1923
  },
2194
1924
 
2195
- fromPartial(object: DeepPartial<UpdateTrackSettings>): UpdateTrackSettings {
2196
- const message = { ...baseUpdateTrackSettings } as UpdateTrackSettings;
2197
- message.trackSids = [];
2198
- if (object.trackSids !== undefined && object.trackSids !== null) {
2199
- for (const e of object.trackSids) {
2200
- message.trackSids.push(e);
2201
- }
2202
- }
1925
+ fromPartial<I extends Exact<DeepPartial<UpdateTrackSettings>, I>>(
1926
+ object: I
1927
+ ): UpdateTrackSettings {
1928
+ const message = createBaseUpdateTrackSettings();
1929
+ message.trackSids = object.trackSids?.map((e) => e) || [];
2203
1930
  message.disabled = object.disabled ?? false;
2204
1931
  message.quality = object.quality ?? 0;
2205
1932
  message.width = object.width ?? 0;
@@ -2208,7 +1935,9 @@ export const UpdateTrackSettings = {
2208
1935
  },
2209
1936
  };
2210
1937
 
2211
- const baseLeaveRequest: object = { canReconnect: false };
1938
+ function createBaseLeaveRequest(): LeaveRequest {
1939
+ return { canReconnect: false };
1940
+ }
2212
1941
 
2213
1942
  export const LeaveRequest = {
2214
1943
  encode(
@@ -2224,7 +1953,7 @@ export const LeaveRequest = {
2224
1953
  decode(input: _m0.Reader | Uint8Array, length?: number): LeaveRequest {
2225
1954
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2226
1955
  let end = length === undefined ? reader.len : reader.pos + length;
2227
- const message = { ...baseLeaveRequest } as LeaveRequest;
1956
+ const message = createBaseLeaveRequest();
2228
1957
  while (reader.pos < end) {
2229
1958
  const tag = reader.uint32();
2230
1959
  switch (tag >>> 3) {
@@ -2240,13 +1969,11 @@ export const LeaveRequest = {
2240
1969
  },
2241
1970
 
2242
1971
  fromJSON(object: any): LeaveRequest {
2243
- const message = { ...baseLeaveRequest } as LeaveRequest;
2244
- if (object.canReconnect !== undefined && object.canReconnect !== null) {
2245
- message.canReconnect = Boolean(object.canReconnect);
2246
- } else {
2247
- message.canReconnect = false;
2248
- }
2249
- return message;
1972
+ return {
1973
+ canReconnect: isSet(object.canReconnect)
1974
+ ? Boolean(object.canReconnect)
1975
+ : false,
1976
+ };
2250
1977
  },
2251
1978
 
2252
1979
  toJSON(message: LeaveRequest): unknown {
@@ -2256,14 +1983,18 @@ export const LeaveRequest = {
2256
1983
  return obj;
2257
1984
  },
2258
1985
 
2259
- fromPartial(object: DeepPartial<LeaveRequest>): LeaveRequest {
2260
- const message = { ...baseLeaveRequest } as LeaveRequest;
1986
+ fromPartial<I extends Exact<DeepPartial<LeaveRequest>, I>>(
1987
+ object: I
1988
+ ): LeaveRequest {
1989
+ const message = createBaseLeaveRequest();
2261
1990
  message.canReconnect = object.canReconnect ?? false;
2262
1991
  return message;
2263
1992
  },
2264
1993
  };
2265
1994
 
2266
- const baseUpdateVideoLayers: object = { trackSid: "" };
1995
+ function createBaseUpdateVideoLayers(): UpdateVideoLayers {
1996
+ return { trackSid: "", layers: [] };
1997
+ }
2267
1998
 
2268
1999
  export const UpdateVideoLayers = {
2269
2000
  encode(
@@ -2282,8 +2013,7 @@ export const UpdateVideoLayers = {
2282
2013
  decode(input: _m0.Reader | Uint8Array, length?: number): UpdateVideoLayers {
2283
2014
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2284
2015
  let end = length === undefined ? reader.len : reader.pos + length;
2285
- const message = { ...baseUpdateVideoLayers } as UpdateVideoLayers;
2286
- message.layers = [];
2016
+ const message = createBaseUpdateVideoLayers();
2287
2017
  while (reader.pos < end) {
2288
2018
  const tag = reader.uint32();
2289
2019
  switch (tag >>> 3) {
@@ -2302,19 +2032,12 @@ export const UpdateVideoLayers = {
2302
2032
  },
2303
2033
 
2304
2034
  fromJSON(object: any): UpdateVideoLayers {
2305
- const message = { ...baseUpdateVideoLayers } as UpdateVideoLayers;
2306
- message.layers = [];
2307
- if (object.trackSid !== undefined && object.trackSid !== null) {
2308
- message.trackSid = String(object.trackSid);
2309
- } else {
2310
- message.trackSid = "";
2311
- }
2312
- if (object.layers !== undefined && object.layers !== null) {
2313
- for (const e of object.layers) {
2314
- message.layers.push(VideoLayer.fromJSON(e));
2315
- }
2316
- }
2317
- return message;
2035
+ return {
2036
+ trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2037
+ layers: Array.isArray(object?.layers)
2038
+ ? object.layers.map((e: any) => VideoLayer.fromJSON(e))
2039
+ : [],
2040
+ };
2318
2041
  },
2319
2042
 
2320
2043
  toJSON(message: UpdateVideoLayers): unknown {
@@ -2330,20 +2053,19 @@ export const UpdateVideoLayers = {
2330
2053
  return obj;
2331
2054
  },
2332
2055
 
2333
- fromPartial(object: DeepPartial<UpdateVideoLayers>): UpdateVideoLayers {
2334
- const message = { ...baseUpdateVideoLayers } as UpdateVideoLayers;
2056
+ fromPartial<I extends Exact<DeepPartial<UpdateVideoLayers>, I>>(
2057
+ object: I
2058
+ ): UpdateVideoLayers {
2059
+ const message = createBaseUpdateVideoLayers();
2335
2060
  message.trackSid = object.trackSid ?? "";
2336
- message.layers = [];
2337
- if (object.layers !== undefined && object.layers !== null) {
2338
- for (const e of object.layers) {
2339
- message.layers.push(VideoLayer.fromPartial(e));
2340
- }
2341
- }
2061
+ message.layers = object.layers?.map((e) => VideoLayer.fromPartial(e)) || [];
2342
2062
  return message;
2343
2063
  },
2344
2064
  };
2345
2065
 
2346
- const baseICEServer: object = { urls: "", username: "", credential: "" };
2066
+ function createBaseICEServer(): ICEServer {
2067
+ return { urls: [], username: "", credential: "" };
2068
+ }
2347
2069
 
2348
2070
  export const ICEServer = {
2349
2071
  encode(
@@ -2365,8 +2087,7 @@ export const ICEServer = {
2365
2087
  decode(input: _m0.Reader | Uint8Array, length?: number): ICEServer {
2366
2088
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2367
2089
  let end = length === undefined ? reader.len : reader.pos + length;
2368
- const message = { ...baseICEServer } as ICEServer;
2369
- message.urls = [];
2090
+ const message = createBaseICEServer();
2370
2091
  while (reader.pos < end) {
2371
2092
  const tag = reader.uint32();
2372
2093
  switch (tag >>> 3) {
@@ -2388,24 +2109,13 @@ export const ICEServer = {
2388
2109
  },
2389
2110
 
2390
2111
  fromJSON(object: any): ICEServer {
2391
- const message = { ...baseICEServer } as ICEServer;
2392
- message.urls = [];
2393
- if (object.urls !== undefined && object.urls !== null) {
2394
- for (const e of object.urls) {
2395
- message.urls.push(String(e));
2396
- }
2397
- }
2398
- if (object.username !== undefined && object.username !== null) {
2399
- message.username = String(object.username);
2400
- } else {
2401
- message.username = "";
2402
- }
2403
- if (object.credential !== undefined && object.credential !== null) {
2404
- message.credential = String(object.credential);
2405
- } else {
2406
- message.credential = "";
2407
- }
2408
- return message;
2112
+ return {
2113
+ urls: Array.isArray(object?.urls)
2114
+ ? object.urls.map((e: any) => String(e))
2115
+ : [],
2116
+ username: isSet(object.username) ? String(object.username) : "",
2117
+ credential: isSet(object.credential) ? String(object.credential) : "",
2118
+ };
2409
2119
  },
2410
2120
 
2411
2121
  toJSON(message: ICEServer): unknown {
@@ -2420,21 +2130,20 @@ export const ICEServer = {
2420
2130
  return obj;
2421
2131
  },
2422
2132
 
2423
- fromPartial(object: DeepPartial<ICEServer>): ICEServer {
2424
- const message = { ...baseICEServer } as ICEServer;
2425
- message.urls = [];
2426
- if (object.urls !== undefined && object.urls !== null) {
2427
- for (const e of object.urls) {
2428
- message.urls.push(e);
2429
- }
2430
- }
2133
+ fromPartial<I extends Exact<DeepPartial<ICEServer>, I>>(
2134
+ object: I
2135
+ ): ICEServer {
2136
+ const message = createBaseICEServer();
2137
+ message.urls = object.urls?.map((e) => e) || [];
2431
2138
  message.username = object.username ?? "";
2432
2139
  message.credential = object.credential ?? "";
2433
2140
  return message;
2434
2141
  },
2435
2142
  };
2436
2143
 
2437
- const baseSpeakersChanged: object = {};
2144
+ function createBaseSpeakersChanged(): SpeakersChanged {
2145
+ return { speakers: [] };
2146
+ }
2438
2147
 
2439
2148
  export const SpeakersChanged = {
2440
2149
  encode(
@@ -2450,8 +2159,7 @@ export const SpeakersChanged = {
2450
2159
  decode(input: _m0.Reader | Uint8Array, length?: number): SpeakersChanged {
2451
2160
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2452
2161
  let end = length === undefined ? reader.len : reader.pos + length;
2453
- const message = { ...baseSpeakersChanged } as SpeakersChanged;
2454
- message.speakers = [];
2162
+ const message = createBaseSpeakersChanged();
2455
2163
  while (reader.pos < end) {
2456
2164
  const tag = reader.uint32();
2457
2165
  switch (tag >>> 3) {
@@ -2467,14 +2175,11 @@ export const SpeakersChanged = {
2467
2175
  },
2468
2176
 
2469
2177
  fromJSON(object: any): SpeakersChanged {
2470
- const message = { ...baseSpeakersChanged } as SpeakersChanged;
2471
- message.speakers = [];
2472
- if (object.speakers !== undefined && object.speakers !== null) {
2473
- for (const e of object.speakers) {
2474
- message.speakers.push(SpeakerInfo.fromJSON(e));
2475
- }
2476
- }
2477
- return message;
2178
+ return {
2179
+ speakers: Array.isArray(object?.speakers)
2180
+ ? object.speakers.map((e: any) => SpeakerInfo.fromJSON(e))
2181
+ : [],
2182
+ };
2478
2183
  },
2479
2184
 
2480
2185
  toJSON(message: SpeakersChanged): unknown {
@@ -2489,19 +2194,19 @@ export const SpeakersChanged = {
2489
2194
  return obj;
2490
2195
  },
2491
2196
 
2492
- fromPartial(object: DeepPartial<SpeakersChanged>): SpeakersChanged {
2493
- const message = { ...baseSpeakersChanged } as SpeakersChanged;
2494
- message.speakers = [];
2495
- if (object.speakers !== undefined && object.speakers !== null) {
2496
- for (const e of object.speakers) {
2497
- message.speakers.push(SpeakerInfo.fromPartial(e));
2498
- }
2499
- }
2197
+ fromPartial<I extends Exact<DeepPartial<SpeakersChanged>, I>>(
2198
+ object: I
2199
+ ): SpeakersChanged {
2200
+ const message = createBaseSpeakersChanged();
2201
+ message.speakers =
2202
+ object.speakers?.map((e) => SpeakerInfo.fromPartial(e)) || [];
2500
2203
  return message;
2501
2204
  },
2502
2205
  };
2503
2206
 
2504
- const baseRoomUpdate: object = {};
2207
+ function createBaseRoomUpdate(): RoomUpdate {
2208
+ return { room: undefined };
2209
+ }
2505
2210
 
2506
2211
  export const RoomUpdate = {
2507
2212
  encode(
@@ -2517,7 +2222,7 @@ export const RoomUpdate = {
2517
2222
  decode(input: _m0.Reader | Uint8Array, length?: number): RoomUpdate {
2518
2223
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2519
2224
  let end = length === undefined ? reader.len : reader.pos + length;
2520
- const message = { ...baseRoomUpdate } as RoomUpdate;
2225
+ const message = createBaseRoomUpdate();
2521
2226
  while (reader.pos < end) {
2522
2227
  const tag = reader.uint32();
2523
2228
  switch (tag >>> 3) {
@@ -2533,13 +2238,9 @@ export const RoomUpdate = {
2533
2238
  },
2534
2239
 
2535
2240
  fromJSON(object: any): RoomUpdate {
2536
- const message = { ...baseRoomUpdate } as RoomUpdate;
2537
- if (object.room !== undefined && object.room !== null) {
2538
- message.room = Room.fromJSON(object.room);
2539
- } else {
2540
- message.room = undefined;
2541
- }
2542
- return message;
2241
+ return {
2242
+ room: isSet(object.room) ? Room.fromJSON(object.room) : undefined,
2243
+ };
2543
2244
  },
2544
2245
 
2545
2246
  toJSON(message: RoomUpdate): unknown {
@@ -2549,22 +2250,21 @@ export const RoomUpdate = {
2549
2250
  return obj;
2550
2251
  },
2551
2252
 
2552
- fromPartial(object: DeepPartial<RoomUpdate>): RoomUpdate {
2553
- const message = { ...baseRoomUpdate } as RoomUpdate;
2554
- if (object.room !== undefined && object.room !== null) {
2555
- message.room = Room.fromPartial(object.room);
2556
- } else {
2557
- message.room = undefined;
2558
- }
2253
+ fromPartial<I extends Exact<DeepPartial<RoomUpdate>, I>>(
2254
+ object: I
2255
+ ): RoomUpdate {
2256
+ const message = createBaseRoomUpdate();
2257
+ message.room =
2258
+ object.room !== undefined && object.room !== null
2259
+ ? Room.fromPartial(object.room)
2260
+ : undefined;
2559
2261
  return message;
2560
2262
  },
2561
2263
  };
2562
2264
 
2563
- const baseConnectionQualityInfo: object = {
2564
- participantSid: "",
2565
- quality: 0,
2566
- score: 0,
2567
- };
2265
+ function createBaseConnectionQualityInfo(): ConnectionQualityInfo {
2266
+ return { participantSid: "", quality: 0, score: 0 };
2267
+ }
2568
2268
 
2569
2269
  export const ConnectionQualityInfo = {
2570
2270
  encode(
@@ -2589,7 +2289,7 @@ export const ConnectionQualityInfo = {
2589
2289
  ): ConnectionQualityInfo {
2590
2290
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2591
2291
  let end = length === undefined ? reader.len : reader.pos + length;
2592
- const message = { ...baseConnectionQualityInfo } as ConnectionQualityInfo;
2292
+ const message = createBaseConnectionQualityInfo();
2593
2293
  while (reader.pos < end) {
2594
2294
  const tag = reader.uint32();
2595
2295
  switch (tag >>> 3) {
@@ -2611,23 +2311,15 @@ export const ConnectionQualityInfo = {
2611
2311
  },
2612
2312
 
2613
2313
  fromJSON(object: any): ConnectionQualityInfo {
2614
- const message = { ...baseConnectionQualityInfo } as ConnectionQualityInfo;
2615
- if (object.participantSid !== undefined && object.participantSid !== null) {
2616
- message.participantSid = String(object.participantSid);
2617
- } else {
2618
- message.participantSid = "";
2619
- }
2620
- if (object.quality !== undefined && object.quality !== null) {
2621
- message.quality = connectionQualityFromJSON(object.quality);
2622
- } else {
2623
- message.quality = 0;
2624
- }
2625
- if (object.score !== undefined && object.score !== null) {
2626
- message.score = Number(object.score);
2627
- } else {
2628
- message.score = 0;
2629
- }
2630
- return message;
2314
+ return {
2315
+ participantSid: isSet(object.participantSid)
2316
+ ? String(object.participantSid)
2317
+ : "",
2318
+ quality: isSet(object.quality)
2319
+ ? connectionQualityFromJSON(object.quality)
2320
+ : 0,
2321
+ score: isSet(object.score) ? Number(object.score) : 0,
2322
+ };
2631
2323
  },
2632
2324
 
2633
2325
  toJSON(message: ConnectionQualityInfo): unknown {
@@ -2640,10 +2332,10 @@ export const ConnectionQualityInfo = {
2640
2332
  return obj;
2641
2333
  },
2642
2334
 
2643
- fromPartial(
2644
- object: DeepPartial<ConnectionQualityInfo>
2335
+ fromPartial<I extends Exact<DeepPartial<ConnectionQualityInfo>, I>>(
2336
+ object: I
2645
2337
  ): ConnectionQualityInfo {
2646
- const message = { ...baseConnectionQualityInfo } as ConnectionQualityInfo;
2338
+ const message = createBaseConnectionQualityInfo();
2647
2339
  message.participantSid = object.participantSid ?? "";
2648
2340
  message.quality = object.quality ?? 0;
2649
2341
  message.score = object.score ?? 0;
@@ -2651,7 +2343,9 @@ export const ConnectionQualityInfo = {
2651
2343
  },
2652
2344
  };
2653
2345
 
2654
- const baseConnectionQualityUpdate: object = {};
2346
+ function createBaseConnectionQualityUpdate(): ConnectionQualityUpdate {
2347
+ return { updates: [] };
2348
+ }
2655
2349
 
2656
2350
  export const ConnectionQualityUpdate = {
2657
2351
  encode(
@@ -2670,10 +2364,7 @@ export const ConnectionQualityUpdate = {
2670
2364
  ): ConnectionQualityUpdate {
2671
2365
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2672
2366
  let end = length === undefined ? reader.len : reader.pos + length;
2673
- const message = {
2674
- ...baseConnectionQualityUpdate,
2675
- } as ConnectionQualityUpdate;
2676
- message.updates = [];
2367
+ const message = createBaseConnectionQualityUpdate();
2677
2368
  while (reader.pos < end) {
2678
2369
  const tag = reader.uint32();
2679
2370
  switch (tag >>> 3) {
@@ -2691,16 +2382,11 @@ export const ConnectionQualityUpdate = {
2691
2382
  },
2692
2383
 
2693
2384
  fromJSON(object: any): ConnectionQualityUpdate {
2694
- const message = {
2695
- ...baseConnectionQualityUpdate,
2696
- } as ConnectionQualityUpdate;
2697
- message.updates = [];
2698
- if (object.updates !== undefined && object.updates !== null) {
2699
- for (const e of object.updates) {
2700
- message.updates.push(ConnectionQualityInfo.fromJSON(e));
2701
- }
2702
- }
2703
- return message;
2385
+ return {
2386
+ updates: Array.isArray(object?.updates)
2387
+ ? object.updates.map((e: any) => ConnectionQualityInfo.fromJSON(e))
2388
+ : [],
2389
+ };
2704
2390
  },
2705
2391
 
2706
2392
  toJSON(message: ConnectionQualityUpdate): unknown {
@@ -2715,27 +2401,19 @@ export const ConnectionQualityUpdate = {
2715
2401
  return obj;
2716
2402
  },
2717
2403
 
2718
- fromPartial(
2719
- object: DeepPartial<ConnectionQualityUpdate>
2404
+ fromPartial<I extends Exact<DeepPartial<ConnectionQualityUpdate>, I>>(
2405
+ object: I
2720
2406
  ): ConnectionQualityUpdate {
2721
- const message = {
2722
- ...baseConnectionQualityUpdate,
2723
- } as ConnectionQualityUpdate;
2724
- message.updates = [];
2725
- if (object.updates !== undefined && object.updates !== null) {
2726
- for (const e of object.updates) {
2727
- message.updates.push(ConnectionQualityInfo.fromPartial(e));
2728
- }
2729
- }
2407
+ const message = createBaseConnectionQualityUpdate();
2408
+ message.updates =
2409
+ object.updates?.map((e) => ConnectionQualityInfo.fromPartial(e)) || [];
2730
2410
  return message;
2731
2411
  },
2732
2412
  };
2733
2413
 
2734
- const baseStreamStateInfo: object = {
2735
- participantSid: "",
2736
- trackSid: "",
2737
- state: 0,
2738
- };
2414
+ function createBaseStreamStateInfo(): StreamStateInfo {
2415
+ return { participantSid: "", trackSid: "", state: 0 };
2416
+ }
2739
2417
 
2740
2418
  export const StreamStateInfo = {
2741
2419
  encode(
@@ -2757,7 +2435,7 @@ export const StreamStateInfo = {
2757
2435
  decode(input: _m0.Reader | Uint8Array, length?: number): StreamStateInfo {
2758
2436
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2759
2437
  let end = length === undefined ? reader.len : reader.pos + length;
2760
- const message = { ...baseStreamStateInfo } as StreamStateInfo;
2438
+ const message = createBaseStreamStateInfo();
2761
2439
  while (reader.pos < end) {
2762
2440
  const tag = reader.uint32();
2763
2441
  switch (tag >>> 3) {
@@ -2779,23 +2457,13 @@ export const StreamStateInfo = {
2779
2457
  },
2780
2458
 
2781
2459
  fromJSON(object: any): StreamStateInfo {
2782
- const message = { ...baseStreamStateInfo } as StreamStateInfo;
2783
- if (object.participantSid !== undefined && object.participantSid !== null) {
2784
- message.participantSid = String(object.participantSid);
2785
- } else {
2786
- message.participantSid = "";
2787
- }
2788
- if (object.trackSid !== undefined && object.trackSid !== null) {
2789
- message.trackSid = String(object.trackSid);
2790
- } else {
2791
- message.trackSid = "";
2792
- }
2793
- if (object.state !== undefined && object.state !== null) {
2794
- message.state = streamStateFromJSON(object.state);
2795
- } else {
2796
- message.state = 0;
2797
- }
2798
- return message;
2460
+ return {
2461
+ participantSid: isSet(object.participantSid)
2462
+ ? String(object.participantSid)
2463
+ : "",
2464
+ trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2465
+ state: isSet(object.state) ? streamStateFromJSON(object.state) : 0,
2466
+ };
2799
2467
  },
2800
2468
 
2801
2469
  toJSON(message: StreamStateInfo): unknown {
@@ -2808,8 +2476,10 @@ export const StreamStateInfo = {
2808
2476
  return obj;
2809
2477
  },
2810
2478
 
2811
- fromPartial(object: DeepPartial<StreamStateInfo>): StreamStateInfo {
2812
- const message = { ...baseStreamStateInfo } as StreamStateInfo;
2479
+ fromPartial<I extends Exact<DeepPartial<StreamStateInfo>, I>>(
2480
+ object: I
2481
+ ): StreamStateInfo {
2482
+ const message = createBaseStreamStateInfo();
2813
2483
  message.participantSid = object.participantSid ?? "";
2814
2484
  message.trackSid = object.trackSid ?? "";
2815
2485
  message.state = object.state ?? 0;
@@ -2817,7 +2487,9 @@ export const StreamStateInfo = {
2817
2487
  },
2818
2488
  };
2819
2489
 
2820
- const baseStreamStateUpdate: object = {};
2490
+ function createBaseStreamStateUpdate(): StreamStateUpdate {
2491
+ return { streamStates: [] };
2492
+ }
2821
2493
 
2822
2494
  export const StreamStateUpdate = {
2823
2495
  encode(
@@ -2833,8 +2505,7 @@ export const StreamStateUpdate = {
2833
2505
  decode(input: _m0.Reader | Uint8Array, length?: number): StreamStateUpdate {
2834
2506
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2835
2507
  let end = length === undefined ? reader.len : reader.pos + length;
2836
- const message = { ...baseStreamStateUpdate } as StreamStateUpdate;
2837
- message.streamStates = [];
2508
+ const message = createBaseStreamStateUpdate();
2838
2509
  while (reader.pos < end) {
2839
2510
  const tag = reader.uint32();
2840
2511
  switch (tag >>> 3) {
@@ -2852,14 +2523,11 @@ export const StreamStateUpdate = {
2852
2523
  },
2853
2524
 
2854
2525
  fromJSON(object: any): StreamStateUpdate {
2855
- const message = { ...baseStreamStateUpdate } as StreamStateUpdate;
2856
- message.streamStates = [];
2857
- if (object.streamStates !== undefined && object.streamStates !== null) {
2858
- for (const e of object.streamStates) {
2859
- message.streamStates.push(StreamStateInfo.fromJSON(e));
2860
- }
2861
- }
2862
- return message;
2526
+ return {
2527
+ streamStates: Array.isArray(object?.streamStates)
2528
+ ? object.streamStates.map((e: any) => StreamStateInfo.fromJSON(e))
2529
+ : [],
2530
+ };
2863
2531
  },
2864
2532
 
2865
2533
  toJSON(message: StreamStateUpdate): unknown {
@@ -2874,19 +2542,19 @@ export const StreamStateUpdate = {
2874
2542
  return obj;
2875
2543
  },
2876
2544
 
2877
- fromPartial(object: DeepPartial<StreamStateUpdate>): StreamStateUpdate {
2878
- const message = { ...baseStreamStateUpdate } as StreamStateUpdate;
2879
- message.streamStates = [];
2880
- if (object.streamStates !== undefined && object.streamStates !== null) {
2881
- for (const e of object.streamStates) {
2882
- message.streamStates.push(StreamStateInfo.fromPartial(e));
2883
- }
2884
- }
2545
+ fromPartial<I extends Exact<DeepPartial<StreamStateUpdate>, I>>(
2546
+ object: I
2547
+ ): StreamStateUpdate {
2548
+ const message = createBaseStreamStateUpdate();
2549
+ message.streamStates =
2550
+ object.streamStates?.map((e) => StreamStateInfo.fromPartial(e)) || [];
2885
2551
  return message;
2886
2552
  },
2887
2553
  };
2888
2554
 
2889
- const baseSubscribedQuality: object = { quality: 0, enabled: false };
2555
+ function createBaseSubscribedQuality(): SubscribedQuality {
2556
+ return { quality: 0, enabled: false };
2557
+ }
2890
2558
 
2891
2559
  export const SubscribedQuality = {
2892
2560
  encode(
@@ -2905,7 +2573,7 @@ export const SubscribedQuality = {
2905
2573
  decode(input: _m0.Reader | Uint8Array, length?: number): SubscribedQuality {
2906
2574
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2907
2575
  let end = length === undefined ? reader.len : reader.pos + length;
2908
- const message = { ...baseSubscribedQuality } as SubscribedQuality;
2576
+ const message = createBaseSubscribedQuality();
2909
2577
  while (reader.pos < end) {
2910
2578
  const tag = reader.uint32();
2911
2579
  switch (tag >>> 3) {
@@ -2924,18 +2592,10 @@ export const SubscribedQuality = {
2924
2592
  },
2925
2593
 
2926
2594
  fromJSON(object: any): SubscribedQuality {
2927
- const message = { ...baseSubscribedQuality } as SubscribedQuality;
2928
- if (object.quality !== undefined && object.quality !== null) {
2929
- message.quality = videoQualityFromJSON(object.quality);
2930
- } else {
2931
- message.quality = 0;
2932
- }
2933
- if (object.enabled !== undefined && object.enabled !== null) {
2934
- message.enabled = Boolean(object.enabled);
2935
- } else {
2936
- message.enabled = false;
2937
- }
2938
- return message;
2595
+ return {
2596
+ quality: isSet(object.quality) ? videoQualityFromJSON(object.quality) : 0,
2597
+ enabled: isSet(object.enabled) ? Boolean(object.enabled) : false,
2598
+ };
2939
2599
  },
2940
2600
 
2941
2601
  toJSON(message: SubscribedQuality): unknown {
@@ -2946,15 +2606,19 @@ export const SubscribedQuality = {
2946
2606
  return obj;
2947
2607
  },
2948
2608
 
2949
- fromPartial(object: DeepPartial<SubscribedQuality>): SubscribedQuality {
2950
- const message = { ...baseSubscribedQuality } as SubscribedQuality;
2609
+ fromPartial<I extends Exact<DeepPartial<SubscribedQuality>, I>>(
2610
+ object: I
2611
+ ): SubscribedQuality {
2612
+ const message = createBaseSubscribedQuality();
2951
2613
  message.quality = object.quality ?? 0;
2952
2614
  message.enabled = object.enabled ?? false;
2953
2615
  return message;
2954
2616
  },
2955
2617
  };
2956
2618
 
2957
- const baseSubscribedQualityUpdate: object = { trackSid: "" };
2619
+ function createBaseSubscribedQualityUpdate(): SubscribedQualityUpdate {
2620
+ return { trackSid: "", subscribedQualities: [] };
2621
+ }
2958
2622
 
2959
2623
  export const SubscribedQualityUpdate = {
2960
2624
  encode(
@@ -2976,10 +2640,7 @@ export const SubscribedQualityUpdate = {
2976
2640
  ): SubscribedQualityUpdate {
2977
2641
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
2978
2642
  let end = length === undefined ? reader.len : reader.pos + length;
2979
- const message = {
2980
- ...baseSubscribedQualityUpdate,
2981
- } as SubscribedQualityUpdate;
2982
- message.subscribedQualities = [];
2643
+ const message = createBaseSubscribedQualityUpdate();
2983
2644
  while (reader.pos < end) {
2984
2645
  const tag = reader.uint32();
2985
2646
  switch (tag >>> 3) {
@@ -3000,24 +2661,14 @@ export const SubscribedQualityUpdate = {
3000
2661
  },
3001
2662
 
3002
2663
  fromJSON(object: any): SubscribedQualityUpdate {
3003
- const message = {
3004
- ...baseSubscribedQualityUpdate,
3005
- } as SubscribedQualityUpdate;
3006
- message.subscribedQualities = [];
3007
- if (object.trackSid !== undefined && object.trackSid !== null) {
3008
- message.trackSid = String(object.trackSid);
3009
- } else {
3010
- message.trackSid = "";
3011
- }
3012
- if (
3013
- object.subscribedQualities !== undefined &&
3014
- object.subscribedQualities !== null
3015
- ) {
3016
- for (const e of object.subscribedQualities) {
3017
- message.subscribedQualities.push(SubscribedQuality.fromJSON(e));
3018
- }
3019
- }
3020
- return message;
2664
+ return {
2665
+ trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2666
+ subscribedQualities: Array.isArray(object?.subscribedQualities)
2667
+ ? object.subscribedQualities.map((e: any) =>
2668
+ SubscribedQuality.fromJSON(e)
2669
+ )
2670
+ : [],
2671
+ };
3021
2672
  },
3022
2673
 
3023
2674
  toJSON(message: SubscribedQualityUpdate): unknown {
@@ -3033,31 +2684,22 @@ export const SubscribedQualityUpdate = {
3033
2684
  return obj;
3034
2685
  },
3035
2686
 
3036
- fromPartial(
3037
- object: DeepPartial<SubscribedQualityUpdate>
2687
+ fromPartial<I extends Exact<DeepPartial<SubscribedQualityUpdate>, I>>(
2688
+ object: I
3038
2689
  ): SubscribedQualityUpdate {
3039
- const message = {
3040
- ...baseSubscribedQualityUpdate,
3041
- } as SubscribedQualityUpdate;
2690
+ const message = createBaseSubscribedQualityUpdate();
3042
2691
  message.trackSid = object.trackSid ?? "";
3043
- message.subscribedQualities = [];
3044
- if (
3045
- object.subscribedQualities !== undefined &&
3046
- object.subscribedQualities !== null
3047
- ) {
3048
- for (const e of object.subscribedQualities) {
3049
- message.subscribedQualities.push(SubscribedQuality.fromPartial(e));
3050
- }
3051
- }
2692
+ message.subscribedQualities =
2693
+ object.subscribedQualities?.map((e) =>
2694
+ SubscribedQuality.fromPartial(e)
2695
+ ) || [];
3052
2696
  return message;
3053
2697
  },
3054
2698
  };
3055
2699
 
3056
- const baseTrackPermission: object = {
3057
- participantSid: "",
3058
- allTracks: false,
3059
- trackSids: "",
3060
- };
2700
+ function createBaseTrackPermission(): TrackPermission {
2701
+ return { participantSid: "", allTracks: false, trackSids: [] };
2702
+ }
3061
2703
 
3062
2704
  export const TrackPermission = {
3063
2705
  encode(
@@ -3079,8 +2721,7 @@ export const TrackPermission = {
3079
2721
  decode(input: _m0.Reader | Uint8Array, length?: number): TrackPermission {
3080
2722
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3081
2723
  let end = length === undefined ? reader.len : reader.pos + length;
3082
- const message = { ...baseTrackPermission } as TrackPermission;
3083
- message.trackSids = [];
2724
+ const message = createBaseTrackPermission();
3084
2725
  while (reader.pos < end) {
3085
2726
  const tag = reader.uint32();
3086
2727
  switch (tag >>> 3) {
@@ -3102,24 +2743,15 @@ export const TrackPermission = {
3102
2743
  },
3103
2744
 
3104
2745
  fromJSON(object: any): TrackPermission {
3105
- const message = { ...baseTrackPermission } as TrackPermission;
3106
- message.trackSids = [];
3107
- if (object.participantSid !== undefined && object.participantSid !== null) {
3108
- message.participantSid = String(object.participantSid);
3109
- } else {
3110
- message.participantSid = "";
3111
- }
3112
- if (object.allTracks !== undefined && object.allTracks !== null) {
3113
- message.allTracks = Boolean(object.allTracks);
3114
- } else {
3115
- message.allTracks = false;
3116
- }
3117
- if (object.trackSids !== undefined && object.trackSids !== null) {
3118
- for (const e of object.trackSids) {
3119
- message.trackSids.push(String(e));
3120
- }
3121
- }
3122
- return message;
2746
+ return {
2747
+ participantSid: isSet(object.participantSid)
2748
+ ? String(object.participantSid)
2749
+ : "",
2750
+ allTracks: isSet(object.allTracks) ? Boolean(object.allTracks) : false,
2751
+ trackSids: Array.isArray(object?.trackSids)
2752
+ ? object.trackSids.map((e: any) => String(e))
2753
+ : [],
2754
+ };
3123
2755
  },
3124
2756
 
3125
2757
  toJSON(message: TrackPermission): unknown {
@@ -3135,21 +2767,20 @@ export const TrackPermission = {
3135
2767
  return obj;
3136
2768
  },
3137
2769
 
3138
- fromPartial(object: DeepPartial<TrackPermission>): TrackPermission {
3139
- const message = { ...baseTrackPermission } as TrackPermission;
2770
+ fromPartial<I extends Exact<DeepPartial<TrackPermission>, I>>(
2771
+ object: I
2772
+ ): TrackPermission {
2773
+ const message = createBaseTrackPermission();
3140
2774
  message.participantSid = object.participantSid ?? "";
3141
2775
  message.allTracks = object.allTracks ?? false;
3142
- message.trackSids = [];
3143
- if (object.trackSids !== undefined && object.trackSids !== null) {
3144
- for (const e of object.trackSids) {
3145
- message.trackSids.push(e);
3146
- }
3147
- }
2776
+ message.trackSids = object.trackSids?.map((e) => e) || [];
3148
2777
  return message;
3149
2778
  },
3150
2779
  };
3151
2780
 
3152
- const baseSubscriptionPermission: object = { allParticipants: false };
2781
+ function createBaseSubscriptionPermission(): SubscriptionPermission {
2782
+ return { allParticipants: false, trackPermissions: [] };
2783
+ }
3153
2784
 
3154
2785
  export const SubscriptionPermission = {
3155
2786
  encode(
@@ -3171,8 +2802,7 @@ export const SubscriptionPermission = {
3171
2802
  ): SubscriptionPermission {
3172
2803
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3173
2804
  let end = length === undefined ? reader.len : reader.pos + length;
3174
- const message = { ...baseSubscriptionPermission } as SubscriptionPermission;
3175
- message.trackPermissions = [];
2805
+ const message = createBaseSubscriptionPermission();
3176
2806
  while (reader.pos < end) {
3177
2807
  const tag = reader.uint32();
3178
2808
  switch (tag >>> 3) {
@@ -3193,25 +2823,14 @@ export const SubscriptionPermission = {
3193
2823
  },
3194
2824
 
3195
2825
  fromJSON(object: any): SubscriptionPermission {
3196
- const message = { ...baseSubscriptionPermission } as SubscriptionPermission;
3197
- message.trackPermissions = [];
3198
- if (
3199
- object.allParticipants !== undefined &&
3200
- object.allParticipants !== null
3201
- ) {
3202
- message.allParticipants = Boolean(object.allParticipants);
3203
- } else {
3204
- message.allParticipants = false;
3205
- }
3206
- if (
3207
- object.trackPermissions !== undefined &&
3208
- object.trackPermissions !== null
3209
- ) {
3210
- for (const e of object.trackPermissions) {
3211
- message.trackPermissions.push(TrackPermission.fromJSON(e));
3212
- }
3213
- }
3214
- return message;
2826
+ return {
2827
+ allParticipants: isSet(object.allParticipants)
2828
+ ? Boolean(object.allParticipants)
2829
+ : false,
2830
+ trackPermissions: Array.isArray(object?.trackPermissions)
2831
+ ? object.trackPermissions.map((e: any) => TrackPermission.fromJSON(e))
2832
+ : [],
2833
+ };
3215
2834
  },
3216
2835
 
3217
2836
  toJSON(message: SubscriptionPermission): unknown {
@@ -3228,29 +2847,20 @@ export const SubscriptionPermission = {
3228
2847
  return obj;
3229
2848
  },
3230
2849
 
3231
- fromPartial(
3232
- object: DeepPartial<SubscriptionPermission>
2850
+ fromPartial<I extends Exact<DeepPartial<SubscriptionPermission>, I>>(
2851
+ object: I
3233
2852
  ): SubscriptionPermission {
3234
- const message = { ...baseSubscriptionPermission } as SubscriptionPermission;
2853
+ const message = createBaseSubscriptionPermission();
3235
2854
  message.allParticipants = object.allParticipants ?? false;
3236
- message.trackPermissions = [];
3237
- if (
3238
- object.trackPermissions !== undefined &&
3239
- object.trackPermissions !== null
3240
- ) {
3241
- for (const e of object.trackPermissions) {
3242
- message.trackPermissions.push(TrackPermission.fromPartial(e));
3243
- }
3244
- }
2855
+ message.trackPermissions =
2856
+ object.trackPermissions?.map((e) => TrackPermission.fromPartial(e)) || [];
3245
2857
  return message;
3246
2858
  },
3247
2859
  };
3248
2860
 
3249
- const baseSubscriptionPermissionUpdate: object = {
3250
- participantSid: "",
3251
- trackSid: "",
3252
- allowed: false,
3253
- };
2861
+ function createBaseSubscriptionPermissionUpdate(): SubscriptionPermissionUpdate {
2862
+ return { participantSid: "", trackSid: "", allowed: false };
2863
+ }
3254
2864
 
3255
2865
  export const SubscriptionPermissionUpdate = {
3256
2866
  encode(
@@ -3275,9 +2885,7 @@ export const SubscriptionPermissionUpdate = {
3275
2885
  ): SubscriptionPermissionUpdate {
3276
2886
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3277
2887
  let end = length === undefined ? reader.len : reader.pos + length;
3278
- const message = {
3279
- ...baseSubscriptionPermissionUpdate,
3280
- } as SubscriptionPermissionUpdate;
2888
+ const message = createBaseSubscriptionPermissionUpdate();
3281
2889
  while (reader.pos < end) {
3282
2890
  const tag = reader.uint32();
3283
2891
  switch (tag >>> 3) {
@@ -3299,25 +2907,13 @@ export const SubscriptionPermissionUpdate = {
3299
2907
  },
3300
2908
 
3301
2909
  fromJSON(object: any): SubscriptionPermissionUpdate {
3302
- const message = {
3303
- ...baseSubscriptionPermissionUpdate,
3304
- } as SubscriptionPermissionUpdate;
3305
- if (object.participantSid !== undefined && object.participantSid !== null) {
3306
- message.participantSid = String(object.participantSid);
3307
- } else {
3308
- message.participantSid = "";
3309
- }
3310
- if (object.trackSid !== undefined && object.trackSid !== null) {
3311
- message.trackSid = String(object.trackSid);
3312
- } else {
3313
- message.trackSid = "";
3314
- }
3315
- if (object.allowed !== undefined && object.allowed !== null) {
3316
- message.allowed = Boolean(object.allowed);
3317
- } else {
3318
- message.allowed = false;
3319
- }
3320
- return message;
2910
+ return {
2911
+ participantSid: isSet(object.participantSid)
2912
+ ? String(object.participantSid)
2913
+ : "",
2914
+ trackSid: isSet(object.trackSid) ? String(object.trackSid) : "",
2915
+ allowed: isSet(object.allowed) ? Boolean(object.allowed) : false,
2916
+ };
3321
2917
  },
3322
2918
 
3323
2919
  toJSON(message: SubscriptionPermissionUpdate): unknown {
@@ -3329,12 +2925,10 @@ export const SubscriptionPermissionUpdate = {
3329
2925
  return obj;
3330
2926
  },
3331
2927
 
3332
- fromPartial(
3333
- object: DeepPartial<SubscriptionPermissionUpdate>
2928
+ fromPartial<I extends Exact<DeepPartial<SubscriptionPermissionUpdate>, I>>(
2929
+ object: I
3334
2930
  ): SubscriptionPermissionUpdate {
3335
- const message = {
3336
- ...baseSubscriptionPermissionUpdate,
3337
- } as SubscriptionPermissionUpdate;
2931
+ const message = createBaseSubscriptionPermissionUpdate();
3338
2932
  message.participantSid = object.participantSid ?? "";
3339
2933
  message.trackSid = object.trackSid ?? "";
3340
2934
  message.allowed = object.allowed ?? false;
@@ -3342,7 +2936,14 @@ export const SubscriptionPermissionUpdate = {
3342
2936
  },
3343
2937
  };
3344
2938
 
3345
- const baseSyncState: object = {};
2939
+ function createBaseSyncState(): SyncState {
2940
+ return {
2941
+ answer: undefined,
2942
+ subscription: undefined,
2943
+ publishTracks: [],
2944
+ dataChannels: [],
2945
+ };
2946
+ }
3346
2947
 
3347
2948
  export const SyncState = {
3348
2949
  encode(
@@ -3373,9 +2974,7 @@ export const SyncState = {
3373
2974
  decode(input: _m0.Reader | Uint8Array, length?: number): SyncState {
3374
2975
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3375
2976
  let end = length === undefined ? reader.len : reader.pos + length;
3376
- const message = { ...baseSyncState } as SyncState;
3377
- message.publishTracks = [];
3378
- message.dataChannels = [];
2977
+ const message = createBaseSyncState();
3379
2978
  while (reader.pos < end) {
3380
2979
  const tag = reader.uint32();
3381
2980
  switch (tag >>> 3) {
@@ -3407,30 +3006,22 @@ export const SyncState = {
3407
3006
  },
3408
3007
 
3409
3008
  fromJSON(object: any): SyncState {
3410
- const message = { ...baseSyncState } as SyncState;
3411
- message.publishTracks = [];
3412
- message.dataChannels = [];
3413
- if (object.answer !== undefined && object.answer !== null) {
3414
- message.answer = SessionDescription.fromJSON(object.answer);
3415
- } else {
3416
- message.answer = undefined;
3417
- }
3418
- if (object.subscription !== undefined && object.subscription !== null) {
3419
- message.subscription = UpdateSubscription.fromJSON(object.subscription);
3420
- } else {
3421
- message.subscription = undefined;
3422
- }
3423
- if (object.publishTracks !== undefined && object.publishTracks !== null) {
3424
- for (const e of object.publishTracks) {
3425
- message.publishTracks.push(TrackPublishedResponse.fromJSON(e));
3426
- }
3427
- }
3428
- if (object.dataChannels !== undefined && object.dataChannels !== null) {
3429
- for (const e of object.dataChannels) {
3430
- message.dataChannels.push(DataChannelInfo.fromJSON(e));
3431
- }
3432
- }
3433
- return message;
3009
+ return {
3010
+ answer: isSet(object.answer)
3011
+ ? SessionDescription.fromJSON(object.answer)
3012
+ : undefined,
3013
+ subscription: isSet(object.subscription)
3014
+ ? UpdateSubscription.fromJSON(object.subscription)
3015
+ : undefined,
3016
+ publishTracks: Array.isArray(object?.publishTracks)
3017
+ ? object.publishTracks.map((e: any) =>
3018
+ TrackPublishedResponse.fromJSON(e)
3019
+ )
3020
+ : [],
3021
+ dataChannels: Array.isArray(object?.dataChannels)
3022
+ ? object.dataChannels.map((e: any) => DataChannelInfo.fromJSON(e))
3023
+ : [],
3024
+ };
3434
3025
  },
3435
3026
 
3436
3027
  toJSON(message: SyncState): unknown {
@@ -3460,37 +3051,30 @@ export const SyncState = {
3460
3051
  return obj;
3461
3052
  },
3462
3053
 
3463
- fromPartial(object: DeepPartial<SyncState>): SyncState {
3464
- const message = { ...baseSyncState } as SyncState;
3465
- if (object.answer !== undefined && object.answer !== null) {
3466
- message.answer = SessionDescription.fromPartial(object.answer);
3467
- } else {
3468
- message.answer = undefined;
3469
- }
3470
- if (object.subscription !== undefined && object.subscription !== null) {
3471
- message.subscription = UpdateSubscription.fromPartial(
3472
- object.subscription
3473
- );
3474
- } else {
3475
- message.subscription = undefined;
3476
- }
3477
- message.publishTracks = [];
3478
- if (object.publishTracks !== undefined && object.publishTracks !== null) {
3479
- for (const e of object.publishTracks) {
3480
- message.publishTracks.push(TrackPublishedResponse.fromPartial(e));
3481
- }
3482
- }
3483
- message.dataChannels = [];
3484
- if (object.dataChannels !== undefined && object.dataChannels !== null) {
3485
- for (const e of object.dataChannels) {
3486
- message.dataChannels.push(DataChannelInfo.fromPartial(e));
3487
- }
3488
- }
3054
+ fromPartial<I extends Exact<DeepPartial<SyncState>, I>>(
3055
+ object: I
3056
+ ): SyncState {
3057
+ const message = createBaseSyncState();
3058
+ message.answer =
3059
+ object.answer !== undefined && object.answer !== null
3060
+ ? SessionDescription.fromPartial(object.answer)
3061
+ : undefined;
3062
+ message.subscription =
3063
+ object.subscription !== undefined && object.subscription !== null
3064
+ ? UpdateSubscription.fromPartial(object.subscription)
3065
+ : undefined;
3066
+ message.publishTracks =
3067
+ object.publishTracks?.map((e) => TrackPublishedResponse.fromPartial(e)) ||
3068
+ [];
3069
+ message.dataChannels =
3070
+ object.dataChannels?.map((e) => DataChannelInfo.fromPartial(e)) || [];
3489
3071
  return message;
3490
3072
  },
3491
3073
  };
3492
3074
 
3493
- const baseDataChannelInfo: object = { label: "", id: 0 };
3075
+ function createBaseDataChannelInfo(): DataChannelInfo {
3076
+ return { label: "", id: 0 };
3077
+ }
3494
3078
 
3495
3079
  export const DataChannelInfo = {
3496
3080
  encode(
@@ -3509,7 +3093,7 @@ export const DataChannelInfo = {
3509
3093
  decode(input: _m0.Reader | Uint8Array, length?: number): DataChannelInfo {
3510
3094
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3511
3095
  let end = length === undefined ? reader.len : reader.pos + length;
3512
- const message = { ...baseDataChannelInfo } as DataChannelInfo;
3096
+ const message = createBaseDataChannelInfo();
3513
3097
  while (reader.pos < end) {
3514
3098
  const tag = reader.uint32();
3515
3099
  switch (tag >>> 3) {
@@ -3528,36 +3112,37 @@ export const DataChannelInfo = {
3528
3112
  },
3529
3113
 
3530
3114
  fromJSON(object: any): DataChannelInfo {
3531
- const message = { ...baseDataChannelInfo } as DataChannelInfo;
3532
- if (object.label !== undefined && object.label !== null) {
3533
- message.label = String(object.label);
3534
- } else {
3535
- message.label = "";
3536
- }
3537
- if (object.id !== undefined && object.id !== null) {
3538
- message.id = Number(object.id);
3539
- } else {
3540
- message.id = 0;
3541
- }
3542
- return message;
3115
+ return {
3116
+ label: isSet(object.label) ? String(object.label) : "",
3117
+ id: isSet(object.id) ? Number(object.id) : 0,
3118
+ };
3543
3119
  },
3544
3120
 
3545
3121
  toJSON(message: DataChannelInfo): unknown {
3546
3122
  const obj: any = {};
3547
3123
  message.label !== undefined && (obj.label = message.label);
3548
- message.id !== undefined && (obj.id = message.id);
3124
+ message.id !== undefined && (obj.id = Math.round(message.id));
3549
3125
  return obj;
3550
3126
  },
3551
3127
 
3552
- fromPartial(object: DeepPartial<DataChannelInfo>): DataChannelInfo {
3553
- const message = { ...baseDataChannelInfo } as DataChannelInfo;
3128
+ fromPartial<I extends Exact<DeepPartial<DataChannelInfo>, I>>(
3129
+ object: I
3130
+ ): DataChannelInfo {
3131
+ const message = createBaseDataChannelInfo();
3554
3132
  message.label = object.label ?? "";
3555
3133
  message.id = object.id ?? 0;
3556
3134
  return message;
3557
3135
  },
3558
3136
  };
3559
3137
 
3560
- const baseSimulateScenario: object = {};
3138
+ function createBaseSimulateScenario(): SimulateScenario {
3139
+ return {
3140
+ speakerUpdate: undefined,
3141
+ nodeFailure: undefined,
3142
+ migration: undefined,
3143
+ serverLeave: undefined,
3144
+ };
3145
+ }
3561
3146
 
3562
3147
  export const SimulateScenario = {
3563
3148
  encode(
@@ -3582,7 +3167,7 @@ export const SimulateScenario = {
3582
3167
  decode(input: _m0.Reader | Uint8Array, length?: number): SimulateScenario {
3583
3168
  const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
3584
3169
  let end = length === undefined ? reader.len : reader.pos + length;
3585
- const message = { ...baseSimulateScenario } as SimulateScenario;
3170
+ const message = createBaseSimulateScenario();
3586
3171
  while (reader.pos < end) {
3587
3172
  const tag = reader.uint32();
3588
3173
  switch (tag >>> 3) {
@@ -3607,34 +3192,26 @@ export const SimulateScenario = {
3607
3192
  },
3608
3193
 
3609
3194
  fromJSON(object: any): SimulateScenario {
3610
- const message = { ...baseSimulateScenario } as SimulateScenario;
3611
- if (object.speakerUpdate !== undefined && object.speakerUpdate !== null) {
3612
- message.speakerUpdate = Number(object.speakerUpdate);
3613
- } else {
3614
- message.speakerUpdate = undefined;
3615
- }
3616
- if (object.nodeFailure !== undefined && object.nodeFailure !== null) {
3617
- message.nodeFailure = Boolean(object.nodeFailure);
3618
- } else {
3619
- message.nodeFailure = undefined;
3620
- }
3621
- if (object.migration !== undefined && object.migration !== null) {
3622
- message.migration = Boolean(object.migration);
3623
- } else {
3624
- message.migration = undefined;
3625
- }
3626
- if (object.serverLeave !== undefined && object.serverLeave !== null) {
3627
- message.serverLeave = Boolean(object.serverLeave);
3628
- } else {
3629
- message.serverLeave = undefined;
3630
- }
3631
- return message;
3195
+ return {
3196
+ speakerUpdate: isSet(object.speakerUpdate)
3197
+ ? Number(object.speakerUpdate)
3198
+ : undefined,
3199
+ nodeFailure: isSet(object.nodeFailure)
3200
+ ? Boolean(object.nodeFailure)
3201
+ : undefined,
3202
+ migration: isSet(object.migration)
3203
+ ? Boolean(object.migration)
3204
+ : undefined,
3205
+ serverLeave: isSet(object.serverLeave)
3206
+ ? Boolean(object.serverLeave)
3207
+ : undefined,
3208
+ };
3632
3209
  },
3633
3210
 
3634
3211
  toJSON(message: SimulateScenario): unknown {
3635
3212
  const obj: any = {};
3636
3213
  message.speakerUpdate !== undefined &&
3637
- (obj.speakerUpdate = message.speakerUpdate);
3214
+ (obj.speakerUpdate = Math.round(message.speakerUpdate));
3638
3215
  message.nodeFailure !== undefined &&
3639
3216
  (obj.nodeFailure = message.nodeFailure);
3640
3217
  message.migration !== undefined && (obj.migration = message.migration);
@@ -3643,8 +3220,10 @@ export const SimulateScenario = {
3643
3220
  return obj;
3644
3221
  },
3645
3222
 
3646
- fromPartial(object: DeepPartial<SimulateScenario>): SimulateScenario {
3647
- const message = { ...baseSimulateScenario } as SimulateScenario;
3223
+ fromPartial<I extends Exact<DeepPartial<SimulateScenario>, I>>(
3224
+ object: I
3225
+ ): SimulateScenario {
3226
+ const message = createBaseSimulateScenario();
3648
3227
  message.speakerUpdate = object.speakerUpdate ?? undefined;
3649
3228
  message.nodeFailure = object.nodeFailure ?? undefined;
3650
3229
  message.migration = object.migration ?? undefined;
@@ -3661,6 +3240,7 @@ type Builtin =
3661
3240
  | number
3662
3241
  | boolean
3663
3242
  | undefined;
3243
+
3664
3244
  export type DeepPartial<T> = T extends Builtin
3665
3245
  ? T
3666
3246
  : T extends Array<infer U>
@@ -3671,7 +3251,19 @@ export type DeepPartial<T> = T extends Builtin
3671
3251
  ? { [K in keyof T]?: DeepPartial<T[K]> }
3672
3252
  : Partial<T>;
3673
3253
 
3254
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
3255
+ export type Exact<P, I extends P> = P extends Builtin
3256
+ ? P
3257
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
3258
+ Exclude<keyof I, KeysOfUnion<P>>,
3259
+ never
3260
+ >;
3261
+
3674
3262
  if (_m0.util.Long !== Long) {
3675
3263
  _m0.util.Long = Long as any;
3676
3264
  _m0.configure();
3677
3265
  }
3266
+
3267
+ function isSet(value: any): boolean {
3268
+ return value !== null && value !== undefined;
3269
+ }