mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
gotta go fast
This commit is contained in:
1 parent
35894f39cf
commit
57d63ea1d7
9 files changed
+368
-668
No files matched your search
@@ -5,9 +5,9 @@
|
||||
// source: packages/core/src/protos/i18n.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = 'blitzkit';
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface I18n {
|
||||
locales: { [key: string]: string };
|
||||
@@ -18,27 +18,20 @@ export interface I18n_LocalesEntry {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function createBaseI18n(): I18n {
|
||||
function createBaseI18n(): I18n {
|
||||
return { locales: {} };
|
||||
}
|
||||
|
||||
export const I18n: MessageFns<I18n> = {
|
||||
encode(
|
||||
message: I18n,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: I18n, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
Object.entries(message.locales).forEach(([key, value]) => {
|
||||
I18n_LocalesEntry.encode(
|
||||
{ key: key as any, value },
|
||||
writer.uint32(10).fork(),
|
||||
).join();
|
||||
I18n_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
||||
});
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): I18n {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseI18n();
|
||||
while (reader.pos < end) {
|
||||
@@ -67,13 +60,10 @@ export const I18n: MessageFns<I18n> = {
|
||||
fromJSON(object: any): I18n {
|
||||
return {
|
||||
locales: isObject(object.locales)
|
||||
? Object.entries(object.locales).reduce<{ [key: string]: string }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[key] = String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
||||
acc[key] = String(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
};
|
||||
},
|
||||
@@ -97,9 +87,7 @@ export const I18n: MessageFns<I18n> = {
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<I18n>, I>>(object: I): I18n {
|
||||
const message = createBaseI18n();
|
||||
message.locales = Object.entries(object.locales ?? {}).reduce<{
|
||||
[key: string]: string;
|
||||
}>((acc, [key, value]) => {
|
||||
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
@@ -110,14 +98,11 @@ export const I18n: MessageFns<I18n> = {
|
||||
};
|
||||
|
||||
function createBaseI18n_LocalesEntry(): I18n_LocalesEntry {
|
||||
return { key: '', value: '' };
|
||||
return { key: "", value: "" };
|
||||
}
|
||||
|
||||
export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
|
||||
encode(
|
||||
message: I18n_LocalesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: I18n_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
@@ -128,8 +113,7 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): I18n_LocalesEntry {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseI18n_LocalesEntry();
|
||||
while (reader.pos < end) {
|
||||
@@ -162,10 +146,8 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
|
||||
|
||||
fromJSON(object: any): I18n_LocalesEntry {
|
||||
return {
|
||||
key: globalThis.String(assertSet('I18n_LocalesEntry.key', object.key)),
|
||||
value: globalThis.String(
|
||||
assertSet('I18n_LocalesEntry.value', object.value),
|
||||
),
|
||||
key: globalThis.String(assertSet("I18n_LocalesEntry.key", object.key)),
|
||||
value: globalThis.String(assertSet("I18n_LocalesEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -180,51 +162,32 @@ export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(
|
||||
base?: I,
|
||||
): I18n_LocalesEntry {
|
||||
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(base?: I): I18n_LocalesEntry {
|
||||
return I18n_LocalesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(
|
||||
object: I,
|
||||
): I18n_LocalesEntry {
|
||||
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(object: I): I18n_LocalesEntry {
|
||||
const message = createBaseI18n_LocalesEntry();
|
||||
message.key = object.key ?? '';
|
||||
message.value = object.value ?? '';
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown }
|
||||
? { $case: T['$case']; value?: DeepPartial<T['value']> }
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === 'object' && value !== null;
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
// source: packages/core/src/protos/legacy_game_definitions.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { I18nString, createBaseI18nString } from './legacy_i18n';
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { I18nString } from "./legacy_i18n";
|
||||
|
||||
export const protobufPackage = 'blitzkit';
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface GameDefinitions {
|
||||
version: string;
|
||||
@@ -37,38 +37,28 @@ export interface GameModeRole {
|
||||
}
|
||||
|
||||
function createBaseGameDefinitions(): GameDefinitions {
|
||||
return { version: '', nations: [], gameModes: {}, roles: {} };
|
||||
return { version: "", nations: [], gameModes: {}, roles: {} };
|
||||
}
|
||||
|
||||
export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
encode(
|
||||
message: GameDefinitions,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.version !== '') {
|
||||
encode(message: GameDefinitions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.version !== "") {
|
||||
writer.uint32(10).string(message.version);
|
||||
}
|
||||
for (const v of message.nations) {
|
||||
writer.uint32(18).string(v!);
|
||||
}
|
||||
Object.entries(message.gameModes).forEach(([key, value]) => {
|
||||
GameDefinitions_GameModesEntry.encode(
|
||||
{ key: key as any, value },
|
||||
writer.uint32(26).fork(),
|
||||
).join();
|
||||
GameDefinitions_GameModesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
|
||||
});
|
||||
Object.entries(message.roles).forEach(([key, value]) => {
|
||||
GameDefinitions_RolesEntry.encode(
|
||||
{ key: key as any, value },
|
||||
writer.uint32(34).fork(),
|
||||
).join();
|
||||
GameDefinitions_RolesEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
|
||||
});
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameDefinitions();
|
||||
while (reader.pos < end) {
|
||||
@@ -95,10 +85,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry3 = GameDefinitions_GameModesEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
const entry3 = GameDefinitions_GameModesEntry.decode(reader, reader.uint32());
|
||||
if (entry3.value !== undefined) {
|
||||
message.gameModes[entry3.key] = entry3.value;
|
||||
}
|
||||
@@ -109,10 +96,7 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry4 = GameDefinitions_RolesEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
const entry4 = GameDefinitions_RolesEntry.decode(reader, reader.uint32());
|
||||
if (entry4.value !== undefined) {
|
||||
message.roles[entry4.key] = entry4.value;
|
||||
}
|
||||
@@ -129,36 +113,26 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
|
||||
fromJSON(object: any): GameDefinitions {
|
||||
return {
|
||||
version: globalThis.String(
|
||||
assertSet('GameDefinitions.version', object.version),
|
||||
),
|
||||
nations: globalThis.Array.isArray(object?.nations)
|
||||
? object.nations.map((e: any) => globalThis.String(e))
|
||||
: [],
|
||||
version: globalThis.String(assertSet("GameDefinitions.version", object.version)),
|
||||
nations: globalThis.Array.isArray(object?.nations) ? object.nations.map((e: any) => globalThis.String(e)) : [],
|
||||
gameModes: isObject(object.gameModes)
|
||||
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameMode.fromJSON(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
? Object.entries(object.gameModes).reduce<{ [key: number]: GameMode }>((acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameMode.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
roles: isObject(object.roles)
|
||||
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
? Object.entries(object.roles).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
|
||||
acc[globalThis.Number(key)] = GameModeRole.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version !== '') {
|
||||
if (message.version !== "") {
|
||||
obj.version = message.version;
|
||||
}
|
||||
if (message.nations?.length) {
|
||||
@@ -185,28 +159,23 @@ export const GameDefinitions: MessageFns<GameDefinitions> = {
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions>, I>>(
|
||||
base?: I,
|
||||
): GameDefinitions {
|
||||
create<I extends Exact<DeepPartial<GameDefinitions>, I>>(base?: I): GameDefinitions {
|
||||
return GameDefinitions.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(
|
||||
object: I,
|
||||
): GameDefinitions {
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions>, I>>(object: I): GameDefinitions {
|
||||
const message = createBaseGameDefinitions();
|
||||
message.version = object.version ?? '';
|
||||
message.version = object.version ?? "";
|
||||
message.nations = object.nations?.map((e) => e) || [];
|
||||
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{
|
||||
[key: number]: GameMode;
|
||||
}>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = GameMode.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
message.roles = Object.entries(object.roles ?? {}).reduce<{
|
||||
[key: number]: GameModeRole;
|
||||
}>((acc, [key, value]) => {
|
||||
message.gameModes = Object.entries(object.gameModes ?? {}).reduce<{ [key: number]: GameMode }>(
|
||||
(acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = GameMode.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
message.roles = Object.entries(object.roles ?? {}).reduce<{ [key: number]: GameModeRole }>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[globalThis.Number(key)] = GameModeRole.fromPartial(value);
|
||||
}
|
||||
@@ -220,201 +189,166 @@ function createBaseGameDefinitions_GameModesEntry(): GameDefinitions_GameModesEn
|
||||
return { key: 0, value: createBaseGameMode() };
|
||||
}
|
||||
|
||||
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> =
|
||||
{
|
||||
encode(
|
||||
message: GameDefinitions_GameModesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
GameMode.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
export const GameDefinitions_GameModesEntry: MessageFns<GameDefinitions_GameModesEntry> = {
|
||||
encode(message: GameDefinitions_GameModesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
GameMode.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: BinaryReader | Uint8Array,
|
||||
length?: number,
|
||||
): GameDefinitions_GameModesEntry {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameDefinitions_GameModesEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.uint32();
|
||||
continue;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_GameModesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameDefinitions_GameModesEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = GameMode.decode(reader, reader.uint32());
|
||||
continue;
|
||||
message.key = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = GameMode.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GameDefinitions_GameModesEntry {
|
||||
return {
|
||||
key: globalThis.Number(
|
||||
assertSet('GameDefinitions_GameModesEntry.key', object.key),
|
||||
),
|
||||
value: GameMode.fromJSON(
|
||||
assertSet('GameDefinitions_GameModesEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions_GameModesEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = Math.round(message.key);
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = GameMode.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(
|
||||
base?: I,
|
||||
): GameDefinitions_GameModesEntry {
|
||||
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<
|
||||
I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>,
|
||||
>(object: I): GameDefinitions_GameModesEntry {
|
||||
const message = createBaseGameDefinitions_GameModesEntry();
|
||||
message.key = object.key ?? 0;
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? GameMode.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
fromJSON(object: any): GameDefinitions_GameModesEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("GameDefinitions_GameModesEntry.key", object.key)),
|
||||
value: GameMode.fromJSON(assertSet("GameDefinitions_GameModesEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions_GameModesEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = Math.round(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = GameMode.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(base?: I): GameDefinitions_GameModesEntry {
|
||||
return GameDefinitions_GameModesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions_GameModesEntry>, I>>(
|
||||
object: I,
|
||||
): GameDefinitions_GameModesEntry {
|
||||
const message = createBaseGameDefinitions_GameModesEntry();
|
||||
message.key = object.key ?? 0;
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
? GameMode.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGameDefinitions_RolesEntry(): GameDefinitions_RolesEntry {
|
||||
return { key: 0, value: createBaseGameModeRole() };
|
||||
}
|
||||
|
||||
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> =
|
||||
{
|
||||
encode(
|
||||
message: GameDefinitions_RolesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
GameModeRole.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
export const GameDefinitions_RolesEntry: MessageFns<GameDefinitions_RolesEntry> = {
|
||||
encode(message: GameDefinitions_RolesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(8).uint32(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
GameModeRole.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: BinaryReader | Uint8Array,
|
||||
length?: number,
|
||||
): GameDefinitions_RolesEntry {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameDefinitions_RolesEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.uint32();
|
||||
continue;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameDefinitions_RolesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameDefinitions_RolesEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = GameModeRole.decode(reader, reader.uint32());
|
||||
continue;
|
||||
message.key = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = GameModeRole.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): GameDefinitions_RolesEntry {
|
||||
return {
|
||||
key: globalThis.Number(
|
||||
assertSet('GameDefinitions_RolesEntry.key', object.key),
|
||||
),
|
||||
value: GameModeRole.fromJSON(
|
||||
assertSet('GameDefinitions_RolesEntry.value', object.value),
|
||||
),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions_RolesEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = Math.round(message.key);
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = GameModeRole.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
|
||||
base?: I,
|
||||
): GameDefinitions_RolesEntry {
|
||||
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(
|
||||
object: I,
|
||||
): GameDefinitions_RolesEntry {
|
||||
const message = createBaseGameDefinitions_RolesEntry();
|
||||
message.key = object.key ?? 0;
|
||||
message.value =
|
||||
object.value !== undefined && object.value !== null
|
||||
? GameModeRole.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
fromJSON(object: any): GameDefinitions_RolesEntry {
|
||||
return {
|
||||
key: globalThis.Number(assertSet("GameDefinitions_RolesEntry.key", object.key)),
|
||||
value: GameModeRole.fromJSON(assertSet("GameDefinitions_RolesEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: GameDefinitions_RolesEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = Math.round(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = GameModeRole.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(base?: I): GameDefinitions_RolesEntry {
|
||||
return GameDefinitions_RolesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameDefinitions_RolesEntry>, I>>(object: I): GameDefinitions_RolesEntry {
|
||||
const message = createBaseGameDefinitions_RolesEntry();
|
||||
message.key = object.key ?? 0;
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
? GameModeRole.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGameMode(): GameMode {
|
||||
return { name: createBaseI18nString() };
|
||||
}
|
||||
|
||||
export const GameMode: MessageFns<GameMode> = {
|
||||
encode(
|
||||
message: GameMode,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: GameMode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.name !== undefined) {
|
||||
I18nString.encode(message.name, writer.uint32(10).fork()).join();
|
||||
}
|
||||
@@ -422,8 +356,7 @@ export const GameMode: MessageFns<GameMode> = {
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameMode {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameMode();
|
||||
while (reader.pos < end) {
|
||||
@@ -447,9 +380,7 @@ export const GameMode: MessageFns<GameMode> = {
|
||||
},
|
||||
|
||||
fromJSON(object: any): GameMode {
|
||||
return {
|
||||
name: I18nString.fromJSON(assertSet('GameMode.name', object.name)),
|
||||
};
|
||||
return { name: I18nString.fromJSON(assertSet("GameMode.name", object.name)) };
|
||||
},
|
||||
|
||||
toJSON(message: GameMode): unknown {
|
||||
@@ -465,10 +396,9 @@ export const GameMode: MessageFns<GameMode> = {
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameMode>, I>>(object: I): GameMode {
|
||||
const message = createBaseGameMode();
|
||||
message.name =
|
||||
object.name !== undefined && object.name !== null
|
||||
? I18nString.fromPartial(object.name)
|
||||
: createBaseI18nString();
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
? I18nString.fromPartial(object.name)
|
||||
: createBaseI18nString();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
@@ -478,10 +408,7 @@ function createBaseGameModeRole(): GameModeRole {
|
||||
}
|
||||
|
||||
export const GameModeRole: MessageFns<GameModeRole> = {
|
||||
encode(
|
||||
message: GameModeRole,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: GameModeRole, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
writer.uint32(10).fork();
|
||||
for (const v of message.provisions) {
|
||||
writer.uint32(v);
|
||||
@@ -496,8 +423,7 @@ export const GameModeRole: MessageFns<GameModeRole> = {
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): GameModeRole {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGameModeRole();
|
||||
while (reader.pos < end) {
|
||||
@@ -570,14 +496,10 @@ export const GameModeRole: MessageFns<GameModeRole> = {
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<GameModeRole>, I>>(
|
||||
base?: I,
|
||||
): GameModeRole {
|
||||
create<I extends Exact<DeepPartial<GameModeRole>, I>>(base?: I): GameModeRole {
|
||||
return GameModeRole.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(
|
||||
object: I,
|
||||
): GameModeRole {
|
||||
fromPartial<I extends Exact<DeepPartial<GameModeRole>, I>>(object: I): GameModeRole {
|
||||
const message = createBaseGameModeRole();
|
||||
message.provisions = object.provisions?.map((e) => e) || [];
|
||||
message.consumables = object.consumables?.map((e) => e) || [];
|
||||
@@ -585,36 +507,21 @@ export const GameModeRole: MessageFns<GameModeRole> = {
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown }
|
||||
? { $case: T['$case']; value?: DeepPartial<T['value']> }
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === 'object' && value !== null;
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// source: packages/core/src/protos/legacy_i18n.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = 'blitzkit';
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface I18nString {
|
||||
locales: { [key: string]: string };
|
||||
@@ -18,27 +18,20 @@ export interface I18nString_LocalesEntry {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function createBaseI18nString(): I18nString {
|
||||
function createBaseI18nString(): I18nString {
|
||||
return { locales: {} };
|
||||
}
|
||||
|
||||
export const I18nString: MessageFns<I18nString> = {
|
||||
encode(
|
||||
message: I18nString,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: I18nString, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
Object.entries(message.locales).forEach(([key, value]) => {
|
||||
I18nString_LocalesEntry.encode(
|
||||
{ key: key as any, value },
|
||||
writer.uint32(10).fork(),
|
||||
).join();
|
||||
I18nString_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
||||
});
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): I18nString {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseI18nString();
|
||||
while (reader.pos < end) {
|
||||
@@ -49,10 +42,7 @@ export const I18nString: MessageFns<I18nString> = {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry1 = I18nString_LocalesEntry.decode(
|
||||
reader,
|
||||
reader.uint32(),
|
||||
);
|
||||
const entry1 = I18nString_LocalesEntry.decode(reader, reader.uint32());
|
||||
if (entry1.value !== undefined) {
|
||||
message.locales[entry1.key] = entry1.value;
|
||||
}
|
||||
@@ -70,13 +60,10 @@ export const I18nString: MessageFns<I18nString> = {
|
||||
fromJSON(object: any): I18nString {
|
||||
return {
|
||||
locales: isObject(object.locales)
|
||||
? Object.entries(object.locales).reduce<{ [key: string]: string }>(
|
||||
(acc, [key, value]) => {
|
||||
acc[key] = String(value);
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
)
|
||||
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
||||
acc[key] = String(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
};
|
||||
},
|
||||
@@ -98,13 +85,9 @@ export const I18nString: MessageFns<I18nString> = {
|
||||
create<I extends Exact<DeepPartial<I18nString>, I>>(base?: I): I18nString {
|
||||
return I18nString.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(
|
||||
object: I,
|
||||
): I18nString {
|
||||
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(object: I): I18nString {
|
||||
const message = createBaseI18nString();
|
||||
message.locales = Object.entries(object.locales ?? {}).reduce<{
|
||||
[key: string]: string;
|
||||
}>((acc, [key, value]) => {
|
||||
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = globalThis.String(value);
|
||||
}
|
||||
@@ -115,14 +98,11 @@ export const I18nString: MessageFns<I18nString> = {
|
||||
};
|
||||
|
||||
function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry {
|
||||
return { key: '', value: '' };
|
||||
return { key: "", value: "" };
|
||||
}
|
||||
|
||||
export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
|
||||
encode(
|
||||
message: I18nString_LocalesEntry,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
@@ -132,12 +112,8 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: BinaryReader | Uint8Array,
|
||||
length?: number,
|
||||
): I18nString_LocalesEntry {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): I18nString_LocalesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseI18nString_LocalesEntry();
|
||||
while (reader.pos < end) {
|
||||
@@ -170,12 +146,8 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
|
||||
|
||||
fromJSON(object: any): I18nString_LocalesEntry {
|
||||
return {
|
||||
key: globalThis.String(
|
||||
assertSet('I18nString_LocalesEntry.key', object.key),
|
||||
),
|
||||
value: globalThis.String(
|
||||
assertSet('I18nString_LocalesEntry.value', object.value),
|
||||
),
|
||||
key: globalThis.String(assertSet("I18nString_LocalesEntry.key", object.key)),
|
||||
value: globalThis.String(assertSet("I18nString_LocalesEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
@@ -190,51 +162,32 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(
|
||||
base?: I,
|
||||
): I18nString_LocalesEntry {
|
||||
create<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(base?: I): I18nString_LocalesEntry {
|
||||
return I18nString_LocalesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(
|
||||
object: I,
|
||||
): I18nString_LocalesEntry {
|
||||
fromPartial<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(object: I): I18nString_LocalesEntry {
|
||||
const message = createBaseI18nString_LocalesEntry();
|
||||
message.key = object.key ?? '';
|
||||
message.value = object.value ?? '';
|
||||
message.key = object.key ?? "";
|
||||
message.value = object.value ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown }
|
||||
? { $case: T['$case']; value?: DeepPartial<T['value']> }
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === 'object' && value !== null;
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
// source: packages/core/src/protos/tank.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
|
||||
import { I18n, createBaseI18n } from './i18n';
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { I18n } from "./i18n";
|
||||
|
||||
export const protobufPackage = 'blitzkit';
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface Tank {
|
||||
id: string;
|
||||
@@ -17,18 +17,15 @@ export interface Tank {
|
||||
}
|
||||
|
||||
function createBaseTank(): Tank {
|
||||
return { id: '', slug: '', name: createBaseI18n() };
|
||||
return { id: "", slug: "", name: createBaseI18n() };
|
||||
}
|
||||
|
||||
export const Tank: MessageFns<Tank> = {
|
||||
encode(
|
||||
message: Tank,
|
||||
writer: BinaryWriter = new BinaryWriter(),
|
||||
): BinaryWriter {
|
||||
if (message.id !== '') {
|
||||
encode(message: Tank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.slug !== '') {
|
||||
if (message.slug !== "") {
|
||||
writer.uint32(18).string(message.slug);
|
||||
}
|
||||
if (message.name !== undefined) {
|
||||
@@ -38,8 +35,7 @@ export const Tank: MessageFns<Tank> = {
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Tank {
|
||||
const reader =
|
||||
input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTank();
|
||||
while (reader.pos < end) {
|
||||
@@ -80,18 +76,18 @@ export const Tank: MessageFns<Tank> = {
|
||||
|
||||
fromJSON(object: any): Tank {
|
||||
return {
|
||||
id: globalThis.String(assertSet('Tank.id', object.id)),
|
||||
slug: globalThis.String(assertSet('Tank.slug', object.slug)),
|
||||
name: I18n.fromJSON(assertSet('Tank.name', object.name)),
|
||||
id: globalThis.String(assertSet("Tank.id", object.id)),
|
||||
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
|
||||
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Tank): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== '') {
|
||||
if (message.id !== "") {
|
||||
obj.id = message.id;
|
||||
}
|
||||
if (message.slug !== '') {
|
||||
if (message.slug !== "") {
|
||||
obj.slug = message.slug;
|
||||
}
|
||||
if (message.name !== undefined) {
|
||||
@@ -105,43 +101,27 @@ export const Tank: MessageFns<Tank> = {
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank {
|
||||
const message = createBaseTank();
|
||||
message.id = object.id ?? '';
|
||||
message.slug = object.slug ?? '';
|
||||
message.name =
|
||||
object.name !== undefined && object.name !== null
|
||||
? I18n.fromPartial(object.name)
|
||||
: createBaseI18n();
|
||||
message.id = object.id ?? "";
|
||||
message.slug = object.slug ?? "";
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
? I18n.fromPartial(object.name)
|
||||
: createBaseI18n();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends globalThis.Array<infer U>
|
||||
? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown }
|
||||
? { $case: T['$case']; value?: DeepPartial<T['value']> }
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "packages/core/src/protos/tank.proto";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message Tanks {
|
||||
repeated TankMeta tanks = 1;
|
||||
repeated string tanks = 1;
|
||||
}
|
||||
|
||||
message TankMeta {
|
||||
required string id = 1;
|
||||
required string slug = 2;
|
||||
message TanksFull {
|
||||
repeated Tank tanks = 1;
|
||||
}
|
||||
@@ -6,16 +6,16 @@
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Tank } from "./tank";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface Tanks {
|
||||
tanks: TankMeta[];
|
||||
tanks: string[];
|
||||
}
|
||||
|
||||
export interface TankMeta {
|
||||
id: string;
|
||||
slug: string;
|
||||
export interface TanksFull {
|
||||
tanks: Tank[];
|
||||
}
|
||||
|
||||
function createBaseTanks(): Tanks {
|
||||
@@ -25,7 +25,7 @@ function createBaseTanks(): Tanks {
|
||||
export const Tanks: MessageFns<Tanks> = {
|
||||
encode(message: Tanks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.tanks) {
|
||||
TankMeta.encode(v!, writer.uint32(10).fork()).join();
|
||||
writer.uint32(10).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
@@ -42,7 +42,7 @@ export const Tanks: MessageFns<Tanks> = {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tanks.push(TankMeta.decode(reader, reader.uint32()));
|
||||
message.tanks.push(reader.string());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,13 @@ export const Tanks: MessageFns<Tanks> = {
|
||||
},
|
||||
|
||||
fromJSON(object: any): Tanks {
|
||||
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => TankMeta.fromJSON(e)) : [] };
|
||||
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => globalThis.String(e)) : [] };
|
||||
},
|
||||
|
||||
toJSON(message: Tanks): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tanks?.length) {
|
||||
obj.tanks = message.tanks.map((e) => TankMeta.toJSON(e));
|
||||
obj.tanks = message.tanks;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
@@ -71,30 +71,27 @@ export const Tanks: MessageFns<Tanks> = {
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Tanks>, I>>(object: I): Tanks {
|
||||
const message = createBaseTanks();
|
||||
message.tanks = object.tanks?.map((e) => TankMeta.fromPartial(e)) || [];
|
||||
message.tanks = object.tanks?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTankMeta(): TankMeta {
|
||||
return { id: "", slug: "" };
|
||||
function createBaseTanksFull(): TanksFull {
|
||||
return { tanks: [] };
|
||||
}
|
||||
|
||||
export const TankMeta: MessageFns<TankMeta> = {
|
||||
encode(message: TankMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== "") {
|
||||
writer.uint32(10).string(message.id);
|
||||
}
|
||||
if (message.slug !== "") {
|
||||
writer.uint32(18).string(message.slug);
|
||||
export const TanksFull: MessageFns<TanksFull> = {
|
||||
encode(message: TanksFull, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.tanks) {
|
||||
Tank.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TankMeta {
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TanksFull {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTankMeta();
|
||||
const message = createBaseTanksFull();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
@@ -103,15 +100,7 @@ export const TankMeta: MessageFns<TankMeta> = {
|
||||
break;
|
||||
}
|
||||
|
||||
message.id = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.slug = reader.string();
|
||||
message.tanks.push(Tank.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -123,31 +112,24 @@ export const TankMeta: MessageFns<TankMeta> = {
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TankMeta {
|
||||
return {
|
||||
id: globalThis.String(assertSet("TankMeta.id", object.id)),
|
||||
slug: globalThis.String(assertSet("TankMeta.slug", object.slug)),
|
||||
};
|
||||
fromJSON(object: any): TanksFull {
|
||||
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] };
|
||||
},
|
||||
|
||||
toJSON(message: TankMeta): unknown {
|
||||
toJSON(message: TanksFull): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== "") {
|
||||
obj.id = message.id;
|
||||
}
|
||||
if (message.slug !== "") {
|
||||
obj.slug = message.slug;
|
||||
if (message.tanks?.length) {
|
||||
obj.tanks = message.tanks.map((e) => Tank.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<TankMeta>, I>>(base?: I): TankMeta {
|
||||
return TankMeta.fromPartial(base ?? ({} as any));
|
||||
create<I extends Exact<DeepPartial<TanksFull>, I>>(base?: I): TanksFull {
|
||||
return TanksFull.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<TankMeta>, I>>(object: I): TankMeta {
|
||||
const message = createBaseTankMeta();
|
||||
message.id = object.id ?? "";
|
||||
message.slug = object.slug ?? "";
|
||||
fromPartial<I extends Exact<DeepPartial<TanksFull>, I>>(object: I): TanksFull {
|
||||
const message = createBaseTanksFull();
|
||||
message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
@@ -165,18 +147,6 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
function assertSet<T>(field: string, value: T | undefined): T {
|
||||
if (!isSet(value)) {
|
||||
throw new TypeError(`Required field ${field} is not set`);
|
||||
}
|
||||
|
||||
return value as T;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
|
||||
Reference in new issue
Block a user