@ssoeasy-dev/proto 1.1.0-beta.1

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 MoreWiktor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # SSO Easy — Protocol Buffers
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ Централизованный репозиторий Protocol Buffers контрактов для SSO Easy микросервисной архитектуры.
6
+
7
+ ## Пространства имён
8
+
9
+ | Пакет | Сервисы | Потребители |
10
+ | -------------- | ----------------------------------------------- | --------------------------- |
11
+ | `auth.v1` | AuthService, VerificationService | `auth.api`, `auth.svc` |
12
+ | `companies.v1` | CompanyService, EmployeeService, ServiceService | `auth.api`, `companies.svc` |
13
+ | `common.v1` | Общие типы (StatusResponse и др.) | все сервисы |
14
+
15
+ ## Структура проекта
16
+
17
+ ```
18
+ .
19
+ ├── proto/ # Исходные .proto файлы
20
+ │ ├── auth/v1/ # AuthService, VerificationService
21
+ │ ├── companies/v1/ # CompanyService, EmployeeService, ServiceService
22
+ │ └── common/v1/ # Общие типы
23
+ ├── gen/go/ # Сгенерированный Go код (коммитится)
24
+ │ ├── auth/v1/
25
+ │ ├── companies/v1/
26
+ │ └── common/v1/
27
+ ├── gen/ts/ # Сгенерированный TypeScript код (коммитится)
28
+ │ ├── index.ts
29
+ │ ├── index.auth.ts
30
+ │ ├── index.companies.ts
31
+ │ └── index.common.ts
32
+ ├── buf.yaml
33
+ ├── buf.gen.yaml # Генерация Go кода
34
+ ├── buf.gen.ts.yaml # Генерация TypeScript кода
35
+ ├── go.mod
36
+ ├── package.json
37
+ ├── Makefile
38
+ ├── workflow.md # Процесс работы с изменениями и релизами
39
+ └── README.md
40
+ ```
41
+
42
+ ## Использование в сервисах
43
+
44
+ ### `auth.svc` и `companies.svc` (Go)
45
+
46
+ Подключение в `go.mod`:
47
+
48
+ ```go
49
+ require github.com/ssoeasy-dev/proto v1.1.1
50
+ ```
51
+
52
+ Импорт в коде:
53
+
54
+ ```go
55
+ import (
56
+ authpb "github.com/ssoeasy-dev/proto/gen/go/auth/v1"
57
+ companiespb "github.com/ssoeasy-dev/proto/gen/go/companies/v1"
58
+ commonpb "github.com/ssoeasy-dev/proto/gen/go/common/v1"
59
+ )
60
+ ```
61
+
62
+ Обновление до последней версии:
63
+
64
+ ```bash
65
+ go get github.com/ssoeasy-dev/proto@latest
66
+ go mod tidy
67
+ ```
68
+
69
+ ### `auth.api` (TypeScript / NestJS)
70
+
71
+ Подключение в `package.json`:
72
+
73
+ ```json
74
+ "dependencies": {
75
+ "@ssoeasy-dev/proto": "1.1.1"
76
+ }
77
+ ```
78
+
79
+ Импорт в коде:
80
+
81
+ ```typescript
82
+ // gRPC клиенты для auth.svc
83
+ import {
84
+ AuthServiceClient,
85
+ VerificationServiceClient,
86
+ } from "@ssoeasy-dev/proto/auth";
87
+
88
+ // gRPC клиенты для companies.svc
89
+ import {
90
+ CompanyServiceClient,
91
+ ServiceServiceClient,
92
+ } from "@ssoeasy-dev/proto/companies";
93
+
94
+ // Общие типы
95
+ import { StatusResponse } from "@ssoeasy-dev/proto/common";
96
+ ```
97
+
98
+ Подключение gRPC-клиентов через NestJS ClientsModule — см. `src/infra/grpc/grpc.module.ts` в `auth.api`.
99
+
100
+ Обновление:
101
+
102
+ ```bash
103
+ pnpm add @ssoeasy-dev/proto@latest
104
+ ```
105
+
106
+ ## Разработка
107
+
108
+ ### Требования
109
+
110
+ - Go 1.24+
111
+ - Node.js 20+
112
+ - pnpm
113
+ - [Buf CLI](https://buf.build/docs/installation)
114
+
115
+ ### Установка инструментов
116
+
117
+ ```bash
118
+ make install-tools
119
+ ```
120
+
121
+ ### Команды
122
+
123
+ ```bash
124
+ make generate # Сгенерировать весь код (Go + TypeScript)
125
+ make generate-go # Только Go
126
+ make generate-ts # Только TypeScript
127
+ make lint # Проверить proto файлы
128
+ make format # Отформатировать proto файлы
129
+ make breaking # Проверить breaking changes относительно main
130
+ make clean # Очистить gen/
131
+ ```
132
+
133
+ ### Добавление нового proto файла
134
+
135
+ ```bash
136
+ # 1. Создать файл в нужном пространстве имён
137
+ vim proto/auth/v1/my_service.proto
138
+
139
+ # 2. Проверить и отформатировать
140
+ make format && make lint
141
+
142
+ # 3. Сгенерировать код
143
+ make generate
144
+
145
+ # 4. Закоммитить proto и сгенерированный код вместе
146
+ git add proto/ gen/
147
+ git commit -m "feat: add MyService"
148
+ ```
149
+
150
+ > **Важно:** всегда коммитьте `proto/` и `gen/` вместе. CI проверяет их синхронизацию.
151
+
152
+ ## Релизы
153
+
154
+ Подробный процесс — в [workflow.md](./workflow.md). Кратко:
155
+
156
+ | Событие | Результат |
157
+ | ------------------------------------ | ---------------------------------------------------------------------- |
158
+ | Открытие / обновление PR в `develop` | dev версия `v1.1.1-dev-{branch}.N` |
159
+ | Закрытие PR в `develop` | dev версия удаляется |
160
+ | Мерж в `develop` | beta версия `v1.1.1-beta.N` |
161
+ | Мерж в `main` | production версия из `package.json`, публикация в npm с тегом `latest` |
162
+
163
+ ## Лицензия
164
+
165
+ MIT — см. [LICENSE](LICENSE).
166
+
167
+ ## Контакты
168
+
169
+ - Email: morewiktor@yandex.ru
170
+ - Telegram: [@MoreWiktor](https://t.me/MoreWiktor)
171
+ - GitHub: [@MoreWiktor](https://github.com/MoreWiktor)