@vsniksnet/contracts 1.0.0 → 1.0.2

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_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
+ readonly USERS: string;
4
5
  };
@@ -5,4 +5,5 @@ const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
+ USERS: (0, path_1.join)(__dirname, '../../proto/users.proto'),
8
9
  };
package/gen/account.ts CHANGED
@@ -10,6 +10,14 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "account.v1";
12
12
 
13
+ export interface VerifyAccountRequest {
14
+ token: string;
15
+ }
16
+
17
+ export interface VerifyAccountResponse {
18
+ ok: boolean;
19
+ }
20
+
13
21
  export interface ChangeTwoFactorRequest {
14
22
  isTwoFactor: boolean;
15
23
  userId: string;
@@ -70,6 +78,10 @@ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
70
78
  /** * User account service */
71
79
 
72
80
  export interface AccountServiceClient {
81
+ /** Verify account */
82
+
83
+ verifyAccount(request: VerifyAccountRequest): Observable<VerifyAccountResponse>;
84
+
73
85
  /** Switch two factor authentication */
74
86
 
75
87
  changeTwoFactor(request: ChangeTwoFactorRequest): Observable<ChangeTwoFactorResponse>;
@@ -98,6 +110,12 @@ export interface AccountServiceClient {
98
110
  /** * User account service */
99
111
 
100
112
  export interface AccountServiceController {
113
+ /** Verify account */
114
+
115
+ verifyAccount(
116
+ request: VerifyAccountRequest,
117
+ ): Promise<VerifyAccountResponse> | Observable<VerifyAccountResponse> | VerifyAccountResponse;
118
+
101
119
  /** Switch two factor authentication */
102
120
 
103
121
  changeTwoFactor(
@@ -138,6 +156,7 @@ export interface AccountServiceController {
138
156
  export function AccountServiceControllerMethods() {
139
157
  return function (constructor: Function) {
140
158
  const grpcMethods: string[] = [
159
+ "verifyAccount",
141
160
  "changeTwoFactor",
142
161
  "changePassword",
143
162
  "initEmailChange",
package/gen/users.ts ADDED
@@ -0,0 +1,97 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.4
4
+ // protoc v6.33.1
5
+ // source: users.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "users.v1";
12
+
13
+ export interface CreateUserRequest {
14
+ id: string;
15
+ email: string;
16
+ username: string;
17
+ }
18
+
19
+ export interface CreateUserResponse {
20
+ success: boolean;
21
+ }
22
+
23
+ export interface GetUserRequest {
24
+ id: string;
25
+ }
26
+
27
+ export interface GetUserResponse {
28
+ user: User | undefined;
29
+ }
30
+
31
+ export interface ListUsersRequest {
32
+ limit: number;
33
+ }
34
+
35
+ export interface ListUsersResponse {
36
+ users: User[];
37
+ }
38
+
39
+ export interface User {
40
+ id: string;
41
+ email: string;
42
+ username: string;
43
+ avatar: string;
44
+ }
45
+
46
+ export const USERS_V1_PACKAGE_NAME = "users.v1";
47
+
48
+ /** Users service */
49
+
50
+ export interface UsersServiceClient {
51
+ /** Create user */
52
+
53
+ createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
54
+
55
+ /** Get one user by id */
56
+
57
+ getUser(request: GetUserRequest): Observable<GetUserResponse>;
58
+
59
+ /** List users */
60
+
61
+ listUsers(request: ListUsersRequest): Observable<ListUsersResponse>;
62
+ }
63
+
64
+ /** Users service */
65
+
66
+ export interface UsersServiceController {
67
+ /** Create user */
68
+
69
+ createUser(
70
+ request: CreateUserRequest,
71
+ ): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
72
+
73
+ /** Get one user by id */
74
+
75
+ getUser(request: GetUserRequest): Promise<GetUserResponse> | Observable<GetUserResponse> | GetUserResponse;
76
+
77
+ /** List users */
78
+
79
+ listUsers(request: ListUsersRequest): Promise<ListUsersResponse> | Observable<ListUsersResponse> | ListUsersResponse;
80
+ }
81
+
82
+ export function UsersServiceControllerMethods() {
83
+ return function (constructor: Function) {
84
+ const grpcMethods: string[] = ["createUser", "getUser", "listUsers"];
85
+ for (const method of grpcMethods) {
86
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
87
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
88
+ }
89
+ const grpcStreamMethods: string[] = [];
90
+ for (const method of grpcStreamMethods) {
91
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
92
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
93
+ }
94
+ };
95
+ }
96
+
97
+ export const USERS_SERVICE_NAME = "UsersService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsniksnet/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Protobuf definitions and generated typescript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -4,6 +4,9 @@ package account.v1;
4
4
 
5
5
  /*** User account service */
6
6
  service AccountService {
7
+ /** Verify account */
8
+ rpc VerifyAccount (VerifyAccountRequest) returns (VerifyAccountResponse);
9
+
7
10
  /** Switch two factor authentication */
8
11
  rpc ChangeTwoFactor (ChangeTwoFactorRequest) returns (ChangeTwoFactorResponse);
9
12
 
@@ -23,6 +26,14 @@ service AccountService {
23
26
  rpc ConfirmPasswirdReset (ConfirmPasswirdResetRequest) returns (ConfirmPasswirdResetResponse);
24
27
  }
25
28
 
29
+ message VerifyAccountRequest {
30
+ string token = 1;
31
+ }
32
+
33
+ message VerifyAccountResponse {
34
+ bool ok = 1;
35
+ }
36
+
26
37
  message ChangeTwoFactorRequest {
27
38
  bool is_two_factor = 1;
28
39
  string user_id = 2;
@@ -0,0 +1,46 @@
1
+ syntax = "proto3";
2
+
3
+ package users.v1;
4
+
5
+ /** Users service */
6
+ service UsersService {
7
+ /** Create user */
8
+ rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
9
+ /** Get one user by id */
10
+ rpc GetUser (GetUserRequest) returns (GetUserResponse);
11
+ /** List users */
12
+ rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
13
+ }
14
+
15
+ message CreateUserRequest {
16
+ string id = 1;
17
+ string email = 2;
18
+ string username = 3;
19
+ }
20
+
21
+ message CreateUserResponse {
22
+ bool success = 1;
23
+ }
24
+
25
+ message GetUserRequest {
26
+ string id = 1;
27
+ }
28
+
29
+ message GetUserResponse {
30
+ User user = 1;
31
+ }
32
+
33
+ message ListUsersRequest {
34
+ int32 limit = 1;
35
+ }
36
+
37
+ message ListUsersResponse {
38
+ repeated User users = 1;
39
+ }
40
+
41
+ message User {
42
+ string id = 1;
43
+ string email = 2;
44
+ string username = 3;
45
+ string avatar = 4;
46
+ }