console/packages/libraries/core/CHANGELOG.md
TheGuildBot 4a805afd94
Upcoming Release Changes (#7345)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-01 14:24:32 +01:00

18 KiB

@graphql-hive/core

0.18.0

Minor Changes

  • #7346 f266368 Thanks @n1ru4l! - Add support for providing a logger object via HivePluginOptions.

    It is possible to provide the following options:

    • 'trace'
    • 'debug'
    • 'info' default
    • 'warn'
    • 'error'
    import { createHive } from '@graphql-hive/core'
    
    const client = createHive({
      logger: 'info'
    })
    

    In addition to that, it is also possible to provide a Hive Logger instance, that allows more control over how you want to log and forward logs.

    import { createHive } from '@graphql-hive/core'
    import { Logger } from '@graphql-hive/logger'
    
    const client = createHive({
      logger: new Logger()
    })
    

    Head to our Hive Logger documentation to learn more.


    The HivePluginOptions.debug option is now deprecated. Instead, please use the logger option to control logging levels.

     import { createHive } from '@graphql-hive/core'
    
     const client = createHive({
    -  debug: process.env.DEBUG === "1",
    +  logger: process.env.DEBUG === "1" ? "debug" : "info",
     })
    

    Note: If the logger property is provided, the debug option is ignored.


    The HivePluginOptions.agent.logger option is now deprecated. Instead, please provide HivePluginOptions.logger.

     import { createHive } from '@graphql-hive/core'
    
     const logger = new Logger()
    
     const client = createHive({
       agent: {
    -    logger,
       },
    +  logger,
     })
    

    Note: If both options are provided, the agent option is ignored.

  • #7346 f266368 Thanks @n1ru4l! - Persisted Documents Improvements

    Persisted documents now support specifying a mirror endpoint that will be used in case the main CDN is unreachable. Provide an array of endpoints to the client configuration.

    import { createClient } from '@graphql-hive/core'
    
    const client = createClient({
      experimental__persistedDocuments: {
        cdn: {
          endpoint: [
            'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
            'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
          ],
          accessToken: ''
        }
      }
    })
    

    In addition to that, the underlying logic for looking up documents now uses a circuit breaker. If a single endpoint is unreachable, further lookups on that endpoint are skipped.

    The behaviour of the circuit breaker can be customized via the circuitBreaker configuration.

    import { createClient } from '@graphql-hive/core'
    
    const client = createClient({
      experimental__persistedDocuments: {
        cdn: {
          endpoint: [
            'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
            'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
          ],
          accessToken: ''
        },
        circuitBreaker: {
          // open circuit if 50 percent of request result in an error
          errorThresholdPercentage: 50,
          // start monitoring the circuit after 10 requests
          volumeThreshold: 10,
          // time before the backend is tried again after the circuit is open
          resetTimeout: 30_000
        }
      }
    })
    
  • #7346 f266368 Thanks @n1ru4l! - New CDN Artifact Fetcher

    We have a new interface for fetching CDN artifacts (such as supergraph and services) with a cache from the CDN. This fetcher supports providing a mirror endpoint and comes with a circuit breaker under the hood.

    const supergraphFetcher = createCDNArtifactFetcher({
      endpoint: [
        'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
        'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
      ],
      accessKey: ''
    })
    
    supergraphFetcher.fetch()
    

    createSupergraphSDLFetcher is now deprecated. Please upgrade to use createCDNArtifactFetcher.

0.15.1

Patch Changes

0.15.0

Minor Changes

  • #7280 2cc443c Thanks @n1ru4l! - Support circuit breaking for usage reporting.

    Circuit breaking is a fault-tolerance pattern that prevents a system from repeatedly calling a failing service. When errors or timeouts exceed a set threshold, the circuit “opens,” blocking further requests until the service recovers.

    This ensures that during a network issue or outage, the service using the Hive SDK remains healthy and is not overwhelmed by failed usage reports or repeated retries.

    import { createClient } from '@graphql-hive/core'
    
    const client = createClient({
      agent: {
        circuitBreaker: {
          /**
           * Count of requests before starting evaluating.
           * Default: 5
           */
          volumeThreshold: 5,
          /**
           * Percentage of requests failing before the circuit breaker kicks in.
           * Default: 50
           */
          errorThresholdPercentage: 1,
          /**
           * After what time the circuit breaker is attempting to retry sending requests in milliseconds
           * Default: 30_000
           */
          resetTimeout: 10_000
        }
      }
    })
    

0.14.0

Minor Changes

  • #7264 582bc0e Thanks @n1ru4l! - Introduce debug log level. HTTP retry log pollute the error log. The retries are now logged to the debug level. In order to see debug logs set the debug option to true.

    const hive = createHive({
      debug: true
    })
    

    If you are using a custom logger, make sure to provide a debug logging method implementation.

    const hive = createHive({
      debug: true,
      agent: {
        logger: {
          info() {},
          error() {},
          debug() {}
        }
      }
    })
    

0.13.2

Patch Changes

  • #7253 43920cd Thanks @ardatan! - Allow to provide version to AgentOptions in Hive Client integrations.

    createHive({
      agent: {
        name: 'my-custom-agent',
        version: '1.2.3' // new field
      }
    })
    

    Currently you can provide name but not version. This change allows to provide both name and version to better identify the clients connecting to Hive Console. Previously the dependent libraries like Yoga, Envelop and Hive Gateway integrations were incorrectly sending their names with the version of @graphql-hive/core package. Now they will be able to send their own versions.

  • #7253 43920cd Thanks @ardatan! - Accept name and version to createSupergraphSDLFetcher to build a more accurate user agent instead of passing hive-client with @graphql-hive/core's version

0.13.1

Patch Changes

  • #7248 d8f6e25 Thanks @n1ru4l! - Support project and personal access tokens (hvp1/ and hvu1/).

0.13.0

Minor Changes

  • #6876 8d56b98 Thanks @n1ru4l! - Add helper function hashOperation for generating consistent hashes used within the Hive Console platform.

0.12.0

Minor Changes

  • #6764 bbd5643 Thanks @jdolle! - Track provided operation arguments/inputs and use them to determine conditional breaking changes; Fix null to non-null argument breaking change edge case"

0.11.0

Minor Changes

  • #6637 5130fc1 Thanks @n1ru4l! - Add error logging for invalid combinations of the target and token configuration.

    • Please make sure to provide the target option for usage reporting when using a token that starts with hvo1/.
    • Please make sure to not provide a target option for usage reporting when a token does not start with hvo1/

0.10.1

Patch Changes

  • #6606 ee70018 Thanks @enisdenjo! - Client can be used only for experimental persisted documents

  • #6623 a003f78 Thanks @ardatan! - Use ranged versions in dependencies to prevent multiple versions of the same package

0.10.0

Minor Changes

  • #6574 494697e Thanks @n1ru4l! - Add support for providing a target for usage reporting with organization access tokens. This can either be a slug following the format $organizationSlug/$projectSlug/$targetSlug (e.g the-guild/graphql-hive/staging) or an UUID (e.g. a0f4c605-6541-4350-8cfe-b31f21a4bf80)

    import { createHive } from '@graphql-hive/core'
    
    const hive = createHive({
      enabled: true,
      token: 'ORGANIZATION_ACCESS_TOKEN',
      usage: {
        target: 'my-org/my-project/my-target'
      }
    })
    

0.9.1

Patch Changes

  • #6494 ae2d16d Thanks @n1ru4l! - Replace usage of crypto.randomUUID() with a custom UUID generation for better backwards compatability.

0.9.0

Minor Changes

  • #6488 f7d65fe Thanks @n1ru4l! - Include and log a x-request-id header for all requests sent to the Hive API. This helps users to share more context with Hive staff when encountering errors.

0.8.4

Patch Changes

0.8.3

Patch Changes

  • #6118 039c66b Thanks @ardatan! - Remove internal _testing_ option to replace the underlying fetch implementation, and add fetch option to do the same as part of the public API.

0.8.2

Patch Changes

0.8.1

Patch Changes

0.8.0

Minor Changes

  • #5401 3ffdb6e Thanks @n1ru4l! - Deduplicate persisted document lookups from the registry for reducing the amount of concurrent HTTP requests.

0.7.1

Patch Changes

0.7.0

Minor Changes

Patch Changes

  • #5361 3f03e7b Thanks @kamilkisiela! - Fixed issue where usage reports were sent only on app disposal or max batch size, now also sent at set intervals.

0.6.1

Patch Changes

  • #5304 f2fef08 Thanks @kamilkisiela! - Fixed a logging issue where both initiated requests and successful responses were being recorded. This was causing the logs to be filled with unnecessary information and affected hive artifact:fetch --artifact command.

0.6.0

Minor Changes

0.5.0

Minor Changes

0.4.0

Minor Changes

0.3.1

Patch Changes

  • #4932 cbc8364 Thanks @n1ru4l! - Prevent failing usage reporting when returning an object with additional properties aside from name and version from the client info object/factory function.

0.3.0

Minor Changes

0.2.4

Patch Changes

0.2.3

Patch Changes

0.2.2

Patch Changes

0.2.1

Patch Changes

  • 0a5dbeb: Point to graphql-hive.com

0.2.0

Minor Changes

  • ac9b868c: Support GraphQL v16

0.1.0

Minor Changes

  • d7348a3: Hide literals and remove aliases

Patch Changes

  • d7348a3: Pick operation name from DocumentNode

0.0.5

Patch Changes

  • c6ef3d2: Bob update

0.0.4

Patch Changes

  • 4a7c569: Share operation hashing

0.0.3

Patch Changes

  • 6b74355: Fix sorting

0.0.2

Patch Changes

  • 094c861: Normalization of operations