@auto-engineer/server-generator-nestjs 0.19.1 → 0.21.0

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 (100) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/.turbo/turbo-format.log +4 -0
  3. package/.turbo/turbo-lint.log +4 -0
  4. package/.turbo/turbo-test.log +13 -0
  5. package/.turbo/turbo-type-check.log +4 -0
  6. package/CHANGELOG.md +13 -2
  7. package/dist/src/codegen/entity-consolidation.d.ts +19 -0
  8. package/dist/src/codegen/entity-consolidation.d.ts.map +1 -0
  9. package/dist/src/codegen/entity-consolidation.js +134 -0
  10. package/dist/src/codegen/entity-consolidation.js.map +1 -0
  11. package/dist/src/codegen/extract/commands.d.ts +25 -0
  12. package/dist/src/codegen/extract/commands.d.ts.map +1 -0
  13. package/dist/src/codegen/extract/commands.js +67 -0
  14. package/dist/src/codegen/extract/commands.js.map +1 -0
  15. package/dist/src/codegen/extract/data-sink.d.ts +6 -0
  16. package/dist/src/codegen/extract/data-sink.d.ts.map +1 -0
  17. package/dist/src/codegen/extract/data-sink.js +90 -0
  18. package/dist/src/codegen/extract/data-sink.js.map +1 -0
  19. package/dist/src/codegen/extract/events.d.ts +10 -0
  20. package/dist/src/codegen/extract/events.d.ts.map +1 -0
  21. package/dist/src/codegen/extract/events.js +42 -0
  22. package/dist/src/codegen/extract/events.js.map +1 -0
  23. package/dist/src/codegen/extract/fields.d.ts +3 -0
  24. package/dist/src/codegen/extract/fields.d.ts.map +1 -0
  25. package/dist/src/codegen/extract/fields.js +9 -0
  26. package/dist/src/codegen/extract/fields.js.map +1 -0
  27. package/dist/src/codegen/extract/graphql.d.ts +14 -0
  28. package/dist/src/codegen/extract/graphql.d.ts.map +1 -0
  29. package/dist/src/codegen/extract/graphql.js +81 -0
  30. package/dist/src/codegen/extract/graphql.js.map +1 -0
  31. package/dist/src/codegen/extract/gwt.d.ts +6 -0
  32. package/dist/src/codegen/extract/gwt.d.ts.map +1 -0
  33. package/dist/src/codegen/extract/gwt.js +79 -0
  34. package/dist/src/codegen/extract/gwt.js.map +1 -0
  35. package/dist/src/codegen/extract/imports.d.ts +29 -0
  36. package/dist/src/codegen/extract/imports.d.ts.map +1 -0
  37. package/dist/src/codegen/extract/imports.js +55 -0
  38. package/dist/src/codegen/extract/imports.js.map +1 -0
  39. package/dist/src/codegen/extract/index.d.ts +10 -0
  40. package/dist/src/codegen/extract/index.d.ts.map +1 -0
  41. package/dist/src/codegen/extract/index.js +10 -0
  42. package/dist/src/codegen/extract/index.js.map +1 -0
  43. package/dist/src/codegen/extract/messages.d.ts +16 -0
  44. package/dist/src/codegen/extract/messages.d.ts.map +1 -0
  45. package/dist/src/codegen/extract/messages.js +192 -0
  46. package/dist/src/codegen/extract/messages.js.map +1 -0
  47. package/dist/src/codegen/extract/projection.d.ts +5 -0
  48. package/dist/src/codegen/extract/projection.d.ts.map +1 -0
  49. package/dist/src/codegen/extract/projection.js +44 -0
  50. package/dist/src/codegen/extract/projection.js.map +1 -0
  51. package/dist/src/codegen/extract/query.d.ts +13 -0
  52. package/dist/src/codegen/extract/query.d.ts.map +1 -0
  53. package/dist/src/codegen/extract/query.js +18 -0
  54. package/dist/src/codegen/extract/query.js.map +1 -0
  55. package/dist/src/codegen/extract/states.d.ts +5 -0
  56. package/dist/src/codegen/extract/states.d.ts.map +1 -0
  57. package/dist/src/codegen/extract/states.js +48 -0
  58. package/dist/src/codegen/extract/states.js.map +1 -0
  59. package/dist/src/codegen/extract/type-helpers.d.ts +13 -0
  60. package/dist/src/codegen/extract/type-helpers.d.ts.map +1 -0
  61. package/dist/src/codegen/extract/type-helpers.js +98 -0
  62. package/dist/src/codegen/extract/type-helpers.js.map +1 -0
  63. package/dist/src/codegen/scaffoldFromSchema.d.ts +9 -0
  64. package/dist/src/codegen/scaffoldFromSchema.d.ts.map +1 -0
  65. package/dist/src/codegen/scaffoldFromSchema.js +391 -0
  66. package/dist/src/codegen/scaffoldFromSchema.js.map +1 -0
  67. package/dist/src/codegen/templates/command/command.ts.ejs +16 -0
  68. package/dist/src/codegen/templates/command/handler.specs.ts.ejs +50 -0
  69. package/dist/src/codegen/templates/command/handler.ts.ejs +30 -0
  70. package/dist/src/codegen/templates/command/input.ts.ejs +23 -0
  71. package/dist/src/codegen/templates/command/resolver.ts.ejs +56 -0
  72. package/dist/src/codegen/templates/entity/entity.ts.ejs +35 -0
  73. package/dist/src/codegen/templates/entity/index.ts.ejs +6 -0
  74. package/dist/src/codegen/templates/module/app-module.ts.ejs +65 -0
  75. package/dist/src/codegen/templates/module/domain-module.ts.ejs +46 -0
  76. package/dist/src/codegen/templates/query/handler.ts.ejs +25 -0
  77. package/dist/src/codegen/templates/query/query.ts.ejs +1 -0
  78. package/dist/src/codegen/templates/query/resolver.ts.ejs +20 -0
  79. package/dist/src/codegen/templates/query/type.ts.ejs +24 -0
  80. package/dist/src/codegen/types.d.ts +37 -0
  81. package/dist/src/codegen/types.d.ts.map +1 -0
  82. package/dist/src/codegen/types.js +2 -0
  83. package/dist/src/codegen/types.js.map +1 -0
  84. package/dist/src/codegen/utils/path.d.ts +4 -0
  85. package/dist/src/codegen/utils/path.d.ts.map +1 -0
  86. package/dist/src/codegen/utils/path.js +18 -0
  87. package/dist/src/codegen/utils/path.js.map +1 -0
  88. package/dist/src/commands/generate-server.d.ts +28 -0
  89. package/dist/src/commands/generate-server.d.ts.map +1 -0
  90. package/dist/src/commands/generate-server.js +422 -0
  91. package/dist/src/commands/generate-server.js.map +1 -0
  92. package/dist/src/index.d.ts +3 -0
  93. package/dist/src/index.d.ts.map +1 -0
  94. package/dist/src/index.js +3 -0
  95. package/dist/src/index.js.map +1 -0
  96. package/dist/src/shared/graphql-types.ts +19 -0
  97. package/dist/src/shared/main.ts +27 -0
  98. package/dist/src/shared/mikro-orm.config.ts +18 -0
  99. package/dist/tsconfig.tsbuildinfo +1 -0
  100. package/package.json +3 -3
@@ -0,0 +1,23 @@
1
+ <%
2
+ const command = commands[0];
3
+ if (!command) return '';
4
+ const usesID = command.fields.some(f => graphqlType(f.tsType) === 'ID');
5
+ const usesFloat = command.fields.some(f => fieldUsesFloat(f.tsType));
6
+ const usesJSON = command.fields.some(f => fieldUsesJSON(f.tsType));
7
+ const enumList = collectEnumNames(command.fields);
8
+ %>import { InputType, Field<% if (usesID) { %>, ID<% } %><% if (usesFloat) { %>, Float<% } %> } from '@nestjs/graphql';
9
+ <% if (usesJSON) { -%>
10
+ import GraphQLJSON from 'graphql-type-json';
11
+ <% } -%>
12
+ <% if (enumList.length > 0) { -%>
13
+ import { <%= enumList.join(', ') %> } from '../entities';
14
+ <% } -%>
15
+
16
+ @InputType()
17
+ export class <%= pascalCase(command.type) %>Input {
18
+ <% for (const field of command.fields) { -%>
19
+ @Field(() => <%= graphqlType(field.tsType) %><%= isNullable(field.tsType) ? ', { nullable: true }' : '' %>)
20
+ <%= field.name %><%= isNullable(field.tsType) ? '?' : '!' %>: <%= toTsFieldType(field.tsType) %>;
21
+
22
+ <% } -%>
23
+ }
@@ -0,0 +1,56 @@
1
+ <%
2
+ const command = commands[0];
3
+ if (!command) return '';
4
+ const mutationName = camelCase(sliceName);
5
+ %>import { Mutation, Resolver, Args } from '@nestjs/graphql';
6
+ import { Logger, Injectable } from '@nestjs/common';
7
+ import { CommandBus } from '@nestjs/cqrs';
8
+ import { <%= pascalCase(command.type) %>Command } from './<%= toKebabCase(sliceName) %>.command';
9
+ import { <%= pascalCase(command.type) %>Input } from './<%= toKebabCase(sliceName) %>.input';
10
+ import { MutationResponse } from '../../shared/graphql-types';
11
+
12
+ @Injectable()
13
+ @Resolver()
14
+ export class <%= pascalCase(command.type) %>Resolver {
15
+ private readonly logger = new Logger(<%= pascalCase(command.type) %>Resolver.name);
16
+
17
+ constructor(private readonly commandBus: CommandBus) {}
18
+
19
+ @Mutation(() => MutationResponse)
20
+ async <%= mutationName %>(
21
+ @Args({ name: 'input', type: () => <%= pascalCase(command.type) %>Input })
22
+ input: <%= pascalCase(command.type) %>Input
23
+ ): Promise<MutationResponse> {
24
+ try {
25
+ await this.commandBus.execute(
26
+ new <%= pascalCase(command.type) %>Command(
27
+ <% for (let i = 0; i < command.fields.length; i++) { const field = command.fields[i]; -%>
28
+ input.<%= field.name %>,
29
+ <% } -%>
30
+ )
31
+ );
32
+ this.logger.log(`Successfully executed: <%= mutationName %>`);
33
+ return { success: true };
34
+ } catch (error: unknown) {
35
+ if (error instanceof Error) {
36
+ this.logger.error(`Failed to execute <%= mutationName %>: ${error.message}`, error.stack);
37
+ return {
38
+ success: false,
39
+ error: {
40
+ type: error.name,
41
+ message: error.message,
42
+ },
43
+ };
44
+ }
45
+
46
+ this.logger.error('Failed to execute <%= mutationName %>: Unknown error');
47
+ return {
48
+ success: false,
49
+ error: {
50
+ type: 'UnknownError',
51
+ message: 'An unexpected error occurred',
52
+ },
53
+ };
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,35 @@
1
+ <%
2
+ function getOrmType(field) {
3
+ const cleanType = field.tsType.replace(/\s*\|\s*null\b/g, '').trim();
4
+ if (cleanType === 'string') return 'string';
5
+ if (cleanType === 'number') return 'number';
6
+ if (cleanType === 'boolean') return 'boolean';
7
+ if (cleanType === 'Date') return 'Date';
8
+ return 'string';
9
+ }
10
+ %>import { Entity, PrimaryKey, Property, Enum, Index } from '@mikro-orm/core';
11
+ <% if (entity.enumImports.length > 0) { -%>
12
+ import { <%= entity.enumImports.join(', ') %> } from '.';
13
+ <% } -%>
14
+
15
+ @Entity({ tableName: '<%= entity.tableName %>' })
16
+ export class <%= entity.entityName %> {
17
+ <% for (const field of entity.fields) { -%>
18
+ <% if (field.isPrimary) { -%>
19
+ @PrimaryKey({ type: '<%= getOrmType(field) %>' })
20
+ <%= field.name %>!: <%= toTsFieldType(field.tsType) %>;
21
+
22
+ <% } else if (field.isEnum && field.enumName) { -%>
23
+ @Enum(() => <%= field.enumName %>)
24
+ <% if (field.indexed) { -%>
25
+ @Index()
26
+ <% } -%>
27
+ <%= field.name %>!: <%= field.enumName %>;
28
+
29
+ <% } else { -%>
30
+ @Property({ type: '<%= getOrmType(field) %>'<%= field.nullable ? ', nullable: true' : '' %> })
31
+ <%= field.name %><%= field.nullable ? '?' : '!' %>: <%= toTsFieldType(field.tsType) %><%= field.nullable ? ' | null' : '' %>;
32
+
33
+ <% } -%>
34
+ <% } -%>
35
+ }
@@ -0,0 +1,6 @@
1
+ export * from './<%= toKebabCase(entity.entityName) %>.entity';
2
+ <% if (entity.enumImports.length > 0) { -%>
3
+ <% for (const enumName of entity.enumImports) { -%>
4
+ export * from './<%= toKebabCase(enumName) %>.enum';
5
+ <% } -%>
6
+ <% } -%>
@@ -0,0 +1,65 @@
1
+ import { Module, Logger } from '@nestjs/common';
2
+ import { CqrsModule } from '@nestjs/cqrs';
3
+ import { GraphQLModule } from '@nestjs/graphql';
4
+ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
5
+ import { MikroOrmModule } from '@mikro-orm/nestjs';
6
+ import { SqliteDriver } from '@mikro-orm/sqlite';
7
+ import { Migrator } from '@mikro-orm/migrations';
8
+ import { join } from 'path';
9
+ import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default';
10
+
11
+ <% for (const flow of flows) { -%>
12
+ import { <%= pascalCase(flow.name) %>Module } from './domain/<%= toKebabCase(flow.name) %>/<%= toKebabCase(flow.name) %>.module';
13
+ import { <%= pascalCase(flow.name) %>Entity } from './domain/<%= toKebabCase(flow.name) %>/entities';
14
+ <% } -%>
15
+
16
+ const domainModules = [
17
+ <% for (const flow of flows) { -%>
18
+ <%= pascalCase(flow.name) %>Module,
19
+ <% } -%>
20
+ ];
21
+
22
+ const entities = [
23
+ <% for (const flow of flows) { -%>
24
+ <%= pascalCase(flow.name) %>Entity,
25
+ <% } -%>
26
+ ];
27
+
28
+ @Module({
29
+ imports: [
30
+ ...domainModules,
31
+ MikroOrmModule.forRoot({
32
+ entities,
33
+ dbName: process.env.NODE_ENV === 'test' ? ':memory:' : './db.sqlite',
34
+ driver: SqliteDriver,
35
+ allowGlobalContext: true,
36
+ debug: process.env.NODE_ENV !== 'production',
37
+ ensureDatabase: true,
38
+ extensions: [Migrator],
39
+ migrations: {
40
+ path: join(__dirname, 'migrations'),
41
+ glob: '!(*.d).{js,ts}',
42
+ transactional: true,
43
+ disableForeignKeys: false,
44
+ emit: 'ts',
45
+ },
46
+ }),
47
+ CqrsModule.forRoot(),
48
+ GraphQLModule.forRoot<ApolloDriverConfig>({
49
+ driver: ApolloDriver,
50
+ autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
51
+ sortSchema: true,
52
+ playground: false,
53
+ introspection: true,
54
+ csrfPrevention: false,
55
+ plugins: [ApolloServerPluginLandingPageLocalDefault()],
56
+ }),
57
+ ],
58
+ })
59
+ export class AppModule {
60
+ private readonly logger = new Logger(AppModule.name);
61
+
62
+ constructor() {
63
+ this.logger.log('✅ Application module initialized');
64
+ }
65
+ }
@@ -0,0 +1,46 @@
1
+ <%
2
+ const moduleName = pascalCase(flowName) + 'Module';
3
+ const entityName = pascalCase(flowName) + 'Entity';
4
+ %>import { Module } from '@nestjs/common';
5
+ import { CqrsModule } from '@nestjs/cqrs';
6
+ import { MikroOrmModule } from '@mikro-orm/nestjs';
7
+ import { <%= entityName %> } from './entities/<%= toKebabCase(entityName) %>.entity';
8
+ <% for (const slice of slices) { -%>
9
+ <% if (slice.type === 'command') { -%>
10
+ import { <%= pascalCase(slice.name) %>Handler } from './<%= toKebabCase(slice.name) %>/<%= toKebabCase(slice.name) %>.handler';
11
+ import { <%= pascalCase(slice.name) %>Resolver } from './<%= toKebabCase(slice.name) %>/<%= toKebabCase(slice.name) %>.resolver';
12
+ <% } else if (slice.type === 'query') { -%>
13
+ import { <%= pascalCase(slice.name) %>Handler } from './<%= toKebabCase(slice.name) %>/<%= toKebabCase(slice.name) %>.handler';
14
+ import { <%= pascalCase(slice.name) %>Resolver } from './<%= toKebabCase(slice.name) %>/<%= toKebabCase(slice.name) %>.resolver';
15
+ <% } -%>
16
+ <% } -%>
17
+
18
+ const CommandHandlers = [
19
+ <% for (const slice of slices) { -%>
20
+ <% if (slice.type === 'command') { -%>
21
+ <%= pascalCase(slice.name) %>Handler,
22
+ <% } -%>
23
+ <% } -%>
24
+ ];
25
+
26
+ const QueryHandlers = [
27
+ <% for (const slice of slices) { -%>
28
+ <% if (slice.type === 'query') { -%>
29
+ <%= pascalCase(slice.name) %>Handler,
30
+ <% } -%>
31
+ <% } -%>
32
+ ];
33
+
34
+ const Resolvers = [
35
+ <% for (const slice of slices) { -%>
36
+ <% if (slice.type === 'command' || slice.type === 'query') { -%>
37
+ <%= pascalCase(slice.name) %>Resolver,
38
+ <% } -%>
39
+ <% } -%>
40
+ ];
41
+
42
+ @Module({
43
+ imports: [CqrsModule, MikroOrmModule.forFeature([<%= entityName %>])],
44
+ providers: [...CommandHandlers, ...QueryHandlers, ...Resolvers],
45
+ })
46
+ export class <%= moduleName %> {}
@@ -0,0 +1,25 @@
1
+ <%
2
+ const entityName = pascalCase(flowName) + 'Entity';
3
+ const typeName = projectionType || pascalCase(sliceName) + 'State';
4
+ const isSingleton = projectionSingleton === true;
5
+ %>import { QueryHandler, IQueryHandler } from '@nestjs/cqrs';
6
+ import { InjectRepository } from '@mikro-orm/nestjs';
7
+ import { EntityRepository } from '@mikro-orm/core';
8
+ import { <%= pascalCase(sliceName) %>Query } from './<%= toKebabCase(sliceName) %>.query';
9
+ import { <%= entityName %> } from '../entities/<%= toKebabCase(entityName) %>.entity';
10
+
11
+ @QueryHandler(<%= pascalCase(sliceName) %>Query)
12
+ export class <%= pascalCase(sliceName) %>Handler implements IQueryHandler<<%= pascalCase(sliceName) %>Query> {
13
+ constructor(
14
+ @InjectRepository(<%= entityName %>)
15
+ private readonly repository: EntityRepository<<%= entityName %>>,
16
+ ) {}
17
+
18
+ async execute(): Promise<<%= entityName %><%= isSingleton ? ' | null' : '[]' %>> {
19
+ <% if (isSingleton) { -%>
20
+ return this.repository.findOne({});
21
+ <% } else { -%>
22
+ return this.repository.findAll();
23
+ <% } -%>
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ export class <%= pascalCase(sliceName) %>Query {}
@@ -0,0 +1,20 @@
1
+ <%
2
+ const typeName = projectionType || pascalCase(sliceName) + 'State';
3
+ const queryName = camelCase(projectionName || sliceName);
4
+ const isSingleton = projectionSingleton === true;
5
+ %>import { Query, Resolver } from '@nestjs/graphql';
6
+ import { Injectable } from '@nestjs/common';
7
+ import { QueryBus } from '@nestjs/cqrs';
8
+ import { <%= pascalCase(sliceName) %>Query } from './<%= toKebabCase(sliceName) %>.query';
9
+ import { <%= typeName %> } from './<%= toKebabCase(sliceName) %>.type';
10
+
11
+ @Injectable()
12
+ @Resolver()
13
+ export class <%= pascalCase(sliceName) %>Resolver {
14
+ constructor(private readonly queryBus: QueryBus) {}
15
+
16
+ @Query(() => <%= isSingleton ? typeName : `[${typeName}]` %>)
17
+ async <%= queryName %>(): Promise<<%= typeName %><%= isSingleton ? ' | null' : '[]' %>> {
18
+ return this.queryBus.execute(new <%= pascalCase(sliceName) %>Query());
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ <%
2
+ const state = states[0] || message;
3
+ if (!state || !state.fields) return '';
4
+ const usesID = state.fields.some(f => graphqlType(f.tsType) === 'ID');
5
+ const usesFloat = state.fields.some(f => fieldUsesFloat(f.tsType));
6
+ const usesJSON = state.fields.some(f => fieldUsesJSON(f.tsType));
7
+ const enumList = collectEnumNames(state.fields);
8
+ const typeName = projectionType || pascalCase(sliceName) + 'State';
9
+ %>import { ObjectType, Field<% if (usesID) { %>, ID<% } %><% if (usesFloat) { %>, Float<% } %> } from '@nestjs/graphql';
10
+ <% if (usesJSON) { -%>
11
+ import GraphQLJSON from 'graphql-type-json';
12
+ <% } -%>
13
+ <% if (enumList.length > 0) { -%>
14
+ import { <%= enumList.join(', ') %> } from '../entities';
15
+ <% } -%>
16
+
17
+ @ObjectType()
18
+ export class <%= typeName %> {
19
+ <% for (const field of state.fields) { -%>
20
+ @Field(() => <%= graphqlType(field.tsType) %><%= isNullable(field.tsType) ? ', { nullable: true }' : '' %>)
21
+ <%= field.name %><%= isNullable(field.tsType) ? '?' : '!' %>: <%= toTsFieldType(field.tsType) %><%= isNullable(field.tsType) ? ' | null' : '' %>;
22
+
23
+ <% } -%>
24
+ }
@@ -0,0 +1,37 @@
1
+ import { CommandExample, EventExample, StateExample } from '@auto-engineer/narrative';
2
+ export interface Message {
3
+ type: string;
4
+ fields: Field[];
5
+ source?: 'when' | 'given' | 'then';
6
+ sourceFlowName?: string;
7
+ sourceSliceName?: string;
8
+ }
9
+ export interface Field {
10
+ name: string;
11
+ tsType: string;
12
+ required: boolean;
13
+ }
14
+ export interface MessageDefinition {
15
+ type: 'command' | 'event' | 'state';
16
+ name: string;
17
+ fields?: Array<{
18
+ name: string;
19
+ type: string;
20
+ required?: boolean;
21
+ description?: string;
22
+ defaultValue?: unknown;
23
+ }>;
24
+ metadata?: unknown;
25
+ description?: string;
26
+ }
27
+ export interface GwtCondition {
28
+ given?: Array<EventExample | StateExample>;
29
+ when: CommandExample | EventExample[];
30
+ then: Array<EventExample | StateExample | CommandExample | {
31
+ errorType: string;
32
+ message?: string;
33
+ }>;
34
+ description?: string;
35
+ ruleDescription?: string;
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/codegen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtF,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC;IAC3C,IAAI,EAAE,cAAc,GAAG,YAAY,EAAE,CAAC;IACtC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/codegen/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare function toKebabCase(str: string): string;
2
+ export declare function ensureDirPath(...segments: string[]): string;
3
+ export declare function ensureDirExists(dirPath: string): Promise<void>;
4
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/codegen/utils/path.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpE"}
@@ -0,0 +1,18 @@
1
+ import path from 'path';
2
+ import { mkdir } from 'fs/promises';
3
+ import { existsSync } from 'fs';
4
+ export function toKebabCase(str) {
5
+ return str
6
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
7
+ .replace(/\s+/g, '-')
8
+ .toLowerCase();
9
+ }
10
+ export function ensureDirPath(...segments) {
11
+ return path.join(...segments);
12
+ }
13
+ export async function ensureDirExists(dirPath) {
14
+ if (!existsSync(dirPath)) {
15
+ await mkdir(dirPath, { recursive: true });
16
+ }
17
+ }
18
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../src/codegen/utils/path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,WAAW,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAG,QAAkB;IACjD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Command, Event } from '@auto-engineer/message-bus';
2
+ export type GenerateServerCommand = Command<'GenerateServer', {
3
+ modelPath: string;
4
+ destination: string;
5
+ }>;
6
+ export type ServerGeneratedEvent = Event<'ServerGenerated', {
7
+ modelPath: string;
8
+ destination: string;
9
+ serverDir: string;
10
+ contextSchemaGraphQL?: string;
11
+ }>;
12
+ export type ServerGenerationFailedEvent = Event<'ServerGenerationFailed', {
13
+ modelPath: string;
14
+ destination: string;
15
+ error: string;
16
+ }>;
17
+ export type SliceGeneratedEvent = Event<'SliceGenerated', {
18
+ flowName: string;
19
+ sliceName: string;
20
+ sliceType: string;
21
+ schemaPath: string;
22
+ slicePath: string;
23
+ }>;
24
+ export type GenerateServerEvents = ServerGeneratedEvent | ServerGenerationFailedEvent | SliceGeneratedEvent;
25
+ export declare const commandHandler: import("@auto-engineer/message-bus").CommandHandler;
26
+ export declare function handleGenerateServerCommandInternal(command: GenerateServerCommand): Promise<GenerateServerEvents[]>;
27
+ export default commandHandler;
28
+ //# sourceMappingURL=generate-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-server.d.ts","sourceRoot":"","sources":["../../../src/commands/generate-server.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAWlF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,gBAAgB,EAChB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CACF,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,KAAK,CAC7C,wBAAwB,EACxB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CACrC,gBAAgB,EAChB;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG,2BAA2B,GAAG,mBAAmB,CAAC;AAE5G,eAAO,MAAM,cAAc,qDA+BzB,CAAC;AAwKH,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA2EjC;AAoND,eAAe,cAAc,CAAC"}