From 1a9ff0ad3a6d5a42dcca4b3467e423c57f75013f Mon Sep 17 00:00:00 2001 From: Daniel Cousens <413395+dcousens@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:18:06 +1000 Subject: [PATCH] Updates for GraphQL schema ordering and TypeScript type generation (#9258) --- examples/assets-local/schema.graphql | 2 +- examples/assets-s3/schema.graphql | 2 +- examples/auth/schema.graphql | 2 +- examples/cloudinary/schema.graphql | 2 +- examples/custom-admin-ui-logo/schema.graphql | 4 +- .../custom-admin-ui-navigation/schema.graphql | 4 +- examples/custom-admin-ui-pages/schema.graphql | 4 +- examples/custom-field-view/schema.graphql | 4 +- examples/custom-field/schema.graphql | 2 +- examples/custom-id/schema.graphql | 10 +- .../custom-output-paths/my-graphql.graphql | 2 +- examples/custom-output-paths/my-types.ts | 74 +++--- .../schema.graphql | 2 +- examples/custom-session-jwt/schema.graphql | 4 +- .../custom-session-next-auth/schema.graphql | 4 +- .../custom-session-passport/schema.graphql | 4 +- examples/custom-session-redis/schema.graphql | 2 +- examples/custom-session/schema.graphql | 4 +- examples/default-values/schema.graphql | 4 +- .../keystone-server/schema.graphql | 4 +- examples/document-field/schema.graphql | 4 +- examples/extend-express-app/schema.graphql | 2 +- .../schema.graphql | 4 +- .../schema.graphql | 4 +- .../keystone-types.ts | 82 +++--- .../schema.graphql | 4 +- .../schema.graphql | 4 +- examples/extend-prisma-schema/schema.graphql | 6 +- examples/field-groups/schema.graphql | 2 +- examples/framework-astro/schema.graphql | 2 +- .../schema.graphql | 2 +- .../schema.graphql | 2 +- .../keystone-server/schema.graphql | 4 +- examples/framework-remix/schema.graphql | 2 +- examples/graphql-ts-gql/schema.graphql | 4 +- examples/hooks/schema.graphql | 2 +- examples/limits/schema.graphql | 2 +- examples/omit/schema.graphql | 6 +- examples/reuse/schema.graphql | 6 +- examples/script/schema.graphql | 2 +- examples/singleton/schema.graphql | 4 +- examples/testing/schema.graphql | 4 +- examples/transactions/schema.graphql | 6 +- .../usecase-blog-moderated/schema.graphql | 8 +- examples/usecase-blog/schema.graphql | 6 +- .../usecase-relationship-union/schema.graphql | 6 +- examples/usecase-roles/schema.graphql | 6 +- examples/usecase-todo/schema.graphql | 4 +- examples/usecase-versioning/schema.graphql | 2 +- examples/virtual-field/schema.graphql | 2 +- .../core/src/lib/core/initialise-lists.ts | 12 +- packages/core/src/lib/core/queries/index.ts | 2 +- packages/core/src/lib/createGraphQLSchema.ts | 5 +- .../core/src/lib/typescript-schema-printer.ts | 238 +++++++----------- packages/core/src/types/next-fields.ts | 22 +- .../src/types/schema/graphql-ts-schema.ts | 28 +-- .../__snapshots__/artifacts.test.ts.snap | 70 +++--- .../fixtures/basic-project/schema.graphql | 2 +- tests/sandbox/schema.graphql | 8 +- tests/test-projects/basic/schema.graphql | 6 +- .../crud-notifications/schema.graphql | 4 +- .../live-reloading/schema.graphql | 2 +- 62 files changed, 324 insertions(+), 409 deletions(-) diff --git a/examples/assets-local/schema.graphql b/examples/assets-local/schema.graphql index 57f46bfc559..184a1f98fea 100644 --- a/examples/assets-local/schema.graphql +++ b/examples/assets-local/schema.graphql @@ -139,8 +139,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/assets-s3/schema.graphql b/examples/assets-s3/schema.graphql index 57f46bfc559..184a1f98fea 100644 --- a/examples/assets-s3/schema.graphql +++ b/examples/assets-s3/schema.graphql @@ -139,8 +139,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/auth/schema.graphql b/examples/auth/schema.graphql index 5911c4e2af4..c2ded0eb201 100644 --- a/examples/auth/schema.graphql +++ b/examples/auth/schema.graphql @@ -101,8 +101,8 @@ input CreateInitialUserInput { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! authenticatedItem: AuthenticatedItem diff --git a/examples/cloudinary/schema.graphql b/examples/cloudinary/schema.graphql index 45d9b255d02..f22a4835046 100644 --- a/examples/cloudinary/schema.graphql +++ b/examples/cloudinary/schema.graphql @@ -154,8 +154,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-admin-ui-logo/schema.graphql b/examples/custom-admin-ui-logo/schema.graphql index 29b110dadf9..10ef9854b03 100644 --- a/examples/custom-admin-ui-logo/schema.graphql +++ b/examples/custom-admin-ui-logo/schema.graphql @@ -220,11 +220,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-admin-ui-navigation/schema.graphql b/examples/custom-admin-ui-navigation/schema.graphql index 29b110dadf9..10ef9854b03 100644 --- a/examples/custom-admin-ui-navigation/schema.graphql +++ b/examples/custom-admin-ui-navigation/schema.graphql @@ -220,11 +220,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-admin-ui-pages/schema.graphql b/examples/custom-admin-ui-pages/schema.graphql index 29b110dadf9..10ef9854b03 100644 --- a/examples/custom-admin-ui-pages/schema.graphql +++ b/examples/custom-admin-ui-pages/schema.graphql @@ -220,11 +220,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-field-view/schema.graphql b/examples/custom-field-view/schema.graphql index 131d30965d2..a7743bbd7f6 100644 --- a/examples/custom-field-view/schema.graphql +++ b/examples/custom-field-view/schema.graphql @@ -223,11 +223,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-field/schema.graphql b/examples/custom-field/schema.graphql index e3f5631272b..2262bb8fe08 100644 --- a/examples/custom-field/schema.graphql +++ b/examples/custom-field/schema.graphql @@ -118,8 +118,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-id/schema.graphql b/examples/custom-id/schema.graphql index bedfde42bf0..aa176aa84a8 100644 --- a/examples/custom-id/schema.graphql +++ b/examples/custom-id/schema.graphql @@ -372,20 +372,20 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int - orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] order(where: OrderWhereUniqueInput!): Order + orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] ordersCount(where: OrderWhereInput! = {}): Int - options(where: OptionWhereInput! = {}, orderBy: [OptionOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OptionWhereUniqueInput): [Option!] option(where: OptionWhereUniqueInput!): Option + options(where: OptionWhereInput! = {}, orderBy: [OptionOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OptionWhereUniqueInput): [Option!] optionsCount(where: OptionWhereInput! = {}): Int - products(where: ProductWhereInput! = {}, orderBy: [ProductOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ProductWhereUniqueInput): [Product!] product(where: ProductWhereUniqueInput!): Product + products(where: ProductWhereInput! = {}, orderBy: [ProductOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ProductWhereUniqueInput): [Product!] productsCount(where: ProductWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-output-paths/my-graphql.graphql b/examples/custom-output-paths/my-graphql.graphql index 3a606a23739..05054a46f84 100644 --- a/examples/custom-output-paths/my-graphql.graphql +++ b/examples/custom-output-paths/my-graphql.graphql @@ -118,8 +118,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-output-paths/my-types.ts b/examples/custom-output-paths/my-types.ts index e32cd663078..6e20117423b 100644 --- a/examples/custom-output-paths/my-types.ts +++ b/examples/custom-output-paths/my-types.ts @@ -1,17 +1,7 @@ /* eslint-disable */ -type Scalars = { - readonly ID: string - readonly Boolean: boolean - readonly String: string - readonly Int: number - readonly Float: number - readonly JSON: import('@keystone-6/core/types').JSONValue - readonly Decimal: import('@keystone-6/core/types').Decimal | string -} - export type PostWhereUniqueInput = { - readonly id?: Scalars['ID'] | null + readonly id?: string | null } export type PostWhereInput = { @@ -25,41 +15,41 @@ export type PostWhereInput = { } export type IDFilter = { - readonly equals?: Scalars['ID'] | null - readonly in?: ReadonlyArray | Scalars['ID'] | null - readonly notIn?: ReadonlyArray | Scalars['ID'] | null - readonly lt?: Scalars['ID'] | null - readonly lte?: Scalars['ID'] | null - readonly gt?: Scalars['ID'] | null - readonly gte?: Scalars['ID'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null readonly not?: IDFilter | null } export type StringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } export type NestedStringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } @@ -86,8 +76,8 @@ export type OrderDirection = | 'desc' export type PostUpdateInput = { - readonly title?: Scalars['String'] | null - readonly content?: Scalars['String'] | null + readonly title?: string | null + readonly content?: string | null readonly publishDate?: any | null } @@ -97,8 +87,8 @@ export type PostUpdateArgs = { } export type PostCreateInput = { - readonly title?: Scalars['String'] | null - readonly content?: Scalars['String'] | null + readonly title?: string | null + readonly content?: string | null readonly publishDate?: any | null } diff --git a/examples/custom-session-invalidation/schema.graphql b/examples/custom-session-invalidation/schema.graphql index d32b434c826..54a43283ba0 100644 --- a/examples/custom-session-invalidation/schema.graphql +++ b/examples/custom-session-invalidation/schema.graphql @@ -97,8 +97,8 @@ input CreateInitialUserInput { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! authenticatedItem: AuthenticatedItem diff --git a/examples/custom-session-jwt/schema.graphql b/examples/custom-session-jwt/schema.graphql index 0fece306d03..50ec24d2ac3 100644 --- a/examples/custom-session-jwt/schema.graphql +++ b/examples/custom-session-jwt/schema.graphql @@ -152,11 +152,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-session-next-auth/schema.graphql b/examples/custom-session-next-auth/schema.graphql index 9841cd65684..153ede9c8dc 100644 --- a/examples/custom-session-next-auth/schema.graphql +++ b/examples/custom-session-next-auth/schema.graphql @@ -186,11 +186,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-session-passport/schema.graphql b/examples/custom-session-passport/schema.graphql index 9841cd65684..153ede9c8dc 100644 --- a/examples/custom-session-passport/schema.graphql +++ b/examples/custom-session-passport/schema.graphql @@ -186,11 +186,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/custom-session-redis/schema.graphql b/examples/custom-session-redis/schema.graphql index 940b508b6f6..02ec97b7eb2 100644 --- a/examples/custom-session-redis/schema.graphql +++ b/examples/custom-session-redis/schema.graphql @@ -91,8 +91,8 @@ input CreateInitialUserInput { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! authenticatedItem: AuthenticatedItem diff --git a/examples/custom-session/schema.graphql b/examples/custom-session/schema.graphql index 0fece306d03..50ec24d2ac3 100644 --- a/examples/custom-session/schema.graphql +++ b/examples/custom-session/schema.graphql @@ -152,11 +152,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/default-values/schema.graphql b/examples/default-values/schema.graphql index a6561bf53e0..b7e9bf91414 100644 --- a/examples/default-values/schema.graphql +++ b/examples/default-values/schema.graphql @@ -239,11 +239,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/document-field-customisation/keystone-server/schema.graphql b/examples/document-field-customisation/keystone-server/schema.graphql index 3b6eed0d900..f13cf757ecd 100644 --- a/examples/document-field-customisation/keystone-server/schema.graphql +++ b/examples/document-field-customisation/keystone-server/schema.graphql @@ -211,11 +211,11 @@ type Mutation { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/document-field/schema.graphql b/examples/document-field/schema.graphql index b9b8ec8b95d..402ee9c038a 100644 --- a/examples/document-field/schema.graphql +++ b/examples/document-field/schema.graphql @@ -235,11 +235,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/extend-express-app/schema.graphql b/examples/extend-express-app/schema.graphql index 8cf5f29c967..61c4fa34c56 100644 --- a/examples/extend-express-app/schema.graphql +++ b/examples/extend-express-app/schema.graphql @@ -110,8 +110,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/extend-graphql-schema-graphql-tools/schema.graphql b/examples/extend-graphql-schema-graphql-tools/schema.graphql index 4ac23c7526b..9273c8d21e8 100644 --- a/examples/extend-graphql-schema-graphql-tools/schema.graphql +++ b/examples/extend-graphql-schema-graphql-tools/schema.graphql @@ -226,11 +226,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! diff --git a/examples/extend-graphql-schema-graphql-ts/schema.graphql b/examples/extend-graphql-schema-graphql-ts/schema.graphql index 12f0b6c5d87..fc6efbb24c7 100644 --- a/examples/extend-graphql-schema-graphql-ts/schema.graphql +++ b/examples/extend-graphql-schema-graphql-ts/schema.graphql @@ -222,11 +222,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! recentPosts(id: ID!, seconds: Int! = 600): [Post!] diff --git a/examples/extend-graphql-schema-nexus/keystone-types.ts b/examples/extend-graphql-schema-nexus/keystone-types.ts index 3c342137433..24c47686ee5 100644 --- a/examples/extend-graphql-schema-nexus/keystone-types.ts +++ b/examples/extend-graphql-schema-nexus/keystone-types.ts @@ -1,21 +1,11 @@ /* eslint-disable */ -type Scalars = { - readonly ID: string - readonly Boolean: boolean - readonly String: string - readonly Int: number - readonly Float: number - readonly JSON: import('@keystone-6/core/types').JSONValue - readonly Decimal: import('@keystone-6/core/types').Decimal | string -} - export type PostStatusType = | 'draft' | 'published' export type PostWhereUniqueInput = { - readonly id?: Scalars['ID'] | null + readonly id?: string | null } export type PostWhereInput = { @@ -31,41 +21,41 @@ export type PostWhereInput = { } export type IDFilter = { - readonly equals?: Scalars['ID'] | null - readonly in?: ReadonlyArray | Scalars['ID'] | null - readonly notIn?: ReadonlyArray | Scalars['ID'] | null - readonly lt?: Scalars['ID'] | null - readonly lte?: Scalars['ID'] | null - readonly gt?: Scalars['ID'] | null - readonly gte?: Scalars['ID'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null readonly not?: IDFilter | null } export type StringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } export type NestedStringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } @@ -100,9 +90,9 @@ export type OrderDirection = | 'desc' export type PostUpdateInput = { - readonly title?: Scalars['String'] | null + readonly title?: string | null readonly status?: PostStatusType | null - readonly content?: Scalars['String'] | null + readonly content?: string | null readonly publishDate?: any | null readonly author?: AuthorRelateToOneForUpdateInput | null } @@ -110,7 +100,7 @@ export type PostUpdateInput = { export type AuthorRelateToOneForUpdateInput = { readonly create?: AuthorCreateInput | null readonly connect?: AuthorWhereUniqueInput | null - readonly disconnect?: Scalars['Boolean'] | null + readonly disconnect?: boolean | null } export type PostUpdateArgs = { @@ -119,9 +109,9 @@ export type PostUpdateArgs = { } export type PostCreateInput = { - readonly title?: Scalars['String'] | null + readonly title?: string | null readonly status?: PostStatusType | null - readonly content?: Scalars['String'] | null + readonly content?: string | null readonly publishDate?: any | null readonly author?: AuthorRelateToOneForCreateInput | null } @@ -132,7 +122,7 @@ export type AuthorRelateToOneForCreateInput = { } export type AuthorWhereUniqueInput = { - readonly id?: Scalars['ID'] | null + readonly id?: string | null } export type AuthorWhereInput = { @@ -156,7 +146,7 @@ export type AuthorOrderByInput = { } export type AuthorUpdateInput = { - readonly name?: Scalars['String'] | null + readonly name?: string | null readonly posts?: PostRelateToManyForUpdateInput | null } @@ -173,7 +163,7 @@ export type AuthorUpdateArgs = { } export type AuthorCreateInput = { - readonly name?: Scalars['String'] | null + readonly name?: string | null readonly posts?: PostRelateToManyForCreateInput | null } diff --git a/examples/extend-graphql-schema-nexus/schema.graphql b/examples/extend-graphql-schema-nexus/schema.graphql index c5fa5e113d8..249f5a61942 100644 --- a/examples/extend-graphql-schema-nexus/schema.graphql +++ b/examples/extend-graphql-schema-nexus/schema.graphql @@ -214,11 +214,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! nexusPosts(id: String!, seconds: Int! = 600): [Post]! diff --git a/examples/extend-graphql-subscriptions/schema.graphql b/examples/extend-graphql-subscriptions/schema.graphql index 2436a4f6874..a2ed0ebcda8 100644 --- a/examples/extend-graphql-subscriptions/schema.graphql +++ b/examples/extend-graphql-subscriptions/schema.graphql @@ -223,11 +223,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/extend-prisma-schema/schema.graphql b/examples/extend-prisma-schema/schema.graphql index 8f61539c5f9..f346ed58252 100644 --- a/examples/extend-prisma-schema/schema.graphql +++ b/examples/extend-prisma-schema/schema.graphql @@ -240,14 +240,14 @@ type Mutation { } type Query { - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!] tag(where: TagWhereUniqueInput!): Tag + tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!] tagsCount(where: TagWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/field-groups/schema.graphql b/examples/field-groups/schema.graphql index 68e0ef42ac9..288ff94b943 100644 --- a/examples/field-groups/schema.graphql +++ b/examples/field-groups/schema.graphql @@ -119,8 +119,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/framework-astro/schema.graphql b/examples/framework-astro/schema.graphql index 6f5f7b1186a..a403cca3020 100644 --- a/examples/framework-astro/schema.graphql +++ b/examples/framework-astro/schema.graphql @@ -100,8 +100,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/framework-nextjs-app-directory/schema.graphql b/examples/framework-nextjs-app-directory/schema.graphql index 90c1572b808..d5ba9a84a6f 100644 --- a/examples/framework-nextjs-app-directory/schema.graphql +++ b/examples/framework-nextjs-app-directory/schema.graphql @@ -120,8 +120,8 @@ type Mutation { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/framework-nextjs-pages-directory/schema.graphql b/examples/framework-nextjs-pages-directory/schema.graphql index 29cc0b87624..c3833e1a7db 100644 --- a/examples/framework-nextjs-pages-directory/schema.graphql +++ b/examples/framework-nextjs-pages-directory/schema.graphql @@ -118,8 +118,8 @@ type Mutation { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/framework-nextjs-two-servers/keystone-server/schema.graphql b/examples/framework-nextjs-two-servers/keystone-server/schema.graphql index 3b6eed0d900..f13cf757ecd 100644 --- a/examples/framework-nextjs-two-servers/keystone-server/schema.graphql +++ b/examples/framework-nextjs-two-servers/keystone-server/schema.graphql @@ -211,11 +211,11 @@ type Mutation { } type Query { - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/framework-remix/schema.graphql b/examples/framework-remix/schema.graphql index 961fe642c7c..b3cea4089a5 100644 --- a/examples/framework-remix/schema.graphql +++ b/examples/framework-remix/schema.graphql @@ -100,8 +100,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/graphql-ts-gql/schema.graphql b/examples/graphql-ts-gql/schema.graphql index 87456fb2737..186cee8809a 100644 --- a/examples/graphql-ts-gql/schema.graphql +++ b/examples/graphql-ts-gql/schema.graphql @@ -231,11 +231,11 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/hooks/schema.graphql b/examples/hooks/schema.graphql index 6d403d4e9f1..26958e12318 100644 --- a/examples/hooks/schema.graphql +++ b/examples/hooks/schema.graphql @@ -139,8 +139,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/limits/schema.graphql b/examples/limits/schema.graphql index 769e62e5e45..58f04b24c30 100644 --- a/examples/limits/schema.graphql +++ b/examples/limits/schema.graphql @@ -95,8 +95,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int! = 20, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int! = 20, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/omit/schema.graphql b/examples/omit/schema.graphql index d586fe6bdce..7d7529736ed 100644 --- a/examples/omit/schema.graphql +++ b/examples/omit/schema.graphql @@ -149,14 +149,14 @@ type Mutation { } type Query { - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int - priorities(where: PriorityWhereInput! = {}, orderBy: [PriorityOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PriorityWhereUniqueInput): [Priority!] priority(where: PriorityWhereUniqueInput!): Priority + priorities(where: PriorityWhereInput! = {}, orderBy: [PriorityOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PriorityWhereUniqueInput): [Priority!] prioritiesCount(where: PriorityWhereInput! = {}): Int - naughties(where: NaughtyWhereInput! = {}, orderBy: [NaughtyOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: NaughtyWhereUniqueInput): [Naughty!] naughty(where: NaughtyWhereUniqueInput!): Naughty + naughties(where: NaughtyWhereInput! = {}, orderBy: [NaughtyOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: NaughtyWhereUniqueInput): [Naughty!] naughtiesCount(where: NaughtyWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/reuse/schema.graphql b/examples/reuse/schema.graphql index 01e0d766de1..8397d9a958e 100644 --- a/examples/reuse/schema.graphql +++ b/examples/reuse/schema.graphql @@ -229,14 +229,14 @@ type Mutation { } type Query { - invoices(where: InvoiceWhereInput! = {}, orderBy: [InvoiceOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: InvoiceWhereUniqueInput): [Invoice!] invoice(where: InvoiceWhereUniqueInput!): Invoice + invoices(where: InvoiceWhereInput! = {}, orderBy: [InvoiceOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: InvoiceWhereUniqueInput): [Invoice!] invoicesCount(where: InvoiceWhereInput! = {}): Int - orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] order(where: OrderWhereUniqueInput!): Order + orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] ordersCount(where: OrderWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/script/schema.graphql b/examples/script/schema.graphql index eb970242f05..22c49cf7df0 100644 --- a/examples/script/schema.graphql +++ b/examples/script/schema.graphql @@ -113,8 +113,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/singleton/schema.graphql b/examples/singleton/schema.graphql index 784785c74d4..eddc10346c3 100644 --- a/examples/singleton/schema.graphql +++ b/examples/singleton/schema.graphql @@ -187,11 +187,11 @@ type Mutation { } type Query { - manySettings(where: SettingsWhereInput! = {id: {equals: 1}}, orderBy: [SettingsOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SettingsWhereUniqueInput): [Settings!] settings(where: SettingsWhereUniqueInput! = {id: 1}): Settings + manySettings(where: SettingsWhereInput! = {id: {equals: 1}}, orderBy: [SettingsOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SettingsWhereUniqueInput): [Settings!] manySettingsCount(where: SettingsWhereInput! = {id: {equals: 1}}): Int - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/testing/schema.graphql b/examples/testing/schema.graphql index 6453d7cef28..17f8f438dc9 100644 --- a/examples/testing/schema.graphql +++ b/examples/testing/schema.graphql @@ -247,11 +247,11 @@ input CreateInitialUserInput { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! authenticatedItem: AuthenticatedItem diff --git a/examples/transactions/schema.graphql b/examples/transactions/schema.graphql index 7082a652fba..bc5d33f72dc 100644 --- a/examples/transactions/schema.graphql +++ b/examples/transactions/schema.graphql @@ -271,14 +271,14 @@ type Mutation { } type Query { - orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] order(where: OrderWhereUniqueInput!): Order + orders(where: OrderWhereInput! = {}, orderBy: [OrderOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: OrderWhereUniqueInput): [Order!] ordersCount(where: OrderWhereInput! = {}): Int - items(where: ItemWhereInput! = {}, orderBy: [ItemOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ItemWhereUniqueInput): [Item!] item(where: ItemWhereUniqueInput!): Item + items(where: ItemWhereInput! = {}, orderBy: [ItemOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ItemWhereUniqueInput): [Item!] itemsCount(where: ItemWhereInput! = {}): Int - products(where: ProductWhereInput! = {}, orderBy: [ProductOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ProductWhereUniqueInput): [Product!] product(where: ProductWhereUniqueInput!): Product + products(where: ProductWhereInput! = {}, orderBy: [ProductOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ProductWhereUniqueInput): [Product!] productsCount(where: ProductWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/usecase-blog-moderated/schema.graphql b/examples/usecase-blog-moderated/schema.graphql index 2f38bea442b..357f55e4578 100644 --- a/examples/usecase-blog-moderated/schema.graphql +++ b/examples/usecase-blog-moderated/schema.graphql @@ -328,17 +328,17 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - contributors(where: ContributorWhereInput! = {}, orderBy: [ContributorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ContributorWhereUniqueInput): [Contributor!] contributor(where: ContributorWhereUniqueInput!): Contributor + contributors(where: ContributorWhereInput! = {}, orderBy: [ContributorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ContributorWhereUniqueInput): [Contributor!] contributorsCount(where: ContributorWhereInput! = {}): Int - moderators(where: ModeratorWhereInput! = {}, orderBy: [ModeratorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ModeratorWhereUniqueInput): [Moderator!] moderator(where: ModeratorWhereUniqueInput!): Moderator + moderators(where: ModeratorWhereInput! = {}, orderBy: [ModeratorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ModeratorWhereUniqueInput): [Moderator!] moderatorsCount(where: ModeratorWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/usecase-blog/schema.graphql b/examples/usecase-blog/schema.graphql index 118722dee9b..9c78a753995 100644 --- a/examples/usecase-blog/schema.graphql +++ b/examples/usecase-blog/schema.graphql @@ -274,14 +274,14 @@ type Mutation { } type Query { - authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] author(where: AuthorWhereUniqueInput!): Author + authors(where: AuthorWhereInput! = {}, orderBy: [AuthorOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: AuthorWhereUniqueInput): [Author!] authorsCount(where: AuthorWhereInput! = {}): Int - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!] tag(where: TagWhereUniqueInput!): Tag + tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!] tagsCount(where: TagWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/usecase-relationship-union/schema.graphql b/examples/usecase-relationship-union/schema.graphql index d7f977bf4f9..73a34f25b33 100644 --- a/examples/usecase-relationship-union/schema.graphql +++ b/examples/usecase-relationship-union/schema.graphql @@ -218,14 +218,14 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int - links(where: LinkWhereInput! = {}, orderBy: [LinkOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: LinkWhereUniqueInput): [Link!] link(where: LinkWhereUniqueInput!): Link + links(where: LinkWhereInput! = {}, orderBy: [LinkOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: LinkWhereUniqueInput): [Link!] linksCount(where: LinkWhereInput! = {}): Int - medias(where: MediaWhereInput! = {}, orderBy: [MediaOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MediaWhereUniqueInput): [Media!] media(where: MediaWhereUniqueInput!): Media + medias(where: MediaWhereInput! = {}, orderBy: [MediaOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: MediaWhereUniqueInput): [Media!] mediasCount(where: MediaWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/usecase-roles/schema.graphql b/examples/usecase-roles/schema.graphql index e15469434a3..b1a34782dcd 100644 --- a/examples/usecase-roles/schema.graphql +++ b/examples/usecase-roles/schema.graphql @@ -327,14 +327,14 @@ input CreateInitialUserInput { } type Query { - todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todo(where: TodoWhereUniqueInput!): Todo + todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todosCount(where: TodoWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int - roles(where: RoleWhereInput! = {}, orderBy: [RoleOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: RoleWhereUniqueInput): [Role!] role(where: RoleWhereUniqueInput!): Role + roles(where: RoleWhereInput! = {}, orderBy: [RoleOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: RoleWhereUniqueInput): [Role!] rolesCount(where: RoleWhereInput! = {}): Int keystone: KeystoneMeta! authenticatedItem: AuthenticatedItem diff --git a/examples/usecase-todo/schema.graphql b/examples/usecase-todo/schema.graphql index bf97fcb90f0..ff520d54195 100644 --- a/examples/usecase-todo/schema.graphql +++ b/examples/usecase-todo/schema.graphql @@ -221,11 +221,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/usecase-versioning/schema.graphql b/examples/usecase-versioning/schema.graphql index fe3e766c10d..b3069abf16b 100644 --- a/examples/usecase-versioning/schema.graphql +++ b/examples/usecase-versioning/schema.graphql @@ -116,8 +116,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/examples/virtual-field/schema.graphql b/examples/virtual-field/schema.graphql index 19e855c2377..ac84e5b1275 100644 --- a/examples/virtual-field/schema.graphql +++ b/examples/virtual-field/schema.graphql @@ -125,8 +125,8 @@ type Mutation { } type Query { - posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] post(where: PostWhereUniqueInput!): Post + posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!] postsCount(where: PostWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/packages/core/src/lib/core/initialise-lists.ts b/packages/core/src/lib/core/initialise-lists.ts index e492a26bede..135e90b9c34 100644 --- a/packages/core/src/lib/core/initialise-lists.ts +++ b/packages/core/src/lib/core/initialise-lists.ts @@ -118,6 +118,7 @@ export type InitialisedList = { } prisma: { + types: GraphQLNames, // TODO: not completely appropriate, but what is used for now listKey: string mapping: string | undefined extendPrismaSchema: ((schema: string) => string) | undefined @@ -751,13 +752,20 @@ function getListsWithInitialisedFields ( groups, graphql: { - types: listGraphqlTypes[listKey].types, - names: names.graphql.names, + types: { + ...listGraphqlTypes[listKey].types, + }, + names: { + ...names.graphql.names, + }, namePlural: names.graphql.namePlural, // TODO: remove ...intermediateList.graphql, }, prisma: { + types: { + ...names.graphql.names, + }, listKey: listKey[0].toLowerCase() + listKey.slice(1), mapping: listConfig.db?.map, extendPrismaSchema: listConfig.db?.extendPrismaSchema, diff --git a/packages/core/src/lib/core/queries/index.ts b/packages/core/src/lib/core/queries/index.ts index 97c48d5ce18..48b6dba3dfe 100644 --- a/packages/core/src/lib/core/queries/index.ts +++ b/packages/core/src/lib/core/queries/index.ts @@ -40,8 +40,8 @@ export function getQueriesForList (list: InitialisedList) { }) return { - [list.graphql.names.listQueryName]: findMany, [list.graphql.names.itemQueryName]: findOne, + [list.graphql.names.listQueryName]: findMany, [list.graphql.names.listQueryCountName]: countQuery, } } diff --git a/packages/core/src/lib/createGraphQLSchema.ts b/packages/core/src/lib/createGraphQLSchema.ts index c4938bd976f..51659d2fc85 100644 --- a/packages/core/src/lib/createGraphQLSchema.ts +++ b/packages/core/src/lib/createGraphQLSchema.ts @@ -8,14 +8,14 @@ import { KeystoneMeta } from './resolve-admin-meta' import type { AdminMetaRootVal } from './create-admin-meta' import type { InitialisedList } from './core/initialise-lists' -import { getMutationsForList } from './core/mutations' import { getQueriesForList } from './core/queries' +import { getMutationsForList } from './core/mutations' function getGraphQLSchema ( lists: Record, extraFields: { - mutation: Record> query: Record> + mutation: Record> }, sudo: boolean ) { @@ -29,7 +29,6 @@ function getGraphQLSchema ( }) const updateManyByList: Record> = {} - const mutation = graphql.object()({ name: 'Mutation', fields: Object.assign( diff --git a/packages/core/src/lib/typescript-schema-printer.ts b/packages/core/src/lib/typescript-schema-printer.ts index 744c8cbf2b0..983eca197da 100644 --- a/packages/core/src/lib/typescript-schema-printer.ts +++ b/packages/core/src/lib/typescript-schema-printer.ts @@ -1,106 +1,60 @@ import { + type GraphQLNamedType, type GraphQLSchema, - GraphQLScalarType, - GraphQLEnumType, type GraphQLType, - GraphQLNonNull, - type GraphQLNamedType, - GraphQLList, + GraphQLEnumType, GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + GraphQLScalarType, introspectionTypes, } from 'graphql' import type { InitialisedList } from './core/initialise-lists' const introspectionTypesSet = new Set(introspectionTypes) +const SCALARS = { + ID: 'string', + Boolean: 'boolean', + String: 'string', + Int: 'number', + Float: 'number', + JSON: `import('@keystone-6/core/types').JSONValue`, + Decimal: `import('@keystone-6/core/types').Decimal | string`, +} as const + function stringify (x: string) { return JSON.stringify(x).slice(1, -1) } -function printEnumTypeDefinition (type: GraphQLEnumType) { - return [ - `export type ${type.name} =`, - type - .getValues() - .map(x => ` | '${stringify(x.name)}'`) - .join('\n'), - ].join('\n') -} - -function printTypeReference (type: GraphQLType, scalars: Record): string { - if (type instanceof GraphQLNonNull) { - return printTypeReferenceWithoutNullable(type.ofType, scalars) - } - return `${printTypeReferenceWithoutNullable(type, scalars)} | null` +function printTypeReference (type: GraphQLType): string { + if (type instanceof GraphQLNonNull) return printTypeReferenceWithoutNullable(type.ofType) + return `${printTypeReferenceWithoutNullable(type)} | null` } function printTypeReferenceWithoutNullable ( type: GraphQLNamedType | GraphQLList, - scalars: Record ): string { - if (type instanceof GraphQLList) { - return `ReadonlyArray<${printTypeReference(type.ofType, scalars)}> | ${printTypeReference( - type.ofType, - scalars - )}` - } + if (type instanceof GraphQLList) return `ReadonlyArray<${printTypeReference(type.ofType)}> | ${printTypeReference(type.ofType)}` const name = type.name if (type instanceof GraphQLScalarType) { - if (scalars[name] === undefined) return 'any' - return `Scalars['${stringify(name)}']` // TODO: inline? + if (name in SCALARS) return SCALARS[name as keyof typeof SCALARS] + return `any` } return name } -function printInputObjectTypeDefinition ( - type: GraphQLInputObjectType, - scalars: Record -) { - return [ - `export type ${type.name} = {`, - ...Object.values(type.getFields()).map(({ type, defaultValue, name }) => { - const maybe = type instanceof GraphQLNonNull ? '' : '?' - return ` readonly ${name}${maybe}: ${printTypeReference(type, scalars)}` - }), - '}', - ].join('\n') -} - -function printInputTypesFromSchema (schema: GraphQLSchema, scalars: Record) { - const output = [ - 'type Scalars = {', - ...Object.keys(scalars).map(scalar => ` readonly ${scalar}: ${scalars[scalar]}`), - '}', - ] - - for (const type of Object.values(schema.getTypeMap())) { - // We don't want to print TS types for the built-in GraphQL introspection types - // they won't be used for anything we want to print here. - if (introspectionTypesSet.has(type)) continue - if (type instanceof GraphQLInputObjectType) { - output.push('', printInputObjectTypeDefinition(type, scalars)) - } - if (type instanceof GraphQLEnumType) { - output.push('', printEnumTypeDefinition(type)) - } - } - - return output.join('\n') -} - function printInterimType ( prismaClientPath: string, list: L, - listKey: string, - typename: string, - operation: 'Create' | 'Update' + operation: 'create' | 'update' ) { - const prismaType = `import('${prismaClientPath}').Prisma.${listKey}${operation}Input` - + const name = list.prisma.types[`${operation}InputName`] + const prismaType = `import('${prismaClientPath}').Prisma.${name}` return [ - `type Resolved${typename} = {`, + `type Resolved${name} = {`, ...Object.entries(list.fields).map(([fieldKey, { dbField }]) => { if (dbField.kind === 'none') return ` ${fieldKey}?: undefined` @@ -114,7 +68,7 @@ function printInterimType ( } // soft-block `id` updates for relationship safety - if (operation === 'Update') return ` id?: undefined` + if (operation === 'update') return ` id?: undefined` } if (dbField.kind === 'multi') { @@ -139,48 +93,6 @@ function printInterimType ( ].join('\n') } -function printListTypeInfo ( - prismaClientPath: string, - listKey: string, - list: L -) { - const { - whereInputName, - whereUniqueInputName, - createInputName, - updateInputName, - listOrderName, - } = list.graphql.names - const listTypeInfoName = `Lists.${listKey}.TypeInfo` - - return [ - `export type ${listKey} = import('@keystone-6/core').ListConfig<${listTypeInfoName}>`, - `namespace ${listKey} {`, - ` export type Item = import('${prismaClientPath}').${listKey}`, - ` export type TypeInfo = {`, - ` key: '${listKey}'`, - ` isSingleton: ${list.isSingleton}`, - ` fields: ${Object.keys(list.fields).map(x => `'${x}'`).join(' | ')}`, - ` item: Item`, - ` inputs: {`, - ` where: ${list.graphql.isEnabled.query ? whereInputName : 'never'}`, - ` uniqueWhere: ${list.graphql.isEnabled.query ? whereUniqueInputName : 'never'}`, - ` create: ${list.graphql.isEnabled.create ? createInputName : 'never'}`, - ` update: ${list.graphql.isEnabled.update ? updateInputName : 'never'}`, - ` orderBy: ${list.graphql.isEnabled.query ? listOrderName : 'never'}`, - ` }`, - ` prisma: {`, - ` create: ${list.graphql.isEnabled.create ? `Resolved${createInputName}` : 'never'}`, - ` update: ${list.graphql.isEnabled.update ? `Resolved${updateInputName}` : 'never'}`, - ` }`, - ` all: __TypeInfo`, - ` }`, - `}`, - ] - .map(line => ` ${line}`) - .join('\n') -} - export function printGeneratedTypes ( prismaClientPath: string, graphQLSchema: GraphQLSchema, @@ -191,44 +103,84 @@ export function printGeneratedTypes ( return [ '/* eslint-disable */', '', - printInputTypesFromSchema(graphQLSchema, { - ID: 'string', - Boolean: 'boolean', - String: 'string', - Int: 'number', - Float: 'number', - JSON: `import('@keystone-6/core/types').JSONValue`, - Decimal: `import('@keystone-6/core/types').Decimal | string`, - }), - '', - ...(function* () { - for (const [listKey, list] of Object.entries(lists)) { - if (list.graphql.isEnabled.create) { - yield printInterimType( - prismaClientPath, - list, - listKey, - list.graphql.names.createInputName, - 'Create' - ) + [...(function* () { + for (const type of Object.values(graphQLSchema.getTypeMap())) { + // We don't want to print TS types for the built-in GraphQL introspection types + // they won't be used for anything we want to print here. + if (introspectionTypesSet.has(type)) continue + if (type instanceof GraphQLInputObjectType) { + yield [ + `export type ${type.name} = {`, + ...(function* () { + for (const { name, type: type_ } of Object.values(type.getFields())) { + const maybe = type_ instanceof GraphQLNonNull ? '' : '?' + yield ` readonly ${name}${maybe}: ${printTypeReference(type_)}` + } + })(), + '}', + ].join('\n') + continue } - if (list.graphql.isEnabled.update) { - yield printInterimType( - prismaClientPath, - list, - listKey, - list.graphql.names.updateInputName, - 'Update' - ) + if (type instanceof GraphQLEnumType) { + yield [ + `export type ${type.name} =`, + type + .getValues() + .map(x => ` | '${stringify(x.name)}'`) + .join('\n'), + ].join('\n') + continue } } + })()].join('\n\n'), + '', + // Resolved* types + ...(function* () { + for (const list of Object.values(lists)) { + if (list.graphql.isEnabled.create) yield printInterimType(prismaClientPath, list, 'create') + if (list.graphql.isEnabled.update) yield printInterimType(prismaClientPath, list, 'update') + } }()), '', 'export declare namespace Lists {', ...(function* () { for (const [listKey, list] of Object.entries(lists)) { - yield printListTypeInfo(prismaClientPath, listKey, list) + const { + whereInputName, + whereUniqueInputName, + createInputName, + updateInputName, + listOrderName, + } = list.prisma.types + const listTypeInfoName = `Lists.${listKey}.TypeInfo` + + yield [ + `export type ${listKey} = import('@keystone-6/core').ListConfig<${listTypeInfoName}>`, + `namespace ${listKey} {`, + ` export type Item = import('${prismaClientPath}').${listKey}`, + ` export type TypeInfo = {`, + ` key: '${listKey}'`, + ` isSingleton: ${list.isSingleton}`, + ` fields: ${Object.keys(list.fields).map(x => `'${x}'`).join(' | ')}`, + ` item: Item`, + ` inputs: {`, + ` where: ${list.graphql.isEnabled.query ? whereInputName : 'never'}`, + ` uniqueWhere: ${list.graphql.isEnabled.query ? whereUniqueInputName : 'never'}`, + ` create: ${list.graphql.isEnabled.create ? list.graphql.names.createInputName : 'never'}`, + ` update: ${list.graphql.isEnabled.update ? list.graphql.names.updateInputName : 'never'}`, + ` orderBy: ${list.graphql.isEnabled.query ? listOrderName : 'never'}`, + ` }`, + ` prisma: {`, + ` create: ${list.graphql.isEnabled.create ? `Resolved${createInputName}` : 'never'}`, + ` update: ${list.graphql.isEnabled.update ? `Resolved${updateInputName}` : 'never'}`, + ` }`, + ` all: __TypeInfo`, + ` }`, + `}`, + ] + .map(line => ` ${line}`) + .join('\n') } })(), '}', diff --git a/packages/core/src/types/next-fields.ts b/packages/core/src/types/next-fields.ts index 0fe004faf7e..9b6179340f7 100644 --- a/packages/core/src/types/next-fields.ts +++ b/packages/core/src/types/next-fields.ts @@ -413,6 +413,17 @@ export type GraphQLTypesForList = { output: graphql.ObjectType findManyArgs: FindManyArgs relateTo: { + one: { + create?: graphql.InputObjectType<{ + create?: graphql.Arg + connect: graphql.Arg + }> + update?: graphql.InputObjectType<{ + create?: graphql.Arg + connect: graphql.Arg + disconnect: graphql.Arg + }> + } many: { where: graphql.InputObjectType<{ every: graphql.Arg @@ -436,17 +447,6 @@ export type GraphQLTypesForList = { create?: graphql.Arg>> }> } - one: { - create?: graphql.InputObjectType<{ - create?: graphql.Arg - connect: graphql.Arg - }> - update?: graphql.InputObjectType<{ - create?: graphql.Arg - connect: graphql.Arg - disconnect: graphql.Arg - }> - } } } diff --git a/packages/core/src/types/schema/graphql-ts-schema.ts b/packages/core/src/types/schema/graphql-ts-schema.ts index c5cd91e4311..b5de2054874 100644 --- a/packages/core/src/types/schema/graphql-ts-schema.ts +++ b/packages/core/src/types/schema/graphql-ts-schema.ts @@ -190,21 +190,15 @@ export const BigInt = graphqlTsSchema.graphql.scalar( new GraphQLScalarType({ name: 'BigInt', serialize (value) { - if (typeof value !== 'bigint') { - throw new GraphQLError(`unexpected value provided to BigInt scalar: ${value}`) - } + if (typeof value !== 'bigint') throw new GraphQLError(`unexpected value provided to BigInt scalar: ${value}`) return value.toString() }, parseLiteral (value) { - if (value.kind !== 'StringValue') { - throw new GraphQLError('BigInt only accepts values as strings') - } + if (value.kind !== 'StringValue') throw new GraphQLError('BigInt only accepts values as strings') return globalThis.BigInt(value.value) }, parseValue (value) { - if (typeof value === 'bigint') { - return value - } + if (typeof value === 'bigint') return value if (typeof value !== 'string') { throw new GraphQLError('BigInt only accepts values as strings') } @@ -220,15 +214,11 @@ const RFC_3339_REGEX = function parseDate (input: string): Date { if (!RFC_3339_REGEX.test(input)) { - throw new GraphQLError( - 'DateTime scalars must be in the form of a full ISO 8601 date-time string' - ) + throw new GraphQLError('DateTime scalars must be in the form of a full ISO 8601 date-time string') } const parsed = new Date(input) if (isNaN(parsed.valueOf())) { - throw new GraphQLError( - 'DateTime scalars must be in the form of a full ISO 8601 date-time string' - ) + throw new GraphQLError('DateTime scalars must be in the form of a full ISO 8601 date-time string') } return parsed } @@ -250,9 +240,7 @@ export const DateTime = graphqlTsSchema.graphql.scalar( return parseDate(value.value) }, parseValue (value: unknown) { - if (value instanceof Date) { - return value - } + if (value instanceof Date) return value if (typeof value !== 'string') { throw new GraphQLError('DateTime only accepts values as strings') } @@ -265,9 +253,7 @@ const RFC_3339_FULL_DATE_REGEX = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01] function validateCalendarDay (input: string) { if (!RFC_3339_FULL_DATE_REGEX.test(input)) { - throw new GraphQLError( - 'CalendarDay scalars must be in the form of a full-date ISO 8601 string' - ) + throw new GraphQLError('CalendarDay scalars must be in the form of a full-date ISO 8601 string') } } diff --git a/tests/cli-tests/__snapshots__/artifacts.test.ts.snap b/tests/cli-tests/__snapshots__/artifacts.test.ts.snap index 2b31990428e..0b1dc00c2b3 100644 --- a/tests/cli-tests/__snapshots__/artifacts.test.ts.snap +++ b/tests/cli-tests/__snapshots__/artifacts.test.ts.snap @@ -4,18 +4,8 @@ exports[`postinstall writes the correct node_modules files 1`] = ` ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ node_modules/.keystone/types.ts ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ /* eslint-disable */ -type Scalars = { - readonly ID: string - readonly Boolean: boolean - readonly String: string - readonly Int: number - readonly Float: number - readonly JSON: import('@keystone-6/core/types').JSONValue - readonly Decimal: import('@keystone-6/core/types').Decimal | string -} - export type TodoWhereUniqueInput = { - readonly id?: Scalars['ID'] | null + readonly id?: string | null } export type TodoWhereInput = { @@ -27,41 +17,41 @@ export type TodoWhereInput = { } export type IDFilter = { - readonly equals?: Scalars['ID'] | null - readonly in?: ReadonlyArray | Scalars['ID'] | null - readonly notIn?: ReadonlyArray | Scalars['ID'] | null - readonly lt?: Scalars['ID'] | null - readonly lte?: Scalars['ID'] | null - readonly gt?: Scalars['ID'] | null - readonly gte?: Scalars['ID'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null readonly not?: IDFilter | null } export type StringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } export type NestedStringFilter = { - readonly equals?: Scalars['String'] | null - readonly in?: ReadonlyArray | Scalars['String'] | null - readonly notIn?: ReadonlyArray | Scalars['String'] | null - readonly lt?: Scalars['String'] | null - readonly lte?: Scalars['String'] | null - readonly gt?: Scalars['String'] | null - readonly gte?: Scalars['String'] | null - readonly contains?: Scalars['String'] | null - readonly startsWith?: Scalars['String'] | null - readonly endsWith?: Scalars['String'] | null + readonly equals?: string | null + readonly in?: ReadonlyArray | string | null + readonly notIn?: ReadonlyArray | string | null + readonly lt?: string | null + readonly lte?: string | null + readonly gt?: string | null + readonly gte?: string | null + readonly contains?: string | null + readonly startsWith?: string | null + readonly endsWith?: string | null readonly not?: NestedStringFilter | null } @@ -75,7 +65,7 @@ export type OrderDirection = | 'desc' export type TodoUpdateInput = { - readonly title?: Scalars['String'] | null + readonly title?: string | null } export type TodoUpdateArgs = { @@ -84,7 +74,7 @@ export type TodoUpdateArgs = { } export type TodoCreateInput = { - readonly title?: Scalars['String'] | null + readonly title?: string | null } export type KeystoneAdminUIFieldMetaIsNonNull = diff --git a/tests/cli-tests/fixtures/basic-project/schema.graphql b/tests/cli-tests/fixtures/basic-project/schema.graphql index e8522762af5..d727995b8f6 100644 --- a/tests/cli-tests/fixtures/basic-project/schema.graphql +++ b/tests/cli-tests/fixtures/basic-project/schema.graphql @@ -95,8 +95,8 @@ type Mutation { } type Query { - todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todo(where: TodoWhereUniqueInput!): Todo + todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todosCount(where: TodoWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/tests/sandbox/schema.graphql b/tests/sandbox/schema.graphql index a8db725b82f..1e559de9a66 100644 --- a/tests/sandbox/schema.graphql +++ b/tests/sandbox/schema.graphql @@ -656,17 +656,17 @@ type Mutation { } type Query { - things(where: ThingWhereInput! = {}, orderBy: [ThingOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ThingWhereUniqueInput): [Thing!] thing(where: ThingWhereUniqueInput!): Thing + things(where: ThingWhereInput! = {}, orderBy: [ThingOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: ThingWhereUniqueInput): [Thing!] thingsCount(where: ThingWhereInput! = {}): Int - todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todo(where: TodoWhereUniqueInput!): Todo + todos(where: TodoWhereInput! = {}, orderBy: [TodoOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TodoWhereUniqueInput): [Todo!] todosCount(where: TodoWhereInput! = {}): Int - users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] user(where: UserWhereUniqueInput!): User + users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] usersCount(where: UserWhereInput! = {}): Int - manySettings(where: SettingsWhereInput! = {id: {equals: 1}}, orderBy: [SettingsOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SettingsWhereUniqueInput): [Settings!] settings(where: SettingsWhereUniqueInput! = {id: 1}): Settings + manySettings(where: SettingsWhereInput! = {id: {equals: 1}}, orderBy: [SettingsOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SettingsWhereUniqueInput): [Settings!] manySettingsCount(where: SettingsWhereInput! = {id: {equals: 1}}): Int keystone: KeystoneMeta! } diff --git a/tests/test-projects/basic/schema.graphql b/tests/test-projects/basic/schema.graphql index cd37f6ad695..46cb9f04a21 100644 --- a/tests/test-projects/basic/schema.graphql +++ b/tests/test-projects/basic/schema.graphql @@ -266,14 +266,14 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int - secretPlans(where: SecretPlanWhereInput! = {}, orderBy: [SecretPlanOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SecretPlanWhereUniqueInput): [SecretPlan!] secretPlan(where: SecretPlanWhereUniqueInput!): SecretPlan + secretPlans(where: SecretPlanWhereInput! = {}, orderBy: [SecretPlanOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SecretPlanWhereUniqueInput): [SecretPlan!] secretPlansCount(where: SecretPlanWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/tests/test-projects/crud-notifications/schema.graphql b/tests/test-projects/crud-notifications/schema.graphql index 29b110dadf9..10ef9854b03 100644 --- a/tests/test-projects/crud-notifications/schema.graphql +++ b/tests/test-projects/crud-notifications/schema.graphql @@ -220,11 +220,11 @@ type Mutation { } type Query { - tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] task(where: TaskWhereUniqueInput!): Task + tasks(where: TaskWhereInput! = {}, orderBy: [TaskOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TaskWhereUniqueInput): [Task!] tasksCount(where: TaskWhereInput! = {}): Int - people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] person(where: PersonWhereUniqueInput!): Person + people(where: PersonWhereInput! = {}, orderBy: [PersonOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PersonWhereUniqueInput): [Person!] peopleCount(where: PersonWhereInput! = {}): Int keystone: KeystoneMeta! } diff --git a/tests/test-projects/live-reloading/schema.graphql b/tests/test-projects/live-reloading/schema.graphql index 56db1ba889a..7b77ab5d401 100644 --- a/tests/test-projects/live-reloading/schema.graphql +++ b/tests/test-projects/live-reloading/schema.graphql @@ -95,8 +95,8 @@ type Mutation { } type Query { - somethings(where: SomethingWhereInput! = {}, orderBy: [SomethingOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SomethingWhereUniqueInput): [Something!] something(where: SomethingWhereUniqueInput!): Something + somethings(where: SomethingWhereInput! = {}, orderBy: [SomethingOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: SomethingWhereUniqueInput): [Something!] somethingsCount(where: SomethingWhereInput! = {}): Int keystone: KeystoneMeta! someNumber: Int