diff --git a/.changeset/good-waves-poke.md b/.changeset/good-waves-poke.md deleted file mode 100644 index 26f7afcda..000000000 --- a/.changeset/good-waves-poke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@graphql-hive/core": minor ---- - -Node agnostic diff --git a/.changeset/mean-books-chew.md b/.changeset/mean-books-chew.md new file mode 100644 index 000000000..d0490c535 --- /dev/null +++ b/.changeset/mean-books-chew.md @@ -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. diff --git a/.changeset/modern-boxes-itch.md b/.changeset/modern-boxes-itch.md deleted file mode 100644 index c4f8a8cc5..000000000 --- a/.changeset/modern-boxes-itch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@graphql-hive/client": minor ---- - -Node agnostic diff --git a/.changeset/odd-brooms-raise.md b/.changeset/odd-brooms-raise.md new file mode 100644 index 000000000..bddf8fb53 --- /dev/null +++ b/.changeset/odd-brooms-raise.md @@ -0,0 +1,5 @@ +--- +"@graphql-hive/core": minor +--- + +Moved most of @graphql-hive/client code here diff --git a/.changeset/red-plums-worry.md b/.changeset/red-plums-worry.md index b8406b6b7..28c6c9cd5 100644 --- a/.changeset/red-plums-worry.md +++ b/.changeset/red-plums-worry.md @@ -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+ diff --git a/.changeset/strong-cherries-carry.md b/.changeset/strong-cherries-carry.md new file mode 100644 index 000000000..3c8e46989 --- /dev/null +++ b/.changeset/strong-cherries-carry.md @@ -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'; +``` diff --git a/.changeset/strong-cherries-carry2.md b/.changeset/strong-cherries-carry2.md new file mode 100644 index 000000000..e7eeb8a95 --- /dev/null +++ b/.changeset/strong-cherries-carry2.md @@ -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'; +``` diff --git a/.changeset/strong-cherries-carry3.md b/.changeset/strong-cherries-carry3.md new file mode 100644 index 000000000..63067bdfc --- /dev/null +++ b/.changeset/strong-cherries-carry3.md @@ -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'; +``` diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f1db94b78..71b0ad6f3 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -107,6 +107,8 @@ module.exports = { 'packages/services/storage/tools/*.js', 'packages/services/**', 'packages/migrations/**', + '**/*.spec.ts', + '**/*.test.ts', ], optionalDependencies: false, }, diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0ed2312d3..b5b61876b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -93,7 +93,8 @@ distress. 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 -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 diff --git a/README.md b/README.md index d0c92bcb0..618000be3 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ GraphQL Hive provides all the tools the get visibility of your GraphQL architecture at all stages, 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)) - [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 diff --git a/codegen.mts b/codegen.mts index ad94ea95b..b9bf355ab 100644 --- a/codegen.mts +++ b/codegen.mts @@ -183,8 +183,8 @@ const config: CodegenConfig = { }, }, // Client - 'packages/libraries/client/src/__generated__/types.ts': { - documents: ['./packages/libraries/client/src/**/*.ts'], + 'packages/libraries/core/src/client/__generated__/types.ts': { + documents: ['./packages/libraries/core/src/client/**/*.ts'], config: { flattenGeneratedTypes: true, onlyOperationTypes: true, diff --git a/integration-tests/package.json b/integration-tests/package.json index adc72d218..529b93628 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -12,7 +12,7 @@ "@apollo/server": "4.10.3", "@aws-sdk/client-s3": "3.556.0", "@esm2cjs/execa": "6.1.1-cjs.1", - "@graphql-hive/client": "workspace:*", + "@graphql-hive/apollo": "workspace:*", "@graphql-hive/core": "workspace:*", "@graphql-typed-document-node/core": "3.2.0", "@hive/rate-limit": "workspace:*", diff --git a/integration-tests/tests/api/artifacts-cdn.spec.ts b/integration-tests/tests/api/artifacts-cdn.spec.ts index 0e96bc9e2..79076d240 100644 --- a/integration-tests/tests/api/artifacts-cdn.spec.ts +++ b/integration-tests/tests/api/artifacts-cdn.spec.ts @@ -10,7 +10,7 @@ import { PutObjectCommand, S3Client, } from '@aws-sdk/client-s3'; -import { createSupergraphManager } from '@graphql-hive/client'; +import { createSupergraphManager } from '@graphql-hive/apollo'; import { graphql } from '../../testkit/gql'; import { execute } from '../../testkit/graphql'; import { initSeed } from '../../testkit/seed'; diff --git a/integration-tests/tests/api/target/usage.spec.ts b/integration-tests/tests/api/target/usage.spec.ts index d59b9d9be..f9e1f861f 100644 --- a/integration-tests/tests/api/target/usage.spec.ts +++ b/integration-tests/tests/api/target/usage.spec.ts @@ -13,7 +13,7 @@ import { } from '@app/gql/graphql'; // eslint-disable-next-line hive/enforce-deps-in-dev 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 { createTarget, updateTargetValidationSettings, waitFor } from '../../../testkit/flow'; import { initSeed } from '../../../testkit/seed'; diff --git a/packages/libraries/client/.gitignore b/packages/libraries/apollo/.gitignore similarity index 100% rename from packages/libraries/client/.gitignore rename to packages/libraries/apollo/.gitignore diff --git a/packages/libraries/client/LICENSE b/packages/libraries/apollo/LICENSE similarity index 100% rename from packages/libraries/client/LICENSE rename to packages/libraries/apollo/LICENSE diff --git a/packages/libraries/apollo/README.md b/packages/libraries/apollo/README.md new file mode 100644 index 000000000..bf3a016b5 --- /dev/null +++ b/packages/libraries/apollo/README.md @@ -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 you’re 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 diff --git a/packages/libraries/apollo/package.json b/packages/libraries/apollo/package.json new file mode 100644 index 000000000..52918deb5 --- /dev/null +++ b/packages/libraries/apollo/package.json @@ -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" + } +} diff --git a/packages/libraries/client/src/apollo.ts b/packages/libraries/apollo/src/index.ts similarity index 82% rename from packages/libraries/client/src/apollo.ts rename to packages/libraries/apollo/src/index.ts index f15f23a66..4ce2f54b0 100644 --- a/packages/libraries/client/src/apollo.ts +++ b/packages/libraries/apollo/src/index.ts @@ -1,15 +1,24 @@ import type { DocumentNode } from 'graphql'; import type { ApolloServerPlugin, HTTPGraphQLRequest } from '@apollo/server'; -import { autoDisposeSymbol, createHive } from './client.js'; -import { get } from './internal/http-client.js'; -import type { +import { + autoDisposeSymbol, + createHash, + createHive as createHiveClient, HiveClient, HivePluginOptions, - SupergraphSDLFetcherOptions, -} from './internal/types.js'; -import { createHash, isHiveClient, joinUrl } from './internal/utils.js'; + http, + isHiveClient, + joinUrl, +} from '@graphql-hive/core'; 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) { let cacheETag: string | null = null; let cached: { @@ -45,31 +54,33 @@ export function createSupergraphSDLFetcher(options: SupergraphSDLFetcherOptions) }; const fetchWithRetry = (): Promise<{ id: string; supergraphSdl: string }> => { - return get(endpoint, { - headers, - }).then(async response => { - if (response.ok) { - const supergraphSdl = await response.text(); - const result = { - id: await createHash('SHA-256').update(supergraphSdl).digest('base64'), - supergraphSdl, - }; + return http + .get(endpoint, { + headers, + }) + .then(async response => { + if (response.ok) { + const supergraphSdl = await response.text(); + const result = { + id: await createHash('SHA-256').update(supergraphSdl).digest('base64'), + supergraphSdl, + }; - const etag = response.headers.get('etag'); - if (etag) { - cached = result; - cacheETag = etag; + const etag = response.headers.get('etag'); + if (etag) { + cached = result; + cacheETag = etag; + } + + return result; } - return result; - } + if (response.status === 304 && cached !== null) { + return cached; + } - if (response.status === 304 && cached !== null) { - return cached; - } - - return retry(response.status); - }); + return retry(response.status); + }); }; return fetchWithRetry(); @@ -133,16 +144,18 @@ function addRequestWithHeaders(context: any, http?: HTTPGraphQLRequest) { return context; } -export function hiveApollo(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin { - const hive = isHiveClient(clientOrOptions) - ? clientOrOptions - : createHive({ - ...clientOrOptions, - agent: { - name: 'hive-client-apollo', - ...clientOrOptions.agent, - }, - }); +export function createHive(clientOrOptions: HivePluginOptions) { + return createHiveClient({ + ...clientOrOptions, + agent: { + name: 'hive-client-yoga', + ...clientOrOptions.agent, + }, + }); +} + +export function useHive(clientOrOptions: HiveClient | HivePluginOptions): ApolloServerPlugin { + const hive = isHiveClient(clientOrOptions) ? clientOrOptions : createHive(clientOrOptions); void hive.info(); diff --git a/packages/libraries/apollo/src/version.ts b/packages/libraries/apollo/src/version.ts new file mode 100644 index 000000000..3916e0afa --- /dev/null +++ b/packages/libraries/apollo/src/version.ts @@ -0,0 +1 @@ +export const version = '0.32.0'; diff --git a/packages/libraries/client/tests/apollo.spec.ts b/packages/libraries/apollo/tests/apollo.spec.ts similarity index 82% rename from packages/libraries/client/tests/apollo.spec.ts rename to packages/libraries/apollo/tests/apollo.spec.ts index 15b8a0eb3..7f13148fa 100644 --- a/packages/libraries/client/tests/apollo.spec.ts +++ b/packages/libraries/apollo/tests/apollo.spec.ts @@ -1,21 +1,175 @@ -/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ -import { createServer, IncomingMessage, Server } from 'http'; +import { createServer, IncomingMessage, Server } from 'node:http'; import bodyParser from 'body-parser'; import express from 'express'; import { execute, subscribe } from 'graphql'; import { createClient } from 'graphql-ws'; import { useServer } from 'graphql-ws/lib/use/ws'; -import { createLogger } from 'graphql-yoga'; import nock from 'nock'; +import { beforeAll, describe, expect, test, vi } from 'vitest'; import { WebSocket, WebSocketServer } from 'ws'; import { ApolloServer } from '@apollo/server'; import { expressMiddleware } from '@apollo/server/express4'; import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'; import { startStandaloneServer } from '@apollo/server/standalone'; import { makeExecutableSchema } from '@graphql-tools/schema'; -import { createHive, createSupergraphSDLFetcher, hiveApollo } from '../src'; +import { createHive, createSupergraphSDLFetcher, useHive } from '../src'; import { version } from '../src/version'; +function createLogger() { + return { + error: vi.fn(), + info: vi.fn(), + }; +} + +beforeAll(() => { + nock.cleanAll(); +}); + +function waitFor(ms: number) { + return new Promise(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 () => { test('createSupergraphSDLFetcher without ETag', async () => { const supergraphSdl = 'type SuperQuery { sdl: String }'; @@ -177,7 +331,7 @@ describe('built-in HTTP usage reporting', async () => { } `, plugins: [ - hiveApollo({ + useHive({ token: 'token', selfHosting: { applicationUrl: 'http://localhost/foo', @@ -197,7 +351,7 @@ describe('built-in HTTP usage reporting', async () => { debug: false, agent: { maxSize: 1, - logger: createLogger('silent'), + logger: createLogger(), }, }), ], @@ -265,7 +419,7 @@ describe('built-in HTTP usage reporting', async () => { } `, plugins: [ - hiveApollo({ + useHive({ token: 'token', selfHosting: { applicationUrl: 'http://localhost/foo', @@ -285,7 +439,7 @@ describe('built-in HTTP usage reporting', async () => { debug: false, agent: { maxSize: 1, - logger: createLogger('silent'), + logger: createLogger(), }, }), ], @@ -371,7 +525,7 @@ describe('built-in HTTP usage reporting', async () => { }, }, plugins: [ - hiveApollo({ + useHive({ token: 'token', selfHosting: { applicationUrl: 'http://localhost/foo', @@ -391,7 +545,7 @@ describe('built-in HTTP usage reporting', async () => { debug: false, agent: { maxSize: 1, - logger: createLogger('silent'), + logger: createLogger(), }, }), ], @@ -473,7 +627,7 @@ describe('built-in HTTP usage reporting', async () => { } `, plugins: [ - hiveApollo({ + useHive({ token: 'token', selfHosting: { applicationUrl: 'http://localhost/foo', @@ -487,7 +641,7 @@ describe('built-in HTTP usage reporting', async () => { debug: false, agent: { maxSize: 1, - logger: createLogger('silent'), + logger: createLogger(), }, }), ], @@ -614,7 +768,7 @@ describe('graphql-ws usage reporting setup', async () => { debug: false, agent: { maxSize: 1, - logger: createLogger('silent'), + logger: createLogger(), }, }); @@ -630,7 +784,7 @@ describe('graphql-ws usage reporting setup', async () => { const server = new ApolloServer({ schema, plugins: [ - hiveApollo(hiveClient), + useHive(hiveClient), // Proper shutdown for the HTTP server. ApolloServerPluginDrainHttpServer({ httpServer }), // Proper shutdown for the WebSocket server. diff --git a/packages/libraries/client/tsconfig.json b/packages/libraries/apollo/tsconfig.json similarity index 100% rename from packages/libraries/client/tsconfig.json rename to packages/libraries/apollo/tsconfig.json diff --git a/packages/libraries/cli/README.md b/packages/libraries/cli/README.md index ad594afa1..8f347ef96 100644 --- a/packages/libraries/cli/README.md +++ b/packages/libraries/cli/README.md @@ -1,7 +1,7 @@ # Hive CLI (Command Line Interface) 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. [![Version](https://img.shields.io/npm/v/@graphql-hive/cli.svg)](https://npmjs.org/package/@graphql-hive/cli) diff --git a/packages/libraries/cli/package.json b/packages/libraries/cli/package.json index 99d5a316b..c82bab96c 100644 --- a/packages/libraries/cli/package.json +++ b/packages/libraries/cli/package.json @@ -7,7 +7,7 @@ "url": "kamilkisiela/graphql-hive", "directory": "packages/libraries/cli" }, - "homepage": "https://graphql-hive.com", + "homepage": "https://the-guild.dev/graphql/hive", "author": { "email": "contact@the-guild.dev", "name": "The Guild", @@ -15,7 +15,7 @@ }, "license": "MIT", "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "bin": { "hive": "./bin/run" @@ -35,7 +35,7 @@ "oclif:upload": "pnpm oclif upload tarballs --no-xz && pnpm oclif upload win", "postpack": "rm -f oclif.manifest.json", "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", "schema:check:federation": "pnpm start schema:check examples/federation.graphql --service reviews", "schema:check:single": "pnpm start schema:check examples/single.graphql", @@ -45,7 +45,7 @@ "version": "oclif readme && git add README.md" }, "dependencies": { - "@graphql-hive/core": "0.2.4", + "@graphql-hive/core": "workspace:*", "@graphql-inspector/core": "5.1.0-alpha-20231208113249-34700c8a", "@graphql-tools/code-file-loader": "~8.1.0", "@graphql-tools/graphql-file-loader": "~8.0.0", diff --git a/packages/libraries/cli/scripts/replace-workspace.mjs b/packages/libraries/cli/scripts/replace-workspace.mjs new file mode 100644 index 000000000..02f0f716c --- /dev/null +++ b/packages/libraries/cli/scripts/replace-workspace.mjs @@ -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); diff --git a/packages/libraries/cli/src/base-command.ts b/packages/libraries/cli/src/base-command.ts index a5649498d..975955997 100644 --- a/packages/libraries/cli/src/base-command.ts +++ b/packages/libraries/cli/src/base-command.ts @@ -178,7 +178,6 @@ export default abstract class extends Command { if (!response.ok) { 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; if (jsonData.errors && jsonData.errors.length > 0) { diff --git a/packages/libraries/client/CHANGELOG.md b/packages/libraries/client/CHANGELOG.md deleted file mode 100644 index 3c6189ab4..000000000 --- a/packages/libraries/client/CHANGELOG.md +++ /dev/null @@ -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 diff --git a/packages/libraries/client/README.md b/packages/libraries/client/README.md deleted file mode 100644 index ad15ec7bb..000000000 --- a/packages/libraries/client/README.md +++ /dev/null @@ -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`. diff --git a/packages/libraries/client/scripts/update-version.mjs b/packages/libraries/client/scripts/update-version.mjs deleted file mode 100644 index e49f089d6..000000000 --- a/packages/libraries/client/scripts/update-version.mjs +++ /dev/null @@ -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); diff --git a/packages/libraries/client/src/index.ts b/packages/libraries/client/src/index.ts deleted file mode 100644 index 21bfd8bae..000000000 --- a/packages/libraries/client/src/index.ts +++ /dev/null @@ -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'; diff --git a/packages/libraries/client/src/version.ts b/packages/libraries/client/src/version.ts deleted file mode 100644 index bfd7c424b..000000000 --- a/packages/libraries/client/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const version = '0.30.0'; diff --git a/packages/libraries/client/tests/integration.spec.ts b/packages/libraries/client/tests/integration.spec.ts deleted file mode 100644 index 3e1eadc71..000000000 --- a/packages/libraries/client/tests/integration.spec.ts +++ /dev/null @@ -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); -}); diff --git a/packages/libraries/core/package.json b/packages/libraries/core/package.json index 38205f66f..19e508a31 100644 --- a/packages/libraries/core/package.json +++ b/packages/libraries/core/package.json @@ -7,7 +7,7 @@ "url": "kamilkisiela/graphql-hive", "directory": "packages/libraries/core" }, - "homepage": "https://graphql-hive.com", + "homepage": "https://the-guild.dev/graphql/hive", "author": { "email": "contact@the-guild.dev", "name": "The Guild", @@ -38,19 +38,27 @@ }, "typings": "dist/typings/index.d.ts", "scripts": { - "build": "bob build", + "build": "node ../../../scripts/generate-version.mjs && bob build", "check:build": "bob check" }, "peerDependencies": { "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "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": { + "@apollo/federation": "0.38.1", + "@apollo/subgraph": "2.7.3", "@types/lodash.sortby": "4.7.9", "graphql": "16.8.1", - "tslib": "2.6.2" + "nock": "14.0.0-beta.5", + "tslib": "2.6.2", + "vitest": "1.5.0" }, "publishConfig": { "registry": "https://registry.npmjs.org", diff --git a/packages/libraries/client/src/internal/agent.ts b/packages/libraries/core/src/client/agent.ts similarity index 89% rename from packages/libraries/client/src/internal/agent.ts rename to packages/libraries/core/src/client/agent.ts index c48e52aab..8bd669c66 100644 --- a/packages/libraries/client/src/internal/agent.ts +++ b/packages/libraries/core/src/client/agent.ts @@ -1,6 +1,6 @@ import retry from 'async-retry'; import { version } from '../version.js'; -import { post } from './http-client.js'; +import { http } from './http-client.js'; import type { Logger } from './types.js'; type ReadOnlyResponse = Pick; @@ -185,20 +185,22 @@ export function createAgent( }; } - const response = await post(options.endpoint, buffer, { - headers: { - accept: 'application/json', - 'content-type': 'application/json', - Authorization: `Bearer ${options.token}`, - 'User-Agent': `${options.name}/${version}`, - ...headers(), - }, - timeout: options.timeout, - fetchImplementation: pluginOptions.__testing?.fetch, - }).catch(error => { - debugLog(`Attempt ${attempt} failed: ${error.message}`); - return Promise.reject(error); - }); + const response = await http + .post(options.endpoint, buffer, { + headers: { + accept: 'application/json', + 'content-type': 'application/json', + Authorization: `Bearer ${options.token}`, + 'User-Agent': `${options.name}/${version}`, + ...headers(), + }, + timeout: options.timeout, + fetchImplementation: pluginOptions.__testing?.fetch, + }) + .catch(error => { + debugLog(`Attempt ${attempt} failed: ${error.message}`); + return Promise.reject(error); + }); if (response.status >= 200 && response.status < 300) { return response; diff --git a/packages/libraries/client/src/client.ts b/packages/libraries/core/src/client/client.ts similarity index 95% rename from packages/libraries/client/src/client.ts rename to packages/libraries/core/src/client/client.ts index 3697d2113..bdba228f4 100644 --- a/packages/libraries/client/src/client.ts +++ b/packages/libraries/core/src/client/client.ts @@ -4,12 +4,12 @@ import { type GraphQLSchema, type subscribe as SubscribeImplementation, } from 'graphql'; -import { post } from './internal/http-client.js'; -import { createReporting } from './internal/reporting.js'; -import type { HiveClient, HivePluginOptions } from './internal/types.js'; -import { createUsage } from './internal/usage.js'; -import { logIf } from './internal/utils.js'; -import { version } from './version.js'; +import { version } from '../version.js'; +import { http } from './http-client.js'; +import { createReporting } from './reporting.js'; +import type { HiveClient, HivePluginOptions } from './types.js'; +import { createUsage } from './usage.js'; +import { logIf } from './utils.js'; export function createHive(options: HivePluginOptions): HiveClient { 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, JSON.stringify({ query, diff --git a/packages/libraries/client/src/gateways.ts b/packages/libraries/core/src/client/gateways.ts similarity index 80% rename from packages/libraries/client/src/gateways.ts rename to packages/libraries/core/src/client/gateways.ts index 234993662..167e8d5fc 100644 --- a/packages/libraries/client/src/gateways.ts +++ b/packages/libraries/core/src/client/gateways.ts @@ -1,7 +1,7 @@ -import { get } from './internal/http-client.js'; -import type { SchemaFetcherOptions, ServicesFetcherOptions } from './internal/types.js'; -import { createHash, joinUrl } from './internal/utils.js'; -import { version } from './version.js'; +import { version } from '../version.js'; +import { http } from './http-client.js'; +import type { SchemaFetcherOptions, ServicesFetcherOptions } from './types.js'; +import { createHash, joinUrl } from './utils.js'; interface Schema { sdl: string; @@ -46,27 +46,29 @@ function createFetcher(options: SchemaFetcherOptions & ServicesFetcherOptions) { }; const fetchWithRetry = (): Promise => { - return get(endpoint, { - headers, - }).then(async response => { - if (response.ok) { - const result = await response.json(); + return http + .get(endpoint, { + headers, + }) + .then(async response => { + if (response.ok) { + const result = await response.json(); - const etag = response.headers.get('etag'); - if (etag) { - cached = result; - cacheETag = etag; + const etag = response.headers.get('etag'); + if (etag) { + cached = result; + cacheETag = etag; + } + + return result; } - return result; - } + if (response.status === 304 && cached !== null) { + return cached; + } - if (response.status === 304 && cached !== null) { - return cached; - } - - return retry(response.status); - }); + return retry(response.status); + }); }; return fetchWithRetry(); diff --git a/packages/libraries/client/src/internal/http-client.ts b/packages/libraries/core/src/client/http-client.ts similarity index 96% rename from packages/libraries/client/src/internal/http-client.ts rename to packages/libraries/core/src/client/http-client.ts index 9baa7d111..dc0b60646 100644 --- a/packages/libraries/client/src/internal/http-client.ts +++ b/packages/libraries/core/src/client/http-client.ts @@ -1,6 +1,6 @@ import { fetch } from '@whatwg-node/fetch'; -export function get( +function get( endpoint: string, config: { headers: Record; @@ -16,7 +16,7 @@ export function get( }); } -export async function post( +function post( endpoint: string, data: string | Buffer, config: { @@ -34,6 +34,11 @@ export async function post( }); } +export const http = { + get, + post, +}; + async function makeFetchCall( endpoint: string, config: { diff --git a/packages/libraries/client/src/internal/reporting.ts b/packages/libraries/core/src/client/reporting.ts similarity index 99% rename from packages/libraries/client/src/internal/reporting.ts rename to packages/libraries/core/src/client/reporting.ts index efa03d73b..6f2c446e1 100644 --- a/packages/libraries/client/src/internal/reporting.ts +++ b/packages/libraries/core/src/client/reporting.ts @@ -8,8 +8,8 @@ import { visit, } from 'graphql'; import { getDocumentNodeFromSchema } from '@graphql-tools/utils'; -import type { SchemaPublishMutation } from '../__generated__/types.js'; import { version } from '../version.js'; +import type { SchemaPublishMutation } from './__generated__/types.js'; import { createAgent } from './agent.js'; import type { HivePluginOptions } from './types.js'; import { logIf } from './utils.js'; diff --git a/packages/libraries/client/src/samplers.ts b/packages/libraries/core/src/client/samplers.ts similarity index 86% rename from packages/libraries/client/src/samplers.ts rename to packages/libraries/core/src/client/samplers.ts index 06d540587..f9b27e369 100644 --- a/packages/libraries/client/src/samplers.ts +++ b/packages/libraries/core/src/client/samplers.ts @@ -1,5 +1,5 @@ -import { dynamicSampling } from './internal/sampling.js'; -import type { SamplingContext } from './internal/types.js'; +import { dynamicSampling } from './sampling.js'; +import type { SamplingContext } from './types.js'; /** * Every operation is reported at least once, but every next occurrence is decided by the sampler. diff --git a/packages/libraries/client/src/internal/sampling.ts b/packages/libraries/core/src/client/sampling.ts similarity index 100% rename from packages/libraries/client/src/internal/sampling.ts rename to packages/libraries/core/src/client/sampling.ts diff --git a/packages/libraries/client/src/internal/types.ts b/packages/libraries/core/src/client/types.ts similarity index 97% rename from packages/libraries/client/src/internal/types.ts rename to packages/libraries/core/src/client/types.ts index e10b4c554..58ff82e15 100644 --- a/packages/libraries/client/src/internal/types.ts +++ b/packages/libraries/core/src/client/types.ts @@ -1,6 +1,6 @@ import type { ExecutionArgs } from 'graphql'; -import type { autoDisposeSymbol, hiveClientSymbol } from '../client.js'; import type { AgentOptions } from './agent.js'; +import type { autoDisposeSymbol, hiveClientSymbol } from './client.js'; import type { SchemaReporter } from './reporting.js'; export interface HiveClient { @@ -218,11 +218,6 @@ export interface GraphQLErrorsResult { }>; } -export interface SupergraphSDLFetcherOptions { - endpoint: string; - key: string; -} - export interface SchemaFetcherOptions { endpoint: string; key: string; diff --git a/packages/libraries/client/src/internal/usage.ts b/packages/libraries/core/src/client/usage.ts similarity index 99% rename from packages/libraries/client/src/internal/usage.ts rename to packages/libraries/core/src/client/usage.ts index 74007a11b..706883c6e 100644 --- a/packages/libraries/client/src/internal/usage.ts +++ b/packages/libraries/core/src/client/usage.ts @@ -23,7 +23,7 @@ import { type ExecutionArgs, } from 'graphql'; import LRU from 'tiny-lru'; -import { normalizeOperation } from '@graphql-hive/core'; +import { normalizeOperation } from '../normalize/operation.js'; import { version } from '../version.js'; import { createAgent } from './agent.js'; import { dynamicSampling, randomSampling } from './sampling.js'; diff --git a/packages/libraries/client/src/internal/utils.ts b/packages/libraries/core/src/client/utils.ts similarity index 98% rename from packages/libraries/client/src/internal/utils.ts rename to packages/libraries/core/src/client/utils.ts index 50d75dfdd..d08358f7a 100644 --- a/packages/libraries/client/src/internal/utils.ts +++ b/packages/libraries/core/src/client/utils.ts @@ -1,5 +1,5 @@ import { crypto, TextEncoder } from '@whatwg-node/fetch'; -import { hiveClientSymbol } from '../client.js'; +import { hiveClientSymbol } from './client.js'; import type { HiveClient, HivePluginOptions } from './types.js'; export const isCloudflareWorker = diff --git a/packages/libraries/core/src/index.ts b/packages/libraries/core/src/index.ts index 2505cd482..ef4bfb4f3 100644 --- a/packages/libraries/core/src/index.ts +++ b/packages/libraries/core/src/index.ts @@ -1 +1,7 @@ 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'; diff --git a/packages/libraries/core/src/version.ts b/packages/libraries/core/src/version.ts new file mode 100644 index 000000000..f78ebaac8 --- /dev/null +++ b/packages/libraries/core/src/version.ts @@ -0,0 +1 @@ +export const version = '0.2.4'; diff --git a/packages/libraries/client/tests/enabled.spec.ts b/packages/libraries/core/tests/enabled.spec.ts similarity index 95% rename from packages/libraries/client/tests/enabled.spec.ts rename to packages/libraries/core/tests/enabled.spec.ts index 820a41adc..ba4f21e8e 100644 --- a/packages/libraries/client/tests/enabled.spec.ts +++ b/packages/libraries/core/tests/enabled.spec.ts @@ -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 () => { const logger = { diff --git a/packages/libraries/client/tests/gateways.spec.ts b/packages/libraries/core/tests/gateways.spec.ts similarity index 99% rename from packages/libraries/client/tests/gateways.spec.ts rename to packages/libraries/core/tests/gateways.spec.ts index b9a3a7c67..b634b9b2f 100644 --- a/packages/libraries/client/tests/gateways.spec.ts +++ b/packages/libraries/core/tests/gateways.spec.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line import/no-extraneous-dependencies import nock from 'nock'; -import { createSchemaFetcher, createServicesFetcher } from '../src/gateways'; +import { createSchemaFetcher, createServicesFetcher } from '../src/client/gateways'; afterEach(() => { nock.cleanAll(); diff --git a/packages/libraries/client/tests/info.spec.ts b/packages/libraries/core/tests/info.spec.ts similarity index 98% rename from packages/libraries/client/tests/info.spec.ts rename to packages/libraries/core/tests/info.spec.ts index de5c73025..3a29170a0 100644 --- a/packages/libraries/client/tests/info.spec.ts +++ b/packages/libraries/core/tests/info.spec.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line import/no-extraneous-dependencies import nock from 'nock'; -import { createHive } from '../src/client'; +import { createHive } from '../src/client/client'; test('should not leak the exception', async () => { const logger = { diff --git a/packages/libraries/client/tests/reporting.spec.ts b/packages/libraries/core/tests/reporting.spec.ts similarity index 98% rename from packages/libraries/client/tests/reporting.spec.ts rename to packages/libraries/core/tests/reporting.spec.ts index ced772667..e64c7f775 100644 --- a/packages/libraries/client/tests/reporting.spec.ts +++ b/packages/libraries/core/tests/reporting.spec.ts @@ -1,11 +1,8 @@ import { buildSchema, parse } from 'graphql'; -// eslint-disable-next-line import/no-extraneous-dependencies import nock from 'nock'; -// eslint-disable-next-line import/no-extraneous-dependencies import { buildSubgraphSchema as buildSubgraphSchemaV1 } from '@apollo/federation'; -// eslint-disable-next-line import/no-extraneous-dependencies import { buildSubgraphSchema as buildSubgraphSchemaV2 } from '@apollo/subgraph'; -import { createHive } from '../src/client'; +import { createHive } from '../src/client/client'; import { version } from '../src/version'; import { waitFor } from './test-utils'; diff --git a/packages/libraries/client/tests/test-utils.ts b/packages/libraries/core/tests/test-utils.ts similarity index 100% rename from packages/libraries/client/tests/test-utils.ts rename to packages/libraries/core/tests/test-utils.ts diff --git a/packages/libraries/client/tests/tsconfig.json b/packages/libraries/core/tests/tsconfig.json similarity index 100% rename from packages/libraries/client/tests/tsconfig.json rename to packages/libraries/core/tests/tsconfig.json diff --git a/packages/libraries/client/tests/usage-collector.spec.ts b/packages/libraries/core/tests/usage-collector.spec.ts similarity index 99% rename from packages/libraries/client/tests/usage-collector.spec.ts rename to packages/libraries/core/tests/usage-collector.spec.ts index 674c8822a..aafe56b02 100644 --- a/packages/libraries/client/tests/usage-collector.spec.ts +++ b/packages/libraries/core/tests/usage-collector.spec.ts @@ -1,5 +1,5 @@ import { buildSchema, parse } from 'graphql'; -import { createCollector } from '../src/internal/usage'; +import { createCollector } from '../src/client/usage'; const schema = buildSchema(/* GraphQL */ ` type Query { diff --git a/packages/libraries/client/tests/usage.spec.ts b/packages/libraries/core/tests/usage.spec.ts similarity index 99% rename from packages/libraries/client/tests/usage.spec.ts rename to packages/libraries/core/tests/usage.spec.ts index 17b74b4dd..63c160cf2 100644 --- a/packages/libraries/client/tests/usage.spec.ts +++ b/packages/libraries/core/tests/usage.spec.ts @@ -1,9 +1,9 @@ import { buildSchema, parse } from 'graphql'; // eslint-disable-next-line import/no-extraneous-dependencies import nock from 'nock'; -import { createHive } from '../src/client'; -import type { Report } from '../src/internal/usage'; -import { atLeastOnceSampler } from '../src/samplers'; +import { createHive } from '../src/client/client'; +import { atLeastOnceSampler } from '../src/client/samplers'; +import type { Report } from '../src/client/usage'; import { version } from '../src/version'; import { waitFor } from './test-utils'; diff --git a/packages/libraries/client/tests/utils.spec.ts b/packages/libraries/core/tests/utils.spec.ts similarity index 96% rename from packages/libraries/client/tests/utils.spec.ts rename to packages/libraries/core/tests/utils.spec.ts index ee469d484..9bdee6d97 100644 --- a/packages/libraries/client/tests/utils.spec.ts +++ b/packages/libraries/core/tests/utils.spec.ts @@ -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 () => { const left = await cacheDocumentKey('doc', { a: true }); diff --git a/packages/libraries/envelop/.gitignore b/packages/libraries/envelop/.gitignore new file mode 100644 index 000000000..4c9d7c35a --- /dev/null +++ b/packages/libraries/envelop/.gitignore @@ -0,0 +1,4 @@ +*.log +.DS_Store +node_modules +dist diff --git a/packages/libraries/envelop/LICENSE b/packages/libraries/envelop/LICENSE new file mode 100644 index 000000000..1cf5b9c7d --- /dev/null +++ b/packages/libraries/envelop/LICENSE @@ -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. diff --git a/packages/libraries/envelop/README.md b/packages/libraries/envelop/README.md new file mode 100644 index 000000000..37fcf5d5b --- /dev/null +++ b/packages/libraries/envelop/README.md @@ -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 you’re 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 diff --git a/packages/libraries/envelop/package.json b/packages/libraries/envelop/package.json new file mode 100644 index 000000000..3875a29ba --- /dev/null +++ b/packages/libraries/envelop/package.json @@ -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" + } +} diff --git a/packages/libraries/client/src/envelop.ts b/packages/libraries/envelop/src/index.ts similarity index 79% rename from packages/libraries/client/src/envelop.ts rename to packages/libraries/envelop/src/index.ts index 5eb642a8a..f1d1829f2 100644 --- a/packages/libraries/client/src/envelop.ts +++ b/packages/libraries/envelop/src/index.ts @@ -1,8 +1,25 @@ import { GraphQLError } from 'graphql'; import type { Plugin } from '@envelop/types'; -import { autoDisposeSymbol, createHive } from './client.js'; -import type { HiveClient, HivePluginOptions } from './internal/types.js'; -import { isAsyncIterable, isHiveClient } from './internal/utils.js'; +import { + autoDisposeSymbol, + 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: HivePluginOptions): Plugin; diff --git a/packages/libraries/envelop/src/version.ts b/packages/libraries/envelop/src/version.ts new file mode 100644 index 000000000..3916e0afa --- /dev/null +++ b/packages/libraries/envelop/src/version.ts @@ -0,0 +1 @@ +export const version = '0.32.0'; diff --git a/packages/libraries/envelop/tsconfig.json b/packages/libraries/envelop/tsconfig.json new file mode 100644 index 000000000..8cc32d09e --- /dev/null +++ b/packages/libraries/envelop/tsconfig.json @@ -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 + } +} diff --git a/packages/libraries/external-composition/README.md b/packages/libraries/external-composition/README.md index c851dd0fa..1ef90e473 100644 --- a/packages/libraries/external-composition/README.md +++ b/packages/libraries/external-composition/README.md @@ -1,9 +1,9 @@ # GraphQL Hive - external composition -[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](https://the-guild.dev/graphql/hive) 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. 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. diff --git a/packages/libraries/external-composition/package.json b/packages/libraries/external-composition/package.json index 83deae195..f7ddd6ffb 100644 --- a/packages/libraries/external-composition/package.json +++ b/packages/libraries/external-composition/package.json @@ -8,7 +8,7 @@ "url": "kamilkisiela/graphql-hive", "directory": "packages/libraries/external-composition" }, - "homepage": "https://graphql-hive.com", + "homepage": "https://the-guild.dev/graphql/hive", "author": { "email": "contact@the-guild.dev", "name": "The Guild", diff --git a/packages/libraries/yoga/.gitignore b/packages/libraries/yoga/.gitignore new file mode 100644 index 000000000..4c9d7c35a --- /dev/null +++ b/packages/libraries/yoga/.gitignore @@ -0,0 +1,4 @@ +*.log +.DS_Store +node_modules +dist diff --git a/packages/libraries/yoga/LICENSE b/packages/libraries/yoga/LICENSE new file mode 100644 index 000000000..1cf5b9c7d --- /dev/null +++ b/packages/libraries/yoga/LICENSE @@ -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. diff --git a/packages/libraries/yoga/README.md b/packages/libraries/yoga/README.md new file mode 100644 index 000000000..31462821d --- /dev/null +++ b/packages/libraries/yoga/README.md @@ -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 you’re 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 diff --git a/packages/libraries/client/package.json b/packages/libraries/yoga/package.json similarity index 66% rename from packages/libraries/client/package.json rename to packages/libraries/yoga/package.json index b03440e80..9c8f9f3fa 100644 --- a/packages/libraries/client/package.json +++ b/packages/libraries/yoga/package.json @@ -1,14 +1,14 @@ { - "name": "@graphql-hive/client", + "name": "@graphql-hive/yoga", "version": "0.32.0", "type": "module", - "description": "A NodeJS client for GraphQL Hive", + "description": "GraphQL Hive + GraphQL Yoga", "repository": { "type": "git", "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": { "email": "contact@the-guild.dev", "name": "The Guild", @@ -16,7 +16,7 @@ }, "license": "MIT", "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -39,39 +39,26 @@ }, "typings": "dist/typings/index.d.ts", "scripts": { - "build": "node scripts/update-version.mjs && bob build", + "build": "node ../../../scripts/generate-version.mjs && bob build", "check:build": "bob check" }, "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": { - "@graphql-hive/core": "^0.2.4", - "@graphql-tools/utils": "^10.0.0", - "@whatwg-node/fetch": "0.9.17", - "async-retry": "1.3.3", + "@graphql-hive/core": "workspace:*", "tiny-lru": "8.0.2" }, - "optionalDependencies": { - "@apollo/server": "^4.0.0", - "@envelop/types": "^5.0.0" - }, "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-yoga/plugin-defer-stream": "3.2.0", "@graphql-yoga/plugin-disable-introspection": "2.2.0", "@graphql-yoga/plugin-graphql-sse": "3.2.0", "@graphql-yoga/plugin-response-cache": "3.4.0", - "@types/async-retry": "1.4.8", - "body-parser": "1.20.2", - "express": "4.19.2", - "graphql": "16.8.1", + "@whatwg-node/fetch": "0.9.17", "graphql-ws": "5.16.0", - "graphql-yoga": "5.2.0", + "graphql-yoga": "5.3.0", "nock": "14.0.0-beta.5", "vitest": "1.5.0", "ws": "8.16.0" diff --git a/packages/libraries/client/src/yoga.ts b/packages/libraries/yoga/src/index.ts similarity index 94% rename from packages/libraries/client/src/yoga.ts rename to packages/libraries/yoga/src/index.ts index 12b243667..75cbe76fb 100644 --- a/packages/libraries/client/src/yoga.ts +++ b/packages/libraries/yoga/src/index.ts @@ -8,9 +8,17 @@ import { } from 'graphql'; import type { GraphQLParams, Plugin } from 'graphql-yoga'; import LRU from 'tiny-lru'; -import { autoDisposeSymbol, createHive as createHiveClient } from './client.js'; -import type { CollectUsageCallback, HiveClient, HivePluginOptions } from './internal/types.js'; -import { isAsyncIterable, isHiveClient } from './internal/utils.js'; +import { + autoDisposeSymbol, + CollectUsageCallback, + createHive as createHiveClient, + HiveClient, + HivePluginOptions, + isAsyncIterable, + isHiveClient, +} from '@graphql-hive/core'; + +export { atLeastOnceSampler, createSchemaFetcher, createServicesFetcher } from '@graphql-hive/core'; type CacheRecord = { callback: CollectUsageCallback; diff --git a/packages/libraries/yoga/src/version.ts b/packages/libraries/yoga/src/version.ts new file mode 100644 index 000000000..3916e0afa --- /dev/null +++ b/packages/libraries/yoga/src/version.ts @@ -0,0 +1 @@ +export const version = '0.32.0'; diff --git a/packages/libraries/client/tests/yoga.spec.ts b/packages/libraries/yoga/tests/yoga.spec.ts similarity index 88% rename from packages/libraries/client/tests/yoga.spec.ts rename to packages/libraries/yoga/tests/yoga.spec.ts index 0fc44e034..e39804472 100644 --- a/packages/libraries/client/tests/yoga.spec.ts +++ b/packages/libraries/yoga/tests/yoga.spec.ts @@ -1,22 +1,176 @@ -/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ import { createServer } from 'node:http'; import { GraphQLError } from 'graphql'; import { createClient } from 'graphql-ws'; import { useServer as useWSServer } from 'graphql-ws/lib/use/ws'; import { createLogger, createSchema, createYoga } from 'graphql-yoga'; import nock from 'nock'; +import { beforeAll, describe, expect, test, vi } from 'vitest'; import { WebSocket, WebSocketServer } from 'ws'; import { useDeferStream } from '@graphql-yoga/plugin-defer-stream'; import { useDisableIntrospection } from '@graphql-yoga/plugin-disable-introspection'; import { useGraphQLSSE } from '@graphql-yoga/plugin-graphql-sse'; 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(() => { nock.cleanAll(); }); -it('reports usage', async ({ expect }) => { +function waitFor(ms: number) { + return new Promise(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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -194,7 +348,7 @@ test('reports usage with response cache', async ({ expect }) => { 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 yoga = createYoga({ schema: createSchema({ @@ -255,7 +409,7 @@ it('does not report usage for operation that does not pass validation', async ({ 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 yoga = createYoga({ @@ -319,7 +473,7 @@ it('does not report usage if context creating raises an error', async ({ expect describe('subscription usage reporting', () => { 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') .post('/usage', body => { expect(body.map).toEqual({ @@ -427,13 +581,14 @@ describe('subscription usage reporting', () => { : event: complete + data: `); })().catch(reject); }); 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -548,6 +703,7 @@ describe('subscription usage reporting', () => { data: {"errors":[{"message":"Unexpected error.","locations":[{"line":1,"column":1}]}]} event: complete + data: `); })().catch(reject); }); @@ -556,7 +712,7 @@ describe('subscription usage reporting', () => { }); 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -677,7 +833,7 @@ describe('subscription usage reporting', () => { 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -795,7 +951,7 @@ describe('subscription usage reporting', () => { }); 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -967,7 +1123,7 @@ describe('subscription usage reporting', () => { }); 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` @@ -1140,7 +1296,7 @@ describe('subscription 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') .post('/usage', body => { expect(body.map).toMatchInlineSnapshot(` diff --git a/packages/libraries/yoga/tsconfig.json b/packages/libraries/yoga/tsconfig.json new file mode 100644 index 000000000..8cc32d09e --- /dev/null +++ b/packages/libraries/yoga/tsconfig.json @@ -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 + } +} diff --git a/packages/services/external-composition/federation-2/README.md b/packages/services/external-composition/federation-2/README.md index be11005d1..78eba198c 100644 --- a/packages/services/external-composition/federation-2/README.md +++ b/packages/services/external-composition/federation-2/README.md @@ -3,7 +3,7 @@ # Background 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 local infrastructure, and connect GraphQL Hive (Cloud or self-service). @@ -56,7 +56,7 @@ node dist/index.js ## 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. diff --git a/packages/services/server/package.json b/packages/services/server/package.json index 4b7b541e2..3ea7375ef 100644 --- a/packages/services/server/package.json +++ b/packages/services/server/package.json @@ -23,7 +23,7 @@ "@escape.tech/graphql-armor-max-tokens": "2.3.0", "@fastify/cors": "9.0.1", "@fastify/formbody": "7.4.0", - "@graphql-hive/client": "workspace:*", + "@graphql-hive/yoga": "workspace:*", "@graphql-yoga/plugin-persisted-operations": "3.2.0", "@graphql-yoga/plugin-response-cache": "3.4.0", "@hive/api": "workspace:*", diff --git a/packages/services/server/src/graphql-handler.ts b/packages/services/server/src/graphql-handler.ts index 97a56b600..1543fbd15 100644 --- a/packages/services/server/src/graphql-handler.ts +++ b/packages/services/server/src/graphql-handler.ts @@ -18,7 +18,7 @@ import { useGraphQlJit } from '@envelop/graphql-jit'; import { useGraphQLModules } from '@envelop/graphql-modules'; import { useOpenTelemetry } from '@envelop/opentelemetry'; 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 { useResponseCache } from '@graphql-yoga/plugin-response-cache'; import { Registry, RegistryContext } from '@hive/api'; @@ -176,7 +176,7 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth return resolveUser(ctx); }, }), - useYogaHive({ + useHive({ debug: true, enabled: !!options.hiveConfig, token: options.hiveConfig?.token ?? '', diff --git a/packages/web/app/src/components/policy/policy-list-item.tsx b/packages/web/app/src/components/policy/policy-list-item.tsx index 4299dbc54..f1d611518 100644 --- a/packages/web/app/src/components/policy/policy-list-item.tsx +++ b/packages/web/app/src/components/policy/policy-list-item.tsx @@ -86,7 +86,6 @@ export function PolicyListItem(props: {
- {/* eslint-disable-next-line tailwindcss/no-unnecessary-arbitrary-value */}
{shouldShowRuleConfig && ( + + + +```typescript +import { createHive, atLeastOnceSampler} from '@graphql-hive/core'; + +const hive = createHive({ /* ... other options ... */, usage: { sampler: atLeastOnceSampler({ @@ -148,7 +176,12 @@ useHive({ // and some operations may have the same name but different body. 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(); if (hour >= 9 && hour <= 17) { @@ -162,13 +195,131 @@ useHive({ }) ``` + + + + +```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; + } + }) + } +}) +``` + + + + + +```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; + } + }) + } +}) +``` + + + + + +```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; + } + }) + } +}) +``` + + + + + #### Custom Integration 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. ```ts -import { createHive } from '@graphql-hive/client' +import { createHive } from '@graphql-hive/core' const hive = createHive({ enabled: true, diff --git a/packages/web/docs/src/pages/docs/features/high-availability-cdn.mdx b/packages/web/docs/src/pages/docs/features/high-availability-cdn.mdx index e3dbcc7e8..abae4bec3 100644 --- a/packages/web/docs/src/pages/docs/features/high-availability-cdn.mdx +++ b/packages/web/docs/src/pages/docs/features/high-availability-cdn.mdx @@ -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. -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. ## CDN Hosts diff --git a/packages/web/docs/src/pages/docs/features/usage-reporting.mdx b/packages/web/docs/src/pages/docs/features/usage-reporting.mdx index 0d63ef95e..109952043 100644 --- a/packages/web/docs/src/pages/docs/features/usage-reporting.mdx +++ b/packages/web/docs/src/pages/docs/features/usage-reporting.mdx @@ -1,5 +1,4 @@ import NextImage from 'next/image' -import { Tab, Tabs } from 'nextra-theme-docs' import { Callout } from '@theguild/components' import monitoringViewImage from '../../../../public/docs/pages/features/monitoring-view.png' import usageClientsImage from '../../../../public/docs/pages/features/usage-clients.png' diff --git a/packages/web/docs/src/pages/docs/get-started/schema-stitching.mdx b/packages/web/docs/src/pages/docs/get-started/schema-stitching.mdx index c4167e6d8..32f4a8f41 100644 --- a/packages/web/docs/src/pages/docs/get-started/schema-stitching.mdx +++ b/packages/web/docs/src/pages/docs/get-started/schema-stitching.mdx @@ -481,7 +481,7 @@ GraphQL gateway using GraphQL-Yoga: import { createServer } from 'node:http' import { buildSchema } from 'graphql' import { createYoga } from 'graphql-yoga' -import { createServicesFetcher } from '@graphql-hive/client' +import { createServicesFetcher } from '@graphql-hive/core' import { stitchSchemas } from '@graphql-tools/stitch' import { stitchingDirectives } from '@graphql-tools/stitching-directives' diff --git a/packages/web/docs/src/pages/docs/integrations/apollo-gateway.mdx b/packages/web/docs/src/pages/docs/integrations/apollo-gateway.mdx index b153325b5..827810dff 100644 --- a/packages/web/docs/src/pages/docs/integrations/apollo-gateway.mdx +++ b/packages/web/docs/src/pages/docs/integrations/apollo-gateway.mdx @@ -35,7 +35,7 @@ flowchart LR ## Installation ```sh npm2yarn -npm i @graphql-hive/client +npm i @graphql-hive/apollo ``` @@ -43,7 +43,7 @@ npm i @graphql-hive/client includes a runtime to send usage reports and schemas to Hive registry. -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 [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 { ApolloServer } from '@apollo/server' import { startStandaloneServer } from '@apollo/server/standalone' -import { createSupergraphManager } from '@graphql-hive/client' +import { createSupergraphManager } from '@graphql-hive/apollo' const gateway = new ApolloGateway({ // 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 { ApolloServer } from '@apollo/server' import { startStandaloneServer } from '@apollo/server/standalone' -import { createSupergraphManager, hiveApollo } from '@graphql-hive/client' +import { createSupergraphManager, useHive } from '@graphql-hive/apollo' const gateway = new ApolloGateway({ // Apollo Gateway will fetch Supergraph from Hive CDN @@ -102,7 +102,7 @@ const gateway = new ApolloGateway({ const server = new ApolloServer({ gateway, plugins: [ - hiveApollo({ + useHive({ enabled: true, token: 'YOUR-TOKEN', 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) - [Apollo Gateway documentation](https://www.apollographql.com/docs/federation/v1/gateway/) - [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) -- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) +- [`@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/core/src/client/types.ts) diff --git a/packages/web/docs/src/pages/docs/integrations/apollo-server.mdx b/packages/web/docs/src/pages/docs/integrations/apollo-server.mdx index c95a64136..eb825a2c4 100644 --- a/packages/web/docs/src/pages/docs/integrations/apollo-server.mdx +++ b/packages/web/docs/src/pages/docs/integrations/apollo-server.mdx @@ -3,7 +3,7 @@ import { Callout } from '@theguild/components' # Apollo-Server You can send usage reports to the Hive registry from your Apollo-Server instance using the -`@graphql-hive/client` package. +`@graphql-hive/apollo` package. 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 ```sh npm2yarn -npm i @graphql-hive/client +npm i @graphql-hive/apollo ``` @@ -21,10 +21,15 @@ npm i @graphql-hive/client includes a runtime to send usage reports to the Hive registry. -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 directly. +## Configuration + +A full configuration guide can be found in the +["Configuration"](../api-reference/client.mdx#configuration) page. + ## Integration ### Publishing Schemas @@ -34,12 +39,12 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process. ### 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. 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. #### 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: ```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 { hiveApollo } from '@graphql-hive/client' +import { useHive } from '@graphql-hive/apollo' const testServer = new ApolloServer({ schema, plugins: [ - hiveApollo({ + useHive({ enabled: true, token: 'YOUR-TOKEN', usage: true @@ -90,7 +95,7 @@ curl \ -H "accept: application/json" \ -X POST \ "http://localhost:4000/graphql" \ - -d '{"query":"{ hello }"} + -d '{"query":"{ hello }"}' ``` @@ -126,7 +131,7 @@ import { WebSocketServer } from 'ws' import { ApolloServer } from '@apollo/server' import { expressMiddleware } from '@apollo/server/express4' 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' const PORT = 3000 @@ -157,7 +162,7 @@ const serverCleanup = useServer( const server = new ApolloServer({ schema, plugins: [ - hiveApollo(hiveClient), + useHive(hiveClient), ApolloServerPluginDrainHttpServer({ httpServer }), { async serverWillStart() { @@ -209,6 +214,6 @@ const client = createClient({ ## Additional Resources -- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) -- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) +- [`@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/core/src/client/types.ts) - [Apollo Server](https://www.apollographql.com/docs/apollo-server/) diff --git a/packages/web/docs/src/pages/docs/integrations/envelop.mdx b/packages/web/docs/src/pages/docs/integrations/envelop.mdx index 2d3f81477..d19374b78 100644 --- a/packages/web/docs/src/pages/docs/integrations/envelop.mdx +++ b/packages/web/docs/src/pages/docs/integrations/envelop.mdx @@ -10,7 +10,7 @@ import { Callout } from '@theguild/components' ## Installation ```sh npm2yarn -npm i @graphql-hive/client +npm i @graphql-hive/envelop ``` @@ -18,10 +18,15 @@ npm i @graphql-hive/client includes a runtime to send usage reports and schemas to Hive registry. -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 that supports Envelop. +## Configuration + +A full configuration guide can be found in the +["Configuration"](../api-reference/client.mdx#configuration) page. + ## Integration Guide ### Publishing Schemas @@ -33,7 +38,7 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process. 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. 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 import { createServer } from 'node:http' import { createYoga } from 'graphql-yoga' +import { useHive } from '@graphql-hive/envelop' import { schema } from './schema' const plugin = useHive({ @@ -52,6 +58,6 @@ const plugin = useHive({ ## Additional Resources -- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) -- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) +- [`@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/cire/src/client/types.ts) - [Envelop](https://the-guild.dev/graphql/envelop) diff --git a/packages/web/docs/src/pages/docs/integrations/graphql-yoga.mdx b/packages/web/docs/src/pages/docs/integrations/graphql-yoga.mdx index 5729afd1b..26564498c 100644 --- a/packages/web/docs/src/pages/docs/integrations/graphql-yoga.mdx +++ b/packages/web/docs/src/pages/docs/integrations/graphql-yoga.mdx @@ -9,7 +9,7 @@ Hive. ## Installation ```sh npm2yarn -npm i @graphql-hive/client +npm i @graphql-hive/yoga ``` @@ -17,10 +17,15 @@ npm i @graphql-hive/client includes a runtime to send usage reports and schemas to Hive registry. -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 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 ### Publishing Schemas @@ -32,7 +37,7 @@ Follow the [CI/CD instructions](./ci-cd.mdx) for automating the process. 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. #### GraphQL over HTTP (default) @@ -42,13 +47,13 @@ You can send usage reporting to Hive registry by using the `usage` section of th ```ts import { createServer } from 'node:http' import { createYoga } from 'graphql-yoga' -import { useYogaHive } from '@graphql-hive/client' +import { useHive } from '@graphql-hive/yoga' import { schema } from './schema' const yoga = createYoga({ schema, plugins: [ - useYogaHive({ + useHive({ enabled: true, // Enable/Disable Hive Client token: 'YOUR-TOKEN', // 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: ```typescript -import { useYogaHive, createYogaHive, useYogaHive } from '@graphql-hive/client' import { createYoga } from 'graphql-yoga' +import { createHive, useHive } from '@graphql-hive/yoga' export default { async fetch(request, env, ctx) { - const hive = createYogaHive({ + const hive = createHive({ enabled: true, // Enable/Disable Hive Client token: 'YOUR-TOKEN', usage: true // Collects schema usage based on operations - }); + }) const yoga = createYoga({ - plugins: [ - useYogaHive(hive) - ] - }); + plugins: [useHive(hive)] + }) - const response = await yoga.fetch(request, env, ctx); - ctx.waitUntil(hive.dispose()); - return response; + const response = await yoga.fetch(request, env, ctx) + ctx.waitUntil(hive.dispose()) + return response } } ``` @@ -101,7 +104,8 @@ export default { ##### Client Information 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} curl \ @@ -111,7 +115,7 @@ curl \ -H "accept: application/json" \ -X POST \ "http://localhost:4000/graphql" \ - -d '{"query":"{ hello }"} + -d '{"query":"{ hello }"}' ``` #### 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} import { createServer } from 'node:http' 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 { schema } from './schema' @@ -134,7 +138,7 @@ const yoga = createYoga({ schema, plugins: [ useGraphQLSSE(), - useYogaHive({ + useHive({ enabled: true, token: 'YOUR-TOKEN', usage: true @@ -177,6 +181,7 @@ import { createServer } from 'node:http' import { useServer } from 'graphql-ws/lib/use/ws' import { createYoga } from 'graphql-yoga' import { WebSocketServer } from 'ws' +import { useHive } from '@graphql-hive/yoga' import { schema } from './schema' const yoga = createYoga({ @@ -185,7 +190,7 @@ const yoga = createYoga({ subscriptionsProtocol: 'WS' }, plugins: [ - useYogaHive({ + useHive({ enabled: true, token: 'YOUR-TOKEN', usage: true @@ -257,6 +262,6 @@ const client = createClient({ ## Additional Resources -- [`@graphql-hive/client` source code](https://github.com/kamilkisiela/graphql-hive/tree/main/packages/libraries/client) -- [`HivePluginOptions` configuration reference](https://github.com/kamilkisiela/graphql-hive/blob/main/packages/libraries/client/src/internal/types.ts#LL40C29-L40C29) +- [`@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/core/src/client/types.ts) - [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server) diff --git a/packages/web/docs/src/pages/docs/integrations/schema-stitching.mdx b/packages/web/docs/src/pages/docs/integrations/schema-stitching.mdx index ec468b5cf..ce6f7e7d9 100644 --- a/packages/web/docs/src/pages/docs/integrations/schema-stitching.mdx +++ b/packages/web/docs/src/pages/docs/integrations/schema-stitching.mdx @@ -5,7 +5,7 @@ import { Callout } from '@theguild/components' ## Installation ```sh npm2yarn -npm i @graphql-hive/client +npm i @graphql-hive/core ``` @@ -13,13 +13,13 @@ npm i @graphql-hive/client includes a runtime to send usage reports and schemas to Hive registry. -The `@graphql-hive/client` package exports a utility function called `createServicesFetcher` that -can be used to fetch services definition from Hive's CDN. You can use it to create a GraphQL schema -from the all services schemas published to Hive. +The `@graphql-hive/core` package exports a utility function called `createServicesFetcher` that can +be used to fetch services definition from Hive's CDN. You can use it to create a GraphQL schema from +the all services schemas published to Hive. - The `createServicesFetcher` function is a part of the `@graphql-hive/client` package, and it can - be used with any GraphQL server runtime. You may use it with Apollo Server, GraphQL Yoga, or any + The `createServicesFetcher` function is a part of the `@graphql-hive/core` package, and it can be + 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. @@ -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 { buildSchema } from 'graphql' 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 { stitchSchemas } from '@graphql-tools/stitch' diff --git a/packages/web/docs/src/pages/docs/self-hosting/client-and-cli-configuration.mdx b/packages/web/docs/src/pages/docs/self-hosting/client-and-cli-configuration.mdx index 1f19253f3..a9544f36a 100644 --- a/packages/web/docs/src/pages/docs/self-hosting/client-and-cli-configuration.mdx +++ b/packages/web/docs/src/pages/docs/self-hosting/client-and-cli-configuration.mdx @@ -1,3 +1,5 @@ +import { Tabs } from '@theguild/components' + # Client & CLI Configuration 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. -```ts filename="hive.ts" -import { createHive } from '@graphql-hive/client' + + + +```ts filename="custom.ts" +import { createHive } from '@graphql-hive/core' const hive = createHive({ enabled: true, @@ -23,6 +28,85 @@ const hive = createHive({ }) ``` + + + + +```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 + }) + ] +}) +``` + + + + + +```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 + }) + ] +}) +``` + + + + + +```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 + }) + ] +}) +``` + + + + + ## Configuring the CLI Place a `hive.json` file within the root of your project. diff --git a/packages/web/docs/src/pages/docs/specs/usage-reports.md b/packages/web/docs/src/pages/docs/specs/usage-reports.md index cdc81d442..16d2a773b 100644 --- a/packages/web/docs/src/pages/docs/specs/usage-reports.md +++ b/packages/web/docs/src/pages/docs/specs/usage-reports.md @@ -1,6 +1,6 @@ # 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. > It's recommended to send a report for more than 1 operation. The maximum payload size is 1 MB. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63ee0b254..da6f290f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,7 +63,7 @@ importers: version: 5.0.2(graphql@16.8.1) '@graphql-codegen/cli': 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': specifier: 4.2.5 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) '@graphql-eslint/eslint-plugin': 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': specifier: 4.0.3 version: 4.0.3(@types/node@20.12.7)(encoding@0.1.13)(graphql@16.8.1) @@ -260,9 +260,9 @@ importers: '@esm2cjs/execa': specifier: 6.1.1-cjs.1 version: 6.1.1-cjs.1 - '@graphql-hive/client': + '@graphql-hive/apollo': specifier: workspace:* - version: link:../packages/libraries/client/dist + version: link:../packages/libraries/apollo/dist '@graphql-hive/core': specifier: workspace:* version: link:../packages/libraries/core/dist @@ -330,11 +330,46 @@ importers: specifier: 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: dependencies: '@graphql-hive/core': - specifier: 0.2.4 - version: 0.2.4(graphql@16.8.1) + specifier: workspace:* + version: link:../core/dist '@graphql-inspector/core': specifier: 5.1.0-alpha-20231208113249-34700c8a version: 5.1.0-alpha-20231208113249-34700c8a(graphql@16.8.1) @@ -409,30 +444,23 @@ importers: 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) - packages/libraries/client: + packages/libraries/core: dependencies: - '@graphql-hive/core': - specifier: ^0.2.4 - version: 0.2.4(graphql@16.8.1) '@graphql-tools/utils': specifier: ^10.0.0 - version: 10.0.0(graphql@16.8.1) + version: 10.1.3(graphql@16.8.1) '@whatwg-node/fetch': specifier: 0.9.17 version: 0.9.17 async-retry: specifier: 1.3.3 version: 1.3.3 + lodash.sortby: + specifier: 4.7.0 + version: 4.7.0 tiny-lru: specifier: 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: '@apollo/federation': specifier: 0.38.1 @@ -440,65 +468,35 @@ importers: '@apollo/subgraph': specifier: 2.7.3 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': specifier: 4.7.9 version: 4.7.9 graphql: specifier: 16.8.1 version: 16.8.1 + nock: + specifier: 14.0.0-beta.5 + version: 14.0.0-beta.5 tslib: specifier: 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 packages/libraries/external-composition: @@ -517,6 +515,53 @@ importers: version: 16.8.1 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: devDependencies: '@graphql-hive/core': @@ -1069,9 +1114,9 @@ importers: '@fastify/formbody': specifier: 7.4.0 version: 7.4.0 - '@graphql-hive/client': + '@graphql-hive/yoga': specifier: workspace:* - version: link:../../libraries/client/dist + version: link:../../libraries/yoga/dist '@graphql-yoga/plugin-persisted-operations': 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) @@ -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) '@theguild/components': 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: specifier: 2.1.0 version: 2.1.0 @@ -1913,13 +1958,13 @@ importers: version: 4.0.3 next: 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: 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: 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: specifier: 18.2.0 version: 18.2.0 @@ -1954,9 +1999,9 @@ importers: scripts: devDependencies: - '@graphql-hive/client': - specifier: '*' - version: 0.32.0(encoding@0.1.13)(graphql@16.8.1) + '@graphql-hive/core': + specifier: workspace:* + version: link:../packages/libraries/core/dist packages: @@ -2050,6 +2095,12 @@ packages: peerDependencies: 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': resolution: {integrity: sha512-w/6FoubSxuzXSx8uvLE1wEuHZVHRXFyfHPKdM76wX5U/xw82zlUKseVO7wTuVODTcnUzEA30udYeCApUoC3/Xw==} engines: {node: '>=12.13.0'} @@ -3900,18 +3951,6 @@ packages: 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-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': resolution: {integrity: sha512-cm4EtieIp9PUSDBze+Sn5HHF80jDF9V7sYyXqFa7+Vtw4Jlet98Ig48dFVtoLuFCPtCv2eZ22I8JOkBKL5WgVA==} engines: {node: '>=16.0.0'} @@ -4160,6 +4199,12 @@ packages: peerDependencies: 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': resolution: {integrity: sha512-ivNtxD+iEfpPONYKip0kbpZMRdMCNR3HrIui8NCURmUdvBYGaGcbB3VrGMhxwZuzc+ybhs2ralPt1F8Oxq2jLA==} engines: {node: '>=16.0.0'} @@ -4238,12 +4283,6 @@ packages: peerDependencies: 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': resolution: {integrity: sha512-FeKv9lKLMwqDu0pQjPpF59GY3HReUkWXKsMIuMuJQOKh9BETu7zPEFUELvcw8w+lwZkl4ileJsHXC9+AnsT2Lw==} engines: {node: '>=16.0.0'} @@ -4274,12 +4313,6 @@ packages: peerDependencies: 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': resolution: {integrity: sha512-p28Oh9EcOna6i0yLaCFOnkcBDQECVf3SCexT6ktb86QNj9idnkhI+tCxnwZDh58Qvjd2nURdkbevvoZkvxzCog==} engines: {node: '>=16.0.0'} @@ -4314,12 +4347,6 @@ packages: peerDependencies: 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': resolution: {integrity: sha512-6uO41urAEIs4sXQT2+CYGsUTkHkVo/2MpM/QjoHj6D6xoEF2woXHBpdAVi0HKIInDwZqWgEYOwIFez0pERxa1Q==} engines: {node: '>=16.0.0'} @@ -11009,6 +11036,12 @@ packages: peerDependencies: 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: resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} @@ -17360,6 +17393,38 @@ snapshots: - encoding - 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)': dependencies: '@apollo/cache-control-types': 1.0.3(graphql@16.8.1) @@ -19663,7 +19728,7 @@ snapshots: graphql: 16.8.1 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: '@babel/generator': 7.23.6 '@babel/template': 7.22.15 @@ -19673,7 +19738,7 @@ snapshots: '@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/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/graphql-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 - 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)': dependencies: '@babel/code-frame': 7.21.4 @@ -19890,27 +19978,6 @@ snapshots: - supports-color - 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)': 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) @@ -19940,7 +20007,7 @@ snapshots: '@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/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/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) @@ -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)': dependencies: '@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 tslib: 2.6.2 yargs: 17.7.2 @@ -20070,10 +20137,10 @@ snapshots: graphql: 16.8.1 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: '@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/utils': 10.0.3(graphql@16.8.1) graphql: 16.8.1 @@ -20182,6 +20249,18 @@ snapshots: tslib: 2.6.2 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)': dependencies: '@graphql-tools/graphql-tag-pluck': 7.5.2(@babel/core@7.24.0)(graphql@16.8.1) @@ -20206,18 +20285,6 @@ snapshots: - '@babel/core' - 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)': dependencies: '@graphql-tools/graphql-tag-pluck': 8.2.0(graphql@16.8.1) @@ -20374,6 +20441,15 @@ snapshots: tslib: 2.6.2 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)': dependencies: '@graphql-tools/graphql-tag-pluck': 8.0.1(@babel/core@7.22.9)(graphql@16.8.1) @@ -20387,19 +20463,6 @@ snapshots: - '@babel/core' - 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)': dependencies: '@ardatan/sync-fetch': 0.0.1(encoding@0.1.13) @@ -20433,6 +20496,19 @@ snapshots: tslib: 2.6.2 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)': dependencies: '@babel/parser': 7.24.0 @@ -20459,19 +20535,6 @@ snapshots: - '@babel/core' - 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)': dependencies: '@babel/core': 7.24.0 @@ -20525,7 +20588,7 @@ snapshots: '@graphql-tools/load@8.0.0(graphql@16.8.1)': 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: 16.8.1 p-limit: 3.1.0 @@ -20537,12 +20600,6 @@ snapshots: graphql: 16.8.1 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)': dependencies: '@graphql-tools/utils': 10.1.3(graphql@16.8.1) @@ -20600,14 +20657,6 @@ snapshots: - encoding - 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)': dependencies: '@graphql-tools/merge': 9.0.3(graphql@16.8.1) @@ -20678,22 +20727,16 @@ snapshots: '@types/ws': 8.5.3 '@whatwg-node/fetch': 0.9.17 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 value-or-promise: 1.0.12 - ws: 8.13.0 + ws: 8.16.0 transitivePeerDependencies: - '@types/node' - bufferutil - encoding - 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)': dependencies: '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) @@ -20754,22 +20797,22 @@ snapshots: dependencies: 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: '@graphql-tools/utils': 10.1.3(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: 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: 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)': dependencies: @@ -20785,6 +20828,14 @@ snapshots: transitivePeerDependencies: - '@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': dependencies: '@graphql-yoga/typed-event-target': 2.0.0 @@ -25058,16 +25109,16 @@ snapshots: '@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: '@giscus/react': 3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@next/bundle-analyzer': 13.4.2 clsx: 2.1.0 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)) - 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-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: 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.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-dom: 18.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 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: {} gray-matter@4.0.3: @@ -32878,17 +32944,17 @@ snapshots: 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: '@corex/deepmerge': 4.0.43 '@next/env': 13.5.6 fast-glob: 3.3.2 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: - 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-dom: 18.2.0(react@18.2.0) @@ -32900,6 +32966,32 @@ snapshots: transitivePeerDependencies: - 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): dependencies: '@next/env': 14.2.1 @@ -32931,7 +33023,7 @@ snapshots: 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) - 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: '@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@popperjs/core': 2.11.8 @@ -32940,15 +33032,15 @@ snapshots: flexsearch: 0.7.43 focus-visible: 5.2.0 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-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) - 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) + 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.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.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-dom: 18.2.0(react@18.2.0) scroll-into-view-if-needed: 3.1.0 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: '@headlessui/react': 1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@mdx-js/mdx': 3.0.1 @@ -32966,7 +33058,7 @@ snapshots: gray-matter: 4.0.3 hast-util-to-estree: 3.1.0 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 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -36006,6 +36098,13 @@ snapshots: hey-listen: 1.0.8 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): dependencies: client-only: 0.0.1 diff --git a/scripts/generate-version.mjs b/scripts/generate-version.mjs new file mode 100644 index 000000000..a4dd0c223 --- /dev/null +++ b/scripts/generate-version.mjs @@ -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); diff --git a/scripts/package.json b/scripts/package.json index e9e5cf1a2..de0d0474d 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -4,6 +4,6 @@ "type": "module", "private": true, "devDependencies": { - "@graphql-hive/client": "*" + "@graphql-hive/core": "workspace:*" } } diff --git a/scripts/seed-local-env.ts b/scripts/seed-local-env.ts index a3a904c62..70cce2d60 100644 --- a/scripts/seed-local-env.ts +++ b/scripts/seed-local-env.ts @@ -1,5 +1,5 @@ import { buildSchema, parse } from 'graphql'; -import { createHive } from '@graphql-hive/client'; +import { createHive } from '@graphql-hive/core'; const isFederation = process.env.FEDERATION === '1'; const isSchemaReportingEnabled = process.env.SCHEMA_REPORTING !== '0'; diff --git a/tsconfig.json b/tsconfig.json index 56fc3217b..c6b0f4eda 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -53,7 +53,9 @@ "@hive/webhooks": ["./packages/services/webhooks/src/api.ts"], "@hive/emails": ["./packages/services/emails/src/api.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": [ "./packages/libraries/external-composition/src/index.ts" ], diff --git a/turbo.json b/turbo.json index 37d339a39..b8a8b2169 100644 --- a/turbo.json +++ b/turbo.json @@ -16,7 +16,19 @@ "dependsOn": ["^build"], "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"], "outputs": ["dist/**"] }, @@ -38,7 +50,7 @@ "outputs": [".next/**", "!.next/cache/**"] }, "@hive/migrations#build": { - "dependsOn": ["^build", "@graphql-hive/client#build"], + "dependsOn": ["^build"], "outputs": ["dist/**"] }, "@hive/server#build": {