@candesk/contracts 4.0.0 → 4.1.1

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.
@@ -0,0 +1,15 @@
1
+ export declare const protobufPackage = "user.v1";
2
+ export interface GetUserRequest {
3
+ id: string;
4
+ }
5
+ export interface GetUserResponse {
6
+ user: User | undefined;
7
+ }
8
+ export interface User {
9
+ id: string;
10
+ name?: string | undefined;
11
+ avatar?: string | undefined;
12
+ }
13
+ export interface UserService {
14
+ getUser(request: GetUserRequest): Promise<GetUserResponse>;
15
+ }
@@ -0,0 +1,10 @@
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: user.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "user.v1";
@@ -0,0 +1,22 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "user.v1";
3
+ export interface GetUserRequest {
4
+ id: string;
5
+ }
6
+ export interface GetUserResponse {
7
+ user: User | undefined;
8
+ }
9
+ export interface User {
10
+ id: string;
11
+ name?: string | undefined;
12
+ avatar?: string | undefined;
13
+ }
14
+ export declare const USER_V1_PACKAGE_NAME = "user.v1";
15
+ export interface UserServiceClient {
16
+ getUser(request: GetUserRequest): Observable<GetUserResponse>;
17
+ }
18
+ export interface UserServiceController {
19
+ getUser(request: GetUserRequest): Promise<GetUserResponse> | Observable<GetUserResponse> | GetUserResponse;
20
+ }
21
+ export declare function UserServiceControllerMethods(): (constructor: Function) => void;
22
+ export declare const USER_SERVICE_NAME = "UserService";
@@ -0,0 +1,30 @@
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: user.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.USER_SERVICE_NAME = exports.USER_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.UserServiceControllerMethods = UserServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "user.v1";
13
+ exports.USER_V1_PACKAGE_NAME = "user.v1";
14
+ function UserServiceControllerMethods() {
15
+ return function (constructor) {
16
+ const grpcMethods = ["getUser"];
17
+ for (const method of grpcMethods) {
18
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
19
+ (0, microservices_1.GrpcMethod)("UserService", method)(constructor.prototype[method], method, descriptor);
20
+ Object.defineProperty(constructor.prototype, method, descriptor);
21
+ }
22
+ const grpcStreamMethods = [];
23
+ for (const method of grpcStreamMethods) {
24
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
25
+ (0, microservices_1.GrpcStreamMethod)("UserService", method)(constructor.prototype[method], method, descriptor);
26
+ Object.defineProperty(constructor.prototype, method, descriptor);
27
+ }
28
+ };
29
+ }
30
+ exports.USER_SERVICE_NAME = "UserService";
@@ -1,4 +1,5 @@
1
1
  export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly ACCOUNT: string;
4
+ readonly USER: string;
4
5
  };
@@ -4,5 +4,6 @@ exports.PROTO_PATHS = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
- ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto')
7
+ ACCOUNT: (0, path_1.join)(__dirname, '../../proto/account.proto'),
8
+ USER: (0, path_1.join)(__dirname, '../../proto/user.proto')
8
9
  };
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "4.0.0",
4
- "description": "Protobuf contracts for Candesk microservices",
3
+ "version": "4.1.1",
4
+ "description": "Protobuf contracts for CanDesk microservices",
5
+ "author": {
6
+ "name": "Alexander Schulz",
7
+ "email": "info@candesk.de"
8
+ },
9
+ "license": "UNLICENSED",
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/candesk-app/contracts.git"
16
+ },
5
17
  "main": "./dist/index.js",
6
18
  "types": "./dist/index.d.ts",
7
19
  "exports": {
@@ -18,6 +30,10 @@
18
30
  "default": "./dist/nest/*.js"
19
31
  }
20
32
  },
33
+ "files": [
34
+ "dist",
35
+ "proto"
36
+ ],
21
37
  "scripts": {
22
38
  "build": "tsc -p tsconfig.build.json",
23
39
  "generate": "yarn generate:types && yarn generate:nest",
@@ -25,13 +41,6 @@
25
41
  "generate:nest": "node -e \"require('fs').mkdirSync('src/nest',{recursive:true})\" && protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/nest --ts_proto_opt=nestJs=true,package=omit,forceLong=string",
26
42
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
27
43
  },
28
- "files": [
29
- "dist",
30
- "proto"
31
- ],
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
44
  "devDependencies": {
36
45
  "@candesk/core": "^1.1.2",
37
46
  "@nestjs/common": "^12.1.0",
@@ -0,0 +1,21 @@
1
+ syntax = "proto3";
2
+
3
+ package user.v1;
4
+
5
+ service UserService {
6
+ rpc GetUser (GetUserRequest) returns (GetUserResponse);
7
+ }
8
+
9
+ message GetUserRequest {
10
+ string id = 1;
11
+ }
12
+
13
+ message GetUserResponse {
14
+ User user = 1;
15
+ }
16
+
17
+ message User {
18
+ string id = 1;
19
+ optional string name = 2;
20
+ optional string avatar = 3;
21
+ }