Break /client into /core /yoga /envelop /apollo (#4573)

This commit is contained in:
Kamil Kisiela 2024-04-23 17:51:43 +02:00 committed by GitHub
parent 50e07274fb
commit 06d465e882
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
93 changed files with 1581 additions and 1928 deletions

View file

@ -1,5 +0,0 @@
---
"@graphql-hive/core": minor
---
Node agnostic

View file

@ -0,0 +1,14 @@
---
"@graphql-hive/envelop": minor
"@graphql-hive/apollo": minor
"@graphql-hive/yoga": minor
---
Break `@graphql-hive/client` into 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.

View file

@ -1,5 +0,0 @@
---
"@graphql-hive/client": minor
---
Node agnostic

View file

@ -0,0 +1,5 @@
---
"@graphql-hive/core": minor
---
Moved most of @graphql-hive/client code here

View file

@ -1,5 +1,9 @@
--- ---
"@graphql-hive/client": minor "@graphql-hive/core": minor
"@graphql-hive/yoga": minor
"@graphql-hive/apollo": minor
"@graphql-hive/envelop": minor
"@graphql-hive/cli": minor
--- ---
🚨 BREAKING CHANGE 🚨 Requires now Node v16+ 🚨 BREAKING CHANGE 🚨 Requires now Node v16+

View file

@ -0,0 +1,14 @@
---
"@graphql-hive/yoga": minor
---
🚨 BREAKING CHANGE 🚨 `useYogaHive`, `createYogaHive` is now `useHive` and `createHive`
**Migration**
Migration steps are available in the README.
```diff
- import { useYogaHive, createYogaHive } from '@graphql-hive/client';
+ import { useHive, createHive } from '@graphql-hive/yoga';
```

View file

@ -0,0 +1,14 @@
---
"@graphql-hive/apollo": minor
---
🚨 BREAKING CHANGE 🚨 `hiveApollo` is now `useHive`
**Migration**
Migration steps are available in the README.
```diff
- import { hiveApollo } from '@graphql-hive/client';
+ import { useHive } from '@graphql-hive/apollo';
```

View file

@ -0,0 +1,12 @@
---
"@graphql-hive/envelop": minor
---
**Migration**
Migration steps are available in the README.
```diff
- import { useHive } from '@graphql-hive/client';
+ import { useHive } from '@graphql-hive/envelop';
```

View file

@ -107,6 +107,8 @@ module.exports = {
'packages/services/storage/tools/*.js', 'packages/services/storage/tools/*.js',
'packages/services/**', 'packages/services/**',
'packages/migrations/**', 'packages/migrations/**',
'**/*.spec.ts',
'**/*.test.ts',
], ],
optionalDependencies: false, optionalDependencies: false,
}, },

View file

@ -93,7 +93,8 @@ distress.
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should
notify with a concise description of your grievance. Your grievance will be handled in accordance notify with a concise description of your grievance. Your grievance will be handled in accordance
with our existing governing policies. [Policy](https://graphql-hive.com/privacy-policy.pdf) with our existing governing policies.
[Policy](https://the-guild.dev/graphql/hive/privacy-policy.pdf)
## 9. Scope ## 9. Scope

View file

@ -3,10 +3,10 @@
GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages,
from standalone APIs to composed schemas (Federation, Stitching). from standalone APIs to composed schemas (Federation, Stitching).
- Visit [graphql-hive.com](https://graphql-hive.com) - Visit [the-guild.dev/graphql/hive](https://the-guild.dev/graphql-hive)
([status page](https://status.graphql-hive.com)) ([status page](https://status.graphql-hive.com))
- [Read the announcement blog post](https://the-guild.dev/blog/announcing-graphql-hive-public) - [Read the announcement blog post](https://the-guild.dev/blog/announcing-graphql-hive-public)
- [Read the docs](https://docs.graphql-hive.com) - [Read the docs](https://the-guild.dev/graphql/hive/docs)
## Built for the community, for all GraphQL APIs ## Built for the community, for all GraphQL APIs

View file

@ -183,8 +183,8 @@ const config: CodegenConfig = {
}, },
}, },
// Client // Client
'packages/libraries/client/src/__generated__/types.ts': { 'packages/libraries/core/src/client/__generated__/types.ts': {
documents: ['./packages/libraries/client/src/**/*.ts'], documents: ['./packages/libraries/core/src/client/**/*.ts'],
config: { config: {
flattenGeneratedTypes: true, flattenGeneratedTypes: true,
onlyOperationTypes: true, onlyOperationTypes: true,

View file

@ -12,7 +12,7 @@
"@apollo/server": "4.10.3", "@apollo/server": "4.10.3",
"@aws-sdk/client-s3": "3.556.0", "@aws-sdk/client-s3": "3.556.0",
"@esm2cjs/execa": "6.1.1-cjs.1", "@esm2cjs/execa": "6.1.1-cjs.1",
"@graphql-hive/client": "workspace:*", "@graphql-hive/apollo": "workspace:*",
"@graphql-hive/core": "workspace:*", "@graphql-hive/core": "workspace:*",
"@graphql-typed-document-node/core": "3.2.0", "@graphql-typed-document-node/core": "3.2.0",
"@hive/rate-limit": "workspace:*", "@hive/rate-limit": "workspace:*",

View file

@ -10,7 +10,7 @@ import {
PutObjectCommand, PutObjectCommand,
S3Client, S3Client,
} from '@aws-sdk/client-s3'; } from '@aws-sdk/client-s3';
import { createSupergraphManager } from '@graphql-hive/client'; import { createSupergraphManager } from '@graphql-hive/apollo';
import { graphql } from '../../testkit/gql'; import { graphql } from '../../testkit/gql';
import { execute } from '../../testkit/graphql'; import { execute } from '../../testkit/graphql';
import { initSeed } from '../../testkit/seed'; import { initSeed } from '../../testkit/seed';

View file

@ -13,7 +13,7 @@ import {
} from '@app/gql/graphql'; } from '@app/gql/graphql';
// eslint-disable-next-line hive/enforce-deps-in-dev // eslint-disable-next-line hive/enforce-deps-in-dev
import { normalizeOperation } from '@graphql-hive/core'; import { normalizeOperation } from '@graphql-hive/core';
import { createHive } from '../../../../packages/libraries/client/src'; import { createHive } from '../../../../packages/libraries/core/src';
import { clickHouseQuery } from '../../../testkit/clickhouse'; import { clickHouseQuery } from '../../../testkit/clickhouse';
import { createTarget, updateTargetValidationSettings, waitFor } from '../../../testkit/flow'; import { createTarget, updateTargetValidationSettings, waitFor } from '../../../testkit/flow';
import { initSeed } from '../../../testkit/seed'; import { initSeed } from '../../../testkit/seed';

View file

@ -0,0 +1,24 @@
# Hive Client for Apollo Server
[Documentation](https://the-guild.dev/graphql/hive/docs/integrations/apollo-server)
---
[GraphQL Hive](https://the-guild.dev/graphql/hive) is a schema registry for GraphQL. With Hive you
manage and collaborate on all your GraphQL schemas and GraphQL workflows, regardless of the
underlying strategy, engine or framework youre using: this includes Schema Stitching, Apollo
Federation, or just a traditional monolith approach.
> Hive and all of its components are developed and managed as an MIT open-source project.
---
## Migration from `@graphql-hive/client`
The `@graphql-hive/client` package has been deprecated in favor of library-specific packages.
1. Install the `@graphql-hive/apollo` package.
1. Remove the `@graphql-hive/client` package from your dependencies.
1. Replace `@graphql-hive/client` with `@graphql-hive/apollo` in your codebase.
1. Replace `hiveApollo` with `useHive` in your codebase.
1. Done

View file

@ -0,0 +1,71 @@
{
"name": "@graphql-hive/apollo",
"version": "0.32.0",
"type": "module",
"description": "GraphQL Hive + Apollo Server",
"repository": {
"type": "git",
"url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/apollo"
},
"homepage": "https://the-guild.dev/graphql/hive",
"author": {
"email": "contact@the-guild.dev",
"name": "The Guild",
"url": "https://the-guild.dev"
},
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"exports": {
".": {
"require": {
"types": "./dist/typings/index.d.cts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/typings/index.d.ts",
"default": "./dist/esm/index.js"
},
"default": {
"types": "./dist/typings/index.d.ts",
"default": "./dist/esm/index.js"
}
},
"./package.json": "./package.json"
},
"typings": "dist/typings/index.d.ts",
"scripts": {
"build": "node ../../../scripts/generate-version.mjs && bob build",
"check:build": "bob check"
},
"peerDependencies": {
"@apollo/server": "^4.0.0",
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
},
"dependencies": {
"@graphql-hive/core": "workspace:*"
},
"devDependencies": {
"@apollo/server": "4.10.4",
"@graphql-tools/schema": "10.0.3",
"body-parser": "1.20.2",
"express": "4.19.2",
"graphql-ws": "5.16.0",
"nock": "14.0.0-beta.5",
"vitest": "1.5.0",
"ws": "8.16.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public",
"directory": "dist"
},
"sideEffects": false,
"typescript": {
"definition": "dist/typings/index.d.ts"
}
}

View file

@ -1,15 +1,24 @@
import type { DocumentNode } from 'graphql'; import type { DocumentNode } from 'graphql';
import type { ApolloServerPlugin, HTTPGraphQLRequest } from '@apollo/server'; import type { ApolloServerPlugin, HTTPGraphQLRequest } from '@apollo/server';
import { autoDisposeSymbol, createHive } from './client.js'; import {
import { get } from './internal/http-client.js'; autoDisposeSymbol,
import type { createHash,
createHive as createHiveClient,
HiveClient, HiveClient,
HivePluginOptions, HivePluginOptions,
SupergraphSDLFetcherOptions, http,
} from './internal/types.js'; isHiveClient,
import { createHash, isHiveClient, joinUrl } from './internal/utils.js'; joinUrl,
} from '@graphql-hive/core';
import { version } from './version.js'; import { version } from './version.js';
export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher } from '@graphql-hive/core';
export interface SupergraphSDLFetcherOptions {
endpoint: string;
key: string;
}
export function createSupergraphSDLFetcher(options: SupergraphSDLFetcherOptions) { export function createSupergraphSDLFetcher(options: SupergraphSDLFetcherOptions) {
let cacheETag: string | null = null; let cacheETag: string | null = null;
let cached: { let cached: {
@ -45,9 +54,11 @@ export function createSupergraphSDLFetcher(options: SupergraphSDLFetcherOptions)
}; };
const fetchWithRetry = (): Promise<{ id: string; supergraphSdl: string }> => { const fetchWithRetry = (): Promise<{ id: string; supergraphSdl: string }> => {
return get(endpoint, { return http
.get(endpoint, {
headers, headers,
}).then(async response => { })
.then(async response => {
if (response.ok) { if (response.ok) {
const supergraphSdl = await response.text(); const supergraphSdl = await response.text();
const result = { const result = {
@ -133,16 +144,18 @@ function addRequestWithHeaders(context: any, http?: HTTPGraphQLRequest) {
return context; return context;
} }
export function hiveApollo(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin { export function createHive(clientOrOptions: HivePluginOptions) {
const hive = isHiveClient(clientOrOptions) return createHiveClient({
? clientOrOptions
: createHive({
...clientOrOptions, ...clientOrOptions,
agent: { agent: {
name: 'hive-client-apollo', name: 'hive-client-yoga',
...clientOrOptions.agent, ...clientOrOptions.agent,
}, },
}); });
}
export function useHive(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin {
const hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions);
void hive.info(); void hive.info();

View file

@ -0,0 +1 @@
export const version = '0.32.0';

View file

@ -1,21 +1,175 @@
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ import { createServer, IncomingMessage, Server } from 'node:http';
import { createServer, IncomingMessage, Server } from 'http';
import bodyParser from 'body-parser'; import bodyParser from 'body-parser';
import express from 'express'; import express from 'express';
import { execute, subscribe } from 'graphql'; import { execute, subscribe } from 'graphql';
import { createClient } from 'graphql-ws'; import { createClient } from 'graphql-ws';
import { useServer } from 'graphql-ws/lib/use/ws'; import { useServer } from 'graphql-ws/lib/use/ws';
import { createLogger } from 'graphql-yoga';
import nock from 'nock'; import nock from 'nock';
import { beforeAll, describe, expect, test, vi } from 'vitest';
import { WebSocket, WebSocketServer } from 'ws'; import { WebSocket, WebSocketServer } from 'ws';
import { ApolloServer } from '@apollo/server'; import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4'; import { expressMiddleware } from '@apollo/server/express4';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'; import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import { startStandaloneServer } from '@apollo/server/standalone'; import { startStandaloneServer } from '@apollo/server/standalone';
import { makeExecutableSchema } from '@graphql-tools/schema'; import { makeExecutableSchema } from '@graphql-tools/schema';
import { createHive, createSupergraphSDLFetcher, hiveApollo } from '../src'; import { createHive, createSupergraphSDLFetcher, useHive } from '../src';
import { version } from '../src/version'; import { version } from '../src/version';
function createLogger() {
return {
error: vi.fn(),
info: vi.fn(),
};
}
beforeAll(() => {
nock.cleanAll();
});
function waitFor(ms: number) {
return new Promise<void>(resolve => {
setTimeout(resolve, ms);
});
}
const typeDefs = /* GraphQL */ `
type Query {
hello: String
}
`;
const resolvers = {
Query: {
hello() {
return 'Hello world';
},
},
};
function handleProcess() {
function fail(error: any) {
throw error;
}
process.once('uncaughtException', fail);
process.once('unhandledRejection', fail);
return () => {
process.removeListener('uncaughtException', fail);
process.removeListener('unhandledRejection', fail);
};
}
test('should not interrupt the process', async () => {
const logger = {
error: vi.fn(),
info: vi.fn(),
};
const clean = handleProcess();
const apollo = new ApolloServer({
typeDefs,
resolvers,
plugins: [
useHive({
enabled: true,
debug: true,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
logger,
},
reporting: {
endpoint: 'http://404.localhost/registry',
author: 'jest',
commit: 'js',
},
usage: {
endpoint: 'http://404.localhost/usage',
},
}),
],
});
await apollo.executeOperation({
query: /* GraphQL */ `
{
hello
}
`,
});
await waitFor(50);
await apollo.stop();
clean();
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][info]'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][usage]'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][reporting]'));
}, 1_000);
test('should capture client name and version headers', async () => {
const clean = handleProcess();
const fetchSpy = vi.fn<[RequestInfo | URL, options: RequestInit | undefined]>(async () =>
Response.json({}, { status: 200 }),
);
const apollo = new ApolloServer({
typeDefs,
resolvers,
plugins: [
useHive({
enabled: true,
debug: false,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
__testing: {
fetch: fetchSpy,
},
},
reporting: false,
usage: {
endpoint: 'http://apollo.localhost:4200/usage',
},
}),
],
});
await startStandaloneServer(apollo, {
listen: {
port: 4000,
},
});
await fetch('http://localhost:4000/graphql', {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
'x-graphql-client-name': 'vitest',
'x-graphql-client-version': '1.0.0',
},
});
await waitFor(50);
await apollo.stop();
expect(fetchSpy).toHaveBeenCalledWith(
'http://apollo.localhost:4200/usage',
expect.objectContaining({
body: expect.stringContaining('"client":{"name":"vitest","version":"1.0.0"}'),
}),
);
clean();
}, 1_000);
describe('supergraph SDL fetcher', async () => { describe('supergraph SDL fetcher', async () => {
test('createSupergraphSDLFetcher without ETag', async () => { test('createSupergraphSDLFetcher without ETag', async () => {
const supergraphSdl = 'type SuperQuery { sdl: String }'; const supergraphSdl = 'type SuperQuery { sdl: String }';
@ -177,7 +331,7 @@ describe('built-in HTTP usage reporting', async () => {
} }
`, `,
plugins: [ plugins: [
hiveApollo({ useHive({
token: 'token', token: 'token',
selfHosting: { selfHosting: {
applicationUrl: 'http://localhost/foo', applicationUrl: 'http://localhost/foo',
@ -197,7 +351,7 @@ describe('built-in HTTP usage reporting', async () => {
debug: false, debug: false,
agent: { agent: {
maxSize: 1, maxSize: 1,
logger: createLogger('silent'), logger: createLogger(),
}, },
}), }),
], ],
@ -265,7 +419,7 @@ describe('built-in HTTP usage reporting', async () => {
} }
`, `,
plugins: [ plugins: [
hiveApollo({ useHive({
token: 'token', token: 'token',
selfHosting: { selfHosting: {
applicationUrl: 'http://localhost/foo', applicationUrl: 'http://localhost/foo',
@ -285,7 +439,7 @@ describe('built-in HTTP usage reporting', async () => {
debug: false, debug: false,
agent: { agent: {
maxSize: 1, maxSize: 1,
logger: createLogger('silent'), logger: createLogger(),
}, },
}), }),
], ],
@ -371,7 +525,7 @@ describe('built-in HTTP usage reporting', async () => {
}, },
}, },
plugins: [ plugins: [
hiveApollo({ useHive({
token: 'token', token: 'token',
selfHosting: { selfHosting: {
applicationUrl: 'http://localhost/foo', applicationUrl: 'http://localhost/foo',
@ -391,7 +545,7 @@ describe('built-in HTTP usage reporting', async () => {
debug: false, debug: false,
agent: { agent: {
maxSize: 1, maxSize: 1,
logger: createLogger('silent'), logger: createLogger(),
}, },
}), }),
], ],
@ -473,7 +627,7 @@ describe('built-in HTTP usage reporting', async () => {
} }
`, `,
plugins: [ plugins: [
hiveApollo({ useHive({
token: 'token', token: 'token',
selfHosting: { selfHosting: {
applicationUrl: 'http://localhost/foo', applicationUrl: 'http://localhost/foo',
@ -487,7 +641,7 @@ describe('built-in HTTP usage reporting', async () => {
debug: false, debug: false,
agent: { agent: {
maxSize: 1, maxSize: 1,
logger: createLogger('silent'), logger: createLogger(),
}, },
}), }),
], ],
@ -614,7 +768,7 @@ describe('graphql-ws usage reporting setup', async () => {
debug: false, debug: false,
agent: { agent: {
maxSize: 1, maxSize: 1,
logger: createLogger('silent'), logger: createLogger(),
}, },
}); });
@ -630,7 +784,7 @@ describe('graphql-ws usage reporting setup', async () => {
const server = new ApolloServer({ const server = new ApolloServer({
schema, schema,
plugins: [ plugins: [
hiveApollo(hiveClient), useHive(hiveClient),
// Proper shutdown for the HTTP server. // Proper shutdown for the HTTP server.
ApolloServerPluginDrainHttpServer({ httpServer }), ApolloServerPluginDrainHttpServer({ httpServer }),
// Proper shutdown for the WebSocket server. // Proper shutdown for the WebSocket server.

View file

@ -1,7 +1,7 @@
# Hive CLI (Command Line Interface) # Hive CLI (Command Line Interface)
A CLI util to manage and control your GraphQL Hive. You can perform A CLI util to manage and control your GraphQL Hive. You can perform
[schema-registry actions](https://docs.graphql-hive.com/features/schema-registry#actions-on-schemas) [schema-registry actions](https://the-guild.dev/graphql/hive/docs/features/schema-registry#actions-on-schemas)
on your Hive targets using the Hive CLI. on your Hive targets using the Hive CLI.
[![Version](https://img.shields.io/npm/v/@graphql-hive/cli.svg)](https://npmjs.org/package/@graphql-hive/cli) [![Version](https://img.shields.io/npm/v/@graphql-hive/cli.svg)](https://npmjs.org/package/@graphql-hive/cli)

View file

@ -7,7 +7,7 @@
"url": "kamilkisiela/graphql-hive", "url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/cli" "directory": "packages/libraries/cli"
}, },
"homepage": "https://graphql-hive.com", "homepage": "https://the-guild.dev/graphql/hive",
"author": { "author": {
"email": "contact@the-guild.dev", "email": "contact@the-guild.dev",
"name": "The Guild", "name": "The Guild",
@ -15,7 +15,7 @@
}, },
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=16.0.0"
}, },
"bin": { "bin": {
"hive": "./bin/run" "hive": "./bin/run"
@ -35,7 +35,7 @@
"oclif:upload": "pnpm oclif upload tarballs --no-xz && pnpm oclif upload win", "oclif:upload": "pnpm oclif upload tarballs --no-xz && pnpm oclif upload win",
"postpack": "rm -f oclif.manifest.json", "postpack": "rm -f oclif.manifest.json",
"prebuild": "rimraf dist", "prebuild": "rimraf dist",
"prepack": "rimraf lib && tsc -b && oclif manifest && oclif readme", "prepack": "node scripts/replace-workspace.mjs rimraf lib && tsc -b && oclif manifest && oclif readme",
"prepublishOnly": "oclif manifest && oclif readme", "prepublishOnly": "oclif manifest && oclif readme",
"schema:check:federation": "pnpm start schema:check examples/federation.graphql --service reviews", "schema:check:federation": "pnpm start schema:check examples/federation.graphql --service reviews",
"schema:check:single": "pnpm start schema:check examples/single.graphql", "schema:check:single": "pnpm start schema:check examples/single.graphql",
@ -45,7 +45,7 @@
"version": "oclif readme && git add README.md" "version": "oclif readme && git add README.md"
}, },
"dependencies": { "dependencies": {
"@graphql-hive/core": "0.2.4", "@graphql-hive/core": "workspace:*",
"@graphql-inspector/core": "5.1.0-alpha-20231208113249-34700c8a", "@graphql-inspector/core": "5.1.0-alpha-20231208113249-34700c8a",
"@graphql-tools/code-file-loader": "~8.1.0", "@graphql-tools/code-file-loader": "~8.1.0",
"@graphql-tools/graphql-file-loader": "~8.0.0", "@graphql-tools/graphql-file-loader": "~8.0.0",

View file

@ -0,0 +1,15 @@
import { readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
const __dirname = new URL('.', import.meta.url).pathname;
const cliPackageJsonAt = join(__dirname, '..', 'package.json');
const corePackageJsonAt = join(__dirname, '..', '..', 'core', 'package.json');
const version = JSON.parse(readFileSync(corePackageJsonAt, 'utf-8')).version;
const newPkg = readFileSync(cliPackageJsonAt, 'utf-8').replace(
'"@graphql-hive/core": "workspace:*"',
`"@graphql-hive/core": "${version}"`,
);
writeFileSync(cliPackageJsonAt, newPkg);

View file

@ -178,7 +178,6 @@ export default abstract class extends Command {
if (!response.ok) { if (!response.ok) {
throw new Error(`Invalid status code for HTTP call: ${response.status}`); throw new Error(`Invalid status code for HTTP call: ${response.status}`);
} }
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const jsonData = (await response.json()) as ExecutionResult<TResult>; const jsonData = (await response.json()) as ExecutionResult<TResult>;
if (jsonData.errors && jsonData.errors.length > 0) { if (jsonData.errors && jsonData.errors.length > 0) {

View file

@ -1,672 +0,0 @@
# @graphql-hive/client
## 0.32.0
### Minor Changes
- [#4564](https://github.com/kamilkisiela/graphql-hive/pull/4564) [`5262934`](https://github.com/kamilkisiela/graphql-hive/commit/52629342d136e664491cb7fc6ad9f79987e51ca4) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Print token information only when debug mode is enabled
### Patch Changes
- [#4564](https://github.com/kamilkisiela/graphql-hive/pull/4564) [`5262934`](https://github.com/kamilkisiela/graphql-hive/commit/52629342d136e664491cb7fc6ad9f79987e51ca4) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Fix auto-detection of client name and version based on x-graphql-client-{name,version} header in Apollo Server integration
## 0.31.0
### Minor Changes
- [#4484](https://github.com/kamilkisiela/graphql-hive/pull/4484) [`7ddf063`](https://github.com/kamilkisiela/graphql-hive/commit/7ddf063984f2fd39acf7bc55eecbf7a315c030bf) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Accepts now CDN endpoint without /services /supergraph etc subdirectories
## 0.30.0
### Minor Changes
- [#4176](https://github.com/kamilkisiela/graphql-hive/pull/4176) [`df0ea91`](https://github.com/kamilkisiela/graphql-hive/commit/df0ea919201d3242148d41248e08231ec55f398b) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Support usage reporting for incremental delivery (`@defer`/`@stream`) operations with GraphQL Yoga
- [#4176](https://github.com/kamilkisiela/graphql-hive/pull/4176) [`df0ea91`](https://github.com/kamilkisiela/graphql-hive/commit/df0ea919201d3242148d41248e08231ec55f398b) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Add APIs for reporting subscription usage.
The Hive client will now report the usage of Subscription operations to GraphQL Hive.
We recommend referring to the corresponding documentation of your server framework for configuration adjustments.
## 0.29.1
### Patch Changes
- [#4328](https://github.com/kamilkisiela/graphql-hive/pull/4328) [`bb0ff23`](https://github.com/kamilkisiela/graphql-hive/commit/bb0ff238ee7a413aca618b05cdf2187e6b886188) Thanks [@Hebilicious](https://github.com/Hebilicious)! - Use node specifier for crypto import
- Updated dependencies [[`bb0ff23`](https://github.com/kamilkisiela/graphql-hive/commit/bb0ff238ee7a413aca618b05cdf2187e6b886188)]:
- @graphql-hive/core@0.2.4
## 0.29.0
### Minor Changes
- [#4109](https://github.com/kamilkisiela/graphql-hive/pull/4109) [`441b71f`](https://github.com/kamilkisiela/graphql-hive/commit/441b71fdab36a9eb79336d720d15d0d1cf7f0156) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Automatic disposal of managed clients for Yoga and Envelop plugins.
## 0.28.1
### Patch Changes
- [#3809](https://github.com/kamilkisiela/graphql-hive/pull/3809) [`b5d1061`](https://github.com/kamilkisiela/graphql-hive/commit/b5d10611ab0c6379d5f141d57798f718e1826a98) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Do not report operations that do not pass GraphQL validation.
## 0.28.0
### Minor Changes
- [#3608](https://github.com/kamilkisiela/graphql-hive/pull/3608) [`daf9eaa`](https://github.com/kamilkisiela/graphql-hive/commit/daf9eaa4b26a247930ec88593fc64e1d7753fae1) Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Changed `exclude` argument type to accept RegEX
## 0.27.0
### Minor Changes
- [#3331](https://github.com/kamilkisiela/graphql-hive/pull/3331)
[`dad9206`](https://github.com/kamilkisiela/graphql-hive/commit/dad92067ff3d15818dd43671609bcda54c38f913)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Add atLeastOnceSampler
- [#3331](https://github.com/kamilkisiela/graphql-hive/pull/3331)
[`dad9206`](https://github.com/kamilkisiela/graphql-hive/commit/dad92067ff3d15818dd43671609bcda54c38f913)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Introduce sampler for dynamic sampling
## 0.26.0
### Minor Changes
- [#3263](https://github.com/kamilkisiela/graphql-hive/pull/3263)
[`7924ddcd`](https://github.com/kamilkisiela/graphql-hive/commit/7924ddcd3012916d85c5f7c543b7aa80ed5ca21b)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Allow to pass http and https agents
## 0.25.0
### Minor Changes
- [#3215](https://github.com/kamilkisiela/graphql-hive/pull/3215)
[`c8ec151e`](https://github.com/kamilkisiela/graphql-hive/commit/c8ec151e5dc2f7c262a5fac9119561c5ca8c63d7)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Remove unused persisted operations feature.
### Patch Changes
- [#3237](https://github.com/kamilkisiela/graphql-hive/pull/3237)
[`e632cd1`](https://github.com/kamilkisiela/graphql-hive/commit/e632cd1529db194899c14eca70e3c8de929f2215)
Thanks [@dotansimha](https://github.com/dotansimha)! - Update `axios` range to address security
issues (https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459)
- [#3160](https://github.com/kamilkisiela/graphql-hive/pull/3160)
[`2c16c211`](https://github.com/kamilkisiela/graphql-hive/commit/2c16c2114782b06001e99f6ec68b1ec4856a4973)
Thanks [@renovate](https://github.com/apps/renovate)! - Bump @envelop/types dependency version
(v5)
## 0.24.3
### Patch Changes
- [#3017](https://github.com/kamilkisiela/graphql-hive/pull/3017)
[`6023be2`](https://github.com/kamilkisiela/graphql-hive/commit/6023be2a0bcd18c59d85c819ad6604b89484a6fc)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Do not collect usage when Apollo Server
did not resolve source
- [#3007](https://github.com/kamilkisiela/graphql-hive/pull/3007)
[`024f68ad`](https://github.com/kamilkisiela/graphql-hive/commit/024f68ad9dbeb10eaa5c17ad1f62f8c725f1d6d7)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Finish measuring duration on error
- [#3007](https://github.com/kamilkisiela/graphql-hive/pull/3007)
[`024f68ad`](https://github.com/kamilkisiela/graphql-hive/commit/024f68ad9dbeb10eaa5c17ad1f62f8c725f1d6d7)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Include operation's name in error
message
- [#3007](https://github.com/kamilkisiela/graphql-hive/pull/3007)
[`024f68ad`](https://github.com/kamilkisiela/graphql-hive/commit/024f68ad9dbeb10eaa5c17ad1f62f8c725f1d6d7)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Detect unavailable definition and throw
errors with paths pointing to relevant ASTNodes
## 0.24.2
### Patch Changes
- [#2979](https://github.com/kamilkisiela/graphql-hive/pull/2979)
[`fa18b0a`](https://github.com/kamilkisiela/graphql-hive/commit/fa18b0a36b67a26479cad4fad63cabcaf58e1c1b)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Detect missing DocumentNode in Apollo
Server
## 0.24.1
### Patch Changes
- [#2543](https://github.com/kamilkisiela/graphql-hive/pull/2543)
[`0a41288d`](https://github.com/kamilkisiela/graphql-hive/commit/0a41288d4ebcfa8d38726c619882a4f1ab0774da)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Internal refactor for re-using existing code.
## 0.24.0
### Minor Changes
- [#2439](https://github.com/kamilkisiela/graphql-hive/pull/2439)
[`c7cdeb73`](https://github.com/kamilkisiela/graphql-hive/commit/c7cdeb73f63dca4e3d795f92b0cf2641f592c733)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Add `useYogaHive` plugin for better integration
with GraphQL Yoga.
## 0.23.1
### Patch Changes
- [#1357](https://github.com/kamilkisiela/graphql-hive/pull/1357)
[`9fc97488`](https://github.com/kamilkisiela/graphql-hive/commit/9fc97488cf6da479a63c4d68c6cfae1f3526f8f9)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Remove `Query._entities` when
extracting original SDL from Fed v2
## 0.23.0
### Minor Changes
- [#1305](https://github.com/kamilkisiela/graphql-hive/pull/1305)
[`cdf2e8a7`](https://github.com/kamilkisiela/graphql-hive/commit/cdf2e8a77eb1e98f7b90c7ac82ad663bda5784ef)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Support Federation v2 in schema
reporting
- [#1224](https://github.com/kamilkisiela/graphql-hive/pull/1224)
[`cf14c18d`](https://github.com/kamilkisiela/graphql-hive/commit/cf14c18d6ebf7751f6bec37f82fa643306b538f6)
Thanks [@rperryng](https://github.com/rperryng)! - skip directive arguments during usage
collection
- [#1305](https://github.com/kamilkisiela/graphql-hive/pull/1305)
[`cdf2e8a7`](https://github.com/kamilkisiela/graphql-hive/commit/cdf2e8a77eb1e98f7b90c7ac82ad663bda5784ef)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Add @apollo/server and @envelop/types
as optional dependencies
- [#1305](https://github.com/kamilkisiela/graphql-hive/pull/1305)
[`cdf2e8a7`](https://github.com/kamilkisiela/graphql-hive/commit/cdf2e8a77eb1e98f7b90c7ac82ad663bda5784ef)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Support @apollo/server
## 0.22.0
### Minor Changes
- [#862](https://github.com/kamilkisiela/graphql-hive/pull/862)
[`d2aa98a5`](https://github.com/kamilkisiela/graphql-hive/commit/d2aa98a574f191e115bd8fab1f95a7aa5bb17659)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Use new CDN endpoint for retrieving the service
list
- [#971](https://github.com/kamilkisiela/graphql-hive/pull/971)
[`0abc58b9`](https://github.com/kamilkisiela/graphql-hive/commit/0abc58b9e2ed8b4c7d950ce3f7cba43dfdeff344)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Retry failed requests upon CDN issues.
### Patch Changes
- [#776](https://github.com/kamilkisiela/graphql-hive/pull/776)
[`e46b5dda`](https://github.com/kamilkisiela/graphql-hive/commit/e46b5ddab84406ea810a9e0f0c08e6149e77468a)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Use correct default value for 'enabled'.
- [#904](https://github.com/kamilkisiela/graphql-hive/pull/904)
[`20edc8c5`](https://github.com/kamilkisiela/graphql-hive/commit/20edc8c5e54cd71a726f02f33f9710460fc6d5a0)
Thanks [@dotansimha](https://github.com/dotansimha)! - Upgrade dependency `axios` to v1
- [#904](https://github.com/kamilkisiela/graphql-hive/pull/904)
[`20edc8c5`](https://github.com/kamilkisiela/graphql-hive/commit/20edc8c5e54cd71a726f02f33f9710460fc6d5a0)
Thanks [@dotansimha](https://github.com/dotansimha)! - Upgrade dependency
`apollo-server-plugin-base`
## 0.21.4
### Patch Changes
- [#710](https://github.com/kamilkisiela/graphql-hive/pull/710)
[`d0357ee`](https://github.com/kamilkisiela/graphql-hive/commit/d0357ee93ae2bca4d8978d990972204ac2d79521)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Make token optional when Hive is
disabled
## 0.21.3
### Patch Changes
- [#668](https://github.com/kamilkisiela/graphql-hive/pull/668)
[`e116841`](https://github.com/kamilkisiela/graphql-hive/commit/e116841a739bfd7f37c4a826544301cf23d61637)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Fix ESM/CJS issue
- Updated dependencies
[[`e116841`](https://github.com/kamilkisiela/graphql-hive/commit/e116841a739bfd7f37c4a826544301cf23d61637)]:
- @graphql-hive/core@0.2.3
## 0.21.2
### Patch Changes
- [#655](https://github.com/kamilkisiela/graphql-hive/pull/655)
[`2cbf27f`](https://github.com/kamilkisiela/graphql-hive/commit/2cbf27fdc9c18749b8969adb6d1598338762dba2)
Thanks [@n1ru4l](https://github.com/n1ru4l)! - Add User-Agent header to all http requests
## 0.21.1
### Patch Changes
- [#466](https://github.com/kamilkisiela/graphql-hive/pull/466)
[`2e036ac`](https://github.com/kamilkisiela/graphql-hive/commit/2e036acc4ce1c27a493e90481bb10f5886c0a00c)
Thanks [@ardatan](https://github.com/ardatan)! - Update GraphQL Tools packages
## 0.21.0
### Minor Changes
- [#563](https://github.com/kamilkisiela/graphql-hive/pull/563)
[`d58a470`](https://github.com/kamilkisiela/graphql-hive/commit/d58a470916b213230f495e896fe99ec0baa225e2)
Thanks [@PabloSzx](https://github.com/PabloSzx)! - Fix createServicesFetcher handling null service
url
## 0.20.1
### Patch Changes
- [#456](https://github.com/kamilkisiela/graphql-hive/pull/456)
[`fb9b624`](https://github.com/kamilkisiela/graphql-hive/commit/fb9b624ab80ff39658c9ecd45b55d10d906e15e7)
Thanks [@dimatill](https://github.com/dimatill)! - (processVariables: true) do not collect input
when corresponding variable is missing
## 0.20.0
### Minor Changes
- [#499](https://github.com/kamilkisiela/graphql-hive/pull/499)
[`682cde8`](https://github.com/kamilkisiela/graphql-hive/commit/682cde81092fcb3a55de7f24035be4f2f64abfb3)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Add Self-Hosting options
## 0.19.0
### Major Changes
- [#435](https://github.com/kamilkisiela/graphql-hive/pull/435)
[`a79c253`](https://github.com/kamilkisiela/graphql-hive/commit/a79c253253614e44d01fef411016d353ef8c255e)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Use ETag and If-None-Match to save
bandwidth and improve performance
## 0.18.5
### Patch Changes
- [#399](https://github.com/kamilkisiela/graphql-hive/pull/399)
[`bd6e500`](https://github.com/kamilkisiela/graphql-hive/commit/bd6e500532ed4878a069883fadeaf3bb00e38aeb)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Fix the wrong cacheKey from #397
## 0.18.4
### Patch Changes
- [#379](https://github.com/kamilkisiela/graphql-hive/pull/379)
[`2e7c8f3`](https://github.com/kamilkisiela/graphql-hive/commit/2e7c8f3c94013f890f42ca1054287841478ba7a6)
Thanks [@dimatill](https://github.com/dimatill)! - Collect input fields from variables (opt-in
with `processVariables` flag)
## 0.18.3
### Patch Changes
- [#308](https://github.com/kamilkisiela/graphql-hive/pull/308)
[`5a212f6`](https://github.com/kamilkisiela/graphql-hive/commit/5a212f61f206d7b73f8abf04667480851aa6066e)
Thanks [@kamilkisiela](https://github.com/kamilkisiela)! - Avoid marking the same type as used
twice
## 0.18.2
### Patch Changes
- ef18a38: Show error messages when publishing the schema
## 0.18.1
### Patch Changes
- c0e0821: fix: enabled false will log in debug that hive is disabled
## 0.18.0
### Minor Changes
- a94fd68: Introduce createSupergraphManager for @apollo/gateway v2
## 0.17.0
### Minor Changes
- 25d6b01: Migrate to Authorization header (previously X-API-Token)
## 0.16.0
### Minor Changes
- 52bebed: Raise an error on missing commit, author or token options.
## 0.15.4
### Patch Changes
- ad66973: Bump
- Updated dependencies [ad66973]
- @graphql-hive/core@0.2.2
## 0.15.3
### Patch Changes
- 0a5dbeb: Point to graphql-hive.com
- Updated dependencies [0a5dbeb]
- @graphql-hive/core@0.2.1
## 0.15.2
### Patch Changes
- a33cdcef: Update link to documentation
## 0.15.1
### Patch Changes
- cd998fab: add readme
## 0.15.0
### Minor Changes
- ac9b868c: Support GraphQL v16
### Patch Changes
- Updated dependencies [ac9b868c]
- @graphql-hive/core@0.2.0
## 0.14.2
### Patch Changes
- 903edf84: Bump
## 0.14.1
### Patch Changes
- ff82bd75: Improve scheduling
- ccb93298: Remove content-encoding header and improve error logs
## 0.14.0
### Minor Changes
- fe2b5dbc: Introduce new reporting format and set maxSize to 1500
## 0.13.0
### Minor Changes
- 607a4fe2: Support new Apollo Server Plugin V3 next to V0
### Patch Changes
- 79d4b4c2: fix(deps): update envelop monorepo
## 0.12.0
### Minor Changes
- b5966ab: Replace undici with axios
## 0.11.1
### Patch Changes
- 02b00f0: Update undici, sentry, bullmq
## 0.11.0
### Minor Changes
- 7eca7f0: Display access to actions
## 0.10.0
### Minor Changes
- d67d3e8: Add schema and services fetchers for gateways other than Apollo Gateway
## 0.9.1
### Patch Changes
- f9b545f: Send version of Hive client
## 0.9.0
### Minor Changes
- 6f204be: Display token info
## 0.8.0
### Minor Changes
- 0527e3c: Support Envelop 1.0
### Patch Changes
- 0527e3c: Update undici
## 0.7.0
### Minor Changes
- 0e712c7: Normalize operations and remove literals before sending them to Hive
## 0.6.3
### Patch Changes
- e09f95a: Bump version
## 0.6.2
### Patch Changes
- 074c052: Fix supergraph fetcher not being a function
## 0.6.1
### Patch Changes
- 38bfd02: Export createSupergraphSDLFetcher
## 0.6.0
### Minor Changes
- 23636de: Support Federation Gateway (polling and supergraph)
### Patch Changes
- 23636de: Support federated services when reporting schema
- 23636de: Fix missing directives, service name and service url when reporting the schema
- 23636de: Compress with gzip
## 0.5.3
### Patch Changes
- aa4e661: Bump Undici
## 0.5.2
### Patch Changes
- e0a47fb: Use Undici instead of Got and Agentkeepalive
## 0.5.1
### Patch Changes
- 8a9fdd7: The has method returns true on staled values - tiny-lru
## 0.5.0
### Minor Changes
- d7348a3: Collect timestamps
## 0.4.5
### Patch Changes
- ee6b82b: Bump undici to stable v4
## 0.4.4
### Patch Changes
- a73e5cb: Warn about missing token
## 0.4.3
### Patch Changes
- 5aa5e93: Bump
## 0.4.2
### Patch Changes
- 968614d: Much more explanatory messages in Agent
## 0.4.1
### Patch Changes
- 1a16360: Send GraphQL Client name and version
## 0.4.0
### Minor Changes
- 4224cb9: Move author and commit under reporting and token to top level of options
### Patch Changes
- c6ef3d2: Bob update
## 0.3.3
### Patch Changes
- 148b294: Fix issues with undici headers timeout
## 0.3.2
### Patch Changes
- 85b85d4: Dependencies update, cleanup, ui fixes
## 0.3.1
### Patch Changes
- a19fef4: Fix missing document in Apollo
## 0.3.0
### Minor Changes
- 1fe62bb: Apollo Plugin
## 0.2.2
### Patch Changes
- 4a7c569: Move operation hashing to Usage service
## 0.2.1
### Patch Changes
- 5ca6a06: Move debug to top level
- f96cfc9: Add hash to usage collector and allow for custom logic
## 0.2.0
### Minor Changes
- 30da7e7: When disabled, run everything in dry mode (only http agent is disabled). This should help
to catch errors in development.
### Patch Changes
- bb5b3c4: Preparations for persisted operations in Lance
## 0.1.3
### Patch Changes
- Updated dependencies [6b74355]
- @graphql-hive/core@0.0.3
## 0.1.2
### Patch Changes
- e1f9e1e: Use normalization
- 02322e7: Collect execution info
- 8585fd8: Collect error path
- Updated dependencies [094c861]
- @graphql-hive/core@0.0.2
## 0.1.1
### Patch Changes
- 5135307: Collect client info
## 0.1.0
### Minor Changes
- 078e758: Token per Target
### Patch Changes
- 7113a0e: Custom logger
- 7113a0e: Add dispose method
- 65cc5b5: Collect arguments
## 0.0.8
### Patch Changes
- fd38851: Add try/catch on top of report/usage
- 32f198b: Enabled flag
## 0.0.7
### Patch Changes
- eedbad6: Make ttl and max optional
## 0.0.6
### Patch Changes
- ab5c204: Collect more with Sentry
## 0.0.5
### Patch Changes
- 2269c61: No extra calls to Auth0
## 0.0.4
### Patch Changes
- d64a3c5: Target 2017
## 0.0.3
### Patch Changes
- 7e88e71: bump
## 0.0.2
### Patch Changes
- b2d686e: bump

View file

@ -1,469 +0,0 @@
# GraphQL Hive Client
[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage
and collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema
stitching, federation, or just a good old monolith.
GraphQL Hive is currently available as a hosted service to be used by all. We take care of the heavy
lifting behind the scenes be managing the registry, scaling it for your needs, to free your time to
focus on the most important things at hand.
## Installation
```
npm install @graphql-hive/client
```
## Basic Usage
Hive Client comes with generic client and plugins for [Envelop](https://envelop.dev) and
[Apollo Server](https://github.com/apollographql/apollo-server)
### With GraphQL Yoga
[GraphQL Yoga](https://www.the-guild.dev/graphql/yoga-server) is a cross-platform GraphQL sever
built on top of the envelop engine.
```ts
import { useHive } from '@graphql-hive/client'
import { createYoga } from '@graphql-yoga/node'
const server = createYoga({
plugins: [
useHive({
enabled: true, // Enable/Disable Hive Client
debug: true, // Debugging mode
token: 'YOUR-TOKEN',
// Schema reporting
reporting: {
// feel free to set dummy values here
author: 'Author of the schema version',
commit: 'git sha or any identifier'
},
usage: true // Collects schema usage based on operations
})
]
})
server.start()
```
### GraphQL Yoga and Cloudflare Workers
If you're using Cloudflare Workers, you can use the following code:
```typescript
import { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'
import { createYoga } from 'graphql-yoga'
export default {
async fetch(request, env, ctx) {
const hive = createYogaHive({
enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN',
usage: true // Collects schema usage based on operations
});
const yoga = createYoga({
plugins: [
useYogaHive(hive)
]
});
const response = await yoga.fetch(request, env, ctx);
ctx.waitUntil(hive.dispose());
return response;
}
}
```
### With Envelop
If you're not familiar with Envelop - in "short" it's a lightweight JavaScript library for wrapping
GraphQL execution layer and flow, allowing developers to develop, share and collaborate on
GraphQL-related plugins, while filling the missing pieces in GraphQL implementations.
Here's [more](https://github.com/dotansimha/envelop#envelop) on that topic.
```ts
import { envelop } from '@envelop/core'
import { useHive } from '@graphql-hive/client'
const envelopProxy = envelop({
plugins: [
useHive({
enabled: true, // Enable/Disable Hive Client
debug: true, // Debugging mode
token: 'YOUR-TOKEN',
// Schema reporting
reporting: {
// feel free to set dummy values here
author: 'Author of the schema version',
commit: 'git sha or any identifier'
},
usage: true // Collects schema usage based on operations
})
]
})
```
### With Apollo Server
Thanks to the plugin system it's a matter of adding hiveApollo plugin to ApolloServer instance:
```ts
import { ApolloServer } from 'apollo-server'
import { hiveApollo } from '@graphql-hive/client'
const server = new ApolloServer({
typeDefs,
resolvers,
plugins: [
hiveApollo({
enabled: true, // Enable/Disable Hive Client
debug: true, // Debugging mode
token: 'YOUR-TOKEN',
reporting: {
// feel free to set dummy values here
author: 'Author of the latest change',
commit: 'git sha or any identifier'
},
usage: true // Collects schema usage based on operations
})
]
})
```
### With Other Servers
First you need to instantiate the Hive Client.
The `collectUsage` method accepts the same arguments as execute function of graphql-js and returns a
function that expects the execution result object.
- `collectUsage(args)` - should be called when a GraphQL execution starts.
- `finish(result)` (function returned by `collectUsage(args)`) - has to be invoked right after
execution finishes.
```ts
import express from 'express'
import { graphqlHTTP } from 'express-graphql'
import { createHive } from '@graphql-hive/client'
const app = express()
const hive = createHive({
enabled: true, // Enable/Disable Hive Client
debug: true, // Debugging mode
token: 'YOUR-TOKEN',
reporting: {
// feel free to set dummy values here
author: 'Author of the latest change',
commit: 'git sha or any identifier'
},
usage: true // Collects schema usage based operations
})
// Report Schema
hive.reportSchema({ schema: yourSchema })
app.post(
'/graphql',
graphqlHTTP({
schema: yourSchema,
async customExecuteFn(args) {
// Collecting usage
const finish = hive.collectUsage(args)
const result = await execute(args)
finish(result)
return result
}
})
)
// When server is shutting down
async function onShutdown() {
await hive.close()
}
```
### Using the registry when Stitching
Stitching could be done in many ways, that's why `@graphql-hive/client` provide generic functions,
not something dedicated for stitching. Unfortunately the implementation of gateway + polling is up
to you.
Prerequisites:
- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step
- `HIVE_CDN_KEY` - the access key
The `createServicesFetcher` factory function returns another function that is responsible for
fetching a list of services from Hive's high-availability endpoint.
```ts
import { createServicesFetcher } from '@graphql-hive/client'
const fetchServices = createServicesFetcher({
endpoint: process.env.HIVE_CDN_ENDPOINT,
key: process.env.HIVE_CDN_KEY
})
// This is your GraphQL gateway with built-in polling mechanism, in which the `stitchServices` method is called every 10 seconds.
startMyGraphQLGateway({
// a function that resolves a list of services to stitch them together
async stitchServices() {
const services = await fetchServices()
return services.map(service => {
return {
sdl: service.sdl,
url: service.url,
checksum: service.id // to check if service's schema was modified
}
})
},
pollingInSec: 10 // every 10s
})
```
### Using the registry with Apollo Gateway
You can connect your Apollo Gateway with Hive client.
- `HIVE_CDN_ENDPOINT` - the endpoint Hive generated for you in the previous step
- `HIVE_CDN_KEY` - the access
```ts
import { ApolloGateway } from '@apollo/gateway'
import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone'
import { createSupergraphManager } from '@graphql-hive/client'
const gateway = new ApolloGateway({
// Apollo Gateway will fetch Supergraph from GraphQL Hive CDN
supergraphSdl: createSupergraphManager({
endpoint: HIVE_CDN_ENDPOINT,
key: HIVE_CDN_KEY,
pollIntervalInMs: 15_000
})
})
const server = new ApolloServer({
gateway
})
const { url } = await startStandaloneServer({ server })
console.log(`🚀 Server ready at ${url}`)
```
## Usage Reporting configuration
### Client Info
The schema usage operation information can be enriched with meta information that will be displayed
on the Hive dashboard in order to get a better understanding of the origin of an executed GraphQL
operation.
### GraphQL Yoga Example
```ts
import { useHive } from '@graphql-hive/client'
import { createYoga } from '@graphql-yoga/node'
const server = createYoga({
plugins: [
useHive({
enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN',
usage: {
clientInfo(ctx: { req: Request }) {
const name = ctx.req.headers.get('x-graphql-client-name')
const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'
if (name) {
return { name, version }
}
return null
}
}
})
]
})
server.start()
```
#### Envelop Example
```ts
import { envelop } from '@envelop/core'
import { useHive } from '@graphql-hive/client'
const envelopProxy = envelop({
plugins: [
useHive({
enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN',
usage: {
clientInfo(ctx: { req: Request }) {
const name = ctx.req.headers.get('x-graphql-client-name')
const version = ctx.req.headers.get('x-graphql-client-version') ?? 'missing'
if (name) {
return { name, version }
}
return null
}
}
})
]
})
```
#### Apollo Server Example
```ts
import type { IncomingMessage } from 'http'
import { ApolloServer } from 'apollo-server'
import { hiveApollo } from '@graphql-hive/client'
const server = new ApolloServer({
typeDefs,
resolvers,
plugins: [
hiveApollo({
enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN',
usage: {
clientInfo(ctx: { req: IncomingMessage }) {
const name = ctx.req.headers['x-graphql-client-name']
const version = ctx.req.headers['x-graphql-client-version'] ?? 'missing'
if (name) {
return { name, version }
}
return null
}
}
})
]
})
```
### Sampling
#### Basic sampling
With `sampleRate` option, you're able to control the sampling rate of the usage reporting. Setting
it to `0.5` will result in 50% of the operations being sent to Hive. There is no guarantee that
every operation will be reported at least once (see `atLeastOnceSampler`).
Default: `1` (100%)
```typescript
useHive({
/* ... other options ... */,
usage: {
sampleRate: 0.6 // 60% of the operations will be sent to Hive
}
})
```
#### Dynamic sampling
GraphQL Hive client accepts a function that returns a number between 0 and 1. This allows you to
implement dynamic sampling based on the operation's context.
If `sampler` is defined, `sampleRate` is ignored.
A sample rate between 0 and 1.
- `0.0` = 0% chance of being sent
- `1.0` = 100% chance of being sent.
- `true` = 100%
- `false` = 0%
```typescript
useHive({
/* ... other options ... */,
usage: {
sampler(samplingContext) {
if (samplingContext.operationName === 'GetUser') {
return 0.5 // 50% of GetUser operations will be sent to Hive
}
return 0.7; // 70% of the other operations will be sent to Hive
}
}
})
```
#### At-least-once sampling
If you want to make sure that every operation is reported at least once, you can use the
`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is
decided by the sampler.
```typescript
import { useHive, atLeastOnceSampler} from '@graphql-hive/client';
useHive({
/* ... other options ... */,
usage: {
sampler: atLeastOnceSampler({
// Produces a unique key for a given GraphQL request.
// This key is used to determine the uniqueness of a GraphQL operation.
keyFn(samplingContext) {
// Operation name is a good candidate for a key, but not perfect,
// as not all operations have names
// and some operations may have the same name but different body.
return samplingContext.operationName;
},
sampler(_samplingContext) {
const hour = new Date().getHours();
if (hour >= 9 && hour <= 17) {
return 0.3;
}
return 0.8;
}
})
}
})
```
## Self-Hosting
To align the client with your own instance of GraphQL Hive, you should use `selfHosting` options in
the client configuration.
The example is based on GraphQL Yoga, but the same configuration applies to Apollo Server and
others.
```ts
import { useHive } from '@graphql-hive/client'
import { createYoga } from '@graphql-yoga/node'
const server = createYoga({
plugins: [
useHive({
enabled: true,
token: 'YOUR-TOKEN',
selfHosting: {
graphqlEndpoint: 'https://your-own-graphql-hive.com/graphql',
applicationUrl: 'https://your-own-graphql-hive.com',
usageEndpoint: 'https://your-own-graphql-hive.com/usage' // optional
}
})
]
})
server.start()
```
> The `selfHosting` options take precedence over the deprecated `options.hosting.endpoint` and
> `options.usage.endpoint`.

View file

@ -1,9 +0,0 @@
import fs from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pkg = JSON.parse(fs.readFileSync(join(__dirname, '../package.json'), 'utf-8'));
const code = `export const version = '${pkg.version}';\n`;
fs.writeFileSync(join(__dirname, '../src/version.ts'), code);

View file

@ -1,7 +0,0 @@
export type { HivePluginOptions, HiveClient } from './internal/types.js';
export { useHive } from './envelop.js';
export { useHive as useYogaHive, createHive as createYogaHive } from './yoga.js';
export { hiveApollo, createSupergraphSDLFetcher, createSupergraphManager } from './apollo.js';
export { createSchemaFetcher, createServicesFetcher } from './gateways.js';
export { createHive } from './client.js';
export { atLeastOnceSampler } from './samplers.js';

View file

@ -1 +0,0 @@
export const version = '0.30.0';

View file

@ -1,270 +0,0 @@
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { createSchema, createYoga } from 'graphql-yoga';
// eslint-disable-next-line import/no-extraneous-dependencies
import { ApolloServer } from '@apollo/server';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { startStandaloneServer } from '@apollo/server/standalone';
import { Response } from '@whatwg-node/fetch';
import { createHive, hiveApollo, useHive } from '../src';
import { waitFor } from './test-utils';
const typeDefs = /* GraphQL */ `
type Query {
hello: String
}
`;
const resolvers = {
Query: {
hello() {
return 'Hello world';
},
},
};
function handleProcess() {
function fail(error: any) {
throw error;
}
process.once('uncaughtException', fail);
process.once('unhandledRejection', fail);
return () => {
process.removeListener('uncaughtException', fail);
process.removeListener('unhandledRejection', fail);
};
}
describe('GraphQL Yoga', () => {
test('should not interrupt the process', async () => {
const logger = {
error: vi.fn(),
info: vi.fn(),
};
const clean = handleProcess();
const hive = createHive({
enabled: true,
debug: true,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
logger,
},
reporting: {
endpoint: 'http://404.localhost/registry',
author: 'jest',
commit: 'js',
},
usage: {
endpoint: 'http://404.localhost/usage',
},
});
const yoga = createYoga({
schema: createSchema({
typeDefs,
resolvers,
}),
plugins: [useHive(hive)],
logging: false,
});
await yoga.fetch(
new Request('http://localhost/graphql', {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
},
}),
);
await waitFor(50);
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][info] Error'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][reporting] Failed'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][usage] Failed'));
await hive.dispose();
clean();
}, 1_000);
test('should capture client name and version headers', async () => {
const fetchSpy = vi.fn<[RequestInfo | URL, options: RequestInit | undefined]>(async () =>
Response.json({}, { status: 200 }),
);
const clean = handleProcess();
const hive = createHive({
enabled: true,
debug: false,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
__testing: {
fetch: fetchSpy,
},
},
reporting: false,
usage: {
endpoint: 'http://yoga.localhost:4200/usage',
},
});
const yoga = createYoga({
schema: createSchema({
typeDefs,
resolvers,
}),
plugins: [useHive(hive)],
logging: false,
});
await yoga.fetch(`http://localhost/graphql`, {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
'x-graphql-client-name': 'vitest',
'x-graphql-client-version': '1.0.0',
},
});
await waitFor(50);
await hive.dispose();
clean();
expect(fetchSpy).toHaveBeenCalledWith(
'http://yoga.localhost:4200/usage',
expect.objectContaining({
body: expect.stringContaining('"client":{"name":"vitest","version":"1.0.0"}'),
}),
);
}, 1_000);
});
describe('Apollo Server', () => {
test('should not interrupt the process', async () => {
const logger = {
error: vi.fn(),
info: vi.fn(),
};
const clean = handleProcess();
const apollo = new ApolloServer({
typeDefs,
resolvers,
plugins: [
hiveApollo({
enabled: true,
debug: true,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
logger,
},
reporting: {
endpoint: 'http://404.localhost/registry',
author: 'jest',
commit: 'js',
},
usage: {
endpoint: 'http://404.localhost/usage',
},
}),
],
});
await apollo.executeOperation({
query: /* GraphQL */ `
{
hello
}
`,
});
await waitFor(50);
await apollo.stop();
clean();
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][info]'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][usage]'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][reporting]'));
}, 1_000);
test('should capture client name and version headers', async () => {
const clean = handleProcess();
const fetchSpy = vi.fn<[RequestInfo | URL, options: RequestInit | undefined]>(async () =>
Response.json({}, { status: 200 }),
);
const apollo = new ApolloServer({
typeDefs,
resolvers,
plugins: [
hiveApollo({
enabled: true,
debug: false,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
__testing: {
fetch: fetchSpy,
},
},
reporting: false,
usage: {
endpoint: 'http://apollo.localhost:4200/usage',
},
}),
],
});
await startStandaloneServer(apollo, {
listen: {
port: 4000,
},
});
await fetch('http://localhost:4000/graphql', {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
'x-graphql-client-name': 'vitest',
'x-graphql-client-version': '1.0.0',
},
});
await waitFor(50);
await apollo.stop();
expect(fetchSpy).toHaveBeenCalledWith(
'http://apollo.localhost:4200/usage',
expect.objectContaining({
body: expect.stringContaining('"client":{"name":"vitest","version":"1.0.0"}'),
}),
);
clean();
}, 1_000);
});

View file

@ -7,7 +7,7 @@
"url": "kamilkisiela/graphql-hive", "url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/core" "directory": "packages/libraries/core"
}, },
"homepage": "https://graphql-hive.com", "homepage": "https://the-guild.dev/graphql/hive",
"author": { "author": {
"email": "contact@the-guild.dev", "email": "contact@the-guild.dev",
"name": "The Guild", "name": "The Guild",
@ -38,19 +38,27 @@
}, },
"typings": "dist/typings/index.d.ts", "typings": "dist/typings/index.d.ts",
"scripts": { "scripts": {
"build": "bob build", "build": "node ../../../scripts/generate-version.mjs && bob build",
"check:build": "bob check" "check:build": "bob check"
}, },
"peerDependencies": { "peerDependencies": {
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
}, },
"dependencies": { "dependencies": {
"lodash.sortby": "4.7.0" "@graphql-tools/utils": "^10.0.0",
"@whatwg-node/fetch": "0.9.17",
"async-retry": "1.3.3",
"lodash.sortby": "4.7.0",
"tiny-lru": "8.0.2"
}, },
"devDependencies": { "devDependencies": {
"@apollo/federation": "0.38.1",
"@apollo/subgraph": "2.7.3",
"@types/lodash.sortby": "4.7.9", "@types/lodash.sortby": "4.7.9",
"graphql": "16.8.1", "graphql": "16.8.1",
"tslib": "2.6.2" "nock": "14.0.0-beta.5",
"tslib": "2.6.2",
"vitest": "1.5.0"
}, },
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org", "registry": "https://registry.npmjs.org",

View file

@ -1,6 +1,6 @@
import retry from 'async-retry'; import retry from 'async-retry';
import { version } from '../version.js'; import { version } from '../version.js';
import { post } from './http-client.js'; import { http } from './http-client.js';
import type { Logger } from './types.js'; import type { Logger } from './types.js';
type ReadOnlyResponse = Pick<Response, 'status' | 'text' | 'json'>; type ReadOnlyResponse = Pick<Response, 'status' | 'text' | 'json'>;
@ -185,7 +185,8 @@ export function createAgent<TEvent>(
}; };
} }
const response = await post(options.endpoint, buffer, { const response = await http
.post(options.endpoint, buffer, {
headers: { headers: {
accept: 'application/json', accept: 'application/json',
'content-type': 'application/json', 'content-type': 'application/json',
@ -195,7 +196,8 @@ export function createAgent<TEvent>(
}, },
timeout: options.timeout, timeout: options.timeout,
fetchImplementation: pluginOptions.__testing?.fetch, fetchImplementation: pluginOptions.__testing?.fetch,
}).catch(error => { })
.catch(error => {
debugLog(`Attempt ${attempt} failed: ${error.message}`); debugLog(`Attempt ${attempt} failed: ${error.message}`);
return Promise.reject(error); return Promise.reject(error);
}); });

View file

@ -4,12 +4,12 @@ import {
type GraphQLSchema, type GraphQLSchema,
type subscribe as SubscribeImplementation, type subscribe as SubscribeImplementation,
} from 'graphql'; } from 'graphql';
import { post } from './internal/http-client.js'; import { version } from '../version.js';
import { createReporting } from './internal/reporting.js'; import { http } from './http-client.js';
import type { HiveClient, HivePluginOptions } from './internal/types.js'; import { createReporting } from './reporting.js';
import { createUsage } from './internal/usage.js'; import type { HiveClient, HivePluginOptions } from './types.js';
import { logIf } from './internal/utils.js'; import { createUsage } from './usage.js';
import { version } from './version.js'; import { logIf } from './utils.js';
export function createHive(options: HivePluginOptions): HiveClient { export function createHive(options: HivePluginOptions): HiveClient {
const logger = options?.agent?.logger ?? console; const logger = options?.agent?.logger ?? console;
@ -92,7 +92,7 @@ export function createHive(options: HivePluginOptions): HiveClient {
} }
`; `;
const response = await post( const response = await http.post(
endpoint, endpoint,
JSON.stringify({ JSON.stringify({
query, query,

View file

@ -1,7 +1,7 @@
import { get } from './internal/http-client.js'; import { version } from '../version.js';
import type { SchemaFetcherOptions, ServicesFetcherOptions } from './internal/types.js'; import { http } from './http-client.js';
import { createHash, joinUrl } from './internal/utils.js'; import type { SchemaFetcherOptions, ServicesFetcherOptions } from './types.js';
import { version } from './version.js'; import { createHash, joinUrl } from './utils.js';
interface Schema { interface Schema {
sdl: string; sdl: string;
@ -46,9 +46,11 @@ function createFetcher(options: SchemaFetcherOptions & ServicesFetcherOptions) {
}; };
const fetchWithRetry = (): Promise<readonly Schema[] | Schema> => { const fetchWithRetry = (): Promise<readonly Schema[] | Schema> => {
return get(endpoint, { return http
.get(endpoint, {
headers, headers,
}).then(async response => { })
.then(async response => {
if (response.ok) { if (response.ok) {
const result = await response.json(); const result = await response.json();

View file

@ -1,6 +1,6 @@
import { fetch } from '@whatwg-node/fetch'; import { fetch } from '@whatwg-node/fetch';
export function get( function get(
endpoint: string, endpoint: string,
config: { config: {
headers: Record<string, string>; headers: Record<string, string>;
@ -16,7 +16,7 @@ export function get(
}); });
} }
export async function post( function post(
endpoint: string, endpoint: string,
data: string | Buffer, data: string | Buffer,
config: { config: {
@ -34,6 +34,11 @@ export async function post(
}); });
} }
export const http = {
get,
post,
};
async function makeFetchCall( async function makeFetchCall(
endpoint: string, endpoint: string,
config: { config: {

View file

@ -8,8 +8,8 @@ import {
visit, visit,
} from 'graphql'; } from 'graphql';
import { getDocumentNodeFromSchema } from '@graphql-tools/utils'; import { getDocumentNodeFromSchema } from '@graphql-tools/utils';
import type { SchemaPublishMutation } from '../__generated__/types.js';
import { version } from '../version.js'; import { version } from '../version.js';
import type { SchemaPublishMutation } from './__generated__/types.js';
import { createAgent } from './agent.js'; import { createAgent } from './agent.js';
import type { HivePluginOptions } from './types.js'; import type { HivePluginOptions } from './types.js';
import { logIf } from './utils.js'; import { logIf } from './utils.js';

View file

@ -1,5 +1,5 @@
import { dynamicSampling } from './internal/sampling.js'; import { dynamicSampling } from './sampling.js';
import type { SamplingContext } from './internal/types.js'; import type { SamplingContext } from './types.js';
/** /**
* Every operation is reported at least once, but every next occurrence is decided by the sampler. * Every operation is reported at least once, but every next occurrence is decided by the sampler.

View file

@ -1,6 +1,6 @@
import type { ExecutionArgs } from 'graphql'; import type { ExecutionArgs } from 'graphql';
import type { autoDisposeSymbol, hiveClientSymbol } from '../client.js';
import type { AgentOptions } from './agent.js'; import type { AgentOptions } from './agent.js';
import type { autoDisposeSymbol, hiveClientSymbol } from './client.js';
import type { SchemaReporter } from './reporting.js'; import type { SchemaReporter } from './reporting.js';
export interface HiveClient { export interface HiveClient {
@ -218,11 +218,6 @@ export interface GraphQLErrorsResult {
}>; }>;
} }
export interface SupergraphSDLFetcherOptions {
endpoint: string;
key: string;
}
export interface SchemaFetcherOptions { export interface SchemaFetcherOptions {
endpoint: string; endpoint: string;
key: string; key: string;

View file

@ -23,7 +23,7 @@ import {
type ExecutionArgs, type ExecutionArgs,
} from 'graphql'; } from 'graphql';
import LRU from 'tiny-lru'; import LRU from 'tiny-lru';
import { normalizeOperation } from '@graphql-hive/core'; import { normalizeOperation } from '../normalize/operation.js';
import { version } from '../version.js'; import { version } from '../version.js';
import { createAgent } from './agent.js'; import { createAgent } from './agent.js';
import { dynamicSampling, randomSampling } from './sampling.js'; import { dynamicSampling, randomSampling } from './sampling.js';

View file

@ -1,5 +1,5 @@
import { crypto, TextEncoder } from '@whatwg-node/fetch'; import { crypto, TextEncoder } from '@whatwg-node/fetch';
import { hiveClientSymbol } from '../client.js'; import { hiveClientSymbol } from './client.js';
import type { HiveClient, HivePluginOptions } from './types.js'; import type { HiveClient, HivePluginOptions } from './types.js';
export const isCloudflareWorker = export const isCloudflareWorker =

View file

@ -1 +1,7 @@
export * from './normalize/operation.js'; export * from './normalize/operation.js';
export type { HivePluginOptions, HiveClient, CollectUsageCallback } from './client/types.js';
export { createSchemaFetcher, createServicesFetcher } from './client/gateways.js';
export { createHive, autoDisposeSymbol } from './client/client.js';
export { atLeastOnceSampler } from './client/samplers.js';
export { isHiveClient, isAsyncIterable, createHash, joinUrl } from './client/utils.js';
export { http } from './client/http-client.js';

View file

@ -0,0 +1 @@
export const version = '0.2.4';

View file

@ -1,4 +1,4 @@
import { createHive } from '../src/client'; import { createHive } from '../src/client/client.js';
test("should log that it's not enabled", async () => { test("should log that it's not enabled", async () => {
const logger = { const logger = {

View file

@ -1,6 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import nock from 'nock'; import nock from 'nock';
import { createSchemaFetcher, createServicesFetcher } from '../src/gateways'; import { createSchemaFetcher, createServicesFetcher } from '../src/client/gateways';
afterEach(() => { afterEach(() => {
nock.cleanAll(); nock.cleanAll();

View file

@ -1,6 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import nock from 'nock'; import nock from 'nock';
import { createHive } from '../src/client'; import { createHive } from '../src/client/client';
test('should not leak the exception', async () => { test('should not leak the exception', async () => {
const logger = { const logger = {

View file

@ -1,11 +1,8 @@
import { buildSchema, parse } from 'graphql'; import { buildSchema, parse } from 'graphql';
// eslint-disable-next-line import/no-extraneous-dependencies
import nock from 'nock'; import nock from 'nock';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildSubgraphSchema as buildSubgraphSchemaV1 } from '@apollo/federation'; import { buildSubgraphSchema as buildSubgraphSchemaV1 } from '@apollo/federation';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildSubgraphSchema as buildSubgraphSchemaV2 } from '@apollo/subgraph'; import { buildSubgraphSchema as buildSubgraphSchemaV2 } from '@apollo/subgraph';
import { createHive } from '../src/client'; import { createHive } from '../src/client/client';
import { version } from '../src/version'; import { version } from '../src/version';
import { waitFor } from './test-utils'; import { waitFor } from './test-utils';

View file

@ -1,5 +1,5 @@
import { buildSchema, parse } from 'graphql'; import { buildSchema, parse } from 'graphql';
import { createCollector } from '../src/internal/usage'; import { createCollector } from '../src/client/usage';
const schema = buildSchema(/* GraphQL */ ` const schema = buildSchema(/* GraphQL */ `
type Query { type Query {

View file

@ -1,9 +1,9 @@
import { buildSchema, parse } from 'graphql'; import { buildSchema, parse } from 'graphql';
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import nock from 'nock'; import nock from 'nock';
import { createHive } from '../src/client'; import { createHive } from '../src/client/client';
import type { Report } from '../src/internal/usage'; import { atLeastOnceSampler } from '../src/client/samplers';
import { atLeastOnceSampler } from '../src/samplers'; import type { Report } from '../src/client/usage';
import { version } from '../src/version'; import { version } from '../src/version';
import { waitFor } from './test-utils'; import { waitFor } from './test-utils';

View file

@ -1,4 +1,4 @@
import { cacheDocumentKey } from '../src/internal/utils'; import { cacheDocumentKey } from '../src/client/utils';
test('produce identical hash for the same document and the same keys but different values in variables', async () => { test('produce identical hash for the same document and the same keys but different values in variables', async () => {
const left = await cacheDocumentKey('doc', { a: true }); const left = await cacheDocumentKey('doc', { a: true });

4
packages/libraries/envelop/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*.log
.DS_Store
node_modules
dist

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 The Guild
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,23 @@
# Hive Client for Envelop
[Documentation](https://the-guild.dev/graphql/hive/docs/integrations/envelop)
---
[GraphQL Hive](https://the-guild.dev/graphql/hive) is a schema registry for GraphQL. With Hive you
manage and collaborate on all your GraphQL schemas and GraphQL workflows, regardless of the
underlying strategy, engine or framework youre using: this includes Schema Stitching, Apollo
Federation, or just a traditional monolith approach.
> Hive and all of its components are developed and managed as an MIT open-source project.
---
## Migration from `@graphql-hive/client`
The `@graphql-hive/client` package has been deprecated in favor of library-specific packages.
1. Install the `@graphql-hive/envelop` package.
1. Remove the `@graphql-hive/client` package from your dependencies.
1. Replace `@graphql-hive/client` with `@graphql-hive/envelop` in your codebase.
1. Done

View file

@ -0,0 +1,64 @@
{
"name": "@graphql-hive/envelop",
"version": "0.32.0",
"type": "module",
"description": "GraphQL Hive + GraphQL Envelop",
"repository": {
"type": "git",
"url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/envelop"
},
"homepage": "https://the-guild.dev/graphql/hive",
"author": {
"email": "contact@the-guild.dev",
"name": "The Guild",
"url": "https://the-guild.dev"
},
"license": "MIT",
"engines": {
"node": ">=16.0.0"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"exports": {
".": {
"require": {
"types": "./dist/typings/index.d.cts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/typings/index.d.ts",
"default": "./dist/esm/index.js"
},
"default": {
"types": "./dist/typings/index.d.ts",
"default": "./dist/esm/index.js"
}
},
"./package.json": "./package.json"
},
"typings": "dist/typings/index.d.ts",
"scripts": {
"build": "node ../../../scripts/generate-version.mjs && bob build",
"check:build": "bob check"
},
"peerDependencies": {
"@envelop/types": "^5.0.0",
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
},
"dependencies": {
"@graphql-hive/core": "workspace:*"
},
"devDependencies": {
"@envelop/types": "5.0.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public",
"directory": "dist"
},
"sideEffects": false,
"typescript": {
"definition": "dist/typings/index.d.ts"
}
}

View file

@ -1,8 +1,25 @@
import { GraphQLError } from 'graphql'; import { GraphQLError } from 'graphql';
import type { Plugin } from '@envelop/types'; import type { Plugin } from '@envelop/types';
import { autoDisposeSymbol, createHive } from './client.js'; import {
import type { HiveClient, HivePluginOptions } from './internal/types.js'; autoDisposeSymbol,
import { isAsyncIterable, isHiveClient } from './internal/utils.js'; createHive as createHiveClient,
HiveClient,
HivePluginOptions,
isAsyncIterable,
isHiveClient,
} from '@graphql-hive/core';
export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher } from '@graphql-hive/core';
export function createHive(clientOrOptions: HivePluginOptions) {
return createHiveClient({
...clientOrOptions,
agent: {
name: 'hive-client-envelop',
...clientOrOptions.agent,
},
});
}
export function useHive(clientOrOptions: HiveClient): Plugin; export function useHive(clientOrOptions: HiveClient): Plugin;
export function useHive(clientOrOptions: HivePluginOptions): Plugin; export function useHive(clientOrOptions: HivePluginOptions): Plugin;

View file

@ -0,0 +1 @@
export const version = '0.32.0';

View file

@ -0,0 +1,14 @@
{
"extends": "../../../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"baseUrl": ".",
"outDir": "dist",
"rootDir": "src",
"target": "es2017",
"module": "esnext",
"skipLibCheck": true,
"declaration": true,
"declarationMap": true
}
}

View file

@ -1,9 +1,9 @@
# GraphQL Hive - external composition # GraphQL Hive - external composition
[GraphQL Hive](https://graphql-hive.com) is a GraphQL schemas registry where you can host, manage [GraphQL Hive](https://the-guild.dev/graphql/hive) is a GraphQL schemas registry where you can host,
and collaborate on all your GraphQL schemas and operations, compatible with all architecture: schema manage and collaborate on all your GraphQL schemas and operations, compatible with all architecture:
stitching, federation, or just a good old monolith. schema stitching, federation, or just a good old monolith.
Read the Read the
["External schema composition"](https://docs.graphql-hive.com/features/external-schema-composition) ["External schema composition"](https://the-guild.dev/graphql/hive/docs/features/external-schema-composition)
to learn more. to learn more.

View file

@ -8,7 +8,7 @@
"url": "kamilkisiela/graphql-hive", "url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/external-composition" "directory": "packages/libraries/external-composition"
}, },
"homepage": "https://graphql-hive.com", "homepage": "https://the-guild.dev/graphql/hive",
"author": { "author": {
"email": "contact@the-guild.dev", "email": "contact@the-guild.dev",
"name": "The Guild", "name": "The Guild",

4
packages/libraries/yoga/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*.log
.DS_Store
node_modules
dist

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 The Guild
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,24 @@
# Hive Client for GraphQL Yoga
[Documentation](https://the-guild.dev/graphql/hive/docs/integrations/graphql-yoga)
---
[GraphQL Hive](https://the-guild.dev/graphql/hive) is a schema registry for GraphQL. With Hive you
manage and collaborate on all your GraphQL schemas and GraphQL workflows, regardless of the
underlying strategy, engine or framework youre using: this includes Schema Stitching, Apollo
Federation, or just a traditional monolith approach.
> Hive and all of its components are developed and managed as an MIT open-source project.
---
## Migration from `@graphql-hive/client`
The `@graphql-hive/client` package has been deprecated in favor of library-specific packages.
1. Install the `@graphql-hive/yoga` package.
1. Remove the `@graphql-hive/client` package from your dependencies.
1. Replace `@graphql-hive/client` with `@graphql-hive/yoga` in your codebase.
1. Replace `useYogaHive` with `useHive`, and `createYogaHive` with `createHive` in your codebase.
1. Done

View file

@ -1,14 +1,14 @@
{ {
"name": "@graphql-hive/client", "name": "@graphql-hive/yoga",
"version": "0.32.0", "version": "0.32.0",
"type": "module", "type": "module",
"description": "A NodeJS client for GraphQL Hive", "description": "GraphQL Hive + GraphQL Yoga",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "kamilkisiela/graphql-hive", "url": "kamilkisiela/graphql-hive",
"directory": "packages/libraries/client" "directory": "packages/libraries/yoga"
}, },
"homepage": "https://graphql-hive.com", "homepage": "https://the-guild.dev/graphql/hive",
"author": { "author": {
"email": "contact@the-guild.dev", "email": "contact@the-guild.dev",
"name": "The Guild", "name": "The Guild",
@ -16,7 +16,7 @@
}, },
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=16.0.0"
}, },
"main": "dist/cjs/index.js", "main": "dist/cjs/index.js",
"module": "dist/esm/index.js", "module": "dist/esm/index.js",
@ -39,39 +39,26 @@
}, },
"typings": "dist/typings/index.d.ts", "typings": "dist/typings/index.d.ts",
"scripts": { "scripts": {
"build": "node scripts/update-version.mjs && bob build", "build": "node ../../../scripts/generate-version.mjs && bob build",
"check:build": "bob check" "check:build": "bob check"
}, },
"peerDependencies": { "peerDependencies": {
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
"graphql-yoga": "^5.0.0"
}, },
"dependencies": { "dependencies": {
"@graphql-hive/core": "^0.2.4", "@graphql-hive/core": "workspace:*",
"@graphql-tools/utils": "^10.0.0",
"@whatwg-node/fetch": "0.9.17",
"async-retry": "1.3.3",
"tiny-lru": "8.0.2" "tiny-lru": "8.0.2"
}, },
"optionalDependencies": {
"@apollo/server": "^4.0.0",
"@envelop/types": "^5.0.0"
},
"devDependencies": { "devDependencies": {
"@apollo/federation": "0.38.1",
"@apollo/server": "4.10.3",
"@apollo/subgraph": "2.7.3",
"@envelop/types": "5.0.0",
"@graphql-tools/schema": "10.0.3", "@graphql-tools/schema": "10.0.3",
"@graphql-yoga/plugin-defer-stream": "3.2.0", "@graphql-yoga/plugin-defer-stream": "3.2.0",
"@graphql-yoga/plugin-disable-introspection": "2.2.0", "@graphql-yoga/plugin-disable-introspection": "2.2.0",
"@graphql-yoga/plugin-graphql-sse": "3.2.0", "@graphql-yoga/plugin-graphql-sse": "3.2.0",
"@graphql-yoga/plugin-response-cache": "3.4.0", "@graphql-yoga/plugin-response-cache": "3.4.0",
"@types/async-retry": "1.4.8", "@whatwg-node/fetch": "0.9.17",
"body-parser": "1.20.2",
"express": "4.19.2",
"graphql": "16.8.1",
"graphql-ws": "5.16.0", "graphql-ws": "5.16.0",
"graphql-yoga": "5.2.0", "graphql-yoga": "5.3.0",
"nock": "14.0.0-beta.5", "nock": "14.0.0-beta.5",
"vitest": "1.5.0", "vitest": "1.5.0",
"ws": "8.16.0" "ws": "8.16.0"

View file

@ -8,9 +8,17 @@ import {
} from 'graphql'; } from 'graphql';
import type { GraphQLParams, Plugin } from 'graphql-yoga'; import type { GraphQLParams, Plugin } from 'graphql-yoga';
import LRU from 'tiny-lru'; import LRU from 'tiny-lru';
import { autoDisposeSymbol, createHive as createHiveClient } from './client.js'; import {
import type { CollectUsageCallback, HiveClient, HivePluginOptions } from './internal/types.js'; autoDisposeSymbol,
import { isAsyncIterable, isHiveClient } from './internal/utils.js'; CollectUsageCallback,
createHive as createHiveClient,
HiveClient,
HivePluginOptions,
isAsyncIterable,
isHiveClient,
} from '@graphql-hive/core';
export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher } from '@graphql-hive/core';
type CacheRecord = { type CacheRecord = {
callback: CollectUsageCallback; callback: CollectUsageCallback;

View file

@ -0,0 +1 @@
export const version = '0.32.0';

View file

@ -1,22 +1,176 @@
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
import { createServer } from 'node:http'; import { createServer } from 'node:http';
import { GraphQLError } from 'graphql'; import { GraphQLError } from 'graphql';
import { createClient } from 'graphql-ws'; import { createClient } from 'graphql-ws';
import { useServer as useWSServer } from 'graphql-ws/lib/use/ws'; import { useServer as useWSServer } from 'graphql-ws/lib/use/ws';
import { createLogger, createSchema, createYoga } from 'graphql-yoga'; import { createLogger, createSchema, createYoga } from 'graphql-yoga';
import nock from 'nock'; import nock from 'nock';
import { beforeAll, describe, expect, test, vi } from 'vitest';
import { WebSocket, WebSocketServer } from 'ws'; import { WebSocket, WebSocketServer } from 'ws';
import { useDeferStream } from '@graphql-yoga/plugin-defer-stream'; import { useDeferStream } from '@graphql-yoga/plugin-defer-stream';
import { useDisableIntrospection } from '@graphql-yoga/plugin-disable-introspection'; import { useDisableIntrospection } from '@graphql-yoga/plugin-disable-introspection';
import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse'; import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse';
import { useResponseCache } from '@graphql-yoga/plugin-response-cache'; import { useResponseCache } from '@graphql-yoga/plugin-response-cache';
import { useHive } from '../src/yoga.js'; import { Response } from '@whatwg-node/fetch';
import { createHive, useHive } from '../src/index.js';
beforeAll(() => { beforeAll(() => {
nock.cleanAll(); nock.cleanAll();
}); });
it('reports usage', async ({ expect }) => { function waitFor(ms: number) {
return new Promise<void>(resolve => {
setTimeout(resolve, ms);
});
}
const typeDefs = /* GraphQL */ `
type Query {
hello: String
}
`;
const resolvers = {
Query: {
hello() {
return 'Hello world';
},
},
};
function handleProcess() {
function fail(error: any) {
throw error;
}
process.once('uncaughtException', fail);
process.once('unhandledRejection', fail);
return () => {
process.removeListener('uncaughtException', fail);
process.removeListener('unhandledRejection', fail);
};
}
test('should not interrupt the process', async () => {
const logger = {
error: vi.fn(),
info: vi.fn(),
};
const clean = handleProcess();
const hive = createHive({
enabled: true,
debug: true,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
logger,
},
reporting: {
endpoint: 'http://404.localhost/registry',
author: 'jest',
commit: 'js',
},
usage: {
endpoint: 'http://404.localhost/usage',
},
});
const yoga = createYoga({
schema: createSchema({
typeDefs,
resolvers,
}),
plugins: [useHive(hive)],
logging: false,
});
await yoga.fetch(
new Request('http://localhost/graphql', {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
},
}),
);
await waitFor(50);
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][info] Error'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][reporting] Failed'));
expect(logger.error).toHaveBeenCalledWith(expect.stringContaining('[hive][usage] Failed'));
await hive.dispose();
clean();
}, 1_000);
test('should capture client name and version headers', async () => {
const fetchSpy = vi.fn<[RequestInfo | URL, options: RequestInit | undefined]>(async () =>
Response.json({}, { status: 200 }),
);
const clean = handleProcess();
const hive = createHive({
enabled: true,
debug: false,
token: 'my-token',
agent: {
maxRetries: 0,
sendInterval: 10,
timeout: 50,
__testing: {
fetch: fetchSpy,
},
},
reporting: false,
usage: {
endpoint: 'http://yoga.localhost:4200/usage',
},
});
const yoga = createYoga({
schema: createSchema({
typeDefs,
resolvers,
}),
plugins: [useHive(hive)],
logging: false,
});
await yoga.fetch(`http://localhost/graphql`, {
method: 'POST',
body: JSON.stringify({
query: /* GraphQL */ `
{
hello
}
`,
}),
headers: {
'content-type': 'application/json',
'x-graphql-client-name': 'vitest',
'x-graphql-client-version': '1.0.0',
},
});
await waitFor(50);
await hive.dispose();
clean();
expect(fetchSpy).toHaveBeenCalledWith(
'http://yoga.localhost:4200/usage',
expect.objectContaining({
body: expect.stringContaining('"client":{"name":"vitest","version":"1.0.0"}'),
}),
);
}, 1_000);
test('reports usage', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -194,7 +348,7 @@ test('reports usage with response cache', async ({ expect }) => {
graphqlScope.done(); graphqlScope.done();
}); });
it('does not report usage for operation that does not pass validation', async ({ expect }) => { test('does not report usage for operation that does not pass validation', async ({ expect }) => {
const callback = vi.fn(); const callback = vi.fn();
const yoga = createYoga({ const yoga = createYoga({
schema: createSchema({ schema: createSchema({
@ -255,7 +409,7 @@ it('does not report usage for operation that does not pass validation', async ({
expect(callback).not.toHaveBeenCalled(); expect(callback).not.toHaveBeenCalled();
}); });
it('does not report usage if context creating raises an error', async ({ expect }) => { test('does not report usage if context creating raises an error', async ({ expect }) => {
const callback = vi.fn(); const callback = vi.fn();
const yoga = createYoga({ const yoga = createYoga({
@ -319,7 +473,7 @@ it('does not report usage if context creating raises an error', async ({ expect
describe('subscription usage reporting', () => { describe('subscription usage reporting', () => {
describe('built-in see', () => { describe('built-in see', () => {
it('reports usage for successful subscription operation', async ({ expect }) => { test('reports usage for successful subscription operation', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toEqual({ expect(body.map).toEqual({
@ -427,13 +581,14 @@ describe('subscription usage reporting', () => {
: :
event: complete event: complete
data:
`); `);
})().catch(reject); })().catch(reject);
}); });
graphqlScope.done(); graphqlScope.done();
}); });
it('reports usage for exception from subscription event stream', async ({ expect }) => { test('reports usage for exception from subscription event stream', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -548,6 +703,7 @@ describe('subscription usage reporting', () => {
data: {"errors":[{"message":"Unexpected error.","locations":[{"line":1,"column":1}]}]} data: {"errors":[{"message":"Unexpected error.","locations":[{"line":1,"column":1}]}]}
event: complete event: complete
data:
`); `);
})().catch(reject); })().catch(reject);
}); });
@ -556,7 +712,7 @@ describe('subscription usage reporting', () => {
}); });
describe('@graphql-yoga/plugin-graphql-sse (distinct connection mode)', () => { describe('@graphql-yoga/plugin-graphql-sse (distinct connection mode)', () => {
it('reports usage for successful subscription operation', async ({ expect }) => { test('reports usage for successful subscription operation', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -677,7 +833,7 @@ describe('subscription usage reporting', () => {
graphqlScope.done(); graphqlScope.done();
}); });
it.skip('reports usage for exception from subscription event stream', async ({ expect }) => { test.skip('reports usage for exception from subscription event stream', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -795,7 +951,7 @@ describe('subscription usage reporting', () => {
}); });
describe('graphql-ws', () => { describe('graphql-ws', () => {
it('reports usage for successful subscription operation', async ({ expect }) => { test('reports usage for successful subscription operation', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -967,7 +1123,7 @@ describe('subscription usage reporting', () => {
}); });
graphqlScope.done(); graphqlScope.done();
}); });
it.skip('reports usage for exception from subscription event stream', async ({ expect }) => { test.skip('reports usage for exception from subscription event stream', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`
@ -1140,7 +1296,7 @@ describe('subscription usage reporting', () => {
}); });
describe('incremental delivery usage reporting', () => { describe('incremental delivery usage reporting', () => {
it('reports usage for successful incremental deliver operation', async ({ expect }) => { test('reports usage for successful incremental deliver operation', async ({ expect }) => {
const graphqlScope = nock('http://localhost') const graphqlScope = nock('http://localhost')
.post('/usage', body => { .post('/usage', body => {
expect(body.map).toMatchInlineSnapshot(` expect(body.map).toMatchInlineSnapshot(`

View file

@ -0,0 +1,14 @@
{
"extends": "../../../tsconfig.json",
"include": ["src"],
"compilerOptions": {
"baseUrl": ".",
"outDir": "dist",
"rootDir": "src",
"target": "es2017",
"module": "esnext",
"skipLibCheck": true,
"declaration": true,
"declarationMap": true
}
}

View file

@ -3,7 +3,7 @@
# Background # Background
Hive comes with support for Apollo Federation v2, based on Hive comes with support for Apollo Federation v2, based on
[external composition](https://docs.graphql-hive.com/features/external-schema-composition). [external composition](https://the-guild.dev/graphql/hive/docs/features/external-schema-composition).
This package provides a reference for running external composition as a NodeJS service, on your This package provides a reference for running external composition as a NodeJS service, on your
local infrastructure, and connect GraphQL Hive (Cloud or self-service). local infrastructure, and connect GraphQL Hive (Cloud or self-service).
@ -56,7 +56,7 @@ node dist/index.js
## Hive Integration ## Hive Integration
[Here you can find instructions on how to integrate your external composition service with Hive](https://docs.graphql-hive.com/features/external-schema-composition#configuration). [Here you can find instructions on how to integrate your external composition service with Hive](https://the-guild.dev/graphql/hive/docs/features/external-schema-composition#configuration).
You'll need to use the public address of your service, and the secret you selected. You'll need to use the public address of your service, and the secret you selected.

View file

@ -23,7 +23,7 @@
"@escape.tech/graphql-armor-max-tokens": "2.3.0", "@escape.tech/graphql-armor-max-tokens": "2.3.0",
"@fastify/cors": "9.0.1", "@fastify/cors": "9.0.1",
"@fastify/formbody": "7.4.0", "@fastify/formbody": "7.4.0",
"@graphql-hive/client": "workspace:*", "@graphql-hive/yoga": "workspace:*",
"@graphql-yoga/plugin-persisted-operations": "3.2.0", "@graphql-yoga/plugin-persisted-operations": "3.2.0",
"@graphql-yoga/plugin-response-cache": "3.4.0", "@graphql-yoga/plugin-response-cache": "3.4.0",
"@hive/api": "workspace:*", "@hive/api": "workspace:*",

View file

@ -18,7 +18,7 @@ import { useGraphQlJit } from '@envelop/graphql-jit';
import { useGraphQLModules } from '@envelop/graphql-modules'; import { useGraphQLModules } from '@envelop/graphql-modules';
import { useOpenTelemetry } from '@envelop/opentelemetry'; import { useOpenTelemetry } from '@envelop/opentelemetry';
import { useSentry } from '@envelop/sentry'; import { useSentry } from '@envelop/sentry';
import { useYogaHive } from '@graphql-hive/client'; import { useHive } from '@graphql-hive/yoga';
import { usePersistedOperations } from '@graphql-yoga/plugin-persisted-operations'; import { usePersistedOperations } from '@graphql-yoga/plugin-persisted-operations';
import { useResponseCache } from '@graphql-yoga/plugin-response-cache'; import { useResponseCache } from '@graphql-yoga/plugin-response-cache';
import { Registry, RegistryContext } from '@hive/api'; import { Registry, RegistryContext } from '@hive/api';
@ -176,7 +176,7 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
return resolveUser(ctx); return resolveUser(ctx);
}, },
}), }),
useYogaHive({ useHive({
debug: true, debug: true,
enabled: !!options.hiveConfig, enabled: !!options.hiveConfig,
token: options.hiveConfig?.token ?? '', token: options.hiveConfig?.token ?? '',

View file

@ -86,7 +86,6 @@ export function PolicyListItem(props: {
<div> <div>
<SeverityLevelToggle canTurnOff={props.overridingParentRule} rule={ruleInfo.id} /> <SeverityLevelToggle canTurnOff={props.overridingParentRule} rule={ruleInfo.id} />
</div> </div>
{/* eslint-disable-next-line tailwindcss/no-unnecessary-arbitrary-value */}
<div className="grid grow grid-cols-4 align-middle [&>*]:min-h-[40px] [&>*]:border-l-[1px] [&>*]:border-l-gray-800"> <div className="grid grow grid-cols-4 align-middle [&>*]:min-h-[40px] [&>*]:border-l-[1px] [&>*]:border-l-gray-800">
{shouldShowRuleConfig && ( {shouldShowRuleConfig && (
<PolicyRuleConfig <PolicyRuleConfig

View file

@ -1,17 +1,26 @@
import { Cards } from 'nextra/components' import { Cards } from 'nextra/components'
import { Tabs } from '@theguild/components'
# Hive Client # Hive Client
**Hive Client** is a set of libraries and utilities for interacting with Hive, for both **Hive Client** is a set of libraries and utilities for interacting with Hive, for both
[Schema Registry](/docs/features/schema-registry) and [Schema Registry](../features/schema-registry.mdx) and
[Usage Reporting](/docs/features/usage-reporting). [Usage Reporting](../features/usage-reporting.mdx).
## Available Clients ## Available Clients
### JavaScript / NodeJS Client ### JavaScript / NodeJS Clients
[`@graphql-hive/client`](https://npmjs.com/package/@graphql-hive/client) is the official library for Here's a list of official libraries for JavaScript and NodeJS:
interacting with Hive's **Schema Registry** and **Usage Reporting**.
- `@graphql-hive/yoga` ([npm](https://npmjs.com/package/@graphql-hive/yoga),
[guide](../integrations/graphql-yoga)) - Integration with GraphQL Yoga.
- `@graphql-hive/apollo` ([npm](https://npmjs.com/package/@graphql-hive/apollo),
[guide](../integrations/apollo-server)) - Integration with Apollo Server.
- `@graphql-hive/envelop` ([npm](https://npmjs.com/package/@graphql-hive/envelop),
[guide](../integrations/envelop)) - Integration with Envelop.
- `@graphql-hive/core` ([npm](https://npmjs.com/package/@graphql-hive/core)) - core library for
interacting with Hive's **Schema Registry** and **Usage Reporting**.
You can refer to the following guides for getting started within your project, then revisit this You can refer to the following guides for getting started within your project, then revisit this
page for configuring the client to your needs. page for configuring the client to your needs.
@ -28,8 +37,9 @@ page for configuring the client to your needs.
#### Configuration #### Configuration
Refer to the Refer to the
[`HivePluginOptions` interface](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) [`HivePluginOptions` interface](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/core/src/client/types.ts)
for complete list of options and configurations you can pass to the Hive JavaScript Client. for complete list of options and configurations you can pass to the Hive JavaScript Client of
choice.
#### Client Information #### Client Information
@ -41,13 +51,13 @@ key within the `connectionParams`.
You can fully customize how to retrieve the client information by passing a custom `clientInfo` You can fully customize how to retrieve the client information by passing a custom `clientInfo`
implementation. implementation.
You can pass a custom `clientInfo` callback to the `HivePluginOptions` to have full control on how You can pass a custom `clientInfo` callback to have full control on how you detect a client's
you detect a client's information. information.
```ts ```ts
const config: HivePluginOptions = { useHive({
usage: { usage: {
clientInfo(context) { clientInfo(context /* Your GraphQL execution context */) {
const name = context?.headers?.['x-graphql-client-name'] const name = context?.headers?.['x-graphql-client-name']
const version = context?.headers?.['x-graphql-client-version'] const version = context?.headers?.['x-graphql-client-version']
@ -58,7 +68,7 @@ const config: HivePluginOptions = {
return null return null
} }
} }
} })
``` ```
The context object is the context object as used within the GraphQL execution. Depending on your The context object is the context object as used within the GraphQL execution. Depending on your
@ -72,11 +82,11 @@ You can pass a custom `exclude` array to the `HivePluginOptions` to ignore speci
being reported to Hive. being reported to Hive.
```ts ```ts
const config: HivePluginOptions = { useHive({
usage: { usage: {
exclude: ['unwantedOperationName', 'anotherOperationName'] exclude: ['unwantedOperationName', 'anotherOperationName']
} }
} })
``` ```
#### Sampling #### Sampling
@ -112,6 +122,12 @@ A sample rate between 0 and 1.
- `true` = 100% - `true` = 100%
- `false` = 0% - `false` = 0%
The `samplingContext` object contains the following properties:
- `operationName` - The name of the operation.
- `document` - The operation AST.
- `contextValue` - The context value passed to the GraphQL execution.
```typescript ```typescript
useHive({ useHive({
/* ... other options ... */, /* ... other options ... */,
@ -133,10 +149,22 @@ If you want to make sure that every operation is reported at least once, you can
`atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is `atLeastOnceSampler`. Every operation is reported at least once, but every next occurrence is
decided by the sampler. decided by the sampler.
```typescript Both `keyFn` and `sampler` are required and receive the same `samplingContext` object.
import { useHive, atLeastOnceSampler} from '@graphql-hive/client';
useHive({ The `samplingContext` object contains the following properties:
- `operationName` - The name of the operation.
- `document` - The operation AST.
- `contextValue` - The context value passed to the GraphQL execution.
<Tabs items={['Custom', 'GraphQL Yoga', 'Apollo Server', 'Envelop']}>
<Tabs.Tab>
```typescript
import { createHive, atLeastOnceSampler} from '@graphql-hive/core';
const hive = createHive({
/* ... other options ... */, /* ... other options ... */,
usage: { usage: {
sampler: atLeastOnceSampler({ sampler: atLeastOnceSampler({
@ -148,7 +176,12 @@ useHive({
// and some operations may have the same name but different body. // and some operations may have the same name but different body.
return samplingContext.operationName; return samplingContext.operationName;
}, },
sampler(_samplingContext) { sampler(samplingContext) {
// Use the context to decide if the operation should be sent to Hive.
if (samplingContext.contextValue.headers.get('x-graphql-client-name') === 'WebApp') {
return 1; // 100% of the operations from WebApp will be sent to Hive
}
const hour = new Date().getHours(); const hour = new Date().getHours();
if (hour >= 9 && hour <= 17) { if (hour >= 9 && hour <= 17) {
@ -162,13 +195,131 @@ useHive({
}) })
``` ```
</Tabs.Tab>
<Tabs.Tab>
```typescript
import { useHive, atLeastOnceSampler} from '@graphql-hive/yoga';
useHive({
/* ... other options ... */,
usage: {
sampler: atLeastOnceSampler({
// Produces a unique key for a given GraphQL request.
// This key is used to determine the uniqueness of a GraphQL operation.
keyFn(samplingContext) {
// Operation name is a good candidate for a key, but not perfect,
// as not all operations have names
// and some operations may have the same name but different body.
return samplingContext.operationName;
},
sampler(samplingContext) {
// Use the context to decide if the operation should be sent to Hive.
if (samplingContext.contextValue.headers.get('x-graphql-client-name') === 'WebApp') {
return 1; // 100% of the operations from WebApp will be sent to Hive
}
const hour = new Date().getHours();
if (hour >= 9 && hour <= 17) {
return 0.3;
}
return 0.8;
}
})
}
})
```
</Tabs.Tab>
<Tabs.Tab>
```typescript
import { useHive, atLeastOnceSampler} from '@graphql-hive/apollo';
useHive({
/* ... other options ... */,
usage: {
sampler: atLeastOnceSampler({
// Produces a unique key for a given GraphQL request.
// This key is used to determine the uniqueness of a GraphQL operation.
keyFn(samplingContext) {
// Operation name is a good candidate for a key, but not perfect,
// as not all operations have names
// and some operations may have the same name but different body.
return samplingContext.operationName;
},
sampler(samplingContext) {
// Use the context to decide if the operation should be sent to Hive.
if (samplingContext.contextValue.headers.get('x-graphql-client-name') === 'WebApp') {
return 1; // 100% of the operations from WebApp will be sent to Hive
}
const hour = new Date().getHours();
if (hour >= 9 && hour <= 17) {
return 0.3;
}
return 0.8;
}
})
}
})
```
</Tabs.Tab>
<Tabs.Tab>
```typescript
import { useHive, atLeastOnceSampler} from '@graphql-hive/envelop';
useHive({
/* ... other options ... */,
usage: {
sampler: atLeastOnceSampler({
// Produces a unique key for a given GraphQL request.
// This key is used to determine the uniqueness of a GraphQL operation.
keyFn(samplingContext) {
// Operation name is a good candidate for a key, but not perfect,
// as not all operations have names
// and some operations may have the same name but different body.
return samplingContext.operationName;
},
sampler(samplingContext) {
// Use the context to decide if the operation should be sent to Hive.
if (samplingContext.contextValue.headers.get('x-graphql-client-name') === 'WebApp') {
return 1; // 100% of the operations from WebApp will be sent to Hive
}
const hour = new Date().getHours();
if (hour >= 9 && hour <= 17) {
return 0.3;
}
return 0.8;
}
})
}
})
```
</Tabs.Tab>
</Tabs>
#### Custom Integration #### Custom Integration
If your GraphQL server is not listed above, you can implement a custom integration. Start by If your GraphQL server is not listed above, you can implement a custom integration. Start by
importing and creating a Hive instance using the `createHive` function. importing and creating a Hive instance using the `createHive` function.
```ts ```ts
import { createHive } from '@graphql-hive/client' import { createHive } from '@graphql-hive/core'
const hive = createHive({ const hive = createHive({
enabled: true, enabled: true,

View file

@ -154,7 +154,7 @@ will return `200 OK` with the new data and new `ETag` header.
Using `ETag` and `If-None-Match` helps to prevent unnecessary data transfer. Using `ETag` and `If-None-Match` helps to prevent unnecessary data transfer.
The [`@graphql-hive/client`](/docs/api-reference/client#javascript--nodejs-client) package uses this The [`@graphql-hive/core`](/docs/api-reference/client#javascript--nodejs-client) package uses this
feature to save bandwidth and improve performance. feature to save bandwidth and improve performance.
## CDN Hosts ## CDN Hosts

View file

@ -1,5 +1,4 @@
import NextImage from 'next/image' import NextImage from 'next/image'
import { Tab, Tabs } from 'nextra-theme-docs'
import { Callout } from '@theguild/components' import { Callout } from '@theguild/components'
import monitoringViewImage from '../../../../public/docs/pages/features/monitoring-view.png' import monitoringViewImage from '../../../../public/docs/pages/features/monitoring-view.png'
import usageClientsImage from '../../../../public/docs/pages/features/usage-clients.png' import usageClientsImage from '../../../../public/docs/pages/features/usage-clients.png'

View file

@ -481,7 +481,7 @@ GraphQL gateway using GraphQL-Yoga:
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { buildSchema } from 'graphql' import { buildSchema } from 'graphql'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { createServicesFetcher } from '@graphql-hive/client' import { createServicesFetcher } from '@graphql-hive/core'
import { stitchSchemas } from '@graphql-tools/stitch' import { stitchSchemas } from '@graphql-tools/stitch'
import { stitchingDirectives } from '@graphql-tools/stitching-directives' import { stitchingDirectives } from '@graphql-tools/stitching-directives'

View file

@ -35,7 +35,7 @@ flowchart LR
## Installation ## Installation
```sh npm2yarn ```sh npm2yarn
npm i @graphql-hive/client npm i @graphql-hive/apollo
``` ```
<Callout type="info"> <Callout type="info">
@ -43,7 +43,7 @@ npm i @graphql-hive/client
includes a runtime to send usage reports and schemas to Hive registry. includes a runtime to send usage reports and schemas to Hive registry.
</Callout> </Callout>
The `@graphql-hive/client` package exports a utility function called `createSupergraphManager` that The `@graphql-hive/apollo` package exports a utility function called `createSupergraphManager` that
fetches the Supergraph schema from the Hive's CDN, and also a fetches the Supergraph schema from the Hive's CDN, and also a
[Apollo-Server plugin](https://www.apollographql.com/docs/apollo-server/) for reporting operations. [Apollo-Server plugin](https://www.apollographql.com/docs/apollo-server/) for reporting operations.
@ -58,7 +58,7 @@ With the endpoint and CDN access token available, you can integrate Hive with Ap
import { ApolloGateway } from '@apollo/gateway' import { ApolloGateway } from '@apollo/gateway'
import { ApolloServer } from '@apollo/server' import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone' import { startStandaloneServer } from '@apollo/server/standalone'
import { createSupergraphManager } from '@graphql-hive/client' import { createSupergraphManager } from '@graphql-hive/apollo'
const gateway = new ApolloGateway({ const gateway = new ApolloGateway({
// Apollo Gateway will fetch Supergraph from Hive CDN // Apollo Gateway will fetch Supergraph from Hive CDN
@ -88,7 +88,7 @@ To enable Usage Reporting with your Apollo Gateway, you can use the Hive plugin
import { ApolloGateway } from '@apollo/gateway' import { ApolloGateway } from '@apollo/gateway'
import { ApolloServer } from '@apollo/server' import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone' import { startStandaloneServer } from '@apollo/server/standalone'
import { createSupergraphManager, hiveApollo } from '@graphql-hive/client' import { createSupergraphManager, useHive } from '@graphql-hive/apollo'
const gateway = new ApolloGateway({ const gateway = new ApolloGateway({
// Apollo Gateway will fetch Supergraph from Hive CDN // Apollo Gateway will fetch Supergraph from Hive CDN
@ -102,7 +102,7 @@ const gateway = new ApolloGateway({
const server = new ApolloServer({ const server = new ApolloServer({
gateway, gateway,
plugins: [ plugins: [
hiveApollo({ useHive({
enabled: true, enabled: true,
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
usage: true // add this one to report usage and operations usage: true // add this one to report usage and operations
@ -125,5 +125,5 @@ console.log(`🚀 Server ready at ${url}`)
- [Get started with Apollo Federation and Hive guide](/docs/get-started/apollo-federation) - [Get started with Apollo Federation and Hive guide](/docs/get-started/apollo-federation)
- [Apollo Gateway documentation](https://www.apollographql.com/docs/federation/v1/gateway/) - [Apollo Gateway documentation](https://www.apollographql.com/docs/federation/v1/gateway/)
- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) - [Apollo Server](https://www.apollographql.com/docs/apollo-server/)
- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) - [`@graphql-hive/apollo` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/apollo)
- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) - [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/core/src/client/types.ts)

View file

@ -3,7 +3,7 @@ import { Callout } from '@theguild/components'
# Apollo-Server # Apollo-Server
You can send usage reports to the Hive registry from your Apollo-Server instance using the You can send usage reports to the Hive registry from your Apollo-Server instance using the
`@graphql-hive/client` package. `@graphql-hive/apollo` package.
<Callout type="warning"> <Callout type="warning">
In case you want to use Apollo-Server as a Federation gateway, please refer to the [Apollo Gateway In case you want to use Apollo-Server as a Federation gateway, please refer to the [Apollo Gateway
@ -13,7 +13,7 @@ You can send usage reports to the Hive registry from your Apollo-Server instance
## Installation ## Installation
```sh npm2yarn ```sh npm2yarn
npm i @graphql-hive/client npm i @graphql-hive/apollo
``` ```
<Callout type="info"> <Callout type="info">
@ -21,10 +21,15 @@ npm i @graphql-hive/client
includes a runtime to send usage reports to the Hive registry. includes a runtime to send usage reports to the Hive registry.
</Callout> </Callout>
The `@graphql-hive/client` package exports a The `@graphql-hive/apollo` package exports a
[Apollo-Server plugin](https://www.apollographql.com/docs/apollo-server/), that can be used [Apollo-Server plugin](https://www.apollographql.com/docs/apollo-server/), that can be used
directly. directly.
## Configuration
A full configuration guide can be found in the
["Configuration"](../api-reference/client.mdx#configuration) page.
## Integration ## Integration
### Publishing Schemas ### Publishing Schemas
@ -34,12 +39,12 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process.
### Usage Reporting ### Usage Reporting
You can report usage to the Hive registry by using the `@graphql-hive/client` package. Depending on You can report usage to the Hive registry by using the `@graphql-hive/apollo` package. Depending on
your GraphQL server setup the configuration might differ. your GraphQL server setup the configuration might differ.
<Callout> <Callout>
For more configuration options, such as sampling, please refer to the [Hive client For more configuration options, such as sampling, please refer to the [Hive client
configuration](/docs/api-reference/client#configuration) reference. configuration](../api-reference/client.mdx#configuration) reference.
</Callout> </Callout>
#### GraphQL over HTTP (default) #### GraphQL over HTTP (default)
@ -47,14 +52,14 @@ your GraphQL server setup the configuration might differ.
You can send usage reporting to Hive registry by using the `usage` section of the configuration: You can send usage reporting to Hive registry by using the `usage` section of the configuration:
```ts filename="Node.js Apollo Server S setup" {8-12,19-21} ```ts filename="Node.js Apollo Server S setup" {8-12,19-21}
import { ApolloServer } from 'apollo-server' import { ApolloServer } from '@apollo/server'
import { startStandaloneServer } from '@apollo/server/standalone' import { startStandaloneServer } from '@apollo/server/standalone'
import { hiveApollo } from '@graphql-hive/client' import { useHive } from '@graphql-hive/apollo'
const testServer = new ApolloServer({ const testServer = new ApolloServer({
schema, schema,
plugins: [ plugins: [
hiveApollo({ useHive({
enabled: true, enabled: true,
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
usage: true usage: true
@ -90,7 +95,7 @@ curl \
-H "accept: application/json" \ -H "accept: application/json" \
-X POST \ -X POST \
"http://localhost:4000/graphql" \ "http://localhost:4000/graphql" \
-d '{"query":"{ hello }"} -d '{"query":"{ hello }"}'
``` ```
<Callout type='info'> <Callout type='info'>
@ -126,7 +131,7 @@ import { WebSocketServer } from 'ws'
import { ApolloServer } from '@apollo/server' import { ApolloServer } from '@apollo/server'
import { expressMiddleware } from '@apollo/server/express4' import { expressMiddleware } from '@apollo/server/express4'
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer' import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'
import { createHive, hiveApollo } from '@graphql-hive/client' import { createHive, useHive } from '@graphql-hive/apollo'
import schema from './schema' import schema from './schema'
const PORT = 3000 const PORT = 3000
@ -157,7 +162,7 @@ const serverCleanup = useServer(
const server = new ApolloServer({ const server = new ApolloServer({
schema, schema,
plugins: [ plugins: [
hiveApollo(hiveClient), useHive(hiveClient),
ApolloServerPluginDrainHttpServer({ httpServer }), ApolloServerPluginDrainHttpServer({ httpServer }),
{ {
async serverWillStart() { async serverWillStart() {
@ -209,6 +214,6 @@ const client = createClient({
## Additional Resources ## Additional Resources
- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) - [`@graphql-hive/apollo` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/apollo)
- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) - [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/core/src/client/types.ts)
- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) - [Apollo Server](https://www.apollographql.com/docs/apollo-server/)

View file

@ -10,7 +10,7 @@ import { Callout } from '@theguild/components'
## Installation ## Installation
```sh npm2yarn ```sh npm2yarn
npm i @graphql-hive/client npm i @graphql-hive/envelop
``` ```
<Callout type="info"> <Callout type="info">
@ -18,10 +18,15 @@ npm i @graphql-hive/client
includes a runtime to send usage reports and schemas to Hive registry. includes a runtime to send usage reports and schemas to Hive registry.
</Callout> </Callout>
The `@graphql-hive/client` package exports an The `@graphql-hive/envelop` package exports an
[Envelop plugin](https://the-guild.dev/graphql/envelop), that can be used directly with any server [Envelop plugin](https://the-guild.dev/graphql/envelop), that can be used directly with any server
that supports Envelop. that supports Envelop.
## Configuration
A full configuration guide can be found in the
["Configuration"](../api-reference/client.mdx#configuration) page.
## Integration Guide ## Integration Guide
### Publishing Schemas ### Publishing Schemas
@ -33,7 +38,7 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process.
<Callout> <Callout>
For more configuration options, such as sampling, client name and version reporting, please refer For more configuration options, such as sampling, client name and version reporting, please refer
to the [Hive client configuration](/docs/api-reference/client#configuration) reference. to the [Hive client configuration](../api-reference/client.mdx#configuration) reference.
</Callout> </Callout>
You can send usage reporting to Hive registry by using the `usage` section of the configuration: You can send usage reporting to Hive registry by using the `usage` section of the configuration:
@ -41,6 +46,7 @@ You can send usage reporting to Hive registry by using the `usage` section of th
```ts ```ts
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { useHive } from '@graphql-hive/envelop'
import { schema } from './schema' import { schema } from './schema'
const plugin = useHive({ const plugin = useHive({
@ -52,6 +58,6 @@ const plugin = useHive({
## Additional Resources ## Additional Resources
- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) - [`@graphql-hive/envelop` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/envelop)
- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) - [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/cire/src/client/types.ts)
- [Envelop](https://the-guild.dev/graphql/envelop) - [Envelop](https://the-guild.dev/graphql/envelop)

View file

@ -9,7 +9,7 @@ Hive.
## Installation ## Installation
```sh npm2yarn ```sh npm2yarn
npm i @graphql-hive/client npm i @graphql-hive/yoga
``` ```
<Callout type="info"> <Callout type="info">
@ -17,10 +17,15 @@ npm i @graphql-hive/client
includes a runtime to send usage reports and schemas to Hive registry. includes a runtime to send usage reports and schemas to Hive registry.
</Callout> </Callout>
The `@graphql-hive/client` package exports a The `@graphql-hive/yoga` package exports a
[Yoga plugin](https://the-guild.dev/graphql/yoga-server/docs/features/envelop-plugins), that can be [Yoga plugin](https://the-guild.dev/graphql/yoga-server/docs/features/envelop-plugins), that can be
used directly with [GraphQL-Yoga](https://the-guild.dev/graphql/yoga-server). used directly with [GraphQL-Yoga](https://the-guild.dev/graphql/yoga-server).
## Configuration
A full configuration guide can be found in the
["Configuration"](../api-reference/client.mdx#configuration) page.
## Integration Guide ## Integration Guide
### Publishing Schemas ### Publishing Schemas
@ -32,7 +37,7 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process.
<Callout> <Callout>
For more configuration options, such as sampling, please refer to the [Hive client For more configuration options, such as sampling, please refer to the [Hive client
configuration](/docs/api-reference/client#configuration) reference. configuration](../api-reference/client.mdx#configuration) reference.
</Callout> </Callout>
#### GraphQL over HTTP (default) #### GraphQL over HTTP (default)
@ -42,13 +47,13 @@ You can send usage reporting to Hive registry by using the `usage` section of th
```ts ```ts
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { useYogaHive } from '@graphql-hive/client' import { useHive } from '@graphql-hive/yoga'
import { schema } from './schema' import { schema } from './schema'
const yoga = createYoga({ const yoga = createYoga({
schema, schema,
plugins: [ plugins: [
useYogaHive({ useHive({
enabled: true, // Enable/Disable Hive Client enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
// Collects and send usage reporting based on executed operations // Collects and send usage reporting based on executed operations
@ -74,26 +79,24 @@ implementation.
Here's an example of how to use Hive with GraphQL Yoga on Cloudflare Workers: Here's an example of how to use Hive with GraphQL Yoga on Cloudflare Workers:
```typescript ```typescript
import { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { createHive, useHive } from '@graphql-hive/yoga'
export default { export default {
async fetch(request, env, ctx) { async fetch(request, env, ctx) {
const hive = createYogaHive({ const hive = createHive({
enabled: true, // Enable/Disable Hive Client enabled: true, // Enable/Disable Hive Client
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
usage: true // Collects schema usage based on operations usage: true // Collects schema usage based on operations
}); })
const yoga = createYoga({ const yoga = createYoga({
plugins: [ plugins: [useHive(hive)]
useYogaHive(hive) })
]
});
const response = await yoga.fetch(request, env, ctx); const response = await yoga.fetch(request, env, ctx)
ctx.waitUntil(hive.dispose()); ctx.waitUntil(hive.dispose())
return response; return response
} }
} }
``` ```
@ -101,7 +104,8 @@ export default {
##### Client Information ##### Client Information
You can associate a client name and version with any operation reported to Hive, by sending the You can associate a client name and version with any operation reported to Hive, by sending the
`x-client-nam`e and `x-client-version` HTTP headers for requests sent to your GraphQL Yoga server. `x-graphql-client-name` and `x-graphql-client-version` HTTP headers for requests sent to your
GraphQL Yoga server.
```bash filename="Example HTTP Request with client headers" {2-3} ```bash filename="Example HTTP Request with client headers" {2-3}
curl \ curl \
@ -111,7 +115,7 @@ curl \
-H "accept: application/json" \ -H "accept: application/json" \
-X POST \ -X POST \
"http://localhost:4000/graphql" \ "http://localhost:4000/graphql" \
-d '{"query":"{ hello }"} -d '{"query":"{ hello }"}'
``` ```
#### GraphQL over SSE #### GraphQL over SSE
@ -126,7 +130,7 @@ Just add the SSE plugin to your Yoga server and the usage reporting will be sent
```ts filename="SSE HTTP Request Client info" {4,10} ```ts filename="SSE HTTP Request Client info" {4,10}
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { createYoga, type YogaInitialContext } from 'graphql-yoga' import { createYoga, type YogaInitialContext } from 'graphql-yoga'
import { useYogaHive } from '@graphql-hive/client' import { useHive } from '@graphql-hive/yoga'
import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse' import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse'
import { schema } from './schema' import { schema } from './schema'
@ -134,7 +138,7 @@ const yoga = createYoga({
schema, schema,
plugins: [ plugins: [
useGraphQLSSE(), useGraphQLSSE(),
useYogaHive({ useHive({
enabled: true, enabled: true,
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
usage: true usage: true
@ -177,6 +181,7 @@ import { createServer } from 'node:http'
import { useServer } from 'graphql-ws/lib/use/ws' import { useServer } from 'graphql-ws/lib/use/ws'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { WebSocketServer } from 'ws' import { WebSocketServer } from 'ws'
import { useHive } from '@graphql-hive/yoga'
import { schema } from './schema' import { schema } from './schema'
const yoga = createYoga({ const yoga = createYoga({
@ -185,7 +190,7 @@ const yoga = createYoga({
subscriptionsProtocol: 'WS' subscriptionsProtocol: 'WS'
}, },
plugins: [ plugins: [
useYogaHive({ useHive({
enabled: true, enabled: true,
token: 'YOUR-TOKEN', token: 'YOUR-TOKEN',
usage: true usage: true
@ -257,6 +262,6 @@ const client = createClient({
## Additional Resources ## Additional Resources
- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) - [`@graphql-hive/yoga` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/yoga)
- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) - [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/core/src/client/types.ts)
- [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server) - [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server)

View file

@ -5,7 +5,7 @@ import { Callout } from '@theguild/components'
## Installation ## Installation
```sh npm2yarn ```sh npm2yarn
npm i @graphql-hive/client npm i @graphql-hive/core
``` ```
<Callout type="info"> <Callout type="info">
@ -13,13 +13,13 @@ npm i @graphql-hive/client
includes a runtime to send usage reports and schemas to Hive registry. includes a runtime to send usage reports and schemas to Hive registry.
</Callout> </Callout>
The `@graphql-hive/client` package exports a utility function called `createServicesFetcher` that The `@graphql-hive/core` package exports a utility function called `createServicesFetcher` that can
can be used to fetch services definition from Hive's CDN. You can use it to create a GraphQL schema be used to fetch services definition from Hive's CDN. You can use it to create a GraphQL schema from
from the all services schemas published to Hive. the all services schemas published to Hive.
<Callout type="info"> <Callout type="info">
The `createServicesFetcher` function is a part of the `@graphql-hive/client` package, and it can The `createServicesFetcher` function is a part of the `@graphql-hive/core` package, and it can be
be used with any GraphQL server runtime. You may use it with Apollo Server, GraphQL Yoga, or any used with any GraphQL server runtime. You may use it with Apollo Server, GraphQL Yoga, or any
other library to implement a custom GraphQL gateway. other library to implement a custom GraphQL gateway.
</Callout> </Callout>
@ -34,7 +34,7 @@ Once you have all services schemas pushed to Hive, and available in the CDN, you
import { createServer } from 'node:http' import { createServer } from 'node:http'
import { buildSchema } from 'graphql' import { buildSchema } from 'graphql'
import { createYoga } from 'graphql-yoga' import { createYoga } from 'graphql-yoga'
import { createServicesFetcher } from '@graphql-hive/client' import { createServicesFetcher } from '@graphql-hive/core'
import { buildHTTPExecutor } from '@graphql-tools/executor-http' import { buildHTTPExecutor } from '@graphql-tools/executor-http'
import { stitchSchemas } from '@graphql-tools/stitch' import { stitchSchemas } from '@graphql-tools/stitch'

View file

@ -1,3 +1,5 @@
import { Tabs } from '@theguild/components'
# Client & CLI Configuration # Client & CLI Configuration
By default, the Hive CLI and Hive Client SDK connect to the Hive Cloud version. In order to connect By default, the Hive CLI and Hive Client SDK connect to the Hive Cloud version. In order to connect
@ -7,8 +9,11 @@ to a local Hive Server, you need to configure both the client and SDK.
Instantiate your Hive client with the `selfHosting` option. Instantiate your Hive client with the `selfHosting` option.
```ts filename="hive.ts" <Tabs items={['Custom', 'GraphQL Yoga', 'Apollo Server', 'Envelop']}>
import { createHive } from '@graphql-hive/client' <Tabs.Tab>
```ts filename="custom.ts"
import { createHive } from '@graphql-hive/core'
const hive = createHive({ const hive = createHive({
enabled: true, enabled: true,
@ -23,6 +28,85 @@ const hive = createHive({
}) })
``` ```
</Tabs.Tab>
<Tabs.Tab>
```ts filename="graphql-yoga.ts"
import { createYoga } from 'graphql-yoga'
import { useHive } from '@graphql-hive/yoga'
const yoga = createYoga({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: 'http://localhost:8082/graphql',
usageEndpoint: 'http://localhost:8081',
applicationUrl: 'http://localhost:8080/'
},
usage: true
})
]
})
```
</Tabs.Tab>
<Tabs.Tab>
```ts filename="apollo-server.ts"
import { createYoga } from '@apollo/server'
import { useHive } from '@graphql-hive/apollo'
const apollo = new ApolloServer({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: 'http://localhost:8082/graphql',
usageEndpoint: 'http://localhost:8081',
applicationUrl: 'http://localhost:8080/'
},
usage: true
})
]
})
```
</Tabs.Tab>
<Tabs.Tab>
```ts filename="envelop.ts"
import { createYoga } from 'graphql-yoga'
import { useHive } from '@graphql-hive/envelop'
const yoga = createYoga({
plugins: [
useHive({
enabled: true,
debug: true,
token,
selfHosting: {
graphqlEndpoint: 'http://localhost:8082/graphql',
usageEndpoint: 'http://localhost:8081',
applicationUrl: 'http://localhost:8080/'
},
usage: true
})
]
})
```
</Tabs.Tab>
</Tabs>
## Configuring the CLI ## Configuring the CLI
Place a `hive.json` file within the root of your project. Place a `hive.json` file within the root of your project.

View file

@ -1,6 +1,6 @@
# Usage Reporting # Usage Reporting
The official JavaScript Hive Client (`@graphql-hive/client`) collects executed operations and sends The official JavaScript Hive Client (`@graphql-hive/core`) collects executed operations and sends
them in batches (as a single report, when a buffer is full or every few seconds) over HTTP. them in batches (as a single report, when a buffer is full or every few seconds) over HTTP.
> It's recommended to send a report for more than 1 operation. The maximum payload size is 1 MB. > It's recommended to send a report for more than 1 operation. The maximum payload size is 1 MB.

View file

@ -63,7 +63,7 @@ importers:
version: 5.0.2(graphql@16.8.1) version: 5.0.2(graphql@16.8.1)
'@graphql-codegen/cli': '@graphql-codegen/cli':
specifier: 5.0.2 specifier: 5.0.2
version: 5.0.2(@babel/core@7.24.0)(@types/node@20.12.7)(encoding@0.1.13)(enquirer@2.3.6)(graphql@16.8.1)(typescript@5.4.5) version: 5.0.2(@babel/core@7.22.9)(@types/node@20.12.7)(encoding@0.1.13)(enquirer@2.3.6)(graphql@16.8.1)(typescript@5.4.5)
'@graphql-codegen/client-preset': '@graphql-codegen/client-preset':
specifier: 4.2.5 specifier: 4.2.5
version: 4.2.5(encoding@0.1.13)(graphql@16.8.1) version: 4.2.5(encoding@0.1.13)(graphql@16.8.1)
@ -84,7 +84,7 @@ importers:
version: 3.0.0(graphql@16.8.1) version: 3.0.0(graphql@16.8.1)
'@graphql-eslint/eslint-plugin': '@graphql-eslint/eslint-plugin':
specifier: 3.20.1 specifier: 3.20.1
version: 3.20.1(patch_hash=n437g5o7zq7pnxdxldn52uql2q)(@babel/core@7.24.0)(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1) version: 3.20.1(patch_hash=n437g5o7zq7pnxdxldn52uql2q)(@babel/core@7.22.9)(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)
'@graphql-inspector/cli': '@graphql-inspector/cli':
specifier: 4.0.3 specifier: 4.0.3
version: 4.0.3(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1) version: 4.0.3(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)
@ -260,9 +260,9 @@ importers:
'@esm2cjs/execa': '@esm2cjs/execa':
specifier: 6.1.1-cjs.1 specifier: 6.1.1-cjs.1
version: 6.1.1-cjs.1 version: 6.1.1-cjs.1
'@graphql-hive/client': '@graphql-hive/apollo':
specifier: workspace:* specifier: workspace:*
version: link:../packages/libraries/client/dist version: link:../packages/libraries/apollo/dist
'@graphql-hive/core': '@graphql-hive/core':
specifier: workspace:* specifier: workspace:*
version: link:../packages/libraries/core/dist version: link:../packages/libraries/core/dist
@ -330,11 +330,46 @@ importers:
specifier: 3.22.4 specifier: 3.22.4
version: 3.22.4 version: 3.22.4
packages/libraries/apollo:
dependencies:
'@graphql-hive/core':
specifier: workspace:*
version: link:../core/dist
graphql:
specifier: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
version: 16.8.1
devDependencies:
'@apollo/server':
specifier: 4.10.4
version: 4.10.4(encoding@0.1.13)(graphql@16.8.1)
'@graphql-tools/schema':
specifier: 10.0.3
version: 10.0.3(graphql@16.8.1)
body-parser:
specifier: 1.20.2
version: 1.20.2
express:
specifier: 4.19.2
version: 4.19.2
graphql-ws:
specifier: 5.16.0
version: 5.16.0(graphql@16.8.1)
nock:
specifier: 14.0.0-beta.5
version: 14.0.0-beta.5
vitest:
specifier: 1.5.0
version: 1.5.0(@types/node@20.12.7)(less@4.2.0)(terser@5.20.0)
ws:
specifier: 8.16.0
version: 8.16.0
publishDirectory: dist
packages/libraries/cli: packages/libraries/cli:
dependencies: dependencies:
'@graphql-hive/core': '@graphql-hive/core':
specifier: 0.2.4 specifier: workspace:*
version: 0.2.4(graphql@16.8.1) version: link:../core/dist
'@graphql-inspector/core': '@graphql-inspector/core':
specifier: 5.1.0-alpha-20231208113249-34700c8a specifier: 5.1.0-alpha-20231208113249-34700c8a
version: 5.1.0-alpha-20231208113249-34700c8a(graphql@16.8.1) version: 5.1.0-alpha-20231208113249-34700c8a(graphql@16.8.1)
@ -409,30 +444,23 @@ importers:
specifier: 10.9.2 specifier: 10.9.2
version: 10.9.2(@swc/core@1.4.14(@swc/helpers@0.5.5))(@types/node@20.12.7)(typescript@5.4.5) version: 10.9.2(@swc/core@1.4.14(@swc/helpers@0.5.5))(@types/node@20.12.7)(typescript@5.4.5)
packages/libraries/client: packages/libraries/core:
dependencies: dependencies:
'@graphql-hive/core':
specifier: ^0.2.4
version: 0.2.4(graphql@16.8.1)
'@graphql-tools/utils': '@graphql-tools/utils':
specifier: ^10.0.0 specifier: ^10.0.0
version: 10.0.0(graphql@16.8.1) version: 10.1.3(graphql@16.8.1)
'@whatwg-node/fetch': '@whatwg-node/fetch':
specifier: 0.9.17 specifier: 0.9.17
version: 0.9.17 version: 0.9.17
async-retry: async-retry:
specifier: 1.3.3 specifier: 1.3.3
version: 1.3.3 version: 1.3.3
lodash.sortby:
specifier: 4.7.0
version: 4.7.0
tiny-lru: tiny-lru:
specifier: 8.0.2 specifier: 8.0.2
version: 8.0.2 version: 8.0.2
optionalDependencies:
'@apollo/server':
specifier: ^4.0.0
version: 4.10.3(encoding@0.1.13)(graphql@16.8.1)
'@envelop/types':
specifier: ^5.0.0
version: 5.0.0
devDependencies: devDependencies:
'@apollo/federation': '@apollo/federation':
specifier: 0.38.1 specifier: 0.38.1
@ -440,65 +468,35 @@ importers:
'@apollo/subgraph': '@apollo/subgraph':
specifier: 2.7.3 specifier: 2.7.3
version: 2.7.3(graphql@16.8.1) version: 2.7.3(graphql@16.8.1)
'@graphql-tools/schema':
specifier: 10.0.3
version: 10.0.3(graphql@16.8.1)
'@graphql-yoga/plugin-defer-stream':
specifier: 3.2.0
version: 3.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-disable-introspection':
specifier: 2.2.0
version: 2.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-graphql-sse':
specifier: 3.2.0
version: 3.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-response-cache':
specifier: 3.4.0
version: 3.4.0(@envelop/core@5.0.0)(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)
'@types/async-retry':
specifier: 1.4.8
version: 1.4.8
body-parser:
specifier: 1.20.2
version: 1.20.2
express:
specifier: 4.19.2
version: 4.19.2
graphql:
specifier: 16.8.1
version: 16.8.1
graphql-ws:
specifier: 5.16.0
version: 5.16.0(graphql@16.8.1)
graphql-yoga:
specifier: 5.2.0
version: 5.2.0(graphql@16.8.1)
nock:
specifier: 14.0.0-beta.5
version: 14.0.0-beta.5
vitest:
specifier: 1.5.0
version: 1.5.0(@types/node@20.12.7)(less@4.2.0)(terser@5.20.0)
ws:
specifier: 8.16.0
version: 8.16.0
publishDirectory: dist
packages/libraries/core:
dependencies:
lodash.sortby:
specifier: 4.7.0
version: 4.7.0
devDependencies:
'@types/lodash.sortby': '@types/lodash.sortby':
specifier: 4.7.9 specifier: 4.7.9
version: 4.7.9 version: 4.7.9
graphql: graphql:
specifier: 16.8.1 specifier: 16.8.1
version: 16.8.1 version: 16.8.1
nock:
specifier: 14.0.0-beta.5
version: 14.0.0-beta.5
tslib: tslib:
specifier: 2.6.2 specifier: 2.6.2
version: 2.6.2 version: 2.6.2
vitest:
specifier: 1.5.0
version: 1.5.0(@types/node@20.12.7)(less@4.2.0)(terser@5.20.0)
publishDirectory: dist
packages/libraries/envelop:
dependencies:
'@graphql-hive/core':
specifier: workspace:*
version: link:../core/dist
graphql:
specifier: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
version: 16.8.1
devDependencies:
'@envelop/types':
specifier: 5.0.0
version: 5.0.0
publishDirectory: dist publishDirectory: dist
packages/libraries/external-composition: packages/libraries/external-composition:
@ -517,6 +515,53 @@ importers:
version: 16.8.1 version: 16.8.1
publishDirectory: dist publishDirectory: dist
packages/libraries/yoga:
dependencies:
'@graphql-hive/core':
specifier: workspace:*
version: link:../core/dist
graphql:
specifier: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
version: 16.8.1
tiny-lru:
specifier: 8.0.2
version: 8.0.2
devDependencies:
'@graphql-tools/schema':
specifier: 10.0.3
version: 10.0.3(graphql@16.8.1)
'@graphql-yoga/plugin-defer-stream':
specifier: 3.2.0
version: 3.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-disable-introspection':
specifier: 2.2.0
version: 2.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-graphql-sse':
specifier: 3.2.0
version: 3.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)
'@graphql-yoga/plugin-response-cache':
specifier: 3.4.0
version: 3.4.0(@envelop/core@5.0.0)(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)
'@whatwg-node/fetch':
specifier: 0.9.17
version: 0.9.17
graphql-ws:
specifier: 5.16.0
version: 5.16.0(graphql@16.8.1)
graphql-yoga:
specifier: 5.3.0
version: 5.3.0(graphql@16.8.1)
nock:
specifier: 14.0.0-beta.5
version: 14.0.0-beta.5
vitest:
specifier: 1.5.0
version: 1.5.0(@types/node@20.12.7)(less@4.2.0)(terser@5.20.0)
ws:
specifier: 8.16.0
version: 8.16.0
publishDirectory: dist
packages/migrations: packages/migrations:
devDependencies: devDependencies:
'@graphql-hive/core': '@graphql-hive/core':
@ -1069,9 +1114,9 @@ importers:
'@fastify/formbody': '@fastify/formbody':
specifier: 7.4.0 specifier: 7.4.0
version: 7.4.0 version: 7.4.0
'@graphql-hive/client': '@graphql-hive/yoga':
specifier: workspace:* specifier: workspace:*
version: link:../../libraries/client/dist version: link:../../libraries/yoga/dist
'@graphql-yoga/plugin-persisted-operations': '@graphql-yoga/plugin-persisted-operations':
specifier: 3.2.0 specifier: 3.2.0
version: 3.2.0(@graphql-tools/utils@10.1.3(graphql@16.8.1))(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1) version: 3.2.0(@graphql-tools/utils@10.1.3(graphql@16.8.1))(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)
@ -1901,7 +1946,7 @@ importers:
version: 1.0.7(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) version: 1.0.7(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
'@theguild/components': '@theguild/components':
specifier: 6.5.3 specifier: 6.5.3
version: 6.5.3(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11)) version: 6.5.3(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11))
clsx: clsx:
specifier: 2.1.0 specifier: 2.1.0
version: 2.1.0 version: 2.1.0
@ -1913,13 +1958,13 @@ importers:
version: 4.0.3 version: 4.0.3
next: next:
specifier: 14.2.1 specifier: 14.2.1
version: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) version: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
next-sitemap: next-sitemap:
specifier: 4.2.3 specifier: 4.2.3
version: 4.2.3(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)) version: 4.2.3(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))
next-themes: next-themes:
specifier: '*' specifier: '*'
version: 0.2.1(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) version: 0.2.1(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
react: react:
specifier: 18.2.0 specifier: 18.2.0
version: 18.2.0 version: 18.2.0
@ -1954,9 +1999,9 @@ importers:
scripts: scripts:
devDependencies: devDependencies:
'@graphql-hive/client': '@graphql-hive/core':
specifier: '*' specifier: workspace:*
version: 0.32.0(encoding@0.1.13)(graphql@16.8.1) version: link:../packages/libraries/core/dist
packages: packages:
@ -2050,6 +2095,12 @@ packages:
peerDependencies: peerDependencies:
graphql: ^16.6.0 graphql: ^16.6.0
'@apollo/server@4.10.4':
resolution: {integrity: sha512-HS12CUa1wq8f5zKXOKJRwRdESFp4por9AINecpcsEUV9jsCP/NqPILgx0hCOOFJuKxmnaL7070xO6l5xmOq4Fw==}
engines: {node: '>=14.16.0'}
peerDependencies:
graphql: ^16.6.0
'@apollo/subgraph@0.6.1': '@apollo/subgraph@0.6.1':
resolution: {integrity: sha512-w/6FoubSxuzXSx8uvLE1wEuHZVHRXFyfHPKdM76wX5U/xw82zlUKseVO7wTuVODTcnUzEA30udYeCApUoC3/Xw==} resolution: {integrity: sha512-w/6FoubSxuzXSx8uvLE1wEuHZVHRXFyfHPKdM76wX5U/xw82zlUKseVO7wTuVODTcnUzEA30udYeCApUoC3/Xw==}
engines: {node: '>=12.13.0'} engines: {node: '>=12.13.0'}
@ -3900,18 +3951,6 @@ packages:
peerDependencies: peerDependencies:
graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
'@graphql-hive/client@0.32.0':
resolution: {integrity: sha512-5kWLdXJeH1Ehzt435P61rISrWd+q6RfaoGD+4sCStjZOtln+BNQ0SD9MW4VMZ1yuEfajdebqlgVFI7s5hoiJXg==}
engines: {node: '>=14.0.0'}
peerDependencies:
graphql: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
'@graphql-hive/core@0.2.4':
resolution: {integrity: sha512-yCCEV9SxL6XriJB24jzxa00R2TvHczSVte3zRl3TWxk+2D7xpJvrC553175QZ0mqrayHqqDmhfO8FWcJPhLMmg==}
engines: {node: '>=14.0.0'}
peerDependencies:
graphql: ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
'@graphql-inspector/audit-command@4.0.3': '@graphql-inspector/audit-command@4.0.3':
resolution: {integrity: sha512-cm4EtieIp9PUSDBze+Sn5HHF80jDF9V7sYyXqFa7+Vtw4Jlet98Ig48dFVtoLuFCPtCv2eZ22I8JOkBKL5WgVA==} resolution: {integrity: sha512-cm4EtieIp9PUSDBze+Sn5HHF80jDF9V7sYyXqFa7+Vtw4Jlet98Ig48dFVtoLuFCPtCv2eZ22I8JOkBKL5WgVA==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -4160,6 +4199,12 @@ packages:
peerDependencies: peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/executor@1.2.6':
resolution: {integrity: sha512-+1kjfqzM5T2R+dCw7F4vdJ3CqG+fY/LYJyhNiWEFtq0ToLwYzR/KKyD8YuzTirEjSxWTVlcBh7endkx5n5F6ew==}
engines: {node: '>=16.0.0'}
peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/git-loader@8.0.1': '@graphql-tools/git-loader@8.0.1':
resolution: {integrity: sha512-ivNtxD+iEfpPONYKip0kbpZMRdMCNR3HrIui8NCURmUdvBYGaGcbB3VrGMhxwZuzc+ybhs2ralPt1F8Oxq2jLA==} resolution: {integrity: sha512-ivNtxD+iEfpPONYKip0kbpZMRdMCNR3HrIui8NCURmUdvBYGaGcbB3VrGMhxwZuzc+ybhs2ralPt1F8Oxq2jLA==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -4238,12 +4283,6 @@ packages:
peerDependencies: peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/merge@9.0.0':
resolution: {integrity: sha512-J7/xqjkGTTwOJmaJQJ2C+VDBDOWJL3lKrHJN4yMaRLAJH3PosB7GiPRaSDZdErs0+F77sH2MKs2haMMkywzx7Q==}
engines: {node: '>=16.0.0'}
peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/merge@9.0.3': '@graphql-tools/merge@9.0.3':
resolution: {integrity: sha512-FeKv9lKLMwqDu0pQjPpF59GY3HReUkWXKsMIuMuJQOKh9BETu7zPEFUELvcw8w+lwZkl4ileJsHXC9+AnsT2Lw==} resolution: {integrity: sha512-FeKv9lKLMwqDu0pQjPpF59GY3HReUkWXKsMIuMuJQOKh9BETu7zPEFUELvcw8w+lwZkl4ileJsHXC9+AnsT2Lw==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -4274,12 +4313,6 @@ packages:
peerDependencies: peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/schema@10.0.0':
resolution: {integrity: sha512-kf3qOXMFcMs2f/S8Y3A8fm/2w+GaHAkfr3Gnhh2LOug/JgpY/ywgFVxO3jOeSpSEdoYcDKLcXVjMigNbY4AdQg==}
engines: {node: '>=16.0.0'}
peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/schema@10.0.3': '@graphql-tools/schema@10.0.3':
resolution: {integrity: sha512-p28Oh9EcOna6i0yLaCFOnkcBDQECVf3SCexT6ktb86QNj9idnkhI+tCxnwZDh58Qvjd2nURdkbevvoZkvxzCog==} resolution: {integrity: sha512-p28Oh9EcOna6i0yLaCFOnkcBDQECVf3SCexT6ktb86QNj9idnkhI+tCxnwZDh58Qvjd2nURdkbevvoZkvxzCog==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -4314,12 +4347,6 @@ packages:
peerDependencies: peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/utils@10.0.0':
resolution: {integrity: sha512-ndBPc6zgR+eGU/jHLpuojrs61kYN3Z89JyMLwK3GCRkPv4EQn9EOr1UWqF1JO0iM+/jAVHY0mvfUxyrFFN9DUQ==}
engines: {node: '>=16.0.0'}
peerDependencies:
graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0
'@graphql-tools/utils@10.0.3': '@graphql-tools/utils@10.0.3':
resolution: {integrity: sha512-6uO41urAEIs4sXQT2+CYGsUTkHkVo/2MpM/QjoHj6D6xoEF2woXHBpdAVi0HKIInDwZqWgEYOwIFez0pERxa1Q==} resolution: {integrity: sha512-6uO41urAEIs4sXQT2+CYGsUTkHkVo/2MpM/QjoHj6D6xoEF2woXHBpdAVi0HKIInDwZqWgEYOwIFez0pERxa1Q==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
@ -11009,6 +11036,12 @@ packages:
peerDependencies: peerDependencies:
graphql: ^15.2.0 || ^16.0.0 graphql: ^15.2.0 || ^16.0.0
graphql-yoga@5.3.0:
resolution: {integrity: sha512-6mXoGE5AMN6YNugJvjBFIQ0dFUiOMloN0dAzLL8GFt4iJ5WlWRgjdzGHod2zZz7yWQokEVD42DHgrc7NY3Dm0w==}
engines: {node: '>=18.0.0'}
peerDependencies:
graphql: ^15.2.0 || ^16.0.0
graphql@16.8.1: graphql@16.8.1:
resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==}
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
@ -17360,6 +17393,38 @@ snapshots:
- encoding - encoding
- supports-color - supports-color
'@apollo/server@4.10.4(encoding@0.1.13)(graphql@16.8.1)':
dependencies:
'@apollo/cache-control-types': 1.0.3(graphql@16.8.1)
'@apollo/server-gateway-interface': 1.1.1(graphql@16.8.1)
'@apollo/usage-reporting-protobuf': 4.1.1
'@apollo/utils.createhash': 2.0.0
'@apollo/utils.fetcher': 2.0.0
'@apollo/utils.isnodelike': 2.0.0
'@apollo/utils.keyvaluecache': 2.1.0
'@apollo/utils.logger': 2.0.0
'@apollo/utils.usagereporting': 2.1.0(graphql@16.8.1)
'@apollo/utils.withrequired': 2.0.0
'@graphql-tools/schema': 9.0.18(graphql@16.8.1)
'@josephg/resolvable': 1.0.1
'@types/express': 4.17.14
'@types/express-serve-static-core': 4.17.31
'@types/node-fetch': 2.6.4
async-retry: 1.3.3
cors: 2.8.5
express: 4.19.2
graphql: 16.8.1
loglevel: 1.8.0
lru-cache: 7.18.3
negotiator: 0.6.3
node-abort-controller: 3.1.1
node-fetch: 2.6.12(encoding@0.1.13)
uuid: 9.0.1
whatwg-mimetype: 3.0.0
transitivePeerDependencies:
- encoding
- supports-color
'@apollo/subgraph@0.6.1(graphql@16.8.1)': '@apollo/subgraph@0.6.1(graphql@16.8.1)':
dependencies: dependencies:
'@apollo/cache-control-types': 1.0.3(graphql@16.8.1) '@apollo/cache-control-types': 1.0.3(graphql@16.8.1)
@ -19663,7 +19728,7 @@ snapshots:
graphql: 16.8.1 graphql: 16.8.1
tslib: 2.6.2 tslib: 2.6.2
'@graphql-codegen/cli@5.0.2(@babel/core@7.24.0)(@types/node@20.12.7)(encoding@0.1.13)(enquirer@2.3.6)(graphql@16.8.1)(typescript@5.4.5)': '@graphql-codegen/cli@5.0.2(@babel/core@7.22.9)(@types/node@20.12.7)(encoding@0.1.13)(enquirer@2.3.6)(graphql@16.8.1)(typescript@5.4.5)':
dependencies: dependencies:
'@babel/generator': 7.23.6 '@babel/generator': 7.23.6
'@babel/template': 7.22.15 '@babel/template': 7.22.15
@ -19673,7 +19738,7 @@ snapshots:
'@graphql-codegen/plugin-helpers': 5.0.3(graphql@16.8.1) '@graphql-codegen/plugin-helpers': 5.0.3(graphql@16.8.1)
'@graphql-tools/apollo-engine-loader': 8.0.0(encoding@0.1.13)(graphql@16.8.1) '@graphql-tools/apollo-engine-loader': 8.0.0(encoding@0.1.13)(graphql@16.8.1)
'@graphql-tools/code-file-loader': 8.1.0(graphql@16.8.1) '@graphql-tools/code-file-loader': 8.1.0(graphql@16.8.1)
'@graphql-tools/git-loader': 8.0.1(@babel/core@7.24.0)(graphql@16.8.1) '@graphql-tools/git-loader': 8.0.1(@babel/core@7.22.9)(graphql@16.8.1)
'@graphql-tools/github-loader': 8.0.0(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1) '@graphql-tools/github-loader': 8.0.0(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)
'@graphql-tools/graphql-file-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/graphql-file-loader': 8.0.0(graphql@16.8.1)
'@graphql-tools/json-file-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/json-file-loader': 8.0.0(graphql@16.8.1)
@ -19867,6 +19932,29 @@ snapshots:
- encoding - encoding
- supports-color - supports-color
'@graphql-eslint/eslint-plugin@3.20.1(patch_hash=n437g5o7zq7pnxdxldn52uql2q)(@babel/core@7.22.9)(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)':
dependencies:
'@babel/code-frame': 7.21.4
'@graphql-tools/code-file-loader': 7.3.23(@babel/core@7.22.9)(graphql@16.8.1)
'@graphql-tools/graphql-tag-pluck': 7.5.2(@babel/core@7.22.9)(graphql@16.8.1)
'@graphql-tools/utils': 9.2.1(graphql@16.8.1)
chalk: 4.1.2
debug: 4.3.4(supports-color@8.1.1)
fast-glob: 3.2.12
graphql: 16.8.1
graphql-config: 4.5.0(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)
graphql-depth-limit: 1.1.0(graphql@16.8.1)
lodash.lowercase: 4.3.0
tslib: 2.6.2
transitivePeerDependencies:
- '@babel/core'
- '@types/node'
- bufferutil
- cosmiconfig-toml-loader
- encoding
- supports-color
- utf-8-validate
'@graphql-eslint/eslint-plugin@3.20.1(patch_hash=n437g5o7zq7pnxdxldn52uql2q)(@babel/core@7.24.0)(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)': '@graphql-eslint/eslint-plugin@3.20.1(patch_hash=n437g5o7zq7pnxdxldn52uql2q)(@babel/core@7.24.0)(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)':
dependencies: dependencies:
'@babel/code-frame': 7.21.4 '@babel/code-frame': 7.21.4
@ -19890,27 +19978,6 @@ snapshots:
- supports-color - supports-color
- utf-8-validate - utf-8-validate
'@graphql-hive/client@0.32.0(encoding@0.1.13)(graphql@16.8.1)':
dependencies:
'@graphql-hive/core': 0.2.4(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
async-retry: 1.3.3
axios: 1.6.5
graphql: 16.8.1
tiny-lru: 8.0.2
optionalDependencies:
'@apollo/server': 4.10.3(encoding@0.1.13)(graphql@16.8.1)
'@envelop/types': 5.0.0
transitivePeerDependencies:
- debug
- encoding
- supports-color
'@graphql-hive/core@0.2.4(graphql@16.8.1)':
dependencies:
graphql: 16.8.1
lodash.sortby: 4.7.0
'@graphql-inspector/audit-command@4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)': '@graphql-inspector/audit-command@4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)':
dependencies: dependencies:
'@graphql-inspector/commands': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2) '@graphql-inspector/commands': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)
@ -19940,7 +20007,7 @@ snapshots:
'@graphql-inspector/graphql-loader': 4.0.2(graphql@16.8.1) '@graphql-inspector/graphql-loader': 4.0.2(graphql@16.8.1)
'@graphql-inspector/introspect-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2) '@graphql-inspector/introspect-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)
'@graphql-inspector/json-loader': 4.0.2(graphql@16.8.1) '@graphql-inspector/json-loader': 4.0.2(graphql@16.8.1)
'@graphql-inspector/loaders': 4.0.3(@babel/core@7.24.0)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1) '@graphql-inspector/loaders': 4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1)
'@graphql-inspector/serve-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2) '@graphql-inspector/serve-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)
'@graphql-inspector/similar-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2) '@graphql-inspector/similar-command': 4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)
'@graphql-inspector/url-loader': 4.0.2(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1) '@graphql-inspector/url-loader': 4.0.2(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)
@ -19967,7 +20034,7 @@ snapshots:
'@graphql-inspector/commands@4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)': '@graphql-inspector/commands@4.0.3(@graphql-inspector/config@4.0.2(graphql@16.8.1))(@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1))(graphql@16.8.1)(yargs@17.7.2)':
dependencies: dependencies:
'@graphql-inspector/config': 4.0.2(graphql@16.8.1) '@graphql-inspector/config': 4.0.2(graphql@16.8.1)
'@graphql-inspector/loaders': 4.0.3(@babel/core@7.24.0)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1) '@graphql-inspector/loaders': 4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1)
graphql: 16.8.1 graphql: 16.8.1
tslib: 2.6.2 tslib: 2.6.2
yargs: 17.7.2 yargs: 17.7.2
@ -20070,10 +20137,10 @@ snapshots:
graphql: 16.8.1 graphql: 16.8.1
tslib: 2.6.2 tslib: 2.6.2
'@graphql-inspector/loaders@4.0.3(@babel/core@7.24.0)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1)': '@graphql-inspector/loaders@4.0.3(@babel/core@7.22.9)(@graphql-inspector/config@4.0.2(graphql@16.8.1))(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-inspector/config': 4.0.2(graphql@16.8.1) '@graphql-inspector/config': 4.0.2(graphql@16.8.1)
'@graphql-tools/code-file-loader': 8.0.1(@babel/core@7.24.0)(graphql@16.8.1) '@graphql-tools/code-file-loader': 8.0.1(@babel/core@7.22.9)(graphql@16.8.1)
'@graphql-tools/load': 8.0.0(graphql@16.8.1) '@graphql-tools/load': 8.0.0(graphql@16.8.1)
'@graphql-tools/utils': 10.0.3(graphql@16.8.1) '@graphql-tools/utils': 10.0.3(graphql@16.8.1)
graphql: 16.8.1 graphql: 16.8.1
@ -20182,6 +20249,18 @@ snapshots:
tslib: 2.6.2 tslib: 2.6.2
value-or-promise: 1.0.12 value-or-promise: 1.0.12
'@graphql-tools/code-file-loader@7.3.23(@babel/core@7.22.9)(graphql@16.8.1)':
dependencies:
'@graphql-tools/graphql-tag-pluck': 7.5.2(@babel/core@7.22.9)(graphql@16.8.1)
'@graphql-tools/utils': 9.2.1(graphql@16.8.1)
globby: 11.1.0
graphql: 16.8.1
tslib: 2.6.2
unixify: 1.0.0
transitivePeerDependencies:
- '@babel/core'
- supports-color
'@graphql-tools/code-file-loader@7.3.23(@babel/core@7.24.0)(graphql@16.8.1)': '@graphql-tools/code-file-loader@7.3.23(@babel/core@7.24.0)(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/graphql-tag-pluck': 7.5.2(@babel/core@7.24.0)(graphql@16.8.1) '@graphql-tools/graphql-tag-pluck': 7.5.2(@babel/core@7.24.0)(graphql@16.8.1)
@ -20206,18 +20285,6 @@ snapshots:
- '@babel/core' - '@babel/core'
- supports-color - supports-color
'@graphql-tools/code-file-loader@8.0.1(@babel/core@7.24.0)(graphql@16.8.1)':
dependencies:
'@graphql-tools/graphql-tag-pluck': 8.0.1(@babel/core@7.24.0)(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
globby: 11.1.0
graphql: 16.8.1
tslib: 2.6.2
unixify: 1.0.0
transitivePeerDependencies:
- '@babel/core'
- supports-color
'@graphql-tools/code-file-loader@8.1.0(graphql@16.8.1)': '@graphql-tools/code-file-loader@8.1.0(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/graphql-tag-pluck': 8.2.0(graphql@16.8.1) '@graphql-tools/graphql-tag-pluck': 8.2.0(graphql@16.8.1)
@ -20374,6 +20441,15 @@ snapshots:
tslib: 2.6.2 tslib: 2.6.2
value-or-promise: 1.0.12 value-or-promise: 1.0.12
'@graphql-tools/executor@1.2.6(graphql@16.8.1)':
dependencies:
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
'@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1)
'@repeaterjs/repeater': 3.0.5
graphql: 16.8.1
tslib: 2.6.2
value-or-promise: 1.0.12
'@graphql-tools/git-loader@8.0.1(@babel/core@7.22.9)(graphql@16.8.1)': '@graphql-tools/git-loader@8.0.1(@babel/core@7.22.9)(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/graphql-tag-pluck': 8.0.1(@babel/core@7.22.9)(graphql@16.8.1) '@graphql-tools/graphql-tag-pluck': 8.0.1(@babel/core@7.22.9)(graphql@16.8.1)
@ -20387,19 +20463,6 @@ snapshots:
- '@babel/core' - '@babel/core'
- supports-color - supports-color
'@graphql-tools/git-loader@8.0.1(@babel/core@7.24.0)(graphql@16.8.1)':
dependencies:
'@graphql-tools/graphql-tag-pluck': 8.0.1(@babel/core@7.24.0)(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1
is-glob: 4.0.3
micromatch: 4.0.5
tslib: 2.6.2
unixify: 1.0.0
transitivePeerDependencies:
- '@babel/core'
- supports-color
'@graphql-tools/github-loader@8.0.0(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)': '@graphql-tools/github-loader@8.0.0(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1)':
dependencies: dependencies:
'@ardatan/sync-fetch': 0.0.1(encoding@0.1.13) '@ardatan/sync-fetch': 0.0.1(encoding@0.1.13)
@ -20433,6 +20496,19 @@ snapshots:
tslib: 2.6.2 tslib: 2.6.2
unixify: 1.0.0 unixify: 1.0.0
'@graphql-tools/graphql-tag-pluck@7.5.2(@babel/core@7.22.9)(graphql@16.8.1)':
dependencies:
'@babel/parser': 7.24.0
'@babel/plugin-syntax-import-assertions': 7.23.3(@babel/core@7.22.9)
'@babel/traverse': 7.24.0
'@babel/types': 7.24.0
'@graphql-tools/utils': 9.2.1(graphql@16.8.1)
graphql: 16.8.1
tslib: 2.6.2
transitivePeerDependencies:
- '@babel/core'
- supports-color
'@graphql-tools/graphql-tag-pluck@7.5.2(@babel/core@7.24.0)(graphql@16.8.1)': '@graphql-tools/graphql-tag-pluck@7.5.2(@babel/core@7.24.0)(graphql@16.8.1)':
dependencies: dependencies:
'@babel/parser': 7.24.0 '@babel/parser': 7.24.0
@ -20459,19 +20535,6 @@ snapshots:
- '@babel/core' - '@babel/core'
- supports-color - supports-color
'@graphql-tools/graphql-tag-pluck@8.0.1(@babel/core@7.24.0)(graphql@16.8.1)':
dependencies:
'@babel/parser': 7.24.0
'@babel/plugin-syntax-import-assertions': 7.23.3(@babel/core@7.24.0)
'@babel/traverse': 7.24.0
'@babel/types': 7.24.0
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1
tslib: 2.6.2
transitivePeerDependencies:
- '@babel/core'
- supports-color
'@graphql-tools/graphql-tag-pluck@8.2.0(graphql@16.8.1)': '@graphql-tools/graphql-tag-pluck@8.2.0(graphql@16.8.1)':
dependencies: dependencies:
'@babel/core': 7.24.0 '@babel/core': 7.24.0
@ -20525,7 +20588,7 @@ snapshots:
'@graphql-tools/load@8.0.0(graphql@16.8.1)': '@graphql-tools/load@8.0.0(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/schema': 10.0.0(graphql@16.8.1) '@graphql-tools/schema': 10.0.3(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1) '@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1 graphql: 16.8.1
p-limit: 3.1.0 p-limit: 3.1.0
@ -20537,12 +20600,6 @@ snapshots:
graphql: 16.8.1 graphql: 16.8.1
tslib: 2.6.2 tslib: 2.6.2
'@graphql-tools/merge@9.0.0(graphql@16.8.1)':
dependencies:
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1
tslib: 2.6.2
'@graphql-tools/merge@9.0.3(graphql@16.8.1)': '@graphql-tools/merge@9.0.3(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/utils': 10.1.3(graphql@16.8.1) '@graphql-tools/utils': 10.1.3(graphql@16.8.1)
@ -20600,14 +20657,6 @@ snapshots:
- encoding - encoding
- supports-color - supports-color
'@graphql-tools/schema@10.0.0(graphql@16.8.1)':
dependencies:
'@graphql-tools/merge': 9.0.0(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1
tslib: 2.6.2
value-or-promise: 1.0.12
'@graphql-tools/schema@10.0.3(graphql@16.8.1)': '@graphql-tools/schema@10.0.3(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/merge': 9.0.3(graphql@16.8.1) '@graphql-tools/merge': 9.0.3(graphql@16.8.1)
@ -20678,22 +20727,16 @@ snapshots:
'@types/ws': 8.5.3 '@types/ws': 8.5.3
'@whatwg-node/fetch': 0.9.17 '@whatwg-node/fetch': 0.9.17
graphql: 16.8.1 graphql: 16.8.1
isomorphic-ws: 5.0.0(ws@8.13.0) isomorphic-ws: 5.0.0(ws@8.16.0)
tslib: 2.6.2 tslib: 2.6.2
value-or-promise: 1.0.12 value-or-promise: 1.0.12
ws: 8.13.0 ws: 8.16.0
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
- bufferutil - bufferutil
- encoding - encoding
- utf-8-validate - utf-8-validate
'@graphql-tools/utils@10.0.0(graphql@16.8.1)':
dependencies:
'@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1)
graphql: 16.8.1
tslib: 2.6.2
'@graphql-tools/utils@10.0.3(graphql@16.8.1)': '@graphql-tools/utils@10.0.3(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1)
@ -20754,22 +20797,22 @@ snapshots:
dependencies: dependencies:
tslib: 2.6.2 tslib: 2.6.2
'@graphql-yoga/plugin-defer-stream@3.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)': '@graphql-yoga/plugin-defer-stream@3.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)':
dependencies: dependencies:
'@graphql-tools/utils': 10.1.3(graphql@16.8.1) '@graphql-tools/utils': 10.1.3(graphql@16.8.1)
graphql: 16.8.1 graphql: 16.8.1
graphql-yoga: 5.2.0(graphql@16.8.1) graphql-yoga: 5.3.0(graphql@16.8.1)
'@graphql-yoga/plugin-disable-introspection@2.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)': '@graphql-yoga/plugin-disable-introspection@2.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)':
dependencies: dependencies:
graphql: 16.8.1 graphql: 16.8.1
graphql-yoga: 5.2.0(graphql@16.8.1) graphql-yoga: 5.3.0(graphql@16.8.1)
'@graphql-yoga/plugin-graphql-sse@3.2.0(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)': '@graphql-yoga/plugin-graphql-sse@3.2.0(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)':
dependencies: dependencies:
graphql: 16.8.1 graphql: 16.8.1
graphql-sse: 2.5.2(graphql@16.8.1) graphql-sse: 2.5.2(graphql@16.8.1)
graphql-yoga: 5.2.0(graphql@16.8.1) graphql-yoga: 5.3.0(graphql@16.8.1)
'@graphql-yoga/plugin-persisted-operations@3.2.0(@graphql-tools/utils@10.1.3(graphql@16.8.1))(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)': '@graphql-yoga/plugin-persisted-operations@3.2.0(@graphql-tools/utils@10.1.3(graphql@16.8.1))(graphql-yoga@5.2.0(graphql@16.8.1))(graphql@16.8.1)':
dependencies: dependencies:
@ -20785,6 +20828,14 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- '@envelop/core' - '@envelop/core'
'@graphql-yoga/plugin-response-cache@3.4.0(@envelop/core@5.0.0)(graphql-yoga@5.3.0(graphql@16.8.1))(graphql@16.8.1)':
dependencies:
'@envelop/response-cache': 6.1.2(@envelop/core@5.0.0)(graphql@16.8.1)
graphql: 16.8.1
graphql-yoga: 5.3.0(graphql@16.8.1)
transitivePeerDependencies:
- '@envelop/core'
'@graphql-yoga/subscription@4.0.0': '@graphql-yoga/subscription@4.0.0':
dependencies: dependencies:
'@graphql-yoga/typed-event-target': 2.0.0 '@graphql-yoga/typed-event-target': 2.0.0
@ -25058,16 +25109,16 @@ snapshots:
'@theguild/buddy@0.1.0(patch_hash=ryylgra5xglhidfoiaxehn22hq)': {} '@theguild/buddy@0.1.0(patch_hash=ryylgra5xglhidfoiaxehn22hq)': {}
'@theguild/components@6.5.3(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11))': '@theguild/components@6.5.3(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11))':
dependencies: dependencies:
'@giscus/react': 3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@giscus/react': 3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
'@next/bundle-analyzer': 13.4.2 '@next/bundle-analyzer': 13.4.2
clsx: 2.1.0 clsx: 2.1.0
fuzzy: 0.1.3 fuzzy: 0.1.3
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
next-videos: 1.5.0(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11)) next-videos: 1.5.0(webpack@5.89.0(@swc/core@1.4.14(@swc/helpers@0.5.5))(esbuild@0.19.11))
nextra: 3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5) nextra: 3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)
nextra-theme-docs: 3.0.0-alpha.22(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) nextra-theme-docs: 3.0.0-alpha.22(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
react-paginate: 8.2.0(react@18.2.0) react-paginate: 8.2.0(react@18.2.0)
@ -29949,6 +30000,21 @@ snapshots:
lru-cache: 10.2.0 lru-cache: 10.2.0
tslib: 2.6.2 tslib: 2.6.2
graphql-yoga@5.3.0(graphql@16.8.1):
dependencies:
'@envelop/core': 5.0.0
'@graphql-tools/executor': 1.2.6(graphql@16.8.1)
'@graphql-tools/schema': 10.0.3(graphql@16.8.1)
'@graphql-tools/utils': 10.1.3(graphql@16.8.1)
'@graphql-yoga/logger': 2.0.0
'@graphql-yoga/subscription': 5.0.0
'@whatwg-node/fetch': 0.9.17
'@whatwg-node/server': 0.9.33
dset: 3.1.2
graphql: 16.8.1
lru-cache: 10.2.0
tslib: 2.6.2
graphql@16.8.1: {} graphql@16.8.1: {}
gray-matter@4.0.3: gray-matter@4.0.3:
@ -32878,17 +32944,17 @@ snapshots:
neo-async@2.6.2: {} neo-async@2.6.2: {}
next-sitemap@4.2.3(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)): next-sitemap@4.2.3(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)):
dependencies: dependencies:
'@corex/deepmerge': 4.0.43 '@corex/deepmerge': 4.0.43
'@next/env': 13.5.6 '@next/env': 13.5.6
fast-glob: 3.3.2 fast-glob: 3.3.2
minimist: 1.2.8 minimist: 1.2.8
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
next-themes@0.2.1(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): next-themes@0.2.1(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies: dependencies:
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
@ -32900,6 +32966,32 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- webpack - webpack
next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies:
'@next/env': 14.2.1
'@swc/helpers': 0.5.5
busboy: 1.6.0
caniuse-lite: 1.0.30001600
graceful-fs: 4.2.11
postcss: 8.4.31
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
styled-jsx: 5.1.1(@babel/core@7.22.9)(react@18.2.0)
optionalDependencies:
'@next/swc-darwin-arm64': 14.2.1
'@next/swc-darwin-x64': 14.2.1
'@next/swc-linux-arm64-gnu': 14.2.1
'@next/swc-linux-arm64-musl': 14.2.1
'@next/swc-linux-x64-gnu': 14.2.1
'@next/swc-linux-x64-musl': 14.2.1
'@next/swc-win32-arm64-msvc': 14.2.1
'@next/swc-win32-ia32-msvc': 14.2.1
'@next/swc-win32-x64-msvc': 14.2.1
'@opentelemetry/api': 1.8.0
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0): next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies: dependencies:
'@next/env': 14.2.1 '@next/env': 14.2.1
@ -32931,7 +33023,7 @@ snapshots:
cors: 2.8.5 cors: 2.8.5
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
nextra-theme-docs@3.0.0-alpha.22(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): nextra-theme-docs@3.0.0-alpha.22(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5))(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
dependencies: dependencies:
'@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
'@popperjs/core': 2.11.8 '@popperjs/core': 2.11.8
@ -32940,15 +33032,15 @@ snapshots:
flexsearch: 0.7.43 flexsearch: 0.7.43
focus-visible: 5.2.0 focus-visible: 5.2.0
intersection-observer: 0.12.2 intersection-observer: 0.12.2
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
next-themes: 0.2.1(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-themes: 0.2.1(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
nextra: 3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5) nextra: 3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5)
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
scroll-into-view-if-needed: 3.1.0 scroll-into-view-if-needed: 3.1.0
zod: 3.22.4 zod: 3.22.4
nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5): nextra@3.0.0-alpha.22(@types/react@18.2.79)(next@14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5):
dependencies: dependencies:
'@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
'@mdx-js/mdx': 3.0.1 '@mdx-js/mdx': 3.0.1
@ -32966,7 +33058,7 @@ snapshots:
gray-matter: 4.0.3 gray-matter: 4.0.3
hast-util-to-estree: 3.1.0 hast-util-to-estree: 3.1.0
katex: 0.16.9 katex: 0.16.9
next: 14.2.1(@babel/core@7.24.0)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next: 14.2.1(@babel/core@7.22.9)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
p-limit: 4.0.0 p-limit: 4.0.0
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
@ -36006,6 +36098,13 @@ snapshots:
hey-listen: 1.0.8 hey-listen: 1.0.8
tslib: 2.6.2 tslib: 2.6.2
styled-jsx@5.1.1(@babel/core@7.22.9)(react@18.2.0):
dependencies:
client-only: 0.0.1
react: 18.2.0
optionalDependencies:
'@babel/core': 7.22.9
styled-jsx@5.1.1(@babel/core@7.24.0)(react@18.2.0): styled-jsx@5.1.1(@babel/core@7.24.0)(react@18.2.0):
dependencies: dependencies:
client-only: 0.0.1 client-only: 0.0.1

View file

@ -0,0 +1,11 @@
import { readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
const packageJsonAt = join(process.cwd(), 'package.json');
const pkg = JSON.parse(readFileSync(packageJsonAt, 'utf-8'));
const code = `export const version = '${pkg.version}';\n`;
const versionFileAt = join(process.cwd(), 'src/version.ts');
writeFileSync(versionFileAt, code);
console.log('Generated version file successfully at', versionFileAt);

View file

@ -4,6 +4,6 @@
"type": "module", "type": "module",
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@graphql-hive/client": "*" "@graphql-hive/core": "workspace:*"
} }
} }

View file

@ -1,5 +1,5 @@
import { buildSchema, parse } from 'graphql'; import { buildSchema, parse } from 'graphql';
import { createHive } from '@graphql-hive/client'; import { createHive } from '@graphql-hive/core';
const isFederation = process.env.FEDERATION === '1'; const isFederation = process.env.FEDERATION === '1';
const isSchemaReportingEnabled = process.env.SCHEMA_REPORTING !== '0'; const isSchemaReportingEnabled = process.env.SCHEMA_REPORTING !== '0';

View file

@ -53,7 +53,9 @@
"@hive/webhooks": ["./packages/services/webhooks/src/api.ts"], "@hive/webhooks": ["./packages/services/webhooks/src/api.ts"],
"@hive/emails": ["./packages/services/emails/src/api.ts"], "@hive/emails": ["./packages/services/emails/src/api.ts"],
"@hive/storage": ["./packages/services/storage/src/index.ts"], "@hive/storage": ["./packages/services/storage/src/index.ts"],
"@graphql-hive/client": ["./packages/libraries/client/src/index.ts"], "@graphql-hive/yoga": ["./packages/libraries/yoga/src/index.ts"],
"@graphql-hive/apollo": ["./packages/libraries/apollo/src/index.ts"],
"@graphql-hive/envelop": ["./packages/libraries/envelop/src/index.ts"],
"@graphql-hive/external-composition": [ "@graphql-hive/external-composition": [
"./packages/libraries/external-composition/src/index.ts" "./packages/libraries/external-composition/src/index.ts"
], ],

View file

@ -16,7 +16,19 @@
"dependsOn": ["^build"], "dependsOn": ["^build"],
"outputs": ["dist/**"] "outputs": ["dist/**"]
}, },
"@hive/libraries/client#build": { "@hive/libraries/core#build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"@hive/libraries/apollo#build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"@hive/libraries/yoga#build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"@hive/libraries/envelop#build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"outputs": ["dist/**"] "outputs": ["dist/**"]
}, },
@ -38,7 +50,7 @@
"outputs": [".next/**", "!.next/cache/**"] "outputs": [".next/**", "!.next/cache/**"]
}, },
"@hive/migrations#build": { "@hive/migrations#build": {
"dependsOn": ["^build", "@graphql-hive/client#build"], "dependsOn": ["^build"],
"outputs": ["dist/**"] "outputs": ["dist/**"]
}, },
"@hive/server#build": { "@hive/server#build": {