create-baeta 1.0.9 → 2.0.0-next.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/dist/chunk-MRF3CANS.js +913 -0
- package/dist/chunk-MRF3CANS.js.map +1 -0
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.js +5 -9
- package/package.json +20 -29
- package/templates/apollo.ts +43 -0
- package/templates/shared.ts +386 -0
- package/templates/yoga.ts +133 -0
- package/CHANGELOG.md +0 -39
- package/dist/chunk-QGXDOHZ2.js +0 -491
- package/dist/chunk-QGXDOHZ2.js.map +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/index.d.ts +0 -70
- package/templates/apollo/src/app.ts +0 -19
- package/templates/apollo/src/types/context.ts +0 -3
- package/templates/shared/baeta.ts +0 -19
- package/templates/shared/src/lib/extensions.ts +0 -17
- package/templates/shared/src/modules/user/user.gql +0 -16
- package/templates/shared/src/modules/user/user.resolvers.ts +0 -26
- package/templates/shared/src/modules/user-photos/user-photos.gql +0 -9
- package/templates/shared/src/modules/user-photos/user-photos.resolvers.ts +0 -11
- package/templates/yoga/src/app.bun.ts +0 -22
- package/templates/yoga/src/app.deno.ts +0 -25
- package/templates/yoga/src/app.node.ts +0 -22
- package/templates/yoga/src/types/context.ts +0 -6
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createExtensions } from '@baeta/core';
|
|
2
|
-
import { complexityExtension } from '@baeta/extension-complexity';
|
|
3
|
-
import type { Context } from '../types/context.ts';
|
|
4
|
-
|
|
5
|
-
const complexity = complexityExtension<Context>({
|
|
6
|
-
defaultComplexity: 1,
|
|
7
|
-
defaultListMultiplier: 10,
|
|
8
|
-
async limit(ctx) {
|
|
9
|
-
return {
|
|
10
|
-
depth: 10,
|
|
11
|
-
breadth: 50,
|
|
12
|
-
complexity: 1000,
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export default createExtensions(complexity);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getUserModule } from './typedef.ts';
|
|
2
|
-
|
|
3
|
-
const { Query } = getUserModule();
|
|
4
|
-
|
|
5
|
-
Query.user(({ args }) => {
|
|
6
|
-
return {
|
|
7
|
-
id: args.where.id,
|
|
8
|
-
email: 'jon.doe@baeta.io',
|
|
9
|
-
lastName: 'Doe',
|
|
10
|
-
};
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
Query.user.$use(async ({ args }, next) => {
|
|
14
|
-
const result = await next();
|
|
15
|
-
console.log('Got user:', result, 'for args:', args);
|
|
16
|
-
return result;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
Query.users(() => {
|
|
20
|
-
const users = Array.from({ length: 10 }).map((_, i) => ({
|
|
21
|
-
id: i.toString(),
|
|
22
|
-
email: `jon.doe${i}@baeta.io`,
|
|
23
|
-
lastName: `Doe ${i}`,
|
|
24
|
-
}));
|
|
25
|
-
return users;
|
|
26
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getUserPhotosModule } from './typedef.ts';
|
|
2
|
-
|
|
3
|
-
const { User } = getUserPhotosModule();
|
|
4
|
-
|
|
5
|
-
User.photos(({ root }) => {
|
|
6
|
-
return Array.from({ length: 10 }).map((_, i) => ({
|
|
7
|
-
id: `u${root.id}_p${i}`,
|
|
8
|
-
userId: root.id,
|
|
9
|
-
url: `https://baeta.io/user/${root.id}/photo/${i}.png`,
|
|
10
|
-
}));
|
|
11
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createApplication } from '@baeta/core';
|
|
2
|
-
import { createYoga } from 'graphql-yoga';
|
|
3
|
-
import { modules } from './modules/autoload.ts';
|
|
4
|
-
import type { Context, ServerContext } from './types/context.ts';
|
|
5
|
-
|
|
6
|
-
const baeta = createApplication({
|
|
7
|
-
modules,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const yoga = createYoga<ServerContext, Context>({
|
|
11
|
-
schema: baeta.schema,
|
|
12
|
-
context: {
|
|
13
|
-
appVersion: '1.0.0',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
Bun.serve({
|
|
18
|
-
fetch: yoga.fetch,
|
|
19
|
-
port: 4000,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
console.log(`🚀 Server ready at http://localhost:4000${yoga.graphqlEndpoint}`);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createApplication } from '@baeta/core';
|
|
2
|
-
import { createYoga } from 'graphql-yoga';
|
|
3
|
-
import { modules } from './modules/autoload.ts';
|
|
4
|
-
import type { Context, ServerContext } from './types/context.ts';
|
|
5
|
-
|
|
6
|
-
const baeta = createApplication({
|
|
7
|
-
modules,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const yoga = createYoga<ServerContext, Context>({
|
|
11
|
-
schema: baeta.schema,
|
|
12
|
-
context: {
|
|
13
|
-
appVersion: '1.0.0',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
Deno.serve(
|
|
18
|
-
{
|
|
19
|
-
port: 4000,
|
|
20
|
-
onListen() {
|
|
21
|
-
console.log(`🚀 Server ready at http://localhost:4000${yoga.graphqlEndpoint}`);
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
yoga.fetch,
|
|
25
|
-
);
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createServer } from 'node:http';
|
|
2
|
-
import { createApplication } from '@baeta/core';
|
|
3
|
-
import { createYoga } from 'graphql-yoga';
|
|
4
|
-
import { modules } from './modules/autoload.ts';
|
|
5
|
-
import type { Context, ServerContext } from './types/context.ts';
|
|
6
|
-
|
|
7
|
-
const baeta = createApplication({
|
|
8
|
-
modules,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const yoga = createYoga<ServerContext, Context>({
|
|
12
|
-
schema: baeta.schema,
|
|
13
|
-
context: {
|
|
14
|
-
appVersion: '1.0.0',
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const server = createServer(yoga);
|
|
19
|
-
|
|
20
|
-
server.listen(4000, () => {
|
|
21
|
-
console.log(`🚀 Server ready at http://localhost:4000${yoga.graphqlEndpoint}`);
|
|
22
|
-
});
|