@funpay-pilot/contracts 0.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.
package/gen/auth.ts ADDED
@@ -0,0 +1,89 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.6
4
+ // protoc v7.34.0
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
+ export interface RegisterRequest {
14
+ email: string;
15
+ password: string;
16
+ username: string;
17
+ }
18
+
19
+ export interface RegisterResponse {
20
+ accessToken: string;
21
+ refreshToken: string;
22
+ }
23
+
24
+ export interface LoginRequest {
25
+ email: string;
26
+ password: string;
27
+ }
28
+
29
+ export interface LoginResponse {
30
+ accessToken: string;
31
+ refreshToken: string;
32
+ }
33
+
34
+ export interface RefreshRequest {
35
+ refreshToken: string;
36
+ }
37
+
38
+ export interface RefreshResponse {
39
+ accessToken: string;
40
+ refreshToken: string;
41
+ }
42
+
43
+ export interface ValidateRequest {
44
+ token: string;
45
+ }
46
+
47
+ export interface ValidateResponse {
48
+ valid: boolean;
49
+ userId: string;
50
+ }
51
+
52
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
53
+
54
+ export interface AuthServiceClient {
55
+ register(request: RegisterRequest): Observable<RegisterResponse>;
56
+
57
+ login(request: LoginRequest): Observable<LoginResponse>;
58
+
59
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
60
+
61
+ validate(request: ValidateRequest): Observable<ValidateResponse>;
62
+ }
63
+
64
+ export interface AuthServiceController {
65
+ register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
66
+
67
+ login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
68
+
69
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
70
+
71
+ validate(request: ValidateRequest): Promise<ValidateResponse> | Observable<ValidateResponse> | ValidateResponse;
72
+ }
73
+
74
+ export function AuthServiceControllerMethods() {
75
+ return function (constructor: Function) {
76
+ const grpcMethods: string[] = ["register", "login", "refresh", "validate"];
77
+ for (const method of grpcMethods) {
78
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
79
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
80
+ }
81
+ const grpcStreamMethods: string[] = [];
82
+ for (const method of grpcStreamMethods) {
83
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
84
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
85
+ }
86
+ };
87
+ }
88
+
89
+ export const AUTH_SERVICE_NAME = "AuthService";
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@funpay-pilot/contracts",
3
+ "version": "0.0.1",
4
+ "description": "Protobuf definitions and generated TypeScript types",
5
+ "scripts": {
6
+ "generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
+ },
8
+ "files": [
9
+ "proto",
10
+ "gen"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@nestjs/microservices": "^11.1.17",
17
+ "rxjs": "^7.8.2",
18
+ "ts-proto": "^2.11.6"
19
+ }
20
+ }
@@ -0,0 +1,49 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ service AuthService {
6
+ rpc Register(RegisterRequest) returns (RegisterResponse);
7
+ rpc Login(LoginRequest) returns (LoginResponse);
8
+ rpc Refresh(RefreshRequest) returns (RefreshResponse);
9
+ rpc Validate(ValidateRequest) returns (ValidateResponse);
10
+ }
11
+
12
+ message RegisterRequest {
13
+ string email = 1;
14
+ string password = 2;
15
+ string username = 3;
16
+ }
17
+
18
+ message RegisterResponse {
19
+ string access_token = 1;
20
+ string refresh_token = 2;
21
+ }
22
+
23
+ message LoginRequest {
24
+ string email = 1;
25
+ string password = 2;
26
+ }
27
+
28
+ message LoginResponse {
29
+ string access_token = 1;
30
+ string refresh_token = 2;
31
+ }
32
+
33
+ message RefreshRequest {
34
+ string refresh_token = 1;
35
+ }
36
+
37
+ message RefreshResponse {
38
+ string access_token = 1;
39
+ string refresh_token = 2;
40
+ }
41
+
42
+ message ValidateRequest {
43
+ string token = 1;
44
+ }
45
+
46
+ message ValidateResponse {
47
+ bool valid = 1;
48
+ string user_id = 2;
49
+ }