@miteradar/contracts 1.0.1 → 1.0.3
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/auth.d.ts +37 -0
- package/dist/gen/auth.js +35 -0
- package/dist/gen/index.d.ts +1 -0
- package/dist/gen/index.js +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +6 -3
- package/proto/auth.proto +12 -1
- package/gen/auth.ts +0 -60
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "auth.v1";
|
|
3
|
+
export declare enum Role {
|
|
4
|
+
ADMIN = 0,
|
|
5
|
+
MODERATOR = 1,
|
|
6
|
+
USER = 2,
|
|
7
|
+
UNRECOGNIZED = -1
|
|
8
|
+
}
|
|
9
|
+
export interface RegisterRequest {
|
|
10
|
+
login: string;
|
|
11
|
+
password: string;
|
|
12
|
+
role: Role;
|
|
13
|
+
}
|
|
14
|
+
export interface LoginRequest {
|
|
15
|
+
login: string;
|
|
16
|
+
password: string;
|
|
17
|
+
}
|
|
18
|
+
export interface RefreshRequest {
|
|
19
|
+
refreshToken: string;
|
|
20
|
+
}
|
|
21
|
+
export interface TokensResponse {
|
|
22
|
+
accessToken: string;
|
|
23
|
+
refreshToken: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
26
|
+
export interface AuthServiceClient {
|
|
27
|
+
login(request: LoginRequest): Observable<TokensResponse>;
|
|
28
|
+
register(request: RegisterRequest): Observable<TokensResponse>;
|
|
29
|
+
refresh(request: RefreshRequest): Observable<TokensResponse>;
|
|
30
|
+
}
|
|
31
|
+
export interface AuthServiceController {
|
|
32
|
+
login(request: LoginRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
33
|
+
register(request: RegisterRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
34
|
+
refresh(request: RefreshRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
35
|
+
}
|
|
36
|
+
export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
|
|
37
|
+
export declare const AUTH_SERVICE_NAME = "AuthService";
|
package/dist/gen/auth.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.6
|
|
5
|
+
// protoc v6.33.2
|
|
6
|
+
// source: auth.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.Role = exports.protobufPackage = void 0;
|
|
9
|
+
exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "auth.v1";
|
|
13
|
+
var Role;
|
|
14
|
+
(function (Role) {
|
|
15
|
+
Role[Role["ADMIN"] = 0] = "ADMIN";
|
|
16
|
+
Role[Role["MODERATOR"] = 1] = "MODERATOR";
|
|
17
|
+
Role[Role["USER"] = 2] = "USER";
|
|
18
|
+
Role[Role["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
19
|
+
})(Role || (exports.Role = Role = {}));
|
|
20
|
+
exports.AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
21
|
+
function AuthServiceControllerMethods() {
|
|
22
|
+
return function (constructor) {
|
|
23
|
+
const grpcMethods = ["login", "register", "refresh"];
|
|
24
|
+
for (const method of grpcMethods) {
|
|
25
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
26
|
+
(0, microservices_1.GrpcMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
27
|
+
}
|
|
28
|
+
const grpcStreamMethods = [];
|
|
29
|
+
for (const method of grpcStreamMethods) {
|
|
30
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
31
|
+
(0, microservices_1.GrpcStreamMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.AUTH_SERVICE_NAME = "AuthService";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth"), exports);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miteradar/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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 --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
|
|
8
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/gen --ts_proto_opt=nestJs=true,package=omit",
|
|
9
9
|
"build": "tsc -p tsconfig.build.json"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"proto",
|
|
13
|
-
"gen",
|
|
14
13
|
"dist"
|
|
15
14
|
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js",
|
|
17
|
+
"./gen/*": "./dist/gen/*"
|
|
18
|
+
},
|
|
16
19
|
"publishConfig": {
|
|
17
20
|
"access": "public"
|
|
18
21
|
},
|
package/proto/auth.proto
CHANGED
|
@@ -4,10 +4,15 @@ package auth.v1;
|
|
|
4
4
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc Login(LoginRequest) returns(TokensResponse);
|
|
7
|
-
rpc Register(
|
|
7
|
+
rpc Register(RegisterRequest) returns(TokensResponse);
|
|
8
8
|
rpc Refresh(RefreshRequest) returns(TokensResponse);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
message RegisterRequest {
|
|
12
|
+
string login = 1;
|
|
13
|
+
string password = 2;
|
|
14
|
+
Role role = 3;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
message LoginRequest {
|
|
13
18
|
string login = 1;
|
|
@@ -21,4 +26,10 @@ message RefreshRequest {
|
|
|
21
26
|
message TokensResponse {
|
|
22
27
|
string access_token = 1;
|
|
23
28
|
string refresh_token = 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
enum Role {
|
|
32
|
+
ADMIN = 0;
|
|
33
|
+
MODERATOR = 1;
|
|
34
|
+
USER = 2;
|
|
24
35
|
}
|
package/gen/auth.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.6
|
|
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 interface LoginRequest {
|
|
14
|
-
login: string;
|
|
15
|
-
password: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface RefreshRequest {
|
|
19
|
-
refreshToken: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface TokensResponse {
|
|
23
|
-
accessToken: string;
|
|
24
|
-
refreshToken: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
28
|
-
|
|
29
|
-
export interface AuthServiceClient {
|
|
30
|
-
login(request: LoginRequest): Observable<TokensResponse>;
|
|
31
|
-
|
|
32
|
-
register(request: LoginRequest): Observable<TokensResponse>;
|
|
33
|
-
|
|
34
|
-
refresh(request: RefreshRequest): Observable<TokensResponse>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface AuthServiceController {
|
|
38
|
-
login(request: LoginRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
39
|
-
|
|
40
|
-
register(request: LoginRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
41
|
-
|
|
42
|
-
refresh(request: RefreshRequest): Promise<TokensResponse> | Observable<TokensResponse> | TokensResponse;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function AuthServiceControllerMethods() {
|
|
46
|
-
return function (constructor: Function) {
|
|
47
|
-
const grpcMethods: string[] = ["login", "register", "refresh"];
|
|
48
|
-
for (const method of grpcMethods) {
|
|
49
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
50
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
51
|
-
}
|
|
52
|
-
const grpcStreamMethods: string[] = [];
|
|
53
|
-
for (const method of grpcStreamMethods) {
|
|
54
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
55
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|