moons-ta-client 1.2.4 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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 { CoreServer } from './models.js';
7
6
  import { Tournament } from './models.js';
@@ -29,8 +28,8 @@ class Event$Type extends MessageType {
29
28
  ]);
30
29
  }
31
30
  create(value) {
32
- const message = { changedObject: { oneofKind: undefined } };
33
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
31
+ const message = globalThis.Object.create((this.messagePrototype));
32
+ message.changedObject = { oneofKind: undefined };
34
33
  if (value !== undefined)
35
34
  reflectionMergePartial(this, message, value);
36
35
  return message;
@@ -197,8 +196,8 @@ class Event_UserAdded$Type extends MessageType {
197
196
  ]);
198
197
  }
199
198
  create(value) {
200
- const message = { tournamentId: "" };
201
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
199
+ const message = globalThis.Object.create((this.messagePrototype));
200
+ message.tournamentId = "";
202
201
  if (value !== undefined)
203
202
  reflectionMergePartial(this, message, value);
204
203
  return message;
@@ -251,8 +250,8 @@ class Event_UserUpdated$Type extends MessageType {
251
250
  ]);
252
251
  }
253
252
  create(value) {
254
- const message = { tournamentId: "" };
255
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
253
+ const message = globalThis.Object.create((this.messagePrototype));
254
+ message.tournamentId = "";
256
255
  if (value !== undefined)
257
256
  reflectionMergePartial(this, message, value);
258
257
  return message;
@@ -305,8 +304,8 @@ class Event_UserLeft$Type extends MessageType {
305
304
  ]);
306
305
  }
307
306
  create(value) {
308
- const message = { tournamentId: "" };
309
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
307
+ const message = globalThis.Object.create((this.messagePrototype));
308
+ message.tournamentId = "";
310
309
  if (value !== undefined)
311
310
  reflectionMergePartial(this, message, value);
312
311
  return message;
@@ -359,8 +358,8 @@ class Event_MatchCreated$Type extends MessageType {
359
358
  ]);
360
359
  }
361
360
  create(value) {
362
- const message = { tournamentId: "" };
363
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
361
+ const message = globalThis.Object.create((this.messagePrototype));
362
+ message.tournamentId = "";
364
363
  if (value !== undefined)
365
364
  reflectionMergePartial(this, message, value);
366
365
  return message;
@@ -413,8 +412,8 @@ class Event_MatchUpdated$Type extends MessageType {
413
412
  ]);
414
413
  }
415
414
  create(value) {
416
- const message = { tournamentId: "" };
417
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
415
+ const message = globalThis.Object.create((this.messagePrototype));
416
+ message.tournamentId = "";
418
417
  if (value !== undefined)
419
418
  reflectionMergePartial(this, message, value);
420
419
  return message;
@@ -467,8 +466,8 @@ class Event_MatchDeleted$Type extends MessageType {
467
466
  ]);
468
467
  }
469
468
  create(value) {
470
- const message = { tournamentId: "" };
471
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
469
+ const message = globalThis.Object.create((this.messagePrototype));
470
+ message.tournamentId = "";
472
471
  if (value !== undefined)
473
472
  reflectionMergePartial(this, message, value);
474
473
  return message;
@@ -521,8 +520,8 @@ class Event_QualifierCreated$Type extends MessageType {
521
520
  ]);
522
521
  }
523
522
  create(value) {
524
- const message = { tournamentId: "" };
525
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
523
+ const message = globalThis.Object.create((this.messagePrototype));
524
+ message.tournamentId = "";
526
525
  if (value !== undefined)
527
526
  reflectionMergePartial(this, message, value);
528
527
  return message;
@@ -575,8 +574,8 @@ class Event_QualifierUpdated$Type extends MessageType {
575
574
  ]);
576
575
  }
577
576
  create(value) {
578
- const message = { tournamentId: "" };
579
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
577
+ const message = globalThis.Object.create((this.messagePrototype));
578
+ message.tournamentId = "";
580
579
  if (value !== undefined)
581
580
  reflectionMergePartial(this, message, value);
582
581
  return message;
@@ -629,8 +628,8 @@ class Event_QualifierDeleted$Type extends MessageType {
629
628
  ]);
630
629
  }
631
630
  create(value) {
632
- const message = { tournamentId: "" };
633
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
631
+ const message = globalThis.Object.create((this.messagePrototype));
632
+ message.tournamentId = "";
634
633
  if (value !== undefined)
635
634
  reflectionMergePartial(this, message, value);
636
635
  return message;
@@ -682,8 +681,7 @@ class Event_TournamentCreated$Type extends MessageType {
682
681
  ]);
683
682
  }
684
683
  create(value) {
685
- const message = {};
686
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
684
+ const message = globalThis.Object.create((this.messagePrototype));
687
685
  if (value !== undefined)
688
686
  reflectionMergePartial(this, message, value);
689
687
  return message;
@@ -729,8 +727,7 @@ class Event_TournamentUpdated$Type extends MessageType {
729
727
  ]);
730
728
  }
731
729
  create(value) {
732
- const message = {};
733
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
730
+ const message = globalThis.Object.create((this.messagePrototype));
734
731
  if (value !== undefined)
735
732
  reflectionMergePartial(this, message, value);
736
733
  return message;
@@ -776,8 +773,7 @@ class Event_TournamentDeleted$Type extends MessageType {
776
773
  ]);
777
774
  }
778
775
  create(value) {
779
- const message = {};
780
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
776
+ const message = globalThis.Object.create((this.messagePrototype));
781
777
  if (value !== undefined)
782
778
  reflectionMergePartial(this, message, value);
783
779
  return message;
@@ -823,8 +819,7 @@ class Event_ServerAdded$Type extends MessageType {
823
819
  ]);
824
820
  }
825
821
  create(value) {
826
- const message = {};
827
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
822
+ const message = globalThis.Object.create((this.messagePrototype));
828
823
  if (value !== undefined)
829
824
  reflectionMergePartial(this, message, value);
830
825
  return message;
@@ -870,8 +865,7 @@ class Event_ServerDeleted$Type extends MessageType {
870
865
  ]);
871
866
  }
872
867
  create(value) {
873
- const message = {};
874
- globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
868
+ const message = globalThis.Object.create((this.messagePrototype));
875
869
  if (value !== undefined)
876
870
  reflectionMergePartial(this, message, value);
877
871
  return message;
@@ -0,0 +1,156 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
5
+ import type { PartialMessage } from "@protobuf-ts/runtime";
6
+ import type { JsonValue } from "@protobuf-ts/runtime";
7
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
8
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
9
+ import { MessageType } from "@protobuf-ts/runtime";
10
+ /**
11
+ * A Timestamp represents a point in time independent of any time zone or local
12
+ * calendar, encoded as a count of seconds and fractions of seconds at
13
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
14
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
15
+ * Gregorian calendar backwards to year one.
16
+ *
17
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
18
+ * second table is needed for interpretation, using a [24-hour linear
19
+ * smear](https://developers.google.com/time/smear).
20
+ *
21
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
22
+ * restricting to that range, we ensure that we can convert to and from [RFC
23
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
24
+ *
25
+ * # Examples
26
+ *
27
+ * Example 1: Compute Timestamp from POSIX `time()`.
28
+ *
29
+ * Timestamp timestamp;
30
+ * timestamp.set_seconds(time(NULL));
31
+ * timestamp.set_nanos(0);
32
+ *
33
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
34
+ *
35
+ * struct timeval tv;
36
+ * gettimeofday(&tv, NULL);
37
+ *
38
+ * Timestamp timestamp;
39
+ * timestamp.set_seconds(tv.tv_sec);
40
+ * timestamp.set_nanos(tv.tv_usec * 1000);
41
+ *
42
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
43
+ *
44
+ * FILETIME ft;
45
+ * GetSystemTimeAsFileTime(&ft);
46
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
47
+ *
48
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
49
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
50
+ * Timestamp timestamp;
51
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
52
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
53
+ *
54
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
55
+ *
56
+ * long millis = System.currentTimeMillis();
57
+ *
58
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
59
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
60
+ *
61
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
62
+ *
63
+ * Instant now = Instant.now();
64
+ *
65
+ * Timestamp timestamp =
66
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
67
+ * .setNanos(now.getNano()).build();
68
+ *
69
+ * Example 6: Compute Timestamp from current time in Python.
70
+ *
71
+ * timestamp = Timestamp()
72
+ * timestamp.GetCurrentTime()
73
+ *
74
+ * # JSON Mapping
75
+ *
76
+ * In JSON format, the Timestamp type is encoded as a string in the
77
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
79
+ * where {year} is always expressed using four digits while {month}, {day},
80
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
81
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
+ * is required. A ProtoJSON serializer should always use UTC (as indicated by
84
+ * "Z") when printing the Timestamp type and a ProtoJSON parser should be
85
+ * able to accept both UTC and other timezones (as indicated by an offset).
86
+ *
87
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
+ * 01:30 UTC on January 15, 2017.
89
+ *
90
+ * In JavaScript, one can convert a Date object to this format using the
91
+ * standard
92
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
+ * method. In Python, a standard `datetime.datetime` object can be converted
94
+ * to this format using
95
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
99
+ * ) to obtain a formatter capable of generating timestamps in this format.
100
+ *
101
+ *
102
+ * @generated from protobuf message google.protobuf.Timestamp
103
+ */
104
+ export interface Timestamp {
105
+ /**
106
+ * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
107
+ * be between -62135596800 and 253402300799 inclusive (which corresponds to
108
+ * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
109
+ *
110
+ * @generated from protobuf field: int64 seconds = 1
111
+ */
112
+ seconds: bigint;
113
+ /**
114
+ * Non-negative fractions of a second at nanosecond resolution. This field is
115
+ * the nanosecond portion of the duration, not an alternative to seconds.
116
+ * Negative second values with fractions must still have non-negative nanos
117
+ * values that count forward in time. Must be between 0 and 999,999,999
118
+ * inclusive.
119
+ *
120
+ * @generated from protobuf field: int32 nanos = 2
121
+ */
122
+ nanos: number;
123
+ }
124
+ declare class Timestamp$Type extends MessageType<Timestamp> {
125
+ constructor();
126
+ /**
127
+ * Creates a new `Timestamp` for the current time.
128
+ */
129
+ now(): Timestamp;
130
+ /**
131
+ * Converts a `Timestamp` to a JavaScript Date.
132
+ */
133
+ toDate(message: Timestamp): Date;
134
+ /**
135
+ * Converts a JavaScript Date to a `Timestamp`.
136
+ */
137
+ fromDate(date: Date): Timestamp;
138
+ /**
139
+ * In JSON format, the `Timestamp` type is encoded as a string
140
+ * in the RFC 3339 format.
141
+ */
142
+ internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue;
143
+ /**
144
+ * In JSON format, the `Timestamp` type is encoded as a string
145
+ * in the RFC 3339 format.
146
+ */
147
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp;
148
+ create(value?: PartialMessage<Timestamp>): Timestamp;
149
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp;
150
+ internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
151
+ }
152
+ /**
153
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
154
+ */
155
+ export declare const Timestamp: Timestamp$Type;
156
+ export {};
@@ -0,0 +1,132 @@
1
+ import { WireType } from "@protobuf-ts/runtime";
2
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
5
+ import { PbLong } from "@protobuf-ts/runtime";
6
+ import { MessageType } from "@protobuf-ts/runtime";
7
+ // @generated message type with reflection information, may provide speed optimized methods
8
+ class Timestamp$Type extends MessageType {
9
+ constructor() {
10
+ super("google.protobuf.Timestamp", [
11
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
12
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
13
+ ]);
14
+ }
15
+ /**
16
+ * Creates a new `Timestamp` for the current time.
17
+ */
18
+ now() {
19
+ const msg = this.create();
20
+ const ms = Date.now();
21
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
22
+ msg.nanos = (ms % 1000) * 1000000;
23
+ return msg;
24
+ }
25
+ /**
26
+ * Converts a `Timestamp` to a JavaScript Date.
27
+ */
28
+ toDate(message) {
29
+ return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
30
+ }
31
+ /**
32
+ * Converts a JavaScript Date to a `Timestamp`.
33
+ */
34
+ fromDate(date) {
35
+ const msg = this.create();
36
+ const ms = date.getTime();
37
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
38
+ msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
39
+ return msg;
40
+ }
41
+ /**
42
+ * In JSON format, the `Timestamp` type is encoded as a string
43
+ * in the RFC 3339 format.
44
+ */
45
+ internalJsonWrite(message, options) {
46
+ let ms = PbLong.from(message.seconds).toNumber() * 1000;
47
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
48
+ throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
49
+ if (message.nanos < 0)
50
+ throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
51
+ let z = "Z";
52
+ if (message.nanos > 0) {
53
+ let nanosStr = (message.nanos + 1000000000).toString().substring(1);
54
+ if (nanosStr.substring(3) === "000000")
55
+ z = "." + nanosStr.substring(0, 3) + "Z";
56
+ else if (nanosStr.substring(6) === "000")
57
+ z = "." + nanosStr.substring(0, 6) + "Z";
58
+ else
59
+ z = "." + nanosStr + "Z";
60
+ }
61
+ return new Date(ms).toISOString().replace(".000Z", z);
62
+ }
63
+ /**
64
+ * In JSON format, the `Timestamp` type is encoded as a string
65
+ * in the RFC 3339 format.
66
+ */
67
+ internalJsonRead(json, options, target) {
68
+ if (typeof json !== "string")
69
+ throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
70
+ let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
71
+ if (!matches)
72
+ throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
73
+ let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
74
+ if (Number.isNaN(ms))
75
+ throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
76
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
77
+ throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
78
+ if (!target)
79
+ target = this.create();
80
+ target.seconds = PbLong.from(ms / 1000).toBigInt();
81
+ target.nanos = 0;
82
+ if (matches[7])
83
+ target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
84
+ return target;
85
+ }
86
+ create(value) {
87
+ const message = globalThis.Object.create((this.messagePrototype));
88
+ message.seconds = 0n;
89
+ message.nanos = 0;
90
+ if (value !== undefined)
91
+ reflectionMergePartial(this, message, value);
92
+ return message;
93
+ }
94
+ internalBinaryRead(reader, length, options, target) {
95
+ let message = target ?? this.create(), end = reader.pos + length;
96
+ while (reader.pos < end) {
97
+ let [fieldNo, wireType] = reader.tag();
98
+ switch (fieldNo) {
99
+ case /* int64 seconds */ 1:
100
+ message.seconds = reader.int64().toBigInt();
101
+ break;
102
+ case /* int32 nanos */ 2:
103
+ message.nanos = reader.int32();
104
+ break;
105
+ default:
106
+ let u = options.readUnknownField;
107
+ if (u === "throw")
108
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
109
+ let d = reader.skip(wireType);
110
+ if (u !== false)
111
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
112
+ }
113
+ }
114
+ return message;
115
+ }
116
+ internalBinaryWrite(message, writer, options) {
117
+ /* int64 seconds = 1; */
118
+ if (message.seconds !== 0n)
119
+ writer.tag(1, WireType.Varint).int64(message.seconds);
120
+ /* int32 nanos = 2; */
121
+ if (message.nanos !== 0)
122
+ writer.tag(2, WireType.Varint).int32(message.nanos);
123
+ let u = options.writeUnknownFields;
124
+ if (u !== false)
125
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
126
+ return writer;
127
+ }
128
+ }
129
+ /**
130
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
131
+ */
132
+ export const Timestamp = new Timestamp$Type();
@@ -6,3 +6,4 @@ export * from "./packets.js";
6
6
  export * from "./pushes.js";
7
7
  export * from "./requests.js";
8
8
  export * from "./responses.js";
9
+ export * from "./replay_stream.js";
@@ -6,3 +6,4 @@ export * from "./packets.js";
6
6
  export * from "./pushes.js";
7
7
  export * from "./requests.js";
8
8
  export * from "./responses.js";
9
+ export * from "./replay_stream.js";