@microservicesss/contracts 1.0.8 → 1.0.10

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.
@@ -1,3 +1,4 @@
1
1
  export declare const PROTO_PATH: {
2
2
  readonly AUTH: string;
3
+ readonly ACCOUNT: string;
3
4
  };
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROTO_PATH = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATH = {
6
- AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto')
6
+ AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
+ ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
7
8
  };
package/gen/account.ts ADDED
@@ -0,0 +1,57 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.10.1
4
+ // protoc v3.21.12
5
+ // source: account.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "auth.v1";
12
+
13
+ export enum Roles {
14
+ ADMIN = 0,
15
+ USER = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export interface GetAccountRequest {
20
+ userId: string;
21
+ }
22
+
23
+ export interface GetAccountResponse {
24
+ id: string;
25
+ phone: string;
26
+ email: string;
27
+ role: Roles;
28
+ }
29
+
30
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
31
+
32
+ export interface AccountServiceClient {
33
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
34
+ }
35
+
36
+ export interface AccountServiceController {
37
+ getAccount(
38
+ request: GetAccountRequest,
39
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
40
+ }
41
+
42
+ export function AccountServiceControllerMethods() {
43
+ return function (constructor: Function) {
44
+ const grpcMethods: string[] = ["getAccount"];
45
+ for (const method of grpcMethods) {
46
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
47
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
48
+ }
49
+ const grpcStreamMethods: string[] = [];
50
+ for (const method of grpcStreamMethods) {
51
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
52
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
53
+ }
54
+ };
55
+ }
56
+
57
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/gen/auth.ts CHANGED
@@ -7,6 +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
11
 
11
12
  export const protobufPackage = "auth.v1";
12
13
 
@@ -39,6 +40,25 @@ export interface RefreshResponse {
39
40
  refreshToken: string;
40
41
  }
41
42
 
43
+ export interface TelegramInitResponse {
44
+ url: string;
45
+ }
46
+
47
+ export interface TelegramVerifyRequest {
48
+ tgAuthResult: { [key: string]: string };
49
+ }
50
+
51
+ export interface TelegramVerifyRequest_TgAuthResultEntry {
52
+ key: string;
53
+ value: string;
54
+ }
55
+
56
+ export interface TelegramVerifyResponse {
57
+ url?: string | undefined;
58
+ accessToken?: string | undefined;
59
+ refreshToken?: string | undefined;
60
+ }
61
+
42
62
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
43
63
 
44
64
  export interface AuthServiceClient {
@@ -47,6 +67,10 @@ export interface AuthServiceClient {
47
67
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
48
68
 
49
69
  refresh(request: RefreshRequest): Observable<RefreshResponse>;
70
+
71
+ telegramInit(request: Empty): Observable<TelegramInitResponse>;
72
+
73
+ telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
50
74
  }
51
75
 
52
76
  export interface AuthServiceController {
@@ -55,11 +79,17 @@ export interface AuthServiceController {
55
79
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
56
80
 
57
81
  refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
82
+
83
+ telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
84
+
85
+ telegramVerify(
86
+ request: TelegramVerifyRequest,
87
+ ): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
58
88
  }
59
89
 
60
90
  export function AuthServiceControllerMethods() {
61
91
  return function (constructor: Function) {
62
- const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
92
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh", "telegramInit", "telegramVerify"];
63
93
  for (const method of grpcMethods) {
64
94
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
65
95
  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.10.1
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": "@microservicesss/contracts",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,23 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ service AccountService {
6
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
7
+ }
8
+
9
+ message GetAccountRequest {
10
+ string userId = 1;
11
+ }
12
+
13
+ message GetAccountResponse {
14
+ string id = 1;
15
+ string phone = 2;
16
+ string email = 3;
17
+ Roles role = 4;
18
+ }
19
+
20
+ enum Roles {
21
+ ADMIN = 0;
22
+ USER = 1;
23
+ }
package/proto/auth.proto CHANGED
@@ -2,10 +2,15 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
+ import "google/protobuf/empty.proto";
6
+
5
7
  service AuthService {
6
8
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
7
9
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
8
10
  rpc Refresh (RefreshRequest) returns (RefreshResponse);
11
+
12
+ rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
+ rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
9
14
  }
10
15
 
11
16
  message SendOtpRequest {
@@ -36,3 +41,19 @@ message RefreshResponse {
36
41
  string accessToken = 1;
37
42
  string refreshToken = 2;
38
43
  }
44
+
45
+ message TelegramInitResponse {
46
+ string url = 1;
47
+ }
48
+
49
+ message TelegramVerifyRequest {
50
+ map<string, string> tgAuthResult = 1;
51
+ }
52
+
53
+ message TelegramVerifyResponse {
54
+ oneof result {
55
+ string url = 1;
56
+ string accessToken = 2;
57
+ string refreshToken = 3;
58
+ }
59
+ }