Releases: deno-libs/gql
Releases · deno-libs/gql
3.0.1
- move to JSR
- bump std
- mention support for Bun
Full Changelog: 2.0.2...3.0.1
2.0.2
bump deps
2.0.1
bump std
2.0.0
A re-write of gql to fully comply with GraphQL-over-HTTP spec, based on graphql-http.
Breaking Changes
runHttpQuery
is removed. Query handling logic is now handled fully by graphql-http.GQLParams
is removed. Use graphql-httpRequest
type instead.- request type
text/plain
is no longer a valid. Useapplication/json
instead
New Features
- All of the configuration for GraphQL-over-HTTP (for example
validationRules
) is now available for gql. - New
GraphQLHTTP
function argument -reqCtx
. Use it to modify the request context for GraphQLRequest
object.
Example:
import { GraphQLHTTP } from 'https://deno.land/x/[email protected]/mod.ts'
import { makeExecutableSchema } from 'npm:@graphql-tools/[email protected]'
import { gql } from 'https://deno.land/x/[email protected]/mod.ts'
import type { Request as GQLRequest } from 'npm:[email protected]'
const typeDefs = gql`
type Query {
hello: String
}
`
type ReqContext = {
request: Request
isRequestContext: boolean
}
type Context = {
request: Request
originalReq: GQLRequest<Request, ReqContext>
}
const resolvers = {
Query: {
hello: (_root: unknown, _args: unknown, ctx: Context) => {
return `Hello from request context: ${ctx.originalReq.context.isRequestContext}`
},
},
}
const schema = makeExecutableSchema({ resolvers, typeDefs })
Deno.serve({
port: 3000,
onListen({ hostname, port }) {
console.log(`☁ Started on http://${hostname}:${port}`)
},
}, async (req) => {
const { pathname } = new URL(req.url)
return pathname === '/graphql'
? await GraphQLHTTP<Request, Context, ReqContext>({
schema,
graphiql: true,
context: (request) => ({ request: req, originalReq: request }),
}, () => ({ request: req, isRequestContext: true }))(req)
: new Response('Not Found', { status: 404 })
})
Misc
- Added GraphQL-over-HTTP compliance tests (100% compliance)
- Bumped GraphQL from 16.6 to 16.8.1
Use `npm:` specifiers instead of ESM CDN
1.2.4 update readme example
1.2.3
remove `target=deno` causing dep conflicts and bump examples
1.2.2
Update README.md
1.2.1
update examples & readme
1.2.0
fix badge and eggs publish
1.1.2
move all types to types.ts, bump deps, remove tinyhttp example