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

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/CHANGELOG.md +7 -0
  2. package/package.json +3 -3
  3. package/.turbo/turbo-build.log +0 -5
  4. package/.turbo/turbo-format.log +0 -4
  5. package/.turbo/turbo-lint.log +0 -4
  6. package/.turbo/turbo-test.log +0 -13
  7. package/.turbo/turbo-type-check.log +0 -4
  8. package/dist/src/codegen/entity-consolidation.d.ts +0 -19
  9. package/dist/src/codegen/entity-consolidation.d.ts.map +0 -1
  10. package/dist/src/codegen/entity-consolidation.js +0 -134
  11. package/dist/src/codegen/entity-consolidation.js.map +0 -1
  12. package/dist/src/codegen/extract/commands.d.ts +0 -25
  13. package/dist/src/codegen/extract/commands.d.ts.map +0 -1
  14. package/dist/src/codegen/extract/commands.js +0 -67
  15. package/dist/src/codegen/extract/commands.js.map +0 -1
  16. package/dist/src/codegen/extract/data-sink.d.ts +0 -6
  17. package/dist/src/codegen/extract/data-sink.d.ts.map +0 -1
  18. package/dist/src/codegen/extract/data-sink.js +0 -90
  19. package/dist/src/codegen/extract/data-sink.js.map +0 -1
  20. package/dist/src/codegen/extract/events.d.ts +0 -10
  21. package/dist/src/codegen/extract/events.d.ts.map +0 -1
  22. package/dist/src/codegen/extract/events.js +0 -42
  23. package/dist/src/codegen/extract/events.js.map +0 -1
  24. package/dist/src/codegen/extract/fields.d.ts +0 -3
  25. package/dist/src/codegen/extract/fields.d.ts.map +0 -1
  26. package/dist/src/codegen/extract/fields.js +0 -9
  27. package/dist/src/codegen/extract/fields.js.map +0 -1
  28. package/dist/src/codegen/extract/graphql.d.ts +0 -14
  29. package/dist/src/codegen/extract/graphql.d.ts.map +0 -1
  30. package/dist/src/codegen/extract/graphql.js +0 -81
  31. package/dist/src/codegen/extract/graphql.js.map +0 -1
  32. package/dist/src/codegen/extract/gwt.d.ts +0 -6
  33. package/dist/src/codegen/extract/gwt.d.ts.map +0 -1
  34. package/dist/src/codegen/extract/gwt.js +0 -79
  35. package/dist/src/codegen/extract/gwt.js.map +0 -1
  36. package/dist/src/codegen/extract/imports.d.ts +0 -29
  37. package/dist/src/codegen/extract/imports.d.ts.map +0 -1
  38. package/dist/src/codegen/extract/imports.js +0 -55
  39. package/dist/src/codegen/extract/imports.js.map +0 -1
  40. package/dist/src/codegen/extract/index.d.ts +0 -10
  41. package/dist/src/codegen/extract/index.d.ts.map +0 -1
  42. package/dist/src/codegen/extract/index.js +0 -10
  43. package/dist/src/codegen/extract/index.js.map +0 -1
  44. package/dist/src/codegen/extract/messages.d.ts +0 -16
  45. package/dist/src/codegen/extract/messages.d.ts.map +0 -1
  46. package/dist/src/codegen/extract/messages.js +0 -192
  47. package/dist/src/codegen/extract/messages.js.map +0 -1
  48. package/dist/src/codegen/extract/projection.d.ts +0 -5
  49. package/dist/src/codegen/extract/projection.d.ts.map +0 -1
  50. package/dist/src/codegen/extract/projection.js +0 -44
  51. package/dist/src/codegen/extract/projection.js.map +0 -1
  52. package/dist/src/codegen/extract/query.d.ts +0 -13
  53. package/dist/src/codegen/extract/query.d.ts.map +0 -1
  54. package/dist/src/codegen/extract/query.js +0 -18
  55. package/dist/src/codegen/extract/query.js.map +0 -1
  56. package/dist/src/codegen/extract/states.d.ts +0 -5
  57. package/dist/src/codegen/extract/states.d.ts.map +0 -1
  58. package/dist/src/codegen/extract/states.js +0 -48
  59. package/dist/src/codegen/extract/states.js.map +0 -1
  60. package/dist/src/codegen/extract/type-helpers.d.ts +0 -13
  61. package/dist/src/codegen/extract/type-helpers.d.ts.map +0 -1
  62. package/dist/src/codegen/extract/type-helpers.js +0 -98
  63. package/dist/src/codegen/extract/type-helpers.js.map +0 -1
  64. package/dist/src/codegen/scaffoldFromSchema.d.ts +0 -9
  65. package/dist/src/codegen/scaffoldFromSchema.d.ts.map +0 -1
  66. package/dist/src/codegen/scaffoldFromSchema.js +0 -391
  67. package/dist/src/codegen/scaffoldFromSchema.js.map +0 -1
  68. package/dist/src/codegen/templates/command/command.ts.ejs +0 -16
  69. package/dist/src/codegen/templates/command/handler.specs.ts.ejs +0 -50
  70. package/dist/src/codegen/templates/command/handler.ts.ejs +0 -30
  71. package/dist/src/codegen/templates/command/input.ts.ejs +0 -23
  72. package/dist/src/codegen/templates/command/resolver.ts.ejs +0 -56
  73. package/dist/src/codegen/templates/entity/entity.ts.ejs +0 -35
  74. package/dist/src/codegen/templates/entity/index.ts.ejs +0 -6
  75. package/dist/src/codegen/templates/module/app-module.ts.ejs +0 -65
  76. package/dist/src/codegen/templates/module/domain-module.ts.ejs +0 -46
  77. package/dist/src/codegen/templates/query/handler.ts.ejs +0 -25
  78. package/dist/src/codegen/templates/query/query.ts.ejs +0 -1
  79. package/dist/src/codegen/templates/query/resolver.ts.ejs +0 -20
  80. package/dist/src/codegen/templates/query/type.ts.ejs +0 -24
  81. package/dist/src/codegen/types.d.ts +0 -37
  82. package/dist/src/codegen/types.d.ts.map +0 -1
  83. package/dist/src/codegen/types.js +0 -2
  84. package/dist/src/codegen/types.js.map +0 -1
  85. package/dist/src/codegen/utils/path.d.ts +0 -4
  86. package/dist/src/codegen/utils/path.d.ts.map +0 -1
  87. package/dist/src/codegen/utils/path.js +0 -18
  88. package/dist/src/codegen/utils/path.js.map +0 -1
  89. package/dist/src/commands/generate-server.d.ts +0 -28
  90. package/dist/src/commands/generate-server.d.ts.map +0 -1
  91. package/dist/src/commands/generate-server.js +0 -422
  92. package/dist/src/commands/generate-server.js.map +0 -1
  93. package/dist/src/index.d.ts +0 -3
  94. package/dist/src/index.d.ts.map +0 -1
  95. package/dist/src/index.js +0 -3
  96. package/dist/src/index.js.map +0 -1
  97. package/dist/src/shared/graphql-types.ts +0 -19
  98. package/dist/src/shared/main.ts +0 -27
  99. package/dist/src/shared/mikro-orm.config.ts +0 -18
  100. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,50 +0,0 @@
1
- <%
2
- const command = commands[0];
3
- if (!command) return '';
4
- const entityName = pascalCase(flowName) + 'Entity';
5
- const enumList = collectEnumNames(command.fields);
6
- %>import { describe, it, expect, beforeEach, vi } from 'vitest';
7
- import { Test, TestingModule } from '@nestjs/testing';
8
- import { getRepositoryToken } from '@mikro-orm/nestjs';
9
- import { <%= pascalCase(command.type) %>Handler } from './<%= toKebabCase(sliceName) %>.handler';
10
- import { <%= pascalCase(command.type) %>Command } from './<%= toKebabCase(sliceName) %>.command';
11
- import { <%= entityName %><% if (enumList.length > 0) { %>, <%= enumList.join(', ') %><% } %> } from '../entities';
12
-
13
- describe('<%= pascalCase(command.type) %>Handler', () => {
14
- let handler: <%= pascalCase(command.type) %>Handler;
15
- let mockRepository: Record<string, unknown>;
16
-
17
- beforeEach(async () => {
18
- mockRepository = {
19
- create: vi.fn(),
20
- findOne: vi.fn(),
21
- getEntityManager: vi.fn(() => ({
22
- persistAndFlush: vi.fn(),
23
- })),
24
- };
25
-
26
- const module: TestingModule = await Test.createTestingModule({
27
- providers: [
28
- <%= pascalCase(command.type) %>Handler,
29
- {
30
- provide: getRepositoryToken(<%= entityName %>),
31
- useValue: mockRepository,
32
- },
33
- ],
34
- }).compile();
35
-
36
- handler = module.get<<%= pascalCase(command.type) %>Handler>(<%= pascalCase(command.type) %>Handler);
37
- });
38
-
39
- it('should be defined', () => {
40
- expect(handler).toBeDefined();
41
- });
42
-
43
- // TODO: Add test cases based on GWT specs
44
- // Example:
45
- // it('should handle <%= command.type %>', async () => {
46
- // const command = new <%= pascalCase(command.type) %>Command(...);
47
- // await handler.execute(command);
48
- // expect(mockRepository.create).toHaveBeenCalled();
49
- // });
50
- });
@@ -1,30 +0,0 @@
1
- <%
2
- const command = commands[0];
3
- if (!command) return '';
4
- const entityName = pascalCase(flowName) + 'Entity';
5
- const enumList = collectEnumNames(command.fields);
6
- %>import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
7
- import { InjectRepository } from '@mikro-orm/nestjs';
8
- import { EntityRepository } from '@mikro-orm/core';
9
- import { <%= pascalCase(command.type) %>Command } from './<%= toKebabCase(sliceName) %>.command';
10
- import { <%= entityName %><% if (enumList.length > 0) { %>, <%= enumList.join(', ') %><% } %> } from '../entities';
11
-
12
- @CommandHandler(<%= pascalCase(command.type) %>Command)
13
- export class <%= pascalCase(command.type) %>Handler implements ICommandHandler<<%= pascalCase(command.type) %>Command> {
14
- constructor(
15
- @InjectRepository(<%= entityName %>)
16
- private readonly repository: EntityRepository<<%= entityName %>>,
17
- ) {}
18
-
19
- async execute(command: <%= pascalCase(command.type) %>Command): Promise<void> {
20
- // TODO: Implement command handler logic
21
- // This is a generated stub - implement based on your business rules
22
- // Example for create operation:
23
- // const entity = this.repository.create({
24
- // ...command fields...
25
- // });
26
- // await this.repository.getEntityManager().persistAndFlush(entity);
27
-
28
- throw new Error('Not yet implemented: <%= command.type %>');
29
- }
30
- }
@@ -1,23 +0,0 @@
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
- }
@@ -1,56 +0,0 @@
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
- }
@@ -1,35 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
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
- <% } -%>
@@ -1,65 +0,0 @@
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
- }
@@ -1,46 +0,0 @@
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 %> {}
@@ -1,25 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export class <%= pascalCase(sliceName) %>Query {}
@@ -1,20 +0,0 @@
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
- }
@@ -1,24 +0,0 @@
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
- }
@@ -1,37 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/codegen/types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,18 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,28 +0,0 @@
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
@@ -1 +0,0 @@
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"}