Skip to content

Commit a7f5f0c

Browse files
authored
re-export from official entrypoints where possible (#12509)
1 parent e70a572 commit a7f5f0c

File tree

13 files changed

+643
-2487
lines changed

13 files changed

+643
-2487
lines changed

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

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import type { ApolloCache as ApolloCache_2 } from '@apollo/client/core';
88
import type { AsStoreObject } from '@apollo/client/utilities';
9+
import { canonicalStringify } from '@apollo/client/utilities';
910
import type { DeepPartial } from '@apollo/client/utilities';
1011
import type { DocumentNode } from 'graphql';
1112
import type { FieldNode } from 'graphql';
@@ -16,12 +17,13 @@ import type { FragmentType } from '@apollo/client/masking';
1617
import { getApolloCacheMemoryInternals } from '@apollo/client/utilities/internal';
1718
import { getInMemoryCacheMemoryInternals } from '@apollo/client/utilities/internal';
1819
import type { InlineFragmentNode } from 'graphql';
19-
import { isReference as isReference_2 } from '@apollo/client/utilities';
20+
import { isReference } from '@apollo/client/utilities';
21+
import { makeReference } from '@apollo/client/utilities';
2022
import type { MaybeMasked } from '@apollo/client/masking';
2123
import type { NoInfer as NoInfer_2 } from '@apollo/client/utilities';
2224
import { Observable } from 'rxjs';
2325
import type { OperationVariables } from '@apollo/client/core';
24-
import type { Reference as Reference_2 } from '@apollo/client/utilities';
26+
import { Reference } from '@apollo/client/utilities';
2527
import type { SelectionSetNode } from 'graphql';
2628
import type { StoreObject } from '@apollo/client/utilities';
2729
import type { StoreValue } from '@apollo/client/utilities';
@@ -52,7 +54,7 @@ export abstract class ApolloCache implements DataProxy {
5254
// @internal
5355
getMemoryInternals?: typeof getApolloCacheMemoryInternals;
5456
// (undocumented)
55-
identify(object: StoreObject | Reference_2): string | undefined;
57+
identify(object: StoreObject | Reference): string | undefined;
5658
// (undocumented)
5759
lookupFragment(fragmentName: string): FragmentDefinitionNode | null;
5860
// (undocumented)
@@ -84,11 +86,11 @@ export abstract class ApolloCache implements DataProxy {
8486
abstract watch<TData = unknown, TVariables = OperationVariables>(watch: Cache_2.WatchOptions<TData, TVariables>): () => void;
8587
watchFragment<TData = unknown, TVars = OperationVariables>(options: WatchFragmentOptions<TData, TVars>): Observable<WatchFragmentResult<TData>>;
8688
// (undocumented)
87-
abstract write<TData = unknown, TVariables = OperationVariables>(write: Cache_2.WriteOptions<TData, TVariables>): Reference_2 | undefined;
89+
abstract write<TData = unknown, TVariables = OperationVariables>(write: Cache_2.WriteOptions<TData, TVariables>): Reference | undefined;
8890
// (undocumented)
89-
writeFragment<TData = unknown, TVariables = OperationVariables>({ id, data, fragment, fragmentName, ...options }: Cache_2.WriteFragmentOptions<TData, TVariables>): Reference_2 | undefined;
91+
writeFragment<TData = unknown, TVariables = OperationVariables>({ id, data, fragment, fragmentName, ...options }: Cache_2.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
9092
// (undocumented)
91-
writeQuery<TData = unknown, TVariables = OperationVariables>({ id, data, ...options }: Cache_2.WriteQueryOptions<TData, TVariables>): Reference_2 | undefined;
93+
writeQuery<TData = unknown, TVariables = OperationVariables>({ id, data, ...options }: Cache_2.WriteQueryOptions<TData, TVariables>): Reference | undefined;
9294
}
9395

9496
// @public (undocumented)
@@ -209,10 +211,7 @@ export const cacheSlot: {
209211
withValue<TResult, TArgs extends any[], TThis = any>(value: ApolloCache_2, callback: (this: TThis, ...args: TArgs) => TResult, args?: TArgs | undefined, thisArg?: TThis | undefined): TResult;
210212
};
211213

212-
// @public
213-
export const canonicalStringify: ((value: any) => string) & {
214-
reset(): void;
215-
};
214+
export { canonicalStringify }
216215

217216
// @public (undocumented)
218217
type CanReadFunction = (value: StoreValue) => boolean;
@@ -281,8 +280,8 @@ export namespace DataProxy {
281280
export interface DataProxy {
282281
readFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.ReadFragmentOptions<TData, TVariables>, optimistic?: boolean): Unmasked<TData> | null;
283282
readQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.ReadQueryOptions<TData, TVariables>, optimistic?: boolean): Unmasked<TData> | null;
284-
writeFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteFragmentOptions<TData, TVariables>): Reference_2 | undefined;
285-
writeQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteQueryOptions<TData, TVariables>): Reference_2 | undefined;
283+
writeFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
284+
writeQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteQueryOptions<TData, TVariables>): Reference | undefined;
286285
}
287286

288287
// Warning: (ae-forgotten-export) The symbol "KeyFieldsContext" needs to be exported by the entry point index.d.ts
@@ -334,7 +333,7 @@ export abstract class EntityStore implements NormalizedCache {
334333
// Warning: (ae-forgotten-export) The symbol "SafeReadonly" needs to be exported by the entry point index.d.ts
335334
//
336335
// (undocumented)
337-
getFieldValue: <T = StoreValue>(objectOrReference: StoreObject | Reference_2 | undefined, storeFieldName: string) => SafeReadonly<T>;
336+
getFieldValue: <T = StoreValue>(objectOrReference: StoreObject | Reference | undefined, storeFieldName: string) => SafeReadonly<T>;
338337
// (undocumented)
339338
getRootIdSet(ids?: Set<string>): Set<string>;
340339
// Warning: (ae-forgotten-export) The symbol "StorageType" needs to be exported by the entry point index.d.ts
@@ -413,7 +412,7 @@ export interface FieldFunctionOptions<TArgs = Record<string, any>, TVars = Recor
413412
// (undocumented)
414413
fieldName: string;
415414
// (undocumented)
416-
isReference: typeof isReference_2;
415+
isReference: typeof isReference;
417416
// Warning: (ae-forgotten-export) The symbol "MergeObjectsFunction" needs to be exported by the entry point index.d.ts
418417
//
419418
// (undocumented)
@@ -523,7 +522,7 @@ export class InMemoryCache extends ApolloCache {
523522
// @internal
524523
getMemoryInternals?: typeof getInMemoryCacheMemoryInternals;
525524
// (undocumented)
526-
identify(object: StoreObject | Reference_2): string | undefined;
525+
identify(object: StoreObject | Reference): string | undefined;
527526
// (undocumented)
528527
lookupFragment(fragmentName: string): FragmentDefinitionNode | null;
529528
// (undocumented)
@@ -555,7 +554,7 @@ export class InMemoryCache extends ApolloCache {
555554
// (undocumented)
556555
watch<TData = unknown, TVariables = OperationVariables>(watch: Cache_2.WatchOptions<TData, TVariables>): () => void;
557556
// (undocumented)
558-
write<TData = unknown, TVariables = OperationVariables>(options: Cache_2.WriteOptions<TData, TVariables>): Reference_2 | undefined;
557+
write<TData = unknown, TVariables = OperationVariables>(options: Cache_2.WriteOptions<TData, TVariables>): Reference | undefined;
559558
}
560559

561560
// @public (undocumented)
@@ -581,8 +580,7 @@ interface InvalidateModifier {
581580
// @public (undocumented)
582581
const _invalidateModifier: unique symbol;
583582

584-
// @public (undocumented)
585-
export function isReference(obj: any): obj is Reference;
583+
export { isReference }
586584

587585
// @public (undocumented)
588586
type KeyArgsFunction = (args: Record<string, any> | null, context: {
@@ -631,8 +629,7 @@ class Layer extends EntityStore {
631629
toObject(): NormalizedCacheObject;
632630
}
633631

634-
// @public (undocumented)
635-
export function makeReference(id: string): Reference;
632+
export { makeReference }
636633

637634
// @public (undocumented)
638635
export function makeVar<T>(value: T): ReactiveVar<T>;
@@ -648,7 +645,7 @@ export interface MergeInfo {
648645
}
649646

650647
// @public (undocumented)
651-
type MergeObjectsFunction = <T extends StoreObject | Reference_2>(existing: T, incoming: T) => T;
648+
type MergeObjectsFunction = <T extends StoreObject | Reference>(existing: T, incoming: T) => T;
652649

653650
// @public (undocumented)
654651
export interface MergeTree {
@@ -692,7 +689,7 @@ export type ModifierDetails = {
692689
storeFieldName: string;
693690
readField: ReadFieldFunction;
694691
canRead: CanReadFunction;
695-
isReference: typeof isReference_2;
692+
isReference: typeof isReference;
696693
toReference: ToReferenceFunction;
697694
storage: StorageType;
698695
};
@@ -819,13 +816,13 @@ interface ReadFieldFunction {
819816
// (undocumented)
820817
<V = StoreValue>(options: ReadFieldOptions): SafeReadonly<V> | undefined;
821818
// (undocumented)
822-
<V = StoreValue>(fieldName: string, from?: StoreObject | Reference_2): SafeReadonly<V> | undefined;
819+
<V = StoreValue>(fieldName: string, from?: StoreObject | Reference): SafeReadonly<V> | undefined;
823820
}
824821

825822
// @public (undocumented)
826823
export interface ReadFieldOptions extends FieldSpecifier {
827824
// (undocumented)
828-
from?: StoreObject | Reference_2;
825+
from?: StoreObject | Reference;
829826
}
830827

831828
// @public (undocumented)
@@ -848,11 +845,7 @@ export type ReadQueryOptions = {
848845
config?: ApolloReducerConfig;
849846
};
850847

851-
// @public (undocumented)
852-
export interface Reference {
853-
// (undocumented)
854-
readonly __ref: string;
855-
}
848+
export { Reference }
856849

857850
// @public (undocumented)
858851
type SafeReadonly<T> = T extends object ? Readonly<T> : T;
@@ -865,7 +858,7 @@ export { StoreObject }
865858
// @public (undocumented)
866859
type StoreObjectValueMaybeReference<StoreVal> = StoreVal extends Array<Record<string, any>> ? StoreVal extends Array<infer Item> ? [
867860
Item
868-
] extends [Record<string, any>] ? ReadonlyArray<AsStoreObject<Item> | Reference_2> : never : never : StoreVal extends Record<string, any> ? AsStoreObject<StoreVal> | Reference_2 : StoreVal;
861+
] extends [Record<string, any>] ? ReadonlyArray<AsStoreObject<Item> | Reference> : never : never : StoreVal extends Record<string, any> ? AsStoreObject<StoreVal> | Reference : StoreVal;
869862

870863
export { StoreValue }
871864

@@ -879,7 +872,7 @@ class Stump extends Layer {
879872
}
880873

881874
// @public (undocumented)
882-
type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference_2, mergeIntoStore?: boolean) => Reference_2 | undefined;
875+
type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined;
883876

884877
// @public (undocumented)
885878
export type Transaction = (c: ApolloCache) => void;
@@ -905,7 +898,7 @@ export type TypePolicy = {
905898
export interface WatchFragmentOptions<TData, TVars> {
906899
fragment: DocumentNode | TypedDocumentNode_2<TData, TVars>;
907900
fragmentName?: string;
908-
from: StoreObject | Reference_2 | FragmentType<NoInfer_2<TData>> | string;
901+
from: StoreObject | Reference | FragmentType<NoInfer_2<TData>> | string;
909902
optimistic?: boolean;
910903
variables?: TVars;
911904
}

0 commit comments

Comments
 (0)