@khanacademy/wonder-blocks-data 6.0.1 → 8.0.0

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 (56) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/es/index.js +329 -777
  3. package/dist/index.js +1196 -834
  4. package/package.json +3 -3
  5. package/src/__docs__/_overview_ssr_.stories.mdx +13 -13
  6. package/src/__docs__/exports.abort-inflight-requests.stories.mdx +20 -0
  7. package/src/__docs__/exports.data.stories.mdx +3 -3
  8. package/src/__docs__/{exports.fulfill-all-data-requests.stories.mdx → exports.fetch-tracked-requests.stories.mdx} +5 -5
  9. package/src/__docs__/exports.get-gql-request-id.stories.mdx +24 -0
  10. package/src/__docs__/{exports.has-unfulfilled-requests.stories.mdx → exports.has-tracked-requests-to-be-fetched.stories.mdx} +4 -4
  11. package/src/__docs__/exports.intialize-hydration-cache.stories.mdx +29 -0
  12. package/src/__docs__/exports.purge-caches.stories.mdx +23 -0
  13. package/src/__docs__/{exports.remove-all-from-cache.stories.mdx → exports.purge-hydration-cache.stories.mdx} +4 -4
  14. package/src/__docs__/{exports.clear-shared-cache.stories.mdx → exports.purge-shared-cache.stories.mdx} +4 -4
  15. package/src/__docs__/exports.track-data.stories.mdx +4 -4
  16. package/src/__docs__/exports.use-cached-effect.stories.mdx +7 -4
  17. package/src/__docs__/exports.use-gql.stories.mdx +1 -33
  18. package/src/__docs__/exports.use-server-effect.stories.mdx +14 -2
  19. package/src/__docs__/exports.use-shared-cache.stories.mdx +2 -2
  20. package/src/__docs__/types.fetch-policy.stories.mdx +44 -0
  21. package/src/__docs__/types.response-cache.stories.mdx +1 -1
  22. package/src/__tests__/generated-snapshot.test.js +5 -5
  23. package/src/components/__tests__/data.test.js +2 -6
  24. package/src/hooks/__tests__/use-cached-effect.test.js +341 -100
  25. package/src/hooks/__tests__/use-hydratable-effect.test.js +17 -34
  26. package/src/hooks/__tests__/use-server-effect.test.js +51 -0
  27. package/src/hooks/__tests__/use-shared-cache.test.js +6 -6
  28. package/src/hooks/use-cached-effect.js +169 -93
  29. package/src/hooks/use-hydratable-effect.js +12 -12
  30. package/src/hooks/use-server-effect.js +30 -5
  31. package/src/hooks/use-shared-cache.js +2 -2
  32. package/src/index.js +14 -78
  33. package/src/util/__tests__/get-gql-request-id.test.js +74 -0
  34. package/src/util/__tests__/graphql-document-node-parser.test.js +542 -0
  35. package/src/util/__tests__/hydration-cache-api.test.js +35 -0
  36. package/src/util/__tests__/purge-caches.test.js +29 -0
  37. package/src/util/__tests__/request-api.test.js +188 -0
  38. package/src/util/__tests__/request-fulfillment.test.js +42 -0
  39. package/src/util/__tests__/ssr-cache.test.js +10 -60
  40. package/src/util/__tests__/to-gql-operation.test.js +42 -0
  41. package/src/util/data-error.js +6 -0
  42. package/src/util/get-gql-request-id.js +50 -0
  43. package/src/util/graphql-document-node-parser.js +133 -0
  44. package/src/util/graphql-types.js +30 -0
  45. package/src/util/hydration-cache-api.js +28 -0
  46. package/src/util/purge-caches.js +15 -0
  47. package/src/util/request-api.js +66 -0
  48. package/src/util/request-fulfillment.js +32 -12
  49. package/src/util/request-tracking.js +1 -1
  50. package/src/util/ssr-cache.js +1 -21
  51. package/src/util/to-gql-operation.js +44 -0
  52. package/src/util/types.js +31 -0
  53. package/src/__docs__/exports.intialize-cache.stories.mdx +0 -29
  54. package/src/__docs__/exports.remove-from-cache.stories.mdx +0 -25
  55. package/src/__docs__/exports.request-fulfillment.stories.mdx +0 -36
  56. package/src/util/abort-error.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @khanacademy/wonder-blocks-data
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 0720470e: Renamed `initializeCache` to `initializeHydrationCache`, deleted `removeFromCache`, renamed `removeAllFromCache` to `purgeHydrationCache`
8
+ - cf9ed87f: Add `fetchPolicy` to `useCachedEffect` options, add `refetch` to `useCachedEffect` return value (return value is now a tuple of [result, refetch]), add abort API to request fulfillment (not truly aborting though)
9
+ - b882b082: Stop exporting `RequestFulfillment`, update `useCachedEffect` to consider scope with sharing inflight requests
10
+ - 0720470e: Rename `fulfillAllDataRequests` to `fetchTrackedRequests`, rename `hasUnfulfilledRequests` to `hasTrackedRequestsToBeFetched`
11
+ - 0720470e: Renamed `clearSharedCache` to `purgeSharedCache`
12
+
13
+ ### Minor Changes
14
+
15
+ - 0720470e: Add `purgeCaches` export for purging all caches with one call
16
+ - 75c10036: Add `abortInflightRequests` to exports
17
+ - a85f2f3a: Provide `getGqlRequestId` function
18
+
19
+ ### Patch Changes
20
+
21
+ - 1385f468: Removed unnecessary `new` on tracking context creation
22
+
23
+ ## 7.0.1
24
+
25
+ ### Patch Changes
26
+
27
+ - @khanacademy/wonder-blocks-core@4.3.1
28
+
29
+ ## 7.0.0
30
+
31
+ ### Major Changes
32
+
33
+ - 34407c4a: `useServerEffect` now has a `skip` option, preventing the request from getting tracked for server-side fulfillment
34
+
3
35
  ## 6.0.1
4
36
 
5
37
  ### Patch Changes