nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
929 stars 194 forks source link

schema.gql file #526

Open bovealexandre opened 11 months ago

bovealexandre commented 11 months ago

Environment

Nuxt project info: 09:13:58


Describe the bug

graphql files are unusable. when I try to use graphQL files like :

<script lang="ts" setup>
import AllUsers from '@/graphql/schema.gql'
or 
import { AllUsers }from '@/graphql/schema.gql'

const Users = await useAsyncQuery(AllUsers)
</script>

It simply shows my gql file like this in an object :

definitions: Array(44) [ {…}, {…}, {…}, … ]
kind: "Document"
loc: Object { start: 0, end: 26188, source: {…} }

my gql file looks like this

schema.gql ``` """All input for the create `Role` mutation.""" input CreateRoleInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """The `Role` to be created by this mutation.""" role: RoleInput! } """The output of our create `Role` mutation.""" type CreateRolePayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """The `Role` that was created by this mutation.""" role: Role """An edge for our `Role`. May be used by Relay 1.""" roleEdge( """The method to use when ordering `Role`.""" orderBy: [RolesOrderBy!] = [PRIMARY_KEY_ASC] ): RolesEdge } """All input for the create `User` mutation.""" input CreateUserInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """The `User` to be created by this mutation.""" user: UserInput! } """The output of our create `User` mutation.""" type CreateUserPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """Reads a single `Role` that is related to this `User`.""" roleByRoleId: Role """The `User` that was created by this mutation.""" user: User """An edge for our `User`. May be used by Relay 1.""" userEdge( """The method to use when ordering `User`.""" orderBy: [UsersOrderBy!] = [PRIMARY_KEY_ASC] ): UsersEdge } """A location in a connection that can be used for resuming pagination.""" scalar Cursor """ A point in time as described by the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. May or may not include a timezone. """ scalar Datetime """All input for the `deleteRoleById` mutation.""" input DeleteRoleByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String id: Int! } """All input for the `deleteRoleByName` mutation.""" input DeleteRoleByNameInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String name: String! } """All input for the `deleteRole` mutation.""" input DeleteRoleInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """ The globally unique `ID` which will identify a single `Role` to be deleted. """ nodeId: ID! } """The output of our delete `Role` mutation.""" type DeleteRolePayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String deletedRoleId: ID """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """The `Role` that was deleted by this mutation.""" role: Role """An edge for our `Role`. May be used by Relay 1.""" roleEdge( """The method to use when ordering `Role`.""" orderBy: [RolesOrderBy!] = [PRIMARY_KEY_ASC] ): RolesEdge } """All input for the `deleteUserByActivationKey` mutation.""" input DeleteUserByActivationKeyInput { activationKey: String! """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String } """All input for the `deleteUserByEmail` mutation.""" input DeleteUserByEmailInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String email: String! } """All input for the `deleteUserById` mutation.""" input DeleteUserByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String id: Int! } """All input for the `deleteUserByPseudo` mutation.""" input DeleteUserByPseudoInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String pseudo: String! } """All input for the `deleteUser` mutation.""" input DeleteUserInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """ The globally unique `ID` which will identify a single `User` to be deleted. """ nodeId: ID! } """The output of our delete `User` mutation.""" type DeleteUserPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String deletedUserId: ID """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """Reads a single `Role` that is related to this `User`.""" roleByRoleId: Role """The `User` that was deleted by this mutation.""" user: User """An edge for our `User`. May be used by Relay 1.""" userEdge( """The method to use when ordering `User`.""" orderBy: [UsersOrderBy!] = [PRIMARY_KEY_ASC] ): UsersEdge } """ The root mutation type which contains root level fields which mutate data. """ type Mutation { """Creates a single `Role`.""" createRole( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: CreateRoleInput! ): CreateRolePayload """Creates a single `User`.""" createUser( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: CreateUserInput! ): CreateUserPayload """Deletes a single `Role` using its globally unique id.""" deleteRole( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteRoleInput! ): DeleteRolePayload """Deletes a single `Role` using a unique key.""" deleteRoleById( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteRoleByIdInput! ): DeleteRolePayload """Deletes a single `Role` using a unique key.""" deleteRoleByName( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteRoleByNameInput! ): DeleteRolePayload """Deletes a single `User` using its globally unique id.""" deleteUser( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteUserInput! ): DeleteUserPayload """Deletes a single `User` using a unique key.""" deleteUserByActivationKey( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteUserByActivationKeyInput! ): DeleteUserPayload """Deletes a single `User` using a unique key.""" deleteUserByEmail( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteUserByEmailInput! ): DeleteUserPayload """Deletes a single `User` using a unique key.""" deleteUserById( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteUserByIdInput! ): DeleteUserPayload """Deletes a single `User` using a unique key.""" deleteUserByPseudo( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: DeleteUserByPseudoInput! ): DeleteUserPayload """Updates a single `Role` using its globally unique id and a patch.""" updateRole( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateRoleInput! ): UpdateRolePayload """Updates a single `Role` using a unique key and a patch.""" updateRoleById( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateRoleByIdInput! ): UpdateRolePayload """Updates a single `Role` using a unique key and a patch.""" updateRoleByName( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateRoleByNameInput! ): UpdateRolePayload """Updates a single `User` using its globally unique id and a patch.""" updateUser( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateUserInput! ): UpdateUserPayload """Updates a single `User` using a unique key and a patch.""" updateUserByActivationKey( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateUserByActivationKeyInput! ): UpdateUserPayload """Updates a single `User` using a unique key and a patch.""" updateUserByEmail( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateUserByEmailInput! ): UpdateUserPayload """Updates a single `User` using a unique key and a patch.""" updateUserById( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateUserByIdInput! ): UpdateUserPayload """Updates a single `User` using a unique key and a patch.""" updateUserByPseudo( """ The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. """ input: UpdateUserByPseudoInput! ): UpdateUserPayload } """An object with a globally unique `ID`.""" interface Node { """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! } """Information about pagination in a connection.""" type PageInfo { """When paginating forwards, the cursor to continue.""" endCursor: Cursor """When paginating forwards, are there more items?""" hasNextPage: Boolean! """When paginating backwards, are there more items?""" hasPreviousPage: Boolean! """When paginating backwards, the cursor to continue.""" startCursor: Cursor } """The root query type which gives access points into the data universe.""" type Query implements Node { """Reads and enables pagination through a set of `Role`.""" allRoles( """Read all values in the set after (below) this cursor.""" after: Cursor """Read all values in the set before (above) this cursor.""" before: Cursor """ A condition to be used in determining which values should be returned by the collection. """ condition: RoleCondition """Only read the first `n` values of the set.""" first: Int """Only read the last `n` values of the set.""" last: Int """ Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`. """ offset: Int """The method to use when ordering `Role`.""" orderBy: [RolesOrderBy!] = [PRIMARY_KEY_ASC] ): RolesConnection """Reads and enables pagination through a set of `User`.""" allUsers( """Read all values in the set after (below) this cursor.""" after: Cursor """Read all values in the set before (above) this cursor.""" before: Cursor """ A condition to be used in determining which values should be returned by the collection. """ condition: UserCondition """Only read the first `n` values of the set.""" first: Int """Only read the last `n` values of the set.""" last: Int """ Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`. """ offset: Int """The method to use when ordering `User`.""" orderBy: [UsersOrderBy!] = [PRIMARY_KEY_ASC] ): UsersConnection """Fetches an object given its globally unique `ID`.""" node( """The globally unique `ID`.""" nodeId: ID! ): Node """ The root query type must be a `Node` to work well with Relay 1 mutations. This just resolves to `query`. """ nodeId: ID! """ Exposes the root query type nested one level down. This is helpful for Relay 1 which can only query top level fields if they are in a particular form. """ query: Query! """Reads a single `Role` using its globally unique `ID`.""" role( """The globally unique `ID` to be used in selecting a single `Role`.""" nodeId: ID! ): Role roleById(id: Int!): Role roleByName(name: String!): Role """Reads a single `User` using its globally unique `ID`.""" user( """The globally unique `ID` to be used in selecting a single `User`.""" nodeId: ID! ): User userByActivationKey(activationKey: String!): User userByEmail(email: String!): User userById(id: Int!): User userByPseudo(pseudo: String!): User } type Role implements Node { canCreateUsers: Boolean canDeleteUsers: Boolean canEditUsers: Boolean canWatchUsers: Boolean id: Int! name: String """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! """Reads and enables pagination through a set of `User`.""" usersByRoleId( """Read all values in the set after (below) this cursor.""" after: Cursor """Read all values in the set before (above) this cursor.""" before: Cursor """ A condition to be used in determining which values should be returned by the collection. """ condition: UserCondition """Only read the first `n` values of the set.""" first: Int """Only read the last `n` values of the set.""" last: Int """ Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`. """ offset: Int """The method to use when ordering `User`.""" orderBy: [UsersOrderBy!] = [PRIMARY_KEY_ASC] ): UsersConnection! } """ A condition to be used against `Role` object types. All fields are tested for equality and combined with a logical ‘and.’ """ input RoleCondition { """Checks for equality with the object’s `canCreateUsers` field.""" canCreateUsers: Boolean """Checks for equality with the object’s `canDeleteUsers` field.""" canDeleteUsers: Boolean """Checks for equality with the object’s `canEditUsers` field.""" canEditUsers: Boolean """Checks for equality with the object’s `canWatchUsers` field.""" canWatchUsers: Boolean """Checks for equality with the object’s `id` field.""" id: Int """Checks for equality with the object’s `name` field.""" name: String } """An input for mutations affecting `Role`""" input RoleInput { canCreateUsers: Boolean canDeleteUsers: Boolean canEditUsers: Boolean canWatchUsers: Boolean id: Int name: String } """Represents an update to a `Role`. Fields that are set will be updated.""" input RolePatch { canCreateUsers: Boolean canDeleteUsers: Boolean canEditUsers: Boolean canWatchUsers: Boolean id: Int name: String } """A connection to a list of `Role` values.""" type RolesConnection { """ A list of edges which contains the `Role` and cursor to aid in pagination. """ edges: [RolesEdge!]! """A list of `Role` objects.""" nodes: [Role]! """Information to aid in pagination.""" pageInfo: PageInfo! """The count of *all* `Role` you could get from the connection.""" totalCount: Int! } """A `Role` edge in the connection.""" type RolesEdge { """A cursor for use in pagination.""" cursor: Cursor """The `Role` at the end of the edge.""" node: Role } """Methods to use when ordering `Role`.""" enum RolesOrderBy { CAN_CREATE_USERS_ASC CAN_CREATE_USERS_DESC CAN_DELETE_USERS_ASC CAN_DELETE_USERS_DESC CAN_EDIT_USERS_ASC CAN_EDIT_USERS_DESC CAN_WATCH_USERS_ASC CAN_WATCH_USERS_DESC ID_ASC ID_DESC NAME_ASC NAME_DESC NATURAL PRIMARY_KEY_ASC PRIMARY_KEY_DESC } """All input for the `updateRoleById` mutation.""" input UpdateRoleByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String id: Int! """ An object where the defined keys will be set on the `Role` being updated. """ rolePatch: RolePatch! } """All input for the `updateRoleByName` mutation.""" input UpdateRoleByNameInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String name: String! """ An object where the defined keys will be set on the `Role` being updated. """ rolePatch: RolePatch! } """All input for the `updateRole` mutation.""" input UpdateRoleInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """ The globally unique `ID` which will identify a single `Role` to be updated. """ nodeId: ID! """ An object where the defined keys will be set on the `Role` being updated. """ rolePatch: RolePatch! } """The output of our update `Role` mutation.""" type UpdateRolePayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """The `Role` that was updated by this mutation.""" role: Role """An edge for our `Role`. May be used by Relay 1.""" roleEdge( """The method to use when ordering `Role`.""" orderBy: [RolesOrderBy!] = [PRIMARY_KEY_ASC] ): RolesEdge } """All input for the `updateUserByActivationKey` mutation.""" input UpdateUserByActivationKeyInput { activationKey: String! """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """ An object where the defined keys will be set on the `User` being updated. """ userPatch: UserPatch! } """All input for the `updateUserByEmail` mutation.""" input UpdateUserByEmailInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String email: String! """ An object where the defined keys will be set on the `User` being updated. """ userPatch: UserPatch! } """All input for the `updateUserById` mutation.""" input UpdateUserByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String id: Int! """ An object where the defined keys will be set on the `User` being updated. """ userPatch: UserPatch! } """All input for the `updateUserByPseudo` mutation.""" input UpdateUserByPseudoInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String pseudo: String! """ An object where the defined keys will be set on the `User` being updated. """ userPatch: UserPatch! } """All input for the `updateUser` mutation.""" input UpdateUserInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String """ The globally unique `ID` which will identify a single `User` to be updated. """ nodeId: ID! """ An object where the defined keys will be set on the `User` being updated. """ userPatch: UserPatch! } """The output of our update `User` mutation.""" type UpdateUserPayload { """ The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query """Reads a single `Role` that is related to this `User`.""" roleByRoleId: Role """The `User` that was updated by this mutation.""" user: User """An edge for our `User`. May be used by Relay 1.""" userEdge( """The method to use when ordering `User`.""" orderBy: [UsersOrderBy!] = [PRIMARY_KEY_ASC] ): UsersEdge } type User implements Node { activationKey: String active: Boolean age: Datetime banned: Boolean! bannedReason: String createdAt: Datetime deletedAt: Datetime email: String! emailVerified: Datetime id: Int! name: String """ A globally unique identifier. Can be used in various places throughout the system to identify this single value. """ nodeId: ID! password: String! pseudo: String! """Reads a single `Role` that is related to this `User`.""" roleByRoleId: Role roleId: Int! surname: String updatedAt: Datetime } """ A condition to be used against `User` object types. All fields are tested for equality and combined with a logical ‘and.’ """ input UserCondition { """Checks for equality with the object’s `activationKey` field.""" activationKey: String """Checks for equality with the object’s `active` field.""" active: Boolean """Checks for equality with the object’s `age` field.""" age: Datetime """Checks for equality with the object’s `banned` field.""" banned: Boolean """Checks for equality with the object’s `bannedReason` field.""" bannedReason: String """Checks for equality with the object’s `createdAt` field.""" createdAt: Datetime """Checks for equality with the object’s `deletedAt` field.""" deletedAt: Datetime """Checks for equality with the object’s `email` field.""" email: String """Checks for equality with the object’s `emailVerified` field.""" emailVerified: Datetime """Checks for equality with the object’s `id` field.""" id: Int """Checks for equality with the object’s `name` field.""" name: String """Checks for equality with the object’s `password` field.""" password: String """Checks for equality with the object’s `pseudo` field.""" pseudo: String """Checks for equality with the object’s `roleId` field.""" roleId: Int """Checks for equality with the object’s `surname` field.""" surname: String """Checks for equality with the object’s `updatedAt` field.""" updatedAt: Datetime } """An input for mutations affecting `User`""" input UserInput { activationKey: String active: Boolean age: Datetime banned: Boolean! bannedReason: String createdAt: Datetime deletedAt: Datetime email: String! emailVerified: Datetime id: Int name: String password: String! pseudo: String! roleId: Int! surname: String updatedAt: Datetime } """Represents an update to a `User`. Fields that are set will be updated.""" input UserPatch { activationKey: String active: Boolean age: Datetime banned: Boolean bannedReason: String createdAt: Datetime deletedAt: Datetime email: String emailVerified: Datetime id: Int name: String password: String pseudo: String roleId: Int surname: String updatedAt: Datetime } """A connection to a list of `User` values.""" type UsersConnection { """ A list of edges which contains the `User` and cursor to aid in pagination. """ edges: [UsersEdge!]! """A list of `User` objects.""" nodes: [User]! """Information to aid in pagination.""" pageInfo: PageInfo! """The count of *all* `User` you could get from the connection.""" totalCount: Int! } """A `User` edge in the connection.""" type UsersEdge { """A cursor for use in pagination.""" cursor: Cursor """The `User` at the end of the edge.""" node: User } """Methods to use when ordering `User`.""" enum UsersOrderBy { ACTIVATION_KEY_ASC ACTIVATION_KEY_DESC ACTIVE_ASC ACTIVE_DESC AGE_ASC AGE_DESC BANNED_ASC BANNED_DESC BANNED_REASON_ASC BANNED_REASON_DESC CREATED_AT_ASC CREATED_AT_DESC DELETED_AT_ASC DELETED_AT_DESC EMAIL_ASC EMAIL_DESC EMAIL_VERIFIED_ASC EMAIL_VERIFIED_DESC ID_ASC ID_DESC NAME_ASC NAME_DESC NATURAL PASSWORD_ASC PASSWORD_DESC PRIMARY_KEY_ASC PRIMARY_KEY_DESC PSEUDO_ASC PSEUDO_DESC ROLE_ID_ASC ROLE_ID_DESC SURNAME_ASC SURNAME_DESC UPDATED_AT_ASC UPDATED_AT_DESC } ```

Expected behaviour

just get my query AllUsers to be able to use it with Apollo

Reproduction

No response

Additional context

the schema is generated by postgraphile

Logs

No response