Skip to content

Commit f266368

Browse files
changesets (#7346)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 1fae939 commit f266368

File tree

10 files changed

+207
-579
lines changed

10 files changed

+207
-579
lines changed

.changeset/big-pig-helps.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
'@graphql-hive/core': minor
3+
'@graphql-hive/apollo': minor
4+
'@graphql-hive/envelop': minor
5+
'@graphql-hive/yoga': minor
6+
---
7+
8+
Add support for providing a logger object via `HivePluginOptions`.
9+
10+
It is possible to provide the following options:
11+
12+
- **'trace'**
13+
- **'debug'**
14+
- **'info'** default
15+
- **'warn'**
16+
- **'error'**
17+
18+
```ts
19+
import { createHive } from '@graphql-hive/core'
20+
21+
const client = createHive({
22+
logger: 'info'
23+
})
24+
```
25+
26+
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.
27+
28+
```ts
29+
import { createHive } from '@graphql-hive/core'
30+
import { Logger } from '@graphql-hive/logger'
31+
32+
const client = createHive({
33+
logger: new Logger()
34+
})
35+
```
36+
37+
Head to our [Hive Logger documentation](https://the-guild.dev/graphql/hive/docs/logger) to learn more.
38+
39+
___
40+
41+
**The `HivePluginOptions.debug` option is now deprecated.** Instead, please use the `logger` option to control logging levels.
42+
43+
```diff
44+
import { createHive } from '@graphql-hive/core'
45+
46+
const client = createHive({
47+
- debug: process.env.DEBUG === "1",
48+
+ logger: process.env.DEBUG === "1" ? "debug" : "info",
49+
})
50+
```
51+
52+
**Note**: If the `logger` property is provided, the `debug` option is ignored.
53+
54+
___
55+
56+
**The `HivePluginOptions.agent.logger` option is now deprecated.** Instead, please provide
57+
`HivePluginOptions.logger`.
58+
59+
```diff
60+
import { createHive } from '@graphql-hive/core'
61+
62+
const logger = new Logger()
63+
64+
const client = createHive({
65+
agent: {
66+
- logger,
67+
},
68+
+ logger,
69+
})
70+
```
71+
72+
**Note**: If both options are provided, the `agent` option is ignored.

.changeset/brave-tigers-dance.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-hive/cli': patch
3+
---
4+
5+
Fixes an issue where schema changes containing escaped single-quoted strings were not handled correctly.

.changeset/calm-mails-sneeze.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
'@graphql-hive/core': minor
3+
'@graphql-hive/apollo': minor
4+
'@graphql-hive/yoga': minor
5+
---
6+
7+
**Persisted Documents Improvements**
8+
9+
Persisted documents now support specifying a mirror endpoint that will be used in case the main CDN
10+
is unreachable. Provide an array of endpoints to the client configuration.
11+
12+
```ts
13+
import { createClient } from '@graphql-hive/core'
14+
15+
const client = createClient({
16+
experimental__persistedDocuments: {
17+
cdn: {
18+
endpoint: [
19+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
20+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
21+
],
22+
accessToken: ''
23+
}
24+
}
25+
})
26+
```
27+
28+
In addition to that, the underlying logic for looking up documents now uses a circuit breaker. If a
29+
single endpoint is unreachable, further lookups on that endpoint are skipped.
30+
31+
The behaviour of the circuit breaker can be customized via the `circuitBreaker` configuration.
32+
33+
```ts
34+
import { createClient } from '@graphql-hive/core'
35+
36+
const client = createClient({
37+
experimental__persistedDocuments: {
38+
cdn: {
39+
endpoint: [
40+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
41+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
42+
],
43+
accessToken: ''
44+
},
45+
circuitBreaker: {
46+
// open circuit if 50 percent of request result in an error
47+
errorThresholdPercentage: 50,
48+
// start monitoring the circuit after 10 requests
49+
volumeThreshold: 10,
50+
// time before the backend is tried again after the circuit is open
51+
resetTimeout: 30_000
52+
}
53+
}
54+
})
55+
```

.changeset/loose-dots-learn.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@graphql-hive/cli': minor
3+
'hive': minor
4+
---
5+
6+
Upgrade graphql-inspector/core to v7 and update the models to be able to handle the new change
7+
objects. GraphQL Inspector now supports directive changes and improves the accuracy of the severity level for several change types. This will improve schema checks to make them more accurate and more complete. See graphql-inspector's changelog for details.

.changeset/nine-worlds-slide.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
'@graphql-hive/apollo': minor
3+
---
4+
5+
**Supergraph Manager Improvements**
6+
7+
Persisted documents now support specifying a mirror endpoint that will be used in case the main CDN
8+
is unreachable. Provide an array of endpoints to the supergraph manager configuration.
9+
10+
```ts
11+
import { createSupergraphManager } from '@graphql-hive/apollo'
12+
13+
const supergraphManager = createSupergraphManager({
14+
endpoint: [
15+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph',
16+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph'
17+
],
18+
key: ''
19+
})
20+
```
21+
22+
In addition to that, the underlying logic for looking up documents now uses a circuit breaker. If a
23+
single endpoint is unreachable, further lookups on that endpoint are skipped.
24+
25+
```ts
26+
import { createSupergraphManager } from '@graphql-hive/apollo'
27+
28+
const supergraphManager = createSupergraphManager({
29+
endpoint: [
30+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph',
31+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688/supergraph'
32+
],
33+
key: '',
34+
circuitBreaker: {
35+
// open circuit if 50 percent of request result in an error
36+
errorThresholdPercentage: 50,
37+
// start monitoring the circuit after 10 requests
38+
volumeThreshold: 10,
39+
// time before the backend is tried again after the circuit is open
40+
resetTimeout: 30_000
41+
}
42+
})
43+
```

.changeset/upset-lemons-reply.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@graphql-hive/core': minor
3+
---
4+
5+
**New CDN Artifact Fetcher**
6+
7+
We have a new interface for fetching CDN artifacts (such as supergraph and services) with a cache
8+
from the CDN. This fetcher supports providing a mirror endpoint and comes with a circuit breaker
9+
under the hood.
10+
11+
```ts
12+
const supergraphFetcher = createCDNArtifactFetcher({
13+
endpoint: [
14+
'https://cdn.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688',
15+
'https://cdn-mirror.graphql-hive.com/artifacts/v1/9fb37bc4-e520-4019-843a-0c8698c25688'
16+
],
17+
accessKey: ''
18+
})
19+
20+
supergraphFetcher.fetch()
21+
```
22+
23+
---
24+
25+
`createSupergraphSDLFetcher` is now deprecated. Please upgrade to use `createCDNArtifactFetcher`.

0 commit comments

Comments
 (0)