@via-profit/ability 2.1.0 → 3.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ ## [3.0.1] - 2026-03-19
4
+
5
+ ## Добавлено
6
+
7
+ ### 1. **Лицензия MIT** (`LICENSE`)
8
+
9
+ - Добавлен официальный файл лицензии MIT от Via Profit
10
+
11
+ ### 2. **Класс `AbilityExplain.ts`**
12
+
13
+ - Новый класс для получения человекочитаемых объяснений результатов проверки
14
+ - Классы-наследники:
15
+ - `AbilityExplainRule` - объяснение для правила
16
+ - `AbilityExplainRuleSet` - объяснение для группы правил
17
+ - `AbilityExplainPolicy` - объяснение для политики
18
+ - Метод `toString()` форматирует вывод с отступами и символами ✓/✗
19
+
20
+ ---
21
+
22
+ ## Обновлено
23
+
24
+ ### **AbilityParser.ts** (полная переработка)
25
+
26
+ - **Было**: Базовая генерация типов
27
+ - **Стало**: Расширенная система генерации TypeScript типов
28
+ - Новые методы:
29
+ - `determineTypeFromRule()` - определение типа на основе правила
30
+ - `getArrayType()` - обработка массивов
31
+ - `getPrimitiveType()` - определение примитивных типов
32
+ - `buildNestedStructure()` - трансформация плоской структуры во вложенную
33
+ - `formatTypeDefinitions()` - форматирование финального вывода
34
+ - `formatNestedObject()` - рекурсивное форматирование объектов
35
+
36
+ ### **AbilityRule.ts**
37
+
38
+ - `id` и `name` теперь опциональные (`?`)
39
+ - Автогенерация `id` и `name` если не предоставлены
40
+ - **Новые статические методы** (фабричные методы):
41
+ - `equal()`, `notEqual()`, `in()`, `notIn()`
42
+ - `lessThan()`, `lessOrEqual()`, `moreThan()`, `moreOrEqual()`
43
+
44
+ ### **AbilityRuleSet.ts**
45
+
46
+ - `id` и `name` теперь опциональные
47
+ - Добавлены статические методы:
48
+ - `and()` - создание группы с логическим И
49
+ - `or()` - создание группы с логическим ИЛИ
50
+
51
+ ### **AbilityPolicy.ts**
52
+
53
+ - Новый метод `explain()` - получение объяснения проверки
54
+ - Новый статический метод `parseAll()` - парсинг массива конфигураций
55
+ - Улучшены комментарии к полю `action`
56
+
57
+ ### **AbilityResolver.ts**
58
+
59
+ - Новый метод `resolveWithExplain()` - проверка с детальным объяснением
60
+ - Возвращает массив `AbilityExplain[]` для анализа результатов
61
+
62
+ ---
63
+
64
+ ## Обновлена документация и примеры
@@ -0,0 +1,14 @@
1
+ # Contributing to @via-profit/ability
2
+
3
+ ## Development Setup
4
+
5
+ 1. Fork the repository
6
+ 2. Install dependencies: `npm install`
7
+ 3. Build: `npm run build`
8
+ 4. Test: `npm test`
9
+
10
+ ## Pull Request Guidelines
11
+
12
+ - Update documentation
13
+ - Add tests for new features
14
+ - Follow existing code style
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Via Profit
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.