Skip to content

Commit 5b6cd69

Browse files
authored
Merge branch 'main' into inspector-v7
2 parents 4ac3916 + 791c025 commit 5b6cd69

File tree

33 files changed

+2138
-45
lines changed

33 files changed

+2138
-45
lines changed

.changeset/every-chefs-switch.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'hive': minor
3+
---
4+
5+
Introduce rate limiting for email sign up, sign in and password rest.
6+
The IP value to use for the rate limiting can be specified via the
7+
`SUPERTOKENS_RATE_LIMIT_IP_HEADER_NAME` environment variable.
8+
By default the `CF-Connecting-IP` header is being used.

packages/libraries/apollo/CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# @graphql-hive/apollo
22

3+
## 0.42.0
4+
5+
### Minor Changes
6+
7+
- [#7280](https://github.com/graphql-hive/console/pull/7280)
8+
[`2cc443c`](https://github.com/graphql-hive/console/commit/2cc443c160e11313c905424b63a7c1362121d8d8)
9+
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Support circuit breaking for usage reporting.
10+
11+
Circuit breaking is a fault-tolerance pattern that prevents a system from repeatedly calling a
12+
failing service. When errors or timeouts exceed a set threshold, the circuit “opens,” blocking
13+
further requests until the service recovers.
14+
15+
This ensures that during a network issue or outage, the service using the Hive SDK remains healthy
16+
and is not overwhelmed by failed usage reports or repeated retries.
17+
18+
```ts
19+
import { createClient } from '@graphql-hive/core'
20+
21+
const client = createClient({
22+
agent: {
23+
circuitBreaker: {
24+
/**
25+
* Count of requests before starting evaluating.
26+
* Default: 5
27+
*/
28+
volumeThreshold: 5,
29+
/**
30+
* Percentage of requests failing before the circuit breaker kicks in.
31+
* Default: 50
32+
*/
33+
errorThresholdPercentage: 1,
34+
/**
35+
* After what time the circuit breaker is attempting to retry sending requests in milliseconds
36+
* Default: 30_000
37+
*/
38+
resetTimeout: 10_000
39+
}
40+
}
41+
})
42+
```
43+
44+
### Patch Changes
45+
46+
- Updated dependencies
47+
[[`2cc443c`](https://github.com/graphql-hive/console/commit/2cc443c160e11313c905424b63a7c1362121d8d8)]:
48+
- @graphql-hive/core@0.15.0
49+
350
## 0.41.0
451

552
### Minor Changes

packages/libraries/apollo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-hive/apollo",
3-
"version": "0.41.0",
3+
"version": "0.42.0",
44
"type": "module",
55
"description": "GraphQL Hive + Apollo Server",
66
"repository": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version = '0.41.0';
1+
export const version = '0.42.0';

packages/libraries/cli/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @graphql-hive/cli
22

3+
## 0.53.4
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
[[`2cc443c`](https://github.com/graphql-hive/console/commit/2cc443c160e11313c905424b63a7c1362121d8d8)]:
9+
- @graphql-hive/core@0.15.0
10+
311
## 0.53.3
412

513
### Patch Changes

packages/libraries/cli/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ DESCRIPTION
8181
```
8282

8383
_See code:
84-
[src/commands/app/create.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/app/create.ts)_
84+
[src/commands/app/create.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/app/create.ts)_
8585

8686
## `hive app:publish`
8787

@@ -108,7 +108,7 @@ DESCRIPTION
108108
```
109109

110110
_See code:
111-
[src/commands/app/publish.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/app/publish.ts)_
111+
[src/commands/app/publish.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/app/publish.ts)_
112112

113113
## `hive app:retire`
114114

@@ -135,7 +135,7 @@ DESCRIPTION
135135
```
136136

137137
_See code:
138-
[src/commands/app/retire.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/app/retire.ts)_
138+
[src/commands/app/retire.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/app/retire.ts)_
139139

140140
## `hive artifact:fetch`
141141

@@ -159,7 +159,7 @@ DESCRIPTION
159159
```
160160

161161
_See code:
162-
[src/commands/artifact/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/artifact/fetch.ts)_
162+
[src/commands/artifact/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/artifact/fetch.ts)_
163163

164164
## `hive dev`
165165

@@ -202,7 +202,7 @@ DESCRIPTION
202202
```
203203

204204
_See code:
205-
[src/commands/dev.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/dev.ts)_
205+
[src/commands/dev.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/dev.ts)_
206206

207207
## `hive help [COMMAND]`
208208

@@ -246,7 +246,7 @@ DESCRIPTION
246246
```
247247

248248
_See code:
249-
[src/commands/introspect.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/introspect.ts)_
249+
[src/commands/introspect.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/introspect.ts)_
250250

251251
## `hive operations:check FILE`
252252

@@ -305,7 +305,7 @@ DESCRIPTION
305305
```
306306

307307
_See code:
308-
[src/commands/operations/check.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/operations/check.ts)_
308+
[src/commands/operations/check.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/operations/check.ts)_
309309

310310
## `hive schema:check FILE`
311311

@@ -349,7 +349,7 @@ DESCRIPTION
349349
```
350350

351351
_See code:
352-
[src/commands/schema/check.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/schema/check.ts)_
352+
[src/commands/schema/check.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/schema/check.ts)_
353353

354354
## `hive schema:delete SERVICE`
355355

@@ -381,7 +381,7 @@ DESCRIPTION
381381
```
382382

383383
_See code:
384-
[src/commands/schema/delete.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/schema/delete.ts)_
384+
[src/commands/schema/delete.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/schema/delete.ts)_
385385

386386
## `hive schema:fetch [COMMIT]`
387387

@@ -414,7 +414,7 @@ DESCRIPTION
414414
```
415415

416416
_See code:
417-
[src/commands/schema/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/schema/fetch.ts)_
417+
[src/commands/schema/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/schema/fetch.ts)_
418418

419419
## `hive schema:publish FILE`
420420

@@ -458,7 +458,7 @@ DESCRIPTION
458458
```
459459

460460
_See code:
461-
[src/commands/schema/publish.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/schema/publish.ts)_
461+
[src/commands/schema/publish.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/schema/publish.ts)_
462462

463463
## `hive update [CHANNEL]`
464464

@@ -520,7 +520,7 @@ DESCRIPTION
520520
```
521521

522522
_See code:
523-
[src/commands/whoami.ts](https://github.com/graphql-hive/platform/blob/v0.53.3/src/commands/whoami.ts)_
523+
[src/commands/whoami.ts](https://github.com/graphql-hive/platform/blob/v0.53.4/src/commands/whoami.ts)_
524524

525525
<!-- commandsstop -->
526526

packages/libraries/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-hive/cli",
3-
"version": "0.53.3",
3+
"version": "0.53.4",
44
"description": "A CLI util to manage and control your GraphQL Hive",
55
"repository": {
66
"type": "git",

packages/libraries/core/CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# @graphql-hive/core
22

3+
## 0.15.0
4+
5+
### Minor Changes
6+
7+
- [#7280](https://github.com/graphql-hive/console/pull/7280)
8+
[`2cc443c`](https://github.com/graphql-hive/console/commit/2cc443c160e11313c905424b63a7c1362121d8d8)
9+
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Support circuit breaking for usage reporting.
10+
11+
Circuit breaking is a fault-tolerance pattern that prevents a system from repeatedly calling a
12+
failing service. When errors or timeouts exceed a set threshold, the circuit “opens,” blocking
13+
further requests until the service recovers.
14+
15+
This ensures that during a network issue or outage, the service using the Hive SDK remains healthy
16+
and is not overwhelmed by failed usage reports or repeated retries.
17+
18+
```ts
19+
import { createClient } from '@graphql-hive/core'
20+
21+
const client = createClient({
22+
agent: {
23+
circuitBreaker: {
24+
/**
25+
* Count of requests before starting evaluating.
26+
* Default: 5
27+
*/
28+
volumeThreshold: 5,
29+
/**
30+
* Percentage of requests failing before the circuit breaker kicks in.
31+
* Default: 50
32+
*/
33+
errorThresholdPercentage: 1,
34+
/**
35+
* After what time the circuit breaker is attempting to retry sending requests in milliseconds
36+
* Default: 30_000
37+
*/
38+
resetTimeout: 10_000
39+
}
40+
}
41+
})
42+
```
43+
344
## 0.14.0
445

546
### Minor Changes

packages/libraries/core/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-hive/core",
3-
"version": "0.14.0",
3+
"version": "0.15.0",
44
"type": "module",
55
"repository": {
66
"type": "git",
@@ -39,15 +39,18 @@
3939
"typings": "dist/typings/index.d.ts",
4040
"scripts": {
4141
"build": "node ../../../scripts/generate-version.mjs && bob build",
42-
"check:build": "bob check"
42+
"check:build": "bob check",
43+
"typecheck": "tsc --noEmit"
4344
},
4445
"peerDependencies": {
4546
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
4647
},
4748
"dependencies": {
49+
"@graphql-hive/signal": "^2.0.0",
4850
"@graphql-tools/utils": "^10.0.0",
4951
"@whatwg-node/fetch": "^0.10.6",
5052
"async-retry": "^1.3.3",
53+
"events": "^3.3.0",
5154
"js-md5": "0.8.3",
5255
"lodash.sortby": "^4.7.0",
5356
"tiny-lru": "^8.0.2"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
*
3+
* Just a small playground to play around with different scenarios arounf the agent.
4+
* You can run it like this: `bun run --watch packages/libraries/core/playground/agent-circuit-breaker.ts`
5+
*/
6+
7+
import { createAgent } from '../src/client/agent.js';
8+
9+
let data: Array<{}> = [];
10+
11+
const agent = createAgent<{}>(
12+
{
13+
debug: true,
14+
endpoint: 'http://127.0.0.1',
15+
token: 'noop',
16+
async fetch(_url, _opts) {
17+
throw new Error('FAIL FAIL');
18+
// console.log('SENDING!');
19+
// return new Response('ok', {
20+
// status: 200,
21+
// });
22+
},
23+
circuitBreaker: {
24+
errorThresholdPercentage: 1,
25+
resetTimeout: 10_000,
26+
volumeThreshold: 0,
27+
},
28+
maxSize: 1,
29+
maxRetries: 1,
30+
},
31+
{
32+
body() {
33+
data = [];
34+
return String(data);
35+
},
36+
data: {
37+
clear() {
38+
data = [];
39+
},
40+
size() {
41+
return data.length;
42+
},
43+
set(d) {
44+
data.push(d);
45+
},
46+
},
47+
},
48+
);
49+
50+
setInterval(() => {
51+
agent.capture({});
52+
console.log('BURR BURT');
53+
}, 1_000);

0 commit comments

Comments
 (0)