Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(core): Add in-code support notices

+44
+44
packages/core/src/internal/fetchSource.ts
··· 1 + /* Summary: This file handles the HTTP transport via GraphQL over HTTP 2 + * See: https://graphql.github.io/graphql-over-http/draft/ 3 + * 4 + * `@urql/core`, by default, implements several RFC'd protocol extensions 5 + * on top of this. As such, this implementation supports: 6 + * - [Incremental Delivery](https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md) 7 + * - [GraphQL over SSE](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverSSE.md) 8 + * 9 + * This also supports the "Defer Stream" payload format. 10 + * See: https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md 11 + * Implementation for this is located in `../utils/result.ts` in `mergeResultPatch` 12 + * 13 + * And; this also supports the GraphQL Multipart spec for file uploads. 14 + * See: https://github.com/jaydenseric/graphql-multipart-request-spec 15 + * Implementation for this is located in `../utils/variables.ts` in `extractFiles`, 16 + * and `./fetchOptions.ts` in `serializeBody`. 17 + * 18 + * And; this also supports GET requests (and hence; automatic persisted queries) 19 + * via the `@urql/exchange-persisted` package. 20 + * 21 + * This implementation DOES NOT support Batching. 22 + * See: https://github.com/graphql/graphql-over-http/blob/main/rfcs/Batching.md 23 + * Which is deemed out-of-scope, as it's sufficiently unnecessary given 24 + * modern handling of HTTP requests being in parallel. 25 + * 26 + * The implementation in this file needs to make certain accommodations for: 27 + * - The Web Fetch API 28 + * - Non-browser or polyfill Fetch APIs 29 + * - Node.js-like Fetch implementations (see `toString` below) 30 + * 31 + * GraphQL over SSE has a reference implementation, which supports non-HTTP/2 32 + * modes and is a faithful implementation of the spec. 33 + * See: https://github.com/enisdenjo/graphql-sse 34 + * 35 + * GraphQL Inremental Delivery (aka “GraphQL Multipart Responses”) has a 36 + * reference implementation, which a prior implementation of this file heavily 37 + * leaned on (See prior attribution comments) 38 + * See: https://github.com/maraisr/meros 39 + * 40 + * This file merges support for all three GraphQL over HTTP response formats 41 + * via async generators and Wonka’s `fromAsyncIterable`. As part of this, `streamBody` 42 + * and `split` are the common, cross-compatible base implementations. 43 + */ 44 + 1 45 import { Source, fromAsyncIterable, onEnd, filter, pipe } from 'wonka'; 2 46 import { Operation, OperationResult, ExecutionResult } from '../types'; 3 47 import { makeResult, makeErrorResult, mergeResultPatch } from '../utils';