@bairock/lenz 0.0.17 → 0.0.18
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/README.md +52 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,16 +4,58 @@ GraphQL SDL → MongoDB ORM — TypeScript-клиент и Apollo Server мод
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- ✅ **
|
|
9
|
-
- ✅ **
|
|
10
|
-
- ✅ **
|
|
11
|
-
- ✅ **
|
|
12
|
-
- ✅ **
|
|
13
|
-
- ✅ **Relations
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- ✅ **
|
|
7
|
+
### Schema & Models
|
|
8
|
+
- ✅ **GraphQL SDL Schema** — Define models using pure GraphQL syntax
|
|
9
|
+
- ✅ **20 директив** — `@model`, `@embedded`, `@id`, `@unique`, `@index`, `@default`, `@relation`, `@createdAt`, `@updatedAt`, `@hide`, `@map`, `@ignore`, `@email`, `@url`, `@regex`, `@modelMap`, `@compoundUnique`, `@compoundIndex`, `@compoundId`, `@fulltext`
|
|
10
|
+
- ✅ **11 скалярных типов** — `String`, `Int`, `Float`, `Boolean`, `ID`, `DateTime`, `Date`, `Json`, `ObjectId`, `Bytes`, `BigInt`
|
|
11
|
+
- ✅ **Enum support** — Нативные GraphQL enum с фильтрацией
|
|
12
|
+
- ✅ **Embedded documents** — Встраиваемые документы через `@embedded`
|
|
13
|
+
- ✅ **Relations** — One-to-One, One-to-Many, Many-to-Many, Many-to-One
|
|
14
|
+
|
|
15
|
+
### Generated ORM Client
|
|
16
|
+
- ✅ **TypeScript First** — Полная типизация, автокомплит, `.d.ts`
|
|
17
|
+
- ✅ **CRUD делегаты** — `findUnique`, `findFirst`, `findMany`, `create`, `update`, `upsert`, `delete`, `count`, `aggregate`, `groupBy` на каждую модель
|
|
18
|
+
- ✅ **Nested operations** — Вложенные create/connect/connectOrCreate/disconnect/set/update/delete/upsert для relations
|
|
19
|
+
- ✅ **Фильтры** — Все Prisma-style фильтры: `equals`, `not`, `in`, `lt`/`lte`/`gt`/`gte`, `contains`, `startsWith`, `endsWith`, `mode: insensitive`
|
|
20
|
+
- ✅ **Логические операторы** — `AND`, `OR`, `NOT`
|
|
21
|
+
- ✅ **Массив-фильтры** — `has`, `hasEvery`, `hasSome`, `isEmpty`
|
|
22
|
+
- ✅ **Full-text search** — MongoDB text indexes через `@fulltext` и `search`
|
|
23
|
+
- ✅ **Geo-spatial** — `near`, `geoWithin`, `geoIntersects`, `geoContains`
|
|
24
|
+
- ✅ **Пагинация** — Offset-based и Cursor-based (Relay Connection)
|
|
25
|
+
- ✅ **Атомарные обновления массивов** — `$push`/`$pull`/`$addToSet`/`$pop`/`$pullAll` с `$each`, `$position`
|
|
26
|
+
- ✅ **Атомарные инкременты** — `increment`/`decrement`/`multiply`/`divide`
|
|
27
|
+
- ✅ **Агрегации** — `_count`, `_sum`, `_avg`, `_min`, `_max` + `groupBy`
|
|
28
|
+
- ✅ **Транзакции** — ACID с retry logic
|
|
29
|
+
- ✅ **Client Extensions** — `$extends()` (query interception, computed fields, кастомные методы)
|
|
30
|
+
- ✅ **Default генераторы** — `uuid`, `now`, `cuid`, `cuid2`, `ulid`
|
|
31
|
+
- ✅ **Валидация** — `@email`, `@url`, `@regex` с ReDoS-защитой
|
|
32
|
+
- ✅ **Cascade** — `Cascade`, `SetNull`, `Restrict` для onDelete/onUpdate
|
|
33
|
+
- ✅ **Две стратегии загрузки** — `populate` (eager) и `lookup` (MongoDB `$lookup`)
|
|
34
|
+
|
|
35
|
+
### Apollo Server Integration
|
|
36
|
+
- ✅ **`lenz generate crud`** — Генерация CRUD-модулей для Apollo Server
|
|
37
|
+
- ✅ **typeDefs + resolvers** — Отдельные файлы на каждую модель
|
|
38
|
+
- ✅ **Context-based** — Резолверы через `{ lenz }` из контекста, без импорта сервисов
|
|
39
|
+
- ✅ **Barrel index.ts** — Единый импорт `{ typeDefs, resolvers }` из `src/index.js`
|
|
40
|
+
- ✅ **SDL inputTypes** — Все Prisma-style input-типы в формате `gql`
|
|
41
|
+
|
|
42
|
+
### Query Builder (runtime)
|
|
43
|
+
- ✅ **MongoDB query translation** — Конвертация типизированных запросов в MongoDB фильтры
|
|
44
|
+
- ✅ **Автоматическое ObjectId** — `id` → `_id` с авто-конвертацией 24-char hex
|
|
45
|
+
- ✅ **BSON форматирование** — ObjectId → string, Long → bigint, Binary → Buffer
|
|
46
|
+
|
|
47
|
+
### Cluster & Connection
|
|
48
|
+
- ✅ **Connection lifecycle** — `$connect()` / `$disconnect()` с pool management
|
|
49
|
+
- ✅ **Raw access** — `$mongo` (MongoClient), `$db` (Db), `$raw` (collection)
|
|
50
|
+
- ✅ **Логирование** — Настраиваемые уровни: `query`, `info`, `warn`, `error`
|
|
51
|
+
- ✅ **Error handling** — Типизированные ошибки: `NotFoundError`, `UniqueConstraintError`, `ValidationError`, `ConnectionError`, `TransactionError`
|
|
52
|
+
- ✅ **Автоиндексация** — Индексы на FK-полях, unique/text/compound индексы из схемы
|
|
53
|
+
|
|
54
|
+
### CLI
|
|
55
|
+
- ✅ **`lenz init`** — Инициализация проекта (схема, конфиг, .env)
|
|
56
|
+
- ✅ **`lenz generate orm`** — Генерация ORM-клиента
|
|
57
|
+
- ✅ **`lenz generate crud`** — Генерация Apollo Server CRUD-модулей
|
|
58
|
+
- ✅ **TypeScript/JavaScript** — Автоопределение языка по конфигу
|
|
17
59
|
|
|
18
60
|
## Сравнение с Prisma
|
|
19
61
|
|