@vsniksnet/contracts 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
+ readonly USERS: string;
4
5
  };
@@ -5,4 +5,5 @@ const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
+ USERS: (0, path_1.join)(__dirname, '../../proto/users.proto'),
8
9
  };
package/gen/users.ts ADDED
@@ -0,0 +1,97 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.4
4
+ // protoc v6.33.1
5
+ // source: users.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "users.v1";
12
+
13
+ export interface CreateUserRequest {
14
+ id: string;
15
+ email: string;
16
+ username: string;
17
+ }
18
+
19
+ export interface CreateUserResponse {
20
+ success: boolean;
21
+ }
22
+
23
+ export interface GetUserRequest {
24
+ id: string;
25
+ }
26
+
27
+ export interface GetUserResponse {
28
+ user: User | undefined;
29
+ }
30
+
31
+ export interface ListUsersRequest {
32
+ limit: number;
33
+ }
34
+
35
+ export interface ListUsersResponse {
36
+ users: User[];
37
+ }
38
+
39
+ export interface User {
40
+ id: string;
41
+ email: string;
42
+ username: string;
43
+ avatar: string;
44
+ }
45
+
46
+ export const USERS_V1_PACKAGE_NAME = "users.v1";
47
+
48
+ /** Users service */
49
+
50
+ export interface UsersServiceClient {
51
+ /** Create user */
52
+
53
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
54
+
55
+ /** Get one user by id */
56
+
57
+ getUser(request: GetUserRequest): Observable<GetUserResponse>;
58
+
59
+ /** List users */
60
+
61
+ listUsers(request: ListUsersRequest): Observable<ListUsersResponse>;
62
+ }
63
+
64
+ /** Users service */
65
+
66
+ export interface UsersServiceController {
67
+ /** Create user */
68
+
69
+ createUser(
70
+ request: CreateUserRequest,
71
+ ): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
72
+
73
+ /** Get one user by id */
74
+
75
+ getUser(request: GetUserRequest): Promise<GetUserResponse> | Observable<GetUserResponse> | GetUserResponse;
76
+
77
+ /** List users */
78
+
79
+ listUsers(request: ListUsersRequest): Promise<ListUsersResponse> | Observable<ListUsersResponse> | ListUsersResponse;
80
+ }
81
+
82
+ export function UsersServiceControllerMethods() {
83
+ return function (constructor: Function) {
84
+ const grpcMethods: string[] = ["createUser", "getUser", "listUsers"];
85
+ for (const method of grpcMethods) {
86
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
87
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
88
+ }
89
+ const grpcStreamMethods: string[] = [];
90
+ for (const method of grpcStreamMethods) {
91
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
92
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
93
+ }
94
+ };
95
+ }
96
+
97
+ export const USERS_SERVICE_NAME = "UsersService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsniksnet/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Protobuf definitions and generated typescript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,46 @@
1
+ syntax = "proto3";
2
+
3
+ package users.v1;
4
+
5
+ /** Users service */
6
+ service UsersService {
7
+ /** Create user */
8
+ rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
9
+ /** Get one user by id */
10
+ rpc GetUser (GetUserRequest) returns (GetUserResponse);
11
+ /** List users */
12
+ rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
13
+ }
14
+
15
+ message CreateUserRequest {
16
+ string id = 1;
17
+ string email = 2;
18
+ string username = 3;
19
+ }
20
+
21
+ message CreateUserResponse {
22
+ bool success = 1;
23
+ }
24
+
25
+ message GetUserRequest {
26
+ string id = 1;
27
+ }
28
+
29
+ message GetUserResponse {
30
+ User user = 1;
31
+ }
32
+
33
+ message ListUsersRequest {
34
+ int32 limit = 1;
35
+ }
36
+
37
+ message ListUsersResponse {
38
+ repeated User users = 1;
39
+ }
40
+
41
+ message User {
42
+ string id = 1;
43
+ string email = 2;
44
+ string username = 3;
45
+ string avatar = 4;
46
+ }