Skip to content

Commit 7ff548d

Browse files
Update api reference docs for links: part 1 (#12819)
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
1 parent 0506f12 commit 7ff548d

24 files changed

Lines changed: 665 additions & 1650 deletions

.api-reports/api-report-link_batch-http.api.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ export class BaseBatchHttpLink extends ApolloLink {
1919

2020
// @public (undocumented)
2121
export namespace BatchHttpLink {
22-
// (undocumented)
23-
export type ContextOptions = HttpLink.ContextOptions;
24-
// (undocumented)
25-
export type Options = Pick<BatchLink.Options, "batchMax" | "batchDebounce" | "batchInterval" | "batchKey"> & Omit<HttpLink.Options, "useGETForQueries">;
22+
export interface ContextOptions extends HttpLink.ContextOptions {
23+
}
24+
export interface Options extends BatchLink.Shared.Options, HttpLink.Shared.Options {
25+
batchMax?: number;
26+
}
2627
}
2728

2829
// @public

.api-reports/api-report-link_batch.api.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ export namespace BatchLink {
1212
// (undocumented)
1313
export type BatchHandler = (operations: ApolloLink.Operation[], forward: ApolloLink.ForwardFunction[]) => Observable<ApolloLink.Result[]>;
1414
// (undocumented)
15-
export interface Options {
16-
batchDebounce?: boolean;
15+
export interface Options extends Shared.Options {
1716
batchHandler?: BatchLink.BatchHandler;
18-
batchInterval?: number;
19-
batchKey?: (operation: ApolloLink.Operation) => string;
2017
batchMax?: number;
2118
}
19+
// (undocumented)
20+
export namespace Shared {
21+
export interface Options {
22+
batchDebounce?: boolean;
23+
batchInterval?: number;
24+
batchKey?: (operation: ApolloLink.Operation) => string;
25+
batchMax?: number;
26+
}
27+
}
2228
}
2329

2430
// @public (undocumented)

.api-reports/api-report-link_client-awareness.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export namespace ClientAwarenessLink {
2020
}
2121
// (undocumented)
2222
export interface Options {
23-
clientAwareness?: ClientAwarenessOptions;
24-
enhancedClientAwareness?: EnhancedClientAwarenessOptions;
23+
clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
24+
enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
2525
}
2626
}
2727

28-
// @public (undocumented)
28+
// @public
2929
export class ClientAwarenessLink extends ApolloLink {
3030
constructor(constructorOptions?: ClientAwarenessLink.Options);
3131
}

.api-reports/api-report-link_error.api.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@ export namespace ErrorLink {
1414
// (undocumented)
1515
(options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
1616
}
17-
// (undocumented)
1817
export interface ErrorHandlerOptions {
1918
error: ErrorLike;
2019
forward: ApolloLink.ForwardFunction;
2120
operation: ApolloLink.Operation;
2221
result?: ApolloLink.Result;
2322
}
23+
// (undocumented)
24+
export namespace ErrorLinkDocumentationTypes {
25+
export function ErrorHandler(options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;
26+
}
2427
}
2528

26-
// @public (undocumented)
29+
// @public
2730
export class ErrorLink extends ApolloLink {
2831
constructor(errorHandler: ErrorLink.ErrorHandler);
2932
}

.api-reports/api-report-link_http.api.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,38 @@ export namespace HttpLink {
7474
fetchOptions?: RequestInit;
7575
headers?: Record<string, string>;
7676
http?: HttpLink.HttpOptions;
77-
uri?: string | UriFunction;
77+
uri?: string | HttpLink.UriFunction;
7878
}
7979
export interface HttpOptions {
8080
accept?: string[];
8181
includeExtensions?: boolean;
8282
includeQuery?: boolean;
8383
preserveHeaderCase?: boolean;
8484
}
85-
export interface Options {
86-
credentials?: RequestCredentials;
87-
fetch?: typeof fetch;
88-
fetchOptions?: RequestInit;
89-
headers?: Record<string, string>;
90-
includeExtensions?: boolean;
91-
includeUnusedVariables?: boolean;
92-
preserveHeaderCase?: boolean;
93-
print?: Printer;
94-
uri?: string | UriFunction;
85+
export interface Options extends Shared.Options {
9586
useGETForQueries?: boolean;
9687
}
9788
// (undocumented)
9889
export type Printer = (node: ASTNode, originalPrint: typeof print_2) => string;
9990
// (undocumented)
91+
export namespace Shared {
92+
export interface Options {
93+
credentials?: RequestCredentials;
94+
fetch?: typeof fetch;
95+
fetchOptions?: RequestInit;
96+
headers?: Record<string, string>;
97+
includeExtensions?: boolean;
98+
includeUnusedVariables?: boolean;
99+
preserveHeaderCase?: boolean;
100+
print?: HttpLink.Printer;
101+
uri?: string | HttpLink.UriFunction;
102+
}
103+
}
104+
// (undocumented)
100105
export type UriFunction = (operation: ApolloLink.Operation) => string;
101106
}
102107

103-
// @public (undocumented)
108+
// @public
104109
export class HttpLink extends ApolloLink {
105110
constructor(options?: HttpLink.Options & ClientAwarenessLink.Options);
106111
}

.api-reports/api-report-link_subscriptions.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ApolloLink } from '@apollo/client/link';
88
import type { Client } from 'graphql-ws';
99
import { Observable } from 'rxjs';
1010

11-
// @public (undocumented)
11+
// @public
1212
export class GraphQLWsLink extends ApolloLink {
1313
constructor(client: Client);
1414
// (undocumented)

.api-reports/api-report.api.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -667,14 +667,12 @@ namespace ClientAwarenessLink {
667667
}
668668
// (undocumented)
669669
interface Options {
670-
// Warning: (ae-forgotten-export) The symbol "ClientAwarenessLink" needs to be exported by the entry point index.d.ts
671-
clientAwareness?: ClientAwarenessOptions;
672-
// Warning: (ae-forgotten-export) The symbol "ClientAwarenessLink" needs to be exported by the entry point index.d.ts
673-
enhancedClientAwareness?: EnhancedClientAwarenessOptions;
670+
clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
671+
enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;
674672
}
675673
}
676674

677-
// @public (undocumented)
675+
// @public
678676
class ClientAwarenessLink extends ApolloLink {
679677
constructor(constructorOptions?: ClientAwarenessLink.Options);
680678
}
@@ -1354,35 +1352,40 @@ export namespace HttpLink {
13541352
fetchOptions?: RequestInit;
13551353
headers?: Record<string, string>;
13561354
http?: HttpLink.HttpOptions;
1357-
uri?: string | UriFunction;
1355+
uri?: string | HttpLink.UriFunction;
13581356
}
13591357
export interface HttpOptions {
13601358
accept?: string[];
13611359
includeExtensions?: boolean;
13621360
includeQuery?: boolean;
13631361
preserveHeaderCase?: boolean;
13641362
}
1365-
export interface Options {
1366-
credentials?: RequestCredentials;
1367-
fetch?: typeof fetch;
1368-
fetchOptions?: RequestInit;
1369-
headers?: Record<string, string>;
1370-
includeExtensions?: boolean;
1371-
includeUnusedVariables?: boolean;
1372-
preserveHeaderCase?: boolean;
1373-
print?: Printer;
1374-
uri?: string | UriFunction;
1363+
export interface Options extends Shared.Options {
13751364
useGETForQueries?: boolean;
13761365
}
13771366
// Warning: (ae-forgotten-export) The symbol "print_2" needs to be exported by the entry point index.d.ts
13781367
//
13791368
// (undocumented)
13801369
export type Printer = (node: ASTNode, originalPrint: typeof print_2) => string;
13811370
// (undocumented)
1371+
export namespace Shared {
1372+
export interface Options {
1373+
credentials?: RequestCredentials;
1374+
fetch?: typeof fetch;
1375+
fetchOptions?: RequestInit;
1376+
headers?: Record<string, string>;
1377+
includeExtensions?: boolean;
1378+
includeUnusedVariables?: boolean;
1379+
preserveHeaderCase?: boolean;
1380+
print?: HttpLink.Printer;
1381+
uri?: string | HttpLink.UriFunction;
1382+
}
1383+
}
1384+
// (undocumented)
13821385
export type UriFunction = (operation: ApolloLink.Operation) => string;
13831386
}
13841387

1385-
// @public (undocumented)
1388+
// @public
13861389
export class HttpLink extends ApolloLink {
13871390
constructor(options?: HttpLink.Options & ClientAwarenessLink.Options);
13881391
}

.changeset/plenty-flies-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@apollo/client": patch
3+
---
4+
5+
update type of `HttpLink.Options.fetchOptions` to `RequestInit`

config/helpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export function patchApiExtractorInternals() {
248248
for (const excerpt of item.excerptTokens) {
249249
const stringified = excerpt.canonicalReference?.toString();
250250
if (stringified?.startsWith("@apollo/client!entrypoint_")) {
251+
// @ts-ignore
251252
excerpt["_canonicalReference"] = DeclarationReference.parse(
252253
stringified.replace(
253254
/(@apollo\/client!entrypoint_[^.]+)[.:]/,

config/inlineInheritDoc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
} from "@microsoft/api-extractor";
3838
import { ApiDocumentedItem, ApiModel } from "@microsoft/api-extractor-model";
3939
import type { DocComment, DocExcerpt, DocNode } from "@microsoft/tsdoc";
40-
import { TextRange } from "@microsoft/tsdoc";
40+
import type { TextRange } from "@microsoft/tsdoc";
4141
import { DeclarationReference } from "@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference.js";
4242
import { visit } from "recast";
4343

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

80-
string = string.replaceAll(/\{\{(\w+)\}\}/g, (_, variable) => {
80+
string = string.replaceAll(/\\?\{\\?\{(\w+)\\?\}\\?\}/g, (_, variable) => {
8181
unusedVariables.delete(variable);
8282
const value = variables?.[variable];
8383
if (value === undefined) {

0 commit comments

Comments
 (0)