moons-ta-client 1.1.4 → 1.1.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.
@@ -4,7 +4,6 @@ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
4
  import type { IBinaryReader } from "@protobuf-ts/runtime";
5
5
  import type { PartialMessage } from "@protobuf-ts/runtime";
6
6
  import { MessageType } from "@protobuf-ts/runtime";
7
- import { ModalOption } from './models.js';
8
7
  import { GameplayParameters } from './models.js';
9
8
  import { LeaderboardEntry } from './models.js';
10
9
  import { CoreServer } from './models.js';
@@ -335,11 +334,11 @@ export interface Request {
335
334
  */
336
335
  preloadImageForStreamSync: Request_PreloadImageForStreamSync;
337
336
  } | {
338
- oneofKind: "showModal";
337
+ oneofKind: "showPrompt";
339
338
  /**
340
- * @generated from protobuf field: proto.packets.Request.ShowModal show_modal = 42;
339
+ * @generated from protobuf field: proto.packets.Request.ShowPrompt show_prompt = 42;
341
340
  */
342
- showModal: Request_ShowModal;
341
+ showPrompt: Request_ShowPrompt;
343
342
  } | {
344
343
  oneofKind: "remainingAttempts";
345
344
  /**
@@ -1110,13 +1109,13 @@ export interface Request_PreloadImageForStreamSync {
1110
1109
  data: Uint8Array;
1111
1110
  }
1112
1111
  /**
1113
- * @generated from protobuf message proto.packets.Request.ShowModal
1112
+ * @generated from protobuf message proto.packets.Request.ShowPrompt
1114
1113
  */
1115
- export interface Request_ShowModal {
1114
+ export interface Request_ShowPrompt {
1116
1115
  /**
1117
- * @generated from protobuf field: string modal_id = 1;
1116
+ * @generated from protobuf field: string prompt_id = 1;
1118
1117
  */
1119
- modalId: string;
1118
+ promptId: string;
1120
1119
  /**
1121
1120
  * @generated from protobuf field: string message_title = 2;
1122
1121
  */
@@ -1126,17 +1125,34 @@ export interface Request_ShowModal {
1126
1125
  */
1127
1126
  messageText: string;
1128
1127
  /**
1129
- * @generated from protobuf field: bool can_close = 4;
1128
+ * @generated from protobuf field: int32 timeout = 4;
1129
+ */
1130
+ timeout: number;
1131
+ /**
1132
+ * @generated from protobuf field: bool show_timer = 5;
1133
+ */
1134
+ showTimer: boolean;
1135
+ /**
1136
+ * @generated from protobuf field: bool can_close = 6;
1130
1137
  */
1131
1138
  canClose: boolean;
1132
1139
  /**
1133
- * @generated from protobuf field: proto.models.ModalOption option_1 = 5;
1140
+ * @generated from protobuf field: repeated proto.packets.Request.ShowPrompt.PromptOption options = 7;
1134
1141
  */
1135
- option1?: ModalOption;
1142
+ options: Request_ShowPrompt_PromptOption[];
1143
+ }
1144
+ /**
1145
+ * @generated from protobuf message proto.packets.Request.ShowPrompt.PromptOption
1146
+ */
1147
+ export interface Request_ShowPrompt_PromptOption {
1136
1148
  /**
1137
- * @generated from protobuf field: proto.models.ModalOption option_2 = 6;
1149
+ * @generated from protobuf field: string label = 1;
1138
1150
  */
1139
- option2?: ModalOption;
1151
+ label: string;
1152
+ /**
1153
+ * @generated from protobuf field: string value = 2;
1154
+ */
1155
+ value: string;
1140
1156
  }
1141
1157
  /**
1142
1158
  * @generated from protobuf message proto.packets.Request.RemainingAttempts
@@ -1675,16 +1691,26 @@ declare class Request_PreloadImageForStreamSync$Type extends MessageType<Request
1675
1691
  * @generated MessageType for protobuf message proto.packets.Request.PreloadImageForStreamSync
1676
1692
  */
1677
1693
  export declare const Request_PreloadImageForStreamSync: Request_PreloadImageForStreamSync$Type;
1678
- declare class Request_ShowModal$Type extends MessageType<Request_ShowModal> {
1694
+ declare class Request_ShowPrompt$Type extends MessageType<Request_ShowPrompt> {
1695
+ constructor();
1696
+ create(value?: PartialMessage<Request_ShowPrompt>): Request_ShowPrompt;
1697
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Request_ShowPrompt): Request_ShowPrompt;
1698
+ internalBinaryWrite(message: Request_ShowPrompt, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
1699
+ }
1700
+ /**
1701
+ * @generated MessageType for protobuf message proto.packets.Request.ShowPrompt
1702
+ */
1703
+ export declare const Request_ShowPrompt: Request_ShowPrompt$Type;
1704
+ declare class Request_ShowPrompt_PromptOption$Type extends MessageType<Request_ShowPrompt_PromptOption> {
1679
1705
  constructor();
1680
- create(value?: PartialMessage<Request_ShowModal>): Request_ShowModal;
1681
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Request_ShowModal): Request_ShowModal;
1682
- internalBinaryWrite(message: Request_ShowModal, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
1706
+ create(value?: PartialMessage<Request_ShowPrompt_PromptOption>): Request_ShowPrompt_PromptOption;
1707
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Request_ShowPrompt_PromptOption): Request_ShowPrompt_PromptOption;
1708
+ internalBinaryWrite(message: Request_ShowPrompt_PromptOption, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
1683
1709
  }
1684
1710
  /**
1685
- * @generated MessageType for protobuf message proto.packets.Request.ShowModal
1711
+ * @generated MessageType for protobuf message proto.packets.Request.ShowPrompt.PromptOption
1686
1712
  */
1687
- export declare const Request_ShowModal: Request_ShowModal$Type;
1713
+ export declare const Request_ShowPrompt_PromptOption: Request_ShowPrompt_PromptOption$Type;
1688
1714
  declare class Request_RemainingAttempts$Type extends MessageType<Request_RemainingAttempts> {
1689
1715
  constructor();
1690
1716
  create(value?: PartialMessage<Request_RemainingAttempts>): Request_RemainingAttempts;
@@ -3,7 +3,6 @@ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
3
  import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
4
  import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
5
5
  import { MessageType } from "@protobuf-ts/runtime";
6
- import { ModalOption } from './models.js';
7
6
  import { GameplayParameters } from './models.js';
8
7
  import { LeaderboardEntry } from './models.js';
9
8
  import { CoreServer } from './models.js';
@@ -73,7 +72,7 @@ class Request$Type extends MessageType {
73
72
  { no: 39, name: "submit_qualifier_score", kind: "message", oneof: "type", T: () => Request_SubmitQualifierScore },
74
73
  { no: 40, name: "load_song", kind: "message", oneof: "type", T: () => Request_LoadSong },
75
74
  { no: 41, name: "preload_image_for_stream_sync", kind: "message", oneof: "type", T: () => Request_PreloadImageForStreamSync },
76
- { no: 42, name: "show_modal", kind: "message", oneof: "type", T: () => Request_ShowModal },
75
+ { no: 42, name: "show_prompt", kind: "message", oneof: "type", T: () => Request_ShowPrompt },
77
76
  { no: 43, name: "remaining_attempts", kind: "message", oneof: "type", T: () => Request_RemainingAttempts }
78
77
  ]);
79
78
  }
@@ -395,10 +394,10 @@ class Request$Type extends MessageType {
395
394
  preloadImageForStreamSync: Request_PreloadImageForStreamSync.internalBinaryRead(reader, reader.uint32(), options, message.type.preloadImageForStreamSync)
396
395
  };
397
396
  break;
398
- case /* proto.packets.Request.ShowModal show_modal */ 42:
397
+ case /* proto.packets.Request.ShowPrompt show_prompt */ 42:
399
398
  message.type = {
400
- oneofKind: "showModal",
401
- showModal: Request_ShowModal.internalBinaryRead(reader, reader.uint32(), options, message.type.showModal)
399
+ oneofKind: "showPrompt",
400
+ showPrompt: Request_ShowPrompt.internalBinaryRead(reader, reader.uint32(), options, message.type.showPrompt)
402
401
  };
403
402
  break;
404
403
  case /* proto.packets.Request.RemainingAttempts remaining_attempts */ 43:
@@ -572,9 +571,9 @@ class Request$Type extends MessageType {
572
571
  /* proto.packets.Request.PreloadImageForStreamSync preload_image_for_stream_sync = 41; */
573
572
  if (message.type.oneofKind === "preloadImageForStreamSync")
574
573
  Request_PreloadImageForStreamSync.internalBinaryWrite(message.type.preloadImageForStreamSync, writer.tag(41, WireType.LengthDelimited).fork(), options).join();
575
- /* proto.packets.Request.ShowModal show_modal = 42; */
576
- if (message.type.oneofKind === "showModal")
577
- Request_ShowModal.internalBinaryWrite(message.type.showModal, writer.tag(42, WireType.LengthDelimited).fork(), options).join();
574
+ /* proto.packets.Request.ShowPrompt show_prompt = 42; */
575
+ if (message.type.oneofKind === "showPrompt")
576
+ Request_ShowPrompt.internalBinaryWrite(message.type.showPrompt, writer.tag(42, WireType.LengthDelimited).fork(), options).join();
578
577
  /* proto.packets.Request.RemainingAttempts remaining_attempts = 43; */
579
578
  if (message.type.oneofKind === "remainingAttempts")
580
579
  Request_RemainingAttempts.internalBinaryWrite(message.type.remainingAttempts, writer.tag(43, WireType.LengthDelimited).fork(), options).join();
@@ -3490,19 +3489,20 @@ class Request_PreloadImageForStreamSync$Type extends MessageType {
3490
3489
  */
3491
3490
  export const Request_PreloadImageForStreamSync = new Request_PreloadImageForStreamSync$Type();
3492
3491
  // @generated message type with reflection information, may provide speed optimized methods
3493
- class Request_ShowModal$Type extends MessageType {
3492
+ class Request_ShowPrompt$Type extends MessageType {
3494
3493
  constructor() {
3495
- super("proto.packets.Request.ShowModal", [
3496
- { no: 1, name: "modal_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
3494
+ super("proto.packets.Request.ShowPrompt", [
3495
+ { no: 1, name: "prompt_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
3497
3496
  { no: 2, name: "message_title", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
3498
3497
  { no: 3, name: "message_text", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
3499
- { no: 4, name: "can_close", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
3500
- { no: 5, name: "option_1", kind: "message", T: () => ModalOption },
3501
- { no: 6, name: "option_2", kind: "message", T: () => ModalOption }
3498
+ { no: 4, name: "timeout", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
3499
+ { no: 5, name: "show_timer", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
3500
+ { no: 6, name: "can_close", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
3501
+ { no: 7, name: "options", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Request_ShowPrompt_PromptOption }
3502
3502
  ]);
3503
3503
  }
3504
3504
  create(value) {
3505
- const message = { modalId: "", messageTitle: "", messageText: "", canClose: false };
3505
+ const message = { promptId: "", messageTitle: "", messageText: "", timeout: 0, showTimer: false, canClose: false, options: [] };
3506
3506
  globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
3507
3507
  if (value !== undefined)
3508
3508
  reflectionMergePartial(this, message, value);
@@ -3513,8 +3513,8 @@ class Request_ShowModal$Type extends MessageType {
3513
3513
  while (reader.pos < end) {
3514
3514
  let [fieldNo, wireType] = reader.tag();
3515
3515
  switch (fieldNo) {
3516
- case /* string modal_id */ 1:
3517
- message.modalId = reader.string();
3516
+ case /* string prompt_id */ 1:
3517
+ message.promptId = reader.string();
3518
3518
  break;
3519
3519
  case /* string message_title */ 2:
3520
3520
  message.messageTitle = reader.string();
@@ -3522,14 +3522,17 @@ class Request_ShowModal$Type extends MessageType {
3522
3522
  case /* string message_text */ 3:
3523
3523
  message.messageText = reader.string();
3524
3524
  break;
3525
- case /* bool can_close */ 4:
3526
- message.canClose = reader.bool();
3525
+ case /* int32 timeout */ 4:
3526
+ message.timeout = reader.int32();
3527
+ break;
3528
+ case /* bool show_timer */ 5:
3529
+ message.showTimer = reader.bool();
3527
3530
  break;
3528
- case /* proto.models.ModalOption option_1 */ 5:
3529
- message.option1 = ModalOption.internalBinaryRead(reader, reader.uint32(), options, message.option1);
3531
+ case /* bool can_close */ 6:
3532
+ message.canClose = reader.bool();
3530
3533
  break;
3531
- case /* proto.models.ModalOption option_2 */ 6:
3532
- message.option2 = ModalOption.internalBinaryRead(reader, reader.uint32(), options, message.option2);
3534
+ case /* repeated proto.packets.Request.ShowPrompt.PromptOption options */ 7:
3535
+ message.options.push(Request_ShowPrompt_PromptOption.internalBinaryRead(reader, reader.uint32(), options));
3533
3536
  break;
3534
3537
  default:
3535
3538
  let u = options.readUnknownField;
@@ -3543,24 +3546,81 @@ class Request_ShowModal$Type extends MessageType {
3543
3546
  return message;
3544
3547
  }
3545
3548
  internalBinaryWrite(message, writer, options) {
3546
- /* string modal_id = 1; */
3547
- if (message.modalId !== "")
3548
- writer.tag(1, WireType.LengthDelimited).string(message.modalId);
3549
+ /* string prompt_id = 1; */
3550
+ if (message.promptId !== "")
3551
+ writer.tag(1, WireType.LengthDelimited).string(message.promptId);
3549
3552
  /* string message_title = 2; */
3550
3553
  if (message.messageTitle !== "")
3551
3554
  writer.tag(2, WireType.LengthDelimited).string(message.messageTitle);
3552
3555
  /* string message_text = 3; */
3553
3556
  if (message.messageText !== "")
3554
3557
  writer.tag(3, WireType.LengthDelimited).string(message.messageText);
3555
- /* bool can_close = 4; */
3558
+ /* int32 timeout = 4; */
3559
+ if (message.timeout !== 0)
3560
+ writer.tag(4, WireType.Varint).int32(message.timeout);
3561
+ /* bool show_timer = 5; */
3562
+ if (message.showTimer !== false)
3563
+ writer.tag(5, WireType.Varint).bool(message.showTimer);
3564
+ /* bool can_close = 6; */
3556
3565
  if (message.canClose !== false)
3557
- writer.tag(4, WireType.Varint).bool(message.canClose);
3558
- /* proto.models.ModalOption option_1 = 5; */
3559
- if (message.option1)
3560
- ModalOption.internalBinaryWrite(message.option1, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
3561
- /* proto.models.ModalOption option_2 = 6; */
3562
- if (message.option2)
3563
- ModalOption.internalBinaryWrite(message.option2, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
3566
+ writer.tag(6, WireType.Varint).bool(message.canClose);
3567
+ /* repeated proto.packets.Request.ShowPrompt.PromptOption options = 7; */
3568
+ for (let i = 0; i < message.options.length; i++)
3569
+ Request_ShowPrompt_PromptOption.internalBinaryWrite(message.options[i], writer.tag(7, WireType.LengthDelimited).fork(), options).join();
3570
+ let u = options.writeUnknownFields;
3571
+ if (u !== false)
3572
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
3573
+ return writer;
3574
+ }
3575
+ }
3576
+ /**
3577
+ * @generated MessageType for protobuf message proto.packets.Request.ShowPrompt
3578
+ */
3579
+ export const Request_ShowPrompt = new Request_ShowPrompt$Type();
3580
+ // @generated message type with reflection information, may provide speed optimized methods
3581
+ class Request_ShowPrompt_PromptOption$Type extends MessageType {
3582
+ constructor() {
3583
+ super("proto.packets.Request.ShowPrompt.PromptOption", [
3584
+ { no: 1, name: "label", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
3585
+ { no: 2, name: "value", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
3586
+ ]);
3587
+ }
3588
+ create(value) {
3589
+ const message = { label: "", value: "" };
3590
+ globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
3591
+ if (value !== undefined)
3592
+ reflectionMergePartial(this, message, value);
3593
+ return message;
3594
+ }
3595
+ internalBinaryRead(reader, length, options, target) {
3596
+ let message = target ?? this.create(), end = reader.pos + length;
3597
+ while (reader.pos < end) {
3598
+ let [fieldNo, wireType] = reader.tag();
3599
+ switch (fieldNo) {
3600
+ case /* string label */ 1:
3601
+ message.label = reader.string();
3602
+ break;
3603
+ case /* string value */ 2:
3604
+ message.value = reader.string();
3605
+ break;
3606
+ default:
3607
+ let u = options.readUnknownField;
3608
+ if (u === "throw")
3609
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
3610
+ let d = reader.skip(wireType);
3611
+ if (u !== false)
3612
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
3613
+ }
3614
+ }
3615
+ return message;
3616
+ }
3617
+ internalBinaryWrite(message, writer, options) {
3618
+ /* string label = 1; */
3619
+ if (message.label !== "")
3620
+ writer.tag(1, WireType.LengthDelimited).string(message.label);
3621
+ /* string value = 2; */
3622
+ if (message.value !== "")
3623
+ writer.tag(2, WireType.LengthDelimited).string(message.value);
3564
3624
  let u = options.writeUnknownFields;
3565
3625
  if (u !== false)
3566
3626
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -3568,9 +3628,9 @@ class Request_ShowModal$Type extends MessageType {
3568
3628
  }
3569
3629
  }
3570
3630
  /**
3571
- * @generated MessageType for protobuf message proto.packets.Request.ShowModal
3631
+ * @generated MessageType for protobuf message proto.packets.Request.ShowPrompt.PromptOption
3572
3632
  */
3573
- export const Request_ShowModal = new Request_ShowModal$Type();
3633
+ export const Request_ShowPrompt_PromptOption = new Request_ShowPrompt_PromptOption$Type();
3574
3634
  // @generated message type with reflection information, may provide speed optimized methods
3575
3635
  class Request_RemainingAttempts$Type extends MessageType {
3576
3636
  constructor() {
@@ -156,11 +156,11 @@ export interface Response {
156
156
  */
157
157
  preloadImageForStreamSync: Response_PreloadImageForStreamSync;
158
158
  } | {
159
- oneofKind: "showModal";
159
+ oneofKind: "showPrompt";
160
160
  /**
161
- * @generated from protobuf field: proto.packets.Response.ShowModal show_modal = 19;
161
+ * @generated from protobuf field: proto.packets.Response.ShowPrompt show_prompt = 19;
162
162
  */
163
- showModal: Response_ShowModal;
163
+ showPrompt: Response_ShowPrompt;
164
164
  } | {
165
165
  oneofKind: "remainingAttempts";
166
166
  /**
@@ -512,13 +512,13 @@ export interface Response_PreloadImageForStreamSync {
512
512
  fileId: string;
513
513
  }
514
514
  /**
515
- * @generated from protobuf message proto.packets.Response.ShowModal
515
+ * @generated from protobuf message proto.packets.Response.ShowPrompt
516
516
  */
517
- export interface Response_ShowModal {
517
+ export interface Response_ShowPrompt {
518
518
  /**
519
- * @generated from protobuf field: string modal_id = 1;
519
+ * @generated from protobuf field: string prompt_id = 1;
520
520
  */
521
- modalId: string;
521
+ promptId: string;
522
522
  /**
523
523
  * @generated from protobuf field: string value = 2;
524
524
  */
@@ -776,16 +776,16 @@ declare class Response_PreloadImageForStreamSync$Type extends MessageType<Respon
776
776
  * @generated MessageType for protobuf message proto.packets.Response.PreloadImageForStreamSync
777
777
  */
778
778
  export declare const Response_PreloadImageForStreamSync: Response_PreloadImageForStreamSync$Type;
779
- declare class Response_ShowModal$Type extends MessageType<Response_ShowModal> {
779
+ declare class Response_ShowPrompt$Type extends MessageType<Response_ShowPrompt> {
780
780
  constructor();
781
- create(value?: PartialMessage<Response_ShowModal>): Response_ShowModal;
782
- internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Response_ShowModal): Response_ShowModal;
783
- internalBinaryWrite(message: Response_ShowModal, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
781
+ create(value?: PartialMessage<Response_ShowPrompt>): Response_ShowPrompt;
782
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Response_ShowPrompt): Response_ShowPrompt;
783
+ internalBinaryWrite(message: Response_ShowPrompt, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
784
784
  }
785
785
  /**
786
- * @generated MessageType for protobuf message proto.packets.Response.ShowModal
786
+ * @generated MessageType for protobuf message proto.packets.Response.ShowPrompt
787
787
  */
788
- export declare const Response_ShowModal: Response_ShowModal$Type;
788
+ export declare const Response_ShowPrompt: Response_ShowPrompt$Type;
789
789
  declare class Response_RemainingAttempts$Type extends MessageType<Response_RemainingAttempts> {
790
790
  constructor();
791
791
  create(value?: PartialMessage<Response_RemainingAttempts>): Response_RemainingAttempts;
@@ -72,7 +72,7 @@ class Response$Type extends MessageType {
72
72
  { no: 16, name: "leaderboard_entries", kind: "message", oneof: "details", T: () => Response_LeaderboardEntries },
73
73
  { no: 17, name: "load_song", kind: "message", oneof: "details", T: () => Response_LoadSong },
74
74
  { no: 18, name: "preload_image_for_stream_sync", kind: "message", oneof: "details", T: () => Response_PreloadImageForStreamSync },
75
- { no: 19, name: "show_modal", kind: "message", oneof: "details", T: () => Response_ShowModal },
75
+ { no: 19, name: "show_prompt", kind: "message", oneof: "details", T: () => Response_ShowPrompt },
76
76
  { no: 20, name: "remaining_attempts", kind: "message", oneof: "details", T: () => Response_RemainingAttempts }
77
77
  ]);
78
78
  }
@@ -220,10 +220,10 @@ class Response$Type extends MessageType {
220
220
  preloadImageForStreamSync: Response_PreloadImageForStreamSync.internalBinaryRead(reader, reader.uint32(), options, message.details.preloadImageForStreamSync)
221
221
  };
222
222
  break;
223
- case /* proto.packets.Response.ShowModal show_modal */ 19:
223
+ case /* proto.packets.Response.ShowPrompt show_prompt */ 19:
224
224
  message.details = {
225
- oneofKind: "showModal",
226
- showModal: Response_ShowModal.internalBinaryRead(reader, reader.uint32(), options, message.details.showModal)
225
+ oneofKind: "showPrompt",
226
+ showPrompt: Response_ShowPrompt.internalBinaryRead(reader, reader.uint32(), options, message.details.showPrompt)
227
227
  };
228
228
  break;
229
229
  case /* proto.packets.Response.RemainingAttempts remaining_attempts */ 20:
@@ -313,9 +313,9 @@ class Response$Type extends MessageType {
313
313
  /* proto.packets.Response.PreloadImageForStreamSync preload_image_for_stream_sync = 18; */
314
314
  if (message.details.oneofKind === "preloadImageForStreamSync")
315
315
  Response_PreloadImageForStreamSync.internalBinaryWrite(message.details.preloadImageForStreamSync, writer.tag(18, WireType.LengthDelimited).fork(), options).join();
316
- /* proto.packets.Response.ShowModal show_modal = 19; */
317
- if (message.details.oneofKind === "showModal")
318
- Response_ShowModal.internalBinaryWrite(message.details.showModal, writer.tag(19, WireType.LengthDelimited).fork(), options).join();
316
+ /* proto.packets.Response.ShowPrompt show_prompt = 19; */
317
+ if (message.details.oneofKind === "showPrompt")
318
+ Response_ShowPrompt.internalBinaryWrite(message.details.showPrompt, writer.tag(19, WireType.LengthDelimited).fork(), options).join();
319
319
  /* proto.packets.Response.RemainingAttempts remaining_attempts = 20; */
320
320
  if (message.details.oneofKind === "remainingAttempts")
321
321
  Response_RemainingAttempts.internalBinaryWrite(message.details.remainingAttempts, writer.tag(20, WireType.LengthDelimited).fork(), options).join();
@@ -1574,15 +1574,15 @@ class Response_PreloadImageForStreamSync$Type extends MessageType {
1574
1574
  */
1575
1575
  export const Response_PreloadImageForStreamSync = new Response_PreloadImageForStreamSync$Type();
1576
1576
  // @generated message type with reflection information, may provide speed optimized methods
1577
- class Response_ShowModal$Type extends MessageType {
1577
+ class Response_ShowPrompt$Type extends MessageType {
1578
1578
  constructor() {
1579
- super("proto.packets.Response.ShowModal", [
1580
- { no: 1, name: "modal_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1579
+ super("proto.packets.Response.ShowPrompt", [
1580
+ { no: 1, name: "prompt_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1581
1581
  { no: 2, name: "value", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1582
1582
  ]);
1583
1583
  }
1584
1584
  create(value) {
1585
- const message = { modalId: "", value: "" };
1585
+ const message = { promptId: "", value: "" };
1586
1586
  globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
1587
1587
  if (value !== undefined)
1588
1588
  reflectionMergePartial(this, message, value);
@@ -1593,8 +1593,8 @@ class Response_ShowModal$Type extends MessageType {
1593
1593
  while (reader.pos < end) {
1594
1594
  let [fieldNo, wireType] = reader.tag();
1595
1595
  switch (fieldNo) {
1596
- case /* string modal_id */ 1:
1597
- message.modalId = reader.string();
1596
+ case /* string prompt_id */ 1:
1597
+ message.promptId = reader.string();
1598
1598
  break;
1599
1599
  case /* string value */ 2:
1600
1600
  message.value = reader.string();
@@ -1611,9 +1611,9 @@ class Response_ShowModal$Type extends MessageType {
1611
1611
  return message;
1612
1612
  }
1613
1613
  internalBinaryWrite(message, writer, options) {
1614
- /* string modal_id = 1; */
1615
- if (message.modalId !== "")
1616
- writer.tag(1, WireType.LengthDelimited).string(message.modalId);
1614
+ /* string prompt_id = 1; */
1615
+ if (message.promptId !== "")
1616
+ writer.tag(1, WireType.LengthDelimited).string(message.promptId);
1617
1617
  /* string value = 2; */
1618
1618
  if (message.value !== "")
1619
1619
  writer.tag(2, WireType.LengthDelimited).string(message.value);
@@ -1624,9 +1624,9 @@ class Response_ShowModal$Type extends MessageType {
1624
1624
  }
1625
1625
  }
1626
1626
  /**
1627
- * @generated MessageType for protobuf message proto.packets.Response.ShowModal
1627
+ * @generated MessageType for protobuf message proto.packets.Response.ShowPrompt
1628
1628
  */
1629
- export const Response_ShowModal = new Response_ShowModal$Type();
1629
+ export const Response_ShowPrompt = new Response_ShowPrompt$Type();
1630
1630
  // @generated message type with reflection information, may provide speed optimized methods
1631
1631
  class Response_RemainingAttempts$Type extends MessageType {
1632
1632
  constructor() {
@@ -2,7 +2,7 @@ import { CustomEventEmitter } from "./custom-event-emitter.js";
2
2
  import { User, Match, QualifierEvent, CoreServer, Tournament, GameplayParameters, Map, QualifierEvent_EventSettings, QualifierEvent_LeaderboardSort, Tournament_TournamentSettings_Team, Tournament_TournamentSettings_Pool, Permissions, RealtimeScore } from "./models/models.js";
3
3
  import { StateManager } from "./state-manager.js";
4
4
  import { Response, Response_Connect } from "./models/responses.js";
5
- import { Request_LoadSong } from "./models/requests.js";
5
+ import { Request_LoadSong, Request_ShowPrompt_PromptOption } from "./models/requests.js";
6
6
  import { Channel, Push_SongFinished } from "./models/index.js";
7
7
  export * from "./scraper.js";
8
8
  export * from "./models/models.js";
@@ -66,6 +66,7 @@ export declare class TAClient extends CustomEventEmitter<TAClientEvents> {
66
66
  getLeaderboard: (tournamentId: string, qualifierId: string, mapId: string) => Promise<Response>;
67
67
  loadSong: (levelId: string, userIds: string[], timeout?: number) => Promise<ResponseFromUser[]>;
68
68
  loadImage: (bitmap: Uint8Array, userIds: string[]) => Promise<ResponseFromUser[]>;
69
+ showPrompt: (userIds: string[], titleText: string, bodyText: string, canClose: boolean, options: Request_ShowPrompt_PromptOption[], timer?: number) => Promise<ResponseFromUser[]>;
69
70
  private handlePacket;
70
71
  updateUser: (tournamentId: string, user: User) => Promise<Response>;
71
72
  createMatch: (tournamentId: string, match: Match) => Promise<Response>;
@@ -166,16 +166,6 @@ export class TAClient extends CustomEventEmitter {
166
166
  }
167
167
  return waitingForUsers;
168
168
  };
169
- // Check that we got responses from all expected users
170
- const checkResponses = () => {
171
- const waitingForUsers = getUnrespondedUsers();
172
- if (waitingForUsers.length === 0) {
173
- // All responses are received, clean up and resolve
174
- removeListeners();
175
- clearTimeout(timeoutTimer);
176
- resolve(responseDictionary);
177
- }
178
- };
179
169
  // Add to the dictionary when the response is to this packet, and from an expected user
180
170
  const onResponseReceived = (response) => {
181
171
  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
@@ -185,7 +175,12 @@ export class TAClient extends CustomEventEmitter {
185
175
  userId: response.userId,
186
176
  response: response.response,
187
177
  });
188
- checkResponses();
178
+ if (getUnrespondedUsers().length === 0) {
179
+ // All responses are received, clean up and resolve
180
+ removeListeners();
181
+ clearTimeout(timeoutTimer);
182
+ resolve(responseDictionary);
183
+ }
189
184
  }
190
185
  };
191
186
  // Return what we have after 30 seconds, inject errors for users that haven't responded yet
@@ -218,15 +213,12 @@ export class TAClient extends CustomEventEmitter {
218
213
  addListeners();
219
214
  });
220
215
  // Assume forwardToUsers emits the 'responseReceived' event asynchronously
221
- const sendRequest = () => {
222
- if (to) {
223
- this.forwardToUsers(packet, to);
224
- }
225
- else {
226
- this.client?.send(packet, to);
227
- }
228
- };
229
- sendRequest();
216
+ if (to) {
217
+ this.forwardToUsers(packet, to);
218
+ }
219
+ else {
220
+ this.client?.send(packet, to);
221
+ }
230
222
  return responsesPromise;
231
223
  }
232
224
  async sendResponse(response, to) {
@@ -344,6 +336,26 @@ export class TAClient extends CustomEventEmitter {
344
336
  }
345
337
  return response;
346
338
  };
339
+ showPrompt = async (userIds, titleText, bodyText, canClose, options, timer) => {
340
+ const response = await this.sendRequest({
341
+ type: {
342
+ oneofKind: "showPrompt",
343
+ showPrompt: {
344
+ promptId: uuidv4(),
345
+ messageTitle: titleText,
346
+ messageText: bodyText,
347
+ showTimer: !!timer,
348
+ timeout: timer ?? 0,
349
+ canClose: canClose,
350
+ options
351
+ },
352
+ },
353
+ }, userIds, timer ? timer * 1000 : timer);
354
+ if (response.length <= 0) {
355
+ throw new Error("Server timed out, or no users responded");
356
+ }
357
+ return response;
358
+ };
347
359
  // --- Packet Handler --- //
348
360
  handlePacket = (packet) => {
349
361
  this.stateManager.handlePacket(packet);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moons-ta-client",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",