@platfformx/proto-contracts 1.0.1 → 1.0.3

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.
@@ -10,17 +10,19 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth_service.v1";
12
12
 
13
- export interface RegisterRequest {
14
- credentials?: RegisterCredentials | undefined;
13
+ export interface CreateAccountRequest {
14
+ credentials?: UserCredentials | undefined;
15
15
  oauthToken?: string | undefined;
16
16
  }
17
17
 
18
- export interface RegisterResponse {
18
+ export interface CreateAccountResponse {
19
19
  userId: string;
20
+ accessToken: string;
21
+ refreshToken: string;
20
22
  }
21
23
 
22
24
  export interface AuthenticationRequest {
23
- credentials?: AuthCredentials | undefined;
25
+ credentials?: UserCredentials | undefined;
24
26
  oauthToken?: string | undefined;
25
27
  }
26
28
 
@@ -30,19 +32,14 @@ export interface AuthenticationResponse {
30
32
  user: UserInfo | undefined;
31
33
  }
32
34
 
33
- export interface RegisterCredentials {
34
- email?: string | undefined;
35
- phone?: string | undefined;
36
- password: string;
37
- }
38
-
39
- export interface AuthCredentials {
40
- email?: string | undefined;
41
- phone?: string | undefined;
42
- username?: string | undefined;
35
+ export interface UserCredentials {
36
+ email: string;
37
+ phone: string;
38
+ username: string;
43
39
  password: string;
44
40
  }
45
41
 
42
+ /** Токены */
46
43
  export interface TokenRefreshRequest {
47
44
  refreshToken: string;
48
45
  }
@@ -63,7 +60,7 @@ export interface UserInfo {
63
60
  export const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
64
61
 
65
62
  export interface AuthServiceClient {
66
- register(request: RegisterRequest): Observable<RegisterResponse>;
63
+ createAccount(request: CreateAccountRequest): Observable<CreateAccountResponse>;
67
64
 
68
65
  authenticate(request: AuthenticationRequest): Observable<AuthenticationResponse>;
69
66
 
@@ -71,7 +68,9 @@ export interface AuthServiceClient {
71
68
  }
72
69
 
73
70
  export interface AuthServiceController {
74
- register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
71
+ createAccount(
72
+ request: CreateAccountRequest,
73
+ ): Promise<CreateAccountResponse> | Observable<CreateAccountResponse> | CreateAccountResponse;
75
74
 
76
75
  authenticate(
77
76
  request: AuthenticationRequest,
@@ -84,7 +83,7 @@ export interface AuthServiceController {
84
83
 
85
84
  export function AuthServiceControllerMethods() {
86
85
  return function (constructor: Function) {
87
- const grpcMethods: string[] = ["register", "authenticate", "refreshTokens"];
86
+ const grpcMethods: string[] = ["createAccount", "authenticate", "refreshTokens"];
88
87
  for (const method of grpcMethods) {
89
88
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
90
89
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platfformx/proto-contracts",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -21,5 +21,8 @@
21
21
  "ts-proto": "^2.11.8",
22
22
  "typescript": "^6.0.3"
23
23
  },
24
- "dependencies": {}
24
+ "dependencies": {
25
+ "@nestjs/microservices": "^11.1.21",
26
+ "rxjs": "^7.8.2"
27
+ }
25
28
  }
@@ -3,25 +3,28 @@ syntax = "proto3";
3
3
  package auth_service.v1;
4
4
 
5
5
  service AuthService {
6
- rpc Register (RegisterRequest) returns (RegisterResponse);
6
+ rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse);
7
7
  rpc Authenticate (AuthenticationRequest) returns (AuthenticationResponse);
8
8
  rpc RefreshTokens (TokenRefreshRequest) returns (TokenRefreshResponse);
9
9
  }
10
10
 
11
- message RegisterRequest {
11
+
12
+ message CreateAccountRequest {
12
13
  oneof register_method {
13
- RegisterCredentials credentials = 1;
14
+ UserCredentials credentials = 1;
14
15
  string oauth_token = 2;
15
16
  }
16
17
  }
17
18
 
18
- message RegisterResponse {
19
+ message CreateAccountResponse {
19
20
  string user_id = 1;
21
+ string access_token = 2;
22
+ string refresh_token = 3;
20
23
  }
21
24
 
22
25
  message AuthenticationRequest {
23
26
  oneof auth_method {
24
- AuthCredentials credentials = 1;
27
+ UserCredentials credentials = 1;
25
28
  string oauth_token = 2;
26
29
  }
27
30
  }
@@ -32,23 +35,15 @@ message AuthenticationResponse {
32
35
  UserInfo user = 3;
33
36
  }
34
37
 
35
- message RegisterCredentials {
36
- oneof identifier {
37
- string email = 1;
38
- string phone = 2;
39
- }
40
- string password = 3;
41
- }
42
38
 
43
- message AuthCredentials {
44
- oneof identifier {
45
- string email = 1;
46
- string phone = 2;
47
- string username = 3;
48
- }
39
+ message UserCredentials {
40
+ string email = 1;
41
+ string phone = 2;
42
+ string username = 3;
49
43
  string password = 4;
50
44
  }
51
45
 
46
+ //Токены
52
47
  message TokenRefreshRequest {
53
48
  string refresh_token = 1;
54
49
  }