diff --git a/.api-reports/api-report-cache.api.md b/.api-reports/api-report-cache.api.md index 513473c09ea..72f792334a2 100644 --- a/.api-reports/api-report-cache.api.md +++ b/.api-reports/api-report-cache.api.md @@ -216,14 +216,25 @@ export const canonicalStringify: ((value: any) => string) & { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) type ContainsFragmentsRefs = TData extends object ? " $fragmentRefs" extends keyof TData ? true : ContainsFragmentsRefs : false; @@ -352,6 +363,9 @@ export type DiffQueryAgainstStoreOptions = ReadQueryOptions & { returnPartialData?: boolean; }; +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) export abstract class EntityStore implements NormalizedCache { constructor(policies: Policies, group: CacheGroup); @@ -448,6 +462,13 @@ export namespace EntityStore { } } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) export interface FieldFunctionOptions, TVars = Record> { // (undocumented) @@ -677,6 +698,9 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) export function isReference(obj: any): obj is Reference; @@ -733,17 +757,17 @@ export function makeReference(id: string): Reference; // @public (undocumented) export function makeVar(value: T): ReactiveVar; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; // @public (undocumented) export interface MergeInfo { @@ -755,6 +779,19 @@ export interface MergeInfo { typename: string | undefined; } +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + // @public (undocumented) type MergeObjectsFunction = (existing: T, incoming: T) => T; @@ -766,6 +803,22 @@ export interface MergeTree { map: Map; } +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; + // @public (undocumented) export class MissingFieldError extends Error { constructor(message: string, path: MissingTree | Array, query: DocumentNode, variables?: Record | undefined); @@ -1016,6 +1069,11 @@ class Stump extends Layer { removeLayer(): this; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1040,19 +1098,18 @@ export type TypePolicy = { }; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index ae7ec2f8dbd..cb31ddd4692 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -432,14 +432,25 @@ export type ClientParseError = InvariantError & { parseError: Error; }; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -633,6 +644,9 @@ export { disableExperimentalFragmentVariables } export { disableFragmentWarnings } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + export { DocumentNode } // @public (undocumented) @@ -811,6 +825,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) export const fallbackHttpConfig: { http: HttpQueryOptions; @@ -1227,6 +1248,9 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) export function isApolloError(err: Error): err is ApolloError; @@ -1236,11 +1260,11 @@ export function isNetworkRequestSettled(networkStatus?: NetworkStatus): boolean; // @public (undocumented) export function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) type KeyArgsFunction = (args: Record | null, context: { @@ -1377,16 +1401,16 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -export type MaybeMasked = TData extends { +export type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; // @public (undocumented) export interface MergeInfo { @@ -1398,6 +1422,19 @@ export interface MergeInfo { typename: string | undefined; } +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + // @public (undocumented) type MergeObjectsFunction = (existing: T, incoming: T) => T; @@ -1414,6 +1451,22 @@ export interface MergeTree { map: Map; } +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; + // @public (undocumented) export type MethodKeys = { [P in keyof T]: T[P] extends Function ? P : never; @@ -2276,6 +2329,11 @@ export interface SubscriptionOptions = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) export const throwServerError: (response: Response, result: any, message: string) => never; @@ -2334,22 +2392,21 @@ export type TypePolicy = { type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -export type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +export type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-masking.api.md b/.api-reports/api-report-masking.api.md index 5f7bac3fc81..c5ad30b2619 100644 --- a/.api-reports/api-report-masking.api.md +++ b/.api-reports/api-report-masking.api.md @@ -6,14 +6,25 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core'; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) type ContainsFragmentsRefs = TData extends object ? " $fragmentRefs" extends keyof TData ? true : ContainsFragmentsRefs : false; @@ -22,6 +33,16 @@ type ContainsFragmentsRefs = TData extends object ? " $fragmentRefs" exte export interface DataMasking { } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) export type FragmentType = [ TData @@ -33,6 +54,9 @@ TData }; } : never : never; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public export type Masked = TData & { __masked?: true; @@ -45,16 +69,45 @@ export type MaskedDocumentNode = TypedDocumentNode, TVariables>; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -export type MaybeMasked = TData extends { +export type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) type Prettify = { @@ -67,20 +120,24 @@ type RemoveFragmentName = T extends any ? Omit : T; // @public (undocumented) type RemoveMaskedMarker = Omit; +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; -// @public -export type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +// @public (undocumented) +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts // +// @public +export type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; + // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index 0051f466da4..8373acf4521 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -528,14 +528,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) export type CommonOptions = TOptions & { @@ -715,6 +726,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -802,6 +816,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // Warning: (ae-forgotten-export) The symbol "FetchMoreQueryOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -995,14 +1016,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) export type LazyQueryExecFunction = (options?: Partial>) => Promise>; @@ -1122,17 +1146,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -2097,6 +2150,11 @@ export interface SuspenseQueryHookOptions = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -2130,22 +2188,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_components.api.md b/.api-reports/api-report-react_components.api.md index 94be1fdfcce..c9ea4d9100a 100644 --- a/.api-reports/api-report-react_components.api.md +++ b/.api-reports/api-report-react_components.api.md @@ -479,14 +479,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -658,6 +669,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -734,6 +748,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -904,14 +925,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) class LocalState { @@ -985,17 +1009,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1830,6 +1883,11 @@ interface SubscriptionResult { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1863,22 +1921,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_context.api.md b/.api-reports/api-report-react_context.api.md index c1caaf168df..c9d716e731e 100644 --- a/.api-reports/api-report-react_context.api.md +++ b/.api-reports/api-report-react_context.api.md @@ -473,14 +473,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -652,6 +663,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -728,6 +742,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -901,14 +922,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) class LocalState { @@ -982,17 +1006,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1750,6 +1803,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1783,22 +1841,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_hoc.api.md b/.api-reports/api-report-react_hoc.api.md index bf1393ebc5a..7579701495f 100644 --- a/.api-reports/api-report-react_hoc.api.md +++ b/.api-reports/api-report-react_hoc.api.md @@ -462,14 +462,25 @@ export type ChildMutateProps = TProps & Partial> & Partial>; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -650,6 +661,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -726,6 +740,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreOptions { // (undocumented) @@ -908,14 +929,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) class LocalState { @@ -989,17 +1013,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1754,6 +1807,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1787,22 +1845,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_hooks.api.md b/.api-reports/api-report-react_hooks.api.md index 06b8fb06b25..b639caed65d 100644 --- a/.api-reports/api-report-react_hooks.api.md +++ b/.api-reports/api-report-react_hooks.api.md @@ -502,14 +502,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -681,6 +692,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -757,6 +771,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // Warning: (ae-forgotten-export) The symbol "FetchMoreQueryOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -937,14 +958,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // Warning: (ae-forgotten-export) The symbol "LazyQueryHookExecOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "QueryResult" needs to be exported by the entry point index.d.ts @@ -1071,17 +1095,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1920,6 +1973,11 @@ interface SuspenseQueryHookOptions = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1953,22 +2011,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_internal.api.md b/.api-reports/api-report-react_internal.api.md index dd8e2bcbd9f..f5587b3de51 100644 --- a/.api-reports/api-report-react_internal.api.md +++ b/.api-reports/api-report-react_internal.api.md @@ -481,14 +481,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -665,6 +676,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -741,6 +755,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // Warning: (ae-forgotten-export) The symbol "FetchMoreQueryOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -999,14 +1020,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) type Listener = (promise: QueryRefPromise) => void; @@ -1081,17 +1105,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1972,6 +2025,11 @@ interface SuspenseQueryHookOptions = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -2005,22 +2063,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index 4e7eab8c1d6..cb40f4d1f28 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -442,14 +442,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -621,6 +632,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -697,6 +711,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -886,14 +907,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) class LocalState { @@ -967,17 +991,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1735,6 +1788,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type ToReferenceFunction = (objOrIdOrRef: StoreObject | string | Reference, mergeIntoStore?: boolean) => Reference | undefined; @@ -1768,22 +1826,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index 1c71fdb06c3..00f01de37dd 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -432,14 +432,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -622,6 +633,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -698,6 +712,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -868,14 +889,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) export const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & { @@ -956,17 +980,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1783,6 +1836,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) export function tick(): Promise; @@ -1819,22 +1877,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index 4e66af7a9b1..1606498c68a 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -431,14 +431,25 @@ const enum CacheWriteBehavior { // @public (undocumented) type CanReadFunction = (value: StoreValue) => boolean; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) class Concast extends Observable { @@ -621,6 +632,9 @@ interface DevtoolsOptions { name?: string; } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -697,6 +711,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -867,14 +888,17 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) export const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & { @@ -955,17 +979,46 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; + +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; // @public (undocumented) class MissingFieldError extends Error { @@ -1740,6 +1793,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) export function tick(): Promise; @@ -1776,22 +1834,21 @@ type TransformFn = (document: DocumentNode) => DocumentNode; type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index d5aa965cf56..76b0f621592 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -552,13 +552,24 @@ export function checkDocument(doc: DocumentNode): DocumentNode; // @public export function cloneDeep(value: T): T; -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public export function compact(...objects: TArgs): TupleToIntersection; @@ -828,6 +839,9 @@ export type Directives = { }; }; +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + // @public (undocumented) export class DocumentTransform { // Warning: (ae-forgotten-export) The symbol "TransformFn" needs to be exported by the entry point index.d.ts @@ -1005,6 +1019,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) interface FetchMoreQueryOptions { // (undocumented) @@ -1460,6 +1481,9 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // Warning: (ae-forgotten-export) The symbol "ApolloPayloadResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -1665,16 +1689,17 @@ type MaybeAsync = T | PromiseLike; // @public (undocumented) export function maybeDeepFreeze(obj: T): T; +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DataMasking" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -type MaybeMasked = TData extends { +type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; // @public (undocumented) export function mergeDeep(...sources: T): TupleToIntersection; @@ -1695,6 +1720,19 @@ interface MergeInfo { typename: string | undefined; } +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + // @public (undocumented) type MergeObjectsFunction = (existing: T, incoming: T) => T; @@ -1713,6 +1751,22 @@ interface MergeTree { map: Map; } +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; + // @public (undocumented) class MissingFieldError extends Error { constructor(message: string, path: MissingTree | Array, query: DocumentNode, variables?: Record | undefined); @@ -2613,6 +2667,11 @@ interface SubscriptionOptions { variables?: TVariables; } +// Warning: (ae-forgotten-export) The symbol "unionToIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type takeOneFromUnion = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) type TExistingRelay = Readonly<{ edges: TRelayEdge[]; @@ -2696,20 +2755,22 @@ type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) export type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +// @public (undocumented) +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; + // @public (undocumented) type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 3632edce9ec..3a4bac0f7a6 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -524,14 +524,25 @@ export type ClientParseError = InvariantError & { parseError: Error; }; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeUnions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ExtractByMatchingTypeNames" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -type CombineFragmentRefs> = UnionToIntersection<{ - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs>; -}[keyof FragmentRefs]>; +// @public +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify>>; +}[NonNullable]; + +// Warning: (ae-forgotten-export) The symbol "CombineByTypeName" needs to be exported by the entry point index.d.ts +// +// @public +type CombineIntersection = Exclude | CombineByTypeName>; // @public (undocumented) export type CommonOptions = TOptions & { @@ -735,6 +746,9 @@ export { disableExperimentalFragmentVariables } export { disableFragmentWarnings } +// @public (undocumented) +type DistributedRequiredExclude = T extends any ? Required extends Required ? Required extends Required ? never : T : T : T; + export { DocumentNode } // @public (undocumented) @@ -924,6 +938,13 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// @public +type ExtractByMatchingTypeNames = Union extends any ? TypeName extends NonNullable ? Omit & { + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; +} : never : never; + // @public (undocumented) export const fallbackHttpConfig: { http: HttpQueryOptions; @@ -1361,6 +1382,9 @@ interface InvalidateModifier { // @public (undocumented) const _invalidateModifier: unique symbol; +// @public (undocumented) +type IsAny = 0 extends 1 & T ? true : false; + // @public (undocumented) export function isApolloError(err: Error): err is ApolloError; @@ -1370,11 +1394,11 @@ export function isNetworkRequestSettled(networkStatus?: NetworkStatus): boolean; // @public (undocumented) export function isReference(obj: any): obj is Reference; -// Warning: (ae-forgotten-export) The symbol "UnionToIntersection_2" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "UnionToIntersection" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "UnionForAny" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type IsStrictlyAny = UnionToIntersection_2> extends never ? true : false; +type IsStrictlyAny = UnionToIntersection> extends never ? true : false; // @public (undocumented) type KeyArgsFunction = (args: Record | null, context: { @@ -1558,16 +1582,16 @@ interface MaskOperationOptions { // @public (undocumented) type MaybeAsync = T | PromiseLike; -// Warning: (ae-forgotten-export) The symbol "Prettify" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "IsAny" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "RemoveMaskedMarker" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ContainsFragmentsRefs" needs to be exported by the entry point index.d.ts // // @public -export type MaybeMasked = TData extends { +export type MaybeMasked = TData extends any ? true extends IsAny ? TData : TData extends { __masked?: true; } ? Prettify> : DataMasking extends { enabled: true; -} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData; +} ? TData : true extends ContainsFragmentsRefs ? Unmasked : TData : never; // @public (undocumented) export interface MergeInfo { @@ -1579,6 +1603,19 @@ export interface MergeInfo { typename: string | undefined; } +// Warning: (ae-forgotten-export) The symbol "CombineIntersection" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeObjects = Prettify<{ + [k in keyof T]: k extends keyof U ? [ + NonNullable, + NonNullable + ] extends ([ + infer TK extends object, + infer UK extends object + ]) ? TK extends unknown[] ? UK extends unknown[] ? CombineIntersection[] | Extract : T[k] : CombineIntersection | Extract : T[k] : T[k]; +} & Pick>>; + // @public (undocumented) type MergeObjectsFunction = (existing: T, incoming: T) => T; @@ -1595,6 +1632,22 @@ export interface MergeTree { map: Map; } +// Warning: (ae-forgotten-export) The symbol "MergeUnionsAcc" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "takeOneFromUnion" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnions = MergeUnionsAcc, never>; + +// Warning: (ae-forgotten-export) The symbol "DistributedRequiredExclude" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "MergeObjects" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type MergeUnionsAcc = [ +Curr +] extends [never] ? Merged : MergeUnionsAcc, takeOneFromUnion>, [ +Merged +] extends [never] ? Curr : MergeObjects>; + // @public (undocumented) export type MethodKeys = { [P in keyof T]: T[P] extends Function ? P : never; @@ -2741,6 +2794,11 @@ export interface SuspenseQueryHookOptions = unionToIntersection 0 : never> extends ((x: infer U) => 0) ? U : never; + // @public (undocumented) export const throwServerError: (response: Response, result: any, message: string) => never; @@ -2799,22 +2857,21 @@ export type TypePolicy = { type UnionForAny = T extends never ? "a" : 1; // @public (undocumented) -type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never; +type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; // @public (undocumented) -type UnionToIntersection_2 = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; +type unionToIntersection = (T extends unknown ? (x: T) => unknown : never) extends ((x: infer U) => unknown) ? U : never; +// Warning: (ae-forgotten-export) The symbol "UnwrapFragmentRefs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "RemoveFragmentName" needs to be exported by the entry point index.d.ts +// // @public -export type Unmasked = TData extends object ? UnwrapFragmentRefs>> : TData; +export type Unmasked = true extends IsAny ? TData : TData extends object ? UnwrapFragmentRefs>> : TData; -// Warning: (ae-forgotten-export) The symbol "CombineFragmentRefs" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -type UnwrapFragmentRefs = TData extends any ? string extends keyof NonNullable ? TData : " $fragmentRefs" extends keyof NonNullable ? TData extends { - " $fragmentRefs"?: infer FragmentRefs extends object; -} ? Prettify<{ - [K in keyof TData as K extends " $fragmentRefs" ? never : K]: UnwrapFragmentRefs; -} & CombineFragmentRefs> : never : TData extends Array ? Array> : TData extends object ? { +type UnwrapFragmentRefs = true extends IsAny ? TData : TData extends any ? string extends keyof TData ? TData : keyof TData extends never ? TData : TData extends { + " $fragmentRefs"?: infer FragmentRefs; +} ? UnwrapFragmentRefs | RemoveFragmentName[keyof NonNullable]>>>> : TData extends Array ? Array> : TData extends object ? { [K in keyof TData]: UnwrapFragmentRefs; } : TData : never; diff --git a/.changeset/happy-months-happen.md b/.changeset/happy-months-happen.md new file mode 100644 index 00000000000..50203b1387f --- /dev/null +++ b/.changeset/happy-months-happen.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Data masking types: handle overlapping nested array types and fragments on interface types. diff --git a/.circleci/config.yml b/.circleci/config.yml index fadfeb1c535..1fd4d1c866d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,13 @@ jobs: path: reports/junit - store_artifacts: path: reports/junit + Attest: + docker: + - image: cimg/node:23.1.0 + steps: + - checkout + - run: npm ci + - run: npm run test:type-benches BuildTarball: docker: @@ -133,6 +140,7 @@ workflows: parameters: project: ["Core Tests", "ReactDOM 17", "ReactDOM 18", "ReactDOM 19"] + - Attest - Formatting - Lint - BuildTarball diff --git a/.gitignore b/.gitignore index 88b6925bf38..d9dbc1e1a44 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,5 @@ esbuild-why-*.html .yalc yalc.lock + +.attest diff --git a/package-lock.json b/package-lock.json index a91707d3c16..07a04712b17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.3", + "@ark/attest": "^0.28.0", "@babel/parser": "7.25.0", "@changesets/changelog-github": "0.5.0", "@changesets/cli": "2.27.7", @@ -106,6 +107,7 @@ "ts-jest-resolver": "2.0.1", "ts-morph": "22.0.0", "ts-node": "10.9.2", + "tsx": "^4.19.2", "typedoc": "0.25.0", "typescript": "5.5.3", "wait-for-observables": "1.0.3", @@ -259,6 +261,68 @@ "node": ">=14.17" } }, + "node_modules/@ark/attest": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@ark/attest/-/attest-0.28.0.tgz", + "integrity": "sha512-jEt8xfuMsL0L/nKuj4Jg0PswDrkOnyt4BjV76vJBQ+VEdQN3K1+18Yt5fzDGMY1RTZI6u6YAXJWBG60RHYhrxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ark/fs": "0.24.0", + "@ark/util": "0.24.0", + "@prettier/sync": "0.5.2", + "@typescript/analyze-trace": "0.10.1", + "@typescript/vfs": "1.6.0", + "arktype": "2.0.0-rc.24", + "prettier": "3.3.3" + }, + "bin": { + "attest": "out/cli/cli.js" + }, + "peerDependencies": { + "typescript": "*" + } + }, + "node_modules/@ark/attest/node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/@ark/fs": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@ark/fs/-/fs-0.24.0.tgz", + "integrity": "sha512-I9zI/qja1+K7RZW67CLjZRMrhZQmL9O4aFeIaoWH0BNkUn3baHDAHdM/2qcxgQojzmOkxx/ZsHBye+heq+ueLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@ark/schema": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@ark/schema/-/schema-0.24.0.tgz", + "integrity": "sha512-L9aHo485uunP8WhQHH1ofd/DiwyAOo2WS3FMF8AebmIVMjqHOKCXnNBUV1rBnzVZXaVslPlTcgAKjCDmCGoHZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ark/util": "0.24.0" + } + }, + "node_modules/@ark/util": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@ark/util/-/util-0.24.0.tgz", + "integrity": "sha512-YfXWkSinlhKdzoXAYxGVPvv2WMHzSN2Rrw5+Aoj79ksj8aPQdQagsMdnDTobaaynnlLxWz46hP/7JmVTo5QQ/A==", + "dev": true, + "license": "MIT" + }, "node_modules/@babel/code-frame": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.6.tgz", @@ -1746,6 +1810,23 @@ "node": ">=12" } }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/openbsd-x64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", @@ -3084,6 +3165,22 @@ "node": ">=14" } }, + "node_modules/@prettier/sync": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@prettier/sync/-/sync-0.5.2.tgz", + "integrity": "sha512-Yb569su456XNx5BsH/Vyem7xD6g/y9iLmLUzRKM1a/dhU/D7HqqvkAG72znulXlMXztbV0iiu9O5AL8K98TzZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "make-synchronized": "^0.2.8" + }, + "funding": { + "url": "https://github.com/prettier/prettier-synchronized?sponsor=1" + }, + "peerDependencies": { + "prettier": "*" + } + }, "node_modules/@rollup/plugin-node-resolve": { "version": "11.2.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz", @@ -4573,6 +4670,98 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript/analyze-trace": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@typescript/analyze-trace/-/analyze-trace-0.10.1.tgz", + "integrity": "sha512-RnlSOPh14QbopGCApgkSx5UBgGda5MX1cHqp2fsqfiDyCwGL/m1jaeB9fzu7didVS81LQqGZZuxFBcg8YU8EVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "exit": "^0.1.2", + "jsonparse": "^1.3.1", + "jsonstream-next": "^3.0.0", + "p-limit": "^3.1.0", + "split2": "^3.2.2", + "treeify": "^1.1.0", + "yargs": "^16.2.0" + }, + "bin": { + "analyze-trace": "bin/analyze-trace", + "print-trace-types": "bin/print-trace-types", + "simplify-trace-types": "bin/simplify-trace-types" + } + }, + "node_modules/@typescript/analyze-trace/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/@typescript/analyze-trace/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@typescript/analyze-trace/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript/analyze-trace/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript/vfs": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.6.0.tgz", + "integrity": "sha512-hvJUjNVeBMp77qPINuUvYXj4FyWeeMMKZkxEATEU3hqBAQ7qdTBCUFT7Sp0Zu0faeEtFf+ldXxMEDr/bk73ISg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1" + }, + "peerDependencies": { + "typescript": "*" + } + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -4842,6 +5031,17 @@ "dequal": "^2.0.3" } }, + "node_modules/arktype": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/arktype/-/arktype-2.0.0-rc.24.tgz", + "integrity": "sha512-uZB2XXDMzkM613MqhDMjB/y4RPSqS55W9Xn+GoVLgdat/Dr6MC/E90YqFsDCon9zusl3NB/A59MzXeR6PcTo4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ark/schema": "0.24.0", + "@ark/util": "0.24.0" + } + }, "node_modules/array-buffer-byte-length": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", @@ -7520,11 +7720,12 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -7644,10 +7845,11 @@ } }, "node_modules/get-tsconfig": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.6.2.tgz", - "integrity": "sha512-E5XrT4CbbXcXWy+1jChlZmrmCwd5KGx502kDCXJJ7y898TtWW9FwoG5HfOLVRKmlmDGkWN2HM9Ho+/Y8F0sJDg==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", "dev": true, + "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -9647,6 +9849,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/jsonstream-next": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonstream-next/-/jsonstream-next-3.0.0.tgz", + "integrity": "sha512-aAi6oPhdt7BKyQn1SrIIGZBt0ukKuOUE1qV6kJ3GgioSOYzsRc8z9Hfr1BVmacA/jLe9nARfmgMGgn68BqIAgg==", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through2": "^4.0.2" + }, + "bin": { + "jsonstream-next": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/klaw-sync": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", @@ -9858,6 +10087,16 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "node_modules/make-synchronized": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/make-synchronized/-/make-synchronized-0.2.9.tgz", + "integrity": "sha512-4wczOs8SLuEdpEvp3vGo83wh8rjJ78UsIk7DIX5fxdfmfMJGog4bQzxfvOwq7Q3yCHLC4jp1urPHIxRS/A93gA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/fisker/make-synchronized?sponsor=1" + } + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -11217,6 +11456,21 @@ "node": ">=4" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -11617,10 +11871,25 @@ } }, "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" }, "node_modules/safe-regex-test": { "version": "1.0.0", @@ -11979,6 +12248,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "license": "ISC", + "dependencies": { + "readable-stream": "^3.0.0" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -12018,6 +12297,16 @@ "node": ">= 0.4" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-argv": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", @@ -12337,6 +12626,16 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "3" + } + }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", @@ -12462,6 +12761,16 @@ "punycode": "^2.1.0" } }, + "node_modules/treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, "node_modules/ts-api-utils": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", @@ -12686,55 +12995,506 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", "dev": true, + "license": "MIT", "dependencies": { - "prelude-ls": "~1.1.2" + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" }, "engines": { - "node": ">= 0.8.0" + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" } }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": ">=4" + "node": ">=18" } }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=18" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", - "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", - "is-typed-array": "^1.1.10" - }, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 0.4" + "node": ">=18" } }, - "node_modules/typed-array-byte-length": { - "version": "1.0.0", + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, + "node_modules/type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "dev": true, + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", "dev": true, @@ -12978,6 +13738,13 @@ "requires-port": "^1.0.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index 493bd8ce26c..78b3c8eae71 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "lint": "eslint 'src/**/*.{[jt]s,[jt]sx}'", "inline-inherit-doc": "ts-node-script config/inlineInheritDoc.ts", "test": "node --expose-gc ./node_modules/jest/bin/jest.js --config ./config/jest.config.js", + "test:type-benches": "find src -name '*.bench.ts' | xargs -n1 tsx", "test:debug": "node --inspect-brk node_modules/.bin/jest --config ./config/jest.config.js --runInBand --testTimeout 99999 --logHeapUsage", "test:ci": "TEST_ENV=ci npm run test:coverage -- --logHeapUsage", "test:watch": "jest --config ./config/jest.config.js --watch", @@ -109,6 +110,7 @@ }, "devDependencies": { "@arethetypeswrong/cli": "0.15.3", + "@ark/attest": "^0.28.0", "@babel/parser": "7.25.0", "@changesets/changelog-github": "0.5.0", "@changesets/cli": "2.27.7", @@ -188,6 +190,7 @@ "ts-jest-resolver": "2.0.1", "ts-morph": "22.0.0", "ts-node": "10.9.2", + "tsx": "^4.19.2", "typedoc": "0.25.0", "typescript": "5.5.3", "wait-for-observables": "1.0.3", diff --git a/src/__tests__/ApolloClient.ts b/src/__tests__/ApolloClient.ts index 298689e9329..e147de233a4 100644 --- a/src/__tests__/ApolloClient.ts +++ b/src/__tests__/ApolloClient.ts @@ -2971,6 +2971,7 @@ describe("ApolloClient", () => { test("client.mutate uses masked/unmasked type when using Masked", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName": "UserFieldsFragment" }; @@ -3077,6 +3078,7 @@ describe("ApolloClient", () => { test("client.watchQuery uses correct masked/unmasked types", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName": "UserFieldsFragment" }; diff --git a/src/__tests__/dataMasking.ts b/src/__tests__/dataMasking.ts index 90ecaa89fbc..9c23822916b 100644 --- a/src/__tests__/dataMasking.ts +++ b/src/__tests__/dataMasking.ts @@ -814,6 +814,7 @@ describe("client.watchQuery", () => { test("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/masking/__benches__/types.bench.ts b/src/masking/__benches__/types.bench.ts new file mode 100644 index 00000000000..621fb29dfaf --- /dev/null +++ b/src/masking/__benches__/types.bench.ts @@ -0,0 +1,466 @@ +import type { MaybeMasked, Unmasked } from "../index.js"; +import { attest, bench } from "@ark/attest"; +import { expectTypeOf } from "expect-type"; +import type { DeepPartial } from "../../utilities/index.js"; + +import { setup } from "@ark/attest"; + +setup({ + updateSnapshots: !process.env.CI, +}); + +function test(name: string, fn: (name: string) => void) { + fn(name + ": "); +} + +type UnrelatedType = { + __typename: "Unrelated"; +} & { " $fragmentName"?: "Unrelated" } & { + " $fragmentRefs"?: { + Unrelated: { + __unrelated: boolean; + }; + }; +}; +// @ts-ignore +type _TypeCacheWarmup = Unmasked | MaybeMasked; + +test("unmasks deeply nested fragments", (prefix) => { + type UserFieldsFragment = { + __typename: "User"; + id: number; + age: number; + } & { " $fragmentName"?: "UserFieldsFragment" } & { + " $fragmentRefs"?: { + NameFieldsFragment: NameFieldsFragment; + JobFieldsFragment: JobFieldsFragment; + }; + }; + + type NameFieldsFragment = { + __typename: "User"; + firstName: string; + lastName: string; + } & { " $fragmentName"?: "NameFieldsFragment" }; + + type JobFieldsFragment = { + __typename: "User"; + job: string; + } & { " $fragmentName"?: "JobFieldsFragment" } & { + " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; + }; + + type CareerFieldsFragment = { + __typename: "User"; + position: string; + } & { " $fragmentName"?: "CareerFieldsFragment" }; + + type Source = UserFieldsFragment; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + expectTypeOf>().toEqualTypeOf<{ + __typename: "User"; + id: number; + age: number; + firstName: string; + lastName: string; + job: string; + position: string; + }>(); + }); +}); + +test("unmasks deeply nested fragments", (prefix) => { + type UserFieldsFragment = { + __typename: "User"; + id: number; + age: number; + jobs: Array< + { + __typename: "Job"; + id: string; + title: string; + } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } } + >; + } & { " $fragmentName"?: "UserFieldsFragment" } & { + " $fragmentRefs"?: { + NameFieldsFragment: NameFieldsFragment; + }; + }; + + type NameFieldsFragment = { + __typename: "User"; + firstName: string; + lastName: string; + } & { " $fragmentName"?: "NameFieldsFragment" }; + + type JobFieldsFragment = { + __typename: "Job"; + job: string; + } & { " $fragmentName"?: "JobFieldsFragment" } & { + " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; + }; + + type CareerFieldsFragment = { + __typename: "Job"; + position: string; + } & { " $fragmentName"?: "CareerFieldsFragment" }; + + type Source = UserFieldsFragment; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + expectTypeOf>().toEqualTypeOf<{ + __typename: "User"; + id: number; + age: number; + firstName: string; + lastName: string; + jobs: Array<{ + __typename: "Job"; + id: string; + title: string; + job: string; + position: string; + }>; + }>(); + }); +}); + +test("unmasks deeply nested nullable fragments", (prefix) => { + type UserFieldsFragment = { + __typename: "User"; + id: number; + age: number; + career: + | ({ + __typename: "Job"; + id: string; + title: string; + } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } }) + | null; + jobs: Array< + | ({ + __typename: "Job"; + id: string; + title: string; + } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } }) + | null + >; + } & { " $fragmentName"?: "UserFieldsFragment" } & { + " $fragmentRefs"?: { + NameFieldsFragment: NameFieldsFragment; + }; + }; + + type NameFieldsFragment = { + __typename: "User"; + firstName: string; + lastName: string; + } & { " $fragmentName"?: "NameFieldsFragment" }; + + type JobFieldsFragment = { + __typename: "Job"; + job: string; + } & { " $fragmentName"?: "JobFieldsFragment" } & { + " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; + }; + + type CareerFieldsFragment = { + __typename: "Job"; + position: string; + } & { " $fragmentName"?: "CareerFieldsFragment" }; + + type Source = UserFieldsFragment; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + expectTypeOf>().toEqualTypeOf<{ + __typename: "User"; + id: number; + age: number; + firstName: string; + lastName: string; + career: { + __typename: "Job"; + id: string; + title: string; + job: string; + position: string; + } | null; + jobs: Array<{ + __typename: "Job"; + id: string; + title: string; + job: string; + position: string; + } | null>; + }>(); + }); +}); + +test("unmasks DeepPartial types", (prefix) => { + type UserFieldsFragment = { + __typename: "User"; + id: number; + age: number; + } & { " $fragmentName"?: "UserFieldsFragment" } & { + " $fragmentRefs"?: { + NameFieldsFragment: NameFieldsFragment; + }; + }; + + type NameFieldsFragment = { + __typename: "User"; + firstName: string; + lastName: string; + } & { " $fragmentName"?: "NameFieldsFragment" }; + + type Source = DeepPartial; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + expectTypeOf>().toEqualTypeOf<{ + __typename?: "User"; + id?: number; + age?: number; + firstName?: string; + lastName?: string; + }>(); + }); +}); + +test("Unmasked handles odd types", (prefix) => { + bench(prefix + "empty type instantiations", () => { + attest<{}, Unmasked<{}>>(); + }).types([80, "instantiations"]); + + bench(prefix + "empty type functionality", () => { + expectTypeOf>().toEqualTypeOf<{}>(); + }); + + bench(prefix + "generic record type instantiations", () => { + attest, Unmasked>>(); + }).types([99, "instantiations"]); + + bench(prefix + "generic record type functionality", () => { + expectTypeOf>>().toEqualTypeOf< + Record + >(); + }); + + bench(prefix + "unknown instantiations", () => { + attest>(); + }).types([47, "instantiations"]); + + bench(prefix + "unknown functionality", () => { + expectTypeOf>().toBeUnknown(); + }); + + bench(prefix + "any instantiations", () => { + attest>(); + }).types([48, "instantiations"]); + + bench(prefix + "any functionality", () => { + expectTypeOf>().toBeAny(); + }); +}); + +test("MaybeMasked handles odd types", (prefix) => { + bench(prefix + "empty type instantiations", () => { + attest<{}, MaybeMasked<{}>>(); + }).types([76, "instantiations"]); + + bench(prefix + "empty type functionality", () => { + expectTypeOf>().toEqualTypeOf<{}>(); + }); + + bench(prefix + "generic record type instantiations", () => { + attest, MaybeMasked>>(); + }).types([93, "instantiations"]); + bench(prefix + "generic record type functionality", () => { + expectTypeOf>>().toEqualTypeOf< + Record + >(); + }); + + bench(prefix + "unknown instantiations", () => { + attest>(); + }).types([52, "instantiations"]); + bench(prefix + "unknown functionality", () => { + expectTypeOf>().toBeUnknown(); + }); + + bench(prefix + "any instantiations", () => { + attest>(); + }).types([49, "instantiations"]); + bench(prefix + "any functionality", () => { + expectTypeOf>().toBeAny(); + }); +}); + +test("distributed members on MaybeMasked", (prefix) => { + (function unresolvedGeneric() { + bench(prefix + "one unresolved generic mixed with null|undefined", () => { + attest< + [MaybeMasked | null | undefined], + [MaybeMasked] + >(); + }).types([55, "instantiations"]); + })(); + + (function unresolvedGenerics() { + bench(prefix + "two unresolved generics distribute", () => { + attest<[MaybeMasked | MaybeMasked], [MaybeMasked]>(); + }).types([61, "instantiations"]); + })(); +}); + +test("deals with overlapping array from parent fragment", (prefix) => { + type Source = { + __typename: "Track"; + /** comment: id */ + id: number; + /** comment: artists */ + artists?: Array<{ + __typename: "Artist"; + /** comment: artists.id */ + id: number; + " $fragmentRefs"?: { + ArtistFragment: ArtistFragment; + }; + }> | null; + " $fragmentRefs"?: { + NestedTrackFragment: NestedTrackFragment; + }; + }; + + type ArtistFragment = { + " $fragmentName"?: "Fragment__Artist"; + __typename: "Artist"; + /** comment: artists.birthday */ + birthdate: string; + }; + + type NestedTrackFragment = { + " $fragmentName"?: "Fragment__Track"; + __typename: "Track"; + artists?: Array<{ + __typename: "Artist"; + /** comment: artists.lastname */ + lastname: string; + }> | null; + }; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + const x = {} as Unmasked; + // some fields for hovering + x.id; + x.artists; + x.artists?.[0]?.id; + x.artists?.[0]?.birthdate; + x.artists?.[0]?.lastname; + expectTypeOf(x).branded.toEqualTypeOf<{ + __typename: "Track"; + id: number; + artists?: + | Array<{ + __typename: "Artist"; + id: number; + birthdate: string; + lastname: string; + }> + | null + | undefined; + }>(); + }); +}); + +test("base type, multiple fragments on sub-types", (prefix) => { + type Source = { + __typename: "Track"; + id: number; + artists?: Array<{ + __typename: "Person" | "Animatronic" | "CartoonCharacter"; + id: number; + name: string; + " $fragmentRefs"?: { + PersonFragment: PersonFragment; + AnimatronicFragment: AnimatronicFragment; + CartoonCharacterFragment: CartoonCharacterFragment; + }; + }> | null; + }; + + type PersonFragment = { + " $fragmentName"?: "Fragment__Person"; + __typename: "Person"; + birthdate: string; + }; + type AnimatronicFragment = { + " $fragmentName"?: "Fragment__Animatronic"; + __typename: "Animatronic"; + manufacturer: string; + warrantyEndDate: string; + }; + type CartoonCharacterFragment = { + " $fragmentName"?: "Fragment__CartoonCharacter"; + __typename: "CartoonCharacter"; + animator: string; + voiceActor: string; + }; + + bench(prefix + "instantiations", () => { + return {} as Unmasked; + }).types([5, "instantiations"]); + + bench(prefix + "functionality", () => { + const x = {} as Unmasked; + expectTypeOf(x).branded.toEqualTypeOf<{ + __typename: "Track"; + id: number; + artists?: + | Array< + | { + __typename: "Person"; + id: number; + name: string; + birthdate: string; + } + | { + __typename: "Animatronic"; + id: number; + name: string; + manufacturer: string; + warrantyEndDate: string; + } + | { + __typename: "CartoonCharacter"; + id: number; + name: string; + animator: string; + voiceActor: string; + } + > + | null + | undefined; + }>(); + }); +}); diff --git a/src/masking/__tests__/types.test.ts b/src/masking/__tests__/types.test.ts deleted file mode 100644 index a016a70fc4d..00000000000 --- a/src/masking/__tests__/types.test.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { expectTypeOf } from "expect-type"; -import type { Unmasked } from "../index"; -import { DeepPartial } from "../../utilities"; - -describe.skip("Unmasked", () => { - test("unmasks deeply nested fragments", () => { - type UserFieldsFragment = { - __typename: "User"; - id: number; - age: number; - } & { " $fragmentName"?: "UserFieldsFragment" } & { - " $fragmentRefs"?: { - NameFieldsFragment: NameFieldsFragment; - JobFieldsFragment: JobFieldsFragment; - }; - }; - - type NameFieldsFragment = { - __typename: "User"; - firstName: string; - lastName: string; - } & { " $fragmentName"?: "NameFieldsFragment" }; - - type JobFieldsFragment = { - __typename: "User"; - job: string; - } & { " $fragmentName"?: "JobFieldsFragment" } & { - " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; - }; - - type CareerFieldsFragment = { - __typename: "User"; - position: string; - } & { " $fragmentName"?: "CareerFieldsFragment" }; - - expectTypeOf>().toEqualTypeOf<{ - __typename: "User"; - id: number; - age: number; - firstName: string; - lastName: string; - job: string; - position: string; - }>(); - }); - - test("unmasks deeply nested fragments", () => { - type UserFieldsFragment = { - __typename: "User"; - id: number; - age: number; - jobs: Array< - { - __typename: "Job"; - id: string; - title: string; - } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } } - >; - } & { " $fragmentName"?: "UserFieldsFragment" } & { - " $fragmentRefs"?: { - NameFieldsFragment: NameFieldsFragment; - }; - }; - - type NameFieldsFragment = { - __typename: "User"; - firstName: string; - lastName: string; - } & { " $fragmentName"?: "NameFieldsFragment" }; - - type JobFieldsFragment = { - __typename: "Job"; - job: string; - } & { " $fragmentName"?: "JobFieldsFragment" } & { - " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; - }; - - type CareerFieldsFragment = { - __typename: "Job"; - position: string; - } & { " $fragmentName"?: "CareerFieldsFragment" }; - - expectTypeOf>().toEqualTypeOf<{ - __typename: "User"; - id: number; - age: number; - firstName: string; - lastName: string; - jobs: Array<{ - __typename: "Job"; - id: string; - title: string; - job: string; - position: string; - }>; - }>(); - }); - - test("unmasks deeply nested nullable fragments", () => { - type UserFieldsFragment = { - __typename: "User"; - id: number; - age: number; - career: - | ({ - __typename: "Job"; - id: string; - title: string; - } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } }) - | null; - jobs: Array< - | ({ - __typename: "Job"; - id: string; - title: string; - } & { " $fragmentRefs"?: { JobFieldsFragment: JobFieldsFragment } }) - | null - >; - } & { " $fragmentName"?: "UserFieldsFragment" } & { - " $fragmentRefs"?: { - NameFieldsFragment: NameFieldsFragment; - }; - }; - - type NameFieldsFragment = { - __typename: "User"; - firstName: string; - lastName: string; - } & { " $fragmentName"?: "NameFieldsFragment" }; - - type JobFieldsFragment = { - __typename: "Job"; - job: string; - } & { " $fragmentName"?: "JobFieldsFragment" } & { - " $fragmentRefs"?: { CareerFieldsFragment: CareerFieldsFragment }; - }; - - type CareerFieldsFragment = { - __typename: "Job"; - position: string; - } & { " $fragmentName"?: "CareerFieldsFragment" }; - - expectTypeOf>().toEqualTypeOf<{ - __typename: "User"; - id: number; - age: number; - firstName: string; - lastName: string; - career: { - __typename: "Job"; - id: string; - title: string; - job: string; - position: string; - } | null; - jobs: Array<{ - __typename: "Job"; - id: string; - title: string; - job: string; - position: string; - } | null>; - }>(); - }); - - test("unmasks DeepPartial types", () => { - type UserFieldsFragment = { - __typename: "User"; - id: number; - age: number; - } & { " $fragmentName"?: "UserFieldsFragment" } & { - " $fragmentRefs"?: { - NameFieldsFragment: NameFieldsFragment; - }; - }; - - type NameFieldsFragment = { - __typename: "User"; - firstName: string; - lastName: string; - } & { " $fragmentName"?: "NameFieldsFragment" }; - - expectTypeOf>>().toEqualTypeOf<{ - __typename?: "User"; - id?: number; - age?: number; - firstName?: string; - lastName?: string; - }>(); - }); - - test("handles odd types", () => { - expectTypeOf>().toEqualTypeOf<{}>(); - expectTypeOf>>().toEqualTypeOf< - Record - >(); - expectTypeOf>().toEqualTypeOf(); - expectTypeOf>().toEqualTypeOf(); - }); -}); diff --git a/src/masking/internal/types.ts b/src/masking/internal/types.ts index edf1ac90041..8343e3b86b3 100644 --- a/src/masking/internal/types.ts +++ b/src/masking/internal/types.ts @@ -1,32 +1,182 @@ -import type { Prettify, UnionToIntersection } from "../../utilities/index.js"; +import type { Prettify } from "../../utilities/index.js"; + +export type IsAny = 0 extends 1 & T ? true : false; export type UnwrapFragmentRefs = - TData extends any ? + true extends IsAny ? TData + : TData extends any ? // Leave TData alone if it is Record and not a specific shape - string extends keyof NonNullable ? TData - : " $fragmentRefs" extends keyof NonNullable ? - TData extends { " $fragmentRefs"?: infer FragmentRefs extends object } ? - Prettify< - { - [K in keyof TData as K extends " $fragmentRefs" ? never - : K]: UnwrapFragmentRefs; - } & CombineFragmentRefs + string extends keyof TData ? TData + : // short-circuit on empty object + keyof TData extends never ? TData + : TData extends { " $fragmentRefs"?: infer FragmentRefs } ? + UnwrapFragmentRefs< + CombineIntersection< + | Omit + | RemoveFragmentName< + NonNullable< + NonNullable[keyof NonNullable] + > + > > - : never + > : TData extends Array ? Array> : TData extends object ? - { [K in keyof TData]: UnwrapFragmentRefs } + { + [K in keyof TData]: UnwrapFragmentRefs; + } : TData : never; -type CombineFragmentRefs> = - UnionToIntersection< - { - [K in keyof FragmentRefs]-?: UnwrapFragmentRefs< - RemoveFragmentName - >; - }[keyof FragmentRefs] +/** + ```ts + CombineIntersection< + | { foo: string } + | { __typename: "A"; a: string } + | { __typename: "B"; b1: number } + | { __typename: "B"; b2: string } + > => + | { foo: string } + | CombineByTypeName< + | { __typename: "A"; a: string } + | { __typename: "B"; b1: number } + | { __typename: "B"; b2: string } + > + ``` + */ +type CombineIntersection = + | Exclude + | CombineByTypeName>; +/** +```ts + CombineByTypeName< + | { __typename: "A"; a: string } + | { __typename: "B"; b1: number } + | { __typename: "B"; b2: string } + > => + | CombineWithArrays< + | { __typename: "A"; a: string } + > + | CombineWithArrays< + | { __typename: "B"; b1: number } + | { __typename: "B"; b2: number } + > +``` + */ +type CombineByTypeName = { + [TypeName in NonNullable]: Prettify< + MergeUnions> >; +}[NonNullable]; + +/** +```ts +CombineByTypeName< + | { + __typename: "Person" | "Animatronic" | "CartoonCharacter"; + id: number; + name: string; + } + | { + __typename: "Person"; + birthdate: string; + } + | { + __typename: "Animatronic"; + manufacturer: string; + warrantyEndDate: string; + } + | { + __typename: "CartoonCharacter"; + animator: string; + voiceActor: string; + } +> + => +{ + id: number; + name: string; + __typename: "Person"; + birthdate: string; +} | { + id: number; + name: string; + __typename: "Animatronic"; + manufacturer: string; + warrantyEndDate: string; +} | { + id: number; + name: string; + __typename: "CartoonCharacter"; + animator: string; + voiceActor: string; +} +``` + */ +type ExtractByMatchingTypeNames< + Union extends { __typename?: string }, + TypeName extends string, +> = Union extends any ? + TypeName extends NonNullable ? + Omit & { + // preserve `?`, which `& { __typename: TypeName }` would not do + [K in keyof Union as K extends "__typename" ? K : never]: TypeName; + } + : never +: never; + +type MergeUnions = MergeUnionsAcc< + TUnion, + takeOneFromUnion, + never +>; + +type DistributedRequiredExclude = + T extends any ? + Required extends Required ? + Required extends Required ? + never + : T + : T + : T; + +type MergeUnionsAcc = + [Curr] extends [never] ? Merged + : MergeUnionsAcc< + DistributedRequiredExclude, + takeOneFromUnion>, + [Merged] extends [never] ? Curr : MergeObjects + >; +type unionToIntersection = + (T extends unknown ? (x: T) => unknown : never) extends ( + (x: infer U) => unknown + ) ? + U + : never; + +type takeOneFromUnion = + unionToIntersection 0 : never> extends ( + (x: infer U) => 0 + ) ? + U + : never; + +type MergeObjects = Prettify< + { + [k in keyof T]: k extends keyof U ? + [NonNullable, NonNullable] extends ( + [infer TK extends object, infer UK extends object] + ) ? + TK extends unknown[] ? + UK extends unknown[] ? + | CombineIntersection[] + | Extract + : T[k] + : CombineIntersection | Extract + : T[k] + : T[k]; + } & Pick> +>; export type RemoveMaskedMarker = Omit; // force distrubution when T is a union with | undefined diff --git a/src/masking/types.ts b/src/masking/types.ts index 90b250b4f70..ebf8cdd4ad4 100644 --- a/src/masking/types.ts +++ b/src/masking/types.ts @@ -1,6 +1,7 @@ import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; import type { ContainsFragmentsRefs, + IsAny, RemoveFragmentName, RemoveMaskedMarker, UnwrapFragmentRefs, @@ -38,15 +39,21 @@ export type FragmentType = * enabled. */ export type MaybeMasked = - TData extends { __masked?: true } ? Prettify> - : DataMasking extends { enabled: true } ? TData - : true extends ContainsFragmentsRefs ? Unmasked - : TData; + // distribute TData - in case of a union, do the next steps for each member + TData extends any ? + // prevent "Type instantiation is excessively deep and possibly infinite." + true extends IsAny ? TData + : TData extends { __masked?: true } ? Prettify> + : DataMasking extends { enabled: true } ? TData + : true extends ContainsFragmentsRefs ? Unmasked + : TData + : never; /** * Unmasks a type to provide its full result. */ export type Unmasked = - TData extends object ? + true extends IsAny ? TData + : TData extends object ? UnwrapFragmentRefs>> : TData; diff --git a/src/react/hoc/mutation-hoc.tsx b/src/react/hoc/mutation-hoc.tsx index 2620f46ff81..2a0291653d1 100644 --- a/src/react/hoc/mutation-hoc.tsx +++ b/src/react/hoc/mutation-hoc.tsx @@ -101,6 +101,8 @@ export function withMutation< // up onto the result since it was passed as a nested prop // we massage the Mutation component's shape here to replicate that // this matches the query HoC + + // @ts-ignore Type instantiation is excessively deep and possibly infinite. const result = Object.assign(r, data || {}); const name = operationOptions.name || "mutate"; const resultName = diff --git a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx index e53a1519c84..84b16b813c8 100644 --- a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx +++ b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx @@ -4789,6 +4789,7 @@ it("masks cache and network result when using cache-and-network fetch policy", a it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useLazyQuery.test.tsx b/src/react/hooks/__tests__/useLazyQuery.test.tsx index 5589db55364..bd7bffe87ef 100644 --- a/src/react/hooks/__tests__/useLazyQuery.test.tsx +++ b/src/react/hooks/__tests__/useLazyQuery.test.tsx @@ -2502,6 +2502,7 @@ describe.skip("Type Tests", () => { test("uses masked types when using masked document", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; @@ -2600,6 +2601,7 @@ describe.skip("Type Tests", () => { test("uses unmasked types when using TypedDocumentNode", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useMutation.test.tsx b/src/react/hooks/__tests__/useMutation.test.tsx index 269ba281cfb..c4098cc571a 100644 --- a/src/react/hooks/__tests__/useMutation.test.tsx +++ b/src/react/hooks/__tests__/useMutation.test.tsx @@ -3242,6 +3242,7 @@ describe.skip("Type Tests", () => { test("uses masked/unmasked type when using Masked", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName": "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useQuery.test.tsx b/src/react/hooks/__tests__/useQuery.test.tsx index 84f985f0d46..003f1899f0c 100644 --- a/src/react/hooks/__tests__/useQuery.test.tsx +++ b/src/react/hooks/__tests__/useQuery.test.tsx @@ -10898,6 +10898,7 @@ describe("useQuery Hook", () => { it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index bfc55ebb8d0..058fc277ce8 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -2419,6 +2419,7 @@ describe.skip("Type Tests", () => { test("uses unmasked types when using TypedDocumentNode", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx index 6817ad2f59d..3583243f787 100644 --- a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx +++ b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx @@ -286,17 +286,20 @@ function useVariablesQueryCase() { } type CharacterFragment = { + __typename: "Character"; name: string; } & { " $fragmentName"?: "CharacterFragment" }; interface MaskedVariablesCaseData { character: { + __typename: "Character"; id: string; } & { " $fragmentRefs"?: { CharacterFragment: CharacterFragment } }; } interface UnmaskedVariablesCaseData { character: { + __typename: "Character"; id: string; name: string; }; @@ -11461,6 +11464,7 @@ describe("useSuspenseQuery", () => { it("masks partial cache data when returnPartialData is `true`", async () => { type UserFieldsFragment = { + __typename: "User"; age: number; } & { " $fragmentName"?: "UserFieldsFragment" }; diff --git a/src/testing/internal/scenarios/index.ts b/src/testing/internal/scenarios/index.ts index fc266ff3685..0d9a826521a 100644 --- a/src/testing/internal/scenarios/index.ts +++ b/src/testing/internal/scenarios/index.ts @@ -65,6 +65,7 @@ export function setupVariablesCase() { } export type MaskedVariablesCaseFragment = { + __typename: "Character"; name: string; } & { " $fragmentName"?: "MaskedVariablesCaseFragment" };