@teacinema-st/contracts 1.0.0 → 1.0.1

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,7 +7,7 @@
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
+ import { Timestamp } from "./google/protobuf/timestamp";
11
11
 
12
12
  export const protobufPackage = "auth.v1";
13
13
 
@@ -20,23 +20,35 @@ export interface SendOtpResponse {
20
20
  ok: boolean;
21
21
  }
22
22
 
23
+ export interface VerifyOtpRequest {
24
+ identifier: string;
25
+ code: string;
26
+ }
27
+
28
+ export interface VerifyOtpResponse {
29
+ accessToken: string;
30
+ refreshToken: string;
31
+ accessTokenExpiresAt: Timestamp | undefined;
32
+ refreshTokenExpiresAt: Timestamp | undefined;
33
+ }
34
+
23
35
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
24
36
 
25
37
  export interface AuthServiceClient {
26
38
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
27
39
 
28
- ping(request: Empty): Observable<Empty>;
40
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
29
41
  }
30
42
 
31
43
  export interface AuthServiceController {
32
44
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
33
45
 
34
- ping(request: Empty): void;
46
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
35
47
  }
36
48
 
37
49
  export function AuthServiceControllerMethods() {
38
50
  return function (constructor: Function) {
39
- const grpcMethods: string[] = ["sendOtp", "ping"];
51
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
40
52
  for (const method of grpcMethods) {
41
53
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
42
54
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacinema-st/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "scripts": {
6
6
  "generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
package/proto/auth.proto CHANGED
@@ -9,8 +9,7 @@ import "google/protobuf/struct.proto";
9
9
 
10
10
  service AuthService {
11
11
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
12
-
13
- rpc Ping (google.protobuf.Empty) returns (google.protobuf.Empty);
12
+ rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
14
13
  }
15
14
 
16
15
  message SendOtpRequest {
@@ -19,4 +18,16 @@ message SendOtpRequest {
19
18
  }
20
19
  message SendOtpResponse {
21
20
  bool ok = 1;
21
+ }
22
+
23
+ message VerifyOtpRequest {
24
+ string identifier = 1;
25
+ string code = 2;
26
+ }
27
+
28
+ message VerifyOtpResponse {
29
+ string access_token = 1;
30
+ string refresh_token = 2;
31
+ google.protobuf.Timestamp access_token_expires_at = 3;
32
+ google.protobuf.Timestamp refresh_token_expires_at = 4;
22
33
  }