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.
@@ -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,16 +0,0 @@
1
- type User {
2
- id: ID!
3
- email: String!
4
- lastName: String!
5
- profile: String
6
- givenName: String
7
- }
8
-
9
- input UserWhereUniqueInput {
10
- id: ID!
11
- }
12
-
13
- type Query {
14
- user(where: UserWhereUniqueInput!): User
15
- users: [User!]
16
- }
@@ -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,9 +0,0 @@
1
- type UserPhoto {
2
- id: ID!
3
- userId: ID!
4
- url: String!
5
- }
6
-
7
- extend type User {
8
- photos: [UserPhoto!]
9
- }
@@ -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
- });
@@ -1,6 +0,0 @@
1
- export type Context = {
2
- appVersion: string;
3
- };
4
-
5
- // biome-ignore lint/complexity/noBannedTypes: Empty context
6
- export type ServerContext = {};