mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: protos
This commit is contained in:
1 parent
a8dc3313cf
commit
f26711bad9
4 files changed
+329
-256
No files matched your search
@@ -6,7 +6,6 @@
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Tank } from "./tank";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
@@ -14,10 +13,6 @@ export interface Tanks {
|
||||
tanks: string[];
|
||||
}
|
||||
|
||||
export interface TanksFull {
|
||||
tanks: Tank[];
|
||||
}
|
||||
|
||||
function createBaseTanks(): Tanks {
|
||||
return { tanks: [] };
|
||||
}
|
||||
@@ -76,64 +71,6 @@ export const Tanks: MessageFns<Tanks> = {
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTanksFull(): TanksFull {
|
||||
return { tanks: [] };
|
||||
}
|
||||
|
||||
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): TanksFull {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTanksFull();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tanks.push(Tank.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TanksFull {
|
||||
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] };
|
||||
},
|
||||
|
||||
toJSON(message: TanksFull): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tanks?.length) {
|
||||
obj.tanks = message.tanks.map((e) => Tank.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<TanksFull>, I>>(base?: I): TanksFull {
|
||||
return TanksFull.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<TanksFull>, I>>(object: I): TanksFull {
|
||||
const message = createBaseTanksFull();
|
||||
message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/tanks_full.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Tank } from "./tank";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface TanksFull {
|
||||
tanks: Tank[];
|
||||
}
|
||||
|
||||
function createBaseTanksFull(): TanksFull {
|
||||
return { tanks: [] };
|
||||
}
|
||||
|
||||
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): TanksFull {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTanksFull();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.tanks.push(Tank.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TanksFull {
|
||||
return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => Tank.fromJSON(e)) : [] };
|
||||
},
|
||||
|
||||
toJSON(message: TanksFull): unknown {
|
||||
const obj: any = {};
|
||||
if (message.tanks?.length) {
|
||||
obj.tanks = message.tanks.map((e) => Tank.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<TanksFull>, I>>(base?: I): TanksFull {
|
||||
return TanksFull.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<TanksFull>, I>>(object: I): TanksFull {
|
||||
const message = createBaseTanksFull();
|
||||
message.tanks = object.tanks?.map((e) => Tank.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
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>;
|
||||
|
||||
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 interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
||||
}
|
||||
Reference in new issue
Block a user