nestia icon indicating copy to clipboard operation
nestia copied to clipboard

Develop protobuf (gRPC) decorators

Open samchon opened this issue 1 year ago • 13 comments

export function message<T>(): string; // Protocol Buffer message
export function assertDecode<T>(buffer: Buffer): T; // safe decoder
export function assertEncode<T>(input: T): Uint8Array; // safe encoder
    // +) decode, isDecode, validateDecode
    // +) encode, isEncode, validateEncode

typia would support protobuf features soon.

Therefore, develop protobuf (gRPC) related decorators. One thing amazing is, it does not need any *.proto file definition. Just using pure TypeScript type would be possible, as TypedRoute and TypedBody are. Defining protocol buffer message and marshaling to binary data would be automatically done by AOT compilation.

New decorator names would be:

  • ProtoRoute
  • ProtoBody

samchon avatar Dec 24 '22 19:12 samchon

we want to use nestia, when it can be ready for use?

omid-mamandi avatar Apr 17 '23 14:04 omid-mamandi

Maybe 3-5 months

samchon avatar Apr 17 '23 16:04 samchon

Would be a game-changer to have the source of truth for GRPC from typescript

L-U-C-K-Y avatar Jun 17 '23 21:06 L-U-C-K-Y

Currently, succeded to support protobuf through typia v5 update.

https://typia.io/docs/protobuf/message/

samchon avatar Sep 10 '23 02:09 samchon

Currently, succeded to support protobuf through typia v5 update.

https://typia.io/docs/protobuf/message/

Hi @samchon

Is it already possible to use the ProtoRoute and ProtoBody from Typia in Nestia?

I checked the Nestia docs and was not sure if this is working correctly.

Many thanks

L-U-C-K-Y avatar Feb 21 '24 06:02 L-U-C-K-Y

I should develop this feature, but I'm sorry. I cannot sure when to start.

samchon avatar Feb 22 '24 12:02 samchon

I should develop this feature, but I'm sorry. I cannot sure when to start.

No problem at all, you are doing great work, just started also to sponsor you, would be great if we can have this feature, as it would allow us to migrate all of our projects to Nestia.

L-U-C-K-Y avatar Feb 23 '24 10:02 L-U-C-K-Y

Hi @samchon

I would kindly ask if it is planned in the near future to work on this feature? As our payloads are large, it would be a big performance benefit to use gRPC and it would enable our non-Nestjs Microservices to receive .proto definitions.

Many thanks!

L-U-C-K-Y avatar Apr 15 '24 05:04 L-U-C-K-Y

Planning to develop websoket decorators and SDK first, and it would be next.

The date may be end of this year.

samchon avatar Apr 15 '24 05:04 samchon

Planning to develop websoket decorators and SDK first, and it would be next.

The date may be end of this year.

Thanks for the update!

L-U-C-K-Y avatar Apr 15 '24 06:04 L-U-C-K-Y

https://nestia.io/docs/core/WebSocketRoute/

Have waited for a long time. I've finally succeeded to implement the @WebSocketRoute.

The GrpcAdaptor.upgrade() and @GrpcRoute() would be developed in the same way.`

samchon avatar May 04 '24 13:05 samchon

https://nestia.io/docs/core/WebSocketRoute/

Have waited for a long time. I've finally succeeded to implement the @WebSocketRoute.

The GrpcAdaptor.upgrade() and @GrpcRoute() would be developed in the same way.`

Great news, great work, many thanks @samchon

L-U-C-K-Y avatar May 04 '24 15:05 L-U-C-K-Y

@L-U-C-K-Y I think you can take most (or more) advantages of gRPC in the @WebSocketRoute().

How about accomplish your mission with it? gRPC may needs lots of months as WebSocket was.

Also, as there's no way to use gRPC in the web browser, I may have to wait for a long time

samchon avatar May 04 '24 15:05 samchon