@ero-world/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 +83 -0
- package/gen/google/protobuf/empty.ts +23 -0
- package/package.json +25 -0
- package/proto/auth.proto +46 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.2
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Empty } from "./google/protobuf/empty";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "auth.v1";
|
|
13
|
+
|
|
14
|
+
export enum Role {
|
|
15
|
+
master = 0,
|
|
16
|
+
salon = 1,
|
|
17
|
+
UNRECOGNIZED = -1,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface RegisterRequest {
|
|
21
|
+
email: string;
|
|
22
|
+
password: string;
|
|
23
|
+
passwordConfirm: string;
|
|
24
|
+
role: Role;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface RegisterResponse {
|
|
28
|
+
ok: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface LoginRequest {
|
|
33
|
+
email: string;
|
|
34
|
+
password: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface TokensResponse {
|
|
38
|
+
accessToken: string;
|
|
39
|
+
refreshToken: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface VerifyRequest {
|
|
43
|
+
token: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
47
|
+
|
|
48
|
+
export interface AuthServiceClient {
|
|
49
|
+
register(request: RegisterRequest): Observable<RegisterResponse>;
|
|
50
|
+
|
|
51
|
+
login(request: LoginRequest): Observable<TokensResponse>;
|
|
52
|
+
|
|
53
|
+
verify(request: Empty): Observable<TokensResponse>;
|
|
54
|
+
|
|
55
|
+
refresh(request: Empty): Observable<TokensResponse>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AuthServiceController {
|
|
59
|
+
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
|
|
60
|
+
|
|
61
|
+
login(request: LoginRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
62
|
+
|
|
63
|
+
verify(request: Empty): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
64
|
+
|
|
65
|
+
refresh(request: Empty): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function AuthServiceControllerMethods() {
|
|
69
|
+
return function (constructor: Function) {
|
|
70
|
+
const grpcMethods: string[] = ["register", "login", "verify", "refresh"];
|
|
71
|
+
for (const method of grpcMethods) {
|
|
72
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
74
|
+
}
|
|
75
|
+
const grpcStreamMethods: string[] = [];
|
|
76
|
+
for (const method of grpcStreamMethods) {
|
|
77
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
78
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.2
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/empty.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A generic empty message that you can re-use to avoid defining duplicated
|
|
13
|
+
* empty messages in your APIs. A typical example is to use it as the request
|
|
14
|
+
* or the response type of an API method. For instance:
|
|
15
|
+
*
|
|
16
|
+
* service Foo {
|
|
17
|
+
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
export interface Empty {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ero-world/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"release": "node scripts/release.js",
|
|
9
|
+
"generate": "protoc -I ./proto --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./gen ./proto/*.proto --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Kirill",
|
|
16
|
+
"email": "scerep529@gmail.com"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"ts-proto": "^2.11.2"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@nestjs/microservices": "^11.1.13",
|
|
23
|
+
"rxjs": "^7.8.2"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package auth.v1;
|
|
3
|
+
|
|
4
|
+
import "google/protobuf/empty.proto";
|
|
5
|
+
|
|
6
|
+
enum Role {
|
|
7
|
+
master = 0;
|
|
8
|
+
salon = 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
service AuthService {
|
|
12
|
+
rpc Register (RegisterRequest) returns (RegisterResponse);
|
|
13
|
+
rpc Login (LoginRequest) returns (TokensResponse);
|
|
14
|
+
rpc Verify (google.protobuf.Empty) returns (TokensResponse);
|
|
15
|
+
rpc Refresh (google.protobuf.Empty) returns (TokensResponse);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message RegisterRequest {
|
|
19
|
+
string email = 1;
|
|
20
|
+
string password = 2;
|
|
21
|
+
string password_confirm = 3;
|
|
22
|
+
Role role = 4;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message RegisterResponse {
|
|
26
|
+
bool ok = 1;
|
|
27
|
+
string message = 2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message LoginRequest {
|
|
31
|
+
string email = 1;
|
|
32
|
+
string password = 2;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message TokensResponse {
|
|
36
|
+
string access_token = 1;
|
|
37
|
+
string refresh_token = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message VerifyRequest {
|
|
41
|
+
string token = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// message RefreshRequest {
|
|
45
|
+
|
|
46
|
+
// }
|