@usteam/contracts 1.1.1 → 1.1.2

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,86 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v7.34.0
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 GetMeRequest {
14
+ id: string;
15
+ }
16
+
17
+ export interface GetMeResponse {
18
+ user: User | undefined;
19
+ }
20
+
21
+ export interface CreateUserRequest {
22
+ id: string;
23
+ }
24
+
25
+ export interface CreateUserResponse {
26
+ ok: boolean;
27
+ }
28
+
29
+ export interface User {
30
+ id: string;
31
+ name?: string | undefined;
32
+ phone?: string | undefined;
33
+ email?: string | undefined;
34
+ avatar?: string | undefined;
35
+ }
36
+
37
+ export const USERS_V1_PACKAGE_NAME = "users.v1";
38
+
39
+ /** UsersService отвечает за операции связанные с пользователем. */
40
+
41
+ export interface UsersServiceClient {
42
+ /**
43
+ * GetMe id текущего пользователя.
44
+ * получает объект с данными текущего пользователя
45
+ */
46
+
47
+ getMe(request: GetMeRequest): Observable<GetMeResponse>;
48
+
49
+ /** CreateUser создает нового пользователя */
50
+
51
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
52
+ }
53
+
54
+ /** UsersService отвечает за операции связанные с пользователем. */
55
+
56
+ export interface UsersServiceController {
57
+ /**
58
+ * GetMe id текущего пользователя.
59
+ * получает объект с данными текущего пользователя
60
+ */
61
+
62
+ getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
63
+
64
+ /** CreateUser создает нового пользователя */
65
+
66
+ createUser(
67
+ request: CreateUserRequest,
68
+ ): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
69
+ }
70
+
71
+ export function UsersServiceControllerMethods() {
72
+ return function (constructor: Function) {
73
+ const grpcMethods: string[] = ["getMe", "createUser"];
74
+ for (const method of grpcMethods) {
75
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
76
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
77
+ }
78
+ const grpcStreamMethods: string[] = [];
79
+ for (const method of grpcStreamMethods) {
80
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
81
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
82
+ }
83
+ };
84
+ }
85
+
86
+ export const USERS_SERVICE_NAME = "UsersService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usteam/contracts",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,37 @@
1
+ syntax = "proto3";
2
+
3
+ package users.v1;
4
+
5
+ // UsersService отвечает за операции связанные с пользователем.
6
+ service UsersService {
7
+ // GetMe id текущего пользователя.
8
+ // получает объект с данными текущего пользователя
9
+ rpc GetMe (GetMeRequest) returns (GetMeResponse);
10
+ // CreateUser создает нового пользователя
11
+ rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
12
+
13
+ }
14
+
15
+ message GetMeRequest {
16
+ string id = 1;
17
+ }
18
+
19
+ message GetMeResponse {
20
+ User user = 1;
21
+ }
22
+
23
+ message CreateUserRequest {
24
+ string id = 1;
25
+ }
26
+
27
+ message CreateUserResponse {
28
+ bool ok = 1;
29
+ }
30
+
31
+ message User {
32
+ string id = 1;
33
+ optional string name = 2;
34
+ optional string phone = 3;
35
+ optional string email = 4;
36
+ optional string avatar = 5;
37
+ }