@alebooking/contracts 1.1.2 → 1.1.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.
@@ -1,4 +1,5 @@
1
1
  export declare const PROTO_PATH: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
+ readonly USER: string;
4
5
  };
@@ -4,5 +4,6 @@ exports.PROTO_PATH = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATH = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
- ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto')
7
+ ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
+ USER: (0, path_1.join)(__dirname, '../../proto/user.proto')
8
9
  };
package/gen/account.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.1
4
- // protoc v6.33.5
4
+ // protoc v3.21.12
5
5
  // source: account.proto
6
6
 
7
7
  /* eslint-disable */
package/gen/auth.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.1
4
- // protoc v6.33.5
4
+ // protoc v3.21.12
5
5
  // source: auth.proto
6
6
 
7
7
  /* eslint-disable */
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.1
4
- // protoc v6.33.5
4
+ // protoc v3.21.12
5
5
  // source: google/protobuf/empty.proto
6
6
 
7
7
  /* eslint-disable */
package/gen/user.ts ADDED
@@ -0,0 +1,63 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.1
4
+ // protoc v3.21.12
5
+ // source: user.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
11
+
12
+ export const protobufPackage = "user.v1";
13
+
14
+ export interface GetMeRequest {
15
+ id: string;
16
+ }
17
+
18
+ export interface GetMeResponse {
19
+ user: User | undefined;
20
+ }
21
+
22
+ export interface CreateUserRequest {
23
+ id: string;
24
+ }
25
+
26
+ export interface User {
27
+ id: string;
28
+ name?: string | undefined;
29
+ phone?: string | undefined;
30
+ email?: string | undefined;
31
+ avatar?: string | undefined;
32
+ }
33
+
34
+ export const USER_V1_PACKAGE_NAME = "user.v1";
35
+
36
+ export interface UserServiceClient {
37
+ getMe(request: GetMeRequest): Observable<GetMeResponse>;
38
+
39
+ createUser(request: CreateUserRequest): Observable<Empty>;
40
+ }
41
+
42
+ export interface UserServiceController {
43
+ getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
44
+
45
+ createUser(request: CreateUserRequest): void;
46
+ }
47
+
48
+ export function UserServiceControllerMethods() {
49
+ return function (constructor: Function) {
50
+ const grpcMethods: string[] = ["getMe", "createUser"];
51
+ for (const method of grpcMethods) {
52
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
53
+ GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
54
+ }
55
+ const grpcStreamMethods: string[] = [];
56
+ for (const method of grpcStreamMethods) {
57
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
58
+ GrpcStreamMethod("UserService", method)(constructor.prototype[method], method, descriptor);
59
+ }
60
+ };
61
+ }
62
+
63
+ export const USER_SERVICE_NAME = "UserService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alebooking/contracts",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Protobug definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,55 +1,55 @@
1
- syntax = "proto3";
2
-
3
- package account.v1;
4
-
5
- import "google/protobuf/empty.proto";
6
-
7
- service AccountService {
8
- rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
9
-
10
- rpc InitEmailChange (InitEmailChangeRequest) returns (google.protobuf.Empty);
11
- rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (google.protobuf.Empty);
12
-
13
- rpc InitPhoneChange (InitPhoneChangeRequest) returns (google.protobuf.Empty);
14
- rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (google.protobuf.Empty);
15
- }
16
-
17
- message GetAccountRequest {
18
- string id = 1;
19
- }
20
-
21
- message GetAccountResponse {
22
- string id = 1;
23
- optional string phone = 2;
24
- optional string email = 3;
25
- bool is_phone_verfiied = 4;
26
- bool is_email_verified = 5;
27
- Role role = 6;
28
- }
29
-
30
- enum Role {
31
- USER = 0;
32
- ADMIN = 1;
33
- }
34
-
35
- message InitEmailChangeRequest {
36
- string email = 1;
37
- string user_id = 2;
38
- }
39
-
40
- message ConfirmEmailChangeRequest {
41
- string email = 1;
42
- string code = 2;
43
- string user_id = 3;
44
- }
45
-
46
- message InitPhoneChangeRequest {
47
- string phone = 1;
48
- string user_id = 2;
49
- }
50
-
51
- message ConfirmPhoneChangeRequest {
52
- string phone = 1;
53
- string code = 2;
54
- string user_id = 3;
1
+ syntax = "proto3";
2
+
3
+ package account.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service AccountService {
8
+ rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
9
+
10
+ rpc InitEmailChange (InitEmailChangeRequest) returns (google.protobuf.Empty);
11
+ rpc ConfirmEmailChange (ConfirmEmailChangeRequest) returns (google.protobuf.Empty);
12
+
13
+ rpc InitPhoneChange (InitPhoneChangeRequest) returns (google.protobuf.Empty);
14
+ rpc ConfirmPhoneChange (ConfirmPhoneChangeRequest) returns (google.protobuf.Empty);
15
+ }
16
+
17
+ message GetAccountRequest {
18
+ string id = 1;
19
+ }
20
+
21
+ message GetAccountResponse {
22
+ string id = 1;
23
+ optional string phone = 2;
24
+ optional string email = 3;
25
+ bool is_phone_verfiied = 4;
26
+ bool is_email_verified = 5;
27
+ Role role = 6;
28
+ }
29
+
30
+ enum Role {
31
+ USER = 0;
32
+ ADMIN = 1;
33
+ }
34
+
35
+ message InitEmailChangeRequest {
36
+ string email = 1;
37
+ string user_id = 2;
38
+ }
39
+
40
+ message ConfirmEmailChangeRequest {
41
+ string email = 1;
42
+ string code = 2;
43
+ string user_id = 3;
44
+ }
45
+
46
+ message InitPhoneChangeRequest {
47
+ string phone = 1;
48
+ string user_id = 2;
49
+ }
50
+
51
+ message ConfirmPhoneChangeRequest {
52
+ string phone = 1;
53
+ string code = 2;
54
+ string user_id = 3;
55
55
  }
package/proto/auth.proto CHANGED
@@ -1,89 +1,89 @@
1
- syntax = "proto3";
2
-
3
- package auth.v1;
4
-
5
- import "google/protobuf/empty.proto";
6
-
7
- service AuthService {
8
- rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
9
- rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
10
- rpc Refresh (RefreshRequest) returns (RefreshResponse);
11
-
12
- rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
- rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
14
-
15
- rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
16
- rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
17
- }
18
-
19
- message SendOtpRequest {
20
- string identifier = 1;
21
- string type = 2;
22
- }
23
-
24
- message SendOtpResponse {
25
- bool ok = 1;
26
- }
27
-
28
- message VerifyOtpRequest {
29
- string identifier = 1;
30
- string type = 2;
31
- string code = 3;
32
- }
33
-
34
- message VerifyOtpResponse {
35
- string access_token = 1;
36
- string refresh_token = 2;
37
- }
38
-
39
- message RefreshRequest {
40
- string refresh_token = 1;
41
- }
42
-
43
- message RefreshResponse {
44
- string access_token = 1;
45
- string refresh_token = 2;
46
- }
47
-
48
- message TelegramInitResponse {
49
- string url = 1;
50
- }
51
-
52
- message TelegramVerifyRequestQuery {
53
- int64 id = 1;
54
- string first_name = 2;
55
- string last_name = 3;
56
- string username = 4;
57
- string photo_url = 5;
58
- int64 auth_date = 6;
59
- string hash = 7;
60
- }
61
-
62
- message TelegramVerifyRequest {
63
- TelegramVerifyRequestQuery query = 1;
64
- }
65
-
66
- message TelegramVerifyResponse {
67
- oneof result {
68
- string url = 1;
69
- VerifyOtpResponse tokens = 2;
70
- }
71
- }
72
-
73
- message TelegramCompleteRequest {
74
- string session_id = 1;
75
- string phone = 2;
76
- }
77
-
78
- message TelegramCompleteResponse {
79
- string session_id = 1;
80
- }
81
-
82
- message TelegramConsumeRequest {
83
- string session_id = 1;
84
- }
85
-
86
- message TelegramConsumeResponse {
87
- string access_token = 1;
88
- string refresh_token = 2;
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service AuthService {
8
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
9
+ rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
10
+ rpc Refresh (RefreshRequest) returns (RefreshResponse);
11
+
12
+ rpc TelegramInit (google.protobuf.Empty) returns (TelegramInitResponse);
13
+ rpc TelegramVerify (TelegramVerifyRequest) returns (TelegramVerifyResponse);
14
+
15
+ rpc TelegramComplete (TelegramCompleteRequest) returns (TelegramCompleteResponse);
16
+ rpc TelegramConsume (TelegramConsumeRequest) returns (TelegramConsumeResponse);
17
+ }
18
+
19
+ message SendOtpRequest {
20
+ string identifier = 1;
21
+ string type = 2;
22
+ }
23
+
24
+ message SendOtpResponse {
25
+ bool ok = 1;
26
+ }
27
+
28
+ message VerifyOtpRequest {
29
+ string identifier = 1;
30
+ string type = 2;
31
+ string code = 3;
32
+ }
33
+
34
+ message VerifyOtpResponse {
35
+ string access_token = 1;
36
+ string refresh_token = 2;
37
+ }
38
+
39
+ message RefreshRequest {
40
+ string refresh_token = 1;
41
+ }
42
+
43
+ message RefreshResponse {
44
+ string access_token = 1;
45
+ string refresh_token = 2;
46
+ }
47
+
48
+ message TelegramInitResponse {
49
+ string url = 1;
50
+ }
51
+
52
+ message TelegramVerifyRequestQuery {
53
+ int64 id = 1;
54
+ string first_name = 2;
55
+ string last_name = 3;
56
+ string username = 4;
57
+ string photo_url = 5;
58
+ int64 auth_date = 6;
59
+ string hash = 7;
60
+ }
61
+
62
+ message TelegramVerifyRequest {
63
+ TelegramVerifyRequestQuery query = 1;
64
+ }
65
+
66
+ message TelegramVerifyResponse {
67
+ oneof result {
68
+ string url = 1;
69
+ VerifyOtpResponse tokens = 2;
70
+ }
71
+ }
72
+
73
+ message TelegramCompleteRequest {
74
+ string session_id = 1;
75
+ string phone = 2;
76
+ }
77
+
78
+ message TelegramCompleteResponse {
79
+ string session_id = 1;
80
+ }
81
+
82
+ message TelegramConsumeRequest {
83
+ string session_id = 1;
84
+ }
85
+
86
+ message TelegramConsumeResponse {
87
+ string access_token = 1;
88
+ string refresh_token = 2;
89
89
  }
@@ -0,0 +1,30 @@
1
+ syntax = "proto3";
2
+
3
+ package user.v1;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service UserService {
8
+ rpc GetMe (GetMeRequest) returns (GetMeResponse);
9
+ rpc CreateUser (CreateUserRequest) returns (google.protobuf.Empty);
10
+ }
11
+
12
+ message GetMeRequest {
13
+ string id = 1;
14
+ }
15
+
16
+ message GetMeResponse {
17
+ User user = 1;
18
+ }
19
+
20
+ message CreateUserRequest {
21
+ string id = 1;
22
+ }
23
+
24
+ message User {
25
+ string id = 1;
26
+ optional string name = 2;
27
+ optional string phone = 3;
28
+ optional string email = 4;
29
+ optional string avatar = 5;
30
+ }