@getastro/contracts 1.0.3 → 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.
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.11.2
5
- // protoc v6.33.5
5
+ // protoc v3.21.12
6
6
  // source: account.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.ACCOUNT_SERVICE_NAME = exports.ACCOUNT_V1_PACKAGE_NAME = exports.Role = exports.protobufPackage = void 0;
package/dist/gen/auth.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.11.2
5
- // protoc v6.33.5
5
+ // protoc v3.21.12
6
6
  // source: auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
package/gen/account.ts ADDED
@@ -0,0 +1,67 @@
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: 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
+ USER = 0,
15
+ ADMIN = 1,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export interface GetAccountRequest {
20
+ id: string;
21
+ }
22
+
23
+ export interface GetAccountResponse {
24
+ id: string;
25
+ phone: string;
26
+ email: string;
27
+ isPhoneVerified: boolean;
28
+ isEmailVerified: boolean;
29
+ role: Role;
30
+ }
31
+
32
+ export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
33
+
34
+ /** Сервис для управления аккаунтами пользователей. */
35
+
36
+ export interface AccountServiceClient {
37
+ /** Получает информацию об аккаунте по access token. */
38
+
39
+ getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
40
+ }
41
+
42
+ /** Сервис для управления аккаунтами пользователей. */
43
+
44
+ export interface AccountServiceController {
45
+ /** Получает информацию об аккаунте по access token. */
46
+
47
+ getAccount(
48
+ request: GetAccountRequest,
49
+ ): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
50
+ }
51
+
52
+ export function AccountServiceControllerMethods() {
53
+ return function (constructor: Function) {
54
+ const grpcMethods: string[] = ["getAccount"];
55
+ for (const method of grpcMethods) {
56
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
57
+ GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
58
+ }
59
+ const grpcStreamMethods: string[] = [];
60
+ for (const method of grpcStreamMethods) {
61
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
62
+ GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
63
+ }
64
+ };
65
+ }
66
+
67
+ export const ACCOUNT_SERVICE_NAME = "AccountService";
package/gen/auth.ts ADDED
@@ -0,0 +1,91 @@
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";
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "@getastro/contracts",
3
- "version": "1.0.3",
4
- "description": "Protobuf definitions and generated TypeScript types",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "1.0.4",
4
+ "main": "./dist/src/index.js",
5
+ "types": "./dist/src/index.d.ts",
7
6
  "exports": {
8
7
  ".": "./dist/src/index.js",
9
- "./gen/*": "./dist/gen/*.js"
8
+ "./gen/*": "./dist/gen/*.js",
9
+ "./proto/*": "./proto/*.proto"
10
10
  },
11
11
  "scripts": {
12
- "build": "tsc -p tsconfig.build.json",
13
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
12
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
13
+ "build": "npm run generate && tsc -p tsconfig.build.json"
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
- "proto"
17
+ "proto",
18
+ "gen"
18
19
  ],
19
20
  "publishConfig": {
20
21
  "access": "public"