@usteam/contracts 1.0.0

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.
package/gen/auth.ts ADDED
@@ -0,0 +1,76 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v6.33.2
5
+ // source: auth.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "auth.v1";
12
+
13
+ /**
14
+ * Запрос на отправку OTP.
15
+ * identifier — email или телефон.
16
+ * type — тип идентификатора (например, "email" или "phone").
17
+ */
18
+ export interface SendOtpRequest {
19
+ identifier: string;
20
+ type: string;
21
+ }
22
+
23
+ /**
24
+ * Ответ на отправку OTP.
25
+ * ok — true, если отправка прошла успешно.
26
+ */
27
+ export interface SendOtpResponse {
28
+ ok: boolean;
29
+ }
30
+
31
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
32
+
33
+ /**
34
+ * AuthService отвечает за операции аутентификации.
35
+ * В данном случае — отправку одноразового пароля (OTP).
36
+ */
37
+
38
+ export interface AuthServiceClient {
39
+ /**
40
+ * SendOtp отправляет одноразовый пароль (OTP) на указанный идентификатор.
41
+ * Может быть email, телефон или другой тип.
42
+ */
43
+
44
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
45
+ }
46
+
47
+ /**
48
+ * AuthService отвечает за операции аутентификации.
49
+ * В данном случае — отправку одноразового пароля (OTP).
50
+ */
51
+
52
+ export interface AuthServiceController {
53
+ /**
54
+ * SendOtp отправляет одноразовый пароль (OTP) на указанный идентификатор.
55
+ * Может быть email, телефон или другой тип.
56
+ */
57
+
58
+ sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
59
+ }
60
+
61
+ export function AuthServiceControllerMethods() {
62
+ return function (constructor: Function) {
63
+ const grpcMethods: string[] = ["sendOtp"];
64
+ for (const method of grpcMethods) {
65
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
66
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
67
+ }
68
+ const grpcStreamMethods: string[] = [];
69
+ for (const method of grpcStreamMethods) {
70
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
71
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
72
+ }
73
+ };
74
+ }
75
+
76
+ export const AUTH_SERVICE_NAME = "AuthService";
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@usteam/contracts",
3
+ "version": "1.0.0",
4
+ "scripts": {
5
+ "generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
6
+ },
7
+ "files": [
8
+ "proto",
9
+ "gen"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "description": "Protobuf definitions and generated TypeScript types",
15
+ "dependencies": {
16
+ "@nestjs/microservices": "^11.1.11",
17
+ "rxjs": "^7.8.2",
18
+ "ts-proto": "^2.10.1"
19
+ }
20
+ }
@@ -0,0 +1,25 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ // AuthService отвечает за операции аутентификации.
6
+ // В данном случае — отправку одноразового пароля (OTP).
7
+ service AuthService {
8
+ // SendOtp отправляет одноразовый пароль (OTP) на указанный идентификатор.
9
+ // Может быть email, телефон или другой тип.
10
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
+ }
12
+
13
+ // Запрос на отправку OTP.
14
+ // identifier — email или телефон.
15
+ // type — тип идентификатора (например, "email" или "phone").
16
+ message SendOtpRequest {
17
+ string identifier = 1;
18
+ string type = 2;
19
+ }
20
+
21
+ // Ответ на отправку OTP.
22
+ // ok — true, если отправка прошла успешно.
23
+ message SendOtpResponse {
24
+ bool ok = 1;
25
+ }