@apollo/client 4.1.0-alpha.6 → 4.1.0-alpha.8

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 (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/__cjs/cache/core/cache.cjs +8 -7
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +9 -8
  5. package/__cjs/cache/core/types/Cache.d.cts +40 -18
  6. package/__cjs/core/ApolloClient.cjs.map +1 -1
  7. package/__cjs/core/ApolloClient.d.cts +42 -18
  8. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +13 -1
  9. package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
  10. package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
  11. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  12. package/__cjs/react/hooks/useFragment.d.cts +4 -4
  13. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  14. package/__cjs/react/hooks/useSuspenseFragment.d.cts +6 -6
  15. package/__cjs/version.cjs +1 -1
  16. package/cache/core/cache.d.ts +9 -8
  17. package/cache/core/cache.js +8 -7
  18. package/cache/core/cache.js.map +1 -1
  19. package/cache/core/types/Cache.d.ts +40 -18
  20. package/cache/core/types/Cache.js.map +1 -1
  21. package/core/ApolloClient.d.ts +42 -18
  22. package/core/ApolloClient.js.map +1 -1
  23. package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
  24. package/link/client-awareness/ClientAwarenessLink.js +13 -1
  25. package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
  26. package/package.json +1 -1
  27. package/react/hooks/useFragment.d.ts +4 -4
  28. package/react/hooks/useFragment.js.map +1 -1
  29. package/react/hooks/useSuspenseFragment.d.ts +6 -6
  30. package/react/hooks/useSuspenseFragment.js.map +1 -1
  31. package/react/hooks-compiled/useFragment.d.ts +4 -4
  32. package/react/hooks-compiled/useFragment.js.map +1 -1
  33. package/react/hooks-compiled/useSuspenseFragment.d.ts +6 -6
  34. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  35. package/version.js +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { DocumentNode } from "graphql";
2
2
  import type { Observable } from "rxjs";
3
- import type { ApolloCache, IgnoreModifier, Reference } from "@apollo/client/cache";
3
+ import type { ApolloCache, Cache, IgnoreModifier, Reference } from "@apollo/client/cache";
4
4
  import type { Incremental } from "@apollo/client/incremental";
5
5
  import type { ApolloLink } from "@apollo/client/link";
6
6
  import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
@@ -522,12 +522,6 @@ export declare namespace ApolloClient {
522
522
  }
523
523
  namespace Base {
524
524
  interface ReadFragmentOptions<TData, TVariables extends OperationVariables> {
525
- /**
526
- * The root id to be used. This id should take the same form as the
527
- * value returned by the `cache.identify` function. If a value with your
528
- * id does not exist in the store, `null` will be returned.
529
- */
530
- id?: string;
531
525
  /**
532
526
  * A GraphQL document created using the `gql` template string tag
533
527
  * with one or more fragments which will be used to determine
@@ -556,7 +550,27 @@ export declare namespace ApolloClient {
556
550
  optimistic?: boolean;
557
551
  }
558
552
  }
559
- type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
553
+ namespace DocumentationTypes {
554
+ interface ReadFragmentOptions<TData, TVariables extends OperationVariables> extends Base.ReadFragmentOptions<TData, TVariables> {
555
+ /**
556
+ * The root id to be used. This id should take the same form as the
557
+ * value returned by the `cache.identify` function. If a value with your
558
+ * id does not exist in the store, `null` will be returned.
559
+ */
560
+ id?: string;
561
+ /**
562
+ * An object containing a `__typename` and primary key fields
563
+ * (such as `id`) identifying the entity object from which the fragment will
564
+ * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
565
+ * (uncommon).
566
+ *
567
+ * @remarks
568
+ * `from` is given precedence over `id` when both are provided.
569
+ */
570
+ from?: ApolloCache.FromOptionValue<TData>;
571
+ }
572
+ }
573
+ type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
560
574
  namespace DocumentationTypes {
561
575
  interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
562
576
  /**
@@ -607,12 +621,6 @@ export declare namespace ApolloClient {
607
621
  }
608
622
  namespace Base {
609
623
  interface WriteFragmentOptions<TData, TVariables extends OperationVariables> {
610
- /**
611
- * The root id to be used. This id should take the same form as the
612
- * value returned by the `cache.identify` function. If a value with your
613
- * id does not exist in the store, `null` will be returned.
614
- */
615
- id?: string;
616
624
  /**
617
625
  * A GraphQL document created using the `gql` template string tag from
618
626
  * `graphql-tag` with one or more fragments which will be used to determine
@@ -644,9 +652,25 @@ export declare namespace ApolloClient {
644
652
  overwrite?: boolean;
645
653
  }
646
654
  }
647
- type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables>;
655
+ type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
648
656
  namespace DocumentationTypes {
649
657
  interface WriteFragmentOptions<TData, TVariables extends OperationVariables> extends Base.WriteFragmentOptions<TData, TVariables> {
658
+ /**
659
+ * The root id to be used. This id should take the same form as the
660
+ * value returned by the `cache.identify` function. If a value with your
661
+ * id does not exist in the store, `null` will be returned.
662
+ */
663
+ id?: string;
664
+ /**
665
+ * An object containing a `__typename` and primary key fields
666
+ * (such as `id`) identifying the entity object from which the fragment will
667
+ * be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID
668
+ * (uncommon).
669
+ *
670
+ * @remarks
671
+ * `from` is given precedence over `id` when both are provided.
672
+ */
673
+ from?: ApolloCache.FromOptionValue<TData>;
650
674
  /**
651
675
  * Any variables that your GraphQL fragments depend on.
652
676
  */
@@ -830,7 +854,7 @@ export declare class ApolloClient {
830
854
  * to optimistic updates.
831
855
  */
832
856
  watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
833
- from: Array<NonNullable<ApolloCache.WatchFragmentFromValue<TData>>>;
857
+ from: Array<ApolloCache.FromOptionValue<TData>>;
834
858
  }): ApolloClient.ObservableFragment<Array<TData>>;
835
859
  /**
836
860
  * Watches the cache store of the fragment according to the options specified
@@ -852,7 +876,7 @@ export declare class ApolloClient {
852
876
  from: Array<null>;
853
877
  }): ApolloClient.ObservableFragment<Array<null>>;
854
878
  watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
855
- from: Array<ApolloCache.WatchFragmentFromValue<TData>>;
879
+ from: Array<ApolloCache.FromOptionValue<TData> | null>;
856
880
  }): ApolloClient.ObservableFragment<Array<TData | null>>;
857
881
  /**
858
882
  * Watches the cache store of the fragment according to the options specified
@@ -890,7 +914,7 @@ export declare class ApolloClient {
890
914
  * to optimistic updates.
891
915
  */
892
916
  watchFragment<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchFragmentOptions<TData, TVariables> & {
893
- from: NonNullable<ApolloCache.WatchFragmentFromValue<TData>>;
917
+ from: ApolloCache.FromOptionValue<TData>;
894
918
  }): ApolloClient.ObservableFragment<TData>;
895
919
  /**
896
920
  * Watches the cache store of the fragment according to the options specified