Skip to content

Commit

Permalink
#56 refactor chat system files
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Dec 22, 2020
1 parent 7a458dd commit aa4540e
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/example-chat-system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
default: generate run-server

generate:
npx protoc -I . --ts_out . --ts_opt server_generic,client_call,optimize_code_size service-chat.proto
npx protoc -I protos --ts_out protos --ts_opt server_generic,client_call,optimize_code_size protos/service-chat.proto
# TODO just here for UnhandledPromiseRejectionWarning
npx protoc -I . --ts_out . --ts_opt server_grpc,optimize_code_size service-chat.proto
npx protoc -I protos --ts_out protos --ts_opt server_grpc,optimize_code_size protos/service-chat.proto

run-server:
npx ts-node server.ts
Expand Down
2 changes: 1 addition & 1 deletion packages/example-chat-system/client-alt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ChannelCredentials} from "@grpc/grpc-js";
import {GrpcTransport} from "@protobuf-ts/grpc-transport";
import {ChatServiceClient} from "./service-chat.client";
import {ChatServiceClient} from "./protos/service-chat.client";
import AbortController from "abort-controller";


Expand Down
2 changes: 1 addition & 1 deletion packages/example-chat-system/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ChannelCredentials} from "@grpc/grpc-js";
import {GrpcTransport} from "@protobuf-ts/grpc-transport";
import {ChatServiceClient, IChatServiceClient} from "./service-chat.client";
import {ChatServiceClient, IChatServiceClient} from "./protos/service-chat.client";
import {TerminalIO} from "./terminal-io";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters server_grpc,optimize_code_size
// @generated by protobuf-ts 2.0.0-alpha.10 with parameters server_grpc,optimize_code_size
// @generated from protobuf file "service-chat.proto" (package "spec", syntax proto3)
// tslint:disable
import { RpcTransport } from "@protobuf-ts/runtime-rpc";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters server_grpc,optimize_code_size
// @generated by protobuf-ts 2.0.0-alpha.10 with parameters server_grpc,optimize_code_size
// @generated from protobuf file "service-chat.proto" (package "spec", syntax proto3)
// tslint:disable
import { PostResponse } from "./service-chat";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters server_generic,client_call,optimize_code_size
// @generated by protobuf-ts 2.0.0-alpha.10 with parameters server_generic,client_call,optimize_code_size
// @generated from protobuf file "service-chat.proto" (package "spec", syntax proto3)
// tslint:disable
import { PostResponse } from "./service-chat";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters server_grpc,optimize_code_size
// @generated by protobuf-ts 2.0.0-alpha.10 with parameters server_grpc,optimize_code_size
// @generated from protobuf file "service-chat.proto" (package "spec", syntax proto3)
// tslint:disable
import { ServiceType } from "@protobuf-ts/runtime-rpc";
Expand Down
4 changes: 2 additions & 2 deletions packages/example-chat-system/server-alt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as grpc from '@grpc/grpc-js';
import {ChatEvent, JoinRequest, PostRequest, PostResponse} from "./service-chat";
import {chatServiceDefinition, IChatService} from "./service-chat.grpc-server";
import {ChatEvent, JoinRequest, PostRequest, PostResponse} from "./protos/service-chat";
import {chatServiceDefinition, IChatService} from "./protos/service-chat.grpc-server";


// TODO UnhandledPromiseRejectionWarning - see client-alt.ts
Expand Down
4 changes: 2 additions & 2 deletions packages/example-chat-system/server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as grpc from '@grpc/grpc-js';
import {RpcError, RpcInputStream, ServerCallContext} from "@protobuf-ts/runtime-rpc";
import {adaptService} from "@protobuf-ts/grpc-backend";
import {IChatService} from "./service-chat.server";
import {ChatEvent, ChatService as ChatServiceType, JoinRequest, PostRequest, PostResponse} from "./service-chat";
import {IChatService} from "./protos/service-chat.server";
import {ChatEvent, ChatService as ChatServiceType, JoinRequest, PostRequest, PostResponse} from "./protos/service-chat";


class ChatService implements IChatService {
Expand Down

0 comments on commit aa4540e

Please sign in to comment.