add reflection service to valut
This commit is contained in:
@@ -3,8 +3,6 @@ FROM node:22.16
|
|||||||
WORKDIR /srv/proto
|
WORKDIR /srv/proto
|
||||||
|
|
||||||
COPY proto/ .
|
COPY proto/ .
|
||||||
# RUN npm install
|
|
||||||
# RUN npm run build
|
|
||||||
|
|
||||||
WORKDIR /srv/vault
|
WORKDIR /srv/vault
|
||||||
|
|
||||||
|
|||||||
@@ -3,258 +3,371 @@
|
|||||||
* compiler version: 3.20.3
|
* compiler version: 3.20.3
|
||||||
* source: character.proto
|
* source: character.proto
|
||||||
* git: https://github.com/thesayyn/protoc-gen-ts */
|
* git: https://github.com/thesayyn/protoc-gen-ts */
|
||||||
import * as pb_1 from "google-protobuf";
|
import * as pb_1 from 'google-protobuf'
|
||||||
import * as grpc_1 from "@grpc/grpc-js";
|
import * as grpc_1 from '@grpc/grpc-js'
|
||||||
export class Character extends pb_1.Message {
|
export class Character extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = []
|
||||||
constructor(data?: any[] | {
|
constructor(
|
||||||
PlayerName?: string;
|
data?:
|
||||||
CharacterName?: string;
|
| any[]
|
||||||
CharacterAlias?: string[];
|
| {
|
||||||
}) {
|
PlayerName?: string
|
||||||
super();
|
CharacterName?: string
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], this.#one_of_decls);
|
CharacterAlias?: string[]
|
||||||
if (!Array.isArray(data) && typeof data == "object") {
|
},
|
||||||
if ("PlayerName" in data && data.PlayerName != undefined) {
|
) {
|
||||||
this.PlayerName = data.PlayerName;
|
super()
|
||||||
}
|
pb_1.Message.initialize(
|
||||||
if ("CharacterName" in data && data.CharacterName != undefined) {
|
this,
|
||||||
this.CharacterName = data.CharacterName;
|
Array.isArray(data) ? data : [],
|
||||||
}
|
0,
|
||||||
if ("CharacterAlias" in data && data.CharacterAlias != undefined) {
|
-1,
|
||||||
this.CharacterAlias = data.CharacterAlias;
|
[3],
|
||||||
}
|
this.#one_of_decls,
|
||||||
}
|
)
|
||||||
|
if (!Array.isArray(data) && typeof data == 'object') {
|
||||||
|
if ('PlayerName' in data && data.PlayerName != undefined) {
|
||||||
|
this.PlayerName = data.PlayerName
|
||||||
|
}
|
||||||
|
if ('CharacterName' in data && data.CharacterName != undefined) {
|
||||||
|
this.CharacterName = data.CharacterName
|
||||||
|
}
|
||||||
|
if ('CharacterAlias' in data && data.CharacterAlias != undefined) {
|
||||||
|
this.CharacterAlias = data.CharacterAlias
|
||||||
|
}
|
||||||
}
|
}
|
||||||
get PlayerName() {
|
}
|
||||||
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
|
get PlayerName() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 1, '') as string
|
||||||
|
}
|
||||||
|
set PlayerName(value: string) {
|
||||||
|
pb_1.Message.setField(this, 1, value)
|
||||||
|
}
|
||||||
|
get CharacterName() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 2, '') as string
|
||||||
|
}
|
||||||
|
set CharacterName(value: string) {
|
||||||
|
pb_1.Message.setField(this, 2, value)
|
||||||
|
}
|
||||||
|
get CharacterAlias() {
|
||||||
|
return pb_1.Message.getFieldWithDefault(this, 3, []) as string[]
|
||||||
|
}
|
||||||
|
set CharacterAlias(value: string[]) {
|
||||||
|
pb_1.Message.setField(this, 3, value)
|
||||||
|
}
|
||||||
|
static fromObject(data: {
|
||||||
|
PlayerName?: string
|
||||||
|
CharacterName?: string
|
||||||
|
CharacterAlias?: string[]
|
||||||
|
}): Character {
|
||||||
|
const message = new Character({})
|
||||||
|
if (data.PlayerName != null) {
|
||||||
|
message.PlayerName = data.PlayerName
|
||||||
}
|
}
|
||||||
set PlayerName(value: string) {
|
if (data.CharacterName != null) {
|
||||||
pb_1.Message.setField(this, 1, value);
|
message.CharacterName = data.CharacterName
|
||||||
}
|
}
|
||||||
get CharacterName() {
|
if (data.CharacterAlias != null) {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
|
message.CharacterAlias = data.CharacterAlias
|
||||||
}
|
}
|
||||||
set CharacterName(value: string) {
|
return message
|
||||||
pb_1.Message.setField(this, 2, value);
|
}
|
||||||
|
toObject() {
|
||||||
|
const data: {
|
||||||
|
PlayerName?: string
|
||||||
|
CharacterName?: string
|
||||||
|
CharacterAlias?: string[]
|
||||||
|
} = {}
|
||||||
|
if (this.PlayerName != null) {
|
||||||
|
data.PlayerName = this.PlayerName
|
||||||
}
|
}
|
||||||
get CharacterAlias() {
|
if (this.CharacterName != null) {
|
||||||
return pb_1.Message.getFieldWithDefault(this, 3, []) as string[];
|
data.CharacterName = this.CharacterName
|
||||||
}
|
}
|
||||||
set CharacterAlias(value: string[]) {
|
if (this.CharacterAlias != null) {
|
||||||
pb_1.Message.setField(this, 3, value);
|
data.CharacterAlias = this.CharacterAlias
|
||||||
}
|
}
|
||||||
static fromObject(data: {
|
return data
|
||||||
PlayerName?: string;
|
}
|
||||||
CharacterName?: string;
|
serialize(): Uint8Array
|
||||||
CharacterAlias?: string[];
|
serialize(w: pb_1.BinaryWriter): void
|
||||||
}): Character {
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
const message = new Character({});
|
const writer = w || new pb_1.BinaryWriter()
|
||||||
if (data.PlayerName != null) {
|
if (this.PlayerName.length) writer.writeString(1, this.PlayerName)
|
||||||
message.PlayerName = data.PlayerName;
|
if (this.CharacterName.length) writer.writeString(2, this.CharacterName)
|
||||||
}
|
if (this.CharacterAlias.length)
|
||||||
if (data.CharacterName != null) {
|
writer.writeRepeatedString(3, this.CharacterAlias)
|
||||||
message.CharacterName = data.CharacterName;
|
if (!w) return writer.getResultBuffer()
|
||||||
}
|
}
|
||||||
if (data.CharacterAlias != null) {
|
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Character {
|
||||||
message.CharacterAlias = data.CharacterAlias;
|
const reader =
|
||||||
}
|
bytes instanceof pb_1.BinaryReader
|
||||||
return message;
|
? bytes
|
||||||
}
|
: new pb_1.BinaryReader(bytes),
|
||||||
toObject() {
|
message = new Character()
|
||||||
const data: {
|
while (reader.nextField()) {
|
||||||
PlayerName?: string;
|
if (reader.isEndGroup()) break
|
||||||
CharacterName?: string;
|
switch (reader.getFieldNumber()) {
|
||||||
CharacterAlias?: string[];
|
case 1:
|
||||||
} = {};
|
message.PlayerName = reader.readString()
|
||||||
if (this.PlayerName != null) {
|
break
|
||||||
data.PlayerName = this.PlayerName;
|
case 2:
|
||||||
}
|
message.CharacterName = reader.readString()
|
||||||
if (this.CharacterName != null) {
|
break
|
||||||
data.CharacterName = this.CharacterName;
|
case 3:
|
||||||
}
|
pb_1.Message.addToRepeatedField(message, 3, reader.readString())
|
||||||
if (this.CharacterAlias != null) {
|
break
|
||||||
data.CharacterAlias = this.CharacterAlias;
|
default:
|
||||||
}
|
reader.skipField()
|
||||||
return data;
|
}
|
||||||
}
|
|
||||||
serialize(): Uint8Array;
|
|
||||||
serialize(w: pb_1.BinaryWriter): void;
|
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
|
||||||
if (this.PlayerName.length)
|
|
||||||
writer.writeString(1, this.PlayerName);
|
|
||||||
if (this.CharacterName.length)
|
|
||||||
writer.writeString(2, this.CharacterName);
|
|
||||||
if (this.CharacterAlias.length)
|
|
||||||
writer.writeRepeatedString(3, this.CharacterAlias);
|
|
||||||
if (!w)
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
}
|
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Character {
|
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Character();
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup())
|
|
||||||
break;
|
|
||||||
switch (reader.getFieldNumber()) {
|
|
||||||
case 1:
|
|
||||||
message.PlayerName = reader.readString();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
message.CharacterName = reader.readString();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
pb_1.Message.addToRepeatedField(message, 3, reader.readString());
|
|
||||||
break;
|
|
||||||
default: reader.skipField();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
serializeBinary(): Uint8Array {
|
|
||||||
return this.serialize();
|
|
||||||
}
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Character {
|
|
||||||
return Character.deserialize(bytes);
|
|
||||||
}
|
}
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize()
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): Character {
|
||||||
|
return Character.deserialize(bytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export class CreateCharacterRequest extends pb_1.Message {
|
export class CreateCharacterRequest extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = []
|
||||||
constructor(data?: any[] | {}) {
|
constructor(data?: any[] | {}) {
|
||||||
super();
|
super()
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
pb_1.Message.initialize(
|
||||||
if (!Array.isArray(data) && typeof data == "object") { }
|
this,
|
||||||
|
Array.isArray(data) ? data : [],
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
[],
|
||||||
|
this.#one_of_decls,
|
||||||
|
)
|
||||||
|
if (!Array.isArray(data) && typeof data == 'object') {
|
||||||
}
|
}
|
||||||
static fromObject(data: {}): CreateCharacterRequest {
|
}
|
||||||
const message = new CreateCharacterRequest({});
|
static fromObject(data: {}): CreateCharacterRequest {
|
||||||
return message;
|
const message = new CreateCharacterRequest({})
|
||||||
}
|
return message
|
||||||
toObject() {
|
}
|
||||||
const data: {} = {};
|
toObject() {
|
||||||
return data;
|
const data: {} = {}
|
||||||
}
|
return data
|
||||||
serialize(): Uint8Array;
|
}
|
||||||
serialize(w: pb_1.BinaryWriter): void;
|
serialize(): Uint8Array
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
serialize(w: pb_1.BinaryWriter): void
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
if (!w)
|
const writer = w || new pb_1.BinaryWriter()
|
||||||
return writer.getResultBuffer();
|
if (!w) return writer.getResultBuffer()
|
||||||
}
|
}
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CreateCharacterRequest {
|
static deserialize(
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CreateCharacterRequest();
|
bytes: Uint8Array | pb_1.BinaryReader,
|
||||||
while (reader.nextField()) {
|
): CreateCharacterRequest {
|
||||||
if (reader.isEndGroup())
|
const reader =
|
||||||
break;
|
bytes instanceof pb_1.BinaryReader
|
||||||
switch (reader.getFieldNumber()) {
|
? bytes
|
||||||
default: reader.skipField();
|
: new pb_1.BinaryReader(bytes),
|
||||||
}
|
message = new CreateCharacterRequest()
|
||||||
}
|
while (reader.nextField()) {
|
||||||
return message;
|
if (reader.isEndGroup()) break
|
||||||
}
|
switch (reader.getFieldNumber()) {
|
||||||
serializeBinary(): Uint8Array {
|
default:
|
||||||
return this.serialize();
|
reader.skipField()
|
||||||
}
|
}
|
||||||
static deserializeBinary(bytes: Uint8Array): CreateCharacterRequest {
|
|
||||||
return CreateCharacterRequest.deserialize(bytes);
|
|
||||||
}
|
}
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize()
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): CreateCharacterRequest {
|
||||||
|
return CreateCharacterRequest.deserialize(bytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export class GetCharacterRequest extends pb_1.Message {
|
export class GetCharacterRequest extends pb_1.Message {
|
||||||
#one_of_decls: number[][] = [];
|
#one_of_decls: number[][] = []
|
||||||
constructor(data?: any[] | {}) {
|
constructor(data?: any[] | {}) {
|
||||||
super();
|
super()
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
pb_1.Message.initialize(
|
||||||
if (!Array.isArray(data) && typeof data == "object") { }
|
this,
|
||||||
|
Array.isArray(data) ? data : [],
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
[],
|
||||||
|
this.#one_of_decls,
|
||||||
|
)
|
||||||
|
if (!Array.isArray(data) && typeof data == 'object') {
|
||||||
}
|
}
|
||||||
static fromObject(data: {}): GetCharacterRequest {
|
}
|
||||||
const message = new GetCharacterRequest({});
|
static fromObject(data: {}): GetCharacterRequest {
|
||||||
return message;
|
const message = new GetCharacterRequest({})
|
||||||
}
|
return message
|
||||||
toObject() {
|
}
|
||||||
const data: {} = {};
|
toObject() {
|
||||||
return data;
|
const data: {} = {}
|
||||||
}
|
return data
|
||||||
serialize(): Uint8Array;
|
}
|
||||||
serialize(w: pb_1.BinaryWriter): void;
|
serialize(): Uint8Array
|
||||||
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
serialize(w: pb_1.BinaryWriter): void
|
||||||
const writer = w || new pb_1.BinaryWriter();
|
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
|
||||||
if (!w)
|
const writer = w || new pb_1.BinaryWriter()
|
||||||
return writer.getResultBuffer();
|
if (!w) return writer.getResultBuffer()
|
||||||
}
|
}
|
||||||
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetCharacterRequest {
|
static deserialize(
|
||||||
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetCharacterRequest();
|
bytes: Uint8Array | pb_1.BinaryReader,
|
||||||
while (reader.nextField()) {
|
): GetCharacterRequest {
|
||||||
if (reader.isEndGroup())
|
const reader =
|
||||||
break;
|
bytes instanceof pb_1.BinaryReader
|
||||||
switch (reader.getFieldNumber()) {
|
? bytes
|
||||||
default: reader.skipField();
|
: new pb_1.BinaryReader(bytes),
|
||||||
}
|
message = new GetCharacterRequest()
|
||||||
}
|
while (reader.nextField()) {
|
||||||
return message;
|
if (reader.isEndGroup()) break
|
||||||
}
|
switch (reader.getFieldNumber()) {
|
||||||
serializeBinary(): Uint8Array {
|
default:
|
||||||
return this.serialize();
|
reader.skipField()
|
||||||
}
|
}
|
||||||
static deserializeBinary(bytes: Uint8Array): GetCharacterRequest {
|
|
||||||
return GetCharacterRequest.deserialize(bytes);
|
|
||||||
}
|
}
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
serializeBinary(): Uint8Array {
|
||||||
|
return this.serialize()
|
||||||
|
}
|
||||||
|
static deserializeBinary(bytes: Uint8Array): GetCharacterRequest {
|
||||||
|
return GetCharacterRequest.deserialize(bytes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
interface GrpcUnaryServiceInterface<P, R> {
|
interface GrpcUnaryServiceInterface<P, R> {
|
||||||
(message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
|
(
|
||||||
(message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
|
message: P,
|
||||||
(message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
|
metadata: grpc_1.Metadata,
|
||||||
(message: P, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
|
options: grpc_1.CallOptions,
|
||||||
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientUnaryCall
|
||||||
|
(
|
||||||
|
message: P,
|
||||||
|
metadata: grpc_1.Metadata,
|
||||||
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientUnaryCall
|
||||||
|
(
|
||||||
|
message: P,
|
||||||
|
options: grpc_1.CallOptions,
|
||||||
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientUnaryCall
|
||||||
|
(message: P, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall
|
||||||
}
|
}
|
||||||
interface GrpcStreamServiceInterface<P, R> {
|
interface GrpcStreamServiceInterface<P, R> {
|
||||||
(message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream<R>;
|
(
|
||||||
(message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream<R>;
|
message: P,
|
||||||
|
metadata: grpc_1.Metadata,
|
||||||
|
options?: grpc_1.CallOptions,
|
||||||
|
): grpc_1.ClientReadableStream<R>
|
||||||
|
(message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream<R>
|
||||||
}
|
}
|
||||||
interface GrpWritableServiceInterface<P, R> {
|
interface GrpWritableServiceInterface<P, R> {
|
||||||
(metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
|
(
|
||||||
(metadata: grpc_1.Metadata, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
|
metadata: grpc_1.Metadata,
|
||||||
(options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
|
options: grpc_1.CallOptions,
|
||||||
(callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>;
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientWritableStream<P>
|
||||||
|
(
|
||||||
|
metadata: grpc_1.Metadata,
|
||||||
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientWritableStream<P>
|
||||||
|
(
|
||||||
|
options: grpc_1.CallOptions,
|
||||||
|
callback: grpc_1.requestCallback<R>,
|
||||||
|
): grpc_1.ClientWritableStream<P>
|
||||||
|
(callback: grpc_1.requestCallback<R>): grpc_1.ClientWritableStream<P>
|
||||||
}
|
}
|
||||||
interface GrpcChunkServiceInterface<P, R> {
|
interface GrpcChunkServiceInterface<P, R> {
|
||||||
(metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream<P, R>;
|
(
|
||||||
(options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream<P, R>;
|
metadata: grpc_1.Metadata,
|
||||||
|
options?: grpc_1.CallOptions,
|
||||||
|
): grpc_1.ClientDuplexStream<P, R>
|
||||||
|
(options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream<P, R>
|
||||||
}
|
}
|
||||||
interface GrpcPromiseServiceInterface<P, R> {
|
interface GrpcPromiseServiceInterface<P, R> {
|
||||||
(message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise<R>;
|
(
|
||||||
(message: P, options?: grpc_1.CallOptions): Promise<R>;
|
message: P,
|
||||||
|
metadata: grpc_1.Metadata,
|
||||||
|
options?: grpc_1.CallOptions,
|
||||||
|
): Promise<R>
|
||||||
|
(message: P, options?: grpc_1.CallOptions): Promise<R>
|
||||||
}
|
}
|
||||||
export abstract class UnimplementedCharacterManagerService {
|
export abstract class UnimplementedCharacterManagerService {
|
||||||
static definition = {
|
static definition = {
|
||||||
createCharacter: {
|
createCharacter: {
|
||||||
path: "/CharacterManager/createCharacter",
|
path: '/CharacterManager/createCharacter',
|
||||||
requestStream: false,
|
requestStream: false,
|
||||||
responseStream: false,
|
responseStream: false,
|
||||||
requestSerialize: (message: CreateCharacterRequest) => Buffer.from(message.serialize()),
|
requestSerialize: (message: CreateCharacterRequest) =>
|
||||||
requestDeserialize: (bytes: Buffer) => CreateCharacterRequest.deserialize(new Uint8Array(bytes)),
|
Buffer.from(message.serialize()),
|
||||||
responseSerialize: (message: Character) => Buffer.from(message.serialize()),
|
requestDeserialize: (bytes: Buffer) =>
|
||||||
responseDeserialize: (bytes: Buffer) => Character.deserialize(new Uint8Array(bytes))
|
CreateCharacterRequest.deserialize(new Uint8Array(bytes)),
|
||||||
},
|
responseSerialize: (message: Character) =>
|
||||||
getCharacter: {
|
Buffer.from(message.serialize()),
|
||||||
path: "/CharacterManager/getCharacter",
|
responseDeserialize: (bytes: Buffer) =>
|
||||||
requestStream: false,
|
Character.deserialize(new Uint8Array(bytes)),
|
||||||
responseStream: false,
|
},
|
||||||
requestSerialize: (message: GetCharacterRequest) => Buffer.from(message.serialize()),
|
getCharacter: {
|
||||||
requestDeserialize: (bytes: Buffer) => GetCharacterRequest.deserialize(new Uint8Array(bytes)),
|
path: '/CharacterManager/getCharacter',
|
||||||
responseSerialize: (message: Character) => Buffer.from(message.serialize()),
|
requestStream: false,
|
||||||
responseDeserialize: (bytes: Buffer) => Character.deserialize(new Uint8Array(bytes))
|
responseStream: false,
|
||||||
}
|
requestSerialize: (message: GetCharacterRequest) =>
|
||||||
};
|
Buffer.from(message.serialize()),
|
||||||
[method: string]: grpc_1.UntypedHandleCall;
|
requestDeserialize: (bytes: Buffer) =>
|
||||||
abstract createCharacter(call: grpc_1.ServerUnaryCall<CreateCharacterRequest, Character>, callback: grpc_1.sendUnaryData<Character>): void;
|
GetCharacterRequest.deserialize(new Uint8Array(bytes)),
|
||||||
abstract getCharacter(call: grpc_1.ServerUnaryCall<GetCharacterRequest, Character>, callback: grpc_1.sendUnaryData<Character>): void;
|
responseSerialize: (message: Character) =>
|
||||||
|
Buffer.from(message.serialize()),
|
||||||
|
responseDeserialize: (bytes: Buffer) =>
|
||||||
|
Character.deserialize(new Uint8Array(bytes)),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
[method: string]: grpc_1.UntypedHandleCall
|
||||||
|
abstract createCharacter(
|
||||||
|
call: grpc_1.ServerUnaryCall<CreateCharacterRequest, Character>,
|
||||||
|
callback: grpc_1.sendUnaryData<Character>,
|
||||||
|
): void
|
||||||
|
abstract getCharacter(
|
||||||
|
call: grpc_1.ServerUnaryCall<GetCharacterRequest, Character>,
|
||||||
|
callback: grpc_1.sendUnaryData<Character>,
|
||||||
|
): void
|
||||||
}
|
}
|
||||||
export class CharacterManagerClient extends grpc_1.makeGenericClientConstructor(UnimplementedCharacterManagerService.definition, "CharacterManager", {}) {
|
export class CharacterManagerClient extends grpc_1.makeGenericClientConstructor(
|
||||||
constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial<grpc_1.ChannelOptions>) {
|
UnimplementedCharacterManagerService.definition,
|
||||||
super(address, credentials, options);
|
'CharacterManager',
|
||||||
}
|
{},
|
||||||
createCharacter: GrpcUnaryServiceInterface<CreateCharacterRequest, Character> = (message: CreateCharacterRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<Character>, options?: grpc_1.CallOptions | grpc_1.requestCallback<Character>, callback?: grpc_1.requestCallback<Character>): grpc_1.ClientUnaryCall => {
|
) {
|
||||||
return super.createCharacter(message, metadata, options, callback);
|
constructor(
|
||||||
};
|
address: string,
|
||||||
getCharacter: GrpcUnaryServiceInterface<GetCharacterRequest, Character> = (message: GetCharacterRequest, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<Character>, options?: grpc_1.CallOptions | grpc_1.requestCallback<Character>, callback?: grpc_1.requestCallback<Character>): grpc_1.ClientUnaryCall => {
|
credentials: grpc_1.ChannelCredentials,
|
||||||
return super.getCharacter(message, metadata, options, callback);
|
options?: Partial<grpc_1.ChannelOptions>,
|
||||||
};
|
) {
|
||||||
|
super(address, credentials, options)
|
||||||
|
}
|
||||||
|
createCharacter: GrpcUnaryServiceInterface<
|
||||||
|
CreateCharacterRequest,
|
||||||
|
Character
|
||||||
|
> = (
|
||||||
|
message: CreateCharacterRequest,
|
||||||
|
metadata:
|
||||||
|
| grpc_1.Metadata
|
||||||
|
| grpc_1.CallOptions
|
||||||
|
| grpc_1.requestCallback<Character>,
|
||||||
|
options?: grpc_1.CallOptions | grpc_1.requestCallback<Character>,
|
||||||
|
callback?: grpc_1.requestCallback<Character>,
|
||||||
|
): grpc_1.ClientUnaryCall => {
|
||||||
|
return super.createCharacter(message, metadata, options, callback)
|
||||||
|
}
|
||||||
|
getCharacter: GrpcUnaryServiceInterface<GetCharacterRequest, Character> = (
|
||||||
|
message: GetCharacterRequest,
|
||||||
|
metadata:
|
||||||
|
| grpc_1.Metadata
|
||||||
|
| grpc_1.CallOptions
|
||||||
|
| grpc_1.requestCallback<Character>,
|
||||||
|
options?: grpc_1.CallOptions | grpc_1.requestCallback<Character>,
|
||||||
|
callback?: grpc_1.requestCallback<Character>,
|
||||||
|
): grpc_1.ClientUnaryCall => {
|
||||||
|
return super.getCharacter(message, metadata, options, callback)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
vault/package-lock.json
generated
15
vault/package-lock.json
generated
@@ -10,6 +10,8 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.13.4",
|
"@grpc/grpc-js": "^1.13.4",
|
||||||
|
"@grpc/proto-loader": "^0.7.15",
|
||||||
|
"@grpc/reflection": "^1.0.4",
|
||||||
"@protobuf-ts/protoc": "^2.11.0",
|
"@protobuf-ts/protoc": "^2.11.0",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"google-protobuf": "^3.21.4",
|
"google-protobuf": "^3.21.4",
|
||||||
@@ -260,6 +262,19 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@grpc/reflection": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@grpc/reflection/-/reflection-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-znA8v4AviOD3OPOxy11pxrtP8k8DanpefeTymS8iGW1fVr1U2cHuzfhYqDPHnVNDf4qvF9E25KtSihPy2DBWfQ==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@grpc/proto-loader": "^0.7.13",
|
||||||
|
"protobufjs": "^7.2.5"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@grpc/grpc-js": "^1.8.21"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@humanfs/core": {
|
"node_modules/@humanfs/core": {
|
||||||
"version": "0.19.1",
|
"version": "0.19.1",
|
||||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"description": "backend for rush cahracter archive",
|
"description": "backend for rush cahracter archive",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build_protos": "mkdir -p src/proto & npx protoc -I=../proto/ --ts_out=server_grpc1:./src/proto --proto_path ../proto ../proto/*.proto",
|
"build_protos": "mkdir -p src/proto && npx protoc -I=../proto/ --ts_out=server_grpc1:./src/proto --proto_path ../proto ../proto/*.proto && cp ../proto/*.proto ./src/proto",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "tsc && node dist/app.js",
|
"start": "tsc && node dist/app.js",
|
||||||
"dev": "npx ts-node-dev src/app.ts",
|
"dev": "npx ts-node-dev src/app.ts",
|
||||||
@@ -29,6 +29,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.13.4",
|
"@grpc/grpc-js": "^1.13.4",
|
||||||
|
"@grpc/proto-loader": "^0.7.15",
|
||||||
|
"@grpc/reflection": "^1.0.4",
|
||||||
"@protobuf-ts/protoc": "^2.11.0",
|
"@protobuf-ts/protoc": "^2.11.0",
|
||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"google-protobuf": "^3.21.4",
|
"google-protobuf": "^3.21.4",
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import { Server, ServerUnaryCall, sendUnaryData } from '@grpc/grpc-js'
|
import {
|
||||||
|
Server,
|
||||||
|
ServerUnaryCall,
|
||||||
|
sendUnaryData,
|
||||||
|
loadPackageDefinition,
|
||||||
|
} from '@grpc/grpc-js'
|
||||||
|
import { ReflectionService } from '@grpc/reflection'
|
||||||
|
import { loadSync } from '@grpc/proto-loader'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Character,
|
Character,
|
||||||
@@ -6,35 +13,45 @@ import {
|
|||||||
CreateCharacterRequest,
|
CreateCharacterRequest,
|
||||||
} from './proto/character'
|
} from './proto/character'
|
||||||
|
|
||||||
import { characterManagerDefinition } from "./proto/character.grpc-server"
|
import { characterManagerDefinition } from './proto/character.grpc-server'
|
||||||
|
|
||||||
export function initCharacterService(server: Server) {
|
export function initCharacterService(server: Server) {
|
||||||
server.addService(characterManagerDefinition, {
|
server.addService(characterManagerDefinition, {
|
||||||
createCharacter: createCharacter_Call,
|
createCharacter: createCharacter_Call,
|
||||||
getCharacter: getCharacter_Call,
|
getCharacter: getCharacter_Call,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
new ReflectionService(loadSync('./src/proto/character.proto')).addToServer(
|
||||||
|
server,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createCharacter_Call(call: ServerUnaryCall<CreateCharacterRequest, Character>, callback: sendUnaryData<Character>) {
|
function createCharacter_Call(
|
||||||
|
call: ServerUnaryCall<CreateCharacterRequest, Character>,
|
||||||
|
callback: sendUnaryData<Character>,
|
||||||
|
) {
|
||||||
callback(null, createCharacter(call.request))
|
callback(null, createCharacter(call.request))
|
||||||
}
|
}
|
||||||
|
|
||||||
function createCharacter(request: CreateCharacterRequest): Character {
|
function createCharacter(request: CreateCharacterRequest): Character {
|
||||||
return {
|
return {
|
||||||
playerName: "test player",
|
playerName: 'test player',
|
||||||
characterName: "test character",
|
characterName: 'test character',
|
||||||
characterAlias: ["test alias"]
|
characterAlias: ['test alias'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCharacter_Call(call: ServerUnaryCall<GetCharacterRequest, Character>, callback: sendUnaryData<Character>) {
|
function getCharacter_Call(
|
||||||
|
call: ServerUnaryCall<GetCharacterRequest, Character>,
|
||||||
|
callback: sendUnaryData<Character>,
|
||||||
|
) {
|
||||||
callback(null, getCharacter(call.request))
|
callback(null, getCharacter(call.request))
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCharacter(request: GetCharacterRequest): Character {
|
function getCharacter(request: GetCharacterRequest): Character {
|
||||||
return {
|
return {
|
||||||
playerName: "test player",
|
playerName: 'test player',
|
||||||
characterName: "test character",
|
characterName: 'test character',
|
||||||
characterAlias: ["test alias"]
|
characterAlias: ['test alias'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user