Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
23 KiB
@graphql-hive/yoga
0.47.0
Minor Changes
-
#7462
60133a4Thanks @adambenhassen! - Add Layer 2 (L2) cache support for persisted documents.This feature adds a second layer of caching between the in-memory cache (L1) and the CDN for persisted documents. This is particularly useful for:
- Serverless environments: Where in-memory cache is lost between invocations
- Multi-instance deployments: To share cached documents across server instances
- Reducing CDN calls: By caching documents in Redis or similar external caches
The lookup flow is: L1 (memory) -> L2 (Redis/external) -> CDN
Example with GraphQL Yoga:
import { createYoga } from 'graphql-yoga' import { createClient } from 'redis' import { useHive } from '@graphql-hive/yoga' const redis = createClient({ url: 'redis://localhost:6379' }) await redis.connect() const yoga = createYoga({ plugins: [ useHive({ experimental__persistedDocuments: { cdn: { endpoint: 'https://cdn.graphql-hive.com/artifacts/v1/<target_id>', accessToken: '<cdn_access_token>' }, layer2Cache: { cache: { get: key => redis.get(`hive:pd:${key}`), set: (key, value, opts) => redis.set(`hive:pd:${key}`, value, opts?.ttl ? { EX: opts.ttl } : {}) }, ttlSeconds: 3600, // 1 hour for found documents notFoundTtlSeconds: 60 // 1 minute for not-found (negative caching) } } }) ] })Features:
- Configurable TTL for found documents (
ttlSeconds) - Configurable TTL for negative caching (
notFoundTtlSeconds) - Graceful fallback to CDN if L2 cache fails
- Support for
waitUntilin serverless environments - Apollo Server integration auto-uses context cache if available
Patch Changes
- Updated dependencies
[
60133a4]:- @graphql-hive/core@0.20.0
0.46.1
Patch Changes
0.46.0
Minor Changes
-
#7346
f266368Thanks @n1ru4l! - Add support for providing a logger object viaHivePluginOptions.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.debugoption is now deprecated. Instead, please use theloggeroption 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
loggerproperty is provided, thedebugoption is ignored.
The
HivePluginOptions.agent.loggeroption is now deprecated. Instead, please provideHivePluginOptions.logger.import { createHive } from '@graphql-hive/core' const logger = new Logger() const client = createHive({ agent: { - logger, }, + logger, })Note: If both options are provided, the
agentoption is ignored. -
#7346
f266368Thanks @n1ru4l! - Persisted Documents ImprovementsPersisted 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
circuitBreakerconfiguration.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 } } })
Patch Changes
0.43.1
Patch Changes
- Updated dependencies
[
64c8368]:- @graphql-hive/core@0.15.1
0.43.0
Minor Changes
-
#7280
2cc443cThanks @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 } } })
Patch Changes
- Updated dependencies
[
2cc443c]:- @graphql-hive/core@0.15.0
0.42.5
Patch Changes
- Updated dependencies
[
582bc0e]:- @graphql-hive/core@0.14.0
0.42.4
Patch Changes
-
#7253
43920cdThanks @ardatan! - Send correct version of the client packages, previously they were sending the version of@graphql-hive/corepackage. -
Updated dependencies [
43920cd,43920cd]:- @graphql-hive/core@0.13.2
0.42.3
Patch Changes
-
#7248
d8f6e25Thanks @n1ru4l! - Support project and personal access tokens (hvp1/andhvu1/). -
Updated dependencies [
d8f6e25]:- @graphql-hive/core@0.13.1
0.42.2
Patch Changes
- Updated dependencies
[
8d56b98]:- @graphql-hive/core@0.13.0
0.42.1
Patch Changes
- Updated dependencies
[
bbd5643]:- @graphql-hive/core@0.12.0
0.42.0
Minor Changes
-
#6637
5130fc1Thanks @n1ru4l! - Add error logging for invalid combinations of thetargetandtokenconfiguration.- Please make sure to provide the
targetoption for usage reporting when using a token that starts withhvo1/. - Please make sure to not provide a
targetoption for usage reporting when a token does not start withhvo1/
- Please make sure to provide the
Patch Changes
- Updated dependencies
[
5130fc1]:- @graphql-hive/core@0.11.0
0.41.1
Patch Changes
0.41.0
Minor Changes
-
#6574
494697eThanks @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.gthe-guild/graphql-hive/staging) or an UUID (e.g.a0f4c605-6541-4350-8cfe-b31f21a4bf80)import { useHive } from '@graphql-hive/yoga' const hivePlugin = useHive({ enabled: true, token: 'ORGANIZATION_ACCESS_TOKEN', usage: { target: 'my-org/my-project/my-target' } })
Patch Changes
- Updated dependencies
[
494697e]:- @graphql-hive/core@0.10.0
0.40.1
Patch Changes
- Updated dependencies
[
ae2d16d]:- @graphql-hive/core@0.9.1
0.40.0
Minor Changes
- #6488
f7d65feThanks @n1ru4l! - Include and log ax-request-idheader for all requests sent to the Hive API. This helps users to share more context with Hive staff when encountering errors.
Patch Changes
- Updated dependencies
[
f7d65fe]:- @graphql-hive/core@0.9.0
0.39.4
Patch Changes
-
#6473
bba81deThanks @n1ru4l! - Correctly extract client information when using the response cache plugin.The client information was not reported for GraphQL responses served from the response cache plugin.
0.39.3
Patch Changes
-
#6383
ec356a7Thanks @kamilkisiela! - Collect custom scalars from arguments and input object fields -
Updated dependencies [
ec356a7]:- @graphql-hive/core@0.8.4
0.39.2
Patch Changes
-
#6118
039c66bThanks @ardatan! - Remove internal_testing_option to replace the underlyingfetchimplementation, and addfetchoption to do the same as part of the public API. -
#6118
039c66bThanks @ardatan! - - Upgrade tographql-yoga>=5.10.4- Improve graceful process termination on Node.js by leveraging
graphql-yoga's dispose lifecycle hooks - Improve Cloudflare Worker runtime support by registering pending usage reporting requests using
the
waitUntilAPI - Use the logger instance from the
graphql-yogainstance, for a more unified logging experience - Use the
fetchAPI implementation on thegraphql-yogainstance for HTTP calls - Replace the internal `tiny-lru` dependency with
graphql-yoga's internal LRU cache implementation
- Improve graceful process termination on Node.js by leveraging
-
Updated dependencies [
039c66b]:- @graphql-hive/core@0.8.3
0.39.1
Patch Changes
- #6057
e4f8b0aThanks @kamilkisiela! - Explain what Hive is in README
0.39.0
Minor Changes
Patch Changes
0.38.2
Patch Changes
-
#5676
c728803Thanks @kamilkisiela! - Correct collection of enum values when used in a list -
Updated dependencies [
c728803]:- @graphql-hive/core@0.8.2
0.38.1
Patch Changes
-
#5667
be5d39cThanks @kamilkisiela! - Report enum values when an enum is used as an output type -
Updated dependencies [
be5d39c]:- @graphql-hive/core@0.8.1
0.38.0
Minor Changes
- #5568
581e84fThanks @n1ru4l! - support resolvingdocumentIdprovided via search params for GET request
0.37.0
Minor Changes
- #5401
3ffdb6eThanks @n1ru4l! - Deduplicate persisted document lookups from the registry for reducing the amount of concurrent HTTP requests.
Patch Changes
- Updated dependencies
[
3ffdb6e]:- @graphql-hive/core@0.8.0
0.36.0
Minor Changes
- #5367
a896642Thanks @kamilkisiela! - Add createSupergraphSDLFetcher to /yoga
Patch Changes
- Updated dependencies
[
a896642]:- @graphql-hive/core@0.7.1
0.35.0
Minor Changes
Patch Changes
- #5361
3f03e7bThanks @kamilkisiela! - Fixed issue where usage reports were sent only on app disposal or max batch size, now also sent at set intervals. - Updated dependencies
[
3f03e7b,0a3b24d]:- @graphql-hive/core@0.7.0
0.34.1
Patch Changes
-
#5304
f2fef08Thanks @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 affectedhive artifact:fetch --artifactcommand. -
Updated dependencies [
f2fef08]:- @graphql-hive/core@0.6.1
0.34.0
Minor Changes
Patch Changes
- Updated dependencies
[
e6dc5c9]:- @graphql-hive/core@0.6.0
0.33.3
Patch Changes
- Updated dependencies
[
f1e43c6]:- @graphql-hive/core@0.5.0
0.33.2
Patch Changes
-
#5097
b8998e7Thanks @kamilkisiela! - Use built-in retry of http client of the core package -
Updated dependencies [
b8998e7]:- @graphql-hive/core@0.4.0
0.33.1
Patch Changes
- #4932
cbc8364Thanks @n1ru4l! - Prevent failing usage reporting when returning an object with additional properties aside fromnameandversionfrom the client info object/factory function. - Updated dependencies
[
cbc8364]:- @graphql-hive/core@0.3.1
0.33.0
Minor Changes
-
#4573
06d465eThanks @kamilkisiela! - Break@graphql-hive/clientinto library-specific packages:@graphql-hive/core- Core functionality@graphql-hive/apollo- Apollo Client integration@graphql-hive/yoga- Yoga Server integration@graphql-hive/envelop- Envelop integration
Migration steps are available in the README of each package.
-
#4494
c5eeac5Thanks @kamilkisiela! - 🚨 BREAKING CHANGE 🚨 Requires now Node v16+ -
#4573
06d465eThanks @kamilkisiela! - 🚨 BREAKING CHANGE 🚨useYogaHive,createYogaHiveis nowuseHiveandcreateHiveMigration
Migration steps are available in the README.
- import { useYogaHive, createYogaHive } from '@graphql-hive/client'; + import { useHive, createHive } from '@graphql-hive/yoga';