Skip to content

Commit 9d08369

Browse files
committed
Add hive usage reporting
1 parent 9c2980c commit 9d08369

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@fastify/cors": "^9.0.1",
4343
"@ffprobe-installer/ffprobe": "^2.1.2",
4444
"@golevelup/nestjs-discovery": "^4.0.0",
45+
"@graphql-hive/yoga": "^0.38.2",
4546
"@graphql-tools/utils": "^10.5.4",
4647
"@graphql-yoga/nestjs": "^3.7.0",
4748
"@graphql-yoga/plugin-apq": "^3.7.0",

src/core/config/config.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export const makeConfig = (env: EnvironmentService) =>
4545
ttl: env.duration('GRAPHQL_PERSISTED_QUERIES_TTL').optional('1w'),
4646
},
4747
};
48+
hive = {
49+
token: env.string('HIVE_TOKEN').optional(),
50+
};
4851

4952
lruCache = {
5053
ttl: env.duration('LRU_CACHE_TTL').optional()?.as('milliseconds'),

src/core/graphql/graphql.options.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useHive } from '@graphql-hive/yoga';
12
import {
23
YogaDriverConfig as DriverConfig,
34
YogaDriverServerContext,
@@ -65,6 +66,12 @@ export class GraphqlOptions implements GqlOptionsFactory {
6566
...scalars,
6667
},
6768
plugins: [
69+
this.config.hive.token
70+
? useHive({
71+
token: this.config.hive.token,
72+
usage: true,
73+
})
74+
: false,
6875
this.useAutomaticPersistedQueries(),
6976
this.useAddOperationToContext(),
7077
],

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,20 @@ __metadata:
18461846
languageName: node
18471847
linkType: hard
18481848

1849+
"@graphql-hive/yoga@npm:^0.38.2":
1850+
version: 0.38.2
1851+
resolution: "@graphql-hive/yoga@npm:0.38.2"
1852+
dependencies:
1853+
"@graphql-hive/core": "npm:0.8.2"
1854+
"@graphql-yoga/plugin-persisted-operations": "npm:^3.3.1"
1855+
tiny-lru: "npm:8.0.2"
1856+
peerDependencies:
1857+
graphql: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
1858+
graphql-yoga: ^5.0.0
1859+
checksum: 10c0/4a1f9599fc7dd9df6975122238370e50d5028280d1c1f91a81dc96688dd54672da7902f5934e4d047c46dcc04036989c760810ed205ae854448a6d39578c5017
1860+
languageName: node
1861+
linkType: hard
1862+
18491863
"@graphql-inspector/core@npm:5.1.0-alpha-20231208113249-34700c8a":
18501864
version: 5.1.0-alpha-20231208113249-34700c8a
18511865
resolution: "@graphql-inspector/core@npm:5.1.0-alpha-20231208113249-34700c8a"
@@ -2252,6 +2266,17 @@ __metadata:
22522266
languageName: node
22532267
linkType: hard
22542268

2269+
"@graphql-yoga/plugin-persisted-operations@npm:^3.3.1":
2270+
version: 3.7.0
2271+
resolution: "@graphql-yoga/plugin-persisted-operations@npm:3.7.0"
2272+
peerDependencies:
2273+
"@graphql-tools/utils": ^10.0.0
2274+
graphql: ^15.2.0 || ^16.0.0
2275+
graphql-yoga: ^5.7.0
2276+
checksum: 10c0/bd536d77b6bdd5a309eeee5bf017f961354c79d50cc62832ad27acddbeb2834e16b4fb12ed752ef9cca2ecb815fd681f4914aae52ff3752d156e7e9ce7e2ff0b
2277+
languageName: node
2278+
linkType: hard
2279+
22552280
"@graphql-yoga/subscription@npm:^5.0.1":
22562281
version: 5.0.1
22572282
resolution: "@graphql-yoga/subscription@npm:5.0.1"
@@ -6113,6 +6138,7 @@ __metadata:
61136138
"@ffprobe-installer/ffprobe": "npm:^2.1.2"
61146139
"@golevelup/nestjs-discovery": "npm:^4.0.0"
61156140
"@graphql-hive/cli": "npm:^0.44.2"
6141+
"@graphql-hive/yoga": "npm:^0.38.2"
61166142
"@graphql-tools/utils": "npm:^10.5.4"
61176143
"@graphql-yoga/nestjs": "npm:^3.7.0"
61186144
"@graphql-yoga/plugin-apq": "npm:^3.7.0"

0 commit comments

Comments
 (0)