apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.38k stars 2.66k forks source link

[Data masking] Provide way to opt-in to data masking via the cache #11862

Closed jerelmiller closed 6 months ago

jerelmiller commented 6 months ago

Partially addresses #11672

Add interfaces to the Cache abstract class that allows a cache to opt-in to data masking. Data masking requires a fragmentMatches function that accepts an inline fragment and a typename and returns a boolean. This will be used by the mask function to determine if a type condition matches when selecting against an interface or union type.

This function is optional in order to provide backwards compatibility. If this function is not provided by the subclass, this effectively disables data masking and the data will be returned unchanged with a warning emitted.

changeset-bot[bot] commented 6 months ago

⚠️ No Changeset found

Latest commit: 62d1735938e8dfd503ded343951d985d262c6772

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

github-actions[bot] commented 6 months ago

size-limit report 📦

Path Size
dist/apollo-client.min.cjs 38.89 KB (+0.64% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" 47.69 KB (+0.58% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/main.cjs" (production) 45.25 KB (+0.58% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" 34.49 KB (+0.86% 🔺)
import { ApolloClient, InMemoryCache, HttpLink } from "dist/index.js" (production) 32.34 KB (+0.91% 🔺)
import { ApolloProvider } from "dist/react/index.js" 1.23 KB (0%)
import { ApolloProvider } from "dist/react/index.js" (production) 1.22 KB (0%)
import { useQuery } from "dist/react/index.js" 5.28 KB (-0.02% 🔽)
import { useQuery } from "dist/react/index.js" (production) 4.36 KB (0%)
import { useLazyQuery } from "dist/react/index.js" 5.52 KB (-0.02% 🔽)
import { useLazyQuery } from "dist/react/index.js" (production) 4.6 KB (+0.03% 🔺)
import { useMutation } from "dist/react/index.js" 3.52 KB (-0.03% 🔽)
import { useMutation } from "dist/react/index.js" (production) 2.74 KB (-0.04% 🔽)
import { useSubscription } from "dist/react/index.js" 3.21 KB (+0.04% 🔺)
import { useSubscription } from "dist/react/index.js" (production) 2.4 KB (-0.05% 🔽)
import { useSuspenseQuery } from "dist/react/index.js" 5.44 KB (0%)
import { useSuspenseQuery } from "dist/react/index.js" (production) 4.1 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" 4.96 KB (0%)
import { useBackgroundQuery } from "dist/react/index.js" (production) 3.61 KB (-0.03% 🔽)
import { useLoadableQuery } from "dist/react/index.js" 5.07 KB (-0.02% 🔽)
import { useLoadableQuery } from "dist/react/index.js" (production) 3.72 KB (-0.03% 🔽)
import { useReadQuery } from "dist/react/index.js" 3.33 KB (+0.03% 🔺)
import { useReadQuery } from "dist/react/index.js" (production) 3.27 KB (+0.03% 🔺)
import { useFragment } from "dist/react/index.js" 2.28 KB (-0.09% 🔽)
import { useFragment } from "dist/react/index.js" (production) 2.23 KB (-0.09% 🔽)
netlify[bot] commented 6 months ago

Deploy Preview for apollo-client-docs ready!

Name Link
Latest commit a8cc69ebdf2fc5ad97cb6bb0eeeaad36188709f0
Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/664bd16d1bbdc600089290aa
Deploy Preview https://deploy-preview-11862--apollo-client-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.