moons-ta-client 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,6 +190,12 @@ export interface Response {
190
190
  * @generated from protobuf field: proto.packets.Response.RefundAttempts refund_attempts = 29;
191
191
  */
192
192
  refundAttempts: Response_RefundAttempts;
193
+ } | {
194
+ oneofKind: "permissionError";
195
+ /**
196
+ * @generated from protobuf field: proto.packets.Response.PermissionError permission_error = 30;
197
+ */
198
+ permissionError: Response_PermissionError;
193
199
  } | {
194
200
  oneofKind: undefined;
195
201
  };
@@ -609,6 +615,23 @@ export interface Response_RefundAttempts {
609
615
  */
610
616
  message: string;
611
617
  }
618
+ /**
619
+ * @generated from protobuf message proto.packets.Response.PermissionError
620
+ */
621
+ export interface Response_PermissionError {
622
+ /**
623
+ * @generated from protobuf field: string required_permission = 1;
624
+ */
625
+ requiredPermission: string;
626
+ /**
627
+ * @generated from protobuf field: string current_roles = 2;
628
+ */
629
+ currentRoles: string;
630
+ /**
631
+ * @generated from protobuf field: string current_permissions = 3;
632
+ */
633
+ currentPermissions: string;
634
+ }
612
635
  /**
613
636
  * @generated from protobuf enum proto.packets.Response.ResponseType
614
637
  */
@@ -922,4 +945,14 @@ declare class Response_RefundAttempts$Type extends MessageType<Response_RefundAt
922
945
  * @generated MessageType for protobuf message proto.packets.Response.RefundAttempts
923
946
  */
924
947
  export declare const Response_RefundAttempts: Response_RefundAttempts$Type;
948
+ declare class Response_PermissionError$Type extends MessageType<Response_PermissionError> {
949
+ constructor();
950
+ create(value?: PartialMessage<Response_PermissionError>): Response_PermissionError;
951
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Response_PermissionError): Response_PermissionError;
952
+ internalBinaryWrite(message: Response_PermissionError, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
953
+ }
954
+ /**
955
+ * @generated MessageType for protobuf message proto.packets.Response.PermissionError
956
+ */
957
+ export declare const Response_PermissionError: Response_PermissionError$Type;
925
958
  export {};
@@ -1,7 +1,6 @@
1
1
  import { WireType } from "@protobuf-ts/runtime";
2
2
  import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
3
  import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
- import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
5
4
  import { MessageType } from "@protobuf-ts/runtime";
6
5
  import { LeaderboardEntry } from './models.js';
7
6
  import { State } from './models.js';
@@ -76,12 +75,15 @@ class Response$Type extends MessageType {
76
75
  { no: 26, name: "get_bot_tokens_for_user", kind: "message", oneof: "details", T: () => Response_GetBotTokensForUser },
77
76
  { no: 27, name: "generate_bot_token", kind: "message", oneof: "details", T: () => Response_GenerateBotToken },
78
77
  { no: 28, name: "revoke_bot_token", kind: "message", oneof: "details", T: () => Response_RevokeBotToken },
79
- { no: 29, name: "refund_attempts", kind: "message", oneof: "details", T: () => Response_RefundAttempts }
78
+ { no: 29, name: "refund_attempts", kind: "message", oneof: "details", T: () => Response_RefundAttempts },
79
+ { no: 30, name: "permission_error", kind: "message", oneof: "details", T: () => Response_PermissionError }
80
80
  ]);
81
81
  }
82
82
  create(value) {
83
- const message = { type: 0, respondingToPacketId: "", details: { oneofKind: undefined } };
84
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
83
+ const message = globalThis.Object.create((this.messagePrototype));
84
+ message.type = 0;
85
+ message.respondingToPacketId = "";
86
+ message.details = { oneofKind: undefined };
85
87
  if (value !== undefined)
86
88
  reflectionMergePartial(this, message, value);
87
89
  return message;
@@ -259,6 +261,12 @@ class Response$Type extends MessageType {
259
261
  refundAttempts: Response_RefundAttempts.internalBinaryRead(reader, reader.uint32(), options, message.details.refundAttempts)
260
262
  };
261
263
  break;
264
+ case /* proto.packets.Response.PermissionError permission_error */ 30:
265
+ message.details = {
266
+ oneofKind: "permissionError",
267
+ permissionError: Response_PermissionError.internalBinaryRead(reader, reader.uint32(), options, message.details.permissionError)
268
+ };
269
+ break;
262
270
  default:
263
271
  let u = options.readUnknownField;
264
272
  if (u === "throw")
@@ -358,6 +366,9 @@ class Response$Type extends MessageType {
358
366
  /* proto.packets.Response.RefundAttempts refund_attempts = 29; */
359
367
  if (message.details.oneofKind === "refundAttempts")
360
368
  Response_RefundAttempts.internalBinaryWrite(message.details.refundAttempts, writer.tag(29, WireType.LengthDelimited).fork(), options).join();
369
+ /* proto.packets.Response.PermissionError permission_error = 30; */
370
+ if (message.details.oneofKind === "permissionError")
371
+ Response_PermissionError.internalBinaryWrite(message.details.permissionError, writer.tag(30, WireType.LengthDelimited).fork(), options).join();
361
372
  let u = options.writeUnknownFields;
362
373
  if (u !== false)
363
374
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -377,8 +388,8 @@ class Response_UpdateUser$Type extends MessageType {
377
388
  ]);
378
389
  }
379
390
  create(value) {
380
- const message = { message: "" };
381
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
391
+ const message = globalThis.Object.create((this.messagePrototype));
392
+ message.message = "";
382
393
  if (value !== undefined)
383
394
  reflectionMergePartial(this, message, value);
384
395
  return message;
@@ -431,8 +442,8 @@ class Response_CreateMatch$Type extends MessageType {
431
442
  ]);
432
443
  }
433
444
  create(value) {
434
- const message = { message: "" };
435
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
445
+ const message = globalThis.Object.create((this.messagePrototype));
446
+ message.message = "";
436
447
  if (value !== undefined)
437
448
  reflectionMergePartial(this, message, value);
438
449
  return message;
@@ -485,8 +496,8 @@ class Response_UpdateMatch$Type extends MessageType {
485
496
  ]);
486
497
  }
487
498
  create(value) {
488
- const message = { message: "" };
489
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
499
+ const message = globalThis.Object.create((this.messagePrototype));
500
+ message.message = "";
490
501
  if (value !== undefined)
491
502
  reflectionMergePartial(this, message, value);
492
503
  return message;
@@ -539,8 +550,8 @@ class Response_DeleteMatch$Type extends MessageType {
539
550
  ]);
540
551
  }
541
552
  create(value) {
542
- const message = { message: "" };
543
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
553
+ const message = globalThis.Object.create((this.messagePrototype));
554
+ message.message = "";
544
555
  if (value !== undefined)
545
556
  reflectionMergePartial(this, message, value);
546
557
  return message;
@@ -593,8 +604,8 @@ class Response_CreateQualifierEvent$Type extends MessageType {
593
604
  ]);
594
605
  }
595
606
  create(value) {
596
- const message = { message: "" };
597
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
607
+ const message = globalThis.Object.create((this.messagePrototype));
608
+ message.message = "";
598
609
  if (value !== undefined)
599
610
  reflectionMergePartial(this, message, value);
600
611
  return message;
@@ -647,8 +658,8 @@ class Response_UpdateQualifierEvent$Type extends MessageType {
647
658
  ]);
648
659
  }
649
660
  create(value) {
650
- const message = { message: "" };
651
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
661
+ const message = globalThis.Object.create((this.messagePrototype));
662
+ message.message = "";
652
663
  if (value !== undefined)
653
664
  reflectionMergePartial(this, message, value);
654
665
  return message;
@@ -701,8 +712,8 @@ class Response_DeleteQualifierEvent$Type extends MessageType {
701
712
  ]);
702
713
  }
703
714
  create(value) {
704
- const message = { message: "" };
705
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
715
+ const message = globalThis.Object.create((this.messagePrototype));
716
+ message.message = "";
706
717
  if (value !== undefined)
707
718
  reflectionMergePartial(this, message, value);
708
719
  return message;
@@ -756,8 +767,10 @@ class Response_AddAuthorizedUser$Type extends MessageType {
756
767
  ]);
757
768
  }
758
769
  create(value) {
759
- const message = { tournamentId: "", discordId: "", roles: [] };
760
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
770
+ const message = globalThis.Object.create((this.messagePrototype));
771
+ message.tournamentId = "";
772
+ message.discordId = "";
773
+ message.roles = [];
761
774
  if (value !== undefined)
762
775
  reflectionMergePartial(this, message, value);
763
776
  return message;
@@ -817,8 +830,10 @@ class Response_UpdateAuthorizedUser$Type extends MessageType {
817
830
  ]);
818
831
  }
819
832
  create(value) {
820
- const message = { tournamentId: "", discordId: "", roles: [] };
821
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
833
+ const message = globalThis.Object.create((this.messagePrototype));
834
+ message.tournamentId = "";
835
+ message.discordId = "";
836
+ message.roles = [];
822
837
  if (value !== undefined)
823
838
  reflectionMergePartial(this, message, value);
824
839
  return message;
@@ -878,8 +893,10 @@ class Response_RemoveAuthorizedUser$Type extends MessageType {
878
893
  ]);
879
894
  }
880
895
  create(value) {
881
- const message = { tournamentId: "", discordId: "", roles: [] };
882
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
896
+ const message = globalThis.Object.create((this.messagePrototype));
897
+ message.tournamentId = "";
898
+ message.discordId = "";
899
+ message.roles = [];
883
900
  if (value !== undefined)
884
901
  reflectionMergePartial(this, message, value);
885
902
  return message;
@@ -938,8 +955,9 @@ class Response_GetAuthorizedUsers$Type extends MessageType {
938
955
  ]);
939
956
  }
940
957
  create(value) {
941
- const message = { tournamentId: "", authorizedUsers: [] };
942
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
958
+ const message = globalThis.Object.create((this.messagePrototype));
959
+ message.tournamentId = "";
960
+ message.authorizedUsers = [];
943
961
  if (value !== undefined)
944
962
  reflectionMergePartial(this, message, value);
945
963
  return message;
@@ -994,8 +1012,11 @@ class Response_GetAuthorizedUsers_AuthroizedUser$Type extends MessageType {
994
1012
  ]);
995
1013
  }
996
1014
  create(value) {
997
- const message = { discordId: "", discordUsername: "", discordAvatarUrl: "", roles: [] };
998
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1015
+ const message = globalThis.Object.create((this.messagePrototype));
1016
+ message.discordId = "";
1017
+ message.discordUsername = "";
1018
+ message.discordAvatarUrl = "";
1019
+ message.roles = [];
999
1020
  if (value !== undefined)
1000
1021
  reflectionMergePartial(this, message, value);
1001
1022
  return message;
@@ -1061,8 +1082,10 @@ class Response_GetDiscordInfo$Type extends MessageType {
1061
1082
  ]);
1062
1083
  }
1063
1084
  create(value) {
1064
- const message = { discordId: "", discordUsername: "", discordAvatarUrl: "" };
1065
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1085
+ const message = globalThis.Object.create((this.messagePrototype));
1086
+ message.discordId = "";
1087
+ message.discordUsername = "";
1088
+ message.discordAvatarUrl = "";
1066
1089
  if (value !== undefined)
1067
1090
  reflectionMergePartial(this, message, value);
1068
1091
  return message;
@@ -1121,8 +1144,8 @@ class Response_CreateTournament$Type extends MessageType {
1121
1144
  ]);
1122
1145
  }
1123
1146
  create(value) {
1124
- const message = { message: "" };
1125
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1147
+ const message = globalThis.Object.create((this.messagePrototype));
1148
+ message.message = "";
1126
1149
  if (value !== undefined)
1127
1150
  reflectionMergePartial(this, message, value);
1128
1151
  return message;
@@ -1175,8 +1198,8 @@ class Response_UpdateTournament$Type extends MessageType {
1175
1198
  ]);
1176
1199
  }
1177
1200
  create(value) {
1178
- const message = { message: "" };
1179
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1201
+ const message = globalThis.Object.create((this.messagePrototype));
1202
+ message.message = "";
1180
1203
  if (value !== undefined)
1181
1204
  reflectionMergePartial(this, message, value);
1182
1205
  return message;
@@ -1229,8 +1252,8 @@ class Response_DeleteTournament$Type extends MessageType {
1229
1252
  ]);
1230
1253
  }
1231
1254
  create(value) {
1232
- const message = { message: "" };
1233
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1255
+ const message = globalThis.Object.create((this.messagePrototype));
1256
+ message.message = "";
1234
1257
  if (value !== undefined)
1235
1258
  reflectionMergePartial(this, message, value);
1236
1259
  return message;
@@ -1283,8 +1306,8 @@ class Response_AddServer$Type extends MessageType {
1283
1306
  ]);
1284
1307
  }
1285
1308
  create(value) {
1286
- const message = { message: "" };
1287
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1309
+ const message = globalThis.Object.create((this.messagePrototype));
1310
+ message.message = "";
1288
1311
  if (value !== undefined)
1289
1312
  reflectionMergePartial(this, message, value);
1290
1313
  return message;
@@ -1339,8 +1362,10 @@ class Response_Connect$Type extends MessageType {
1339
1362
  ]);
1340
1363
  }
1341
1364
  create(value) {
1342
- const message = { serverVersion: 0, message: "", reason: 0 };
1343
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1365
+ const message = globalThis.Object.create((this.messagePrototype));
1366
+ message.serverVersion = 0;
1367
+ message.message = "";
1368
+ message.reason = 0;
1344
1369
  if (value !== undefined)
1345
1370
  reflectionMergePartial(this, message, value);
1346
1371
  return message;
@@ -1408,8 +1433,11 @@ class Response_Join$Type extends MessageType {
1408
1433
  ]);
1409
1434
  }
1410
1435
  create(value) {
1411
- const message = { selfGuid: "", tournamentId: "", message: "", reason: 0 };
1412
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1436
+ const message = globalThis.Object.create((this.messagePrototype));
1437
+ message.selfGuid = "";
1438
+ message.tournamentId = "";
1439
+ message.message = "";
1440
+ message.reason = 0;
1413
1441
  if (value !== undefined)
1414
1442
  reflectionMergePartial(this, message, value);
1415
1443
  return message;
@@ -1479,8 +1507,8 @@ class Response_LeaderboardEntries$Type extends MessageType {
1479
1507
  ]);
1480
1508
  }
1481
1509
  create(value) {
1482
- const message = { scores: [] };
1483
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1510
+ const message = globalThis.Object.create((this.messagePrototype));
1511
+ message.scores = [];
1484
1512
  if (value !== undefined)
1485
1513
  reflectionMergePartial(this, message, value);
1486
1514
  return message;
@@ -1527,8 +1555,9 @@ class Response_LoadSong$Type extends MessageType {
1527
1555
  ]);
1528
1556
  }
1529
1557
  create(value) {
1530
- const message = { levelId: "", message: "" };
1531
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1558
+ const message = globalThis.Object.create((this.messagePrototype));
1559
+ message.levelId = "";
1560
+ message.message = "";
1532
1561
  if (value !== undefined)
1533
1562
  reflectionMergePartial(this, message, value);
1534
1563
  return message;
@@ -1580,8 +1609,8 @@ class Response_PreloadImageForStreamSync$Type extends MessageType {
1580
1609
  ]);
1581
1610
  }
1582
1611
  create(value) {
1583
- const message = { fileId: "" };
1584
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1612
+ const message = globalThis.Object.create((this.messagePrototype));
1613
+ message.fileId = "";
1585
1614
  if (value !== undefined)
1586
1615
  reflectionMergePartial(this, message, value);
1587
1616
  return message;
@@ -1627,8 +1656,8 @@ class Response_ShowPrompt$Type extends MessageType {
1627
1656
  ]);
1628
1657
  }
1629
1658
  create(value) {
1630
- const message = { value: "" };
1631
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1659
+ const message = globalThis.Object.create((this.messagePrototype));
1660
+ message.value = "";
1632
1661
  if (value !== undefined)
1633
1662
  reflectionMergePartial(this, message, value);
1634
1663
  return message;
@@ -1674,8 +1703,8 @@ class Response_RemainingAttempts$Type extends MessageType {
1674
1703
  ]);
1675
1704
  }
1676
1705
  create(value) {
1677
- const message = { remainingAttempts: 0 };
1678
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1706
+ const message = globalThis.Object.create((this.messagePrototype));
1707
+ message.remainingAttempts = 0;
1679
1708
  if (value !== undefined)
1680
1709
  reflectionMergePartial(this, message, value);
1681
1710
  return message;
@@ -1721,8 +1750,8 @@ class Response_GetBotTokensForUser$Type extends MessageType {
1721
1750
  ]);
1722
1751
  }
1723
1752
  create(value) {
1724
- const message = { botUsers: [] };
1725
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1753
+ const message = globalThis.Object.create((this.messagePrototype));
1754
+ message.botUsers = [];
1726
1755
  if (value !== undefined)
1727
1756
  reflectionMergePartial(this, message, value);
1728
1757
  return message;
@@ -1770,8 +1799,10 @@ class Response_GetBotTokensForUser_BotUser$Type extends MessageType {
1770
1799
  ]);
1771
1800
  }
1772
1801
  create(value) {
1773
- const message = { guid: "", username: "", ownerDiscordId: "" };
1774
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1802
+ const message = globalThis.Object.create((this.messagePrototype));
1803
+ message.guid = "";
1804
+ message.username = "";
1805
+ message.ownerDiscordId = "";
1775
1806
  if (value !== undefined)
1776
1807
  reflectionMergePartial(this, message, value);
1777
1808
  return message;
@@ -1829,8 +1860,8 @@ class Response_GenerateBotToken$Type extends MessageType {
1829
1860
  ]);
1830
1861
  }
1831
1862
  create(value) {
1832
- const message = { botToken: "" };
1833
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1863
+ const message = globalThis.Object.create((this.messagePrototype));
1864
+ message.botToken = "";
1834
1865
  if (value !== undefined)
1835
1866
  reflectionMergePartial(this, message, value);
1836
1867
  return message;
@@ -1876,8 +1907,8 @@ class Response_RevokeBotToken$Type extends MessageType {
1876
1907
  ]);
1877
1908
  }
1878
1909
  create(value) {
1879
- const message = { message: "" };
1880
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1910
+ const message = globalThis.Object.create((this.messagePrototype));
1911
+ message.message = "";
1881
1912
  if (value !== undefined)
1882
1913
  reflectionMergePartial(this, message, value);
1883
1914
  return message;
@@ -1923,8 +1954,8 @@ class Response_RefundAttempts$Type extends MessageType {
1923
1954
  ]);
1924
1955
  }
1925
1956
  create(value) {
1926
- const message = { message: "" };
1927
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1957
+ const message = globalThis.Object.create((this.messagePrototype));
1958
+ message.message = "";
1928
1959
  if (value !== undefined)
1929
1960
  reflectionMergePartial(this, message, value);
1930
1961
  return message;
@@ -1962,3 +1993,66 @@ class Response_RefundAttempts$Type extends MessageType {
1962
1993
  * @generated MessageType for protobuf message proto.packets.Response.RefundAttempts
1963
1994
  */
1964
1995
  export const Response_RefundAttempts = new Response_RefundAttempts$Type();
1996
+ // @generated message type with reflection information, may provide speed optimized methods
1997
+ class Response_PermissionError$Type extends MessageType {
1998
+ constructor() {
1999
+ super("proto.packets.Response.PermissionError", [
2000
+ { no: 1, name: "required_permission", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
2001
+ { no: 2, name: "current_roles", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
2002
+ { no: 3, name: "current_permissions", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
2003
+ ]);
2004
+ }
2005
+ create(value) {
2006
+ const message = globalThis.Object.create((this.messagePrototype));
2007
+ message.requiredPermission = "";
2008
+ message.currentRoles = "";
2009
+ message.currentPermissions = "";
2010
+ if (value !== undefined)
2011
+ reflectionMergePartial(this, message, value);
2012
+ return message;
2013
+ }
2014
+ internalBinaryRead(reader, length, options, target) {
2015
+ let message = target ?? this.create(), end = reader.pos + length;
2016
+ while (reader.pos < end) {
2017
+ let [fieldNo, wireType] = reader.tag();
2018
+ switch (fieldNo) {
2019
+ case /* string required_permission */ 1:
2020
+ message.requiredPermission = reader.string();
2021
+ break;
2022
+ case /* string current_roles */ 2:
2023
+ message.currentRoles = reader.string();
2024
+ break;
2025
+ case /* string current_permissions */ 3:
2026
+ message.currentPermissions = reader.string();
2027
+ break;
2028
+ default:
2029
+ let u = options.readUnknownField;
2030
+ if (u === "throw")
2031
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2032
+ let d = reader.skip(wireType);
2033
+ if (u !== false)
2034
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2035
+ }
2036
+ }
2037
+ return message;
2038
+ }
2039
+ internalBinaryWrite(message, writer, options) {
2040
+ /* string required_permission = 1; */
2041
+ if (message.requiredPermission !== "")
2042
+ writer.tag(1, WireType.LengthDelimited).string(message.requiredPermission);
2043
+ /* string current_roles = 2; */
2044
+ if (message.currentRoles !== "")
2045
+ writer.tag(2, WireType.LengthDelimited).string(message.currentRoles);
2046
+ /* string current_permissions = 3; */
2047
+ if (message.currentPermissions !== "")
2048
+ writer.tag(3, WireType.LengthDelimited).string(message.currentPermissions);
2049
+ let u = options.writeUnknownFields;
2050
+ if (u !== false)
2051
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
2052
+ return writer;
2053
+ }
2054
+ }
2055
+ /**
2056
+ * @generated MessageType for protobuf message proto.packets.Response.PermissionError
2057
+ */
2058
+ export const Response_PermissionError = new Response_PermissionError$Type();
@@ -10,7 +10,11 @@ export type ResponseFromUser = {
10
10
  userId: string;
11
11
  response: Response;
12
12
  };
13
- export type LogLevel = "Quiet" | "Info";
13
+ export declare enum LogLevel {
14
+ Quiet = 0,
15
+ Debug = 1,
16
+ Info = 2
17
+ }
14
18
  type TAClientEvents = {
15
19
  connectedToServer: Response_Connect;
16
20
  connectingToServer: {};
@@ -104,11 +108,12 @@ export declare class TAClient extends CustomEventEmitter<TAClientEvents> {
104
108
  getBotTokensForUser: (ownerDiscordId: string) => Promise<Response>;
105
109
  generateBotToken: (username: string) => Promise<Response>;
106
110
  revokeBotToken: (botTokenGuid: string) => Promise<Response>;
107
- createTournament: (serverAddress: string, serverName: string, serverPort: string, serverWebsocketPort: string, name: string, tournamentImage?: Uint8Array, enableTeams?: boolean, enablePools?: boolean, showTournamentButton?: boolean, showQualifierButton?: boolean, roles?: Role[], teams?: Tournament_TournamentSettings_Team[], scoreUpdateFrequency?: number, bannedMods?: string[], pools?: Tournament_TournamentSettings_Pool[], allowUnauthorizedView?: boolean) => Promise<Response>;
111
+ createTournament: (serverAddress: string, serverName: string, serverPort: string, serverWebsocketPort: string, name: string, tournamentImage?: Uint8Array, enableTeams?: boolean, enablePools?: boolean, showTournamentButton?: boolean, showQualifierButton?: boolean, roles?: Role[], teams?: Tournament_TournamentSettings_Team[], scoreUpdateFrequency?: number, bannedMods?: string[], pools?: Tournament_TournamentSettings_Pool[], allowUnauthorizedView?: boolean, enableReplayStreaming?: boolean) => Promise<Response>;
108
112
  setTournamentName: (tournamentId: string, tournamentName: string) => Promise<Response>;
109
113
  setTournamentImage: (tournamentId: string, tournamentImage: Uint8Array) => Promise<Response>;
110
114
  setTournamentEnableTeams: (tournamentId: string, enableTeams: boolean) => Promise<Response>;
111
115
  setTournamentEnablePools: (tournamentId: string, enablePools: boolean) => Promise<Response>;
116
+ setTournamentEnableReplayStreaming: (tournamentId: string, enableReplayStreaming: boolean) => Promise<Response>;
112
117
  setTournamentShowTournamentButton: (tournamentId: string, showTournamentButton: boolean) => Promise<Response>;
113
118
  setTournamentShowQualifierButton: (tournamentId: string, showQualifierButton: boolean) => Promise<Response>;
114
119
  setTournamentAllowUnauthorizedView: (tournamentId: string, allowUnauthorizedView: boolean) => Promise<Response>;
@@ -2,13 +2,19 @@ import { Client } from "./client.js";
2
2
  import { CustomEventEmitter } from "./custom-event-emitter.js";
3
3
  import { v4 as uuidv4 } from "uuid";
4
4
  import { StateManager } from "./state-manager.js";
5
- import { Response_ResponseType, } from "./models/responses.js";
5
+ import { Response_ResponseType } from "./models/responses.js";
6
6
  import { Command_ModifyGameplay_Modifier } from "./models/commands.js";
7
7
  import { masterAddress, masterApiPort, versionCode } from "./constants.js";
8
8
  import WebSocket from "ws";
9
9
  // Created by Moon on 6/12/2022
10
10
  export * from "./scraper.js";
11
11
  export * from "./models/models.js";
12
+ export var LogLevel;
13
+ (function (LogLevel) {
14
+ LogLevel[LogLevel["Quiet"] = 0] = "Quiet";
15
+ LogLevel[LogLevel["Debug"] = 1] = "Debug";
16
+ LogLevel[LogLevel["Info"] = 2] = "Info";
17
+ })(LogLevel = LogLevel || (LogLevel = {}));
12
18
  export class TAClient extends CustomEventEmitter {
13
19
  _imageServer = `https://${masterAddress}:${masterApiPort}`;
14
20
  stateManager;
@@ -18,7 +24,7 @@ export class TAClient extends CustomEventEmitter {
18
24
  token = "";
19
25
  shouldHeartbeat = false;
20
26
  heartbeatInterval;
21
- constructor(uiVersion = undefined, logLevel = "Quiet") {
27
+ constructor(uiVersion = undefined, logLevel = LogLevel.Quiet) {
22
28
  super();
23
29
  this.stateManager = new StateManager();
24
30
  this.uiVersion = uiVersion;
@@ -26,12 +32,14 @@ export class TAClient extends CustomEventEmitter {
26
32
  }
27
33
  // --- Logging --- //
28
34
  logInfo(object) {
29
- if (this.logLevel === "Info") {
35
+ if (this.logLevel >= LogLevel.Info) {
30
36
  console.log(object);
31
37
  }
32
38
  }
33
39
  logError(object) {
34
- this.logError(object);
40
+ if (this.logLevel >= LogLevel.Debug) {
41
+ console.error(object);
42
+ }
35
43
  }
36
44
  // --- State helpers --- //
37
45
  get isConnected() {
@@ -187,8 +195,7 @@ export class TAClient extends CustomEventEmitter {
187
195
  // Add to the dictionary when the response is to this packet, and from an expected user
188
196
  const onResponseReceived = (response) => {
189
197
  const expectedUsers = to ?? ["00000000-0000-0000-0000-000000000000"]; // If we didn't forward this to any users, we should expect a response from the server
190
- if (response.response.respondingToPacketId === packet.id &&
191
- expectedUsers.includes(response.userId)) {
198
+ if (response.response.respondingToPacketId === packet.id && expectedUsers.includes(response.userId)) {
192
199
  responseDictionary.push({
193
200
  userId: response.userId,
194
201
  response: response.response,
@@ -483,11 +490,7 @@ export class TAClient extends CustomEventEmitter {
483
490
  else if (packet.packet.oneofKind === "request") {
484
491
  const request = packet.packet.request;
485
492
  if (request.type.oneofKind === "loadSong") {
486
- this.emit("loadSongRequested", [
487
- packet.id,
488
- packet.from,
489
- request.type.loadSong,
490
- ]);
493
+ this.emit("loadSongRequested", [packet.id, packet.from, request.type.loadSong]);
491
494
  }
492
495
  }
493
496
  else if (packet.packet.oneofKind === "response") {
@@ -1013,7 +1016,7 @@ export class TAClient extends CustomEventEmitter {
1013
1016
  }
1014
1017
  return response[0].response;
1015
1018
  };
1016
- createTournament = async (serverAddress, serverName, serverPort, serverWebsocketPort, name, tournamentImage = new Uint8Array([1]), enableTeams = false, enablePools = false, showTournamentButton = true, showQualifierButton = true, roles = [], teams = [], scoreUpdateFrequency = 30, bannedMods = [], pools = [], allowUnauthorizedView = false) => {
1019
+ createTournament = async (serverAddress, serverName, serverPort, serverWebsocketPort, name, tournamentImage = new Uint8Array([1]), enableTeams = false, enablePools = false, showTournamentButton = true, showQualifierButton = true, roles = [], teams = [], scoreUpdateFrequency = 30, bannedMods = [], pools = [], allowUnauthorizedView = false, enableReplayStreaming = false) => {
1017
1020
  const response = await this.sendRequest({
1018
1021
  type: {
1019
1022
  oneofKind: "createTournament",
@@ -1028,6 +1031,7 @@ export class TAClient extends CustomEventEmitter {
1028
1031
  tournamentImage: await this.uploadImage(tournamentImage),
1029
1032
  enableTeams,
1030
1033
  enablePools,
1034
+ enableReplayStreaming,
1031
1035
  showTournamentButton,
1032
1036
  showQualifierButton,
1033
1037
  roles,
@@ -1113,6 +1117,21 @@ export class TAClient extends CustomEventEmitter {
1113
1117
  }
1114
1118
  return response[0].response;
1115
1119
  };
1120
+ setTournamentEnableReplayStreaming = async (tournamentId, enableReplayStreaming) => {
1121
+ const response = await this.sendRequest({
1122
+ type: {
1123
+ oneofKind: "setTournamentEnableReplayStreaming",
1124
+ setTournamentEnableReplayStreaming: {
1125
+ tournamentId,
1126
+ enableReplayStreaming,
1127
+ },
1128
+ },
1129
+ });
1130
+ if (response.length <= 0) {
1131
+ throw new Error("Server timed out");
1132
+ }
1133
+ return response[0].response;
1134
+ };
1116
1135
  setTournamentShowTournamentButton = async (tournamentId, showTournamentButton) => {
1117
1136
  const response = await this.sendRequest({
1118
1137
  type: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moons-ta-client",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -49,4 +49,4 @@
49
49
  "dist",
50
50
  "package.json"
51
51
  ]
52
- }
52
+ }