@citec-spbu/contracts 1.0.2 → 1.0.4
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/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +1 -0
- package/gen/ts/account.ts +57 -0
- package/gen/ts/auth.ts +23 -25
- package/package.json +1 -1
- package/proto/account.proto +23 -0
- package/proto/auth.proto +15 -15
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
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
CHANGED
|
@@ -10,64 +10,62 @@ import { Observable } from "rxjs";
|
|
|
10
10
|
|
|
11
11
|
export const protobufPackage = "auth.v1";
|
|
12
12
|
|
|
13
|
-
export interface
|
|
14
|
-
|
|
13
|
+
export interface GenerateJwtRequest {
|
|
14
|
+
provider: string;
|
|
15
|
+
providerId: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export interface
|
|
18
|
-
|
|
18
|
+
export interface GenerateJwtResponse {
|
|
19
|
+
tokens: TokenPair | undefined;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export interface
|
|
22
|
-
|
|
23
|
-
state: string;
|
|
22
|
+
export interface ValidateJwtRequest {
|
|
23
|
+
accessToken: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export interface
|
|
27
|
-
|
|
26
|
+
export interface ValidateJwtResponse {
|
|
27
|
+
valid: boolean;
|
|
28
|
+
accountId: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export interface
|
|
31
|
+
export interface RefreshRequest {
|
|
31
32
|
refreshToken: string;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export interface
|
|
35
|
+
export interface RefreshResponse {
|
|
35
36
|
tokens: TokenPair | undefined;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export interface TokenPair {
|
|
39
40
|
accessToken: string;
|
|
40
41
|
refreshToken: string;
|
|
41
|
-
expiresIn: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
45
45
|
|
|
46
46
|
export interface AuthServiceClient {
|
|
47
|
-
|
|
47
|
+
generateJwt(request: GenerateJwtRequest): Observable<GenerateJwtResponse>;
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
validateJwt(request: ValidateJwtRequest): Observable<ValidateJwtResponse>;
|
|
50
50
|
|
|
51
|
-
refresh(request:
|
|
51
|
+
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export interface AuthServiceController {
|
|
55
|
-
|
|
56
|
-
request:
|
|
57
|
-
): Promise<
|
|
55
|
+
generateJwt(
|
|
56
|
+
request: GenerateJwtRequest,
|
|
57
|
+
): Promise<GenerateJwtResponse> | Observable<GenerateJwtResponse> | GenerateJwtResponse;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
request:
|
|
61
|
-
): Promise<
|
|
59
|
+
validateJwt(
|
|
60
|
+
request: ValidateJwtRequest,
|
|
61
|
+
): Promise<ValidateJwtResponse> | Observable<ValidateJwtResponse> | ValidateJwtResponse;
|
|
62
62
|
|
|
63
|
-
refresh(
|
|
64
|
-
request: RefreshTokenRequest,
|
|
65
|
-
): Promise<RefreshTokenResponse> | Observable<RefreshTokenResponse> | RefreshTokenResponse;
|
|
63
|
+
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
export function AuthServiceControllerMethods() {
|
|
69
67
|
return function (constructor: Function) {
|
|
70
|
-
const grpcMethods: string[] = ["
|
|
68
|
+
const grpcMethods: string[] = ["generateJwt", "validateJwt", "refresh"];
|
|
71
69
|
for (const method of grpcMethods) {
|
|
72
70
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
71
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
service AccountService {
|
|
6
|
+
rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message GetAccountRequest {
|
|
10
|
+
string id = 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message GetAccountResponse {
|
|
14
|
+
string id = 1;
|
|
15
|
+
Role role = 2;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
enum Role {
|
|
19
|
+
ROLE_UNSPECIFIED = 0;
|
|
20
|
+
ROLE_USER = 1;
|
|
21
|
+
ROLE_SUPERVISOR = 2;
|
|
22
|
+
ROLE_ADMIN = 3;
|
|
23
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -3,40 +3,40 @@ syntax = "proto3";
|
|
|
3
3
|
package auth.v1;
|
|
4
4
|
|
|
5
5
|
service AuthService {
|
|
6
|
-
rpc
|
|
6
|
+
rpc GenerateJwt(GenerateJwtRequest) returns (GenerateJwtResponse);
|
|
7
7
|
|
|
8
|
-
rpc
|
|
8
|
+
rpc ValidateJwt(ValidateJwtRequest) returns (ValidateJwtResponse);
|
|
9
9
|
|
|
10
|
-
rpc Refresh(
|
|
10
|
+
rpc Refresh(RefreshRequest) returns (RefreshResponse);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
message
|
|
14
|
-
string
|
|
13
|
+
message GenerateJwtRequest {
|
|
14
|
+
string provider = 1;
|
|
15
|
+
string provider_id = 2;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
message
|
|
18
|
-
|
|
18
|
+
message GenerateJwtResponse {
|
|
19
|
+
TokenPair tokens = 1;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
message
|
|
22
|
-
string
|
|
23
|
-
string state = 2;
|
|
22
|
+
message ValidateJwtRequest {
|
|
23
|
+
string access_token = 1;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
message
|
|
27
|
-
|
|
26
|
+
message ValidateJwtResponse {
|
|
27
|
+
bool valid = 1;
|
|
28
|
+
string account_id = 2;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
message
|
|
31
|
+
message RefreshRequest {
|
|
31
32
|
string refresh_token = 1;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
message
|
|
35
|
+
message RefreshResponse {
|
|
35
36
|
TokenPair tokens = 1;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
message TokenPair {
|
|
39
40
|
string access_token = 1;
|
|
40
41
|
string refresh_token = 2;
|
|
41
|
-
int64 expires_in = 3;
|
|
42
42
|
}
|