Releases: dotansimha/graphql-yoga
July 18, 2024
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- #3345
c6f3900
Thanks @renovate! - dependencies updates:- Updated dependency
@urql/core@^5.0.0
↗︎
(from^3.0.0 || ^4.0.0
, inpeerDependencies
)
- Updated dependency
@graphql-yoga/[email protected]
Patch Changes
-
#3338
4252e3d
Thanks @ardatan! - dependencies updates:- Added dependency
[email protected]
↗︎ (to
dependencies
)
- Added dependency
-
#3346
e98970a
Thanks @renovate! - dependencies updates:- Updated dependency
@graphiql/plugin-explorer@^3.0.0
↗︎
(from^1.0.3
, independencies
)
- Updated dependency
[email protected]
Patch Changes
- #3338
4252e3d
Thanks @ardatan! - dependencies updates:- Updated dependency
@whatwg-node/server@^0.9.36
↗︎
(from^0.9.33
, independencies
)
- Updated dependency
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies []:
- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Major Changes
-
#3366
057ad06
Thanks @dotansimha! - Re-write for the JWT plugin. This plugin
can be configured now with multiple providers, lookup locations, token verification, and more.The version has better version coverage, and it provides an improved API for configuring provider
and custom behaviors.Breaking Change: New Plugin Configuration
Signing key providers
❌ The
signingKey
option has be removed. ❌ ThejwksUri
+jwksOpts
options has been removed.
✅ Multiple signing key providers and support for fallbacks (singingKeyProviders[]
). ✅ Improved
API for defining signing key configuration. ✅ Better defaults for caching and rate-limiting for
remote JWKS providers.Before
useJWT({ signingKey: "...", // or jwksUri: "http://example.com/..." jwksOpts: { // ... } })
After
import { createInlineSigningKeyProvider, createRemoteJwksSigningKeyProvider, useJWT } from '@graphql-yoga/plugin-jwt' useJWT({ // Pass one or more providers singingKeyProviders: [ createRemoteJwksSigningKeyProvider({ // ... }) // This one also acts as a fallback in case of a fetching issue with the 1st provider createInlineSigningKeyProvider({ signingKey: "..."}) ] })
Improved Token Lookup
❌ Removed
getToken
option from the root config. ✅ Added support for autmatically extracting
the JWT token from cookie or header. ✅ Easier setup for extracting from multiple locations. ✅
getToken
is still available for advanced use-cases, you can pass a custom function to
lookupLocations
.Before
useJWT({ getToken: payload => payload.request.headers.get('...') })
After
With built-in extractors:
imoprt { extractFromHeader, extractFromCookie, useJWT } from '@graphql-yoga/plugin-jwt' const yoga = createYoga({ // ... plugins: [ useCookies(), // Required if "extractFromCookie" is used. useJWT({ lookupLocations: [ extractFromHeader({ name: 'authorization', prefix: 'Bearer' }), extractFromHeader({ name: 'x-legacy-auth' }), extractFromHeader({ name: 'x-api-key', prefix: 'API-Access' }), extractFromCookie({ name: 'browserAuth' }) ] }) ] })
With a custom
getToken
:useJWT({ lookupLocations: [payload => payload.request.headers.get('...')] })
Improved Verification Options
❌ Removed root-level config
algorithms
+audience
+issuer
flags. ✅ Easy API for
customizing token verifications (based onjsonwebtoken
library). ✅ Better defaults for token
algorithm verification (before:RS256
, after:RS256
andHS256
)Before
useJWT({ algorithms: ['RS256'], audience: 'my.app', issuer: 'http://my-issuer' })
After
useJWT({ tokenVerification: { algorithms: ['RS256', 'HS256'], audience: 'my.app', issuer: 'http://my-issuer' // You can pass more options to `jsonwebtoken.verify("...", options)` here } })
Customized Token Rejection
✅ New config flag
reject: { ... }
for configuring how to handle a missing or invalid tokens
(enbaled by default).useJWT({ reject: { missingToken: true, invalidToken: true } })
Flexible Context Injection
❌ Removed root-level config
extendContextField
flags. ✅ Added root-level config
extendContext
(boolean
/string
) ✅ Token and payload are injected now to the context
(structure:{ payload: {}, token: { value, prefix }}
)Before
useJWT({ reject: { extendContextField: true } })
After
// Can be a boolean. By default injects to "context.jwt" field useJWT({ reject: { extendContext: true } }) // Or an object to customize the field name useJWT({ reject: { extendContext: 'myJwt' } })
Patch Changes
- #3366
057ad06
Thanks @dotansimha! - dependencies updates:- Added dependency
@whatwg-node/[email protected]
↗︎
(todependencies
)
- Added dependency
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
-
#3339
f245472
Thanks @ziolekjj! - IncludeoperationName
in context params for
persisted operations -
Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[4252e3d
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[[4252e3d
](4252e3d0e664e3c247c709c...
July 01, 2024
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
[email protected]
Minor Changes
-
#3333
9f3f945
Thanks @ardatan! - By default, Yoga does not allow extra parameters
in the request body other thanquery
,operationName
,extensions
, andvariables
, then
throws 400 HTTP Error. This change adds a new option calledextraParamNames
to allow extra
parameters in the request body.import { createYoga } from 'graphql-yoga' const yoga = createYoga({ /* other options */ extraParamNames: ['extraParam1', 'extraParam2'] }) const res = await yoga.fetch('/graphql', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ query: 'query { __typename }', extraParam1: 'value1', extraParam2: 'value2' }) }) console.assert(res.status === 200)
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies []:
- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[9f3f945
]:
June 30, 2024
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
[email protected]
Minor Changes
-
#3332
0208024
Thanks @ardatan! - Customize the landing page by passing a custom
renderer that returnsResponse
to thelandingPage
optionimport { createYoga } from 'graphql-yoga' const yoga = createYoga({ landingPage: ({ url, fetchAPI }) => { return new fetchAPI.Response( /* HTML */ ` <!doctype html> <html> <head> <title>404 Not Found</title> </head> <body> <h1>404 Not Found</h1> <p>Sorry, the page (${url.pathname}) you are looking for could not be found.</p> </body> </html> `, { status: 404, headers: { 'Content-Type': 'text/html' } } ) } })
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies []:
- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[0208024
]:
June 18, 2024
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- #3300
fdd902c
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@graphql-yoga/typed-event-target@workspace:^
↗︎
(from^3.0.0
, independencies
)
- Updated dependency
@graphql-yoga/[email protected]
Minor Changes
-
#3314
d5dfe99
Thanks @EmrysMyrddin! - Allow for full customization of the
GraphiQL page.Props from the
YogaGraphiQL
are now forwarded to the underlying GraphiQL components.The
graphiql
option field type of the Yoga server as also been updated to document which options
are configurable from the server side. Only serializable options are available. -
#3255
7335a82
Thanks @nissy-dev! - support shouldPersistHeaders option in
GraphiQL plugin
Patch Changes
- #3279
5a40b2b
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@graphiql/plugin-explorer@^1.0.3
↗︎
(from^0.1.4
, independencies
) - Updated dependency
@graphiql/[email protected]
↗︎ (from
0.8.4
, independencies
) - Updated dependency
@graphql-tools/[email protected]
↗︎
(from8.0.1
, independencies
) - Updated dependency
[email protected]
↗︎ (from
2.0.7
, independencies
) - Updated dependency
[email protected]
↗︎ (from
16.6.0
, independencies
)
- Updated dependency
[email protected]
Minor Changes
-
#3314
d5dfe99
Thanks @EmrysMyrddin! - Allow for full customization of the
GraphiQL page.Props from the
YogaGraphiQL
are now forwarded to the underlying GraphiQL components.The
graphiql
option field type of the Yoga server as also been updated to document which options
are configurable from the server side. Only serializable options are available. -
#3255
7335a82
Thanks @nissy-dev! - support shouldPersistHeaders option in
GraphiQL plugin
Patch Changes
-
#3325
4cd43b9
Thanks @n1ru4l! - Fix TypeScript compatibility withtype: "module"
. -
#3300
fdd902c
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@graphql-yoga/logger@workspace:^
↗︎
(from^2.0.0
, independencies
) - Updated dependency
@graphql-yoga/subscription@workspace:^
↗︎
(from^5.0.0
, independencies
)
- Updated dependency
-
#3270
f9aa1cd
Thanks @andrew0! - Retain server context prototype for batched
requests -
Updated dependencies
[fdd902c
]:- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- #3300
fdd902c
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
graphql-yoga@workspace:^
↗︎ (from
^5.3.1
, inpeerDependencies
)
- Updated dependency
- Updated dependencies
[4cd43b9
,
fdd902c
,
d5dfe99
,
7335a82
,
f9aa1cd
]:
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[fdd902c
,
fdd902c
]:- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- #3300
fdd902c
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
graphql-yoga@workspace:^
↗︎ (from
^5.3.1
, inpeerDependencies
)
- Updated dependency
- Updated dependencies
[4cd43b9
,
fdd902c
,
d5dfe99
,
7335a82
,
f9aa1cd
]:
@graphql-yoga/[email protected]
Patch Changes
- #3328
9b468ec
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@graphql-tools/[email protected]
↗︎
(from^2.0.0
, independencies
)
- Updated dependency
- Updated dependencies
[4cd43b9
,
fdd902c
,
d5dfe99
,
7335a82
,
f9aa1cd
]:
@graphql-yoga/[email protected]
Patch Changes
- #3300
fdd902c
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
graphql-yoga@workspace:^
↗︎ (from
^5.3.1
, inpeerDependencies
)
- Updated dependency
- Updated dependencies
[4cd43b9
,
fdd902c
,
d5dfe99
,
7335a82
,
f9aa1cd
]:
@graphql-yoga/[email protected]
Patch Changes
- #3300
fdd902c
Thanks [@EmrysMyrddin](https://github.com/Emr...
May 08, 2024
[email protected]
Patch Changes
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
[email protected]
Patch Changes
-
#3237
3324bbab
Thanks @ardatan! - dependencies updates:- Updated dependency
@whatwg-node/server@^0.9.33
↗︎
(from^0.9.32
, independencies
)
- Updated dependency
-
#3237
3324bbab
Thanks @ardatan! - In such environments like CloudFlare Workers, the
request
object in the context always has the initial request object, so it was impossible to
access the actualRequest
object from the execution context. Now Yoga ensures that therequest
in the context is the same with the actualRequest
.
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies []:
- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Major Changes
-
#3251
a8ddac54
Thanks @EmrysMyrddin! - Adds a cache for metrics definition
(Summary, Histogram and Counter).Fixes an issue preventing this plugin to be initialized multiple times, leading to metrics
duplication error (ardatan/graphql-mesh#6545).Behavior Breaking Change:
Due to Prometheus client API limitations, a metric is only defined once for a given registry. This
means that if the configuration of the metrics, it will be silently ignored on plugin
re-initialization.This is to avoid potential loss of metrics data produced between the plugin re-initialization and
the last pull by the prometheus agent.If you need to be sure metrics configuration is up to date after a plugin re-initialization, you
can either:- restart the whole node process instead of just recreating a graphql server at runtime
- clear the registry using
registry.clear()
before plugin re-initialization:function usePrometheusWithReset() { registry.clear() return usePrometheus({ ... }) }
- use a new registry for each plugin instance:
function usePrometheusWithRegistry() { const registry = new Registry() return usePrometheus({ registry, ... }) }
Keep in mind that this implies potential data loss in pull mode.
API Breaking Change:
To ensure metrics from being registered multiple times on the same registry, the signature of
createHistogram
,createSummary
andcreateCounter
have been changed to now include the
registry as a mandatory parameter.If you were customizing metrics parameters, you will need to update the metric definitions
usePrometheus({ execute: createHistogram({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), requestCount: createCounter({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), requestSummary: createSummary({ + registry: registry histogram: new Histogram({ name: 'my_custom_name', help: 'HELP ME', labelNames: ['opText'] as const, - registers: [registry], }), fillLabelsFn: () => {} }), })
Patch Changes
- #3251
a8ddac54
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/prometheus@^10.0.0
↗︎
(from^9.4.0
, independencies
)
- Updated dependency
- Updated dependencies
[3324bbab
,
3324bbab
]:
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
March 29, 2024
[email protected]
Patch Changes
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
[email protected]
Minor Changes
-
#3197
f775b341
Thanks @n1ru4l! - Experimental support for aborting GraphQL execution
when the HTTP request is canceled.The execution of subsequent GraphQL resolvers is now aborted if the incoming HTTP request is
canceled from the client side. This reduces the load of your API in case incoming requests with
deep GraphQL operation selection sets are canceled.import { createYoga, useExecutionCancellation } from 'graphql-yoga' const yoga = createYoga({ plugins: [useExecutionCancellation()] })
Action Required In order to benefit from this new feature, you need to update your integration
setup for Fastify, Koa and Hapi.- const response = await yoga.handleNodeRequest(req, { ... }) + const response = await yoga.handleNodeRequestAndResponse(req, res, { ... })
Please refer to the corresponding integration guides for examples.
Patch Changes
-
#3197
f775b341
Thanks @n1ru4l! - dependencies updates:- Updated dependency
@graphql-tools/executor@^1.2.5
↗︎
(from^1.2.2
, independencies
) - Updated dependency
@whatwg-node/fetch@^0.9.17
↗︎
(from^0.9.7
, independencies
) - Updated dependency
@whatwg-node/server@^0.9.32
↗︎
(from^0.9.1
, independencies
)
- Updated dependency
-
#3214
f89a1aa2
Thanks @n1ru4l! - Always include empty data payload for final
complete
event of SSE stream responses to ensure
EventSource
compatibility. See
the
GraphQL over SSE protocol
for more information.
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies
[f775b341
]:- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
- #3197
f775b341
Thanks @n1ru4l! - dependencies updates:- Updated dependency
@whatwg-node/fetch@^0.9.17
↗︎
(from^0.9.7
, inpeerDependencies
)
- Updated dependency
- Updated dependencies
[f775b341
,
f775b341
,
f89a1aa2
]:
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
March 13, 2024
[email protected]
Patch Changes
@graphql-yoga/[email protected]
@graphql-yoga/[email protected]
[email protected]
Minor Changes
- #3196
71db7548
Thanks @n1ru4l! - Allow setting async iterable withinonParams
hook
setResult
function
Patch Changes
- #3196
71db7548
Thanks @n1ru4l! - dependencies updates:- Updated dependency
@graphql-tools/executor@^1.2.2
↗︎
(from^1.0.0
, independencies
) - Updated dependency
@graphql-tools/utils@^10.1.0
↗︎
(from^10.0.0
, independencies
)
- Updated dependency
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
- Updated dependencies []:
- @graphql-yoga/[email protected]
- @graphql-yoga/[email protected]
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Minor Changes
- #3183
6725f8e7
Thanks @n1ru4l! - Inject request intoextractPersistedOperationId
function for allowing to extract the ID based on request header, query parameters or request path.
Patch Changes
@graphql-yoga/[email protected]
Minor Changes
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
-
#3181
35387c04
Thanks @gilgardosh! - Type fix to match
@envelop/response-cache-redis
@graphql-yoga/[email protected]
Patch Changes
@graphql-yoga/[email protected]
Patch Changes
February 04, 2024
@graphql-yoga/[email protected]
Major Changes
- #3179
7dc37e62
Thanks @darren-west! - Removed labels that cause high
cardinality