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.
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -2
- package/dist/index.d.ts +62 -57
- package/dist/index.esm.js +160 -128
- package/dist/models/models.d.ts +0 -23
- package/dist/models/models.js +0 -54
- package/dist/models/requests.d.ts +45 -19
- package/dist/models/requests.js +96 -36
- package/dist/models/responses.d.ts +13 -13
- package/dist/models/responses.js +18 -18
- package/dist/tournament-assistant-client.d.ts +2 -1
- package/dist/tournament-assistant-client.js +32 -20
- package/package.json +1 -1
|
@@ -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: "
|
|
337
|
+
oneofKind: "showPrompt";
|
|
339
338
|
/**
|
|
340
|
-
* @generated from protobuf field: proto.packets.Request.
|
|
339
|
+
* @generated from protobuf field: proto.packets.Request.ShowPrompt show_prompt = 42;
|
|
341
340
|
*/
|
|
342
|
-
|
|
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.
|
|
1112
|
+
* @generated from protobuf message proto.packets.Request.ShowPrompt
|
|
1114
1113
|
*/
|
|
1115
|
-
export interface
|
|
1114
|
+
export interface Request_ShowPrompt {
|
|
1116
1115
|
/**
|
|
1117
|
-
* @generated from protobuf field: string
|
|
1116
|
+
* @generated from protobuf field: string prompt_id = 1;
|
|
1118
1117
|
*/
|
|
1119
|
-
|
|
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:
|
|
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.
|
|
1140
|
+
* @generated from protobuf field: repeated proto.packets.Request.ShowPrompt.PromptOption options = 7;
|
|
1134
1141
|
*/
|
|
1135
|
-
|
|
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:
|
|
1149
|
+
* @generated from protobuf field: string label = 1;
|
|
1138
1150
|
*/
|
|
1139
|
-
|
|
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
|
|
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<
|
|
1681
|
-
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?:
|
|
1682
|
-
internalBinaryWrite(message:
|
|
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.
|
|
1711
|
+
* @generated MessageType for protobuf message proto.packets.Request.ShowPrompt.PromptOption
|
|
1686
1712
|
*/
|
|
1687
|
-
export declare const
|
|
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;
|
package/dist/models/requests.js
CHANGED
|
@@ -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: "
|
|
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.
|
|
397
|
+
case /* proto.packets.Request.ShowPrompt show_prompt */ 42:
|
|
399
398
|
message.type = {
|
|
400
|
-
oneofKind: "
|
|
401
|
-
|
|
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.
|
|
576
|
-
if (message.type.oneofKind === "
|
|
577
|
-
|
|
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
|
|
3492
|
+
class Request_ShowPrompt$Type extends MessageType {
|
|
3494
3493
|
constructor() {
|
|
3495
|
-
super("proto.packets.Request.
|
|
3496
|
-
{ no: 1, name: "
|
|
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: "
|
|
3500
|
-
{ no: 5, name: "
|
|
3501
|
-
{ no: 6, name: "
|
|
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 = {
|
|
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
|
|
3517
|
-
message.
|
|
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 /*
|
|
3526
|
-
message.
|
|
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 /*
|
|
3529
|
-
message.
|
|
3531
|
+
case /* bool can_close */ 6:
|
|
3532
|
+
message.canClose = reader.bool();
|
|
3530
3533
|
break;
|
|
3531
|
-
case /* proto.
|
|
3532
|
-
message.
|
|
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
|
|
3547
|
-
if (message.
|
|
3548
|
-
writer.tag(1, WireType.LengthDelimited).string(message.
|
|
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
|
-
/*
|
|
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(
|
|
3558
|
-
/* proto.
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
if (
|
|
3563
|
-
|
|
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.
|
|
3631
|
+
* @generated MessageType for protobuf message proto.packets.Request.ShowPrompt.PromptOption
|
|
3572
3632
|
*/
|
|
3573
|
-
export const
|
|
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: "
|
|
159
|
+
oneofKind: "showPrompt";
|
|
160
160
|
/**
|
|
161
|
-
* @generated from protobuf field: proto.packets.Response.
|
|
161
|
+
* @generated from protobuf field: proto.packets.Response.ShowPrompt show_prompt = 19;
|
|
162
162
|
*/
|
|
163
|
-
|
|
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.
|
|
515
|
+
* @generated from protobuf message proto.packets.Response.ShowPrompt
|
|
516
516
|
*/
|
|
517
|
-
export interface
|
|
517
|
+
export interface Response_ShowPrompt {
|
|
518
518
|
/**
|
|
519
|
-
* @generated from protobuf field: string
|
|
519
|
+
* @generated from protobuf field: string prompt_id = 1;
|
|
520
520
|
*/
|
|
521
|
-
|
|
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
|
|
779
|
+
declare class Response_ShowPrompt$Type extends MessageType<Response_ShowPrompt> {
|
|
780
780
|
constructor();
|
|
781
|
-
create(value?: PartialMessage<
|
|
782
|
-
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?:
|
|
783
|
-
internalBinaryWrite(message:
|
|
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.
|
|
786
|
+
* @generated MessageType for protobuf message proto.packets.Response.ShowPrompt
|
|
787
787
|
*/
|
|
788
|
-
export declare const
|
|
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;
|
package/dist/models/responses.js
CHANGED
|
@@ -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: "
|
|
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.
|
|
223
|
+
case /* proto.packets.Response.ShowPrompt show_prompt */ 19:
|
|
224
224
|
message.details = {
|
|
225
|
-
oneofKind: "
|
|
226
|
-
|
|
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.
|
|
317
|
-
if (message.details.oneofKind === "
|
|
318
|
-
|
|
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
|
|
1577
|
+
class Response_ShowPrompt$Type extends MessageType {
|
|
1578
1578
|
constructor() {
|
|
1579
|
-
super("proto.packets.Response.
|
|
1580
|
-
{ no: 1, name: "
|
|
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 = {
|
|
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
|
|
1597
|
-
message.
|
|
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
|
|
1615
|
-
if (message.
|
|
1616
|
-
writer.tag(1, WireType.LengthDelimited).string(message.
|
|
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.
|
|
1627
|
+
* @generated MessageType for protobuf message proto.packets.Response.ShowPrompt
|
|
1628
1628
|
*/
|
|
1629
|
-
export const
|
|
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
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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);
|