create-auto-app 1.40.0 → 1.42.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/package.json +2 -2
- package/templates/typical/.gitignore +1 -1
- package/templates/typical/auto.config.ts +14 -12
- package/templates/typical/server/event-store.sqlite +0 -0
- package/templates/typical/server/package.json +0 -30
- package/templates/typical/server/pnpm-lock.yaml +0 -3869
- package/templates/typical/server/scripts/generate-schema.ts +0 -31
- package/templates/typical/server/src/domain/flows/health/query.resolver.ts +0 -10
- package/templates/typical/server/src/domain/shared/index.ts +0 -1
- package/templates/typical/server/src/domain/shared/types.ts +0 -8
- package/templates/typical/server/src/server.ts +0 -34
- package/templates/typical/server/src/utils/index.ts +0 -1
- package/templates/typical/server/src/utils/loadResolvers.ts +0 -34
- package/templates/typical/server/tsconfig.json +0 -20
- package/templates/typical/server/vitest.config.ts +0 -7
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { buildSchema } from 'type-graphql';
|
|
3
|
-
import { printSchema } from 'graphql';
|
|
4
|
-
import { writeFile } from 'fs/promises';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import { loadResolvers } from '../src/utils/loadResolvers.js';
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
try {
|
|
10
|
-
const resolvers = await loadResolvers('src/domain/flows/**/*.resolver.{ts,js}');
|
|
11
|
-
const schema = await buildSchema({
|
|
12
|
-
resolvers: resolvers as any,
|
|
13
|
-
emitSchemaFile: false,
|
|
14
|
-
});
|
|
15
|
-
const printedSchema = printSchema(schema);
|
|
16
|
-
|
|
17
|
-
const contextDir = path.resolve('/Users/sam/code/auto/1/auto-engineer-1/examples/typical', '.context');
|
|
18
|
-
const schemaPath = path.join(contextDir, 'schema.graphql');
|
|
19
|
-
await writeFile(schemaPath, printedSchema, 'utf-8');
|
|
20
|
-
|
|
21
|
-
console.log(`✅ GraphQL schema generated at: ${schemaPath}`);
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error(`❌ GraphQL schema generation failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
main().catch((err) => {
|
|
29
|
-
console.error(err);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { getInMemoryDatabase, getInMemoryMessageBus } from '@event-driven-io/emmett';
|
|
3
|
-
import { getSQLiteEventStore } from '@event-driven-io/emmett-sqlite';
|
|
4
|
-
import { ApolloServer } from 'apollo-server';
|
|
5
|
-
import { buildSchema } from 'type-graphql';
|
|
6
|
-
import { loadResolvers } from './utils';
|
|
7
|
-
|
|
8
|
-
async function start() {
|
|
9
|
-
const messageBus = getInMemoryMessageBus();
|
|
10
|
-
const database = getInMemoryDatabase();
|
|
11
|
-
|
|
12
|
-
const eventStore = getSQLiteEventStore({
|
|
13
|
-
fileName: './event-store.sqlite',
|
|
14
|
-
schema: { autoMigration: 'CreateOrUpdate' },
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const resolvers = await loadResolvers('src/domain/flows/**/*.resolver.{ts,js}');
|
|
18
|
-
type ResolverClass = new (...args: unknown[]) => unknown;
|
|
19
|
-
const schema = await buildSchema({
|
|
20
|
-
resolvers: resolvers as unknown as [ResolverClass, ...ResolverClass[]],
|
|
21
|
-
});
|
|
22
|
-
const server = new ApolloServer({
|
|
23
|
-
schema,
|
|
24
|
-
context: () => ({
|
|
25
|
-
eventStore,
|
|
26
|
-
messageBus,
|
|
27
|
-
database,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
const { url } = await server.listen({ port: 4000 });
|
|
31
|
-
console.log(`🚀 GraphQL server ready at ${url}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
void start();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './loadResolvers';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fg from 'fast-glob';
|
|
2
|
-
|
|
3
|
-
export type Resolver = (...args: unknown[]) => unknown;
|
|
4
|
-
|
|
5
|
-
export async function loadResolvers(source: string): Promise<Resolver[]> {
|
|
6
|
-
const files = await fg(source, {
|
|
7
|
-
absolute: true,
|
|
8
|
-
});
|
|
9
|
-
const modules: unknown[] = await Promise.all(files.map((file) => import(file)));
|
|
10
|
-
const allResolvers: Resolver[] = [];
|
|
11
|
-
|
|
12
|
-
for (const mod of modules) {
|
|
13
|
-
if (typeof mod !== 'object' || mod === null) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
for (const key of Object.keys(mod)) {
|
|
18
|
-
const exported = (mod as Record<string, unknown>)[key];
|
|
19
|
-
|
|
20
|
-
if (typeof exported === 'function') {
|
|
21
|
-
allResolvers.push(exported as Resolver);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (Array.isArray(exported) && exported.every((r) => typeof r === 'function')) {
|
|
25
|
-
allResolvers.push(...(exported as Resolver[]));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (allResolvers.length === 0) {
|
|
31
|
-
throw new Error('❌ No resolvers found for any slices.');
|
|
32
|
-
}
|
|
33
|
-
return allResolvers;
|
|
34
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"emitDecoratorMetadata": true,
|
|
10
|
-
"experimentalDecorators": true
|
|
11
|
-
},
|
|
12
|
-
"include": [
|
|
13
|
-
"src/**/*",
|
|
14
|
-
"vitest.config.ts"
|
|
15
|
-
],
|
|
16
|
-
"exclude": [
|
|
17
|
-
"dist",
|
|
18
|
-
"node_modules"
|
|
19
|
-
]
|
|
20
|
-
}
|