mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 22:07:32 +00:00
[TS/JS] Updates the grpc (#6654)
* Updates go lang support to allow other languages to communicate with it * Update js grpc lib to use grpc-js Reformat code
This commit is contained in:
7
tests/monster_test_grpc.d.ts
vendored
7
tests/monster_test_grpc.d.ts
vendored
@@ -3,7 +3,7 @@ import * as flatbuffers from 'flatbuffers';
|
||||
import { Stat as MyGame_Example_Stat } from './my-game/example/stat';
|
||||
import { Monster as MyGame_Example_Monster } from './my-game/example/monster';
|
||||
|
||||
import * as grpc from 'grpc';
|
||||
import * as grpc from '@grpc/grpc-js';
|
||||
|
||||
interface IMonsterStorageService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
|
||||
Store: IMonsterStorageService_IStore;
|
||||
@@ -54,7 +54,7 @@ interface IMonsterStorageService_IGetMinMaxHitPoints extends grpc.MethodDefiniti
|
||||
|
||||
export const MonsterStorageService: IMonsterStorageService;
|
||||
|
||||
export interface IMonsterStorageServer {
|
||||
export interface IMonsterStorageServer extends grpc.UntypedServiceImplementation {
|
||||
Store: grpc.handleUnaryCall<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
Retrieve: grpc.handleServerStreamingCall<MyGame_Example_Stat, MyGame_Example_Monster>;
|
||||
GetMaxHitPoint: grpc.handleClientStreamingCall<MyGame_Example_Monster, MyGame_Example_Stat>;
|
||||
@@ -77,7 +77,8 @@ export interface IMonsterStorageClient {
|
||||
}
|
||||
|
||||
export class MonsterStorageClient extends grpc.Client implements IMonsterStorageClient {
|
||||
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); public Store(request: MyGame_Example_Monster, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
|
||||
public Store(request: MyGame_Example_Monster, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Store(request: MyGame_Example_Monster, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: MyGame_Example_Stat) => void): grpc.ClientUnaryCall;
|
||||
public Retrieve(request: MyGame_Example_Stat, metadata: grpc.Metadata): grpc.ClientReadableStream<MyGame_Example_Monster>;
|
||||
|
||||
@@ -3,13 +3,13 @@ import * as flatbuffers from 'flatbuffers';
|
||||
import { Stat as MyGame_Example_Stat } from './my-game/example/stat';
|
||||
import { Monster as MyGame_Example_Monster } from './my-game/example/monster';
|
||||
|
||||
var grpc = require('grpc');
|
||||
var grpc = require('@grpc/grpc-js');
|
||||
|
||||
function serialize_MyGame_Example_Stat(buffer_args) {
|
||||
if (!(buffer_args instanceof MyGame_Example_Stat)) {
|
||||
throw new Error('Expected argument of type Stat');
|
||||
}
|
||||
return buffer_args.serialize();
|
||||
return Buffer.from(buffer_args.serialize());
|
||||
}
|
||||
|
||||
function deserialize_MyGame_Example_Stat(buffer) {
|
||||
@@ -21,7 +21,7 @@ function serialize_MyGame_Example_Monster(buffer_args) {
|
||||
if (!(buffer_args instanceof MyGame_Example_Monster)) {
|
||||
throw new Error('Expected argument of type Monster');
|
||||
}
|
||||
return buffer_args.serialize();
|
||||
return Buffer.from(buffer_args.serialize());
|
||||
}
|
||||
|
||||
function deserialize_MyGame_Example_Monster(buffer) {
|
||||
|
||||
Reference in New Issue
Block a user