@auto-engineer/server-generator-nestjs 0.19.0 → 0.20.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.
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-test.log +13 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/CHANGELOG.md +7 -0
- package/dist/src/codegen/entity-consolidation.d.ts +19 -0
- package/dist/src/codegen/entity-consolidation.d.ts.map +1 -0
- package/dist/src/codegen/entity-consolidation.js +134 -0
- package/dist/src/codegen/entity-consolidation.js.map +1 -0
- package/dist/src/codegen/extract/commands.d.ts +25 -0
- package/dist/src/codegen/extract/commands.d.ts.map +1 -0
- package/dist/src/codegen/extract/commands.js +67 -0
- package/dist/src/codegen/extract/commands.js.map +1 -0
- package/dist/src/codegen/extract/data-sink.d.ts +6 -0
- package/dist/src/codegen/extract/data-sink.d.ts.map +1 -0
- package/dist/src/codegen/extract/data-sink.js +78 -0
- package/dist/src/codegen/extract/data-sink.js.map +1 -0
- package/dist/src/codegen/extract/events.d.ts +10 -0
- package/dist/src/codegen/extract/events.d.ts.map +1 -0
- package/dist/src/codegen/extract/events.js +42 -0
- package/dist/src/codegen/extract/events.js.map +1 -0
- package/dist/src/codegen/extract/fields.d.ts +3 -0
- package/dist/src/codegen/extract/fields.d.ts.map +1 -0
- package/dist/src/codegen/extract/fields.js +9 -0
- package/dist/src/codegen/extract/fields.js.map +1 -0
- package/dist/src/codegen/extract/graphql.d.ts +14 -0
- package/dist/src/codegen/extract/graphql.d.ts.map +1 -0
- package/dist/src/codegen/extract/graphql.js +81 -0
- package/dist/src/codegen/extract/graphql.js.map +1 -0
- package/dist/src/codegen/extract/gwt.d.ts +6 -0
- package/dist/src/codegen/extract/gwt.d.ts.map +1 -0
- package/dist/src/codegen/extract/gwt.js +64 -0
- package/dist/src/codegen/extract/gwt.js.map +1 -0
- package/dist/src/codegen/extract/imports.d.ts +29 -0
- package/dist/src/codegen/extract/imports.d.ts.map +1 -0
- package/dist/src/codegen/extract/imports.js +55 -0
- package/dist/src/codegen/extract/imports.js.map +1 -0
- package/dist/src/codegen/extract/index.d.ts +10 -0
- package/dist/src/codegen/extract/index.d.ts.map +1 -0
- package/dist/src/codegen/extract/index.js +10 -0
- package/dist/src/codegen/extract/index.js.map +1 -0
- package/dist/src/codegen/extract/messages.d.ts +17 -0
- package/dist/src/codegen/extract/messages.d.ts.map +1 -0
- package/dist/src/codegen/extract/messages.js +172 -0
- package/dist/src/codegen/extract/messages.js.map +1 -0
- package/dist/src/codegen/extract/projection.d.ts +5 -0
- package/dist/src/codegen/extract/projection.d.ts.map +1 -0
- package/dist/src/codegen/extract/projection.js +44 -0
- package/dist/src/codegen/extract/projection.js.map +1 -0
- package/dist/src/codegen/extract/query.d.ts +14 -0
- package/dist/src/codegen/extract/query.d.ts.map +1 -0
- package/dist/src/codegen/extract/query.js +17 -0
- package/dist/src/codegen/extract/query.js.map +1 -0
- package/dist/src/codegen/extract/states.d.ts +5 -0
- package/dist/src/codegen/extract/states.d.ts.map +1 -0
- package/dist/src/codegen/extract/states.js +48 -0
- package/dist/src/codegen/extract/states.js.map +1 -0
- package/dist/src/codegen/extract/step-converter.d.ts +17 -0
- package/dist/src/codegen/extract/step-converter.d.ts.map +1 -0
- package/dist/src/codegen/extract/step-converter.js +82 -0
- package/dist/src/codegen/extract/step-converter.js.map +1 -0
- package/dist/src/codegen/extract/step-types.d.ts +29 -0
- package/dist/src/codegen/extract/step-types.d.ts.map +1 -0
- package/dist/src/codegen/extract/step-types.js +16 -0
- package/dist/src/codegen/extract/step-types.js.map +1 -0
- package/dist/src/codegen/extract/type-helpers.d.ts +13 -0
- package/dist/src/codegen/extract/type-helpers.d.ts.map +1 -0
- package/dist/src/codegen/extract/type-helpers.js +98 -0
- package/dist/src/codegen/extract/type-helpers.js.map +1 -0
- package/dist/src/codegen/scaffoldFromSchema.d.ts +9 -0
- package/dist/src/codegen/scaffoldFromSchema.d.ts.map +1 -0
- package/dist/src/codegen/scaffoldFromSchema.js +389 -0
- package/dist/src/codegen/scaffoldFromSchema.js.map +1 -0
- package/dist/src/codegen/templates/command/command.ts.ejs +16 -0
- package/dist/src/codegen/templates/command/handler.specs.ts.ejs +50 -0
- package/dist/src/codegen/templates/command/handler.ts.ejs +30 -0
- package/dist/src/codegen/templates/command/input.ts.ejs +23 -0
- package/dist/src/codegen/templates/command/resolver.ts.ejs +56 -0
- package/dist/src/codegen/templates/entity/entity.ts.ejs +35 -0
- package/dist/src/codegen/templates/entity/index.ts.ejs +6 -0
- package/dist/src/codegen/templates/module/app-module.ts.ejs +65 -0
- package/dist/src/codegen/templates/module/domain-module.ts.ejs +46 -0
- package/dist/src/codegen/templates/query/handler.ts.ejs +25 -0
- package/dist/src/codegen/templates/query/query.ts.ejs +1 -0
- package/dist/src/codegen/templates/query/resolver.ts.ejs +20 -0
- package/dist/src/codegen/templates/query/type.ts.ejs +24 -0
- package/dist/src/codegen/types.d.ts +38 -0
- package/dist/src/codegen/types.d.ts.map +1 -0
- package/dist/src/codegen/types.js +2 -0
- package/dist/src/codegen/types.js.map +1 -0
- package/dist/src/codegen/utils/path.d.ts +4 -0
- package/dist/src/codegen/utils/path.d.ts.map +1 -0
- package/dist/src/codegen/utils/path.js +18 -0
- package/dist/src/codegen/utils/path.js.map +1 -0
- package/dist/src/commands/generate-server.d.ts +28 -0
- package/dist/src/commands/generate-server.d.ts.map +1 -0
- package/dist/src/commands/generate-server.js +421 -0
- package/dist/src/commands/generate-server.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/shared/graphql-types.ts +19 -0
- package/dist/src/shared/main.ts +27 -0
- package/dist/src/shared/mikro-orm.config.ts +18 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -3
|
@@ -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,38 @@
|
|
|
1
|
+
import type { CommandExample, ErrorRef, EventExample, StateExample } from './extract/step-types';
|
|
2
|
+
export type { CommandExample, ErrorRef, EventExample, StateExample };
|
|
3
|
+
export interface Message {
|
|
4
|
+
type: string;
|
|
5
|
+
fields: Field[];
|
|
6
|
+
source?: 'when' | 'given' | 'then';
|
|
7
|
+
sourceFlowName?: string;
|
|
8
|
+
sourceSliceName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Field {
|
|
11
|
+
name: string;
|
|
12
|
+
tsType: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface MessageDefinition {
|
|
16
|
+
type: 'command' | 'event' | 'state';
|
|
17
|
+
name: string;
|
|
18
|
+
fields?: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
description?: string;
|
|
23
|
+
defaultValue?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
metadata?: unknown;
|
|
26
|
+
description?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GwtCondition {
|
|
29
|
+
given?: Array<EventExample | StateExample>;
|
|
30
|
+
when: CommandExample | EventExample[];
|
|
31
|
+
then: Array<EventExample | StateExample | CommandExample | {
|
|
32
|
+
errorType: string;
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
35
|
+
description?: string;
|
|
36
|
+
ruleDescription?: string;
|
|
37
|
+
}
|
|
38
|
+
//# 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,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEjG,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAErE,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 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/codegen/types.ts"],"names":[],"mappings":""}
|
|
@@ -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 { existsSync } from 'fs';
|
|
2
|
+
import { mkdir } from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
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,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,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 { type Command, type 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":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAsB5F,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"}
|