@seatwave/contracts 1.0.5 → 1.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
@@ -7,116 +7,127 @@
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
9
  import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
10
11
 
11
12
  export const protobufPackage = "auth.v1";
12
13
 
13
- /** Request to send a one-time password (OTP) to the user. */
14
14
  export interface SendOtpRequest {
15
- /** The user identifier: either phone number or email address. */
16
15
  identifier: string;
17
- /** The type of identifier: "phone" or "email". */
18
16
  type: string;
19
17
  }
20
18
 
21
- /** Response for SendOtp request. */
22
19
  export interface SendOtpResponse {
23
- /** True if OTP was successfully sent. */
24
20
  ok: boolean;
25
21
  }
26
22
 
27
- /** Request to verify a one-time password (OTP). */
28
23
  export interface VerifyOtpRequest {
29
- /** The user identifier: either phone number or email address. */
30
24
  identifier: string;
31
- /** The type of identifier: "phone" or "email". */
32
25
  type: string;
33
- /** The OTP code sent to the user. */
34
26
  code: string;
35
27
  }
36
28
 
37
- /** Response for VerifyOtp request. */
38
29
  export interface VerifyOtpResponse {
39
- /** JWT access token. */
40
30
  accessToken: string;
41
- /** Refresh token to obtain new access tokens. */
42
31
  refreshToken: string;
43
32
  }
44
33
 
45
- /** Request to refresh an access token. */
46
34
  export interface RefreshRequest {
47
- /** The refresh token issued previously. */
48
35
  refreshToken: string;
49
36
  }
50
37
 
51
- /** Response for Refresh request. */
52
38
  export interface RefreshResponse {
53
- /** New JWT access token. */
54
39
  accessToken: string;
55
- /** New refresh token. */
56
40
  refreshToken: string;
57
41
  }
58
42
 
59
- export const AUTH_V1_PACKAGE_NAME = "auth.v1";
43
+ export interface TelegramInitResponse {
44
+ url: string;
45
+ }
60
46
 
61
- /**
62
- * AuthService handles all user authentication operations such as sending
63
- * OTP codes, verifying them, and refreshing access tokens.
64
- */
47
+ export interface TelegramVerifyRequest {
48
+ query: { [key: string]: string };
49
+ }
65
50
 
66
- export interface AuthServiceClient {
67
- /**
68
- * Sends a one-time verification code to the user via phone or email.
69
- * The user provides an identifier (phone number or email) and type.
70
- */
51
+ export interface TelegramVerifyRequest_QueryEntry {
52
+ key: string;
53
+ value: string;
54
+ }
71
55
 
72
- sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
56
+ export interface TelegramVerifyResponse {
57
+ url?: string | undefined;
58
+ accessToken?: string | undefined;
59
+ refreshToken?: string | undefined;
60
+ }
73
61
 
74
- /**
75
- * Verifies a one-time password (OTP) sent to the user.
76
- * The request must include the identifier, type, and OTP code.
77
- */
62
+ export interface TelegramCompleteRequest {
63
+ sessionId: string;
64
+ phone: string;
65
+ }
78
66
 
79
- verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
67
+ export interface TelegramCompleteResponse {
68
+ sessionId: string;
69
+ }
80
70
 
81
- /**
82
- * Refreshes the access token using a valid refresh token.
83
- * Returns a new access token and refresh token.
84
- */
71
+ export interface TelegramConsumeRequest {
72
+ sessionId: string;
73
+ }
85
74
 
86
- refresh(request: RefreshRequest): Observable<RefreshResponse>;
75
+ export interface TelegramConsumeResponse {
76
+ accessToken: string;
77
+ refreshToken: string;
87
78
  }
88
79
 
89
- /**
90
- * AuthService handles all user authentication operations such as sending
91
- * OTP codes, verifying them, and refreshing access tokens.
92
- */
80
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
93
81
 
94
- export interface AuthServiceController {
95
- /**
96
- * Sends a one-time verification code to the user via phone or email.
97
- * The user provides an identifier (phone number or email) and type.
98
- */
82
+ export interface AuthServiceClient {
83
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
99
84
 
100
- sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
85
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
101
86
 
102
- /**
103
- * Verifies a one-time password (OTP) sent to the user.
104
- * The request must include the identifier, type, and OTP code.
105
- */
87
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
106
88
 
107
- verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
89
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
108
90
 
109
- /**
110
- * Refreshes the access token using a valid refresh token.
111
- * Returns a new access token and refresh token.
112
- */
91
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
92
+
93
+ telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
94
+
95
+ telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
96
+ }
97
+
98
+ export interface AuthServiceController {
99
+ sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
100
+
101
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
113
102
 
114
103
  refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
104
+
105
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
106
+
107
+ telegramVerify(
108
+ request: TelegramVerifyRequest,
109
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
110
+
111
+ telegramComplete(
112
+ request: TelegramCompleteRequest,
113
+ ): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
114
+
115
+ telegramConsume(
116
+ request: TelegramConsumeRequest,
117
+ ): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
115
118
  }
116
119
 
117
120
  export function AuthServiceControllerMethods() {
118
121
  return function (constructor: Function) {
119
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
122
+ const grpcMethods: string[] = [
123
+ "sendOtp",
124
+ "verifyOtp",
125
+ "refresh",
126
+ "telegramInit",
127
+ "telegramVerify",
128
+ "telegramComplete",
129
+ "telegramConsume",
130
+ ];
120
131
  for (const method of grpcMethods) {
121
132
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
122
133
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seatwave/contracts",
3
- "version": "1.0.5",
3
+ "version": "1.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
@@ -2,69 +2,78 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
- // AuthService handles all user authentication operations such as sending
6
- // OTP codes, verifying them, and refreshing access tokens.
5
+ import "google/protobuf/empty.proto";
6
+
7
7
  service AuthService {
8
- // Sends a one-time verification code to the user via phone or email.
9
- // The user provides an identifier (phone number or email) and type.
10
8
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
-
12
- // Verifies a one-time password (OTP) sent to the user.
13
- // The request must include the identifier, type, and OTP code.
14
9
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
15
-
16
- // Refreshes the access token using a valid refresh token.
17
- // Returns a new access token and refresh token.
18
10
  rpc Refresh (RefreshRequest) returns (RefreshResponse);
11
+
12
+ rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
+ rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
14
+ rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
15
+ rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
19
16
  }
20
17
 
21
- // Request to send a one-time password (OTP) to the user.
22
18
  message SendOtpRequest {
23
- // The user identifier: either phone number or email address.
24
19
  string identifier = 1;
25
-
26
- // The type of identifier: "phone" or "email".
27
- string type = 2;
20
+ string type = 2;
28
21
  }
29
22
 
30
- // Response for SendOtp request.
31
23
  message SendOtpResponse {
32
- // True if OTP was successfully sent.
33
24
  bool ok = 1;
34
25
  }
35
26
 
36
- // Request to verify a one-time password (OTP).
37
27
  message VerifyOtpRequest {
38
- // The user identifier: either phone number or email address.
39
28
  string identifier = 1;
40
-
41
- // The type of identifier: "phone" or "email".
42
- string type = 2;
43
-
44
- // The OTP code sent to the user.
45
- string code = 3;
29
+ string type = 2;
30
+ string code = 3;
46
31
  }
47
32
 
48
- // Response for VerifyOtp request.
49
33
  message VerifyOtpResponse {
50
- // JWT access token.
51
- string access_token = 1;
52
-
53
- // Refresh token to obtain new access tokens.
34
+ string access_token = 1;
54
35
  string refresh_token = 2;
55
36
  }
56
37
 
57
- // Request to refresh an access token.
58
38
  message RefreshRequest {
59
- // The refresh token issued previously.
60
39
  string refresh_token = 1;
61
40
  }
62
41
 
63
- // Response for Refresh request.
64
42
  message RefreshResponse {
65
- // New JWT access token.
66
- string access_token = 1;
67
-
68
- // New refresh token.
43
+ string access_token = 1;
69
44
  string refresh_token = 2;
70
45
  }
46
+
47
+ message TelegramInitResponse {
48
+ string url = 1;
49
+ }
50
+
51
+ message TelegramVerifyRequest {
52
+ map<string, string> query = 1;
53
+ }
54
+
55
+ message TelegramVerifyResponse {
56
+ oneof result {
57
+ string url = 1;
58
+ string access_token = 2;
59
+ string refresh_token = 3;
60
+ }
61
+ }
62
+
63
+ message TelegramCompleteRequest {
64
+ string session_id = 1;
65
+ string phone = 2;
66
+ }
67
+
68
+ message TelegramCompleteResponse {
69
+ string session_id = 1;
70
+ }
71
+
72
+ message TelegramConsumeRequest {
73
+ string session_id = 1;
74
+ }
75
+
76
+ message TelegramConsumeResponse {
77
+ string access_token = 1;
78
+ string refresh_token = 2;
79
+ }