Compare commits
34 Commits
7f6ae4ddc0
...
v1.0.12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f1a68df5a | ||
|
|
9f5afc5a36 | ||
|
|
6666bb1a74 | ||
|
|
f6366f14b5 | ||
|
|
39d0e360a2 | ||
|
|
4f038b0f92 | ||
|
|
f592ccc021 | ||
|
|
b16f526fb5 | ||
|
|
55cf38c8c2 | ||
|
|
c5e57adf5b | ||
|
|
ea6a3e7777 | ||
|
|
3ef32ab618 | ||
|
|
d81e20c41a | ||
|
|
b8715f8f31 | ||
|
|
0d3bf2ca36 | ||
|
|
970873d536 | ||
|
|
b7d9039783 | ||
|
|
e530608121 | ||
|
|
91c262e2a6 | ||
|
|
60eb6068ec | ||
|
|
a225dd4a48 | ||
|
|
b00a823b50 | ||
|
|
15c2ed57c7 | ||
|
|
273bdd685b | ||
|
|
f5d18a63e5 | ||
|
|
0c494faa6b | ||
|
|
54bff3da7d | ||
|
|
7cbe61f226 | ||
|
|
287cd340de | ||
|
|
d4196e16f9 | ||
|
|
4a1eb650f4 | ||
|
|
e55fd159cb | ||
|
|
1eb1d4b946 | ||
|
|
c956cd29f0 |
47
.github/workflows/publish.yml
vendored
47
.github/workflows/publish.yml
vendored
@@ -9,6 +9,8 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
name: Publish Job
|
name: Publish Job
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -17,18 +19,51 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
registry-url: "https://registry.npmjs.org/"
|
registry-url: "https://git.lendry.ru/api/packages/lendry-erp/npm/"
|
||||||
|
scope: "@lendry-erp"
|
||||||
|
|
||||||
|
# 1. Устанавливаем Go (нужен для скачивания плагинов генерации)
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.22" # Можно указать нужную тебе версию
|
||||||
|
|
||||||
|
# 2. Устанавливаем плагины генерации для Go и добавляем их в PATH
|
||||||
|
- name: Install Go Protoc Plugins
|
||||||
|
run: |
|
||||||
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install protoc
|
- name: Install protoc
|
||||||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: npm install
|
run: npm ci
|
||||||
|
|
||||||
- name: Generate TS Protobuf
|
- name: Build
|
||||||
run: npm run generate
|
run: npm run build
|
||||||
|
|
||||||
|
# 3. Исправленный шаг генерации (команды разделены, добавлено создание папки)
|
||||||
|
- name: Generate Protobuf
|
||||||
|
run: |
|
||||||
|
npm install -g ts-proto
|
||||||
|
mkdir -p ./gen/go # Создаем вложенную папку для Go
|
||||||
|
protoc -I ./proto ./proto/*.proto \
|
||||||
|
--ts_proto_out=nestJs=true,package=omit:./gen \
|
||||||
|
--go_out=paths=source_relative:./gen/go \
|
||||||
|
--go-grpc_out=paths=source_relative:./gen/go
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
# Представляемся Git-ботом
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
# Добавляем папку gen в индекс
|
||||||
|
git add ./gen
|
||||||
|
|
||||||
|
# Проверяем, есть ли изменения. Если есть — коммитим и пушим.
|
||||||
|
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: auto-generate protobuf files [skip ci]" && git push)
|
||||||
- name: Publish package
|
- name: Publish package
|
||||||
run: npm publish
|
run: npm publish
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|||||||
1
.npmrc
Normal file
1
.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@lendry-erp:registry=https://git.lendry.ru/api/packages/lendry-erp/npm/
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// protoc-gen-ts_proto v2.11.6
|
|
||||||
// protoc v7.34.1
|
|
||||||
// source: google/protobuf/any.proto
|
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
export const protobufPackage = "google.protobuf";
|
|
||||||
|
|
||||||
export interface Any {
|
|
||||||
typeUrl: string;
|
|
||||||
value: Uint8Array;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// protoc-gen-ts_proto v2.11.6
|
|
||||||
// protoc v7.34.1
|
|
||||||
// source: google/rpc/status.proto
|
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
import { Any } from "../protobuf/any";
|
|
||||||
|
|
||||||
export const protobufPackage = "google.rpc";
|
|
||||||
|
|
||||||
export interface Status {
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
details: Any[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GOOGLE_RPC_PACKAGE_NAME = "google.rpc";
|
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-ts_proto v2.11.6
|
// protoc-gen-ts_proto v2.11.6
|
||||||
// protoc v7.34.1
|
// protoc v7.34.1
|
||||||
// source: auth.proto
|
// source: identity.proto
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
import { Observable } from "rxjs";
|
import { Observable } from "rxjs";
|
||||||
import { Status } from "./google/rpc/status";
|
import { Status } from "./google/rpc/status";
|
||||||
|
|
||||||
export const protobufPackage = "auth.v1";
|
export const protobufPackage = "identity";
|
||||||
|
|
||||||
export interface LoginRequest {
|
export interface LoginRequest {
|
||||||
username: string;
|
username: string;
|
||||||
@@ -18,34 +18,52 @@ export interface LoginRequest {
|
|||||||
|
|
||||||
export interface LoginResponse {
|
export interface LoginResponse {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
status: string;
|
status: string;
|
||||||
need2fa: boolean;
|
need2fa: boolean;
|
||||||
tempToken: string;
|
tempToken?: string | undefined;
|
||||||
|
message?: string | undefined;
|
||||||
|
errorCode?: string | undefined;
|
||||||
|
error?: Status | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RefreshRequest {
|
||||||
|
refreshToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RefreshResponse {
|
||||||
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LogoutRequest {
|
||||||
|
accessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LogoutResponse {
|
||||||
|
success: boolean;
|
||||||
message: string;
|
message: string;
|
||||||
errorCode: string;
|
|
||||||
error: Status | undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegisterRequest {
|
export interface UnlockPinRequest {
|
||||||
username: string;
|
accessToken: string;
|
||||||
password: string;
|
pinCode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegisterResponse {
|
export interface UnlockPinResponse {
|
||||||
userId: string;
|
success: boolean;
|
||||||
status: string;
|
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Verify2FaRequest {
|
export interface Verify2FaRequest {
|
||||||
tempToken: string;
|
tempToken: string;
|
||||||
totpCode: string;
|
totpCode?: string | undefined;
|
||||||
telegramCode: string;
|
telegramCode?: string | undefined;
|
||||||
reserveCode: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Verify2FaResponse {
|
export interface Verify2FaResponse {
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
refreshToken: string;
|
||||||
status: string;
|
status: string;
|
||||||
message: string;
|
message: string;
|
||||||
reserveCodes: string[];
|
reserveCodes: string[];
|
||||||
@@ -130,12 +148,16 @@ export interface DisableTelegramResponse {
|
|||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
export const IDENTITY_PACKAGE_NAME = "identity";
|
||||||
|
|
||||||
export interface AuthServiceClient {
|
export interface AuthServiceClient {
|
||||||
login(request: LoginRequest): Observable<LoginResponse>;
|
login(request: LoginRequest): Observable<LoginResponse>;
|
||||||
|
|
||||||
register(request: RegisterRequest): Observable<RegisterResponse>;
|
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
||||||
|
|
||||||
|
logout(request: LogoutRequest): Observable<LogoutResponse>;
|
||||||
|
|
||||||
|
unlockPin(request: UnlockPinRequest): Observable<UnlockPinResponse>;
|
||||||
|
|
||||||
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
|
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
|
||||||
}
|
}
|
||||||
@@ -143,14 +165,18 @@ export interface AuthServiceClient {
|
|||||||
export interface AuthServiceController {
|
export interface AuthServiceController {
|
||||||
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
||||||
|
|
||||||
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
|
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
||||||
|
|
||||||
|
logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
|
||||||
|
|
||||||
|
unlockPin(request: UnlockPinRequest): Promise<UnlockPinResponse> | Observable<UnlockPinResponse> | UnlockPinResponse;
|
||||||
|
|
||||||
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
|
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AuthServiceControllerMethods() {
|
export function AuthServiceControllerMethods() {
|
||||||
return function (constructor: Function) {
|
return function (constructor: Function) {
|
||||||
const grpcMethods: string[] = ["login", "register", "verify2Fa"];
|
const grpcMethods: string[] = ["login", "refresh", "logout", "unlockPin", "verify2Fa"];
|
||||||
for (const method of grpcMethods) {
|
for (const method of grpcMethods) {
|
||||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||||
@@ -165,7 +191,7 @@ export function AuthServiceControllerMethods() {
|
|||||||
|
|
||||||
export const AUTH_SERVICE_NAME = "AuthService";
|
export const AUTH_SERVICE_NAME = "AuthService";
|
||||||
|
|
||||||
export interface TwoFaSrviceClient {
|
export interface TwoFaServiceClient {
|
||||||
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
|
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
|
||||||
|
|
||||||
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
|
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
|
||||||
@@ -183,7 +209,7 @@ export interface TwoFaSrviceClient {
|
|||||||
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
|
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TwoFaSrviceController {
|
export interface TwoFaServiceController {
|
||||||
getTwoFaStatus(
|
getTwoFaStatus(
|
||||||
request: GetTwoFaStatusRequest,
|
request: GetTwoFaStatusRequest,
|
||||||
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
|
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
|
||||||
@@ -223,7 +249,7 @@ export interface TwoFaSrviceController {
|
|||||||
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
|
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TwoFaSrviceControllerMethods() {
|
export function TwoFaServiceControllerMethods() {
|
||||||
return function (constructor: Function) {
|
return function (constructor: Function) {
|
||||||
const grpcMethods: string[] = [
|
const grpcMethods: string[] = [
|
||||||
"getTwoFaStatus",
|
"getTwoFaStatus",
|
||||||
@@ -237,14 +263,14 @@ export function TwoFaSrviceControllerMethods() {
|
|||||||
];
|
];
|
||||||
for (const method of grpcMethods) {
|
for (const method of grpcMethods) {
|
||||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
GrpcMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
|
GrpcMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
||||||
}
|
}
|
||||||
const grpcStreamMethods: string[] = [];
|
const grpcStreamMethods: string[] = [];
|
||||||
for (const method of grpcStreamMethods) {
|
for (const method of grpcStreamMethods) {
|
||||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
GrpcStreamMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
|
GrpcStreamMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TWO_FA_SRVICE_SERVICE_NAME = "TwoFaSrvice";
|
export const TWO_FA_SERVICE_NAME = "TwoFaService";
|
||||||
50
package-lock.json
generated
50
package-lock.json
generated
@@ -1,16 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "@lendry-erp/contracts",
|
"name": "@lendry-erp/contracts",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lendry-erp/contracts",
|
"name": "@lendry-erp/contracts",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@lendry-erp/contracts": "^1.0.2",
|
||||||
"@nestjs/microservices": "^11.1.17",
|
"@nestjs/microservices": "^11.1.17",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"ts-proto": "^2.11.6"
|
"ts-proto": "^2.11.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^25.5.0",
|
||||||
|
"typescript": "^6.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@borewit/text-codec": {
|
"node_modules/@borewit/text-codec": {
|
||||||
@@ -30,6 +35,16 @@
|
|||||||
"integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==",
|
"integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==",
|
||||||
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
||||||
},
|
},
|
||||||
|
"node_modules/@lendry-erp/contracts": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://git.lendry.ru/api/packages/lendry-erp/npm/%40lendry-erp%2Fcontracts/-/1.0.2/contracts-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-39NulQ6mn3dmrX/GXwzYYPyX/rE+4gO1En+uJJR9bHXZ3awWi0U3drIvgwM25gyi829Ae0U8vVtzMaP3gON90A==",
|
||||||
|
"dependencies": {
|
||||||
|
"@nestjs/microservices": "^11.1.17",
|
||||||
|
"rxjs": "^7.8.2",
|
||||||
|
"ts-proto": "^2.11.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@lukeed/csprng": {
|
"node_modules/@lukeed/csprng": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz",
|
||||||
@@ -214,6 +229,16 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "25.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
|
||||||
|
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~7.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/case-anything": {
|
"node_modules/case-anything": {
|
||||||
"version": "2.1.13",
|
"version": "2.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz",
|
||||||
@@ -460,6 +485,20 @@
|
|||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "6.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz",
|
||||||
|
"integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/uid": {
|
"node_modules/uid": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
|
||||||
@@ -485,6 +524,13 @@
|
|||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "7.18.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
|
||||||
|
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -1,12 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "@lendry-erp/contracts",
|
"name": "@lendry-erp/contracts",
|
||||||
"version": "1.0.2",
|
"version": "1.0.11",
|
||||||
"description": "Protobuf definitions and generated TypeScript types",
|
"description": "Protobuf definitions and generated TypeScript types",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
"build": "tsc -p tsconfig.build.json"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"dist",
|
||||||
"proto",
|
"proto",
|
||||||
"gen"
|
"gen"
|
||||||
],
|
],
|
||||||
@@ -17,5 +20,9 @@
|
|||||||
"@nestjs/microservices": "^11.1.17",
|
"@nestjs/microservices": "^11.1.17",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"ts-proto": "^2.11.6"
|
"ts-proto": "^2.11.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^25.5.0",
|
||||||
|
"typescript": "^6.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package google.protobuf;
|
|
||||||
|
|
||||||
message Any {
|
|
||||||
string type_url = 1;
|
|
||||||
bytes value = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package google.rpc;
|
|
||||||
|
|
||||||
import "google/protobuf/any.proto";
|
|
||||||
|
|
||||||
message Status {
|
|
||||||
int32 code = 1;
|
|
||||||
string message = 2;
|
|
||||||
repeated google.protobuf.Any details = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package identity;
|
package identity;
|
||||||
import "google/rpc/status.proto";
|
|
||||||
|
|
||||||
|
option go_package = './gen';
|
||||||
|
|
||||||
service AuthService {
|
service AuthService {
|
||||||
rpc Login (LoginRequest) returns (LoginResponse);
|
rpc Login (LoginRequest) returns (LoginResponse);
|
||||||
rpc Register (RegisterRequest) returns (RegisterResponse);
|
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
||||||
|
rpc Logout (LogoutRequest) returns (LogoutResponse);
|
||||||
|
rpc UnlockPin (UnlockPinRequest) returns (UnlockPinResponse);
|
||||||
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
|
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,28 +33,44 @@ message LoginResponse {
|
|||||||
string refresh_token = 2;
|
string refresh_token = 2;
|
||||||
string status = 3;
|
string status = 3;
|
||||||
bool need2fa = 4;
|
bool need2fa = 4;
|
||||||
string temp_token = 5;
|
optional string temp_token = 5;
|
||||||
string message = 6;
|
optional string message = 6;
|
||||||
string error_code = 7;
|
optional string error_code = 7;
|
||||||
google.rpc.Status error = 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RegisterRequest {
|
message RefreshRequest {
|
||||||
string username = 1;
|
string refresh_token = 1;
|
||||||
string password = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RegisterResponse {
|
message RefreshResponse {
|
||||||
string user_id = 1;
|
string access_token = 1;
|
||||||
string status = 2;
|
string refresh_token = 2;
|
||||||
string message = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message LogoutRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LogoutResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnlockPinRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
string pin_code = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UnlockPinResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
message Verify2FaRequest {
|
message Verify2FaRequest {
|
||||||
string temp_token = 1;
|
string temp_token = 1;
|
||||||
string totp_code = 2;
|
optional string totp_code = 2;
|
||||||
string telegram_code = 3;
|
optional string telegram_code = 3;
|
||||||
string reserve_code = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message Verify2FaResponse {
|
message Verify2FaResponse {
|
||||||
|
|||||||
28
proto/ldap.proto
Normal file
28
proto/ldap.proto
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package ldap_service;
|
||||||
|
|
||||||
|
option go_package = "git.lendry.ru/lendry-erp/gen;ldap_service";
|
||||||
|
|
||||||
|
service LdapAuth {
|
||||||
|
rpc VerifyUser (VerifyRequest) returns (VerifyResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message VerifyRequest {
|
||||||
|
string username = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message VerifyResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string error_message = 2;
|
||||||
|
UserData user = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UserData {
|
||||||
|
string dn = 1;
|
||||||
|
string display_name = 2;
|
||||||
|
repeated string groups = 3;
|
||||||
|
bool is_active = 4;
|
||||||
|
}
|
||||||
|
|
||||||
1
src/index.ts
Normal file
1
src/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from "./proto";
|
||||||
1
src/proto/index.ts
Normal file
1
src/proto/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from "./paths";
|
||||||
6
src/proto/paths.ts
Normal file
6
src/proto/paths.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { join } from "path";
|
||||||
|
|
||||||
|
export const PROTO_PATHS = {
|
||||||
|
AUTH: join(__dirname, "../../proto/identity.proto"),
|
||||||
|
LDAP: join(__dirname, "../../proto/ldap.proto"),
|
||||||
|
} as const;
|
||||||
11
tsconfig.build.json
Normal file
11
tsconfig.build.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"],
|
||||||
|
"exclude": ["node_module", "dist", "test"]
|
||||||
|
}
|
||||||
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2024",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strictNullChecks": false
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user