@alebooking/contracts 1.1.3 → 1.1.5

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.
@@ -2,4 +2,5 @@ export declare const PROTO_PATH: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
4
  readonly USER: string;
5
+ readonly MEDIA: string;
5
6
  };
@@ -5,5 +5,6 @@ const path_1 = require("path");
5
5
  exports.PROTO_PATH = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
7
  ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
- USER: (0, path_1.join)(__dirname, '../../proto/user.proto')
8
+ USER: (0, path_1.join)(__dirname, '../../proto/user.proto'),
9
+ MEDIA: (0, path_1.join)(__dirname, '../../proto/media.proto')
9
10
  };
@@ -0,0 +1,76 @@
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: media.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+
11
+ export const protobufPackage = "media.v1";
12
+
13
+ export interface UploadRequest {
14
+ fileName: string;
15
+ folder: string;
16
+ contentType: string;
17
+ data: Uint8Array;
18
+ resizeWidth?: number | undefined;
19
+ resizeHeight?: number | undefined;
20
+ }
21
+
22
+ export interface UploadResponse {
23
+ key: string;
24
+ }
25
+
26
+ export interface GetRequest {
27
+ key: string;
28
+ }
29
+
30
+ export interface GetResponse {
31
+ data: Uint8Array;
32
+ contentType: string;
33
+ }
34
+
35
+ export interface DeleteRequest {
36
+ key: string;
37
+ }
38
+
39
+ export interface DeleteResponse {
40
+ ok: boolean;
41
+ }
42
+
43
+ export const MEDIA_V1_PACKAGE_NAME = "media.v1";
44
+
45
+ export interface MediaServiceClient {
46
+ upload(request: UploadRequest): Observable<UploadResponse>;
47
+
48
+ get(request: GetRequest): Observable<GetResponse>;
49
+
50
+ delete(request: DeleteRequest): Observable<DeleteResponse>;
51
+ }
52
+
53
+ export interface MediaServiceController {
54
+ upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
55
+
56
+ get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
57
+
58
+ delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
59
+ }
60
+
61
+ export function MediaServiceControllerMethods() {
62
+ return function (constructor: Function) {
63
+ const grpcMethods: string[] = ["upload", "get", "delete"];
64
+ for (const method of grpcMethods) {
65
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
66
+ GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
67
+ }
68
+ const grpcStreamMethods: string[] = [];
69
+ for (const method of grpcStreamMethods) {
70
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
71
+ GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
72
+ }
73
+ };
74
+ }
75
+
76
+ export const MEDIA_SERVICE_NAME = "MediaService";
@@ -23,6 +23,16 @@ export interface CreateUserRequest {
23
23
  id: string;
24
24
  }
25
25
 
26
+ export interface PatchUserRequest {
27
+ id: string;
28
+ name?: string | undefined;
29
+ avatar?: string | undefined;
30
+ }
31
+
32
+ export interface PatchUserResponse {
33
+ user: User | undefined;
34
+ }
35
+
26
36
  export interface User {
27
37
  id: string;
28
38
  name?: string | undefined;
@@ -37,17 +47,21 @@ export interface UserServiceClient {
37
47
  getMe(request: GetMeRequest): Observable<GetMeResponse>;
38
48
 
39
49
  createUser(request: CreateUserRequest): Observable<Empty>;
50
+
51
+ patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
40
52
  }
41
53
 
42
54
  export interface UserServiceController {
43
55
  getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
44
56
 
45
57
  createUser(request: CreateUserRequest): void;
58
+
59
+ patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
46
60
  }
47
61
 
48
62
  export function UserServiceControllerMethods() {
49
63
  return function (constructor: Function) {
50
- const grpcMethods: string[] = ["getMe", "createUser"];
64
+ const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
51
65
  for (const method of grpcMethods) {
52
66
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
53
67
  GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@alebooking/contracts",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Protobug definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc -p tsconfig.build.json",
9
- "pregenerate": "node -e \"require('fs').mkdirSync('./gen',{recursive:true})\"",
10
- "generate": "protoc -I=./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
9
+ "pregenerate": "node -e \"require('fs').mkdirSync('./gen/ts',{recursive:true})\" && node -e \"require('fs').mkdirSync('./gen/go',{recursive:true})\"",
10
+ "generate": "protoc -I=./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit"
11
11
  },
12
12
  "files": [
13
13
  "proto",
@@ -0,0 +1,43 @@
1
+ syntax = "proto3";
2
+
3
+ package media.v1;
4
+
5
+ option go_package = "github.com/alebooking/contracts/media;media";
6
+ option java_multiple_files = true;
7
+
8
+ service MediaService {
9
+ rpc Upload (UploadRequest) returns (UploadResponse);
10
+ rpc Get (GetRequest) returns (GetResponse);
11
+ rpc Delete (DeleteRequest) returns (DeleteResponse);
12
+ }
13
+
14
+ message UploadRequest {
15
+ string file_name = 1;
16
+ string folder = 2;
17
+ string content_type = 3;
18
+ bytes data = 4;
19
+ optional int32 resize_width = 5;
20
+ optional int32 resize_height = 6;
21
+ }
22
+
23
+ message UploadResponse {
24
+ string key = 1;
25
+ }
26
+
27
+ message GetRequest {
28
+ string key = 1;
29
+ }
30
+
31
+ message GetResponse {
32
+ bytes data = 1;
33
+ string content_type = 2;
34
+ }
35
+
36
+ message DeleteRequest {
37
+ string key = 1;
38
+ }
39
+
40
+ message DeleteResponse {
41
+ bool ok = 1;
42
+ }
43
+
package/proto/user.proto CHANGED
@@ -7,6 +7,7 @@ import "google/protobuf/empty.proto";
7
7
  service UserService {
8
8
  rpc GetMe (GetMeRequest) returns (GetMeResponse);
9
9
  rpc CreateUser (CreateUserRequest) returns (google.protobuf.Empty);
10
+ rpc PatchUser (PatchUserRequest) returns (PatchUserResponse);
10
11
  }
11
12
 
12
13
  message GetMeRequest {
@@ -21,6 +22,17 @@ message CreateUserRequest {
21
22
  string id = 1;
22
23
  }
23
24
 
25
+ message PatchUserRequest {
26
+ string id = 1;
27
+
28
+ optional string name = 2;
29
+ optional string avatar = 3;
30
+ }
31
+
32
+ message PatchUserResponse {
33
+ User user = 1;
34
+ }
35
+
24
36
  message User {
25
37
  string id = 1;
26
38
  optional string name = 2;
File without changes
File without changes
File without changes