Skip to content

Commit 6aa6fd3

Browse files
authored
Switch to RxJS (#12384)
1 parent 9ec9584 commit 6aa6fd3

143 files changed

Lines changed: 2328 additions & 3468 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { DocumentNode } from 'graphql';
88
import type { FieldNode } from 'graphql';
99
import type { FragmentDefinitionNode } from 'graphql';
1010
import type { InlineFragmentNode } from 'graphql';
11-
import { Observable } from 'zen-observable-ts';
11+
import { Observable } from 'rxjs';
1212
import type { SelectionSetNode } from 'graphql';
1313
import { Trie } from '@wry/trie';
1414
import { TypedDocumentNode } from '@graphql-typed-document-node/core';

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

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ import { gql } from 'graphql-tag';
1616
import type { GraphQLErrorExtensions } from 'graphql';
1717
import type { GraphQLFormattedError } from 'graphql';
1818
import type { InlineFragmentNode } from 'graphql';
19-
import { Observable } from 'zen-observable-ts';
20-
import type { Subscription as ObservableSubscription } from 'zen-observable-ts';
21-
import type { Observer } from 'zen-observable-ts';
19+
import { Observable } from 'rxjs';
20+
import type { Observer } from 'rxjs';
2221
import { resetCaches } from 'graphql-tag';
2322
import type { SelectionSetNode } from 'graphql';
24-
import type { Subscriber } from 'zen-observable-ts';
23+
import type { Subscribable } from 'rxjs';
24+
import type { Subscriber } from 'rxjs';
25+
import type { Subscription } from 'rxjs';
2526
import { Trie } from '@wry/trie';
2627
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
2728

@@ -234,7 +235,7 @@ export class ApolloLink {
234235
// @internal
235236
readonly left?: ApolloLink;
236237
// (undocumented)
237-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
238+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
238239
// (undocumented)
239240
request(operation: Operation, forward?: NextLink): Observable<FetchResult> | null;
240241
// @internal
@@ -444,30 +445,6 @@ type CombineIntersection<T> = Exclude<T, {
444445
__typename?: string;
445446
}>>;
446447

447-
// @public (undocumented)
448-
class Concast<T> extends Observable<T> {
449-
// Warning: (ae-forgotten-export) The symbol "MaybeAsync" needs to be exported by the entry point index.d.ts
450-
// Warning: (ae-forgotten-export) The symbol "ConcastSourcesIterable" needs to be exported by the entry point index.d.ts
451-
constructor(sources: MaybeAsync<ConcastSourcesIterable<T>> | Subscriber<T>);
452-
// (undocumented)
453-
addObserver(observer: Observer<T>): void;
454-
// Warning: (ae-forgotten-export) The symbol "NextResultListener" needs to be exported by the entry point index.d.ts
455-
//
456-
// (undocumented)
457-
beforeNext(callback: NextResultListener): void;
458-
// (undocumented)
459-
cancel: (reason: any) => void;
460-
// (undocumented)
461-
readonly promise: Promise<T | undefined>;
462-
// (undocumented)
463-
removeObserver(observer: Observer<T>): void;
464-
}
465-
466-
// Warning: (ae-forgotten-export) The symbol "Source" needs to be exported by the entry point index.d.ts
467-
//
468-
// @public (undocumented)
469-
type ConcastSourcesIterable<T> = Iterable<Source<T>>;
470-
471448
// @public (undocumented)
472449
export const concat: typeof ApolloLink.concat;
473450

@@ -976,12 +953,6 @@ TData
976953
// @public (undocumented)
977954
export const from: typeof ApolloLink.from;
978955

979-
// @public (undocumented)
980-
export function fromError<T>(errorValue: any): Observable<T>;
981-
982-
// @public (undocumented)
983-
export function fromPromise<T>(promise: Promise<T>): Observable<T>;
984-
985956
// @internal
986957
const getApolloCacheMemoryInternals: (() => {
987958
cache: {
@@ -1409,9 +1380,6 @@ interface MaskOperationOptions<TData> {
14091380
id: string;
14101381
}
14111382

1412-
// @public (undocumented)
1413-
type MaybeAsync<T> = T | PromiseLike<T>;
1414-
14151383
// Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts
14161384
//
14171385
// @public
@@ -1628,9 +1596,6 @@ interface NextFetchPolicyContext<TData, TVariables extends OperationVariables> {
16281596
// @public (undocumented)
16291597
export type NextLink = (operation: Operation) => Observable<FetchResult>;
16301598

1631-
// @public (undocumented)
1632-
type NextResultListener = (method: "next" | "error" | "complete", arg?: any) => any;
1633-
16341599
// @public
16351600
type NoInfer_2<T> = [T][T extends any ? 0 : never];
16361601

@@ -1680,7 +1645,7 @@ export interface NormalizedCacheObject {
16801645
export { Observable }
16811646

16821647
// @public (undocumented)
1683-
export class ObservableQuery<TData = any, TVariables extends OperationVariables = OperationVariables> extends Observable<ApolloQueryResult<MaybeMasked<TData>>> {
1648+
export class ObservableQuery<TData = any, TVariables extends OperationVariables = OperationVariables> implements Subscribable<ApolloQueryResult<MaybeMasked<TData>>> {
16841649
constructor({ queryManager, queryInfo, options, }: {
16851650
queryManager: QueryManager<any>;
16861651
queryInfo: QueryInfo;
@@ -1705,6 +1670,8 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
17051670
// (undocumented)
17061671
readonly options: WatchQueryOptions<TVariables, TData>;
17071672
// (undocumented)
1673+
pipe: Observable<ApolloQueryResult<MaybeMasked<TData>>>["pipe"];
1674+
// (undocumented)
17081675
get query(): TypedDocumentNode<TData, TVariables>;
17091676
// (undocumented)
17101677
readonly queryId: string;
@@ -1713,19 +1680,11 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
17131680
refetch(variables?: Partial<TVariables>): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
17141681
// (undocumented)
17151682
reobserve(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
1716-
// Warning: (ae-forgotten-export) The symbol "Concast" needs to be exported by the entry point index.d.ts
1717-
//
1718-
// (undocumented)
1719-
reobserveAsConcast(newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus): Concast<ApolloQueryResult<TData>>;
17201683
// @internal (undocumented)
17211684
resetDiff(): void;
17221685
// (undocumented)
17231686
resetLastResults(): void;
17241687
// (undocumented)
1725-
resubscribeAfterError(onNext: (value: ApolloQueryResult<MaybeMasked<TData>>) => void, onError?: (error: any) => void, onComplete?: () => void): ObservableSubscription;
1726-
// (undocumented)
1727-
resubscribeAfterError(observer: Observer<ApolloQueryResult<TData>>): ObservableSubscription;
1728-
// (undocumented)
17291688
result(): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
17301689
// (undocumented)
17311690
setOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): Promise<ApolloQueryResult<MaybeMasked<TData>>>;
@@ -1734,15 +1693,13 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
17341693
silentSetOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): void;
17351694
startPolling(pollInterval: number): void;
17361695
stopPolling(): void;
1696+
// (undocumented)
1697+
subscribe: (observer: Partial<Observer<ApolloQueryResult<MaybeMasked<TData>>>> | ((value: ApolloQueryResult<MaybeMasked<TData>>) => void)) => Subscription;
17371698
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVariables>): () => void;
17381699
updateQuery(mapFn: UpdateQueryMapFn<TData, TVariables>): void;
17391700
get variables(): TVariables | undefined;
17401701
}
17411702

1742-
export { ObservableSubscription }
1743-
1744-
export { Observer }
1745-
17461703
// @public (undocumented)
17471704
export type OnQueryUpdated<TResult> = (observableQuery: ObservableQuery<any>, diff: Cache_2.DiffResult<any>, lastDiff: Cache_2.DiffResult<any> | undefined) => boolean | TResult;
17481705

@@ -2272,9 +2229,6 @@ export interface SingleExecutionResult<TData = Record<string, any>, TContext = D
22722229
extensions?: TExtensions;
22732230
}
22742231

2275-
// @public (undocumented)
2276-
type Source<T> = MaybeAsync<Observable<T>>;
2277-
22782232
// @public (undocumented)
22792233
export const split: typeof ApolloLink.split;
22802234

@@ -2356,9 +2310,6 @@ type takeOneFromUnion<T> = unionToIntersection<T extends T ? (x: T) => 0 : never
23562310
// @public (undocumented)
23572311
export const throwServerError: (response: Response, result: any, message: string) => never;
23582312

2359-
// @public (undocumented)
2360-
export function toPromise<R>(observable: Observable<R>): Promise<R>;
2361-
23622313
// @public (undocumented)
23632314
type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined;
23642315

@@ -2534,10 +2485,10 @@ interface WriteContext extends ReadMergeModifyContext {
25342485
// src/cache/inmemory/policies.ts:166:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
25352486
// src/cache/inmemory/policies.ts:166:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
25362487
// src/cache/inmemory/types.ts:140:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
2537-
// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
2538-
// src/core/ObservableQuery.ts:122:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
2539-
// src/core/QueryManager.ts:161:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
2540-
// src/core/QueryManager.ts:416:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
2488+
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
2489+
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
2490+
// src/core/QueryManager.ts:172:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
2491+
// src/core/QueryManager.ts:430:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
25412492
// src/link/http/selectHttpOptionsAndBody.ts:128:1 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts
25422493

25432494
// (No @packageDocumentation comment for this package)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import type { ASTNode } from 'graphql';
88
import type { DocumentNode } from 'graphql';
99
import type { GraphQLFormattedError } from 'graphql';
10-
import { Observable } from 'zen-observable-ts';
11-
import type { Observer } from 'zen-observable-ts';
10+
import { Observable } from 'rxjs';
11+
import type { Subscriber } from 'rxjs';
1212

1313
// @public (undocumented)
1414
class ApolloLink {
@@ -33,7 +33,7 @@ class ApolloLink {
3333
// @internal
3434
readonly left?: ApolloLink;
3535
// (undocumented)
36-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
36+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3737
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3838
//
3939
// (undocumented)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import type { DocumentNode } from 'graphql';
88
import type { GraphQLFormattedError } from 'graphql';
9-
import { Observable } from 'zen-observable-ts';
10-
import type { Observer } from 'zen-observable-ts';
9+
import { Observable } from 'rxjs';
10+
import type { Subscriber } from 'rxjs';
1111

1212
// @public (undocumented)
1313
class ApolloLink {
@@ -32,7 +32,7 @@ class ApolloLink {
3232
// @internal
3333
readonly left?: ApolloLink;
3434
// (undocumented)
35-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
35+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3636
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3737
//
3838
// (undocumented)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import type { DocumentNode } from 'graphql';
88
import type { GraphQLFormattedError } from 'graphql';
9-
import { Observable } from 'zen-observable-ts';
10-
import type { Observer } from 'zen-observable-ts';
9+
import type { Observable } from 'rxjs';
10+
import type { Subscriber } from 'rxjs';
1111

1212
// @public (undocumented)
1313
class ApolloLink {
@@ -32,7 +32,7 @@ class ApolloLink {
3232
// @internal
3333
readonly left?: ApolloLink;
3434
// (undocumented)
35-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
35+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3636
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3737
//
3838
// (undocumented)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import type { DocumentNode } from 'graphql';
88
import type { GraphQLFormattedError } from 'graphql';
9-
import { Observable } from 'zen-observable-ts';
10-
import type { Observer } from 'zen-observable-ts';
9+
import type { Observable } from 'rxjs';
10+
import type { Subscriber } from 'rxjs';
1111

1212
// @public (undocumented)
1313
export class ApolloLink {
@@ -27,7 +27,7 @@ export class ApolloLink {
2727
// @internal
2828
readonly left?: ApolloLink;
2929
// (undocumented)
30-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
30+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3131
// (undocumented)
3232
request(operation: Operation, forward?: NextLink): Observable<FetchResult> | null;
3333
// @internal

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import type { DocumentNode } from 'graphql';
88
import type { FormattedExecutionResult } from 'graphql';
99
import type { GraphQLFormattedError } from 'graphql';
10-
import { Observable } from 'zen-observable-ts';
11-
import type { Observer } from 'zen-observable-ts';
10+
import { Observable } from 'rxjs';
11+
import type { Subscriber } from 'rxjs';
1212

1313
// @public (undocumented)
1414
class ApolloLink {
@@ -33,7 +33,7 @@ class ApolloLink {
3333
// @internal
3434
readonly left?: ApolloLink;
3535
// (undocumented)
36-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
36+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3737
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3838
//
3939
// (undocumented)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import type { ASTNode } from 'graphql';
88
import type { DocumentNode } from 'graphql';
99
import type { GraphQLFormattedError } from 'graphql';
10-
import { Observable } from 'zen-observable-ts';
11-
import type { Observer } from 'zen-observable-ts';
10+
import type { Observable } from 'rxjs';
11+
import type { Subscriber } from 'rxjs';
1212

1313
// @public (undocumented)
1414
class ApolloLink {
@@ -33,7 +33,7 @@ class ApolloLink {
3333
// @internal
3434
readonly left?: ApolloLink;
3535
// (undocumented)
36-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
36+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3737
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3838
//
3939
// (undocumented)

.api-reports/api-report-link_persisted-queries.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import type { DocumentNode } from 'graphql';
88
import type { FormattedExecutionResult } from 'graphql';
99
import type { GraphQLFormattedError } from 'graphql';
10-
import { Observable } from 'zen-observable-ts';
11-
import type { Observer } from 'zen-observable-ts';
10+
import type { Observable } from 'rxjs';
11+
import type { Subscriber } from 'rxjs';
1212

1313
// @public (undocumented)
1414
class ApolloLink {
@@ -33,7 +33,7 @@ class ApolloLink {
3333
// @internal
3434
readonly left?: ApolloLink;
3535
// (undocumented)
36-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
36+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3737
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3838
//
3939
// (undocumented)

.api-reports/api-report-link_remove-typename.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import type { DocumentNode } from 'graphql';
88
import type { GraphQLFormattedError } from 'graphql';
9-
import { Observable } from 'zen-observable-ts';
10-
import type { Observer } from 'zen-observable-ts';
9+
import type { Observable } from 'rxjs';
10+
import type { Subscriber } from 'rxjs';
1111

1212
// @public (undocumented)
1313
class ApolloLink {
@@ -32,7 +32,7 @@ class ApolloLink {
3232
// @internal
3333
readonly left?: ApolloLink;
3434
// (undocumented)
35-
protected onError(error: any, observer?: Observer<FetchResult>): false | void;
35+
protected onError(error: any, observer?: Subscriber<FetchResult>): false | void;
3636
// Warning: (ae-forgotten-export) The symbol "NextLink" needs to be exported by the entry point index.d.ts
3737
//
3838
// (undocumented)

0 commit comments

Comments
 (0)