由 Tobias W. 出售

A comprehensive suite of utilities for building, mocking, merging, and optimizing GraphQL schemas and documents. Designed for backend developers working with GraphQL.js, Apollo, and GraphQL Yoga.
This block delivers the full graphql-tools monorepo package set: schema building, document manipulation, execution, schema stitching, mocking, loaders, and Apollo/Yoga/urql executor adapters. The typical buyer is a backend TypeScript team building a GraphQL gateway, federation layer, or schema-stitching proxy that needs production-grade tooling without reinventing it.
documents/ - Utilities for normalizing, sorting, and printing executable GraphQL documentsexecutor/ - A spec-compliant, incremental-delivery-capable GraphQL executorexecutors/apollo-link/ - Apollo Client ApolloLink adapter wrapping any Executorexecutors/envelop/ - Envelop plugin that sources a remote schema from an Executorexecutors/legacy-ws/ - WebSocket executor for legacy subscriptions-transport-ws serversexecutors/urql-exchange/ - urql exchange wrapping any Executorexecutors/yoga/ - GraphQL Yoga executor adaptergraphql-tag-pluck/ - Extracts GraphQL template literals from JS/TS source filesgraphql-tools/ - Aggregated re-export package (public entry point)import/ - GraphQL #import directive resolver for multi-file schemasinspect/ - Deep inspection utilities for GraphQL typesjest-transform/ - Jest transformer for .graphql fileslinks/ - HTTP/fetch-based executor link implementationsload/ - Schema and document loading from files, URLs, globsload-files/ - Raw file loading utilities used by loadloaders/ - Specific loaders (URL, code-file, git, GitHub, etc.)merge/ - Type definition and resolver mergingmock/ - Schema mocking with per-type and per-field overridesnode-require/ - require-based module loading helperoptimize/ - Query document optimization passesrelay-compiler/ - Relay compiler integrationrelay-operation-optimizer/ - Relay-style operation optimization启动隔离沙箱并在服务器端直接运行 — 无需本地配置。
此版本的 Tetrees AI Review
This Express backend / api completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
管道 avcp-2026-08-04.1 · SHA-256 a68013e19f59bf60…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
审查日期 2026年8月4日
将此产品直接导入你的 AI IDE、网页构建器或云端 IDE。
将 Tetrees 连接到兼容的 AI IDE,列出你拥有的产品并获取已验证 ZIP,同时不会开放卖家上传权限。
暂无评价。
Sign in to join the discussion
Loading discussion…
resolvers-composition/ - Higher-order resolver composition utilitiesschema/ - makeExecutableSchema and schema transformation helperstesting/ - Test helpers shared across the monorepoutils/ - Core types (Executor, MaybePromise, etc.) used by all packageswebpack-loader/ - Webpack loader for .graphql fileswebpack-loader-runtime/ - Runtime support for the webpack loadernpm install graphql
npm install @graphql-tools/utils @graphql-tools/schema @graphql-tools/merge
npm install @graphql-tools/load @graphql-tools/load-files
npm install @graphql-tools/executor
npm install @graphql-tools/documents
# Apollo executor adapter (optional)
npm install @graphql-tools/executor-apollo-link @apollo/client
# Envelop executor plugin (optional)
npm install @graphql-tools/executor-envelop @envelop/core @graphql-tools/wrap
# urql exchange (optional)
npm install @graphql-tools/executor-urql-exchange urql
# yoga executor (optional)
npm install @graphql-tools/executor-yoga graphql-yoga
No native modules, pod install, or Android linking steps required. All packages are pure JavaScript/TypeScript.
source/ directory into your project, e.g. src/graphql-tools/.tsconfig.json if you want to import from the source directly instead of the published npm packages:{
"compilerOptions": {
"paths": {
"@graphql-tools/utils": ["./src/graphql-tools/utils/src/index.ts"],
"@graphql-tools/schema": ["./src/graphql-tools/schema/src/index.ts"],
"@graphql-tools/executor": ["./src/graphql-tools/executor/src/index.ts"],
"@graphql-tools/documents": ["./src/graphql-tools/documents/src/index.ts"]
}
}
}
"moduleResolution": "bundler" or "node16" is set; the source uses .js extensions in imports which require modern resolution.loaders/url) expect a standard fetch global (Node 18+ or a polyfill via cross-fetch).@graphql-tools/jest-transform in jest.config.ts:transform: { '\\.graphql$': '@graphql-tools/jest-transform' }
printExecutableGraphQLDocumentimport { printExecutableGraphQLDocument } from '@graphql-tools/documents';
function printExecutableGraphQLDocument(ast: DocumentNode): string;
Prints a DocumentNode as a canonical, deterministic GraphQL SDL string. Use this when you need a stable hash key for persisted queries or want to strip client-only directives before sending to a server.
sortExecutableDocumentimport { sortExecutableDocument } from '@graphql-tools/documents';
function sortExecutableDocument(document: DocumentNode): DocumentNode;
Returns a new DocumentNode with all definitions and fields sorted alphabetically. Use it before hashing a document to ensure two semantically identical queries always produce the same hash regardless of field ordering.
ExecutorLinkimport { ExecutorLink } from '@graphql-tools/executor-apollo-link';
// (source: executors/apollo-link/src/index.ts)
class ExecutorLink extends ApolloLink {
constructor(executor: Executor): ExecutorLink;
}
Wraps any Executor (including remote HTTP executors or mock executors) as an Apollo Client link. Drop it into an Apollo link chain wherever you would normally use HttpLink. Supports subscriptions via async iterables automatically.
useExecutorimport { useExecutor } from '@graphql-tools/executor-envelop';
// (source: executors/envelop/src/index.ts)
function useExecutor<TPluginContext extends Record<string, any>>(
executor: Executor,
opts?: ExecutorPluginOpts,
): Plugin<TPluginContext> & ExecutorPluginExtras;
Creates an Envelop plugin that proxies all GraphQL execution to a remote Executor, automatically fetching and caching the remote schema via introspection. Pass opts.polling (milliseconds) to periodically refresh the schema.
Produce a stable string key for a GraphQL document to use as a persisted query identifier, regardless of how the client wrote the query.
import { parse } from 'graphql';
import { sortExecutableDocument } from '@graphql-tools/documents';
import { printExecutableGraphQLDocument } from '@graphql-tools/documents';
import { createHash } from 'crypto';
const rawDocument = parse(`
query GetUser {
user {
email
id
name
}
}
`);
const sorted = sortExecutableDocument(rawDocument);
const printed = printExecutableGraphQLDocument(sorted);
const hash = createHash('sha256').update(printed).digest('hex');
console.log('Persisted query key:', hash);
console.log('Canonical document:\n', printed);
Replace HttpLink with ExecutorLink so Apollo Client delegates to any Executor — useful for testing, schema stitching, or adding middleware.
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
import { ExecutorLink } from '@graphql-tools/executor-apollo-link';
import { buildHTTPExecutor } from '@graphql-tools/executor-http'; // from loaders/url
const executor = buildHTTPExecutor({
endpoint: 'https://api.example.com/graphql',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
});
const client = new ApolloClient({
link: new ExecutorLink(executor),
cache: new InMemoryCache(),
});
const result = await client.query({
query: gql`
query GetPosts {
posts {
id
title
}
}
`,
});
console.log(result.data);
Build an Envelop-powered GraphQL gateway that sources its schema from a remote executor and refreshes it every 60 seconds.
import { envelop, useSchema } from '@envelop/core';
import { useExecutor } from '@graphql-tools/executor-envelop';
import { buildHTTPExecutor } from '@graphql-tools/executor-http';
const remoteExecutor = buildHTTPExecutor({
endpoint: 'https://remote-api.example.com/graphql',
});
const getEnveloped = envelop({
plugins: [
useExecutor(remoteExecutor, {
polling: 60_000,
logWarn: (msg) => console.warn('[gateway]', msg),
}),
],
});
// In your HTTP handler (e.g. Node http, Express, Fastify):
async function handleRequest(req: any, res: any) {
const { execute, schema, contextFactory, parse, validate } = getEnveloped({ req });
const body = await req.json();
const document = parse(body.query);
const errors = validate(schema, document);
if (errors.length) {
res.json({ errors });
return;
}
const result = await execute({
schema,
document,
contextValue: await contextFactory(),
variableValues: body.variables,
});
res.json(result);
}
documents/src/index.ts - Re-exports printExecutableGraphQLDocument and sortExecutableDocument; the two public utilities for deterministic document handling.executor/src/index.ts - Barrel that re-exports everything from execution/, including execute, normalizedExecutor, and getVariableValues.executor/src/execution/execute.ts - Core executor implementation; a drop-in replacement for graphql-js execute with incremental delivery support.executor/src/execution/normalizedExecutor.ts - Wraps execute to always return a single result or async iterable, normalizing the return type.executor/src/execution/values.ts - Coerces and validates variable and argument values against a schema.executors/apollo-link/src/index.ts - Exports ExecutorLink; bridges Executor to Apollo Client's link chain.executors/envelop/src/index.ts - Exports useExecutor; Envelop plugin for remote schema proxying.executors/legacy-ws/src/index.ts - Executor for subscriptions-transport-ws (legacy WebSocket protocol).executors/urql-exchange/src/index.ts - urql exchange that delegates operations to an Executor.executors/yoga/src/index.ts - GraphQL Yoga-compatible executor adapter..js extension resolution fails in Node CJS mode - Set "moduleResolution": "node16" or "bundler" in tsconfig.json; the source uses explicit .js extensions in all imports.@apollo/client default export varies between CJS and ESM - The apollo-link adapter handles this with (apolloImport as any)?.default ?? apolloImport; do not double-wrap the import yourself.fetch not defined in Node < 18 - Install cross-fetch and call import 'cross-fetch/polyfill' before any loader or URL executor is used.useExecutor schema not ready on first request - The schema is fetched asynchronously on first use; call ensureSchema() from the returned ExecutorPluginExtras during server startup to pre-warm it.graphql - All packages in this monorepo require graphql@^16; mixing graphql@15 causes silent type incompatibilities in schema stitching.@envelop/core - Envelop publishes both formats; if you see duplicate symbol errors, pin all envelop packages to the same minor version and ensure a single graphql instance via npm dedupe.I have the graphql-tools monorepo source copied into `src/graphql-tools/` in my project.
I also have `USAGE.md` open which documents the real exports and working examples.
The upstream package is `graphql-tools` (graphql-tools monorepo).
Please help me integrate it into my project step by step:
1. Read `USAGE.md` to understand the available packages and their exports.
2. Check my existing `tsconfig.json` and update path aliases so imports from
`@graphql-tools/executor`, `@graphql-tools/documents`, and
`@graphql-tools/executor-apollo-link` resolve to `src/graphql-tools/`.
3. Wire up `ExecutorLink` from `src/graphql-tools/executors/apollo-link/src/index.ts`
into my Apollo Client configuration, replacing the existing `HttpLink`.
4. Add `sortExecutableDocument` and `printExecutableGraphQLDocument` from
`src/graphql-tools/documents/src/index.ts` to my persisted-query pipeline.
5. If I use Envelop, add the `useExecutor` plugin from
`src/graphql-tools/executors/envelop/src/index.ts` with a 60-second polling interval.
6. Show me the final diff for each changed file and flag any peer dependency
version issues to resolve before running the build.
The upstream project is MIT licensed. See source/LICENSE if present, or refer to the graphql-tools GitHub repository and the npm packages under the @graphql-tools scope. Original authors: Uri Goldshtein, The Guild, and contributors.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完整安装指南与集成提示词将在购买后解锁。
Automation, Utilities & Developer Tools
免费