@apollo/client 4.3.0-alpha.9 → 4.3.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/__cjs/cache/core/Scalar.cjs.map +1 -1
  3. package/__cjs/cache/core/Scalar.d.cts +0 -1
  4. package/__cjs/cache/core/cache.cjs +3 -3
  5. package/__cjs/cache/core/cache.cjs.map +1 -1
  6. package/__cjs/cache/core/cache.d.cts +53 -8
  7. package/__cjs/cache/index.cjs.map +1 -1
  8. package/__cjs/cache/index.d.cts +1 -1
  9. package/__cjs/cache/inmemory/entityStore.cjs +25 -10
  10. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  11. package/__cjs/cache/inmemory/helpers.cjs +12 -0
  12. package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
  13. package/__cjs/cache/inmemory/helpers.d.cts +2 -1
  14. package/__cjs/cache/inmemory/inMemoryCache.cjs +34 -22
  15. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  16. package/__cjs/cache/inmemory/inMemoryCache.d.cts +4 -4
  17. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  18. package/__cjs/cache/inmemory/policies.cjs +7 -8
  19. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  20. package/__cjs/cache/inmemory/policies.d.cts +3 -4
  21. package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
  22. package/__cjs/cache/inmemory/types.d.cts +3 -1
  23. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  24. package/__cjs/core/ApolloClient.cjs +14 -14
  25. package/__cjs/core/ObservableQuery.cjs +8 -8
  26. package/__cjs/core/QueryInfo.cjs +1 -1
  27. package/__cjs/core/QueryManager.cjs +12 -12
  28. package/__cjs/core/RefetchEventManager.cjs +3 -3
  29. package/__cjs/core/index.cjs.map +1 -1
  30. package/__cjs/core/index.d.cts +3 -2
  31. package/__cjs/core/types.d.cts +9 -4
  32. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +1 -1
  33. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  34. package/__cjs/invariantErrorCodes.cjs +131 -116
  35. package/__cjs/link/core/ApolloLink.cjs +3 -3
  36. package/__cjs/link/http/checkFetcher.cjs +1 -1
  37. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  38. package/__cjs/link/persisted-queries/index.cjs +2 -2
  39. package/__cjs/link/ws/index.cjs +1 -1
  40. package/__cjs/local-state/LocalState.cjs +11 -11
  41. package/__cjs/local-state/LocalState.cjs.map +1 -1
  42. package/__cjs/local-state/LocalState.d.cts +1 -1
  43. package/__cjs/masking/maskDefinition.cjs +2 -2
  44. package/__cjs/masking/maskFragment.cjs +2 -2
  45. package/__cjs/masking/maskOperation.cjs +1 -1
  46. package/__cjs/masking/utils.cjs +3 -3
  47. package/__cjs/react/context/ApolloContext.cjs +1 -1
  48. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  49. package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
  50. package/__cjs/react/hooks/useApolloClient.cjs +1 -1
  51. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  52. package/__cjs/react/hooks/useBackgroundQuery.d.cts +1 -1
  53. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  54. package/__cjs/react/hooks/useFragment.d.cts +0 -1
  55. package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
  56. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  57. package/__cjs/react/hooks/useLazyQuery.d.cts +1 -1
  58. package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
  59. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  60. package/__cjs/react/hooks/useMutation.d.cts +1 -1
  61. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  62. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  63. package/__cjs/react/hooks/useSubscription.cjs +7 -3
  64. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  65. package/__cjs/react/hooks/useSubscription.d.cts +7 -4
  66. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  67. package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -1
  68. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  69. package/__cjs/react/hooks/useSuspenseQuery.d.cts +1 -1
  70. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  71. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  72. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  73. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -1
  74. package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
  75. package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
  76. package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
  77. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +45 -12
  78. package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -1
  79. package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
  80. package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
  81. package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
  82. package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
  83. package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
  84. package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
  85. package/__cjs/utilities/internal/index.cjs +6 -4
  86. package/__cjs/utilities/internal/index.cjs.map +1 -1
  87. package/__cjs/utilities/internal/index.d.cts +2 -2
  88. package/__cjs/utilities/internal/matchScalarList.cjs +12 -0
  89. package/__cjs/utilities/internal/matchScalarList.cjs.map +1 -0
  90. package/__cjs/utilities/internal/matchScalarList.d.cts +8 -0
  91. package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
  92. package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
  93. package/__cjs/utilities/internal/unwrapScalarType.cjs +12 -0
  94. package/__cjs/utilities/internal/unwrapScalarType.cjs.map +1 -0
  95. package/__cjs/utilities/internal/unwrapScalarType.d.cts +10 -0
  96. package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
  97. package/__cjs/version.cjs +1 -1
  98. package/__cjs/version.cjs.map +1 -1
  99. package/cache/core/Scalar.d.ts +0 -1
  100. package/cache/core/Scalar.js.map +1 -1
  101. package/cache/core/cache.d.ts +53 -8
  102. package/cache/core/cache.js +3 -3
  103. package/cache/core/cache.js.map +1 -1
  104. package/cache/index.d.ts +1 -1
  105. package/cache/index.js.map +1 -1
  106. package/cache/inmemory/entityStore.js +26 -11
  107. package/cache/inmemory/entityStore.js.map +1 -1
  108. package/cache/inmemory/helpers.d.ts +2 -1
  109. package/cache/inmemory/helpers.js +11 -0
  110. package/cache/inmemory/helpers.js.map +1 -1
  111. package/cache/inmemory/inMemoryCache.d.ts +4 -4
  112. package/cache/inmemory/inMemoryCache.js +36 -24
  113. package/cache/inmemory/inMemoryCache.js.map +1 -1
  114. package/cache/inmemory/key-extractor.js +1 -1
  115. package/cache/inmemory/policies.d.ts +3 -4
  116. package/cache/inmemory/policies.js +7 -8
  117. package/cache/inmemory/policies.js.map +1 -1
  118. package/cache/inmemory/readFromStore.js +3 -3
  119. package/cache/inmemory/types.d.ts +3 -1
  120. package/cache/inmemory/types.js.map +1 -1
  121. package/cache/inmemory/writeToStore.js +4 -4
  122. package/core/ApolloClient.js +14 -14
  123. package/core/ObservableQuery.js +8 -8
  124. package/core/QueryInfo.js +1 -1
  125. package/core/QueryManager.js +12 -12
  126. package/core/RefetchEventManager.js +3 -3
  127. package/core/index.d.ts +3 -2
  128. package/core/index.js.map +1 -1
  129. package/core/types.d.ts +9 -4
  130. package/core/types.js.map +1 -1
  131. package/incremental/handlers/graphql17Alpha9.js +1 -1
  132. package/incremental/handlers/notImplemented.js +1 -1
  133. package/invariantErrorCodes.js +131 -116
  134. package/link/core/ApolloLink.js +3 -3
  135. package/link/http/checkFetcher.js +1 -1
  136. package/link/http/parseAndCheckHttpResponse.js +1 -1
  137. package/link/persisted-queries/index.js +2 -2
  138. package/link/ws/index.js +1 -1
  139. package/local-state/LocalState.d.ts +1 -1
  140. package/local-state/LocalState.js +11 -11
  141. package/local-state/LocalState.js.map +1 -1
  142. package/masking/maskDefinition.js +2 -2
  143. package/masking/maskFragment.js +2 -2
  144. package/masking/maskOperation.js +1 -1
  145. package/masking/utils.js +3 -3
  146. package/package.json +1 -1
  147. package/react/context/ApolloContext.js +1 -1
  148. package/react/context/ApolloProvider.js +1 -1
  149. package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
  150. package/react/hooks/useApolloClient.js +1 -1
  151. package/react/hooks/useBackgroundQuery.d.ts +1 -1
  152. package/react/hooks/useBackgroundQuery.js.map +1 -1
  153. package/react/hooks/useFragment.d.ts +0 -1
  154. package/react/hooks/useFragment.js.map +1 -1
  155. package/react/hooks/useLazyQuery.d.ts +1 -1
  156. package/react/hooks/useLazyQuery.js +2 -2
  157. package/react/hooks/useLazyQuery.js.map +1 -1
  158. package/react/hooks/useLoadableQuery.js +2 -2
  159. package/react/hooks/useMutation.d.ts +1 -1
  160. package/react/hooks/useMutation.js.map +1 -1
  161. package/react/hooks/useQuery.d.ts +1 -1
  162. package/react/hooks/useQuery.js.map +1 -1
  163. package/react/hooks/useSubscription.d.ts +7 -4
  164. package/react/hooks/useSubscription.js +7 -3
  165. package/react/hooks/useSubscription.js.map +1 -1
  166. package/react/hooks/useSuspenseFragment.d.ts +1 -1
  167. package/react/hooks/useSuspenseFragment.js.map +1 -1
  168. package/react/hooks/useSuspenseQuery.d.ts +1 -1
  169. package/react/hooks/useSuspenseQuery.js.map +1 -1
  170. package/react/hooks/useSyncExternalStore.js +1 -1
  171. package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
  172. package/react/hooks-compiled/useApolloClient.js +1 -1
  173. package/react/hooks-compiled/useBackgroundQuery.d.ts +1 -1
  174. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  175. package/react/hooks-compiled/useFragment.d.ts +0 -1
  176. package/react/hooks-compiled/useFragment.js.map +1 -1
  177. package/react/hooks-compiled/useLazyQuery.d.ts +1 -1
  178. package/react/hooks-compiled/useLazyQuery.js +2 -2
  179. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  180. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  181. package/react/hooks-compiled/useMutation.d.ts +1 -1
  182. package/react/hooks-compiled/useMutation.js.map +1 -1
  183. package/react/hooks-compiled/useQuery.d.ts +1 -1
  184. package/react/hooks-compiled/useQuery.js.map +1 -1
  185. package/react/hooks-compiled/useSubscription.d.ts +7 -4
  186. package/react/hooks-compiled/useSubscription.js +107 -93
  187. package/react/hooks-compiled/useSubscription.js.map +1 -1
  188. package/react/hooks-compiled/useSuspenseFragment.d.ts +1 -1
  189. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  190. package/react/hooks-compiled/useSuspenseQuery.d.ts +1 -1
  191. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  192. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  193. package/react/internal/cache/QueryReference.js +1 -1
  194. package/react/query-preloader/createQueryPreloader.d.ts +1 -1
  195. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  196. package/react/ssr/prerenderStatic.js +2 -2
  197. package/testing/core/mocking/mockLink.js +4 -4
  198. package/utilities/graphql/DocumentTransform.js +1 -1
  199. package/utilities/internal/coerceScalarFieldsToParsed.js +40 -11
  200. package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -1
  201. package/utilities/internal/getFragmentDefinition.js +3 -3
  202. package/utilities/internal/getFragmentDefinition.js.map +1 -1
  203. package/utilities/internal/getFragmentFromSelection.js +1 -1
  204. package/utilities/internal/getFragmentQueryDocument.js +2 -2
  205. package/utilities/internal/getMainDefinition.js +1 -1
  206. package/utilities/internal/getQueryDefinition.js +1 -1
  207. package/utilities/internal/index.d.ts +2 -2
  208. package/utilities/internal/index.js +2 -1
  209. package/utilities/internal/index.js.map +1 -1
  210. package/utilities/internal/matchScalarList.d.ts +8 -0
  211. package/utilities/internal/matchScalarList.js +9 -0
  212. package/utilities/internal/matchScalarList.js.map +1 -0
  213. package/utilities/internal/removeDirectivesFromDocument.js +1 -1
  214. package/utilities/internal/shouldInclude.js +4 -4
  215. package/utilities/internal/unwrapScalarType.d.ts +10 -0
  216. package/utilities/internal/unwrapScalarType.js +9 -0
  217. package/utilities/internal/unwrapScalarType.js.map +1 -0
  218. package/utilities/internal/valueToObjectRepresentation.js +1 -1
  219. package/version.js +1 -1
  220. package/version.js.map +1 -1
  221. package/__cjs/utilities/internal/getUnwrappedType.cjs +0 -20
  222. package/__cjs/utilities/internal/getUnwrappedType.cjs.map +0 -1
  223. package/__cjs/utilities/internal/getUnwrappedType.d.cts +0 -8
  224. package/__cjs/utilities/internal/types/NoInfer.cjs +0 -3
  225. package/__cjs/utilities/internal/types/NoInfer.cjs.map +0 -1
  226. package/__cjs/utilities/internal/types/NoInfer.d.cts +0 -35
  227. package/utilities/internal/getUnwrappedType.d.ts +0 -8
  228. package/utilities/internal/getUnwrappedType.js +0 -17
  229. package/utilities/internal/getUnwrappedType.js.map +0 -1
  230. package/utilities/internal/types/NoInfer.d.ts +0 -35
  231. package/utilities/internal/types/NoInfer.js +0 -2
  232. package/utilities/internal/types/NoInfer.js.map +0 -1
@@ -282,7 +282,7 @@ export class StoreReader {
282
282
  if (typename) {
283
283
  const policy = policies["getFieldPolicy"](typename, fieldName);
284
284
  if (policy?.scalar) {
285
- __DEV__ && invariant.warn(116, `${typename}.${fieldName}`, policy.scalar);
285
+ __DEV__ && invariant.warn(119, `${typename}.${fieldName}`, policy.scalar);
286
286
  }
287
287
  }
288
288
  }
@@ -319,7 +319,7 @@ export class StoreReader {
319
319
  else {
320
320
  const fragment = getFragmentFromSelection(selection, context.lookupFragment);
321
321
  if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
322
- throw newInvariantError(117, selection.name.value);
322
+ throw newInvariantError(120, selection.name.value);
323
323
  }
324
324
  if (fragment && policies.fragmentMatches(fragment, typename)) {
325
325
  const isDeferBoundary = isDeferredFragment(selection, context.variables);
@@ -616,7 +616,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
616
616
  if (isNonNullObject(value)) {
617
617
  invariant(
618
618
  !isReference(value),
619
- 118,
619
+ 121,
620
620
  getTypenameFromStoreObject(store, value),
621
621
  field.name.value
622
622
  );
@@ -129,6 +129,8 @@ export interface ReadMergeModifyContext {
129
129
  varString?: string;
130
130
  extensions?: ExtensionsWithStreamInfo;
131
131
  }
132
+ type ListOf<T extends string> = `[${T}]`;
133
+ type NestedScalarName<T extends string> = T | ListOf<T> | ListOf<ListOf<T>> | ListOf<ListOf<ListOf<T>>> | ListOf<ListOf<ListOf<ListOf<T>>>>;
132
134
  export type KnownScalars = RemoveIndexSignature<ApolloCache.Scalars>;
133
- export type ScalarNames = keyof KnownScalars | (string extends keyof ApolloCache.Scalars ? string & {} : never);
135
+ export type ScalarType = NestedScalarName<keyof KnownScalars & string> | (string extends keyof ApolloCache.Scalars ? string & {} : never);
134
136
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/inmemory/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FieldNode } from \"graphql\";\n\nimport type { OperationVariables } from \"@apollo/client\";\nimport type {\n Reference,\n StoreObject,\n StoreValue,\n} from \"@apollo/client/utilities\";\nimport type {\n DeferInfoTrie,\n ExtensionsWithStreamInfo,\n RemoveIndexSignature,\n StreamInfoTrie,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloCache, Transaction } from \"../core/cache.js\";\nimport type {\n AllFieldsModifier,\n CanReadFunction,\n Modifiers,\n ToReferenceFunction,\n} from \"../core/types/common.js\";\n\nimport type { FieldValueGetter } from \"./entityStore.js\";\nimport type { FragmentRegistryAPI } from \"./fragmentRegistry.js\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type {\n FieldMergeFunction,\n KeyFieldsFunction,\n PossibleTypesMap,\n StorageType,\n TypePolicies,\n} from \"./policies.js\";\n\nexport type { Reference, StoreObject, StoreValue };\n\nexport interface IdGetterObj extends Object {\n __typename?: string;\n id?: string;\n _id?: string;\n}\n\nexport declare type IdGetter = (value: IdGetterObj) => string | undefined;\n\n/**\n * This is an interface used to access, set and remove\n * StoreObjects from the cache\n */\nexport interface NormalizedCache {\n has(dataId: string): boolean;\n get(dataId: string, fieldName: string): StoreValue;\n\n // The store.merge method allows either argument to be a string ID, but\n // the other argument has to be a StoreObject. Either way, newer fields\n // always take precedence over older fields.\n merge(olderId: string, newerObject: StoreObject): void;\n merge(olderObject: StoreObject, newerId: string): void;\n\n modify<Entity extends Record<string, any>>(\n dataId: string,\n fields: Modifiers<Entity> | AllFieldsModifier<Entity>,\n exact: boolean\n ): boolean;\n delete(dataId: string, fieldName?: string): boolean;\n clear(): void;\n\n // non-Map elements:\n /**\n * returns an Object with key-value pairs matching the contents of the store\n */\n toObject(): NormalizedCacheObject;\n /**\n * replace the state of the store\n */\n replace(newData: NormalizedCacheObject): void;\n\n /**\n * Retain (or release) a given root ID to protect (or expose) it and its\n * transitive child entities from (or to) garbage collection. The current\n * retainment count is returned by both methods. Note that releasing a root\n * ID does not cause that entity to be garbage collected, but merely removes\n * it from the set of root IDs that will be considered during the next\n * mark-and-sweep collection.\n */\n retain(rootId: string): number;\n release(rootId: string): number;\n\n getFieldValue: FieldValueGetter;\n toReference: ToReferenceFunction;\n canRead: CanReadFunction;\n\n getStorage(\n idOrObj: string | StoreObject,\n ...storeFieldNames: (string | number)[]\n ): StorageType;\n}\n\n/**\n * This is a normalized representation of the Apollo query result cache. It consists of\n * a flattened representation of query result trees.\n */\nexport interface NormalizedCacheObject {\n __META?: {\n // Well-known singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered to be root IDs during cache.gc garbage\n // collection, but other IDs can become roots if they are written\n // directly with cache.writeFragment or retained explicitly with\n // cache.retain. When such IDs exist, we include them in the __META\n // section so that they can survive cache.{extract,restore}.\n extraRootIds: string[];\n };\n [dataId: string]: StoreObject | undefined;\n}\n\nexport type OptimisticStoreItem = {\n id: string;\n data: NormalizedCacheObject;\n transaction: Transaction;\n};\n\nexport type ReadQueryOptions = {\n /**\n * The Apollo Client store object.\n */\n store: NormalizedCache;\n /**\n * A parsed GraphQL query document.\n */\n query: DocumentNode;\n variables?: Object;\n previousResult?: any;\n rootId?: string;\n config?: ApolloReducerConfig;\n};\n\n/** @internal */\nexport interface DiffIncrementalInfo {\n streamInfo?: StreamInfoTrie;\n deferInfo?: DeferInfoTrie;\n}\n\nexport type DiffQueryAgainstStoreOptions = ReadQueryOptions & {\n returnPartialData?: boolean;\n};\n\nexport type ApolloReducerConfig = {\n dataIdFromObject?: KeyFieldsFunction;\n};\n\nexport interface InputObjectConfig {\n fields: Record<string, string>;\n}\n\nexport interface InputObjectsOption {\n [inputObjectName: string]: InputObjectConfig;\n}\n\nexport type InMemoryCacheConfig = ApolloReducerConfig & {\n resultCaching?: boolean;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n fragments?: FragmentRegistryAPI;\n inputObjects?: InputObjectsOption;\n} & ({} extends InMemoryCache.ScalarsOption ?\n InMemoryCache.ScalarsOption extends Record<string, never> ?\n {\n scalars?: Record<\n string,\n `Scalar types must be declared in ApolloCache.Scalars before usage. See https://www.apollographql.com/docs/react/data/typescript#declaring-scalar-types.`\n >;\n }\n : { scalars?: InMemoryCache.ScalarsOption }\n : { scalars: InMemoryCache.ScalarsOption });\n\nexport interface MergeInfo {\n field: FieldNode;\n typename: string | undefined;\n merge: FieldMergeFunction;\n path: Array<string | number>;\n}\n\nexport interface MergeTree {\n info?: MergeInfo;\n map: Map<string | number, MergeTree>;\n}\n\nexport interface ReadMergeModifyContext {\n store: NormalizedCache;\n variables?: OperationVariables;\n // A JSON.stringify-serialized version of context.variables.\n varString?: string;\n extensions?: ExtensionsWithStreamInfo;\n}\n\nexport type KnownScalars = RemoveIndexSignature<ApolloCache.Scalars>;\nexport type ScalarNames =\n | keyof KnownScalars\n | (string extends keyof ApolloCache.Scalars ? string & {} : never);\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/inmemory/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FieldNode } from \"graphql\";\n\nimport type { OperationVariables } from \"@apollo/client\";\nimport type {\n Reference,\n StoreObject,\n StoreValue,\n} from \"@apollo/client/utilities\";\nimport type {\n DeferInfoTrie,\n ExtensionsWithStreamInfo,\n RemoveIndexSignature,\n StreamInfoTrie,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloCache, Transaction } from \"../core/cache.js\";\nimport type {\n AllFieldsModifier,\n CanReadFunction,\n Modifiers,\n ToReferenceFunction,\n} from \"../core/types/common.js\";\n\nimport type { FieldValueGetter } from \"./entityStore.js\";\nimport type { FragmentRegistryAPI } from \"./fragmentRegistry.js\";\nimport type { InMemoryCache } from \"./inMemoryCache.js\";\nimport type {\n FieldMergeFunction,\n KeyFieldsFunction,\n PossibleTypesMap,\n StorageType,\n TypePolicies,\n} from \"./policies.js\";\n\nexport type { Reference, StoreObject, StoreValue };\n\nexport interface IdGetterObj extends Object {\n __typename?: string;\n id?: string;\n _id?: string;\n}\n\nexport declare type IdGetter = (value: IdGetterObj) => string | undefined;\n\n/**\n * This is an interface used to access, set and remove\n * StoreObjects from the cache\n */\nexport interface NormalizedCache {\n has(dataId: string): boolean;\n get(dataId: string, fieldName: string): StoreValue;\n\n // The store.merge method allows either argument to be a string ID, but\n // the other argument has to be a StoreObject. Either way, newer fields\n // always take precedence over older fields.\n merge(olderId: string, newerObject: StoreObject): void;\n merge(olderObject: StoreObject, newerId: string): void;\n\n modify<Entity extends Record<string, any>>(\n dataId: string,\n fields: Modifiers<Entity> | AllFieldsModifier<Entity>,\n exact: boolean\n ): boolean;\n delete(dataId: string, fieldName?: string): boolean;\n clear(): void;\n\n // non-Map elements:\n /**\n * returns an Object with key-value pairs matching the contents of the store\n */\n toObject(): NormalizedCacheObject;\n /**\n * replace the state of the store\n */\n replace(newData: NormalizedCacheObject): void;\n\n /**\n * Retain (or release) a given root ID to protect (or expose) it and its\n * transitive child entities from (or to) garbage collection. The current\n * retainment count is returned by both methods. Note that releasing a root\n * ID does not cause that entity to be garbage collected, but merely removes\n * it from the set of root IDs that will be considered during the next\n * mark-and-sweep collection.\n */\n retain(rootId: string): number;\n release(rootId: string): number;\n\n getFieldValue: FieldValueGetter;\n toReference: ToReferenceFunction;\n canRead: CanReadFunction;\n\n getStorage(\n idOrObj: string | StoreObject,\n ...storeFieldNames: (string | number)[]\n ): StorageType;\n}\n\n/**\n * This is a normalized representation of the Apollo query result cache. It consists of\n * a flattened representation of query result trees.\n */\nexport interface NormalizedCacheObject {\n __META?: {\n // Well-known singleton IDs like ROOT_QUERY and ROOT_MUTATION are\n // always considered to be root IDs during cache.gc garbage\n // collection, but other IDs can become roots if they are written\n // directly with cache.writeFragment or retained explicitly with\n // cache.retain. When such IDs exist, we include them in the __META\n // section so that they can survive cache.{extract,restore}.\n extraRootIds: string[];\n };\n [dataId: string]: StoreObject | undefined;\n}\n\nexport type OptimisticStoreItem = {\n id: string;\n data: NormalizedCacheObject;\n transaction: Transaction;\n};\n\nexport type ReadQueryOptions = {\n /**\n * The Apollo Client store object.\n */\n store: NormalizedCache;\n /**\n * A parsed GraphQL query document.\n */\n query: DocumentNode;\n variables?: Object;\n previousResult?: any;\n rootId?: string;\n config?: ApolloReducerConfig;\n};\n\n/** @internal */\nexport interface DiffIncrementalInfo {\n streamInfo?: StreamInfoTrie;\n deferInfo?: DeferInfoTrie;\n}\n\nexport type DiffQueryAgainstStoreOptions = ReadQueryOptions & {\n returnPartialData?: boolean;\n};\n\nexport type ApolloReducerConfig = {\n dataIdFromObject?: KeyFieldsFunction;\n};\n\nexport interface InputObjectConfig {\n fields: Record<string, string>;\n}\n\nexport interface InputObjectsOption {\n [inputObjectName: string]: InputObjectConfig;\n}\n\nexport type InMemoryCacheConfig = ApolloReducerConfig & {\n resultCaching?: boolean;\n possibleTypes?: PossibleTypesMap;\n typePolicies?: TypePolicies;\n fragments?: FragmentRegistryAPI;\n inputObjects?: InputObjectsOption;\n} & ({} extends InMemoryCache.ScalarsOption ?\n InMemoryCache.ScalarsOption extends Record<string, never> ?\n {\n scalars?: Record<\n string,\n `Scalar types must be declared in ApolloCache.Scalars before usage. See https://www.apollographql.com/docs/react/data/typescript#declaring-scalar-types.`\n >;\n }\n : { scalars?: InMemoryCache.ScalarsOption }\n : { scalars: InMemoryCache.ScalarsOption });\n\nexport interface MergeInfo {\n field: FieldNode;\n typename: string | undefined;\n merge: FieldMergeFunction;\n path: Array<string | number>;\n}\n\nexport interface MergeTree {\n info?: MergeInfo;\n map: Map<string | number, MergeTree>;\n}\n\nexport interface ReadMergeModifyContext {\n store: NormalizedCache;\n variables?: OperationVariables;\n // A JSON.stringify-serialized version of context.variables.\n varString?: string;\n extensions?: ExtensionsWithStreamInfo;\n}\n\ntype ListOf<T extends string> = `[${T}]`;\n\ntype NestedScalarName<T extends string> =\n | T\n | ListOf<T>\n | ListOf<ListOf<T>>\n | ListOf<ListOf<ListOf<T>>>\n | ListOf<ListOf<ListOf<ListOf<T>>>>;\n\nexport type KnownScalars = RemoveIndexSignature<ApolloCache.Scalars>;\n\nexport type ScalarType =\n | NestedScalarName<keyof KnownScalars & string>\n | (string extends keyof ApolloCache.Scalars ? string & {} : never);\n"]}
@@ -68,7 +68,7 @@ export class StoreWriter {
68
68
  path: [],
69
69
  });
70
70
  if (!isReference(ref)) {
71
- throw newInvariantError(119, result);
71
+ throw newInvariantError(122, result);
72
72
  }
73
73
  // So far, the store has not been modified, so now it's time to process
74
74
  // context.incomingById and merge those incoming fields into context.store.
@@ -230,7 +230,7 @@ export class StoreWriter {
230
230
  // provide a default value, so its absence from the written data should
231
231
  // not be cause for alarm.
232
232
  !policies.getReadFunction(typename, field.name.value)) {
233
- invariant.error(120, resultKeyNameFromField(field), result);
233
+ invariant.error(123, resultKeyNameFromField(field), result);
234
234
  }
235
235
  });
236
236
  // Identify the result object, even if dataId was already provided,
@@ -378,7 +378,7 @@ export class StoreWriter {
378
378
  else {
379
379
  const fragment = getFragmentFromSelection(selection, context.lookupFragment);
380
380
  if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
381
- throw newInvariantError(121, selection.name.value);
381
+ throw newInvariantError(124, selection.name.value);
382
382
  }
383
383
  if (fragment &&
384
384
  policies.fragmentMatches(fragment, typename, result, context.variables)) {
@@ -550,7 +550,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
550
550
  }
551
551
  });
552
552
  }
553
- __DEV__ && invariant.warn(122, fieldName, parentType, childTypenames.length ?
553
+ __DEV__ && invariant.warn(125, fieldName, parentType, childTypenames.length ?
554
554
  "either ensure all objects of type " +
555
555
  childTypenames.join(" and ") +
556
556
  " have an ID or a custom merge function, or "
@@ -71,8 +71,8 @@ export class ApolloClient {
71
71
  */
72
72
  constructor(options) {
73
73
  if (__DEV__) {
74
- invariant(options.cache, 69);
75
- invariant(options.link, 70);
74
+ invariant(options.cache, 70);
75
+ invariant(options.link, 71);
76
76
  }
77
77
  const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], refetchEventManager, } = options;
78
78
  this.link = link;
@@ -260,12 +260,12 @@ export class ApolloClient {
260
260
  if (refetchOn) {
261
261
  const operationName = getOperationName(query, "(anonymous)");
262
262
  if (!refetchEventManager) {
263
- __DEV__ && invariant.warn(71, operationName);
263
+ __DEV__ && invariant.warn(72, operationName);
264
264
  }
265
265
  else if (typeof refetchOn === "object") {
266
266
  Object.keys(refetchOn).forEach((source) => {
267
267
  if (!refetchEventManager.hasSource(source)) {
268
- __DEV__ && invariant.warn(72, source, operationName);
268
+ __DEV__ && invariant.warn(73, source, operationName);
269
269
  }
270
270
  });
271
271
  }
@@ -287,13 +287,13 @@ export class ApolloClient {
287
287
  options = mergeOptions(this.defaultOptions.query, options);
288
288
  }
289
289
  if (__DEV__) {
290
- invariant(options.fetchPolicy !== "cache-and-network", 73);
291
- invariant(options.fetchPolicy !== "standby", 74);
292
- invariant(options.query, 75);
293
- invariant(options.query.kind === "Document", 76);
294
- invariant(!options.returnPartialData, 77);
295
- invariant(!options.pollInterval, 78);
296
- invariant(!options.notifyOnNetworkStatusChange, 79);
290
+ invariant(options.fetchPolicy !== "cache-and-network", 74);
291
+ invariant(options.fetchPolicy !== "standby", 75);
292
+ invariant(options.query, 76);
293
+ invariant(options.query.kind === "Document", 77);
294
+ invariant(!options.returnPartialData, 78);
295
+ invariant(!options.pollInterval, 79);
296
+ invariant(!options.notifyOnNetworkStatusChange, 80);
297
297
  }
298
298
  return this.queryManager.query(options);
299
299
  };
@@ -311,9 +311,9 @@ export class ApolloClient {
311
311
  errorPolicy: "none",
312
312
  }, this.defaultOptions.mutate), options);
313
313
  if (__DEV__) {
314
- invariant(optionsWithDefaults.mutation, 80);
314
+ invariant(optionsWithDefaults.mutation, 81);
315
315
  invariant(optionsWithDefaults.fetchPolicy === "network-only" ||
316
- optionsWithDefaults.fetchPolicy === "no-cache", 81);
316
+ optionsWithDefaults.fetchPolicy === "no-cache", 82);
317
317
  }
318
318
  checkDocument(optionsWithDefaults.mutation, OperationTypeNode.MUTATION);
319
319
  return this.queryManager.mutate(optionsWithDefaults);
@@ -519,7 +519,7 @@ export class ApolloClient {
519
519
  // result.queries and result.results instead, you shouldn't have to worry
520
520
  // about preventing uncaught rejections for the Promise.all result.
521
521
  result.catch((error) => {
522
- __DEV__ && invariant.debug(82, error);
522
+ __DEV__ && invariant.debug(83, error);
523
523
  });
524
524
  return result;
525
525
  }
@@ -102,7 +102,7 @@ export class ObservableQuery {
102
102
  // Make sure we don't store "standby" as the initialFetchPolicy.
103
103
  initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
104
104
  if (options[variablesUnknownSymbol]) {
105
- invariant(fetchPolicy === "standby", 83);
105
+ invariant(fetchPolicy === "standby", 84);
106
106
  this.variablesUnknown = true;
107
107
  }
108
108
  this.lastQuery = transformedQuery;
@@ -411,7 +411,7 @@ export class ObservableQuery {
411
411
  const queryDef = getQueryDefinition(this.query);
412
412
  const vars = queryDef.variableDefinitions;
413
413
  if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
414
- __DEV__ && invariant.warn(84, variables, queryDef.name?.value || queryDef);
414
+ __DEV__ && invariant.warn(85, variables, queryDef.name?.value || queryDef);
415
415
  }
416
416
  }
417
417
  if (variables && !equal(this.variables, variables)) {
@@ -426,7 +426,7 @@ export class ObservableQuery {
426
426
  fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
427
427
  invariant(
428
428
  this.options.fetchPolicy !== "cache-only",
429
- 85,
429
+ 86,
430
430
  getOperationName(this.query, "(anonymous)")
431
431
  );
432
432
  const combinedOptions = {
@@ -460,7 +460,7 @@ export class ObservableQuery {
460
460
  let wasUpdated = false;
461
461
  const isCached = this.options.fetchPolicy !== "no-cache";
462
462
  if (!isCached) {
463
- invariant(updateQuery, 86);
463
+ invariant(updateQuery, 87);
464
464
  }
465
465
  const { finalize, pushNotification } = this.pushOperation(NetworkStatus.fetchMore);
466
466
  pushNotification({
@@ -634,7 +634,7 @@ export class ObservableQuery {
634
634
  onError(error);
635
635
  }
636
636
  else {
637
- invariant.error(87, error);
637
+ invariant.error(88, error);
638
638
  }
639
639
  return;
640
640
  }
@@ -885,7 +885,7 @@ export class ObservableQuery {
885
885
  if (!this.didWarnCacheOnlyPolling &&
886
886
  pollInterval &&
887
887
  fetchPolicy === "cache-only") {
888
- __DEV__ && invariant.warn(88, getOperationName(this.query, "(anonymous)"));
888
+ __DEV__ && invariant.warn(89, getOperationName(this.query, "(anonymous)"));
889
889
  this.didWarnCacheOnlyPolling = true;
890
890
  }
891
891
  }
@@ -1511,7 +1511,7 @@ export class ObservableQuery {
1511
1511
  }
1512
1512
  export function logMissingFieldErrors(missing) {
1513
1513
  if (__DEV__ && missing) {
1514
- __DEV__ && invariant.debug(89, missing);
1514
+ __DEV__ && invariant.debug(90, missing);
1515
1515
  }
1516
1516
  }
1517
1517
  function isEqualQuery(a, b) {
@@ -1555,6 +1555,6 @@ function getTrackingOperatorPromise(defaultValue) {
1555
1555
  return { promise, operator };
1556
1556
  }
1557
1557
  function warnOnFeud(query, diff) {
1558
- __DEV__ && invariant.warn(90, getOperationName(query, "(anonymous)"), diff.missing?.missing);
1558
+ __DEV__ && invariant.warn(91, getOperationName(query, "(anonymous)"), diff.missing?.missing);
1559
1559
  }
1560
1560
  //# sourceMappingURL=ObservableQuery.js.map
package/core/QueryInfo.js CHANGED
@@ -363,7 +363,7 @@ export class QueryInfo {
363
363
  }
364
364
  function warnAboutPartialCacheResult(query, networkResult, diff) {
365
365
  __DEV__ && invariant.warn(
366
- 91,
366
+ 92,
367
367
  getOperationName(query, "(anonymous)"),
368
368
  diff.missing?.missing,
369
369
  networkResult,
@@ -99,7 +99,7 @@ export class QueryManager {
99
99
  */
100
100
  stop() {
101
101
  this.obsQueries.forEach((oq) => oq.stop());
102
- this.cancelPendingFetches(newInvariantError(92));
102
+ this.cancelPendingFetches(newInvariantError(93));
103
103
  }
104
104
  cancelPendingFetches(error) {
105
105
  this.fetchCancelFns.forEach((cancel) => cancel(error));
@@ -112,7 +112,7 @@ export class QueryManager {
112
112
  variables = this.getVariables(mutation, variables);
113
113
  if (hasClientExports) {
114
114
  if (__DEV__) {
115
- invariant(this.localState, 93, getOperationName(mutation, "(anonymous)"));
115
+ invariant(this.localState, 94, getOperationName(mutation, "(anonymous)"));
116
116
  }
117
117
  variables = await this.localState.getExportedVariables({
118
118
  client: this.client,
@@ -345,7 +345,7 @@ export class QueryManager {
345
345
  // depend on values that previously existed in the data portion of the
346
346
  // store. So, we cancel the promises and observers that we have issued
347
347
  // so far and not yet resolved (in the case of queries).
348
- this.cancelPendingFetches(newInvariantError(94));
348
+ this.cancelPendingFetches(newInvariantError(95));
349
349
  this.obsQueries.forEach((observableQuery) => {
350
350
  // Set loading to true so listeners don't trigger unless they want
351
351
  // results with partial data.
@@ -415,10 +415,10 @@ export class QueryManager {
415
415
  if (!included) {
416
416
  const queryName = queryNames.get(nameOrQueryString);
417
417
  if (queryName) {
418
- __DEV__ && invariant.warn(95, queryName);
418
+ __DEV__ && invariant.warn(96, queryName);
419
419
  }
420
420
  else {
421
- __DEV__ && invariant.warn(96);
421
+ __DEV__ && invariant.warn(97);
422
422
  }
423
423
  }
424
424
  });
@@ -447,7 +447,7 @@ export class QueryManager {
447
447
  if (__DEV__) {
448
448
  invariant(
449
449
  !this.getDocumentInfo(query).hasClientExports || this.localState,
450
- 97,
450
+ 98,
451
451
  getOperationName(query, "(anonymous)")
452
452
  );
453
453
  }
@@ -592,14 +592,14 @@ export class QueryManager {
592
592
  if (__DEV__) {
593
593
  invariant(
594
594
  this.localState,
595
- 98,
595
+ 99,
596
596
  operation[0].toUpperCase() + operation.slice(1),
597
597
  operationName ?? "(anonymous)"
598
598
  );
599
599
  }
600
600
  invariant(
601
601
  !hasIncrementalDirective,
602
- 99,
602
+ 100,
603
603
  operation[0].toUpperCase() + operation.slice(1),
604
604
  operationName ?? "(anonymous)"
605
605
  );
@@ -767,7 +767,7 @@ export class QueryManager {
767
767
  // we deprecated and removed LocalState.
768
768
  if (this.getDocumentInfo(normalized.query).hasClientExports) {
769
769
  if (__DEV__) {
770
- invariant(this.localState, 100, getOperationName(normalized.query, "(anonymous)"));
770
+ invariant(this.localState, 101, getOperationName(normalized.query, "(anonymous)"));
771
771
  }
772
772
  observable = from(this.localState.getExportedVariables({
773
773
  client: this.client,
@@ -940,7 +940,7 @@ export class QueryManager {
940
940
  !isFullyUnmaskedOperation(document) &&
941
941
  !this.noCacheWarningsByCause.has(cause)) {
942
942
  this.noCacheWarningsByCause.add(cause);
943
- __DEV__ && invariant.warn(101, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
943
+ __DEV__ && invariant.warn(102, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
944
944
  }
945
945
  }
946
946
  return (this.dataMasking ?
@@ -1003,7 +1003,7 @@ export class QueryManager {
1003
1003
  (diff.complete || returnPartialData) &&
1004
1004
  this.getDocumentInfo(query).hasForcedResolvers) {
1005
1005
  if (__DEV__) {
1006
- invariant(this.localState, 102, getOperationName(query, "(anonymous)"));
1006
+ invariant(this.localState, 103, getOperationName(query, "(anonymous)"));
1007
1007
  }
1008
1008
  onCacheHit();
1009
1009
  return from(this.localState.execute({
@@ -1124,7 +1124,7 @@ function validateDidEmitValue() {
1124
1124
  didEmitValue = true;
1125
1125
  },
1126
1126
  complete() {
1127
- invariant(didEmitValue, 103);
1127
+ invariant(didEmitValue, 104);
1128
1128
  },
1129
1129
  });
1130
1130
  }
@@ -27,7 +27,7 @@ export class RefetchEventManager {
27
27
  }
28
28
  if (this.client) {
29
29
  if (__DEV__) {
30
- __DEV__ && invariant.warn(104);
30
+ __DEV__ && invariant.warn(105);
31
31
  }
32
32
  this.disconnect();
33
33
  }
@@ -96,13 +96,13 @@ export class RefetchEventManager {
96
96
  const [payload] = args;
97
97
  if (!this.client) {
98
98
  if (__DEV__) {
99
- __DEV__ && invariant.warn(105, source);
99
+ __DEV__ && invariant.warn(106, source);
100
100
  }
101
101
  return;
102
102
  }
103
103
  if (!this.hasSource(source)) {
104
104
  if (__DEV__) {
105
- __DEV__ && invariant.warn(106, source);
105
+ __DEV__ && invariant.warn(107, source);
106
106
  }
107
107
  return;
108
108
  }
package/core/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, RefetchWritePolicy,
8
8
  export { NetworkStatus } from "./networkStatus.js";
9
9
  export type { DataState, DataValue, DefaultContext, ErrorLike, GetDataState, InternalRefetchQueriesInclude, InternalRefetchQueriesMap, InternalRefetchQueriesOptions, InternalRefetchQueriesResult, InternalRefetchQueryDescriptor, MutationQueryReducer, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchEvents, RefetchOn, RefetchQueriesInclude, RefetchQueriesPromiseResults, RefetchQueryDescriptor, SubscriptionObservable, TypedDocumentNode, TypeOverrides, } from "./types.js";
10
10
  export { CombinedGraphQLErrors, CombinedProtocolErrors, LinkError, LocalStateError, ServerError, ServerParseError, UnconventionalError, } from "@apollo/client/errors";
11
- export type { ApolloReducerConfig, Cache, DiffQueryAgainstStoreOptions, FieldFunctionOptions, FieldMergeFunction, FieldPolicy, FieldReadFunction, IdGetter, IdGetterObj, InMemoryCacheConfig, InputObjectConfig, InputObjectsOption, MergeInfo, MergeTree, NormalizedCache, NormalizedCacheObject, OptimisticStoreItem, PossibleTypesMap, ReactiveVar, ReadMergeModifyContext, ReadQueryOptions, StoreValue, Transaction, TypePolicies, TypePolicy, WatchFragmentOptions, WatchFragmentResult, } from "@apollo/client/cache";
11
+ export type { ApolloReducerConfig, Cache, DiffQueryAgainstStoreOptions, FieldFunctionOptions, FieldMergeFunction, FieldPolicy, FieldReadFunction, IdGetter, IdGetterObj, InMemoryCacheConfig, InputObjectConfig, InputObjectsOption, MergeInfo, MergeTree, NormalizedCache, NormalizedCacheObject, OptimisticStoreItem, PossibleTypesMap, ReactiveVar, ReadMergeModifyContext, ReadQueryOptions, ScalarType, StoreValue, Transaction, TypePolicies, TypePolicy, WatchFragmentOptions, WatchFragmentResult, } from "@apollo/client/cache";
12
12
  export { ApolloCache, defaultDataIdFromObject, InMemoryCache, makeVar, MissingFieldError, Scalar, } from "@apollo/client/cache";
13
13
  export { ApolloLink, concat, empty, execute, from, split, } from "@apollo/client/link";
14
14
  export type { ApolloPayloadResult, DocumentNode, FetchResult, GraphQLRequest, Operation, RequestHandler, } from "@apollo/client/link";
@@ -23,6 +23,7 @@ export { disableExperimentalFragmentVariables, disableFragmentWarnings, enableEx
23
23
  export { build, version } from "../version.js";
24
24
  import type { DefaultOptionsParentObject, PossibleDefaultOptions } from "./defaultOptions.js";
25
25
  import type { QueryManager } from "./QueryManager.js";
26
+ import type { OverridableTypes } from "./types.js";
26
27
  import type { NextFetchPolicyContext } from "./watchQueryOptions.js";
27
28
  /**
28
29
  * @internal
@@ -30,6 +31,6 @@ import type { NextFetchPolicyContext } from "./watchQueryOptions.js";
30
31
  * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
31
32
  */
32
33
  export declare namespace InternalTypes {
33
- export type { DefaultOptionsParentObject, NextFetchPolicyContext, PossibleDefaultOptions, QueryManager, };
34
+ export type { DefaultOptionsParentObject, NextFetchPolicyContext, OverridableTypes, PossibleDefaultOptions, QueryManager, };
34
35
  }
35
36
  //# sourceMappingURL=index.d.ts.map
package/core/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,UAAU;AAgBV,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAY1E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA2BnD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAmC/B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAE9B,UAAU;AAEV,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,GACN,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB;AACxB,uEAAuE;AACvE,gCAAgC,EAChC,SAAS,GACV,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,EACL,iBAAiB;AACjB,2FAA2F;AAC3F,uBAAuB,EACvB,WAAW,EACX,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,gBAAgB;AAEhB,yEAAyE;AACzE,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErF,0DAA0D;AAC1D,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,yCAAyC;AACzC,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,qEAAqE;AACrE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EACL,oCAAoC,EACpC,uBAAuB,EACvB,mCAAmC,EACnC,GAAG,EACH,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/* Core */\n\nexport type {\n ApolloClientOptions,\n ApolloQueryResult,\n DefaultOptions,\n DevtoolsOptions,\n MutateResult,\n MutationOptions,\n QueryOptions,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n SubscribeToMoreOptions,\n SubscriptionOptions,\n WatchQueryOptions,\n} from \"./deprecated.js\";\nexport { ApolloClient } from \"./ApolloClient.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport { RefetchEventManager } from \"./RefetchEventManager.js\";\nexport { onlineSource } from \"./refetchSources/onlineSource.js\";\nexport { windowFocusSource } from \"./refetchSources/windowFocusSource.js\";\nexport type {\n ErrorPolicy,\n FetchPolicy,\n MutationFetchPolicy,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n SubscribeToMoreUpdateQueryFn,\n UpdateQueryMapFn,\n UpdateQueryOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\nexport { NetworkStatus } from \"./networkStatus.js\";\nexport type {\n DataState,\n DataValue,\n DefaultContext,\n ErrorLike,\n GetDataState,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesMap,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueryDescriptor,\n MutationQueryReducer,\n MutationQueryReducersMap,\n MutationUpdaterFunction,\n NormalizedExecutionResult,\n OnQueryUpdated,\n OperationVariables,\n RefetchEvents,\n RefetchOn,\n RefetchQueriesInclude,\n RefetchQueriesPromiseResults,\n RefetchQueryDescriptor,\n SubscriptionObservable,\n TypedDocumentNode,\n TypeOverrides,\n} from \"./types.js\";\nexport {\n CombinedGraphQLErrors,\n CombinedProtocolErrors,\n LinkError,\n LocalStateError,\n ServerError,\n ServerParseError,\n UnconventionalError,\n} from \"@apollo/client/errors\";\n/* Cache */\n\nexport type {\n ApolloReducerConfig,\n Cache,\n DiffQueryAgainstStoreOptions,\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldPolicy,\n FieldReadFunction,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n InputObjectConfig,\n InputObjectsOption,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n PossibleTypesMap,\n ReactiveVar,\n ReadMergeModifyContext,\n ReadQueryOptions,\n StoreValue,\n // All the exports (types) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Transaction,\n TypePolicies,\n TypePolicy,\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"@apollo/client/cache\";\n\nexport {\n ApolloCache,\n defaultDataIdFromObject,\n InMemoryCache,\n makeVar,\n MissingFieldError,\n Scalar,\n} from \"@apollo/client/cache\";\n\n/* Link */\n\nexport {\n ApolloLink,\n concat,\n empty,\n execute,\n from,\n split,\n} from \"@apollo/client/link\";\nexport type {\n ApolloPayloadResult,\n DocumentNode,\n FetchResult,\n GraphQLRequest,\n Operation,\n RequestHandler,\n} from \"@apollo/client/link\";\n\nexport {\n checkFetcher,\n createHttpLink,\n createSignalIfSupported,\n defaultPrinter,\n fallbackHttpConfig,\n HttpLink,\n parseAndCheckHttpResponse,\n rewriteURIForGET,\n selectHttpOptionsAndBody,\n // TODO remove: needed by @apollo/client/link/batch-http but not public\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\n\n/* Masking */\nexport type {\n FragmentType,\n MaybeMasked,\n Unmasked,\n} from \"@apollo/client/masking\";\n\n/* Utilities */\n\nexport type {\n DocumentTransformCacheKey,\n Reference,\n StoreObject,\n} from \"@apollo/client/utilities\";\nexport {\n DocumentTransform,\n /** @deprecated Please import `isNetworkRequestSettled` from `@apollo/client/utilities`. */\n isNetworkRequestSettled,\n isReference,\n Observable,\n} from \"@apollo/client/utilities\";\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// by passing \"log\", \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nexport { setVerbosity as setLogVerbosity } from \"@apollo/client/utilities/invariant\";\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n disableExperimentalFragmentVariables,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n gql,\n resetCaches,\n} from \"graphql-tag\";\nexport { build, version } from \"../version.js\";\n\n// internal types\nimport type {\n DefaultOptionsParentObject,\n PossibleDefaultOptions,\n} from \"./defaultOptions.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\nimport type { NextFetchPolicyContext } from \"./watchQueryOptions.js\";\n/** @internal */\nexport declare namespace InternalTypes {\n export type {\n DefaultOptionsParentObject,\n NextFetchPolicyContext,\n PossibleDefaultOptions,\n QueryManager,\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,UAAU;AAgBV,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAY1E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA2BnD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAoC/B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAE9B,UAAU;AAEV,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,GACN,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB;AACxB,uEAAuE;AACvE,gCAAgC,EAChC,SAAS,GACV,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,EACL,iBAAiB;AACjB,2FAA2F;AAC3F,uBAAuB,EACvB,WAAW,EACX,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,gBAAgB;AAEhB,yEAAyE;AACzE,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErF,0DAA0D;AAC1D,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,yCAAyC;AACzC,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,qEAAqE;AACrE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EACL,oCAAoC,EACpC,uBAAuB,EACvB,mCAAmC,EACnC,GAAG,EACH,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/* Core */\n\nexport type {\n ApolloClientOptions,\n ApolloQueryResult,\n DefaultOptions,\n DevtoolsOptions,\n MutateResult,\n MutationOptions,\n QueryOptions,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n SubscribeToMoreOptions,\n SubscriptionOptions,\n WatchQueryOptions,\n} from \"./deprecated.js\";\nexport { ApolloClient } from \"./ApolloClient.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport { RefetchEventManager } from \"./RefetchEventManager.js\";\nexport { onlineSource } from \"./refetchSources/onlineSource.js\";\nexport { windowFocusSource } from \"./refetchSources/windowFocusSource.js\";\nexport type {\n ErrorPolicy,\n FetchPolicy,\n MutationFetchPolicy,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n SubscribeToMoreUpdateQueryFn,\n UpdateQueryMapFn,\n UpdateQueryOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\nexport { NetworkStatus } from \"./networkStatus.js\";\nexport type {\n DataState,\n DataValue,\n DefaultContext,\n ErrorLike,\n GetDataState,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesMap,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueryDescriptor,\n MutationQueryReducer,\n MutationQueryReducersMap,\n MutationUpdaterFunction,\n NormalizedExecutionResult,\n OnQueryUpdated,\n OperationVariables,\n RefetchEvents,\n RefetchOn,\n RefetchQueriesInclude,\n RefetchQueriesPromiseResults,\n RefetchQueryDescriptor,\n SubscriptionObservable,\n TypedDocumentNode,\n TypeOverrides,\n} from \"./types.js\";\nexport {\n CombinedGraphQLErrors,\n CombinedProtocolErrors,\n LinkError,\n LocalStateError,\n ServerError,\n ServerParseError,\n UnconventionalError,\n} from \"@apollo/client/errors\";\n/* Cache */\n\nexport type {\n ApolloReducerConfig,\n Cache,\n DiffQueryAgainstStoreOptions,\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldPolicy,\n FieldReadFunction,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n InputObjectConfig,\n InputObjectsOption,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n PossibleTypesMap,\n ReactiveVar,\n ReadMergeModifyContext,\n ReadQueryOptions,\n ScalarType,\n StoreValue,\n // All the exports (types) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Transaction,\n TypePolicies,\n TypePolicy,\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"@apollo/client/cache\";\n\nexport {\n ApolloCache,\n defaultDataIdFromObject,\n InMemoryCache,\n makeVar,\n MissingFieldError,\n Scalar,\n} from \"@apollo/client/cache\";\n\n/* Link */\n\nexport {\n ApolloLink,\n concat,\n empty,\n execute,\n from,\n split,\n} from \"@apollo/client/link\";\nexport type {\n ApolloPayloadResult,\n DocumentNode,\n FetchResult,\n GraphQLRequest,\n Operation,\n RequestHandler,\n} from \"@apollo/client/link\";\n\nexport {\n checkFetcher,\n createHttpLink,\n createSignalIfSupported,\n defaultPrinter,\n fallbackHttpConfig,\n HttpLink,\n parseAndCheckHttpResponse,\n rewriteURIForGET,\n selectHttpOptionsAndBody,\n // TODO remove: needed by @apollo/client/link/batch-http but not public\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\n\n/* Masking */\nexport type {\n FragmentType,\n MaybeMasked,\n Unmasked,\n} from \"@apollo/client/masking\";\n\n/* Utilities */\n\nexport type {\n DocumentTransformCacheKey,\n Reference,\n StoreObject,\n} from \"@apollo/client/utilities\";\nexport {\n DocumentTransform,\n /** @deprecated Please import `isNetworkRequestSettled` from `@apollo/client/utilities`. */\n isNetworkRequestSettled,\n isReference,\n Observable,\n} from \"@apollo/client/utilities\";\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// by passing \"log\", \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nexport { setVerbosity as setLogVerbosity } from \"@apollo/client/utilities/invariant\";\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n disableExperimentalFragmentVariables,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n gql,\n resetCaches,\n} from \"graphql-tag\";\nexport { build, version } from \"../version.js\";\n\n// internal types\nimport type {\n DefaultOptionsParentObject,\n PossibleDefaultOptions,\n} from \"./defaultOptions.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\nimport type { OverridableTypes } from \"./types.js\";\nimport type { NextFetchPolicyContext } from \"./watchQueryOptions.js\";\n/** @internal */\nexport declare namespace InternalTypes {\n export type {\n DefaultOptionsParentObject,\n NextFetchPolicyContext,\n OverridableTypes,\n PossibleDefaultOptions,\n QueryManager,\n };\n}\n"]}
package/core/types.d.ts CHANGED
@@ -2,19 +2,20 @@ import type { DocumentNode, FormattedExecutionResult } from "graphql";
2
2
  import type { NextNotification, Observable, ObservableNotification } from "rxjs";
3
3
  import type { Cache } from "@apollo/client/cache";
4
4
  import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
5
- import type { Unmasked } from "@apollo/client/masking";
6
- import type { DeepPartial, HKT } from "@apollo/client/utilities";
5
+ import type { FragmentType, Unmasked } from "@apollo/client/masking";
6
+ import type { DeepPartial, HKT, Reference, StoreObject } from "@apollo/client/utilities";
7
7
  import type { ApplyHKTImplementationWithDefault, IsAny } from "@apollo/client/utilities/internal";
8
8
  import type { ApolloClient } from "./ApolloClient.js";
9
9
  import type { ObservableQuery } from "./ObservableQuery.js";
10
10
  export type { TypedDocumentNode } from "@graphql-typed-document-node/core";
11
11
  export interface TypeOverrides {
12
12
  }
13
- declare namespace OverridableTypes {
13
+ export declare namespace OverridableTypes {
14
14
  interface Defaults {
15
15
  Complete: Complete;
16
16
  Streaming: Streaming;
17
17
  Partial: Partial;
18
+ FromOptionValue: FromOptionValue;
18
19
  }
19
20
  interface Complete extends HKT {
20
21
  arg1: unknown;
@@ -28,6 +29,10 @@ declare namespace OverridableTypes {
28
29
  arg1: unknown;
29
30
  return: DeepPartial<this["arg1"]>;
30
31
  }
32
+ interface FromOptionValue extends HKT {
33
+ arg1: unknown;
34
+ return: StoreObject | Reference | FragmentType<NoInfer<this["arg1"]>> | string;
35
+ }
31
36
  }
32
37
  export declare namespace DataValue {
33
38
  /**
@@ -304,7 +309,7 @@ export type MutationQueryReducersMap<T = {
304
309
  };
305
310
  export type MutationUpdaterFunction<TData, TVariables extends OperationVariables, TCache extends Cache.Implementation> = (cache: TCache, result: FormattedExecutionResult<Unmasked<TData>>, options: {
306
311
  context?: DefaultContext;
307
- variables?: TVariables;
312
+ variables: TVariables;
308
313
  }) => void;
309
314
  export declare namespace QueryNotification {
310
315
  type NewNetworkStatus = NextNotification<{
package/core/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { Unmasked } from \"@apollo/client/masking\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\ndeclare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\nexport interface RefetchEvents {\n windowFocus: Event;\n online: Event;\n}\n\nexport declare namespace RefetchOn {\n export type Context<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n\n export type Callback<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (context: RefetchOn.Context<TSource>) => boolean;\n\n export type Option =\n | boolean\n | RefetchOn.Callback<keyof RefetchEvents>\n | {\n [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;\n };\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends Cache.Implementation,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends Cache.Implementation,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables?: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n resolvedVariables?: OperationVariables;\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n resolvedVariables?: OperationVariables;\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { FragmentType, Unmasked } from \"@apollo/client/masking\";\nimport type {\n DeepPartial,\n HKT,\n Reference,\n StoreObject,\n} from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\nexport declare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n FromOptionValue: FromOptionValue;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n\n interface FromOptionValue extends HKT {\n arg1: unknown; // TData\n return:\n | StoreObject\n | Reference\n | FragmentType<NoInfer<this[\"arg1\"]>>\n | string;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\nexport interface RefetchEvents {\n windowFocus: Event;\n online: Event;\n}\n\nexport declare namespace RefetchOn {\n export type Context<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n\n export type Callback<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (context: RefetchOn.Context<TSource>) => boolean;\n\n export type Option =\n | boolean\n | RefetchOn.Callback<keyof RefetchEvents>\n | {\n [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;\n };\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends Cache.Implementation,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends Cache.Implementation,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n resolvedVariables?: OperationVariables;\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n resolvedVariables?: OperationVariables;\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}
@@ -67,7 +67,7 @@ class IncrementalRequest {
67
67
  if (hasIncrementalChunks(chunk)) {
68
68
  for (const incremental of chunk.incremental) {
69
69
  const pending = this.pendingMap.get(incremental.id);
70
- invariant(pending, 67);
70
+ invariant(pending, 68);
71
71
  const path = pending.path.concat(incremental.subPath ?? []);
72
72
  let data;
73
73
  if ("items" in incremental) {
@@ -5,7 +5,7 @@ export class NotImplementedHandler {
5
5
  return false;
6
6
  }
7
7
  prepareRequest(request) {
8
- invariant(!hasDirectives(["defer", "stream"], request.query), 68);
8
+ invariant(!hasDirectives(["defer", "stream"], request.query), 69);
9
9
  return request;
10
10
  }
11
11
  extractErrors() { }