@apollo/[email protected]
@apollo/[email protected]
@apollo/client
Release Notes
Minor Changes
#13310
8ab63fcThanks @jerelmiller! - Introduce a new GraphQL Codegen plugin to generate the input object configuration needed to configure custom scalars for each field.// codegen.ts import type { CustomScalarsPluginConfig } from "@apollo/client-graphql-codegen/custom-scalars"; const config: CodegenConfig = { // ... generates: { "./path/to/custom-scalars.ts": { plugins: ["@apollo/client-graphql-codegen/custom-scalars"], config: { // ... } satisfies CustomScalarsPluginConfig, }, }, };This will generate an
inputObjectsobject in the generated file that can be used to configure theinputObjectsoption forInMemoryCache.import { inputObjects } from "./path/to/custom-scalars"; const cache = new InMemoryCache({ inputObjects, });#13318
01f255bThanks @jerelmiller! - The@apollo/client-graphql-codegen/custom-scalarsGraphQL Codegen plugin now generates the type policy configuration needed to configure custom scalars for each field.// codegen.ts import type { CustomScalarsPluginConfig } from "@apollo/client-graphql-codegen/custom-scalars"; const config: CodegenConfig = { // ... generates: { "./path/to/custom-scalars.ts": { plugins: ["@apollo/client-graphql-codegen/custom-scalars"], config: { // ... } satisfies CustomScalarsPluginConfig, }, }, };This will generate a
scalarTypePoliciesobject in the generated file that can be used to configure type policies.import { scalarTypePolicies } from "./path/to/custom-scalars"; const cache = new InMemoryCache(); cache.policies.addTypePolicies(scalarTypePolicies);