65 Commits

Author SHA1 Message Date
Дмитрий
44525133ab add go_package account proto file
All checks were successful
Publish / Publish Job (push) Successful in 2m42s
2026-04-02 20:25:40 +03:00
Дмитрий
0ac1343b09 add go_package account proto file 2026-04-02 20:25:25 +03:00
Дмитрий
e8b63a2c70 refactor all proto files
Some checks failed
Publish / Publish Job (push) Failing after 2m49s
2026-04-02 20:19:40 +03:00
Дмитрий
31d02ab7d8 refactor all proto files 2026-04-02 20:10:53 +03:00
github-actions[bot]
678ac4f22b chore: auto-generate protobuf files [skip ci] 2026-04-02 12:23:16 +00:00
Дмитрий
dbf71f91ef add support metadata from grpc typescript
All checks were successful
Publish / Publish Job (push) Successful in 2m36s
2026-04-02 15:20:42 +03:00
github-actions[bot]
ae192553a0 chore: auto-generate protobuf files [skip ci] 2026-04-02 10:34:18 +00:00
Дмитрий
76ded73e40 add requres pin
All checks were successful
Publish / Publish Job (push) Successful in 2m35s
2026-04-02 13:31:43 +03:00
github-actions[bot]
bd7fb33d1e chore: auto-generate protobuf files [skip ci] 2026-04-02 08:56:34 +00:00
Дмитрий
f6237eeb86 add logout_all methods
All checks were successful
Publish / Publish Job (push) Successful in 2m36s
2026-04-02 11:53:59 +03:00
github-actions[bot]
a4a5190dce chore: auto-generate protobuf files [skip ci] 2026-04-01 16:11:13 +00:00
Дмитрий
216c49a338 add check role level for ierarchy
All checks were successful
Publish / Publish Job (push) Successful in 2m32s
2026-04-01 19:08:39 +03:00
Дмитрий
e79f7183da change commit
All checks were successful
Publish / Publish Job (push) Successful in 2m29s
2026-04-01 18:03:49 +03:00
github-actions[bot]
f972282031 chore: auto-generate protobuf files [skip ci] 2026-04-01 14:28:08 +00:00
Дмитрий
be3d0ea089 add verify sessions requests
All checks were successful
Publish / Publish Job (push) Successful in 2m50s
2026-04-01 17:25:15 +03:00
github-actions[bot]
0534ae4340 chore: auto-generate protobuf files [skip ci] 2026-04-01 09:30:59 +00:00
Дмитрий
d4b32ad655 fix: change go package proto link
All checks were successful
Publish / Publish Job (push) Successful in 2m29s
2026-04-01 12:28:30 +03:00
github-actions[bot]
352b63c60c chore: auto-generate protobuf files [skip ci] 2026-04-01 09:12:45 +00:00
Дмитрий
0713605442 update: ldap.proto
All checks were successful
Publish / Publish Job (push) Successful in 2m27s
2026-04-01 12:10:00 +03:00
Дмитрий
156a747f59 fix: change version and go.mod file
All checks were successful
Publish / Publish Job (push) Successful in 2m27s
2026-04-01 11:08:41 +03:00
Дмитрий
ff14fded40 fix: change version
All checks were successful
Publish / Publish Job (push) Successful in 2m32s
2026-04-01 10:50:42 +03:00
github-actions[bot]
7f07e83065 chore: auto-generate protobuf files [skip ci] 2026-04-01 07:38:33 +00:00
Дмитрий
b5d2f846ee change: change go_packege ldap-service
Some checks failed
Publish / Publish Job (push) Failing after 2m27s
2026-04-01 10:36:07 +03:00
github-actions[bot]
b4ff48f512 chore: auto-generate protobuf files [skip ci] 2026-03-30 16:54:45 +00:00
Дмитрий
55fad6f1b2 fix: fix go_package
All checks were successful
Publish / Publish Job (push) Successful in 2m29s
2026-03-30 19:52:10 +03:00
github-actions[bot]
ea99c4c89a chore: auto-generate protobuf files [skip ci] 2026-03-30 16:08:03 +00:00
Дмитрий
0e8da180ca fix: remove go_package for identity service
All checks were successful
Publish / Publish Job (push) Successful in 2m33s
2026-03-30 19:05:31 +03:00
Дмитрий
b98bdddb66 fix: remove go_package for identity service
Some checks failed
Publish / Publish Job (push) Failing after 2m28s
2026-03-30 18:56:54 +03:00
Дмитрий
f5b566676c fix: remove go_package for identity service 2026-03-30 18:56:50 +03:00
Дмитрий
86d15e4055 update: package json version
All checks were successful
Publish / Publish Job (push) Successful in 2m32s
2026-03-30 18:34:29 +03:00
github-actions[bot]
4c98db2dfc chore: auto-generate protobuf files [skip ci] 2026-03-30 15:31:20 +00:00
Дмитрий
4f1a68df5a update: update publish file add git
Some checks failed
Publish / Publish Job (push) Failing after 2m31s
2026-03-30 18:28:41 +03:00
Дмитрий
9f5afc5a36 fix: ganerate proto file for golang
All checks were successful
Publish / Publish Job (push) Successful in 2m34s
2026-03-30 18:12:33 +03:00
Дмитрий
6666bb1a74 add: add go repository
All checks were successful
Publish / Publish Job (push) Successful in 2m28s
2026-03-30 16:40:36 +03:00
Дмитрий
f6366f14b5 fix: remove imports google any and status protobufs and add go package proto files
All checks were successful
Publish / Publish Job (push) Successful in 2m6s
2026-03-30 16:30:22 +03:00
Дмитрий
39d0e360a2 fix: remove imports google any and status protobufs
Some checks failed
Publish / Publish Job (push) Failing after 2m0s
2026-03-30 16:24:42 +03:00
Дмитрий
4f038b0f92 fix: remove imports google any and status protobufs
Some checks failed
Publish / Publish Job (push) Has been cancelled
2026-03-30 16:23:40 +03:00
Дмитрий
f592ccc021 fix: remove imports google any and status protobufs 2026-03-30 16:22:49 +03:00
Дмитрий
b16f526fb5 fix: fix any.proto imptort
Some checks failed
Publish / Publish Job (push) Failing after 1m58s
2026-03-30 16:16:30 +03:00
Дмитрий
55cf38c8c2 fix: add go grpc and protoc generate
Some checks failed
Publish / Publish Job (push) Failing after 3m7s
2026-03-30 16:09:52 +03:00
Дмитрий
c5e57adf5b fix: install ts-proto global
Some checks failed
Publish / Publish Job (push) Failing after 1m11s
2026-03-30 16:06:05 +03:00
Дмитрий
ea6a3e7777 fix: fix protoc generate
Some checks failed
Publish / Publish Job (push) Failing after 1m9s
2026-03-30 15:58:02 +03:00
Дмитрий
3ef32ab618 add: add ldap protobuf
Some checks failed
Publish / Publish Job (push) Failing after 1m10s
2026-03-30 15:54:12 +03:00
Дмитрий
d81e20c41a remove: delete register methods and change version
All checks were successful
Publish / Publish Job (push) Successful in 1m15s
2026-03-28 11:47:16 +03:00
Дмитрий
b8715f8f31 remove: delete register methods
Some checks failed
Publish / Publish Job (push) Failing after 1m9s
2026-03-28 11:44:02 +03:00
Дмитрий
0d3bf2ca36 fix: change version
All checks were successful
Publish / Publish Job (push) Successful in 1m19s
2026-03-28 10:41:11 +03:00
Дмитрий
970873d536 feat: add success status pin and logout
Some checks failed
Publish / Publish Job (push) Has been cancelled
2026-03-27 18:36:41 +03:00
Дмитрий
b7d9039783 feat: add unlock pin methods
All checks were successful
Publish / Publish Job (push) Successful in 1m18s
2026-03-27 18:11:22 +03:00
Дмитрий
e530608121 feat: add logout method
All checks were successful
Publish / Publish Job (push) Successful in 1m13s
2026-03-27 16:46:54 +03:00
Дмитрий
91c262e2a6 fix: restructure request and respone methodes
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-27 15:30:33 +03:00
Дмитрий
60eb6068ec fix: restructure request and respone methodes
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 15:28:01 +03:00
Дмитрий
a225dd4a48 feat: add refresh token messages and RPC method
All checks were successful
Publish / Publish Job (push) Successful in 1m15s
2026-03-27 15:18:31 +03:00
Дмитрий
b00a823b50 fix: edit package version
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-27 10:55:52 +03:00
Дмитрий
15c2ed57c7 fix: publish yml edit level env
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 10:51:14 +03:00
Дмитрий
273bdd685b add: add npmrc file registry
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 10:19:31 +03:00
Дмитрий
f5d18a63e5 first commit
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-26 15:45:17 +03:00
Дмитрий
0c494faa6b fix: fix path name proto file 2026-03-25 16:31:12 +03:00
Дмитрий
54bff3da7d fix: rename path 2026-03-25 16:30:29 +03:00
Дмитрий
7cbe61f226 fix: add dist to files 2026-03-25 16:22:15 +03:00
Дмитрий
287cd340de feat: add PROTO_PATHS 2026-03-25 16:06:35 +03:00
Дмитрий
d4196e16f9 fix: npm install deps frozen lockfile 2026-03-25 13:58:47 +03:00
Дмитрий
4a1eb650f4 fix: npm install deps frozen lockfile 2026-03-25 13:56:54 +03:00
Дмитрий
e55fd159cb fix: totp and telegram codes is optional 2026-03-25 12:17:56 +03:00
Дмитрий
1eb1d4b946 fix: remove reserve codes from request 2026-03-25 12:09:51 +03:00
Дмитрий
c956cd29f0 fix: rename twofaservice 2026-03-25 11:33:30 +03:00
20 changed files with 431 additions and 386 deletions

View File

@@ -9,6 +9,8 @@ jobs:
publish:
name: Publish Job
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -17,18 +19,51 @@ jobs:
uses: actions/setup-node@v4
with:
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
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install deps
run: npm install
run: npm ci
- name: Generate TS Protobuf
run: npm run generate
- name: Build
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,addGrpcMetadata=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
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
@lendry-erp:registry=https://git.lendry.ru/api/packages/lendry-erp/npm/

View File

@@ -1,250 +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: auth.proto
/* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs";
import { Status } from "./google/rpc/status";
export const protobufPackage = "auth.v1";
export interface LoginRequest {
username: string;
password: string;
}
export interface LoginResponse {
accessToken: string;
status: string;
need2fa: boolean;
tempToken: string;
message: string;
errorCode: string;
error: Status | undefined;
}
export interface RegisterRequest {
username: string;
password: string;
}
export interface RegisterResponse {
userId: string;
status: string;
message: string;
}
export interface Verify2FaRequest {
tempToken: string;
totpCode: string;
telegramCode: string;
reserveCode: string;
}
export interface Verify2FaResponse {
accessToken: string;
status: string;
message: string;
reserveCodes: string[];
}
export interface AuthenticatedAccessRequest {
accessToken: string;
}
export interface GetTwoFaStatusRequest {
accessToken: string;
}
export interface GetTwoFaStatusResponse {
totpEnabled: boolean;
telegramEnabled: boolean;
totpEnrollmentPending: boolean;
telegramEnrollmentPending: boolean;
}
export interface StartTotpEnrollmentResponse {
secretBase32: string;
otpauthUri: string;
issuer: string;
accountLabel: string;
}
export interface ConfirmTotpEnrollmentRequest {
accessToken: string;
totpCode: string;
}
export interface ConfirmTotpEnrollmentResponse {
status: string;
message: string;
reserveCodes: string[];
}
export interface CancelTotpEnrollmentResponse {
status: string;
message: string;
}
export interface DisableTotpRequest {
accessToken: string;
password: string;
totpCode?: string | undefined;
}
export interface DisableTotpResponse {
status: string;
message: string;
}
export interface StartTelegramEnrollmentResponse {
enrollmentToken: string;
deepLink: string;
botUsername: string;
expiresAtIso: string;
}
export interface ConfirmTelegramEnrollmentRequest {
accessToken: string;
enrollmentToken: string;
otpCode: string;
}
export interface ConfirmTelegramEnrollmentResponse {
status: string;
message: string;
reserveCodes: string[];
}
export interface DisableTelegramRequest {
accessToken: string;
password: string;
telegramOtpCode?: string | undefined;
}
export interface DisableTelegramResponse {
status: string;
message: string;
}
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
export interface AuthServiceClient {
login(request: LoginRequest): Observable<LoginResponse>;
register(request: RegisterRequest): Observable<RegisterResponse>;
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
}
export interface AuthServiceController {
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
}
export function AuthServiceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = ["login", "register", "verify2Fa"];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
}
};
}
export const AUTH_SERVICE_NAME = "AuthService";
export interface TwoFaSrviceClient {
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
confirmTotpErollment(request: ConfirmTotpEnrollmentRequest): Observable<ConfirmTotpEnrollmentResponse>;
cancelTotpEnrollment(request: AuthenticatedAccessRequest): Observable<CancelTotpEnrollmentResponse>;
disableTotp(request: DisableTotpRequest): Observable<DisableTotpResponse>;
startTelegramEnrollment(request: AuthenticatedAccessRequest): Observable<StartTelegramEnrollmentResponse>;
confirmTelegramEnrollment(request: ConfirmTelegramEnrollmentRequest): Observable<ConfirmTelegramEnrollmentResponse>;
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
}
export interface TwoFaSrviceController {
getTwoFaStatus(
request: GetTwoFaStatusRequest,
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
startTotpEnrollment(
request: AuthenticatedAccessRequest,
): Promise<StartTotpEnrollmentResponse> | Observable<StartTotpEnrollmentResponse> | StartTotpEnrollmentResponse;
confirmTotpErollment(
request: ConfirmTotpEnrollmentRequest,
): Promise<ConfirmTotpEnrollmentResponse> | Observable<ConfirmTotpEnrollmentResponse> | ConfirmTotpEnrollmentResponse;
cancelTotpEnrollment(
request: AuthenticatedAccessRequest,
): Promise<CancelTotpEnrollmentResponse> | Observable<CancelTotpEnrollmentResponse> | CancelTotpEnrollmentResponse;
disableTotp(
request: DisableTotpRequest,
): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
startTelegramEnrollment(
request: AuthenticatedAccessRequest,
):
| Promise<StartTelegramEnrollmentResponse>
| Observable<StartTelegramEnrollmentResponse>
| StartTelegramEnrollmentResponse;
confirmTelegramEnrollment(
request: ConfirmTelegramEnrollmentRequest,
):
| Promise<ConfirmTelegramEnrollmentResponse>
| Observable<ConfirmTelegramEnrollmentResponse>
| ConfirmTelegramEnrollmentResponse;
disableTelegram(
request: DisableTelegramRequest,
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
}
export function TwoFaSrviceControllerMethods() {
return function (constructor: Function) {
const grpcMethods: string[] = [
"getTwoFaStatus",
"startTotpEnrollment",
"confirmTotpErollment",
"cancelTotpEnrollment",
"disableTotp",
"startTelegramEnrollment",
"confirmTelegramEnrollment",
"disableTelegram",
];
for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
}
const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
}
};
}
export const TWO_FA_SRVICE_SERVICE_NAME = "TwoFaSrvice";

View File

@@ -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";

View File

@@ -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";

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module git.lendry.ru/lendry-erp/contracts.git
go 1.26.1

91
package-lock.json generated
View File

@@ -1,16 +1,22 @@
{
"name": "@lendry-erp/contracts",
"version": "1.0.0",
"version": "1.0.24",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lendry-erp/contracts",
"version": "1.0.0",
"version": "1.0.24",
"dependencies": {
"@lendry-erp/contracts": "^1.0.24",
"@lendry-erp/passport": "^1.0.3",
"@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2",
"ts-proto": "^2.11.6"
},
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
}
},
"node_modules/@borewit/text-codec": {
@@ -18,7 +24,6 @@
"resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz",
"integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==",
"license": "MIT",
"peer": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Borewit"
@@ -30,12 +35,33 @@
"integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==",
"license": "(Apache-2.0 AND BSD-3-Clause)"
},
"node_modules/@lendry-erp/contracts": {
"version": "1.0.24",
"resolved": "https://git.lendry.ru/api/packages/lendry-erp/npm/%40lendry-erp%2Fcontracts/-/1.0.24/contracts-1.0.24.tgz",
"integrity": "sha512-Bn4RgU22O6IDFhYEbQicBLpRtSGHrEgqOSAljQh4lT5shMeLedlE0V3jFxzFu9xpyTzcM/o+C96vpsAHab0tbg==",
"dependencies": {
"@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2",
"ts-proto": "^2.11.6"
}
},
"node_modules/@lendry-erp/passport": {
"version": "1.0.3",
"resolved": "https://git.lendry.ru/api/packages/lendry-erp/npm/%40lendry-erp%2Fpassport/-/1.0.3/passport-1.0.3.tgz",
"integrity": "sha512-gaPdlZahkXmOUnLBlzNdk41nJ1BI6TPZY5xUaCmlIkpqZKr8D5TSBBkFrw4Vlw+TLImqL2Y1JUT4k60gHHtjiw==",
"license": "ISC",
"dependencies": {
"@nestjs/common": "^11.1.17",
"@nestjs/core": "^11.1.17",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.2"
}
},
"node_modules/@lukeed/csprng": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz",
"integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=8"
}
@@ -45,7 +71,6 @@
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.17.tgz",
"integrity": "sha512-hLODw5Abp8OQgA+mUO4tHou4krKgDtUcM9j5Ihxncst9XeyxYBTt2bwZm4e4EQr5E352S4Fyy6V3iFx9ggxKAg==",
"license": "MIT",
"peer": true,
"dependencies": {
"file-type": "21.3.2",
"iterare": "1.2.1",
@@ -78,7 +103,6 @@
"integrity": "sha512-lD5mAYekTTurF3vDaa8C2OKPnjiz4tsfxIc5XlcSUzOhkwWf6Ay3HKvt6FmvuWQam6uIIHX52Clg+e6tAvf/cg==",
"hasInstallScript": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@nuxt/opencollective": "0.4.1",
"fast-safe-stringify": "2.1.1",
@@ -177,7 +201,6 @@
"resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.4.1.tgz",
"integrity": "sha512-GXD3wy50qYbxCJ652bDrDzgMr3NFEkIS374+IgFQKkCvk9yiYcLvX2XDYr7UyQxf4wK0e+yqDYRubZ0DtOxnmQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"consola": "^3.2.3"
},
@@ -194,7 +217,6 @@
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
"integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",
"license": "MIT",
"peer": true,
"dependencies": {
"debug": "^4.4.3",
"token-types": "^6.1.1"
@@ -211,8 +233,17 @@
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",
"license": "MIT"
},
"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",
"peer": true
"dependencies": {
"undici-types": "~7.18.0"
}
},
"node_modules/case-anything": {
"version": "2.1.13",
@@ -231,7 +262,6 @@
"resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
"integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
"license": "MIT",
"peer": true,
"engines": {
"node": "^14.18.0 || >=16.10.0"
}
@@ -241,7 +271,6 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"license": "MIT",
"peer": true,
"dependencies": {
"ms": "^2.1.3"
},
@@ -279,15 +308,13 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/file-type": {
"version": "21.3.2",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.2.tgz",
"integrity": "sha512-DLkUvGwep3poOV2wpzbHCOnSKGk1LzyXTv+aHFgN2VFl96wnp8YA9YjO2qPzg5PuL8q/SW9Pdi6WTkYOIh995w==",
"license": "MIT",
"peer": true,
"dependencies": {
"@tokenizer/inflate": "^0.4.1",
"strtok3": "^10.3.4",
@@ -319,8 +346,7 @@
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause",
"peer": true
"license": "BSD-3-Clause"
},
"node_modules/iterare": {
"version": "1.2.1",
@@ -346,7 +372,6 @@
}
],
"license": "MIT",
"peer": true,
"engines": {
"node": ">=13.2.0"
}
@@ -355,15 +380,13 @@
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/path-to-regexp": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
"license": "MIT",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
@@ -373,8 +396,7 @@
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
"license": "Apache-2.0",
"peer": true
"license": "Apache-2.0"
},
"node_modules/rxjs": {
"version": "7.8.2",
@@ -390,7 +412,6 @@
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz",
"integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@tokenizer/token": "^0.3.0"
},
@@ -407,7 +428,6 @@
"resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz",
"integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==",
"license": "MIT",
"peer": true,
"dependencies": {
"@borewit/text-codec": "^0.2.1",
"@tokenizer/token": "^0.3.0",
@@ -460,12 +480,25 @@
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"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": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
"integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==",
"license": "MIT",
"peer": true,
"dependencies": {
"@lukeed/csprng": "^1.0.0"
},
@@ -478,13 +511,19 @@
"resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz",
"integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=18"
},
"funding": {
"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"
}
}
}

View File

@@ -1,12 +1,15 @@
{
"name": "@lendry-erp/contracts",
"version": "1.0.2",
"version": "1.0.29",
"description": "Protobuf definitions and generated TypeScript types",
"type": "commonjs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"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": [
"dist",
"proto",
"gen"
],
@@ -14,8 +17,14 @@
"access": "public"
},
"dependencies": {
"@lendry-erp/contracts": "^1.0.24",
"@lendry-erp/passport": "^1.0.3",
"@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2",
"ts-proto": "^2.11.6"
},
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
}
}

41
proto/account.proto Normal file
View File

@@ -0,0 +1,41 @@
syntax = "proto3";
package account;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service AccountService {
rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
}
message GetAccountRequest {
string id = 1;
}
message GetAccountResponse {
string id = 1;
string username = 2;
string email = 3;
string phone = 4;
string full_name = 5;
bool is_ldap = 6;
string status = 7;
repeated string roles = 8;
string avatar_url = 9;
optional string employee_id = 10;
Presence presence = 11;
string last_active = 12;
string custom_status_text = 13;
string custom_status_emoji = 14;
string timezone = 15;
string language = 16;
bool two_fa_enabled = 17;
bool has_pin = 18;
}
enum Presence {
PRESENCE_UNSPECIFIED = 0;
OFFLINE = 1;
ONLINE = 2;
}

85
proto/auth.proto Normal file
View File

@@ -0,0 +1,85 @@
syntax = "proto3";
package auth.v1;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service AuthService {
rpc Login (LoginRequest) returns (LoginResponse);
rpc Refresh (RefreshRequest) returns (RefreshResponse);
rpc VerifyToken (VerifyTokenRequest) returns (VerifyTokenResponse);
rpc GetAccountRoleLevel (GetAccountRoleLevelRequest) returns (GetAccountRoleLevelResponse);
rpc Logout (LogoutRequest) returns (LogoutResponse);
rpc LogoutAll (LogoutRequest) returns (LogoutResponse);
rpc UnlockPin (UnlockPinRequest) returns (UnlockPinResponse);
}
message LoginRequest {
string username = 1;
string password = 2;
}
message LoginResponse {
string access_token = 1;
string refresh_token = 2;
string status = 3;
bool need2fa = 4;
optional string temp_token = 5;
optional string message = 6;
optional string error_code = 7;
}
message RefreshRequest {
string refresh_token = 1;
}
message RefreshResponse {
string access_token = 1;
string refresh_token = 2;
}
message LogoutRequest {
string access_token = 1;
}
message LogoutResponse {
bool success = 1;
string message = 2;
}
message VerifyTokenRequest {
string token = 1;
}
message VerifyTokenResponse {
bool is_valid = 1;
optional string error_message = 2;
optional string id = 3;
optional string username = 4;
optional int32 role_level = 5;
repeated string permissions = 6;
optional string session_id = 7;
optional bool requires_pin = 8;
}
message GetAccountRoleLevelRequest {
string account_id = 1;
}
message GetAccountRoleLevelResponse {
bool found = 1;
int32 role_level = 2;
}
message UnlockPinRequest {
string access_token = 1;
string pin_code = 2;
}
message UnlockPinResponse {
bool success = 1;
string message = 2;
}

View File

@@ -1,9 +0,0 @@
syntax = "proto3";
package google.protobuf;
message Any {
string type_url = 1;
bytes value = 2;
}

View File

@@ -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;
}

45
proto/ldap-auth.proto Normal file
View File

@@ -0,0 +1,45 @@
syntax = "proto3";
package ldap_auth.v1;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service LdapAuthService {
rpc VerifyUser (VerifyRequest) returns (VerifyResponse);
}
// ==========================================
// БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
// ==========================================
// Полная модель пользователя
message UserData {
string dn = 1; // Полный путь в AD (Distinguished Name)
string username = 2; // Логин (sAMAccountName)
string display_name = 3; // ФИО (displayName)
string email = 4; // Почта (mail)
string description = 5; // Описание/Должность (description)
bytes avatar = 6; // Аватарка в байтах (thumbnailPhoto)
repeated string groups = 7; // Список групп
bool is_active = 8; // Статус аккаунта
}
// ==========================================
// ЗАПРОСЫ И ОТВЕТЫ (REQUESTS / RESPONSES)
// ==========================================
// --- Авторизация ---
message VerifyRequest {
string username = 1;
string password = 2;
}
message VerifyResponse {
bool success = 1;
string error_message = 2;
UserData user = 3; // Отдаем полные данные при успешном входе
}

94
proto/ldap.proto Normal file
View File

@@ -0,0 +1,94 @@
syntax = "proto3";
package ldap.v1;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service LdapService {
// Управление Пользователями (Bind системного аккаунта) ---
rpc GetUsers (EmptyRequest) returns (UserListResponse);
rpc CreateUser (CreateUserRequest) returns (StatusResponse);
rpc UpdateUser (UpdateUserRequest) returns (StatusResponse);
rpc ChangePassword (ChangePasswordRequest) returns (StatusResponse);
rpc ToggleUserStatus (ToggleStatusRequest) returns (StatusResponse);
// Управление Группами ---
rpc GetGroups (EmptyRequest) returns (GroupListResponse);
rpc AddUserToGroup (GroupMemberRequest) returns (StatusResponse);
rpc RemoveUserFromGroup (GroupMemberRequest) returns (StatusResponse);
}
// ==========================================
// БАЗОВЫЕ И ПЕРЕИСПОЛЬЗУЕМЫЕ СТРУКТУРЫ
// ==========================================
message EmptyRequest {}
// Стандартный ответ для мутаций (создание, обновление, удаление)
message StatusResponse {
bool success = 1;
string error_message = 2;
}
// Полная модель пользователя
message UserData {
string dn = 1; // Полный путь в AD (Distinguished Name)
string username = 2; // Логин (sAMAccountName)
string display_name = 3; // ФИО (displayName)
string email = 4; // Почта (mail)
string description = 5; // Описание/Должность (description)
bytes avatar = 6; // Аватарка в байтах (thumbnailPhoto)
repeated string groups = 7; // Список групп
bool is_active = 8; // Статус аккаунта
}
// Модель группы
message GroupData {
string dn = 1;
string name = 2; // Короткое имя группы (cn)
}
// --- Списки ---
message UserListResponse {
bool success = 1;
string error_message = 2;
repeated UserData users = 3;
}
message GroupListResponse {
bool success = 1;
string error_message = 2;
repeated GroupData groups = 3;
}
// --- Управление профилем ---
message CreateUserRequest {
string username = 1;
string full_name = 2;
string password = 3;
optional string email = 4; // Сразу при создании можно задать почту
}
// Запрос на обновление. Используем optional для частичного обновления.
message UpdateUserRequest {
string username = 1; // Обязательное поле: кого обновляем
optional string display_name = 2; // Новое ФИО (повлечет Rename CN)
optional string email = 3; // Новая почта
optional string description = 4; // Новое описание
optional bytes avatar = 5; // Новая аватарка (бинарник картинки)
}
message ChangePasswordRequest {
string username = 1;
string new_password = 2;
}
message ToggleStatusRequest {
string username = 1;
bool set_active = 2; // true - включить (512), false - отключить (514)
}
// --- Управление членством в группах ---
message GroupMemberRequest {
string username = 1; // Логин пользователя
string group_dn = 2; // Полный путь группы (в которую добавляем / из которой удаляем)
}

View File

@@ -1,58 +1,25 @@
syntax = "proto3";
package identity;
import "google/rpc/status.proto";
package twofa.v1;
service AuthService {
rpc Login (LoginRequest) returns (LoginResponse);
rpc Register (RegisterRequest) returns (RegisterResponse);
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
}
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service TwoFaService {
rpc GetTwoFaStatus (GetTwoFaStatusRequest) returns (GetTwoFaStatusResponse);
rpc StartTotpEnrollment (AuthenticatedAccessRequest) returns (StartTotpEnrollmentResponse);
rpc ConfirmTotpErollment (ConfirmTotpEnrollmentRequest) returns (ConfirmTotpEnrollmentResponse);
rpc CancelTotpEnrollment (AuthenticatedAccessRequest) returns (CancelTotpEnrollmentResponse);
rpc DisableTotp (DisableTotpRequest) returns (DisableTotpResponse);
rpc StartTelegramEnrollment (AuthenticatedAccessRequest) returns (StartTelegramEnrollmentResponse);
rpc ConfirmTelegramEnrollment (ConfirmTelegramEnrollmentRequest) returns (ConfirmTelegramEnrollmentResponse);
rpc DisableTelegram(DisableTelegramRequest) returns (DisableTelegramResponse);
}
message LoginRequest {
string username = 1;
string password = 2;
}
message LoginResponse {
string access_token = 1;
string refresh_token = 2;
string status = 3;
bool need2fa = 4;
string temp_token = 5;
string message = 6;
string error_code = 7;
google.rpc.Status error = 8;
}
message RegisterRequest {
string username = 1;
string password = 2;
}
message RegisterResponse {
string user_id = 1;
string status = 2;
string message = 3;
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
rpc GetTwoFaStatus (GetTwoFaStatusRequest) returns (GetTwoFaStatusResponse);
rpc StartTotpEnrollment (AuthenticatedAccessRequest) returns (StartTotpEnrollmentResponse);
rpc ConfirmTotpErollment (ConfirmTotpEnrollmentRequest) returns (ConfirmTotpEnrollmentResponse);
rpc CancelTotpEnrollment (AuthenticatedAccessRequest) returns (CancelTotpEnrollmentResponse);
rpc DisableTotp (DisableTotpRequest) returns (DisableTotpResponse);
rpc StartTelegramEnrollment (AuthenticatedAccessRequest) returns (StartTelegramEnrollmentResponse);
rpc ConfirmTelegramEnrollment (ConfirmTelegramEnrollmentRequest) returns (ConfirmTelegramEnrollmentResponse);
rpc DisableTelegram(DisableTelegramRequest) returns (DisableTelegramResponse);
}
message Verify2FaRequest {
string temp_token = 1;
string totp_code = 2;
string telegram_code = 3;
string reserve_code = 4;
optional string totp_code = 2;
optional string telegram_code = 3;
}
message Verify2FaResponse {
@@ -140,4 +107,5 @@ message DisableTelegramRequest {
message DisableTelegramResponse {
string status = 1;
string message = 2;
}
}

1
src/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./proto";

1
src/proto/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./paths";

6
src/proto/paths.ts Normal file
View 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
View 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
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2024",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": false
}
}