Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1be5134
Update docs for HttpLink types
jerelmiller Jul 31, 2025
ef010e5
Update more httplink docs
jerelmiller Jul 31, 2025
9bb27dd
Remove outdated info
jerelmiller Jul 31, 2025
1ce39c0
Add constructor signature and include information about client awareness
jerelmiller Jul 31, 2025
bcbba2d
Update title of doc
jerelmiller Jul 31, 2025
3451f7e
Add client awareness link doc
jerelmiller Jul 31, 2025
fc6ac0c
Tweak HttpLink description
jerelmiller Jul 31, 2025
e5f7a50
Alphabetize links in sidebar
jerelmiller Jul 31, 2025
192bf67
Use interface for batchHttpLink options. Add doc blocks
jerelmiller Jul 31, 2025
87bd494
Use interface instead of type alias
jerelmiller Jul 31, 2025
48f5530
Revert back to type
jerelmiller Jul 31, 2025
b358499
Update doc blocks for batchHttpLink
jerelmiller Jul 31, 2025
8247139
Update batch http link docs
jerelmiller Jul 31, 2025
a81fcd9
Add constrcturo signature
jerelmiller Jul 31, 2025
28f1643
Nest configuring client awareness
jerelmiller Jul 31, 2025
497fbbf
Update error link api doc
jerelmiller Jul 31, 2025
6e10856
Update title
jerelmiller Jul 31, 2025
b62778a
Add import for ClientAwarenessLink
jerelmiller Jul 31, 2025
1f639c4
Add doc block for GraphQLWsLink
jerelmiller Jul 31, 2025
90bd074
Tweak copy
jerelmiller Jul 31, 2025
8107854
Update api report
jerelmiller Jul 31, 2025
b2e925e
reorder `ApolloLink` static properties
phryneas Aug 1, 2025
4ee31a5
restructure shared options between `HttpLink`, `BatchLink` and `Batch…
phryneas Aug 1, 2025
63047d6
update type of `HttpLink.Options.fetchOptions` to `RequestInit`
phryneas Aug 1, 2025
2e72e4c
fix typo
phryneas Aug 1, 2025
f8124b3
type fixes
phryneas Aug 1, 2025
abc0d3a
fix typo
phryneas Aug 1, 2025
83ac42b
Remove handling errors section
jerelmiller Aug 4, 2025
cd4467a
Update subscription links in sidebar
jerelmiller Aug 4, 2025
62cc518
Remove rest link from documentation
jerelmiller Aug 4, 2025
22c5735
Simplify customizing fetch section
jerelmiller Aug 4, 2025
7425520
Remove response from context in batch http link
jerelmiller Aug 4, 2025
10aa590
Add section on operation results
jerelmiller Aug 4, 2025
b849b8e
Tweak description for client awareness link
jerelmiller Aug 4, 2025
adb56bb
Add constructor signature to apollo link
jerelmiller Aug 4, 2025
5c1331c
Remove enhancedClientAwareness from request context
jerelmiller Aug 4, 2025
e35cbcb
Fix link
jerelmiller Aug 4, 2025
9faf57a
Use period
jerelmiller Aug 4, 2025
603e9b4
Remove italics
jerelmiller Aug 4, 2025
d844e1c
Remove additional sentence
jerelmiller Aug 4, 2025
ee56a82
Add qualifier
jerelmiller Aug 4, 2025
ad78ad0
Formatting
jerelmiller Aug 4, 2025
9358ac9
Add more detail
jerelmiller Aug 4, 2025
9adaf03
Tweak note
jerelmiller Aug 4, 2025
27ddb99
Change options in ws link
jerelmiller Aug 4, 2025
2db5b3c
Update options section
jerelmiller Aug 4, 2025
7ead34e
Fix backtick
jerelmiller Aug 4, 2025
fd751c3
Chores
jerelmiller Aug 4, 2025
483aec5
Fix typo
jerelmiller Aug 4, 2025
285241b
AI suggestions
jerelmiller Aug 4, 2025
56d8bf3
Allow for variable replacement on escaped curlys
jerelmiller Aug 4, 2025
cd70f2c
Escape curlys
jerelmiller Aug 4, 2025
6e272c1
Tweak sentence
jerelmiller Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .api-reports/api-report-link_batch-http.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export class BaseBatchHttpLink extends ApolloLink {

// @public (undocumented)
export namespace BatchHttpLink {
// (undocumented)
export type ContextOptions = HttpLink.ContextOptions;
// (undocumented)
export type Options = Pick<BatchLink.Options, "batchMax" | "batchDebounce" | "batchInterval" | "batchKey"> & Omit<HttpLink.Options, "useGETForQueries">;
export interface ContextOptions extends HttpLink.ContextOptions {
}
export interface Options extends BatchLink.Shared.Options, HttpLink.Shared.Options {
batchMax?: number;
}
}

// @public
Expand Down
14 changes: 10 additions & 4 deletions .api-reports/api-report-link_batch.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ export namespace BatchLink {
// (undocumented)
export type BatchHandler = (operations: ApolloLink.Operation[], forward: ApolloLink.ForwardFunction[]) => Observable<ApolloLink.Result[]>;
// (undocumented)
export interface Options {
batchDebounce?: boolean;
export interface Options extends Shared.Options {
batchHandler?: BatchLink.BatchHandler;
batchInterval?: number;
batchKey?: (operation: ApolloLink.Operation) => string;
batchMax?: number;
}
// (undocumented)
export namespace Shared {
export interface Options {
batchDebounce?: boolean;
batchInterval?: number;
batchKey?: (operation: ApolloLink.Operation) => string;
batchMax?: number;
}
}
}

// @public (undocumented)
Expand Down
6 changes: 3 additions & 3 deletions .api-reports/api-report-link_client-awareness.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export namespace ClientAwarenessLink {
}
// (undocumented)
export interface Options {
clientAwareness?: ClientAwarenessOptions;
enhancedClientAwareness?: EnhancedClientAwarenessOptions;
clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
}
}

// @public (undocumented)
// @public
export class ClientAwarenessLink extends ApolloLink {
constructor(constructorOptions?: ClientAwarenessLink.Options);
}
Expand Down
7 changes: 5 additions & 2 deletions .api-reports/api-report-link_error.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ export namespace ErrorLink {
// (undocumented)
(options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
}
// (undocumented)
export interface ErrorHandlerOptions {
error: ErrorLike;
forward: ApolloLink.ForwardFunction;
operation: ApolloLink.Operation;
result?: ApolloLink.Result;
}
// (undocumented)
export namespace ErrorLinkDocumentationTypes {
export function ErrorHandler(options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
}
}

// @public (undocumented)
// @public
export class ErrorLink extends ApolloLink {
constructor(errorHandler: ErrorLink.ErrorHandler);
}
Expand Down
29 changes: 17 additions & 12 deletions .api-reports/api-report-link_http.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,33 +74,38 @@ export namespace HttpLink {
fetchOptions?: RequestInit;
headers?: Record<string, string>;
http?: HttpLink.HttpOptions;
uri?: string | UriFunction;
uri?: string | HttpLink.UriFunction;
}
export interface HttpOptions {
accept?: string[];
includeExtensions?: boolean;
includeQuery?: boolean;
preserveHeaderCase?: boolean;
}
export interface Options {
credentials?: RequestCredentials;
fetch?: typeof fetch;
fetchOptions?: RequestInit;
headers?: Record<string, string>;
includeExtensions?: boolean;
includeUnusedVariables?: boolean;
preserveHeaderCase?: boolean;
print?: Printer;
uri?: string | UriFunction;
export interface Options extends Shared.Options {
useGETForQueries?: boolean;
}
// (undocumented)
export type Printer = (node: ASTNode, originalPrint: typeof print_2) => string;
// (undocumented)
export namespace Shared {
export interface Options {
credentials?: RequestCredentials;
fetch?: typeof fetch;
fetchOptions?: RequestInit;
headers?: Record<string, string>;
includeExtensions?: boolean;
includeUnusedVariables?: boolean;
preserveHeaderCase?: boolean;
print?: HttpLink.Printer;
uri?: string | HttpLink.UriFunction;
}
}
// (undocumented)
export type UriFunction = (operation: ApolloLink.Operation) => string;
}

// @public (undocumented)
// @public
export class HttpLink extends ApolloLink {
constructor(options?: HttpLink.Options & ClientAwarenessLink.Options);
}
Expand Down
2 changes: 1 addition & 1 deletion .api-reports/api-report-link_subscriptions.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ApolloLink } from '@apollo/client/link';
import type { Client } from 'graphql-ws';
import { Observable } from 'rxjs';

// @public (undocumented)
// @public
export class GraphQLWsLink extends ApolloLink {
constructor(client: Client);
// (undocumented)
Expand Down
37 changes: 20 additions & 17 deletions .api-reports/api-report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,12 @@ namespace ClientAwarenessLink {
}
// (undocumented)
interface Options {
// Warning: (ae-forgotten-export) The symbol "ClientAwarenessLink" needs to be exported by the entry point index.d.ts
clientAwareness?: ClientAwarenessOptions;
// Warning: (ae-forgotten-export) The symbol "ClientAwarenessLink" needs to be exported by the entry point index.d.ts
enhancedClientAwareness?: EnhancedClientAwarenessOptions;
clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
}
}

// @public (undocumented)
// @public
class ClientAwarenessLink extends ApolloLink {
constructor(constructorOptions?: ClientAwarenessLink.Options);
}
Expand Down Expand Up @@ -1354,35 +1352,40 @@ export namespace HttpLink {
fetchOptions?: RequestInit;
headers?: Record<string, string>;
http?: HttpLink.HttpOptions;
uri?: string | UriFunction;
uri?: string | HttpLink.UriFunction;
}
export interface HttpOptions {
accept?: string[];
includeExtensions?: boolean;
includeQuery?: boolean;
preserveHeaderCase?: boolean;
}
export interface Options {
credentials?: RequestCredentials;
fetch?: typeof fetch;
fetchOptions?: RequestInit;
headers?: Record<string, string>;
includeExtensions?: boolean;
includeUnusedVariables?: boolean;
preserveHeaderCase?: boolean;
print?: Printer;
uri?: string | UriFunction;
export interface Options extends Shared.Options {
useGETForQueries?: boolean;
}
// Warning: (ae-forgotten-export) The symbol "print_2" needs to be exported by the entry point index.d.ts
//
// (undocumented)
export type Printer = (node: ASTNode, originalPrint: typeof print_2) => string;
// (undocumented)
export namespace Shared {
export interface Options {
credentials?: RequestCredentials;
fetch?: typeof fetch;
fetchOptions?: RequestInit;
headers?: Record<string, string>;
includeExtensions?: boolean;
includeUnusedVariables?: boolean;
preserveHeaderCase?: boolean;
print?: HttpLink.Printer;
uri?: string | HttpLink.UriFunction;
}
}
// (undocumented)
export type UriFunction = (operation: ApolloLink.Operation) => string;
}

// @public (undocumented)
// @public
export class HttpLink extends ApolloLink {
constructor(options?: HttpLink.Options & ClientAwarenessLink.Options);
}
Expand Down
5 changes: 5 additions & 0 deletions .changeset/plenty-flies-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

update type of `HttpLink.Options.fetchOptions` to `RequestInit`
1 change: 1 addition & 0 deletions config/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export function patchApiExtractorInternals() {
for (const excerpt of item.excerptTokens) {
const stringified = excerpt.canonicalReference?.toString();
if (stringified?.startsWith("@apollo/client!entrypoint_")) {
// @ts-ignore
excerpt["_canonicalReference"] = DeclarationReference.parse(
stringified.replace(
/(@apollo\/client!entrypoint_[^.]+)[.:]/,
Expand Down
4 changes: 2 additions & 2 deletions config/inlineInheritDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
} from "@microsoft/api-extractor";
import { ApiDocumentedItem, ApiModel } from "@microsoft/api-extractor-model";
import type { DocComment, DocExcerpt, DocNode } from "@microsoft/tsdoc";
import { TextRange } from "@microsoft/tsdoc";
import type { TextRange } from "@microsoft/tsdoc";
import { DeclarationReference } from "@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference.js";
import { visit } from "recast";

Expand Down Expand Up @@ -77,7 +77,7 @@ function getCommentFor(
const unusedVariables = new Set(Object.keys(variables || {}));
let string = renderDocComment(apiItem.tsdocComment);

string = string.replaceAll(/\{\{(\w+)\}\}/g, (_, variable) => {
string = string.replaceAll(/\\?\{\\?\{(\w+)\\?\}\\?\}/g, (_, variable) => {

@jerelmiller jerelmiller Aug 4, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the warning in https://github.com/apollographql/apollo-client/actions/runs/16732740917/job/47364457350 by allowing us to escape the curlys when we see this warning. Now the following will also be replaced:

\{\{defaultValue\}\}

unusedVariables.delete(variable);
const value = variables?.[variable];
if (value === undefined) {
Expand Down
18 changes: 9 additions & 9 deletions docs/source/_sidebar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,27 +189,27 @@ items:
href: ./api/link/introduction
- label: ApolloLink
href: ./api/link/apollo-link
- label: HttpLink
href: ./api/link/apollo-link-http
- label: BatchHttpLink
href: ./api/link/apollo-link-batch-http
- label: SetContextLink
href: ./api/link/apollo-link-context
- label: ClientAwarenessLink
href: ./api/link/apollo-link-client-awareness
- label: ErrorLink
href: ./api/link/apollo-link-error
- label: GraphQLWsLink
href: ./api/link/apollo-link-subscriptions
- label: HttpLink
href: ./api/link/apollo-link-http
- label: PersistedQueryLink
href: ./api/link/persisted-queries
- label: RemoveTypenameFromVariablesLink
href: ./api/link/apollo-link-remove-typename
- label: RestLink
href: ./api/link/apollo-link-rest
- label: RetryLink
href: ./api/link/apollo-link-retry
- label: SchemaLink
href: ./api/link/apollo-link-schema
- label: GraphQLWsLink (newer protocol)
href: ./api/link/apollo-link-subscriptions
- label: WebSocketLink (older protocol)
- label: SetContextLink
href: ./api/link/apollo-link-context
- label: WebSocketLink (deprecated)
href: ./api/link/apollo-link-ws
- label: Community links
href: ./api/link/community-links
Loading