Skip to content

Releases: dotansimha/graphql-yoga

August 15, 2024

15 Aug 22:45
1fbc07d
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

[email protected]

Minor Changes

  • #3331
    5dae4ab
    Thanks @EmrysMyrddin! - Expose server context in
    onResultProcessHook. In particular, this gives access to the waitUntil method to cleanly
    handle hanging promises.

  • #3331
    5dae4ab
    Thanks @EmrysMyrddin! - New hook: onExecutionResult which is
    triggered when an execution is done on the pipeline. If it is a batched operation, this is called
    per each operation in the batch

  • #3331
    5dae4ab
    Thanks @EmrysMyrddin! - Expose the already existing waitUntil
    method from the server context.

Patch Changes

@graphql-yoga/[email protected]

Minor Changes

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

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

Read more

August 14, 2024

14 Aug 11:37
d2e4557
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

Major Changes

  • #3391
    0788d8a
    Thanks @EmrysMyrddin! - Breaking Change: Rename all metrics
    options to their actual metric name to avoid confusion.

    All metric options have been moved under a mandatory metrics key, and the name of each options
    have been renamed to match the default metric name.

    The plugin option argument is also now mandatory.

    export const serveConfig = defineConfig({
      plugins: pluginCtx => [
        usePrometheus({
          ...pluginCtx,
    
          // Enable all available metrics
    -     http: true
    -     requestSummary: true,
    -     parse: true,
    -     validate: true,
    -     contextBuilding: true,
    -     execute: true,
    -     subscribe: true,
    -     errors: true,
    -     deprecatedFields: true,
    -     requestTotalDuration: true,
    -     schemaChangeCount: true,
    
          // Warning: enabling resolvers level metrics will introduce significant overhead
    -     resolvers: true,
    +     metrics: {
    +       graphql_yoga_http_duration: true,
    +       graphql_envelop_request_time_summary: true,
    +       graphql_envelop_phase_parse: true,
    +       graphql_envelop_phase_validate: true,
    +       graphql_envelop_phase_context: true,
    +       graphql_envelop_phase_execute: true,
    +       graphql_envelop_phase_subscribe: true,
    +       graphql_envelop_error_result: true,
    +       graphql_envelop_deprecated_field: true,
    +       graphql_envelop_request_duration: true,
    +       graphql_envelop_schema_change: true,
    
            // Warning: enabling resolvers level metrics will introduce significant overhead
    +       graphql_envelop_execute_resolver: true,
    +     }
        })
      ]
    })
  • #3408
    88393b3
    Thanks @dotansimha! - By default, the following metrics are now
    enabled:

    • graphql_envelop_deprecated_field
    • graphql_envelop_request
    • graphql_envelop_request_duration
    • graphql_envelop_request_time_summary
    • graphql_envelop_phase_parse
    • graphql_envelop_phase_validate
    • graphql_envelop_phase_context
    • graphql_envelop_error_result
    • graphql_envelop_phase_execute
    • graphql_envelop_phase_subscribe
    • graphql_envelop_schema_change
    • graphql_yoga_http_duration

Minor Changes

  • #3391
    0788d8a
    Thanks @EmrysMyrddin! - Add missing labels path and phase
    of graphql_envelop_error_result metric to the configuration.

    Add missing labels method and statusCode of graphql_yoga_http_duration metric to the
    configuration.

Patch Changes

August 04, 2024

04 Aug 03:40
f7b64d8
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

[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

@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

July 25, 2024

25 Jul 17:30
aa8237d
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

[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

@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

July 24, 2024

24 Jul 00:52
85752ac
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

Patch Changes

July 18, 2024

18 Jul 05:58
855600c
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

[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]

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. ❌ The jwksUri + 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 on jsonwebtoken library). ✅ Better defaults for token
    algorithm verification (before: RS256, after: RS256 and HS256)

    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

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

Read more

July 01, 2024

01 Jul 11:02
19fa816
Compare
Choose a tag to compare

@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 than query, operationName, extensions, and variables, then
    throws 400 HTTP Error. This change adds a new option called extraParamNames 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

@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

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

June 30, 2024

30 Jun 01:54
66bef8a
Compare
Choose a tag to compare

@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 returns Response to the landingPage option

    import { 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

@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

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

June 18, 2024

18 Jun 09:31
f32ad6d
Compare
Choose a tag to compare

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

Patch Changes

@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

[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

@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

Read more

May 08, 2024

08 May 09:18
f99322f
Compare
Choose a tag to compare

[email protected]

Patch Changes

@graphql-yoga/[email protected]

@graphql-yoga/[email protected]

[email protected]

Patch Changes

  • #3237
    3324bbab
    Thanks @ardatan! - dependencies updates:

  • #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 actual Request object from the execution context. Now Yoga ensures that the request
    in the context is the same with the actual Request.

@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]

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 and createCounter 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

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes

@graphql-yoga/[email protected]

Patch Changes