@citec-spbu/contracts 1.0.7 → 1.0.9
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/gen/ts/users.d.ts +31 -0
- package/dist/gen/ts/users.js +28 -0
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/package.json +8 -13
- package/proto/users.proto +31 -0
- package/gen/ts/account.ts +0 -57
- package/gen/ts/auth.ts +0 -90
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "users.v1";
|
|
3
|
+
export interface GetMeRequest {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GetMeResponse {
|
|
7
|
+
user: User | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateUserRequest {
|
|
10
|
+
user: User | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateUserResponse {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface User {
|
|
16
|
+
id: string;
|
|
17
|
+
username: string;
|
|
18
|
+
profileUrl: string;
|
|
19
|
+
avatarUrl: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const USERS_V1_PACKAGE_NAME = "users.v1";
|
|
22
|
+
export interface UsersServiceClient {
|
|
23
|
+
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
24
|
+
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
25
|
+
}
|
|
26
|
+
export interface UsersServiceController {
|
|
27
|
+
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
|
28
|
+
createUser(request: CreateUserRequest): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
29
|
+
}
|
|
30
|
+
export declare function UsersServiceControllerMethods(): (constructor: Function) => void;
|
|
31
|
+
export declare const USERS_SERVICE_NAME = "UsersService";
|
|
@@ -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.10.1
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: users.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.USERS_SERVICE_NAME = exports.USERS_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.UsersServiceControllerMethods = UsersServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "users.v1";
|
|
13
|
+
exports.USERS_V1_PACKAGE_NAME = "users.v1";
|
|
14
|
+
function UsersServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = ["getMe", "createUser"];
|
|
17
|
+
for (const method of grpcMethods) {
|
|
18
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
19
|
+
(0, microservices_1.GrpcMethod)("UsersService", 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)("UsersService", method)(constructor.prototype[method], method, descriptor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.USERS_SERVICE_NAME = "UsersService";
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -5,4 +5,5 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
6
|
AUTH: (0, node_path_1.join)(__dirname, "../../proto/auth.proto"),
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, "../../proto/account.proto"),
|
|
8
|
+
USERS: (0, node_path_1.join)(__dirname, "../../proto/users.proto"),
|
|
8
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citec-spbu/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,33 +9,28 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
-
"./gen/ts
|
|
13
|
-
"types": "./dist/gen/ts
|
|
14
|
-
"default": "./dist/gen/ts
|
|
15
|
-
},
|
|
16
|
-
"./gen/ts/account": {
|
|
17
|
-
"types": "./dist/gen/ts/account.d.ts",
|
|
18
|
-
"default": "./dist/gen/ts/account.js"
|
|
12
|
+
"./gen/ts/*": {
|
|
13
|
+
"types": "./dist/gen/ts/*.d.ts",
|
|
14
|
+
"default": "./dist/gen/ts/*.js"
|
|
19
15
|
}
|
|
20
16
|
},
|
|
21
17
|
"scripts": {
|
|
22
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit",
|
|
18
|
+
"generate": "mkdir -p gen/ts && protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit",
|
|
23
19
|
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.gen.json"
|
|
24
20
|
},
|
|
25
21
|
"files": [
|
|
26
22
|
"dist",
|
|
27
|
-
"proto"
|
|
28
|
-
"gen"
|
|
23
|
+
"proto"
|
|
29
24
|
],
|
|
30
25
|
"publishConfig": {
|
|
31
26
|
"access": "public"
|
|
32
27
|
},
|
|
33
28
|
"dependencies": {
|
|
34
29
|
"@nestjs/microservices": "^11.1.11",
|
|
35
|
-
"rxjs": "^7.8.2"
|
|
36
|
-
"ts-proto": "^2.10.1"
|
|
30
|
+
"rxjs": "^7.8.2"
|
|
37
31
|
},
|
|
38
32
|
"devDependencies": {
|
|
33
|
+
"ts-proto": "^2.10.1",
|
|
39
34
|
"@types/node": "^25.0.6",
|
|
40
35
|
"typescript": "^5.9.3"
|
|
41
36
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package users.v1;
|
|
4
|
+
|
|
5
|
+
service UsersService {
|
|
6
|
+
rpc GetMe(GetMeRequest) returns (GetMeResponse);
|
|
7
|
+
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message GetMeRequest {
|
|
11
|
+
string id = 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message GetMeResponse {
|
|
15
|
+
User user = 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message CreateUserRequest {
|
|
19
|
+
User user = 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message CreateUserResponse {
|
|
23
|
+
bool ok = 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message User {
|
|
27
|
+
string id = 1;
|
|
28
|
+
string username = 2;
|
|
29
|
+
string profile_url = 3;
|
|
30
|
+
string avatar_url = 4;
|
|
31
|
+
}
|
package/gen/ts/account.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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: account.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "account.v1";
|
|
12
|
-
|
|
13
|
-
export enum Role {
|
|
14
|
-
ROLE_UNSPECIFIED = 0,
|
|
15
|
-
ROLE_USER = 1,
|
|
16
|
-
ROLE_SUPERVISOR = 2,
|
|
17
|
-
ROLE_ADMIN = 3,
|
|
18
|
-
UNRECOGNIZED = -1,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface GetAccountRequest {
|
|
22
|
-
id: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface GetAccountResponse {
|
|
26
|
-
id: string;
|
|
27
|
-
role: Role;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
31
|
-
|
|
32
|
-
export interface AccountServiceClient {
|
|
33
|
-
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface AccountServiceController {
|
|
37
|
-
getAccount(
|
|
38
|
-
request: GetAccountRequest,
|
|
39
|
-
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function AccountServiceControllerMethods() {
|
|
43
|
-
return function (constructor: Function) {
|
|
44
|
-
const grpcMethods: string[] = ["getAccount"];
|
|
45
|
-
for (const method of grpcMethods) {
|
|
46
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
47
|
-
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
48
|
-
}
|
|
49
|
-
const grpcStreamMethods: string[] = [];
|
|
50
|
-
for (const method of grpcStreamMethods) {
|
|
51
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
52
|
-
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
package/gen/ts/auth.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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: auth.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
-
import { Observable } from "rxjs";
|
|
10
|
-
|
|
11
|
-
export const protobufPackage = "auth.v1";
|
|
12
|
-
|
|
13
|
-
export enum Provider {
|
|
14
|
-
PROVIDER_UNSPECIFIED = 0,
|
|
15
|
-
PROVIDER_GITHUB = 1,
|
|
16
|
-
UNRECOGNIZED = -1,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface GithubLoginRequest {
|
|
20
|
-
provider: Provider;
|
|
21
|
-
providerId: string;
|
|
22
|
-
username: string;
|
|
23
|
-
profileUrl: string;
|
|
24
|
-
avatarUrl: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface GithubLoginResponse {
|
|
28
|
-
tokens: TokenPair | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ValidateJwtRequest {
|
|
32
|
-
accessToken: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ValidateJwtResponse {
|
|
36
|
-
valid: boolean;
|
|
37
|
-
accountId?: string | undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface RefreshRequest {
|
|
41
|
-
refreshToken: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface RefreshResponse {
|
|
45
|
-
tokens: TokenPair | undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TokenPair {
|
|
49
|
-
accessToken: string;
|
|
50
|
-
refreshToken: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
54
|
-
|
|
55
|
-
export interface AuthServiceClient {
|
|
56
|
-
githubLogin(request: GithubLoginRequest): Observable<GithubLoginResponse>;
|
|
57
|
-
|
|
58
|
-
validateJwt(request: ValidateJwtRequest): Observable<ValidateJwtResponse>;
|
|
59
|
-
|
|
60
|
-
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface AuthServiceController {
|
|
64
|
-
githubLogin(
|
|
65
|
-
request: GithubLoginRequest,
|
|
66
|
-
): Promise<GithubLoginResponse> | Observable<GithubLoginResponse> | GithubLoginResponse;
|
|
67
|
-
|
|
68
|
-
validateJwt(
|
|
69
|
-
request: ValidateJwtRequest,
|
|
70
|
-
): Promise<ValidateJwtResponse> | Observable<ValidateJwtResponse> | ValidateJwtResponse;
|
|
71
|
-
|
|
72
|
-
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function AuthServiceControllerMethods() {
|
|
76
|
-
return function (constructor: Function) {
|
|
77
|
-
const grpcMethods: string[] = ["githubLogin", "validateJwt", "refresh"];
|
|
78
|
-
for (const method of grpcMethods) {
|
|
79
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
80
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
81
|
-
}
|
|
82
|
-
const grpcStreamMethods: string[] = [];
|
|
83
|
-
for (const method of grpcStreamMethods) {
|
|
84
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
85
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|