Back to Apollo Client

Api Report Utilities Internal.Api

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

3.14.119.4 KB
Original Source

API Report File for "@apollo/client"

Do not edit this file. It is a report generated by API Extractor.

ts

import type { ApolloCache } from '@apollo/client';
import type { ApolloClient } from '@apollo/client';
import type { ASTNode } from 'graphql';
import type { DataValue } from '@apollo/client';
import type { DirectiveNode } from 'graphql';
import type { DocumentNode } from 'graphql';
import type { ErrorLike } from '@apollo/client';
import type { FieldNode } from 'graphql';
import type { FormattedExecutionResult } from 'graphql';
import type { FragmentDefinitionNode } from 'graphql';
import type { GraphQLFormattedError } from 'graphql';
import type { HKT } from '@apollo/client/utilities';
import type { Incremental } from '@apollo/client/incremental';
import type { InlineFragmentNode } from 'graphql';
import type { MaybeMasked } from '@apollo/client';
import type { NetworkStatus } from '@apollo/client';
import { Observable } from 'rxjs';
import type { ObservableQuery } from '@apollo/client';
import type { Observer } from 'rxjs';
import type { OperationDefinitionNode } from 'graphql';
import type { OperationTypeNode } from 'graphql';
import type { OperationVariables } from '@apollo/client';
import type { OperatorFunction } from 'rxjs';
import type { Reference } from '@apollo/client/utilities';
import type { SelectionNode } from 'graphql';
import type { SelectionSetNode } from 'graphql';
import { StrongCache } from '@wry/caches';
import type { Subscription } from 'rxjs';
import type { Trie } from '@wry/trie';
import { WeakCache } from '@wry/caches';

// @internal @deprecated (undocumented)
export type ApplyHKT<fn extends HKT, arg1, arg2 = never, arg3 = never, arg4 = never> = (fn & {
    arg1: arg1;
    arg2: arg2;
    arg3: arg3;
    arg4: arg4;
})["return"];

// @internal @deprecated (undocumented)
export type ApplyHKTImplementationWithDefault<Implementation, Name extends string, DefaultImplementation extends Record<Name, HKT>, arg1, arg2 = never, arg3 = never, arg4 = never> = ApplyHKT<Implementation extends {
    [name in Name]: infer Implementation extends HKT;
} ? Implementation : DefaultImplementation[Name], arg1, arg2, arg3, arg4>;

// @internal @deprecated (undocumented)
export function argumentsObjectFromField(field: FieldNode | DirectiveNode, variables?: Record<string, any>): Object | null;

// @internal @deprecated
export const AutoCleanedStrongCache: typeof StrongCache;

// @internal @deprecated (undocumented)
export type AutoCleanedStrongCache<K, V> = StrongCache<K, V>;

// @internal @deprecated
export const AutoCleanedWeakCache: typeof WeakCache;

// @internal @deprecated (undocumented)
export type AutoCleanedWeakCache<K extends object, V> = WeakCache<K, V>;

// @public
export function bindCacheKey(...prebound: object[]): (...args: any) => object;

// @public
export const canonicalStringify: ((value: any) => string) & {
    reset(): void;
};

// @internal @deprecated (undocumented)
export const canUseDOM: boolean;

// @internal @deprecated
export const checkDocument: (doc: DocumentNode, expectedType?: OperationTypeNode) => void;

// @internal @deprecated
export function cloneDeep<T>(value: T): T;

// @public
export function combineLatestBatched<T>(observables: Array<Observable<T> & {
    dirty?: boolean;
}>): Observable<T[]>;

// Warning: (ae-forgotten-export) The symbol "TupleToIntersection" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated
export function compact<TArgs extends any[]>(...objects: TArgs): TupleToIntersection<TArgs>;

// @internal @deprecated
export function createFragmentMap(fragments?: FragmentDefinitionNode[]): FragmentMap;

// @internal @deprecated (undocumented)
export function createFulfilledPromise<TValue>(value: TValue): FulfilledPromise<TValue>;

// @internal @deprecated (undocumented)
export function createRejectedPromise<TValue = unknown>(reason: unknown): RejectedPromise<TValue>;

// @public (undocumented)
export function dealias(fieldValue: Record<string, any> | null | undefined, selectionSet: SelectionSetNode): {
    [x: string]: any;
} | null | undefined;

// @internal @deprecated (undocumented)
export type DecoratedPromise<TValue> = PendingPromise<TValue> | FulfilledPromise<TValue> | RejectedPromise<TValue>;

// @internal @deprecated (undocumented)
export function decoratePromise<TValue>(promise: Promise<TValue>): DecoratedPromise<TValue>;

// @internal @deprecated (undocumented)
export namespace DeepMerger {
    // (undocumented)
    export type ArrayMergeStrategy = "truncate" | "combine";
    // (undocumented)
    export interface MergeOptions {
        // (undocumented)
        atPath?: ReadonlyArray<string | number>;
    }
    // (undocumented)
    export interface Options {
        // (undocumented)
        arrayMerge?: DeepMerger.ArrayMergeStrategy;
        // Warning: (ae-forgotten-export) The symbol "ReconcilerFunction" needs to be exported by the entry point index.d.ts
        //
        // (undocumented)
        reconciler?: ReconcilerFunction;
    }
}

// @internal @deprecated (undocumented)
export class DeepMerger {
    constructor(options?: DeepMerger.Options);
    // (undocumented)
    isObject: typeof isNonNullObject;
    // (undocumented)
    merge(target: any, source: any, mergeOptions?: DeepMerger.MergeOptions): any;
    // (undocumented)
    shallowCopyForMerge<T>(value: T): T;
}

// Warning: (ae-forgotten-export) The symbol "DeepOmitPrimitive" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "DeepOmitArray" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated (undocumented)
export type DeepOmit<T, K> = T extends DeepOmitPrimitive ? T : {
    [P in keyof T as P extends K ? never : P]: T[P] extends infer TP ? TP extends DeepOmitPrimitive ? TP : TP extends any[] ? DeepOmitArray<TP, K> : DeepOmit<TP, K> : never;
};

// Warning: (ae-incompatible-release-tags) The symbol "DeepOmitArray" is marked as @public, but its signature references "DeepOmit" which is marked as @internal
//
// @public (undocumented)
type DeepOmitArray<T extends any[], K> = {
    [P in keyof T]: DeepOmit<T[P], K>;
};

// Warning: (ae-incompatible-release-tags) The symbol "DeepOmitPrimitive" is marked as @public, but its signature references "Primitive" which is marked as @internal
//
// @public (undocumented)
type DeepOmitPrimitive = Primitive | Function;

// @public (undocumented)
type Directives = {
    [directiveName: string]: {
        [argName: string]: any;
    };
};

// @public
export namespace DocumentationTypes {
    // (undocumented)
    export interface ApolloQueryResult<TData> extends DataState<TData> {
        error?: ErrorLike;
        loading: boolean;
        networkStatus: NetworkStatus;
        // @deprecated
        partial: boolean;
    }
    // (undocumented)
    export interface DataState<TData> {
        data?: DataValue.Complete<TData> | DataValue.Streaming<TData> | DataValue.Partial<TData> | undefined;
        dataState: "complete" | "streaming" | "partial" | "empty";
    }
    // (undocumented)
    export interface RxjsObservable<TData> {
        // (undocumented)
        pipe<OperatorResult>(...operators: [
        OperatorFunction<Observable<ApolloQueryResult<TData>>, OperatorResult>
        ] | [
        OperatorFunction<Observable<ApolloQueryResult<TData>>, unknown>,
        ...OperatorFunction<unknown, unknown>[],
        OperatorFunction<unknown, OperatorResult>
        ]): Observable<OperatorResult>;
        // (undocumented)
        subscribe(observer: Partial<Observer<ApolloQueryResult<MaybeMasked<TData>>>> | ((value: ApolloQueryResult<MaybeMasked<TData>>) => void)): Subscription;
    }
    // (undocumented)
    export interface VariableOptions<TVariables extends OperationVariables> {
        variables?: TVariables;
    }
}

// @public (undocumented)
export function equalByQuery(query: DocumentNode, { data: aData, ...aRest }: Partial<ObservableQuery.Result<unknown>>, { data: bData, ...bRest }: Partial<ObservableQuery.Result<unknown>>, variables?: OperationVariables): boolean;

// @internal @deprecated
export const extensionsSymbol: unique symbol;

// @public
export interface ExtensionsWithStreamInfo extends Record<string, unknown> {
    // (undocumented)
    [streamInfoSymbol]?: {
        deref(): StreamInfoTrie | undefined;
    };
}

// @public (undocumented)
export function filterMap<T, R>(fn: (value: T, context: undefined) => R | undefined): OperatorFunction<T, R>;

// @public (undocumented)
export function filterMap<T, R, Context>(fn: (value: T, context: Context) => R | undefined, makeContext: () => NoInfer<Context>): OperatorFunction<T, R>;

// @internal @deprecated
export interface FragmentMap {
    // (undocumented)
    [fragmentName: string]: FragmentDefinitionNode;
}

// @internal @deprecated (undocumented)
export type FragmentMapFunction = (fragmentName: string) => FragmentDefinitionNode | null;

// @internal @deprecated (undocumented)
export interface FulfilledPromise<TValue> extends Promise<TValue> {
    // (undocumented)
    status: "fulfilled";
    // (undocumented)
    value: TValue;
}

// @internal @deprecated
export const getApolloCacheMemoryInternals: (() => {
    cache: {
        fragmentQueryDocuments: number | undefined;
    };
}) | undefined;

// @internal @deprecated
export const getApolloClientMemoryInternals: (() => {
    limits: {
        [k: string]: number;
    };
    sizes: {
        cache?: {
            fragmentQueryDocuments: number | undefined;
        } | undefined;
        addTypenameDocumentTransform?: {
            cache: number;
        }[] | undefined;
        inMemoryCache?: {
            executeSelectionSet: number | undefined;
            executeSubSelectedArray: number | undefined;
            maybeBroadcastWatch: number | undefined;
        } | undefined;
        fragmentRegistry?: {
            findFragmentSpreads: number | undefined;
            lookup: number | undefined;
            transform: number | undefined;
        } | undefined;
        print: number | undefined;
        canonicalStringify: number | undefined;
        links: unknown[];
        queryManager: {
            getDocumentInfo: number;
            documentTransforms: {
                cache: number;
            }[];
        };
    };
}) | undefined;

// @internal @deprecated (undocumented)
export function getDefaultValues(definition: OperationDefinitionNode | undefined): Record<string, any>;

// @internal @deprecated (undocumented)
export function getFragmentDefinition(doc: DocumentNode): FragmentDefinitionNode;

// @internal @deprecated (undocumented)
export function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[];

// @internal @deprecated (undocumented)
export function getFragmentFromSelection(selection: SelectionNode, fragmentMap?: FragmentMap | FragmentMapFunction): InlineFragmentNode | FragmentDefinitionNode | null;

// @internal @deprecated
export function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode;

// @internal @deprecated (undocumented)
export function getGraphQLErrorsFromResult(result: {
    errors?: ReadonlyArray<GraphQLFormattedError>;
}): Array<GraphQLFormattedError>;

// @internal @deprecated
export const getInMemoryCacheMemoryInternals: (() => {
    addTypenameDocumentTransform: {
        cache: number;
    }[];
    inMemoryCache: {
        executeSelectionSet: number | undefined;
        executeSubSelectedArray: number | undefined;
        maybeBroadcastWatch: number | undefined;
    };
    fragmentRegistry: {
        findFragmentSpreads: number | undefined;
        lookup: number | undefined;
        transform: number | undefined;
    };
    cache: {
        fragmentQueryDocuments: number | undefined;
    };
}) | undefined;

// @public
export function getMainDefinition(queryDoc: DocumentNode): OperationDefinitionNode | FragmentDefinitionNode;

// @internal @deprecated (undocumented)
export function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined;

// @internal @deprecated (undocumented)
export function getOperationName<TFallback extends string | null | undefined = undefined>(doc: DocumentNode, fallback?: TFallback): string | TFallback;

// @internal @deprecated (undocumented)
export function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode;

// Warning: (ae-forgotten-export) The symbol "Directives" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated (undocumented)
export const getStoreKeyName: ((fieldName: string, args?: Record<string, any> | null, directives?: Directives) => string) & {
    setStringify(s: typeof storeKeyNameStringify): (value: any) => string;
};

// @public (undocumented)
const globalCaches: {
    print?: () => number;
    canonicalStringify?: () => number;
};

// @internal @deprecated (undocumented)
export function graphQLResultHasError(result: FormattedExecutionResult<any>): boolean;

// @internal @deprecated (undocumented)
export function hasDirectives(names: string[], root: ASTNode, all?: boolean): boolean;

// @public (undocumented)
export function hasForcedResolvers(document: ASTNode): boolean;

// @internal @deprecated (undocumented)
export type IsAny<T> = 0 extends 1 & T ? true : false;

// @internal @deprecated
export const isArray: (a: any) => a is any[] | readonly any[];

// @internal @deprecated (undocumented)
export function isDocumentNode(value: unknown): value is DocumentNode;

// @internal @deprecated (undocumented)
export function isField(selection: SelectionNode): selection is FieldNode;

// @internal @deprecated (undocumented)
export function isNonEmptyArray<T>(value: ArrayLike<T> | null | undefined): value is Array<T>;

// @internal @deprecated (undocumented)
export function isNonNullObject(obj: unknown): obj is Record<string | number, any>;

// @internal @deprecated (undocumented)
export function isPlainObject(obj: unknown): obj is Record<string | number, any>;

// @internal @deprecated (undocumented)
export function makeReference(id: string): Reference;

// @internal @deprecated
export function makeUniqueId(prefix: string): string;

// @public (undocumented)
export const mapObservableFragmentMemoized: <From, To>(observable: ApolloCache.ObservableFragment<From>, _cacheKey: symbol, mapFn: (from: ApolloCache.WatchFragmentResult<From>) => ApolloCache.WatchFragmentResult<To>) => ApolloCache.ObservableFragment<To>;

// @internal @deprecated (undocumented)
export function maybeDeepFreeze<T>(obj: T): T;

// @internal @deprecated (undocumented)
export function mergeDeep<T extends any[]>(...sources: T): TupleToIntersection<T>;

// @internal @deprecated (undocumented)
export function mergeDeepArray<T>(sources: T[]): T;

// Warning: (ae-forgotten-export) The symbol "OptionsUnion" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated (undocumented)
export function mergeOptions<TDefaultOptions extends Partial<OptionsUnion<any, any>>, TOptions extends TDefaultOptions>(defaults: TDefaultOptions | Partial<TDefaultOptions> | undefined, options: TOptions | Partial<TOptions>): TOptions & TDefaultOptions;

// @public @deprecated
type NoInfer_2<T> = [T][T extends any ? 0 : never];
export { NoInfer_2 as NoInfer }

// @internal @deprecated (undocumented)
export function omitDeep<T, K extends string>(value: T, key: K): DeepOmit<T, K>;

// @public (undocumented)
type OptionsUnion<TData, TVariables extends OperationVariables> = ApolloClient.WatchQueryOptions<TData, TVariables> | ApolloClient.QueryOptions<TData, TVariables> | ApolloClient.MutateOptions<TData, TVariables, any>;

// @internal @deprecated (undocumented)
export interface PendingPromise<TValue> extends Promise<TValue> {
    // (undocumented)
    status: "pending";
}

// @internal @deprecated (undocumented)
export type Prettify<T> = {
    [K in keyof T]: T[K];
} & {};

// @public (undocumented)
export function preventUnhandledRejection<T>(promise: Promise<T>): Promise<T>;

// @internal @deprecated (undocumented)
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;

// Warning: (ae-incompatible-release-tags) The symbol "ReconcilerFunction" is marked as @public, but its signature references "DeepMerger" which is marked as @internal
//
// @public (undocumented)
type ReconcilerFunction = (this: DeepMerger, target: Record<string | number, any>, source: Record<string | number, any>, property: string | number) => any;

// Warning: (ae-forgotten-export) The symbol "globalCaches" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function registerGlobalCache(name: keyof typeof globalCaches, getSize: () => number): void;

// @internal @deprecated (undocumented)
export interface RejectedPromise<TValue> extends Promise<TValue> {
    // (undocumented)
    reason: unknown;
    // (undocumented)
    status: "rejected";
}

// @public (undocumented)
type RemoveDirectiveConfig = {
    name?: string;
    test?: (node: DirectiveNode) => boolean;
    remove?: boolean;
};

// Warning: (ae-forgotten-export) The symbol "RemoveDirectiveConfig" needs to be exported by the entry point index.d.ts
//
// @internal @deprecated (undocumented)
export function removeDirectivesFromDocument(directives: RemoveDirectiveConfig[], doc: DocumentNode): DocumentNode | null;

// @internal @deprecated (undocumented)
export type RemoveIndexSignature<T> = {
    [K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: T[K];
};

// @public (undocumented)
export function removeMaskedFragmentSpreads(document: DocumentNode): DocumentNode;

// @internal @deprecated (undocumented)
export function resultKeyNameFromField(field: FieldNode): string;

// @internal @deprecated (undocumented)
export function shouldInclude({ directives }: SelectionNode, variables?: Record<string, any>): boolean;

// @internal @deprecated (undocumented)
export function storeKeyNameFromField(field: FieldNode, variables?: Object): string;

// @public (undocumented)
let storeKeyNameStringify: (value: any) => string;

// @public
export const streamInfoSymbol: unique symbol;

// @internal @deprecated (undocumented)
export type StreamInfoTrie = Trie<{
    current: Incremental.StreamFieldInfo;
    previous?: {
        incoming: unknown;
        streamFieldInfo: Incremental.StreamFieldInfo;
        result: unknown;
    };
}>;

// @internal @deprecated (undocumented)
export function stringifyForDisplay(value: any, space?: number): string;

// @internal @deprecated (undocumented)
export function toQueryResult<TData = unknown>(value: ObservableQuery.Result<TData>): ApolloClient.QueryResult<TData>;

// @public (undocumented)
type TupleToIntersection<T extends any[]> = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any;

// @internal @deprecated (undocumented)
export type VariablesOption<TVariables extends OperationVariables> = {} extends TVariables ? {
    variables?: TVariables;
} : {
    variables: TVariables;
};

// @internal @deprecated
export const variablesUnknownSymbol: unique symbol;

// Warnings were encountered during analysis:
//
// src/utilities/internal/getStoreKeyName.ts:89:1 - (ae-forgotten-export) The symbol "storeKeyNameStringify" needs to be exported by the entry point index.d.ts
// src/utilities/internal/types/ExtensionsWithStreamDetails.ts:11:5 - (ae-incompatible-release-tags) The symbol "deref" is marked as @public, but its signature references "StreamInfoTrie" which is marked as @internal

// (No @packageDocumentation comment for this package)