@requ1emz/contracts 1.0.12 → 1.0.14

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/family.ts ADDED
@@ -0,0 +1,73 @@
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: family.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 = "family.v1";
13
+
14
+ export interface CreateFamilyRequest {
15
+ userId: string;
16
+ name: string;
17
+ }
18
+
19
+ export interface DeleteFamilyRequest {
20
+ userId: string;
21
+ familyId: string;
22
+ }
23
+
24
+ export interface GetFamilyRequest {
25
+ userId: string;
26
+ }
27
+
28
+ export interface FamilyResponse {
29
+ id: string;
30
+ name: string;
31
+ createdBy: string;
32
+ members: FamilyMemberDto[];
33
+ }
34
+
35
+ export interface FamilyMemberDto {
36
+ userId: string;
37
+ role: string;
38
+ }
39
+
40
+ export const FAMILY_V1_PACKAGE_NAME = "family.v1";
41
+
42
+ export interface FamilyServiceClient {
43
+ createFamily(request: CreateFamilyRequest): Observable<FamilyResponse>;
44
+
45
+ deleteFamily(request: DeleteFamilyRequest): Observable<Empty>;
46
+
47
+ getFamily(request: GetFamilyRequest): Observable<FamilyResponse>;
48
+ }
49
+
50
+ export interface FamilyServiceController {
51
+ createFamily(request: CreateFamilyRequest): Promise<FamilyResponse> | Observable<FamilyResponse> | FamilyResponse;
52
+
53
+ deleteFamily(request: DeleteFamilyRequest): void;
54
+
55
+ getFamily(request: GetFamilyRequest): Promise<FamilyResponse> | Observable<FamilyResponse> | FamilyResponse;
56
+ }
57
+
58
+ export function FamilyServiceControllerMethods() {
59
+ return function (constructor: Function) {
60
+ const grpcMethods: string[] = ["createFamily", "deleteFamily", "getFamily"];
61
+ for (const method of grpcMethods) {
62
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
63
+ GrpcMethod("FamilyService", method)(constructor.prototype[method], method, descriptor);
64
+ }
65
+ const grpcStreamMethods: string[] = [];
66
+ for (const method of grpcStreamMethods) {
67
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
68
+ GrpcStreamMethod("FamilyService", method)(constructor.prototype[method], method, descriptor);
69
+ }
70
+ };
71
+ }
72
+
73
+ export const FAMILY_SERVICE_NAME = "FamilyService";
@@ -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/gen/user.ts CHANGED
@@ -10,6 +10,14 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "user.v1";
12
12
 
13
+ export interface SendCheckUserExistsRequest {
14
+ email: string;
15
+ }
16
+
17
+ export interface SendCheckUserExistsResponse {
18
+ exists: boolean;
19
+ }
20
+
13
21
  export interface SendCreateUserRequest {
14
22
  email: string;
15
23
  passwordHash: string;
@@ -52,6 +60,8 @@ export interface SendDeleteUserResponse {
52
60
  export const USER_V1_PACKAGE_NAME = "user.v1";
53
61
 
54
62
  export interface UserServiceClient {
63
+ checkUserExists(request: SendCheckUserExistsRequest): Observable<SendCheckUserExistsResponse>;
64
+
55
65
  createUser(request: SendCreateUserRequest): Observable<SendCreateUserResponse>;
56
66
 
57
67
  getUser(request: SendGetUserRequest): Observable<SendGetUserResponse>;
@@ -62,6 +72,10 @@ export interface UserServiceClient {
62
72
  }
63
73
 
64
74
  export interface UserServiceController {
75
+ checkUserExists(
76
+ request: SendCheckUserExistsRequest,
77
+ ): Promise<SendCheckUserExistsResponse> | Observable<SendCheckUserExistsResponse> | SendCheckUserExistsResponse;
78
+
65
79
  createUser(
66
80
  request: SendCreateUserRequest,
67
81
  ): Promise<SendCreateUserResponse> | Observable<SendCreateUserResponse> | SendCreateUserResponse;
@@ -81,7 +95,7 @@ export interface UserServiceController {
81
95
 
82
96
  export function UserServiceControllerMethods() {
83
97
  return function (constructor: Function) {
84
- const grpcMethods: string[] = ["createUser", "getUser", "updateUser", "deleteUser"];
98
+ const grpcMethods: string[] = ["checkUserExists", "createUser", "getUser", "updateUser", "deleteUser"];
85
99
  for (const method of grpcMethods) {
86
100
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
87
101
  GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@requ1emz/contracts",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -0,0 +1,36 @@
1
+ syntax = "proto3";
2
+
3
+ package family.v1;
4
+ import "google/protobuf/empty.proto";
5
+
6
+ service FamilyService {
7
+ rpc CreateFamily (CreateFamilyRequest) returns (FamilyResponse);
8
+ rpc DeleteFamily (DeleteFamilyRequest) returns (google.protobuf.Empty);
9
+ rpc GetFamily (GetFamilyRequest) returns (FamilyResponse);
10
+ }
11
+
12
+ message CreateFamilyRequest {
13
+ string user_id = 1;
14
+ string name = 2;
15
+ }
16
+
17
+ message DeleteFamilyRequest {
18
+ string user_id = 1;
19
+ string family_id = 2;
20
+ }
21
+
22
+ message GetFamilyRequest {
23
+ string user_id = 1;
24
+ }
25
+
26
+ message FamilyResponse {
27
+ string id = 1;
28
+ string name = 2;
29
+ string created_by = 3;
30
+ repeated FamilyMemberDto members = 4;
31
+ }
32
+
33
+ message FamilyMemberDto {
34
+ string user_id = 1;
35
+ string role = 2;
36
+ }
package/proto/user.proto CHANGED
@@ -3,12 +3,21 @@ syntax = "proto3";
3
3
  package user.v1;
4
4
 
5
5
  service UserService {
6
+ rpc CheckUserExists (SendCheckUserExistsRequest) returns (SendCheckUserExistsResponse);
6
7
  rpc CreateUser (SendCreateUserRequest) returns (SendCreateUserResponse);
7
8
  rpc GetUser (SendGetUserRequest) returns (SendGetUserResponse);
8
9
  rpc UpdateUser (SendUpdateUserRequest) returns (SendUpdateUserResponse);
9
10
  rpc DeleteUser (SendDeleteUserRequest) returns (SendDeleteUserResponse);
10
11
  }
11
12
 
13
+ message SendCheckUserExistsRequest {
14
+ string email = 1;
15
+ }
16
+
17
+ message SendCheckUserExistsResponse {
18
+ bool exists = 1;
19
+ }
20
+
12
21
  message SendCreateUserRequest {
13
22
  string email = 1;
14
23
  string password_hash = 2;