diff --git a/README.md b/README.md index ed4e8dc..a909f7c 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,17 @@ The design of GQLoom is inspired by [tRPC](https://trpc.io/), [TypeGraphQL](http ## Features -- 🚀 GraphQL: flexible and efficient, reducing redundant data transfers; -- 🔒 Robust type safety: enjoy intelligent hints at development time to detect potential problems at compile time; -- 🔋 Ready to go: middleware, contexts, subscriptions, federated graphs are ready to go; -- 🔮 No extra magic: no decorators, no metadata and reflection, no code generation, you just need JavaScript/TypeScript; -- 🧩 Familiar schema libraries: use the schema libraries you already know (Zod, Yup, Valibot) to build GraphQL Schema and validate inputs; -- 🧑‍💻 Develop happily: highly readable and semantic APIs designed to keep your code tidy; +* 🚀 GraphQL: flexible and efficient, reducing redundant data transfers; +* 🔒 Robust type safety: enjoy intelligent hints at development time to detect potential problems at compile time; +* 🔋 Ready to go: middleware, contexts, subscriptions, federated graphs are ready to go; +* 🔮 No extra magic: no decorators, no metadata and reflection, no code generation, you just need JavaScript/TypeScript; +* 🧩 Familiar schema libraries: use the schema libraries you already know (Zod, Yup, Valibot) to build GraphQL Schema and validate inputs; +* 🧑‍💻 Develop happily: highly readable and semantic APIs designed to keep your code tidy; ## Hello World ```ts -import { resolver, query, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { resolver, query, weave, ValibotWeaver } from "@gqloom/valibot" import * as v from "valibot" const helloResolver = resolver({ @@ -43,22 +42,26 @@ See [Getting Started](https://gqloom.dev/guide/getting-started.html) to learn ho ## In this Repository -- [GQLoom Core](./packages/core/README.md): GraphQL Loom Core Features; +* [GQLoom Core](./packages/core/README.md): GraphQL Loom Core Features; -- [GQLoom Federation](./packages/federation/README.md): Provides GQLoom support for Apollo Federation; +* [GQLoom Federation](./packages/federation/README.md): Provides GQLoom support for Apollo Federation; -- [GQLoom Mikro ORM](./packages/mikro-orm/README.md): GQLoom integration with Mikro ORM; +* [GQLoom Mikro ORM](./packages/mikro-orm/README.md): GQLoom integration with Mikro ORM; -- [GQLoom Prisma](./packages/prisma/README.md): GQLoom integration with Prisma; +* [GQLoom Prisma](./packages/prisma/README.md): GQLoom integration with Prisma; -- [GQLoom Valibot](./packages/valibot/README.md): GQLoom integration with Valibot; +* [GQLoom Valibot](./packages/valibot/README.md): GQLoom integration with Valibot; -- [GQLoom Yup](./packages/yup/README.md): GQLoom integration with Yup; +* [GQLoom Yup](./packages/yup/README.md): GQLoom integration with Yup; -- [GQLoom Zod](./packages/zod/README.md): GQLoom integration with Zod; +* [GQLoom Zod](./packages/zod/README.md): GQLoom integration with Zod; [license-image]: https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square + [license-url]: https://opensource.org/licenses/MIT + [npm-image]: https://img.shields.io/npm/v/%40gqloom%2Fcore.svg?style=flat-square + [npm-url]: https://www.npmjs.com/package/@gqloom/core + [downloads-image]: https://img.shields.io/npm/dm/%40gqloom%2Fcore.svg?style=flat-square diff --git a/examples/cattery-valibot/src/index.ts b/examples/cattery-valibot/src/index.ts index df67a4c..220af3c 100644 --- a/examples/cattery-valibot/src/index.ts +++ b/examples/cattery-valibot/src/index.ts @@ -1,6 +1,12 @@ import { createServer } from "node:http" -import { field, mutation, query, resolver, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { + ValibotWeaver, + field, + mutation, + query, + resolver, + weave, +} from "@gqloom/valibot" import { createYoga } from "graphql-yoga" import * as v from "valibot" diff --git a/examples/middlewares/src/valibot.ts b/examples/middlewares/src/valibot.ts index dcc71b0..a466b26 100644 --- a/examples/middlewares/src/valibot.ts +++ b/examples/middlewares/src/valibot.ts @@ -1,6 +1,5 @@ import { createServer } from "node:http" -import { query, resolver, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, query, resolver, weave } from "@gqloom/valibot" import { createYoga } from "graphql-yoga" import * as v from "valibot" import { ValibotExceptionFilter, outputValidator } from "./middlewares" diff --git a/examples/prisma/src/index.ts b/examples/prisma/src/index.ts index 3d1d852..55c23af 100644 --- a/examples/prisma/src/index.ts +++ b/examples/prisma/src/index.ts @@ -1,9 +1,8 @@ import * as fs from "fs" import { createServer } from "node:http" import * as path from "path" -import { query, resolver, weave } from "@gqloom/core" import { PrismaModelBobbin } from "@gqloom/prisma" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, query, resolver, weave } from "@gqloom/valibot" import { PrismaClient } from "@prisma/client" import { printSchema } from "graphql" import { createYoga } from "graphql-yoga" diff --git a/examples/subscriptions/src/valibot.ts b/examples/subscriptions/src/valibot.ts index 179c920..8b6c131 100644 --- a/examples/subscriptions/src/valibot.ts +++ b/examples/subscriptions/src/valibot.ts @@ -1,6 +1,11 @@ import { createServer } from "node:http" -import { query, resolver, subscription, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { + ValibotWeaver, + query, + resolver, + subscription, + weave, +} from "@gqloom/valibot" import { createPubSub, createYoga } from "graphql-yoga" import * as v from "valibot" diff --git a/website/docs/en/guide/advanced/subscription.mdx b/website/docs/en/guide/advanced/subscription.mdx index 71c9e17..61d058f 100644 --- a/website/docs/en/guide/advanced/subscription.mdx +++ b/website/docs/en/guide/advanced/subscription.mdx @@ -11,8 +11,7 @@ In `GQLoom`, we use the `subscription` function to define a subscription:. ```ts -import { weave, resolver, subscription } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, subscription } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" diff --git a/website/docs/en/guide/fundamentals/middleware.mdx b/website/docs/en/guide/fundamentals/middleware.mdx index be70e74..3bbfbd2 100644 --- a/website/docs/en/guide/fundamentals/middleware.mdx +++ b/website/docs/en/guide/fundamentals/middleware.mdx @@ -93,8 +93,7 @@ Let's try to use this middleware: ```ts -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" diff --git a/website/docs/en/guide/getting-started.mdx b/website/docs/en/guide/getting-started.mdx index d8b076a..46faac6 100644 --- a/website/docs/en/guide/getting-started.mdx +++ b/website/docs/en/guide/getting-started.mdx @@ -76,8 +76,7 @@ Then, we create an `src/index.ts` file and add the following code: ```ts title="src/index.ts" -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" @@ -274,8 +273,7 @@ Now, let's go back to the beginning with `CatResolver` and add a `query` operati ```ts title="src/index.ts" -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" const CatResolver = resolver({ // [!code hl] diff --git a/website/docs/en/guide/introduction.mdx b/website/docs/en/guide/introduction.mdx index 24d1c94..4edc7e1 100644 --- a/website/docs/en/guide/introduction.mdx +++ b/website/docs/en/guide/introduction.mdx @@ -31,8 +31,7 @@ The design of GQLoom is inspired by [tRPC](https://trpc.io/), [TypeGraphQL](http ```ts -import { resolver, query, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" const HelloResolver = resolver({ diff --git a/website/docs/en/guide/schema-integration/valibot.mdx b/website/docs/en/guide/schema-integration/valibot.mdx index 5c0eb61..6d0ed08 100644 --- a/website/docs/en/guide/schema-integration/valibot.mdx +++ b/website/docs/en/guide/schema-integration/valibot.mdx @@ -31,8 +31,7 @@ const IntScalar = v.pipe(v.nullable(v.number()), v.integer()) // GraphQLInt To ensure that `GQLoom` correctly weaves Valibot schemas into the GraphQL schema, we need to add the `ValibotWeaver` from `@gqloom/valibot` when using the `weave` function. ```ts -import { resolver, query ,weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" export const helloResolver = resolver({ hello: query(v.string(), () => "Hello, World!"), diff --git a/website/docs/zh/guide/advanced/subscription.mdx b/website/docs/zh/guide/advanced/subscription.mdx index 4bbdb89..e9c160a 100644 --- a/website/docs/zh/guide/advanced/subscription.mdx +++ b/website/docs/zh/guide/advanced/subscription.mdx @@ -11,8 +11,7 @@ import { Tab, Tabs } from 'rspress/theme'; ```ts -import { weave, resolver, subscription } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, subscription } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" diff --git a/website/docs/zh/guide/fundamentals/middleware.mdx b/website/docs/zh/guide/fundamentals/middleware.mdx index 5a15235..df854c1 100644 --- a/website/docs/zh/guide/fundamentals/middleware.mdx +++ b/website/docs/zh/guide/fundamentals/middleware.mdx @@ -93,8 +93,7 @@ export const outputValidator: Middleware = async ({ next, outputSilk }) => { ```ts -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" diff --git a/website/docs/zh/guide/getting-started.mdx b/website/docs/zh/guide/getting-started.mdx index f7f53cb..099b91d 100644 --- a/website/docs/zh/guide/getting-started.mdx +++ b/website/docs/zh/guide/getting-started.mdx @@ -76,8 +76,7 @@ npx tsc --init ```ts title="src/index.ts" -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" import { createServer } from "node:http" import { createYoga } from "graphql-yoga" @@ -274,8 +273,7 @@ const catMap = new Map([ ```ts title="src/index.ts" -import { weave, resolver, query } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" import * as v from "valibot" const CatResolver = resolver({ // [!code hl] diff --git a/website/docs/zh/guide/introduction.mdx b/website/docs/zh/guide/introduction.mdx index a63b2e3..952877d 100644 --- a/website/docs/zh/guide/introduction.mdx +++ b/website/docs/zh/guide/introduction.mdx @@ -32,8 +32,7 @@ GQLoom 的设计受 [tRPC](https://trpc.io/)、[TypeGraphQL](https://typegraphql ```ts -import { resolver, query, weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, resolver, query, weave } from "@gqloom/valibot" import * as v from "valibot" const HelloResolver = resolver({ diff --git a/website/docs/zh/guide/schema-integration/valibot.mdx b/website/docs/zh/guide/schema-integration/valibot.mdx index e22db3b..2db54eb 100644 --- a/website/docs/zh/guide/schema-integration/valibot.mdx +++ b/website/docs/zh/guide/schema-integration/valibot.mdx @@ -31,8 +31,7 @@ const IntScalar = v.pipe(v.nullable(v.number()), v.integer()) // GraphQLInt 为了让 `GQLoom` 能正确地将 Valibot Schema 编织到 GraphQL Schema,我们在使用 `weave` 函数时,需要添加来自 `@gqloom/valibot` 的 `ValibotWeaver`。 ```ts -import { resolver, query ,weave } from "@gqloom/core" -import { ValibotWeaver } from "@gqloom/valibot" +import { ValibotWeaver, weave, resolver, query } from "@gqloom/valibot" export const helloResolver = resolver({ hello: query(v.string(), () => "Hello, World!"),