@getastro/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/account.d.ts +31 -0
- package/dist/gen/account.js +34 -0
- package/dist/gen/auth.d.ts +46 -0
- package/dist/gen/auth.js +28 -0
- package/dist/{proto → src/proto}/paths.d.ts +1 -0
- package/dist/{proto → src/proto}/paths.js +1 -0
- package/package.json +6 -3
- package/proto/account.proto +28 -0
- package/gen/auth.ts +0 -91
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{proto → src/proto}/index.d.ts +0 -0
- /package/dist/{proto → src/proto}/index.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "account.v1";
|
|
3
|
+
export declare enum Role {
|
|
4
|
+
USER = 0,
|
|
5
|
+
ADMIN = 1,
|
|
6
|
+
UNRECOGNIZED = -1
|
|
7
|
+
}
|
|
8
|
+
export interface GetAccountRequest {
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GetAccountResponse {
|
|
12
|
+
id: string;
|
|
13
|
+
phone: string;
|
|
14
|
+
email: string;
|
|
15
|
+
isPhoneVerified: boolean;
|
|
16
|
+
isEmailVerified: boolean;
|
|
17
|
+
role: Role;
|
|
18
|
+
}
|
|
19
|
+
export declare const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
20
|
+
/** Сервис для управления аккаунтами пользователей. */
|
|
21
|
+
export interface AccountServiceClient {
|
|
22
|
+
/** Получает информацию об аккаунте по access token. */
|
|
23
|
+
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
24
|
+
}
|
|
25
|
+
/** Сервис для управления аккаунтами пользователей. */
|
|
26
|
+
export interface AccountServiceController {
|
|
27
|
+
/** Получает информацию об аккаунте по access token. */
|
|
28
|
+
getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
29
|
+
}
|
|
30
|
+
export declare function AccountServiceControllerMethods(): (constructor: Function) => void;
|
|
31
|
+
export declare const ACCOUNT_SERVICE_NAME = "AccountService";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.2
|
|
5
|
+
// protoc v6.33.5
|
|
6
|
+
// source: account.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ACCOUNT_SERVICE_NAME = exports.ACCOUNT_V1_PACKAGE_NAME = exports.Role = exports.protobufPackage = void 0;
|
|
9
|
+
exports.AccountServiceControllerMethods = AccountServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "account.v1";
|
|
13
|
+
var Role;
|
|
14
|
+
(function (Role) {
|
|
15
|
+
Role[Role["USER"] = 0] = "USER";
|
|
16
|
+
Role[Role["ADMIN"] = 1] = "ADMIN";
|
|
17
|
+
Role[Role["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
18
|
+
})(Role || (exports.Role = Role = {}));
|
|
19
|
+
exports.ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
20
|
+
function AccountServiceControllerMethods() {
|
|
21
|
+
return function (constructor) {
|
|
22
|
+
const grpcMethods = ["getAccount"];
|
|
23
|
+
for (const method of grpcMethods) {
|
|
24
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
25
|
+
(0, microservices_1.GrpcMethod)("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
26
|
+
}
|
|
27
|
+
const grpcStreamMethods = [];
|
|
28
|
+
for (const method of grpcStreamMethods) {
|
|
29
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
30
|
+
(0, microservices_1.GrpcStreamMethod)("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.ACCOUNT_SERVICE_NAME = "AccountService";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "auth.v1";
|
|
3
|
+
export interface SendOtpRequest {
|
|
4
|
+
identifier: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SendOtpResponse {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface VerifyOtpRequest {
|
|
11
|
+
identifier: string;
|
|
12
|
+
type: string;
|
|
13
|
+
code: string;
|
|
14
|
+
}
|
|
15
|
+
export interface VerifyOtpResponse {
|
|
16
|
+
accessToken: string;
|
|
17
|
+
refreshToken: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RefreshRequest {
|
|
20
|
+
refreshToken: string;
|
|
21
|
+
}
|
|
22
|
+
export interface RefreshResponse {
|
|
23
|
+
accessToken: string;
|
|
24
|
+
refreshToken: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
27
|
+
/** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
|
|
28
|
+
export interface AuthServiceClient {
|
|
29
|
+
/** Отправляет код подтверждения на указанный идентификатор (email/phone). */
|
|
30
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
31
|
+
/** Проверяет код и возвращает пару JWT токенов при успехе. */
|
|
32
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
33
|
+
/** Обновляет access token, используя refresh token. */
|
|
34
|
+
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
35
|
+
}
|
|
36
|
+
/** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
|
|
37
|
+
export interface AuthServiceController {
|
|
38
|
+
/** Отправляет код подтверждения на указанный идентификатор (email/phone). */
|
|
39
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
40
|
+
/** Проверяет код и возвращает пару JWT токенов при успехе. */
|
|
41
|
+
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
42
|
+
/** Обновляет access token, используя refresh token. */
|
|
43
|
+
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
44
|
+
}
|
|
45
|
+
export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
|
|
46
|
+
export declare const AUTH_SERVICE_NAME = "AuthService";
|
package/dist/gen/auth.js
ADDED
|
@@ -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.11.2
|
|
5
|
+
// protoc v6.33.5
|
|
6
|
+
// source: auth.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "auth.v1";
|
|
13
|
+
exports.AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
14
|
+
function AuthServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = ["sendOtp", "verifyOtp", "refresh"];
|
|
17
|
+
for (const method of grpcMethods) {
|
|
18
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
19
|
+
(0, microservices_1.GrpcMethod)("AuthService", 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)("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.AUTH_SERVICE_NAME = "AuthService";
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getastro/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/src/index.js",
|
|
9
|
+
"./gen/*": "./dist/gen/*.js"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "tsc -p tsconfig.build.json",
|
|
9
13
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
14
|
},
|
|
11
15
|
"files": [
|
|
12
16
|
"dist",
|
|
13
|
-
"proto"
|
|
14
|
-
"gen"
|
|
17
|
+
"proto"
|
|
15
18
|
],
|
|
16
19
|
"publishConfig": {
|
|
17
20
|
"access": "public"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
// Сервис для управления аккаунтами пользователей.
|
|
6
|
+
service AccountService {
|
|
7
|
+
// Получает информацию об аккаунте по access token.
|
|
8
|
+
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message GetAccountRequest {
|
|
12
|
+
string id = 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message GetAccountResponse {
|
|
16
|
+
string id = 1;
|
|
17
|
+
string phone = 2;
|
|
18
|
+
string email = 3;
|
|
19
|
+
bool is_phone_verified = 4;
|
|
20
|
+
bool is_email_verified = 5;
|
|
21
|
+
Role role = 6;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
enum Role {
|
|
25
|
+
USER = 0;
|
|
26
|
+
ADMIN = 1;
|
|
27
|
+
}
|
|
28
|
+
|
package/gen/auth.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.2
|
|
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 SendOtpRequest {
|
|
14
|
-
identifier: string;
|
|
15
|
-
type: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SendOtpResponse {
|
|
19
|
-
ok: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface VerifyOtpRequest {
|
|
23
|
-
identifier: string;
|
|
24
|
-
type: string;
|
|
25
|
-
code: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface VerifyOtpResponse {
|
|
29
|
-
accessToken: string;
|
|
30
|
-
refreshToken: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface RefreshRequest {
|
|
34
|
-
refreshToken: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface RefreshResponse {
|
|
38
|
-
accessToken: string;
|
|
39
|
-
refreshToken: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
43
|
-
|
|
44
|
-
/** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
|
|
45
|
-
|
|
46
|
-
export interface AuthServiceClient {
|
|
47
|
-
/** Отправляет код подтверждения на указанный идентификатор (email/phone). */
|
|
48
|
-
|
|
49
|
-
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
50
|
-
|
|
51
|
-
/** Проверяет код и возвращает пару JWT токенов при успехе. */
|
|
52
|
-
|
|
53
|
-
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
54
|
-
|
|
55
|
-
/** Обновляет access token, используя refresh token. */
|
|
56
|
-
|
|
57
|
-
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Сервис аутентификации для управления одноразовыми паролями (OTP) и токенами. */
|
|
61
|
-
|
|
62
|
-
export interface AuthServiceController {
|
|
63
|
-
/** Отправляет код подтверждения на указанный идентификатор (email/phone). */
|
|
64
|
-
|
|
65
|
-
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
66
|
-
|
|
67
|
-
/** Проверяет код и возвращает пару JWT токенов при успехе. */
|
|
68
|
-
|
|
69
|
-
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
70
|
-
|
|
71
|
-
/** Обновляет access token, используя refresh token. */
|
|
72
|
-
|
|
73
|
-
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function AuthServiceControllerMethods() {
|
|
77
|
-
return function (constructor: Function) {
|
|
78
|
-
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
|
|
79
|
-
for (const method of grpcMethods) {
|
|
80
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
81
|
-
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
82
|
-
}
|
|
83
|
-
const grpcStreamMethods: string[] = [];
|
|
84
|
-
for (const method of grpcStreamMethods) {
|
|
85
|
-
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
86
|
-
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const AUTH_SERVICE_NAME = "AuthService";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|