@platfformx/proto-contracts 1.0.4 → 1.0.6

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,36 +10,54 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth_service.v1";
12
12
 
13
+ /** Shared */
14
+ export enum OAuthProvider {
15
+ OAUTH_PROVIDER_UNSPECIFIED = 0,
16
+ OAUTH_PROVIDER_GOOGLE = 1,
17
+ OAUTH_PROVIDER_GITHUB = 2,
18
+ OAUTH_PROVIDER_TELEGRAM = 3,
19
+ UNRECOGNIZED = -1,
20
+ }
21
+
22
+ /** Create account */
13
23
  export interface CreateAccountRequest {
14
- credentials?: UserCredentials | undefined;
15
- oauthToken?: string | undefined;
24
+ credentials: UserCredentials | undefined;
16
25
  }
17
26
 
18
27
  export interface CreateAccountResponse {
19
28
  userId: string;
20
29
  accessToken: string;
21
30
  refreshToken: string;
31
+ user: UserProfile | undefined;
22
32
  }
23
33
 
34
+ /** Authenticate credentials */
24
35
  export interface AuthenticationRequest {
25
- credentials?: UserCredentials | undefined;
26
- oauthToken?: string | undefined;
36
+ credentials: UserCredentials | undefined;
27
37
  }
28
38
 
29
39
  export interface AuthenticationResponse {
40
+ userId: string;
30
41
  accessToken: string;
31
42
  refreshToken: string;
32
- user: UserInfo | undefined;
43
+ user: UserProfile | undefined;
33
44
  }
34
45
 
35
- export interface UserCredentials {
36
- email?: string | undefined;
37
- phone?: string | undefined;
38
- username?: string | undefined;
39
- password: string;
46
+ /** AuthenticateWithOAuth */
47
+ export interface OAuthSessionRequest {
48
+ provider: OAuthProvider;
49
+ token: string;
40
50
  }
41
51
 
42
- /** Токены */
52
+ export interface OAuthSessionResponse {
53
+ userId: string;
54
+ accessToken: string;
55
+ refreshToken: string;
56
+ user: UserProfile | undefined;
57
+ isNewUser: boolean;
58
+ }
59
+
60
+ /** Tokens */
43
61
  export interface TokenRefreshRequest {
44
62
  refreshToken: string;
45
63
  }
@@ -49,8 +67,14 @@ export interface TokenRefreshResponse {
49
67
  refreshToken: string;
50
68
  }
51
69
 
52
- export interface UserInfo {
53
- userId: string;
70
+ export interface UserCredentials {
71
+ email?: string | undefined;
72
+ phone?: string | undefined;
73
+ username?: string | undefined;
74
+ password: string;
75
+ }
76
+
77
+ export interface UserProfile {
54
78
  email?: string | undefined;
55
79
  phone?: string | undefined;
56
80
  username?: string | undefined;
@@ -64,6 +88,8 @@ export interface AuthServiceClient {
64
88
 
65
89
  authenticate(request: AuthenticationRequest): Observable<AuthenticationResponse>;
66
90
 
91
+ authenticateWithOAuth(request: OAuthSessionRequest): Observable<OAuthSessionResponse>;
92
+
67
93
  refreshTokens(request: TokenRefreshRequest): Observable<TokenRefreshResponse>;
68
94
  }
69
95
 
@@ -76,6 +102,10 @@ export interface AuthServiceController {
76
102
  request: AuthenticationRequest,
77
103
  ): Promise<AuthenticationResponse> | Observable<AuthenticationResponse> | AuthenticationResponse;
78
104
 
105
+ authenticateWithOAuth(
106
+ request: OAuthSessionRequest,
107
+ ): Promise<OAuthSessionResponse> | Observable<OAuthSessionResponse> | OAuthSessionResponse;
108
+
79
109
  refreshTokens(
80
110
  request: TokenRefreshRequest,
81
111
  ): Promise<TokenRefreshResponse> | Observable<TokenRefreshResponse> | TokenRefreshResponse;
@@ -83,7 +113,7 @@ export interface AuthServiceController {
83
113
 
84
114
  export function AuthServiceControllerMethods() {
85
115
  return function (constructor: Function) {
86
- const grpcMethods: string[] = ["createAccount", "authenticate", "refreshTokens"];
116
+ const grpcMethods: string[] = ["createAccount", "authenticate", "authenticateWithOAuth", "refreshTokens"];
87
117
  for (const method of grpcMethods) {
88
118
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
89
119
  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.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -5,45 +5,47 @@ package auth_service.v1;
5
5
  service AuthService {
6
6
  rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse);
7
7
  rpc Authenticate (AuthenticationRequest) returns (AuthenticationResponse);
8
+ rpc AuthenticateWithOAuth (OAuthSessionRequest) returns (OAuthSessionResponse);
8
9
  rpc RefreshTokens (TokenRefreshRequest) returns (TokenRefreshResponse);
9
10
  }
10
11
 
11
-
12
+ // Create account
12
13
  message CreateAccountRequest {
13
- oneof register_method {
14
- UserCredentials credentials = 1;
15
- string oauth_token = 2;
16
- }
14
+ UserCredentials credentials = 1;
17
15
  }
18
16
 
19
17
  message CreateAccountResponse {
20
18
  string user_id = 1;
21
19
  string access_token = 2;
22
20
  string refresh_token = 3;
21
+ UserProfile user = 4;
23
22
  }
24
23
 
24
+ // Authenticate credentials
25
25
  message AuthenticationRequest {
26
- oneof auth_method {
27
- UserCredentials credentials = 1;
28
- string oauth_token = 2;
29
- }
26
+ UserCredentials credentials = 1;
30
27
  }
31
28
 
32
29
  message AuthenticationResponse {
33
- string access_token = 1;
34
- string refresh_token = 2;
35
- UserInfo user = 3;
30
+ string user_id = 1;
31
+ string access_token = 2;
32
+ string refresh_token = 3;
33
+ UserProfile user = 4;
36
34
  }
37
35
 
38
-
39
- message UserCredentials {
40
- optional string email = 1;
41
- optional string phone = 2;
42
- optional string username = 3;
43
- string password = 4;
36
+ // AuthenticateWithOAuth
37
+ message OAuthSessionRequest {
38
+ OAuthProvider provider = 1;
39
+ string token = 2;
44
40
  }
45
-
46
- //Токены
41
+ message OAuthSessionResponse {
42
+ string user_id = 1;
43
+ string access_token = 2;
44
+ string refresh_token = 3;
45
+ UserProfile user = 4;
46
+ bool is_new_user = 5;
47
+ }
48
+ // Tokens
47
49
  message TokenRefreshRequest {
48
50
  string refresh_token = 1;
49
51
  }
@@ -53,10 +55,25 @@ message TokenRefreshResponse {
53
55
  string refresh_token = 2;
54
56
  }
55
57
 
56
- message UserInfo {
57
- string user_id = 1;
58
- optional string email = 2;
59
- optional string phone = 3;
60
- optional string username = 4;
61
- optional string display_name = 5;
62
- }
58
+ // Shared
59
+ enum OAuthProvider {
60
+ OAUTH_PROVIDER_UNSPECIFIED = 0;
61
+ OAUTH_PROVIDER_GOOGLE = 1;
62
+ OAUTH_PROVIDER_GITHUB = 2;
63
+ OAUTH_PROVIDER_TELEGRAM = 3;
64
+ }
65
+ message UserCredentials {
66
+ oneof identifier {
67
+ string email = 1;
68
+ string phone = 2;
69
+ string username = 3;
70
+ }
71
+ string password = 4;
72
+ }
73
+ message UserProfile {
74
+ optional string email = 1;
75
+ optional string phone = 2;
76
+ optional string username = 3;
77
+ optional string display_name = 4;
78
+ }
79
+