@just-education-org/rpc-contracts 1.8.2 → 1.10.0
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/dist/generated/ts/media.d.ts +54 -0
- package/dist/generated/ts/media.js +28 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/package.json +5 -6
- package/proto/media.proto +58 -0
- /package/dist/generated/{account.d.ts → ts/account.d.ts} +0 -0
- /package/dist/generated/{account.js → ts/account.js} +0 -0
- /package/dist/generated/{auth.d.ts → ts/auth.d.ts} +0 -0
- /package/dist/generated/{auth.js → ts/auth.js} +0 -0
- /package/dist/generated/{users.d.ts → ts/users.d.ts} +0 -0
- /package/dist/generated/{users.js → ts/users.js} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "media.v1";
|
|
3
|
+
export interface UploadRequest {
|
|
4
|
+
fileName: string;
|
|
5
|
+
folder: string;
|
|
6
|
+
contentType: string;
|
|
7
|
+
data: Uint8Array;
|
|
8
|
+
resizeWidth?: number | undefined;
|
|
9
|
+
resizeHeight?: number | undefined;
|
|
10
|
+
convertToWebp?: boolean | undefined;
|
|
11
|
+
thumbnailWidth?: number | undefined;
|
|
12
|
+
thumbnailHeight?: number | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface UploadResponse {
|
|
15
|
+
key: string;
|
|
16
|
+
thumbnailKey: string;
|
|
17
|
+
}
|
|
18
|
+
export interface GetRequest {
|
|
19
|
+
key: string;
|
|
20
|
+
}
|
|
21
|
+
export interface GetResponse {
|
|
22
|
+
data: Uint8Array;
|
|
23
|
+
contentType: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DeleteRequest {
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DeleteResponse {
|
|
29
|
+
ok: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CreatePresignedUrlRequest {
|
|
32
|
+
key: string;
|
|
33
|
+
method: string;
|
|
34
|
+
expiresInSeconds: number;
|
|
35
|
+
contentType: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CreatePresignedUrlResponse {
|
|
38
|
+
url: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
41
|
+
export interface MediaServiceClient {
|
|
42
|
+
upload(request: UploadRequest): Observable<UploadResponse>;
|
|
43
|
+
get(request: GetRequest): Observable<GetResponse>;
|
|
44
|
+
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
|
45
|
+
createPresignedUrl(request: CreatePresignedUrlRequest): Observable<CreatePresignedUrlResponse>;
|
|
46
|
+
}
|
|
47
|
+
export interface MediaServiceController {
|
|
48
|
+
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
|
49
|
+
get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
|
|
50
|
+
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
51
|
+
createPresignedUrl(request: CreatePresignedUrlRequest): Promise<CreatePresignedUrlResponse> | Observable<CreatePresignedUrlResponse> | CreatePresignedUrlResponse;
|
|
52
|
+
}
|
|
53
|
+
export declare function MediaServiceControllerMethods(): (constructor: Function) => void;
|
|
54
|
+
export declare const MEDIA_SERVICE_NAME = "MediaService";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.12.0
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: media.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MEDIA_SERVICE_NAME = exports.MEDIA_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.MediaServiceControllerMethods = MediaServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "media.v1";
|
|
13
|
+
exports.MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
14
|
+
function MediaServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = ["upload", "get", "delete", "createPresignedUrl"];
|
|
17
|
+
for (const method of grpcMethods) {
|
|
18
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
19
|
+
(0, microservices_1.GrpcMethod)("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
20
|
+
}
|
|
21
|
+
const grpcStreamMethods = [];
|
|
22
|
+
for (const method of grpcStreamMethods) {
|
|
23
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
24
|
+
(0, microservices_1.GrpcStreamMethod)("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.MEDIA_SERVICE_NAME = "MediaService";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./proto";
|
|
2
|
-
export * as Account from "./generated/account";
|
|
3
|
-
export * as Auth from "./generated/auth";
|
|
4
|
-
export * as Users from "./generated/users";
|
|
2
|
+
export * as Account from "./generated/ts/account";
|
|
3
|
+
export * as Auth from "./generated/ts/auth";
|
|
4
|
+
export * as Users from "./generated/ts/users";
|
|
5
|
+
export * as Media from "./generated/ts/media";
|
|
5
6
|
export * from "./events";
|
package/dist/index.js
CHANGED
|
@@ -36,9 +36,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Users = exports.Auth = exports.Account = void 0;
|
|
39
|
+
exports.Media = exports.Users = exports.Auth = exports.Account = void 0;
|
|
40
40
|
__exportStar(require("./proto"), exports);
|
|
41
|
-
exports.Account = __importStar(require("./generated/account"));
|
|
42
|
-
exports.Auth = __importStar(require("./generated/auth"));
|
|
43
|
-
exports.Users = __importStar(require("./generated/users"));
|
|
41
|
+
exports.Account = __importStar(require("./generated/ts/account"));
|
|
42
|
+
exports.Auth = __importStar(require("./generated/ts/auth"));
|
|
43
|
+
exports.Users = __importStar(require("./generated/ts/users"));
|
|
44
|
+
exports.Media = __importStar(require("./generated/ts/media"));
|
|
44
45
|
__exportStar(require("./events"), exports);
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -6,4 +6,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
8
|
USERS: (0, path_1.join)(__dirname, "../../proto/users.proto"),
|
|
9
|
+
MEDIA: (0, path_1.join)(__dirname, "../../proto/media.proto"),
|
|
9
10
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@just-education-org/rpc-contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Protobuf definitions and generated TS types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"generate": "protoc -I ./proto ./proto/*.proto --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated --ts_proto_opt=nestJs=true,package=omit",
|
|
9
|
-
"build": "tsc -p tsconfig.build.json"
|
|
8
|
+
"generate": "protoc -I ./proto ./proto/*.proto --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated/ts --ts_proto_opt=nestJs=true,package=omit",
|
|
9
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"proto",
|
|
13
|
-
"gen",
|
|
14
13
|
"dist"
|
|
15
14
|
],
|
|
16
15
|
"author": {
|
|
@@ -27,8 +26,8 @@
|
|
|
27
26
|
"require": "./dist/index.js"
|
|
28
27
|
},
|
|
29
28
|
"./gen/*": {
|
|
30
|
-
"types": "./dist/generated/*.d.ts",
|
|
31
|
-
"require": "./dist/generated/*.js"
|
|
29
|
+
"types": "./dist/generated/ts/*.d.ts",
|
|
30
|
+
"require": "./dist/generated/ts/*.js"
|
|
32
31
|
}
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package media.v1;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/just-education-org/rpc-contracts/src/generated/go;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
|
+
rpc CreatePresignedUrl(CreatePresignedUrlRequest) returns (CreatePresignedUrlResponse);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message UploadRequest {
|
|
16
|
+
string file_name = 1;
|
|
17
|
+
string folder = 2;
|
|
18
|
+
string content_type = 3;
|
|
19
|
+
bytes data = 4;
|
|
20
|
+
optional int32 resize_width = 5;
|
|
21
|
+
optional int32 resize_height = 6;
|
|
22
|
+
optional bool convert_to_webp = 7;
|
|
23
|
+
optional int32 thumbnail_width = 8;
|
|
24
|
+
optional int32 thumbnail_height = 9;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message UploadResponse {
|
|
28
|
+
string key = 1;
|
|
29
|
+
string thumbnail_key = 2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message GetRequest {
|
|
33
|
+
string key = 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message GetResponse {
|
|
37
|
+
bytes data = 1;
|
|
38
|
+
string content_type = 2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
message DeleteRequest {
|
|
42
|
+
string key = 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message DeleteResponse {
|
|
46
|
+
bool ok = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message CreatePresignedUrlRequest {
|
|
50
|
+
string key = 1;
|
|
51
|
+
string method = 2;
|
|
52
|
+
int64 expires_in_seconds = 3;
|
|
53
|
+
string content_type = 4;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
message CreatePresignedUrlResponse {
|
|
57
|
+
string url = 1;
|
|
58
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|