@bairock/lenz 0.0.16 → 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.
Files changed (30) hide show
  1. package/README.md +149 -15
  2. package/dist/cli/commands/generate/crud.d.ts +3 -0
  3. package/dist/cli/commands/generate/crud.d.ts.map +1 -0
  4. package/dist/cli/commands/generate/crud.js +123 -0
  5. package/dist/cli/commands/generate/crud.js.map +1 -0
  6. package/dist/cli/commands/generate/index.d.ts +3 -0
  7. package/dist/cli/commands/generate/index.d.ts.map +1 -0
  8. package/dist/cli/commands/generate/index.js +8 -0
  9. package/dist/cli/commands/generate/index.js.map +1 -0
  10. package/dist/cli/commands/generate/orm.d.ts +3 -0
  11. package/dist/cli/commands/generate/orm.d.ts.map +1 -0
  12. package/dist/cli/commands/generate/orm.js +107 -0
  13. package/dist/cli/commands/generate/orm.js.map +1 -0
  14. package/dist/cli/index.js +1 -1
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/engine/CodeGenerator.d.ts +1 -0
  17. package/dist/engine/CodeGenerator.d.ts.map +1 -1
  18. package/dist/engine/CodeGenerator.js +3 -0
  19. package/dist/engine/CodeGenerator.js.map +1 -1
  20. package/dist/engine/generators/CrudModuleGenerator.d.ts +10 -0
  21. package/dist/engine/generators/CrudModuleGenerator.d.ts.map +1 -0
  22. package/dist/engine/generators/CrudModuleGenerator.js +141 -0
  23. package/dist/engine/generators/CrudModuleGenerator.js.map +1 -0
  24. package/dist/engine/generators/SDLInputTypesGenerator.d.ts +6 -0
  25. package/dist/engine/generators/SDLInputTypesGenerator.d.ts.map +1 -0
  26. package/dist/engine/generators/SDLInputTypesGenerator.js +763 -0
  27. package/dist/engine/generators/SDLInputTypesGenerator.js.map +1 -0
  28. package/dist/index.js +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/package.json +9 -3
package/README.md CHANGED
@@ -1,18 +1,61 @@
1
- # Lenz 🚀
1
+ # Lenz
2
2
 
3
- GraphQL-based ORM for MongoDB (Prisma style)
3
+ GraphQL SDL MongoDB ORM — TypeScript-клиент и Apollo Server модули из SDL
4
4
 
5
5
  ## Features
6
6
 
7
- - ✅ **GraphQL SDL Schema** - Define models using GraphQL syntax
8
- - ✅ **TypeScript First** - Full type safety and autocompletion
9
- - ✅ **MongoDB Native** - Leverage all MongoDB features including aggregation
10
- - ✅ **Prisma Style** - Familiar configuration and client generation
11
- - ✅ **Auto-generated Client** - Generate TypeScript client from GraphQL schema
12
- - ✅ **Relations Support** - One-to-One, One-to-Many, Many-to-Many
13
- - ✅ **Smart Loading Strategies** - Automatic choice between populate (separate queries) and lookup (server-side joins)
14
- - ✅ **Automatic Indexing** - Intelligent index creation for foreign key fields
15
- - **Transactions** - ACID transactions with MongoDB
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** — Автоопределение языка по конфигу
16
59
 
17
60
  ## Сравнение с Prisma
18
61
 
@@ -977,14 +1020,23 @@ type Author @model {
977
1020
  # Initialize project
978
1021
  npx lenz init
979
1022
 
980
- # Generate client
981
- npx lenz generate
1023
+ # Generate ORM client
1024
+ npx lenz generate orm
1025
+
1026
+ # Generate ORM client with custom config
1027
+ npx lenz generate orm --config lenz/lenz.config.ts
1028
+
1029
+ # Generate Apollo Server CRUD modules
1030
+ npx lenz generate crud
982
1031
 
983
- # Generate with custom config (use .ts for TypeScript, .js for JavaScript)
984
- npx lenz generate --config lenz/lenz.config.ts
1032
+ # Generate CRUD modules with custom paths
1033
+ npx lenz generate crud --schema lenz/schema.graphql --output ./src
985
1034
 
986
1035
  # Show help
987
1036
  npx lenz --help
1037
+
1038
+ # Show generate subcommands
1039
+ npx lenz generate
988
1040
  ```
989
1041
 
990
1042
  ## Structure After Generation
@@ -1001,11 +1053,93 @@ my-app/
1001
1053
  │ ├── client.ts # LenzClient class
1002
1054
  │ ├── types.ts # TypeScript types
1003
1055
  │ ├── enums.ts # Enum definitions
1056
+ │ ├── inputTypes.ts # GraphQL input types (filters, CreateInput, UpdateInput)
1004
1057
  │ ├── runtime/ # Runtime utilities
1005
1058
  │ └── models/ # Model delegates
1006
1059
  └── .env # Environment variables
1007
1060
  ```
1008
1061
 
1062
+ ### `lenz generate crud` — Apollo Server CRUD Modules
1063
+
1064
+ Generates per-model Apollo Server modules (typeDefs + resolvers) from `lenz/schema.graphql`.
1065
+
1066
+ **Опции:**
1067
+ - `-c, --config <path>` — путь к конфиг-файлу (по умолчанию: `lenz/lenz.config.ts`, с автоопределением `lenz/lenz.config.js`)
1068
+ - `-s, --schema <path>` — путь к схеме (по умолчанию: из конфига или `schema.graphql`)
1069
+ - `-o, --output <path>` — выходная директория (по умолчанию: из конфига `generate.crud.output` или `./src`)
1070
+
1071
+ **Определение языка:** генератор определяет TypeScript или JavaScript по расширению конфиг-файла:
1072
+ - `lenz/lenz.config.ts` → генерирует `.ts` файлы
1073
+ - `lenz/lenz.config.js` → генерирует `.js` файлы
1074
+
1075
+ Если конфиг не найден, по умолчанию используются `.ts` файлы.
1076
+
1077
+ **Структура выхода:**
1078
+ ```
1079
+ src/
1080
+ ├── index.ts # Баррель-файл: typeDefs + resolvers всех модулей
1081
+ ├── Category/
1082
+ │ ├── typeDefs/
1083
+ │ │ ├── mutations.ts # createCategory, updateCategory, deleteCategory
1084
+ │ │ └── queries.ts # findUniqueCategory, findFirstCategory, findManyCategory, findManyCategoryCount
1085
+ │ ├── resolvers/
1086
+ │ │ ├── mutations.ts # Resolvers using { lenz } from context
1087
+ │ │ └── queries.ts
1088
+ │ └── index.ts # Aggregated typeDefs and resolvers
1089
+ ├── User/
1090
+ │ ├── ...
1091
+ │ └── index.ts
1092
+ └── ... (все модели)
1093
+ ```
1094
+
1095
+ Баррель `src/index.ts` автоматически импортирует `inputTypes` из ORM-клиента и собирает все модули:
1096
+
1097
+ ```typescript
1098
+ // src/index.ts (сгенерировано)
1099
+ import { mergeTypeDefs, mergeResolvers } from '@graphql-tools/merge';
1100
+ import { inputTypes } from '../generated/lenz/client/inputTypes.js';
1101
+ import { categoryTypeDefs, categoryResolvers } from './Category/index.js';
1102
+ import { userTypeDefs, userResolvers } from './User/index.js';
1103
+
1104
+ export const typeDefs = mergeTypeDefs([inputTypes, ...categoryTypeDefs, ...userTypeDefs]);
1105
+ export const resolvers = mergeResolvers([categoryResolvers, userResolvers]);
1106
+ ```
1107
+
1108
+ **Пример конфига (опционально):**
1109
+ ```js
1110
+ // lenz/lenz.config.js
1111
+ export default {
1112
+ schema: 'lenz/schema.graphql',
1113
+ generate: {
1114
+ crud: {
1115
+ output: './src',
1116
+ },
1117
+ },
1118
+ };
1119
+ ```
1120
+
1121
+ **Использование с Apollo Server:**
1122
+
1123
+ Резолверы получают экземпляр `LenzClient` через поле `lenz` GraphQL контекста — без импорта сервисов. Баррель `src/index.ts` уже собирает все typeDefs и resolvers:
1124
+
1125
+ ```typescript
1126
+ import { ApolloServer } from '@apollo/server';
1127
+ import { startStandaloneServer } from '@apollo/server/standalone';
1128
+ import { LenzClient } from '../generated/lenz/client/index.js';
1129
+ import { typeDefs, resolvers } from './src/index.js';
1130
+
1131
+ const lenz = new LenzClient({ url: process.env.MONGO_URL });
1132
+ await lenz.$connect();
1133
+
1134
+ const server = new ApolloServer({ typeDefs, resolvers });
1135
+
1136
+ const { url } = await startStandaloneServer(server, {
1137
+ context: async () => ({ lenz }),
1138
+ });
1139
+ ```
1140
+
1141
+ > **Важно:** `src/index.ts` автоматически импортирует `inputTypes` из ORM-клиента и объединяет их со всеми CRUD-модулями через `mergeTypeDefs` / `mergeResolvers`. Путь к ORM-клиенту берётся из конфига (`generate.client.output`) или используется `../generated/lenz/client` по умолчанию.
1142
+
1009
1143
  ## Development
1010
1144
 
1011
1145
  ### Build
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const generateCrudCommand: Command;
3
+ //# sourceMappingURL=crud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/generate/crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,mBAAmB,SA0I5B,CAAC"}
@@ -0,0 +1,123 @@
1
+ import { Command } from 'commander';
2
+ import { promises as fs, existsSync } from 'fs';
3
+ import { resolve, dirname, relative, sep, join } from 'path';
4
+ import chalk from 'chalk';
5
+ import * as ts from 'typescript';
6
+ import { GraphQLParser } from '../../../engine/GraphQLParser.js';
7
+ import { CrudModuleGenerator } from '../../../engine/generators/CrudModuleGenerator.js';
8
+ import { ConfigurationError } from '../../../errors/index.js';
9
+ export const generateCrudCommand = new Command('crud')
10
+ .description('Generate Apollo Server CRUD modules from GraphQL schema')
11
+ .option('-c, --config <path>', 'Path to lenz config file', 'lenz/lenz.config.ts')
12
+ .option('-s, --schema <path>', 'Path to GraphQL schema file')
13
+ .option('-o, --output <path>', 'Output directory for generated modules')
14
+ .action(async (options) => {
15
+ console.log(chalk.blue('🚀 Generating Apollo Server CRUD modules...'));
16
+ try {
17
+ // 1. Load config (for path resolution and language detection)
18
+ let config = {};
19
+ let configFile = options.config;
20
+ // Auto-detect JS config if default TS config doesn't exist
21
+ if (configFile === 'lenz/lenz.config.ts') {
22
+ const tsConfigPath = resolve(process.cwd(), 'lenz/lenz.config.ts');
23
+ const jsConfigPath = resolve(process.cwd(), 'lenz/lenz.config.js');
24
+ if (!existsSync(tsConfigPath) && existsSync(jsConfigPath)) {
25
+ configFile = 'lenz/lenz.config.js';
26
+ console.log(chalk.gray(`📦 Using JavaScript config: ${configFile}`));
27
+ }
28
+ }
29
+ const configPath = resolve(process.cwd(), configFile);
30
+ if (existsSync(configPath)) {
31
+ if (configPath.endsWith('.ts')) {
32
+ try {
33
+ const configModule = await import(configPath);
34
+ config = configModule.default || configModule;
35
+ }
36
+ catch {
37
+ const tsCode = await fs.readFile(configPath, 'utf-8');
38
+ const jsCode = ts.transpileModule(tsCode, {
39
+ compilerOptions: {
40
+ target: ts.ScriptTarget.ES2020,
41
+ module: ts.ModuleKind.ESNext,
42
+ strict: false,
43
+ esModuleInterop: true,
44
+ }
45
+ }).outputText;
46
+ const tempPath = resolve(dirname(configPath), `.lenz-config-${Date.now()}.mjs`);
47
+ await fs.writeFile(tempPath, jsCode, 'utf-8');
48
+ try {
49
+ const configModule = await import(tempPath);
50
+ config = configModule.default || configModule;
51
+ }
52
+ finally {
53
+ await fs.unlink(tempPath).catch(() => { });
54
+ }
55
+ }
56
+ }
57
+ else if (configPath.endsWith('.js') || configPath.endsWith('.mjs')) {
58
+ const configModule = await import(configPath);
59
+ config = configModule.default || configModule;
60
+ }
61
+ }
62
+ else {
63
+ console.log(chalk.yellow('⚠️ Config file not found, using defaults'));
64
+ }
65
+ // 2. Resolve paths
66
+ const isTypeScript = configPath.endsWith('.ts');
67
+ const schemaPath = resolve(dirname(configPath), options.schema || config.schema || 'schema.graphql');
68
+ if (!existsSync(schemaPath)) {
69
+ throw new ConfigurationError(`Schema file not found: ${schemaPath}. Try running: lenz init`, { schemaPath });
70
+ }
71
+ const outputPath = resolve(dirname(configPath), options.output || config.generate?.crud?.output || './src');
72
+ // Compute inputTypes path relative to CRUD output
73
+ const ormOutputDir = resolve(dirname(configPath), config.generate?.client?.output || '../generated/lenz/client');
74
+ const inputTypesRel = relative(outputPath, join(ormOutputDir, 'inputTypes.js')).split(sep).join('/');
75
+ const inputTypesPath = inputTypesRel.startsWith('.') ? inputTypesRel : `./${inputTypesRel}`;
76
+ // 3. Read and parse schema
77
+ const schemaSDL = await fs.readFile(schemaPath, 'utf-8');
78
+ const parser = new GraphQLParser(schemaSDL);
79
+ parser.validate();
80
+ const schemaInfo = parser.getSchemaInfo();
81
+ const models = schemaInfo.models;
82
+ const nonEmbedded = models.filter(m => !m.isEmbedded);
83
+ console.log(chalk.blue(`📊 Found ${nonEmbedded.length} non-embedded models`));
84
+ console.log(chalk.gray(`📁 Detected ${isTypeScript ? 'TypeScript' : 'JavaScript'} project`));
85
+ // 4. Validate required input types exist in schema
86
+ const generator = new CrudModuleGenerator(inputTypesPath);
87
+ generator.validate(models, schemaSDL);
88
+ // 5. Generate files with proper extension
89
+ const files = generator.generate(models);
90
+ // 6. Write files
91
+ let fileCount = 0;
92
+ for (let [relativePath, content] of Object.entries(files)) {
93
+ // Change extension from .ts to .js for JS projects
94
+ if (!isTypeScript) {
95
+ relativePath = relativePath.replace(/\.ts$/, '.js');
96
+ }
97
+ const fullPath = resolve(outputPath, relativePath);
98
+ const dir = resolve(outputPath, relativePath.split('/').slice(0, -1).join('/'));
99
+ await fs.mkdir(dir, { recursive: true });
100
+ await fs.writeFile(fullPath, content, 'utf-8');
101
+ fileCount++;
102
+ }
103
+ // 7. Print summary
104
+ console.log(chalk.green(`✅ CRUD modules generated!`));
105
+ console.log(chalk.gray('================================'));
106
+ console.log(chalk.cyan('📊 Generated:'));
107
+ console.log(chalk.white(` • ${nonEmbedded.length} model modules`));
108
+ console.log(chalk.white(` • ${fileCount} files total`));
109
+ console.log(chalk.gray('================================\n'));
110
+ console.log(chalk.yellow('📋 Next steps:'));
111
+ console.log(chalk.white(` 1. Import from barrel: ${chalk.cyan(`import { typeDefs, resolvers } from '${options.output || './src'}/index${isTypeScript ? '.ts' : '.js'}'`)}`));
112
+ console.log(chalk.white(` 2. Add lenz client to Apollo context: ${chalk.cyan(`context: ({ req }) => ({ lenz })`)}\n`));
113
+ }
114
+ catch (error) {
115
+ console.log(chalk.red('❌ CRUD generation failed:'));
116
+ console.log(chalk.red(error instanceof Error ? error.message : String(error)));
117
+ if (typeof error === 'object' && error !== null && 'details' in error) {
118
+ console.log(chalk.gray(' Details:', JSON.stringify(error.details, null, 2)));
119
+ }
120
+ throw error;
121
+ }
122
+ });
123
+ //# sourceMappingURL=crud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crud.js","sourceRoot":"","sources":["../../../../src/cli/commands/generate/crud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC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C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,4BAA4B,KAAK,CAAC,IAAI,CAAC,wCAAwC,OAAO,CAAC,MAAM,IAAI,OAAO,SAAS,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9K,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,2CAA2C,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1H,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAE,KAAa,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const generateCommand: Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,eAAe,SAGM,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ import { generateOrmCommand } from './orm.js';
3
+ import { generateCrudCommand } from './crud.js';
4
+ export const generateCommand = new Command('generate')
5
+ .description('Generate code from lenz/schema.graphql')
6
+ .addCommand(generateOrmCommand)
7
+ .addCommand(generateCrudCommand);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KACnD,WAAW,CAAC,wCAAwC,CAAC;KACrD,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const generateOrmCommand: Command;
3
+ //# sourceMappingURL=orm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orm.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/generate/orm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,kBAAkB,SAkH3B,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { Command } from 'commander';
2
+ import { LenzEngine } from '../../../engine/LenzEngine.js';
3
+ import { existsSync, promises as fs } from 'fs';
4
+ import { resolve, dirname } from 'path';
5
+ import chalk from 'chalk';
6
+ import * as ts from 'typescript';
7
+ import { ConfigurationError } from '../../../errors/index.js';
8
+ export const generateOrmCommand = new Command('orm')
9
+ .description('Generate Lenz ORM client from GraphQL schema')
10
+ .option('-c, --config <path>', 'Path to lenz config file', 'lenz/lenz.config.ts')
11
+ .option('-s, --schema <path>', 'Path to GraphQL schema file')
12
+ .option('-o, --output <path>', 'Output directory for generated client')
13
+ .option('-n, --name <name>', 'Name of the generated client', 'LenzClient')
14
+ .action(async (options) => {
15
+ console.log(chalk.blue('🚀 Generating Lenz client...'));
16
+ try {
17
+ let config = {};
18
+ // Автоматически определяем конфиг по типу проекта, если используется значение по умолчанию
19
+ let configFile = options.config;
20
+ if (configFile === 'lenz/lenz.config.ts') {
21
+ const tsConfigPath = resolve(process.cwd(), 'lenz/lenz.config.ts');
22
+ const jsConfigPath = resolve(process.cwd(), 'lenz/lenz.config.js');
23
+ if (!existsSync(tsConfigPath) && existsSync(jsConfigPath)) {
24
+ configFile = 'lenz/lenz.config.js';
25
+ console.log(chalk.gray(`📦 Using JavaScript config: ${configFile}`));
26
+ }
27
+ }
28
+ const configPath = resolve(process.cwd(), configFile);
29
+ // Загружаем конфигурацию
30
+ if (existsSync(configPath)) {
31
+ if (configPath.endsWith('.ts')) {
32
+ // Try direct import first (works when running via tsx), fallback to transpile
33
+ try {
34
+ const configModule = await import(configPath);
35
+ config = configModule.default || configModule;
36
+ }
37
+ catch {
38
+ // Fallback: transpile with TypeScript compiler
39
+ const tsCode = await fs.readFile(configPath, 'utf-8');
40
+ const jsCode = ts.transpileModule(tsCode, {
41
+ compilerOptions: {
42
+ target: ts.ScriptTarget.ES2020,
43
+ module: ts.ModuleKind.ESNext,
44
+ strict: false,
45
+ esModuleInterop: true,
46
+ }
47
+ }).outputText;
48
+ const tempPath = resolve(dirname(configPath), `.lenz-config-${Date.now()}.mjs`);
49
+ await fs.writeFile(tempPath, jsCode, 'utf-8');
50
+ try {
51
+ const configModule = await import(tempPath);
52
+ config = configModule.default || configModule;
53
+ }
54
+ finally {
55
+ await fs.unlink(tempPath).catch(() => { });
56
+ }
57
+ }
58
+ }
59
+ else if (configPath.endsWith('.js') || configPath.endsWith('.mjs')) {
60
+ // Для JavaScript конфига (только ESM)
61
+ const configModule = await import(configPath);
62
+ config = configModule.default || configModule;
63
+ }
64
+ }
65
+ else {
66
+ console.log(chalk.yellow('⚠️ Config file not found, using defaults'));
67
+ }
68
+ // Определяем пути
69
+ const schemaPath = resolve(dirname(configPath), options.schema || config.schema || 'schema.graphql');
70
+ if (!existsSync(schemaPath)) {
71
+ throw new ConfigurationError(`Schema file not found: ${schemaPath}. Try running: lenz init`, { schemaPath });
72
+ }
73
+ const outputPath = resolve(dirname(configPath), options.output || config.generate?.client?.output || '../generated/lenz/client');
74
+ // Создаем движок и генерируем
75
+ const engine = new LenzEngine({
76
+ schemaPath,
77
+ outputPath,
78
+ clientName: options.name
79
+ });
80
+ await engine.generate();
81
+ // Отображаем информацию
82
+ const schemaInfo = engine.getSchemaInfo();
83
+ if (schemaInfo) {
84
+ console.log(chalk.green('✅ Generation complete!'));
85
+ console.log(chalk.gray('================================'));
86
+ console.log(chalk.cyan('📊 Generated:'));
87
+ console.log(chalk.white(` • ${schemaInfo.modelCount} models`));
88
+ console.log(chalk.white(` • ${schemaInfo.enumCount} enums`));
89
+ console.log(chalk.white(` • ${schemaInfo.relationCount} relations`));
90
+ console.log(chalk.gray('================================\n'));
91
+ console.log(chalk.yellow('🚀 Next steps:'));
92
+ console.log(chalk.white(` 1. Import client: ${chalk.cyan(`import { LenzClient } from '../generated/lenz/client'`)}`));
93
+ console.log(chalk.white(` 2. Create instance: ${chalk.cyan(`const lenz = new LenzClient({ url: 'mongodb://...' })`)}`));
94
+ console.log(chalk.white(` 3. Connect: ${chalk.cyan(`await lenz.$connect()`)}`));
95
+ console.log(chalk.white(` 4. Use models: ${chalk.cyan(`await lenz.user.findMany()`)}\n`));
96
+ }
97
+ }
98
+ catch (error) {
99
+ console.log(chalk.red('❌ Generation failed:'));
100
+ console.log(chalk.red(error instanceof Error ? error.message : String(error)));
101
+ if (typeof error === 'object' && error !== null && 'details' in error) {
102
+ console.log(chalk.gray(' Details:', JSON.stringify(error.details, null, 2)));
103
+ }
104
+ throw error;
105
+ }
106
+ });
107
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,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC;YACjF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,CAAC;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAE,KAAa,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC"}
package/dist/cli/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
- import { generateCommand } from './commands/generate.js';
3
+ import { generateCommand } from './commands/generate/index.js';
4
4
  import { initCommand } from './commands/init.js';
5
5
  import chalk from 'chalk';
6
6
  import figlet from 'figlet';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CA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AI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,0CAA0C,CAAC;KACvD,OAAO,CAAC,OAAO,CAAC;KAChB,eAAe,CAAC;IACf,WAAW,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACnD,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAEpC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -14,6 +14,7 @@ export declare class CodeGenerator {
14
14
  private clientGenerator;
15
15
  private delegateGenerator;
16
16
  private runtimeGenerator;
17
+ private sdlInputTypesGenerator;
17
18
  generate(options: GenerateOptions): GeneratedFiles;
18
19
  }
19
20
  //# sourceMappingURL=CodeGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeGenerator.d.ts","sourceRoot":"","sources":["../../src/engine/CodeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAO9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,iBAAiB,CAA2B;IACpD,OAAO,CAAC,gBAAgB,CAA0B;IAElD,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc;CAkCnD"}
1
+ {"version":3,"file":"CodeGenerator.d.ts","sourceRoot":"","sources":["../../src/engine/CodeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQ9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,eAAe,CAAyB;IAChD,OAAO,CAAC,iBAAiB,CAA2B;IACpD,OAAO,CAAC,gBAAgB,CAA0B;IAClD,OAAO,CAAC,sBAAsB,CAAgC;IAE9D,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc;CAmCnD"}
@@ -3,12 +3,14 @@ import { TypeGenerator } from './generators/TypeGenerator.js';
3
3
  import { ClientGenerator } from './generators/ClientGenerator.js';
4
4
  import { DelegateGenerator } from './generators/DelegateGenerator.js';
5
5
  import { RuntimeGenerator } from './generators/RuntimeGenerator.js';
6
+ import { SDLInputTypesGenerator } from './generators/SDLInputTypesGenerator.js';
6
7
  export class CodeGenerator {
7
8
  constructor() {
8
9
  this.typeGenerator = new TypeGenerator();
9
10
  this.clientGenerator = new ClientGenerator();
10
11
  this.delegateGenerator = new DelegateGenerator();
11
12
  this.runtimeGenerator = new RuntimeGenerator();
13
+ this.sdlInputTypesGenerator = new SDLInputTypesGenerator();
12
14
  }
13
15
  generate(options) {
14
16
  const { models, enums, clientName = 'LenzClient' } = options;
@@ -24,6 +26,7 @@ export class CodeGenerator {
24
26
  'runtime/relations.ts': this.runtimeGenerator.generateRuntimeRelations(),
25
27
  'runtime/errors.ts': this.runtimeGenerator.generateRuntimeErrors(),
26
28
  'runtime/logger.ts': this.runtimeGenerator.generateRuntimeLogger(),
29
+ 'inputTypes.ts': this.sdlInputTypesGenerator.generateSDLOutput(models, enums),
27
30
  'models/index.ts': this.delegateGenerator.generateModelsIndex(nonEmbeddedModels),
28
31
  ...this.delegateGenerator.generateModelFiles(nonEmbeddedModels)
29
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CodeGenerator.js","sourceRoot":"","sources":["../../src/engine/CodeGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAcpE,MAAM,OAAO,aAAa;IAA1B;QACU,kBAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QACxC,sBAAiB,GAAG,IAAI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AmB,EAAE,CAAC;QAClC,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAEhD,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACvD,MAAM,CAAC,MAAM,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,MAAM,CAAC,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;YAC1D,CAAC;YAED,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { GraphQLModel } from '../GraphQLParser.js';
2
+ export declare class CrudModuleGenerator {
3
+ private inputTypesPath;
4
+ constructor(inputTypesPath?: string);
5
+ generate(models: GraphQLModel[]): Record<string, string>;
6
+ private genBarrelIndex;
7
+ /** Validate that all required SDL input types exist in the schema SDL string */
8
+ validate(models: GraphQLModel[], schemaSDL: string): void;
9
+ }
10
+ //# sourceMappingURL=CrudModuleGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrudModuleGenerator.d.ts","sourceRoot":"","sources":["../../../src/engine/generators/CrudModuleGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAqFnD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,cAAc,CAAS;gBAEnB,cAAc,GAAE,MAAiD;IAI7E,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAoBxD,OAAO,CAAC,cAAc;IAsBtB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CA0B1D"}