@candesk/contracts 6.2.0 → 6.3.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.
@@ -1,4 +1,5 @@
1
1
  export declare const RMQ_QUEUES: {
2
2
  readonly NOTIFICATIONS: 'notifications_queue';
3
3
  readonly USERS: 'users_queue';
4
+ readonly MEDIA: 'media_queue';
4
5
  };
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RMQ_QUEUES = void 0;
4
4
  exports.RMQ_QUEUES = {
5
5
  NOTIFICATIONS: 'notifications_queue',
6
- USERS: 'users_queue'
6
+ USERS: 'users_queue',
7
+ MEDIA: 'media_queue'
7
8
  };
@@ -0,0 +1,35 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "media.v1";
3
+ export declare enum MediaKind {
4
+ MEDIA_KIND_UNSPECIFIED = 0,
5
+ MEDIA_KIND_AVATAR = 1,
6
+ UNRECOGNIZED = -1
7
+ }
8
+ export interface UploadRequest {
9
+ metadata?: UploadMetadata | undefined;
10
+ chunk?: Uint8Array | undefined;
11
+ }
12
+ export interface UploadMetadata {
13
+ ownerId: string;
14
+ kind: MediaKind;
15
+ }
16
+ export interface UploadResponse {
17
+ key: string;
18
+ }
19
+ export interface GetUrlRequest {
20
+ key: string;
21
+ }
22
+ export interface GetUrlResponse {
23
+ url: string;
24
+ }
25
+ export interface DeleteRequest {
26
+ key: string;
27
+ }
28
+ export interface DeleteResponse {
29
+ ok: boolean;
30
+ }
31
+ export interface MediaService {
32
+ upload(request: Observable<UploadRequest>): Promise<UploadResponse>;
33
+ getUrl(request: GetUrlRequest): Promise<GetUrlResponse>;
34
+ delete(request: DeleteRequest): Promise<DeleteResponse>;
35
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.4
5
+ // protoc v3.21.12
6
+ // source: media.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.MediaKind = exports.protobufPackage = void 0;
9
+ exports.protobufPackage = "media.v1";
10
+ var MediaKind;
11
+ (function (MediaKind) {
12
+ MediaKind[MediaKind["MEDIA_KIND_UNSPECIFIED"] = 0] = "MEDIA_KIND_UNSPECIFIED";
13
+ MediaKind[MediaKind["MEDIA_KIND_AVATAR"] = 1] = "MEDIA_KIND_AVATAR";
14
+ MediaKind[MediaKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
15
+ })(MediaKind || (exports.MediaKind = MediaKind = {}));
@@ -0,0 +1,43 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "media.v1";
3
+ export declare enum MediaKind {
4
+ MEDIA_KIND_UNSPECIFIED = 0,
5
+ MEDIA_KIND_AVATAR = 1,
6
+ UNRECOGNIZED = -1
7
+ }
8
+ export interface UploadRequest {
9
+ metadata?: UploadMetadata | undefined;
10
+ chunk?: Uint8Array | undefined;
11
+ }
12
+ export interface UploadMetadata {
13
+ ownerId: string;
14
+ kind: MediaKind;
15
+ }
16
+ export interface UploadResponse {
17
+ key: string;
18
+ }
19
+ export interface GetUrlRequest {
20
+ key: string;
21
+ }
22
+ export interface GetUrlResponse {
23
+ url: string;
24
+ }
25
+ export interface DeleteRequest {
26
+ key: string;
27
+ }
28
+ export interface DeleteResponse {
29
+ ok: boolean;
30
+ }
31
+ export declare const MEDIA_V1_PACKAGE_NAME = "media.v1";
32
+ export interface MediaServiceClient {
33
+ upload(request: Observable<UploadRequest>): Observable<UploadResponse>;
34
+ getUrl(request: GetUrlRequest): Observable<GetUrlResponse>;
35
+ delete(request: DeleteRequest): Observable<DeleteResponse>;
36
+ }
37
+ export interface MediaServiceController {
38
+ upload(request: Observable<UploadRequest>): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
39
+ getUrl(request: GetUrlRequest): Promise<GetUrlResponse> | Observable<GetUrlResponse> | GetUrlResponse;
40
+ delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
41
+ }
42
+ export declare function MediaServiceControllerMethods(): (constructor: Function) => void;
43
+ export declare const MEDIA_SERVICE_NAME = "MediaService";
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.4
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.MediaKind = exports.protobufPackage = void 0;
9
+ exports.MediaServiceControllerMethods = MediaServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "media.v1";
13
+ var MediaKind;
14
+ (function (MediaKind) {
15
+ MediaKind[MediaKind["MEDIA_KIND_UNSPECIFIED"] = 0] = "MEDIA_KIND_UNSPECIFIED";
16
+ MediaKind[MediaKind["MEDIA_KIND_AVATAR"] = 1] = "MEDIA_KIND_AVATAR";
17
+ MediaKind[MediaKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
18
+ })(MediaKind || (exports.MediaKind = MediaKind = {}));
19
+ exports.MEDIA_V1_PACKAGE_NAME = "media.v1";
20
+ function MediaServiceControllerMethods() {
21
+ return function (constructor) {
22
+ const grpcMethods = ["getUrl", "delete"];
23
+ for (const method of grpcMethods) {
24
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
25
+ (0, microservices_1.GrpcMethod)("MediaService", method)(constructor.prototype[method], method, descriptor);
26
+ Object.defineProperty(constructor.prototype, method, descriptor);
27
+ }
28
+ const grpcStreamMethods = ["upload"];
29
+ for (const method of grpcStreamMethods) {
30
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
31
+ (0, microservices_1.GrpcStreamMethod)("MediaService", method)(constructor.prototype[method], method, descriptor);
32
+ Object.defineProperty(constructor.prototype, method, descriptor);
33
+ }
34
+ };
35
+ }
36
+ exports.MEDIA_SERVICE_NAME = "MediaService";
@@ -2,4 +2,5 @@ export declare const PROTO_PATHS: {
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_PATHS = {
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "Protobuf contracts for CanDesk microservices",
5
5
  "author": {
6
6
  "name": "Alexander Schulz",
@@ -0,0 +1,46 @@
1
+ syntax = "proto3";
2
+
3
+ package media.v1;
4
+
5
+ service MediaService {
6
+ rpc Upload (stream UploadRequest) returns (UploadResponse);
7
+ rpc GetUrl (GetUrlRequest) returns (GetUrlResponse);
8
+ rpc Delete (DeleteRequest) returns (DeleteResponse);
9
+ }
10
+
11
+ enum MediaKind {
12
+ MEDIA_KIND_UNSPECIFIED = 0;
13
+ MEDIA_KIND_AVATAR = 1;
14
+ }
15
+
16
+ message UploadRequest {
17
+ oneof payload {
18
+ UploadMetadata metadata = 1;
19
+ bytes chunk = 2;
20
+ }
21
+ }
22
+
23
+ message UploadMetadata {
24
+ string owner_id = 1;
25
+ MediaKind kind = 2;
26
+ }
27
+
28
+ message UploadResponse {
29
+ string key = 1;
30
+ }
31
+
32
+ message GetUrlRequest {
33
+ string key = 1;
34
+ }
35
+
36
+ message GetUrlResponse {
37
+ string url = 1;
38
+ }
39
+
40
+ message DeleteRequest {
41
+ string key = 1;
42
+ }
43
+
44
+ message DeleteResponse {
45
+ bool ok = 1;
46
+ }