@apollo/client
Version:
A fully-featured caching GraphQL client.
1 lines • 1.89 kB
Source Map (JSON)
{"version":3,"file":"bindCacheKey.cjs","sources":["../../../../src/utilities/internal/bindCacheKey.ts"],"sourcesContent":["import { defaultMakeCacheKey } from \"optimism\";\n\n/**\n * A variant of `optimism`'s `defaultMakeCacheKey` function that allows us to\n * pre-bind some arguments to be part of the cache key Trie path.\n *\n * This should always be used in place of `defaultMakeCacheKey` to bind\n * the `this` context of classes owning wrapped functions, to ensure that\n * the cache keys are collected from memory when the owning object is garbage collected.\n *\n * Without this, cache keys can stay in memory indefinitely, even though the owning\n * Apollo Client instance is long gone.\n * This is a risk in long-running processes with `[DocumentNode, string, string]`\n * style cache keys with persistent document nodes.\n */\nexport function bindCacheKey(...prebound: object[]): (...args: any) => object {\n return defaultMakeCacheKey.bind(null, ...prebound);\n}\n"],"names":[],"mappings":";;AAeA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAfA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA;;;;;;;;;;;;CAYA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAC,CAA7B,CAAA,CAAgC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkD,EAAlD;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAC,CAA7B,CAAA,CAAA,CAAiC,CAAC,CAAlC,CAAA,CAAA,CAAsC,EAAE,CAAxC,CAAA,CAA2C,CAA3C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmD,CAAC;AACpD;"}