@thiscargo/contracts 0.0.6 → 0.0.7

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 CHANGED
@@ -10,6 +10,18 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
+ export interface RegisterRequest {
14
+ firstName: string;
15
+ lastName: string;
16
+ phone: string;
17
+ password: string;
18
+ }
19
+
20
+ export interface RegisterResponse {
21
+ accessToken: string;
22
+ refreshToken: string;
23
+ }
24
+
13
25
  export interface LoginRequest {
14
26
  phone: string;
15
27
  password: string;
@@ -20,19 +32,38 @@ export interface LoginResponse {
20
32
  refreshToken: string;
21
33
  }
22
34
 
35
+ export interface RefreshTokenRequest {
36
+ refreshToken: string;
37
+ }
38
+
39
+ export interface RefreshTokenResponse {
40
+ accessToken: string;
41
+ refreshToken: string;
42
+ }
43
+
23
44
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
24
45
 
25
46
  export interface AuthServiceClient {
47
+ register(request: RegisterRequest): Observable<RegisterResponse>;
48
+
26
49
  login(request: LoginRequest): Observable<LoginResponse>;
50
+
51
+ refresh(request: RefreshTokenRequest): Observable<RefreshTokenResponse>;
27
52
  }
28
53
 
29
54
  export interface AuthServiceController {
55
+ register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
56
+
30
57
  login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
58
+
59
+ refresh(
60
+ request: RefreshTokenRequest,
61
+ ): Promise<RefreshTokenResponse> | Observable<RefreshTokenResponse> | RefreshTokenResponse;
31
62
  }
32
63
 
33
64
  export function AuthServiceControllerMethods() {
34
65
  return function (constructor: Function) {
35
- const grpcMethods: string[] = ["login"];
66
+ const grpcMethods: string[] = ["register", "login", "refresh"];
36
67
  for (const method of grpcMethods) {
37
68
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
38
69
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thiscargo/contracts",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/proto/auth.proto CHANGED
@@ -3,7 +3,21 @@ syntax = "proto3";
3
3
  package auth.v1;
4
4
 
5
5
  service AuthService {
6
+ rpc Register(RegisterRequest) returns (RegisterResponse);
6
7
  rpc Login(LoginRequest) returns (LoginResponse);
8
+ rpc Refresh(RefreshTokenRequest) returns (RefreshTokenResponse);
9
+ }
10
+
11
+ message RegisterRequest {
12
+ string first_name = 1;
13
+ string last_name = 2;
14
+ string phone = 3;
15
+ string password = 4;
16
+ }
17
+
18
+ message RegisterResponse {
19
+ string access_token = 1;
20
+ string refresh_token = 2;
7
21
  }
8
22
 
9
23
  message LoginRequest {
@@ -12,6 +26,15 @@ message LoginRequest {
12
26
  }
13
27
 
14
28
  message LoginResponse {
15
- string accessToken = 1;
16
- string refreshToken = 2;
29
+ string access_token = 1;
30
+ string refresh_token = 2;
17
31
  }
32
+
33
+ message RefreshTokenRequest {
34
+ string refresh_token = 1;
35
+ }
36
+
37
+ message RefreshTokenResponse {
38
+ string access_token = 1;
39
+ string refresh_token = 2;
40
+ }